dynamic-formik-form 1.0.2 → 1.0.4

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 CHANGED
@@ -97,45 +97,63 @@ var defaultAdapter = {
97
97
  )
98
98
  };
99
99
  var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, FormHelperText, IconButton, MenuItem, Paper, Popover, Radio, RadioGroup, Switch, TextField2, Typography, DatePicker, DateTimePicker) => {
100
+ const filterMUIProps = (props) => {
101
+ const filtered = { ...props };
102
+ delete filtered.error;
103
+ delete filtered.fullWidth;
104
+ delete filtered.select;
105
+ delete filtered.multiline;
106
+ delete filtered.variant;
107
+ return filtered;
108
+ };
100
109
  return {
101
- Input: ({ className, disabled, error, type, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
102
- TextField2,
103
- {
104
- ...props,
105
- type,
106
- disabled,
107
- error: !!error,
108
- className,
109
- fullWidth: true,
110
- variant: "outlined"
111
- }
112
- ),
113
- Textarea: ({ className, disabled, error, rows, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
114
- TextField2,
115
- {
116
- ...props,
117
- multiline: true,
118
- rows: rows || 4,
119
- disabled,
120
- error: !!error,
121
- className,
122
- fullWidth: true,
123
- variant: "outlined"
124
- }
125
- ),
126
- Select: ({ className, disabled, error, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
127
- TextField2,
128
- {
129
- ...props,
130
- select: true,
131
- disabled,
132
- error: !!error,
133
- className,
134
- fullWidth: true,
135
- variant: "outlined",
136
- children
137
- }
138
- ),
110
+ Input: ({ className, disabled, error, type, ...props }) => {
111
+ const filteredProps = filterMUIProps(props);
112
+ return /* @__PURE__ */ jsxRuntime.jsx(
113
+ TextField2,
114
+ {
115
+ ...filteredProps,
116
+ type,
117
+ disabled,
118
+ ...error ? { error: true } : {},
119
+ className,
120
+ fullWidth: true,
121
+ variant: "outlined"
122
+ }
123
+ );
124
+ },
125
+ Textarea: ({ className, disabled, error, rows, ...props }) => {
126
+ const filteredProps = filterMUIProps(props);
127
+ return /* @__PURE__ */ jsxRuntime.jsx(
128
+ TextField2,
129
+ {
130
+ ...filteredProps,
131
+ multiline: true,
132
+ rows: rows || 4,
133
+ disabled,
134
+ ...error ? { error: true } : {},
135
+ className,
136
+ fullWidth: true,
137
+ variant: "outlined"
138
+ }
139
+ );
140
+ },
141
+ Select: ({ className, disabled, error, children, ...props }) => {
142
+ const filteredProps = filterMUIProps(props);
143
+ return /* @__PURE__ */ jsxRuntime.jsx(
144
+ TextField2,
145
+ {
146
+ ...filteredProps,
147
+ select: true,
148
+ disabled,
149
+ ...error ? { error: true } : {},
150
+ className,
151
+ fullWidth: true,
152
+ variant: "outlined",
153
+ children
154
+ }
155
+ );
156
+ },
139
157
  Checkbox: ({ className, disabled, label, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
140
158
  FormControlLabel,
141
159
  {
@@ -191,7 +209,7 @@ var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, Fo
191
209
  {
192
210
  className,
193
211
  required,
194
- error: !!error,
212
+ ...error ? { error: true } : {},
195
213
  fullWidth: true,
196
214
  children
197
215
  }
@@ -253,20 +271,23 @@ var createMUIAdapter = (Box, Button, Checkbox, FormControl, FormControlLabel, Fo
253
271
  ...props
254
272
  }
255
273
  ) : void 0,
256
- TextField: TextField2 ? ({ inputRef, inputProps, label, id, error, helperText, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
257
- TextField2,
258
- {
259
- inputRef,
260
- inputProps,
261
- label,
262
- id,
263
- error: !!error,
264
- helperText,
265
- ...props,
266
- fullWidth: true,
267
- variant: "outlined"
268
- }
269
- ) : void 0
274
+ TextField: TextField2 ? ({ inputRef, inputProps, label, id, error, helperText, ...props }) => {
275
+ const filteredProps = filterMUIProps(props);
276
+ return /* @__PURE__ */ jsxRuntime.jsx(
277
+ TextField2,
278
+ {
279
+ inputRef,
280
+ inputProps,
281
+ label,
282
+ id,
283
+ ...error ? { error: true } : {},
284
+ helperText,
285
+ ...filteredProps,
286
+ fullWidth: true,
287
+ variant: "outlined"
288
+ }
289
+ );
290
+ } : void 0
270
291
  };
271
292
  };
272
293
  var createBootstrapAdapter = (Form, FormControl, FormLabel, FormText, FormCheck, FormSelect, ButtonComponent, InputGroup, OverlayTrigger, Popover, ListGroup, ListGroupItem) => {