@rjsf/daisyui 6.0.0-beta.21 → 6.0.0-beta.22
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 +102 -113
- package/dist/chakra-ui.esm.js.map +3 -3
- package/dist/chakra-ui.umd.js +35 -44
- package/dist/index.cjs +140 -151
- package/dist/index.cjs.map +3 -3
- 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 +2 -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/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/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 +2 -1
- 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/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/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_react17 = 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,13 @@ 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,
|
|
240
231
|
value,
|
|
241
232
|
required,
|
|
242
233
|
disabled,
|
|
@@ -255,15 +246,15 @@ function BaseInputTemplate(props) {
|
|
|
255
246
|
const inputProps = (0, import_utils4.getInputProps)(schema, type, options);
|
|
256
247
|
const { step, min, max, accept, ...rest } = inputProps;
|
|
257
248
|
const htmlInputProps = { step, min, max, accept, ...schema.examples ? { list: (0, import_utils4.examplesId)(id) } : void 0 };
|
|
258
|
-
const _onChange = (0,
|
|
249
|
+
const _onChange = (0, import_react2.useCallback)(
|
|
259
250
|
({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2),
|
|
260
251
|
[onChange, options]
|
|
261
252
|
);
|
|
262
|
-
const _onBlur = (0,
|
|
253
|
+
const _onBlur = (0, import_react2.useCallback)(
|
|
263
254
|
({ target }) => onBlur && onBlur(id, target.value),
|
|
264
255
|
[onBlur, id]
|
|
265
256
|
);
|
|
266
|
-
const _onFocus = (0,
|
|
257
|
+
const _onFocus = (0, import_react2.useCallback)(
|
|
267
258
|
({ target }) => onFocus && onFocus(id, target.value),
|
|
268
259
|
[onFocus, id]
|
|
269
260
|
);
|
|
@@ -274,7 +265,7 @@ function BaseInputTemplate(props) {
|
|
|
274
265
|
"input",
|
|
275
266
|
{
|
|
276
267
|
id,
|
|
277
|
-
name: id,
|
|
268
|
+
name: htmlName || id,
|
|
278
269
|
value: value || value === 0 ? value : "",
|
|
279
270
|
placeholder,
|
|
280
271
|
required,
|
|
@@ -302,7 +293,7 @@ var import_fontawesome_svg_core = require("@fortawesome/fontawesome-svg-core");
|
|
|
302
293
|
var import_free_solid_svg_icons = require("@fortawesome/free-solid-svg-icons");
|
|
303
294
|
|
|
304
295
|
// src/templates/ButtonTemplates/DaisyUIButton.tsx
|
|
305
|
-
var
|
|
296
|
+
var import_react3 = require("react");
|
|
306
297
|
var import_react_fontawesome = require("@fortawesome/react-fontawesome");
|
|
307
298
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
308
299
|
function DaisyUIButton(props) {
|
|
@@ -310,7 +301,7 @@ function DaisyUIButton(props) {
|
|
|
310
301
|
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
302
|
}
|
|
312
303
|
DaisyUIButton.displayName = "DaisyUIButton";
|
|
313
|
-
var DaisyUIButton_default = (0,
|
|
304
|
+
var DaisyUIButton_default = (0, import_react3.memo)(DaisyUIButton);
|
|
314
305
|
|
|
315
306
|
// src/templates/ButtonTemplates/AddButton.tsx
|
|
316
307
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -453,21 +444,22 @@ function FieldTemplate(props) {
|
|
|
453
444
|
help,
|
|
454
445
|
hideError,
|
|
455
446
|
displayLabel,
|
|
447
|
+
onKeyRename,
|
|
448
|
+
onKeyRenameBlur,
|
|
449
|
+
onRemoveProperty,
|
|
456
450
|
classNames,
|
|
457
|
-
// Destructure props we don't want to pass to div
|
|
458
|
-
description,
|
|
459
|
-
onKeyChange,
|
|
460
|
-
onDropPropertyClick,
|
|
461
451
|
uiSchema,
|
|
462
452
|
schema,
|
|
463
453
|
readonly,
|
|
464
454
|
required,
|
|
455
|
+
registry,
|
|
456
|
+
// Destructure props we don't want to pass to div
|
|
457
|
+
description,
|
|
465
458
|
rawErrors,
|
|
466
459
|
rawHelp,
|
|
467
460
|
rawDescription,
|
|
468
461
|
hidden,
|
|
469
462
|
onChange,
|
|
470
|
-
registry,
|
|
471
463
|
...divProps
|
|
472
464
|
} = props;
|
|
473
465
|
const isCheckbox = schema.type === "boolean";
|
|
@@ -484,8 +476,9 @@ function FieldTemplate(props) {
|
|
|
484
476
|
disabled: divProps.disabled,
|
|
485
477
|
id,
|
|
486
478
|
label,
|
|
487
|
-
|
|
488
|
-
|
|
479
|
+
onKeyRename,
|
|
480
|
+
onKeyRenameBlur,
|
|
481
|
+
onRemoveProperty,
|
|
489
482
|
readonly,
|
|
490
483
|
required,
|
|
491
484
|
schema,
|
|
@@ -540,7 +533,7 @@ function ObjectFieldTemplate(props) {
|
|
|
540
533
|
schema,
|
|
541
534
|
formData,
|
|
542
535
|
optionalDataControl,
|
|
543
|
-
|
|
536
|
+
onAddProperty,
|
|
544
537
|
registry
|
|
545
538
|
} = props;
|
|
546
539
|
const uiOptions = (0, import_utils9.getUiOptions)(uiSchema);
|
|
@@ -595,7 +588,7 @@ function ObjectFieldTemplate(props) {
|
|
|
595
588
|
{
|
|
596
589
|
id: (0, import_utils9.buttonId)(fieldPathId, "add"),
|
|
597
590
|
className: "rjsf-object-property-expand btn btn-primary btn-sm",
|
|
598
|
-
onClick:
|
|
591
|
+
onClick: onAddProperty,
|
|
599
592
|
disabled: disabled || readonly,
|
|
600
593
|
uiSchema,
|
|
601
594
|
registry
|
|
@@ -658,7 +651,6 @@ function TitleField(props) {
|
|
|
658
651
|
}
|
|
659
652
|
|
|
660
653
|
// src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
661
|
-
var import_react5 = require("react");
|
|
662
654
|
var import_utils11 = require("@rjsf/utils");
|
|
663
655
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
664
656
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -672,8 +664,9 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
672
664
|
required,
|
|
673
665
|
schema,
|
|
674
666
|
uiSchema,
|
|
675
|
-
|
|
676
|
-
|
|
667
|
+
onKeyRename,
|
|
668
|
+
onKeyRenameBlur,
|
|
669
|
+
onRemoveProperty,
|
|
677
670
|
registry,
|
|
678
671
|
...rest
|
|
679
672
|
} = props;
|
|
@@ -681,15 +674,6 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
681
674
|
const { templates, translateString } = registry;
|
|
682
675
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
683
676
|
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
677
|
if (!additional) {
|
|
694
678
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: classNames, children });
|
|
695
679
|
}
|
|
@@ -702,7 +686,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
702
686
|
type: "text",
|
|
703
687
|
className: "input input-bordered",
|
|
704
688
|
id: `${id}-key`,
|
|
705
|
-
onBlur:
|
|
689
|
+
onBlur: onKeyRenameBlur,
|
|
706
690
|
defaultValue: label,
|
|
707
691
|
disabled: disabled || readonly
|
|
708
692
|
}
|
|
@@ -715,7 +699,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
715
699
|
id: (0, import_utils11.buttonId)(id, "remove"),
|
|
716
700
|
className: "rjsf-object-property-remove",
|
|
717
701
|
disabled: disabled || readonly,
|
|
718
|
-
onClick:
|
|
702
|
+
onClick: onRemoveProperty,
|
|
719
703
|
uiSchema,
|
|
720
704
|
registry
|
|
721
705
|
}
|
|
@@ -765,7 +749,7 @@ function AltDateTimeWidget({
|
|
|
765
749
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
766
750
|
|
|
767
751
|
// src/widgets/AltDateWidget/AltDateWidget.tsx
|
|
768
|
-
var
|
|
752
|
+
var import_react4 = require("react");
|
|
769
753
|
var import_utils12 = require("@rjsf/utils");
|
|
770
754
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
771
755
|
function readyForChange(state, time = false) {
|
|
@@ -808,7 +792,7 @@ function DateElement({
|
|
|
808
792
|
}) {
|
|
809
793
|
const id = `${rootId}_${type}`;
|
|
810
794
|
const { SelectWidget: SelectWidget2 } = registry.widgets;
|
|
811
|
-
const handleChange = (0,
|
|
795
|
+
const handleChange = (0, import_react4.useCallback)(
|
|
812
796
|
(value2) => {
|
|
813
797
|
select(type, value2);
|
|
814
798
|
},
|
|
@@ -862,13 +846,13 @@ function AltDateWidget({
|
|
|
862
846
|
value
|
|
863
847
|
}) {
|
|
864
848
|
const { translateString } = registry;
|
|
865
|
-
const [lastValue, setLastValue] = (0,
|
|
849
|
+
const [lastValue, setLastValue] = (0, import_react4.useState)(value);
|
|
866
850
|
const initialState = (0, import_utils12.parseDateString)(value, time);
|
|
867
851
|
const dateReducer = (state2, action) => {
|
|
868
852
|
return { ...state2, ...action };
|
|
869
853
|
};
|
|
870
|
-
const [state, setState] = (0,
|
|
871
|
-
(0,
|
|
854
|
+
const [state, setState] = (0, import_react4.useReducer)(dateReducer, initialState);
|
|
855
|
+
(0, import_react4.useEffect)(() => {
|
|
872
856
|
const rjsfDateObj = convertToRJSFDateObject(state);
|
|
873
857
|
const stateValue = (0, import_utils12.toDateString)(rjsfDateObj, time);
|
|
874
858
|
if (readyForChange(state, time) && stateValue !== value) {
|
|
@@ -878,10 +862,10 @@ function AltDateWidget({
|
|
|
878
862
|
setState((0, import_utils12.parseDateString)(value, time));
|
|
879
863
|
}
|
|
880
864
|
}, [time, value, onChange, state, lastValue]);
|
|
881
|
-
const handleChange = (0,
|
|
865
|
+
const handleChange = (0, import_react4.useCallback)((property, value2) => {
|
|
882
866
|
setState({ [property]: value2 });
|
|
883
867
|
}, []);
|
|
884
|
-
const handleSetNow = (0,
|
|
868
|
+
const handleSetNow = (0, import_react4.useCallback)(
|
|
885
869
|
(event) => {
|
|
886
870
|
event.preventDefault();
|
|
887
871
|
if (disabled || readonly) {
|
|
@@ -893,7 +877,7 @@ function AltDateWidget({
|
|
|
893
877
|
},
|
|
894
878
|
[disabled, readonly, time, onChange]
|
|
895
879
|
);
|
|
896
|
-
const handleClear = (0,
|
|
880
|
+
const handleClear = (0, import_react4.useCallback)(
|
|
897
881
|
(event) => {
|
|
898
882
|
event.preventDefault();
|
|
899
883
|
if (disabled || readonly) {
|
|
@@ -955,12 +939,13 @@ function AltDateWidget({
|
|
|
955
939
|
}
|
|
956
940
|
|
|
957
941
|
// src/widgets/CheckboxWidget/CheckboxWidget.tsx
|
|
958
|
-
var
|
|
942
|
+
var import_react5 = require("react");
|
|
959
943
|
var import_utils13 = require("@rjsf/utils");
|
|
960
944
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
961
945
|
function CheckboxWidget(props) {
|
|
962
946
|
const {
|
|
963
947
|
id,
|
|
948
|
+
htmlName,
|
|
964
949
|
value,
|
|
965
950
|
required,
|
|
966
951
|
disabled,
|
|
@@ -981,17 +966,17 @@ function CheckboxWidget(props) {
|
|
|
981
966
|
options
|
|
982
967
|
);
|
|
983
968
|
const description = options.description || schema.description;
|
|
984
|
-
const handleFocus = (0,
|
|
969
|
+
const handleFocus = (0, import_react5.useCallback)(() => {
|
|
985
970
|
if (onFocus) {
|
|
986
971
|
onFocus(id, value);
|
|
987
972
|
}
|
|
988
973
|
}, [onFocus, id, value]);
|
|
989
|
-
const handleBlur = (0,
|
|
974
|
+
const handleBlur = (0, import_react5.useCallback)(() => {
|
|
990
975
|
if (onBlur) {
|
|
991
976
|
onBlur(id, value);
|
|
992
977
|
}
|
|
993
978
|
}, [onBlur, id, value]);
|
|
994
|
-
const handleChange = (0,
|
|
979
|
+
const handleChange = (0, import_react5.useCallback)(
|
|
995
980
|
(event) => {
|
|
996
981
|
onChange(event.target.checked);
|
|
997
982
|
},
|
|
@@ -1002,6 +987,7 @@ function CheckboxWidget(props) {
|
|
|
1002
987
|
{
|
|
1003
988
|
type: "checkbox",
|
|
1004
989
|
id,
|
|
990
|
+
name: htmlName || id,
|
|
1005
991
|
checked: value,
|
|
1006
992
|
required,
|
|
1007
993
|
disabled: disabled || readonly,
|
|
@@ -1033,10 +1019,11 @@ function CheckboxWidget(props) {
|
|
|
1033
1019
|
}
|
|
1034
1020
|
|
|
1035
1021
|
// src/widgets/CheckboxesWidget/CheckboxesWidget.tsx
|
|
1036
|
-
var
|
|
1022
|
+
var import_react6 = require("react");
|
|
1037
1023
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1038
1024
|
function CheckboxesWidget({
|
|
1039
1025
|
id,
|
|
1026
|
+
htmlName,
|
|
1040
1027
|
disabled,
|
|
1041
1028
|
options,
|
|
1042
1029
|
value,
|
|
@@ -1048,7 +1035,7 @@ function CheckboxesWidget({
|
|
|
1048
1035
|
}) {
|
|
1049
1036
|
const { enumOptions } = options;
|
|
1050
1037
|
const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
|
|
1051
|
-
const isChecked = (0,
|
|
1038
|
+
const isChecked = (0, import_react6.useCallback)(
|
|
1052
1039
|
(option) => {
|
|
1053
1040
|
if (!Array.isArray(value)) {
|
|
1054
1041
|
return false;
|
|
@@ -1060,7 +1047,7 @@ function CheckboxesWidget({
|
|
|
1060
1047
|
},
|
|
1061
1048
|
[value, isEnumeratedObject]
|
|
1062
1049
|
);
|
|
1063
|
-
const handleChange = (0,
|
|
1050
|
+
const handleChange = (0, import_react6.useCallback)(
|
|
1064
1051
|
(event) => {
|
|
1065
1052
|
const index = Number(event.target.dataset.index);
|
|
1066
1053
|
const option = enumOptions?.[index];
|
|
@@ -1077,7 +1064,7 @@ function CheckboxesWidget({
|
|
|
1077
1064
|
},
|
|
1078
1065
|
[onChange, value, isChecked, isEnumeratedObject, enumOptions]
|
|
1079
1066
|
);
|
|
1080
|
-
const handleFocus = (0,
|
|
1067
|
+
const handleFocus = (0, import_react6.useCallback)(
|
|
1081
1068
|
(event) => {
|
|
1082
1069
|
if (onFocus) {
|
|
1083
1070
|
const index = Number(event.target.dataset.index);
|
|
@@ -1089,7 +1076,7 @@ function CheckboxesWidget({
|
|
|
1089
1076
|
},
|
|
1090
1077
|
[onFocus, id, enumOptions]
|
|
1091
1078
|
);
|
|
1092
|
-
const handleBlur = (0,
|
|
1079
|
+
const handleBlur = (0, import_react6.useCallback)(
|
|
1093
1080
|
(event) => {
|
|
1094
1081
|
if (onBlur) {
|
|
1095
1082
|
const index = Number(event.target.dataset.index);
|
|
@@ -1108,7 +1095,7 @@ function CheckboxesWidget({
|
|
|
1108
1095
|
type: "checkbox",
|
|
1109
1096
|
id: `${id}-${option.value}`,
|
|
1110
1097
|
className: "checkbox",
|
|
1111
|
-
name: id,
|
|
1098
|
+
name: htmlName || id,
|
|
1112
1099
|
checked: isChecked(option),
|
|
1113
1100
|
required,
|
|
1114
1101
|
disabled: disabled || readonly,
|
|
@@ -1123,7 +1110,7 @@ function CheckboxesWidget({
|
|
|
1123
1110
|
}
|
|
1124
1111
|
|
|
1125
1112
|
// src/widgets/DateTimeWidget/DateTimeWidget.tsx
|
|
1126
|
-
var
|
|
1113
|
+
var import_react7 = require("react");
|
|
1127
1114
|
var import_free_solid_svg_icons4 = require("@fortawesome/free-solid-svg-icons");
|
|
1128
1115
|
var import_react_fontawesome2 = require("@fortawesome/react-fontawesome");
|
|
1129
1116
|
var import_date_fns = require("date-fns");
|
|
@@ -1131,12 +1118,12 @@ var import_react_day_picker = require("react-day-picker");
|
|
|
1131
1118
|
var import_style = require("react-day-picker/dist/style.css");
|
|
1132
1119
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1133
1120
|
function useDatePickerState(initialDate) {
|
|
1134
|
-
const [isOpen, setIsOpen] = (0,
|
|
1135
|
-
const [month, setMonth] = (0,
|
|
1121
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
1122
|
+
const [month, setMonth] = (0, import_react7.useState)(initialDate ?? /* @__PURE__ */ new Date());
|
|
1136
1123
|
return { isOpen, setIsOpen, month, setMonth };
|
|
1137
1124
|
}
|
|
1138
1125
|
function useClickOutside(ref, callback) {
|
|
1139
|
-
(0,
|
|
1126
|
+
(0, import_react7.useEffect)(() => {
|
|
1140
1127
|
const handleClickOutside = (event) => {
|
|
1141
1128
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1142
1129
|
callback();
|
|
@@ -1181,7 +1168,7 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
|
|
|
1181
1168
|
...dayPickerStyles.modifiers,
|
|
1182
1169
|
"custom-today": "btn btn-outline btn-info min-h-0 h-full"
|
|
1183
1170
|
};
|
|
1184
|
-
const handleClick = (0,
|
|
1171
|
+
const handleClick = (0, import_react7.useCallback)((e) => {
|
|
1185
1172
|
e.stopPropagation();
|
|
1186
1173
|
}, []);
|
|
1187
1174
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "p-3", children: [
|
|
@@ -1217,17 +1204,17 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
|
|
|
1217
1204
|
] }) })
|
|
1218
1205
|
] });
|
|
1219
1206
|
}
|
|
1220
|
-
var MemoizedDateTimePickerPopup = (0,
|
|
1207
|
+
var MemoizedDateTimePickerPopup = (0, import_react7.memo)(DateTimePickerPopup);
|
|
1221
1208
|
function DateTimeWidget(props) {
|
|
1222
1209
|
const { id, value, onChange, onFocus, onBlur, schema } = props;
|
|
1223
|
-
const initialDate = (0,
|
|
1224
|
-
const [localDate, setLocalDate] = (0,
|
|
1225
|
-
(0,
|
|
1210
|
+
const initialDate = (0, import_react7.useMemo)(() => value ? new Date(value) : void 0, [value]);
|
|
1211
|
+
const [localDate, setLocalDate] = (0, import_react7.useState)(initialDate);
|
|
1212
|
+
(0, import_react7.useEffect)(() => {
|
|
1226
1213
|
setLocalDate(initialDate);
|
|
1227
1214
|
}, [initialDate]);
|
|
1228
1215
|
const { isOpen, setIsOpen, month, setMonth } = useDatePickerState(initialDate);
|
|
1229
|
-
const containerRef = (0,
|
|
1230
|
-
const inputRef = (0,
|
|
1216
|
+
const containerRef = (0, import_react7.useRef)(null);
|
|
1217
|
+
const inputRef = (0, import_react7.useRef)(null);
|
|
1231
1218
|
useClickOutside(containerRef, () => {
|
|
1232
1219
|
if (isOpen) {
|
|
1233
1220
|
setIsOpen(false);
|
|
@@ -1237,13 +1224,13 @@ function DateTimeWidget(props) {
|
|
|
1237
1224
|
}
|
|
1238
1225
|
}
|
|
1239
1226
|
});
|
|
1240
|
-
(0,
|
|
1227
|
+
(0, import_react7.useEffect)(() => {
|
|
1241
1228
|
if (localDate) {
|
|
1242
1229
|
setMonth(localDate);
|
|
1243
1230
|
}
|
|
1244
1231
|
}, [localDate, setMonth]);
|
|
1245
|
-
const handleMonthChange = (0,
|
|
1246
|
-
const handleSelect = (0,
|
|
1232
|
+
const handleMonthChange = (0, import_react7.useCallback)((date) => setMonth(date), [setMonth]);
|
|
1233
|
+
const handleSelect = (0, import_react7.useCallback)(
|
|
1247
1234
|
(date) => {
|
|
1248
1235
|
if (date) {
|
|
1249
1236
|
if (localDate) {
|
|
@@ -1254,7 +1241,7 @@ function DateTimeWidget(props) {
|
|
|
1254
1241
|
},
|
|
1255
1242
|
[localDate]
|
|
1256
1243
|
);
|
|
1257
|
-
const handleTimeChange = (0,
|
|
1244
|
+
const handleTimeChange = (0, import_react7.useCallback)(
|
|
1258
1245
|
(e) => {
|
|
1259
1246
|
if (localDate) {
|
|
1260
1247
|
const [hours, minutes] = e.target.value.split(":");
|
|
@@ -1265,7 +1252,7 @@ function DateTimeWidget(props) {
|
|
|
1265
1252
|
},
|
|
1266
1253
|
[localDate]
|
|
1267
1254
|
);
|
|
1268
|
-
const togglePicker = (0,
|
|
1255
|
+
const togglePicker = (0, import_react7.useCallback)(
|
|
1269
1256
|
(e) => {
|
|
1270
1257
|
e.stopPropagation();
|
|
1271
1258
|
setIsOpen((prev) => !prev);
|
|
@@ -1275,17 +1262,17 @@ function DateTimeWidget(props) {
|
|
|
1275
1262
|
},
|
|
1276
1263
|
[isOpen, id, onFocus, setIsOpen, value]
|
|
1277
1264
|
);
|
|
1278
|
-
const handleFocus = (0,
|
|
1265
|
+
const handleFocus = (0, import_react7.useCallback)(() => {
|
|
1279
1266
|
if (onFocus) {
|
|
1280
1267
|
onFocus(id, value);
|
|
1281
1268
|
}
|
|
1282
1269
|
}, [id, onFocus, value]);
|
|
1283
|
-
const handleBlur = (0,
|
|
1270
|
+
const handleBlur = (0, import_react7.useCallback)(() => {
|
|
1284
1271
|
if (!isOpen && onBlur) {
|
|
1285
1272
|
onBlur(id, value);
|
|
1286
1273
|
}
|
|
1287
1274
|
}, [id, onBlur, value, isOpen]);
|
|
1288
|
-
const handleKeyDown = (0,
|
|
1275
|
+
const handleKeyDown = (0, import_react7.useCallback)(
|
|
1289
1276
|
(e) => {
|
|
1290
1277
|
if (e.key === "Enter" || e.key === " ") {
|
|
1291
1278
|
togglePicker(e);
|
|
@@ -1293,10 +1280,10 @@ function DateTimeWidget(props) {
|
|
|
1293
1280
|
},
|
|
1294
1281
|
[togglePicker]
|
|
1295
1282
|
);
|
|
1296
|
-
const handleContainerClick = (0,
|
|
1283
|
+
const handleContainerClick = (0, import_react7.useCallback)((e) => {
|
|
1297
1284
|
e.stopPropagation();
|
|
1298
1285
|
}, []);
|
|
1299
|
-
(0,
|
|
1286
|
+
(0, import_react7.useEffect)(() => {
|
|
1300
1287
|
const handleEscape = (e) => {
|
|
1301
1288
|
if (e.key === "Escape" && isOpen) {
|
|
1302
1289
|
setIsOpen(false);
|
|
@@ -1308,7 +1295,7 @@ function DateTimeWidget(props) {
|
|
|
1308
1295
|
document.addEventListener("keydown", handleEscape);
|
|
1309
1296
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
1310
1297
|
}, [id, isOpen, setIsOpen, onBlur, value]);
|
|
1311
|
-
const handleDoneClick = (0,
|
|
1298
|
+
const handleDoneClick = (0, import_react7.useCallback)(() => {
|
|
1312
1299
|
setIsOpen(false);
|
|
1313
1300
|
onChange(localDate ? localDate.toISOString() : "");
|
|
1314
1301
|
if (onBlur) {
|
|
@@ -1369,7 +1356,7 @@ function DateTimeWidget(props) {
|
|
|
1369
1356
|
}
|
|
1370
1357
|
|
|
1371
1358
|
// src/widgets/DateWidget/DateWidget.tsx
|
|
1372
|
-
var
|
|
1359
|
+
var import_react8 = require("react");
|
|
1373
1360
|
var import_free_solid_svg_icons5 = require("@fortawesome/free-solid-svg-icons");
|
|
1374
1361
|
var import_react_fontawesome3 = require("@fortawesome/react-fontawesome");
|
|
1375
1362
|
var import_date_fns2 = require("date-fns");
|
|
@@ -1377,12 +1364,12 @@ var import_react_day_picker2 = require("react-day-picker");
|
|
|
1377
1364
|
var import_style2 = require("react-day-picker/dist/style.css");
|
|
1378
1365
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1379
1366
|
function useDatePickerState2(initialDate) {
|
|
1380
|
-
const [isOpen, setIsOpen] = (0,
|
|
1381
|
-
const [month, setMonth] = (0,
|
|
1367
|
+
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
1368
|
+
const [month, setMonth] = (0, import_react8.useState)(initialDate ?? /* @__PURE__ */ new Date());
|
|
1382
1369
|
return { isOpen, setIsOpen, month, setMonth };
|
|
1383
1370
|
}
|
|
1384
1371
|
function useClickOutside2(ref, callback) {
|
|
1385
|
-
(0,
|
|
1372
|
+
(0, import_react8.useEffect)(() => {
|
|
1386
1373
|
const handleClickOutside = (event) => {
|
|
1387
1374
|
if (ref.current && !ref.current.contains(event.target)) {
|
|
1388
1375
|
callback();
|
|
@@ -1445,17 +1432,17 @@ function DatePickerPopup({ selectedDate, month, onMonthChange, onSelect }) {
|
|
|
1445
1432
|
}
|
|
1446
1433
|
) });
|
|
1447
1434
|
}
|
|
1448
|
-
var MemoizedDatePickerPopup = (0,
|
|
1435
|
+
var MemoizedDatePickerPopup = (0, import_react8.memo)(DatePickerPopup);
|
|
1449
1436
|
function DateWidget(props) {
|
|
1450
1437
|
const { id, value, onChange, onFocus, onBlur, schema } = props;
|
|
1451
|
-
const initialDate = (0,
|
|
1452
|
-
const [localDate, setLocalDate] = (0,
|
|
1453
|
-
(0,
|
|
1438
|
+
const initialDate = (0, import_react8.useMemo)(() => value ? new Date(value) : void 0, [value]);
|
|
1439
|
+
const [localDate, setLocalDate] = (0, import_react8.useState)(initialDate);
|
|
1440
|
+
(0, import_react8.useEffect)(() => {
|
|
1454
1441
|
setLocalDate(initialDate);
|
|
1455
1442
|
}, [initialDate]);
|
|
1456
1443
|
const { isOpen, setIsOpen, month, setMonth } = useDatePickerState2(initialDate);
|
|
1457
|
-
const containerRef = (0,
|
|
1458
|
-
const inputRef = (0,
|
|
1444
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
1445
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
1459
1446
|
useClickOutside2(containerRef, () => {
|
|
1460
1447
|
if (isOpen) {
|
|
1461
1448
|
setIsOpen(false);
|
|
@@ -1465,19 +1452,19 @@ function DateWidget(props) {
|
|
|
1465
1452
|
}
|
|
1466
1453
|
}
|
|
1467
1454
|
});
|
|
1468
|
-
(0,
|
|
1455
|
+
(0, import_react8.useEffect)(() => {
|
|
1469
1456
|
if (localDate) {
|
|
1470
1457
|
setMonth(localDate);
|
|
1471
1458
|
}
|
|
1472
1459
|
}, [localDate, setMonth]);
|
|
1473
|
-
const handleMonthChange = (0,
|
|
1474
|
-
const handleSelect = (0,
|
|
1460
|
+
const handleMonthChange = (0, import_react8.useCallback)((date) => setMonth(date), [setMonth]);
|
|
1461
|
+
const handleSelect = (0, import_react8.useCallback)((date) => {
|
|
1475
1462
|
if (date) {
|
|
1476
1463
|
date.setHours(0, 0, 0, 0);
|
|
1477
1464
|
setLocalDate(date);
|
|
1478
1465
|
}
|
|
1479
1466
|
}, []);
|
|
1480
|
-
(0,
|
|
1467
|
+
(0, import_react8.useEffect)(() => {
|
|
1481
1468
|
let portalContainer = document.getElementById("date-picker-portal");
|
|
1482
1469
|
if (!portalContainer) {
|
|
1483
1470
|
portalContainer = document.createElement("div");
|
|
@@ -1509,7 +1496,7 @@ function DateWidget(props) {
|
|
|
1509
1496
|
}
|
|
1510
1497
|
return { doc, win };
|
|
1511
1498
|
};
|
|
1512
|
-
const renderCalendar = (0,
|
|
1499
|
+
const renderCalendar = (0, import_react8.useCallback)(() => {
|
|
1513
1500
|
if (!containerRef.current || !inputRef.current) {
|
|
1514
1501
|
return;
|
|
1515
1502
|
}
|
|
@@ -1527,7 +1514,7 @@ function DateWidget(props) {
|
|
|
1527
1514
|
}
|
|
1528
1515
|
containerRef.current.style.zIndex = "99999";
|
|
1529
1516
|
}, [containerRef, inputRef]);
|
|
1530
|
-
(0,
|
|
1517
|
+
(0, import_react8.useEffect)(() => {
|
|
1531
1518
|
if (!isOpen) {
|
|
1532
1519
|
return;
|
|
1533
1520
|
}
|
|
@@ -1539,7 +1526,7 @@ function DateWidget(props) {
|
|
|
1539
1526
|
window.removeEventListener("scroll", renderCalendar);
|
|
1540
1527
|
};
|
|
1541
1528
|
}, [isOpen, renderCalendar]);
|
|
1542
|
-
const togglePicker = (0,
|
|
1529
|
+
const togglePicker = (0, import_react8.useCallback)(
|
|
1543
1530
|
(e) => {
|
|
1544
1531
|
e.stopPropagation();
|
|
1545
1532
|
setIsOpen((prev) => !prev);
|
|
@@ -1549,17 +1536,17 @@ function DateWidget(props) {
|
|
|
1549
1536
|
},
|
|
1550
1537
|
[isOpen, id, onFocus, setIsOpen, value]
|
|
1551
1538
|
);
|
|
1552
|
-
const handleFocus = (0,
|
|
1539
|
+
const handleFocus = (0, import_react8.useCallback)(() => {
|
|
1553
1540
|
if (onFocus) {
|
|
1554
1541
|
onFocus(id, value);
|
|
1555
1542
|
}
|
|
1556
1543
|
}, [id, onFocus, value]);
|
|
1557
|
-
const handleBlur = (0,
|
|
1544
|
+
const handleBlur = (0, import_react8.useCallback)(() => {
|
|
1558
1545
|
if (!isOpen && onBlur) {
|
|
1559
1546
|
onBlur(id, value);
|
|
1560
1547
|
}
|
|
1561
1548
|
}, [id, onBlur, value, isOpen]);
|
|
1562
|
-
(0,
|
|
1549
|
+
(0, import_react8.useEffect)(() => {
|
|
1563
1550
|
const handleEscape = (e) => {
|
|
1564
1551
|
if (e.key === "Escape" && isOpen) {
|
|
1565
1552
|
setIsOpen(false);
|
|
@@ -1571,7 +1558,7 @@ function DateWidget(props) {
|
|
|
1571
1558
|
document.addEventListener("keydown", handleEscape);
|
|
1572
1559
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
1573
1560
|
}, [id, isOpen, setIsOpen, onBlur, value]);
|
|
1574
|
-
const handleDoneClick = (0,
|
|
1561
|
+
const handleDoneClick = (0, import_react8.useCallback)(() => {
|
|
1575
1562
|
setIsOpen(false);
|
|
1576
1563
|
onChange(localDate ? localDate.toISOString() : "");
|
|
1577
1564
|
if (onBlur) {
|
|
@@ -1639,13 +1626,13 @@ function DateWidget(props) {
|
|
|
1639
1626
|
}
|
|
1640
1627
|
|
|
1641
1628
|
// src/widgets/FileWidget/FileWidget.tsx
|
|
1642
|
-
var
|
|
1629
|
+
var import_react9 = require("react");
|
|
1643
1630
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1644
1631
|
function FileWidget(props) {
|
|
1645
1632
|
const { id, required, disabled, readonly, schema, onChange, onFocus, onBlur, options = {} } = props;
|
|
1646
1633
|
const isMulti = schema.type === "array" || Boolean(options.multiple);
|
|
1647
1634
|
const accept = typeof options.accept === "string" ? options.accept : void 0;
|
|
1648
|
-
const handleChange = (0,
|
|
1635
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1649
1636
|
(event) => {
|
|
1650
1637
|
if (!event.target.files) {
|
|
1651
1638
|
return;
|
|
@@ -1659,7 +1646,7 @@ function FileWidget(props) {
|
|
|
1659
1646
|
},
|
|
1660
1647
|
[onChange, isMulti]
|
|
1661
1648
|
);
|
|
1662
|
-
const handleFocus = (0,
|
|
1649
|
+
const handleFocus = (0, import_react9.useCallback)(
|
|
1663
1650
|
(event) => {
|
|
1664
1651
|
if (onFocus) {
|
|
1665
1652
|
onFocus(id, event.target.files ? Array.from(event.target.files) : null);
|
|
@@ -1667,7 +1654,7 @@ function FileWidget(props) {
|
|
|
1667
1654
|
},
|
|
1668
1655
|
[onFocus, id]
|
|
1669
1656
|
);
|
|
1670
|
-
const handleBlur = (0,
|
|
1657
|
+
const handleBlur = (0, import_react9.useCallback)(
|
|
1671
1658
|
(event) => {
|
|
1672
1659
|
if (onBlur) {
|
|
1673
1660
|
onBlur(id, event.target.files ? Array.from(event.target.files) : null);
|
|
@@ -1693,10 +1680,11 @@ function FileWidget(props) {
|
|
|
1693
1680
|
}
|
|
1694
1681
|
|
|
1695
1682
|
// src/widgets/RadioWidget/RadioWidget.tsx
|
|
1696
|
-
var
|
|
1683
|
+
var import_react10 = require("react");
|
|
1697
1684
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1698
1685
|
function RadioWidget({
|
|
1699
1686
|
id,
|
|
1687
|
+
htmlName,
|
|
1700
1688
|
options,
|
|
1701
1689
|
value,
|
|
1702
1690
|
required,
|
|
@@ -1717,7 +1705,7 @@ function RadioWidget({
|
|
|
1717
1705
|
}
|
|
1718
1706
|
return value === option.value;
|
|
1719
1707
|
};
|
|
1720
|
-
const handleFocus = (0,
|
|
1708
|
+
const handleFocus = (0, import_react10.useCallback)(
|
|
1721
1709
|
(event) => {
|
|
1722
1710
|
if (onFocus) {
|
|
1723
1711
|
const index = Number(event.target.dataset.index);
|
|
@@ -1727,7 +1715,7 @@ function RadioWidget({
|
|
|
1727
1715
|
},
|
|
1728
1716
|
[onFocus, id, enumOptions]
|
|
1729
1717
|
);
|
|
1730
|
-
const handleBlur = (0,
|
|
1718
|
+
const handleBlur = (0, import_react10.useCallback)(
|
|
1731
1719
|
(event) => {
|
|
1732
1720
|
if (onBlur) {
|
|
1733
1721
|
const index = Number(event.target.dataset.index);
|
|
@@ -1737,7 +1725,7 @@ function RadioWidget({
|
|
|
1737
1725
|
},
|
|
1738
1726
|
[onBlur, id, enumOptions]
|
|
1739
1727
|
);
|
|
1740
|
-
const handleChange = (0,
|
|
1728
|
+
const handleChange = (0, import_react10.useCallback)(
|
|
1741
1729
|
(event) => {
|
|
1742
1730
|
const index = Number(event.target.dataset.index);
|
|
1743
1731
|
const option = enumOptions?.[index];
|
|
@@ -1755,7 +1743,7 @@ function RadioWidget({
|
|
|
1755
1743
|
type: "radio",
|
|
1756
1744
|
id: `${id}-${option.value}`,
|
|
1757
1745
|
className: "radio",
|
|
1758
|
-
name: id,
|
|
1746
|
+
name: htmlName || id,
|
|
1759
1747
|
value: getValue(option),
|
|
1760
1748
|
checked: isChecked(option),
|
|
1761
1749
|
required,
|
|
@@ -1771,7 +1759,7 @@ function RadioWidget({
|
|
|
1771
1759
|
}
|
|
1772
1760
|
|
|
1773
1761
|
// src/widgets/RangeWidget/RangeWidget.tsx
|
|
1774
|
-
var
|
|
1762
|
+
var import_react11 = require("react");
|
|
1775
1763
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1776
1764
|
function RangeWidget({
|
|
1777
1765
|
id,
|
|
@@ -1794,7 +1782,7 @@ function RangeWidget({
|
|
|
1794
1782
|
onBlur(id, event.target.value);
|
|
1795
1783
|
}
|
|
1796
1784
|
};
|
|
1797
|
-
const handleChange = (0,
|
|
1785
|
+
const handleChange = (0, import_react11.useCallback)(
|
|
1798
1786
|
(event) => {
|
|
1799
1787
|
onChange(event.target.value);
|
|
1800
1788
|
},
|
|
@@ -1823,7 +1811,7 @@ function RangeWidget({
|
|
|
1823
1811
|
}
|
|
1824
1812
|
|
|
1825
1813
|
// src/widgets/RatingWidget/RatingWidget.tsx
|
|
1826
|
-
var
|
|
1814
|
+
var import_react12 = require("react");
|
|
1827
1815
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1828
1816
|
function RatingWidget({
|
|
1829
1817
|
id,
|
|
@@ -1843,13 +1831,13 @@ function RatingWidget({
|
|
|
1843
1831
|
const min = schema.minimum || 0;
|
|
1844
1832
|
const maskClass = shape === "heart" ? "mask-heart" : "mask-star-2";
|
|
1845
1833
|
const sizeClass = size === "md" ? "" : `rating-${size}`;
|
|
1846
|
-
const _onChange = (0,
|
|
1834
|
+
const _onChange = (0, import_react12.useCallback)(
|
|
1847
1835
|
({ target: { value: value2 } }) => {
|
|
1848
1836
|
onChange(parseInt(value2));
|
|
1849
1837
|
},
|
|
1850
1838
|
[onChange]
|
|
1851
1839
|
);
|
|
1852
|
-
const handleFocus = (0,
|
|
1840
|
+
const handleFocus = (0, import_react12.useCallback)(
|
|
1853
1841
|
(event) => {
|
|
1854
1842
|
if (onFocus) {
|
|
1855
1843
|
const starValue = Number(event.target.value);
|
|
@@ -1858,7 +1846,7 @@ function RatingWidget({
|
|
|
1858
1846
|
},
|
|
1859
1847
|
[onFocus, id]
|
|
1860
1848
|
);
|
|
1861
|
-
const handleBlur = (0,
|
|
1849
|
+
const handleBlur = (0, import_react12.useCallback)(
|
|
1862
1850
|
(event) => {
|
|
1863
1851
|
if (onBlur) {
|
|
1864
1852
|
const starValue = Number(event.target.value);
|
|
@@ -1899,7 +1887,7 @@ function RatingWidget({
|
|
|
1899
1887
|
}
|
|
1900
1888
|
|
|
1901
1889
|
// src/widgets/SelectWidget/SelectWidget.tsx
|
|
1902
|
-
var
|
|
1890
|
+
var import_react13 = require("react");
|
|
1903
1891
|
var import_utils14 = require("@rjsf/utils");
|
|
1904
1892
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1905
1893
|
function SelectWidget({
|
|
@@ -1931,7 +1919,7 @@ function SelectWidget({
|
|
|
1931
1919
|
return String(val);
|
|
1932
1920
|
};
|
|
1933
1921
|
const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
|
|
1934
|
-
const handleOptionClick = (0,
|
|
1922
|
+
const handleOptionClick = (0, import_react13.useCallback)(
|
|
1935
1923
|
(event) => {
|
|
1936
1924
|
const index = Number(event.currentTarget.dataset.value);
|
|
1937
1925
|
if (isNaN(index)) {
|
|
@@ -1950,7 +1938,7 @@ function SelectWidget({
|
|
|
1950
1938
|
},
|
|
1951
1939
|
[value, multiple, isEnumeratedObject, enumOptions, optEmptyVal, onChange]
|
|
1952
1940
|
);
|
|
1953
|
-
const _onBlur = (0,
|
|
1941
|
+
const _onBlur = (0, import_react13.useCallback)(
|
|
1954
1942
|
({ target }) => {
|
|
1955
1943
|
const dataValue = target?.getAttribute("data-value");
|
|
1956
1944
|
if (dataValue !== null) {
|
|
@@ -1959,7 +1947,7 @@ function SelectWidget({
|
|
|
1959
1947
|
},
|
|
1960
1948
|
[onBlur, id, enumOptions, optEmptyVal]
|
|
1961
1949
|
);
|
|
1962
|
-
const _onFocus = (0,
|
|
1950
|
+
const _onFocus = (0, import_react13.useCallback)(
|
|
1963
1951
|
({ target }) => {
|
|
1964
1952
|
const dataValue = target?.getAttribute("data-value");
|
|
1965
1953
|
if (dataValue !== null) {
|
|
@@ -2013,11 +2001,11 @@ function SelectWidget({
|
|
|
2013
2001
|
}
|
|
2014
2002
|
|
|
2015
2003
|
// src/widgets/TextareaWidget/TextareaWidget.tsx
|
|
2016
|
-
var
|
|
2004
|
+
var import_react14 = require("react");
|
|
2017
2005
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2018
2006
|
function TextareaWidget(props) {
|
|
2019
|
-
const { id, value, required, disabled, readonly, onChange, onFocus, onBlur, options } = props;
|
|
2020
|
-
const handleFocus = (0,
|
|
2007
|
+
const { id, htmlName, value, required, disabled, readonly, onChange, onFocus, onBlur, options } = props;
|
|
2008
|
+
const handleFocus = (0, import_react14.useCallback)(
|
|
2021
2009
|
(event) => {
|
|
2022
2010
|
if (onFocus) {
|
|
2023
2011
|
onFocus(id, event.target.value);
|
|
@@ -2025,7 +2013,7 @@ function TextareaWidget(props) {
|
|
|
2025
2013
|
},
|
|
2026
2014
|
[onFocus, id]
|
|
2027
2015
|
);
|
|
2028
|
-
const handleBlur = (0,
|
|
2016
|
+
const handleBlur = (0, import_react14.useCallback)(
|
|
2029
2017
|
(event) => {
|
|
2030
2018
|
if (onBlur) {
|
|
2031
2019
|
onBlur(id, event.target.value);
|
|
@@ -2033,7 +2021,7 @@ function TextareaWidget(props) {
|
|
|
2033
2021
|
},
|
|
2034
2022
|
[onBlur, id]
|
|
2035
2023
|
);
|
|
2036
|
-
const handleChange = (0,
|
|
2024
|
+
const handleChange = (0, import_react14.useCallback)(
|
|
2037
2025
|
(event) => {
|
|
2038
2026
|
onChange(event.target.value);
|
|
2039
2027
|
},
|
|
@@ -2044,6 +2032,7 @@ function TextareaWidget(props) {
|
|
|
2044
2032
|
"textarea",
|
|
2045
2033
|
{
|
|
2046
2034
|
id,
|
|
2035
|
+
name: htmlName || id,
|
|
2047
2036
|
value: value || "",
|
|
2048
2037
|
required,
|
|
2049
2038
|
disabled: disabled || readonly,
|
|
@@ -2058,11 +2047,11 @@ function TextareaWidget(props) {
|
|
|
2058
2047
|
}
|
|
2059
2048
|
|
|
2060
2049
|
// src/widgets/TimeWidget/TimeWidget.tsx
|
|
2061
|
-
var
|
|
2050
|
+
var import_react15 = require("react");
|
|
2062
2051
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2063
2052
|
function TimeWidget(props) {
|
|
2064
2053
|
const { id, value, onChange, onFocus, onBlur, required, disabled, readonly } = props;
|
|
2065
|
-
const handleFocus = (0,
|
|
2054
|
+
const handleFocus = (0, import_react15.useCallback)(
|
|
2066
2055
|
(event) => {
|
|
2067
2056
|
if (onFocus) {
|
|
2068
2057
|
onFocus(id, event.target.value);
|
|
@@ -2070,7 +2059,7 @@ function TimeWidget(props) {
|
|
|
2070
2059
|
},
|
|
2071
2060
|
[onFocus, id]
|
|
2072
2061
|
);
|
|
2073
|
-
const handleBlur = (0,
|
|
2062
|
+
const handleBlur = (0, import_react15.useCallback)(
|
|
2074
2063
|
(event) => {
|
|
2075
2064
|
if (onBlur) {
|
|
2076
2065
|
onBlur(id, event.target.value);
|
|
@@ -2078,7 +2067,7 @@ function TimeWidget(props) {
|
|
|
2078
2067
|
},
|
|
2079
2068
|
[onBlur, id]
|
|
2080
2069
|
);
|
|
2081
|
-
const handleChange = (0,
|
|
2070
|
+
const handleChange = (0, import_react15.useCallback)(
|
|
2082
2071
|
(event) => {
|
|
2083
2072
|
onChange(event.target.value);
|
|
2084
2073
|
},
|
|
@@ -2102,19 +2091,19 @@ function TimeWidget(props) {
|
|
|
2102
2091
|
}
|
|
2103
2092
|
|
|
2104
2093
|
// src/widgets/ToggleWidget/ToggleWidget.tsx
|
|
2105
|
-
var
|
|
2094
|
+
var import_react16 = require("react");
|
|
2106
2095
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2107
2096
|
function ToggleWidget({ id, value, required, disabled, readonly, autofocus, onChange, onFocus, onBlur, options }) {
|
|
2108
|
-
const _onChange = (0,
|
|
2097
|
+
const _onChange = (0, import_react16.useCallback)(
|
|
2109
2098
|
({ target: { checked } }) => onChange(checked),
|
|
2110
2099
|
[onChange]
|
|
2111
2100
|
);
|
|
2112
|
-
const handleFocus = (0,
|
|
2101
|
+
const handleFocus = (0, import_react16.useCallback)(() => {
|
|
2113
2102
|
if (onFocus) {
|
|
2114
2103
|
onFocus(id, value);
|
|
2115
2104
|
}
|
|
2116
2105
|
}, [onFocus, id, value]);
|
|
2117
|
-
const handleBlur = (0,
|
|
2106
|
+
const handleBlur = (0, import_react16.useCallback)(() => {
|
|
2118
2107
|
if (onBlur) {
|
|
2119
2108
|
onBlur(id, value);
|
|
2120
2109
|
}
|
|
@@ -2179,20 +2168,20 @@ function generateTheme() {
|
|
|
2179
2168
|
}
|
|
2180
2169
|
var Theme = generateTheme();
|
|
2181
2170
|
var Theme_default = Theme;
|
|
2182
|
-
var ThemeContext = (0,
|
|
2171
|
+
var ThemeContext = (0, import_react17.createContext)({
|
|
2183
2172
|
theme: "night",
|
|
2184
2173
|
setTheme: () => {
|
|
2185
2174
|
}
|
|
2186
2175
|
});
|
|
2187
2176
|
function ThemeProvider({ children }) {
|
|
2188
|
-
const [theme, setTheme] = (0,
|
|
2177
|
+
const [theme, setTheme] = (0, import_react17.useState)(() => {
|
|
2189
2178
|
try {
|
|
2190
2179
|
return localStorage.getItem("daisyui-theme") || "cupcake";
|
|
2191
2180
|
} catch {
|
|
2192
2181
|
return "cupcake";
|
|
2193
2182
|
}
|
|
2194
2183
|
});
|
|
2195
|
-
const handleSetTheme = (0,
|
|
2184
|
+
const handleSetTheme = (0, import_react17.useCallback)((newTheme) => {
|
|
2196
2185
|
try {
|
|
2197
2186
|
localStorage.setItem("daisyui-theme", newTheme);
|
|
2198
2187
|
setTheme(newTheme);
|
|
@@ -2201,7 +2190,7 @@ function ThemeProvider({ children }) {
|
|
|
2201
2190
|
}, []);
|
|
2202
2191
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ThemeContext.Provider, { value: { theme, setTheme: handleSetTheme }, children });
|
|
2203
2192
|
}
|
|
2204
|
-
var useTheme = () => (0,
|
|
2193
|
+
var useTheme = () => (0, import_react17.useContext)(ThemeContext);
|
|
2205
2194
|
|
|
2206
2195
|
// src/DaisyUIForm.tsx
|
|
2207
2196
|
var import_core3 = require("@rjsf/core");
|
|
@@ -2209,7 +2198,7 @@ var DaisyUIForm = (0, import_core3.withTheme)(Theme_default);
|
|
|
2209
2198
|
var DaisyUIForm_default = DaisyUIForm;
|
|
2210
2199
|
|
|
2211
2200
|
// src/DaisyUIFrameProvider.tsx
|
|
2212
|
-
var
|
|
2201
|
+
var import_react18 = require("react");
|
|
2213
2202
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2214
2203
|
function DaisyUIFrameComponent(props) {
|
|
2215
2204
|
const { children, subtheme = {}, document: document2 } = props;
|
|
@@ -2224,7 +2213,7 @@ function DaisyUIFrameComponent(props) {
|
|
|
2224
2213
|
return "cupcake";
|
|
2225
2214
|
}
|
|
2226
2215
|
})();
|
|
2227
|
-
(0,
|
|
2216
|
+
(0, import_react18.useEffect)(() => {
|
|
2228
2217
|
if (document2) {
|
|
2229
2218
|
const configScript = document2.createElement("script");
|
|
2230
2219
|
configScript.textContent = `
|