@danderson00/react-forms-material 0.0.46 → 0.0.48

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/README.md CHANGED
@@ -1,145 +1,145 @@
1
- # @danderson00/react-forms-material
2
-
3
- Beautiful, ultra simple, stateless, validated forms for use in React function components.
4
-
5
- A demo is available at [https://danderson00digital.github.io/react-forms-material/](https://danderson00digital.github.io/react-forms-material/).
6
-
7
- ## Installation
8
-
9
- ```shell
10
- yarn add @danderson00/react-forms-material
11
- ```
12
-
13
- ## Usage
14
-
15
- ```jsx
16
- import React from 'react'
17
- import { Form, Text, Select, Radio, Checkbox, Submit } from '@danderson00/react-forms-material'
18
-
19
- export default ({ onSubmit, initialValues }) => (
20
- <Form onSubmit={onSubmit} values={initialValues}>
21
- <Text name="name" label="Name" required minLength="5" maxLength="50" />
22
- <Text name="description" label="Description" multiline maxLength="100" />
23
- <Select name="type" label="Type" values={['', 'Widget', 'Component']} required />
24
- <Radio name="rating" label="Rating" values={[1, 2, 3]} row />
25
- <Checkbox name="urgent" label="Urgent" />
26
-
27
- <Submit>Submit</Submit>
28
- </Form>
29
- )
30
- ```
31
-
32
- ## Core Components
33
-
34
- ### `Form`
35
-
36
- All input components must be contained within a `Form` component.
37
-
38
- #### Props
39
-
40
- Name|Type|Description
41
- ---|---|---
42
- values|object|Object containing initial values for form elements
43
- onSubmit|function(values)|A callback to be executed when the corresponding `Submit` component is clicked
44
-
45
- All other props are passed on to the underlying `form` element.
46
-
47
- ### `Submit`
48
-
49
- Renders a Material UI [`Button` component](https://material-ui.com/api/button/) that triggers the closest `Form`
50
- component's `onSubmit` callback.
51
-
52
- #### Props
53
-
54
- All props are passed on to the underlying `Button` component.
55
-
56
- ### `Button`
57
-
58
- A pass through of the Material UI [`Button` component](https://material-ui.com/api/button/) for convenience.
59
-
60
- ## Field Components
61
-
62
- Field components are constructed by wrapping a Material UI [`InputLabel` component](https://material-ui.com/api/input-label/),
63
- a form component and [`FormHelperText` component](https://material-ui.com/api/form-helper-text/) within a
64
- [`FormControl` component](https://material-ui.com/api/form-control/), similar to a
65
- [`TextField` component](https://material-ui.com/api/text-field/).
66
-
67
- All field components can be passed the following props:
68
-
69
- Name|Type|Description
70
- ---|---|---
71
- name|string|Specifies the name of the property to populate with the field value (required)
72
- label|string|Text on the field's label
73
- value|any|Initial value for the field. The DOM API will generally cast this to a string
74
- helperText|string|Specifies the helper text for the field
75
-
76
- The following props are passed to the parent [`FormControl` component](https://material-ui.com/api/form-control/):
77
-
78
- Name|Type|Description
79
- ---|---|---
80
- className|string|Class name to apply to the component
81
- fullWidth|boolean|Specifies that the field should occupy the full width of its parent
82
- variant|string|Corresponds to the `variant` [prop](https://material-ui.com/api/form-control/#props) of a `FormControl`. One of `standard`, `outlined` or `filled`
83
- margin|string|Corresponds to the `margin` [prop](https://material-ui.com/api/form-control/#props) of a `FormControl`. One of `none`, `dense` or `normal`. Most fields, except `Text` default to `normal`
84
-
85
- All other props are passed to the input component, as described below.
86
-
87
- ### `Text`
88
-
89
- Renders a field component with a Material UI [`Input` component](https://material-ui.com/api/input/) as the input
90
- component.
91
-
92
- ### `Select`
93
-
94
- Renders a field component with a Material UI [`Select` component](https://material-ui.com/api/select/) as the input
95
- component. Options are specified using the props below and are rendered as
96
- [`MenuItem` components](https://material-ui.com/api/menu-item/).
97
-
98
- #### Props
99
-
100
- Name|Type|Description
101
- ---|---|---
102
- values|array(any)|Specifies the values to use for each option. The DOM API casts these to strings
103
- labels|array(string)|Specifies the labels to use for each corresponding option in the `values` array. If not specified, entries from the `values` array are used.
104
-
105
- ### `Radio`
106
-
107
- Renders a field component with a Material UI [`RadioGroup` component](https://material-ui.com/api/radio-group/) as the
108
- input component. Options are specified using the props below and are rendered as `RadioButton` components, described
109
- in the next section.
110
-
111
- #### Props
112
-
113
- Name|Type|Description
114
- ---|---|---
115
- values|array(any)|Specifies the values to use for each option. The DOM API casts these to strings
116
- labels|array(string)|Specifies the labels to use for each corresponding option in the `values` array. If not specified, entries from the `values` array are used
117
-
118
- ### `RadioButton`
119
-
120
- Renders a field component with a Material UI [`Radio` component](https://material-ui.com/api/radio/) as the input
121
- component.
122
-
123
- ### `Checkbox`
124
-
125
- Renders a field component with a Material UI [`Checkbox` component](https://material-ui.com/api/checkbox/) as the
126
- input component.
127
-
128
- ## License
129
-
130
- **The MIT License (MIT)**
131
-
132
- Copyright © 2022 Dale Anderson
133
-
134
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
135
- documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
136
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
137
- persons to whom the Software is furnished to do so, subject to the following conditions:
138
-
139
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
140
- Software.
141
-
142
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
143
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
144
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
145
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ # @danderson00/react-forms-material
2
+
3
+ Beautiful, ultra simple, stateless, validated forms for use in React function components.
4
+
5
+ A demo is available at [https://danderson00digital.github.io/react-forms-material/](https://danderson00digital.github.io/react-forms-material/).
6
+
7
+ ## Installation
8
+
9
+ ```shell
10
+ yarn add @danderson00/react-forms-material
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```jsx
16
+ import React from 'react'
17
+ import { Form, Text, Select, Radio, Checkbox, Submit } from '@danderson00/react-forms-material'
18
+
19
+ export default ({ onSubmit, initialValues }) => (
20
+ <Form onSubmit={onSubmit} values={initialValues}>
21
+ <Text name="name" label="Name" required minLength="5" maxLength="50" />
22
+ <Text name="description" label="Description" multiline maxLength="100" />
23
+ <Select name="type" label="Type" values={['', 'Widget', 'Component']} required />
24
+ <Radio name="rating" label="Rating" values={[1, 2, 3]} row />
25
+ <Checkbox name="urgent" label="Urgent" />
26
+
27
+ <Submit>Submit</Submit>
28
+ </Form>
29
+ )
30
+ ```
31
+
32
+ ## Core Components
33
+
34
+ ### `Form`
35
+
36
+ All input components must be contained within a `Form` component.
37
+
38
+ #### Props
39
+
40
+ Name|Type|Description
41
+ ---|---|---
42
+ values|object|Object containing initial values for form elements
43
+ onSubmit|function(values)|A callback to be executed when the corresponding `Submit` component is clicked
44
+
45
+ All other props are passed on to the underlying `form` element.
46
+
47
+ ### `Submit`
48
+
49
+ Renders a Material UI [`Button` component](https://material-ui.com/api/button/) that triggers the closest `Form`
50
+ component's `onSubmit` callback.
51
+
52
+ #### Props
53
+
54
+ All props are passed on to the underlying `Button` component.
55
+
56
+ ### `Button`
57
+
58
+ A pass through of the Material UI [`Button` component](https://material-ui.com/api/button/) for convenience.
59
+
60
+ ## Field Components
61
+
62
+ Field components are constructed by wrapping a Material UI [`InputLabel` component](https://material-ui.com/api/input-label/),
63
+ a form component and [`FormHelperText` component](https://material-ui.com/api/form-helper-text/) within a
64
+ [`FormControl` component](https://material-ui.com/api/form-control/), similar to a
65
+ [`TextField` component](https://material-ui.com/api/text-field/).
66
+
67
+ All field components can be passed the following props:
68
+
69
+ Name|Type|Description
70
+ ---|---|---
71
+ name|string|Specifies the name of the property to populate with the field value (required)
72
+ label|string|Text on the field's label
73
+ value|any|Initial value for the field. The DOM API will generally cast this to a string
74
+ helperText|string|Specifies the helper text for the field
75
+
76
+ The following props are passed to the parent [`FormControl` component](https://material-ui.com/api/form-control/):
77
+
78
+ Name|Type|Description
79
+ ---|---|---
80
+ className|string|Class name to apply to the component
81
+ fullWidth|boolean|Specifies that the field should occupy the full width of its parent
82
+ variant|string|Corresponds to the `variant` [prop](https://material-ui.com/api/form-control/#props) of a `FormControl`. One of `standard`, `outlined` or `filled`
83
+ margin|string|Corresponds to the `margin` [prop](https://material-ui.com/api/form-control/#props) of a `FormControl`. One of `none`, `dense` or `normal`. Most fields, except `Text` default to `normal`
84
+
85
+ All other props are passed to the input component, as described below.
86
+
87
+ ### `Text`
88
+
89
+ Renders a field component with a Material UI [`Input` component](https://material-ui.com/api/input/) as the input
90
+ component.
91
+
92
+ ### `Select`
93
+
94
+ Renders a field component with a Material UI [`Select` component](https://material-ui.com/api/select/) as the input
95
+ component. Options are specified using the props below and are rendered as
96
+ [`MenuItem` components](https://material-ui.com/api/menu-item/).
97
+
98
+ #### Props
99
+
100
+ Name|Type|Description
101
+ ---|---|---
102
+ values|array(any)|Specifies the values to use for each option. The DOM API casts these to strings
103
+ labels|array(string)|Specifies the labels to use for each corresponding option in the `values` array. If not specified, entries from the `values` array are used.
104
+
105
+ ### `Radio`
106
+
107
+ Renders a field component with a Material UI [`RadioGroup` component](https://material-ui.com/api/radio-group/) as the
108
+ input component. Options are specified using the props below and are rendered as `RadioButton` components, described
109
+ in the next section.
110
+
111
+ #### Props
112
+
113
+ Name|Type|Description
114
+ ---|---|---
115
+ values|array(any)|Specifies the values to use for each option. The DOM API casts these to strings
116
+ labels|array(string)|Specifies the labels to use for each corresponding option in the `values` array. If not specified, entries from the `values` array are used
117
+
118
+ ### `RadioButton`
119
+
120
+ Renders a field component with a Material UI [`Radio` component](https://material-ui.com/api/radio/) as the input
121
+ component.
122
+
123
+ ### `Checkbox`
124
+
125
+ Renders a field component with a Material UI [`Checkbox` component](https://material-ui.com/api/checkbox/) as the
126
+ input component.
127
+
128
+ ## License
129
+
130
+ **The MIT License (MIT)**
131
+
132
+ Copyright © 2022 Dale Anderson
133
+
134
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
135
+ documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
136
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
137
+ persons to whom the Software is furnished to do so, subject to the following conditions:
138
+
139
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
140
+ Software.
141
+
142
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
143
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
144
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
145
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/TODO.md CHANGED
@@ -1,2 +1,2 @@
1
- - Import specific components from @material-ui rather than everything from the main module (drastically reduce bundle size)
1
+ - Import specific components from @material-ui rather than everything from the main module (drastically reduce bundle size)
2
2
  - Change dependency on @material-ui to peerDependency of version "*" to prevent conflicts with user dependencies
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","require","_reactForms","_ErrorMessage","_Button","_interopRequireDefault","_Checkbox","_FormControl","_FormHelperText","_Input","_InputLabel","_MenuItem","_Radio","_RadioGroup","_Select","_excluded","_excluded2","_excluded3","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","_toConsumableArray","arr","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","TypeError","o","minLen","_arrayLikeToArray","n","Object","toString","call","slice","name","Array","from","test","iter","isArray","len","length","i","arr2","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","ownKeys","object","enumerableOnly","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","Number","ErrorMessage","_ref","error","createElement","MuiFormHelperText","children","extractErrorMessage","exports","Form","FormProvider","context","Provider","margin","Submit","wrapSubmit","MuiButton","Button","wrapped","component","options","baseOptions","wrapInput","base","passErrorProp","_ref2","alwaysShrinkLabel","_ref2$shrinkLabel","shrinkLabel","shrinkLabelOption","passError","_ref3","className","hiddenLabel","variant","label","helperText","valid","pattern","inputProps","MuiFormControl","concat","type","fullWidth","required","MuiInputLabel","htmlFor","id","shrink","Input","MuiInput","Text","Checkbox","MuiCheckbox","RadioButton","MuiRadio","Radio","createRawConsumer","_ref4","values","labels","numeric","getFieldValue","getFieldValues","props","MuiRadioGroup","map","index","Select","_ref5","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/src/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 return (\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)\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, inputProps, ...props }) => {\n return createElement(MuiRadioGroup, { ...props, children: [\n values.map((value, index) => {\n return 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 inputProps\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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,YAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,eAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,MAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,WAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,SAAA,GAAAN,sBAAA,CAAAJ,OAAA;AACA,IAAAW,MAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,WAAA,GAAAR,sBAAA,CAAAJ,OAAA;AACA,IAAAa,OAAA,GAAAT,sBAAA,CAAAJ,OAAA;AACAA,OAAA;AAAiB,IAAAc,SAAA;EAAAC,UAAA;EAAAC,UAAA;AAAA,SAAAZ,uBAAAa,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,QAAAF,GAAA,sCAAAE,OAAA,wBAAAC,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAJ,GAAA,kBAAAA,GAAA,gBAAAA,GAAA,WAAAA,GAAA,yBAAAG,MAAA,IAAAH,GAAA,CAAAK,WAAA,KAAAF,MAAA,IAAAH,GAAA,KAAAG,MAAA,CAAAG,SAAA,qBAAAN,GAAA,KAAAE,OAAA,CAAAF,GAAA;AAAA,SAAAO,mBAAAC,GAAA,WAAAC,kBAAA,CAAAD,GAAA,KAAAE,gBA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AAA,CAAC,EACF;EAAEG,IAAI,EAAE;AAAa,CAAC,EACtB;EAAEhB,iBAAiB,EAAE;AAAM,CAC7B,CAAC,CAAC;AAAAlB,OAAA,CAAAgD,KAAA,GAAAA,KAAA;AAEK,IAAMY,MAAM,GAAGlD,OAAO,CAAC,UAAAmD,KAAA;EAAA,IAAGV,MAAM,GAAAU,KAAA,CAANV,MAAM;IAAEC,MAAM,GAAAS,KAAA,CAANT,MAAM;IAAKI,KAAK,GAAA1G,wBAAA,CAAA+G,KAAA,EAAAhJ,UAAA;EAAA,oBACvD,IAAA+E,oBAAa,EAACkE,kBAAS,EAAA1F,aAAA,CAAAA,aAAA,KAAOoF,KAAK;IAAE1D,QAAQ,EAC3CqD,MAAM,CAACO,GAAG,CAAC,UAAC/E,KAAK,EAAEgF,KAAK;MAAA,oBACtB,IAAA/D,oBAAa,EAACmE,oBAAW,EAAA3F,aAAA;QACvBO,KAAK,EAALA,KAAK;QACLxB,GAAG,EAAEwB,KAAK;QACVmB,QAAQ,EAAGsD,MAAM,IAAIA,MAAM,CAACO,KAAK,CAAC,IAAKhF;MAAK,GACxC6E,KAAK,CAACpB,QAAQ,IAAI;QAAEA,QAAQ,EAAEoB,KAAK,CAACpB;MAAS,CAAC,CACnD,CAAC;IAAA,CACJ;EAAC,EACF,CAAC;AAAA,GACF;EAAEF,IAAI,EAAE;AAAS,CAAC,EAClB;EAAEhB,iBAAiB,EAAE;AAAM,CAC7B,CAAC;AAAAlB,OAAA,CAAA4D,MAAA,GAAAA,MAAA;AAEM,IAAMI,SAAS,GAAGtD,OAAO;AAAAV,OAAA,CAAAgE,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"file":"index.js","names":["_react","require","_reactForms","_ErrorMessage","_Button","_interopRequireDefault","_Checkbox","_FormControl","_FormHelperText","_Input","_InputLabel","_MenuItem","_Radio","_RadioGroup","_Select","_excluded","_excluded2","_excluded3","obj","__esModule","_typeof","Symbol","iterator","constructor","prototype","_toConsumableArray","arr","_arrayWithoutHoles","_iterableToArray","_unsupportedIterableToArray","_nonIterableSpread","TypeError","o","minLen","_arrayLikeToArray","n","Object","toString","call","slice","name","Array","from","test","iter","isArray","len","length","i","arr2","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","getOwnPropertySymbols","sourceSymbolKeys","indexOf","propertyIsEnumerable","sourceKeys","keys","ownKeys","object","enumerableOnly","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","Number","ErrorMessage","_ref","error","createElement","MuiFormHelperText","children","extractErrorMessage","exports","Form","FormProvider","context","Provider","margin","Submit","wrapSubmit","MuiButton","Button","wrapped","component","options","baseOptions","wrapInput","base","passErrorProp","_ref2","alwaysShrinkLabel","_ref2$shrinkLabel","shrinkLabel","shrinkLabelOption","passError","_ref3","className","hiddenLabel","variant","label","helperText","valid","pattern","inputProps","MuiFormControl","concat","type","fullWidth","required","MuiInputLabel","htmlFor","id","shrink","Input","MuiInput","Text","Checkbox","MuiCheckbox","RadioButton","MuiRadio","Radio","createRawConsumer","_ref4","values","labels","numeric","getFieldValue","getFieldValues","props","MuiRadioGroup","map","index","Select","_ref5","MuiSelect","MuiMenuItem","wrapField"],"sources":["../src/index.js"],"sourcesContent":["import { createElement } from 'react'\r\nimport { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useForm, useFormValues } from '@danderson00/react-forms'\r\nimport { extractErrorMessage } from '@danderson00/react-forms/src/ErrorMessage'\r\nimport MuiButton from '@material-ui/core/Button'\r\nimport MuiCheckbox from '@material-ui/core/Checkbox'\r\nimport MuiFormControl from '@material-ui/core/FormControl'\r\nimport MuiFormHelperText from '@material-ui/core/FormHelperText'\r\nimport MuiInput from '@material-ui/core/Input'\r\nimport MuiInputLabel from '@material-ui/core/InputLabel'\r\nimport MuiMenuItem from '@material-ui/core/MenuItem'\r\nimport MuiRadio from '@material-ui/core/Radio'\r\nimport MuiRadioGroup from '@material-ui/core/RadioGroup'\r\nimport MuiSelect from '@material-ui/core/Select'\r\nimport './styles'\r\n\r\nexport const ErrorMessage = ({ error }) => createElement(MuiFormHelperText, { children: extractErrorMessage(error), error: true })\r\nexport const Form = FormProvider(context.Provider, { margin: 'dense' }, ErrorMessage)\r\nexport const Submit = wrapSubmit(MuiButton)\r\nexport const Button = MuiButton\r\nexport { useForm, useFormValues, Group, wrapInput }\r\n\r\nconst wrapped = (component, options, baseOptions) => wrapInput(\r\n base(component, options, baseOptions),\r\n { passErrorProp: true, ...options }\r\n)\r\n\r\nconst base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true, passError } = {}) => (\r\n ({ className, error, hiddenLabel, variant, margin, label, helperText, shrinkLabel, valid, pattern, ...inputProps }) => {\r\n return (\r\n createElement(MuiFormControl, {\r\n className: `react-forms-material-field${options.type ? ` react-forms-material-${options.type}` : ''}${className ? ` ${className}` : ''}`,\r\n error,\r\n fullWidth: inputProps.fullWidth,\r\n hiddenLabel,\r\n required: inputProps.required,\r\n variant,\r\n margin,\r\n children: [\r\n ...(label ? [createElement(MuiInputLabel, {\r\n key: 'label',\r\n htmlFor: inputProps.id,\r\n children: label,\r\n ...(shrinkLabelOption === false && { shrink: false }),\r\n ...((alwaysShrinkLabel || shrinkLabel) && { className: 'MuiInputLabel-shrink' }),\r\n })] : []),\r\n\r\n createElement(component, {\r\n key: 'input',\r\n variant,\r\n ...(passError && { error }),\r\n ...inputProps,\r\n inputProps: { ...(pattern && { pattern }), ...inputProps.inputProps }\r\n }),\r\n\r\n ...(helperText ? [createElement(MuiFormHelperText, {\r\n key: 'helperText',\r\n children: helperText\r\n })] : [])\r\n ]\r\n })\r\n )\r\n }\r\n)\r\n\r\nexport const Input = wrapInput(MuiInput)\r\nexport const Text = wrapped(MuiInput)\r\nexport const Checkbox = wrapped(MuiCheckbox, { type: 'checkbox' }, { alwaysShrinkLabel: true })\r\nexport const RadioButton = wrapped(MuiRadio, { type: 'radio' }, { shrinkLabel: false })\r\n\r\nexport const Radio = createRawConsumer(base(\r\n ({ name, values, labels, numeric, required, getFieldValue, getFieldValues, inputProps, ...props }) => {\r\n return createElement(MuiRadioGroup, { ...props, children: [\r\n values.map((value, index) => {\r\n return createElement(RadioButton, {\r\n name,\r\n value,\r\n numeric,\r\n key: value,\r\n label: (labels && labels[index]) || value,\r\n margin: props.margin,\r\n ...(required && { required }),\r\n inputProps\r\n })\r\n })\r\n ] }\r\n )},\r\n { type: 'radiogroup' },\r\n { alwaysShrinkLabel: true }\r\n))\r\n\r\nexport const Select = wrapped(({ values, labels, ...props }) =>\r\n createElement(MuiSelect, { ...props, children:\r\n values.map((value, index) =>\r\n createElement(MuiMenuItem, {\r\n value,\r\n key: value,\r\n children: (labels && labels[index]) || value,\r\n ...(props.required && { required: props.required })\r\n })\r\n )\r\n }),\r\n { type: 'select' },\r\n { alwaysShrinkLabel: true }\r\n)\r\n\r\nexport const wrapField = wrapped"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,YAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,eAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,MAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AACA,IAAAS,WAAA,GAAAL,sBAAA,CAAAJ,OAAA;AACA,IAAAU,SAAA,GAAAN,sBAAA,CAAAJ,OAAA;AACA,IAAAW,MAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,WAAA,GAAAR,sBAAA,CAAAJ,OAAA;AACA,I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,KAAK,CAACpB,QAAQ,IAAI;QAAEA,QAAQ,EAAEoB,KAAK,CAACpB;MAAS,CAAC,CACnD,CAAC;IAAA,CACJ;EAAC,EACF,CAAC;AAAA,GACF;EAAEF,IAAI,EAAE;AAAS,CAAC,EAClB;EAAEhB,iBAAiB,EAAE;AAAM,CAC7B,CAAC;AAAAlB,OAAA,CAAA4D,MAAA,GAAAA,MAAA;AAEM,IAAMI,SAAS,GAAGtD,OAAO;AAAAV,OAAA,CAAAgE,SAAA,GAAAA,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","names":["_injectCss","_interopRequireDefault","require","obj","__esModule","injectCss"],"sources":["../src/styles.js"],"sourcesContent":["import injectCss from '@danderson00/react-forms/src/injectCss'\n\ninjectCss('react-forms-material-styles', `\n .react-forms-material-radiogroup.MuiFormControl-root {\n overflow: hidden;\n }\n\n .react-forms-material-radio.MuiFormControl-root {\n flex-direction: row-reverse;\n justify-content: flex-end;\n }\n \n .react-forms-material-radio .MuiInputLabel-formControl {\n position: static;\n }\n\n .react-forms-material-radio .MuiRadio-root {\n transform: translate(0, 9px) scale(1);\n } \n \n .react-forms-material-checkbox .MuiCheckbox-root {\n transform: translate(0, 9px) scale(1);\n }\n \n /* allow forms to be embedded in dialogs - essentially replicate a few styles */\n .MuiDialog-container form {\n display: flex;\n }\n \n .MuiDialog-container form .MuiDialogContent-root {\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n }\n\n .MuiDialog-container form .MuiDialogActions-root {\n align-self: flex-end;\n }\n \n .react-forms input::-webkit-outer-spin-button,\n .react-forms input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .react-forms input[type=number] {\n -moz-appearance: textfield;\n }\n`)\n\n\n"],"mappings":";;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAE9D,IAAAE,qBAAS,EAAC,6BAA6B,smCA8CtC,CAAC"}
1
+ {"version":3,"file":"styles.js","names":["_injectCss","_interopRequireDefault","require","obj","__esModule","injectCss"],"sources":["../src/styles.js"],"sourcesContent":["import injectCss from '@danderson00/react-forms/src/injectCss'\r\n\r\ninjectCss('react-forms-material-styles', `\r\n .react-forms-material-radiogroup.MuiFormControl-root {\r\n overflow: hidden;\r\n }\r\n\r\n .react-forms-material-radio.MuiFormControl-root {\r\n flex-direction: row-reverse;\r\n justify-content: flex-end;\r\n }\r\n \r\n .react-forms-material-radio .MuiInputLabel-formControl {\r\n position: static;\r\n }\r\n\r\n .react-forms-material-radio .MuiRadio-root {\r\n transform: translate(0, 9px) scale(1);\r\n } \r\n \r\n .react-forms-material-checkbox .MuiCheckbox-root {\r\n transform: translate(0, 9px) scale(1);\r\n }\r\n \r\n /* allow forms to be embedded in dialogs - essentially replicate a few styles */\r\n .MuiDialog-container form {\r\n display: flex;\r\n }\r\n \r\n .MuiDialog-container form .MuiDialogContent-root {\r\n display: flex;\r\n align-items: flex-start;\r\n flex-direction: column;\r\n }\r\n\r\n .MuiDialog-container form .MuiDialogActions-root {\r\n align-self: flex-end;\r\n }\r\n \r\n .react-forms input::-webkit-outer-spin-button,\r\n .react-forms input::-webkit-inner-spin-button {\r\n -webkit-appearance: none;\r\n margin: 0;\r\n }\r\n\r\n .react-forms input[type=number] {\r\n -moz-appearance: textfield;\r\n }\r\n`)\r\n\r\n\r\n"],"mappings":";;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAE9D,IAAAE,qBAAS,EAAC,6BAA6B,smCA8CtC,CAAC"}
package/package.json CHANGED
@@ -1,62 +1,62 @@
1
- {
2
- "name": "@danderson00/react-forms-material",
3
- "version": "0.0.46",
4
- "description": "Beautiful, ultra simple, stateless, validated forms for use in React function components",
5
- "main": "src/index.js",
6
- "scripts": {
7
- "test": "jest",
8
- "build": "babel src --source-maps --out-dir dist",
9
- "prepare": "babel src --source-maps --out-dir dist"
10
- },
11
- "dependencies": {
12
- "@danderson00/react-forms": "0.0.46",
13
- "@material-ui/core": "^4.11.3"
14
- },
15
- "peerDependencies": {
16
- "react": "*"
17
- },
18
- "devDependencies": {
19
- "@babel/cli": "^7.4.4",
20
- "@babel/core": "^7.4.4",
21
- "@babel/preset-env": "^7.4.4",
22
- "@babel/preset-react": "^7.0.0",
23
- "babel-jest": "26.6.3",
24
- "enzyme": "^3.9.0",
25
- "enzyme-adapter-react-16": "^1.9.1",
26
- "jest": "26.6.3",
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0"
29
- },
30
- "jest": {
31
- "moduleNameMapper": {
32
- "\\.css$": "<rootDir>/test/setup/styleMock.js"
33
- },
34
- "setupFilesAfterEnv": [
35
- "<rootDir>test/setup/beforeAll.js"
36
- ]
37
- },
38
- "babel": {
39
- "presets": [
40
- "@babel/preset-env",
41
- "@babel/preset-react"
42
- ]
43
- },
44
- "keywords": [
45
- "react",
46
- "stateless",
47
- "form",
48
- "function",
49
- "component",
50
- "material",
51
- "ui"
52
- ],
53
- "author": "danderson00",
54
- "license": "MIT",
55
- "publishConfig": {
56
- "access": "public"
57
- },
58
- "repository": {
59
- "type": "git",
60
- "url": "git+https://gitlab.com/danderson00/react-forms.git"
61
- }
62
- }
1
+ {
2
+ "name": "@danderson00/react-forms-material",
3
+ "version": "0.0.48",
4
+ "description": "Beautiful, ultra simple, stateless, validated forms for use in React function components",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "test": "jest",
8
+ "build": "babel src --source-maps --out-dir dist",
9
+ "prepare": "babel src --source-maps --out-dir dist"
10
+ },
11
+ "dependencies": {
12
+ "@danderson00/react-forms": "0.0.48",
13
+ "@material-ui/core": "^4.11.3"
14
+ },
15
+ "peerDependencies": {
16
+ "react": "*"
17
+ },
18
+ "devDependencies": {
19
+ "@babel/cli": "^7.4.4",
20
+ "@babel/core": "^7.4.4",
21
+ "@babel/preset-env": "^7.4.4",
22
+ "@babel/preset-react": "^7.0.0",
23
+ "babel-jest": "26.6.3",
24
+ "enzyme": "^3.9.0",
25
+ "enzyme-adapter-react-16": "^1.9.1",
26
+ "jest": "26.6.3",
27
+ "react": "^18.2.0",
28
+ "react-dom": "^18.2.0"
29
+ },
30
+ "jest": {
31
+ "moduleNameMapper": {
32
+ "\\.css$": "<rootDir>/test/setup/styleMock.js"
33
+ },
34
+ "setupFilesAfterEnv": [
35
+ "<rootDir>test/setup/beforeAll.js"
36
+ ]
37
+ },
38
+ "babel": {
39
+ "presets": [
40
+ "@babel/preset-env",
41
+ "@babel/preset-react"
42
+ ]
43
+ },
44
+ "keywords": [
45
+ "react",
46
+ "stateless",
47
+ "form",
48
+ "function",
49
+ "component",
50
+ "material",
51
+ "ui"
52
+ ],
53
+ "author": "danderson00",
54
+ "license": "MIT",
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://gitlab.com/danderson00/react-forms.git"
61
+ }
62
+ }
package/src/index.js CHANGED
@@ -1,106 +1,106 @@
1
- import { createElement } from 'react'
2
- import { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useForm, useFormValues } from '@danderson00/react-forms'
3
- import { extractErrorMessage } from '@danderson00/react-forms/src/ErrorMessage'
4
- import MuiButton from '@material-ui/core/Button'
5
- import MuiCheckbox from '@material-ui/core/Checkbox'
6
- import MuiFormControl from '@material-ui/core/FormControl'
7
- import MuiFormHelperText from '@material-ui/core/FormHelperText'
8
- import MuiInput from '@material-ui/core/Input'
9
- import MuiInputLabel from '@material-ui/core/InputLabel'
10
- import MuiMenuItem from '@material-ui/core/MenuItem'
11
- import MuiRadio from '@material-ui/core/Radio'
12
- import MuiRadioGroup from '@material-ui/core/RadioGroup'
13
- import MuiSelect from '@material-ui/core/Select'
14
- import './styles'
15
-
16
- export const ErrorMessage = ({ error }) => createElement(MuiFormHelperText, { children: extractErrorMessage(error), error: true })
17
- export const Form = FormProvider(context.Provider, { margin: 'dense' }, ErrorMessage)
18
- export const Submit = wrapSubmit(MuiButton)
19
- export const Button = MuiButton
20
- export { useForm, useFormValues, Group, wrapInput }
21
-
22
- const wrapped = (component, options, baseOptions) => wrapInput(
23
- base(component, options, baseOptions),
24
- { passErrorProp: true, ...options }
25
- )
26
-
27
- const base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true, passError } = {}) => (
28
- ({ className, error, hiddenLabel, variant, margin, label, helperText, shrinkLabel, valid, pattern, ...inputProps }) => {
29
- return (
30
- createElement(MuiFormControl, {
31
- className: `react-forms-material-field${options.type ? ` react-forms-material-${options.type}` : ''}${className ? ` ${className}` : ''}`,
32
- error,
33
- fullWidth: inputProps.fullWidth,
34
- hiddenLabel,
35
- required: inputProps.required,
36
- variant,
37
- margin,
38
- children: [
39
- ...(label ? [createElement(MuiInputLabel, {
40
- key: 'label',
41
- htmlFor: inputProps.id,
42
- children: label,
43
- ...(shrinkLabelOption === false && { shrink: false }),
44
- ...((alwaysShrinkLabel || shrinkLabel) && { className: 'MuiInputLabel-shrink' }),
45
- })] : []),
46
-
47
- createElement(component, {
48
- key: 'input',
49
- variant,
50
- ...(passError && { error }),
51
- ...inputProps,
52
- inputProps: { ...(pattern && { pattern }), ...inputProps.inputProps }
53
- }),
54
-
55
- ...(helperText ? [createElement(MuiFormHelperText, {
56
- key: 'helperText',
57
- children: helperText
58
- })] : [])
59
- ]
60
- })
61
- )
62
- }
63
- )
64
-
65
- export const Input = wrapInput(MuiInput)
66
- export const Text = wrapped(MuiInput)
67
- export const Checkbox = wrapped(MuiCheckbox, { type: 'checkbox' }, { alwaysShrinkLabel: true })
68
- export const RadioButton = wrapped(MuiRadio, { type: 'radio' }, { shrinkLabel: false })
69
-
70
- export const Radio = createRawConsumer(base(
71
- ({ name, values, labels, numeric, required, getFieldValue, getFieldValues, inputProps, ...props }) => {
72
- return createElement(MuiRadioGroup, { ...props, children: [
73
- values.map((value, index) => {
74
- return createElement(RadioButton, {
75
- name,
76
- value,
77
- numeric,
78
- key: value,
79
- label: (labels && labels[index]) || value,
80
- margin: props.margin,
81
- ...(required && { required }),
82
- inputProps
83
- })
84
- })
85
- ] }
86
- )},
87
- { type: 'radiogroup' },
88
- { alwaysShrinkLabel: true }
89
- ))
90
-
91
- export const Select = wrapped(({ values, labels, ...props }) =>
92
- createElement(MuiSelect, { ...props, children:
93
- values.map((value, index) =>
94
- createElement(MuiMenuItem, {
95
- value,
96
- key: value,
97
- children: (labels && labels[index]) || value,
98
- ...(props.required && { required: props.required })
99
- })
100
- )
101
- }),
102
- { type: 'select' },
103
- { alwaysShrinkLabel: true }
104
- )
105
-
1
+ import { createElement } from 'react'
2
+ import { FormProvider, Group, context, createRawConsumer, wrapInput, wrapSubmit, useForm, useFormValues } from '@danderson00/react-forms'
3
+ import { extractErrorMessage } from '@danderson00/react-forms/src/ErrorMessage'
4
+ import MuiButton from '@material-ui/core/Button'
5
+ import MuiCheckbox from '@material-ui/core/Checkbox'
6
+ import MuiFormControl from '@material-ui/core/FormControl'
7
+ import MuiFormHelperText from '@material-ui/core/FormHelperText'
8
+ import MuiInput from '@material-ui/core/Input'
9
+ import MuiInputLabel from '@material-ui/core/InputLabel'
10
+ import MuiMenuItem from '@material-ui/core/MenuItem'
11
+ import MuiRadio from '@material-ui/core/Radio'
12
+ import MuiRadioGroup from '@material-ui/core/RadioGroup'
13
+ import MuiSelect from '@material-ui/core/Select'
14
+ import './styles'
15
+
16
+ export const ErrorMessage = ({ error }) => createElement(MuiFormHelperText, { children: extractErrorMessage(error), error: true })
17
+ export const Form = FormProvider(context.Provider, { margin: 'dense' }, ErrorMessage)
18
+ export const Submit = wrapSubmit(MuiButton)
19
+ export const Button = MuiButton
20
+ export { useForm, useFormValues, Group, wrapInput }
21
+
22
+ const wrapped = (component, options, baseOptions) => wrapInput(
23
+ base(component, options, baseOptions),
24
+ { passErrorProp: true, ...options }
25
+ )
26
+
27
+ const base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true, passError } = {}) => (
28
+ ({ className, error, hiddenLabel, variant, margin, label, helperText, shrinkLabel, valid, pattern, ...inputProps }) => {
29
+ return (
30
+ createElement(MuiFormControl, {
31
+ className: `react-forms-material-field${options.type ? ` react-forms-material-${options.type}` : ''}${className ? ` ${className}` : ''}`,
32
+ error,
33
+ fullWidth: inputProps.fullWidth,
34
+ hiddenLabel,
35
+ required: inputProps.required,
36
+ variant,
37
+ margin,
38
+ children: [
39
+ ...(label ? [createElement(MuiInputLabel, {
40
+ key: 'label',
41
+ htmlFor: inputProps.id,
42
+ children: label,
43
+ ...(shrinkLabelOption === false && { shrink: false }),
44
+ ...((alwaysShrinkLabel || shrinkLabel) && { className: 'MuiInputLabel-shrink' }),
45
+ })] : []),
46
+
47
+ createElement(component, {
48
+ key: 'input',
49
+ variant,
50
+ ...(passError && { error }),
51
+ ...inputProps,
52
+ inputProps: { ...(pattern && { pattern }), ...inputProps.inputProps }
53
+ }),
54
+
55
+ ...(helperText ? [createElement(MuiFormHelperText, {
56
+ key: 'helperText',
57
+ children: helperText
58
+ })] : [])
59
+ ]
60
+ })
61
+ )
62
+ }
63
+ )
64
+
65
+ export const Input = wrapInput(MuiInput)
66
+ export const Text = wrapped(MuiInput)
67
+ export const Checkbox = wrapped(MuiCheckbox, { type: 'checkbox' }, { alwaysShrinkLabel: true })
68
+ export const RadioButton = wrapped(MuiRadio, { type: 'radio' }, { shrinkLabel: false })
69
+
70
+ export const Radio = createRawConsumer(base(
71
+ ({ name, values, labels, numeric, required, getFieldValue, getFieldValues, inputProps, ...props }) => {
72
+ return createElement(MuiRadioGroup, { ...props, children: [
73
+ values.map((value, index) => {
74
+ return createElement(RadioButton, {
75
+ name,
76
+ value,
77
+ numeric,
78
+ key: value,
79
+ label: (labels && labels[index]) || value,
80
+ margin: props.margin,
81
+ ...(required && { required }),
82
+ inputProps
83
+ })
84
+ })
85
+ ] }
86
+ )},
87
+ { type: 'radiogroup' },
88
+ { alwaysShrinkLabel: true }
89
+ ))
90
+
91
+ export const Select = wrapped(({ values, labels, ...props }) =>
92
+ createElement(MuiSelect, { ...props, children:
93
+ values.map((value, index) =>
94
+ createElement(MuiMenuItem, {
95
+ value,
96
+ key: value,
97
+ children: (labels && labels[index]) || value,
98
+ ...(props.required && { required: props.required })
99
+ })
100
+ )
101
+ }),
102
+ { type: 'select' },
103
+ { alwaysShrinkLabel: true }
104
+ )
105
+
106
106
  export const wrapField = wrapped
package/src/styles.js CHANGED
@@ -1,51 +1,51 @@
1
- import injectCss from '@danderson00/react-forms/src/injectCss'
2
-
3
- injectCss('react-forms-material-styles', `
4
- .react-forms-material-radiogroup.MuiFormControl-root {
5
- overflow: hidden;
6
- }
7
-
8
- .react-forms-material-radio.MuiFormControl-root {
9
- flex-direction: row-reverse;
10
- justify-content: flex-end;
11
- }
12
-
13
- .react-forms-material-radio .MuiInputLabel-formControl {
14
- position: static;
15
- }
16
-
17
- .react-forms-material-radio .MuiRadio-root {
18
- transform: translate(0, 9px) scale(1);
19
- }
20
-
21
- .react-forms-material-checkbox .MuiCheckbox-root {
22
- transform: translate(0, 9px) scale(1);
23
- }
24
-
25
- /* allow forms to be embedded in dialogs - essentially replicate a few styles */
26
- .MuiDialog-container form {
27
- display: flex;
28
- }
29
-
30
- .MuiDialog-container form .MuiDialogContent-root {
31
- display: flex;
32
- align-items: flex-start;
33
- flex-direction: column;
34
- }
35
-
36
- .MuiDialog-container form .MuiDialogActions-root {
37
- align-self: flex-end;
38
- }
39
-
40
- .react-forms input::-webkit-outer-spin-button,
41
- .react-forms input::-webkit-inner-spin-button {
42
- -webkit-appearance: none;
43
- margin: 0;
44
- }
45
-
46
- .react-forms input[type=number] {
47
- -moz-appearance: textfield;
48
- }
49
- `)
50
-
51
-
1
+ import injectCss from '@danderson00/react-forms/src/injectCss'
2
+
3
+ injectCss('react-forms-material-styles', `
4
+ .react-forms-material-radiogroup.MuiFormControl-root {
5
+ overflow: hidden;
6
+ }
7
+
8
+ .react-forms-material-radio.MuiFormControl-root {
9
+ flex-direction: row-reverse;
10
+ justify-content: flex-end;
11
+ }
12
+
13
+ .react-forms-material-radio .MuiInputLabel-formControl {
14
+ position: static;
15
+ }
16
+
17
+ .react-forms-material-radio .MuiRadio-root {
18
+ transform: translate(0, 9px) scale(1);
19
+ }
20
+
21
+ .react-forms-material-checkbox .MuiCheckbox-root {
22
+ transform: translate(0, 9px) scale(1);
23
+ }
24
+
25
+ /* allow forms to be embedded in dialogs - essentially replicate a few styles */
26
+ .MuiDialog-container form {
27
+ display: flex;
28
+ }
29
+
30
+ .MuiDialog-container form .MuiDialogContent-root {
31
+ display: flex;
32
+ align-items: flex-start;
33
+ flex-direction: column;
34
+ }
35
+
36
+ .MuiDialog-container form .MuiDialogActions-root {
37
+ align-self: flex-end;
38
+ }
39
+
40
+ .react-forms input::-webkit-outer-spin-button,
41
+ .react-forms input::-webkit-inner-spin-button {
42
+ -webkit-appearance: none;
43
+ margin: 0;
44
+ }
45
+
46
+ .react-forms input[type=number] {
47
+ -moz-appearance: textfield;
48
+ }
49
+ `)
50
+
51
+