@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
@@ -1,11 +1,21 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import AddIcon from '@mui/icons-material/Add';
3
3
  import IconButton from '@mui/material/IconButton';
4
- import { TranslatableString } from '@rjsf/utils';
4
+ import { getUiOptions, TranslatableString, } from '@rjsf/utils';
5
+ import { getMuiProps } from '../util.js';
5
6
  /** The `AddButton` renders a button that represent the `Add` action on a form
6
7
  */
7
8
  export default function AddButton({ uiSchema, registry, ...props }) {
8
9
  const { translateString } = registry;
9
- return (_jsx(IconButton, { title: translateString(TranslatableString.AddItemButton), ...props, color: 'primary', children: _jsx(AddIcon, {}) }));
10
+ const uiOptions = getUiOptions(uiSchema);
11
+ const muiProps = getMuiProps(uiOptions, [
12
+ 'color',
13
+ 'disableFocusRipple',
14
+ 'disableRipple',
15
+ 'edge',
16
+ 'size',
17
+ 'sx',
18
+ ]);
19
+ return (_jsx(IconButton, { title: translateString(TranslatableString.AddItemButton), ...props, color: 'primary', ...muiProps, children: _jsx(AddIcon, {}) }));
10
20
  }
11
21
  //# sourceMappingURL=AddButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAkE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjH;GACG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoF,EACnH,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACiB;IACzB,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,OAAO,CACL,KAAC,UAAU,IAAC,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,KAAM,KAAK,EAAE,KAAK,EAAC,SAAS,YAC9F,KAAC,OAAO,KAAG,GACA,CACd,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,OAAO,UAAqD,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAEL,YAAY,EAIZ,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;GACG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoF,EACnH,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACiB;IACzB,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,WAAW,CAA8B,SAAS,EAAE;QACnE,OAAO;QACP,oBAAoB;QACpB,eAAe;QACf,MAAM;QACN,MAAM;QACN,IAAI;KACL,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,UAAU,IAAC,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,KAAM,KAAK,EAAE,KAAK,EAAC,SAAS,KAAK,QAAQ,YAC3G,KAAC,OAAO,KAAG,GACA,CACd,CAAC;AACJ,CAAC"}
@@ -1,4 +1,25 @@
1
- import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { BoxProps } from '@mui/material/Box';
2
+ import { GridProps } from '@mui/material/Grid';
3
+ import { PaperProps } from '@mui/material/Paper';
4
+ import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema, GenericObjectType } from '@rjsf/utils';
5
+ /** Properties available for the `rjsfSlotProps` target of the ArrayFieldItemTemplate. */
6
+ export interface ArrayFieldItemTemplateMuiProps extends GenericObjectType {
7
+ /** RJSF-specific slot props for targeting child elements of the ArrayFieldItemTemplate. */
8
+ rjsfSlotProps?: {
9
+ /** Props applied to the outermost `Grid` container. */
10
+ arrayItemGridContainer?: GridProps;
11
+ /** Props applied to the `Grid` item wrapping the item's content. */
12
+ arrayItemGridItem?: GridProps;
13
+ /** Props applied to the outer `Box` container. */
14
+ arrayItemOuterBox?: BoxProps;
15
+ /** Props applied to the `Paper` elevation component. */
16
+ arrayItemPaper?: PaperProps;
17
+ /** Props applied to the inner `Box` containing the actual children. */
18
+ arrayItemInnerBox?: BoxProps;
19
+ /** Props applied to the `Grid` containing the item's buttons. */
20
+ arrayItemToolbarGrid?: GridProps;
21
+ };
22
+ }
2
23
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
3
24
  *
4
25
  * @param props - The `ArrayFieldItemTemplateProps` props for the component
@@ -3,6 +3,7 @@ import Box from '@mui/material/Box';
3
3
  import Grid from '@mui/material/Grid';
4
4
  import Paper from '@mui/material/Paper';
5
5
  import { getUiOptions, getTemplate, } from '@rjsf/utils';
6
+ import { getMuiProps } from '../util.js';
6
7
  /** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
7
8
  *
8
9
  * @param props - The `ArrayFieldItemTemplateProps` props for the component
@@ -18,6 +19,7 @@ export default function ArrayFieldItemTemplate(props) {
18
19
  fontWeight: 'bold',
19
20
  minWidth: 0,
20
21
  };
21
- return (_jsxs(Grid, { container: true, alignItems: 'center', children: [_jsx(Grid, { size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 }, style: { overflow: 'auto' }, children: _jsx(Box, { mb: 2, children: _jsx(Paper, { elevation: 2, children: _jsx(Box, { p: 2, children: children }) }) }) }), hasToolbar && (_jsx(Grid, { sx: { mt: hasDescription ? -5 : -1.5 }, children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }))] }));
22
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
23
+ return (_jsxs(Grid, { container: true, alignItems: 'center', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemGridContainer, children: [_jsx(Grid, { size: { xs: 8, sm: 9, md: 10, lg: 11, xl: 11.25 }, style: { overflow: 'auto' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemGridItem, children: _jsx(Box, { mb: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemOuterBox, children: _jsx(Paper, { elevation: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemPaper, children: _jsx(Box, { p: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemInnerBox, children: children }) }) }) }), hasToolbar && (_jsx(Grid, { sx: { mt: hasDescription ? -5 : -1.5 }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayItemToolbarGrid, children: _jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps, style: btnStyle }) }))] }));
22
24
  }
23
25
  //# sourceMappingURL=ArrayFieldItemTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAGL,YAAY,EACZ,WAAW,GAGZ,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA2C;IAC3C,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACzF,MAAM,SA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YACnD,KAAC,GAAG,IAAC,CAAC,EAAE,CAAC,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,iBAAiB,YAC3C,QAAQ,GACL,GACA,GACJ,GACD,EACN,UAAU,IAAI,CACb,KAAC,IAAI,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,oBAAoB,YAClF,KAAC,6BAA6B,OAAK,YAAY,EAAE,KAAK,EAAE,QAAQ,GAAI,GAC/D,CACR,IACI,CACR,CAAC;AACJ,CAAC"}
@@ -1,4 +1,23 @@
1
- import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { BoxProps } from '@mui/material/Box';
2
+ import { GridProps } from '@mui/material/Grid';
3
+ import { PaperProps } from '@mui/material/Paper';
4
+ import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema, GenericObjectType } from '@rjsf/utils';
5
+ /** Properties available for the `rjsfSlotProps` target of the ArrayFieldTemplate. */
6
+ export interface ArrayFieldTemplateMuiProps extends GenericObjectType {
7
+ /** RJSF-specific slot props for targeting child elements of the ArrayFieldTemplate. */
8
+ rjsfSlotProps?: {
9
+ /** Props applied to the wrapper `Paper` material. */
10
+ arrayPaper?: PaperProps;
11
+ /** Props applied to the primary `Box` container. */
12
+ arrayBox?: BoxProps;
13
+ /** Props applied to the wrapper `Grid` container next to the Add Button. */
14
+ arrayAddButtonGridContainer?: GridProps;
15
+ /** Props applied to the `Grid` item containing the Add Button. */
16
+ arrayAddButtonGridItem?: GridProps;
17
+ /** Props applied to the `Box` containing the Add Button. */
18
+ arrayAddButtonBox?: BoxProps;
19
+ };
20
+ }
2
21
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
3
22
  *
4
23
  * @param props - The `ArrayFieldTemplateProps` props for the component
@@ -3,6 +3,7 @@ import Box from '@mui/material/Box';
3
3
  import Grid from '@mui/material/Grid';
4
4
  import Paper from '@mui/material/Paper';
5
5
  import { getTemplate, getUiOptions, buttonId, } from '@rjsf/utils';
6
+ import { getMuiProps } from '../util.js';
6
7
  /** The `ArrayFieldTemplate` component is the template used to render all items in an array.
7
8
  *
8
9
  * @param props - The `ArrayFieldTemplateProps` props for the component
@@ -15,6 +16,7 @@ export default function ArrayFieldTemplate(props) {
15
16
  const showOptionalDataControlInTitle = !readonly && !disabled;
16
17
  // Button templates are not overridden in the uiSchema
17
18
  const { ButtonTemplates: { AddButton }, } = registry.templates;
18
- return (_jsx(Paper, { elevation: 2, children: _jsxs(Box, { p: 2, children: [_jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, required: required, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined }), _jsx(ArrayFieldDescriptionTemplate, { fieldPathId: fieldPathId, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), !showOptionalDataControlInTitle ? optionalDataControl : undefined, items, canAdd && (_jsx(Grid, { container: true, justifyContent: 'flex-end', children: _jsx(Grid, { children: _jsx(Box, { mt: 2, children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }) }))] }) }));
19
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
20
+ return (_jsx(Paper, { elevation: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayPaper, children: _jsxs(Box, { p: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayBox, children: [_jsx(ArrayFieldTitleTemplate, { fieldPathId: fieldPathId, title: uiOptions.title || title, schema: schema, uiSchema: uiSchema, required: required, registry: registry, optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : undefined }), _jsx(ArrayFieldDescriptionTemplate, { fieldPathId: fieldPathId, description: uiOptions.description || schema.description, schema: schema, uiSchema: uiSchema, registry: registry }), !showOptionalDataControlInTitle ? optionalDataControl : undefined, items, canAdd && (_jsx(Grid, { container: true, justifyContent: 'flex-end', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayAddButtonGridContainer, children: _jsx(Grid, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayAddButtonGridItem, children: _jsx(Box, { mt: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.arrayAddButtonBox, children: _jsx(AddButton, { id: buttonId(fieldPathId, 'add'), className: 'rjsf-array-item-add', onClick: onAddClick, disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }) }) }) }))] }) }));
19
21
  }
20
22
  //# sourceMappingURL=ArrayFieldTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EACL,WAAW,EACX,YAAY,EAKZ,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAAuC;IACvC,MAAM,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,GACN,GAAG,KAAK,CAAC;IACV,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ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 -1,4 +1,20 @@
1
- import { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { InputProps as MuiInputProps } from '@mui/material/Input';
2
+ import { InputLabelProps as MuiInputLabelProps } from '@mui/material/InputLabel';
3
+ import { BaseInputTemplateProps, FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
4
+ /** Properties available for the MUI `ui:options` of the BaseInputTemplate.
5
+ * Unlike RJSF templates, `slotProps` here maps directly to MUI's native `TextField` `slotProps`,
6
+ * enabling type-safe customization of the underlying MUI sub-components. */
7
+ export interface BaseInputTemplateMuiProps extends GenericObjectType {
8
+ /** Native MUI `TextField` slotProps for targeting specific sub-components. */
9
+ slotProps?: {
10
+ /** Props applied to the base native HTML `<input>` or `<textarea>` element. */
11
+ htmlInput?: React.HTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
12
+ /** Props applied to the MUI `Input` element, useful for `endAdornment`/`startAdornment`. */
13
+ input?: MuiInputProps;
14
+ /** Props applied to the MUI `InputLabel` element. */
15
+ inputLabel?: MuiInputLabelProps;
16
+ };
17
+ }
2
18
  /** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
3
19
  * It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
4
20
  * It can be customized/overridden for other themes or individual implementations as needed.
@@ -4,6 +4,7 @@ import TextField from '@mui/material/TextField';
4
4
  import InputAdornment from '@mui/material/InputAdornment';
5
5
  import { ariaDescribedByIds, examplesId, getInputProps, labelValue, } from '@rjsf/utils';
6
6
  import { SchemaExamples } from '@rjsf/core';
7
+ import { getMuiProps } from '../util.js';
7
8
  const TYPES_THAT_SHRINK_LABEL = ['date', 'datetime-local', 'file', 'time'];
8
9
  /** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
9
10
  * It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
@@ -17,8 +18,11 @@ export default function BaseInputTemplate(props) {
17
18
  const { ClearButton } = registry.templates.ButtonTemplates;
18
19
  // Now we need to pull out the step, min, max into an inner `inputProps` for material-ui
19
20
  const { step, min, max, accept, ...rest } = getInputProps(schema, type, options);
21
+ const muiProps = getMuiProps(options);
22
+ const { slotProps: muiSlotProps, ...otherMuiProps } = muiProps;
20
23
  const htmlInputProps = {
21
24
  ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.htmlInput,
25
+ ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.htmlInput,
22
26
  step,
23
27
  min,
24
28
  max,
@@ -29,24 +33,25 @@ export default function BaseInputTemplate(props) {
29
33
  const _onBlur = ({ target }) => onBlur(id, target && target.value);
30
34
  const _onFocus = ({ target }) => onFocus(id, target && target.value);
31
35
  const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type)
32
- ? { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...InputLabelProps, shrink: true }
33
- : { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...InputLabelProps };
36
+ ? { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel, ...InputLabelProps, shrink: true }
37
+ : { ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.inputLabel, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.inputLabel, ...InputLabelProps };
34
38
  const _onClear = useCallback((e) => {
35
39
  var _a;
36
40
  e.preventDefault();
37
41
  e.stopPropagation();
38
42
  onChange((_a = options.emptyValue) !== null && _a !== void 0 ? _a : '');
39
43
  }, [onChange, options.emptyValue]);
40
- const inputProps = { ...InputProps, ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.input };
44
+ const inputProps = { ...InputProps, ...slotProps === null || slotProps === void 0 ? void 0 : slotProps.input, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.input };
41
45
  if (options.allowClearTextInputs && value && !readonly && !disabled) {
42
46
  const clearAdornment = (_jsx(InputAdornment, { position: 'end', children: _jsx(ClearButton, { registry: registry, onClick: _onClear }) }));
43
47
  inputProps.endAdornment = !inputProps.endAdornment ? (clearAdornment) : (_jsxs(_Fragment, { children: [inputProps.endAdornment, clearAdornment] }));
44
48
  }
45
49
  return (_jsxs(_Fragment, { children: [_jsx(TextField, { id: id, name: htmlName || id, placeholder: placeholder, label: labelValue(label || undefined, hideLabel, undefined), autoFocus: autofocus, required: required, disabled: disabled || readonly, slotProps: {
46
50
  ...slotProps,
51
+ ...muiSlotProps,
47
52
  input: inputProps,
48
53
  htmlInput: htmlInputProps,
49
54
  inputLabel: DisplayInputLabelProps,
50
- }, ...rest, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, ...textFieldProps, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), _jsx(SchemaExamples, { id: id, schema: schema })] }));
55
+ }, ...rest, value: value || value === 0 ? value : '', error: rawErrors.length > 0, onChange: onChangeOverride || _onChange, onBlur: _onBlur, onFocus: _onFocus, ...{ ...otherMuiProps, ...textFieldProps }, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), _jsx(SchemaExamples, { id: id, schema: schema })] }));
51
56
  }
52
57
  //# sourceMappingURL=BaseInputTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuC,WAAW,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,SAA6B,MAAM,yBAAyB,CAAC;AACpE,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EACL,kBAAkB,EAElB,UAAU,EACV,aAAa,EACb,UAAU,GAIX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM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AAS,CAAC,MAAM,GAAG,CAAC,EAC3B,QAAQ,EAAE,gBAAgB,IAAI,SAAS,EACvC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,KACZ,EAAE,GAAG,aAAa,EAAE,GAAG,cAAc,EAAqB,sBAC7C,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAC3D,EACF,KAAC,cAAc,IAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAI,IACzC,CACJ,CAAC;AACJ,CAAC"}
@@ -1,4 +1,16 @@
1
- import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
1
+ import { CheckboxProps } from '@mui/material/Checkbox';
2
+ import { FormControlLabelProps } from '@mui/material/FormControlLabel';
3
+ import { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
4
+ /** Properties available for the `rjsfSlotProps` target of the CheckboxWidget. */
5
+ export interface CheckboxWidgetMuiProps extends GenericObjectType {
6
+ /** RJSF-specific slot props for targeting child elements of the CheckboxWidget. */
7
+ rjsfSlotProps?: {
8
+ /** Props applied to the individual `Checkbox` component. */
9
+ checkbox?: CheckboxProps;
10
+ /** Props applied to the `FormControlLabel` component wrapping the checkbox. */
11
+ formControlLabel?: FormControlLabelProps;
12
+ };
13
+ }
2
14
  /** The `CheckBoxWidget` is a widget for rendering boolean properties.
3
15
  * It is typically used to represent a boolean.
4
16
  *
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import Checkbox from '@mui/material/Checkbox';
3
3
  import FormControlLabel from '@mui/material/FormControlLabel';
4
4
  import { ariaDescribedByIds, descriptionId, getTemplate, labelValue, schemaRequiresTrueValue, } from '@rjsf/utils';
5
+ import { getMuiProps } from '../util.js';
5
6
  /** The `CheckBoxWidget` is a widget for rendering boolean properties.
6
7
  * It is typically used to represent a boolean.
7
8
  *
@@ -19,6 +20,7 @@ export default function CheckboxWidget(props) {
19
20
  const _onBlur = () => onBlur(id, value);
20
21
  const _onFocus = () => onFocus(id, value);
21
22
  const description = (_a = options.description) !== null && _a !== void 0 ? _a : schema.description;
22
- return (_jsxs(_Fragment, { children: [!hideLabel && description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsx(FormControlLabel, { control: _jsx(Checkbox, { id: id, name: htmlName || id, checked: typeof value === 'undefined' ? false : Boolean(value), required: required, disabled: disabled || readonly, autoFocus: autofocus, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }), label: labelValue(label, hideLabel, false) })] }));
23
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
24
+ return (_jsxs(_Fragment, { children: [!hideLabel && description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsx(FormControlLabel, { ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: _jsx(Checkbox, { id: id, name: htmlName || id, checked: typeof value === 'undefined' ? false : Boolean(value), required: required, disabled: disabled || readonly, autoFocus: autofocus, onChange: _onChange, onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id), ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.checkbox }), label: labelValue(label, hideLabel, false) })] }));
23
25
  }
24
26
  //# sourceMappingURL=CheckboxWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxWidget.js","sourceRoot":"","sources":["../../src/CheckboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":";AAAA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,UA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C,IACD,CACJ,CAAC;AACJ,CAAC"}
@@ -1,7 +1,22 @@
1
- import { FormContextType, WidgetProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { CheckboxProps } from '@mui/material/Checkbox';
2
+ import { FormControlLabelProps } from '@mui/material/FormControlLabel';
3
+ import { FormGroupProps } from '@mui/material/FormGroup';
4
+ import { FormContextType, GenericObjectType, WidgetProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
5
+ /** Properties available for the `rjsfSlotProps` target of the CheckboxesWidget. */
6
+ export interface CheckboxesWidgetMuiProps extends GenericObjectType {
7
+ /** RJSF-specific slot props for targeting child elements of the CheckboxesWidget. */
8
+ rjsfSlotProps?: {
9
+ /** Props applied to the `FormGroup` container. */
10
+ formGroup?: FormGroupProps;
11
+ /** Props applied to the individual `Checkbox` components. */
12
+ checkbox?: CheckboxProps;
13
+ /** Props applied to the `FormControlLabel` components wrapping each checkbox. */
14
+ formControlLabel?: FormControlLabelProps;
15
+ };
16
+ }
2
17
  /** The `CheckboxesWidget` is a widget for rendering checkbox groups.
3
18
  * It is typically used to represent an array of enums.
4
19
  *
5
20
  * @param props - The `WidgetProps` for this component
6
21
  */
7
- export default function CheckboxesWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ label, hideLabel, id, htmlName, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus, }: WidgetProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
22
+ export default function CheckboxesWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(props: WidgetProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,20 @@
1
+ import { createElement as _createElement } from "react";
1
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import Checkbox from '@mui/material/Checkbox';
3
4
  import FormControlLabel from '@mui/material/FormControlLabel';
4
5
  import FormGroup from '@mui/material/FormGroup';
5
6
  import FormLabel from '@mui/material/FormLabel';
6
- import { ariaDescribedByIds, enumOptionsDeselectValue, enumOptionsIsSelected, enumOptionsSelectValue, enumOptionsValueForIndex, labelValue, optionId, } from '@rjsf/utils';
7
+ import { ariaDescribedByIds, enumOptionValueDecoder, enumOptionsDeselectValue, enumOptionsIsSelected, enumOptionsSelectValue, getOptionValueFormat, labelValue, optionId, } from '@rjsf/utils';
8
+ import { getMuiProps } from '../util.js';
7
9
  /** The `CheckboxesWidget` is a widget for rendering checkbox groups.
8
10
  * It is typically used to represent an array of enums.
9
11
  *
10
12
  * @param props - The `WidgetProps` for this component
11
13
  */
12
- export default function CheckboxesWidget({ label, hideLabel, id, htmlName, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus, }) {
14
+ export default function CheckboxesWidget(props) {
15
+ const { label, hideLabel, id, htmlName, disabled, options, value, autofocus, readonly, required, onChange, onBlur, onFocus, } = props;
13
16
  const { enumOptions, enumDisabled, inline, emptyValue } = options;
17
+ const optionValueFormat = getOptionValueFormat(options);
14
18
  const checkboxesValues = Array.isArray(value) ? value : [value];
15
19
  const _onChange = (index) => ({ target: { checked } }) => {
16
20
  if (checked) {
@@ -20,14 +24,15 @@ export default function CheckboxesWidget({ label, hideLabel, id, htmlName, disab
20
24
  onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
21
25
  }
22
26
  };
23
- const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
24
- const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
25
- return (_jsxs(_Fragment, { children: [labelValue(_jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), _jsx(FormGroup, { id: id, row: !!inline, children: Array.isArray(enumOptions) &&
27
+ const _onBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
28
+ const _onFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
29
+ const { rjsfSlotProps: muiSlotProps, ...otherMuiProps } = getMuiProps(options);
30
+ return (_jsxs(_Fragment, { children: [labelValue(_jsx(FormLabel, { required: required, htmlFor: id, children: label || undefined }), hideLabel), _jsx(FormGroup, { ...otherMuiProps, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formGroup, id: id, row: !!inline, children: Array.isArray(enumOptions) &&
26
31
  enumOptions.map((option, index) => {
27
32
  const checked = enumOptionsIsSelected(option.value, checkboxesValues);
28
33
  const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
29
- const checkbox = (_jsx(Checkbox, { id: optionId(id, index), name: htmlName || id, checked: checked, disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: _onChange(index), onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }));
30
- return _jsx(FormControlLabel, { control: checkbox, label: option.label }, index);
34
+ const checkbox = (_jsx(Checkbox, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.checkbox, id: optionId(id, index), name: htmlName || id, checked: checked, disabled: disabled || itemDisabled || readonly, autoFocus: autofocus && index === 0, onChange: _onChange(index), onBlur: _onBlur, onFocus: _onFocus, "aria-describedby": ariaDescribedByIds(id) }));
35
+ return (_createElement(FormControlLabel, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.formControlLabel, control: checkbox, key: index, label: option.label }));
31
36
  }) })] }));
32
37
  }
33
38
  //# sourceMappingURL=CheckboxesWidget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxesWidget.js","sourceRoot":"","sources":["../../src/CheckboxesWidget/CheckboxesWidget.tsx"],"names":[],"mappings":";AACA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,SAA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YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,EAC1B,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EACvB,IAAI,EAAE,QAAQ,IAAI,EAAE,EACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,YAAY,IAAI,QAAQ,EAC9C,SAAS,EAAE,SAAS,IAAI,KAAK,KAAK,CAAC,EACnC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,EAC1B,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,QAAQ,sBACC,kBAAkB,CAAC,EAAE,CAAC,GACxC,CACH,CAAC;wBACF,OAAO,CACL,eAAC,gBAAgB,OACX,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,gBAAgB,EAClC,OAAO,EAAE,QAAQ,EACjB,GAAG,EAAE,KAAK,EACV,KAAK,EAAE,MAAM,CAAC,KAAK,GACnB,CACH,CAAC;oBACJ,CAAC,CAAC,GACM,IACX,CACJ,CAAC;AACJ,CAAC"}
@@ -1,4 +1,13 @@
1
- import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { TypographyProps } from '@mui/material/Typography';
2
+ import { DescriptionFieldProps, FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
3
+ /** Properties available for the `rjsfSlotProps` target of the DescriptionField. */
4
+ export interface DescriptionFieldMuiProps extends GenericObjectType {
5
+ /** RJSF-specific slot props for targeting child elements of the DescriptionField. */
6
+ rjsfSlotProps?: {
7
+ /** Props applied to the `Typography` element used for the description. */
8
+ descTypography?: TypographyProps;
9
+ };
10
+ }
2
11
  /** The `DescriptionField` is the template to use to render the description of a field
3
12
  *
4
13
  * @param props - The `DescriptionFieldProps` for this component
@@ -1,14 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Typography from '@mui/material/Typography';
3
+ import { getUiOptions, } from '@rjsf/utils';
3
4
  import { RichDescription } from '@rjsf/core';
5
+ import { getMuiProps } from '../util.js';
4
6
  /** The `DescriptionField` is the template to use to render the description of a field
5
7
  *
6
8
  * @param props - The `DescriptionFieldProps` for this component
7
9
  */
8
10
  export default function DescriptionField(props) {
9
11
  const { id, description, registry, uiSchema } = props;
12
+ const uiOptions = getUiOptions(uiSchema);
13
+ const muiProps = getMuiProps(uiOptions);
14
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
10
15
  if (description) {
11
- return (_jsx(Typography, { id: id, variant: 'subtitle2', style: { marginTop: '5px' }, children: _jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }));
16
+ return (_jsx(Typography, { id: id, variant: 'subtitle2', style: { marginTop: '5px' }, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.descTypography, children: _jsx(RichDescription, { description: description, registry: registry, uiSchema: uiSchema }) }));
12
17
  }
13
18
  return null;
14
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionField.js","sourceRoot":"","sources":["../../src/DescriptionField/DescriptionField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAItC,KAAqC;IACrC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CACL,KAAC,UAAU,IAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,YACjE,KAAC,eAAe,IAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAC1E,CACd,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"DescriptionField.js","sourceRoot":"","sources":["../../src/DescriptionField/DescriptionField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAA+B,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAML,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAWtC;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAItC,KAAqC;IACrC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEtD,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,WAAW,CAAoC,SAAS,CAAC,CAAC;IAC3E,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IAEjD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CACL,KAAC,UAAU,IAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,YACnG,KAAC,eAAe,IAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,GAC1E,CACd,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,6 +1,33 @@
1
- import { ErrorListProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { BoxProps } from '@mui/material/Box';
2
+ import { ListProps } from '@mui/material/List';
3
+ import { ListItemProps } from '@mui/material/ListItem';
4
+ import { ListItemIconProps } from '@mui/material/ListItemIcon';
5
+ import { ListItemTextProps } from '@mui/material/ListItemText';
6
+ import { PaperProps } from '@mui/material/Paper';
7
+ import { TypographyProps } from '@mui/material/Typography';
8
+ import { ErrorListProps, FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
9
+ /** Properties available for the `rjsfSlotProps` target of the ErrorList. */
10
+ export interface ErrorListMuiProps extends GenericObjectType {
11
+ /** RJSF-specific slot props for targeting child elements of the ErrorList. */
12
+ rjsfSlotProps?: {
13
+ /** Props applied to the outermost `Paper` component. */
14
+ errorPaper?: PaperProps;
15
+ /** Props applied to the `Box` container. */
16
+ errorBox?: BoxProps;
17
+ /** Props applied to the `Typography` element for the title. */
18
+ errorTypography?: TypographyProps;
19
+ /** Props applied to the `List` container holding the errors. */
20
+ errorList?: ListProps;
21
+ /** Props applied to each `ListItem` representing an error. */
22
+ errorListItem?: ListItemProps;
23
+ /** Props applied to each `ListItemIcon` representing the error icon. */
24
+ errorListItemIcon?: ListItemIconProps;
25
+ /** Props applied to each `ListItemText` representing the error message. */
26
+ errorListItemText?: ListItemTextProps;
27
+ };
28
+ }
2
29
  /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
3
30
  *
4
31
  * @param props - The `ErrorListProps` for this component
5
32
  */
6
- export default function ErrorList<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ errors, registry, }: ErrorListProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
33
+ export default function ErrorList<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ errors, registry, uiSchema, }: ErrorListProps<T, S, F>): import("react/jsx-runtime").JSX.Element;
@@ -7,15 +7,18 @@ import ListItemIcon from '@mui/material/ListItemIcon';
7
7
  import ListItemText from '@mui/material/ListItemText';
8
8
  import Paper from '@mui/material/Paper';
9
9
  import Typography from '@mui/material/Typography';
10
- import { TranslatableString } from '@rjsf/utils';
10
+ import { TranslatableString, getUiOptions, } from '@rjsf/utils';
11
+ import { getMuiProps } from '../util.js';
11
12
  /** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
12
13
  *
13
14
  * @param props - The `ErrorListProps` for this component
14
15
  */
15
- export default function ErrorList({ errors, registry, }) {
16
+ export default function ErrorList({ errors, registry, uiSchema, }) {
16
17
  const { translateString } = registry;
17
- return (_jsx(Paper, { elevation: 2, children: _jsxs(Box, { mb: 2, p: 2, children: [_jsx(Typography, { variant: 'h6', children: translateString(TranslatableString.ErrorsLabel) }), _jsx(List, { dense: true, children: errors.map((error, i) => {
18
- return (_jsxs(ListItem, { children: [_jsx(ListItemIcon, { children: _jsx(ErrorIcon, { color: 'error' }) }), _jsx(ListItemText, { primary: error.stack })] }, i));
18
+ const uiOptions = getUiOptions(uiSchema);
19
+ const { rjsfSlotProps: muiSlotProps } = getMuiProps(uiOptions);
20
+ return (_jsx(Paper, { elevation: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorPaper, children: _jsxs(Box, { mb: 2, p: 2, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorBox, children: [_jsx(Typography, { variant: 'h6', ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorTypography, children: translateString(TranslatableString.ErrorsLabel) }), _jsx(List, { dense: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorList, children: errors.map((error, i) => {
21
+ return (_jsxs(ListItem, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorListItem, children: [_jsx(ListItemIcon, { ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorListItemIcon, children: _jsx(ErrorIcon, { color: 'error' }) }), _jsx(ListItemText, { primary: error.stack, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.errorListItemText })] }, i));
19
22
  }) })] }) }));
20
23
  }
21
24
  //# sourceMappingURL=ErrorList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorList.js","sourceRoot":"","sources":["../../src/ErrorList/ErrorList.tsx"],"names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AZ,YAAY,CAAE,aAAa,aAC/C,KAAC,YAAY,OAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,iBAAiB,YAC/C,KAAC,SAAS,IAAC,KAAK,EAAC,OAAO,GAAG,GACd,EACf,KAAC,YAAY,IAAC,OAAO,EAAE,KAAK,CAAC,KAAK,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,iBAAiB,GAAI,KAJ9D,CAAC,CAKL,CACZ,CAAC;oBACJ,CAAC,CAAC,GACG,IACH,GACA,CACT,CAAC;AACJ,CAAC"}
@@ -1,4 +1,19 @@
1
- import { FieldErrorProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { ListItemProps } from '@mui/material/ListItem';
2
+ import { FormHelperTextProps } from '@mui/material/FormHelperText';
3
+ import { ListProps } from '@mui/material/List';
4
+ import { FieldErrorProps, FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
5
+ /** Properties available for the `rjsfSlotProps` target of the FieldErrorTemplate. */
6
+ export interface FieldErrorTemplateMuiProps extends GenericObjectType {
7
+ /** RJSF-specific slot props for targeting child elements of the FieldErrorTemplate. */
8
+ rjsfSlotProps?: {
9
+ /** Props applied to the `List` container holding the errors. */
10
+ fieldErrorList?: ListProps;
11
+ /** Props applied to each `ListItem` representing an error. */
12
+ fieldErrorListItem?: ListItemProps;
13
+ /** Props applied to the `FormHelperText` displaying the actual error message. */
14
+ fieldErrorFormHelperText?: FormHelperTextProps;
15
+ };
16
+ }
2
17
  /** The `FieldErrorTemplate` component renders the errors local to the particular field
3
18
  *
4
19
  * @param props - The `FieldErrorProps` for the errors being rendered
@@ -2,19 +2,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import ListItem from '@mui/material/ListItem';
3
3
  import FormHelperText from '@mui/material/FormHelperText';
4
4
  import List from '@mui/material/List';
5
- import { errorId } from '@rjsf/utils';
5
+ import { errorId, getUiOptions, } from '@rjsf/utils';
6
+ import { getMuiProps } from '../util.js';
6
7
  /** The `FieldErrorTemplate` component renders the errors local to the particular field
7
8
  *
8
9
  * @param props - The `FieldErrorProps` for the errors being rendered
9
10
  */
10
11
  export default function FieldErrorTemplate(props) {
11
- const { errors = [], fieldPathId } = props;
12
+ const { errors = [], fieldPathId, uiSchema } = props;
12
13
  if (errors.length === 0) {
13
14
  return null;
14
15
  }
15
16
  const id = errorId(fieldPathId);
16
- return (_jsx(List, { id: id, dense: true, disablePadding: true, children: errors.map((error, i) => {
17
- return (_jsx(ListItem, { disableGutters: true, children: _jsx(FormHelperText, { component: 'div', id: `${id}-${i}`, children: error }) }, i));
17
+ const uiOptions = getUiOptions(uiSchema);
18
+ const muiProps = getMuiProps(uiOptions);
19
+ const { rjsfSlotProps: muiSlotProps } = muiProps;
20
+ return (_jsx(List, { id: id, dense: true, disablePadding: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorList, children: errors.map((error, i) => {
21
+ return (_jsx(ListItem, { disableGutters: true, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorListItem, children: _jsx(FormHelperText, { component: 'div', id: `${id}-${i}`, ...muiSlotProps === null || muiSlotProps === void 0 ? void 0 : muiSlotProps.fieldErrorFormHelperText, children: error }) }, i));
18
22
  }) }));
19
23
  }
20
24
  //# sourceMappingURL=FieldErrorTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FieldErrorTemplate.js","sourceRoot":"","sources":["../../src/FieldErrorTemplate/FieldErrorTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAkE,MAAM,aAAa,CAAC;AAEtG;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAA+B;IAC/B,MAAM,E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;IAEhC,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,WAAW,CAAsC,SAAS,CAAC,CAAC;IAC7E,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;IAEjD,OAAO,CACL,KAAC,IAAI,IAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,cAAc,YAC9E,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAS,EAAE,EAAE;YAC/B,OAAO,CACL,KAAC,QAAQ,IAAS,cAAc,EAAE,IAAI,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,kBAAkB,YAC1E,KAAC,cAAc,IAAC,SAAS,EAAC,KAAK,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,KAAM,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,wBAAwB,YACzF,KAAK,GACS,IAHJ,CAAC,CAIL,CACZ,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC"}
@@ -1,4 +1,13 @@
1
- import { FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
1
+ import { FieldHelpProps, FormContextType, RJSFSchema, StrictRJSFSchema, GenericObjectType } from '@rjsf/utils';
2
+ import { FormHelperTextProps } from '@mui/material/FormHelperText';
3
+ /** Properties available for the `rjsfSlotProps` target of the FieldHelpTemplate. */
4
+ export interface FieldHelpTemplateMuiProps extends GenericObjectType {
5
+ /** RJSF-specific slot props for targeting child elements of the FieldHelpTemplate. */
6
+ rjsfSlotProps?: {
7
+ /** Props applied to the `FormHelperText` used for help text. */
8
+ helpFormHelperText?: FormHelperTextProps;
9
+ };
10
+ }
2
11
  /** The `FieldHelpTemplate` component renders any help desired for a field
3
12
  *
4
13
  * @param props - The `FieldHelpProps` to be rendered