@rjsf/mui 6.4.2 → 6.5.1

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.
Files changed (93) hide show
  1. package/README.md +25 -0
  2. package/dist/index.cjs +353 -214
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/mui.esm.js +354 -185
  5. package/dist/mui.esm.js.map +4 -4
  6. package/dist/mui.umd.js +293 -165
  7. package/lib/AddButton/AddButton.js +12 -2
  8. package/lib/AddButton/AddButton.js.map +1 -1
  9. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +22 -1
  10. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +3 -1
  11. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  12. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +20 -1
  13. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -1
  14. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  15. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +17 -1
  16. package/lib/BaseInputTemplate/BaseInputTemplate.js +9 -4
  17. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  18. package/lib/CheckboxWidget/CheckboxWidget.d.ts +13 -1
  19. package/lib/CheckboxWidget/CheckboxWidget.js +3 -1
  20. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
  21. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +17 -2
  22. package/lib/CheckboxesWidget/CheckboxesWidget.js +12 -7
  23. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  24. package/lib/DescriptionField/DescriptionField.d.ts +10 -1
  25. package/lib/DescriptionField/DescriptionField.js +6 -1
  26. package/lib/DescriptionField/DescriptionField.js.map +1 -1
  27. package/lib/ErrorList/ErrorList.d.ts +29 -2
  28. package/lib/ErrorList/ErrorList.js +7 -4
  29. package/lib/ErrorList/ErrorList.js.map +1 -1
  30. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +16 -1
  31. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +8 -4
  32. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
  33. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +10 -1
  34. package/lib/FieldHelpTemplate/FieldHelpTemplate.js +6 -2
  35. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  36. package/lib/FieldTemplate/FieldTemplate.d.ts +13 -1
  37. package/lib/FieldTemplate/FieldTemplate.js +3 -1
  38. package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
  39. package/lib/IconButton/IconButton.js +12 -2
  40. package/lib/IconButton/IconButton.js.map +1 -1
  41. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +13 -1
  42. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +6 -2
  43. package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -1
  44. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +16 -1
  45. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +4 -2
  46. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  47. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +3 -3
  48. package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  49. package/lib/RadioWidget/RadioWidget.d.ts +17 -2
  50. package/lib/RadioWidget/RadioWidget.js +13 -9
  51. package/lib/RadioWidget/RadioWidget.js.map +1 -1
  52. package/lib/RangeWidget/RangeWidget.d.ts +10 -1
  53. package/lib/RangeWidget/RangeWidget.js +3 -1
  54. package/lib/RangeWidget/RangeWidget.js.map +1 -1
  55. package/lib/SelectWidget/SelectWidget.d.ts +14 -3
  56. package/lib/SelectWidget/SelectWidget.js +26 -19
  57. package/lib/SelectWidget/SelectWidget.js.map +1 -1
  58. package/lib/SubmitButton/SubmitButton.d.ts +13 -1
  59. package/lib/SubmitButton/SubmitButton.js +5 -2
  60. package/lib/SubmitButton/SubmitButton.js.map +1 -1
  61. package/lib/TitleField/TitleField.d.ts +24 -2
  62. package/lib/TitleField/TitleField.js +9 -4
  63. package/lib/TitleField/TitleField.js.map +1 -1
  64. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +16 -1
  65. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +7 -2
  66. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  67. package/lib/tsconfig.tsbuildinfo +1 -1
  68. package/lib/util.d.ts +9 -0
  69. package/lib/util.js +24 -0
  70. package/lib/util.js.map +1 -0
  71. package/package.json +9 -9
  72. package/src/AddButton/AddButton.tsx +21 -3
  73. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +39 -9
  74. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +30 -8
  75. package/src/BaseInputTemplate/BaseInputTemplate.tsx +29 -5
  76. package/src/CheckboxWidget/CheckboxWidget.tsx +20 -2
  77. package/src/CheckboxesWidget/CheckboxesWidget.tsx +51 -23
  78. package/src/DescriptionField/DescriptionField.tsx +25 -3
  79. package/src/ErrorList/ErrorList.tsx +52 -15
  80. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +34 -8
  81. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +30 -3
  82. package/src/FieldTemplate/FieldTemplate.tsx +26 -4
  83. package/src/IconButton/IconButton.tsx +21 -2
  84. package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +28 -6
  85. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +25 -5
  86. package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -1
  87. package/src/RadioWidget/RadioWidget.tsx +43 -26
  88. package/src/RangeWidget/RangeWidget.tsx +16 -1
  89. package/src/SelectWidget/SelectWidget.tsx +71 -49
  90. package/src/SubmitButton/SubmitButton.tsx +36 -5
  91. package/src/TitleField/TitleField.tsx +54 -16
  92. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +39 -5
  93. package/src/util.ts +30 -0
package/dist/mui.umd.js CHANGED
@@ -5,13 +5,34 @@
5
5
  })(this, (function (exports, core, AddIcon, IconButton, utils, jsxRuntime, Box, Grid4, Paper, react, TextField, InputAdornment, Typography, ErrorIcon, List, ListItem, ListItemIcon, ListItemText, ArrowDownwardIcon, ArrowUpwardIcon, CopyIcon, RemoveIcon, ClearIcon, FormHelperText, FormControl, Button, Divider, Checkbox, FormControlLabel, FormGroup, FormLabel, Radio, RadioGroup, Slider, MenuItem) { 'use strict';
6
6
 
7
7
  // src/MuiForm/MuiForm.tsx
8
+
9
+ // src/util.ts
10
+ function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
11
+ const muiProps = options?.mui || {};
12
+ if (propsToFilter) {
13
+ return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((obj, key) => {
14
+ obj[key] = muiProps[key];
15
+ return obj;
16
+ }, {});
17
+ }
18
+ return muiProps;
19
+ }
8
20
  function AddButton({
9
21
  uiSchema,
10
22
  registry,
11
23
  ...props
12
24
  }) {
13
25
  const { translateString } = registry;
14
- return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.AddItemButton), ...props, color: "primary", children: /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {}) });
26
+ const uiOptions = utils.getUiOptions(uiSchema);
27
+ const muiProps = getMuiProps(uiOptions, [
28
+ "color",
29
+ "disableFocusRipple",
30
+ "disableRipple",
31
+ "edge",
32
+ "size",
33
+ "sx"
34
+ ]);
35
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.AddItemButton), ...props, color: "primary", ...muiProps, children: /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {}) });
15
36
  }
16
37
  function ArrayFieldItemTemplate(props) {
17
38
  const { children, buttonsProps, hasDescription, hasToolbar, uiSchema, registry } = props;
@@ -28,9 +49,18 @@
28
49
  fontWeight: "bold",
29
50
  minWidth: 0
30
51
  };
31
- return /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, alignItems: "center", children: [
32
- /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 }, style: { overflow: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { p: 2, children }) }) }) }),
33
- hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { sx: { mt: hasDescription ? -5 : -1.5 }, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
52
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
53
+ return /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, alignItems: "center", ...muiSlotProps?.arrayItemGridContainer, children: [
54
+ /* @__PURE__ */ jsxRuntime.jsx(
55
+ Grid4,
56
+ {
57
+ size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 },
58
+ style: { overflow: "auto" },
59
+ ...muiSlotProps?.arrayItemGridItem,
60
+ children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mb: 2, ...muiSlotProps?.arrayItemOuterBox, children: /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, ...muiSlotProps?.arrayItemPaper, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { p: 2, ...muiSlotProps?.arrayItemInnerBox, children }) }) })
61
+ }
62
+ ),
63
+ hasToolbar && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { sx: { mt: hasDescription ? -5 : -1.5 }, ...muiSlotProps?.arrayItemToolbarGrid, children: /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
34
64
  ] });
35
65
  }
36
66
  function ArrayFieldTemplate(props) {
@@ -63,7 +93,8 @@
63
93
  const {
64
94
  ButtonTemplates: { AddButton: AddButton2 }
65
95
  } = registry.templates;
66
- return /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { p: 2, children: [
96
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
97
+ return /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, ...muiSlotProps?.arrayPaper, children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { p: 2, ...muiSlotProps?.arrayBox, children: [
67
98
  /* @__PURE__ */ jsxRuntime.jsx(
68
99
  ArrayFieldTitleTemplate,
69
100
  {
@@ -88,7 +119,7 @@
88
119
  ),
89
120
  !showOptionalDataControlInTitle ? optionalDataControl : void 0,
90
121
  items,
91
- canAdd && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(Grid4, { children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
122
+ canAdd && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: true, justifyContent: "flex-end", ...muiSlotProps?.arrayAddButtonGridContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Grid4, { ...muiSlotProps?.arrayAddButtonGridItem, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 2, ...muiSlotProps?.arrayAddButtonBox, children: /* @__PURE__ */ jsxRuntime.jsx(
92
123
  AddButton2,
93
124
  {
94
125
  id: utils.buttonId(fieldPathId, "add"),
@@ -135,8 +166,11 @@
135
166
  } = props;
136
167
  const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
137
168
  const { step, min, max, accept, ...rest } = utils.getInputProps(schema, type, options);
169
+ const muiProps = getMuiProps(options);
170
+ const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;
138
171
  const htmlInputProps = {
139
172
  ...slotProps?.htmlInput,
173
+ ...muiSlotProps?.htmlInput,
140
174
  step,
141
175
  min,
142
176
  max,
@@ -146,7 +180,7 @@
146
180
  const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
147
181
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
148
182
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
149
- const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...InputLabelProps };
183
+ const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps };
150
184
  const _onClear = react.useCallback(
151
185
  (e) => {
152
186
  e.preventDefault();
@@ -155,7 +189,7 @@
155
189
  },
156
190
  [onChange, options.emptyValue]
157
191
  );
158
- const inputProps = { ...InputProps, ...slotProps?.input };
192
+ const inputProps = { ...InputProps, ...slotProps?.input, ...muiSlotProps?.input };
159
193
  if (options.allowClearTextInputs && value && !readonly && !disabled) {
160
194
  const clearAdornment = /* @__PURE__ */ jsxRuntime.jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: _onClear }) });
161
195
  inputProps.endAdornment = !inputProps.endAdornment ? clearAdornment : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -176,6 +210,7 @@
176
210
  disabled: disabled || readonly,
177
211
  slotProps: {
178
212
  ...slotProps,
213
+ ...muiSlotProps,
179
214
  input: inputProps,
180
215
  htmlInput: htmlInputProps,
181
216
  inputLabel: DisplayInputLabelProps
@@ -186,7 +221,7 @@
186
221
  onChange: onChangeOverride || _onChange,
187
222
  onBlur: _onBlur,
188
223
  onFocus: _onFocus,
189
- ...textFieldProps,
224
+ ...{ ...otherMuiProps, ...textFieldProps },
190
225
  "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
191
226
  }
192
227
  ),
@@ -195,29 +230,44 @@
195
230
  }
196
231
  function DescriptionField(props) {
197
232
  const { id, description, registry, uiSchema } = props;
233
+ const uiOptions = utils.getUiOptions(uiSchema);
234
+ const muiProps = getMuiProps(uiOptions);
235
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
198
236
  if (description) {
199
- return /* @__PURE__ */ jsxRuntime.jsx(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" }, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichDescription, { description, registry, uiSchema }) });
237
+ return /* @__PURE__ */ jsxRuntime.jsx(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" }, ...muiSlotProps?.descTypography, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichDescription, { description, registry, uiSchema }) });
200
238
  }
201
239
  return null;
202
240
  }
203
241
  function ErrorList({
204
242
  errors,
205
- registry
243
+ registry,
244
+ uiSchema
206
245
  }) {
207
246
  const { translateString } = registry;
208
- return /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { mb: 2, p: 2, children: [
209
- /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h6", children: translateString(utils.TranslatableString.ErrorsLabel) }),
210
- /* @__PURE__ */ jsxRuntime.jsx(List, { dense: true, children: errors.map((error, i) => {
211
- return /* @__PURE__ */ jsxRuntime.jsxs(ListItem, { children: [
212
- /* @__PURE__ */ jsxRuntime.jsx(ListItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, { color: "error" }) }),
213
- /* @__PURE__ */ jsxRuntime.jsx(ListItemText, { primary: error.stack })
247
+ const uiOptions = utils.getUiOptions(uiSchema);
248
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
249
+ return /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, ...muiSlotProps?.errorPaper, children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { mb: 2, p: 2, ...muiSlotProps?.errorBox, children: [
250
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h6", ...muiSlotProps?.errorTypography, children: translateString(utils.TranslatableString.ErrorsLabel) }),
251
+ /* @__PURE__ */ jsxRuntime.jsx(List, { dense: true, ...muiSlotProps?.errorList, children: errors.map((error, i) => {
252
+ return /* @__PURE__ */ jsxRuntime.jsxs(ListItem, { ...muiSlotProps?.errorListItem, children: [
253
+ /* @__PURE__ */ jsxRuntime.jsx(ListItemIcon, { ...muiSlotProps?.errorListItemIcon, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, { color: "error" }) }),
254
+ /* @__PURE__ */ jsxRuntime.jsx(ListItemText, { primary: error.stack, ...muiSlotProps?.errorListItemText })
214
255
  ] }, i);
215
256
  }) })
216
257
  ] }) });
217
258
  }
218
259
  function MuiIconButton(props) {
219
260
  const { icon, color, uiSchema, registry, ...otherProps } = props;
220
- return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { ...otherProps, size: "small", color, children: icon });
261
+ const uiOptions = utils.getUiOptions(uiSchema);
262
+ const muiProps = getMuiProps(uiOptions, [
263
+ "color",
264
+ "disableFocusRipple",
265
+ "disableRipple",
266
+ "edge",
267
+ "size",
268
+ "sx"
269
+ ]);
270
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { ...muiProps, ...otherProps, size: "small", color, children: icon });
221
271
  }
222
272
  function CopyButton(props) {
223
273
  const {
@@ -288,13 +338,16 @@
288
338
  );
289
339
  }
290
340
  function FieldErrorTemplate(props) {
291
- const { errors = [], fieldPathId } = props;
341
+ const { errors = [], fieldPathId, uiSchema } = props;
292
342
  if (errors.length === 0) {
293
343
  return null;
294
344
  }
295
345
  const id = utils.errorId(fieldPathId);
296
- return /* @__PURE__ */ jsxRuntime.jsx(List, { id, dense: true, disablePadding: true, children: errors.map((error, i) => {
297
- return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { disableGutters: true, children: /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { component: "div", id: `${id}-${i}`, children: error }) }, i);
346
+ const uiOptions = utils.getUiOptions(uiSchema);
347
+ const muiProps = getMuiProps(uiOptions);
348
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
349
+ return /* @__PURE__ */ jsxRuntime.jsx(List, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) => {
350
+ return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { disableGutters: true, ...muiSlotProps?.fieldErrorListItem, children: /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { component: "div", id: `${id}-${i}`, ...muiSlotProps?.fieldErrorFormHelperText, children: error }) }, i);
298
351
  }) });
299
352
  }
300
353
  function FieldHelpTemplate(props) {
@@ -302,7 +355,19 @@
302
355
  if (!help) {
303
356
  return null;
304
357
  }
305
- return /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { component: "div", id: utils.helpId(fieldPathId), style: { marginTop: "5px" }, children: /* @__PURE__ */ jsxRuntime.jsx(core.RichHelp, { help, registry, uiSchema }) });
358
+ const uiOptions = utils.getUiOptions(uiSchema);
359
+ const muiProps = getMuiProps(uiOptions);
360
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
361
+ return /* @__PURE__ */ jsxRuntime.jsx(
362
+ FormHelperText,
363
+ {
364
+ component: "div",
365
+ id: utils.helpId(fieldPathId),
366
+ style: { marginTop: "5px" },
367
+ ...muiSlotProps?.helpFormHelperText,
368
+ children: /* @__PURE__ */ jsxRuntime.jsx(core.RichHelp, { help, registry, uiSchema })
369
+ }
370
+ );
306
371
  }
307
372
  function FieldTemplate(props) {
308
373
  const {
@@ -338,6 +403,7 @@
338
403
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "none" }, children });
339
404
  }
340
405
  const isCheckbox = uiOptions.widget === "checkbox";
406
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
341
407
  return /* @__PURE__ */ jsxRuntime.jsx(
342
408
  WrapIfAdditionalTemplate2,
343
409
  {
@@ -356,12 +422,23 @@
356
422
  schema,
357
423
  uiSchema,
358
424
  registry,
359
- children: /* @__PURE__ */ jsxRuntime.jsxs(FormControl, { fullWidth: true, error: rawErrors.length ? true : false, required, children: [
360
- children,
361
- displayLabel && !isCheckbox && rawDescription ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", color: "textSecondary", children: description }) : null,
362
- errors,
363
- help
364
- ] })
425
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
426
+ FormControl,
427
+ {
428
+ fullWidth: true,
429
+ error: rawErrors.length ? true : false,
430
+ required,
431
+ ...muiSlotProps?.fieldFormControl,
432
+ sx: otherMuiProps.sx,
433
+ className: otherMuiProps.className,
434
+ children: [
435
+ children,
436
+ displayLabel && !isCheckbox && rawDescription ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", color: "textSecondary", ...muiSlotProps?.fieldTypography, children: description }) : null,
437
+ errors,
438
+ help
439
+ ]
440
+ }
441
+ )
365
442
  }
366
443
  );
367
444
  }
@@ -370,9 +447,11 @@
370
447
  return /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: !column, ...rest, children });
371
448
  }
372
449
  function MultiSchemaFieldTemplate(props) {
373
- const { optionSchemaField, selector } = props;
374
- return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { mb: 2 }, children: [
375
- /* @__PURE__ */ jsxRuntime.jsx(FormControl, { fullWidth: true, sx: { mb: 2 }, children: selector }),
450
+ const { optionSchemaField, selector, uiSchema } = props;
451
+ const uiOptions = utils.getUiOptions(uiSchema);
452
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
453
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { mb: 2 }, ...muiSlotProps?.multiBox, children: [
454
+ /* @__PURE__ */ jsxRuntime.jsx(FormControl, { fullWidth: true, sx: { mb: 2 }, ...muiSlotProps?.multiFormControl, children: selector }),
376
455
  optionSchemaField
377
456
  ] });
378
457
  }
@@ -403,6 +482,7 @@
403
482
  const {
404
483
  ButtonTemplates: { AddButton: AddButton2 }
405
484
  } = registry.templates;
485
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
406
486
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
407
487
  title && /* @__PURE__ */ jsxRuntime.jsx(
408
488
  TitleFieldTemplate,
@@ -426,17 +506,17 @@
426
506
  registry
427
507
  }
428
508
  ),
429
- /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
509
+ /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, spacing: 2, style: { marginTop: "10px" }, ...muiSlotProps?.objectGridContainer, children: [
430
510
  !showOptionalDataControlInTitle ? optionalDataControl : void 0,
431
511
  properties.map(
432
512
  (element, index) => (
433
513
  // Remove the <Grid> if the inner element is hidden as the <Grid>
434
514
  // itself would otherwise still take up space.
435
- element.hidden ? element.content : /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
515
+ element.hidden ? element.content : /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: { xs: 12 }, style: { marginBottom: "10px" }, ...muiSlotProps?.objectGridItem, children: element.content }, index)
436
516
  )
437
517
  )
438
518
  ] }),
439
- utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(Grid4, { children: /* @__PURE__ */ jsxRuntime.jsx(
519
+ utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(Grid4, { container: true, justifyContent: "flex-end", ...muiSlotProps?.objectAddButtonGridContainer, children: /* @__PURE__ */ jsxRuntime.jsx(Grid4, { ...muiSlotProps?.objectAddButtonGridItem, children: /* @__PURE__ */ jsxRuntime.jsx(
440
520
  AddButton2,
441
521
  {
442
522
  id: utils.buttonId(fieldPathId, "add"),
@@ -450,13 +530,14 @@
450
530
  ] });
451
531
  }
452
532
  function OptionalDataControlsTemplate(props) {
453
- const { id, registry, label, onAddClick, onRemoveClick } = props;
533
+ const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
454
534
  if (onAddClick) {
455
535
  return /* @__PURE__ */ jsxRuntime.jsx(
456
536
  MuiIconButton,
457
537
  {
458
538
  id,
459
539
  registry,
540
+ uiSchema,
460
541
  className: "rjsf-add-optional-data",
461
542
  onClick: onAddClick,
462
543
  title: label,
@@ -469,6 +550,7 @@
469
550
  {
470
551
  id,
471
552
  registry,
553
+ uiSchema,
472
554
  className: "rjsf-remove-optional-data",
473
555
  onClick: onRemoveClick,
474
556
  title: label
@@ -482,23 +564,35 @@
482
564
  if (norender) {
483
565
  return null;
484
566
  }
485
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
567
+ const uiOptions = utils.getUiOptions(uiSchema);
568
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
569
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { marginTop: 3, ...muiSlotProps?.submitBox, children: /* @__PURE__ */ jsxRuntime.jsx(
570
+ Button,
571
+ {
572
+ type: "submit",
573
+ variant: "contained",
574
+ color: "primary",
575
+ ...submitButtonProps,
576
+ ...otherMuiProps,
577
+ ...muiSlotProps?.submitButton,
578
+ children: submitText
579
+ }
580
+ ) });
486
581
  }
487
- function TitleField({
488
- id,
489
- title,
490
- optionalDataControl
491
- }) {
492
- let heading = /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h5", children: title });
582
+ function TitleField(props) {
583
+ const { id, title, optionalDataControl, uiSchema } = props;
584
+ const uiOptions = utils.getUiOptions(uiSchema);
585
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
586
+ let heading = /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h5", ...muiSlotProps?.titleTypography, children: title });
493
587
  if (optionalDataControl) {
494
- heading = /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, spacing: 0, children: [
495
- /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: "grow", children: heading }),
496
- /* @__PURE__ */ jsxRuntime.jsx(Grid4, { justifyContent: "flex-end", children: optionalDataControl })
588
+ heading = /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, spacing: 0, ...muiSlotProps?.titleGridContainer, children: [
589
+ /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: "grow", ...muiSlotProps?.titleGridItem, children: heading }),
590
+ /* @__PURE__ */ jsxRuntime.jsx(Grid4, { justifyContent: "flex-end", ...muiSlotProps?.titleOptionalDataGridItem, children: optionalDataControl })
497
591
  ] });
498
592
  }
499
- return /* @__PURE__ */ jsxRuntime.jsxs(Box, { id, mb: 1, mt: 1, children: [
593
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { id, mb: 1, mt: 1, ...muiSlotProps?.titleBox, children: [
500
594
  heading,
501
- /* @__PURE__ */ jsxRuntime.jsx(Divider, {})
595
+ /* @__PURE__ */ jsxRuntime.jsx(Divider, { ...muiSlotProps?.titleDivider })
502
596
  ] });
503
597
  }
504
598
  function WrapIfAdditionalTemplate(props) {
@@ -528,39 +622,56 @@
528
622
  paddingRight: 6,
529
623
  fontWeight: "bold"
530
624
  };
625
+ const uiOptions = utils.getUiOptions(uiSchema);
626
+ const { rjsfSlotProps } = getMuiProps(uiOptions);
627
+ const muiSlotProps = rjsfSlotProps;
531
628
  if (!additional) {
532
629
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
533
630
  }
534
- return /* @__PURE__ */ jsxRuntime.jsxs(Grid4, { container: true, alignItems: "flex-start", spacing: 2, className: classNames, style, children: [
535
- /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: 5.5, children: /* @__PURE__ */ jsxRuntime.jsx(
536
- TextField,
537
- {
538
- fullWidth: true,
539
- required,
540
- label: displayLabel ? keyLabel : void 0,
541
- defaultValue: label,
542
- disabled: disabled || readonly,
543
- id: `${id}-key`,
544
- name: `${id}-key`,
545
- onBlur: !readonly ? onKeyRenameBlur : void 0,
546
- type: "text"
547
- }
548
- ) }),
549
- /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: 5.5, children }),
550
- /* @__PURE__ */ jsxRuntime.jsx(Grid4, { sx: { mt: 1.5 }, children: /* @__PURE__ */ jsxRuntime.jsx(
551
- RemoveButton2,
552
- {
553
- id: utils.buttonId(id, "remove"),
554
- className: "rjsf-object-property-remove",
555
- iconType: "default",
556
- style: btnStyle,
557
- disabled: disabled || readonly,
558
- onClick: onRemoveProperty,
559
- uiSchema,
560
- registry
561
- }
562
- ) })
563
- ] }, `${id}-key`);
631
+ const { wrapGridContainer, wrapKeyGridItem, wrapChildrenGridItem, wrapRemoveButtonGridItem } = muiSlotProps || {};
632
+ return /* @__PURE__ */ jsxRuntime.jsxs(
633
+ Grid4,
634
+ {
635
+ container: true,
636
+ alignItems: "flex-start",
637
+ spacing: 2,
638
+ className: classNames,
639
+ style,
640
+ ...wrapGridContainer,
641
+ children: [
642
+ /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: 5.5, ...wrapKeyGridItem, children: /* @__PURE__ */ jsxRuntime.jsx(
643
+ TextField,
644
+ {
645
+ fullWidth: true,
646
+ required,
647
+ label: displayLabel ? keyLabel : void 0,
648
+ defaultValue: label,
649
+ disabled: disabled || readonly,
650
+ id: `${id}-key`,
651
+ name: `${id}-key`,
652
+ onBlur: !readonly ? onKeyRenameBlur : void 0,
653
+ type: "text"
654
+ },
655
+ label
656
+ ) }),
657
+ /* @__PURE__ */ jsxRuntime.jsx(Grid4, { size: 5.5, ...wrapChildrenGridItem, children }),
658
+ /* @__PURE__ */ jsxRuntime.jsx(Grid4, { sx: { mt: 1.5 }, ...wrapRemoveButtonGridItem, children: /* @__PURE__ */ jsxRuntime.jsx(
659
+ RemoveButton2,
660
+ {
661
+ id: utils.buttonId(id, "remove"),
662
+ className: "rjsf-object-property-remove",
663
+ iconType: "default",
664
+ style: btnStyle,
665
+ disabled: disabled || readonly,
666
+ onClick: onRemoveProperty,
667
+ uiSchema,
668
+ registry
669
+ }
670
+ ) })
671
+ ]
672
+ },
673
+ `${id}-key`
674
+ );
564
675
  }
565
676
 
566
677
  // src/Templates/Templates.ts
@@ -620,6 +731,7 @@
620
731
  const _onBlur = () => onBlur(id, value);
621
732
  const _onFocus = () => onFocus(id, value);
622
733
  const description = options.description ?? schema.description;
734
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
623
735
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
624
736
  !hideLabel && description && /* @__PURE__ */ jsxRuntime.jsx(
625
737
  DescriptionFieldTemplate,
@@ -634,6 +746,8 @@
634
746
  /* @__PURE__ */ jsxRuntime.jsx(
635
747
  FormControlLabel,
636
748
  {
749
+ ...otherMuiProps,
750
+ ...muiSlotProps?.formControlLabel,
637
751
  control: /* @__PURE__ */ jsxRuntime.jsx(
638
752
  Checkbox,
639
753
  {
@@ -646,7 +760,8 @@
646
760
  onChange: _onChange,
647
761
  onBlur: _onBlur,
648
762
  onFocus: _onFocus,
649
- "aria-describedby": utils.ariaDescribedByIds(id)
763
+ "aria-describedby": utils.ariaDescribedByIds(id),
764
+ ...muiSlotProps?.checkbox
650
765
  }
651
766
  ),
652
767
  label: utils.labelValue(label, hideLabel, false)
@@ -654,22 +769,24 @@
654
769
  )
655
770
  ] });
656
771
  }
657
- function CheckboxesWidget({
658
- label,
659
- hideLabel,
660
- id,
661
- htmlName,
662
- disabled,
663
- options,
664
- value,
665
- autofocus,
666
- readonly,
667
- required,
668
- onChange,
669
- onBlur,
670
- onFocus
671
- }) {
772
+ function CheckboxesWidget(props) {
773
+ const {
774
+ label,
775
+ hideLabel,
776
+ id,
777
+ htmlName,
778
+ disabled,
779
+ options,
780
+ value,
781
+ autofocus,
782
+ readonly,
783
+ required,
784
+ onChange,
785
+ onBlur,
786
+ onFocus
787
+ } = props;
672
788
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
789
+ const optionValueFormat = utils.getOptionValueFormat(options);
673
790
  const checkboxesValues = Array.isArray(value) ? value : [value];
674
791
  const _onChange = (index) => ({ target: { checked } }) => {
675
792
  if (checked) {
@@ -678,19 +795,21 @@
678
795
  onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
679
796
  }
680
797
  };
681
- const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
682
- const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
798
+ const _onBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
799
+ const _onFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
800
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
683
801
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
684
802
  utils.labelValue(
685
803
  /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, htmlFor: id, children: label || void 0 }),
686
804
  hideLabel
687
805
  ),
688
- /* @__PURE__ */ jsxRuntime.jsx(FormGroup, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
806
+ /* @__PURE__ */ jsxRuntime.jsx(FormGroup, { ...otherMuiProps, ...muiSlotProps?.formGroup, id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
689
807
  const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
690
808
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
691
809
  const checkbox = /* @__PURE__ */ jsxRuntime.jsx(
692
810
  Checkbox,
693
811
  {
812
+ ...muiSlotProps?.checkbox,
694
813
  id: utils.optionId(id, index),
695
814
  name: htmlName || id,
696
815
  checked,
@@ -702,30 +821,28 @@
702
821
  "aria-describedby": utils.ariaDescribedByIds(id)
703
822
  }
704
823
  );
705
- return /* @__PURE__ */ jsxRuntime.jsx(FormControlLabel, { control: checkbox, label: option.label }, index);
824
+ return /* @__PURE__ */ react.createElement(
825
+ FormControlLabel,
826
+ {
827
+ ...muiSlotProps?.formControlLabel,
828
+ control: checkbox,
829
+ key: index,
830
+ label: option.label
831
+ }
832
+ );
706
833
  }) })
707
834
  ] });
708
835
  }
709
- function RadioWidget({
710
- id,
711
- htmlName,
712
- options,
713
- value,
714
- required,
715
- disabled,
716
- readonly,
717
- label,
718
- hideLabel,
719
- onChange,
720
- onBlur,
721
- onFocus
722
- }) {
836
+ function RadioWidget(props) {
837
+ const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
723
838
  const { enumOptions, enumDisabled, emptyValue } = options;
724
- const _onChange = (_, value2) => onChange(utils.enumOptionsValueForIndex(value2, enumOptions, emptyValue));
725
- const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
726
- const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
839
+ const optionValueFormat = utils.getOptionValueFormat(options);
840
+ const _onChange = (_, value2) => onChange(utils.enumOptionValueDecoder(value2, enumOptions, optionValueFormat, emptyValue));
841
+ const _onBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
842
+ const _onFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
727
843
  const row = options ? options.inline : false;
728
- const selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions) ?? null;
844
+ const selectValue = utils.enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, "");
845
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
729
846
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
730
847
  utils.labelValue(
731
848
  /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, htmlFor: id, children: label || void 0 }),
@@ -734,9 +851,11 @@
734
851
  /* @__PURE__ */ jsxRuntime.jsx(
735
852
  RadioGroup,
736
853
  {
854
+ ...otherMuiProps,
855
+ ...muiSlotProps?.radioGroup,
737
856
  id,
738
857
  name: htmlName || id,
739
- value: selectedIndex,
858
+ value: selectValue,
740
859
  row,
741
860
  onChange: _onChange,
742
861
  onBlur: _onBlur,
@@ -744,15 +863,16 @@
744
863
  "aria-describedby": utils.ariaDescribedByIds(id),
745
864
  children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
746
865
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
747
- const radio = /* @__PURE__ */ jsxRuntime.jsx(
866
+ const radio = /* @__PURE__ */ react.createElement(
748
867
  FormControlLabel,
749
868
  {
750
- control: /* @__PURE__ */ jsxRuntime.jsx(Radio, { name: htmlName || id, id: utils.optionId(id, index), color: "primary" }),
869
+ ...muiSlotProps?.formControlLabel,
870
+ control: /* @__PURE__ */ jsxRuntime.jsx(Radio, { ...muiSlotProps?.radio, name: htmlName || id, id: utils.optionId(id, index), color: "primary" }),
751
871
  label: option.label,
752
- value: String(index),
872
+ value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
873
+ key: index,
753
874
  disabled: disabled || itemDisabled || readonly
754
- },
755
- index
875
+ }
756
876
  );
757
877
  return radio;
758
878
  })
@@ -768,6 +888,7 @@
768
888
  };
769
889
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
770
890
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
891
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
771
892
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
772
893
  utils.labelValue(
773
894
  /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, htmlFor: id, children: label || void 0 }),
@@ -781,55 +902,59 @@
781
902
  onBlur: _onBlur,
782
903
  onFocus: _onFocus,
783
904
  valueLabelDisplay: "auto",
905
+ ...otherMuiProps,
906
+ ...muiSlotProps?.slider,
784
907
  ...sliderProps,
785
908
  "aria-describedby": utils.ariaDescribedByIds(id)
786
909
  }
787
910
  )
788
911
  ] });
789
912
  }
790
- function SelectWidget({
791
- schema,
792
- id,
793
- name,
794
- // remove this from textFieldProps
795
- htmlName,
796
- options,
797
- label,
798
- hideLabel,
799
- required,
800
- disabled,
801
- placeholder,
802
- readonly,
803
- value,
804
- multiple,
805
- autofocus,
806
- onChange,
807
- onBlur,
808
- onFocus,
809
- errorSchema,
810
- rawErrors = [],
811
- registry,
812
- uiSchema,
813
- hideError,
814
- ...textFieldProps
815
- }) {
913
+ function SelectWidget(props) {
914
+ const {
915
+ schema,
916
+ id,
917
+ name,
918
+ // remove this from textFieldProps
919
+ htmlName,
920
+ options,
921
+ label,
922
+ hideLabel,
923
+ required,
924
+ disabled,
925
+ placeholder,
926
+ readonly,
927
+ value,
928
+ multiple,
929
+ autofocus,
930
+ onChange,
931
+ onBlur,
932
+ onFocus,
933
+ errorSchema,
934
+ rawErrors = [],
935
+ registry,
936
+ uiSchema,
937
+ hideError,
938
+ ...textFieldProps
939
+ } = props;
816
940
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
817
- multiple = typeof multiple === "undefined" ? false : !!multiple;
818
- const emptyValue = multiple ? [] : "";
819
- const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
820
- const _onChange = ({ target: { value: value2 } }) => onChange(utils.enumOptionsValueForIndex(value2, enumOptions, optEmptyVal));
821
- const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, optEmptyVal));
822
- const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, optEmptyVal));
823
- const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
941
+ const optionValueFormat = utils.getOptionValueFormat(options);
942
+ const isMultiple = typeof multiple === "undefined" ? false : !!multiple;
943
+ const emptyValue = isMultiple ? [] : "";
944
+ const isEmpty = typeof value === "undefined" || isMultiple && value.length < 1 || !isMultiple && value === emptyValue;
945
+ const _onChange = ({ target: { value: value2 } }) => onChange(utils.enumOptionValueDecoder(value2, enumOptions, optionValueFormat, optEmptyVal));
946
+ const _onBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
947
+ const _onFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
948
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
824
949
  const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
825
- const showPlaceholderOption = !multiple && schema.default === void 0;
950
+ const showPlaceholderOption = !isMultiple && schema.default === void 0;
826
951
  return /* @__PURE__ */ jsxRuntime.jsxs(
827
952
  TextField,
828
953
  {
829
954
  id,
830
955
  name: htmlName || id,
831
956
  label: utils.labelValue(label || void 0, hideLabel, void 0),
832
- value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
957
+ value: utils.enumOptionSelectedValue(value, enumOptions, isMultiple, optionValueFormat, emptyValue),
833
958
  required,
834
959
  disabled: disabled || readonly,
835
960
  autoFocus: autofocus,
@@ -839,22 +964,25 @@
839
964
  onChange: _onChange,
840
965
  onBlur: _onBlur,
841
966
  onFocus: _onFocus,
842
- ...textFieldRemainingProps,
967
+ ...{ ...otherMuiProps, ...textFieldRemainingProps },
843
968
  select: true,
844
- InputLabelProps: {
845
- ...InputLabelProps,
846
- shrink: !isEmpty
847
- },
848
- SelectProps: {
849
- ...SelectProps,
850
- multiple
969
+ slotProps: {
970
+ ...muiSlotProps,
971
+ inputLabel: {
972
+ ...muiSlotProps?.inputLabel,
973
+ shrink: !isEmpty
974
+ },
975
+ select: {
976
+ ...muiSlotProps?.select,
977
+ multiple
978
+ }
851
979
  },
852
980
  "aria-describedby": utils.ariaDescribedByIds(id),
853
981
  children: [
854
982
  showPlaceholderOption && /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { value: "", children: placeholder }),
855
983
  Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
856
984
  const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
857
- return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { value: String(i), disabled: disabled2, children: label2 }, i);
985
+ return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { value: utils.enumOptionValueEncoder(value2, i, optionValueFormat), disabled: disabled2, children: label2 }, i);
858
986
  })
859
987
  ]
860
988
  }