@rjsf/daisyui 6.0.0-beta.21 → 6.0.0-beta.23
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.
- package/dist/chakra-ui.esm.js +169 -355
- package/dist/chakra-ui.esm.js.map +4 -4
- package/dist/chakra-ui.umd.js +60 -237
- package/dist/index.cjs +186 -370
- package/dist/index.cjs.map +4 -4
- package/lib/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.d.ts +2 -2
- package/lib/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.js +2 -7
- package/lib/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -3
- package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -2
- package/lib/templates/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/templates/BaseInputTemplate/BaseInputTemplate.js +8 -2
- package/lib/templates/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/templates/FieldTemplate/FieldTemplate.js +3 -3
- package/lib/templates/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/templates/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
- package/lib/templates/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +2 -9
- package/lib/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/AltDateWidget/AltDateWidget.d.ts +1 -1
- package/lib/widgets/AltDateWidget/AltDateWidget.js +5 -121
- package/lib/widgets/AltDateWidget/AltDateWidget.js.map +1 -1
- package/lib/widgets/CheckboxWidget/CheckboxWidget.js +2 -2
- package/lib/widgets/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/widgets/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/widgets/CheckboxesWidget/CheckboxesWidget.js +2 -2
- package/lib/widgets/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/widgets/RadioWidget/RadioWidget.js +2 -2
- package/lib/widgets/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget/TextareaWidget.js +2 -2
- package/lib/widgets/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/widgets/Widgets.d.ts +1 -2
- package/lib/widgets/Widgets.js +1 -3
- package/lib/widgets/Widgets.js.map +1 -1
- package/package.json +7 -7
- package/src/templates/ArrayFieldItemButtonsTemplate/ArrayFieldItemButtonsTemplate.tsx +10 -15
- package/src/templates/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -3
- package/src/templates/ArrayFieldTemplate/ArrayFieldTemplate.tsx +1 -8
- package/src/templates/BaseInputTemplate/BaseInputTemplate.tsx +11 -3
- package/src/templates/FieldTemplate/FieldTemplate.tsx +9 -7
- package/src/templates/ObjectFieldTemplate/ObjectFieldTemplate.tsx +2 -2
- package/src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +5 -16
- package/src/widgets/AltDateWidget/AltDateWidget.tsx +18 -253
- package/src/widgets/CheckboxWidget/CheckboxWidget.tsx +2 -0
- package/src/widgets/CheckboxesWidget/CheckboxesWidget.tsx +2 -1
- package/src/widgets/RadioWidget/RadioWidget.tsx +2 -1
- package/src/widgets/TextareaWidget/TextareaWidget.tsx +2 -1
- package/src/widgets/Widgets.tsx +0 -3
- package/lib/widgets/FileWidget/FileWidget.d.ts +0 -12
- package/lib/widgets/FileWidget/FileWidget.js +0 -57
- package/lib/widgets/FileWidget/FileWidget.js.map +0 -1
- package/lib/widgets/FileWidget/index.d.ts +0 -2
- package/lib/widgets/FileWidget/index.js +0 -3
- package/lib/widgets/FileWidget/index.js.map +0 -1
- package/src/widgets/FileWidget/FileWidget.tsx +0 -86
- package/src/widgets/FileWidget/index.ts +0 -2
package/dist/index.cjs
CHANGED
|
@@ -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
|
|
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) {
|
|
@@ -49,19 +48,15 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
49
48
|
hasMoveUp,
|
|
50
49
|
hasRemove,
|
|
51
50
|
fieldPathId,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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";
|
|
@@ -73,7 +68,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
73
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:
|
|
71
|
+
onClick: onMoveUpItem,
|
|
77
72
|
uiSchema,
|
|
78
73
|
registry
|
|
79
74
|
}
|
|
@@ -84,7 +79,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
84
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:
|
|
82
|
+
onClick: onMoveDownItem,
|
|
88
83
|
uiSchema,
|
|
89
84
|
registry
|
|
90
85
|
}
|
|
@@ -96,7 +91,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
96
91
|
id: (0, import_utils.buttonId)(fieldPathId, "copy"),
|
|
97
92
|
className: `rjsf-array-item-copy ${btnClass}`,
|
|
98
93
|
disabled: disabled || readonly,
|
|
99
|
-
onClick:
|
|
94
|
+
onClick: onCopyItem,
|
|
100
95
|
uiSchema,
|
|
101
96
|
registry
|
|
102
97
|
}
|
|
@@ -107,7 +102,7 @@ function ArrayFieldItemButtonsTemplate(props) {
|
|
|
107
102
|
id: (0, import_utils.buttonId)(fieldPathId, "remove"),
|
|
108
103
|
className: `rjsf-array-item-remove ${removeBtnClass}`,
|
|
109
104
|
disabled: disabled || readonly,
|
|
110
|
-
onClick:
|
|
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
|
|
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) {
|
|
@@ -164,11 +159,6 @@ function ArrayFieldTemplate(props) {
|
|
|
164
159
|
registry,
|
|
165
160
|
uiOptions
|
|
166
161
|
);
|
|
167
|
-
const ArrayFieldItemTemplate2 = (0, import_utils3.getTemplate)(
|
|
168
|
-
"ArrayFieldItemTemplate",
|
|
169
|
-
registry,
|
|
170
|
-
uiOptions
|
|
171
|
-
);
|
|
172
162
|
const ArrayFieldTitleTemplate = (0, import_utils3.getTemplate)(
|
|
173
163
|
"ArrayFieldTitleTemplate",
|
|
174
164
|
registry,
|
|
@@ -178,7 +168,7 @@ function ArrayFieldTemplate(props) {
|
|
|
178
168
|
const {
|
|
179
169
|
ButtonTemplates: { AddButton: AddButton2 }
|
|
180
170
|
} = registry.templates;
|
|
181
|
-
const handleAddClick = (0,
|
|
171
|
+
const handleAddClick = (0, import_react.useCallback)(
|
|
182
172
|
(e) => {
|
|
183
173
|
e.preventDefault();
|
|
184
174
|
e.stopPropagation();
|
|
@@ -212,7 +202,7 @@ function ArrayFieldTemplate(props) {
|
|
|
212
202
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
213
203
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
214
204
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rjsf-array-item-list", children: [
|
|
215
|
-
items
|
|
205
|
+
items,
|
|
216
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 })
|
|
217
207
|
] }),
|
|
218
208
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -231,12 +221,14 @@ function ArrayFieldTemplate(props) {
|
|
|
231
221
|
}
|
|
232
222
|
|
|
233
223
|
// src/templates/BaseInputTemplate/BaseInputTemplate.tsx
|
|
234
|
-
var
|
|
224
|
+
var import_react2 = require("react");
|
|
235
225
|
var import_utils4 = require("@rjsf/utils");
|
|
236
226
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
237
227
|
function BaseInputTemplate(props) {
|
|
238
228
|
const {
|
|
239
229
|
id,
|
|
230
|
+
htmlName,
|
|
231
|
+
multiple,
|
|
240
232
|
value,
|
|
241
233
|
required,
|
|
242
234
|
disabled,
|
|
@@ -253,17 +245,23 @@ function BaseInputTemplate(props) {
|
|
|
253
245
|
placeholder
|
|
254
246
|
} = props;
|
|
255
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
|
+
}
|
|
256
254
|
const { step, min, max, accept, ...rest } = inputProps;
|
|
257
255
|
const htmlInputProps = { step, min, max, accept, ...schema.examples ? { list: (0, import_utils4.examplesId)(id) } : void 0 };
|
|
258
|
-
const _onChange = (0,
|
|
256
|
+
const _onChange = (0, import_react2.useCallback)(
|
|
259
257
|
({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
|
|
260
258
|
[onChange, options]
|
|
261
259
|
);
|
|
262
|
-
const _onBlur = (0,
|
|
260
|
+
const _onBlur = (0, import_react2.useCallback)(
|
|
263
261
|
({ target }) => onBlur && onBlur(id, target.value),
|
|
264
262
|
[onBlur, id]
|
|
265
263
|
);
|
|
266
|
-
const _onFocus = (0,
|
|
264
|
+
const _onFocus = (0, import_react2.useCallback)(
|
|
267
265
|
({ target }) => onFocus && onFocus(id, target.value),
|
|
268
266
|
[onFocus, id]
|
|
269
267
|
);
|
|
@@ -274,13 +272,14 @@ function BaseInputTemplate(props) {
|
|
|
274
272
|
"input",
|
|
275
273
|
{
|
|
276
274
|
id,
|
|
277
|
-
name: id,
|
|
275
|
+
name: htmlName || id,
|
|
278
276
|
value: value || value === 0 ? value : "",
|
|
279
277
|
placeholder,
|
|
280
278
|
required,
|
|
281
279
|
disabled: disabled || readonly,
|
|
282
280
|
autoFocus: autofocus,
|
|
283
|
-
className
|
|
281
|
+
className,
|
|
282
|
+
multiple: isMulti,
|
|
284
283
|
...rest,
|
|
285
284
|
...htmlInputProps,
|
|
286
285
|
onChange: onChangeOverride || _onChange,
|
|
@@ -302,7 +301,7 @@ var import_fontawesome_svg_core = require("@fortawesome/fontawesome-svg-core");
|
|
|
302
301
|
var import_free_solid_svg_icons = require("@fortawesome/free-solid-svg-icons");
|
|
303
302
|
|
|
304
303
|
// src/templates/ButtonTemplates/DaisyUIButton.tsx
|
|
305
|
-
var
|
|
304
|
+
var import_react3 = require("react");
|
|
306
305
|
var import_react_fontawesome = require("@fortawesome/react-fontawesome");
|
|
307
306
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
308
307
|
function DaisyUIButton(props) {
|
|
@@ -310,7 +309,7 @@ function DaisyUIButton(props) {
|
|
|
310
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" }) });
|
|
311
310
|
}
|
|
312
311
|
DaisyUIButton.displayName = "DaisyUIButton";
|
|
313
|
-
var DaisyUIButton_default = (0,
|
|
312
|
+
var DaisyUIButton_default = (0, import_react3.memo)(DaisyUIButton);
|
|
314
313
|
|
|
315
314
|
// src/templates/ButtonTemplates/AddButton.tsx
|
|
316
315
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -453,21 +452,22 @@ function FieldTemplate(props) {
|
|
|
453
452
|
help,
|
|
454
453
|
hideError,
|
|
455
454
|
displayLabel,
|
|
455
|
+
onKeyRename,
|
|
456
|
+
onKeyRenameBlur,
|
|
457
|
+
onRemoveProperty,
|
|
456
458
|
classNames,
|
|
457
|
-
// Destructure props we don't want to pass to div
|
|
458
|
-
description,
|
|
459
|
-
onKeyChange,
|
|
460
|
-
onDropPropertyClick,
|
|
461
459
|
uiSchema,
|
|
462
460
|
schema,
|
|
463
461
|
readonly,
|
|
464
462
|
required,
|
|
463
|
+
registry,
|
|
464
|
+
// Destructure props we don't want to pass to div
|
|
465
|
+
description,
|
|
465
466
|
rawErrors,
|
|
466
467
|
rawHelp,
|
|
467
468
|
rawDescription,
|
|
468
469
|
hidden,
|
|
469
470
|
onChange,
|
|
470
|
-
registry,
|
|
471
471
|
...divProps
|
|
472
472
|
} = props;
|
|
473
473
|
const isCheckbox = schema.type === "boolean";
|
|
@@ -484,8 +484,9 @@ function FieldTemplate(props) {
|
|
|
484
484
|
disabled: divProps.disabled,
|
|
485
485
|
id,
|
|
486
486
|
label,
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
onKeyRename,
|
|
488
|
+
onKeyRenameBlur,
|
|
489
|
+
onRemoveProperty,
|
|
489
490
|
readonly,
|
|
490
491
|
required,
|
|
491
492
|
schema,
|
|
@@ -540,7 +541,7 @@ function ObjectFieldTemplate(props) {
|
|
|
540
541
|
schema,
|
|
541
542
|
formData,
|
|
542
543
|
optionalDataControl,
|
|
543
|
-
|
|
544
|
+
onAddProperty,
|
|
544
545
|
registry
|
|
545
546
|
} = props;
|
|
546
547
|
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
|
|
@@ -595,7 +596,7 @@ function ObjectFieldTemplate(props) {
|
|
|
595
596
|
{
|
|
596
597
|
id: (0, import_utils9.buttonId)(fieldPathId, "add"),
|
|
597
598
|
className: "rjsf-object-property-expand btn btn-primary btn-sm",
|
|
598
|
-
onClick:
|
|
599
|
+
onClick: onAddProperty,
|
|
599
600
|
disabled: disabled || readonly,
|
|
600
601
|
uiSchema,
|
|
601
602
|
registry
|
|
@@ -658,7 +659,6 @@ function TitleField(props) {
|
|
|
658
659
|
}
|
|
659
660
|
|
|
660
661
|
// src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
661
|
-
var import_react5 = require("react");
|
|
662
662
|
var import_utils11 = require("@rjsf/utils");
|
|
663
663
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
664
664
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -672,8 +672,9 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
672
672
|
required,
|
|
673
673
|
schema,
|
|
674
674
|
uiSchema,
|
|
675
|
-
|
|
676
|
-
|
|
675
|
+
onKeyRename,
|
|
676
|
+
onKeyRenameBlur,
|
|
677
|
+
onRemoveProperty,
|
|
677
678
|
registry,
|
|
678
679
|
...rest
|
|
679
680
|
} = props;
|
|
@@ -681,15 +682,6 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
681
682
|
const { templates, translateString } = registry;
|
|
682
683
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
683
684
|
const keyLabel = translateString(import_utils11.TranslatableString.KeyLabel, [label]);
|
|
684
|
-
const handleBlur = (0, import_react5.useCallback)(
|
|
685
|
-
(event) => {
|
|
686
|
-
onKeyChange(event.target.value);
|
|
687
|
-
},
|
|
688
|
-
[onKeyChange]
|
|
689
|
-
);
|
|
690
|
-
const handleRemove = (0, import_react5.useCallback)(() => {
|
|
691
|
-
onDropPropertyClick(label)();
|
|
692
|
-
}, [onDropPropertyClick, label]);
|
|
693
685
|
if (!additional) {
|
|
694
686
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: classNames, children });
|
|
695
687
|
}
|
|
@@ -702,7 +694,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
702
694
|
type: "text",
|
|
703
695
|
className: "input input-bordered",
|
|
704
696
|
id: `${id}-key`,
|
|
705
|
-
onBlur:
|
|
697
|
+
onBlur: onKeyRenameBlur,
|
|
706
698
|
defaultValue: label,
|
|
707
699
|
disabled: disabled || readonly
|
|
708
700
|
}
|
|
@@ -715,7 +707,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
715
707
|
id: (0, import_utils11.buttonId)(id, "remove"),
|
|
716
708
|
className: "rjsf-object-property-remove",
|
|
717
709
|
disabled: disabled || readonly,
|
|
718
|
-
onClick:
|
|
710
|
+
onClick: onRemoveProperty,
|
|
719
711
|
uiSchema,
|
|
720
712
|
registry
|
|
721
713
|
}
|
|
@@ -765,157 +757,31 @@ function AltDateTimeWidget({
|
|
|
765
757
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
766
758
|
|
|
767
759
|
// src/widgets/AltDateWidget/AltDateWidget.tsx
|
|
768
|
-
var import_react6 = require("react");
|
|
769
760
|
var import_utils12 = require("@rjsf/utils");
|
|
770
761
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
771
|
-
function
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
value: state[key],
|
|
784
|
-
range: key === "year" ? rangeOptions : key === "month" ? [1, 12] : key === "day" ? [1, 31] : [0, 59]
|
|
785
|
-
}));
|
|
786
|
-
if (time) {
|
|
787
|
-
dateElements.push(
|
|
788
|
-
{ type: "hour", value: state.hour, range: [0, 23] },
|
|
789
|
-
{ type: "minute", value: state.minute, range: [0, 59] },
|
|
790
|
-
{ type: "second", value: state.second, range: [0, 59] }
|
|
791
|
-
);
|
|
792
|
-
}
|
|
793
|
-
return dateElements;
|
|
794
|
-
}
|
|
795
|
-
function DateElement({
|
|
796
|
-
type,
|
|
797
|
-
range,
|
|
798
|
-
value,
|
|
799
|
-
select,
|
|
800
|
-
rootId,
|
|
801
|
-
name,
|
|
802
|
-
disabled,
|
|
803
|
-
readonly,
|
|
804
|
-
autofocus,
|
|
805
|
-
registry,
|
|
806
|
-
onBlur,
|
|
807
|
-
onFocus
|
|
808
|
-
}) {
|
|
809
|
-
const id = `${rootId}_${type}`;
|
|
810
|
-
const { SelectWidget: SelectWidget2 } = registry.widgets;
|
|
811
|
-
const handleChange = (0, import_react6.useCallback)(
|
|
812
|
-
(value2) => {
|
|
813
|
-
select(type, value2);
|
|
814
|
-
},
|
|
815
|
-
[select, type]
|
|
816
|
-
);
|
|
817
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
818
|
-
SelectWidget2,
|
|
819
|
-
{
|
|
820
|
-
schema: { type: "integer" },
|
|
821
|
-
id,
|
|
822
|
-
name,
|
|
823
|
-
className: "select select-bordered select-sm w-full",
|
|
824
|
-
options: { enumOptions: (0, import_utils12.dateRangeOptions)(range[0], range[1]) },
|
|
825
|
-
placeholder: type,
|
|
826
|
-
value,
|
|
827
|
-
disabled,
|
|
828
|
-
readonly,
|
|
829
|
-
autofocus,
|
|
830
|
-
onChange: handleChange,
|
|
831
|
-
onBlur,
|
|
832
|
-
onFocus,
|
|
833
|
-
registry,
|
|
834
|
-
label: "",
|
|
835
|
-
"aria-describedby": (0, import_utils12.ariaDescribedByIds)(rootId),
|
|
836
|
-
required: false
|
|
837
|
-
}
|
|
838
|
-
);
|
|
839
|
-
}
|
|
840
|
-
function convertToRJSFDateObject(dateObj) {
|
|
841
|
-
return {
|
|
842
|
-
year: dateObj.year ? parseInt(dateObj.year) : 0,
|
|
843
|
-
month: dateObj.month ? parseInt(dateObj.month) : 0,
|
|
844
|
-
day: dateObj.day ? parseInt(dateObj.day) : 0,
|
|
845
|
-
hour: dateObj.hour ? parseInt(dateObj.hour) : 0,
|
|
846
|
-
minute: dateObj.minute ? parseInt(dateObj.minute) : 0,
|
|
847
|
-
second: dateObj.second ? parseInt(dateObj.second) : 0
|
|
848
|
-
};
|
|
849
|
-
}
|
|
850
|
-
function AltDateWidget({
|
|
851
|
-
time = false,
|
|
852
|
-
disabled = false,
|
|
853
|
-
readonly = false,
|
|
854
|
-
autofocus = false,
|
|
855
|
-
options = {},
|
|
856
|
-
id,
|
|
857
|
-
name,
|
|
858
|
-
registry,
|
|
859
|
-
onBlur,
|
|
860
|
-
onFocus,
|
|
861
|
-
onChange,
|
|
862
|
-
value
|
|
863
|
-
}) {
|
|
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;
|
|
864
774
|
const { translateString } = registry;
|
|
865
|
-
const
|
|
866
|
-
const initialState = (0, import_utils12.parseDateString)(value, time);
|
|
867
|
-
const dateReducer = (state2, action) => {
|
|
868
|
-
return { ...state2, ...action };
|
|
869
|
-
};
|
|
870
|
-
const [state, setState] = (0, import_react6.useReducer)(dateReducer, initialState);
|
|
871
|
-
(0, import_react6.useEffect)(() => {
|
|
872
|
-
const rjsfDateObj = convertToRJSFDateObject(state);
|
|
873
|
-
const stateValue = (0, import_utils12.toDateString)(rjsfDateObj, time);
|
|
874
|
-
if (readyForChange(state, time) && stateValue !== value) {
|
|
875
|
-
onChange(stateValue);
|
|
876
|
-
} else if (lastValue !== value) {
|
|
877
|
-
setLastValue(value);
|
|
878
|
-
setState((0, import_utils12.parseDateString)(value, time));
|
|
879
|
-
}
|
|
880
|
-
}, [time, value, onChange, state, lastValue]);
|
|
881
|
-
const handleChange = (0, import_react6.useCallback)((property, value2) => {
|
|
882
|
-
setState({ [property]: value2 });
|
|
883
|
-
}, []);
|
|
884
|
-
const handleSetNow = (0, import_react6.useCallback)(
|
|
885
|
-
(event) => {
|
|
886
|
-
event.preventDefault();
|
|
887
|
-
if (disabled || readonly) {
|
|
888
|
-
return;
|
|
889
|
-
}
|
|
890
|
-
const nextState = (0, import_utils12.parseDateString)((/* @__PURE__ */ new Date()).toJSON(), time);
|
|
891
|
-
const rjsfDateObj = convertToRJSFDateObject(nextState);
|
|
892
|
-
onChange((0, import_utils12.toDateString)(rjsfDateObj, time));
|
|
893
|
-
},
|
|
894
|
-
[disabled, readonly, time, onChange]
|
|
895
|
-
);
|
|
896
|
-
const handleClear = (0, import_react6.useCallback)(
|
|
897
|
-
(event) => {
|
|
898
|
-
event.preventDefault();
|
|
899
|
-
if (disabled || readonly) {
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
onChange(void 0);
|
|
903
|
-
},
|
|
904
|
-
[disabled, readonly, onChange]
|
|
905
|
-
);
|
|
775
|
+
const { elements, handleChange, handleClear, handleSetNow } = (0, import_utils12.useAltDateWidgetProps)(props);
|
|
906
776
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "space-y-3", children: [
|
|
907
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "grid grid-cols-3 gap-2", children:
|
|
908
|
-
state,
|
|
909
|
-
time,
|
|
910
|
-
options.yearsRange,
|
|
911
|
-
options.format
|
|
912
|
-
).map((elemProps, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "form-control", 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: [
|
|
913
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 }) }),
|
|
914
779
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
915
|
-
DateElement,
|
|
780
|
+
import_utils12.DateElement,
|
|
916
781
|
{
|
|
917
782
|
rootId: id,
|
|
918
783
|
name,
|
|
784
|
+
className: "select select-bordered select-sm",
|
|
919
785
|
select: handleChange,
|
|
920
786
|
type: elemProps.type,
|
|
921
787
|
range: elemProps.range,
|
|
@@ -955,12 +821,13 @@ function AltDateWidget({
|
|
|
955
821
|
}
|
|
956
822
|
|
|
957
823
|
// src/widgets/CheckboxWidget/CheckboxWidget.tsx
|
|
958
|
-
var
|
|
824
|
+
var import_react4 = require("react");
|
|
959
825
|
var import_utils13 = require("@rjsf/utils");
|
|
960
826
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
961
827
|
function CheckboxWidget(props) {
|
|
962
828
|
const {
|
|
963
829
|
id,
|
|
830
|
+
htmlName,
|
|
964
831
|
value,
|
|
965
832
|
required,
|
|
966
833
|
disabled,
|
|
@@ -981,17 +848,17 @@ function CheckboxWidget(props) {
|
|
|
981
848
|
options
|
|
982
849
|
);
|
|
983
850
|
const description = options.description || schema.description;
|
|
984
|
-
const handleFocus = (0,
|
|
851
|
+
const handleFocus = (0, import_react4.useCallback)(() => {
|
|
985
852
|
if (onFocus) {
|
|
986
853
|
onFocus(id, value);
|
|
987
854
|
}
|
|
988
855
|
}, [onFocus, id, value]);
|
|
989
|
-
const handleBlur = (0,
|
|
856
|
+
const handleBlur = (0, import_react4.useCallback)(() => {
|
|
990
857
|
if (onBlur) {
|
|
991
858
|
onBlur(id, value);
|
|
992
859
|
}
|
|
993
860
|
}, [onBlur, id, value]);
|
|
994
|
-
const handleChange = (0,
|
|
861
|
+
const handleChange = (0, import_react4.useCallback)(
|
|
995
862
|
(event) => {
|
|
996
863
|
onChange(event.target.checked);
|
|
997
864
|
},
|
|
@@ -1002,6 +869,7 @@ function CheckboxWidget(props) {
|
|
|
1002
869
|
{
|
|
1003
870
|
type: "checkbox",
|
|
1004
871
|
id,
|
|
872
|
+
name: htmlName || id,
|
|
1005
873
|
checked: value,
|
|
1006
874
|
required,
|
|
1007
875
|
disabled: disabled || readonly,
|
|
@@ -1033,10 +901,11 @@ function CheckboxWidget(props) {
|
|
|
1033
901
|
}
|
|
1034
902
|
|
|
1035
903
|
// src/widgets/CheckboxesWidget/CheckboxesWidget.tsx
|
|
1036
|
-
var
|
|
904
|
+
var import_react5 = require("react");
|
|
1037
905
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1038
906
|
function CheckboxesWidget({
|
|
1039
907
|
id,
|
|
908
|
+
htmlName,
|
|
1040
909
|
disabled,
|
|
1041
910
|
options,
|
|
1042
911
|
value,
|
|
@@ -1048,7 +917,7 @@ function CheckboxesWidget({
|
|
|
1048
917
|
}) {
|
|
1049
918
|
const { enumOptions } = options;
|
|
1050
919
|
const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
|
|
1051
|
-
const isChecked = (0,
|
|
920
|
+
const isChecked = (0, import_react5.useCallback)(
|
|
1052
921
|
(option) => {
|
|
1053
922
|
if (!Array.isArray(value)) {
|
|
1054
923
|
return false;
|
|
@@ -1060,7 +929,7 @@ function CheckboxesWidget({
|
|
|
1060
929
|
},
|
|
1061
930
|
[value, isEnumeratedObject]
|
|
1062
931
|
);
|
|
1063
|
-
const handleChange = (0,
|
|
932
|
+
const handleChange = (0, import_react5.useCallback)(
|
|
1064
933
|
(event) => {
|
|
1065
934
|
const index = Number(event.target.dataset.index);
|
|
1066
935
|
const option = enumOptions?.[index];
|
|
@@ -1077,7 +946,7 @@ function CheckboxesWidget({
|
|
|
1077
946
|
},
|
|
1078
947
|
[onChange, value, isChecked, isEnumeratedObject, enumOptions]
|
|
1079
948
|
);
|
|
1080
|
-
const handleFocus = (0,
|
|
949
|
+
const handleFocus = (0, import_react5.useCallback)(
|
|
1081
950
|
(event) => {
|
|
1082
951
|
if (onFocus) {
|
|
1083
952
|
const index = Number(event.target.dataset.index);
|
|
@@ -1089,7 +958,7 @@ function CheckboxesWidget({
|
|
|
1089
958
|
},
|
|
1090
959
|
[onFocus, id, enumOptions]
|
|
1091
960
|
);
|
|
1092
|
-
const handleBlur = (0,
|
|
961
|
+
const handleBlur = (0, import_react5.useCallback)(
|
|
1093
962
|
(event) => {
|
|
1094
963
|
if (onBlur) {
|
|
1095
964
|
const index = Number(event.target.dataset.index);
|
|
@@ -1108,7 +977,7 @@ function CheckboxesWidget({
|
|
|
1108
977
|
type: "checkbox",
|
|
1109
978
|
id: `${id}-${option.value}`,
|
|
1110
979
|
className: "checkbox",
|
|
1111
|
-
name: id,
|
|
980
|
+
name: htmlName || id,
|
|
1112
981
|
checked: isChecked(option),
|
|
1113
982
|
required,
|
|
1114
983
|
disabled: disabled || readonly,
|
|
@@ -1123,7 +992,7 @@ function CheckboxesWidget({
|
|
|
1123
992
|
}
|
|
1124
993
|
|
|
1125
994
|
// src/widgets/DateTimeWidget/DateTimeWidget.tsx
|
|
1126
|
-
var
|
|
995
|
+
var import_react6 = require("react");
|
|
1127
996
|
var import_free_solid_svg_icons4 = require("@fortawesome/free-solid-svg-icons");
|
|
1128
997
|
var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
|
|
1129
998
|
var import_date_fns = require("date-fns");
|
|
@@ -1131,12 +1000,12 @@ var import_react_day_picker = require("react-day-picker");
|
|
|
1131
1000
|
var import_style = require("react-day-picker/dist/style.css");
|
|
1132
1001
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1133
1002
|
function useDatePickerState(initialDate) {
|
|
1134
|
-
const [isOpen, setIsOpen] = (0,
|
|
1135
|
-
const [month, setMonth] = (0,
|
|
1003
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
1004
|
+
const [month, setMonth] = (0, import_react6.useState)(initialDate ?? /* @__PURE__ */ new Date());
|
|
1136
1005
|
return { isOpen, setIsOpen, month, setMonth };
|
|
1137
1006
|
}
|
|
1138
1007
|
function useClickOutside(ref, callback) {
|
|
1139
|
-
(0,
|
|
1008
|
+
(0, import_react6.useEffect)(() => {
|
|
1140
1009
|
const handleClickOutside = (event) => {
|
|
1141
1010
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1142
1011
|
callback();
|
|
@@ -1181,7 +1050,7 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
|
|
|
1181
1050
|
...dayPickerStyles.modifiers,
|
|
1182
1051
|
"custom-today": "btn btn-outline btn-info min-h-0 h-full"
|
|
1183
1052
|
};
|
|
1184
|
-
const handleClick = (0,
|
|
1053
|
+
const handleClick = (0, import_react6.useCallback)((e) => {
|
|
1185
1054
|
e.stopPropagation();
|
|
1186
1055
|
}, []);
|
|
1187
1056
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "p-3", children: [
|
|
@@ -1217,17 +1086,17 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
|
|
|
1217
1086
|
] }) })
|
|
1218
1087
|
] });
|
|
1219
1088
|
}
|
|
1220
|
-
var MemoizedDateTimePickerPopup = (0,
|
|
1089
|
+
var MemoizedDateTimePickerPopup = (0, import_react6.memo)(DateTimePickerPopup);
|
|
1221
1090
|
function DateTimeWidget(props) {
|
|
1222
1091
|
const { id, value, onChange, onFocus, onBlur, schema } = props;
|
|
1223
|
-
const initialDate = (0,
|
|
1224
|
-
const [localDate, setLocalDate] = (0,
|
|
1225
|
-
(0,
|
|
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)(() => {
|
|
1226
1095
|
setLocalDate(initialDate);
|
|
1227
1096
|
}, [initialDate]);
|
|
1228
1097
|
const { isOpen, setIsOpen, month, setMonth } = useDatePickerState(initialDate);
|
|
1229
|
-
const containerRef = (0,
|
|
1230
|
-
const inputRef = (0,
|
|
1098
|
+
const containerRef = (0, import_react6.useRef)(null);
|
|
1099
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
1231
1100
|
useClickOutside(containerRef, () => {
|
|
1232
1101
|
if (isOpen) {
|
|
1233
1102
|
setIsOpen(false);
|
|
@@ -1237,13 +1106,13 @@ function DateTimeWidget(props) {
|
|
|
1237
1106
|
}
|
|
1238
1107
|
}
|
|
1239
1108
|
});
|
|
1240
|
-
(0,
|
|
1109
|
+
(0, import_react6.useEffect)(() => {
|
|
1241
1110
|
if (localDate) {
|
|
1242
1111
|
setMonth(localDate);
|
|
1243
1112
|
}
|
|
1244
1113
|
}, [localDate, setMonth]);
|
|
1245
|
-
const handleMonthChange = (0,
|
|
1246
|
-
const handleSelect = (0,
|
|
1114
|
+
const handleMonthChange = (0, import_react6.useCallback)((date) => setMonth(date), [setMonth]);
|
|
1115
|
+
const handleSelect = (0, import_react6.useCallback)(
|
|
1247
1116
|
(date) => {
|
|
1248
1117
|
if (date) {
|
|
1249
1118
|
if (localDate) {
|
|
@@ -1254,7 +1123,7 @@ function DateTimeWidget(props) {
|
|
|
1254
1123
|
},
|
|
1255
1124
|
[localDate]
|
|
1256
1125
|
);
|
|
1257
|
-
const handleTimeChange = (0,
|
|
1126
|
+
const handleTimeChange = (0, import_react6.useCallback)(
|
|
1258
1127
|
(e) => {
|
|
1259
1128
|
if (localDate) {
|
|
1260
1129
|
const [hours, minutes] = e.target.value.split(":");
|
|
@@ -1265,7 +1134,7 @@ function DateTimeWidget(props) {
|
|
|
1265
1134
|
},
|
|
1266
1135
|
[localDate]
|
|
1267
1136
|
);
|
|
1268
|
-
const togglePicker = (0,
|
|
1137
|
+
const togglePicker = (0, import_react6.useCallback)(
|
|
1269
1138
|
(e) => {
|
|
1270
1139
|
e.stopPropagation();
|
|
1271
1140
|
setIsOpen((prev) => !prev);
|
|
@@ -1275,17 +1144,17 @@ function DateTimeWidget(props) {
|
|
|
1275
1144
|
},
|
|
1276
1145
|
[isOpen, id, onFocus, setIsOpen, value]
|
|
1277
1146
|
);
|
|
1278
|
-
const handleFocus = (0,
|
|
1147
|
+
const handleFocus = (0, import_react6.useCallback)(() => {
|
|
1279
1148
|
if (onFocus) {
|
|
1280
1149
|
onFocus(id, value);
|
|
1281
1150
|
}
|
|
1282
1151
|
}, [id, onFocus, value]);
|
|
1283
|
-
const handleBlur = (0,
|
|
1152
|
+
const handleBlur = (0, import_react6.useCallback)(() => {
|
|
1284
1153
|
if (!isOpen && onBlur) {
|
|
1285
1154
|
onBlur(id, value);
|
|
1286
1155
|
}
|
|
1287
1156
|
}, [id, onBlur, value, isOpen]);
|
|
1288
|
-
const handleKeyDown = (0,
|
|
1157
|
+
const handleKeyDown = (0, import_react6.useCallback)(
|
|
1289
1158
|
(e) => {
|
|
1290
1159
|
if (e.key === "Enter" || e.key === " ") {
|
|
1291
1160
|
togglePicker(e);
|
|
@@ -1293,10 +1162,10 @@ function DateTimeWidget(props) {
|
|
|
1293
1162
|
},
|
|
1294
1163
|
[togglePicker]
|
|
1295
1164
|
);
|
|
1296
|
-
const handleContainerClick = (0,
|
|
1165
|
+
const handleContainerClick = (0, import_react6.useCallback)((e) => {
|
|
1297
1166
|
e.stopPropagation();
|
|
1298
1167
|
}, []);
|
|
1299
|
-
(0,
|
|
1168
|
+
(0, import_react6.useEffect)(() => {
|
|
1300
1169
|
const handleEscape = (e) => {
|
|
1301
1170
|
if (e.key === "Escape" && isOpen) {
|
|
1302
1171
|
setIsOpen(false);
|
|
@@ -1308,7 +1177,7 @@ function DateTimeWidget(props) {
|
|
|
1308
1177
|
document.addEventListener("keydown", handleEscape);
|
|
1309
1178
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
1310
1179
|
}, [id, isOpen, setIsOpen, onBlur, value]);
|
|
1311
|
-
const handleDoneClick = (0,
|
|
1180
|
+
const handleDoneClick = (0, import_react6.useCallback)(() => {
|
|
1312
1181
|
setIsOpen(false);
|
|
1313
1182
|
onChange(localDate ? localDate.toISOString() : "");
|
|
1314
1183
|
if (onBlur) {
|
|
@@ -1369,7 +1238,7 @@ function DateTimeWidget(props) {
|
|
|
1369
1238
|
}
|
|
1370
1239
|
|
|
1371
1240
|
// src/widgets/DateWidget/DateWidget.tsx
|
|
1372
|
-
var
|
|
1241
|
+
var import_react7 = require("react");
|
|
1373
1242
|
var import_free_solid_svg_icons5 = require("@fortawesome/free-solid-svg-icons");
|
|
1374
1243
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
1375
1244
|
var import_date_fns2 = require("date-fns");
|
|
@@ -1377,12 +1246,12 @@ var import_react_day_picker2 = require("react-day-picker");
|
|
|
1377
1246
|
var import_style2 = require("react-day-picker/dist/style.css");
|
|
1378
1247
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1379
1248
|
function useDatePickerState2(initialDate) {
|
|
1380
|
-
const [isOpen, setIsOpen] = (0,
|
|
1381
|
-
const [month, setMonth] = (0,
|
|
1249
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
1250
|
+
const [month, setMonth] = (0, import_react7.useState)(initialDate ?? /* @__PURE__ */ new Date());
|
|
1382
1251
|
return { isOpen, setIsOpen, month, setMonth };
|
|
1383
1252
|
}
|
|
1384
1253
|
function useClickOutside2(ref, callback) {
|
|
1385
|
-
(0,
|
|
1254
|
+
(0, import_react7.useEffect)(() => {
|
|
1386
1255
|
const handleClickOutside = (event) => {
|
|
1387
1256
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1388
1257
|
callback();
|
|
@@ -1445,17 +1314,17 @@ function DatePickerPopup({ selectedDate, month, onMonthChange, onSelect }) {
|
|
|
1445
1314
|
}
|
|
1446
1315
|
) });
|
|
1447
1316
|
}
|
|
1448
|
-
var MemoizedDatePickerPopup = (0,
|
|
1317
|
+
var MemoizedDatePickerPopup = (0, import_react7.memo)(DatePickerPopup);
|
|
1449
1318
|
function DateWidget(props) {
|
|
1450
1319
|
const { id, value, onChange, onFocus, onBlur, schema } = props;
|
|
1451
|
-
const initialDate = (0,
|
|
1452
|
-
const [localDate, setLocalDate] = (0,
|
|
1453
|
-
(0,
|
|
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)(() => {
|
|
1454
1323
|
setLocalDate(initialDate);
|
|
1455
1324
|
}, [initialDate]);
|
|
1456
1325
|
const { isOpen, setIsOpen, month, setMonth } = useDatePickerState2(initialDate);
|
|
1457
|
-
const containerRef = (0,
|
|
1458
|
-
const inputRef = (0,
|
|
1326
|
+
const containerRef = (0, import_react7.useRef)(null);
|
|
1327
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
1459
1328
|
useClickOutside2(containerRef, () => {
|
|
1460
1329
|
if (isOpen) {
|
|
1461
1330
|
setIsOpen(false);
|
|
@@ -1465,19 +1334,19 @@ function DateWidget(props) {
|
|
|
1465
1334
|
}
|
|
1466
1335
|
}
|
|
1467
1336
|
});
|
|
1468
|
-
(0,
|
|
1337
|
+
(0, import_react7.useEffect)(() => {
|
|
1469
1338
|
if (localDate) {
|
|
1470
1339
|
setMonth(localDate);
|
|
1471
1340
|
}
|
|
1472
1341
|
}, [localDate, setMonth]);
|
|
1473
|
-
const handleMonthChange = (0,
|
|
1474
|
-
const handleSelect = (0,
|
|
1342
|
+
const handleMonthChange = (0, import_react7.useCallback)((date) => setMonth(date), [setMonth]);
|
|
1343
|
+
const handleSelect = (0, import_react7.useCallback)((date) => {
|
|
1475
1344
|
if (date) {
|
|
1476
1345
|
date.setHours(0, 0, 0, 0);
|
|
1477
1346
|
setLocalDate(date);
|
|
1478
1347
|
}
|
|
1479
1348
|
}, []);
|
|
1480
|
-
(0,
|
|
1349
|
+
(0, import_react7.useEffect)(() => {
|
|
1481
1350
|
let portalContainer = document.getElementById("date-picker-portal");
|
|
1482
1351
|
if (!portalContainer) {
|
|
1483
1352
|
portalContainer = document.createElement("div");
|
|
@@ -1509,7 +1378,7 @@ function DateWidget(props) {
|
|
|
1509
1378
|
}
|
|
1510
1379
|
return { doc, win };
|
|
1511
1380
|
};
|
|
1512
|
-
const renderCalendar = (0,
|
|
1381
|
+
const renderCalendar = (0, import_react7.useCallback)(() => {
|
|
1513
1382
|
if (!containerRef.current || !inputRef.current) {
|
|
1514
1383
|
return;
|
|
1515
1384
|
}
|
|
@@ -1527,7 +1396,7 @@ function DateWidget(props) {
|
|
|
1527
1396
|
}
|
|
1528
1397
|
containerRef.current.style.zIndex = "99999";
|
|
1529
1398
|
}, [containerRef, inputRef]);
|
|
1530
|
-
(0,
|
|
1399
|
+
(0, import_react7.useEffect)(() => {
|
|
1531
1400
|
if (!isOpen) {
|
|
1532
1401
|
return;
|
|
1533
1402
|
}
|
|
@@ -1539,7 +1408,7 @@ function DateWidget(props) {
|
|
|
1539
1408
|
window.removeEventListener("scroll", renderCalendar);
|
|
1540
1409
|
};
|
|
1541
1410
|
}, [isOpen, renderCalendar]);
|
|
1542
|
-
const togglePicker = (0,
|
|
1411
|
+
const togglePicker = (0, import_react7.useCallback)(
|
|
1543
1412
|
(e) => {
|
|
1544
1413
|
e.stopPropagation();
|
|
1545
1414
|
setIsOpen((prev) => !prev);
|
|
@@ -1549,17 +1418,17 @@ function DateWidget(props) {
|
|
|
1549
1418
|
},
|
|
1550
1419
|
[isOpen, id, onFocus, setIsOpen, value]
|
|
1551
1420
|
);
|
|
1552
|
-
const handleFocus = (0,
|
|
1421
|
+
const handleFocus = (0, import_react7.useCallback)(() => {
|
|
1553
1422
|
if (onFocus) {
|
|
1554
1423
|
onFocus(id, value);
|
|
1555
1424
|
}
|
|
1556
1425
|
}, [id, onFocus, value]);
|
|
1557
|
-
const handleBlur = (0,
|
|
1426
|
+
const handleBlur = (0, import_react7.useCallback)(() => {
|
|
1558
1427
|
if (!isOpen && onBlur) {
|
|
1559
1428
|
onBlur(id, value);
|
|
1560
1429
|
}
|
|
1561
1430
|
}, [id, onBlur, value, isOpen]);
|
|
1562
|
-
(0,
|
|
1431
|
+
(0, import_react7.useEffect)(() => {
|
|
1563
1432
|
const handleEscape = (e) => {
|
|
1564
1433
|
if (e.key === "Escape" && isOpen) {
|
|
1565
1434
|
setIsOpen(false);
|
|
@@ -1571,7 +1440,7 @@ function DateWidget(props) {
|
|
|
1571
1440
|
document.addEventListener("keydown", handleEscape);
|
|
1572
1441
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
1573
1442
|
}, [id, isOpen, setIsOpen, onBlur, value]);
|
|
1574
|
-
const handleDoneClick = (0,
|
|
1443
|
+
const handleDoneClick = (0, import_react7.useCallback)(() => {
|
|
1575
1444
|
setIsOpen(false);
|
|
1576
1445
|
onChange(localDate ? localDate.toISOString() : "");
|
|
1577
1446
|
if (onBlur) {
|
|
@@ -1638,65 +1507,12 @@ function DateWidget(props) {
|
|
|
1638
1507
|
) });
|
|
1639
1508
|
}
|
|
1640
1509
|
|
|
1641
|
-
// src/widgets/FileWidget/FileWidget.tsx
|
|
1642
|
-
var import_react11 = require("react");
|
|
1643
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1644
|
-
function FileWidget(props) {
|
|
1645
|
-
const { id, required, disabled, readonly, schema, onChange, onFocus, onBlur, options = {} } = props;
|
|
1646
|
-
const isMulti = schema.type === "array" || Boolean(options.multiple);
|
|
1647
|
-
const accept = typeof options.accept === "string" ? options.accept : void 0;
|
|
1648
|
-
const handleChange = (0, import_react11.useCallback)(
|
|
1649
|
-
(event) => {
|
|
1650
|
-
if (!event.target.files) {
|
|
1651
|
-
return;
|
|
1652
|
-
}
|
|
1653
|
-
const fileList = Array.from(event.target.files);
|
|
1654
|
-
if (isMulti) {
|
|
1655
|
-
onChange(fileList);
|
|
1656
|
-
} else {
|
|
1657
|
-
onChange(fileList[0] || null);
|
|
1658
|
-
}
|
|
1659
|
-
},
|
|
1660
|
-
[onChange, isMulti]
|
|
1661
|
-
);
|
|
1662
|
-
const handleFocus = (0, import_react11.useCallback)(
|
|
1663
|
-
(event) => {
|
|
1664
|
-
if (onFocus) {
|
|
1665
|
-
onFocus(id, event.target.files ? Array.from(event.target.files) : null);
|
|
1666
|
-
}
|
|
1667
|
-
},
|
|
1668
|
-
[onFocus, id]
|
|
1669
|
-
);
|
|
1670
|
-
const handleBlur = (0, import_react11.useCallback)(
|
|
1671
|
-
(event) => {
|
|
1672
|
-
if (onBlur) {
|
|
1673
|
-
onBlur(id, event.target.files ? Array.from(event.target.files) : null);
|
|
1674
|
-
}
|
|
1675
|
-
},
|
|
1676
|
-
[onBlur, id]
|
|
1677
|
-
);
|
|
1678
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1679
|
-
"input",
|
|
1680
|
-
{
|
|
1681
|
-
id,
|
|
1682
|
-
type: "file",
|
|
1683
|
-
className: "file-input w-full",
|
|
1684
|
-
required,
|
|
1685
|
-
disabled: disabled || readonly,
|
|
1686
|
-
onChange: handleChange,
|
|
1687
|
-
onFocus: handleFocus,
|
|
1688
|
-
onBlur: handleBlur,
|
|
1689
|
-
multiple: isMulti,
|
|
1690
|
-
accept
|
|
1691
|
-
}
|
|
1692
|
-
);
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
1510
|
// src/widgets/RadioWidget/RadioWidget.tsx
|
|
1696
|
-
var
|
|
1697
|
-
var
|
|
1511
|
+
var import_react8 = require("react");
|
|
1512
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1698
1513
|
function RadioWidget({
|
|
1699
1514
|
id,
|
|
1515
|
+
htmlName,
|
|
1700
1516
|
options,
|
|
1701
1517
|
value,
|
|
1702
1518
|
required,
|
|
@@ -1717,7 +1533,7 @@ function RadioWidget({
|
|
|
1717
1533
|
}
|
|
1718
1534
|
return value === option.value;
|
|
1719
1535
|
};
|
|
1720
|
-
const handleFocus = (0,
|
|
1536
|
+
const handleFocus = (0, import_react8.useCallback)(
|
|
1721
1537
|
(event) => {
|
|
1722
1538
|
if (onFocus) {
|
|
1723
1539
|
const index = Number(event.target.dataset.index);
|
|
@@ -1727,7 +1543,7 @@ function RadioWidget({
|
|
|
1727
1543
|
},
|
|
1728
1544
|
[onFocus, id, enumOptions]
|
|
1729
1545
|
);
|
|
1730
|
-
const handleBlur = (0,
|
|
1546
|
+
const handleBlur = (0, import_react8.useCallback)(
|
|
1731
1547
|
(event) => {
|
|
1732
1548
|
if (onBlur) {
|
|
1733
1549
|
const index = Number(event.target.dataset.index);
|
|
@@ -1737,7 +1553,7 @@ function RadioWidget({
|
|
|
1737
1553
|
},
|
|
1738
1554
|
[onBlur, id, enumOptions]
|
|
1739
1555
|
);
|
|
1740
|
-
const handleChange = (0,
|
|
1556
|
+
const handleChange = (0, import_react8.useCallback)(
|
|
1741
1557
|
(event) => {
|
|
1742
1558
|
const index = Number(event.target.dataset.index);
|
|
1743
1559
|
const option = enumOptions?.[index];
|
|
@@ -1748,14 +1564,14 @@ function RadioWidget({
|
|
|
1748
1564
|
},
|
|
1749
1565
|
[onChange, isEnumeratedObject, enumOptions]
|
|
1750
1566
|
);
|
|
1751
|
-
return /* @__PURE__ */ (0,
|
|
1752
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1753
1569
|
"input",
|
|
1754
1570
|
{
|
|
1755
1571
|
type: "radio",
|
|
1756
1572
|
id: `${id}-${option.value}`,
|
|
1757
1573
|
className: "radio",
|
|
1758
|
-
name: id,
|
|
1574
|
+
name: htmlName || id,
|
|
1759
1575
|
value: getValue(option),
|
|
1760
1576
|
checked: isChecked(option),
|
|
1761
1577
|
required,
|
|
@@ -1766,13 +1582,13 @@ function RadioWidget({
|
|
|
1766
1582
|
onBlur: handleBlur
|
|
1767
1583
|
}
|
|
1768
1584
|
),
|
|
1769
|
-
/* @__PURE__ */ (0,
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "label-text", children: option.label })
|
|
1770
1586
|
] }, option.value)) }) });
|
|
1771
1587
|
}
|
|
1772
1588
|
|
|
1773
1589
|
// src/widgets/RangeWidget/RangeWidget.tsx
|
|
1774
|
-
var
|
|
1775
|
-
var
|
|
1590
|
+
var import_react9 = require("react");
|
|
1591
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1776
1592
|
function RangeWidget({
|
|
1777
1593
|
id,
|
|
1778
1594
|
value,
|
|
@@ -1794,14 +1610,14 @@ function RangeWidget({
|
|
|
1794
1610
|
onBlur(id, event.target.value);
|
|
1795
1611
|
}
|
|
1796
1612
|
};
|
|
1797
|
-
const handleChange = (0,
|
|
1613
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1798
1614
|
(event) => {
|
|
1799
1615
|
onChange(event.target.value);
|
|
1800
1616
|
},
|
|
1801
1617
|
[onChange]
|
|
1802
1618
|
);
|
|
1803
|
-
return /* @__PURE__ */ (0,
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1805
1621
|
"input",
|
|
1806
1622
|
{
|
|
1807
1623
|
type: "range",
|
|
@@ -1818,13 +1634,13 @@ function RangeWidget({
|
|
|
1818
1634
|
onBlur: handleBlur
|
|
1819
1635
|
}
|
|
1820
1636
|
),
|
|
1821
|
-
/* @__PURE__ */ (0,
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "label-text ml-4", children: value })
|
|
1822
1638
|
] }) });
|
|
1823
1639
|
}
|
|
1824
1640
|
|
|
1825
1641
|
// src/widgets/RatingWidget/RatingWidget.tsx
|
|
1826
|
-
var
|
|
1827
|
-
var
|
|
1642
|
+
var import_react10 = require("react");
|
|
1643
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1828
1644
|
function RatingWidget({
|
|
1829
1645
|
id,
|
|
1830
1646
|
value,
|
|
@@ -1843,13 +1659,13 @@ function RatingWidget({
|
|
|
1843
1659
|
const min = schema.minimum || 0;
|
|
1844
1660
|
const maskClass = shape === "heart" ? "mask-heart" : "mask-star-2";
|
|
1845
1661
|
const sizeClass = size === "md" ? "" : `rating-${size}`;
|
|
1846
|
-
const _onChange = (0,
|
|
1662
|
+
const _onChange = (0, import_react10.useCallback)(
|
|
1847
1663
|
({ target: { value: value2 } }) => {
|
|
1848
1664
|
onChange(parseInt(value2));
|
|
1849
1665
|
},
|
|
1850
1666
|
[onChange]
|
|
1851
1667
|
);
|
|
1852
|
-
const handleFocus = (0,
|
|
1668
|
+
const handleFocus = (0, import_react10.useCallback)(
|
|
1853
1669
|
(event) => {
|
|
1854
1670
|
if (onFocus) {
|
|
1855
1671
|
const starValue = Number(event.target.value);
|
|
@@ -1858,7 +1674,7 @@ function RatingWidget({
|
|
|
1858
1674
|
},
|
|
1859
1675
|
[onFocus, id]
|
|
1860
1676
|
);
|
|
1861
|
-
const handleBlur = (0,
|
|
1677
|
+
const handleBlur = (0, import_react10.useCallback)(
|
|
1862
1678
|
(event) => {
|
|
1863
1679
|
if (onBlur) {
|
|
1864
1680
|
const starValue = Number(event.target.value);
|
|
@@ -1875,9 +1691,9 @@ function RatingWidget({
|
|
|
1875
1691
|
const colorIdx = Math.min(index, colors.length - 1);
|
|
1876
1692
|
return `bg-${colors[colorIdx]}-400`;
|
|
1877
1693
|
};
|
|
1878
|
-
return /* @__PURE__ */ (0,
|
|
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) => {
|
|
1879
1695
|
const starValue = min + index;
|
|
1880
|
-
return /* @__PURE__ */ (0,
|
|
1696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1881
1697
|
"input",
|
|
1882
1698
|
{
|
|
1883
1699
|
type: "radio",
|
|
@@ -1899,9 +1715,9 @@ function RatingWidget({
|
|
|
1899
1715
|
}
|
|
1900
1716
|
|
|
1901
1717
|
// src/widgets/SelectWidget/SelectWidget.tsx
|
|
1902
|
-
var
|
|
1718
|
+
var import_react11 = require("react");
|
|
1903
1719
|
var import_utils14 = require("@rjsf/utils");
|
|
1904
|
-
var
|
|
1720
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1905
1721
|
function SelectWidget({
|
|
1906
1722
|
schema,
|
|
1907
1723
|
id,
|
|
@@ -1931,7 +1747,7 @@ function SelectWidget({
|
|
|
1931
1747
|
return String(val);
|
|
1932
1748
|
};
|
|
1933
1749
|
const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
|
|
1934
|
-
const handleOptionClick = (0,
|
|
1750
|
+
const handleOptionClick = (0, import_react11.useCallback)(
|
|
1935
1751
|
(event) => {
|
|
1936
1752
|
const index = Number(event.currentTarget.dataset.value);
|
|
1937
1753
|
if (isNaN(index)) {
|
|
@@ -1950,7 +1766,7 @@ function SelectWidget({
|
|
|
1950
1766
|
},
|
|
1951
1767
|
[value, multiple, isEnumeratedObject, enumOptions, optEmptyVal, onChange]
|
|
1952
1768
|
);
|
|
1953
|
-
const _onBlur = (0,
|
|
1769
|
+
const _onBlur = (0, import_react11.useCallback)(
|
|
1954
1770
|
({ target }) => {
|
|
1955
1771
|
const dataValue = target?.getAttribute("data-value");
|
|
1956
1772
|
if (dataValue !== null) {
|
|
@@ -1959,7 +1775,7 @@ function SelectWidget({
|
|
|
1959
1775
|
},
|
|
1960
1776
|
[onBlur, id, enumOptions, optEmptyVal]
|
|
1961
1777
|
);
|
|
1962
|
-
const _onFocus = (0,
|
|
1778
|
+
const _onFocus = (0, import_react11.useCallback)(
|
|
1963
1779
|
({ target }) => {
|
|
1964
1780
|
const dataValue = target?.getAttribute("data-value");
|
|
1965
1781
|
if (dataValue !== null) {
|
|
@@ -1971,8 +1787,8 @@ function SelectWidget({
|
|
|
1971
1787
|
const selectedIndexes = (0, import_utils14.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1972
1788
|
const selectedValues = Array.isArray(selectedIndexes) ? selectedIndexes : [selectedIndexes];
|
|
1973
1789
|
const optionsList = enumOptions || (Array.isArray(schema.examples) ? schema.examples.map((example) => ({ value: example, label: example })) : []);
|
|
1974
|
-
return /* @__PURE__ */ (0,
|
|
1975
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1976
1792
|
"div",
|
|
1977
1793
|
{
|
|
1978
1794
|
tabIndex: 0,
|
|
@@ -1981,12 +1797,12 @@ function SelectWidget({
|
|
|
1981
1797
|
onBlur: _onBlur,
|
|
1982
1798
|
onFocus: _onFocus,
|
|
1983
1799
|
children: [
|
|
1984
|
-
/* @__PURE__ */ (0,
|
|
1985
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1986
1802
|
]
|
|
1987
1803
|
}
|
|
1988
1804
|
),
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1990
1806
|
"li",
|
|
1991
1807
|
{
|
|
1992
1808
|
role: "button",
|
|
@@ -1994,8 +1810,8 @@ function SelectWidget({
|
|
|
1994
1810
|
className: `px-4 py-2 hover:bg-base-200 cursor-pointer ${selectedValues.includes(String(i)) ? "bg-primary/10" : ""}`,
|
|
1995
1811
|
onClick: handleOptionClick,
|
|
1996
1812
|
"data-value": i,
|
|
1997
|
-
children: /* @__PURE__ */ (0,
|
|
1998
|
-
multiple && /* @__PURE__ */ (0,
|
|
1813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1814
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1999
1815
|
"input",
|
|
2000
1816
|
{
|
|
2001
1817
|
type: "checkbox",
|
|
@@ -2004,7 +1820,7 @@ function SelectWidget({
|
|
|
2004
1820
|
readOnly: true
|
|
2005
1821
|
}
|
|
2006
1822
|
),
|
|
2007
|
-
/* @__PURE__ */ (0,
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { children: isEnumeratedObject ? label2 : getDisplayValue(label2) })
|
|
2008
1824
|
] })
|
|
2009
1825
|
},
|
|
2010
1826
|
i
|
|
@@ -2013,11 +1829,11 @@ function SelectWidget({
|
|
|
2013
1829
|
}
|
|
2014
1830
|
|
|
2015
1831
|
// src/widgets/TextareaWidget/TextareaWidget.tsx
|
|
2016
|
-
var
|
|
2017
|
-
var
|
|
1832
|
+
var import_react12 = require("react");
|
|
1833
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2018
1834
|
function TextareaWidget(props) {
|
|
2019
|
-
const { id, value, required, disabled, readonly, onChange, onFocus, onBlur, options } = props;
|
|
2020
|
-
const handleFocus = (0,
|
|
1835
|
+
const { id, htmlName, value, required, disabled, readonly, onChange, onFocus, onBlur, options } = props;
|
|
1836
|
+
const handleFocus = (0, import_react12.useCallback)(
|
|
2021
1837
|
(event) => {
|
|
2022
1838
|
if (onFocus) {
|
|
2023
1839
|
onFocus(id, event.target.value);
|
|
@@ -2025,7 +1841,7 @@ function TextareaWidget(props) {
|
|
|
2025
1841
|
},
|
|
2026
1842
|
[onFocus, id]
|
|
2027
1843
|
);
|
|
2028
|
-
const handleBlur = (0,
|
|
1844
|
+
const handleBlur = (0, import_react12.useCallback)(
|
|
2029
1845
|
(event) => {
|
|
2030
1846
|
if (onBlur) {
|
|
2031
1847
|
onBlur(id, event.target.value);
|
|
@@ -2033,17 +1849,18 @@ function TextareaWidget(props) {
|
|
|
2033
1849
|
},
|
|
2034
1850
|
[onBlur, id]
|
|
2035
1851
|
);
|
|
2036
|
-
const handleChange = (0,
|
|
1852
|
+
const handleChange = (0, import_react12.useCallback)(
|
|
2037
1853
|
(event) => {
|
|
2038
1854
|
onChange(event.target.value);
|
|
2039
1855
|
},
|
|
2040
1856
|
[onChange]
|
|
2041
1857
|
);
|
|
2042
1858
|
const rows = options?.rows || 5;
|
|
2043
|
-
return /* @__PURE__ */ (0,
|
|
1859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2044
1860
|
"textarea",
|
|
2045
1861
|
{
|
|
2046
1862
|
id,
|
|
1863
|
+
name: htmlName || id,
|
|
2047
1864
|
value: value || "",
|
|
2048
1865
|
required,
|
|
2049
1866
|
disabled: disabled || readonly,
|
|
@@ -2058,11 +1875,11 @@ function TextareaWidget(props) {
|
|
|
2058
1875
|
}
|
|
2059
1876
|
|
|
2060
1877
|
// src/widgets/TimeWidget/TimeWidget.tsx
|
|
2061
|
-
var
|
|
2062
|
-
var
|
|
1878
|
+
var import_react13 = require("react");
|
|
1879
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2063
1880
|
function TimeWidget(props) {
|
|
2064
1881
|
const { id, value, onChange, onFocus, onBlur, required, disabled, readonly } = props;
|
|
2065
|
-
const handleFocus = (0,
|
|
1882
|
+
const handleFocus = (0, import_react13.useCallback)(
|
|
2066
1883
|
(event) => {
|
|
2067
1884
|
if (onFocus) {
|
|
2068
1885
|
onFocus(id, event.target.value);
|
|
@@ -2070,7 +1887,7 @@ function TimeWidget(props) {
|
|
|
2070
1887
|
},
|
|
2071
1888
|
[onFocus, id]
|
|
2072
1889
|
);
|
|
2073
|
-
const handleBlur = (0,
|
|
1890
|
+
const handleBlur = (0, import_react13.useCallback)(
|
|
2074
1891
|
(event) => {
|
|
2075
1892
|
if (onBlur) {
|
|
2076
1893
|
onBlur(id, event.target.value);
|
|
@@ -2078,13 +1895,13 @@ function TimeWidget(props) {
|
|
|
2078
1895
|
},
|
|
2079
1896
|
[onBlur, id]
|
|
2080
1897
|
);
|
|
2081
|
-
const handleChange = (0,
|
|
1898
|
+
const handleChange = (0, import_react13.useCallback)(
|
|
2082
1899
|
(event) => {
|
|
2083
1900
|
onChange(event.target.value);
|
|
2084
1901
|
},
|
|
2085
1902
|
[onChange]
|
|
2086
1903
|
);
|
|
2087
|
-
return /* @__PURE__ */ (0,
|
|
1904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "form-control", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2088
1905
|
"input",
|
|
2089
1906
|
{
|
|
2090
1907
|
type: "time",
|
|
@@ -2102,27 +1919,27 @@ function TimeWidget(props) {
|
|
|
2102
1919
|
}
|
|
2103
1920
|
|
|
2104
1921
|
// src/widgets/ToggleWidget/ToggleWidget.tsx
|
|
2105
|
-
var
|
|
2106
|
-
var
|
|
1922
|
+
var import_react14 = require("react");
|
|
1923
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2107
1924
|
function ToggleWidget({ id, value, required, disabled, readonly, autofocus, onChange, onFocus, onBlur, options }) {
|
|
2108
|
-
const _onChange = (0,
|
|
1925
|
+
const _onChange = (0, import_react14.useCallback)(
|
|
2109
1926
|
({ target: { checked } }) => onChange(checked),
|
|
2110
1927
|
[onChange]
|
|
2111
1928
|
);
|
|
2112
|
-
const handleFocus = (0,
|
|
1929
|
+
const handleFocus = (0, import_react14.useCallback)(() => {
|
|
2113
1930
|
if (onFocus) {
|
|
2114
1931
|
onFocus(id, value);
|
|
2115
1932
|
}
|
|
2116
1933
|
}, [onFocus, id, value]);
|
|
2117
|
-
const handleBlur = (0,
|
|
1934
|
+
const handleBlur = (0, import_react14.useCallback)(() => {
|
|
2118
1935
|
if (onBlur) {
|
|
2119
1936
|
onBlur(id, value);
|
|
2120
1937
|
}
|
|
2121
1938
|
}, [onBlur, id, value]);
|
|
2122
1939
|
const { size = "md" } = options;
|
|
2123
1940
|
const sizeClass = size !== "md" ? `toggle-${size}` : "";
|
|
2124
|
-
return /* @__PURE__ */ (0,
|
|
2125
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
2126
1943
|
"input",
|
|
2127
1944
|
{
|
|
2128
1945
|
type: "checkbox",
|
|
@@ -2137,7 +1954,7 @@ function ToggleWidget({ id, value, required, disabled, readonly, autofocus, onCh
|
|
|
2137
1954
|
className: `toggle ${sizeClass}`
|
|
2138
1955
|
}
|
|
2139
1956
|
),
|
|
2140
|
-
/* @__PURE__ */ (0,
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "label-text", children: options.label })
|
|
2141
1958
|
] }) });
|
|
2142
1959
|
}
|
|
2143
1960
|
|
|
@@ -2150,7 +1967,6 @@ function generateWidgets() {
|
|
|
2150
1967
|
CheckboxWidget,
|
|
2151
1968
|
DateTimeWidget,
|
|
2152
1969
|
DateWidget,
|
|
2153
|
-
FileWidget,
|
|
2154
1970
|
RadioWidget,
|
|
2155
1971
|
RangeWidget,
|
|
2156
1972
|
RatingWidget,
|
|
@@ -2163,7 +1979,7 @@ function generateWidgets() {
|
|
|
2163
1979
|
var Widgets_default = generateWidgets;
|
|
2164
1980
|
|
|
2165
1981
|
// src/theme/Theme.tsx
|
|
2166
|
-
var
|
|
1982
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2167
1983
|
function generateTheme() {
|
|
2168
1984
|
const { fields } = (0, import_core2.getDefaultRegistry)();
|
|
2169
1985
|
const generatedWidgets = generateWidgets();
|
|
@@ -2179,29 +1995,29 @@ function generateTheme() {
|
|
|
2179
1995
|
}
|
|
2180
1996
|
var Theme = generateTheme();
|
|
2181
1997
|
var Theme_default = Theme;
|
|
2182
|
-
var ThemeContext = (0,
|
|
1998
|
+
var ThemeContext = (0, import_react15.createContext)({
|
|
2183
1999
|
theme: "night",
|
|
2184
2000
|
setTheme: () => {
|
|
2185
2001
|
}
|
|
2186
2002
|
});
|
|
2187
2003
|
function ThemeProvider({ children }) {
|
|
2188
|
-
const [theme, setTheme] = (0,
|
|
2004
|
+
const [theme, setTheme] = (0, import_react15.useState)(() => {
|
|
2189
2005
|
try {
|
|
2190
2006
|
return localStorage.getItem("daisyui-theme") || "cupcake";
|
|
2191
2007
|
} catch {
|
|
2192
2008
|
return "cupcake";
|
|
2193
2009
|
}
|
|
2194
2010
|
});
|
|
2195
|
-
const handleSetTheme = (0,
|
|
2011
|
+
const handleSetTheme = (0, import_react15.useCallback)((newTheme) => {
|
|
2196
2012
|
try {
|
|
2197
2013
|
localStorage.setItem("daisyui-theme", newTheme);
|
|
2198
2014
|
setTheme(newTheme);
|
|
2199
2015
|
} catch {
|
|
2200
2016
|
}
|
|
2201
2017
|
}, []);
|
|
2202
|
-
return /* @__PURE__ */ (0,
|
|
2018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ThemeContext.Provider, { value: { theme, setTheme: handleSetTheme }, children });
|
|
2203
2019
|
}
|
|
2204
|
-
var useTheme = () => (0,
|
|
2020
|
+
var useTheme = () => (0, import_react15.useContext)(ThemeContext);
|
|
2205
2021
|
|
|
2206
2022
|
// src/DaisyUIForm.tsx
|
|
2207
2023
|
var import_core3 = require("@rjsf/core");
|
|
@@ -2209,8 +2025,8 @@ var DaisyUIForm = (0, import_core3.withTheme)(Theme_default);
|
|
|
2209
2025
|
var DaisyUIForm_default = DaisyUIForm;
|
|
2210
2026
|
|
|
2211
2027
|
// src/DaisyUIFrameProvider.tsx
|
|
2212
|
-
var
|
|
2213
|
-
var
|
|
2028
|
+
var import_react16 = require("react");
|
|
2029
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2214
2030
|
function DaisyUIFrameComponent(props) {
|
|
2215
2031
|
const { children, subtheme = {}, document: document2 } = props;
|
|
2216
2032
|
const theme = (() => {
|
|
@@ -2224,7 +2040,7 @@ function DaisyUIFrameComponent(props) {
|
|
|
2224
2040
|
return "cupcake";
|
|
2225
2041
|
}
|
|
2226
2042
|
})();
|
|
2227
|
-
(0,
|
|
2043
|
+
(0, import_react16.useEffect)(() => {
|
|
2228
2044
|
if (document2) {
|
|
2229
2045
|
const configScript = document2.createElement("script");
|
|
2230
2046
|
configScript.textContent = `
|
|
@@ -2259,11 +2075,11 @@ function DaisyUIFrameComponent(props) {
|
|
|
2259
2075
|
}
|
|
2260
2076
|
return void 0;
|
|
2261
2077
|
}, [document2]);
|
|
2262
|
-
return /* @__PURE__ */ (0,
|
|
2078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { "data-theme": theme, className: "daisy-ui-theme", children });
|
|
2263
2079
|
}
|
|
2264
2080
|
var __createDaisyUIFrameProvider = (props) => {
|
|
2265
2081
|
return function DaisyUIFrame({ document: document2 }) {
|
|
2266
|
-
return /* @__PURE__ */ (0,
|
|
2082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DaisyUIFrameComponent, { document: document2, ...props });
|
|
2267
2083
|
};
|
|
2268
2084
|
};
|
|
2269
2085
|
|