@rjsf/shadcn 6.6.1 → 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 +6 -7
- 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.esm.js
CHANGED
|
@@ -72,10 +72,7 @@ function AddButton({
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
75
|
-
import {
|
|
76
|
-
getTemplate,
|
|
77
|
-
getUiOptions
|
|
78
|
-
} from "@rjsf/utils";
|
|
75
|
+
import { getTemplate, getUiOptions } from "@rjsf/utils";
|
|
79
76
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
80
77
|
function ArrayFieldItemTemplate(props) {
|
|
81
78
|
const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, uiSchema, registry } = props;
|
|
@@ -100,11 +97,7 @@ function ArrayFieldItemTemplate(props) {
|
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
103
|
-
import {
|
|
104
|
-
buttonId,
|
|
105
|
-
getTemplate as getTemplate2,
|
|
106
|
-
getUiOptions as getUiOptions2
|
|
107
|
-
} from "@rjsf/utils";
|
|
100
|
+
import { buttonId, getTemplate as getTemplate2, getUiOptions as getUiOptions2 } from "@rjsf/utils";
|
|
108
101
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
109
102
|
function ArrayFieldTemplate(props) {
|
|
110
103
|
const {
|
|
@@ -180,11 +173,7 @@ function ArrayFieldTemplate(props) {
|
|
|
180
173
|
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
181
174
|
import { useCallback } from "react";
|
|
182
175
|
import { SchemaExamples } from "@rjsf/core";
|
|
183
|
-
import {
|
|
184
|
-
ariaDescribedByIds,
|
|
185
|
-
examplesId,
|
|
186
|
-
getInputProps
|
|
187
|
-
} from "@rjsf/utils";
|
|
176
|
+
import { ariaDescribedByIds, examplesId, getInputProps } from "@rjsf/utils";
|
|
188
177
|
|
|
189
178
|
// src/components/ui/input.tsx
|
|
190
179
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
@@ -234,10 +223,10 @@ function BaseInputTemplate({
|
|
|
234
223
|
...extraProps,
|
|
235
224
|
...getInputProps(schema, type, options)
|
|
236
225
|
};
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const
|
|
226
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
227
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
228
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
229
|
+
const handleClear = useCallback(
|
|
241
230
|
(e) => {
|
|
242
231
|
e.preventDefault();
|
|
243
232
|
e.stopPropagation();
|
|
@@ -261,13 +250,13 @@ function BaseInputTemplate({
|
|
|
261
250
|
list: schema.examples ? examplesId(id) : void 0,
|
|
262
251
|
...inputProps,
|
|
263
252
|
value: value || value === 0 ? value : "",
|
|
264
|
-
onChange: onChangeOverride ||
|
|
265
|
-
onBlur:
|
|
266
|
-
onFocus:
|
|
253
|
+
onChange: onChangeOverride || handleChange,
|
|
254
|
+
onBlur: handleBlur,
|
|
255
|
+
onFocus: handleFocus,
|
|
267
256
|
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
268
257
|
}
|
|
269
258
|
),
|
|
270
|
-
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx6(ClearButton2, { onClick:
|
|
259
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx6(ClearButton2, { onClick: handleClear, registry }),
|
|
271
260
|
children,
|
|
272
261
|
/* @__PURE__ */ jsx6(SchemaExamples, { id, schema })
|
|
273
262
|
] });
|
|
@@ -341,12 +330,13 @@ function ErrorList({
|
|
|
341
330
|
return /* @__PURE__ */ jsxs5(Alert, { variant: "destructive", className: "mb-2", children: [
|
|
342
331
|
/* @__PURE__ */ jsx9(AlertCircle, { className: "h-4 w-4" }),
|
|
343
332
|
/* @__PURE__ */ jsx9(AlertTitle, { children: translateString(TranslatableString2.ErrorsLabel) }),
|
|
344
|
-
/* @__PURE__ */ jsx9(AlertDescription, { className: "flex flex-col gap-1", children: errors.map((error, i) =>
|
|
345
|
-
|
|
333
|
+
/* @__PURE__ */ jsx9(AlertDescription, { className: "flex flex-col gap-1", children: errors.map((error, i) => (
|
|
334
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
335
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
346
336
|
"\u2022 ",
|
|
347
337
|
error.stack
|
|
348
|
-
] }, i)
|
|
349
|
-
|
|
338
|
+
] }, i)
|
|
339
|
+
)) })
|
|
350
340
|
] });
|
|
351
341
|
}
|
|
352
342
|
|
|
@@ -359,9 +349,10 @@ function FieldErrorTemplate(props) {
|
|
|
359
349
|
return null;
|
|
360
350
|
}
|
|
361
351
|
const id = errorId(fieldPathId);
|
|
362
|
-
return /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-1", id, children: errors.map((error, i) =>
|
|
363
|
-
|
|
364
|
-
|
|
352
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex flex-col gap-1", id, children: errors.map((error, i) => (
|
|
353
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
354
|
+
/* @__PURE__ */ jsx10("span", { className: "text-xs font-medium text-destructive mb-1", children: error }, i)
|
|
355
|
+
)) });
|
|
365
356
|
}
|
|
366
357
|
|
|
367
358
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
@@ -384,10 +375,7 @@ function FieldHelpTemplate(props) {
|
|
|
384
375
|
}
|
|
385
376
|
|
|
386
377
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
387
|
-
import {
|
|
388
|
-
getTemplate as getTemplate3,
|
|
389
|
-
getUiOptions as getUiOptions3
|
|
390
|
-
} from "@rjsf/utils";
|
|
378
|
+
import { getTemplate as getTemplate3, getUiOptions as getUiOptions3 } from "@rjsf/utils";
|
|
391
379
|
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
392
380
|
function FieldTemplate({
|
|
393
381
|
id,
|
|
@@ -478,20 +466,24 @@ function GridTemplate(props) {
|
|
|
478
466
|
}
|
|
479
467
|
|
|
480
468
|
// src/IconButton/IconButton.tsx
|
|
469
|
+
import { memo } from "react";
|
|
481
470
|
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
482
471
|
import { ChevronDown, ChevronUp, Copy, Trash2, X } from "lucide-react";
|
|
483
472
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
484
|
-
function
|
|
473
|
+
function IconButtonFn(props) {
|
|
485
474
|
const { icon, iconType, className, uiSchema, registry, ...otherProps } = props;
|
|
486
475
|
return /* @__PURE__ */ jsx14(Button, { size: "icon", variant: "outline", className, ...otherProps, type: "button", children: icon });
|
|
487
476
|
}
|
|
488
|
-
|
|
477
|
+
var IconButton = memo(IconButtonFn);
|
|
478
|
+
var IconButton_default = IconButton;
|
|
479
|
+
function CopyButtonFn(props) {
|
|
489
480
|
const {
|
|
490
481
|
registry: { translateString }
|
|
491
482
|
} = props;
|
|
492
483
|
return /* @__PURE__ */ jsx14(IconButton, { title: translateString(TranslatableString3.CopyButton), ...props, icon: /* @__PURE__ */ jsx14(Copy, { className: "h-4 w-4" }) });
|
|
493
484
|
}
|
|
494
|
-
|
|
485
|
+
var CopyButton = memo(CopyButtonFn);
|
|
486
|
+
function MoveDownButtonFn(props) {
|
|
495
487
|
const {
|
|
496
488
|
registry: { translateString }
|
|
497
489
|
} = props;
|
|
@@ -504,7 +496,8 @@ function MoveDownButton(props) {
|
|
|
504
496
|
}
|
|
505
497
|
);
|
|
506
498
|
}
|
|
507
|
-
|
|
499
|
+
var MoveDownButton = memo(MoveDownButtonFn);
|
|
500
|
+
function MoveUpButtonFn(props) {
|
|
508
501
|
const {
|
|
509
502
|
registry: { translateString }
|
|
510
503
|
} = props;
|
|
@@ -517,7 +510,8 @@ function MoveUpButton(props) {
|
|
|
517
510
|
}
|
|
518
511
|
);
|
|
519
512
|
}
|
|
520
|
-
|
|
513
|
+
var MoveUpButton = memo(MoveUpButtonFn);
|
|
514
|
+
function RemoveButtonFn(props) {
|
|
521
515
|
const {
|
|
522
516
|
registry: { translateString }
|
|
523
517
|
} = props;
|
|
@@ -531,12 +525,14 @@ function RemoveButton(props) {
|
|
|
531
525
|
}
|
|
532
526
|
);
|
|
533
527
|
}
|
|
534
|
-
|
|
528
|
+
var RemoveButton = memo(RemoveButtonFn);
|
|
529
|
+
function ClearButtonFn(props) {
|
|
535
530
|
const {
|
|
536
531
|
registry: { translateString }
|
|
537
532
|
} = props;
|
|
538
533
|
return /* @__PURE__ */ jsx14(IconButton, { title: translateString(TranslatableString3.ClearButton), ...props, icon: /* @__PURE__ */ jsx14(X, {}) });
|
|
539
534
|
}
|
|
535
|
+
var ClearButton = memo(ClearButtonFn);
|
|
540
536
|
|
|
541
537
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
542
538
|
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -548,14 +544,7 @@ function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
|
548
544
|
}
|
|
549
545
|
|
|
550
546
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
551
|
-
import {
|
|
552
|
-
buttonId as buttonId2,
|
|
553
|
-
canExpand,
|
|
554
|
-
descriptionId,
|
|
555
|
-
getTemplate as getTemplate4,
|
|
556
|
-
getUiOptions as getUiOptions4,
|
|
557
|
-
titleId
|
|
558
|
-
} from "@rjsf/utils";
|
|
547
|
+
import { buttonId as buttonId2, canExpand, descriptionId, getTemplate as getTemplate4, getUiOptions as getUiOptions4, titleId } from "@rjsf/utils";
|
|
559
548
|
import { Fragment, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
560
549
|
function ObjectFieldTemplate({
|
|
561
550
|
description,
|
|
@@ -608,7 +597,7 @@ function ObjectFieldTemplate({
|
|
|
608
597
|
),
|
|
609
598
|
/* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2", children: [
|
|
610
599
|
!showOptionalDataControlInTitle ? optionalDataControl : void 0,
|
|
611
|
-
properties.map((element
|
|
600
|
+
properties.map((element) => /* @__PURE__ */ jsx16("div", { className: `${element.hidden ? "hidden" : ""} flex`, children: /* @__PURE__ */ jsx16("div", { className: "w-full", children: element.content }) }, element.name)),
|
|
612
601
|
canExpand(schema, uiSchema, formData) ? /* @__PURE__ */ jsx16("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ jsx16(
|
|
613
602
|
AddButton2,
|
|
614
603
|
{
|
|
@@ -631,7 +620,7 @@ function OptionalDataControlsTemplate(props) {
|
|
|
631
620
|
const { id, registry, label, onAddClick, onRemoveClick } = props;
|
|
632
621
|
if (onAddClick) {
|
|
633
622
|
return /* @__PURE__ */ jsx17(
|
|
634
|
-
|
|
623
|
+
IconButton_default,
|
|
635
624
|
{
|
|
636
625
|
id,
|
|
637
626
|
registry,
|
|
@@ -642,7 +631,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
642
631
|
size: "xs"
|
|
643
632
|
}
|
|
644
633
|
);
|
|
645
|
-
}
|
|
634
|
+
}
|
|
635
|
+
if (onRemoveClick) {
|
|
646
636
|
return /* @__PURE__ */ jsx17(
|
|
647
637
|
RemoveButton,
|
|
648
638
|
{
|
|
@@ -719,11 +709,7 @@ function TitleField({
|
|
|
719
709
|
}
|
|
720
710
|
|
|
721
711
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
722
|
-
import {
|
|
723
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
724
|
-
buttonId as buttonId3,
|
|
725
|
-
TranslatableString as TranslatableString4
|
|
726
|
-
} from "@rjsf/utils";
|
|
712
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId as buttonId3, TranslatableString as TranslatableString4 } from "@rjsf/utils";
|
|
727
713
|
import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
728
714
|
function WrapIfAdditionalTemplate({
|
|
729
715
|
classNames,
|
|
@@ -893,11 +879,11 @@ function CheckboxesWidget({
|
|
|
893
879
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
894
880
|
const optionValueFormat = getOptionValueFormat(options);
|
|
895
881
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
896
|
-
const
|
|
897
|
-
const
|
|
882
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
883
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
898
884
|
return /* @__PURE__ */ jsx24("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) => {
|
|
899
885
|
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
900
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
886
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
901
887
|
const indexOptionId = optionId(id, index);
|
|
902
888
|
return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
903
889
|
/* @__PURE__ */ jsx24(
|
|
@@ -917,8 +903,8 @@ function CheckboxesWidget({
|
|
|
917
903
|
className,
|
|
918
904
|
checked,
|
|
919
905
|
autoFocus: autofocus && index === 0,
|
|
920
|
-
onBlur:
|
|
921
|
-
onFocus:
|
|
906
|
+
onBlur: handleBlur,
|
|
907
|
+
onFocus: handleFocus,
|
|
922
908
|
"aria-describedby": ariaDescribedByIds2(id)
|
|
923
909
|
}
|
|
924
910
|
),
|
|
@@ -928,13 +914,7 @@ function CheckboxesWidget({
|
|
|
928
914
|
}
|
|
929
915
|
|
|
930
916
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
931
|
-
import {
|
|
932
|
-
ariaDescribedByIds as ariaDescribedByIds3,
|
|
933
|
-
descriptionId as descriptionId2,
|
|
934
|
-
getTemplate as getTemplate5,
|
|
935
|
-
labelValue,
|
|
936
|
-
schemaRequiresTrueValue
|
|
937
|
-
} from "@rjsf/utils";
|
|
917
|
+
import { ariaDescribedByIds as ariaDescribedByIds3, descriptionId as descriptionId2, getTemplate as getTemplate5, labelValue, schemaRequiresTrueValue } from "@rjsf/utils";
|
|
938
918
|
import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
939
919
|
function CheckboxWidget(props) {
|
|
940
920
|
const {
|
|
@@ -961,9 +941,9 @@ function CheckboxWidget(props) {
|
|
|
961
941
|
registry,
|
|
962
942
|
options
|
|
963
943
|
);
|
|
964
|
-
const
|
|
965
|
-
const
|
|
966
|
-
const
|
|
944
|
+
const handleChange = (checked) => onChange(checked);
|
|
945
|
+
const handleBlur = () => onBlur(id, value);
|
|
946
|
+
const handleFocus = () => onFocus(id, value);
|
|
967
947
|
const description = options.description || schema.description;
|
|
968
948
|
return /* @__PURE__ */ jsxs12(
|
|
969
949
|
"div",
|
|
@@ -991,9 +971,9 @@ function CheckboxWidget(props) {
|
|
|
991
971
|
required,
|
|
992
972
|
disabled: disabled || readonly,
|
|
993
973
|
autoFocus: autofocus,
|
|
994
|
-
onCheckedChange:
|
|
995
|
-
onBlur:
|
|
996
|
-
onFocus:
|
|
974
|
+
onCheckedChange: handleChange,
|
|
975
|
+
onBlur: handleBlur,
|
|
976
|
+
onFocus: handleFocus,
|
|
997
977
|
className
|
|
998
978
|
}
|
|
999
979
|
),
|
|
@@ -1052,9 +1032,9 @@ function RadioWidget({
|
|
|
1052
1032
|
}) {
|
|
1053
1033
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1054
1034
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1057
|
-
const
|
|
1035
|
+
const handleChange = (enumValue) => onChange(enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1036
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1037
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder2(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1058
1038
|
const inline = Boolean(options && options.inline);
|
|
1059
1039
|
return /* @__PURE__ */ jsx27("div", { className: "mb-0", children: /* @__PURE__ */ jsx27(
|
|
1060
1040
|
RadioGroup,
|
|
@@ -1063,15 +1043,15 @@ function RadioWidget({
|
|
|
1063
1043
|
required,
|
|
1064
1044
|
disabled: disabled || readonly,
|
|
1065
1045
|
onValueChange: (e) => {
|
|
1066
|
-
|
|
1046
|
+
handleChange(e);
|
|
1067
1047
|
},
|
|
1068
|
-
onBlur:
|
|
1069
|
-
onFocus:
|
|
1048
|
+
onBlur: handleBlur,
|
|
1049
|
+
onFocus: handleFocus,
|
|
1070
1050
|
"aria-describedby": ariaDescribedByIds4(id),
|
|
1071
1051
|
orientation: inline ? "horizontal" : "vertical",
|
|
1072
1052
|
className: cn("flex flex-wrap", { "flex-col": !inline }, className),
|
|
1073
1053
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1074
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1054
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1075
1055
|
const checked = enumOptionsIsSelected2(option.value, value);
|
|
1076
1056
|
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
1077
1057
|
/* @__PURE__ */ jsx27(
|
|
@@ -1099,10 +1079,15 @@ import { useMemo } from "react";
|
|
|
1099
1079
|
import { Range, Root as Root5, Thumb, Track } from "@radix-ui/react-slider";
|
|
1100
1080
|
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1101
1081
|
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
1102
|
-
const
|
|
1103
|
-
(
|
|
1104
|
-
|
|
1105
|
-
|
|
1082
|
+
const enumValues = useMemo(() => {
|
|
1083
|
+
if (Array.isArray(value)) {
|
|
1084
|
+
return value;
|
|
1085
|
+
}
|
|
1086
|
+
if (Array.isArray(defaultValue)) {
|
|
1087
|
+
return defaultValue;
|
|
1088
|
+
}
|
|
1089
|
+
return [min, max];
|
|
1090
|
+
}, [value, defaultValue, min, max]);
|
|
1106
1091
|
return /* @__PURE__ */ jsxs14(
|
|
1107
1092
|
Root5,
|
|
1108
1093
|
{
|
|
@@ -1133,7 +1118,7 @@ function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }
|
|
|
1133
1118
|
)
|
|
1134
1119
|
}
|
|
1135
1120
|
),
|
|
1136
|
-
Array.from({ length:
|
|
1121
|
+
Array.from({ length: enumValues.length }, (_, index) => /* @__PURE__ */ jsx28(
|
|
1137
1122
|
Thumb,
|
|
1138
1123
|
{
|
|
1139
1124
|
"data-slot": "slider-thumb",
|
|
@@ -1173,7 +1158,7 @@ function RangeWidget({
|
|
|
1173
1158
|
label,
|
|
1174
1159
|
id
|
|
1175
1160
|
}) {
|
|
1176
|
-
const
|
|
1161
|
+
const handleChange = (newValue) => onChange(newValue[0]);
|
|
1177
1162
|
const sliderProps = { value, label, id, ...rangeSpec(schema) };
|
|
1178
1163
|
const uiProps = { id, ..._pick(options.props || {}, allowedProps) };
|
|
1179
1164
|
return /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
@@ -1185,7 +1170,7 @@ function RangeWidget({
|
|
|
1185
1170
|
max: sliderProps.max,
|
|
1186
1171
|
step: sliderProps.step,
|
|
1187
1172
|
value: [value],
|
|
1188
|
-
onValueChange:
|
|
1173
|
+
onValueChange: handleChange,
|
|
1189
1174
|
...uiProps,
|
|
1190
1175
|
"aria-describedby": ariaDescribedByIds5(id)
|
|
1191
1176
|
}
|
|
@@ -1204,12 +1189,7 @@ import {
|
|
|
1204
1189
|
} from "@rjsf/utils";
|
|
1205
1190
|
|
|
1206
1191
|
// src/components/ui/fancy-multi-select.tsx
|
|
1207
|
-
import {
|
|
1208
|
-
useCallback as useCallback2,
|
|
1209
|
-
useMemo as useMemo2,
|
|
1210
|
-
useRef,
|
|
1211
|
-
useState
|
|
1212
|
-
} from "react";
|
|
1192
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useRef, useState } from "react";
|
|
1213
1193
|
import { Command as CommandPrimitive2 } from "cmdk";
|
|
1214
1194
|
import isEqual from "lodash/isEqual";
|
|
1215
1195
|
import { X as X2 } from "lucide-react";
|
|
@@ -1257,20 +1237,18 @@ import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
|
1257
1237
|
// src/components/ui/command.tsx
|
|
1258
1238
|
import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1259
1239
|
var Command = forwardRef(
|
|
1260
|
-
({ className, ...props }, ref) =>
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
);
|
|
1273
|
-
}
|
|
1240
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
1241
|
+
CommandPrimitive,
|
|
1242
|
+
{
|
|
1243
|
+
ref,
|
|
1244
|
+
"data-slot": "command",
|
|
1245
|
+
className: cn(
|
|
1246
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
1247
|
+
className
|
|
1248
|
+
),
|
|
1249
|
+
...props
|
|
1250
|
+
}
|
|
1251
|
+
)
|
|
1274
1252
|
);
|
|
1275
1253
|
var CommandInput = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs17("div", { className: "flex items-center border-b px-3", ...{ "cmdk-input-wrapper": "" }, children: [
|
|
1276
1254
|
/* @__PURE__ */ jsx32(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
@@ -1382,7 +1360,7 @@ function FancyMultiSelect({
|
|
|
1382
1360
|
}
|
|
1383
1361
|
setInputValue("");
|
|
1384
1362
|
const newSelected = multiple ? [...selectedItems, item] : [item];
|
|
1385
|
-
onValueChange?.(newSelected.map((
|
|
1363
|
+
onValueChange?.(newSelected.map((selectedItem) => selectedItem.index));
|
|
1386
1364
|
},
|
|
1387
1365
|
[multiple, selectedItems, onValueChange, disabled]
|
|
1388
1366
|
);
|
|
@@ -1532,7 +1510,10 @@ function FancySelect({
|
|
|
1532
1510
|
/* @__PURE__ */ jsxs19(
|
|
1533
1511
|
"div",
|
|
1534
1512
|
{
|
|
1513
|
+
role: "button",
|
|
1514
|
+
tabIndex: disabled ? -1 : 0,
|
|
1535
1515
|
onClick: () => !disabled && setOpen(!open),
|
|
1516
|
+
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && !disabled && setOpen(!open),
|
|
1536
1517
|
className: cn(
|
|
1537
1518
|
"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",
|
|
1538
1519
|
!selectedItem && required && "border-red-500",
|
|
@@ -1603,17 +1584,17 @@ function SelectWidget({
|
|
|
1603
1584
|
}) {
|
|
1604
1585
|
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
1605
1586
|
const optionValueFormat = getOptionValueFormat3(options);
|
|
1606
|
-
const
|
|
1587
|
+
const handleFancyFocus = () => {
|
|
1607
1588
|
onFocus(id, enumOptionValueDecoder3(value, enumOptions, optionValueFormat, optEmptyValue));
|
|
1608
1589
|
};
|
|
1609
|
-
const
|
|
1590
|
+
const handleFancyBlur = () => {
|
|
1610
1591
|
onBlur(id, enumOptionValueDecoder3(value, enumOptions, optionValueFormat, optEmptyValue));
|
|
1611
1592
|
};
|
|
1612
|
-
const items = enumOptions?.map(({ value:
|
|
1613
|
-
value: multiple ?
|
|
1614
|
-
label,
|
|
1593
|
+
const items = enumOptions?.map(({ value: enumValue, label: enumLabel }, index) => ({
|
|
1594
|
+
value: multiple ? enumValue : enumOptionValueEncoder2(enumValue, index, optionValueFormat),
|
|
1595
|
+
label: enumLabel,
|
|
1615
1596
|
index,
|
|
1616
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(
|
|
1597
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1617
1598
|
}));
|
|
1618
1599
|
const cnClassName = cn({ "border-destructive": rawErrors.length > 0 }, className);
|
|
1619
1600
|
return /* @__PURE__ */ jsx35("div", { className: "p-0.5", children: !multiple ? /* @__PURE__ */ jsx35(
|
|
@@ -1629,8 +1610,8 @@ function SelectWidget({
|
|
|
1629
1610
|
required,
|
|
1630
1611
|
placeholder,
|
|
1631
1612
|
className: cnClassName,
|
|
1632
|
-
onFocus:
|
|
1633
|
-
onBlur:
|
|
1613
|
+
onFocus: handleFancyFocus,
|
|
1614
|
+
onBlur: handleFancyBlur,
|
|
1634
1615
|
ariaDescribedby: ariaDescribedByIds6(id)
|
|
1635
1616
|
}
|
|
1636
1617
|
) : /* @__PURE__ */ jsx35(
|
|
@@ -1646,8 +1627,8 @@ function SelectWidget({
|
|
|
1646
1627
|
onValueChange: (values) => {
|
|
1647
1628
|
onChange(enumOptionValueDecoder3(values.map(String), enumOptions, optionValueFormat, optEmptyValue));
|
|
1648
1629
|
},
|
|
1649
|
-
onFocus:
|
|
1650
|
-
onBlur:
|
|
1630
|
+
onFocus: handleFancyFocus,
|
|
1631
|
+
onBlur: handleFancyBlur
|
|
1651
1632
|
}
|
|
1652
1633
|
) });
|
|
1653
1634
|
}
|
|
@@ -1688,9 +1669,9 @@ function TextareaWidget({
|
|
|
1688
1669
|
options,
|
|
1689
1670
|
className
|
|
1690
1671
|
}) {
|
|
1691
|
-
const
|
|
1692
|
-
const
|
|
1693
|
-
const
|
|
1672
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1673
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1674
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1694
1675
|
return /* @__PURE__ */ jsx37("div", { className: "flex p-0.5", children: /* @__PURE__ */ jsx37(
|
|
1695
1676
|
Textarea,
|
|
1696
1677
|
{
|
|
@@ -1703,9 +1684,9 @@ function TextareaWidget({
|
|
|
1703
1684
|
required,
|
|
1704
1685
|
autoFocus: autofocus,
|
|
1705
1686
|
rows: options.rows || 5,
|
|
1706
|
-
onChange:
|
|
1707
|
-
onBlur:
|
|
1708
|
-
onFocus:
|
|
1687
|
+
onChange: handleChange,
|
|
1688
|
+
onBlur: handleBlur,
|
|
1689
|
+
onFocus: handleFocus,
|
|
1709
1690
|
"aria-describedby": ariaDescribedByIds7(id),
|
|
1710
1691
|
className
|
|
1711
1692
|
}
|