@danderson00/react-forms-material 0.0.39 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.js +2 -2
package/dist/index.js
CHANGED
|
@@ -11,6 +11,12 @@ Object.defineProperty(exports, "Group", {
|
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
exports.Text = exports.Submit = exports.Select = exports.RadioButton = exports.Radio = exports.Input = void 0;
|
|
14
|
+
Object.defineProperty(exports, "useForm", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _reactForms.useForm;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
14
20
|
Object.defineProperty(exports, "useFormValues", {
|
|
15
21
|
enumerable: true,
|
|
16
22
|
get: function get() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ErrorMessage","error","createElement","MuiFormHelperText","children","extractErrorMessage","Form","FormProvider","context","Provider","margin","Submit","wrapSubmit","MuiButton","Button","wrapped","component","options","baseOptions","wrapInput","base","passErrorProp","alwaysShrinkLabel","shrinkLabel","shrinkLabelOption","passError","className","hiddenLabel","variant","label","helperText","valid","pattern","inputProps","MuiFormControl","type","fullWidth","required","MuiInputLabel","key","htmlFor","id","shrink","Input","MuiInput","Text","Checkbox","MuiCheckbox","RadioButton","MuiRadio","Radio","createRawConsumer","name","values","labels","numeric","getFieldValue","getFieldValues","props","MuiRadioGroup","map","value","index","Select","MuiSelect","MuiMenuItem","wrapField"],"sources":["../src/index.js"],"sourcesContent":["import { createElement } from 'react'\nimport { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useFormValues } from '@danderson00/react-forms'\nimport { extractErrorMessage } from '@danderson00/react-forms/dist/ErrorMessage'\nimport MuiButton from '@material-ui/core/Button'\nimport MuiCheckbox from '@material-ui/core/Checkbox'\nimport MuiFormControl from '@material-ui/core/FormControl'\nimport MuiFormHelperText from '@material-ui/core/FormHelperText'\nimport MuiInput from '@material-ui/core/Input'\nimport MuiInputLabel from '@material-ui/core/InputLabel'\nimport MuiMenuItem from '@material-ui/core/MenuItem'\nimport MuiRadio from '@material-ui/core/Radio'\nimport MuiRadioGroup from '@material-ui/core/RadioGroup'\nimport MuiSelect from '@material-ui/core/Select'\nimport './styles'\n\nexport const ErrorMessage = ({ error }) => createElement(MuiFormHelperText, { children: extractErrorMessage(error), error: true })\nexport const Form = FormProvider(context.Provider, { margin: 'dense' }, ErrorMessage)\nexport const Submit = wrapSubmit(MuiButton)\nexport const Button = MuiButton\nexport { useFormValues, Group, wrapInput }\n\nconst wrapped = (component, options, baseOptions) => wrapInput(\n base(component, options, baseOptions),\n { passErrorProp: true, ...options }\n)\n\nconst base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true, passError } = {}) => (\n ({ className, error, hiddenLabel, variant, margin, label, helperText, shrinkLabel, valid, pattern, ...inputProps }) => (\n createElement(MuiFormControl, {\n className: `react-forms-material-field${options.type ? ` react-forms-material-${options.type}` : ''}${className ? ` ${className}` : ''}`,\n error,\n fullWidth: inputProps.fullWidth,\n hiddenLabel,\n required: inputProps.required,\n variant,\n margin,\n children: [\n ...(label ? [createElement(MuiInputLabel, {\n key: 'label',\n htmlFor: inputProps.id,\n children: label,\n ...(shrinkLabelOption === false && { shrink: false }),\n ...((alwaysShrinkLabel || shrinkLabel) && { className: 'MuiInputLabel-shrink' }),\n })] : []),\n\n createElement(component, {\n key: 'input',\n variant,\n ...(passError && { error }),\n ...inputProps,\n inputProps: { ...(pattern && { pattern }), ...inputProps.inputProps }\n }),\n\n ...(helperText ? [createElement(MuiFormHelperText, {\n key: 'helperText',\n children: helperText\n })] : [])\n ]\n })\n )\n)\n\nexport const Input = wrapInput(MuiInput)\nexport const Text = wrapped(MuiInput)\nexport const Checkbox = wrapped(MuiCheckbox, { type: 'checkbox' }, { alwaysShrinkLabel: true })\nexport const RadioButton = wrapped(MuiRadio, { type: 'radio' }, { shrinkLabel: false })\n\nexport const Radio = createRawConsumer(base(\n ({ name, values, labels, numeric, required, getFieldValue, getFieldValues, ...props }) => (\n createElement(MuiRadioGroup, { ...props, children: [\n values.map((value, index) =>\n createElement(RadioButton, {\n name,\n value,\n numeric,\n key: value,\n label: (labels && labels[index]) || value,\n margin: props.margin,\n ...(required && { required })\n })\n )\n ] })\n ),\n { type: 'radiogroup' },\n { alwaysShrinkLabel: true }\n))\n\nexport const Select = wrapped(({ values, labels, ...props }) =>\n createElement(MuiSelect, { ...props, children:\n values.map((value, index) =>\n createElement(MuiMenuItem, {\n value,\n key: value,\n children: (labels && labels[index]) || value,\n ...(props.required && { required: props.required })\n })\n )\n }),\n { type: 'select' },\n { alwaysShrinkLabel: true }\n)\n\nexport const wrapField = wrapped"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["ErrorMessage","error","createElement","MuiFormHelperText","children","extractErrorMessage","Form","FormProvider","context","Provider","margin","Submit","wrapSubmit","MuiButton","Button","wrapped","component","options","baseOptions","wrapInput","base","passErrorProp","alwaysShrinkLabel","shrinkLabel","shrinkLabelOption","passError","className","hiddenLabel","variant","label","helperText","valid","pattern","inputProps","MuiFormControl","type","fullWidth","required","MuiInputLabel","key","htmlFor","id","shrink","Input","MuiInput","Text","Checkbox","MuiCheckbox","RadioButton","MuiRadio","Radio","createRawConsumer","name","values","labels","numeric","getFieldValue","getFieldValues","props","MuiRadioGroup","map","value","index","Select","MuiSelect","MuiMenuItem","wrapField"],"sources":["../src/index.js"],"sourcesContent":["import { createElement } from 'react'\nimport { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useForm, useFormValues } from '@danderson00/react-forms'\nimport { extractErrorMessage } from '@danderson00/react-forms/dist/ErrorMessage'\nimport MuiButton from '@material-ui/core/Button'\nimport MuiCheckbox from '@material-ui/core/Checkbox'\nimport MuiFormControl from '@material-ui/core/FormControl'\nimport MuiFormHelperText from '@material-ui/core/FormHelperText'\nimport MuiInput from '@material-ui/core/Input'\nimport MuiInputLabel from '@material-ui/core/InputLabel'\nimport MuiMenuItem from '@material-ui/core/MenuItem'\nimport MuiRadio from '@material-ui/core/Radio'\nimport MuiRadioGroup from '@material-ui/core/RadioGroup'\nimport MuiSelect from '@material-ui/core/Select'\nimport './styles'\n\nexport const ErrorMessage = ({ error }) => createElement(MuiFormHelperText, { children: extractErrorMessage(error), error: true })\nexport const Form = FormProvider(context.Provider, { margin: 'dense' }, ErrorMessage)\nexport const Submit = wrapSubmit(MuiButton)\nexport const Button = MuiButton\nexport { useForm, useFormValues, Group, wrapInput }\n\nconst wrapped = (component, options, baseOptions) => wrapInput(\n base(component, options, baseOptions),\n { passErrorProp: true, ...options }\n)\n\nconst base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true, passError } = {}) => (\n ({ className, error, hiddenLabel, variant, margin, label, helperText, shrinkLabel, valid, pattern, ...inputProps }) => (\n createElement(MuiFormControl, {\n className: `react-forms-material-field${options.type ? ` react-forms-material-${options.type}` : ''}${className ? ` ${className}` : ''}`,\n error,\n fullWidth: inputProps.fullWidth,\n hiddenLabel,\n required: inputProps.required,\n variant,\n margin,\n children: [\n ...(label ? [createElement(MuiInputLabel, {\n key: 'label',\n htmlFor: inputProps.id,\n children: label,\n ...(shrinkLabelOption === false && { shrink: false }),\n ...((alwaysShrinkLabel || shrinkLabel) && { className: 'MuiInputLabel-shrink' }),\n })] : []),\n\n createElement(component, {\n key: 'input',\n variant,\n ...(passError && { error }),\n ...inputProps,\n inputProps: { ...(pattern && { pattern }), ...inputProps.inputProps }\n }),\n\n ...(helperText ? [createElement(MuiFormHelperText, {\n key: 'helperText',\n children: helperText\n })] : [])\n ]\n })\n )\n)\n\nexport const Input = wrapInput(MuiInput)\nexport const Text = wrapped(MuiInput)\nexport const Checkbox = wrapped(MuiCheckbox, { type: 'checkbox' }, { alwaysShrinkLabel: true })\nexport const RadioButton = wrapped(MuiRadio, { type: 'radio' }, { shrinkLabel: false })\n\nexport const Radio = createRawConsumer(base(\n ({ name, values, labels, numeric, required, getFieldValue, getFieldValues, ...props }) => (\n createElement(MuiRadioGroup, { ...props, children: [\n values.map((value, index) =>\n createElement(RadioButton, {\n name,\n value,\n numeric,\n key: value,\n label: (labels && labels[index]) || value,\n margin: props.margin,\n ...(required && { required })\n })\n )\n ] })\n ),\n { type: 'radiogroup' },\n { alwaysShrinkLabel: true }\n))\n\nexport const Select = wrapped(({ values, labels, ...props }) =>\n createElement(MuiSelect, { ...props, children:\n values.map((value, index) =>\n createElement(MuiMenuItem, {\n value,\n key: value,\n children: (labels && labels[index]) || value,\n ...(props.required && { required: props.required })\n })\n )\n }),\n { type: 'select' },\n { alwaysShrinkLabel: true }\n)\n\nexport const wrapField = wrapped"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,YAAY,GAAG,SAAfA,YAAe;EAAA,IAAGC,KAAH,QAAGA,KAAH;EAAA,oBAAe,IAAAC,oBAAA,EAAcC,0BAAd,EAAiC;IAAEC,QAAQ,EAAE,IAAAC,iCAAA,EAAoBJ,KAApB,CAAZ;IAAwCA,KAAK,EAAE;EAA/C,CAAjC,CAAf;AAAA,CAArB;;;AACA,IAAMK,IAAI,GAAG,IAAAC,wBAAA,EAAaC,mBAAA,CAAQC,QAArB,EAA+B;EAAEC,MAAM,EAAE;AAAV,CAA/B,EAAoDV,YAApD,CAAb;;AACA,IAAMW,MAAM,GAAG,IAAAC,sBAAA,EAAWC,kBAAX,CAAf;;AACA,IAAMC,MAAM,GAAGD,kBAAf;;;AAGP,IAAME,OAAO,GAAG,SAAVA,OAAU,CAACC,SAAD,EAAYC,OAAZ,EAAqBC,WAArB;EA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AGkD,MAAM,IAAIA,MAAM,CAACQ,KAAD,CAAjB,IAA6BD;MAHzC,GAIMH,KAAK,CAACrB,QAAN,IAAkB;QAAEA,QAAQ,EAAEqB,KAAK,CAACrB;MAAlB,CAJxB,EADS;IAAA,CAAX;EADF,GAD4B;AAAA,CAAD,EAW3B;EAAEF,IAAI,EAAE;AAAR,CAX2B,EAY3B;EAAEb,iBAAiB,EAAE;AAArB,CAZ2B,CAAtB;;AAeA,IAAM4C,SAAS,GAAGnD,OAAlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danderson00/react-forms-material",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.41",
|
|
4
4
|
"description": "Beautiful, ultra simple, stateless, validated forms for use in React function components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"prepare": "babel src --source-maps --out-dir dist"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@danderson00/react-forms": "0.0.
|
|
13
|
+
"@danderson00/react-forms": "0.0.41",
|
|
14
14
|
"@material-ui/core": "^4.11.3"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElement } from 'react'
|
|
2
|
-
import { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useFormValues } from '@danderson00/react-forms'
|
|
2
|
+
import { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useForm, useFormValues } from '@danderson00/react-forms'
|
|
3
3
|
import { extractErrorMessage } from '@danderson00/react-forms/dist/ErrorMessage'
|
|
4
4
|
import MuiButton from '@material-ui/core/Button'
|
|
5
5
|
import MuiCheckbox from '@material-ui/core/Checkbox'
|
|
@@ -17,7 +17,7 @@ export const ErrorMessage = ({ error }) => createElement(MuiFormHelperText, { ch
|
|
|
17
17
|
export const Form = FormProvider(context.Provider, { margin: 'dense' }, ErrorMessage)
|
|
18
18
|
export const Submit = wrapSubmit(MuiButton)
|
|
19
19
|
export const Button = MuiButton
|
|
20
|
-
export { useFormValues, Group, wrapInput }
|
|
20
|
+
export { useForm, useFormValues, Group, wrapInput }
|
|
21
21
|
|
|
22
22
|
const wrapped = (component, options, baseOptions) => wrapInput(
|
|
23
23
|
base(component, options, baseOptions),
|