@rjsf/shadcn 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/index.cjs +117 -100
- package/dist/index.cjs.map +3 -3
- package/dist/rjsf-shadcn.esm.js +105 -124
- package/dist/rjsf-shadcn.esm.js.map +3 -3
- package/dist/rjsf-shadcn.umd.js +96 -80
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.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 +6 -6
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +5 -5
- 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 +1 -3
- 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/IconButton.d.ts +15 -8
- package/lib/IconButton/IconButton.js +14 -6
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +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 +2 -2
- package/lib/RangeWidget/RangeWidget.js +2 -2
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +8 -8
- 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 +4 -4
- 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/TitleField/TitleField.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/badge.d.ts +1 -1
- package/lib/components/ui/button.d.ts +1 -1
- package/lib/components/ui/checkbox.d.ts +1 -1
- package/lib/components/ui/command.d.ts +1 -1
- package/lib/components/ui/command.js +1 -3
- package/lib/components/ui/command.js.map +1 -1
- package/lib/components/ui/dialog.d.ts +1 -1
- package/lib/components/ui/fancy-multi-select.d.ts +3 -3
- package/lib/components/ui/fancy-multi-select.js +2 -2
- package/lib/components/ui/fancy-multi-select.js.map +1 -1
- package/lib/components/ui/fancy-select.d.ts +3 -3
- package/lib/components/ui/fancy-select.js +1 -1
- package/lib/components/ui/fancy-select.js.map +1 -1
- package/lib/components/ui/input.d.ts +1 -1
- package/lib/components/ui/label.d.ts +1 -1
- package/lib/components/ui/radio-group.d.ts +1 -1
- package/lib/components/ui/separator.d.ts +1 -1
- package/lib/components/ui/slider.d.ts +1 -1
- package/lib/components/ui/slider.js +10 -2
- package/lib/components/ui/slider.js.map +1 -1
- package/lib/components/ui/textarea.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -9
- package/src/AddButton/AddButton.tsx +2 -1
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +2 -8
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -9
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +13 -19
- package/src/CheckboxWidget/CheckboxWidget.tsx +8 -17
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +7 -10
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +6 -4
- 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/IconButton.tsx +19 -9
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +4 -14
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +10 -13
- package/src/RangeWidget/RangeWidget.tsx +5 -4
- package/src/SelectWidget/SelectWidget.tsx +11 -14
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +10 -9
- package/src/Theme/Theme.tsx +2 -2
- package/src/TitleField/TitleField.tsx +2 -1
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
- package/src/components/ui/alert.tsx +1 -1
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/command.tsx +13 -14
- package/src/components/ui/dialog.tsx +1 -1
- package/src/components/ui/fancy-multi-select.tsx +5 -13
- package/src/components/ui/fancy-select.tsx +7 -3
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/radio-group.tsx +1 -1
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/slider.tsx +12 -6
- package/src/components/ui/textarea.tsx +1 -1
package/dist/rjsf-shadcn.umd.js
CHANGED
|
@@ -191,10 +191,10 @@
|
|
|
191
191
|
...extraProps,
|
|
192
192
|
...utils.getInputProps(schema, type, options)
|
|
193
193
|
};
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
const
|
|
197
|
-
const
|
|
194
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
195
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
196
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
197
|
+
const handleClear = react.useCallback(
|
|
198
198
|
(e) => {
|
|
199
199
|
e.preventDefault();
|
|
200
200
|
e.stopPropagation();
|
|
@@ -218,13 +218,13 @@
|
|
|
218
218
|
list: schema.examples ? utils.examplesId(id) : void 0,
|
|
219
219
|
...inputProps,
|
|
220
220
|
value: value || value === 0 ? value : "",
|
|
221
|
-
onChange: onChangeOverride ||
|
|
222
|
-
onBlur:
|
|
223
|
-
onFocus:
|
|
221
|
+
onChange: onChangeOverride || handleChange,
|
|
222
|
+
onBlur: handleBlur,
|
|
223
|
+
onFocus: handleFocus,
|
|
224
224
|
"aria-describedby": utils.ariaDescribedByIds(id, !!schema.examples)
|
|
225
225
|
}
|
|
226
226
|
),
|
|
227
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { onClick:
|
|
227
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { onClick: handleClear, registry }),
|
|
228
228
|
children,
|
|
229
229
|
/* @__PURE__ */ jsxRuntime.jsx(core.SchemaExamples, { id, schema })
|
|
230
230
|
] });
|
|
@@ -283,12 +283,13 @@
|
|
|
283
283
|
return /* @__PURE__ */ jsxRuntime.jsxs(Alert, { variant: "destructive", className: "mb-2", children: [
|
|
284
284
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4" }),
|
|
285
285
|
/* @__PURE__ */ jsxRuntime.jsx(AlertTitle, { children: translateString(utils.TranslatableString.ErrorsLabel) }),
|
|
286
|
-
/* @__PURE__ */ jsxRuntime.jsx(AlertDescription, { className: "flex flex-col gap-1", children: errors.map((error, i) =>
|
|
287
|
-
|
|
286
|
+
/* @__PURE__ */ jsxRuntime.jsx(AlertDescription, { className: "flex flex-col gap-1", children: errors.map((error, i) => (
|
|
287
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
288
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
288
289
|
"\u2022 ",
|
|
289
290
|
error.stack
|
|
290
|
-
] }, i)
|
|
291
|
-
|
|
291
|
+
] }, i)
|
|
292
|
+
)) })
|
|
292
293
|
] });
|
|
293
294
|
}
|
|
294
295
|
function FieldErrorTemplate(props) {
|
|
@@ -297,9 +298,10 @@
|
|
|
297
298
|
return null;
|
|
298
299
|
}
|
|
299
300
|
const id = utils.errorId(fieldPathId);
|
|
300
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", id, children: errors.map((error, i) =>
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", id, children: errors.map((error, i) => (
|
|
302
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-destructive mb-1", children: error }, i)
|
|
304
|
+
)) });
|
|
303
305
|
}
|
|
304
306
|
function FieldHelpTemplate(props) {
|
|
305
307
|
const { fieldPathId, help, uiSchema, registry, hasErrors } = props;
|
|
@@ -399,17 +401,20 @@
|
|
|
399
401
|
const { children, column, className, ...rest } = props;
|
|
400
402
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("grid gap-2", className), ...rest, children });
|
|
401
403
|
}
|
|
402
|
-
function
|
|
404
|
+
function IconButtonFn(props) {
|
|
403
405
|
const { icon, iconType, className, uiSchema, registry, ...otherProps } = props;
|
|
404
406
|
return /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "icon", variant: "outline", className, ...otherProps, type: "button", children: icon });
|
|
405
407
|
}
|
|
406
|
-
|
|
408
|
+
var IconButton = react.memo(IconButtonFn);
|
|
409
|
+
var IconButton_default = IconButton;
|
|
410
|
+
function CopyButtonFn(props) {
|
|
407
411
|
const {
|
|
408
412
|
registry: { translateString }
|
|
409
413
|
} = props;
|
|
410
414
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "h-4 w-4" }) });
|
|
411
415
|
}
|
|
412
|
-
|
|
416
|
+
var CopyButton = react.memo(CopyButtonFn);
|
|
417
|
+
function MoveDownButtonFn(props) {
|
|
413
418
|
const {
|
|
414
419
|
registry: { translateString }
|
|
415
420
|
} = props;
|
|
@@ -422,7 +427,8 @@
|
|
|
422
427
|
}
|
|
423
428
|
);
|
|
424
429
|
}
|
|
425
|
-
|
|
430
|
+
var MoveDownButton = react.memo(MoveDownButtonFn);
|
|
431
|
+
function MoveUpButtonFn(props) {
|
|
426
432
|
const {
|
|
427
433
|
registry: { translateString }
|
|
428
434
|
} = props;
|
|
@@ -435,7 +441,8 @@
|
|
|
435
441
|
}
|
|
436
442
|
);
|
|
437
443
|
}
|
|
438
|
-
|
|
444
|
+
var MoveUpButton = react.memo(MoveUpButtonFn);
|
|
445
|
+
function RemoveButtonFn(props) {
|
|
439
446
|
const {
|
|
440
447
|
registry: { translateString }
|
|
441
448
|
} = props;
|
|
@@ -449,12 +456,14 @@
|
|
|
449
456
|
}
|
|
450
457
|
);
|
|
451
458
|
}
|
|
452
|
-
|
|
459
|
+
var RemoveButton = react.memo(RemoveButtonFn);
|
|
460
|
+
function ClearButtonFn(props) {
|
|
453
461
|
const {
|
|
454
462
|
registry: { translateString }
|
|
455
463
|
} = props;
|
|
456
464
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { title: translateString(utils.TranslatableString.ClearButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) });
|
|
457
465
|
}
|
|
466
|
+
var ClearButton = react.memo(ClearButtonFn);
|
|
458
467
|
function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
459
468
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("p-4 border rounded-md bg-background shadow-sm"), children: [
|
|
460
469
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("mb-4"), children: selector }),
|
|
@@ -512,7 +521,7 @@
|
|
|
512
521
|
),
|
|
513
522
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
514
523
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
515
|
-
properties.map((element
|
|
524
|
+
properties.map((element) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${element.hidden ? "hidden" : ""} flex`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: element.content }) }, element.name)),
|
|
516
525
|
utils.canExpand(schema, uiSchema, formData) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
517
526
|
AddButton2,
|
|
518
527
|
{
|
|
@@ -531,7 +540,7 @@
|
|
|
531
540
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
532
541
|
if (onAddClick) {
|
|
533
542
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
534
|
-
|
|
543
|
+
IconButton_default,
|
|
535
544
|
{
|
|
536
545
|
id,
|
|
537
546
|
registry,
|
|
@@ -542,7 +551,8 @@
|
|
|
542
551
|
size: "xs"
|
|
543
552
|
}
|
|
544
553
|
);
|
|
545
|
-
}
|
|
554
|
+
}
|
|
555
|
+
if (onRemoveClick) {
|
|
546
556
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
547
557
|
RemoveButton,
|
|
548
558
|
{
|
|
@@ -748,11 +758,11 @@
|
|
|
748
758
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
749
759
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
750
760
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
751
|
-
const
|
|
752
|
-
const
|
|
761
|
+
const handleBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
762
|
+
const handleFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
753
763
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn({ "flex flex-col gap-2": !inline, "flex flex-row gap-4 flex-wrap": inline }), children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
754
764
|
const checked = utils.enumOptionsIsSelected(option.value, checkboxesValues);
|
|
755
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
765
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
756
766
|
const indexOptionId = utils.optionId(id, index);
|
|
757
767
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
758
768
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -772,8 +782,8 @@
|
|
|
772
782
|
className,
|
|
773
783
|
checked,
|
|
774
784
|
autoFocus: autofocus && index === 0,
|
|
775
|
-
onBlur:
|
|
776
|
-
onFocus:
|
|
785
|
+
onBlur: handleBlur,
|
|
786
|
+
onFocus: handleFocus,
|
|
777
787
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
778
788
|
}
|
|
779
789
|
),
|
|
@@ -806,9 +816,9 @@
|
|
|
806
816
|
registry,
|
|
807
817
|
options
|
|
808
818
|
);
|
|
809
|
-
const
|
|
810
|
-
const
|
|
811
|
-
const
|
|
819
|
+
const handleChange = (checked) => onChange(checked);
|
|
820
|
+
const handleBlur = () => onBlur(id, value);
|
|
821
|
+
const handleFocus = () => onFocus(id, value);
|
|
812
822
|
const description = options.description || schema.description;
|
|
813
823
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
814
824
|
"div",
|
|
@@ -836,9 +846,9 @@
|
|
|
836
846
|
required,
|
|
837
847
|
disabled: disabled || readonly,
|
|
838
848
|
autoFocus: autofocus,
|
|
839
|
-
onCheckedChange:
|
|
840
|
-
onBlur:
|
|
841
|
-
onFocus:
|
|
849
|
+
onCheckedChange: handleChange,
|
|
850
|
+
onBlur: handleBlur,
|
|
851
|
+
onFocus: handleFocus,
|
|
842
852
|
className
|
|
843
853
|
}
|
|
844
854
|
),
|
|
@@ -879,9 +889,9 @@
|
|
|
879
889
|
}) {
|
|
880
890
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
881
891
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
882
|
-
const
|
|
883
|
-
const
|
|
884
|
-
const
|
|
892
|
+
const handleChange = (enumValue) => onChange(utils.enumOptionValueDecoder(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
893
|
+
const handleBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
894
|
+
const handleFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
885
895
|
const inline = Boolean(options && options.inline);
|
|
886
896
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
887
897
|
RadioGroup,
|
|
@@ -890,15 +900,15 @@
|
|
|
890
900
|
required,
|
|
891
901
|
disabled: disabled || readonly,
|
|
892
902
|
onValueChange: (e) => {
|
|
893
|
-
|
|
903
|
+
handleChange(e);
|
|
894
904
|
},
|
|
895
|
-
onBlur:
|
|
896
|
-
onFocus:
|
|
905
|
+
onBlur: handleBlur,
|
|
906
|
+
onFocus: handleFocus,
|
|
897
907
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
898
908
|
orientation: inline ? "horizontal" : "vertical",
|
|
899
909
|
className: cn("flex flex-wrap", { "flex-col": !inline }, className),
|
|
900
910
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
901
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
911
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
902
912
|
const checked = utils.enumOptionsIsSelected(option.value, value);
|
|
903
913
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
904
914
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -917,10 +927,15 @@
|
|
|
917
927
|
) });
|
|
918
928
|
}
|
|
919
929
|
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
920
|
-
const
|
|
921
|
-
(
|
|
922
|
-
|
|
923
|
-
|
|
930
|
+
const enumValues = react.useMemo(() => {
|
|
931
|
+
if (Array.isArray(value)) {
|
|
932
|
+
return value;
|
|
933
|
+
}
|
|
934
|
+
if (Array.isArray(defaultValue)) {
|
|
935
|
+
return defaultValue;
|
|
936
|
+
}
|
|
937
|
+
return [min, max];
|
|
938
|
+
}, [value, defaultValue, min, max]);
|
|
924
939
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
925
940
|
reactSlider.Root,
|
|
926
941
|
{
|
|
@@ -951,7 +966,7 @@
|
|
|
951
966
|
)
|
|
952
967
|
}
|
|
953
968
|
),
|
|
954
|
-
Array.from({ length:
|
|
969
|
+
Array.from({ length: enumValues.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
955
970
|
reactSlider.Thumb,
|
|
956
971
|
{
|
|
957
972
|
"data-slot": "slider-thumb",
|
|
@@ -988,7 +1003,7 @@
|
|
|
988
1003
|
label,
|
|
989
1004
|
id
|
|
990
1005
|
}) {
|
|
991
|
-
const
|
|
1006
|
+
const handleChange = (newValue) => onChange(newValue[0]);
|
|
992
1007
|
const sliderProps = { ...utils.rangeSpec(schema) };
|
|
993
1008
|
const uiProps = { id, ..._pick(options.props || {}, allowedProps) };
|
|
994
1009
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1000,7 +1015,7 @@
|
|
|
1000
1015
|
max: sliderProps.max,
|
|
1001
1016
|
step: sliderProps.step,
|
|
1002
1017
|
value: [value],
|
|
1003
|
-
onValueChange:
|
|
1018
|
+
onValueChange: handleChange,
|
|
1004
1019
|
...uiProps,
|
|
1005
1020
|
"aria-describedby": utils.ariaDescribedByIds(id)
|
|
1006
1021
|
}
|
|
@@ -1034,20 +1049,18 @@
|
|
|
1034
1049
|
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props });
|
|
1035
1050
|
}
|
|
1036
1051
|
var Command = react.forwardRef(
|
|
1037
|
-
({ className, ...props }, ref) =>
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1052
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1053
|
+
cmdk.Command,
|
|
1054
|
+
{
|
|
1055
|
+
ref,
|
|
1056
|
+
"data-slot": "command",
|
|
1057
|
+
className: cn(
|
|
1058
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
1059
|
+
className
|
|
1060
|
+
),
|
|
1061
|
+
...props
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1051
1064
|
);
|
|
1052
1065
|
var CommandInput = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3", ...{ "cmdk-input-wrapper": "" }, children: [
|
|
1053
1066
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
@@ -1156,7 +1169,7 @@
|
|
|
1156
1169
|
}
|
|
1157
1170
|
setInputValue("");
|
|
1158
1171
|
const newSelected = multiple ? [...selectedItems, item] : [item];
|
|
1159
|
-
onValueChange?.(newSelected.map((
|
|
1172
|
+
onValueChange?.(newSelected.map((selectedItem) => selectedItem.index));
|
|
1160
1173
|
},
|
|
1161
1174
|
[multiple, selectedItems, onValueChange, disabled]
|
|
1162
1175
|
);
|
|
@@ -1301,7 +1314,10 @@
|
|
|
1301
1314
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1302
1315
|
"div",
|
|
1303
1316
|
{
|
|
1317
|
+
role: "button",
|
|
1318
|
+
tabIndex: disabled ? -1 : 0,
|
|
1304
1319
|
onClick: () => !disabled && setOpen(!open),
|
|
1320
|
+
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && !disabled && setOpen(!open),
|
|
1305
1321
|
className: cn(
|
|
1306
1322
|
"flex h-9 w-full items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
1307
1323
|
!selectedItem && required && "border-red-500",
|
|
@@ -1369,17 +1385,17 @@
|
|
|
1369
1385
|
}) {
|
|
1370
1386
|
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
1371
1387
|
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
1372
|
-
const
|
|
1388
|
+
const handleFancyFocus = () => {
|
|
1373
1389
|
onFocus(id, utils.enumOptionValueDecoder(value, enumOptions, optionValueFormat, optEmptyValue));
|
|
1374
1390
|
};
|
|
1375
|
-
const
|
|
1391
|
+
const handleFancyBlur = () => {
|
|
1376
1392
|
onBlur(id, utils.enumOptionValueDecoder(value, enumOptions, optionValueFormat, optEmptyValue));
|
|
1377
1393
|
};
|
|
1378
|
-
const items = enumOptions?.map(({ value:
|
|
1379
|
-
value: multiple ?
|
|
1380
|
-
label,
|
|
1394
|
+
const items = enumOptions?.map(({ value: enumValue, label: enumLabel }, index) => ({
|
|
1395
|
+
value: multiple ? enumValue : utils.enumOptionValueEncoder(enumValue, index, optionValueFormat),
|
|
1396
|
+
label: enumLabel,
|
|
1381
1397
|
index,
|
|
1382
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(
|
|
1398
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1383
1399
|
}));
|
|
1384
1400
|
const cnClassName = cn({ "border-destructive": rawErrors.length > 0 }, className);
|
|
1385
1401
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-0.5", children: !multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1395,8 +1411,8 @@
|
|
|
1395
1411
|
required,
|
|
1396
1412
|
placeholder,
|
|
1397
1413
|
className: cnClassName,
|
|
1398
|
-
onFocus:
|
|
1399
|
-
onBlur:
|
|
1414
|
+
onFocus: handleFancyFocus,
|
|
1415
|
+
onBlur: handleFancyBlur,
|
|
1400
1416
|
ariaDescribedby: utils.ariaDescribedByIds(id)
|
|
1401
1417
|
}
|
|
1402
1418
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1412,8 +1428,8 @@
|
|
|
1412
1428
|
onValueChange: (values) => {
|
|
1413
1429
|
onChange(utils.enumOptionValueDecoder(values.map(String), enumOptions, optionValueFormat, optEmptyValue));
|
|
1414
1430
|
},
|
|
1415
|
-
onFocus:
|
|
1416
|
-
onBlur:
|
|
1431
|
+
onFocus: handleFancyFocus,
|
|
1432
|
+
onBlur: handleFancyBlur
|
|
1417
1433
|
}
|
|
1418
1434
|
) });
|
|
1419
1435
|
}
|
|
@@ -1445,9 +1461,9 @@
|
|
|
1445
1461
|
options,
|
|
1446
1462
|
className
|
|
1447
1463
|
}) {
|
|
1448
|
-
const
|
|
1449
|
-
const
|
|
1450
|
-
const
|
|
1464
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1465
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1466
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1451
1467
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex p-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1452
1468
|
Textarea,
|
|
1453
1469
|
{
|
|
@@ -1460,9 +1476,9 @@
|
|
|
1460
1476
|
required,
|
|
1461
1477
|
autoFocus: autofocus,
|
|
1462
1478
|
rows: options.rows || 5,
|
|
1463
|
-
onChange:
|
|
1464
|
-
onBlur:
|
|
1465
|
-
onFocus:
|
|
1479
|
+
onChange: handleChange,
|
|
1480
|
+
onBlur: handleBlur,
|
|
1481
|
+
onFocus: handleFocus,
|
|
1466
1482
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1467
1483
|
className
|
|
1468
1484
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, IconButtonProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/**
|
|
3
3
|
* A button component for adding new items in a form
|
|
4
4
|
* @param uiSchema - The UI schema for the form, which can include custom properties
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AddButton.js","sourceRoot":"","sources":["../../src/AddButton/AddButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoF,EACnH,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACiB;IACzB,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,OAAO,CACL,cAAK,SAAS,EAAC,SAAS,YACtB,MAAC,MAAM,OAAK,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,aACzF,KAAC,UAAU,IAAC,IAAI,EAAE,EAAE,GAAI,OAAE,eAAe,CAAC,kBAAkB,CAAC,aAAa,CAAC,IACpE,GACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
3
3
|
*
|
|
4
4
|
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getTemplate, getUiOptions
|
|
2
|
+
import { getTemplate, getUiOptions } from '@rjsf/utils';
|
|
3
3
|
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
4
4
|
*
|
|
5
5
|
* @param props - The `ArrayFieldItemTemplateProps` props for the component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ArrayFieldItemTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAI5C,KAA2C;IAC3C,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACvG,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,OAAO,CACL,wBACE,eAAK,SAAS,EAAC,2CAA2C,aACxD,cAAK,SAAS,EAAC,aAAa,YAAE,QAAQ,GAAO,EAC7C,cAAK,SAAS,EAAC,kCAAkC,YAC9C,UAAU,IAAI,CACb,cACE,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,YAEjF,KAAC,6BAA6B,OAAK,YAAY,GAAI,GAC/C,CACP,GACG,IACF,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { ArrayFieldTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
3
3
|
*
|
|
4
4
|
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { buttonId, getTemplate, getUiOptions
|
|
2
|
+
import { buttonId, getTemplate, getUiOptions } from '@rjsf/utils';
|
|
3
3
|
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
4
4
|
*
|
|
5
5
|
* @param props - The `ArrayFieldTemplateProps` props for the component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ArrayFieldTemplate.js","sourceRoot":"","sources":["../../src/ArrayFieldTemplate/ArrayFieldTemplate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAAuC;IACvC,MAAM,EACJ,MAAM,EACN,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,KAAK,EACL,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,GACN,GAAG,KAAK,CAAC;IACV,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAClD,MAAM,6BAA6B,GAAG,WAAW,CAC/C,+BAA+B,EAC/B,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,uBAAuB,GAAG,WAAW,CACzC,yBAAyB,EACzB,QAAQ,EACR,SAAS,CACV,CAAC;IACF,MAAM,8BAA8B,GAAG,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC;IAC9D,sDAAsD;IACtD,MAAM,EACJ,eAAe,EAAE,EAAE,SAAS,EAAE,GAC/B,GAAG,QAAQ,CAAC,SAAS,CAAC;IACvB,OAAO,CACL,wBACE,cAAK,SAAS,EAAC,cAAc,YAC3B,eAAK,SAAS,EAAC,gBAAgB,aAC7B,KAAC,uBAAuB,IACtB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,KAAK,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,8BAA8B,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,GACrF,EACF,KAAC,6BAA6B,IAC5B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,EACxD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,EACF,eAAgD,SAAS,EAAC,qBAAqB,aAC5E,CAAC,8BAA8B,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,EACjE,KAAK,EACL,MAAM,IAAI,CACT,cAAK,SAAS,EAAC,uBAAuB,YACpC,KAAC,SAAS,IACR,EAAE,EAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,EAChC,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACE,CACP,KAdO,mBAAmB,WAAW,CAAC,GAAG,EAAE,CAexC,IACF,GACF,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { BaseInputTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
3
3
|
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
4
4
|
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { SchemaExamples } from '@rjsf/core';
|
|
4
|
-
import { ariaDescribedByIds, examplesId, getInputProps
|
|
4
|
+
import { ariaDescribedByIds, examplesId, getInputProps } from '@rjsf/utils';
|
|
5
5
|
import { Input } from '../components/ui/input.js';
|
|
6
6
|
import { cn } from '../lib/utils.js';
|
|
7
7
|
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
@@ -16,15 +16,15 @@ export default function BaseInputTemplate({ id, htmlName, placeholder, required,
|
|
|
16
16
|
...extraProps,
|
|
17
17
|
...getInputProps(schema, type, options),
|
|
18
18
|
};
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
19
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === '' ? options.emptyValue : newValue);
|
|
20
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
21
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
22
|
+
const handleClear = useCallback((e) => {
|
|
23
23
|
var _a;
|
|
24
24
|
e.preventDefault();
|
|
25
25
|
e.stopPropagation();
|
|
26
26
|
onChange((_a = options.emptyValue) !== null && _a !== void 0 ? _a : '');
|
|
27
27
|
}, [onChange, options.emptyValue]);
|
|
28
|
-
return (_jsxs("div", { className: 'p-0.5', children: [_jsx(Input, { id: id, name: htmlName || id, type: type, placeholder: placeholder, autoFocus: autofocus, required: required, disabled: disabled, readOnly: readonly, className: cn({ 'border-destructive focus-visible:ring-0': rawErrors.length > 0 }, className), list: schema.examples ? examplesId(id) : undefined, ...inputProps, value: value || value === 0 ? value : '', onChange: onChangeOverride ||
|
|
28
|
+
return (_jsxs("div", { className: 'p-0.5', children: [_jsx(Input, { id: id, name: htmlName || id, type: type, placeholder: placeholder, autoFocus: autofocus, required: required, disabled: disabled, readOnly: readonly, className: cn({ 'border-destructive focus-visible:ring-0': rawErrors.length > 0 }, className), list: schema.examples ? examplesId(id) : undefined, ...inputProps, value: value || value === 0 ? value : '', onChange: onChangeOverride || handleChange, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }), options.allowClearTextInputs && !readonly && !disabled && value && (_jsx(ClearButton, { onClick: handleClear, registry: registry })), children, _jsx(SchemaExamples, { id: id, schema: schema })] }));
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=BaseInputTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BaseInputTemplate.js","sourceRoot":"","sources":["../../src/BaseInputTemplate/BaseInputTemplate.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
2
2
|
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
3
3
|
* It is typically used to represent a boolean.
|
|
4
4
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ariaDescribedByIds, descriptionId, getTemplate, labelValue, schemaRequiresTrueValue
|
|
2
|
+
import { ariaDescribedByIds, descriptionId, getTemplate, labelValue, schemaRequiresTrueValue } from '@rjsf/utils';
|
|
3
3
|
import { Checkbox } from '../components/ui/checkbox.js';
|
|
4
4
|
import { Label } from '../components/ui/label.js';
|
|
5
5
|
/** The `CheckBoxWidget` is a widget for rendering boolean properties.
|
|
@@ -14,10 +14,10 @@ export default function CheckboxWidget(props) {
|
|
|
14
14
|
// "const" or "enum" keywords
|
|
15
15
|
const required = schemaRequiresTrueValue(schema);
|
|
16
16
|
const DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const handleChange = (checked) => onChange(checked);
|
|
18
|
+
const handleBlur = () => onBlur(id, value);
|
|
19
|
+
const handleFocus = () => onFocus(id, value);
|
|
20
20
|
const description = options.description || schema.description;
|
|
21
|
-
return (_jsxs("div", { className: `relative ${disabled || readonly ? 'cursor-not-allowed opacity-50' : ''}`, "aria-describedby": ariaDescribedByIds(id), children: [!hideLabel && description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs("div", { className: 'flex items-center gap-2 my-2', children: [_jsx(Checkbox, { id: id, name: htmlName || id, checked: typeof value === 'undefined' ? false : Boolean(value), required: required, disabled: disabled || readonly, autoFocus: autofocus, onCheckedChange:
|
|
21
|
+
return (_jsxs("div", { className: `relative ${disabled || readonly ? 'cursor-not-allowed opacity-50' : ''}`, "aria-describedby": ariaDescribedByIds(id), children: [!hideLabel && description && (_jsx(DescriptionFieldTemplate, { id: descriptionId(id), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), _jsxs("div", { className: 'flex items-center gap-2 my-2', children: [_jsx(Checkbox, { id: id, name: htmlName || id, checked: typeof value === 'undefined' ? false : Boolean(value), required: required, disabled: disabled || readonly, autoFocus: autofocus, onCheckedChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, className: className }), _jsx(Label, { className: 'leading-tight', htmlFor: id, children: labelValue(label, hideLabel || !label) })] })] }));
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=CheckboxWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxWidget.js","sourceRoot":"","sources":["../../src/CheckboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CheckboxWidget.js","sourceRoot":"","sources":["../../src/CheckboxWidget/CheckboxWidget.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAElH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAIpC,KAA2B;IAC3B,MAAM,EACJ,EAAE,EACF,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,EACN,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,GAAG,KAAK,CAAC;IACV,8EAA8E;IAC9E,yEAAyE;IACzE,6BAA6B;IAC7B,MAAM,QAAQ,GAAG,uBAAuB,CAAI,MAAM,CAAC,CAAC;IACpD,MAAM,wBAAwB,GAAG,WAAW,CAC1C,0BAA0B,EAC1B,QAAQ,EACR,OAAO,CACR,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAE7C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC;IAC9D,OAAO,CACL,eACE,SAAS,EAAE,YAAY,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,EAAE,sBAClE,kBAAkB,CAAC,EAAE,CAAC,aAEvC,CAAC,SAAS,IAAI,WAAW,IAAI,CAC5B,KAAC,wBAAwB,IACvB,EAAE,EAAE,aAAa,CAAC,EAAE,CAAC,EACrB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,EACD,eAAK,SAAS,EAAC,8BAA8B,aAC3C,KAAC,QAAQ,IACP,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,QAAQ,IAAI,EAAE,EACpB,OAAO,EAAE,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAC9D,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,YAAY,EAC7B,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,SAAS,GACpB,EACF,KAAC,KAAK,IAAC,SAAS,EAAC,eAAe,EAAC,OAAO,EAAE,EAAE,YACzC,UAAU,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC,KAAK,CAAC,GACjC,IACJ,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
1
|
+
import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils';
|
|
2
2
|
/** The `CheckboxesWidget` is a widget for rendering checkbox groups.
|
|
3
3
|
* It is typically used to represent an array of enums.
|
|
4
4
|
*
|
|
@@ -12,12 +12,12 @@ export default function CheckboxesWidget({ id, htmlName, disabled, options, valu
|
|
|
12
12
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
13
13
|
const optionValueFormat = getOptionValueFormat(options);
|
|
14
14
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
16
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
17
17
|
return (_jsx("div", { className: cn({ 'flex flex-col gap-2': !inline, 'flex flex-row gap-4 flex-wrap': inline }), children: Array.isArray(enumOptions) &&
|
|
18
18
|
enumOptions.map((option, index) => {
|
|
19
19
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
20
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
20
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
21
21
|
const indexOptionId = optionId(id, index);
|
|
22
22
|
return (_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Checkbox, { id: indexOptionId, name: htmlName || id, required: required, disabled: disabled || itemDisabled || readonly, onCheckedChange: (state) => {
|
|
23
23
|
if (state) {
|
|
@@ -26,7 +26,7 @@ export default function CheckboxesWidget({ id, htmlName, disabled, options, valu
|
|
|
26
26
|
else {
|
|
27
27
|
onChange(enumOptionsDeselectValue(index, checkboxesValues, enumOptions));
|
|
28
28
|
}
|
|
29
|
-
}, className: className, checked: checked, autoFocus: autofocus && index === 0, onBlur:
|
|
29
|
+
}, className: className, checked: checked, autoFocus: autofocus && index === 0, onBlur: handleBlur, onFocus: handleFocus, "aria-describedby": ariaDescribedByIds(id) }), _jsx(Label, { className: 'leading-tight', htmlFor: optionId(id, index), children: option.label })] }, indexOptionId));
|
|
30
30
|
}) }));
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=CheckboxesWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxesWidget.js","sourceRoot":"","sources":["../../src/CheckboxesWidget/CheckboxesWidget.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CheckboxesWidget.js","sourceRoot":"","sources":["../../src/CheckboxesWidget/CheckboxesWidget.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
1
|
+
import type { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
2
|
/** The `DescriptionField` is the template to use to render the description of a field
|
|
3
3
|
*
|
|
4
4
|
* @param props - The `DescriptionFieldProps` for this component
|