@rjsf/mui 5.11.2 → 5.12.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 (211) hide show
  1. package/dist/index.js +1003 -5
  2. package/dist/index.js.map +7 -0
  3. package/dist/mui.esm.js +650 -824
  4. package/dist/mui.esm.js.map +7 -1
  5. package/dist/mui.umd.js +852 -0
  6. package/lib/AddButton/AddButton.d.ts +5 -0
  7. package/lib/AddButton/AddButton.js +13 -0
  8. package/lib/AddButton/AddButton.js.map +1 -0
  9. package/lib/AddButton/index.d.ts +2 -0
  10. package/lib/AddButton/index.js +3 -0
  11. package/lib/AddButton/index.js.map +1 -0
  12. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +7 -0
  13. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +21 -0
  14. package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -0
  15. package/lib/ArrayFieldItemTemplate/index.d.ts +2 -0
  16. package/lib/ArrayFieldItemTemplate/index.js +3 -0
  17. package/lib/ArrayFieldItemTemplate/index.js.map +1 -0
  18. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +7 -0
  19. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +25 -0
  20. package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -0
  21. package/lib/ArrayFieldTemplate/index.d.ts +2 -0
  22. package/lib/ArrayFieldTemplate/index.js +3 -0
  23. package/lib/ArrayFieldTemplate/index.js.map +1 -0
  24. package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +9 -0
  25. package/lib/BaseInputTemplate/BaseInputTemplate.js +32 -0
  26. package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -0
  27. package/lib/BaseInputTemplate/index.d.ts +2 -0
  28. package/lib/BaseInputTemplate/index.js +3 -0
  29. package/lib/BaseInputTemplate/index.js.map +1 -0
  30. package/lib/CheckboxWidget/CheckboxWidget.d.ts +8 -0
  31. package/lib/CheckboxWidget/CheckboxWidget.js +24 -0
  32. package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -0
  33. package/lib/CheckboxWidget/index.d.ts +2 -0
  34. package/lib/CheckboxWidget/index.js +3 -0
  35. package/lib/CheckboxWidget/index.js.map +1 -0
  36. package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +8 -0
  37. package/lib/CheckboxesWidget/CheckboxesWidget.js +33 -0
  38. package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -0
  39. package/lib/CheckboxesWidget/index.d.ts +2 -0
  40. package/lib/CheckboxesWidget/index.js +3 -0
  41. package/lib/CheckboxesWidget/index.js.map +1 -0
  42. package/lib/DescriptionField/DescriptionField.d.ts +7 -0
  43. package/lib/DescriptionField/DescriptionField.js +14 -0
  44. package/lib/DescriptionField/DescriptionField.js.map +1 -0
  45. package/lib/DescriptionField/index.d.ts +2 -0
  46. package/lib/DescriptionField/index.js +3 -0
  47. package/lib/DescriptionField/index.js.map +1 -0
  48. package/lib/ErrorList/ErrorList.d.ts +7 -0
  49. package/lib/ErrorList/ErrorList.js +21 -0
  50. package/lib/ErrorList/ErrorList.js.map +1 -0
  51. package/lib/ErrorList/index.d.ts +2 -0
  52. package/lib/ErrorList/index.js +3 -0
  53. package/lib/ErrorList/index.js.map +1 -0
  54. package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +7 -0
  55. package/lib/FieldErrorTemplate/FieldErrorTemplate.js +20 -0
  56. package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -0
  57. package/lib/FieldErrorTemplate/index.d.ts +2 -0
  58. package/lib/FieldErrorTemplate/index.js +3 -0
  59. package/lib/FieldErrorTemplate/index.js.map +1 -0
  60. package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +7 -0
  61. package/lib/FieldHelpTemplate/FieldHelpTemplate.js +16 -0
  62. package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -0
  63. package/lib/FieldHelpTemplate/index.d.ts +2 -0
  64. package/lib/FieldHelpTemplate/index.js +3 -0
  65. package/lib/FieldHelpTemplate/index.js.map +1 -0
  66. package/lib/FieldTemplate/FieldTemplate.d.ts +8 -0
  67. package/lib/FieldTemplate/FieldTemplate.js +19 -0
  68. package/lib/FieldTemplate/FieldTemplate.js.map +1 -0
  69. package/lib/FieldTemplate/index.d.ts +2 -0
  70. package/lib/FieldTemplate/index.js +3 -0
  71. package/lib/FieldTemplate/index.js.map +1 -0
  72. package/lib/IconButton/IconButton.d.ts +7 -0
  73. package/lib/IconButton/IconButton.js +30 -0
  74. package/lib/IconButton/IconButton.js.map +1 -0
  75. package/lib/IconButton/index.d.ts +2 -0
  76. package/lib/IconButton/index.js +3 -0
  77. package/lib/IconButton/index.js.map +1 -0
  78. package/lib/MuiForm/MuiForm.d.ts +6 -0
  79. package/lib/MuiForm/MuiForm.js +7 -0
  80. package/lib/MuiForm/MuiForm.js.map +1 -0
  81. package/lib/MuiForm/index.d.ts +2 -0
  82. package/lib/MuiForm/index.js +3 -0
  83. package/lib/MuiForm/index.js.map +1 -0
  84. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +9 -0
  85. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +22 -0
  86. package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -0
  87. package/lib/ObjectFieldTemplate/index.d.ts +2 -0
  88. package/lib/ObjectFieldTemplate/index.js +3 -0
  89. package/lib/ObjectFieldTemplate/index.js.map +1 -0
  90. package/lib/RadioWidget/RadioWidget.d.ts +8 -0
  91. package/lib/RadioWidget/RadioWidget.js +27 -0
  92. package/lib/RadioWidget/RadioWidget.js.map +1 -0
  93. package/lib/RadioWidget/index.d.ts +2 -0
  94. package/lib/RadioWidget/index.js +3 -0
  95. package/lib/RadioWidget/index.js.map +1 -0
  96. package/lib/RangeWidget/RangeWidget.d.ts +8 -0
  97. package/lib/RangeWidget/RangeWidget.js +20 -0
  98. package/lib/RangeWidget/RangeWidget.js.map +1 -0
  99. package/lib/RangeWidget/index.d.ts +2 -0
  100. package/lib/RangeWidget/index.js +3 -0
  101. package/lib/RangeWidget/index.js.map +1 -0
  102. package/lib/SelectWidget/SelectWidget.d.ts +9 -0
  103. package/lib/SelectWidget/SelectWidget.js +29 -0
  104. package/lib/SelectWidget/SelectWidget.js.map +1 -0
  105. package/lib/SelectWidget/index.d.ts +2 -0
  106. package/lib/SelectWidget/index.js +3 -0
  107. package/lib/SelectWidget/index.js.map +1 -0
  108. package/lib/SubmitButton/SubmitButton.d.ts +5 -0
  109. package/lib/SubmitButton/SubmitButton.js +14 -0
  110. package/lib/SubmitButton/SubmitButton.js.map +1 -0
  111. package/lib/SubmitButton/index.d.ts +2 -0
  112. package/lib/SubmitButton/index.js +3 -0
  113. package/lib/SubmitButton/index.js.map +1 -0
  114. package/lib/Templates/Templates.d.ts +4 -0
  115. package/lib/Templates/Templates.js +39 -0
  116. package/lib/Templates/Templates.js.map +1 -0
  117. package/lib/Templates/index.d.ts +2 -0
  118. package/lib/Templates/index.js +3 -0
  119. package/lib/Templates/index.js.map +1 -0
  120. package/lib/TextareaWidget/TextareaWidget.d.ts +7 -0
  121. package/lib/TextareaWidget/TextareaWidget.js +16 -0
  122. package/lib/TextareaWidget/TextareaWidget.js.map +1 -0
  123. package/lib/TextareaWidget/index.d.ts +2 -0
  124. package/lib/TextareaWidget/index.js +3 -0
  125. package/lib/TextareaWidget/index.js.map +1 -0
  126. package/lib/Theme/Theme.d.ts +5 -0
  127. package/lib/Theme/Theme.js +10 -0
  128. package/lib/Theme/Theme.js.map +1 -0
  129. package/lib/Theme/index.d.ts +2 -0
  130. package/lib/Theme/index.js +3 -0
  131. package/lib/Theme/index.js.map +1 -0
  132. package/lib/TitleField/TitleField.d.ts +7 -0
  133. package/lib/TitleField/TitleField.js +12 -0
  134. package/lib/TitleField/TitleField.js.map +1 -0
  135. package/lib/TitleField/index.d.ts +2 -0
  136. package/lib/TitleField/index.js +3 -0
  137. package/lib/TitleField/index.js.map +1 -0
  138. package/lib/Widgets/Widgets.d.ts +4 -0
  139. package/lib/Widgets/Widgets.js +18 -0
  140. package/lib/Widgets/Widgets.js.map +1 -0
  141. package/lib/Widgets/index.d.ts +2 -0
  142. package/lib/Widgets/index.js +3 -0
  143. package/lib/Widgets/index.js.map +1 -0
  144. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +8 -0
  145. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +29 -0
  146. package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -0
  147. package/lib/WrapIfAdditionalTemplate/index.d.ts +2 -0
  148. package/lib/WrapIfAdditionalTemplate/index.js +3 -0
  149. package/lib/WrapIfAdditionalTemplate/index.js.map +1 -0
  150. package/lib/index.d.ts +6 -0
  151. package/lib/index.js +7 -0
  152. package/lib/index.js.map +1 -0
  153. package/package.json +24 -16
  154. package/src/AddButton/AddButton.tsx +18 -0
  155. package/src/AddButton/index.ts +2 -0
  156. package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +91 -0
  157. package/src/ArrayFieldItemTemplate/index.ts +2 -0
  158. package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +87 -0
  159. package/src/ArrayFieldTemplate/index.ts +2 -0
  160. package/src/BaseInputTemplate/BaseInputTemplate.tsx +106 -0
  161. package/src/BaseInputTemplate/index.ts +2 -0
  162. package/src/CheckboxWidget/CheckboxWidget.tsx +87 -0
  163. package/src/CheckboxWidget/index.ts +2 -0
  164. package/src/CheckboxesWidget/CheckboxesWidget.tsx +92 -0
  165. package/src/CheckboxesWidget/index.ts +2 -0
  166. package/src/DescriptionField/DescriptionField.tsx +23 -0
  167. package/src/DescriptionField/index.ts +2 -0
  168. package/src/ErrorList/ErrorList.tsx +39 -0
  169. package/src/ErrorList/index.ts +2 -0
  170. package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +32 -0
  171. package/src/FieldErrorTemplate/index.ts +2 -0
  172. package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +19 -0
  173. package/src/FieldHelpTemplate/index.ts +2 -0
  174. package/src/FieldTemplate/FieldTemplate.tsx +81 -0
  175. package/src/FieldTemplate/index.ts +2 -0
  176. package/src/IconButton/IconButton.tsx +81 -0
  177. package/src/IconButton/index.ts +2 -0
  178. package/src/MuiForm/MuiForm.tsx +15 -0
  179. package/src/MuiForm/index.ts +2 -0
  180. package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +99 -0
  181. package/src/ObjectFieldTemplate/index.ts +2 -0
  182. package/src/RadioWidget/RadioWidget.tsx +83 -0
  183. package/src/RadioWidget/index.ts +2 -0
  184. package/src/RangeWidget/RangeWidget.tsx +51 -0
  185. package/src/RangeWidget/index.ts +2 -0
  186. package/src/SelectWidget/SelectWidget.tsx +100 -0
  187. package/src/SelectWidget/index.ts +2 -0
  188. package/src/SubmitButton/SubmitButton.tsx +23 -0
  189. package/src/SubmitButton/index.ts +2 -0
  190. package/src/Templates/Templates.ts +46 -0
  191. package/src/Templates/index.ts +2 -0
  192. package/src/TextareaWidget/TextareaWidget.tsx +21 -0
  193. package/src/TextareaWidget/index.ts +2 -0
  194. package/src/Theme/Theme.tsx +18 -0
  195. package/src/Theme/index.ts +2 -0
  196. package/src/TitleField/TitleField.tsx +20 -0
  197. package/src/TitleField/index.ts +2 -0
  198. package/src/Widgets/Widgets.ts +25 -0
  199. package/src/Widgets/index.ts +2 -0
  200. package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +90 -0
  201. package/src/WrapIfAdditionalTemplate/index.ts +2 -0
  202. package/src/index.ts +8 -0
  203. package/dist/index.d.ts +0 -17
  204. package/dist/mui.cjs.development.js +0 -1239
  205. package/dist/mui.cjs.development.js.map +0 -1
  206. package/dist/mui.cjs.production.min.js +0 -2
  207. package/dist/mui.cjs.production.min.js.map +0 -1
  208. package/dist/mui.umd.development.js +0 -1213
  209. package/dist/mui.umd.development.js.map +0 -1
  210. package/dist/mui.umd.production.min.js +0 -2
  211. package/dist/mui.umd.production.min.js.map +0 -1
@@ -0,0 +1,852 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('@mui/icons-material/Add'), require('@mui/material/IconButton'), require('@rjsf/utils'), require('react/jsx-runtime'), require('@mui/material/Box'), require('@mui/material/Grid'), require('@mui/material/Paper'), require('@mui/material/TextField'), require('@mui/material/Typography'), require('@mui/icons-material/Error'), require('@mui/material/List'), require('@mui/material/ListItem'), require('@mui/material/ListItemIcon'), require('@mui/material/ListItemText'), require('@mui/icons-material/ArrowDownward'), require('@mui/icons-material/ArrowUpward'), require('@mui/icons-material/ContentCopy'), require('@mui/icons-material/Remove'), require('@mui/material/FormHelperText'), require('@mui/material/FormControl'), require('@mui/material/Button'), require('@mui/material/Divider'), require('@mui/material/Checkbox'), require('@mui/material/FormControlLabel'), require('@mui/material/FormGroup'), require('@mui/material/FormLabel'), require('@mui/material/Radio'), require('@mui/material/RadioGroup'), require('@mui/material/Slider'), require('@mui/material/MenuItem')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', '@mui/icons-material/Add', '@mui/material/IconButton', '@rjsf/utils', 'react/jsx-runtime', '@mui/material/Box', '@mui/material/Grid', '@mui/material/Paper', '@mui/material/TextField', '@mui/material/Typography', '@mui/icons-material/Error', '@mui/material/List', '@mui/material/ListItem', '@mui/material/ListItemIcon', '@mui/material/ListItemText', '@mui/icons-material/ArrowDownward', '@mui/icons-material/ArrowUpward', '@mui/icons-material/ContentCopy', '@mui/icons-material/Remove', '@mui/material/FormHelperText', '@mui/material/FormControl', '@mui/material/Button', '@mui/material/Divider', '@mui/material/Checkbox', '@mui/material/FormControlLabel', '@mui/material/FormGroup', '@mui/material/FormLabel', '@mui/material/Radio', '@mui/material/RadioGroup', '@mui/material/Slider', '@mui/material/MenuItem'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/mui"] = {}, global.core, global.AddIcon, global.IconButton, global.utils, global.jsxRuntime, global.Box, global.Grid3, global.Paper, global.TextField, global.Typography, global.ErrorIcon, global.List, global.ListItem, global.ListItemIcon, global.ListItemText, global.ArrowDownwardIcon, global.ArrowUpwardIcon, global.CopyIcon, global.RemoveIcon, global.FormHelperText, global.FormControl, global.Button, global.Divider, global.Checkbox, global.FormControlLabel, global.FormGroup, global.FormLabel, global.Radio, global.RadioGroup, global.Slider, global.MenuItem));
5
+ })(this, (function (exports, core, AddIcon, IconButton, utils, jsxRuntime, Box, Grid3, Paper, TextField, Typography, ErrorIcon, List, ListItem, ListItemIcon, ListItemText, ArrowDownwardIcon, ArrowUpwardIcon, CopyIcon, RemoveIcon, FormHelperText, FormControl, Button, Divider, Checkbox, FormControlLabel, FormGroup, FormLabel, Radio, RadioGroup, Slider, MenuItem) { 'use strict';
6
+
7
+ // src/MuiForm/MuiForm.tsx
8
+ function AddButton({
9
+ uiSchema,
10
+ registry,
11
+ ...props
12
+ }) {
13
+ const { translateString } = registry;
14
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.AddItemButton), ...props, color: "primary", children: /* @__PURE__ */ jsxRuntime.jsx(AddIcon, {}) });
15
+ }
16
+ function ArrayFieldItemTemplate(props) {
17
+ const {
18
+ children,
19
+ disabled,
20
+ hasToolbar,
21
+ hasCopy,
22
+ hasMoveDown,
23
+ hasMoveUp,
24
+ hasRemove,
25
+ index,
26
+ onCopyIndexClick,
27
+ onDropIndexClick,
28
+ onReorderClick,
29
+ readonly,
30
+ uiSchema,
31
+ registry
32
+ } = props;
33
+ const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
34
+ const btnStyle = {
35
+ flex: 1,
36
+ paddingLeft: 6,
37
+ paddingRight: 6,
38
+ fontWeight: "bold",
39
+ minWidth: 0
40
+ };
41
+ return /* @__PURE__ */ jsxRuntime.jsxs(Grid3, { container: true, alignItems: "center", children: [
42
+ /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, xs: true, style: { overflow: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mb: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { p: 2, children }) }) }) }),
43
+ hasToolbar && /* @__PURE__ */ jsxRuntime.jsxs(Grid3, { item: true, children: [
44
+ (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsxRuntime.jsx(
45
+ MoveUpButton2,
46
+ {
47
+ style: btnStyle,
48
+ disabled: disabled || readonly || !hasMoveUp,
49
+ onClick: onReorderClick(index, index - 1),
50
+ uiSchema,
51
+ registry
52
+ }
53
+ ),
54
+ (hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsxRuntime.jsx(
55
+ MoveDownButton2,
56
+ {
57
+ style: btnStyle,
58
+ disabled: disabled || readonly || !hasMoveDown,
59
+ onClick: onReorderClick(index, index + 1),
60
+ uiSchema,
61
+ registry
62
+ }
63
+ ),
64
+ hasCopy && /* @__PURE__ */ jsxRuntime.jsx(
65
+ CopyButton2,
66
+ {
67
+ style: btnStyle,
68
+ disabled: disabled || readonly,
69
+ onClick: onCopyIndexClick(index),
70
+ uiSchema,
71
+ registry
72
+ }
73
+ ),
74
+ hasRemove && /* @__PURE__ */ jsxRuntime.jsx(
75
+ RemoveButton2,
76
+ {
77
+ style: btnStyle,
78
+ disabled: disabled || readonly,
79
+ onClick: onDropIndexClick(index),
80
+ uiSchema,
81
+ registry
82
+ }
83
+ )
84
+ ] })
85
+ ] });
86
+ }
87
+ function ArrayFieldTemplate(props) {
88
+ const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = props;
89
+ const uiOptions = utils.getUiOptions(uiSchema);
90
+ const ArrayFieldDescriptionTemplate = utils.getTemplate(
91
+ "ArrayFieldDescriptionTemplate",
92
+ registry,
93
+ uiOptions
94
+ );
95
+ const ArrayFieldItemTemplate2 = utils.getTemplate(
96
+ "ArrayFieldItemTemplate",
97
+ registry,
98
+ uiOptions
99
+ );
100
+ const ArrayFieldTitleTemplate = utils.getTemplate(
101
+ "ArrayFieldTitleTemplate",
102
+ registry,
103
+ uiOptions
104
+ );
105
+ const {
106
+ ButtonTemplates: { AddButton: AddButton2 }
107
+ } = registry.templates;
108
+ return /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { p: 2, children: [
109
+ /* @__PURE__ */ jsxRuntime.jsx(
110
+ ArrayFieldTitleTemplate,
111
+ {
112
+ idSchema,
113
+ title: uiOptions.title || title,
114
+ schema,
115
+ uiSchema,
116
+ required,
117
+ registry
118
+ }
119
+ ),
120
+ /* @__PURE__ */ jsxRuntime.jsx(
121
+ ArrayFieldDescriptionTemplate,
122
+ {
123
+ idSchema,
124
+ description: uiOptions.description || schema.description,
125
+ schema,
126
+ uiSchema,
127
+ registry
128
+ }
129
+ ),
130
+ /* @__PURE__ */ jsxRuntime.jsxs(Grid3, { container: true, children: [
131
+ items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ jsxRuntime.jsx(ArrayFieldItemTemplate2, { ...itemProps }, key)),
132
+ canAdd && /* @__PURE__ */ jsxRuntime.jsx(Grid3, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { mt: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
133
+ AddButton2,
134
+ {
135
+ className: "array-item-add",
136
+ onClick: onAddClick,
137
+ disabled: disabled || readonly,
138
+ uiSchema,
139
+ registry
140
+ }
141
+ ) }) }) })
142
+ ] }, `array-item-list-${idSchema.$id}`)
143
+ ] }) });
144
+ }
145
+ var TYPES_THAT_SHRINK_LABEL = ["date", "datetime-local", "file", "time"];
146
+ function BaseInputTemplate(props) {
147
+ const {
148
+ id,
149
+ name,
150
+ // remove this from textFieldProps
151
+ placeholder,
152
+ required,
153
+ readonly,
154
+ disabled,
155
+ type,
156
+ label,
157
+ hideLabel,
158
+ value,
159
+ onChange,
160
+ onChangeOverride,
161
+ onBlur,
162
+ onFocus,
163
+ autofocus,
164
+ options,
165
+ schema,
166
+ uiSchema,
167
+ rawErrors = [],
168
+ formContext,
169
+ registry,
170
+ InputLabelProps,
171
+ ...textFieldProps
172
+ } = props;
173
+ const inputProps = utils.getInputProps(schema, type, options);
174
+ const { step, min, max, ...rest } = inputProps;
175
+ const otherProps = {
176
+ inputProps: {
177
+ step,
178
+ min,
179
+ max,
180
+ ...schema.examples ? { list: utils.examplesId(id) } : void 0
181
+ },
182
+ ...rest
183
+ };
184
+ const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
185
+ const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
186
+ const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
187
+ const DisplayInputLabelProps = TYPES_THAT_SHRINK_LABEL.includes(type) ? {
188
+ ...InputLabelProps,
189
+ shrink: true
190
+ } : InputLabelProps;
191
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
192
+ /* @__PURE__ */ jsxRuntime.jsx(
193
+ TextField,
194
+ {
195
+ id,
196
+ name: id,
197
+ placeholder,
198
+ label: utils.labelValue(label || void 0, hideLabel, false),
199
+ autoFocus: autofocus,
200
+ required,
201
+ disabled: disabled || readonly,
202
+ ...otherProps,
203
+ value: value || value === 0 ? value : "",
204
+ error: rawErrors.length > 0,
205
+ onChange: onChangeOverride || _onChange,
206
+ onBlur: _onBlur,
207
+ onFocus: _onFocus,
208
+ InputLabelProps: DisplayInputLabelProps,
209
+ ...textFieldProps,
210
+ "aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
211
+ }
212
+ ),
213
+ Array.isArray(schema.examples) && /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: utils.examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
214
+ return /* @__PURE__ */ jsxRuntime.jsx("option", { value: example }, example);
215
+ }) })
216
+ ] });
217
+ }
218
+ function DescriptionField(props) {
219
+ const { id, description } = props;
220
+ if (description) {
221
+ return /* @__PURE__ */ jsxRuntime.jsx(Typography, { id, variant: "subtitle2", style: { marginTop: "5px" }, children: description });
222
+ }
223
+ return null;
224
+ }
225
+ function ErrorList({
226
+ errors,
227
+ registry
228
+ }) {
229
+ const { translateString } = registry;
230
+ return /* @__PURE__ */ jsxRuntime.jsx(Paper, { elevation: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(Box, { mb: 2, p: 2, children: [
231
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h6", children: translateString(utils.TranslatableString.ErrorsLabel) }),
232
+ /* @__PURE__ */ jsxRuntime.jsx(List, { dense: true, children: errors.map((error, i) => {
233
+ return /* @__PURE__ */ jsxRuntime.jsxs(ListItem, { children: [
234
+ /* @__PURE__ */ jsxRuntime.jsx(ListItemIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorIcon, { color: "error" }) }),
235
+ /* @__PURE__ */ jsxRuntime.jsx(ListItemText, { primary: error.stack })
236
+ ] }, i);
237
+ }) })
238
+ ] }) });
239
+ }
240
+ function MuiIconButton(props) {
241
+ const { icon, color, uiSchema, registry, ...otherProps } = props;
242
+ return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { ...otherProps, size: "small", color, children: icon });
243
+ }
244
+ function CopyButton(props) {
245
+ const {
246
+ registry: { translateString }
247
+ } = props;
248
+ return /* @__PURE__ */ jsxRuntime.jsx(
249
+ MuiIconButton,
250
+ {
251
+ title: translateString(utils.TranslatableString.CopyButton),
252
+ ...props,
253
+ icon: /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { fontSize: "small" })
254
+ }
255
+ );
256
+ }
257
+ function MoveDownButton(props) {
258
+ const {
259
+ registry: { translateString }
260
+ } = props;
261
+ return /* @__PURE__ */ jsxRuntime.jsx(
262
+ MuiIconButton,
263
+ {
264
+ title: translateString(utils.TranslatableString.MoveDownButton),
265
+ ...props,
266
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ArrowDownwardIcon, { fontSize: "small" })
267
+ }
268
+ );
269
+ }
270
+ function MoveUpButton(props) {
271
+ const {
272
+ registry: { translateString }
273
+ } = props;
274
+ return /* @__PURE__ */ jsxRuntime.jsx(
275
+ MuiIconButton,
276
+ {
277
+ title: translateString(utils.TranslatableString.MoveUpButton),
278
+ ...props,
279
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ArrowUpwardIcon, { fontSize: "small" })
280
+ }
281
+ );
282
+ }
283
+ function RemoveButton(props) {
284
+ const { iconType, ...otherProps } = props;
285
+ const {
286
+ registry: { translateString }
287
+ } = otherProps;
288
+ return /* @__PURE__ */ jsxRuntime.jsx(
289
+ MuiIconButton,
290
+ {
291
+ title: translateString(utils.TranslatableString.RemoveButton),
292
+ ...otherProps,
293
+ color: "error",
294
+ icon: /* @__PURE__ */ jsxRuntime.jsx(RemoveIcon, { fontSize: iconType === "default" ? void 0 : "small" })
295
+ }
296
+ );
297
+ }
298
+ function FieldErrorTemplate(props) {
299
+ const { errors = [], idSchema } = props;
300
+ if (errors.length === 0) {
301
+ return null;
302
+ }
303
+ const id = utils.errorId(idSchema);
304
+ return /* @__PURE__ */ jsxRuntime.jsx(List, { dense: true, disablePadding: true, children: errors.map((error, i) => {
305
+ return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { disableGutters: true, children: /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { id, children: error }) }, i);
306
+ }) });
307
+ }
308
+ function FieldHelpTemplate(props) {
309
+ const { idSchema, help } = props;
310
+ if (!help) {
311
+ return null;
312
+ }
313
+ const id = utils.helpId(idSchema);
314
+ return /* @__PURE__ */ jsxRuntime.jsx(FormHelperText, { id, children: help });
315
+ }
316
+ function FieldTemplate(props) {
317
+ const {
318
+ id,
319
+ children,
320
+ classNames,
321
+ style,
322
+ disabled,
323
+ displayLabel,
324
+ hidden,
325
+ label,
326
+ onDropPropertyClick,
327
+ onKeyChange,
328
+ readonly,
329
+ required,
330
+ rawErrors = [],
331
+ errors,
332
+ help,
333
+ description,
334
+ rawDescription,
335
+ schema,
336
+ uiSchema,
337
+ registry
338
+ } = props;
339
+ const uiOptions = utils.getUiOptions(uiSchema);
340
+ const WrapIfAdditionalTemplate2 = utils.getTemplate(
341
+ "WrapIfAdditionalTemplate",
342
+ registry,
343
+ uiOptions
344
+ );
345
+ if (hidden) {
346
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "none" }, children });
347
+ }
348
+ return /* @__PURE__ */ jsxRuntime.jsx(
349
+ WrapIfAdditionalTemplate2,
350
+ {
351
+ classNames,
352
+ style,
353
+ disabled,
354
+ id,
355
+ label,
356
+ onDropPropertyClick,
357
+ onKeyChange,
358
+ readonly,
359
+ required,
360
+ schema,
361
+ uiSchema,
362
+ registry,
363
+ children: /* @__PURE__ */ jsxRuntime.jsxs(FormControl, { fullWidth: true, error: rawErrors.length ? true : false, required, children: [
364
+ children,
365
+ displayLabel && rawDescription ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "caption", color: "textSecondary", children: description }) : null,
366
+ errors,
367
+ help
368
+ ] })
369
+ }
370
+ );
371
+ }
372
+ function ObjectFieldTemplate(props) {
373
+ const {
374
+ description,
375
+ title,
376
+ properties,
377
+ required,
378
+ disabled,
379
+ readonly,
380
+ uiSchema,
381
+ idSchema,
382
+ schema,
383
+ formData,
384
+ onAddClick,
385
+ registry
386
+ } = props;
387
+ const uiOptions = utils.getUiOptions(uiSchema);
388
+ const TitleFieldTemplate = utils.getTemplate("TitleFieldTemplate", registry, uiOptions);
389
+ const DescriptionFieldTemplate = utils.getTemplate(
390
+ "DescriptionFieldTemplate",
391
+ registry,
392
+ uiOptions
393
+ );
394
+ const {
395
+ ButtonTemplates: { AddButton: AddButton2 }
396
+ } = registry.templates;
397
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
398
+ title && /* @__PURE__ */ jsxRuntime.jsx(
399
+ TitleFieldTemplate,
400
+ {
401
+ id: utils.titleId(idSchema),
402
+ title,
403
+ required,
404
+ schema,
405
+ uiSchema,
406
+ registry
407
+ }
408
+ ),
409
+ description && /* @__PURE__ */ jsxRuntime.jsx(
410
+ DescriptionFieldTemplate,
411
+ {
412
+ id: utils.descriptionId(idSchema),
413
+ description,
414
+ schema,
415
+ uiSchema,
416
+ registry
417
+ }
418
+ ),
419
+ /* @__PURE__ */ jsxRuntime.jsxs(Grid3, { container: true, spacing: 2, style: { marginTop: "10px" }, children: [
420
+ properties.map(
421
+ (element, index) => (
422
+ // Remove the <Grid> if the inner element is hidden as the <Grid>
423
+ // itself would otherwise still take up space.
424
+ element.hidden ? element.content : /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, xs: 12, style: { marginBottom: "10px" }, children: element.content }, index)
425
+ )
426
+ ),
427
+ utils.canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsxRuntime.jsx(Grid3, { container: true, justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, children: /* @__PURE__ */ jsxRuntime.jsx(
428
+ AddButton2,
429
+ {
430
+ className: "object-property-expand",
431
+ onClick: onAddClick(schema),
432
+ disabled: disabled || readonly,
433
+ uiSchema,
434
+ registry
435
+ }
436
+ ) }) })
437
+ ] })
438
+ ] });
439
+ }
440
+ function SubmitButton({ uiSchema }) {
441
+ const { submitText, norender, props: submitButtonProps = {} } = utils.getSubmitButtonOptions(uiSchema);
442
+ if (norender) {
443
+ return null;
444
+ }
445
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", variant: "contained", color: "primary", ...submitButtonProps, children: submitText }) });
446
+ }
447
+ function TitleField({
448
+ id,
449
+ title
450
+ }) {
451
+ return /* @__PURE__ */ jsxRuntime.jsxs(Box, { id, mb: 1, mt: 1, children: [
452
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h5", children: title }),
453
+ /* @__PURE__ */ jsxRuntime.jsx(Divider, {})
454
+ ] });
455
+ }
456
+ function WrapIfAdditionalTemplate(props) {
457
+ const {
458
+ children,
459
+ classNames,
460
+ style,
461
+ disabled,
462
+ id,
463
+ label,
464
+ onDropPropertyClick,
465
+ onKeyChange,
466
+ readonly,
467
+ required,
468
+ schema,
469
+ uiSchema,
470
+ registry
471
+ } = props;
472
+ const { templates, translateString } = registry;
473
+ const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
474
+ const keyLabel = translateString(utils.TranslatableString.KeyLabel, [label]);
475
+ const additional = utils.ADDITIONAL_PROPERTY_FLAG in schema;
476
+ const btnStyle = {
477
+ flex: 1,
478
+ paddingLeft: 6,
479
+ paddingRight: 6,
480
+ fontWeight: "bold"
481
+ };
482
+ if (!additional) {
483
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, style, children });
484
+ }
485
+ const handleBlur = ({ target }) => onKeyChange(target.value);
486
+ return /* @__PURE__ */ jsxRuntime.jsxs(Grid3, { container: true, alignItems: "center", spacing: 2, className: classNames, style, children: [
487
+ /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, xs: true, children: /* @__PURE__ */ jsxRuntime.jsx(
488
+ TextField,
489
+ {
490
+ fullWidth: true,
491
+ required,
492
+ label: keyLabel,
493
+ defaultValue: label,
494
+ disabled: disabled || readonly,
495
+ id: `${id}-key`,
496
+ name: `${id}-key`,
497
+ onBlur: !readonly ? handleBlur : void 0,
498
+ type: "text"
499
+ }
500
+ ) }),
501
+ /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, xs: true, children }),
502
+ /* @__PURE__ */ jsxRuntime.jsx(Grid3, { item: true, children: /* @__PURE__ */ jsxRuntime.jsx(
503
+ RemoveButton2,
504
+ {
505
+ iconType: "default",
506
+ style: btnStyle,
507
+ disabled: disabled || readonly,
508
+ onClick: onDropPropertyClick(label),
509
+ uiSchema,
510
+ registry
511
+ }
512
+ ) })
513
+ ] }, `${id}-key`);
514
+ }
515
+
516
+ // src/Templates/Templates.ts
517
+ function generateTemplates() {
518
+ return {
519
+ ArrayFieldItemTemplate,
520
+ ArrayFieldTemplate,
521
+ BaseInputTemplate,
522
+ ButtonTemplates: {
523
+ AddButton,
524
+ CopyButton,
525
+ MoveDownButton,
526
+ MoveUpButton,
527
+ RemoveButton,
528
+ SubmitButton
529
+ },
530
+ DescriptionFieldTemplate: DescriptionField,
531
+ ErrorListTemplate: ErrorList,
532
+ FieldErrorTemplate,
533
+ FieldHelpTemplate,
534
+ FieldTemplate,
535
+ ObjectFieldTemplate,
536
+ TitleFieldTemplate: TitleField,
537
+ WrapIfAdditionalTemplate
538
+ };
539
+ }
540
+ var Templates_default = generateTemplates();
541
+ function CheckboxWidget(props) {
542
+ const {
543
+ schema,
544
+ id,
545
+ value,
546
+ disabled,
547
+ readonly,
548
+ label = "",
549
+ hideLabel,
550
+ autofocus,
551
+ onChange,
552
+ onBlur,
553
+ onFocus,
554
+ registry,
555
+ options,
556
+ uiSchema
557
+ } = props;
558
+ const DescriptionFieldTemplate = utils.getTemplate(
559
+ "DescriptionFieldTemplate",
560
+ registry,
561
+ options
562
+ );
563
+ const required = utils.schemaRequiresTrueValue(schema);
564
+ const _onChange = (_, checked) => onChange(checked);
565
+ const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
566
+ const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
567
+ const description = options.description ?? schema.description;
568
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
569
+ !hideLabel && !!description && /* @__PURE__ */ jsxRuntime.jsx(
570
+ DescriptionFieldTemplate,
571
+ {
572
+ id: utils.descriptionId(id),
573
+ description,
574
+ schema,
575
+ uiSchema,
576
+ registry
577
+ }
578
+ ),
579
+ /* @__PURE__ */ jsxRuntime.jsx(
580
+ FormControlLabel,
581
+ {
582
+ control: /* @__PURE__ */ jsxRuntime.jsx(
583
+ Checkbox,
584
+ {
585
+ id,
586
+ name: id,
587
+ checked: typeof value === "undefined" ? false : Boolean(value),
588
+ required,
589
+ disabled: disabled || readonly,
590
+ autoFocus: autofocus,
591
+ onChange: _onChange,
592
+ onBlur: _onBlur,
593
+ onFocus: _onFocus,
594
+ "aria-describedby": utils.ariaDescribedByIds(id)
595
+ }
596
+ ),
597
+ label: utils.labelValue(label, hideLabel, false)
598
+ }
599
+ )
600
+ ] });
601
+ }
602
+ function CheckboxesWidget({
603
+ label,
604
+ hideLabel,
605
+ id,
606
+ disabled,
607
+ options,
608
+ value,
609
+ autofocus,
610
+ readonly,
611
+ required,
612
+ onChange,
613
+ onBlur,
614
+ onFocus
615
+ }) {
616
+ const { enumOptions, enumDisabled, inline, emptyValue } = options;
617
+ const checkboxesValues = Array.isArray(value) ? value : [value];
618
+ const _onChange = (index) => ({ target: { checked } }) => {
619
+ if (checked) {
620
+ onChange(utils.enumOptionsSelectValue(index, checkboxesValues, enumOptions));
621
+ } else {
622
+ onChange(utils.enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
623
+ }
624
+ };
625
+ const _onBlur = ({ target: { value: value2 } }) => onBlur(id, utils.enumOptionsValueForIndex(value2, enumOptions, emptyValue));
626
+ const _onFocus = ({ target: { value: value2 } }) => onFocus(id, utils.enumOptionsValueForIndex(value2, enumOptions, emptyValue));
627
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
628
+ utils.labelValue(
629
+ /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, htmlFor: id, children: label || void 0 }),
630
+ hideLabel
631
+ ),
632
+ /* @__PURE__ */ jsxRuntime.jsx(FormGroup, { id, row: !!inline, children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
633
+ const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
634
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
635
+ const checkbox = /* @__PURE__ */ jsxRuntime.jsx(
636
+ Checkbox,
637
+ {
638
+ id: utils.optionId(id, index),
639
+ name: id,
640
+ checked,
641
+ disabled: disabled || itemDisabled || readonly,
642
+ autoFocus: autofocus && index === 0,
643
+ onChange: _onChange(index),
644
+ onBlur: _onBlur,
645
+ onFocus: _onFocus,
646
+ "aria-describedby": utils.ariaDescribedByIds(id)
647
+ }
648
+ );
649
+ return /* @__PURE__ */ jsxRuntime.jsx(FormControlLabel, { control: checkbox, label: option.label }, index);
650
+ }) })
651
+ ] });
652
+ }
653
+ function RadioWidget({
654
+ id,
655
+ options,
656
+ value,
657
+ required,
658
+ disabled,
659
+ readonly,
660
+ label,
661
+ hideLabel,
662
+ onChange,
663
+ onBlur,
664
+ onFocus
665
+ }) {
666
+ const { enumOptions, enumDisabled, emptyValue } = options;
667
+ const _onChange = (_, value2) => onChange(utils.enumOptionsValueForIndex(value2, enumOptions, emptyValue));
668
+ const _onBlur = ({ target: { value: value2 } }) => onBlur(id, utils.enumOptionsValueForIndex(value2, enumOptions, emptyValue));
669
+ const _onFocus = ({ target: { value: value2 } }) => onFocus(id, utils.enumOptionsValueForIndex(value2, enumOptions, emptyValue));
670
+ const row = options ? options.inline : false;
671
+ const selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions) ?? null;
672
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
673
+ utils.labelValue(
674
+ /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, htmlFor: id, children: label || void 0 }),
675
+ hideLabel
676
+ ),
677
+ /* @__PURE__ */ jsxRuntime.jsx(
678
+ RadioGroup,
679
+ {
680
+ id,
681
+ name: id,
682
+ value: selectedIndex,
683
+ row,
684
+ onChange: _onChange,
685
+ onBlur: _onBlur,
686
+ onFocus: _onFocus,
687
+ "aria-describedby": utils.ariaDescribedByIds(id),
688
+ children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
689
+ const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
690
+ const radio = /* @__PURE__ */ jsxRuntime.jsx(
691
+ FormControlLabel,
692
+ {
693
+ control: /* @__PURE__ */ jsxRuntime.jsx(Radio, { name: id, id: utils.optionId(id, index), color: "primary" }),
694
+ label: option.label,
695
+ value: String(index),
696
+ disabled: disabled || itemDisabled || readonly
697
+ },
698
+ index
699
+ );
700
+ return radio;
701
+ })
702
+ }
703
+ )
704
+ ] });
705
+ }
706
+ function RangeWidget(props) {
707
+ const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props;
708
+ const sliderProps = { value, label, id, name: id, ...utils.rangeSpec(schema) };
709
+ const _onChange = (_, value2) => {
710
+ onChange(value2 ?? options.emptyValue);
711
+ };
712
+ const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
713
+ const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
714
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
715
+ utils.labelValue(
716
+ /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { required, htmlFor: id, children: label || void 0 }),
717
+ hideLabel
718
+ ),
719
+ /* @__PURE__ */ jsxRuntime.jsx(
720
+ Slider,
721
+ {
722
+ disabled: disabled || readonly,
723
+ onChange: _onChange,
724
+ onBlur: _onBlur,
725
+ onFocus: _onFocus,
726
+ valueLabelDisplay: "auto",
727
+ ...sliderProps,
728
+ "aria-describedby": utils.ariaDescribedByIds(id)
729
+ }
730
+ )
731
+ ] });
732
+ }
733
+ function SelectWidget({
734
+ schema,
735
+ id,
736
+ name,
737
+ // remove this from textFieldProps
738
+ options,
739
+ label,
740
+ hideLabel,
741
+ required,
742
+ disabled,
743
+ placeholder,
744
+ readonly,
745
+ value,
746
+ multiple,
747
+ autofocus,
748
+ onChange,
749
+ onBlur,
750
+ onFocus,
751
+ rawErrors = [],
752
+ registry,
753
+ uiSchema,
754
+ hideError,
755
+ formContext,
756
+ ...textFieldProps
757
+ }) {
758
+ const { enumOptions, enumDisabled, emptyValue: optEmptyVal } = options;
759
+ multiple = typeof multiple === "undefined" ? false : !!multiple;
760
+ const emptyValue = multiple ? [] : "";
761
+ const isEmpty = typeof value === "undefined" || multiple && value.length < 1 || !multiple && value === emptyValue;
762
+ const _onChange = ({ target: { value: value2 } }) => onChange(utils.enumOptionsValueForIndex(value2, enumOptions, optEmptyVal));
763
+ const _onBlur = ({ target: { value: value2 } }) => onBlur(id, utils.enumOptionsValueForIndex(value2, enumOptions, optEmptyVal));
764
+ const _onFocus = ({ target: { value: value2 } }) => onFocus(id, utils.enumOptionsValueForIndex(value2, enumOptions, optEmptyVal));
765
+ const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
766
+ return /* @__PURE__ */ jsxRuntime.jsx(
767
+ TextField,
768
+ {
769
+ id,
770
+ name: id,
771
+ label: utils.labelValue(label || void 0, hideLabel, false),
772
+ value: isEmpty ? emptyValue : selectedIndexes,
773
+ required,
774
+ disabled: disabled || readonly,
775
+ autoFocus: autofocus,
776
+ placeholder,
777
+ error: rawErrors.length > 0,
778
+ onChange: _onChange,
779
+ onBlur: _onBlur,
780
+ onFocus: _onFocus,
781
+ ...textFieldProps,
782
+ select: true,
783
+ InputLabelProps: {
784
+ ...textFieldProps.InputLabelProps,
785
+ shrink: !isEmpty
786
+ },
787
+ SelectProps: {
788
+ ...textFieldProps.SelectProps,
789
+ multiple
790
+ },
791
+ "aria-describedby": utils.ariaDescribedByIds(id),
792
+ children: Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label: label2 }, i) => {
793
+ const disabled2 = Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1;
794
+ return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { value: String(i), disabled: disabled2, children: label2 }, i);
795
+ })
796
+ }
797
+ );
798
+ }
799
+ function TextareaWidget(props) {
800
+ const { options, registry } = props;
801
+ const BaseInputTemplate2 = utils.getTemplate("BaseInputTemplate", registry, options);
802
+ let rows = 5;
803
+ if (typeof options.rows === "string" || typeof options.rows === "number") {
804
+ rows = options.rows;
805
+ }
806
+ return /* @__PURE__ */ jsxRuntime.jsx(BaseInputTemplate2, { ...props, multiline: true, rows });
807
+ }
808
+
809
+ // src/Widgets/Widgets.ts
810
+ function generateWidgets() {
811
+ return {
812
+ CheckboxWidget,
813
+ CheckboxesWidget,
814
+ RadioWidget,
815
+ RangeWidget,
816
+ SelectWidget,
817
+ TextareaWidget
818
+ };
819
+ }
820
+ var Widgets_default = generateWidgets();
821
+
822
+ // src/Theme/Theme.tsx
823
+ function generateTheme() {
824
+ return {
825
+ templates: generateTemplates(),
826
+ widgets: generateWidgets()
827
+ };
828
+ }
829
+ var Theme_default = generateTheme();
830
+
831
+ // src/MuiForm/MuiForm.tsx
832
+ function generateForm() {
833
+ return core.withTheme(generateTheme());
834
+ }
835
+ var MuiForm_default = generateForm();
836
+
837
+ // src/index.ts
838
+ var src_default = MuiForm_default;
839
+
840
+ exports.Form = MuiForm_default;
841
+ exports.Templates = Templates_default;
842
+ exports.Theme = Theme_default;
843
+ exports.Widgets = Widgets_default;
844
+ exports.default = src_default;
845
+ exports.generateForm = generateForm;
846
+ exports.generateTemplates = generateTemplates;
847
+ exports.generateTheme = generateTheme;
848
+ exports.generateWidgets = generateWidgets;
849
+
850
+ Object.defineProperty(exports, '__esModule', { value: true });
851
+
852
+ }));