@rjsf/mantine 6.0.0-beta.14

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 (173) hide show
  1. package/README.md +153 -0
  2. package/dist/index.js +1918 -0
  3. package/dist/index.js.map +7 -0
  4. package/dist/mantine.esm.js +1967 -0
  5. package/dist/mantine.esm.js.map +7 -0
  6. package/dist/mantine.umd.js +1714 -0
  7. package/lib/Form/index.d.ts +6 -0
  8. package/lib/Form/index.js +7 -0
  9. package/lib/Form/index.js.map +1 -0
  10. package/lib/Theme/index.d.ts +5 -0
  11. package/lib/Theme/index.js +10 -0
  12. package/lib/Theme/index.js.map +1 -0
  13. package/lib/index.d.ts +6 -0
  14. package/lib/index.js +7 -0
  15. package/lib/index.js.map +1 -0
  16. package/lib/templates/ArrayFieldItemTemplate.d.ts +6 -0
  17. package/lib/templates/ArrayFieldItemTemplate.js +14 -0
  18. package/lib/templates/ArrayFieldItemTemplate.js.map +1 -0
  19. package/lib/templates/ArrayFieldTemplate.d.ts +6 -0
  20. package/lib/templates/ArrayFieldTemplate.js +20 -0
  21. package/lib/templates/ArrayFieldTemplate.js.map +1 -0
  22. package/lib/templates/ArrayFieldTitleTemplate.d.ts +7 -0
  23. package/lib/templates/ArrayFieldTitleTemplate.js +18 -0
  24. package/lib/templates/ArrayFieldTitleTemplate.js.map +1 -0
  25. package/lib/templates/BaseInputTemplate.d.ts +8 -0
  26. package/lib/templates/BaseInputTemplate.js +36 -0
  27. package/lib/templates/BaseInputTemplate.js.map +1 -0
  28. package/lib/templates/ButtonTemplates/AddButton.d.ts +4 -0
  29. package/lib/templates/ButtonTemplates/AddButton.js +11 -0
  30. package/lib/templates/ButtonTemplates/AddButton.js.map +1 -0
  31. package/lib/templates/ButtonTemplates/IconButton.d.ts +8 -0
  32. package/lib/templates/ButtonTemplates/IconButton.js +25 -0
  33. package/lib/templates/ButtonTemplates/IconButton.js.map +1 -0
  34. package/lib/templates/ButtonTemplates/SubmitButton.d.ts +4 -0
  35. package/lib/templates/ButtonTemplates/SubmitButton.js +13 -0
  36. package/lib/templates/ButtonTemplates/SubmitButton.js.map +1 -0
  37. package/lib/templates/ButtonTemplates/index.d.ts +3 -0
  38. package/lib/templates/ButtonTemplates/index.js +15 -0
  39. package/lib/templates/ButtonTemplates/index.js.map +1 -0
  40. package/lib/templates/DescriptionField.d.ts +6 -0
  41. package/lib/templates/DescriptionField.js +15 -0
  42. package/lib/templates/DescriptionField.js.map +1 -0
  43. package/lib/templates/ErrorList.d.ts +6 -0
  44. package/lib/templates/ErrorList.js +13 -0
  45. package/lib/templates/ErrorList.js.map +1 -0
  46. package/lib/templates/FieldErrorTemplate.d.ts +6 -0
  47. package/lib/templates/FieldErrorTemplate.js +16 -0
  48. package/lib/templates/FieldErrorTemplate.js.map +1 -0
  49. package/lib/templates/FieldHelpTemplate.d.ts +6 -0
  50. package/lib/templates/FieldHelpTemplate.js +13 -0
  51. package/lib/templates/FieldHelpTemplate.js.map +1 -0
  52. package/lib/templates/FieldTemplate.d.ts +7 -0
  53. package/lib/templates/FieldTemplate.js +18 -0
  54. package/lib/templates/FieldTemplate.js.map +1 -0
  55. package/lib/templates/GridTemplate.d.ts +7 -0
  56. package/lib/templates/GridTemplate.js +20 -0
  57. package/lib/templates/GridTemplate.js.map +1 -0
  58. package/lib/templates/MultiSchemaFieldTemplate.d.ts +2 -0
  59. package/lib/templates/MultiSchemaFieldTemplate.js +6 -0
  60. package/lib/templates/MultiSchemaFieldTemplate.js.map +1 -0
  61. package/lib/templates/ObjectFieldTemplate.d.ts +8 -0
  62. package/lib/templates/ObjectFieldTemplate.js +24 -0
  63. package/lib/templates/ObjectFieldTemplate.js.map +1 -0
  64. package/lib/templates/TitleField.d.ts +6 -0
  65. package/lib/templates/TitleField.js +11 -0
  66. package/lib/templates/TitleField.js.map +1 -0
  67. package/lib/templates/WrapIfAdditionalTemplate.d.ts +7 -0
  68. package/lib/templates/WrapIfAdditionalTemplate.js +29 -0
  69. package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -0
  70. package/lib/templates/icons.d.ts +11 -0
  71. package/lib/templates/icons.js +20 -0
  72. package/lib/templates/icons.js.map +1 -0
  73. package/lib/templates/index.d.ts +4 -0
  74. package/lib/templates/index.js +36 -0
  75. package/lib/templates/index.js.map +1 -0
  76. package/lib/tsconfig.tsbuildinfo +1 -0
  77. package/lib/utils.d.ts +2 -0
  78. package/lib/utils.js +35 -0
  79. package/lib/utils.js.map +1 -0
  80. package/lib/widgets/CheckboxWidget.d.ts +8 -0
  81. package/lib/widgets/CheckboxWidget.js +33 -0
  82. package/lib/widgets/CheckboxWidget.js.map +1 -0
  83. package/lib/widgets/CheckboxesWidget.d.ts +7 -0
  84. package/lib/widgets/CheckboxesWidget.js +33 -0
  85. package/lib/widgets/CheckboxesWidget.js.map +1 -0
  86. package/lib/widgets/ColorWidget.d.ts +6 -0
  87. package/lib/widgets/ColorWidget.js +28 -0
  88. package/lib/widgets/ColorWidget.js.map +1 -0
  89. package/lib/widgets/DateTime/AltDateTimeWidget.d.ts +13 -0
  90. package/lib/widgets/DateTime/AltDateTimeWidget.js +16 -0
  91. package/lib/widgets/DateTime/AltDateTimeWidget.js.map +1 -0
  92. package/lib/widgets/DateTime/AltDateWidget.d.ts +11 -0
  93. package/lib/widgets/DateTime/AltDateWidget.js +51 -0
  94. package/lib/widgets/DateTime/AltDateWidget.js.map +1 -0
  95. package/lib/widgets/DateTime/DateTimeInput.d.ts +5 -0
  96. package/lib/widgets/DateTime/DateTimeInput.js +39 -0
  97. package/lib/widgets/DateTime/DateTimeInput.js.map +1 -0
  98. package/lib/widgets/DateTime/DateTimeWidget.d.ts +6 -0
  99. package/lib/widgets/DateTime/DateTimeWidget.js +11 -0
  100. package/lib/widgets/DateTime/DateTimeWidget.js.map +1 -0
  101. package/lib/widgets/DateTime/DateWidget.d.ts +6 -0
  102. package/lib/widgets/DateTime/DateWidget.js +11 -0
  103. package/lib/widgets/DateTime/DateWidget.js.map +1 -0
  104. package/lib/widgets/DateTime/TimeWidget.d.ts +6 -0
  105. package/lib/widgets/DateTime/TimeWidget.js +27 -0
  106. package/lib/widgets/DateTime/TimeWidget.js.map +1 -0
  107. package/lib/widgets/DateTime/index.d.ts +5 -0
  108. package/lib/widgets/DateTime/index.js +6 -0
  109. package/lib/widgets/DateTime/index.js.map +1 -0
  110. package/lib/widgets/FileWidget.d.ts +7 -0
  111. package/lib/widgets/FileWidget.js +106 -0
  112. package/lib/widgets/FileWidget.js.map +1 -0
  113. package/lib/widgets/PasswordWidget.d.ts +7 -0
  114. package/lib/widgets/PasswordWidget.js +30 -0
  115. package/lib/widgets/PasswordWidget.js.map +1 -0
  116. package/lib/widgets/RadioWidget.d.ts +7 -0
  117. package/lib/widgets/RadioWidget.js +33 -0
  118. package/lib/widgets/RadioWidget.js.map +1 -0
  119. package/lib/widgets/RangeWidget.d.ts +7 -0
  120. package/lib/widgets/RangeWidget.js +34 -0
  121. package/lib/widgets/RangeWidget.js.map +1 -0
  122. package/lib/widgets/SelectWidget.d.ts +7 -0
  123. package/lib/widgets/SelectWidget.js +45 -0
  124. package/lib/widgets/SelectWidget.js.map +1 -0
  125. package/lib/widgets/TextareaWidget.d.ts +7 -0
  126. package/lib/widgets/TextareaWidget.js +30 -0
  127. package/lib/widgets/TextareaWidget.js.map +1 -0
  128. package/lib/widgets/index.d.ts +4 -0
  129. package/lib/widgets/index.js +34 -0
  130. package/lib/widgets/index.js.map +1 -0
  131. package/package.json +110 -0
  132. package/src/Form/index.ts +15 -0
  133. package/src/Theme/index.ts +18 -0
  134. package/src/index.ts +8 -0
  135. package/src/templates/ArrayFieldItemTemplate.tsx +40 -0
  136. package/src/templates/ArrayFieldTemplate.tsx +103 -0
  137. package/src/templates/ArrayFieldTitleTemplate.tsx +33 -0
  138. package/src/templates/BaseInputTemplate.tsx +134 -0
  139. package/src/templates/ButtonTemplates/AddButton.tsx +17 -0
  140. package/src/templates/ButtonTemplates/IconButton.tsx +87 -0
  141. package/src/templates/ButtonTemplates/SubmitButton.tsx +20 -0
  142. package/src/templates/ButtonTemplates/index.ts +21 -0
  143. package/src/templates/DescriptionField.tsx +24 -0
  144. package/src/templates/ErrorList.tsx +36 -0
  145. package/src/templates/FieldErrorTemplate.tsx +27 -0
  146. package/src/templates/FieldHelpTemplate.tsx +22 -0
  147. package/src/templates/FieldTemplate.tsx +66 -0
  148. package/src/templates/GridTemplate.tsx +30 -0
  149. package/src/templates/MultiSchemaFieldTemplate.tsx +15 -0
  150. package/src/templates/ObjectFieldTemplate.tsx +104 -0
  151. package/src/templates/TitleField.tsx +17 -0
  152. package/src/templates/WrapIfAdditionalTemplate.tsx +99 -0
  153. package/src/templates/icons.tsx +141 -0
  154. package/src/templates/index.ts +43 -0
  155. package/src/tsconfig.json +23 -0
  156. package/src/utils.ts +37 -0
  157. package/src/widgets/CheckboxWidget.tsx +110 -0
  158. package/src/widgets/CheckboxesWidget.tsx +112 -0
  159. package/src/widgets/ColorWidget.tsx +85 -0
  160. package/src/widgets/DateTime/AltDateTimeWidget.tsx +22 -0
  161. package/src/widgets/DateTime/AltDateWidget.tsx +139 -0
  162. package/src/widgets/DateTime/DateTimeInput.tsx +97 -0
  163. package/src/widgets/DateTime/DateTimeWidget.tsx +24 -0
  164. package/src/widgets/DateTime/DateWidget.tsx +22 -0
  165. package/src/widgets/DateTime/TimeWidget.tsx +83 -0
  166. package/src/widgets/DateTime/index.ts +5 -0
  167. package/src/widgets/FileWidget.tsx +176 -0
  168. package/src/widgets/PasswordWidget.tsx +88 -0
  169. package/src/widgets/RadioWidget.tsx +103 -0
  170. package/src/widgets/RangeWidget.tsx +95 -0
  171. package/src/widgets/SelectWidget.tsx +109 -0
  172. package/src/widgets/TextareaWidget.tsx +87 -0
  173. package/src/widgets/index.ts +42 -0
@@ -0,0 +1,1967 @@
1
+ // src/Form/index.ts
2
+ import { withTheme } from "@rjsf/core";
3
+
4
+ // src/templates/ArrayFieldItemTemplate.tsx
5
+ import {
6
+ getTemplate,
7
+ getUiOptions
8
+ } from "@rjsf/utils";
9
+ import { Box, Flex, Group } from "@mantine/core";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ function ArrayFieldItemTemplate(props) {
12
+ const { buttonsProps, className, hasToolbar, index, uiSchema, registry, children } = props;
13
+ const uiOptions = getUiOptions(uiSchema);
14
+ const ArrayFieldItemButtonsTemplate = getTemplate(
15
+ "ArrayFieldItemButtonsTemplate",
16
+ registry,
17
+ uiOptions
18
+ );
19
+ return /* @__PURE__ */ jsx(Box, { className: className || "rjsf-array-item", mb: "xs", children: /* @__PURE__ */ jsxs(Flex, { gap: "xs", align: "end", justify: "center", children: [
20
+ /* @__PURE__ */ jsx(Box, { w: "100%", children }),
21
+ hasToolbar && /* @__PURE__ */ jsx(Group, { wrap: "nowrap", gap: 2, mb: 7, children: /* @__PURE__ */ jsx(ArrayFieldItemButtonsTemplate, { ...buttonsProps }) })
22
+ ] }) }, `array-item-${index}`);
23
+ }
24
+
25
+ // src/templates/ArrayFieldTemplate.tsx
26
+ import {
27
+ getTemplate as getTemplate2,
28
+ getUiOptions as getUiOptions2,
29
+ buttonId
30
+ } from "@rjsf/utils";
31
+ import { Fieldset, Box as Box2, Group as Group2 } from "@mantine/core";
32
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
33
+ function ArrayFieldTemplate(props) {
34
+ const {
35
+ canAdd,
36
+ className,
37
+ disabled,
38
+ idSchema,
39
+ items,
40
+ onAddClick,
41
+ readonly,
42
+ required,
43
+ schema,
44
+ uiSchema,
45
+ title,
46
+ registry
47
+ } = props;
48
+ const uiOptions = getUiOptions2(uiSchema);
49
+ const ArrayFieldDescriptionTemplate = getTemplate2(
50
+ "ArrayFieldDescriptionTemplate",
51
+ registry,
52
+ uiOptions
53
+ );
54
+ const ArrayFieldItemTemplate2 = getTemplate2(
55
+ "ArrayFieldItemTemplate",
56
+ registry,
57
+ uiOptions
58
+ );
59
+ const ArrayFieldTitleTemplate2 = getTemplate2(
60
+ "ArrayFieldTitleTemplate",
61
+ registry,
62
+ uiOptions
63
+ );
64
+ const {
65
+ ButtonTemplates: { AddButton: AddButton2 }
66
+ } = registry.templates;
67
+ const legend = (uiOptions.title || title) && /* @__PURE__ */ jsx2(
68
+ ArrayFieldTitleTemplate2,
69
+ {
70
+ idSchema,
71
+ required,
72
+ title: uiOptions.title || title,
73
+ schema,
74
+ uiSchema,
75
+ registry
76
+ }
77
+ );
78
+ return /* @__PURE__ */ jsxs2(Fieldset, { legend, className, id: idSchema.$id, children: [
79
+ (uiOptions.description || schema.description) && /* @__PURE__ */ jsx2(
80
+ ArrayFieldDescriptionTemplate,
81
+ {
82
+ description: uiOptions.description || schema.description,
83
+ idSchema,
84
+ schema,
85
+ uiSchema,
86
+ registry
87
+ }
88
+ ),
89
+ /* @__PURE__ */ jsx2(Box2, { className: "row rjsf-array-item-list", children: items && items.map(({ key, ...itemProps }) => /* @__PURE__ */ jsx2(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
90
+ canAdd && /* @__PURE__ */ jsx2(Group2, { justify: "flex-end", children: /* @__PURE__ */ jsx2(
91
+ AddButton2,
92
+ {
93
+ id: buttonId(idSchema, "add"),
94
+ className: "rjsf-array-item-add",
95
+ disabled: disabled || readonly,
96
+ onClick: onAddClick,
97
+ uiSchema,
98
+ registry,
99
+ iconType: "md"
100
+ }
101
+ ) })
102
+ ] });
103
+ }
104
+
105
+ // src/templates/ArrayFieldTitleTemplate.tsx
106
+ import {
107
+ getUiOptions as getUiOptions3,
108
+ titleId
109
+ } from "@rjsf/utils";
110
+ import { Title } from "@mantine/core";
111
+ import { jsx as jsx3 } from "react/jsx-runtime";
112
+ function ArrayFieldTitleTemplate(props) {
113
+ const { idSchema, title, uiSchema, registry } = props;
114
+ const options = getUiOptions3(uiSchema, registry.globalUiOptions);
115
+ const { label: displayLabel = true } = options;
116
+ if (!title || !displayLabel) {
117
+ return null;
118
+ }
119
+ return /* @__PURE__ */ jsx3(Title, { id: titleId(idSchema), order: 4, fw: "normal", children: title });
120
+ }
121
+
122
+ // src/templates/BaseInputTemplate.tsx
123
+ import { useCallback } from "react";
124
+ import {
125
+ ariaDescribedByIds,
126
+ examplesId,
127
+ getInputProps,
128
+ labelValue
129
+ } from "@rjsf/utils";
130
+ import { TextInput, NumberInput } from "@mantine/core";
131
+
132
+ // src/utils.ts
133
+ var uiOptionsKeys = [
134
+ "emptyValue",
135
+ "classNames",
136
+ "title",
137
+ "help",
138
+ "autocomplete",
139
+ "disabled",
140
+ "enumDisabled",
141
+ "hideError",
142
+ "readonly",
143
+ "order",
144
+ "filePreview",
145
+ "inline",
146
+ "inputType",
147
+ "submitButtonOptions",
148
+ "widget",
149
+ "enumNames",
150
+ "addable",
151
+ "copyable",
152
+ "orderable",
153
+ "removable",
154
+ "duplicateKeySuffixSeparator",
155
+ "enumOptions",
156
+ "enableMarkdownInDescription"
157
+ ];
158
+ function cleanupOptions(options) {
159
+ const result = {};
160
+ for (const key in options) {
161
+ if (!uiOptionsKeys.includes(key)) {
162
+ result[key] = options[key];
163
+ }
164
+ }
165
+ return result;
166
+ }
167
+
168
+ // src/templates/BaseInputTemplate.tsx
169
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
170
+ function BaseInputTemplate(props) {
171
+ const {
172
+ id,
173
+ type,
174
+ schema,
175
+ value,
176
+ placeholder,
177
+ required,
178
+ disabled,
179
+ readonly,
180
+ autofocus,
181
+ label,
182
+ hideLabel,
183
+ onChange,
184
+ onChangeOverride,
185
+ onBlur,
186
+ onFocus,
187
+ options,
188
+ rawErrors,
189
+ children
190
+ } = props;
191
+ const inputProps = getInputProps(schema, type, options, false);
192
+ const themeProps = cleanupOptions(options);
193
+ const handleNumberChange = useCallback((value2) => onChange(value2), [onChange]);
194
+ const handleChange = useCallback(
195
+ (e) => {
196
+ const handler = onChangeOverride ? onChangeOverride : onChange;
197
+ const value2 = e.target.value === "" ? options.emptyValue ?? "" : e.target.value;
198
+ handler(value2);
199
+ },
200
+ [onChange, onChangeOverride, options]
201
+ );
202
+ const handleBlur = useCallback(
203
+ (e) => {
204
+ onBlur(id, e.target && e.target.value);
205
+ },
206
+ [onBlur, id]
207
+ );
208
+ const handleFocus = useCallback(
209
+ (e) => {
210
+ onFocus(id, e.target && e.target.value);
211
+ },
212
+ [onFocus, id]
213
+ );
214
+ const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ jsx4(
215
+ NumberInput,
216
+ {
217
+ id,
218
+ name: id,
219
+ label: labelValue(label || void 0, hideLabel, false),
220
+ required,
221
+ autoFocus: autofocus,
222
+ disabled: disabled || readonly,
223
+ onBlur: !readonly ? handleBlur : void 0,
224
+ onChange: !readonly ? handleNumberChange : void 0,
225
+ onFocus: !readonly ? handleFocus : void 0,
226
+ placeholder,
227
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
228
+ list: schema.examples ? examplesId(id) : void 0,
229
+ ...inputProps,
230
+ ...themeProps,
231
+ step: typeof inputProps.step === "number" ? inputProps.step : 1,
232
+ type: "text",
233
+ value,
234
+ "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
235
+ }
236
+ ) : /* @__PURE__ */ jsx4(
237
+ TextInput,
238
+ {
239
+ id,
240
+ name: id,
241
+ label: labelValue(label || void 0, hideLabel, false),
242
+ required,
243
+ autoFocus: autofocus,
244
+ disabled: disabled || readonly,
245
+ onBlur: !readonly ? handleBlur : void 0,
246
+ onChange: !readonly ? handleChange : void 0,
247
+ onFocus: !readonly ? handleFocus : void 0,
248
+ placeholder,
249
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
250
+ list: schema.examples ? examplesId(id) : void 0,
251
+ ...inputProps,
252
+ ...themeProps,
253
+ value,
254
+ "aria-describedby": ariaDescribedByIds(id, !!schema.examples)
255
+ }
256
+ );
257
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
258
+ input,
259
+ children,
260
+ Array.isArray(schema.examples) && /* @__PURE__ */ jsx4("datalist", { id: examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
261
+ return /* @__PURE__ */ jsx4("option", { value: example }, example);
262
+ }) })
263
+ ] });
264
+ }
265
+
266
+ // src/templates/DescriptionField.tsx
267
+ import { RichDescription } from "@rjsf/core";
268
+ import { Text } from "@mantine/core";
269
+ import { jsx as jsx5 } from "react/jsx-runtime";
270
+ function DescriptionField(props) {
271
+ const { id, description, registry, uiSchema } = props;
272
+ if (description) {
273
+ return /* @__PURE__ */ jsx5(Text, { id, mt: 3, mb: "sm", children: /* @__PURE__ */ jsx5(RichDescription, { description, registry, uiSchema }) });
274
+ }
275
+ return null;
276
+ }
277
+
278
+ // src/templates/ErrorList.tsx
279
+ import { TranslatableString } from "@rjsf/utils";
280
+ import { Alert, Title as Title2, List } from "@mantine/core";
281
+
282
+ // src/templates/icons.tsx
283
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
284
+ function Plus({ size, style, ...others }) {
285
+ return /* @__PURE__ */ jsxs4(
286
+ "svg",
287
+ {
288
+ xmlns: "http://www.w3.org/2000/svg",
289
+ width: "24",
290
+ height: "24",
291
+ viewBox: "0 0 24 24",
292
+ fill: "none",
293
+ stroke: "currentColor",
294
+ strokeWidth: "2",
295
+ strokeLinecap: "round",
296
+ strokeLinejoin: "round",
297
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-plus",
298
+ style: { width: size, height: size, ...style },
299
+ ...others,
300
+ children: [
301
+ /* @__PURE__ */ jsx6("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
302
+ /* @__PURE__ */ jsx6("path", { d: "M12 5l0 14" }),
303
+ /* @__PURE__ */ jsx6("path", { d: "M5 12l14 0" })
304
+ ]
305
+ }
306
+ );
307
+ }
308
+ function Copy({ size, style, ...others }) {
309
+ return /* @__PURE__ */ jsxs4(
310
+ "svg",
311
+ {
312
+ xmlns: "http://www.w3.org/2000/svg",
313
+ width: "24",
314
+ height: "24",
315
+ viewBox: "0 0 24 24",
316
+ fill: "none",
317
+ stroke: "currentColor",
318
+ strokeWidth: "2",
319
+ strokeLinecap: "round",
320
+ strokeLinejoin: "round",
321
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-copy",
322
+ style: { width: size, height: size, ...style },
323
+ ...others,
324
+ children: [
325
+ /* @__PURE__ */ jsx6("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
326
+ /* @__PURE__ */ jsx6("path", { d: "M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" }),
327
+ /* @__PURE__ */ jsx6("path", { d: "M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" })
328
+ ]
329
+ }
330
+ );
331
+ }
332
+ function ChevronDown({ size, style, ...others }) {
333
+ return /* @__PURE__ */ jsxs4(
334
+ "svg",
335
+ {
336
+ xmlns: "http://www.w3.org/2000/svg",
337
+ width: "24",
338
+ height: "24",
339
+ viewBox: "0 0 24 24",
340
+ fill: "none",
341
+ stroke: "currentColor",
342
+ strokeWidth: "2",
343
+ strokeLinecap: "round",
344
+ strokeLinejoin: "round",
345
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-down",
346
+ style: { width: size, height: size, ...style },
347
+ ...others,
348
+ children: [
349
+ /* @__PURE__ */ jsx6("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
350
+ /* @__PURE__ */ jsx6("path", { d: "M6 9l6 6l6 -6" })
351
+ ]
352
+ }
353
+ );
354
+ }
355
+ function ChevronUp({ size, style, ...others }) {
356
+ return /* @__PURE__ */ jsxs4(
357
+ "svg",
358
+ {
359
+ xmlns: "http://www.w3.org/2000/svg",
360
+ width: "24",
361
+ height: "24",
362
+ viewBox: "0 0 24 24",
363
+ fill: "none",
364
+ stroke: "currentColor",
365
+ strokeWidth: "2",
366
+ strokeLinecap: "round",
367
+ strokeLinejoin: "round",
368
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-chevron-up",
369
+ style: { width: size, height: size, ...style },
370
+ ...others,
371
+ children: [
372
+ /* @__PURE__ */ jsx6("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
373
+ /* @__PURE__ */ jsx6("path", { d: "M6 15l6 -6l6 6" })
374
+ ]
375
+ }
376
+ );
377
+ }
378
+ function X({ size, style, ...others }) {
379
+ return /* @__PURE__ */ jsxs4(
380
+ "svg",
381
+ {
382
+ xmlns: "http://www.w3.org/2000/svg",
383
+ width: "24",
384
+ height: "24",
385
+ viewBox: "0 0 24 24",
386
+ fill: "none",
387
+ stroke: "currentColor",
388
+ strokeWidth: "2",
389
+ strokeLinecap: "round",
390
+ strokeLinejoin: "round",
391
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-x",
392
+ style: { width: size, height: size, ...style },
393
+ ...others,
394
+ children: [
395
+ /* @__PURE__ */ jsx6("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
396
+ /* @__PURE__ */ jsx6("path", { d: "M18 6l-12 12" }),
397
+ /* @__PURE__ */ jsx6("path", { d: "M6 6l12 12" })
398
+ ]
399
+ }
400
+ );
401
+ }
402
+ function ExclamationCircle({ size, style, ...others }) {
403
+ return /* @__PURE__ */ jsxs4(
404
+ "svg",
405
+ {
406
+ xmlns: "http://www.w3.org/2000/svg",
407
+ width: "24",
408
+ height: "24",
409
+ viewBox: "0 0 24 24",
410
+ fill: "none",
411
+ stroke: "currentColor",
412
+ strokeWidth: "2",
413
+ strokeLinecap: "round",
414
+ strokeLinejoin: "round",
415
+ className: "icon icon-tabler icons-tabler-outline icon-tabler-exclamation-circle",
416
+ style: { width: size, height: size, ...style },
417
+ ...others,
418
+ children: [
419
+ /* @__PURE__ */ jsx6("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
420
+ /* @__PURE__ */ jsx6("path", { d: "M12 9v4" }),
421
+ /* @__PURE__ */ jsx6("path", { d: "M12 16v.01" })
422
+ ]
423
+ }
424
+ );
425
+ }
426
+
427
+ // src/templates/ErrorList.tsx
428
+ import { jsx as jsx7 } from "react/jsx-runtime";
429
+ function ErrorList({
430
+ errors,
431
+ registry
432
+ }) {
433
+ const { translateString } = registry;
434
+ return /* @__PURE__ */ jsx7(
435
+ Alert,
436
+ {
437
+ color: "red",
438
+ variant: "transparent",
439
+ title: /* @__PURE__ */ jsx7(Title2, { order: 5, fw: "normal", children: translateString(TranslatableString.ErrorsLabel) }),
440
+ icon: /* @__PURE__ */ jsx7(ExclamationCircle, {}),
441
+ children: /* @__PURE__ */ jsx7(List, { children: errors.map((error, index) => /* @__PURE__ */ jsx7(List.Item, { c: "red", children: error.stack }, `error-${index}`)) })
442
+ }
443
+ );
444
+ }
445
+
446
+ // src/templates/ButtonTemplates/SubmitButton.tsx
447
+ import { Button } from "@mantine/core";
448
+ import { getSubmitButtonOptions } from "@rjsf/utils";
449
+ import { jsx as jsx8 } from "react/jsx-runtime";
450
+ function SubmitButton({ uiSchema }) {
451
+ const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
452
+ if (norender) {
453
+ return null;
454
+ }
455
+ return /* @__PURE__ */ jsx8(Button, { type: "submit", variant: "filled", ...submitButtonProps, children: submitText });
456
+ }
457
+
458
+ // src/templates/ButtonTemplates/AddButton.tsx
459
+ import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
460
+
461
+ // src/templates/ButtonTemplates/IconButton.tsx
462
+ import { ActionIcon } from "@mantine/core";
463
+ import { TranslatableString as TranslatableString2 } from "@rjsf/utils";
464
+ import { jsx as jsx9 } from "react/jsx-runtime";
465
+ function IconButton(props) {
466
+ const { icon, iconType = "sm", color, onClick, uiSchema, registry, ...otherProps } = props;
467
+ return /* @__PURE__ */ jsx9(
468
+ ActionIcon,
469
+ {
470
+ size: iconType,
471
+ color,
472
+ onClick,
473
+ ...otherProps,
474
+ children: icon
475
+ }
476
+ );
477
+ }
478
+ function CopyButton(props) {
479
+ const {
480
+ registry: { translateString }
481
+ } = props;
482
+ return /* @__PURE__ */ jsx9(IconButton, { title: translateString(TranslatableString2.CopyButton), variant: "subtle", ...props, icon: /* @__PURE__ */ jsx9(Copy, {}) });
483
+ }
484
+ function MoveDownButton(props) {
485
+ const {
486
+ registry: { translateString }
487
+ } = props;
488
+ return /* @__PURE__ */ jsx9(
489
+ IconButton,
490
+ {
491
+ title: translateString(TranslatableString2.MoveDownButton),
492
+ variant: "subtle",
493
+ ...props,
494
+ icon: /* @__PURE__ */ jsx9(ChevronDown, {})
495
+ }
496
+ );
497
+ }
498
+ function MoveUpButton(props) {
499
+ const {
500
+ registry: { translateString }
501
+ } = props;
502
+ return /* @__PURE__ */ jsx9(
503
+ IconButton,
504
+ {
505
+ title: translateString(TranslatableString2.MoveUpButton),
506
+ variant: "subtle",
507
+ ...props,
508
+ icon: /* @__PURE__ */ jsx9(ChevronUp, {})
509
+ }
510
+ );
511
+ }
512
+ function RemoveButton(props) {
513
+ const {
514
+ registry: { translateString }
515
+ } = props;
516
+ return /* @__PURE__ */ jsx9(
517
+ IconButton,
518
+ {
519
+ title: translateString(TranslatableString2.RemoveButton),
520
+ variant: "subtle",
521
+ color: "red",
522
+ ...props,
523
+ icon: /* @__PURE__ */ jsx9(X, {})
524
+ }
525
+ );
526
+ }
527
+
528
+ // src/templates/ButtonTemplates/AddButton.tsx
529
+ import { jsx as jsx10 } from "react/jsx-runtime";
530
+ function AddButton(props) {
531
+ const {
532
+ registry: { translateString }
533
+ } = props;
534
+ return /* @__PURE__ */ jsx10(IconButton, { title: translateString(TranslatableString3.AddItemButton), variant: "subtle", ...props, icon: /* @__PURE__ */ jsx10(Plus, {}) });
535
+ }
536
+
537
+ // src/templates/ButtonTemplates/index.ts
538
+ function buttonTemplates() {
539
+ return {
540
+ SubmitButton,
541
+ AddButton,
542
+ CopyButton,
543
+ MoveDownButton,
544
+ MoveUpButton,
545
+ RemoveButton
546
+ };
547
+ }
548
+ var ButtonTemplates_default = buttonTemplates;
549
+
550
+ // src/templates/FieldErrorTemplate.tsx
551
+ import { errorId } from "@rjsf/utils";
552
+ import { Box as Box3, List as List2 } from "@mantine/core";
553
+ import { jsx as jsx11 } from "react/jsx-runtime";
554
+ function FieldErrorTemplate({ errors, idSchema }) {
555
+ if (!errors || !errors.length) {
556
+ return null;
557
+ }
558
+ const id = errorId(idSchema);
559
+ return /* @__PURE__ */ jsx11(Box3, { id, c: "red", display: "none", children: /* @__PURE__ */ jsx11(List2, { children: errors.map((error, index) => /* @__PURE__ */ jsx11(List2.Item, { children: error }, `field-error-${index}`)) }) });
560
+ }
561
+
562
+ // src/templates/FieldTemplate.tsx
563
+ import { Box as Box4 } from "@mantine/core";
564
+ import {
565
+ getTemplate as getTemplate3,
566
+ getUiOptions as getUiOptions4
567
+ } from "@rjsf/utils";
568
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
569
+ function FieldTemplate(props) {
570
+ const {
571
+ id,
572
+ classNames,
573
+ style,
574
+ label,
575
+ errors,
576
+ help,
577
+ displayLabel,
578
+ description,
579
+ rawDescription,
580
+ hidden,
581
+ schema,
582
+ uiSchema,
583
+ registry,
584
+ children,
585
+ ...otherProps
586
+ } = props;
587
+ const uiOptions = getUiOptions4(uiSchema);
588
+ const WrapIfAdditionalTemplate2 = getTemplate3(
589
+ "WrapIfAdditionalTemplate",
590
+ registry,
591
+ uiOptions
592
+ );
593
+ if (hidden) {
594
+ return /* @__PURE__ */ jsx12(Box4, { display: "none", children });
595
+ }
596
+ return /* @__PURE__ */ jsxs5(
597
+ WrapIfAdditionalTemplate2,
598
+ {
599
+ id,
600
+ classNames,
601
+ style,
602
+ label,
603
+ schema,
604
+ uiSchema,
605
+ registry,
606
+ ...otherProps,
607
+ children: [
608
+ children,
609
+ errors,
610
+ help
611
+ ]
612
+ }
613
+ );
614
+ }
615
+
616
+ // src/templates/FieldHelpTemplate.tsx
617
+ import { helpId } from "@rjsf/utils";
618
+ import { Text as Text2 } from "@mantine/core";
619
+ import { jsx as jsx13 } from "react/jsx-runtime";
620
+ function FieldHelpTemplate(props) {
621
+ const { idSchema, help } = props;
622
+ const id = helpId(idSchema);
623
+ return !help ? null : /* @__PURE__ */ jsx13(Text2, { id, size: "sm", my: "xs", c: "dimmed", children: help });
624
+ }
625
+
626
+ // src/templates/GridTemplate.tsx
627
+ import { Container, Grid } from "@mantine/core";
628
+ import { jsx as jsx14 } from "react/jsx-runtime";
629
+ function GridTemplate(props) {
630
+ const { children, column, fluid = true, ...rest } = props;
631
+ if (column) {
632
+ return /* @__PURE__ */ jsx14(Grid.Col, { ...rest, children });
633
+ }
634
+ if (fluid) {
635
+ return /* @__PURE__ */ jsx14(Container, { p: "4", mx: 0, w: "100%", children: /* @__PURE__ */ jsx14(Grid, { ...rest, children }) });
636
+ }
637
+ return /* @__PURE__ */ jsx14(Grid, { grow: true, ...rest, children });
638
+ }
639
+
640
+ // src/templates/ObjectFieldTemplate.tsx
641
+ import { Box as Box5, Container as Container2, Group as Group3, SimpleGrid } from "@mantine/core";
642
+ import {
643
+ buttonId as buttonId2,
644
+ canExpand,
645
+ descriptionId,
646
+ getTemplate as getTemplate4,
647
+ getUiOptions as getUiOptions5,
648
+ titleId as titleId2
649
+ } from "@rjsf/utils";
650
+ import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
651
+ function ObjectFieldTemplate(props) {
652
+ const {
653
+ title,
654
+ description,
655
+ disabled,
656
+ properties,
657
+ onAddClick,
658
+ readonly,
659
+ required,
660
+ schema,
661
+ uiSchema,
662
+ idSchema,
663
+ formData,
664
+ registry
665
+ } = props;
666
+ const uiOptions = getUiOptions5(uiSchema);
667
+ const TitleFieldTemplate = getTemplate4("TitleFieldTemplate", registry, uiOptions);
668
+ const DescriptionFieldTemplate = getTemplate4(
669
+ "DescriptionFieldTemplate",
670
+ registry,
671
+ uiOptions
672
+ );
673
+ const {
674
+ ButtonTemplates: { AddButton: AddButton2 }
675
+ } = registry.templates;
676
+ const gridCols = typeof uiOptions?.gridCols === "number" && uiOptions?.gridCols || void 0;
677
+ const gridSpacing = uiOptions?.gridSpacing;
678
+ const gridVerticalSpacing = uiOptions?.gridVerticalSpacing;
679
+ return /* @__PURE__ */ jsxs6(Container2, { id: idSchema.$id, p: 0, children: [
680
+ title && /* @__PURE__ */ jsx15(
681
+ TitleFieldTemplate,
682
+ {
683
+ id: titleId2(idSchema),
684
+ title,
685
+ required,
686
+ schema,
687
+ uiSchema,
688
+ registry
689
+ }
690
+ ),
691
+ description && /* @__PURE__ */ jsx15(
692
+ DescriptionFieldTemplate,
693
+ {
694
+ id: descriptionId(idSchema),
695
+ description,
696
+ schema,
697
+ uiSchema,
698
+ registry
699
+ }
700
+ ),
701
+ /* @__PURE__ */ jsx15(
702
+ SimpleGrid,
703
+ {
704
+ cols: gridCols,
705
+ spacing: gridSpacing,
706
+ verticalSpacing: gridVerticalSpacing,
707
+ mb: "sm",
708
+ children: properties.filter((e) => !e.hidden).map((element) => /* @__PURE__ */ jsx15(Box5, { children: element.content }, element.name))
709
+ }
710
+ ),
711
+ canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx15(Group3, { mt: "xs", justify: "flex-end", children: /* @__PURE__ */ jsx15(
712
+ AddButton2,
713
+ {
714
+ id: buttonId2(idSchema, "add"),
715
+ disabled: disabled || readonly,
716
+ onClick: onAddClick(schema),
717
+ className: "rjsf-object-property-expand",
718
+ uiSchema,
719
+ registry
720
+ }
721
+ ) })
722
+ ] });
723
+ }
724
+
725
+ // src/templates/TitleField.tsx
726
+ import { Title as Title3 } from "@mantine/core";
727
+ import { jsx as jsx16 } from "react/jsx-runtime";
728
+ function TitleField(props) {
729
+ const { id, title } = props;
730
+ return title ? /* @__PURE__ */ jsx16(Title3, { id, order: 3, fw: "normal", children: title }) : null;
731
+ }
732
+
733
+ // src/templates/WrapIfAdditionalTemplate.tsx
734
+ import { useCallback as useCallback2 } from "react";
735
+ import {
736
+ ADDITIONAL_PROPERTY_FLAG,
737
+ UI_OPTIONS_KEY,
738
+ buttonId as buttonId3,
739
+ TranslatableString as TranslatableString4
740
+ } from "@rjsf/utils";
741
+ import { Flex as Flex2, Grid as Grid2, TextInput as TextInput2 } from "@mantine/core";
742
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
743
+ function WrapIfAdditionalTemplate(props) {
744
+ const {
745
+ id,
746
+ classNames,
747
+ style,
748
+ label,
749
+ required,
750
+ readonly,
751
+ disabled,
752
+ schema,
753
+ uiSchema,
754
+ onKeyChange,
755
+ onDropPropertyClick,
756
+ registry,
757
+ children
758
+ } = props;
759
+ const { templates, translateString } = registry;
760
+ const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
761
+ const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
762
+ const additional = ADDITIONAL_PROPERTY_FLAG in schema;
763
+ const handleBlur = useCallback2(
764
+ ({ target }) => onKeyChange(target && target.value),
765
+ [onKeyChange]
766
+ );
767
+ if (!additional) {
768
+ return /* @__PURE__ */ jsx17("div", { className: classNames, style, children });
769
+ }
770
+ const uiOptions = uiSchema ? uiSchema[UI_OPTIONS_KEY] : {};
771
+ const buttonUiOptions = {
772
+ ...uiSchema,
773
+ [UI_OPTIONS_KEY]: { ...uiOptions, block: true }
774
+ };
775
+ return /* @__PURE__ */ jsx17("div", { className: classNames, style, children: /* @__PURE__ */ jsxs7(Flex2, { gap: "xs", align: "end", justify: "center", children: [
776
+ /* @__PURE__ */ jsxs7(Grid2, { w: "100%", align: "center", children: [
777
+ /* @__PURE__ */ jsx17(Grid2.Col, { span: 6, className: "form-additional", children: /* @__PURE__ */ jsx17("div", { className: "form-group", children: /* @__PURE__ */ jsx17(
778
+ TextInput2,
779
+ {
780
+ className: "form-group",
781
+ label: keyLabel,
782
+ defaultValue: label,
783
+ required,
784
+ disabled: disabled || readonly,
785
+ id: `${id}-key`,
786
+ name: `${id}-key`,
787
+ onBlur: !readonly ? handleBlur : void 0
788
+ }
789
+ ) }) }),
790
+ /* @__PURE__ */ jsx17(Grid2.Col, { span: 6, className: "form-additional", children })
791
+ ] }),
792
+ /* @__PURE__ */ jsx17(
793
+ RemoveButton2,
794
+ {
795
+ id: buttonId3(id, "remove"),
796
+ iconType: "sm",
797
+ className: "rjsf-array-item-remove",
798
+ disabled: disabled || readonly,
799
+ onClick: onDropPropertyClick(label),
800
+ uiSchema: buttonUiOptions,
801
+ registry
802
+ }
803
+ )
804
+ ] }) });
805
+ }
806
+
807
+ // src/templates/MultiSchemaFieldTemplate.tsx
808
+ import { Stack } from "@mantine/core";
809
+ import { jsxs as jsxs8 } from "react/jsx-runtime";
810
+ function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
811
+ return /* @__PURE__ */ jsxs8(Stack, { style: { marginBottom: "1rem" }, children: [
812
+ selector,
813
+ optionSchemaField
814
+ ] });
815
+ }
816
+
817
+ // src/templates/index.ts
818
+ function generateTemplates() {
819
+ return {
820
+ ArrayFieldItemTemplate,
821
+ ArrayFieldTemplate,
822
+ ArrayFieldTitleTemplate,
823
+ BaseInputTemplate,
824
+ ButtonTemplates: ButtonTemplates_default(),
825
+ DescriptionFieldTemplate: DescriptionField,
826
+ ErrorListTemplate: ErrorList,
827
+ FieldErrorTemplate,
828
+ FieldTemplate,
829
+ FieldHelpTemplate,
830
+ GridTemplate,
831
+ ObjectFieldTemplate,
832
+ TitleFieldTemplate: TitleField,
833
+ WrapIfAdditionalTemplate,
834
+ MultiSchemaFieldTemplate
835
+ };
836
+ }
837
+ var templates_default = generateTemplates();
838
+
839
+ // src/widgets/index.ts
840
+ import dayjs2 from "dayjs";
841
+ import customParseFormat from "dayjs/plugin/customParseFormat";
842
+
843
+ // src/widgets/DateTime/AltDateWidget.tsx
844
+ import { useCallback as useCallback3, useEffect, useState } from "react";
845
+ import {
846
+ ariaDescribedByIds as ariaDescribedByIds2,
847
+ dateRangeOptions,
848
+ parseDateString,
849
+ toDateString,
850
+ getDateElementProps,
851
+ titleId as titleId3,
852
+ TranslatableString as TranslatableString5
853
+ } from "@rjsf/utils";
854
+ import { Flex as Flex3, Box as Box6, Group as Group4, Button as Button2, Select, Input } from "@mantine/core";
855
+ import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
856
+ function readyForChange(state) {
857
+ return Object.values(state).every((value) => value !== -1);
858
+ }
859
+ function AltDateWidget(props) {
860
+ const {
861
+ id,
862
+ value,
863
+ required,
864
+ disabled,
865
+ readonly,
866
+ label,
867
+ hideLabel,
868
+ rawErrors,
869
+ options,
870
+ onChange,
871
+ showTime = false,
872
+ registry
873
+ } = props;
874
+ const { translateString } = registry;
875
+ const [state, setState] = useState(parseDateString(value, showTime));
876
+ useEffect(() => {
877
+ setState(parseDateString(value, showTime));
878
+ }, [showTime, value]);
879
+ const handleChange = useCallback3(
880
+ (property, nextValue) => {
881
+ const nextState = {
882
+ ...state,
883
+ [property]: typeof nextValue === "undefined" ? -1 : nextValue
884
+ };
885
+ if (readyForChange(nextState)) {
886
+ onChange(toDateString(nextState, showTime));
887
+ } else {
888
+ setState(nextState);
889
+ }
890
+ },
891
+ [state, onChange, showTime]
892
+ );
893
+ const handleSetNow = useCallback3(() => {
894
+ if (!disabled && !readonly) {
895
+ const nextState = parseDateString((/* @__PURE__ */ new Date()).toJSON(), showTime);
896
+ onChange(toDateString(nextState, showTime));
897
+ }
898
+ }, [disabled, readonly, showTime, onChange]);
899
+ const handleClear = useCallback3(() => {
900
+ if (!disabled && !readonly) {
901
+ onChange("");
902
+ }
903
+ }, [disabled, readonly, onChange]);
904
+ return /* @__PURE__ */ jsxs9(Fragment2, { children: [
905
+ !hideLabel && !!label && /* @__PURE__ */ jsx18(Input.Label, { id: titleId3(id), required, children: label }),
906
+ /* @__PURE__ */ jsxs9(Flex3, { gap: "xs", align: "center", wrap: "nowrap", children: [
907
+ getDateElementProps(
908
+ state,
909
+ showTime,
910
+ options.yearsRange,
911
+ options.format
912
+ ).map((elemProps, i) => {
913
+ const elemId = id + "_" + elemProps.type;
914
+ return /* @__PURE__ */ jsx18(Box6, { children: /* @__PURE__ */ jsx18(
915
+ Select,
916
+ {
917
+ id: elemId,
918
+ name: elemId,
919
+ placeholder: elemProps.type,
920
+ disabled: disabled || readonly,
921
+ data: dateRangeOptions(elemProps.range[0], elemProps.range[1]).map((item) => item.value.toString()),
922
+ value: !elemProps.value || elemProps.value < 0 ? null : elemProps.value.toString(),
923
+ onChange: (v) => handleChange(elemProps.type, v),
924
+ searchable: false,
925
+ allowDeselect: false,
926
+ comboboxProps: { withinPortal: false },
927
+ "aria-describedby": ariaDescribedByIds2(elemId)
928
+ }
929
+ ) }, i);
930
+ }),
931
+ /* @__PURE__ */ jsxs9(Group4, { wrap: "nowrap", gap: 3, children: [
932
+ (options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ jsx18(Button2, { variant: "subtle", size: "xs", onClick: handleSetNow, children: translateString(TranslatableString5.NowLabel) }),
933
+ (options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ jsx18(Button2, { variant: "subtle", size: "xs", onClick: handleClear, children: translateString(TranslatableString5.ClearLabel) })
934
+ ] })
935
+ ] }),
936
+ rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ jsx18(Input.Error, { children: error }, `alt-date-widget-input-errors-${index}`))
937
+ ] });
938
+ }
939
+ AltDateWidget.defaultProps = {
940
+ showTime: false
941
+ };
942
+
943
+ // src/widgets/DateTime/AltDateTimeWidget.tsx
944
+ import { jsx as jsx19 } from "react/jsx-runtime";
945
+ function AltDateTimeWidget(props) {
946
+ const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
947
+ return /* @__PURE__ */ jsx19(AltDateWidget2, { showTime: true, ...props });
948
+ }
949
+ AltDateTimeWidget.defaultProps = {
950
+ ...AltDateWidget?.defaultProps,
951
+ showTime: true
952
+ };
953
+
954
+ // src/widgets/DateTime/DateTimeInput.tsx
955
+ import { useCallback as useCallback4 } from "react";
956
+ import {
957
+ ariaDescribedByIds as ariaDescribedByIds3,
958
+ labelValue as labelValue2
959
+ } from "@rjsf/utils";
960
+ import dayjs from "dayjs";
961
+ import { DateInput } from "@mantine/dates";
962
+ import { jsx as jsx20 } from "react/jsx-runtime";
963
+ var dateParser = (input, format) => {
964
+ if (!input) {
965
+ return null;
966
+ }
967
+ const d = dayjs(input, format);
968
+ return d.isValid() ? d.toDate() : null;
969
+ };
970
+ var dateFormat = (date, format) => {
971
+ if (!date) {
972
+ return "";
973
+ }
974
+ return dayjs(date).format(format || "YYYY-MM-DD");
975
+ };
976
+ function DateTimeInput(props) {
977
+ const {
978
+ id,
979
+ name,
980
+ value,
981
+ placeholder,
982
+ required,
983
+ disabled,
984
+ readonly,
985
+ autofocus,
986
+ label,
987
+ hideLabel,
988
+ rawErrors,
989
+ options,
990
+ onChange,
991
+ onBlur,
992
+ onFocus,
993
+ valueFormat,
994
+ displayFormat
995
+ } = props;
996
+ const handleChange = useCallback4(
997
+ (nextValue) => {
998
+ onChange(dateFormat(nextValue, valueFormat));
999
+ },
1000
+ [onChange, valueFormat]
1001
+ );
1002
+ const handleBlur = useCallback4(() => {
1003
+ if (onBlur) {
1004
+ onBlur(id, value);
1005
+ }
1006
+ }, [onBlur, id, value]);
1007
+ const handleFocus = useCallback4(() => {
1008
+ if (onFocus) {
1009
+ onFocus(id, value);
1010
+ }
1011
+ }, [onFocus, id, value]);
1012
+ return /* @__PURE__ */ jsx20(
1013
+ DateInput,
1014
+ {
1015
+ id,
1016
+ name,
1017
+ value: dateParser(value, valueFormat),
1018
+ dateParser: (v) => dateParser(v, displayFormat),
1019
+ placeholder: placeholder || void 0,
1020
+ required,
1021
+ disabled: disabled || readonly,
1022
+ autoFocus: autofocus,
1023
+ label: labelValue2(label || void 0, hideLabel, false),
1024
+ onChange: handleChange,
1025
+ onBlur: handleBlur,
1026
+ onFocus: handleFocus,
1027
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1028
+ ...options,
1029
+ "aria-describedby": ariaDescribedByIds3(id),
1030
+ popoverProps: { withinPortal: false },
1031
+ classNames: typeof options?.classNames === "object" ? options.classNames : void 0,
1032
+ valueFormat: displayFormat
1033
+ }
1034
+ );
1035
+ }
1036
+
1037
+ // src/widgets/DateTime/DateWidget.tsx
1038
+ import { jsx as jsx21 } from "react/jsx-runtime";
1039
+ function DateWidget(props) {
1040
+ const { valueFormat = "YYYY-MM-DD", displayFormat, ...otherOptions } = props.options;
1041
+ return /* @__PURE__ */ jsx21(
1042
+ DateTimeInput,
1043
+ {
1044
+ ...props,
1045
+ options: otherOptions,
1046
+ valueFormat,
1047
+ displayFormat: displayFormat || valueFormat
1048
+ }
1049
+ );
1050
+ }
1051
+
1052
+ // src/widgets/DateTime/DateTimeWidget.tsx
1053
+ import { jsx as jsx22 } from "react/jsx-runtime";
1054
+ function DateTimeWidget(props) {
1055
+ const { valueFormat = "YYYY-MM-DD HH:mm:ss", displayFormat, ...otherOptions } = props.options;
1056
+ return /* @__PURE__ */ jsx22(
1057
+ DateTimeInput,
1058
+ {
1059
+ ...props,
1060
+ options: otherOptions,
1061
+ valueFormat,
1062
+ displayFormat: displayFormat || valueFormat
1063
+ }
1064
+ );
1065
+ }
1066
+
1067
+ // src/widgets/DateTime/TimeWidget.tsx
1068
+ import { useCallback as useCallback5 } from "react";
1069
+ import {
1070
+ labelValue as labelValue3,
1071
+ ariaDescribedByIds as ariaDescribedByIds4
1072
+ } from "@rjsf/utils";
1073
+ import { TimeInput } from "@mantine/dates";
1074
+ import { jsx as jsx23 } from "react/jsx-runtime";
1075
+ function TimeWidget(props) {
1076
+ const {
1077
+ id,
1078
+ name,
1079
+ value,
1080
+ placeholder,
1081
+ required,
1082
+ disabled,
1083
+ readonly,
1084
+ autofocus,
1085
+ label,
1086
+ hideLabel,
1087
+ rawErrors,
1088
+ options,
1089
+ onChange,
1090
+ onBlur,
1091
+ onFocus
1092
+ } = props;
1093
+ const emptyValue = options.emptyValue || "";
1094
+ const handleChange = useCallback5(
1095
+ (e) => {
1096
+ onChange(e.target.value === "" ? emptyValue : e.target.value);
1097
+ },
1098
+ [onChange, emptyValue]
1099
+ );
1100
+ const handleBlur = useCallback5(
1101
+ ({ target }) => {
1102
+ if (onBlur) {
1103
+ onBlur(id, target && target.value);
1104
+ }
1105
+ },
1106
+ [onBlur, id]
1107
+ );
1108
+ const handleFocus = useCallback5(
1109
+ ({ target }) => {
1110
+ if (onFocus) {
1111
+ onFocus(id, target && target.value);
1112
+ }
1113
+ },
1114
+ [onFocus, id]
1115
+ );
1116
+ return /* @__PURE__ */ jsx23(
1117
+ TimeInput,
1118
+ {
1119
+ id,
1120
+ name,
1121
+ value: value || "",
1122
+ placeholder: placeholder || void 0,
1123
+ required,
1124
+ disabled: disabled || readonly,
1125
+ autoFocus: autofocus,
1126
+ label: labelValue3(label || void 0, hideLabel, false),
1127
+ onChange: handleChange,
1128
+ onBlur: handleBlur,
1129
+ onFocus: handleFocus,
1130
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1131
+ ...options,
1132
+ "aria-describedby": ariaDescribedByIds4(id),
1133
+ classNames: typeof options?.classNames === "object" ? options.classNames : void 0
1134
+ }
1135
+ );
1136
+ }
1137
+
1138
+ // src/widgets/CheckboxesWidget.tsx
1139
+ import { useCallback as useCallback6 } from "react";
1140
+ import {
1141
+ ariaDescribedByIds as ariaDescribedByIds5,
1142
+ enumOptionsValueForIndex,
1143
+ enumOptionsIndexForValue,
1144
+ optionId,
1145
+ titleId as titleId4
1146
+ } from "@rjsf/utils";
1147
+ import { Checkbox, Flex as Flex4, Input as Input2 } from "@mantine/core";
1148
+ import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
1149
+ function CheckboxesWidget(props) {
1150
+ const {
1151
+ id,
1152
+ value,
1153
+ required,
1154
+ disabled,
1155
+ readonly,
1156
+ autofocus,
1157
+ label,
1158
+ hideLabel,
1159
+ rawErrors,
1160
+ options,
1161
+ onChange,
1162
+ onBlur,
1163
+ onFocus
1164
+ } = props;
1165
+ const { enumOptions, enumDisabled, inline, emptyValue } = options;
1166
+ const themeProps = cleanupOptions(options);
1167
+ const handleChange = useCallback6(
1168
+ (nextValue) => {
1169
+ if (!disabled && !readonly && onChange) {
1170
+ onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
1171
+ }
1172
+ },
1173
+ [onChange, disabled, readonly, enumOptions, emptyValue]
1174
+ );
1175
+ const handleBlur = useCallback6(
1176
+ ({ target }) => {
1177
+ if (onBlur) {
1178
+ onBlur(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
1179
+ }
1180
+ },
1181
+ [onBlur, id, enumOptions, emptyValue]
1182
+ );
1183
+ const handleFocus = useCallback6(
1184
+ ({ target }) => {
1185
+ if (onFocus) {
1186
+ onFocus(id, enumOptionsValueForIndex(target.value, enumOptions, emptyValue));
1187
+ }
1188
+ },
1189
+ [onFocus, id, enumOptions, emptyValue]
1190
+ );
1191
+ const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
1192
+ return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
1193
+ !hideLabel && !!label && /* @__PURE__ */ jsx24(Input2.Label, { id: titleId4(id), required, children: label }),
1194
+ /* @__PURE__ */ jsx24(
1195
+ Checkbox.Group,
1196
+ {
1197
+ id,
1198
+ value: selectedIndexes,
1199
+ onChange: handleChange,
1200
+ required,
1201
+ readOnly: disabled || readonly,
1202
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1203
+ "aria-describedby": ariaDescribedByIds5(id),
1204
+ ...themeProps,
1205
+ children: Array.isArray(enumOptions) ? /* @__PURE__ */ jsx24(Flex4, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ jsx24(
1206
+ Checkbox,
1207
+ {
1208
+ id: optionId(id, i),
1209
+ name: id,
1210
+ value: String(i),
1211
+ label: option.label,
1212
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
1213
+ autoFocus: i === 0 && autofocus,
1214
+ onBlur: handleBlur,
1215
+ onFocus: handleFocus
1216
+ },
1217
+ i
1218
+ )) }) : null
1219
+ }
1220
+ )
1221
+ ] }) : null;
1222
+ }
1223
+
1224
+ // src/widgets/CheckboxWidget.tsx
1225
+ import { useCallback as useCallback7 } from "react";
1226
+ import {
1227
+ descriptionId as descriptionId2,
1228
+ getTemplate as getTemplate5,
1229
+ labelValue as labelValue4,
1230
+ ariaDescribedByIds as ariaDescribedByIds6
1231
+ } from "@rjsf/utils";
1232
+ import { Checkbox as Checkbox2 } from "@mantine/core";
1233
+ import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
1234
+ function CheckboxWidget(props) {
1235
+ const {
1236
+ id,
1237
+ name,
1238
+ value = false,
1239
+ required,
1240
+ disabled,
1241
+ readonly,
1242
+ autofocus,
1243
+ label,
1244
+ hideLabel,
1245
+ schema,
1246
+ rawErrors,
1247
+ options,
1248
+ onChange,
1249
+ onBlur,
1250
+ onFocus,
1251
+ registry,
1252
+ uiSchema
1253
+ } = props;
1254
+ const themeProps = cleanupOptions(options);
1255
+ const DescriptionFieldTemplate = getTemplate5(
1256
+ "DescriptionFieldTemplate",
1257
+ registry,
1258
+ options
1259
+ );
1260
+ const handleCheckboxChange = useCallback7(
1261
+ (e) => {
1262
+ if (!disabled && !readonly && onChange) {
1263
+ onChange(e.currentTarget.checked);
1264
+ }
1265
+ },
1266
+ [onChange, disabled, readonly]
1267
+ );
1268
+ const handleBlur = useCallback7(
1269
+ ({ target }) => {
1270
+ if (onBlur) {
1271
+ onBlur(id, target.checked);
1272
+ }
1273
+ },
1274
+ [onBlur, id]
1275
+ );
1276
+ const handleFocus = useCallback7(
1277
+ ({ target }) => {
1278
+ if (onFocus) {
1279
+ onFocus(id, target.checked);
1280
+ }
1281
+ },
1282
+ [onFocus, id]
1283
+ );
1284
+ const description = options.description || schema.description;
1285
+ return /* @__PURE__ */ jsxs11(Fragment4, { children: [
1286
+ !hideLabel && !!description && /* @__PURE__ */ jsx25(
1287
+ DescriptionFieldTemplate,
1288
+ {
1289
+ id: descriptionId2(id),
1290
+ description,
1291
+ schema,
1292
+ uiSchema,
1293
+ registry
1294
+ }
1295
+ ),
1296
+ /* @__PURE__ */ jsx25(
1297
+ Checkbox2,
1298
+ {
1299
+ id,
1300
+ name,
1301
+ label: labelValue4(label || void 0, hideLabel, false),
1302
+ disabled: disabled || readonly,
1303
+ required,
1304
+ autoFocus: autofocus,
1305
+ checked: typeof value === "undefined" ? false : value === "true" || value,
1306
+ onChange: handleCheckboxChange,
1307
+ onBlur: handleBlur,
1308
+ onFocus: handleFocus,
1309
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1310
+ "aria-describedby": ariaDescribedByIds6(id),
1311
+ ...themeProps
1312
+ }
1313
+ )
1314
+ ] });
1315
+ }
1316
+
1317
+ // src/widgets/ColorWidget.tsx
1318
+ import { useCallback as useCallback8 } from "react";
1319
+ import {
1320
+ labelValue as labelValue5,
1321
+ ariaDescribedByIds as ariaDescribedByIds7
1322
+ } from "@rjsf/utils";
1323
+ import { ColorInput } from "@mantine/core";
1324
+ import { jsx as jsx26 } from "react/jsx-runtime";
1325
+ function ColorWidget(props) {
1326
+ const {
1327
+ id,
1328
+ name,
1329
+ value,
1330
+ placeholder,
1331
+ required,
1332
+ disabled,
1333
+ readonly,
1334
+ autofocus,
1335
+ label,
1336
+ hideLabel,
1337
+ rawErrors,
1338
+ options,
1339
+ onChange,
1340
+ onBlur,
1341
+ onFocus
1342
+ } = props;
1343
+ const themeProps = cleanupOptions(options);
1344
+ const handleChange = useCallback8(
1345
+ (nextValue) => {
1346
+ onChange(nextValue);
1347
+ },
1348
+ [onChange]
1349
+ );
1350
+ const handleBlur = useCallback8(
1351
+ ({ target }) => {
1352
+ if (onBlur) {
1353
+ onBlur(id, target && target.value);
1354
+ }
1355
+ },
1356
+ [onBlur, id]
1357
+ );
1358
+ const handleFocus = useCallback8(
1359
+ ({ target }) => {
1360
+ if (onFocus) {
1361
+ onFocus(id, target && target.value);
1362
+ }
1363
+ },
1364
+ [onFocus, id]
1365
+ );
1366
+ return /* @__PURE__ */ jsx26(
1367
+ ColorInput,
1368
+ {
1369
+ id,
1370
+ name,
1371
+ value: value || "",
1372
+ placeholder: placeholder || void 0,
1373
+ required,
1374
+ disabled: disabled || readonly,
1375
+ autoFocus: autofocus,
1376
+ label: labelValue5(label || void 0, hideLabel, false),
1377
+ onChange: handleChange,
1378
+ onBlur: handleBlur,
1379
+ onFocus: handleFocus,
1380
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1381
+ ...themeProps,
1382
+ "aria-describedby": ariaDescribedByIds7(id),
1383
+ popoverProps: { withinPortal: false }
1384
+ }
1385
+ );
1386
+ }
1387
+
1388
+ // src/widgets/FileWidget.tsx
1389
+ import { useCallback as useCallback9 } from "react";
1390
+ import {
1391
+ dataURItoBlob,
1392
+ ariaDescribedByIds as ariaDescribedByIds8,
1393
+ labelValue as labelValue6
1394
+ } from "@rjsf/utils";
1395
+ import { FileInput, Pill } from "@mantine/core";
1396
+ import { jsx as jsx27 } from "react/jsx-runtime";
1397
+ function addNameToDataURL(dataURL, name) {
1398
+ if (dataURL === null) {
1399
+ return null;
1400
+ }
1401
+ return dataURL.replace(";base64", `;name=${encodeURIComponent(name)};base64`);
1402
+ }
1403
+ function processFile(file) {
1404
+ const { name, size, type } = file;
1405
+ return new Promise((resolve, reject) => {
1406
+ const reader = new window.FileReader();
1407
+ reader.onerror = reject;
1408
+ reader.onload = (event) => {
1409
+ if (typeof event.target?.result === "string") {
1410
+ resolve({
1411
+ dataURL: addNameToDataURL(event.target.result, name),
1412
+ name,
1413
+ size,
1414
+ type
1415
+ });
1416
+ } else {
1417
+ resolve({
1418
+ dataURL: null,
1419
+ name,
1420
+ size,
1421
+ type
1422
+ });
1423
+ }
1424
+ };
1425
+ reader.readAsDataURL(file);
1426
+ });
1427
+ }
1428
+ function processFiles(files) {
1429
+ return Promise.all(Array.from(files).map(processFile));
1430
+ }
1431
+ function extractFileInfo(dataURLs) {
1432
+ return dataURLs.reduce((acc, dataURL) => {
1433
+ if (!dataURL) {
1434
+ return acc;
1435
+ }
1436
+ try {
1437
+ const { blob, name } = dataURItoBlob(dataURL);
1438
+ return [
1439
+ ...acc,
1440
+ {
1441
+ dataURL,
1442
+ name,
1443
+ size: blob.size,
1444
+ type: blob.type
1445
+ }
1446
+ ];
1447
+ } catch (e) {
1448
+ console.log(e);
1449
+ return acc;
1450
+ }
1451
+ }, []);
1452
+ }
1453
+ function FileWidget(props) {
1454
+ const {
1455
+ id,
1456
+ name,
1457
+ value,
1458
+ placeholder,
1459
+ required,
1460
+ disabled,
1461
+ readonly,
1462
+ autofocus,
1463
+ label,
1464
+ hideLabel,
1465
+ rawErrors,
1466
+ options,
1467
+ multiple,
1468
+ onChange
1469
+ } = props;
1470
+ const themeProps = cleanupOptions(options);
1471
+ const handleChange = useCallback9(
1472
+ (files) => {
1473
+ if (typeof files === "object") {
1474
+ processFiles(multiple ? files : [files]).then((filesInfoEvent) => {
1475
+ const newValue = filesInfoEvent.map((fileInfo) => fileInfo.dataURL);
1476
+ if (multiple) {
1477
+ onChange(value.concat(newValue));
1478
+ } else {
1479
+ onChange(newValue[0]);
1480
+ }
1481
+ });
1482
+ }
1483
+ return;
1484
+ },
1485
+ [multiple, value, onChange]
1486
+ );
1487
+ const handleRemoveFile = useCallback9(
1488
+ (index) => {
1489
+ if (multiple) {
1490
+ const newValue = value.filter((_, i) => i !== index);
1491
+ onChange(newValue);
1492
+ } else {
1493
+ onChange(void 0);
1494
+ }
1495
+ },
1496
+ [multiple, value, onChange]
1497
+ );
1498
+ const ValueComponent = useCallback9(
1499
+ (props2) => {
1500
+ const filesInfo = props2.value ? extractFileInfo(Array.isArray(props2.value) ? props2.value : [props2.value]) : null;
1501
+ if (Array.isArray(filesInfo) && filesInfo.length > 0) {
1502
+ return /* @__PURE__ */ jsx27(Pill.Group, { children: filesInfo.map((file, index) => /* @__PURE__ */ jsx27(Pill, { withRemoveButton: true, onRemove: () => handleRemoveFile(index), children: file.name }, index)) });
1503
+ }
1504
+ return null;
1505
+ },
1506
+ [handleRemoveFile]
1507
+ );
1508
+ return /* @__PURE__ */ jsx27(
1509
+ FileInput,
1510
+ {
1511
+ id,
1512
+ name,
1513
+ value: value || "",
1514
+ placeholder: placeholder || void 0,
1515
+ required,
1516
+ disabled: disabled || readonly,
1517
+ autoFocus: autofocus,
1518
+ label: labelValue6(label || void 0, hideLabel, false),
1519
+ multiple: !!multiple,
1520
+ valueComponent: ValueComponent,
1521
+ onChange: handleChange,
1522
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1523
+ ...themeProps,
1524
+ "aria-describedby": ariaDescribedByIds8(id)
1525
+ }
1526
+ );
1527
+ }
1528
+
1529
+ // src/widgets/PasswordWidget.tsx
1530
+ import { useCallback as useCallback10 } from "react";
1531
+ import {
1532
+ ariaDescribedByIds as ariaDescribedByIds9,
1533
+ labelValue as labelValue7
1534
+ } from "@rjsf/utils";
1535
+ import { PasswordInput } from "@mantine/core";
1536
+ import { jsx as jsx28 } from "react/jsx-runtime";
1537
+ function PasswordWidget(props) {
1538
+ const {
1539
+ id,
1540
+ name,
1541
+ value,
1542
+ placeholder,
1543
+ required,
1544
+ disabled,
1545
+ readonly,
1546
+ autofocus,
1547
+ label,
1548
+ hideLabel,
1549
+ rawErrors,
1550
+ options,
1551
+ onChange,
1552
+ onBlur,
1553
+ onFocus
1554
+ } = props;
1555
+ const emptyValue = options.emptyValue || "";
1556
+ const themeProps = cleanupOptions(options);
1557
+ const handleChange = useCallback10(
1558
+ (e) => {
1559
+ onChange(e.target.value === "" ? emptyValue : e.target.value);
1560
+ },
1561
+ [onChange, emptyValue]
1562
+ );
1563
+ const handleBlur = useCallback10(
1564
+ ({ target }) => {
1565
+ if (onBlur) {
1566
+ onBlur(id, target && target.value);
1567
+ }
1568
+ },
1569
+ [onBlur, id]
1570
+ );
1571
+ const handleFocus = useCallback10(
1572
+ ({ target }) => {
1573
+ if (onFocus) {
1574
+ onFocus(id, target && target.value);
1575
+ }
1576
+ },
1577
+ [onFocus, id]
1578
+ );
1579
+ return /* @__PURE__ */ jsx28(
1580
+ PasswordInput,
1581
+ {
1582
+ id,
1583
+ name,
1584
+ value: value || "",
1585
+ placeholder: placeholder || void 0,
1586
+ required,
1587
+ disabled: disabled || readonly,
1588
+ autoFocus: autofocus,
1589
+ label: labelValue7(label || void 0, hideLabel, false),
1590
+ onChange: handleChange,
1591
+ onBlur: handleBlur,
1592
+ onFocus: handleFocus,
1593
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1594
+ ...themeProps,
1595
+ "aria-describedby": ariaDescribedByIds9(id)
1596
+ }
1597
+ );
1598
+ }
1599
+
1600
+ // src/widgets/RadioWidget.tsx
1601
+ import { useCallback as useCallback11 } from "react";
1602
+ import {
1603
+ ariaDescribedByIds as ariaDescribedByIds10,
1604
+ enumOptionsIndexForValue as enumOptionsIndexForValue2,
1605
+ enumOptionsValueForIndex as enumOptionsValueForIndex2,
1606
+ optionId as optionId2
1607
+ } from "@rjsf/utils";
1608
+ import { Radio, Flex as Flex5 } from "@mantine/core";
1609
+ import { jsx as jsx29 } from "react/jsx-runtime";
1610
+ function RadioWidget(props) {
1611
+ const {
1612
+ id,
1613
+ value,
1614
+ required,
1615
+ disabled,
1616
+ readonly,
1617
+ autofocus,
1618
+ label,
1619
+ hideLabel,
1620
+ rawErrors,
1621
+ options,
1622
+ onChange,
1623
+ onBlur,
1624
+ onFocus
1625
+ } = props;
1626
+ const { enumOptions, enumDisabled, inline, emptyValue } = options;
1627
+ const themeProps = cleanupOptions(options);
1628
+ const handleChange = useCallback11(
1629
+ (nextValue) => {
1630
+ if (!disabled && !readonly && onChange) {
1631
+ onChange(enumOptionsValueForIndex2(nextValue, enumOptions, emptyValue));
1632
+ }
1633
+ },
1634
+ [onChange, disabled, readonly, enumOptions, emptyValue]
1635
+ );
1636
+ const handleBlur = useCallback11(
1637
+ ({ target }) => {
1638
+ if (onBlur) {
1639
+ onBlur(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
1640
+ }
1641
+ },
1642
+ [onBlur, id, enumOptions, emptyValue]
1643
+ );
1644
+ const handleFocus = useCallback11(
1645
+ ({ target }) => {
1646
+ if (onFocus) {
1647
+ onFocus(id, enumOptionsValueForIndex2(target && target.value, enumOptions, emptyValue));
1648
+ }
1649
+ },
1650
+ [onFocus, id, enumOptions, emptyValue]
1651
+ );
1652
+ const selected = enumOptionsIndexForValue2(value, enumOptions);
1653
+ return /* @__PURE__ */ jsx29(
1654
+ Radio.Group,
1655
+ {
1656
+ id,
1657
+ name: id,
1658
+ value: selected,
1659
+ label: !hideLabel ? label : void 0,
1660
+ onChange: handleChange,
1661
+ required,
1662
+ readOnly: disabled || readonly,
1663
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1664
+ "aria-describedby": ariaDescribedByIds10(id),
1665
+ ...themeProps,
1666
+ children: Array.isArray(enumOptions) ? /* @__PURE__ */ jsx29(Flex5, { mt: "xs", direction: inline ? "row" : "column", gap: "xs", wrap: "wrap", children: enumOptions.map((option, i) => /* @__PURE__ */ jsx29(
1667
+ Radio,
1668
+ {
1669
+ id: optionId2(id, i),
1670
+ value: String(i),
1671
+ label: option.label,
1672
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
1673
+ autoFocus: i === 0 && autofocus,
1674
+ onBlur: handleBlur,
1675
+ onFocus: handleFocus
1676
+ },
1677
+ i
1678
+ )) }) : null
1679
+ }
1680
+ );
1681
+ }
1682
+
1683
+ // src/widgets/RangeWidget.tsx
1684
+ import { useCallback as useCallback12 } from "react";
1685
+ import {
1686
+ ariaDescribedByIds as ariaDescribedByIds11,
1687
+ rangeSpec,
1688
+ titleId as titleId5
1689
+ } from "@rjsf/utils";
1690
+ import { Slider, Input as Input3 } from "@mantine/core";
1691
+ import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs12 } from "react/jsx-runtime";
1692
+ function RangeWidget(props) {
1693
+ const {
1694
+ id,
1695
+ name,
1696
+ value,
1697
+ required,
1698
+ disabled,
1699
+ readonly,
1700
+ autofocus,
1701
+ label,
1702
+ hideLabel,
1703
+ rawErrors,
1704
+ options,
1705
+ onChange,
1706
+ onBlur,
1707
+ onFocus,
1708
+ schema
1709
+ } = props;
1710
+ const themeProps = cleanupOptions(options);
1711
+ const { min, max, step } = rangeSpec(schema);
1712
+ const handleChange = useCallback12(
1713
+ (nextValue) => {
1714
+ if (!disabled && !readonly && onChange) {
1715
+ onChange(nextValue);
1716
+ }
1717
+ },
1718
+ [onChange, disabled, readonly]
1719
+ );
1720
+ const handleBlur = useCallback12(() => {
1721
+ if (onBlur) {
1722
+ onBlur(id, value);
1723
+ }
1724
+ }, [onBlur, id, value]);
1725
+ const handleFocus = useCallback12(() => {
1726
+ if (onFocus) {
1727
+ onFocus(id, value);
1728
+ }
1729
+ }, [onFocus, id, value]);
1730
+ return /* @__PURE__ */ jsxs12(Fragment5, { children: [
1731
+ !hideLabel && !!label && /* @__PURE__ */ jsx30(Input3.Label, { id: titleId5(id), required, children: label }),
1732
+ options?.description && /* @__PURE__ */ jsx30(Input3.Description, { children: options.description }),
1733
+ /* @__PURE__ */ jsx30(
1734
+ Slider,
1735
+ {
1736
+ id,
1737
+ name,
1738
+ value,
1739
+ max,
1740
+ min,
1741
+ step,
1742
+ disabled: disabled || readonly,
1743
+ autoFocus: autofocus,
1744
+ onChange: handleChange,
1745
+ onBlur: handleBlur,
1746
+ onFocus: handleFocus,
1747
+ ...themeProps,
1748
+ "aria-describedby": ariaDescribedByIds11(id)
1749
+ }
1750
+ ),
1751
+ rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => /* @__PURE__ */ jsx30(Input3.Error, { children: error }, `range-widget-input-errors-${index}`))
1752
+ ] });
1753
+ }
1754
+
1755
+ // src/widgets/SelectWidget.tsx
1756
+ import { useCallback as useCallback13, useMemo } from "react";
1757
+ import {
1758
+ ariaDescribedByIds as ariaDescribedByIds12,
1759
+ enumOptionsIndexForValue as enumOptionsIndexForValue3,
1760
+ enumOptionsValueForIndex as enumOptionsValueForIndex3,
1761
+ labelValue as labelValue8
1762
+ } from "@rjsf/utils";
1763
+ import { Select as Select2, MultiSelect } from "@mantine/core";
1764
+ import { jsx as jsx31 } from "react/jsx-runtime";
1765
+ function SelectWidget(props) {
1766
+ const {
1767
+ id,
1768
+ value,
1769
+ placeholder,
1770
+ required,
1771
+ disabled,
1772
+ readonly,
1773
+ autofocus,
1774
+ label,
1775
+ hideLabel,
1776
+ multiple,
1777
+ rawErrors,
1778
+ options,
1779
+ onChange,
1780
+ onBlur,
1781
+ onFocus
1782
+ } = props;
1783
+ const { enumOptions, enumDisabled, emptyValue } = options;
1784
+ const themeProps = cleanupOptions(options);
1785
+ const handleChange = useCallback13(
1786
+ (nextValue) => {
1787
+ if (!disabled && !readonly && onChange) {
1788
+ onChange(enumOptionsValueForIndex3(nextValue, enumOptions, emptyValue));
1789
+ }
1790
+ },
1791
+ [onChange, disabled, readonly, enumOptions, emptyValue]
1792
+ );
1793
+ const handleBlur = useCallback13(
1794
+ ({ target }) => {
1795
+ if (onBlur) {
1796
+ onBlur(id, enumOptionsValueForIndex3(target && target.value, enumOptions, emptyValue));
1797
+ }
1798
+ },
1799
+ [onBlur, id, enumOptions, emptyValue]
1800
+ );
1801
+ const handleFocus = useCallback13(
1802
+ ({ target }) => {
1803
+ if (onFocus) {
1804
+ onFocus(id, enumOptionsValueForIndex3(target && target.value, enumOptions, emptyValue));
1805
+ }
1806
+ },
1807
+ [onFocus, id, enumOptions, emptyValue]
1808
+ );
1809
+ const selectedIndexes = enumOptionsIndexForValue3(value, enumOptions, multiple);
1810
+ const selectOptions = useMemo(() => {
1811
+ if (Array.isArray(enumOptions)) {
1812
+ return enumOptions.map((option, index) => ({
1813
+ key: String(index),
1814
+ value: String(index),
1815
+ label: option.label,
1816
+ disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1
1817
+ }));
1818
+ }
1819
+ return [];
1820
+ }, [enumDisabled, enumOptions]);
1821
+ const Component = multiple ? MultiSelect : Select2;
1822
+ return /* @__PURE__ */ jsx31(
1823
+ Component,
1824
+ {
1825
+ id,
1826
+ name: id,
1827
+ label: labelValue8(label || void 0, hideLabel, false),
1828
+ data: selectOptions,
1829
+ value: multiple ? selectedIndexes : selectedIndexes,
1830
+ onChange: !readonly ? handleChange : void 0,
1831
+ onBlur: !readonly ? handleBlur : void 0,
1832
+ onFocus: !readonly ? handleFocus : void 0,
1833
+ autoFocus: autofocus,
1834
+ placeholder,
1835
+ disabled: disabled || readonly,
1836
+ required,
1837
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1838
+ searchable: true,
1839
+ ...themeProps,
1840
+ "aria-describedby": ariaDescribedByIds12(id),
1841
+ comboboxProps: { withinPortal: false }
1842
+ }
1843
+ );
1844
+ }
1845
+
1846
+ // src/widgets/TextareaWidget.tsx
1847
+ import { useCallback as useCallback14 } from "react";
1848
+ import {
1849
+ labelValue as labelValue9,
1850
+ ariaDescribedByIds as ariaDescribedByIds13
1851
+ } from "@rjsf/utils";
1852
+ import { Textarea } from "@mantine/core";
1853
+ import { jsx as jsx32 } from "react/jsx-runtime";
1854
+ function TextareaWidget(props) {
1855
+ const {
1856
+ id,
1857
+ name,
1858
+ value,
1859
+ placeholder,
1860
+ required,
1861
+ disabled,
1862
+ readonly,
1863
+ autofocus,
1864
+ label,
1865
+ hideLabel,
1866
+ rawErrors,
1867
+ options,
1868
+ onChange,
1869
+ onBlur,
1870
+ onFocus
1871
+ } = props;
1872
+ const themeProps = cleanupOptions(options);
1873
+ const emptyValue = options?.emptyValue ?? "";
1874
+ const handleChange = useCallback14(
1875
+ (e) => {
1876
+ onChange(e.target.value === "" ? emptyValue : e.target.value);
1877
+ },
1878
+ [onChange, emptyValue]
1879
+ );
1880
+ const handleBlur = useCallback14(
1881
+ ({ target }) => {
1882
+ if (onBlur) {
1883
+ onBlur(id, target && target.value);
1884
+ }
1885
+ },
1886
+ [onBlur, id]
1887
+ );
1888
+ const handleFocus = useCallback14(
1889
+ ({ target }) => {
1890
+ if (onFocus) {
1891
+ onFocus(id, target && target.value);
1892
+ }
1893
+ },
1894
+ [onFocus, id]
1895
+ );
1896
+ return /* @__PURE__ */ jsx32(
1897
+ Textarea,
1898
+ {
1899
+ id,
1900
+ name,
1901
+ value: value || "",
1902
+ placeholder: placeholder || void 0,
1903
+ required,
1904
+ disabled: disabled || readonly,
1905
+ autoFocus: autofocus,
1906
+ label: labelValue9(label || void 0, hideLabel, false),
1907
+ onChange: handleChange,
1908
+ onBlur: handleBlur,
1909
+ onFocus: handleFocus,
1910
+ error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
1911
+ "aria-describedby": ariaDescribedByIds13(id),
1912
+ ...themeProps
1913
+ }
1914
+ );
1915
+ }
1916
+
1917
+ // src/widgets/index.ts
1918
+ dayjs2.extend(customParseFormat);
1919
+ function generateWidgets() {
1920
+ return {
1921
+ AltDateTimeWidget,
1922
+ AltDateWidget,
1923
+ CheckboxesWidget,
1924
+ CheckboxWidget,
1925
+ ColorWidget,
1926
+ FileWidget,
1927
+ DateTimeWidget,
1928
+ DateWidget,
1929
+ PasswordWidget,
1930
+ RadioWidget,
1931
+ RangeWidget,
1932
+ SelectWidget,
1933
+ TextareaWidget,
1934
+ TimeWidget
1935
+ };
1936
+ }
1937
+ var widgets_default = generateWidgets();
1938
+
1939
+ // src/Theme/index.ts
1940
+ function generateTheme() {
1941
+ return {
1942
+ templates: generateTemplates(),
1943
+ widgets: generateWidgets()
1944
+ };
1945
+ }
1946
+ var Theme_default = generateTheme();
1947
+
1948
+ // src/Form/index.ts
1949
+ function generateForm() {
1950
+ return withTheme(generateTheme());
1951
+ }
1952
+ var Form_default = generateForm();
1953
+
1954
+ // src/index.ts
1955
+ var index_default = Form_default;
1956
+ export {
1957
+ Form_default as Form,
1958
+ templates_default as Templates,
1959
+ Theme_default as Theme,
1960
+ widgets_default as Widgets,
1961
+ index_default as default,
1962
+ generateForm,
1963
+ generateTemplates,
1964
+ generateTheme,
1965
+ generateWidgets
1966
+ };
1967
+ //# sourceMappingURL=mantine.esm.js.map