{"id":26246159,"url":"https://github.com/zillow/redux-inputs","last_synced_at":"2025-04-23T20:26:50.265Z","repository":{"id":10113872,"uuid":"64522992","full_name":"zillow/redux-inputs","owner":"zillow","description":"redux-inputs is a Javascript library that works with redux to validate and store values from inputs and forms.","archived":false,"fork":false,"pushed_at":"2023-01-06T01:32:01.000Z","size":2888,"stargazers_count":102,"open_issues_count":18,"forks_count":10,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-13T18:09:31.789Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zillow.github.io/redux-inputs/examples/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zillow.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-30T02:57:57.000Z","updated_at":"2025-03-20T12:51:14.000Z","dependencies_parsed_at":"2023-01-13T15:45:03.146Z","dependency_job_id":null,"html_url":"https://github.com/zillow/redux-inputs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zillow%2Fredux-inputs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zillow%2Fredux-inputs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zillow%2Fredux-inputs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zillow%2Fredux-inputs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zillow","download_url":"https://codeload.github.com/zillow/redux-inputs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250508075,"owners_count":21442155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-13T13:17:30.770Z","updated_at":"2025-04-23T20:26:50.237Z","avatar_url":"https://github.com/zillow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-inputs\n[![npm version](https://badge.fury.io/js/redux-inputs.svg)](https://badge.fury.io/js/redux-inputs)\n[![Build Status](https://travis-ci.org/zillow/redux-inputs.svg?branch=master)](https://travis-ci.org/zillow/redux-inputs)\n\n`redux-inputs` works with redux to validate and store values from inputs and forms.\n\n## Features\n\n- Declarative validation\n- Declarative parsing\n- Declarative formatting\n- Async validation\n- Per-input validation\n- Cross-field validation\n- Custom input components\n- Programatic value collection\n- Programatic value initialization\n- Programatic value modification\n- Programatic input reset\n\n\n## Docs\n\n- [Getting Started](docs/gettingStarted.md)\n- [API](docs/api.md)\n- [Examples](https://zillow.github.io/redux-inputs/examples/)\n\n## Installation\n\n`npm install --save redux-inputs`\n\n## Single File Example\n\n```jsx\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { createStore, combineReducers, applyMiddleware } from 'redux';\nimport { createInputsReducer, connectWithInputs, ReduxInputsWrapper } from 'redux-inputs';\nimport { Provider } from 'react-redux';\nimport thunk from 'redux-thunk';\n\n// Define configuration for this form. A single input named 'email' with a default value and a function to determine validity.\nconst inputsConfig = {\n    email: {\n        defaultValue: 'test@example.com',\n        validator: (value) =\u003e typeof value === 'string' \u0026\u0026 value.indexOf('@') \u003e= 0\n    }\n};\n\n// Create redux store with a reducer created with the createInputsReducer function.\nconst reducer = combineReducers({\n    inputs: createInputsReducer(inputsConfig)\n});\nconst store = createStore(reducer, applyMiddleware(thunk));\n\n// Define our own Field component, and wrap it in a ReduxInputsWrapper to easily create a compatible input component.\n// Integration with other ui component libraries, such as material-ui, would be done here.\nconst Field = ({id, value, error, onChange, errorText}) =\u003e (\n    \u003cdiv\u003e\n        \u003cinput name={id} value={value} onChange={(e) =\u003e onChange(e.target.value)}/\u003e\n        {error ? \u003cp style={{color: 'red'}}\u003e{errorText}\u003c/p\u003e : null}\n    \u003c/div\u003e\n);\nconst ReduxInputsField = ReduxInputsWrapper(Field);\n\n// Use the newly created ReduxInputsField by spreading in reduxInputs.inputProps.email object.\nconst Form = ({ inputs, reduxInputs }) =\u003e (\n    \u003cform\u003e\n        \u003cReduxInputsField errorText=\"Your email must contain an @\" {...reduxInputs.inputProps.email}/\u003e\n        \u003ch3\u003eInput state\u003c/h3\u003e\n        \u003cpre\u003e{JSON.stringify(inputs, null, 2)}\u003c/pre\u003e\n    \u003c/form\u003e\n);\n\n// Hook the form up to the store with connectWithInputs, a wrapped version of react-redux's connect.\nconst FormContainer = connectWithInputs(inputsConfig)(s =\u003e s)(Form);\nReactDOM.render(\u003cProvider store={store}\u003e\u003cFormContainer /\u003e\u003c/Provider\u003e, document.getElementById('container'));\n```\n\n## Contributing\n\n### Build\n\n    npm i\n\n    npm run build\n\n### Examples\n\n    npm run watch-examples \u0026 npm run serve-examples\n\n### Tests\n\n    npm test\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzillow%2Fredux-inputs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzillow%2Fredux-inputs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzillow%2Fredux-inputs/lists"}