@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.esm.js CHANGED
@@ -4,7 +4,28 @@ import { withTheme } from "@rjsf/core";
4
4
  // src/AddButton/AddButton.tsx
5
5
  import AddIcon from "@mui/icons-material/Add";
6
6
  import IconButton from "@mui/material/IconButton";
7
- import { TranslatableString } from "@rjsf/utils";
7
+ import {
8
+ getUiOptions,
9
+ TranslatableString
10
+ } from "@rjsf/utils";
11
+
12
+ // src/util.ts
13
+ function getMuiProps(options, propsToFilter, rjsfSlotPropsOnly) {
14
+ const muiProps = options?.mui || {};
15
+ if (rjsfSlotPropsOnly) {
16
+ const { rjsfSlotProps } = muiProps;
17
+ return { rjsfSlotProps };
18
+ }
19
+ if (propsToFilter) {
20
+ return Object.keys(muiProps).filter((key) => propsToFilter.includes(key)).reduce((obj, key) => {
21
+ obj[key] = muiProps[key];
22
+ return obj;
23
+ }, {});
24
+ }
25
+ return muiProps;
26
+ }
27
+
28
+ // src/AddButton/AddButton.tsx
8
29
  import { jsx } from "react/jsx-runtime";
9
30
  function AddButton({
10
31
  uiSchema,
@@ -12,7 +33,16 @@ function AddButton({
12
33
  ...props
13
34
  }) {
14
35
  const { translateString } = registry;
15
- return /* @__PURE__ */ jsx(IconButton, { title: translateString(TranslatableString.AddItemButton), ...props, color: "primary", children: /* @__PURE__ */ jsx(AddIcon, {}) });
36
+ const uiOptions = getUiOptions(uiSchema);
37
+ const muiProps = getMuiProps(uiOptions, [
38
+ "color",
39
+ "disableFocusRipple",
40
+ "disableRipple",
41
+ "edge",
42
+ "size",
43
+ "sx"
44
+ ]);
45
+ return /* @__PURE__ */ jsx(IconButton, { title: translateString(TranslatableString.AddItemButton), ...props, color: "primary", ...muiProps, children: /* @__PURE__ */ jsx(AddIcon, {}) });
16
46
  }
17
47
 
18
48
  // src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
@@ -20,13 +50,13 @@ import Box from "@mui/material/Box";
20
50
  import Grid from "@mui/material/Grid";
21
51
  import Paper from "@mui/material/Paper";
22
52
  import {
23
- getUiOptions,
53
+ getUiOptions as getUiOptions2,
24
54
  getTemplate
25
55
  } from "@rjsf/utils";
26
56
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
27
57
  function ArrayFieldItemTemplate(props) {
28
58
  const { children, buttonsProps, hasDescription, hasToolbar, uiSchema, registry } = props;
29
- const uiOptions = getUiOptions(uiSchema);
59
+ const uiOptions = getUiOptions2(uiSchema);
30
60
  const ArrayFieldItemButtonsTemplate = getTemplate(
31
61
  "ArrayFieldItemButtonsTemplate",
32
62
  registry,
@@ -39,9 +69,18 @@ function ArrayFieldItemTemplate(props) {
39
69
  fontWeight: "bold",
40
70
  minWidth: 0
41
71
  };
42
- return /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", children: [
43
- /* @__PURE__ */ jsx2(Grid, { size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 }, style: { overflow: "auto" }, children: /* @__PURE__ */ jsx2(Box, { mb: 2, children: /* @__PURE__ */ jsx2(Paper, { elevation: 2, children: /* @__PURE__ */ jsx2(Box, { p: 2, children }) }) }) }),
44
- hasToolbar && /* @__PURE__ */ jsx2(Grid, { sx: { mt: hasDescription ? -5 : -1.5 }, children: /* @__PURE__ */ jsx2(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
72
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
73
+ return /* @__PURE__ */ jsxs(Grid, { container: true, alignItems: "center", ...muiSlotProps?.arrayItemGridContainer, children: [
74
+ /* @__PURE__ */ jsx2(
75
+ Grid,
76
+ {
77
+ size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 },
78
+ style: { overflow: "auto" },
79
+ ...muiSlotProps?.arrayItemGridItem,
80
+ children: /* @__PURE__ */ jsx2(Box, { mb: 2, ...muiSlotProps?.arrayItemOuterBox, children: /* @__PURE__ */ jsx2(Paper, { elevation: 2, ...muiSlotProps?.arrayItemPaper, children: /* @__PURE__ */ jsx2(Box, { p: 2, ...muiSlotProps?.arrayItemInnerBox, children }) }) })
81
+ }
82
+ ),
83
+ hasToolbar && /* @__PURE__ */ jsx2(Grid, { sx: { mt: hasDescription ? -5 : -1.5 }, ...muiSlotProps?.arrayItemToolbarGrid, children: /* @__PURE__ */ jsx2(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) })
45
84
  ] });
46
85
  }
47
86
 
@@ -51,7 +90,7 @@ import Grid2 from "@mui/material/Grid";
51
90
  import Paper2 from "@mui/material/Paper";
52
91
  import {
53
92
  getTemplate as getTemplate2,
54
- getUiOptions as getUiOptions2,
93
+ getUiOptions as getUiOptions3,
55
94
  buttonId
56
95
  } from "@rjsf/utils";
57
96
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -70,7 +109,7 @@ function ArrayFieldTemplate(props) {
70
109
  schema,
71
110
  title
72
111
  } = props;
73
- const uiOptions = getUiOptions2(uiSchema);
112
+ const uiOptions = getUiOptions3(uiSchema);
74
113
  const ArrayFieldDescriptionTemplate = getTemplate2(
75
114
  "ArrayFieldDescriptionTemplate",
76
115
  registry,
@@ -85,7 +124,8 @@ function ArrayFieldTemplate(props) {
85
124
  const {
86
125
  ButtonTemplates: { AddButton: AddButton2 }
87
126
  } = registry.templates;
88
- return /* @__PURE__ */ jsx3(Paper2, { elevation: 2, children: /* @__PURE__ */ jsxs2(Box2, { p: 2, children: [
127
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
128
+ return /* @__PURE__ */ jsx3(Paper2, { elevation: 2, ...muiSlotProps?.arrayPaper, children: /* @__PURE__ */ jsxs2(Box2, { p: 2, ...muiSlotProps?.arrayBox, children: [
89
129
  /* @__PURE__ */ jsx3(
90
130
  ArrayFieldTitleTemplate,
91
131
  {
@@ -110,7 +150,7 @@ function ArrayFieldTemplate(props) {
110
150
  ),
111
151
  !showOptionalDataControlInTitle ? optionalDataControl : void 0,
112
152
  items,
113
- canAdd && /* @__PURE__ */ jsx3(Grid2, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsx3(Grid2, { children: /* @__PURE__ */ jsx3(Box2, { mt: 2, children: /* @__PURE__ */ jsx3(
153
+ canAdd && /* @__PURE__ */ jsx3(Grid2, { container: true, justifyContent: "flex-end", ...muiSlotProps?.arrayAddButtonGridContainer, children: /* @__PURE__ */ jsx3(Grid2, { ...muiSlotProps?.arrayAddButtonGridItem, children: /* @__PURE__ */ jsx3(Box2, { mt: 2, ...muiSlotProps?.arrayAddButtonBox, children: /* @__PURE__ */ jsx3(
114
154
  AddButton2,
115
155
  {
116
156
  id: buttonId(fieldPathId, "add"),
@@ -170,8 +210,11 @@ function BaseInputTemplate(props) {
170
210
  } = props;
171
211
  const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
172
212
  const { step, min, max, accept, ...rest } = getInputProps(schema, type, options);
213
+ const muiProps = getMuiProps(options);
214
+ const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;
173
215
  const htmlInputProps = {
174
216
  ...slotProps?.htmlInput,
217
+ ...muiSlotProps?.htmlInput,
175
218
  step,
176
219
  min,
177
220
  max,
@@ -181,7 +224,7 @@ function BaseInputTemplate(props) {
181
224
  const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
182
225
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
183
226
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
184
- const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...InputLabelProps };
227
+ const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps, shrink: true } : { ...slotProps?.inputLabel, ...muiSlotProps?.inputLabel, ...InputLabelProps };
185
228
  const _onClear = useCallback(
186
229
  (e) => {
187
230
  e.preventDefault();
@@ -190,7 +233,7 @@ function BaseInputTemplate(props) {
190
233
  },
191
234
  [onChange, options.emptyValue]
192
235
  );
193
- const inputProps = { ...InputProps, ...slotProps?.input };
236
+ const inputProps = { ...InputProps, ...slotProps?.input, ...muiSlotProps?.input };
194
237
  if (options.allowClearTextInputs && value && !readonly && !disabled) {
195
238
  const clearAdornment = /* @__PURE__ */ jsx4(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick: _onClear }) });
196
239
  inputProps.endAdornment = !inputProps.endAdornment ? clearAdornment : /* @__PURE__ */ jsxs3(Fragment, { children: [
@@ -211,6 +254,7 @@ function BaseInputTemplate(props) {
211
254
  disabled: disabled || readonly,
212
255
  slotProps: {
213
256
  ...slotProps,
257
+ ...muiSlotProps,
214
258
  input: inputProps,
215
259
  htmlInput: htmlInputProps,
216
260
  inputLabel: DisplayInputLabelProps
@@ -221,7 +265,7 @@ function BaseInputTemplate(props) {
221
265
  onChange: onChangeOverride || _onChange,
222
266
  onBlur: _onBlur,
223
267
  onFocus: _onFocus,
224
- ...textFieldProps,
268
+ ...{ ...otherMuiProps, ...textFieldProps },
225
269
  "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
226
270
  }
227
271
  ),
@@ -231,12 +275,18 @@ function BaseInputTemplate(props) {
231
275
 
232
276
  // src/DescriptionField/DescriptionField.tsx
233
277
  import Typography from "@mui/material/Typography";
278
+ import {
279
+ getUiOptions as getUiOptions4
280
+ } from "@rjsf/utils";
234
281
  import { RichDescription } from "@rjsf/core";
235
282
  import { jsx as jsx5 } from "react/jsx-runtime";
236
283
  function DescriptionField(props) {
237
284
  const { id, description, registry, uiSchema } = props;
285
+ const uiOptions = getUiOptions4(uiSchema);
286
+ const muiProps = getMuiProps(uiOptions);
287
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
238
288
  if (description) {
239
- return /* @__PURE__ */ jsx5(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" }, children: /* @__PURE__ */ jsx5(RichDescription, { description, registry, uiSchema }) });
289
+ return /* @__PURE__ */ jsx5(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" }, ...muiSlotProps?.descTypography, children: /* @__PURE__ */ jsx5(RichDescription, { description, registry, uiSchema }) });
240
290
  }
241
291
  return null;
242
292
  }
@@ -250,19 +300,25 @@ import ListItemIcon from "@mui/material/ListItemIcon";
250
300
  import ListItemText from "@mui/material/ListItemText";
251
301
  import Paper3 from "@mui/material/Paper";
252
302
  import Typography2 from "@mui/material/Typography";
253
- import { TranslatableString as TranslatableString2 } from "@rjsf/utils";
303
+ import {
304
+ TranslatableString as TranslatableString2,
305
+ getUiOptions as getUiOptions5
306
+ } from "@rjsf/utils";
254
307
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
255
308
  function ErrorList({
256
309
  errors,
257
- registry
310
+ registry,
311
+ uiSchema
258
312
  }) {
259
313
  const { translateString } = registry;
260
- return /* @__PURE__ */ jsx6(Paper3, { elevation: 2, children: /* @__PURE__ */ jsxs4(Box3, { mb: 2, p: 2, children: [
261
- /* @__PURE__ */ jsx6(Typography2, { variant: "h6", children: translateString(TranslatableString2.ErrorsLabel) }),
262
- /* @__PURE__ */ jsx6(List, { dense: true, children: errors.map((error, i) => {
263
- return /* @__PURE__ */ jsxs4(ListItem, { children: [
264
- /* @__PURE__ */ jsx6(ListItemIcon, { children: /* @__PURE__ */ jsx6(ErrorIcon, { color: "error" }) }),
265
- /* @__PURE__ */ jsx6(ListItemText, { primary: error.stack })
314
+ const uiOptions = getUiOptions5(uiSchema);
315
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
316
+ return /* @__PURE__ */ jsx6(Paper3, { elevation: 2, ...muiSlotProps?.errorPaper, children: /* @__PURE__ */ jsxs4(Box3, { mb: 2, p: 2, ...muiSlotProps?.errorBox, children: [
317
+ /* @__PURE__ */ jsx6(Typography2, { variant: "h6", ...muiSlotProps?.errorTypography, children: translateString(TranslatableString2.ErrorsLabel) }),
318
+ /* @__PURE__ */ jsx6(List, { dense: true, ...muiSlotProps?.errorList, children: errors.map((error, i) => {
319
+ return /* @__PURE__ */ jsxs4(ListItem, { ...muiSlotProps?.errorListItem, children: [
320
+ /* @__PURE__ */ jsx6(ListItemIcon, { ...muiSlotProps?.errorListItemIcon, children: /* @__PURE__ */ jsx6(ErrorIcon, { color: "error" }) }),
321
+ /* @__PURE__ */ jsx6(ListItemText, { primary: error.stack, ...muiSlotProps?.errorListItemText })
266
322
  ] }, i);
267
323
  }) })
268
324
  ] }) });
@@ -275,11 +331,23 @@ import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
275
331
  import CopyIcon from "@mui/icons-material/ContentCopy";
276
332
  import RemoveIcon from "@mui/icons-material/Remove";
277
333
  import ClearIcon from "@mui/icons-material/Clear";
278
- import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
334
+ import {
335
+ TranslatableString as TranslatableString3,
336
+ getUiOptions as getUiOptions6
337
+ } from "@rjsf/utils";
279
338
  import { jsx as jsx7 } from "react/jsx-runtime";
280
339
  function MuiIconButton(props) {
281
340
  const { icon, color, uiSchema, registry, ...otherProps } = props;
282
- return /* @__PURE__ */ jsx7(IconButton2, { ...otherProps, size: "small", color, children: icon });
341
+ const uiOptions = getUiOptions6(uiSchema);
342
+ const muiProps = getMuiProps(uiOptions, [
343
+ "color",
344
+ "disableFocusRipple",
345
+ "disableRipple",
346
+ "edge",
347
+ "size",
348
+ "sx"
349
+ ]);
350
+ return /* @__PURE__ */ jsx7(IconButton2, { ...muiProps, ...otherProps, size: "small", color, children: icon });
283
351
  }
284
352
  function CopyButton(props) {
285
353
  const {
@@ -354,22 +422,31 @@ function ClearButton(props) {
354
422
  import ListItem2 from "@mui/material/ListItem";
355
423
  import FormHelperText from "@mui/material/FormHelperText";
356
424
  import List2 from "@mui/material/List";
357
- import { errorId } from "@rjsf/utils";
425
+ import {
426
+ errorId,
427
+ getUiOptions as getUiOptions7
428
+ } from "@rjsf/utils";
358
429
  import { jsx as jsx8 } from "react/jsx-runtime";
359
430
  function FieldErrorTemplate(props) {
360
- const { errors = [], fieldPathId } = props;
431
+ const { errors = [], fieldPathId, uiSchema } = props;
361
432
  if (errors.length === 0) {
362
433
  return null;
363
434
  }
364
435
  const id = errorId(fieldPathId);
365
- return /* @__PURE__ */ jsx8(List2, { id, dense: true, disablePadding: true, children: errors.map((error, i) => {
366
- return /* @__PURE__ */ jsx8(ListItem2, { disableGutters: true, children: /* @__PURE__ */ jsx8(FormHelperText, { component: "div", id: `${id}-${i}`, children: error }) }, i);
436
+ const uiOptions = getUiOptions7(uiSchema);
437
+ const muiProps = getMuiProps(uiOptions);
438
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
439
+ return /* @__PURE__ */ jsx8(List2, { id, dense: true, disablePadding: true, ...muiSlotProps?.fieldErrorList, children: errors.map((error, i) => {
440
+ return /* @__PURE__ */ jsx8(ListItem2, { disableGutters: true, ...muiSlotProps?.fieldErrorListItem, children: /* @__PURE__ */ jsx8(FormHelperText, { component: "div", id: `${id}-${i}`, ...muiSlotProps?.fieldErrorFormHelperText, children: error }) }, i);
367
441
  }) });
368
442
  }
369
443
 
370
444
  // src/FieldHelpTemplate/FieldHelpTemplate.tsx
371
445
  import { RichHelp } from "@rjsf/core";
372
- import { helpId } from "@rjsf/utils";
446
+ import {
447
+ helpId,
448
+ getUiOptions as getUiOptions8
449
+ } from "@rjsf/utils";
373
450
  import FormHelperText2 from "@mui/material/FormHelperText";
374
451
  import { jsx as jsx9 } from "react/jsx-runtime";
375
452
  function FieldHelpTemplate(props) {
@@ -377,7 +454,19 @@ function FieldHelpTemplate(props) {
377
454
  if (!help) {
378
455
  return null;
379
456
  }
380
- return /* @__PURE__ */ jsx9(FormHelperText2, { component: "div", id: helpId(fieldPathId), style: { marginTop: "5px" }, children: /* @__PURE__ */ jsx9(RichHelp, { help, registry, uiSchema }) });
457
+ const uiOptions = getUiOptions8(uiSchema);
458
+ const muiProps = getMuiProps(uiOptions);
459
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
460
+ return /* @__PURE__ */ jsx9(
461
+ FormHelperText2,
462
+ {
463
+ component: "div",
464
+ id: helpId(fieldPathId),
465
+ style: { marginTop: "5px" },
466
+ ...muiSlotProps?.helpFormHelperText,
467
+ children: /* @__PURE__ */ jsx9(RichHelp, { help, registry, uiSchema })
468
+ }
469
+ );
381
470
  }
382
471
 
383
472
  // src/FieldTemplate/FieldTemplate.tsx
@@ -385,7 +474,7 @@ import FormControl from "@mui/material/FormControl";
385
474
  import Typography3 from "@mui/material/Typography";
386
475
  import {
387
476
  getTemplate as getTemplate3,
388
- getUiOptions as getUiOptions3
477
+ getUiOptions as getUiOptions9
389
478
  } from "@rjsf/utils";
390
479
  import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
391
480
  function FieldTemplate(props) {
@@ -412,7 +501,7 @@ function FieldTemplate(props) {
412
501
  uiSchema,
413
502
  registry
414
503
  } = props;
415
- const uiOptions = getUiOptions3(uiSchema);
504
+ const uiOptions = getUiOptions9(uiSchema);
416
505
  const WrapIfAdditionalTemplate2 = getTemplate3(
417
506
  "WrapIfAdditionalTemplate",
418
507
  registry,
@@ -422,6 +511,7 @@ function FieldTemplate(props) {
422
511
  return /* @__PURE__ */ jsx10("div", { style: { display: "none" }, children });
423
512
  }
424
513
  const isCheckbox = uiOptions.widget === "checkbox";
514
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
425
515
  return /* @__PURE__ */ jsx10(
426
516
  WrapIfAdditionalTemplate2,
427
517
  {
@@ -440,12 +530,23 @@ function FieldTemplate(props) {
440
530
  schema,
441
531
  uiSchema,
442
532
  registry,
443
- children: /* @__PURE__ */ jsxs5(FormControl, { fullWidth: true, error: rawErrors.length ? true : false, required, children: [
444
- children,
445
- displayLabel && !isCheckbox && rawDescription ? /* @__PURE__ */ jsx10(Typography3, { variant: "caption", color: "textSecondary", children: description }) : null,
446
- errors,
447
- help
448
- ] })
533
+ children: /* @__PURE__ */ jsxs5(
534
+ FormControl,
535
+ {
536
+ fullWidth: true,
537
+ error: rawErrors.length ? true : false,
538
+ required,
539
+ ...muiSlotProps?.fieldFormControl,
540
+ sx: otherMuiProps.sx,
541
+ className: otherMuiProps.className,
542
+ children: [
543
+ children,
544
+ displayLabel && !isCheckbox && rawDescription ? /* @__PURE__ */ jsx10(Typography3, { variant: "caption", color: "textSecondary", ...muiSlotProps?.fieldTypography, children: description }) : null,
545
+ errors,
546
+ help
547
+ ]
548
+ }
549
+ )
449
550
  }
450
551
  );
451
552
  }
@@ -461,11 +562,16 @@ function GridTemplate(props) {
461
562
  // src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
462
563
  import Box4 from "@mui/material/Box";
463
564
  import FormControl2 from "@mui/material/FormControl";
565
+ import {
566
+ getUiOptions as getUiOptions10
567
+ } from "@rjsf/utils";
464
568
  import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
465
569
  function MultiSchemaFieldTemplate(props) {
466
- const { optionSchemaField, selector } = props;
467
- return /* @__PURE__ */ jsxs6(Box4, { sx: { mb: 2 }, children: [
468
- /* @__PURE__ */ jsx12(FormControl2, { fullWidth: true, sx: { mb: 2 }, children: selector }),
570
+ const { optionSchemaField, selector, uiSchema } = props;
571
+ const uiOptions = getUiOptions10(uiSchema);
572
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
573
+ return /* @__PURE__ */ jsxs6(Box4, { sx: { mb: 2 }, ...muiSlotProps?.multiBox, children: [
574
+ /* @__PURE__ */ jsx12(FormControl2, { fullWidth: true, sx: { mb: 2 }, ...muiSlotProps?.multiFormControl, children: selector }),
469
575
  optionSchemaField
470
576
  ] });
471
577
  }
@@ -476,7 +582,7 @@ import {
476
582
  canExpand,
477
583
  descriptionId,
478
584
  getTemplate as getTemplate4,
479
- getUiOptions as getUiOptions4,
585
+ getUiOptions as getUiOptions11,
480
586
  titleId,
481
587
  buttonId as buttonId2
482
588
  } from "@rjsf/utils";
@@ -497,7 +603,7 @@ function ObjectFieldTemplate(props) {
497
603
  onAddProperty,
498
604
  registry
499
605
  } = props;
500
- const uiOptions = getUiOptions4(uiSchema);
606
+ const uiOptions = getUiOptions11(uiSchema);
501
607
  const TitleFieldTemplate = getTemplate4("TitleFieldTemplate", registry, uiOptions);
502
608
  const DescriptionFieldTemplate = getTemplate4(
503
609
  "DescriptionFieldTemplate",
@@ -508,6 +614,7 @@ function ObjectFieldTemplate(props) {
508
614
  const {
509
615
  ButtonTemplates: { AddButton: AddButton2 }
510
616
  } = registry.templates;
617
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
511
618
  return /* @__PURE__ */ jsxs7(Fragment2, { children: [
512
619
  title && /* @__PURE__ */ jsx13(
513
620
  TitleFieldTemplate,
@@ -531,17 +638,17 @@ function ObjectFieldTemplate(props) {
531
638
  registry
532
639
  }
533
640
  ),
534
- /* @__PURE__ */ jsxs7(Grid4, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
641
+ /* @__PURE__ */ jsxs7(Grid4, { container: true, spacing: 2, style: { marginTop: "10px" }, ...muiSlotProps?.objectGridContainer, children: [
535
642
  !showOptionalDataControlInTitle ? optionalDataControl : void 0,
536
643
  properties.map(
537
644
  (element, index) => (
538
645
  // Remove the <Grid> if the inner element is hidden as the <Grid>
539
646
  // itself would otherwise still take up space.
540
- element.hidden ? element.content : /* @__PURE__ */ jsx13(Grid4, { size: { xs: 12 }, style: { marginBottom: "10px" }, children: element.content }, index)
647
+ element.hidden ? element.content : /* @__PURE__ */ jsx13(Grid4, { size: { xs: 12 }, style: { marginBottom: "10px" }, ...muiSlotProps?.objectGridItem, children: element.content }, index)
541
648
  )
542
649
  )
543
650
  ] }),
544
- canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx13(Grid4, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsx13(Grid4, { children: /* @__PURE__ */ jsx13(
651
+ canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx13(Grid4, { container: true, justifyContent: "flex-end", ...muiSlotProps?.objectAddButtonGridContainer, children: /* @__PURE__ */ jsx13(Grid4, { ...muiSlotProps?.objectAddButtonGridItem, children: /* @__PURE__ */ jsx13(
545
652
  AddButton2,
546
653
  {
547
654
  id: buttonId2(fieldPathId, "add"),
@@ -559,13 +666,14 @@ function ObjectFieldTemplate(props) {
559
666
  import AddIcon2 from "@mui/icons-material/Add";
560
667
  import { jsx as jsx14 } from "react/jsx-runtime";
561
668
  function OptionalDataControlsTemplate(props) {
562
- const { id, registry, label, onAddClick, onRemoveClick } = props;
669
+ const { id, registry, label, onAddClick, onRemoveClick, uiSchema } = props;
563
670
  if (onAddClick) {
564
671
  return /* @__PURE__ */ jsx14(
565
672
  MuiIconButton,
566
673
  {
567
674
  id,
568
675
  registry,
676
+ uiSchema,
569
677
  className: "rjsf-add-optional-data",
570
678
  onClick: onAddClick,
571
679
  title: label,
@@ -578,6 +686,7 @@ function OptionalDataControlsTemplate(props) {
578
686
  {
579
687
  id,
580
688
  registry,
689
+ uiSchema,
581
690
  className: "rjsf-remove-optional-data",
582
691
  onClick: onRemoveClick,
583
692
  title: label
@@ -590,14 +699,30 @@ function OptionalDataControlsTemplate(props) {
590
699
  // src/SubmitButton/SubmitButton.tsx
591
700
  import Box5 from "@mui/material/Box";
592
701
  import Button from "@mui/material/Button";
593
- import { getSubmitButtonOptions } from "@rjsf/utils";
702
+ import {
703
+ getSubmitButtonOptions,
704
+ getUiOptions as getUiOptions12
705
+ } from "@rjsf/utils";
594
706
  import { jsx as jsx15 } from "react/jsx-runtime";
595
707
  function SubmitButton({ uiSchema }) {
596
708
  const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
597
709
  if (norender) {
598
710
  return null;
599
711
  }
600
- return /* @__PURE__ */ jsx15(Box5, { marginTop: 3, children: /* @__PURE__ */ jsx15(Button, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
712
+ const uiOptions = getUiOptions12(uiSchema);
713
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(uiOptions);
714
+ return /* @__PURE__ */ jsx15(Box5, { marginTop: 3, ...muiSlotProps?.submitBox, children: /* @__PURE__ */ jsx15(
715
+ Button,
716
+ {
717
+ type: "submit",
718
+ variant: "contained",
719
+ color: "primary",
720
+ ...submitButtonProps,
721
+ ...otherMuiProps,
722
+ ...muiSlotProps?.submitButton,
723
+ children: submitText
724
+ }
725
+ ) });
601
726
  }
602
727
 
603
728
  // src/TitleField/TitleField.tsx
@@ -605,22 +730,24 @@ import Box6 from "@mui/material/Box";
605
730
  import Divider from "@mui/material/Divider";
606
731
  import Grid5 from "@mui/material/Grid";
607
732
  import Typography4 from "@mui/material/Typography";
733
+ import {
734
+ getUiOptions as getUiOptions13
735
+ } from "@rjsf/utils";
608
736
  import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
609
- function TitleField({
610
- id,
611
- title,
612
- optionalDataControl
613
- }) {
614
- let heading = /* @__PURE__ */ jsx16(Typography4, { variant: "h5", children: title });
737
+ function TitleField(props) {
738
+ const { id, title, optionalDataControl, uiSchema } = props;
739
+ const uiOptions = getUiOptions13(uiSchema);
740
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
741
+ let heading = /* @__PURE__ */ jsx16(Typography4, { variant: "h5", ...muiSlotProps?.titleTypography, children: title });
615
742
  if (optionalDataControl) {
616
- heading = /* @__PURE__ */ jsxs8(Grid5, { container: true, spacing: 0, children: [
617
- /* @__PURE__ */ jsx16(Grid5, { size: "grow", children: heading }),
618
- /* @__PURE__ */ jsx16(Grid5, { justifyContent: "flex-end", children: optionalDataControl })
743
+ heading = /* @__PURE__ */ jsxs8(Grid5, { container: true, spacing: 0, ...muiSlotProps?.titleGridContainer, children: [
744
+ /* @__PURE__ */ jsx16(Grid5, { size: "grow", ...muiSlotProps?.titleGridItem, children: heading }),
745
+ /* @__PURE__ */ jsx16(Grid5, { justifyContent: "flex-end", ...muiSlotProps?.titleOptionalDataGridItem, children: optionalDataControl })
619
746
  ] });
620
747
  }
621
- return /* @__PURE__ */ jsxs8(Box6, { id, mb: 1, mt: 1, children: [
748
+ return /* @__PURE__ */ jsxs8(Box6, { id, mb: 1, mt: 1, ...muiSlotProps?.titleBox, children: [
622
749
  heading,
623
- /* @__PURE__ */ jsx16(Divider, {})
750
+ /* @__PURE__ */ jsx16(Divider, { ...muiSlotProps?.titleDivider })
624
751
  ] });
625
752
  }
626
753
 
@@ -630,7 +757,8 @@ import TextField2 from "@mui/material/TextField";
630
757
  import {
631
758
  ADDITIONAL_PROPERTY_FLAG,
632
759
  buttonId as buttonId3,
633
- TranslatableString as TranslatableString4
760
+ TranslatableString as TranslatableString4,
761
+ getUiOptions as getUiOptions14
634
762
  } from "@rjsf/utils";
635
763
  import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
636
764
  function WrapIfAdditionalTemplate(props) {
@@ -660,39 +788,56 @@ function WrapIfAdditionalTemplate(props) {
660
788
  paddingRight: 6,
661
789
  fontWeight: "bold"
662
790
  };
791
+ const uiOptions = getUiOptions14(uiSchema);
792
+ const { rjsfSlotProps } = getMuiProps(uiOptions);
793
+ const muiSlotProps = rjsfSlotProps;
663
794
  if (!additional) {
664
795
  return /* @__PURE__ */ jsx17("div", { className: classNames, style, children });
665
796
  }
666
- return /* @__PURE__ */ jsxs9(Grid6, { container: true, alignItems: "flex-start", spacing: 2, className: classNames, style, children: [
667
- /* @__PURE__ */ jsx17(Grid6, { size: 5.5, children: /* @__PURE__ */ jsx17(
668
- TextField2,
669
- {
670
- fullWidth: true,
671
- required,
672
- label: displayLabel ? keyLabel : void 0,
673
- defaultValue: label,
674
- disabled: disabled || readonly,
675
- id: `${id}-key`,
676
- name: `${id}-key`,
677
- onBlur: !readonly ? onKeyRenameBlur : void 0,
678
- type: "text"
679
- }
680
- ) }),
681
- /* @__PURE__ */ jsx17(Grid6, { size: 5.5, children }),
682
- /* @__PURE__ */ jsx17(Grid6, { sx: { mt: 1.5 }, children: /* @__PURE__ */ jsx17(
683
- RemoveButton2,
684
- {
685
- id: buttonId3(id, "remove"),
686
- className: "rjsf-object-property-remove",
687
- iconType: "default",
688
- style: btnStyle,
689
- disabled: disabled || readonly,
690
- onClick: onRemoveProperty,
691
- uiSchema,
692
- registry
693
- }
694
- ) })
695
- ] }, `${id}-key`);
797
+ const { wrapGridContainer, wrapKeyGridItem, wrapChildrenGridItem, wrapRemoveButtonGridItem } = muiSlotProps || {};
798
+ return /* @__PURE__ */ jsxs9(
799
+ Grid6,
800
+ {
801
+ container: true,
802
+ alignItems: "flex-start",
803
+ spacing: 2,
804
+ className: classNames,
805
+ style,
806
+ ...wrapGridContainer,
807
+ children: [
808
+ /* @__PURE__ */ jsx17(Grid6, { size: 5.5, ...wrapKeyGridItem, children: /* @__PURE__ */ jsx17(
809
+ TextField2,
810
+ {
811
+ fullWidth: true,
812
+ required,
813
+ label: displayLabel ? keyLabel : void 0,
814
+ defaultValue: label,
815
+ disabled: disabled || readonly,
816
+ id: `${id}-key`,
817
+ name: `${id}-key`,
818
+ onBlur: !readonly ? onKeyRenameBlur : void 0,
819
+ type: "text"
820
+ },
821
+ label
822
+ ) }),
823
+ /* @__PURE__ */ jsx17(Grid6, { size: 5.5, ...wrapChildrenGridItem, children }),
824
+ /* @__PURE__ */ jsx17(Grid6, { sx: { mt: 1.5 }, ...wrapRemoveButtonGridItem, children: /* @__PURE__ */ jsx17(
825
+ RemoveButton2,
826
+ {
827
+ id: buttonId3(id, "remove"),
828
+ className: "rjsf-object-property-remove",
829
+ iconType: "default",
830
+ style: btnStyle,
831
+ disabled: disabled || readonly,
832
+ onClick: onRemoveProperty,
833
+ uiSchema,
834
+ registry
835
+ }
836
+ ) })
837
+ ]
838
+ },
839
+ `${id}-key`
840
+ );
696
841
  }
697
842
 
698
843
  // src/Templates/Templates.ts
@@ -764,6 +909,7 @@ function CheckboxWidget(props) {
764
909
  const _onBlur = () => onBlur(id, value);
765
910
  const _onFocus = () => onFocus(id, value);
766
911
  const description = options.description ?? schema.description;
912
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
767
913
  return /* @__PURE__ */ jsxs10(Fragment3, { children: [
768
914
  !hideLabel && description && /* @__PURE__ */ jsx18(
769
915
  DescriptionFieldTemplate,
@@ -778,6 +924,8 @@ function CheckboxWidget(props) {
778
924
  /* @__PURE__ */ jsx18(
779
925
  FormControlLabel,
780
926
  {
927
+ ...otherMuiProps,
928
+ ...muiSlotProps?.formControlLabel,
781
929
  control: /* @__PURE__ */ jsx18(
782
930
  Checkbox,
783
931
  {
@@ -790,7 +938,8 @@ function CheckboxWidget(props) {
790
938
  onChange: _onChange,
791
939
  onBlur: _onBlur,
792
940
  onFocus: _onFocus,
793
- "aria-describedby": ariaDescribedByIds2(id)
941
+ "aria-describedby": ariaDescribedByIds2(id),
942
+ ...muiSlotProps?.checkbox
794
943
  }
795
944
  ),
796
945
  label: labelValue2(label, hideLabel, false)
@@ -806,30 +955,34 @@ import FormGroup from "@mui/material/FormGroup";
806
955
  import FormLabel from "@mui/material/FormLabel";
807
956
  import {
808
957
  ariaDescribedByIds as ariaDescribedByIds3,
958
+ enumOptionValueDecoder,
809
959
  enumOptionsDeselectValue,
810
960
  enumOptionsIsSelected,
811
961
  enumOptionsSelectValue,
812
- enumOptionsValueForIndex,
962
+ getOptionValueFormat,
813
963
  labelValue as labelValue3,
814
964
  optionId
815
965
  } from "@rjsf/utils";
816
966
  import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
817
- function CheckboxesWidget({
818
- label,
819
- hideLabel,
820
- id,
821
- htmlName,
822
- disabled,
823
- options,
824
- value,
825
- autofocus,
826
- readonly,
827
- required,
828
- onChange,
829
- onBlur,
830
- onFocus
831
- }) {
967
+ import { createElement } from "react";
968
+ function CheckboxesWidget(props) {
969
+ const {
970
+ label,
971
+ hideLabel,
972
+ id,
973
+ htmlName,
974
+ disabled,
975
+ options,
976
+ value,
977
+ autofocus,
978
+ readonly,
979
+ required,
980
+ onChange,
981
+ onBlur,
982
+ onFocus
983
+ } = props;
832
984
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
985
+ const optionValueFormat = getOptionValueFormat(options);
833
986
  const checkboxesValues = Array.isArray(value) ? value : [value];
834
987
  const _onChange = (index) => ({ target: { checked } }) => {
835
988
  if (checked) {
@@ -838,19 +991,21 @@ function CheckboxesWidget({
838
991
  onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
839
992
  }
840
993
  };
841
- const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
842
- const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
994
+ const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
995
+ const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
996
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
843
997
  return /* @__PURE__ */ jsxs11(Fragment4, { children: [
844
998
  labelValue3(
845
999
  /* @__PURE__ */ jsx19(FormLabel, { required, htmlFor: id, children: label || void 0 }),
846
1000
  hideLabel
847
1001
  ),
848
- /* @__PURE__ */ jsx19(FormGroup, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
1002
+ /* @__PURE__ */ jsx19(FormGroup, { ...otherMuiProps, ...muiSlotProps?.formGroup, id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
849
1003
  const checked = enumOptionsIsSelected(option.value, checkboxesValues);
850
1004
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
851
1005
  const checkbox = /* @__PURE__ */ jsx19(
852
1006
  Checkbox2,
853
1007
  {
1008
+ ...muiSlotProps?.checkbox,
854
1009
  id: optionId(id, index),
855
1010
  name: htmlName || id,
856
1011
  checked,
@@ -862,7 +1017,15 @@ function CheckboxesWidget({
862
1017
  "aria-describedby": ariaDescribedByIds3(id)
863
1018
  }
864
1019
  );
865
- return /* @__PURE__ */ jsx19(FormControlLabel2, { control: checkbox, label: option.label }, index);
1020
+ return /* @__PURE__ */ createElement(
1021
+ FormControlLabel2,
1022
+ {
1023
+ ...muiSlotProps?.formControlLabel,
1024
+ control: checkbox,
1025
+ key: index,
1026
+ label: option.label
1027
+ }
1028
+ );
866
1029
  }) })
867
1030
  ] });
868
1031
  }
@@ -874,32 +1037,25 @@ import Radio from "@mui/material/Radio";
874
1037
  import RadioGroup from "@mui/material/RadioGroup";
875
1038
  import {
876
1039
  ariaDescribedByIds as ariaDescribedByIds4,
877
- enumOptionsIndexForValue,
878
- enumOptionsValueForIndex as enumOptionsValueForIndex2,
1040
+ enumOptionSelectedValue,
1041
+ enumOptionValueDecoder as enumOptionValueDecoder2,
1042
+ enumOptionValueEncoder,
1043
+ getOptionValueFormat as getOptionValueFormat2,
879
1044
  labelValue as labelValue4,
880
1045
  optionId as optionId2
881
1046
  } from "@rjsf/utils";
882
1047
  import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
883
- function RadioWidget({
884
- id,
885
- htmlName,
886
- options,
887
- value,
888
- required,
889
- disabled,
890
- readonly,
891
- label,
892
- hideLabel,
893
- onChange,
894
- onBlur,
895
- onFocus
896
- }) {
1048
+ import { createElement as createElement2 } from "react";
1049
+ function RadioWidget(props) {
1050
+ const { id, htmlName, options, value, required, disabled, readonly, label, hideLabel, onChange, onBlur, onFocus } = props;
897
1051
  const { enumOptions, enumDisabled, emptyValue } = options;
898
- const _onChange = (_, value2) => onChange(enumOptionsValueForIndex2(value2, enumOptions, emptyValue));
899
- const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
900
- const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
1052
+ const optionValueFormat = getOptionValueFormat2(options);
1053
+ const _onChange = (_, value2) => onChange(enumOptionValueDecoder2(value2, enumOptions, optionValueFormat, emptyValue));
1054
+ const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
1055
+ const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
901
1056
  const row = options ? options.inline : false;
902
- const selectedIndex = enumOptionsIndexForValue(value, enumOptions) ?? null;
1057
+ const selectValue = enumOptionSelectedValue(value, enumOptions, false, optionValueFormat, "");
1058
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
903
1059
  return /* @__PURE__ */ jsxs12(Fragment5, { children: [
904
1060
  labelValue4(
905
1061
  /* @__PURE__ */ jsx20(FormLabel2, { required, htmlFor: id, children: label || void 0 }),
@@ -908,9 +1064,11 @@ function RadioWidget({
908
1064
  /* @__PURE__ */ jsx20(
909
1065
  RadioGroup,
910
1066
  {
1067
+ ...otherMuiProps,
1068
+ ...muiSlotProps?.radioGroup,
911
1069
  id,
912
1070
  name: htmlName || id,
913
- value: selectedIndex,
1071
+ value: selectValue,
914
1072
  row,
915
1073
  onChange: _onChange,
916
1074
  onBlur: _onBlur,
@@ -918,15 +1076,16 @@ function RadioWidget({
918
1076
  "aria-describedby": ariaDescribedByIds4(id),
919
1077
  children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
920
1078
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
921
- const radio = /* @__PURE__ */ jsx20(
1079
+ const radio = /* @__PURE__ */ createElement2(
922
1080
  FormControlLabel3,
923
1081
  {
924
- control: /* @__PURE__ */ jsx20(Radio, { name: htmlName || id, id: optionId2(id, index), color: "primary" }),
1082
+ ...muiSlotProps?.formControlLabel,
1083
+ control: /* @__PURE__ */ jsx20(Radio, { ...muiSlotProps?.radio, name: htmlName || id, id: optionId2(id, index), color: "primary" }),
925
1084
  label: option.label,
926
- value: String(index),
1085
+ value: enumOptionValueEncoder(option.value, index, optionValueFormat),
1086
+ key: index,
927
1087
  disabled: disabled || itemDisabled || readonly
928
- },
929
- index
1088
+ }
930
1089
  );
931
1090
  return radio;
932
1091
  })
@@ -952,6 +1111,7 @@ function RangeWidget(props) {
952
1111
  };
953
1112
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
954
1113
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
1114
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
955
1115
  return /* @__PURE__ */ jsxs13(Fragment6, { children: [
956
1116
  labelValue5(
957
1117
  /* @__PURE__ */ jsx21(FormLabel3, { required, htmlFor: id, children: label || void 0 }),
@@ -965,6 +1125,8 @@ function RangeWidget(props) {
965
1125
  onBlur: _onBlur,
966
1126
  onFocus: _onFocus,
967
1127
  valueLabelDisplay: "auto",
1128
+ ...otherMuiProps,
1129
+ ...muiSlotProps?.slider,
968
1130
  ...sliderProps,
969
1131
  "aria-describedby": ariaDescribedByIds5(id)
970
1132
  }
@@ -977,54 +1139,58 @@ import MenuItem from "@mui/material/MenuItem";
977
1139
  import TextField3 from "@mui/material/TextField";
978
1140
  import {
979
1141
  ariaDescribedByIds as ariaDescribedByIds6,
980
- enumOptionsIndexForValue as enumOptionsIndexForValue2,
981
- enumOptionsValueForIndex as enumOptionsValueForIndex3,
1142
+ enumOptionSelectedValue as enumOptionSelectedValue2,
1143
+ enumOptionValueDecoder as enumOptionValueDecoder3,
1144
+ enumOptionValueEncoder as enumOptionValueEncoder2,
1145
+ getOptionValueFormat as getOptionValueFormat3,
982
1146
  labelValue as labelValue6
983
1147
  } from "@rjsf/utils";
984
1148
  import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
985
- function SelectWidget({
986
- schema,
987
- id,
988
- name,
989
- // remove this from textFieldProps
990
- htmlName,
991
- options,
992
- label,
993
- hideLabel,
994
- required,
995
- disabled,
996
- placeholder,
997
- readonly,
998
- value,
999
- multiple,
1000
- autofocus,
1001
- onChange,
1002
- onBlur,
1003
- onFocus,
1004
- errorSchema,
1005
- rawErrors = [],
1006
- registry,
1007
- uiSchema,
1008
- hideError,
1009
- ...textFieldProps
1010
- }) {
1149
+ function SelectWidget(props) {
1150
+ const {
1151
+ schema,
1152
+ id,
1153
+ name,
1154
+ // remove this from textFieldProps
1155
+ htmlName,
1156
+ options,
1157
+ label,
1158
+ hideLabel,
1159
+ required,
1160
+ disabled,
1161
+ placeholder,
1162
+ readonly,
1163
+ value,
1164
+ multiple,
1165
+ autofocus,
1166
+ onChange,
1167
+ onBlur,
1168
+ onFocus,
1169
+ errorSchema,
1170
+ rawErrors = [],
1171
+ registry,
1172
+ uiSchema,
1173
+ hideError,
1174
+ ...textFieldProps
1175
+ } = props;
1011
1176
  const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
1012
- multiple = typeof multiple === "undefined" ? false : !!multiple;
1013
- const emptyValue = multiple ? [] : "";
1014
- const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
1015
- const _onChange = ({ target: { value: value2 } }) => onChange(enumOptionsValueForIndex3(value2, enumOptions, optEmptyVal));
1016
- const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex3(target && target.value, enumOptions, optEmptyVal));
1017
- const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex3(target && target.value, enumOptions, optEmptyVal));
1018
- const selectedIndexes = enumOptionsIndexForValue2(value, enumOptions, multiple);
1177
+ const optionValueFormat = getOptionValueFormat3(options);
1178
+ const isMultiple = typeof multiple === "undefined" ? false : !!multiple;
1179
+ const emptyValue = isMultiple ? [] : "";
1180
+ const isEmpty = typeof value === "undefined" || isMultiple && value.length < 1 || !isMultiple && value === emptyValue;
1181
+ const _onChange = ({ target: { value: value2 } }) => onChange(enumOptionValueDecoder3(value2, enumOptions, optionValueFormat, optEmptyVal));
1182
+ const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder3(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
1183
+ const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder3(target && target.value, enumOptions, optionValueFormat, optEmptyVal));
1184
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
1019
1185
  const { InputLabelProps, SelectProps, autocomplete, ...textFieldRemainingProps } = textFieldProps;
1020
- const showPlaceholderOption = !multiple && schema.default === void 0;
1186
+ const showPlaceholderOption = !isMultiple && schema.default === void 0;
1021
1187
  return /* @__PURE__ */ jsxs14(
1022
1188
  TextField3,
1023
1189
  {
1024
1190
  id,
1025
1191
  name: htmlName || id,
1026
1192
  label: labelValue6(label || void 0, hideLabel, void 0),
1027
- value: !isEmpty && typeof selectedIndexes !== "undefined" ? selectedIndexes : emptyValue,
1193
+ value: enumOptionSelectedValue2(value, enumOptions, isMultiple, optionValueFormat, emptyValue),
1028
1194
  required,
1029
1195
  disabled: disabled || readonly,
1030
1196
  autoFocus: autofocus,
@@ -1034,22 +1200,25 @@ function SelectWidget({
1034
1200
  onChange: _onChange,
1035
1201
  onBlur: _onBlur,
1036
1202
  onFocus: _onFocus,
1037
- ...textFieldRemainingProps,
1203
+ ...{ ...otherMuiProps, ...textFieldRemainingProps },
1038
1204
  select: true,
1039
- InputLabelProps: {
1040
- ...InputLabelProps,
1041
- shrink: !isEmpty
1042
- },
1043
- SelectProps: {
1044
- ...SelectProps,
1045
- multiple
1205
+ slotProps: {
1206
+ ...muiSlotProps,
1207
+ inputLabel: {
1208
+ ...muiSlotProps?.inputLabel,
1209
+ shrink: !isEmpty
1210
+ },
1211
+ select: {
1212
+ ...muiSlotProps?.select,
1213
+ multiple
1214
+ }
1046
1215
  },
1047
1216
  "aria-describedby": ariaDescribedByIds6(id),
1048
1217
  children: [
1049
1218
  showPlaceholderOption && /* @__PURE__ */ jsx22(MenuItem, { value: "", children: placeholder }),
1050
1219
  Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
1051
1220
  const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
1052
- return /* @__PURE__ */ jsx22(MenuItem, { value: String(i), disabled: disabled2, children: label2 }, i);
1221
+ return /* @__PURE__ */ jsx22(MenuItem, { value: enumOptionValueEncoder2(value2, i, optionValueFormat), disabled: disabled2, children: label2 }, i);
1053
1222
  })
1054
1223
  ]
1055
1224
  }