@rjsf/chakra-ui 6.6.0 → 6.6.2
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 +147 -189
- package/dist/chakra-ui.esm.js.map +3 -3
- package/dist/chakra-ui.umd.js +135 -133
- package/dist/index.cjs +237 -234
- package/dist/index.cjs.map +3 -3
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/AltDateTimeWidget/AltDateTimeWidget.d.ts +1 -1
- package/lib/AltDateWidget/AltDateWidget.d.ts +1 -1
- package/lib/AltDateWidget/AltDateWidget.js +1 -1
- package/lib/AltDateWidget/AltDateWidget.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +5 -5
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/ChakraFrameProvider.js +1 -3
- package/lib/ChakraFrameProvider.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +4 -4
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +4 -4
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +1 -1
- package/lib/ErrorList/ErrorList.d.ts +1 -1
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +1 -3
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/Form/Form.d.ts +3 -3
- package/lib/Form/Form.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/ChakraIconButton.d.ts +2 -2
- package/lib/IconButton/ChakraIconButton.js.map +1 -1
- package/lib/IconButton/IconButton.d.ts +13 -7
- package/lib/IconButton/IconButton.js +11 -5
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/NativeSelectWidget/NativeSelectWidget.d.ts +1 -1
- package/lib/NativeSelectWidget/NativeSelectWidget.js +13 -15
- package/lib/NativeSelectWidget/NativeSelectWidget.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +6 -6
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +15 -17
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +5 -5
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/UpDownWidget/UpDownWidget.d.ts +1 -1
- package/lib/UpDownWidget/UpDownWidget.js +5 -5
- package/lib/UpDownWidget/UpDownWidget.js.map +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/components/ui/alert.d.ts +1 -1
- package/lib/components/ui/alert.js +1 -1
- package/lib/components/ui/alert.js.map +1 -1
- package/lib/components/ui/checkbox.d.ts +1 -1
- package/lib/components/ui/checkbox.js +1 -1
- package/lib/components/ui/checkbox.js.map +1 -1
- package/lib/components/ui/close-button.js +1 -1
- package/lib/components/ui/close-button.js.map +1 -1
- package/lib/components/ui/field.d.ts +1 -1
- package/lib/components/ui/field.js +1 -1
- package/lib/components/ui/field.js.map +1 -1
- package/lib/components/ui/number-input.js +1 -1
- package/lib/components/ui/number-input.js.map +1 -1
- package/lib/components/ui/radio.d.ts +1 -1
- package/lib/components/ui/radio.js +1 -1
- package/lib/components/ui/radio.js.map +1 -1
- package/lib/components/ui/select.d.ts +1 -1
- package/lib/components/ui/select.js +13 -17
- package/lib/components/ui/select.js.map +1 -1
- package/lib/components/ui/slider.d.ts +2 -2
- package/lib/components/ui/slider.js +19 -19
- package/lib/components/ui/slider.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js.map +1 -1
- package/package.json +8 -9
- package/src/AddButton/AddButton.tsx +2 -1
- package/src/AltDateTimeWidget/AltDateTimeWidget.tsx +1 -1
- package/src/AltDateWidget/AltDateWidget.tsx +2 -10
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -9
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -9
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +11 -18
- package/src/ChakraFrameProvider.tsx +7 -9
- package/src/CheckboxWidget/CheckboxWidget.tsx +10 -12
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +8 -11
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +3 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +8 -8
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/Form/Form.tsx +4 -3
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/ChakraIconButton.tsx +9 -3
- package/src/IconButton/IconButton.tsx +15 -7
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/NativeSelectWidget/NativeSelectWidget.tsx +20 -29
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +4 -18
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +13 -16
- package/src/RangeWidget/RangeWidget.tsx +11 -18
- package/src/SelectWidget/SelectWidget.tsx +24 -27
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +10 -16
- package/src/Theme/Theme.tsx +2 -2
- package/src/TitleField/TitleField.tsx +1 -1
- package/src/UpDownWidget/UpDownWidget.tsx +10 -16
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
- package/src/components/ui/alert.tsx +3 -2
- package/src/components/ui/checkbox.tsx +3 -2
- package/src/components/ui/close-button.tsx +5 -7
- package/src/components/ui/field.tsx +3 -2
- package/src/components/ui/number-input.tsx +1 -1
- package/src/components/ui/radio.tsx +3 -2
- package/src/components/ui/select.tsx +31 -36
- package/src/components/ui/slider.tsx +37 -35
- package/src/utils.ts +3 -2
package/dist/index.cjs
CHANGED
|
@@ -168,7 +168,7 @@ var import_utils4 = require("@rjsf/utils");
|
|
|
168
168
|
var import_react4 = require("react");
|
|
169
169
|
var import_react5 = require("@chakra-ui/react");
|
|
170
170
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
171
|
-
var Field = (0, import_react4.forwardRef)(
|
|
171
|
+
var Field = (0, import_react4.forwardRef)((props, ref) => {
|
|
172
172
|
const { label, children, helperText, errorText, optionalText, ...rest } = props;
|
|
173
173
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.Field.Root, { ref, ...rest, children: [
|
|
174
174
|
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react5.Field.Label, { children: [
|
|
@@ -222,9 +222,9 @@ function BaseInputTemplate(props) {
|
|
|
222
222
|
} = props;
|
|
223
223
|
const inputProps = (0, import_utils4.getInputProps)(schema, type, options);
|
|
224
224
|
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
const
|
|
225
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
226
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
227
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
228
228
|
const onClear = (0, import_react7.useCallback)(
|
|
229
229
|
(e) => {
|
|
230
230
|
e.preventDefault();
|
|
@@ -251,9 +251,9 @@ function BaseInputTemplate(props) {
|
|
|
251
251
|
id,
|
|
252
252
|
name: htmlName || id,
|
|
253
253
|
value: value || value === 0 ? value : "",
|
|
254
|
-
onChange: onChangeOverride ||
|
|
255
|
-
onBlur:
|
|
256
|
-
onFocus:
|
|
254
|
+
onChange: onChangeOverride || handleChange,
|
|
255
|
+
onBlur: handleBlur,
|
|
256
|
+
onFocus: handleFocus,
|
|
257
257
|
autoFocus: autofocus,
|
|
258
258
|
placeholder,
|
|
259
259
|
...inputProps,
|
|
@@ -292,13 +292,11 @@ var import_react10 = require("react");
|
|
|
292
292
|
var import_react11 = require("@chakra-ui/react");
|
|
293
293
|
var import_lu = require("react-icons/lu");
|
|
294
294
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
295
|
-
var CloseButton = (0, import_react10.forwardRef)(
|
|
296
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.IconButton, { variant: "ghost", "aria-label": "Close", ref, ...props, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lu.LuX, {}) });
|
|
297
|
-
});
|
|
295
|
+
var CloseButton = (0, import_react10.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react11.IconButton, { variant: "ghost", "aria-label": "Close", ref, ...props, children: props.children ?? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lu.LuX, {}) }));
|
|
298
296
|
|
|
299
297
|
// src/components/ui/alert.tsx
|
|
300
298
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
301
|
-
var Alert = (0, import_react12.forwardRef)(
|
|
299
|
+
var Alert = (0, import_react12.forwardRef)((props, ref) => {
|
|
302
300
|
const { title, children, closable, onClose, startElement, endElement, ...rest } = props;
|
|
303
301
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react13.Alert.Root, { ref, ...rest, children: [
|
|
304
302
|
startElement || /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react13.Alert.Indicator, {}),
|
|
@@ -312,7 +310,10 @@ var Alert = (0, import_react12.forwardRef)(function Alert2(props, ref) {
|
|
|
312
310
|
});
|
|
313
311
|
|
|
314
312
|
// src/ErrorList/ErrorList.tsx
|
|
315
|
-
var import_jsx_runtime9 =
|
|
313
|
+
var import_jsx_runtime9 = (
|
|
314
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
315
|
+
require("react/jsx-runtime")
|
|
316
|
+
);
|
|
316
317
|
function ErrorList({
|
|
317
318
|
errors,
|
|
318
319
|
registry
|
|
@@ -324,16 +325,17 @@ function ErrorList({
|
|
|
324
325
|
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
325
326
|
var import_react15 = require("@chakra-ui/react");
|
|
326
327
|
var import_utils7 = require("@rjsf/utils");
|
|
327
|
-
var import_jsx_runtime10 =
|
|
328
|
+
var import_jsx_runtime10 = (
|
|
329
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
330
|
+
require("react/jsx-runtime")
|
|
331
|
+
);
|
|
328
332
|
function FieldErrorTemplate(props) {
|
|
329
333
|
const { errors = [], fieldPathId } = props;
|
|
330
334
|
if (errors.length === 0) {
|
|
331
335
|
return null;
|
|
332
336
|
}
|
|
333
337
|
const id = (0, import_utils7.errorId)(fieldPathId);
|
|
334
|
-
return errors.map((error, i) => {
|
|
335
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react15.Fieldset.ErrorText, { mt: 0, id, children: error }, i);
|
|
336
|
-
});
|
|
338
|
+
return errors.map((error, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react15.Fieldset.ErrorText, { mt: 0, id, children: error }, i));
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
@@ -437,16 +439,18 @@ ChakraIconButton2.displayName = "ChakraIconButton";
|
|
|
437
439
|
var ChakraIconButton_default = (0, import_react19.memo)(ChakraIconButton2);
|
|
438
440
|
|
|
439
441
|
// src/IconButton/IconButton.tsx
|
|
442
|
+
var import_react21 = require("react");
|
|
440
443
|
var import_utils10 = require("@rjsf/utils");
|
|
441
444
|
var import_lucide_react2 = require("lucide-react");
|
|
442
445
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
443
|
-
function
|
|
446
|
+
function CopyButtonFn(props) {
|
|
444
447
|
const {
|
|
445
448
|
registry: { translateString }
|
|
446
449
|
} = props;
|
|
447
450
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChakraIconButton_default, { title: translateString(import_utils10.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react2.CopyIcon, {}) });
|
|
448
451
|
}
|
|
449
|
-
|
|
452
|
+
var CopyButton = (0, import_react21.memo)(CopyButtonFn);
|
|
453
|
+
function MoveDownButtonFn(props) {
|
|
450
454
|
const {
|
|
451
455
|
registry: { translateString }
|
|
452
456
|
} = props;
|
|
@@ -459,7 +463,8 @@ function MoveDownButton(props) {
|
|
|
459
463
|
}
|
|
460
464
|
);
|
|
461
465
|
}
|
|
462
|
-
|
|
466
|
+
var MoveDownButton = (0, import_react21.memo)(MoveDownButtonFn);
|
|
467
|
+
function MoveUpButtonFn(props) {
|
|
463
468
|
const {
|
|
464
469
|
registry: { translateString }
|
|
465
470
|
} = props;
|
|
@@ -472,7 +477,8 @@ function MoveUpButton(props) {
|
|
|
472
477
|
}
|
|
473
478
|
);
|
|
474
479
|
}
|
|
475
|
-
|
|
480
|
+
var MoveUpButton = (0, import_react21.memo)(MoveUpButtonFn);
|
|
481
|
+
function RemoveButtonFn(props) {
|
|
476
482
|
const {
|
|
477
483
|
registry: { translateString }
|
|
478
484
|
} = props;
|
|
@@ -485,26 +491,28 @@ function RemoveButton(props) {
|
|
|
485
491
|
}
|
|
486
492
|
);
|
|
487
493
|
}
|
|
488
|
-
|
|
494
|
+
var RemoveButton = (0, import_react21.memo)(RemoveButtonFn);
|
|
495
|
+
function ClearButtonFn(props) {
|
|
489
496
|
const {
|
|
490
497
|
registry: { translateString }
|
|
491
498
|
} = props;
|
|
492
499
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChakraIconButton_default, { title: translateString(import_utils10.TranslatableString.ClearButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react2.X, {}) });
|
|
493
500
|
}
|
|
501
|
+
var ClearButton = (0, import_react21.memo)(ClearButtonFn);
|
|
494
502
|
|
|
495
503
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
496
|
-
var
|
|
504
|
+
var import_react22 = require("@chakra-ui/react");
|
|
497
505
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
498
506
|
function MultiSchemaFieldTemplate(props) {
|
|
499
507
|
const { optionSchemaField, selector } = props;
|
|
500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
501
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react22.Card.Root, { mb: 2, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react22.Card.Body, { pb: 2, children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react22.Box, { mb: 4, children: selector }),
|
|
502
510
|
optionSchemaField
|
|
503
511
|
] }) });
|
|
504
512
|
}
|
|
505
513
|
|
|
506
514
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
507
|
-
var
|
|
515
|
+
var import_react23 = require("@chakra-ui/react");
|
|
508
516
|
var import_utils11 = require("@rjsf/utils");
|
|
509
517
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
510
518
|
function ObjectFieldTemplate(props) {
|
|
@@ -557,12 +565,12 @@ function ObjectFieldTemplate(props) {
|
|
|
557
565
|
registry
|
|
558
566
|
}
|
|
559
567
|
),
|
|
560
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
561
|
-
!showOptionalDataControlInTitle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react23.Grid, { gap: description ? 2 : 4, mb: 4, children: [
|
|
569
|
+
!showOptionalDataControlInTitle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react23.GridItem, { children: optionalDataControl }) : void 0,
|
|
562
570
|
properties.map(
|
|
563
|
-
(element
|
|
571
|
+
(element) => element.hidden ? element.content : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react23.GridItem, { children: element.content }, element.name)
|
|
564
572
|
),
|
|
565
|
-
(0, import_utils11.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
573
|
+
(0, import_utils11.canExpand)(schema, uiSchema, formData) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react23.GridItem, { justifySelf: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
566
574
|
AddButton2,
|
|
567
575
|
{
|
|
568
576
|
id: (0, import_utils11.buttonId)(fieldPathId, "add"),
|
|
@@ -596,7 +604,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
596
604
|
variant: "subtle"
|
|
597
605
|
}
|
|
598
606
|
);
|
|
599
|
-
}
|
|
607
|
+
}
|
|
608
|
+
if (onRemoveClick) {
|
|
600
609
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
601
610
|
RemoveButton,
|
|
602
611
|
{
|
|
@@ -614,7 +623,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
614
623
|
}
|
|
615
624
|
|
|
616
625
|
// src/SubmitButton/SubmitButton.tsx
|
|
617
|
-
var
|
|
626
|
+
var import_react24 = require("@chakra-ui/react");
|
|
618
627
|
var import_utils12 = require("@rjsf/utils");
|
|
619
628
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
620
629
|
function SubmitButton({ uiSchema }) {
|
|
@@ -622,33 +631,33 @@ function SubmitButton({ uiSchema }) {
|
|
|
622
631
|
if (norender) {
|
|
623
632
|
return null;
|
|
624
633
|
}
|
|
625
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react24.Box, { marginTop: 3, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react24.Button, { type: "submit", variant: "solid", ...submitButtonProps, children: submitText }) });
|
|
626
635
|
}
|
|
627
636
|
|
|
628
637
|
// src/TitleField/TitleField.tsx
|
|
629
|
-
var
|
|
638
|
+
var import_react25 = require("@chakra-ui/react");
|
|
630
639
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
631
640
|
function TitleField({
|
|
632
641
|
id,
|
|
633
642
|
title,
|
|
634
643
|
optionalDataControl
|
|
635
644
|
}) {
|
|
636
|
-
let heading = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
645
|
+
let heading = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react25.Heading, { as: "h5", children: title });
|
|
637
646
|
if (optionalDataControl) {
|
|
638
|
-
heading = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
647
|
+
heading = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react25.Flex, { children: [
|
|
639
648
|
heading,
|
|
640
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react25.Spacer, {}),
|
|
641
650
|
optionalDataControl
|
|
642
651
|
] });
|
|
643
652
|
}
|
|
644
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react25.Box, { id, mt: 1, mb: 4, children: [
|
|
645
654
|
heading,
|
|
646
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
655
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react25.Separator, {})
|
|
647
656
|
] });
|
|
648
657
|
}
|
|
649
658
|
|
|
650
659
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
651
|
-
var
|
|
660
|
+
var import_react26 = require("@chakra-ui/react");
|
|
652
661
|
var import_utils13 = require("@rjsf/utils");
|
|
653
662
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
654
663
|
function WrapIfAdditionalTemplate(props) {
|
|
@@ -679,7 +688,7 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
679
688
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: classNames, style, children });
|
|
680
689
|
}
|
|
681
690
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
682
|
-
|
|
691
|
+
import_react26.Grid,
|
|
683
692
|
{
|
|
684
693
|
templateColumns: "repeat(11, 1fr)",
|
|
685
694
|
className: classNames,
|
|
@@ -687,8 +696,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
687
696
|
alignItems: "center",
|
|
688
697
|
gap: 2,
|
|
689
698
|
children: [
|
|
690
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
691
|
-
|
|
699
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react26.GridItem, { colSpan: 5, style: { marginTop: hasDescription ? "36px" : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Field, { required, label: keyLabel, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
700
|
+
import_react26.Input,
|
|
692
701
|
{
|
|
693
702
|
defaultValue: label,
|
|
694
703
|
disabled: disabled || readonly,
|
|
@@ -700,8 +709,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
700
709
|
},
|
|
701
710
|
label
|
|
702
711
|
) }) }),
|
|
703
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
704
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react26.GridItem, { colSpan: 5, children }),
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react26.GridItem, { justifySelf: "flex-end", style: { marginTop: displayLabel ? `${margin}px` : void 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
705
714
|
RemoveButton2,
|
|
706
715
|
{
|
|
707
716
|
id: (0, import_utils13.buttonId)(id, "remove"),
|
|
@@ -760,7 +769,7 @@ function AltDateTimeWidget({
|
|
|
760
769
|
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
761
770
|
|
|
762
771
|
// src/AltDateWidget/AltDateWidget.tsx
|
|
763
|
-
var
|
|
772
|
+
var import_react27 = require("@chakra-ui/react");
|
|
764
773
|
var import_utils14 = require("@rjsf/utils");
|
|
765
774
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
766
775
|
function AltDateWidget({
|
|
@@ -779,10 +788,10 @@ function AltDateWidget({
|
|
|
779
788
|
options: realOptions
|
|
780
789
|
});
|
|
781
790
|
const chakraProps = getChakra({ uiSchema: props.uiSchema });
|
|
782
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
783
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react27.FieldsetRoot, { ...chakraProps, children: [
|
|
792
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react27.Box, { display: "flex", flexWrap: "wrap", alignItems: "center", children: elements.map((elemProps, i) => {
|
|
784
793
|
const elemId = `${id}_${elemProps.type}`;
|
|
785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react27.Box, { mr: "2", mb: "2", width: "20", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
786
795
|
import_utils14.DateElement,
|
|
787
796
|
{
|
|
788
797
|
...props,
|
|
@@ -800,28 +809,28 @@ function AltDateWidget({
|
|
|
800
809
|
}
|
|
801
810
|
) }, elemId);
|
|
802
811
|
}) }),
|
|
803
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
804
|
-
!options.hideNowButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
805
|
-
!options.hideClearButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react27.Box, { display: "flex", children: [
|
|
813
|
+
!options.hideNowButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react27.Button, { onClick: handleSetNow, mr: "2", children: translateString(import_utils14.TranslatableString.NowLabel) }),
|
|
814
|
+
!options.hideClearButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react27.Button, { onClick: handleClear, children: translateString(import_utils14.TranslatableString.ClearLabel) })
|
|
806
815
|
] })
|
|
807
816
|
] });
|
|
808
817
|
}
|
|
809
818
|
var AltDateWidget_default = AltDateWidget;
|
|
810
819
|
|
|
811
820
|
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
812
|
-
var
|
|
821
|
+
var import_react30 = require("@chakra-ui/react");
|
|
813
822
|
var import_utils16 = require("@rjsf/utils");
|
|
814
823
|
|
|
815
824
|
// src/components/ui/checkbox.tsx
|
|
816
|
-
var
|
|
817
|
-
var
|
|
825
|
+
var import_react28 = require("react");
|
|
826
|
+
var import_react29 = require("@chakra-ui/react");
|
|
818
827
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
819
|
-
var Checkbox = (0,
|
|
828
|
+
var Checkbox = (0, import_react28.forwardRef)((props, ref) => {
|
|
820
829
|
const { icon, children, inputProps, rootRef, ...rest } = props;
|
|
821
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
822
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
823
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
824
|
-
children != null && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react29.Checkbox.Root, { ref: rootRef, ...rest, children: [
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react29.Checkbox.HiddenInput, { ref, ...inputProps }),
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react29.Checkbox.Control, { children: icon || /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react29.Checkbox.Indicator, {}) }),
|
|
833
|
+
children != null && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react29.Checkbox.Label, { children })
|
|
825
834
|
] });
|
|
826
835
|
});
|
|
827
836
|
|
|
@@ -846,30 +855,30 @@ function CheckboxesWidget(props) {
|
|
|
846
855
|
} = props;
|
|
847
856
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
848
857
|
const optionValueFormat = (0, import_utils16.getOptionValueFormat)(options);
|
|
849
|
-
const
|
|
850
|
-
const
|
|
858
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
859
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils16.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
851
860
|
const row = options ? options.inline : false;
|
|
852
861
|
const selectValue = (0, import_utils16.enumOptionSelectedValue)(value, enumOptions, true, optionValueFormat, []);
|
|
853
862
|
const chakraProps = getChakra({ uiSchema });
|
|
854
863
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
855
|
-
|
|
864
|
+
import_react30.FieldsetRoot,
|
|
856
865
|
{
|
|
857
866
|
mb: 1,
|
|
858
867
|
disabled: disabled || readonly,
|
|
859
868
|
invalid: rawErrors && rawErrors.length > 0,
|
|
860
869
|
...chakraProps,
|
|
861
870
|
children: [
|
|
862
|
-
!hideLabel && label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
871
|
+
!hideLabel && label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react30.FieldsetLegend, { children: (0, import_utils16.labelValue)(label) }),
|
|
863
872
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
864
|
-
|
|
873
|
+
import_react30.CheckboxGroup,
|
|
865
874
|
{
|
|
866
875
|
onValueChange: (option) => onChange((0, import_utils16.enumOptionValueDecoder)(option, enumOptions, optionValueFormat, emptyValue)),
|
|
867
876
|
value: selectValue,
|
|
868
877
|
"aria-describedby": (0, import_utils16.ariaDescribedByIds)(id),
|
|
869
878
|
readOnly: readonly,
|
|
870
879
|
invalid: required && value.length === 0,
|
|
871
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
872
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
880
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react30.Stack, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
881
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
873
882
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
874
883
|
Checkbox,
|
|
875
884
|
{
|
|
@@ -877,11 +886,11 @@ function CheckboxesWidget(props) {
|
|
|
877
886
|
name: htmlName || id,
|
|
878
887
|
value: (0, import_utils16.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
879
888
|
disabled: disabled || itemDisabled || readonly,
|
|
880
|
-
onBlur:
|
|
881
|
-
onFocus:
|
|
882
|
-
children: option.label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
889
|
+
onBlur: handleBlur,
|
|
890
|
+
onFocus: handleFocus,
|
|
891
|
+
children: option.label && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react30.Text, { children: option.label })
|
|
883
892
|
},
|
|
884
|
-
|
|
893
|
+
String(option.value)
|
|
885
894
|
);
|
|
886
895
|
}) })
|
|
887
896
|
}
|
|
@@ -892,7 +901,7 @@ function CheckboxesWidget(props) {
|
|
|
892
901
|
}
|
|
893
902
|
|
|
894
903
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
895
|
-
var
|
|
904
|
+
var import_react31 = require("@chakra-ui/react");
|
|
896
905
|
var import_utils18 = require("@rjsf/utils");
|
|
897
906
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
898
907
|
function CheckboxWidget(props) {
|
|
@@ -921,9 +930,9 @@ function CheckboxWidget(props) {
|
|
|
921
930
|
const uiOptions = (0, import_utils18.getUiOptions)(uiSchema);
|
|
922
931
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
923
932
|
const description = isCheckbox ? void 0 : options.description ?? schema.description;
|
|
924
|
-
const
|
|
925
|
-
const
|
|
926
|
-
const
|
|
933
|
+
const handleChange = ({ checked }) => onChange(checked);
|
|
934
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
935
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.checked);
|
|
927
936
|
const chakraProps = getChakra({ uiSchema });
|
|
928
937
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Field, { mb: 1, required, ...chakraProps, children: [
|
|
929
938
|
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -943,19 +952,19 @@ function CheckboxWidget(props) {
|
|
|
943
952
|
name: htmlName || id,
|
|
944
953
|
checked: typeof value === "undefined" ? false : value,
|
|
945
954
|
disabled: disabled || readonly,
|
|
946
|
-
onCheckedChange:
|
|
947
|
-
onBlur:
|
|
948
|
-
onFocus:
|
|
955
|
+
onCheckedChange: handleChange,
|
|
956
|
+
onBlur: handleBlur,
|
|
957
|
+
onFocus: handleFocus,
|
|
949
958
|
"aria-describedby": (0, import_utils18.ariaDescribedByIds)(id),
|
|
950
|
-
children: (0, import_utils18.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
959
|
+
children: (0, import_utils18.labelValue)(/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react31.Text, { children: label }), hideLabel || !label)
|
|
951
960
|
}
|
|
952
961
|
)
|
|
953
962
|
] });
|
|
954
963
|
}
|
|
955
964
|
|
|
956
965
|
// src/NativeSelectWidget/NativeSelectWidget.tsx
|
|
957
|
-
var
|
|
958
|
-
var
|
|
966
|
+
var import_react32 = require("react");
|
|
967
|
+
var import_react33 = require("@chakra-ui/react");
|
|
959
968
|
var import_utils20 = require("@rjsf/utils");
|
|
960
969
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
961
970
|
function NativeSelectWidget(props) {
|
|
@@ -979,27 +988,25 @@ function NativeSelectWidget(props) {
|
|
|
979
988
|
uiSchema
|
|
980
989
|
} = props;
|
|
981
990
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
};
|
|
985
|
-
const _onBlur = ({ target }) => onBlur(id, (0, import_utils20.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
986
|
-
const _onFocus = ({ target }) => onFocus(id, (0, import_utils20.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
991
|
+
const handleChange = ({ target }) => onChange((0, import_utils20.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
992
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils20.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
993
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils20.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
987
994
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
988
|
-
const { valueLabelMap, displayEnumOptions } = (0,
|
|
989
|
-
const
|
|
990
|
-
let
|
|
995
|
+
const { valueLabelMap, displayEnumOptions } = (0, import_react32.useMemo)(() => {
|
|
996
|
+
const computedValueLabelMap = {};
|
|
997
|
+
let computedOptions = [];
|
|
991
998
|
if (Array.isArray(enumOptions)) {
|
|
992
|
-
|
|
993
|
-
const { value:
|
|
994
|
-
|
|
999
|
+
computedOptions = enumOptions.map((option, index) => {
|
|
1000
|
+
const { value: enumValue, label: enumLabel } = option;
|
|
1001
|
+
computedValueLabelMap[index] = enumLabel || String(enumValue);
|
|
995
1002
|
return {
|
|
996
|
-
label:
|
|
1003
|
+
label: enumLabel,
|
|
997
1004
|
value: String(index),
|
|
998
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1005
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
999
1006
|
};
|
|
1000
1007
|
});
|
|
1001
1008
|
}
|
|
1002
|
-
return { valueLabelMap:
|
|
1009
|
+
return { valueLabelMap: computedValueLabelMap, displayEnumOptions: computedOptions };
|
|
1003
1010
|
}, [enumDisabled, enumOptions]);
|
|
1004
1011
|
const selectedIndex = (0, import_utils20.enumOptionsIndexForValue)(value, enumOptions, false);
|
|
1005
1012
|
const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
|
|
@@ -1009,7 +1016,7 @@ function NativeSelectWidget(props) {
|
|
|
1009
1016
|
}
|
|
1010
1017
|
] : [];
|
|
1011
1018
|
const formValue = getSingleValue()[0]?.value || "";
|
|
1012
|
-
const selectOptions = (0,
|
|
1019
|
+
const selectOptions = (0, import_react33.createListCollection)({
|
|
1013
1020
|
items: displayEnumOptions.filter((item) => item.value)
|
|
1014
1021
|
});
|
|
1015
1022
|
const chakraProps = getChakra({ uiSchema });
|
|
@@ -1023,14 +1030,14 @@ function NativeSelectWidget(props) {
|
|
|
1023
1030
|
invalid: rawErrors && rawErrors.length > 0,
|
|
1024
1031
|
label: (0, import_utils20.labelValue)(label, hideLabel || !label),
|
|
1025
1032
|
...chakraProps,
|
|
1026
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react33.NativeSelect.Root, { children: [
|
|
1027
1034
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
1028
|
-
|
|
1035
|
+
import_react33.NativeSelect.Field,
|
|
1029
1036
|
{
|
|
1030
1037
|
id,
|
|
1031
|
-
onBlur:
|
|
1032
|
-
onChange:
|
|
1033
|
-
onFocus:
|
|
1038
|
+
onBlur: handleBlur,
|
|
1039
|
+
onChange: handleChange,
|
|
1040
|
+
onFocus: handleFocus,
|
|
1034
1041
|
autoFocus: autofocus,
|
|
1035
1042
|
value: formValue,
|
|
1036
1043
|
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(id),
|
|
@@ -1040,29 +1047,29 @@ function NativeSelectWidget(props) {
|
|
|
1040
1047
|
]
|
|
1041
1048
|
}
|
|
1042
1049
|
),
|
|
1043
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react33.NativeSelect.Indicator, {})
|
|
1044
1051
|
] })
|
|
1045
1052
|
}
|
|
1046
1053
|
);
|
|
1047
1054
|
}
|
|
1048
1055
|
|
|
1049
1056
|
// src/RadioWidget/RadioWidget.tsx
|
|
1050
|
-
var
|
|
1057
|
+
var import_react36 = require("@chakra-ui/react");
|
|
1051
1058
|
var import_utils22 = require("@rjsf/utils");
|
|
1052
1059
|
|
|
1053
1060
|
// src/components/ui/radio.tsx
|
|
1054
|
-
var
|
|
1055
|
-
var
|
|
1061
|
+
var import_react34 = require("react");
|
|
1062
|
+
var import_react35 = require("@chakra-ui/react");
|
|
1056
1063
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1057
|
-
var Radio = (0,
|
|
1064
|
+
var Radio = (0, import_react34.forwardRef)((props, ref) => {
|
|
1058
1065
|
const { children, inputProps, rootRef, ...rest } = props;
|
|
1059
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
1060
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1061
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1062
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react35.RadioGroup.Item, { ref: rootRef, ...rest, children: [
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react35.RadioGroup.ItemHiddenInput, { ref, ...inputProps }),
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react35.RadioGroup.ItemIndicator, {}),
|
|
1069
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react35.RadioGroup.ItemText, { children })
|
|
1063
1070
|
] });
|
|
1064
1071
|
});
|
|
1065
|
-
var RadioGroup =
|
|
1072
|
+
var RadioGroup = import_react35.RadioGroup.Root;
|
|
1066
1073
|
|
|
1067
1074
|
// src/RadioWidget/RadioWidget.tsx
|
|
1068
1075
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
@@ -1083,9 +1090,9 @@ function RadioWidget({
|
|
|
1083
1090
|
}) {
|
|
1084
1091
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1085
1092
|
const optionValueFormat = (0, import_utils22.getOptionValueFormat)(options);
|
|
1086
|
-
const
|
|
1087
|
-
const
|
|
1088
|
-
const
|
|
1093
|
+
const handleChange = ({ target: { value: enumValue } }) => onChange((0, import_utils22.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1094
|
+
const handleBlur = ({ target: { value: enumValue } }) => onBlur(id, (0, import_utils22.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1095
|
+
const handleFocus = ({ target: { value: enumValue } }) => onFocus(id, (0, import_utils22.enumOptionValueDecoder)(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1089
1096
|
const row = options ? options.inline : false;
|
|
1090
1097
|
const selectValue = (0, import_utils22.enumOptionSelectedValue)(value, enumOptions, false, optionValueFormat, null);
|
|
1091
1098
|
const chakraProps = getChakra({ uiSchema });
|
|
@@ -1101,14 +1108,14 @@ function RadioWidget({
|
|
|
1101
1108
|
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1102
1109
|
RadioGroup,
|
|
1103
1110
|
{
|
|
1104
|
-
onChange:
|
|
1105
|
-
onBlur:
|
|
1106
|
-
onFocus:
|
|
1111
|
+
onChange: handleChange,
|
|
1112
|
+
onBlur: handleBlur,
|
|
1113
|
+
onFocus: handleFocus,
|
|
1107
1114
|
value: selectValue,
|
|
1108
1115
|
name: htmlName || id,
|
|
1109
1116
|
"aria-describedby": (0, import_utils22.ariaDescribedByIds)(id),
|
|
1110
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1111
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1117
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react36.Stack, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1118
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1112
1119
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1113
1120
|
Radio,
|
|
1114
1121
|
{
|
|
@@ -1117,7 +1124,7 @@ function RadioWidget({
|
|
|
1117
1124
|
disabled: disabled || itemDisabled || readonly,
|
|
1118
1125
|
children: option.label
|
|
1119
1126
|
},
|
|
1120
|
-
|
|
1127
|
+
String(option.value)
|
|
1121
1128
|
);
|
|
1122
1129
|
}) })
|
|
1123
1130
|
}
|
|
@@ -1130,10 +1137,27 @@ function RadioWidget({
|
|
|
1130
1137
|
var import_utils24 = require("@rjsf/utils");
|
|
1131
1138
|
|
|
1132
1139
|
// src/components/ui/slider.tsx
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
1135
|
-
var import_jsx_runtime30 =
|
|
1136
|
-
|
|
1140
|
+
var import_react37 = require("react");
|
|
1141
|
+
var import_react38 = require("@chakra-ui/react");
|
|
1142
|
+
var import_jsx_runtime30 = (
|
|
1143
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1144
|
+
require("react/jsx-runtime")
|
|
1145
|
+
);
|
|
1146
|
+
var SliderMarks = (0, import_react37.forwardRef)((props, ref) => {
|
|
1147
|
+
const { marks } = props;
|
|
1148
|
+
if (!marks?.length) {
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.MarkerGroup, { ref, children: marks.map((mark, index) => {
|
|
1152
|
+
const value = typeof mark === "number" ? mark : mark.value;
|
|
1153
|
+
const label = typeof mark === "number" ? void 0 : mark.label;
|
|
1154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react38.Slider.Marker, { value, children: [
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.MarkerIndicator, {}),
|
|
1156
|
+
label
|
|
1157
|
+
] }, index);
|
|
1158
|
+
}) });
|
|
1159
|
+
});
|
|
1160
|
+
var Slider = (0, import_react37.forwardRef)((props, ref) => {
|
|
1137
1161
|
const { marks: marksProp, showValue, ...rest } = props;
|
|
1138
1162
|
const value = props.defaultValue ?? props.value;
|
|
1139
1163
|
const marks = marksProp?.map((mark) => {
|
|
@@ -1143,10 +1167,10 @@ var Slider = (0, import_react36.forwardRef)(function Slider2(props, ref) {
|
|
|
1143
1167
|
return mark;
|
|
1144
1168
|
});
|
|
1145
1169
|
const hasMarkLabel = !!marks?.some((mark) => mark.label);
|
|
1146
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1147
|
-
showValue && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1148
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1149
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react38.Slider.Root, { ref, width: "200px", thumbAlignment: "center", ...rest, children: [
|
|
1171
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.HStack, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.ValueText, {}) }),
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react38.Slider.Control, { "data-has-mark-label": hasMarkLabel || void 0, children: [
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.Track, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.Range, {}) }),
|
|
1150
1174
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SliderThumbs, { value }),
|
|
1151
1175
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SliderMarks, { marks })
|
|
1152
1176
|
] })
|
|
@@ -1154,22 +1178,11 @@ var Slider = (0, import_react36.forwardRef)(function Slider2(props, ref) {
|
|
|
1154
1178
|
});
|
|
1155
1179
|
function SliderThumbs(props) {
|
|
1156
1180
|
const { value } = props;
|
|
1157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: value?.map((_, index) =>
|
|
1181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: value?.map((_, index) => (
|
|
1182
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.Thumb, { index, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react38.Slider.HiddenInput, {}) }, index)
|
|
1184
|
+
)) });
|
|
1158
1185
|
}
|
|
1159
|
-
var SliderMarks = (0, import_react36.forwardRef)(function SliderMarks2(props, ref) {
|
|
1160
|
-
const { marks } = props;
|
|
1161
|
-
if (!marks?.length) {
|
|
1162
|
-
return null;
|
|
1163
|
-
}
|
|
1164
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react37.Slider.MarkerGroup, { ref, children: marks.map((mark, index) => {
|
|
1165
|
-
const value = typeof mark === "number" ? mark : mark.value;
|
|
1166
|
-
const label = typeof mark === "number" ? void 0 : mark.label;
|
|
1167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react37.Slider.Marker, { value, children: [
|
|
1168
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react37.Slider.MarkerIndicator, {}),
|
|
1169
|
-
label
|
|
1170
|
-
] }, index);
|
|
1171
|
-
}) });
|
|
1172
|
-
});
|
|
1173
1186
|
|
|
1174
1187
|
// src/RangeWidget/RangeWidget.tsx
|
|
1175
1188
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -1187,9 +1200,9 @@ function RangeWidget({
|
|
|
1187
1200
|
id,
|
|
1188
1201
|
uiSchema
|
|
1189
1202
|
}) {
|
|
1190
|
-
const
|
|
1191
|
-
const
|
|
1192
|
-
const
|
|
1203
|
+
const handleChange = ({ value: newValue }) => onChange(newValue === void 0 ? options.emptyValue : newValue[0]);
|
|
1204
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1205
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1193
1206
|
const chakraProps = getChakra({ uiSchema });
|
|
1194
1207
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Field, { mb: 1, label: (0, import_utils24.labelValue)(label, hideLabel || !label), ...chakraProps, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1195
1208
|
Slider,
|
|
@@ -1199,52 +1212,48 @@ function RangeWidget({
|
|
|
1199
1212
|
name: id,
|
|
1200
1213
|
disabled: disabled || readonly,
|
|
1201
1214
|
value: [value],
|
|
1202
|
-
onValueChange:
|
|
1203
|
-
onBlur:
|
|
1204
|
-
onFocus:
|
|
1215
|
+
onValueChange: handleChange,
|
|
1216
|
+
onBlur: handleBlur,
|
|
1217
|
+
onFocus: handleFocus,
|
|
1205
1218
|
"aria-describedby": (0, import_utils24.ariaDescribedByIds)(id)
|
|
1206
1219
|
}
|
|
1207
1220
|
) });
|
|
1208
1221
|
}
|
|
1209
1222
|
|
|
1210
1223
|
// src/SelectWidget/SelectWidget.tsx
|
|
1211
|
-
var
|
|
1212
|
-
var
|
|
1224
|
+
var import_react41 = require("react");
|
|
1225
|
+
var import_react42 = require("@chakra-ui/react");
|
|
1213
1226
|
var import_utils26 = require("@rjsf/utils");
|
|
1214
1227
|
|
|
1215
1228
|
// src/components/ui/select.tsx
|
|
1216
|
-
var
|
|
1217
|
-
var
|
|
1229
|
+
var import_react39 = require("react");
|
|
1230
|
+
var import_react40 = require("@chakra-ui/react");
|
|
1218
1231
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1219
|
-
var
|
|
1232
|
+
var SelectClearTrigger = (0, import_react39.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.ClearTrigger, { asChild: true, ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CloseButton, { size: "xs", variant: "plain", focusVisibleRing: "inside", focusRingWidth: "2px", pointerEvents: "auto" }) }));
|
|
1233
|
+
var SelectTrigger = (0, import_react39.forwardRef)((props, ref) => {
|
|
1220
1234
|
const { children, clearable, ...rest } = props;
|
|
1221
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1222
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1223
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Select.Control, { ...rest, children: [
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.Trigger, { ref, children }),
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Select.IndicatorGroup, { children: [
|
|
1224
1238
|
clearable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectClearTrigger, {}),
|
|
1225
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1239
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.Indicator, {})
|
|
1226
1240
|
] })
|
|
1227
1241
|
] });
|
|
1228
1242
|
});
|
|
1229
|
-
var
|
|
1230
|
-
function SelectClearTrigger2(props, ref) {
|
|
1231
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react39.Select.ClearTrigger, { asChild: true, ...props, ref, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CloseButton, { size: "xs", variant: "plain", focusVisibleRing: "inside", focusRingWidth: "2px", pointerEvents: "auto" }) });
|
|
1232
|
-
}
|
|
1233
|
-
);
|
|
1234
|
-
var SelectContent = (0, import_react38.forwardRef)(function SelectContent2(props, ref) {
|
|
1243
|
+
var SelectContent = (0, import_react39.forwardRef)((props, ref) => {
|
|
1235
1244
|
const { portalled = true, portalRef, ...rest } = props;
|
|
1236
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.Content, { ...rest, ref }) }) });
|
|
1237
1246
|
});
|
|
1238
|
-
var SelectItem = (0,
|
|
1247
|
+
var SelectItem = (0, import_react39.forwardRef)((props, ref) => {
|
|
1239
1248
|
const { item, children, ...rest } = props;
|
|
1240
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Select.Item, { item, ...rest, ref, children: [
|
|
1241
1250
|
children,
|
|
1242
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.ItemIndicator, {})
|
|
1243
1252
|
] }, item.value);
|
|
1244
1253
|
});
|
|
1245
|
-
var SelectValueText = (0,
|
|
1254
|
+
var SelectValueText = (0, import_react39.forwardRef)((props, ref) => {
|
|
1246
1255
|
const { children, ...rest } = props;
|
|
1247
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.ValueText, { ...rest, ref, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.Context, { children: (select) => {
|
|
1248
1257
|
const items = select.selectedItems;
|
|
1249
1258
|
if (items.length === 0) {
|
|
1250
1259
|
return props.placeholder;
|
|
@@ -1258,21 +1267,19 @@ var SelectValueText = (0, import_react38.forwardRef)(function SelectValueText2(p
|
|
|
1258
1267
|
return `${items.length} selected`;
|
|
1259
1268
|
} }) });
|
|
1260
1269
|
});
|
|
1261
|
-
var SelectRoot = (0,
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
});
|
|
1267
|
-
var SelectItemGroup = (0, import_react38.forwardRef)(function SelectItemGroup2(props, ref) {
|
|
1270
|
+
var SelectRoot = (0, import_react39.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.Root, { ...props, ref, positioning: { sameWidth: true, ...props.positioning }, children: props.asChild ? props.children : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.HiddenSelect, {}),
|
|
1272
|
+
props.children
|
|
1273
|
+
] }) }));
|
|
1274
|
+
var SelectItemGroup = (0, import_react39.forwardRef)((props, ref) => {
|
|
1268
1275
|
const { children, label, ...rest } = props;
|
|
1269
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1270
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Select.ItemGroup, { ...rest, ref, children: [
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react40.Select.ItemGroupLabel, { children: label }),
|
|
1271
1278
|
children
|
|
1272
1279
|
] });
|
|
1273
1280
|
});
|
|
1274
|
-
var SelectLabel =
|
|
1275
|
-
var SelectItemText =
|
|
1281
|
+
var SelectLabel = import_react40.Select.Label;
|
|
1282
|
+
var SelectItemText = import_react40.Select.ItemText;
|
|
1276
1283
|
|
|
1277
1284
|
// src/SelectWidget/SelectWidget.tsx
|
|
1278
1285
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -1299,41 +1306,39 @@ function SelectWidget(props) {
|
|
|
1299
1306
|
} = props;
|
|
1300
1307
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1301
1308
|
const optionValueFormat = (0, import_utils26.getOptionValueFormat)(options);
|
|
1302
|
-
const
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
const _onSingleChange = ({ value: value2 }) => {
|
|
1306
|
-
const selected = (0, import_utils26.enumOptionValueDecoder)(value2, enumOptions, optionValueFormat, emptyValue);
|
|
1309
|
+
const handleMultiChange = ({ value: newValue }) => onChange((0, import_utils26.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, emptyValue));
|
|
1310
|
+
const handleSingleChange = ({ value: newValue }) => {
|
|
1311
|
+
const selected = (0, import_utils26.enumOptionValueDecoder)(newValue, enumOptions, optionValueFormat, emptyValue);
|
|
1307
1312
|
return onChange(Array.isArray(selected) && selected.length === 1 ? selected[0] : selected);
|
|
1308
1313
|
};
|
|
1309
|
-
const
|
|
1310
|
-
const
|
|
1314
|
+
const handleBlur = ({ target }) => onBlur(id, (0, import_utils26.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1315
|
+
const handleFocus = ({ target }) => onFocus(id, (0, import_utils26.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1311
1316
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1312
|
-
const displayEnumOptions = (0,
|
|
1313
|
-
let
|
|
1317
|
+
const displayEnumOptions = (0, import_react41.useMemo)(() => {
|
|
1318
|
+
let computedOptions = [];
|
|
1314
1319
|
if (Array.isArray(enumOptions)) {
|
|
1315
|
-
|
|
1316
|
-
const { value:
|
|
1320
|
+
computedOptions = enumOptions.map((option, index) => {
|
|
1321
|
+
const { value: enumValue, label: enumLabel } = option;
|
|
1317
1322
|
return {
|
|
1318
|
-
label:
|
|
1319
|
-
value: (0, import_utils26.enumOptionValueEncoder)(
|
|
1320
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1323
|
+
label: enumLabel,
|
|
1324
|
+
value: (0, import_utils26.enumOptionValueEncoder)(enumValue, index, optionValueFormat),
|
|
1325
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1321
1326
|
};
|
|
1322
1327
|
});
|
|
1323
1328
|
if (showPlaceholderOption) {
|
|
1324
|
-
|
|
1329
|
+
computedOptions.unshift({ value: "", label: placeholder || "" });
|
|
1325
1330
|
}
|
|
1326
1331
|
}
|
|
1327
|
-
return
|
|
1332
|
+
return computedOptions;
|
|
1328
1333
|
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
|
|
1329
|
-
const isMultiple = typeof multiple !== "undefined" && multiple
|
|
1334
|
+
const isMultiple = typeof multiple !== "undefined" && multiple && Boolean(enumOptions);
|
|
1330
1335
|
const formValue = [
|
|
1331
1336
|
(0, import_utils26.enumOptionSelectedValue)(value, enumOptions, isMultiple, optionValueFormat, isMultiple ? [] : "")
|
|
1332
1337
|
].flat().filter((v) => v !== "");
|
|
1333
|
-
const selectOptions = (0,
|
|
1338
|
+
const selectOptions = (0, import_react42.createListCollection)({
|
|
1334
1339
|
items: displayEnumOptions.filter((item) => item.value)
|
|
1335
1340
|
});
|
|
1336
|
-
const containerRef = (0,
|
|
1341
|
+
const containerRef = (0, import_react41.useRef)(null);
|
|
1337
1342
|
const chakraProps = getChakra({ uiSchema });
|
|
1338
1343
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1339
1344
|
Field,
|
|
@@ -1355,18 +1360,18 @@ function SelectWidget(props) {
|
|
|
1355
1360
|
name: htmlName || id,
|
|
1356
1361
|
multiple: isMultiple,
|
|
1357
1362
|
closeOnSelect: !isMultiple,
|
|
1358
|
-
onBlur:
|
|
1359
|
-
onValueChange: isMultiple ?
|
|
1360
|
-
onFocus:
|
|
1363
|
+
onBlur: handleBlur,
|
|
1364
|
+
onValueChange: isMultiple ? handleMultiChange : handleSingleChange,
|
|
1365
|
+
onFocus: handleFocus,
|
|
1361
1366
|
autoFocus: autofocus,
|
|
1362
1367
|
value: formValue,
|
|
1363
1368
|
"aria-describedby": (0, import_utils26.ariaDescribedByIds)(id),
|
|
1364
1369
|
positioning: { placement: "bottom" },
|
|
1365
1370
|
children: [
|
|
1366
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1367
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react42.Select.Control, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectValueText, { placeholder }) }) }),
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react42.Select.Positioner, { minWidth: "100% !important", zIndex: "2 !important", top: "calc(100% + 5px) !important", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react42.Select.Content, { children: selectOptions.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react42.Select.Item, { item, children: [
|
|
1368
1373
|
item.label,
|
|
1369
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react42.Select.ItemIndicator, {})
|
|
1370
1375
|
] }, item.value)) }) })
|
|
1371
1376
|
]
|
|
1372
1377
|
}
|
|
@@ -1376,7 +1381,7 @@ function SelectWidget(props) {
|
|
|
1376
1381
|
}
|
|
1377
1382
|
|
|
1378
1383
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1379
|
-
var
|
|
1384
|
+
var import_react43 = require("@chakra-ui/react");
|
|
1380
1385
|
var import_utils28 = require("@rjsf/utils");
|
|
1381
1386
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1382
1387
|
function TextareaWidget({
|
|
@@ -1397,9 +1402,9 @@ function TextareaWidget({
|
|
|
1397
1402
|
rawErrors,
|
|
1398
1403
|
uiSchema
|
|
1399
1404
|
}) {
|
|
1400
|
-
const
|
|
1401
|
-
const
|
|
1402
|
-
const
|
|
1405
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1406
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1407
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1403
1408
|
const chakraProps = getChakra({ uiSchema });
|
|
1404
1409
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1405
1410
|
Field,
|
|
@@ -1412,16 +1417,16 @@ function TextareaWidget({
|
|
|
1412
1417
|
label: (0, import_utils28.labelValue)(label, hideLabel || !label),
|
|
1413
1418
|
...chakraProps,
|
|
1414
1419
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1415
|
-
|
|
1420
|
+
import_react43.Textarea,
|
|
1416
1421
|
{
|
|
1417
1422
|
id,
|
|
1418
1423
|
name: htmlName || id,
|
|
1419
1424
|
value: value ?? "",
|
|
1420
1425
|
placeholder,
|
|
1421
1426
|
autoFocus: autofocus,
|
|
1422
|
-
onChange:
|
|
1423
|
-
onBlur:
|
|
1424
|
-
onFocus:
|
|
1427
|
+
onChange: handleChange,
|
|
1428
|
+
onBlur: handleBlur,
|
|
1429
|
+
onFocus: handleFocus,
|
|
1425
1430
|
rows: options.rows,
|
|
1426
1431
|
"aria-describedby": (0, import_utils28.ariaDescribedByIds)(id)
|
|
1427
1432
|
}
|
|
@@ -1434,22 +1439,22 @@ function TextareaWidget({
|
|
|
1434
1439
|
var import_utils30 = require("@rjsf/utils");
|
|
1435
1440
|
|
|
1436
1441
|
// src/components/ui/number-input.tsx
|
|
1437
|
-
var
|
|
1438
|
-
var
|
|
1442
|
+
var import_react44 = require("react");
|
|
1443
|
+
var import_react45 = require("@chakra-ui/react");
|
|
1439
1444
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1440
|
-
var NumberInputRoot = (0,
|
|
1441
|
-
const inputRef = (0,
|
|
1442
|
-
(0,
|
|
1445
|
+
var NumberInputRoot = (0, import_react44.forwardRef)((props, ref) => {
|
|
1446
|
+
const inputRef = (0, import_react44.useRef)(null);
|
|
1447
|
+
(0, import_react44.useEffect)(() => {
|
|
1443
1448
|
if (inputRef.current) {
|
|
1444
1449
|
inputRef.current.value = props.value || "";
|
|
1445
1450
|
}
|
|
1446
1451
|
}, [props.value]);
|
|
1447
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1448
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1449
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1450
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react45.NumberInput.Root, { ref, variant: "outline", ...props, children: [
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react45.NumberInput.Control, { children: [
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react45.NumberInput.IncrementTrigger, {}),
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react45.NumberInput.DecrementTrigger, {})
|
|
1451
1456
|
] }),
|
|
1452
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react45.NumberInput.Input, { ref: inputRef })
|
|
1453
1458
|
] });
|
|
1454
1459
|
});
|
|
1455
1460
|
|
|
@@ -1457,9 +1462,9 @@ var NumberInputRoot = (0, import_react43.forwardRef)(function NumberInput(props,
|
|
|
1457
1462
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1458
1463
|
function UpDownWidget(props) {
|
|
1459
1464
|
const { id, readonly, disabled, label, hideLabel, value, onChange, onBlur, onFocus, rawErrors, required } = props;
|
|
1460
|
-
const
|
|
1461
|
-
const
|
|
1462
|
-
const
|
|
1465
|
+
const handleChange = ({ value: newValue }) => onChange(newValue);
|
|
1466
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1467
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1463
1468
|
const chakraProps = getChakra({ uiSchema: props.uiSchema });
|
|
1464
1469
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1465
1470
|
Field,
|
|
@@ -1475,9 +1480,9 @@ function UpDownWidget(props) {
|
|
|
1475
1480
|
NumberInputRoot,
|
|
1476
1481
|
{
|
|
1477
1482
|
value,
|
|
1478
|
-
onValueChange:
|
|
1479
|
-
onBlur:
|
|
1480
|
-
onFocus:
|
|
1483
|
+
onValueChange: handleChange,
|
|
1484
|
+
onBlur: handleBlur,
|
|
1485
|
+
onFocus: handleFocus,
|
|
1481
1486
|
"aria-describedby": (0, import_utils30.ariaDescribedByIds)(id),
|
|
1482
1487
|
id,
|
|
1483
1488
|
name: id
|
|
@@ -1520,18 +1525,16 @@ function generateForm() {
|
|
|
1520
1525
|
var Form_default = generateForm();
|
|
1521
1526
|
|
|
1522
1527
|
// src/ChakraFrameProvider.tsx
|
|
1523
|
-
var
|
|
1528
|
+
var import_react46 = require("@chakra-ui/react");
|
|
1524
1529
|
var import_cache = __toESM(require("@emotion/cache"), 1);
|
|
1525
|
-
var
|
|
1530
|
+
var import_react47 = require("@emotion/react");
|
|
1526
1531
|
var import_weak_memoize = __toESM(require("@emotion/weak-memoize"), 1);
|
|
1527
1532
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1528
1533
|
var memoizedCreateCacheWithContainer = (0, import_weak_memoize.default)((container) => {
|
|
1529
1534
|
const newCache = (0, import_cache.default)({ container, key: "rjsf" });
|
|
1530
1535
|
return newCache;
|
|
1531
1536
|
});
|
|
1532
|
-
var __createChakraFrameProvider = (props) => ({ document }) => {
|
|
1533
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { margin: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react46.CacheProvider, { value: memoizedCreateCacheWithContainer(document.head), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react45.ChakraProvider, { value: import_react45.defaultSystem, children: props.children }) }) });
|
|
1534
|
-
};
|
|
1537
|
+
var __createChakraFrameProvider = (props) => ({ document }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { margin: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react47.CacheProvider, { value: memoizedCreateCacheWithContainer(document.head), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react46.ChakraProvider, { value: import_react46.defaultSystem, children: props.children }) }) });
|
|
1535
1538
|
|
|
1536
1539
|
// src/index.ts
|
|
1537
1540
|
var index_default = Form_default;
|