@rjsf/daisyui 6.0.0-beta.9 → 6.0.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 (99) hide show
  1. package/README.md +9 -16
  2. package/dist/chakra-ui.esm.js +382 -472
  3. package/dist/chakra-ui.esm.js.map +4 -4
  4. package/dist/chakra-ui.umd.js +194 -287
  5. package/dist/{index.js → index.cjs} +404 -496
  6. package/dist/index.cjs.map +7 -0
  7. package/lib/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.d.ts +2 -2
  8. package/lib/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.js +2 -7
  9. package/lib/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.js.map +1 -1
  10. package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
  11. package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
  12. package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
  13. package/lib/templates/ArrayFieldTemplate/ArrayFieldTemplate.js +3 -4
  14. package/lib/templates/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
  15. package/lib/templates/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js +7 -3
  16. package/lib/templates/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.js.map +1 -1
  17. package/lib/templates/BaseInputTemplate/BaseInputTemplate.js +8 -2
  18. package/lib/templates/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  19. package/lib/templates/ButtonTemplates/AddButton.js +1 -1
  20. package/lib/templates/ButtonTemplates/AddButton.js.map +1 -1
  21. package/lib/templates/ButtonTemplates/IconButton.js +4 -4
  22. package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
  23. package/lib/templates/FieldTemplate/FieldTemplate.js +6 -3
  24. package/lib/templates/FieldTemplate/FieldTemplate.js.map +1 -1
  25. package/lib/templates/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +2 -0
  26. package/lib/templates/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js +6 -0
  27. package/lib/templates/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.js.map +1 -0
  28. package/lib/templates/MultiSchemaFieldTemplate/index.d.ts +2 -0
  29. package/lib/templates/MultiSchemaFieldTemplate/index.js +3 -0
  30. package/lib/templates/MultiSchemaFieldTemplate/index.js.map +1 -0
  31. package/lib/templates/ObjectFieldTemplate/ObjectFieldTemplate.js +4 -3
  32. package/lib/templates/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
  33. package/lib/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +10 -0
  34. package/lib/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +23 -0
  35. package/lib/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -0
  36. package/lib/templates/OptionalDataControlsTemplate/index.d.ts +2 -0
  37. package/lib/templates/OptionalDataControlsTemplate/index.js +3 -0
  38. package/lib/templates/OptionalDataControlsTemplate/index.js.map +1 -0
  39. package/lib/templates/Templates.js +4 -0
  40. package/lib/templates/Templates.js.map +1 -1
  41. package/lib/templates/TitleField/TitleField.js +6 -2
  42. package/lib/templates/TitleField/TitleField.js.map +1 -1
  43. package/lib/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +11 -11
  44. package/lib/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
  45. package/lib/tsconfig.tsbuildinfo +1 -1
  46. package/lib/widgets/AltDateWidget/AltDateWidget.d.ts +1 -1
  47. package/lib/widgets/AltDateWidget/AltDateWidget.js +5 -121
  48. package/lib/widgets/AltDateWidget/AltDateWidget.js.map +1 -1
  49. package/lib/widgets/CheckboxWidget/CheckboxWidget.js +2 -2
  50. package/lib/widgets/CheckboxWidget/CheckboxWidget.js.map +1 -1
  51. package/lib/widgets/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
  52. package/lib/widgets/CheckboxesWidget/CheckboxesWidget.js +2 -2
  53. package/lib/widgets/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
  54. package/lib/widgets/DateTimeWidget/DateTimeWidget.js +2 -2
  55. package/lib/widgets/DateTimeWidget/DateTimeWidget.js.map +1 -1
  56. package/lib/widgets/DateWidget/DateWidget.js +2 -2
  57. package/lib/widgets/DateWidget/DateWidget.js.map +1 -1
  58. package/lib/widgets/RadioWidget/RadioWidget.d.ts +1 -1
  59. package/lib/widgets/RadioWidget/RadioWidget.js +2 -2
  60. package/lib/widgets/RadioWidget/RadioWidget.js.map +1 -1
  61. package/lib/widgets/TextareaWidget/TextareaWidget.js +2 -2
  62. package/lib/widgets/TextareaWidget/TextareaWidget.js.map +1 -1
  63. package/lib/widgets/Widgets.d.ts +1 -2
  64. package/lib/widgets/Widgets.js +1 -3
  65. package/lib/widgets/Widgets.js.map +1 -1
  66. package/package.json +24 -22
  67. package/src/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.tsx +15 -20
  68. package/src/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -3
  69. package/src/templates/ArrayFieldTemplate/ArrayFieldTemplate.tsx +9 -13
  70. package/src/templates/ArrayFieldTitleTemplate/ArrayFieldTitleTemplate.tsx +12 -2
  71. package/src/templates/BaseInputTemplate/BaseInputTemplate.tsx +14 -6
  72. package/src/templates/ButtonTemplates/AddButton.tsx +1 -1
  73. package/src/templates/ButtonTemplates/IconButton.tsx +4 -4
  74. package/src/templates/FieldTemplate/FieldTemplate.tsx +48 -19
  75. package/src/templates/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +15 -0
  76. package/src/templates/MultiSchemaFieldTemplate/index.ts +2 -0
  77. package/src/templates/ObjectFieldTemplate/ObjectFieldTemplate.tsx +13 -9
  78. package/src/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +46 -0
  79. package/src/templates/OptionalDataControlsTemplate/index.ts +2 -0
  80. package/src/templates/Templates.tsx +4 -0
  81. package/src/templates/TitleField/TitleField.tsx +12 -3
  82. package/src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +38 -34
  83. package/src/widgets/AltDateWidget/AltDateWidget.tsx +18 -253
  84. package/src/widgets/CheckboxWidget/CheckboxWidget.tsx +5 -3
  85. package/src/widgets/CheckboxesWidget/CheckboxesWidget.tsx +2 -1
  86. package/src/widgets/DateTimeWidget/DateTimeWidget.tsx +2 -2
  87. package/src/widgets/DateWidget/DateWidget.tsx +2 -2
  88. package/src/widgets/RadioWidget/RadioWidget.tsx +2 -1
  89. package/src/widgets/TextareaWidget/TextareaWidget.tsx +2 -1
  90. package/src/widgets/Widgets.tsx +0 -3
  91. package/dist/index.js.map +0 -7
  92. package/lib/widgets/FileWidget/FileWidget.d.ts +0 -12
  93. package/lib/widgets/FileWidget/FileWidget.js +0 -57
  94. package/lib/widgets/FileWidget/FileWidget.js.map +0 -1
  95. package/lib/widgets/FileWidget/index.d.ts +0 -2
  96. package/lib/widgets/FileWidget/index.js +0 -3
  97. package/lib/widgets/FileWidget/index.js.map +0 -1
  98. package/src/widgets/FileWidget/FileWidget.tsx +0 -86
  99. package/src/widgets/FileWidget/index.ts +0 -2
@@ -34,11 +34,10 @@ module.exports = __toCommonJS(index_exports);
34
34
  var import_core4 = require("@rjsf/core");
35
35
 
36
36
  // src/theme/Theme.tsx
37
- var import_react19 = require("react");
37
+ var import_react15 = require("react");
38
38
  var import_core2 = require("@rjsf/core");
39
39
 
40
40
  // src/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.tsx
41
- var import_react = require("react");
42
41
  var import_utils = require("@rjsf/utils");
43
42
  var import_jsx_runtime = require("react/jsx-runtime");
44
43
  function ArrayFieldItemButtonsTemplate(props) {
@@ -48,20 +47,16 @@ function ArrayFieldItemButtonsTemplate(props) {
48
47
  hasMoveDown,
49
48
  hasMoveUp,
50
49
  hasRemove,
51
- idSchema,
52
- index,
53
- onCopyIndexClick,
54
- onDropIndexClick,
55
- onReorderClick,
50
+ fieldPathId,
51
+ onCopyItem,
52
+ onRemoveItem,
53
+ onMoveDownItem,
54
+ onMoveUpItem,
56
55
  readonly,
57
56
  registry,
58
57
  uiSchema
59
58
  } = props;
60
59
  const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
61
- const onCopyClick = (0, import_react.useMemo)(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
62
- const onRemoveClick = (0, import_react.useMemo)(() => onDropIndexClick(index), [index, onDropIndexClick]);
63
- const onArrowUpClick = (0, import_react.useMemo)(() => onReorderClick(index, index - 1), [index, onReorderClick]);
64
- const onArrowDownClick = (0, import_react.useMemo)(() => onReorderClick(index, index + 1), [index, onReorderClick]);
65
60
  const renderMany = [hasMoveUp || hasMoveDown, hasCopy, hasRemove].filter(Boolean).length > 1;
66
61
  const btnClass = renderMany ? "join-item btn btn-sm px-2" : "btn btn-sm px-2 rounded-sm";
67
62
  const removeBtnClass = renderMany ? "join-item btn btn-sm btn-error px-2" : "btn btn-sm btn-error px-2 rounded-sm";
@@ -70,10 +65,10 @@ function ArrayFieldItemButtonsTemplate(props) {
70
65
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
66
  MoveUpButton2,
72
67
  {
73
- id: (0, import_utils.buttonId)(idSchema, "moveUp"),
68
+ id: (0, import_utils.buttonId)(fieldPathId, "moveUp"),
74
69
  className: `rjsf-array-item-move-up ${btnClass}`,
75
70
  disabled: disabled || readonly || !hasMoveUp,
76
- onClick: onArrowUpClick,
71
+ onClick: onMoveUpItem,
77
72
  uiSchema,
78
73
  registry
79
74
  }
@@ -81,10 +76,10 @@ function ArrayFieldItemButtonsTemplate(props) {
81
76
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
77
  MoveDownButton2,
83
78
  {
84
- id: (0, import_utils.buttonId)(idSchema, "moveDown"),
79
+ id: (0, import_utils.buttonId)(fieldPathId, "moveDown"),
85
80
  className: `rjsf-array-item-move-down ${btnClass}`,
86
81
  disabled: disabled || readonly || !hasMoveDown,
87
- onClick: onArrowDownClick,
82
+ onClick: onMoveDownItem,
88
83
  uiSchema,
89
84
  registry
90
85
  }
@@ -93,10 +88,10 @@ function ArrayFieldItemButtonsTemplate(props) {
93
88
  hasCopy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
89
  CopyButton2,
95
90
  {
96
- id: (0, import_utils.buttonId)(idSchema, "copy"),
91
+ id: (0, import_utils.buttonId)(fieldPathId, "copy"),
97
92
  className: `rjsf-array-item-copy ${btnClass}`,
98
93
  disabled: disabled || readonly,
99
- onClick: onCopyClick,
94
+ onClick: onCopyItem,
100
95
  uiSchema,
101
96
  registry
102
97
  }
@@ -104,10 +99,10 @@ function ArrayFieldItemButtonsTemplate(props) {
104
99
  hasRemove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
100
  RemoveButton2,
106
101
  {
107
- id: (0, import_utils.buttonId)(idSchema, "remove"),
102
+ id: (0, import_utils.buttonId)(fieldPathId, "remove"),
108
103
  className: `rjsf-array-item-remove ${removeBtnClass}`,
109
104
  disabled: disabled || readonly,
110
- onClick: onRemoveClick,
105
+ onClick: onRemoveItem,
111
106
  uiSchema,
112
107
  registry
113
108
  }
@@ -139,7 +134,7 @@ function ArrayFieldItemTemplate(props) {
139
134
  }
140
135
 
141
136
  // src/templates/ArrayFieldTemplate/ArrayFieldTemplate.tsx
142
- var import_react2 = require("react");
137
+ var import_react = require("react");
143
138
  var import_utils3 = require("@rjsf/utils");
144
139
  var import_jsx_runtime3 = require("react/jsx-runtime");
145
140
  function ArrayFieldTemplate(props) {
@@ -147,8 +142,9 @@ function ArrayFieldTemplate(props) {
147
142
  canAdd,
148
143
  className,
149
144
  disabled,
150
- idSchema,
145
+ fieldPathId,
151
146
  items,
147
+ optionalDataControl,
152
148
  onAddClick,
153
149
  readonly,
154
150
  registry,
@@ -163,20 +159,16 @@ function ArrayFieldTemplate(props) {
163
159
  registry,
164
160
  uiOptions
165
161
  );
166
- const ArrayFieldItemTemplate2 = (0, import_utils3.getTemplate)(
167
- "ArrayFieldItemTemplate",
168
- registry,
169
- uiOptions
170
- );
171
162
  const ArrayFieldTitleTemplate = (0, import_utils3.getTemplate)(
172
163
  "ArrayFieldTitleTemplate",
173
164
  registry,
174
165
  uiOptions
175
166
  );
167
+ const showOptionalDataControlInTitle = !readonly && !disabled;
176
168
  const {
177
169
  ButtonTemplates: { AddButton: AddButton2 }
178
170
  } = registry.templates;
179
- const handleAddClick = (0, import_react2.useCallback)(
171
+ const handleAddClick = (0, import_react.useCallback)(
180
172
  (e) => {
181
173
  e.preventDefault();
182
174
  e.stopPropagation();
@@ -188,18 +180,19 @@ function ArrayFieldTemplate(props) {
188
180
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
189
181
  ArrayFieldTitleTemplate,
190
182
  {
191
- idSchema,
183
+ fieldPathId,
192
184
  title: uiOptions.title || title,
193
185
  schema,
194
186
  uiSchema,
195
187
  required,
196
- registry
188
+ registry,
189
+ optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
197
190
  }
198
191
  ),
199
192
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
200
193
  ArrayFieldDescriptionTemplate,
201
194
  {
202
- idSchema,
195
+ fieldPathId,
203
196
  description: uiOptions.description || schema.description,
204
197
  schema,
205
198
  uiSchema,
@@ -207,14 +200,15 @@ function ArrayFieldTemplate(props) {
207
200
  }
208
201
  ),
209
202
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col gap-4", children: [
203
+ !showOptionalDataControlInTitle ? optionalDataControl : void 0,
210
204
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rjsf-array-item-list", children: [
211
- items && items.map(({ key, ...itemProps }, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrayFieldItemTemplate2, { ...itemProps, index, totalItems: items.length }, key)),
205
+ items,
212
206
  items && items.length === 0 && canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-center italic text-base-content/70", children: import_utils3.TranslatableString.EmptyArray })
213
207
  ] }),
214
208
  canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
215
209
  AddButton2,
216
210
  {
217
- id: (0, import_utils3.buttonId)(idSchema, "add"),
211
+ id: (0, import_utils3.buttonId)(fieldPathId, "add"),
218
212
  className: "rjsf-array-item-add btn btn-primary btn-sm",
219
213
  onClick: handleAddClick,
220
214
  disabled: disabled || readonly,
@@ -227,12 +221,14 @@ function ArrayFieldTemplate(props) {
227
221
  }
228
222
 
229
223
  // src/templates/BaseInputTemplate/BaseInputTemplate.tsx
230
- var import_react3 = require("react");
224
+ var import_react2 = require("react");
231
225
  var import_utils4 = require("@rjsf/utils");
232
226
  var import_jsx_runtime4 = require("react/jsx-runtime");
233
227
  function BaseInputTemplate(props) {
234
228
  const {
235
229
  id,
230
+ htmlName,
231
+ multiple,
236
232
  value,
237
233
  required,
238
234
  disabled,
@@ -249,17 +245,23 @@ function BaseInputTemplate(props) {
249
245
  placeholder
250
246
  } = props;
251
247
  const inputProps = (0, import_utils4.getInputProps)(schema, type, options);
248
+ let className = "input input-bordered";
249
+ let isMulti = multiple;
250
+ if (type === "file") {
251
+ isMulti = schema.type === "array" || Boolean(options.multiple);
252
+ className = "file-input w-full";
253
+ }
252
254
  const { step, min, max, accept, ...rest } = inputProps;
253
255
  const htmlInputProps = { step, min, max, accept, ...schema.examples ? { list: (0, import_utils4.examplesId)(id) } : void 0 };
254
- const _onChange = (0, import_react3.useCallback)(
256
+ const _onChange = (0, import_react2.useCallback)(
255
257
  ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
256
258
  [onChange, options]
257
259
  );
258
- const _onBlur = (0, import_react3.useCallback)(
260
+ const _onBlur = (0, import_react2.useCallback)(
259
261
  ({ target }) => onBlur && onBlur(id, target.value),
260
262
  [onBlur, id]
261
263
  );
262
- const _onFocus = (0, import_react3.useCallback)(
264
+ const _onFocus = (0, import_react2.useCallback)(
263
265
  ({ target }) => onFocus && onFocus(id, target.value),
264
266
  [onFocus, id]
265
267
  );
@@ -270,13 +272,14 @@ function BaseInputTemplate(props) {
270
272
  "input",
271
273
  {
272
274
  id,
273
- name: id,
275
+ name: htmlName || id,
274
276
  value: value || value === 0 ? value : "",
275
277
  placeholder,
276
278
  required,
277
279
  disabled: disabled || readonly,
278
280
  autoFocus: autofocus,
279
- className: "input input-bordered",
281
+ className,
282
+ multiple: isMulti,
280
283
  ...rest,
281
284
  ...htmlInputProps,
282
285
  onChange: onChangeOverride || _onChange,
@@ -298,7 +301,7 @@ var import_fontawesome_svg_core = require("@fortawesome/fontawesome-svg-core");
298
301
  var import_free_solid_svg_icons = require("@fortawesome/free-solid-svg-icons");
299
302
 
300
303
  // src/templates/ButtonTemplates/DaisyUIButton.tsx
301
- var import_react4 = require("react");
304
+ var import_react3 = require("react");
302
305
  var import_react_fontawesome = require("@fortawesome/react-fontawesome");
303
306
  var import_jsx_runtime5 = require("react/jsx-runtime");
304
307
  function DaisyUIButton(props) {
@@ -306,7 +309,7 @@ function DaisyUIButton(props) {
306
309
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className, "aria-label": props.title, ...otherProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_fontawesome.FontAwesomeIcon, { icon, className: "h-5 w-5" }) });
307
310
  }
308
311
  DaisyUIButton.displayName = "DaisyUIButton";
309
- var DaisyUIButton_default = (0, import_react4.memo)(DaisyUIButton);
312
+ var DaisyUIButton_default = (0, import_react3.memo)(DaisyUIButton);
310
313
 
311
314
  // src/templates/ButtonTemplates/AddButton.tsx
312
315
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -322,11 +325,11 @@ function AddButton({
322
325
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: `col-xs-3 col-xs-offset-9 text-right ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
323
326
  DaisyUIButton_default,
324
327
  {
328
+ title: translateString(import_utils5.TranslatableString.AddButton),
325
329
  ...otherProps,
326
330
  iconType: "info",
327
331
  icon: import_free_solid_svg_icons.faPlus,
328
332
  className: "btn-add col-xs-12 btn-primary btn-primary-content",
329
- title: translateString(import_utils5.TranslatableString.AddButton),
330
333
  onClick,
331
334
  disabled,
332
335
  registry
@@ -361,7 +364,7 @@ function CopyButton(props) {
361
364
  const {
362
365
  registry: { translateString }
363
366
  } = props;
364
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DaisyUIButton_default, { ...props, title: translateString(import_utils7.TranslatableString.CopyButton), icon: import_free_solid_svg_icons2.faCopy });
367
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DaisyUIButton_default, { title: translateString(import_utils7.TranslatableString.CopyButton), ...props, icon: import_free_solid_svg_icons2.faCopy });
365
368
  }
366
369
  function MoveDownButton(props) {
367
370
  const {
@@ -370,8 +373,8 @@ function MoveDownButton(props) {
370
373
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
371
374
  DaisyUIButton_default,
372
375
  {
373
- ...props,
374
376
  title: translateString(import_utils7.TranslatableString.MoveDownButton),
377
+ ...props,
375
378
  icon: import_free_solid_svg_icons2.faArrowDown
376
379
  }
377
380
  );
@@ -383,8 +386,8 @@ function MoveUpButton(props) {
383
386
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
384
387
  DaisyUIButton_default,
385
388
  {
386
- ...props,
387
389
  title: translateString(import_utils7.TranslatableString.MoveUpButton),
390
+ ...props,
388
391
  icon: import_free_solid_svg_icons2.faArrowUp
389
392
  }
390
393
  );
@@ -396,8 +399,8 @@ function RemoveButton(props) {
396
399
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
397
400
  DaisyUIButton_default,
398
401
  {
399
- ...props,
400
402
  title: translateString(import_utils7.TranslatableString.RemoveButton),
403
+ ...props,
401
404
  iconType: "danger",
402
405
  icon: import_free_solid_svg_icons2.faTrash
403
406
  }
@@ -437,6 +440,7 @@ function FieldHelpTemplate(props) {
437
440
  }
438
441
 
439
442
  // src/templates/FieldTemplate/FieldTemplate.tsx
443
+ var import_utils8 = require("@rjsf/utils");
440
444
  var import_jsx_runtime13 = require("react/jsx-runtime");
441
445
  function FieldTemplate(props) {
442
446
  const {
@@ -444,37 +448,61 @@ function FieldTemplate(props) {
444
448
  label,
445
449
  children,
446
450
  errors,
447
- formContext,
448
451
  formData,
449
452
  help,
450
453
  hideError,
451
454
  displayLabel,
455
+ onKeyRename,
456
+ onKeyRenameBlur,
457
+ onRemoveProperty,
452
458
  classNames,
453
- // Destructure props we don't want to pass to div
454
- onKeyChange,
455
- onDropPropertyClick,
456
459
  uiSchema,
457
460
  schema,
458
461
  readonly,
459
462
  required,
463
+ registry,
464
+ // Destructure props we don't want to pass to div
465
+ description,
460
466
  rawErrors,
461
467
  rawHelp,
462
468
  rawDescription,
463
469
  hidden,
464
470
  onChange,
465
- registry,
466
471
  ...divProps
467
472
  } = props;
468
473
  const isCheckbox = schema.type === "boolean";
469
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `field-template mb-3 ${classNames || ""}`, ...divProps, children: [
470
- displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: id, className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "label-text font-medium", children: [
474
+ const uiOptions = (0, import_utils8.getUiOptions)(uiSchema);
475
+ const WrapIfAdditionalTemplate2 = (0, import_utils8.getTemplate)(
476
+ "WrapIfAdditionalTemplate",
477
+ registry,
478
+ uiOptions
479
+ );
480
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
481
+ WrapIfAdditionalTemplate2,
482
+ {
483
+ classNames,
484
+ disabled: divProps.disabled,
485
+ id,
471
486
  label,
472
- required && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-error ml-1", children: "*" })
473
- ] }) }),
474
- children,
475
- errors,
476
- help
477
- ] });
487
+ onKeyRename,
488
+ onKeyRenameBlur,
489
+ onRemoveProperty,
490
+ readonly,
491
+ required,
492
+ schema,
493
+ uiSchema,
494
+ registry,
495
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `field-template mb-3 ${classNames || ""}`, ...divProps, children: [
496
+ displayLabel && !isCheckbox && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: id, className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "label-text font-medium", children: [
497
+ label,
498
+ required && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-error ml-1", children: "*" })
499
+ ] }) }),
500
+ children,
501
+ errors,
502
+ help
503
+ ] })
504
+ }
505
+ );
478
506
  }
479
507
 
480
508
  // src/templates/GridTemplate/GridTemplate.tsx
@@ -487,9 +515,19 @@ function GridTemplate(props) {
487
515
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-wrap gap-4", ...rest, children });
488
516
  }
489
517
 
490
- // src/templates/ObjectFieldTemplate/ObjectFieldTemplate.tsx
491
- var import_utils8 = require("@rjsf/utils");
518
+ // src/templates/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
492
519
  var import_jsx_runtime15 = require("react/jsx-runtime");
520
+ function MultiSchemaFieldTemplate(props) {
521
+ const { optionSchemaField, selector } = props;
522
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "p-4 border rounded-sm shadow-sm", children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mb-4", children: selector }),
524
+ optionSchemaField
525
+ ] });
526
+ }
527
+
528
+ // src/templates/ObjectFieldTemplate/ObjectFieldTemplate.tsx
529
+ var import_utils9 = require("@rjsf/utils");
530
+ var import_jsx_runtime16 = require("react/jsx-runtime");
493
531
  function ObjectFieldTemplate(props) {
494
532
  const {
495
533
  description,
@@ -499,62 +537,66 @@ function ObjectFieldTemplate(props) {
499
537
  disabled,
500
538
  readonly,
501
539
  uiSchema,
502
- idSchema,
540
+ fieldPathId,
503
541
  schema,
504
542
  formData,
505
- onAddClick,
543
+ optionalDataControl,
544
+ onAddProperty,
506
545
  registry
507
546
  } = props;
508
- const uiOptions = (0, import_utils8.getUiOptions)(uiSchema);
509
- const TitleFieldTemplate = (0, import_utils8.getTemplate)("TitleFieldTemplate", registry, uiOptions);
510
- const DescriptionFieldTemplate = (0, import_utils8.getTemplate)(
547
+ const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
548
+ const TitleFieldTemplate = (0, import_utils9.getTemplate)("TitleFieldTemplate", registry, uiOptions);
549
+ const DescriptionFieldTemplate = (0, import_utils9.getTemplate)(
511
550
  "DescriptionFieldTemplate",
512
551
  registry,
513
552
  uiOptions
514
553
  );
554
+ const showOptionalDataControlInTitle = !readonly && !disabled;
515
555
  const {
516
556
  ButtonTemplates: { AddButton: AddButton2 }
517
557
  } = registry.templates;
518
- const isRoot = idSchema.$id === "root";
519
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `form-control ${isRoot ? "bg-base-100 p-6 rounded-xl shadow-lg" : ""}`, children: [
520
- title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
558
+ const isRoot = fieldPathId.$id === "root";
559
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `form-control ${isRoot ? "bg-base-100 p-6 rounded-xl shadow-lg" : ""}`, children: [
560
+ title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
521
561
  TitleFieldTemplate,
522
562
  {
523
- id: (0, import_utils8.titleId)(idSchema),
563
+ id: (0, import_utils9.titleId)(fieldPathId),
524
564
  title,
525
565
  required,
526
566
  schema,
527
567
  uiSchema,
528
- registry
568
+ registry,
569
+ optionalDataControl: showOptionalDataControlInTitle ? optionalDataControl : void 0
529
570
  }
530
571
  ),
531
- description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
572
+ description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
532
573
  DescriptionFieldTemplate,
533
574
  {
534
- id: (0, import_utils8.descriptionId)(idSchema),
575
+ id: (0, import_utils9.descriptionId)(fieldPathId),
535
576
  description,
536
577
  schema,
537
578
  uiSchema,
538
579
  registry
539
580
  }
540
581
  ),
541
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `grid grid-cols-1 gap-${description ? 3 : 4} ${isRoot ? "" : "mb-4"}`, children: [
582
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `grid grid-cols-1 gap-${description ? 3 : 4} ${isRoot ? "" : "mb-4"}`, children: [
583
+ !showOptionalDataControlInTitle ? optionalDataControl : void 0,
542
584
  properties.map(
543
- (element, index) => element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
585
+ (element, index) => element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
544
586
  "div",
545
587
  {
546
- className: idSchema.$id === "root" && element.name === "tasks" ? "mt-2" : "",
588
+ className: fieldPathId.$id === "root" && element.name === "tasks" ? "mt-2" : "",
547
589
  children: element.content
548
590
  },
549
- `${idSchema.$id}-${element.name}-${index}`
591
+ `${fieldPathId.$id}-${element.name}-${index}`
550
592
  )
551
593
  ),
552
- (0, import_utils8.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
594
+ (0, import_utils9.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
553
595
  AddButton2,
554
596
  {
555
- id: (0, import_utils8.buttonId)(idSchema, "add"),
597
+ id: (0, import_utils9.buttonId)(fieldPathId, "add"),
556
598
  className: "rjsf-object-property-expand btn btn-primary btn-sm",
557
- onClick: onAddClick(schema),
599
+ onClick: onAddProperty,
558
600
  disabled: disabled || readonly,
559
601
  uiSchema,
560
602
  registry
@@ -564,22 +606,61 @@ function ObjectFieldTemplate(props) {
564
606
  ] });
565
607
  }
566
608
 
609
+ // src/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx
610
+ var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
611
+ var import_jsx_runtime17 = require("react/jsx-runtime");
612
+ function OptionalDataControlsTemplate(props) {
613
+ const { id, registry, label, onAddClick, onRemoveClick } = props;
614
+ if (onAddClick) {
615
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
616
+ DaisyUIButton_default,
617
+ {
618
+ id,
619
+ registry,
620
+ iconType: "info",
621
+ icon: import_free_solid_svg_icons3.faPlus,
622
+ className: "rjsf-add-optional-data",
623
+ onClick: onAddClick,
624
+ title: label
625
+ }
626
+ );
627
+ } else if (onRemoveClick) {
628
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
629
+ RemoveButton,
630
+ {
631
+ id,
632
+ registry,
633
+ className: "rjsf-remove-optional-data",
634
+ onClick: onRemoveClick,
635
+ title: label
636
+ }
637
+ );
638
+ }
639
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("em", { id, children: label });
640
+ }
641
+
567
642
  // src/templates/TitleField/TitleField.tsx
568
- var import_utils9 = require("@rjsf/utils");
569
- var import_jsx_runtime16 = require("react/jsx-runtime");
643
+ var import_utils10 = require("@rjsf/utils");
644
+ var import_jsx_runtime18 = require("react/jsx-runtime");
570
645
  function TitleField(props) {
571
- const { id, title, uiSchema } = props;
572
- const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
573
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { id, className: "title-field mb-6", children: [
574
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h2", { className: "text-3xl font-bold text-primary mb-2", children: uiOptions.title || title }),
575
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "divider divider-primary" })
646
+ const { id, title, uiSchema, optionalDataControl } = props;
647
+ const uiOptions = (0, import_utils10.getUiOptions)(uiSchema);
648
+ let heading = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h2", { className: "text-3xl font-bold text-primary mb-2", children: uiOptions.title || title });
649
+ if (optionalDataControl) {
650
+ heading = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex", children: [
651
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-auto", children: heading }),
652
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex justify-end", children: optionalDataControl })
653
+ ] });
654
+ }
655
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id, className: "title-field mb-6", children: [
656
+ heading,
657
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "divider divider-primary my-0" })
576
658
  ] });
577
659
  }
578
660
 
579
661
  // src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
580
- var import_react5 = require("react");
581
- var import_utils10 = require("@rjsf/utils");
582
- var import_jsx_runtime17 = require("react/jsx-runtime");
662
+ var import_utils11 = require("@rjsf/utils");
663
+ var import_jsx_runtime19 = require("react/jsx-runtime");
583
664
  function WrapIfAdditionalTemplate(props) {
584
665
  const {
585
666
  children,
@@ -590,47 +671,48 @@ function WrapIfAdditionalTemplate(props) {
590
671
  readonly,
591
672
  required,
592
673
  schema,
593
- onKeyChange,
594
- onDropPropertyClick,
674
+ uiSchema,
675
+ onKeyRename,
676
+ onKeyRenameBlur,
677
+ onRemoveProperty,
595
678
  registry,
596
679
  ...rest
597
680
  } = props;
598
- const { translateString } = registry;
599
- const handleBlur = (0, import_react5.useCallback)(
600
- (event) => {
601
- onKeyChange(event.target.value);
602
- },
603
- [onKeyChange]
604
- );
605
- const handleRemove = (0, import_react5.useCallback)(() => {
606
- onDropPropertyClick(label)();
607
- }, [onDropPropertyClick, label]);
608
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `wrap-if-additional-template ${classNames}`, ...rest, children: [
609
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center", children: [
610
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
681
+ const additional = import_utils11.ADDITIONAL_PROPERTY_FLAG in schema;
682
+ const { templates, translateString } = registry;
683
+ const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
684
+ const keyLabel = translateString(import_utils11.TranslatableString.KeyLabel, [label]);
685
+ if (!additional) {
686
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: classNames, children });
687
+ }
688
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `wrap-if-additional-template ${classNames}`, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-baseline", style: { justifyContent: "space-between" }, children: [
689
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
690
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { htmlFor: `${id}-key`, className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "label-text", children: keyLabel }) }),
691
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
611
692
  "input",
612
693
  {
613
694
  type: "text",
614
695
  className: "input input-bordered",
615
696
  id: `${id}-key`,
616
- onBlur: handleBlur,
697
+ onBlur: onKeyRenameBlur,
617
698
  defaultValue: label,
618
699
  disabled: disabled || readonly
619
700
  }
620
- ),
621
- schema.additionalProperties && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
622
- "button",
623
- {
624
- id: (0, import_utils10.buttonId)(id, "remove"),
625
- className: "rjsf-array-item-remove btn btn-danger ml-2",
626
- onClick: handleRemove,
627
- disabled: disabled || readonly,
628
- children: translateString(import_utils10.TranslatableString.RemoveButton)
629
- }
630
701
  )
631
702
  ] }),
632
- children
633
- ] });
703
+ children,
704
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex self-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
705
+ RemoveButton2,
706
+ {
707
+ id: (0, import_utils11.buttonId)(id, "remove"),
708
+ className: "rjsf-object-property-remove",
709
+ disabled: disabled || readonly,
710
+ onClick: onRemoveProperty,
711
+ uiSchema,
712
+ registry
713
+ }
714
+ ) })
715
+ ] }) });
634
716
  }
635
717
 
636
718
  // src/templates/Templates.tsx
@@ -654,7 +736,9 @@ function generateTemplates() {
654
736
  FieldHelpTemplate,
655
737
  FieldTemplate,
656
738
  GridTemplate,
739
+ MultiSchemaFieldTemplate,
657
740
  ObjectFieldTemplate,
741
+ OptionalDataControlsTemplate,
658
742
  TitleFieldTemplate: TitleField,
659
743
  WrapIfAdditionalTemplate
660
744
  };
@@ -662,168 +746,42 @@ function generateTemplates() {
662
746
  var Templates_default = generateTemplates();
663
747
 
664
748
  // src/widgets/AltDateTimeWidget/AltDateTimeWidget.tsx
665
- var import_jsx_runtime18 = require("react/jsx-runtime");
749
+ var import_jsx_runtime20 = require("react/jsx-runtime");
666
750
  function AltDateTimeWidget({
667
751
  time = true,
668
752
  ...props
669
753
  }) {
670
754
  const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
671
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AltDateWidget2, { time, ...props });
755
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltDateWidget2, { time, ...props });
672
756
  }
673
757
  var AltDateTimeWidget_default = AltDateTimeWidget;
674
758
 
675
759
  // src/widgets/AltDateWidget/AltDateWidget.tsx
676
- var import_react6 = require("react");
677
- var import_utils11 = require("@rjsf/utils");
678
- var import_jsx_runtime19 = require("react/jsx-runtime");
679
- function readyForChange(state, time = false) {
680
- return state.year && state.month && state.day && (!time || state.hour && state.minute && state.second);
681
- }
682
- function getDateElementProps(state, time, yearsRange, format3 = "YMD") {
683
- const rangeOptions = yearsRange ?? [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2];
684
- const formats = {
685
- YMD: ["year", "month", "day"],
686
- MDY: ["month", "day", "year"],
687
- DMY: ["day", "month", "year"]
688
- };
689
- const dateElements = formats[format3].map((key) => ({
690
- type: key,
691
- value: state[key],
692
- range: key === "year" ? rangeOptions : key === "month" ? [1, 12] : key === "day" ? [1, 31] : [0, 59]
693
- }));
694
- if (time) {
695
- dateElements.push(
696
- { type: "hour", value: state.hour, range: [0, 23] },
697
- { type: "minute", value: state.minute, range: [0, 59] },
698
- { type: "second", value: state.second, range: [0, 59] }
699
- );
700
- }
701
- return dateElements;
702
- }
703
- function DateElement({
704
- type,
705
- range,
706
- value,
707
- select,
708
- rootId,
709
- name,
710
- disabled,
711
- readonly,
712
- autofocus,
713
- registry,
714
- onBlur,
715
- onFocus
716
- }) {
717
- const id = `${rootId}_${type}`;
718
- const { SelectWidget: SelectWidget2 } = registry.widgets;
719
- const handleChange = (0, import_react6.useCallback)(
720
- (value2) => {
721
- select(type, value2);
722
- },
723
- [select, type]
724
- );
725
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
726
- SelectWidget2,
727
- {
728
- schema: { type: "integer" },
729
- id,
730
- name,
731
- className: "select select-bordered select-sm w-full",
732
- options: { enumOptions: (0, import_utils11.dateRangeOptions)(range[0], range[1]) },
733
- placeholder: type,
734
- value,
735
- disabled,
736
- readonly,
737
- autofocus,
738
- onChange: handleChange,
739
- onBlur,
740
- onFocus,
741
- registry,
742
- label: "",
743
- "aria-describedby": (0, import_utils11.ariaDescribedByIds)(rootId),
744
- required: false
745
- }
746
- );
747
- }
748
- function convertToRJSFDateObject(dateObj) {
749
- return {
750
- year: dateObj.year ? parseInt(dateObj.year) : 0,
751
- month: dateObj.month ? parseInt(dateObj.month) : 0,
752
- day: dateObj.day ? parseInt(dateObj.day) : 0,
753
- hour: dateObj.hour ? parseInt(dateObj.hour) : 0,
754
- minute: dateObj.minute ? parseInt(dateObj.minute) : 0,
755
- second: dateObj.second ? parseInt(dateObj.second) : 0
756
- };
757
- }
758
- function AltDateWidget({
759
- time = false,
760
- disabled = false,
761
- readonly = false,
762
- autofocus = false,
763
- options = {},
764
- id,
765
- name,
766
- registry,
767
- onBlur,
768
- onFocus,
769
- onChange,
770
- value
771
- }) {
760
+ var import_utils12 = require("@rjsf/utils");
761
+ var import_jsx_runtime21 = require("react/jsx-runtime");
762
+ function AltDateWidget(props) {
763
+ const {
764
+ disabled = false,
765
+ readonly = false,
766
+ autofocus = false,
767
+ options = {},
768
+ id,
769
+ name,
770
+ registry,
771
+ onBlur,
772
+ onFocus
773
+ } = props;
772
774
  const { translateString } = registry;
773
- const [lastValue, setLastValue] = (0, import_react6.useState)(value);
774
- const initialState = (0, import_utils11.parseDateString)(value, time);
775
- const dateReducer = (state2, action) => {
776
- return { ...state2, ...action };
777
- };
778
- const [state, setState] = (0, import_react6.useReducer)(dateReducer, initialState);
779
- (0, import_react6.useEffect)(() => {
780
- const rjsfDateObj = convertToRJSFDateObject(state);
781
- const stateValue = (0, import_utils11.toDateString)(rjsfDateObj, time);
782
- if (readyForChange(state, time) && stateValue !== value) {
783
- onChange(stateValue);
784
- } else if (lastValue !== value) {
785
- setLastValue(value);
786
- setState((0, import_utils11.parseDateString)(value, time));
787
- }
788
- }, [time, value, onChange, state, lastValue]);
789
- const handleChange = (0, import_react6.useCallback)((property, value2) => {
790
- setState({ [property]: value2 });
791
- }, []);
792
- const handleSetNow = (0, import_react6.useCallback)(
793
- (event) => {
794
- event.preventDefault();
795
- if (disabled || readonly) {
796
- return;
797
- }
798
- const nextState = (0, import_utils11.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), time);
799
- const rjsfDateObj = convertToRJSFDateObject(nextState);
800
- onChange((0, import_utils11.toDateString)(rjsfDateObj, time));
801
- },
802
- [disabled, readonly, time, onChange]
803
- );
804
- const handleClear = (0, import_react6.useCallback)(
805
- (event) => {
806
- event.preventDefault();
807
- if (disabled || readonly) {
808
- return;
809
- }
810
- onChange(void 0);
811
- },
812
- [disabled, readonly, onChange]
813
- );
814
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-3", children: [
815
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "grid grid-cols-3 gap-2", children: getDateElementProps(
816
- state,
817
- time,
818
- options.yearsRange,
819
- options.format
820
- ).map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "form-control", children: [
821
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "label-text capitalize", children: elemProps.type }) }),
822
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
823
- DateElement,
775
+ const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils12.useAltDateWidgetProps)(props);
776
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-3", children: [
777
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-3 gap-2", children: elements.map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "form-control", children: [
778
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "label-text capitalize", children: elemProps.type }) }),
779
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
780
+ import_utils12.DateElement,
824
781
  {
825
782
  rootId: id,
826
783
  name,
784
+ className: "select select-bordered select-sm",
827
785
  select: handleChange,
828
786
  type: elemProps.type,
829
787
  range: elemProps.range,
@@ -837,25 +795,25 @@ function AltDateWidget({
837
795
  }
838
796
  )
839
797
  ] }, i)) }),
840
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex justify-start space-x-2", children: [
841
- (options.hideNowButton !== void 0 ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
798
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex justify-start space-x-2", children: [
799
+ (options.hideNowButton !== void 0 ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
842
800
  "button",
843
801
  {
844
802
  type: "button",
845
803
  className: "btn btn-sm btn-primary",
846
804
  onClick: handleSetNow,
847
805
  disabled: disabled || readonly,
848
- children: translateString(import_utils11.TranslatableString.NowLabel)
806
+ children: translateString(import_utils12.TranslatableString.NowLabel)
849
807
  }
850
808
  ),
851
- (options.hideClearButton !== void 0 ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
809
+ (options.hideClearButton !== void 0 ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
852
810
  "button",
853
811
  {
854
812
  type: "button",
855
813
  className: "btn btn-sm btn-secondary",
856
814
  onClick: handleClear,
857
815
  disabled: disabled || readonly,
858
- children: translateString(import_utils11.TranslatableString.ClearLabel)
816
+ children: translateString(import_utils12.TranslatableString.ClearLabel)
859
817
  }
860
818
  )
861
819
  ] })
@@ -863,12 +821,13 @@ function AltDateWidget({
863
821
  }
864
822
 
865
823
  // src/widgets/CheckboxWidget/CheckboxWidget.tsx
866
- var import_react7 = require("react");
867
- var import_utils12 = require("@rjsf/utils");
868
- var import_jsx_runtime20 = require("react/jsx-runtime");
824
+ var import_react4 = require("react");
825
+ var import_utils13 = require("@rjsf/utils");
826
+ var import_jsx_runtime22 = require("react/jsx-runtime");
869
827
  function CheckboxWidget(props) {
870
828
  const {
871
829
  id,
830
+ htmlName,
872
831
  value,
873
832
  required,
874
833
  disabled,
@@ -883,33 +842,34 @@ function CheckboxWidget(props) {
883
842
  onFocus,
884
843
  onBlur
885
844
  } = props;
886
- const DescriptionFieldTemplate = (0, import_utils12.getTemplate)(
845
+ const DescriptionFieldTemplate = (0, import_utils13.getTemplate)(
887
846
  "DescriptionFieldTemplate",
888
847
  registry,
889
848
  options
890
849
  );
891
850
  const description = options.description || schema.description;
892
- const handleFocus = (0, import_react7.useCallback)(() => {
851
+ const handleFocus = (0, import_react4.useCallback)(() => {
893
852
  if (onFocus) {
894
853
  onFocus(id, value);
895
854
  }
896
855
  }, [onFocus, id, value]);
897
- const handleBlur = (0, import_react7.useCallback)(() => {
856
+ const handleBlur = (0, import_react4.useCallback)(() => {
898
857
  if (onBlur) {
899
858
  onBlur(id, value);
900
859
  }
901
860
  }, [onBlur, id, value]);
902
- const handleChange = (0, import_react7.useCallback)(
861
+ const handleChange = (0, import_react4.useCallback)(
903
862
  (event) => {
904
863
  onChange(event.target.checked);
905
864
  },
906
865
  [onChange]
907
866
  );
908
- const input = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
867
+ const input = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
909
868
  "input",
910
869
  {
911
870
  type: "checkbox",
912
871
  id,
872
+ name: htmlName || id,
913
873
  checked: value,
914
874
  required,
915
875
  disabled: disabled || readonly,
@@ -919,32 +879,33 @@ function CheckboxWidget(props) {
919
879
  className: "checkbox"
920
880
  }
921
881
  );
922
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "form-control", children: [
923
- !hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
882
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "form-control", children: [
883
+ !hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
924
884
  DescriptionFieldTemplate,
925
885
  {
926
- id: (0, import_utils12.descriptionId)(id),
886
+ id: (0, import_utils13.descriptionId)(id),
927
887
  description,
928
888
  schema,
929
889
  uiSchema,
930
890
  registry
931
891
  }
932
892
  ),
933
- hideLabel || !label ? input : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "label cursor-pointer justify-start", children: [
934
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "mr-2", children: input }),
935
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "label-text", children: [
893
+ hideLabel || !label ? input : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "label cursor-pointer justify-start", children: [
894
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mr-2", children: input }),
895
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "label-text", children: [
936
896
  label,
937
- required && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-error ml-1", children: "*" })
897
+ required && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-error ml-1", children: "*" })
938
898
  ] })
939
899
  ] })
940
900
  ] });
941
901
  }
942
902
 
943
903
  // src/widgets/CheckboxesWidget/CheckboxesWidget.tsx
944
- var import_react8 = require("react");
945
- var import_jsx_runtime21 = require("react/jsx-runtime");
904
+ var import_react5 = require("react");
905
+ var import_jsx_runtime23 = require("react/jsx-runtime");
946
906
  function CheckboxesWidget({
947
907
  id,
908
+ htmlName,
948
909
  disabled,
949
910
  options,
950
911
  value,
@@ -956,7 +917,7 @@ function CheckboxesWidget({
956
917
  }) {
957
918
  const { enumOptions } = options;
958
919
  const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
959
- const isChecked = (0, import_react8.useCallback)(
920
+ const isChecked = (0, import_react5.useCallback)(
960
921
  (option) => {
961
922
  if (!Array.isArray(value)) {
962
923
  return false;
@@ -968,7 +929,7 @@ function CheckboxesWidget({
968
929
  },
969
930
  [value, isEnumeratedObject]
970
931
  );
971
- const handleChange = (0, import_react8.useCallback)(
932
+ const handleChange = (0, import_react5.useCallback)(
972
933
  (event) => {
973
934
  const index = Number(event.target.dataset.index);
974
935
  const option = enumOptions?.[index];
@@ -985,7 +946,7 @@ function CheckboxesWidget({
985
946
  },
986
947
  [onChange, value, isChecked, isEnumeratedObject, enumOptions]
987
948
  );
988
- const handleFocus = (0, import_react8.useCallback)(
949
+ const handleFocus = (0, import_react5.useCallback)(
989
950
  (event) => {
990
951
  if (onFocus) {
991
952
  const index = Number(event.target.dataset.index);
@@ -997,7 +958,7 @@ function CheckboxesWidget({
997
958
  },
998
959
  [onFocus, id, enumOptions]
999
960
  );
1000
- const handleBlur = (0, import_react8.useCallback)(
961
+ const handleBlur = (0, import_react5.useCallback)(
1001
962
  (event) => {
1002
963
  if (onBlur) {
1003
964
  const index = Number(event.target.dataset.index);
@@ -1009,14 +970,14 @@ function CheckboxesWidget({
1009
970
  },
1010
971
  [onBlur, id, enumOptions]
1011
972
  );
1012
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex flex-col gap-2 mt-1", children: enumOptions?.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center cursor-pointer gap-2", children: [
1013
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
973
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col gap-2 mt-1", children: enumOptions?.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center cursor-pointer gap-2", children: [
974
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1014
975
  "input",
1015
976
  {
1016
977
  type: "checkbox",
1017
978
  id: `${id}-${option.value}`,
1018
979
  className: "checkbox",
1019
- name: id,
980
+ name: htmlName || id,
1020
981
  checked: isChecked(option),
1021
982
  required,
1022
983
  disabled: disabled || readonly,
@@ -1026,25 +987,25 @@ function CheckboxesWidget({
1026
987
  onBlur: handleBlur
1027
988
  }
1028
989
  ),
1029
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "label-text", children: option.label })
990
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "label-text", children: option.label })
1030
991
  ] }, option.value)) }) });
1031
992
  }
1032
993
 
1033
994
  // src/widgets/DateTimeWidget/DateTimeWidget.tsx
1034
- var import_react9 = require("react");
1035
- var import_free_solid_svg_icons3 = require("@fortawesome/free-solid-svg-icons");
995
+ var import_react6 = require("react");
996
+ var import_free_solid_svg_icons4 = require("@fortawesome/free-solid-svg-icons");
1036
997
  var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
1037
998
  var import_date_fns = require("date-fns");
1038
999
  var import_react_day_picker = require("react-day-picker");
1039
1000
  var import_style = require("react-day-picker/dist/style.css");
1040
- var import_jsx_runtime22 = require("react/jsx-runtime");
1001
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1041
1002
  function useDatePickerState(initialDate) {
1042
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
1043
- const [month, setMonth] = (0, import_react9.useState)(initialDate ?? /* @__PURE__ */ new Date());
1003
+ const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
1004
+ const [month, setMonth] = (0, import_react6.useState)(initialDate ?? /* @__PURE__ */ new Date());
1044
1005
  return { isOpen, setIsOpen, month, setMonth };
1045
1006
  }
1046
1007
  function useClickOutside(ref, callback) {
1047
- (0, import_react9.useEffect)(() => {
1008
+ (0, import_react6.useEffect)(() => {
1048
1009
  const handleClickOutside = (event) => {
1049
1010
  if (ref.current && !ref.current.contains(event.target)) {
1050
1011
  callback();
@@ -1089,11 +1050,11 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
1089
1050
  ...dayPickerStyles.modifiers,
1090
1051
  "custom-today": "btn btn-outline btn-info min-h-0 h-full"
1091
1052
  };
1092
- const handleClick = (0, import_react9.useCallback)((e) => {
1053
+ const handleClick = (0, import_react6.useCallback)((e) => {
1093
1054
  e.stopPropagation();
1094
1055
  }, []);
1095
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "p-3", children: [
1096
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1056
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "p-3", children: [
1057
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1097
1058
  import_react_day_picker.DayPicker,
1098
1059
  {
1099
1060
  mode: "single",
@@ -1110,9 +1071,9 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
1110
1071
  modifiersClassNames: customModifiersClassNames
1111
1072
  }
1112
1073
  ),
1113
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-3 border-t border-base-300 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "form-control w-full", children: [
1114
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "label-text", children: "Time" }) }),
1115
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1074
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-3 border-t border-base-300 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "form-control w-full", children: [
1075
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("label", { className: "label", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "label-text", children: "Time" }) }),
1076
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1116
1077
  "input",
1117
1078
  {
1118
1079
  type: "time",
@@ -1125,17 +1086,17 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
1125
1086
  ] }) })
1126
1087
  ] });
1127
1088
  }
1128
- var MemoizedDateTimePickerPopup = (0, import_react9.memo)(DateTimePickerPopup);
1089
+ var MemoizedDateTimePickerPopup = (0, import_react6.memo)(DateTimePickerPopup);
1129
1090
  function DateTimeWidget(props) {
1130
1091
  const { id, value, onChange, onFocus, onBlur, schema } = props;
1131
- const initialDate = (0, import_react9.useMemo)(() => value ? new Date(value) : void 0, [value]);
1132
- const [localDate, setLocalDate] = (0, import_react9.useState)(initialDate);
1133
- (0, import_react9.useEffect)(() => {
1092
+ const initialDate = (0, import_react6.useMemo)(() => value ? new Date(value) : void 0, [value]);
1093
+ const [localDate, setLocalDate] = (0, import_react6.useState)(initialDate);
1094
+ (0, import_react6.useEffect)(() => {
1134
1095
  setLocalDate(initialDate);
1135
1096
  }, [initialDate]);
1136
1097
  const { isOpen, setIsOpen, month, setMonth } = useDatePickerState(initialDate);
1137
- const containerRef = (0, import_react9.useRef)(null);
1138
- const inputRef = (0, import_react9.useRef)(null);
1098
+ const containerRef = (0, import_react6.useRef)(null);
1099
+ const inputRef = (0, import_react6.useRef)(null);
1139
1100
  useClickOutside(containerRef, () => {
1140
1101
  if (isOpen) {
1141
1102
  setIsOpen(false);
@@ -1145,13 +1106,13 @@ function DateTimeWidget(props) {
1145
1106
  }
1146
1107
  }
1147
1108
  });
1148
- (0, import_react9.useEffect)(() => {
1109
+ (0, import_react6.useEffect)(() => {
1149
1110
  if (localDate) {
1150
1111
  setMonth(localDate);
1151
1112
  }
1152
1113
  }, [localDate, setMonth]);
1153
- const handleMonthChange = (0, import_react9.useCallback)((date) => setMonth(date), [setMonth]);
1154
- const handleSelect = (0, import_react9.useCallback)(
1114
+ const handleMonthChange = (0, import_react6.useCallback)((date) => setMonth(date), [setMonth]);
1115
+ const handleSelect = (0, import_react6.useCallback)(
1155
1116
  (date) => {
1156
1117
  if (date) {
1157
1118
  if (localDate) {
@@ -1162,7 +1123,7 @@ function DateTimeWidget(props) {
1162
1123
  },
1163
1124
  [localDate]
1164
1125
  );
1165
- const handleTimeChange = (0, import_react9.useCallback)(
1126
+ const handleTimeChange = (0, import_react6.useCallback)(
1166
1127
  (e) => {
1167
1128
  if (localDate) {
1168
1129
  const [hours, minutes] = e.target.value.split(":");
@@ -1173,7 +1134,7 @@ function DateTimeWidget(props) {
1173
1134
  },
1174
1135
  [localDate]
1175
1136
  );
1176
- const togglePicker = (0, import_react9.useCallback)(
1137
+ const togglePicker = (0, import_react6.useCallback)(
1177
1138
  (e) => {
1178
1139
  e.stopPropagation();
1179
1140
  setIsOpen((prev) => !prev);
@@ -1183,17 +1144,17 @@ function DateTimeWidget(props) {
1183
1144
  },
1184
1145
  [isOpen, id, onFocus, setIsOpen, value]
1185
1146
  );
1186
- const handleFocus = (0, import_react9.useCallback)(() => {
1147
+ const handleFocus = (0, import_react6.useCallback)(() => {
1187
1148
  if (onFocus) {
1188
1149
  onFocus(id, value);
1189
1150
  }
1190
1151
  }, [id, onFocus, value]);
1191
- const handleBlur = (0, import_react9.useCallback)(() => {
1152
+ const handleBlur = (0, import_react6.useCallback)(() => {
1192
1153
  if (!isOpen && onBlur) {
1193
1154
  onBlur(id, value);
1194
1155
  }
1195
1156
  }, [id, onBlur, value, isOpen]);
1196
- const handleKeyDown = (0, import_react9.useCallback)(
1157
+ const handleKeyDown = (0, import_react6.useCallback)(
1197
1158
  (e) => {
1198
1159
  if (e.key === "Enter" || e.key === " ") {
1199
1160
  togglePicker(e);
@@ -1201,10 +1162,10 @@ function DateTimeWidget(props) {
1201
1162
  },
1202
1163
  [togglePicker]
1203
1164
  );
1204
- const handleContainerClick = (0, import_react9.useCallback)((e) => {
1165
+ const handleContainerClick = (0, import_react6.useCallback)((e) => {
1205
1166
  e.stopPropagation();
1206
1167
  }, []);
1207
- (0, import_react9.useEffect)(() => {
1168
+ (0, import_react6.useEffect)(() => {
1208
1169
  const handleEscape = (e) => {
1209
1170
  if (e.key === "Escape" && isOpen) {
1210
1171
  setIsOpen(false);
@@ -1215,16 +1176,16 @@ function DateTimeWidget(props) {
1215
1176
  };
1216
1177
  document.addEventListener("keydown", handleEscape);
1217
1178
  return () => document.removeEventListener("keydown", handleEscape);
1218
- }, [id, isOpen, onBlur, value]);
1219
- const handleDoneClick = (0, import_react9.useCallback)(() => {
1179
+ }, [id, isOpen, setIsOpen, onBlur, value]);
1180
+ const handleDoneClick = (0, import_react6.useCallback)(() => {
1220
1181
  setIsOpen(false);
1221
1182
  onChange(localDate ? localDate.toISOString() : "");
1222
1183
  if (onBlur) {
1223
1184
  onBlur(id, value);
1224
1185
  }
1225
1186
  inputRef.current?.focus();
1226
- }, [localDate, onChange, onBlur, id, value]);
1227
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "form-control my-4 w-full relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1187
+ }, [localDate, onChange, onBlur, id, value, setIsOpen]);
1188
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "form-control my-4 w-full relative", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1228
1189
  "div",
1229
1190
  {
1230
1191
  className: "w-full",
@@ -1234,7 +1195,7 @@ function DateTimeWidget(props) {
1234
1195
  onBlur: handleBlur,
1235
1196
  ref: inputRef,
1236
1197
  children: [
1237
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1198
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1238
1199
  "div",
1239
1200
  {
1240
1201
  id,
@@ -1245,19 +1206,19 @@ function DateTimeWidget(props) {
1245
1206
  "aria-expanded": isOpen,
1246
1207
  tabIndex: -1,
1247
1208
  children: [
1248
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: localDate && (0, import_date_fns.isValid)(localDate) ? "" : "text-base-content/50", children: localDate && (0, import_date_fns.isValid)(localDate) ? (0, import_date_fns.format)(localDate, "PP p") : schema.title }),
1249
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_fontawesome2.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faCalendar, className: "ml-2 h-4 w-4 text-primary" })
1209
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: localDate && (0, import_date_fns.isValid)(localDate) ? "" : "text-base-content/50", children: localDate && (0, import_date_fns.isValid)(localDate) ? (0, import_date_fns.format)(localDate, "PP p") : schema.title }),
1210
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_fontawesome2.FontAwesomeIcon, { icon: import_free_solid_svg_icons4.faCalendar, className: "ml-2 h-4 w-4 text-primary" })
1250
1211
  ]
1251
1212
  }
1252
1213
  ),
1253
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1214
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1254
1215
  "div",
1255
1216
  {
1256
1217
  ref: containerRef,
1257
1218
  className: "absolute z-[100] mt-2 w-full max-w-xs bg-base-100 border border-base-300 shadow-lg rounded-box",
1258
1219
  onClick: handleContainerClick,
1259
1220
  children: [
1260
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1221
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1261
1222
  MemoizedDateTimePickerPopup,
1262
1223
  {
1263
1224
  selectedDate: localDate,
@@ -1267,7 +1228,7 @@ function DateTimeWidget(props) {
1267
1228
  onTimeChange: handleTimeChange
1268
1229
  }
1269
1230
  ),
1270
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "p-3 flex justify-end border-t border-base-300", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: handleDoneClick, children: "Done" }) })
1231
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "p-3 flex justify-end border-t border-base-300", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: handleDoneClick, children: "Done" }) })
1271
1232
  ]
1272
1233
  }
1273
1234
  )
@@ -1277,20 +1238,20 @@ function DateTimeWidget(props) {
1277
1238
  }
1278
1239
 
1279
1240
  // src/widgets/DateWidget/DateWidget.tsx
1280
- var import_react10 = require("react");
1281
- var import_free_solid_svg_icons4 = require("@fortawesome/free-solid-svg-icons");
1241
+ var import_react7 = require("react");
1242
+ var import_free_solid_svg_icons5 = require("@fortawesome/free-solid-svg-icons");
1282
1243
  var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
1283
1244
  var import_date_fns2 = require("date-fns");
1284
1245
  var import_react_day_picker2 = require("react-day-picker");
1285
1246
  var import_style2 = require("react-day-picker/dist/style.css");
1286
- var import_jsx_runtime23 = require("react/jsx-runtime");
1247
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1287
1248
  function useDatePickerState2(initialDate) {
1288
- const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
1289
- const [month, setMonth] = (0, import_react10.useState)(initialDate ?? /* @__PURE__ */ new Date());
1249
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
1250
+ const [month, setMonth] = (0, import_react7.useState)(initialDate ?? /* @__PURE__ */ new Date());
1290
1251
  return { isOpen, setIsOpen, month, setMonth };
1291
1252
  }
1292
1253
  function useClickOutside2(ref, callback) {
1293
- (0, import_react10.useEffect)(() => {
1254
+ (0, import_react7.useEffect)(() => {
1294
1255
  const handleClickOutside = (event) => {
1295
1256
  if (ref.current && !ref.current.contains(event.target)) {
1296
1257
  callback();
@@ -1335,7 +1296,7 @@ function DatePickerPopup({ selectedDate, month, onMonthChange, onSelect }) {
1335
1296
  ...dayPickerStyles2.modifiers,
1336
1297
  "custom-today": "btn btn-outline btn-info min-h-0 h-full"
1337
1298
  };
1338
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-3", style: { minWidth: "320px", minHeight: "350px" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1299
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "p-3", style: { minWidth: "320px", minHeight: "350px" }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1339
1300
  import_react_day_picker2.DayPicker,
1340
1301
  {
1341
1302
  mode: "single",
@@ -1353,17 +1314,17 @@ function DatePickerPopup({ selectedDate, month, onMonthChange, onSelect }) {
1353
1314
  }
1354
1315
  ) });
1355
1316
  }
1356
- var MemoizedDatePickerPopup = (0, import_react10.memo)(DatePickerPopup);
1317
+ var MemoizedDatePickerPopup = (0, import_react7.memo)(DatePickerPopup);
1357
1318
  function DateWidget(props) {
1358
1319
  const { id, value, onChange, onFocus, onBlur, schema } = props;
1359
- const initialDate = (0, import_react10.useMemo)(() => value ? new Date(value) : void 0, [value]);
1360
- const [localDate, setLocalDate] = (0, import_react10.useState)(initialDate);
1361
- (0, import_react10.useEffect)(() => {
1320
+ const initialDate = (0, import_react7.useMemo)(() => value ? new Date(value) : void 0, [value]);
1321
+ const [localDate, setLocalDate] = (0, import_react7.useState)(initialDate);
1322
+ (0, import_react7.useEffect)(() => {
1362
1323
  setLocalDate(initialDate);
1363
1324
  }, [initialDate]);
1364
1325
  const { isOpen, setIsOpen, month, setMonth } = useDatePickerState2(initialDate);
1365
- const containerRef = (0, import_react10.useRef)(null);
1366
- const inputRef = (0, import_react10.useRef)(null);
1326
+ const containerRef = (0, import_react7.useRef)(null);
1327
+ const inputRef = (0, import_react7.useRef)(null);
1367
1328
  useClickOutside2(containerRef, () => {
1368
1329
  if (isOpen) {
1369
1330
  setIsOpen(false);
@@ -1373,19 +1334,19 @@ function DateWidget(props) {
1373
1334
  }
1374
1335
  }
1375
1336
  });
1376
- (0, import_react10.useEffect)(() => {
1337
+ (0, import_react7.useEffect)(() => {
1377
1338
  if (localDate) {
1378
1339
  setMonth(localDate);
1379
1340
  }
1380
1341
  }, [localDate, setMonth]);
1381
- const handleMonthChange = (0, import_react10.useCallback)((date) => setMonth(date), [setMonth]);
1382
- const handleSelect = (0, import_react10.useCallback)((date) => {
1342
+ const handleMonthChange = (0, import_react7.useCallback)((date) => setMonth(date), [setMonth]);
1343
+ const handleSelect = (0, import_react7.useCallback)((date) => {
1383
1344
  if (date) {
1384
1345
  date.setHours(0, 0, 0, 0);
1385
1346
  setLocalDate(date);
1386
1347
  }
1387
1348
  }, []);
1388
- (0, import_react10.useEffect)(() => {
1349
+ (0, import_react7.useEffect)(() => {
1389
1350
  let portalContainer = document.getElementById("date-picker-portal");
1390
1351
  if (!portalContainer) {
1391
1352
  portalContainer = document.createElement("div");
@@ -1417,7 +1378,7 @@ function DateWidget(props) {
1417
1378
  }
1418
1379
  return { doc, win };
1419
1380
  };
1420
- const renderCalendar = (0, import_react10.useCallback)(() => {
1381
+ const renderCalendar = (0, import_react7.useCallback)(() => {
1421
1382
  if (!containerRef.current || !inputRef.current) {
1422
1383
  return;
1423
1384
  }
@@ -1435,7 +1396,7 @@ function DateWidget(props) {
1435
1396
  }
1436
1397
  containerRef.current.style.zIndex = "99999";
1437
1398
  }, [containerRef, inputRef]);
1438
- (0, import_react10.useEffect)(() => {
1399
+ (0, import_react7.useEffect)(() => {
1439
1400
  if (!isOpen) {
1440
1401
  return;
1441
1402
  }
@@ -1447,7 +1408,7 @@ function DateWidget(props) {
1447
1408
  window.removeEventListener("scroll", renderCalendar);
1448
1409
  };
1449
1410
  }, [isOpen, renderCalendar]);
1450
- const togglePicker = (0, import_react10.useCallback)(
1411
+ const togglePicker = (0, import_react7.useCallback)(
1451
1412
  (e) => {
1452
1413
  e.stopPropagation();
1453
1414
  setIsOpen((prev) => !prev);
@@ -1457,17 +1418,17 @@ function DateWidget(props) {
1457
1418
  },
1458
1419
  [isOpen, id, onFocus, setIsOpen, value]
1459
1420
  );
1460
- const handleFocus = (0, import_react10.useCallback)(() => {
1421
+ const handleFocus = (0, import_react7.useCallback)(() => {
1461
1422
  if (onFocus) {
1462
1423
  onFocus(id, value);
1463
1424
  }
1464
1425
  }, [id, onFocus, value]);
1465
- const handleBlur = (0, import_react10.useCallback)(() => {
1426
+ const handleBlur = (0, import_react7.useCallback)(() => {
1466
1427
  if (!isOpen && onBlur) {
1467
1428
  onBlur(id, value);
1468
1429
  }
1469
1430
  }, [id, onBlur, value, isOpen]);
1470
- (0, import_react10.useEffect)(() => {
1431
+ (0, import_react7.useEffect)(() => {
1471
1432
  const handleEscape = (e) => {
1472
1433
  if (e.key === "Escape" && isOpen) {
1473
1434
  setIsOpen(false);
@@ -1478,16 +1439,16 @@ function DateWidget(props) {
1478
1439
  };
1479
1440
  document.addEventListener("keydown", handleEscape);
1480
1441
  return () => document.removeEventListener("keydown", handleEscape);
1481
- }, [id, isOpen, onBlur, value]);
1482
- const handleDoneClick = (0, import_react10.useCallback)(() => {
1442
+ }, [id, isOpen, setIsOpen, onBlur, value]);
1443
+ const handleDoneClick = (0, import_react7.useCallback)(() => {
1483
1444
  setIsOpen(false);
1484
1445
  onChange(localDate ? localDate.toISOString() : "");
1485
1446
  if (onBlur) {
1486
1447
  onBlur(id, value);
1487
1448
  }
1488
1449
  inputRef.current?.focus();
1489
- }, [localDate, onChange, onBlur, id, value]);
1490
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "form-control my-4 w-full relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1450
+ }, [localDate, onChange, onBlur, id, value, setIsOpen]);
1451
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "form-control my-4 w-full relative", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1491
1452
  "div",
1492
1453
  {
1493
1454
  className: "w-full",
@@ -1501,7 +1462,7 @@ function DateWidget(props) {
1501
1462
  onBlur: handleBlur,
1502
1463
  ref: inputRef,
1503
1464
  children: [
1504
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1465
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1505
1466
  "div",
1506
1467
  {
1507
1468
  id,
@@ -1512,12 +1473,12 @@ function DateWidget(props) {
1512
1473
  "aria-expanded": isOpen,
1513
1474
  tabIndex: -1,
1514
1475
  children: [
1515
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: localDate && (0, import_date_fns2.isValid)(localDate) ? "" : "text-base-content/50", children: localDate && (0, import_date_fns2.isValid)(localDate) ? (0, import_date_fns2.format)(localDate, "PP") : schema.title }),
1516
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons4.faCalendar, className: "ml-2 h-4 w-4 text-primary" })
1476
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: localDate && (0, import_date_fns2.isValid)(localDate) ? "" : "text-base-content/50", children: localDate && (0, import_date_fns2.isValid)(localDate) ? (0, import_date_fns2.format)(localDate, "PP") : schema.title }),
1477
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons5.faCalendar, className: "ml-2 h-4 w-4 text-primary" })
1517
1478
  ]
1518
1479
  }
1519
1480
  ),
1520
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1481
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1521
1482
  "div",
1522
1483
  {
1523
1484
  ref: containerRef,
@@ -1528,7 +1489,7 @@ function DateWidget(props) {
1528
1489
  },
1529
1490
  onClick: (e) => e.stopPropagation(),
1530
1491
  children: [
1531
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1492
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1532
1493
  MemoizedDatePickerPopup,
1533
1494
  {
1534
1495
  selectedDate: localDate,
@@ -1537,7 +1498,7 @@ function DateWidget(props) {
1537
1498
  onSelect: handleSelect
1538
1499
  }
1539
1500
  ),
1540
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-3 flex justify-end border-t border-base-300", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: handleDoneClick, children: "Done" }) })
1501
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "p-3 flex justify-end border-t border-base-300", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "btn btn-sm btn-primary", onClick: handleDoneClick, children: "Done" }) })
1541
1502
  ]
1542
1503
  }
1543
1504
  )
@@ -1546,65 +1507,12 @@ function DateWidget(props) {
1546
1507
  ) });
1547
1508
  }
1548
1509
 
1549
- // src/widgets/FileWidget/FileWidget.tsx
1550
- var import_react11 = require("react");
1551
- var import_jsx_runtime24 = require("react/jsx-runtime");
1552
- function FileWidget(props) {
1553
- const { id, required, disabled, readonly, schema, onChange, onFocus, onBlur, options = {} } = props;
1554
- const isMulti = schema.type === "array" || Boolean(options.multiple);
1555
- const accept = typeof options.accept === "string" ? options.accept : void 0;
1556
- const handleChange = (0, import_react11.useCallback)(
1557
- (event) => {
1558
- if (!event.target.files) {
1559
- return;
1560
- }
1561
- const fileList = Array.from(event.target.files);
1562
- if (isMulti) {
1563
- onChange(fileList);
1564
- } else {
1565
- onChange(fileList[0] || null);
1566
- }
1567
- },
1568
- [onChange, isMulti]
1569
- );
1570
- const handleFocus = (0, import_react11.useCallback)(
1571
- (event) => {
1572
- if (onFocus) {
1573
- onFocus(id, event.target.files ? Array.from(event.target.files) : null);
1574
- }
1575
- },
1576
- [onFocus, id]
1577
- );
1578
- const handleBlur = (0, import_react11.useCallback)(
1579
- (event) => {
1580
- if (onBlur) {
1581
- onBlur(id, event.target.files ? Array.from(event.target.files) : null);
1582
- }
1583
- },
1584
- [onBlur, id]
1585
- );
1586
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1587
- "input",
1588
- {
1589
- id,
1590
- type: "file",
1591
- className: "file-input w-full",
1592
- required,
1593
- disabled: disabled || readonly,
1594
- onChange: handleChange,
1595
- onFocus: handleFocus,
1596
- onBlur: handleBlur,
1597
- multiple: isMulti,
1598
- accept
1599
- }
1600
- );
1601
- }
1602
-
1603
1510
  // src/widgets/RadioWidget/RadioWidget.tsx
1604
- var import_react12 = require("react");
1605
- var import_jsx_runtime25 = require("react/jsx-runtime");
1511
+ var import_react8 = require("react");
1512
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1606
1513
  function RadioWidget({
1607
1514
  id,
1515
+ htmlName,
1608
1516
  options,
1609
1517
  value,
1610
1518
  required,
@@ -1625,7 +1533,7 @@ function RadioWidget({
1625
1533
  }
1626
1534
  return value === option.value;
1627
1535
  };
1628
- const handleFocus = (0, import_react12.useCallback)(
1536
+ const handleFocus = (0, import_react8.useCallback)(
1629
1537
  (event) => {
1630
1538
  if (onFocus) {
1631
1539
  const index = Number(event.target.dataset.index);
@@ -1635,7 +1543,7 @@ function RadioWidget({
1635
1543
  },
1636
1544
  [onFocus, id, enumOptions]
1637
1545
  );
1638
- const handleBlur = (0, import_react12.useCallback)(
1546
+ const handleBlur = (0, import_react8.useCallback)(
1639
1547
  (event) => {
1640
1548
  if (onBlur) {
1641
1549
  const index = Number(event.target.dataset.index);
@@ -1645,7 +1553,7 @@ function RadioWidget({
1645
1553
  },
1646
1554
  [onBlur, id, enumOptions]
1647
1555
  );
1648
- const handleChange = (0, import_react12.useCallback)(
1556
+ const handleChange = (0, import_react8.useCallback)(
1649
1557
  (event) => {
1650
1558
  const index = Number(event.target.dataset.index);
1651
1559
  const option = enumOptions?.[index];
@@ -1656,14 +1564,14 @@ function RadioWidget({
1656
1564
  },
1657
1565
  [onChange, isEnumeratedObject, enumOptions]
1658
1566
  );
1659
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-col gap-2 mt-1", children: enumOptions?.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center cursor-pointer gap-2", children: [
1660
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1567
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-col gap-2 mt-1", children: enumOptions?.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center cursor-pointer gap-2", children: [
1568
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1661
1569
  "input",
1662
1570
  {
1663
1571
  type: "radio",
1664
1572
  id: `${id}-${option.value}`,
1665
1573
  className: "radio",
1666
- name: id,
1574
+ name: htmlName || id,
1667
1575
  value: getValue(option),
1668
1576
  checked: isChecked(option),
1669
1577
  required,
@@ -1674,13 +1582,13 @@ function RadioWidget({
1674
1582
  onBlur: handleBlur
1675
1583
  }
1676
1584
  ),
1677
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "label-text", children: option.label })
1585
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "label-text", children: option.label })
1678
1586
  ] }, option.value)) }) });
1679
1587
  }
1680
1588
 
1681
1589
  // src/widgets/RangeWidget/RangeWidget.tsx
1682
- var import_react13 = require("react");
1683
- var import_jsx_runtime26 = require("react/jsx-runtime");
1590
+ var import_react9 = require("react");
1591
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1684
1592
  function RangeWidget({
1685
1593
  id,
1686
1594
  value,
@@ -1702,14 +1610,14 @@ function RangeWidget({
1702
1610
  onBlur(id, event.target.value);
1703
1611
  }
1704
1612
  };
1705
- const handleChange = (0, import_react13.useCallback)(
1613
+ const handleChange = (0, import_react9.useCallback)(
1706
1614
  (event) => {
1707
1615
  onChange(event.target.value);
1708
1616
  },
1709
1617
  [onChange]
1710
1618
  );
1711
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center", children: [
1712
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1619
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
1620
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1713
1621
  "input",
1714
1622
  {
1715
1623
  type: "range",
@@ -1726,13 +1634,13 @@ function RangeWidget({
1726
1634
  onBlur: handleBlur
1727
1635
  }
1728
1636
  ),
1729
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "label-text ml-4", children: value })
1637
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "label-text ml-4", children: value })
1730
1638
  ] }) });
1731
1639
  }
1732
1640
 
1733
1641
  // src/widgets/RatingWidget/RatingWidget.tsx
1734
- var import_react14 = require("react");
1735
- var import_jsx_runtime27 = require("react/jsx-runtime");
1642
+ var import_react10 = require("react");
1643
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1736
1644
  function RatingWidget({
1737
1645
  id,
1738
1646
  value,
@@ -1751,13 +1659,13 @@ function RatingWidget({
1751
1659
  const min = schema.minimum || 0;
1752
1660
  const maskClass = shape === "heart" ? "mask-heart" : "mask-star-2";
1753
1661
  const sizeClass = size === "md" ? "" : `rating-${size}`;
1754
- const _onChange = (0, import_react14.useCallback)(
1662
+ const _onChange = (0, import_react10.useCallback)(
1755
1663
  ({ target: { value: value2 } }) => {
1756
1664
  onChange(parseInt(value2));
1757
1665
  },
1758
1666
  [onChange]
1759
1667
  );
1760
- const handleFocus = (0, import_react14.useCallback)(
1668
+ const handleFocus = (0, import_react10.useCallback)(
1761
1669
  (event) => {
1762
1670
  if (onFocus) {
1763
1671
  const starValue = Number(event.target.value);
@@ -1766,7 +1674,7 @@ function RatingWidget({
1766
1674
  },
1767
1675
  [onFocus, id]
1768
1676
  );
1769
- const handleBlur = (0, import_react14.useCallback)(
1677
+ const handleBlur = (0, import_react10.useCallback)(
1770
1678
  (event) => {
1771
1679
  if (onBlur) {
1772
1680
  const starValue = Number(event.target.value);
@@ -1783,9 +1691,9 @@ function RatingWidget({
1783
1691
  const colorIdx = Math.min(index, colors.length - 1);
1784
1692
  return `bg-${colors[colorIdx]}-400`;
1785
1693
  };
1786
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "form-control w-full", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `rating gap-1 ${sizeClass}`, children: [...Array(numStars)].map((_, index) => {
1694
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "form-control w-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: `rating gap-1 ${sizeClass}`, children: [...Array(numStars)].map((_, index) => {
1787
1695
  const starValue = min + index;
1788
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1696
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1789
1697
  "input",
1790
1698
  {
1791
1699
  type: "radio",
@@ -1807,9 +1715,9 @@ function RatingWidget({
1807
1715
  }
1808
1716
 
1809
1717
  // src/widgets/SelectWidget/SelectWidget.tsx
1810
- var import_react15 = require("react");
1811
- var import_utils13 = require("@rjsf/utils");
1812
- var import_jsx_runtime28 = require("react/jsx-runtime");
1718
+ var import_react11 = require("react");
1719
+ var import_utils14 = require("@rjsf/utils");
1720
+ var import_jsx_runtime29 = require("react/jsx-runtime");
1813
1721
  function SelectWidget({
1814
1722
  schema,
1815
1723
  id,
@@ -1839,7 +1747,7 @@ function SelectWidget({
1839
1747
  return String(val);
1840
1748
  };
1841
1749
  const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
1842
- const handleOptionClick = (0, import_react15.useCallback)(
1750
+ const handleOptionClick = (0, import_react11.useCallback)(
1843
1751
  (event) => {
1844
1752
  const index = Number(event.currentTarget.dataset.value);
1845
1753
  if (isNaN(index)) {
@@ -1847,40 +1755,40 @@ function SelectWidget({
1847
1755
  }
1848
1756
  if (multiple) {
1849
1757
  const currentValue = Array.isArray(value) ? value : [];
1850
- const optionValue = isEnumeratedObject ? enumOptions[index].value : (0, import_utils13.enumOptionsValueForIndex)(String(index), enumOptions, optEmptyVal);
1758
+ const optionValue = isEnumeratedObject ? enumOptions[index].value : (0, import_utils14.enumOptionsValueForIndex)(String(index), enumOptions, optEmptyVal);
1851
1759
  const newValue = currentValue.includes(optionValue) ? currentValue.filter((v) => v !== optionValue) : [...currentValue, optionValue];
1852
1760
  onChange(newValue);
1853
1761
  } else {
1854
1762
  onChange(
1855
- isEnumeratedObject ? enumOptions[index].value : (0, import_utils13.enumOptionsValueForIndex)(String(index), enumOptions, optEmptyVal)
1763
+ isEnumeratedObject ? enumOptions[index].value : (0, import_utils14.enumOptionsValueForIndex)(String(index), enumOptions, optEmptyVal)
1856
1764
  );
1857
1765
  }
1858
1766
  },
1859
1767
  [value, multiple, isEnumeratedObject, enumOptions, optEmptyVal, onChange]
1860
1768
  );
1861
- const _onBlur = (0, import_react15.useCallback)(
1769
+ const _onBlur = (0, import_react11.useCallback)(
1862
1770
  ({ target }) => {
1863
1771
  const dataValue = target?.getAttribute("data-value");
1864
1772
  if (dataValue !== null) {
1865
- onBlur(id, (0, import_utils13.enumOptionsValueForIndex)(dataValue, enumOptions, optEmptyVal));
1773
+ onBlur(id, (0, import_utils14.enumOptionsValueForIndex)(dataValue, enumOptions, optEmptyVal));
1866
1774
  }
1867
1775
  },
1868
1776
  [onBlur, id, enumOptions, optEmptyVal]
1869
1777
  );
1870
- const _onFocus = (0, import_react15.useCallback)(
1778
+ const _onFocus = (0, import_react11.useCallback)(
1871
1779
  ({ target }) => {
1872
1780
  const dataValue = target?.getAttribute("data-value");
1873
1781
  if (dataValue !== null) {
1874
- onFocus(id, (0, import_utils13.enumOptionsValueForIndex)(dataValue, enumOptions, optEmptyVal));
1782
+ onFocus(id, (0, import_utils14.enumOptionsValueForIndex)(dataValue, enumOptions, optEmptyVal));
1875
1783
  }
1876
1784
  },
1877
1785
  [onFocus, id, enumOptions, optEmptyVal]
1878
1786
  );
1879
- const selectedIndexes = (0, import_utils13.enumOptionsIndexForValue)(value, enumOptions, multiple);
1787
+ const selectedIndexes = (0, import_utils14.enumOptionsIndexForValue)(value, enumOptions, multiple);
1880
1788
  const selectedValues = Array.isArray(selectedIndexes) ? selectedIndexes : [selectedIndexes];
1881
1789
  const optionsList = enumOptions || (Array.isArray(schema.examples) ? schema.examples.map((example) => ({ value: example, label: example })) : []);
1882
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "form-control w-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "dropdown w-full", children: [
1883
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
1790
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "form-control w-full", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "dropdown w-full", children: [
1791
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
1884
1792
  "div",
1885
1793
  {
1886
1794
  tabIndex: 0,
@@ -1889,12 +1797,12 @@ function SelectWidget({
1889
1797
  onBlur: _onBlur,
1890
1798
  onFocus: _onFocus,
1891
1799
  children: [
1892
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "truncate", children: selectedValues.length > 0 ? selectedValues.map((index) => optionsList[Number(index)]?.label).join(", ") : placeholder || label || "Select..." }),
1893
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "ml-2", children: "\u25BC" })
1800
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "truncate", children: selectedValues.length > 0 ? selectedValues.map((index) => optionsList[Number(index)]?.label).join(", ") : placeholder || label || "Select..." }),
1801
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "ml-2", children: "\u25BC" })
1894
1802
  ]
1895
1803
  }
1896
1804
  ),
1897
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("ul", { className: "dropdown-content z-[1] bg-base-100 w-full max-h-60 overflow-auto rounded-box shadow-lg", children: optionsList.map(({ label: label2 }, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1805
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { className: "dropdown-content z-[1] bg-base-100 w-full max-h-60 overflow-auto rounded-box shadow-lg", children: optionsList.map(({ label: label2 }, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1898
1806
  "li",
1899
1807
  {
1900
1808
  role: "button",
@@ -1902,8 +1810,8 @@ function SelectWidget({
1902
1810
  className: `px-4 py-2 hover:bg-base-200 cursor-pointer ${selectedValues.includes(String(i)) ? "bg-primary/10" : ""}`,
1903
1811
  onClick: handleOptionClick,
1904
1812
  "data-value": i,
1905
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
1906
- multiple && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1813
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
1814
+ multiple && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1907
1815
  "input",
1908
1816
  {
1909
1817
  type: "checkbox",
@@ -1912,7 +1820,7 @@ function SelectWidget({
1912
1820
  readOnly: true
1913
1821
  }
1914
1822
  ),
1915
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: isEnumeratedObject ? label2 : getDisplayValue(label2) })
1823
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: isEnumeratedObject ? label2 : getDisplayValue(label2) })
1916
1824
  ] })
1917
1825
  },
1918
1826
  i
@@ -1921,11 +1829,11 @@ function SelectWidget({
1921
1829
  }
1922
1830
 
1923
1831
  // src/widgets/TextareaWidget/TextareaWidget.tsx
1924
- var import_react16 = require("react");
1925
- var import_jsx_runtime29 = require("react/jsx-runtime");
1832
+ var import_react12 = require("react");
1833
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1926
1834
  function TextareaWidget(props) {
1927
- const { id, value, required, disabled, readonly, onChange, onFocus, onBlur, options } = props;
1928
- const handleFocus = (0, import_react16.useCallback)(
1835
+ const { id, htmlName, value, required, disabled, readonly, onChange, onFocus, onBlur, options } = props;
1836
+ const handleFocus = (0, import_react12.useCallback)(
1929
1837
  (event) => {
1930
1838
  if (onFocus) {
1931
1839
  onFocus(id, event.target.value);
@@ -1933,7 +1841,7 @@ function TextareaWidget(props) {
1933
1841
  },
1934
1842
  [onFocus, id]
1935
1843
  );
1936
- const handleBlur = (0, import_react16.useCallback)(
1844
+ const handleBlur = (0, import_react12.useCallback)(
1937
1845
  (event) => {
1938
1846
  if (onBlur) {
1939
1847
  onBlur(id, event.target.value);
@@ -1941,17 +1849,18 @@ function TextareaWidget(props) {
1941
1849
  },
1942
1850
  [onBlur, id]
1943
1851
  );
1944
- const handleChange = (0, import_react16.useCallback)(
1852
+ const handleChange = (0, import_react12.useCallback)(
1945
1853
  (event) => {
1946
1854
  onChange(event.target.value);
1947
1855
  },
1948
1856
  [onChange]
1949
1857
  );
1950
1858
  const rows = options?.rows || 5;
1951
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1859
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1952
1860
  "textarea",
1953
1861
  {
1954
1862
  id,
1863
+ name: htmlName || id,
1955
1864
  value: value || "",
1956
1865
  required,
1957
1866
  disabled: disabled || readonly,
@@ -1966,11 +1875,11 @@ function TextareaWidget(props) {
1966
1875
  }
1967
1876
 
1968
1877
  // src/widgets/TimeWidget/TimeWidget.tsx
1969
- var import_react17 = require("react");
1970
- var import_jsx_runtime30 = require("react/jsx-runtime");
1878
+ var import_react13 = require("react");
1879
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1971
1880
  function TimeWidget(props) {
1972
1881
  const { id, value, onChange, onFocus, onBlur, required, disabled, readonly } = props;
1973
- const handleFocus = (0, import_react17.useCallback)(
1882
+ const handleFocus = (0, import_react13.useCallback)(
1974
1883
  (event) => {
1975
1884
  if (onFocus) {
1976
1885
  onFocus(id, event.target.value);
@@ -1978,7 +1887,7 @@ function TimeWidget(props) {
1978
1887
  },
1979
1888
  [onFocus, id]
1980
1889
  );
1981
- const handleBlur = (0, import_react17.useCallback)(
1890
+ const handleBlur = (0, import_react13.useCallback)(
1982
1891
  (event) => {
1983
1892
  if (onBlur) {
1984
1893
  onBlur(id, event.target.value);
@@ -1986,13 +1895,13 @@ function TimeWidget(props) {
1986
1895
  },
1987
1896
  [onBlur, id]
1988
1897
  );
1989
- const handleChange = (0, import_react17.useCallback)(
1898
+ const handleChange = (0, import_react13.useCallback)(
1990
1899
  (event) => {
1991
1900
  onChange(event.target.value);
1992
1901
  },
1993
1902
  [onChange]
1994
1903
  );
1995
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1904
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1996
1905
  "input",
1997
1906
  {
1998
1907
  type: "time",
@@ -2010,27 +1919,27 @@ function TimeWidget(props) {
2010
1919
  }
2011
1920
 
2012
1921
  // src/widgets/ToggleWidget/ToggleWidget.tsx
2013
- var import_react18 = require("react");
2014
- var import_jsx_runtime31 = require("react/jsx-runtime");
1922
+ var import_react14 = require("react");
1923
+ var import_jsx_runtime32 = require("react/jsx-runtime");
2015
1924
  function ToggleWidget({ id, value, required, disabled, readonly, autofocus, onChange, onFocus, onBlur, options }) {
2016
- const _onChange = (0, import_react18.useCallback)(
1925
+ const _onChange = (0, import_react14.useCallback)(
2017
1926
  ({ target: { checked } }) => onChange(checked),
2018
1927
  [onChange]
2019
1928
  );
2020
- const handleFocus = (0, import_react18.useCallback)(() => {
1929
+ const handleFocus = (0, import_react14.useCallback)(() => {
2021
1930
  if (onFocus) {
2022
1931
  onFocus(id, value);
2023
1932
  }
2024
1933
  }, [onFocus, id, value]);
2025
- const handleBlur = (0, import_react18.useCallback)(() => {
1934
+ const handleBlur = (0, import_react14.useCallback)(() => {
2026
1935
  if (onBlur) {
2027
1936
  onBlur(id, value);
2028
1937
  }
2029
1938
  }, [onBlur, id, value]);
2030
1939
  const { size = "md" } = options;
2031
1940
  const sizeClass = size !== "md" ? `toggle-${size}` : "";
2032
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "cursor-pointer label my-auto", children: [
2033
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1941
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "cursor-pointer label my-auto", children: [
1942
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
2034
1943
  "input",
2035
1944
  {
2036
1945
  type: "checkbox",
@@ -2045,7 +1954,7 @@ function ToggleWidget({ id, value, required, disabled, readonly, autofocus, onCh
2045
1954
  className: `toggle ${sizeClass}`
2046
1955
  }
2047
1956
  ),
2048
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "label-text", children: options.label })
1957
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "label-text", children: options.label })
2049
1958
  ] }) });
2050
1959
  }
2051
1960
 
@@ -2058,7 +1967,6 @@ function generateWidgets() {
2058
1967
  CheckboxWidget,
2059
1968
  DateTimeWidget,
2060
1969
  DateWidget,
2061
- FileWidget,
2062
1970
  RadioWidget,
2063
1971
  RangeWidget,
2064
1972
  RatingWidget,
@@ -2071,7 +1979,7 @@ function generateWidgets() {
2071
1979
  var Widgets_default = generateWidgets;
2072
1980
 
2073
1981
  // src/theme/Theme.tsx
2074
- var import_jsx_runtime32 = require("react/jsx-runtime");
1982
+ var import_jsx_runtime33 = require("react/jsx-runtime");
2075
1983
  function generateTheme() {
2076
1984
  const { fields } = (0, import_core2.getDefaultRegistry)();
2077
1985
  const generatedWidgets = generateWidgets();
@@ -2087,29 +1995,29 @@ function generateTheme() {
2087
1995
  }
2088
1996
  var Theme = generateTheme();
2089
1997
  var Theme_default = Theme;
2090
- var ThemeContext = (0, import_react19.createContext)({
1998
+ var ThemeContext = (0, import_react15.createContext)({
2091
1999
  theme: "night",
2092
2000
  setTheme: () => {
2093
2001
  }
2094
2002
  });
2095
2003
  function ThemeProvider({ children }) {
2096
- const [theme, setTheme] = (0, import_react19.useState)(() => {
2004
+ const [theme, setTheme] = (0, import_react15.useState)(() => {
2097
2005
  try {
2098
2006
  return localStorage.getItem("daisyui-theme") || "cupcake";
2099
2007
  } catch {
2100
2008
  return "cupcake";
2101
2009
  }
2102
2010
  });
2103
- const handleSetTheme = (0, import_react19.useCallback)((newTheme) => {
2011
+ const handleSetTheme = (0, import_react15.useCallback)((newTheme) => {
2104
2012
  try {
2105
2013
  localStorage.setItem("daisyui-theme", newTheme);
2106
2014
  setTheme(newTheme);
2107
2015
  } catch {
2108
2016
  }
2109
2017
  }, []);
2110
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ThemeContext.Provider, { value: { theme, setTheme: handleSetTheme }, children });
2018
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ThemeContext.Provider, { value: { theme, setTheme: handleSetTheme }, children });
2111
2019
  }
2112
- var useTheme = () => (0, import_react19.useContext)(ThemeContext);
2020
+ var useTheme = () => (0, import_react15.useContext)(ThemeContext);
2113
2021
 
2114
2022
  // src/DaisyUIForm.tsx
2115
2023
  var import_core3 = require("@rjsf/core");
@@ -2117,8 +2025,8 @@ var DaisyUIForm = (0, import_core3.withTheme)(Theme_default);
2117
2025
  var DaisyUIForm_default = DaisyUIForm;
2118
2026
 
2119
2027
  // src/DaisyUIFrameProvider.tsx
2120
- var import_react20 = require("react");
2121
- var import_jsx_runtime33 = require("react/jsx-runtime");
2028
+ var import_react16 = require("react");
2029
+ var import_jsx_runtime34 = require("react/jsx-runtime");
2122
2030
  function DaisyUIFrameComponent(props) {
2123
2031
  const { children, subtheme = {}, document: document2 } = props;
2124
2032
  const theme = (() => {
@@ -2132,7 +2040,7 @@ function DaisyUIFrameComponent(props) {
2132
2040
  return "cupcake";
2133
2041
  }
2134
2042
  })();
2135
- (0, import_react20.useEffect)(() => {
2043
+ (0, import_react16.useEffect)(() => {
2136
2044
  if (document2) {
2137
2045
  const configScript = document2.createElement("script");
2138
2046
  configScript.textContent = `
@@ -2167,14 +2075,14 @@ function DaisyUIFrameComponent(props) {
2167
2075
  }
2168
2076
  return void 0;
2169
2077
  }, [document2]);
2170
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { "data-theme": theme, className: "daisy-ui-theme", children });
2078
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { "data-theme": theme, className: "daisy-ui-theme", children });
2171
2079
  }
2172
2080
  var __createDaisyUIFrameProvider = (props) => {
2173
2081
  return function DaisyUIFrame({ document: document2 }) {
2174
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DaisyUIFrameComponent, { document: document2, ...props });
2082
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DaisyUIFrameComponent, { document: document2, ...props });
2175
2083
  };
2176
2084
  };
2177
2085
 
2178
2086
  // src/index.ts
2179
2087
  var index_default = (0, import_core4.withTheme)(Theme_default);
2180
- //# sourceMappingURL=index.js.map
2088
+ //# sourceMappingURL=index.cjs.map