{"_id":"@a-2-c-2-anpm/debitis-qui-repudiandae","name":"@a-2-c-2-anpm/debitis-qui-repudiandae","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@a-2-c-2-anpm/debitis-qui-repudiandae","version":"1.0.0","description":"[![Travis build status](https://img.shields.io/travis/a-2-c-2-anpm/debitis-qui-repudiandae/develop.svg)](https://travis-ci.org/a-2-c-2-anpm/debitis-qui-repudiandae) [![Coverage](https://img.shields.io/coveralls/a-2-c-2-anpm/debitis-qui-repudiandae/develop","main":"index.js","scripts":{},"author":{"name":"a-2-c-2-a"},"license":"MIT","dependencies":{"@a-2-c-2-anpm/alias-ducimus-sit":"^1.0.0","@a-2-c-2-anpm/atque-nemo-accusantium":"^1.0.0","@a-2-c-2-anpm/distinctio-quibusdam-culpa":"^1.0.0","@a-2-c-2-anpm/eligendi-praesentium-hic":"^1.0.0","@a-2-c-2-anpm/enim-amet-voluptatem":"^1.0.0","@a-2-c-2-anpm/error-dolorem-a":"^1.0.0","@a-2-c-2-anpm/excepturi-natus-facere":"^1.0.0","@a-2-c-2-anpm/expedita-recusandae-aut":"^1.0.0","@a-2-c-2-anpm/fugit-impedit-quae":"^1.0.0","@a-2-c-2-anpm/hic-maiores-accusantium":"^1.0.0","@a-2-c-2-anpm/laborum-exercitationem-quis":"^1.0.0","@a-2-c-2-anpm/laudantium-dolor-perspiciatis":"^1.0.0","@a-2-c-2-anpm/maiores-quis-dignissimos":"^1.0.0","@a-2-c-2-anpm/nam-eaque-occaecati":"^1.0.0","@a-2-c-2-anpm/neque-culpa-culpa":"^1.0.0","@a-2-c-2-anpm/neque-iste-eum":"^1.0.0","@a-2-c-2-anpm/nobis-similique-magni":"^1.0.0","@a-2-c-2-anpm/officia-tempore-ipsa":"^1.0.0","@a-2-c-2-anpm/perferendis-qui-suscipit":"^1.0.0","@a-2-c-2-anpm/placeat-suscipit-cumque":"^1.0.0","@a-2-c-2-anpm/quo-quia-expedita":"^1.0.0","@a-2-c-2-anpm/quos-voluptates-excepturi":"^1.0.0","@a-2-c-2-anpm/saepe-praesentium-iusto":"^1.0.0","@a-2-c-2-anpm/sint-ipsa-atque":"^1.0.0","@a-2-c-2-anpm/vitae-ad-molestiae":"^1.0.0","@ajhgwdjnpm/quas-mollitia-aspernatur-reprehenderit":"^1.0.0","calculator-3rd":"^1.0.12","mi-dex-func-3":"^1.0.0","vnhat-button-component":"^1.0.0","vnhat-forminput-component":"^1.0.1"},"keywords":["colour","bound","tape","predictable","Function.prototype.name","warning","style","configurable","open","redact","entries","symlink","browser","xhr","typedarray","kinesis","parser","some","Object.fromEntries","quote","less compiler","preprocessor","extension","authentication","tdd","loading","Symbol.toStringTag","text","sharedarraybuffer","hooks","crypto","trimRight","stateless","concurrency","es8","spinners","dependencies","ebs","date","compile less","autoscaling","password","typedarrays","ECMAScript 2023","tap","callback","testing","internal","postcss","css-in-js","from"],"repository":{"type":"git","url":"git+https://github.com/a-2-c-2-anpm/debitis-qui-repudiandae.git"},"homepage":"https://github.com/a-2-c-2-anpm/debitis-qui-repudiandae/#readme","bugs":{"url":"https://github.com/a-2-c-2-anpm/debitis-qui-repudiandae/issues"},"_id":"@a-2-c-2-anpm/debitis-qui-repudiandae@1.0.0","gitHead":"d994ba8ef85ee2b4a32f13165e25512dce696715","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-SnzrU9W1BVosUEyF1N6/tsgmku3kRAo3AdMkGitV+c2rppN2x1/xR/F2Ee+IpEhtlkYNPRyoVjAWnJXny4nemg==","shasum":"6e214e17f20dfd9ae1ae26e5bdf5939ce242c7b6","tarball":"https://registry.npmjs.org/@a-2-c-2-anpm/debitis-qui-repudiandae/-/debitis-qui-repudiandae-1.0.0.tgz","fileCount":8,"unpackedSize":13952,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH7cnIVsA+ZoIZGvLnYsDC1faoVmF2U+8Njmhdubbg+YAiEA3Vwksf23P6KJysMwMhVcH7ZDsterLMgWDu9Z7u+KMWI="}]},"_npmUser":{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"},"directories":{},"maintainers":[{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/debitis-qui-repudiandae_1.0.0_1714842062494_0.32745629111256647"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-04T17:01:02.317Z","1.0.0":"2024-05-04T17:01:02.663Z","modified":"2024-05-04T17:01:02.975Z"},"maintainers":[{"name":"tranduc345zz","email":"tranduc345zz@gmail.com"}],"description":"[![Travis build status](https://img.shields.io/travis/a-2-c-2-anpm/debitis-qui-repudiandae/develop.svg)](https://travis-ci.org/a-2-c-2-anpm/debitis-qui-repudiandae) [![Coverage](https://img.shields.io/coveralls/a-2-c-2-anpm/debitis-qui-repudiandae/develop","homepage":"https://github.com/a-2-c-2-anpm/debitis-qui-repudiandae/#readme","keywords":["colour","bound","tape","predictable","Function.prototype.name","warning","style","configurable","open","redact","entries","symlink","browser","xhr","typedarray","kinesis","parser","some","Object.fromEntries","quote","less compiler","preprocessor","extension","authentication","tdd","loading","Symbol.toStringTag","text","sharedarraybuffer","hooks","crypto","trimRight","stateless","concurrency","es8","spinners","dependencies","ebs","date","compile less","autoscaling","password","typedarrays","ECMAScript 2023","tap","callback","testing","internal","postcss","css-in-js","from"],"repository":{"type":"git","url":"git+https://github.com/a-2-c-2-anpm/debitis-qui-repudiandae.git"},"author":{"name":"a-2-c-2-a"},"bugs":{"url":"https://github.com/a-2-c-2-anpm/debitis-qui-repudiandae/issues"},"license":"MIT","readme":"# React Forms\n\n[![Travis build status](https://img.shields.io/travis/a-2-c-2-anpm/debitis-qui-repudiandae/develop.svg)](https://travis-ci.org/a-2-c-2-anpm/debitis-qui-repudiandae) [![Coverage](https://img.shields.io/coveralls/a-2-c-2-anpm/debitis-qui-repudiandae/develop.svg)](https://coveralls.io/github/a-2-c-2-anpm/debitis-qui-repudiandae)\n\nReact Forms library provides a set of tools for [React][] to handle form\nrendering and validation.\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n**Table of Contents**\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Validation](#validation)\n  - [API Reference](#api-reference)\n    - [`<Field />`](#field-)\n    - [`<Fieldset />`](#fieldset-)\n    - [`createValue({schema, value, onChange})`](#createvalueschema-value-onchange)\n    - [`WithFormValue(Component)`](#withformvaluecomponent)\n  - [Howto Guides](#howto-guides)\n    - [Customizing form fields](#customizing-form-fields)\n    - [Pattern for reusable forms](#pattern-for-reusable-forms)\n- [Examples](#examples)\n- [Credits](#credits)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n## Installation\n\nTo use version documented here you need to install `beta` tag from npm:\n\n    % npm install react-forms@beta\n\nYou would probably also need a module bundler such as [Browserify][] or\n[Webpack][] as React Forms is distributed as a set of CommonJS modules.\n\n## Usage\n\nReact Forms doesn't provide any `<Form />` component, instead it makes\nimplementing form components an easy task.\n\nNote that examples are written using ES2015 syntax. You would probably use\n[Babel][] with `es2015` and `react` presets enabled to compile code to ES5 which\nis compatible with most of the current runtimes.\n\n### Basic form component.\n\nThis is the example where form value is managed as a part of local component\nstate. Some might put form value in a Flux/Redux store instead.\n\n```js\nimport React from 'react'\nimport {Fieldset, Field, createValue} from 'react-forms'\n\nclass Form extends React.Component {\n\n  constructor(props) {\n    super(props)\n    let formValue = createValue({\n      value: props.value,\n      onChange: this.onChange.bind(this)\n    })\n    this.state = {formValue}\n  }\n\n  onChange(formValue) {\n    this.setState({formValue})\n  }\n\n  render() {\n    return (\n      <Fieldset formValue={this.state.formValue}>\n        <Field select=\"firstName\" label=\"First name\" />\n        <Field select=\"lastName\" label=\"Last name\" />\n      </Fieldset>\n    )\n  }\n}\n```\n\nThen you can use `<Form />` component like any regular React component:\n\n```js\nimport {render} from 'react-dom'\n\nrender(\n  <Form value={{firstName: 'Michael', lastName: 'Jackson'}} />,\n  document.getElementById('form')\n)\n```\n\n### Validation\n\nReact Forms can validate form value using [JSON schema][]:\n\n```js\nlet schema = {\n  type: 'object',\n  properties: {\n    firstName: {type: 'string'},\n    lastName: {type: 'string'}\n  }\n}\n```\n\nSimply pass it to a `createValue(..)` function:\n\n```js\nlet formValue = createValue({value, onChange, schema})\n```\n\n### API Reference\n\n#### `<Field />`\n\n#### `<Fieldset />`\n\n#### `createValue({schema, value, onChange})`\n\n#### `WithFormValue(Component)`\n\n### Howto Guides\n\n#### Customizing form fields\n\nAll components in React Forms conform to [React Stylesheet][] API. That means\nthat for injecting customization one needs `react-stylesheet` package to be\ninstalled:\n\n    % npm install react-stylesheet\n\nCustomizing label rendering:\n\n```js\nimport React from 'react'\nimport {style} from 'react-stylesheet'\nimport {Field as BaseField, Label as BaseLabel} from 'react-forms'\n\nfunction Label({label, schema}) {\n  return <BaseLabel className=\"my-label\" label={label} schema={schema} />\n}\n\nlet Field = style(BaseField, {\n  Label: Label\n})\n```\n\nCustomizing error list rendering:\n\n```js\nimport React from 'react'\nimport {style} from 'react-stylesheet'\nimport {Field as BaseField, ErrorList as BaseErrorList} from 'react-forms'\n\nfunction ErrorList({formValue}) {\n  return <BaseErrorList className=\"my-error-list\" formValue={formValue} />\n}\n\nlet Field = style(BaseField, {\n  ErrorList: ErrorList\n})\n```\n\nForm field with custom input component:\n\n```js\nimport React from 'react'\nimport {Field} from 'react-forms'\nimport Datepicker from 'datepicker'\n\nfunction DateField(props) {\n  return <Field {...props} Input={Datepicker} />\n}\n```\n\nImplementing form field component from scratch:\n\n```js\nimport React from 'react'\nimport {WithFormValue} from 'react-forms'\n\nclass Field extends React.Component {\n\n  render() {\n    let {formValue} = this.props\n    return (\n      <div>\n        <label>{formValue.schema.label}</label>\n        <input value={formValue.value} onChange={this.onChange} />\n      </div>\n    )\n  }\n\n  onChange = (e) => this.props.formValue.update(e.target.value)\n}\n\nField = WithFormValue(Field);\n```\n\n#### Pattern for reusable forms\n\n```js\nimport React from 'react'\nimport {Fieldset} from 'react-forms'\n\nclass IndividualFieldset extends React.Component {\n\n  static schema = {\n    type: 'object',\n    properties: {\n      firstName: {type: 'string'},\n      lastName: {type: 'string'}\n    }\n  }\n\n  static value = {\n    firstName: 'John',\n    lastName: 'Doe'\n  }\n\n  render() {\n    let {label, ...props} = this.props\n    return (\n      <Fieldset {...props}>\n        <label>{label}</label>\n        <Field\n          select=\"firstName\"\n          label=\"First name\"\n          />\n        <Field\n          select=\"lastName\"\n          label=\"Last name\"\n          />\n      </Fieldset>\n    )\n  }\n}\n```\n\nLater you can compose schema and initial form value using `IndividualFieldset.schema`\nand `IndividualFieldset.value` static properties and use `<IndividualFieldset />` component\nitself for rendering.\n\n```js\nlet schema = {\n  type: 'object',\n  properties: {\n    mother: IndividualFieldset.schema,\n    father: IndividualFieldset.schema\n  }\n}\n\nlet value = {\n  mother: IndividualFieldset.value,\n  father: IndividualFieldset.value\n}\n\nclass FamilyForm extends React.Component {\n\n  constructor(props) {\n    super(props)\n    this.state = {formValue: createValue({schema, value, this.onChange})}\n  }\n\n  onChange = (nextFormValue) => {\n    this.setState({formValue: nextFormValue})\n  }\n\n  render() {\n    return (\n      <Fieldset formValue={this.state.formValue}>\n        <IndividualFieldset\n          select=\"mother\"\n          label=\"Mother\"\n          />\n        <IndividualFieldset\n          select=\"father\"\n          label=\"Father\"\n          />\n      </Fieldset>\n    )\n  }\n}\n```\n\n## Examples\n\nExamples are located at `examples` folder. To run.\n\n```js\ncd examples\nnpm install\nnpm start\n```\nopen http://localhost:4000 in browser\n\n## Credits\n\nReact Forms is free software created by [Prometheus Research, LLC][] and is\nreleased under the MIT license.\n\n[React]: http://facebook.github.io/react/\n[React Stylesheet]: https://github.com/prometheusresearch/react-stylesheet\n[Prometheus Research, LLC]: http://prometheusresearch.com\n[JSON schema]: http://json-schema.org/documentation.html\n[Browserify]: http://browserify.org/\n[Webpack]: https://webpack.github.io/docs/\n[Babel]: http://babeljs.io/\n","readmeFilename":"README.md"}