@rjsf/shadcn 6.0.0-beta.14 → 6.0.0-beta.15
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/README.md +6 -2
- package/dist/index.js +115 -93
- package/dist/index.js.map +2 -2
- package/dist/rjsf-shadcn.esm.js +36 -14
- package/dist/rjsf-shadcn.esm.js.map +2 -2
- package/dist/rjsf-shadcn.umd.js +36 -14
- package/lib/AddButton/AddButton.d.ts +4 -1
- package/lib/AddButton/AddButton.js +6 -2
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +2 -2
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +2 -2
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +2 -2
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +2 -2
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +3 -2
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.js +2 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +2 -2
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/AddButton/AddButton.tsx +6 -1
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +2 -1
- package/src/CheckboxWidget/CheckboxWidget.tsx +2 -0
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +14 -1
- package/src/RadioWidget/RadioWidget.tsx +2 -1
- package/src/SelectWidget/SelectWidget.tsx +5 -2
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/TextareaWidget/TextareaWidget.tsx +2 -0
package/README.md
CHANGED
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Request Feature</a>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
|
+
|
|
24
|
+
<p align="center">
|
|
25
|
+
<img src="https://github.com/tuanphung2308/rjsf-shadcn-css/blob/main/shadcn-demo.png?raw=true" alt="Logo" width="720" height="240">
|
|
26
|
+
</p>
|
|
27
|
+
|
|
23
28
|
<!-- TABLE OF CONTENTS -->
|
|
24
29
|
|
|
25
30
|
## Table of Contents
|
|
@@ -134,8 +139,7 @@ Supported colors are:
|
|
|
134
139
|
#### Coloring
|
|
135
140
|
|
|
136
141
|
- Generate a theme from [official shadCN site](https://ui.shadcn.com/themes)
|
|
137
|
-
or [
|
|
138
|
-
or [Railly](https://customizer.railly.dev/)
|
|
142
|
+
or [tweakcn](https://tweakcn.com/editor/theme)
|
|
139
143
|
- Navigate to shadcn/css, create a new file called [your-theme].css
|
|
140
144
|
- Replace the base layer code with your new color
|
|
141
145
|
- Follow the next section to build your CSS file
|
package/dist/index.js
CHANGED
|
@@ -103,10 +103,11 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
103
103
|
function AddButton({
|
|
104
104
|
uiSchema,
|
|
105
105
|
registry,
|
|
106
|
+
className,
|
|
106
107
|
...props
|
|
107
108
|
}) {
|
|
108
109
|
const { translateString } = registry;
|
|
109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "p-0 m-0", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { ...props, className: "w-fit gap-2", variant: "outline", type: "button", children: [
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "p-0 m-0", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { ...props, className: cn("w-fit gap-2", className), variant: "outline", type: "button", children: [
|
|
110
111
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.PlusCircle, { size: 16 }),
|
|
111
112
|
" ",
|
|
112
113
|
translateString(import_utils2.TranslatableString.AddItemButton)
|
|
@@ -114,12 +115,12 @@ function AddButton({
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
117
|
-
var
|
|
118
|
+
var import_utils4 = require("@rjsf/utils");
|
|
118
119
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
119
120
|
function ArrayFieldItemTemplate(props) {
|
|
120
121
|
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
121
|
-
const uiOptions = (0,
|
|
122
|
-
const ArrayFieldItemButtonsTemplate = (0,
|
|
122
|
+
const uiOptions = (0, import_utils4.getUiOptions)(uiSchema);
|
|
123
|
+
const ArrayFieldItemButtonsTemplate = (0, import_utils4.getTemplate)(
|
|
123
124
|
"ArrayFieldItemButtonsTemplate",
|
|
124
125
|
registry,
|
|
125
126
|
uiOptions
|
|
@@ -131,22 +132,22 @@ function ArrayFieldItemTemplate(props) {
|
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
134
|
-
var
|
|
135
|
+
var import_utils5 = require("@rjsf/utils");
|
|
135
136
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
136
137
|
function ArrayFieldTemplate(props) {
|
|
137
138
|
const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = props;
|
|
138
|
-
const uiOptions = (0,
|
|
139
|
-
const ArrayFieldDescriptionTemplate = (0,
|
|
139
|
+
const uiOptions = (0, import_utils5.getUiOptions)(uiSchema);
|
|
140
|
+
const ArrayFieldDescriptionTemplate = (0, import_utils5.getTemplate)(
|
|
140
141
|
"ArrayFieldDescriptionTemplate",
|
|
141
142
|
registry,
|
|
142
143
|
uiOptions
|
|
143
144
|
);
|
|
144
|
-
const ArrayFieldItemTemplate2 = (0,
|
|
145
|
+
const ArrayFieldItemTemplate2 = (0, import_utils5.getTemplate)(
|
|
145
146
|
"ArrayFieldItemTemplate",
|
|
146
147
|
registry,
|
|
147
148
|
uiOptions
|
|
148
149
|
);
|
|
149
|
-
const ArrayFieldTitleTemplate = (0,
|
|
150
|
+
const ArrayFieldTitleTemplate = (0, import_utils5.getTemplate)(
|
|
150
151
|
"ArrayFieldTitleTemplate",
|
|
151
152
|
registry,
|
|
152
153
|
uiOptions
|
|
@@ -181,7 +182,7 @@ function ArrayFieldTemplate(props) {
|
|
|
181
182
|
canAdd && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-2 flex", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
182
183
|
AddButton2,
|
|
183
184
|
{
|
|
184
|
-
id: (0,
|
|
185
|
+
id: (0, import_utils5.buttonId)(idSchema, "add"),
|
|
185
186
|
className: "rjsf-array-item-add",
|
|
186
187
|
onClick: onAddClick,
|
|
187
188
|
disabled: disabled || readonly,
|
|
@@ -194,7 +195,7 @@ function ArrayFieldTemplate(props) {
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
197
|
-
var
|
|
198
|
+
var import_utils7 = require("@rjsf/utils");
|
|
198
199
|
|
|
199
200
|
// src/components/ui/input.tsx
|
|
200
201
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -234,11 +235,12 @@ function BaseInputTemplate({
|
|
|
234
235
|
schema,
|
|
235
236
|
rawErrors = [],
|
|
236
237
|
children,
|
|
237
|
-
extraProps
|
|
238
|
+
extraProps,
|
|
239
|
+
className
|
|
238
240
|
}) {
|
|
239
241
|
const inputProps = {
|
|
240
242
|
...extraProps,
|
|
241
|
-
...(0,
|
|
243
|
+
...(0, import_utils7.getInputProps)(schema, type, options)
|
|
242
244
|
};
|
|
243
245
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
244
246
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
@@ -255,18 +257,18 @@ function BaseInputTemplate({
|
|
|
255
257
|
required,
|
|
256
258
|
disabled,
|
|
257
259
|
readOnly: readonly,
|
|
258
|
-
className: cn({ "border-destructive focus-visible:ring-0": rawErrors.length > 0 }),
|
|
259
|
-
list: schema.examples ? (0,
|
|
260
|
+
className: cn({ "border-destructive focus-visible:ring-0": rawErrors.length > 0 }, className),
|
|
261
|
+
list: schema.examples ? (0, import_utils7.examplesId)(id) : void 0,
|
|
260
262
|
...inputProps,
|
|
261
263
|
value: value || value === 0 ? value : "",
|
|
262
264
|
onChange: onChangeOverride || _onChange,
|
|
263
265
|
onBlur: _onBlur,
|
|
264
266
|
onFocus: _onFocus,
|
|
265
|
-
"aria-describedby": (0,
|
|
267
|
+
"aria-describedby": (0, import_utils7.ariaDescribedByIds)(id, !!schema.examples)
|
|
266
268
|
}
|
|
267
269
|
),
|
|
268
270
|
children,
|
|
269
|
-
Array.isArray(schema.examples) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("datalist", { id: (0,
|
|
271
|
+
Array.isArray(schema.examples) ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("datalist", { id: (0, import_utils7.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
|
|
270
272
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: example }, example);
|
|
271
273
|
}) }) : null
|
|
272
274
|
] });
|
|
@@ -283,7 +285,7 @@ function DescriptionField({ id, description, registry, uiSchema }) {
|
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
// src/ErrorList/ErrorList.tsx
|
|
286
|
-
var
|
|
288
|
+
var import_utils10 = require("@rjsf/utils");
|
|
287
289
|
var import_lucide_react2 = require("lucide-react");
|
|
288
290
|
|
|
289
291
|
// src/components/ui/alert.tsx
|
|
@@ -339,7 +341,7 @@ function ErrorList({
|
|
|
339
341
|
const { translateString } = registry;
|
|
340
342
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Alert, { variant: "destructive", className: "mb-2", children: [
|
|
341
343
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react2.AlertCircle, { className: "h-4 w-4" }),
|
|
342
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AlertTitle, { children: translateString(
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AlertTitle, { children: translateString(import_utils10.TranslatableString.ErrorsLabel) }),
|
|
343
345
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AlertDescription, { className: "flex flex-col gap-1", children: errors.map((error, i) => {
|
|
344
346
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
345
347
|
"\u2022 ",
|
|
@@ -350,33 +352,33 @@ function ErrorList({
|
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
353
|
-
var
|
|
355
|
+
var import_utils11 = require("@rjsf/utils");
|
|
354
356
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
355
357
|
function FieldErrorTemplate(props) {
|
|
356
358
|
const { errors = [], idSchema } = props;
|
|
357
359
|
if (errors.length === 0) {
|
|
358
360
|
return null;
|
|
359
361
|
}
|
|
360
|
-
const id = (0,
|
|
362
|
+
const id = (0, import_utils11.errorId)(idSchema);
|
|
361
363
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex flex-col gap-1", id, children: errors.map((error, i) => {
|
|
362
364
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs font-medium text-destructive mb-1", children: error }, i);
|
|
363
365
|
}) });
|
|
364
366
|
}
|
|
365
367
|
|
|
366
368
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
367
|
-
var
|
|
369
|
+
var import_utils12 = require("@rjsf/utils");
|
|
368
370
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
369
371
|
function FieldHelpTemplate(props) {
|
|
370
372
|
const { idSchema, help, hasErrors } = props;
|
|
371
373
|
if (!help) {
|
|
372
374
|
return null;
|
|
373
375
|
}
|
|
374
|
-
const id = (0,
|
|
376
|
+
const id = (0, import_utils12.helpId)(idSchema);
|
|
375
377
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: cn("text-xs font-medium text-muted-foreground", { " text-destructive": hasErrors }), id, children: help });
|
|
376
378
|
}
|
|
377
379
|
|
|
378
380
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
379
|
-
var
|
|
381
|
+
var import_utils14 = require("@rjsf/utils");
|
|
380
382
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
381
383
|
function FieldTemplate({
|
|
382
384
|
id,
|
|
@@ -400,8 +402,8 @@ function FieldTemplate({
|
|
|
400
402
|
uiSchema,
|
|
401
403
|
registry
|
|
402
404
|
}) {
|
|
403
|
-
const uiOptions = (0,
|
|
404
|
-
const WrapIfAdditionalTemplate2 = (0,
|
|
405
|
+
const uiOptions = (0, import_utils14.getUiOptions)(uiSchema);
|
|
406
|
+
const WrapIfAdditionalTemplate2 = (0, import_utils14.getTemplate)(
|
|
405
407
|
"WrapIfAdditionalTemplate",
|
|
406
408
|
registry,
|
|
407
409
|
uiOptions
|
|
@@ -462,7 +464,7 @@ function GridTemplate(props) {
|
|
|
462
464
|
}
|
|
463
465
|
|
|
464
466
|
// src/IconButton/IconButton.tsx
|
|
465
|
-
var
|
|
467
|
+
var import_utils17 = require("@rjsf/utils");
|
|
466
468
|
var import_lucide_react3 = require("lucide-react");
|
|
467
469
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
468
470
|
function IconButton(props) {
|
|
@@ -473,7 +475,7 @@ function CopyButton(props) {
|
|
|
473
475
|
const {
|
|
474
476
|
registry: { translateString }
|
|
475
477
|
} = props;
|
|
476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconButton, { title: translateString(
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconButton, { title: translateString(import_utils17.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Copy, { className: "h-4 w-4" }) });
|
|
477
479
|
}
|
|
478
480
|
function MoveDownButton(props) {
|
|
479
481
|
const {
|
|
@@ -482,7 +484,7 @@ function MoveDownButton(props) {
|
|
|
482
484
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
483
485
|
IconButton,
|
|
484
486
|
{
|
|
485
|
-
title: translateString(
|
|
487
|
+
title: translateString(import_utils17.TranslatableString.MoveDownButton),
|
|
486
488
|
...props,
|
|
487
489
|
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.ChevronDown, { className: "h-4 w-4" })
|
|
488
490
|
}
|
|
@@ -495,7 +497,7 @@ function MoveUpButton(props) {
|
|
|
495
497
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
496
498
|
IconButton,
|
|
497
499
|
{
|
|
498
|
-
title: translateString(
|
|
500
|
+
title: translateString(import_utils17.TranslatableString.MoveUpButton),
|
|
499
501
|
...props,
|
|
500
502
|
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.ChevronUp, { className: "h-4 w-4" })
|
|
501
503
|
}
|
|
@@ -508,7 +510,7 @@ function RemoveButton(props) {
|
|
|
508
510
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
509
511
|
IconButton,
|
|
510
512
|
{
|
|
511
|
-
title: translateString(
|
|
513
|
+
title: translateString(import_utils17.TranslatableString.RemoveButton),
|
|
512
514
|
...props,
|
|
513
515
|
className: "border-destructive",
|
|
514
516
|
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Trash2, { className: "h-4 w-4 stroke-destructive" })
|
|
@@ -526,7 +528,7 @@ function MultiSchemaFieldTemplate({ selector, optionSchemaField }) {
|
|
|
526
528
|
}
|
|
527
529
|
|
|
528
530
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
529
|
-
var
|
|
531
|
+
var import_utils19 = require("@rjsf/utils");
|
|
530
532
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
531
533
|
function ObjectFieldTemplate({
|
|
532
534
|
description,
|
|
@@ -542,9 +544,9 @@ function ObjectFieldTemplate({
|
|
|
542
544
|
readonly,
|
|
543
545
|
registry
|
|
544
546
|
}) {
|
|
545
|
-
const uiOptions = (0,
|
|
546
|
-
const TitleFieldTemplate = (0,
|
|
547
|
-
const DescriptionFieldTemplate = (0,
|
|
547
|
+
const uiOptions = (0, import_utils19.getUiOptions)(uiSchema);
|
|
548
|
+
const TitleFieldTemplate = (0, import_utils19.getTemplate)("TitleFieldTemplate", registry, uiOptions);
|
|
549
|
+
const DescriptionFieldTemplate = (0, import_utils19.getTemplate)(
|
|
548
550
|
"DescriptionFieldTemplate",
|
|
549
551
|
registry,
|
|
550
552
|
uiOptions
|
|
@@ -556,7 +558,7 @@ function ObjectFieldTemplate({
|
|
|
556
558
|
title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
557
559
|
TitleFieldTemplate,
|
|
558
560
|
{
|
|
559
|
-
id: (0,
|
|
561
|
+
id: (0, import_utils19.titleId)(idSchema),
|
|
560
562
|
title,
|
|
561
563
|
required,
|
|
562
564
|
schema,
|
|
@@ -567,7 +569,7 @@ function ObjectFieldTemplate({
|
|
|
567
569
|
description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
568
570
|
DescriptionFieldTemplate,
|
|
569
571
|
{
|
|
570
|
-
id: (0,
|
|
572
|
+
id: (0, import_utils19.descriptionId)(idSchema),
|
|
571
573
|
description,
|
|
572
574
|
schema,
|
|
573
575
|
uiSchema,
|
|
@@ -579,10 +581,10 @@ function ObjectFieldTemplate({
|
|
|
579
581
|
" ",
|
|
580
582
|
element.content
|
|
581
583
|
] }) }, index)),
|
|
582
|
-
(0,
|
|
584
|
+
(0, import_utils19.canExpand)(schema, uiSchema, formData) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
583
585
|
AddButton2,
|
|
584
586
|
{
|
|
585
|
-
id: (0,
|
|
587
|
+
id: (0, import_utils19.buttonId)(idSchema, "add"),
|
|
586
588
|
onClick: onAddClick(schema),
|
|
587
589
|
disabled: disabled || readonly,
|
|
588
590
|
className: "rjsf-object-property-expand",
|
|
@@ -595,18 +597,18 @@ function ObjectFieldTemplate({
|
|
|
595
597
|
}
|
|
596
598
|
|
|
597
599
|
// src/SubmitButton/SubmitButton.tsx
|
|
598
|
-
var
|
|
600
|
+
var import_utils20 = require("@rjsf/utils");
|
|
599
601
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
600
602
|
function SubmitButton(props) {
|
|
601
|
-
const { submitText, norender, props: submitButtonProps } = (0,
|
|
603
|
+
const { submitText, norender, props: submitButtonProps } = (0, import_utils20.getSubmitButtonOptions)(props.uiSchema);
|
|
602
604
|
if (norender) {
|
|
603
605
|
return null;
|
|
604
606
|
}
|
|
605
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { type: "submit", ...submitButtonProps, className: "my-2", children: submitText }) });
|
|
607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button, { type: "submit", ...submitButtonProps, className: cn("my-2", submitButtonProps?.className), children: submitText }) });
|
|
606
608
|
}
|
|
607
609
|
|
|
608
610
|
// src/TitleField/TitleField.tsx
|
|
609
|
-
var
|
|
611
|
+
var import_utils23 = require("@rjsf/utils");
|
|
610
612
|
|
|
611
613
|
// src/components/ui/separator.tsx
|
|
612
614
|
var import_react_separator = require("@radix-ui/react-separator");
|
|
@@ -639,7 +641,7 @@ function TitleField({
|
|
|
639
641
|
title,
|
|
640
642
|
uiSchema
|
|
641
643
|
}) {
|
|
642
|
-
const uiOptions = (0,
|
|
644
|
+
const uiOptions = (0, import_utils23.getUiOptions)(uiSchema);
|
|
643
645
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { id, className: "my-1 flex flex-col gap-0.5", children: [
|
|
644
646
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h5", { children: uiOptions.title || title }),
|
|
645
647
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Separator, { dir: "horizontal", style: { height: "1px" }, className: "my-1" })
|
|
@@ -647,7 +649,7 @@ function TitleField({
|
|
|
647
649
|
}
|
|
648
650
|
|
|
649
651
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
650
|
-
var
|
|
652
|
+
var import_utils24 = require("@rjsf/utils");
|
|
651
653
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
652
654
|
function WrapIfAdditionalTemplate({
|
|
653
655
|
classNames,
|
|
@@ -666,8 +668,8 @@ function WrapIfAdditionalTemplate({
|
|
|
666
668
|
}) {
|
|
667
669
|
const { templates, translateString } = registry;
|
|
668
670
|
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
669
|
-
const keyLabel = translateString(
|
|
670
|
-
const additional =
|
|
671
|
+
const keyLabel = translateString(import_utils24.TranslatableString.KeyLabel, [label]);
|
|
672
|
+
const additional = import_utils24.ADDITIONAL_PROPERTY_FLAG in schema;
|
|
671
673
|
if (!additional) {
|
|
672
674
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: classNames, style, children });
|
|
673
675
|
}
|
|
@@ -697,7 +699,7 @@ function WrapIfAdditionalTemplate({
|
|
|
697
699
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
698
700
|
RemoveButton2,
|
|
699
701
|
{
|
|
700
|
-
id: (0,
|
|
702
|
+
id: (0, import_utils24.buttonId)(id, "remove"),
|
|
701
703
|
iconType: "block",
|
|
702
704
|
className: "rjsf-object-property-remove w-full",
|
|
703
705
|
disabled: disabled || readonly,
|
|
@@ -740,7 +742,7 @@ function generateTemplates() {
|
|
|
740
742
|
var Templates_default = generateTemplates();
|
|
741
743
|
|
|
742
744
|
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
743
|
-
var
|
|
745
|
+
var import_utils27 = require("@rjsf/utils");
|
|
744
746
|
|
|
745
747
|
// src/components/ui/checkbox.tsx
|
|
746
748
|
var import_react_checkbox = require("@radix-ui/react-checkbox");
|
|
@@ -802,10 +804,11 @@ function CheckboxWidget(props) {
|
|
|
802
804
|
onBlur,
|
|
803
805
|
onFocus,
|
|
804
806
|
registry,
|
|
805
|
-
uiSchema
|
|
807
|
+
uiSchema,
|
|
808
|
+
className
|
|
806
809
|
} = props;
|
|
807
|
-
const required = (0,
|
|
808
|
-
const DescriptionFieldTemplate = (0,
|
|
810
|
+
const required = (0, import_utils27.schemaRequiresTrueValue)(schema);
|
|
811
|
+
const DescriptionFieldTemplate = (0, import_utils27.getTemplate)(
|
|
809
812
|
"DescriptionFieldTemplate",
|
|
810
813
|
registry,
|
|
811
814
|
options
|
|
@@ -818,12 +821,12 @@ function CheckboxWidget(props) {
|
|
|
818
821
|
"div",
|
|
819
822
|
{
|
|
820
823
|
className: `relative ${disabled || readonly ? "cursor-not-allowed opacity-50" : ""}`,
|
|
821
|
-
"aria-describedby": (0,
|
|
824
|
+
"aria-describedby": (0, import_utils27.ariaDescribedByIds)(id),
|
|
822
825
|
children: [
|
|
823
826
|
!hideLabel && description && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
824
827
|
DescriptionFieldTemplate,
|
|
825
828
|
{
|
|
826
|
-
id: (0,
|
|
829
|
+
id: (0, import_utils27.descriptionId)(id),
|
|
827
830
|
description,
|
|
828
831
|
schema,
|
|
829
832
|
uiSchema,
|
|
@@ -842,10 +845,11 @@ function CheckboxWidget(props) {
|
|
|
842
845
|
autoFocus: autofocus,
|
|
843
846
|
onCheckedChange: _onChange,
|
|
844
847
|
onBlur: _onBlur,
|
|
845
|
-
onFocus: _onFocus
|
|
848
|
+
onFocus: _onFocus,
|
|
849
|
+
className
|
|
846
850
|
}
|
|
847
851
|
),
|
|
848
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label, { className: "leading-tight", htmlFor: id, children: (0,
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label, { className: "leading-tight", htmlFor: id, children: (0, import_utils27.labelValue)(label, hideLabel || !label) })
|
|
849
853
|
] })
|
|
850
854
|
]
|
|
851
855
|
}
|
|
@@ -853,17 +857,29 @@ function CheckboxWidget(props) {
|
|
|
853
857
|
}
|
|
854
858
|
|
|
855
859
|
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
856
|
-
var
|
|
860
|
+
var import_utils28 = require("@rjsf/utils");
|
|
857
861
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
858
|
-
function CheckboxesWidget({
|
|
862
|
+
function CheckboxesWidget({
|
|
863
|
+
id,
|
|
864
|
+
disabled,
|
|
865
|
+
options,
|
|
866
|
+
value,
|
|
867
|
+
autofocus,
|
|
868
|
+
readonly,
|
|
869
|
+
required,
|
|
870
|
+
onChange,
|
|
871
|
+
onBlur,
|
|
872
|
+
onFocus,
|
|
873
|
+
className
|
|
874
|
+
}) {
|
|
859
875
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
860
876
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
861
|
-
const _onBlur = ({ target }) => onBlur(id, (0,
|
|
862
|
-
const _onFocus = ({ target }) => onFocus(id, (0,
|
|
877
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
878
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils28.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
863
879
|
return /* @__PURE__ */ (0, import_jsx_runtime24.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) => {
|
|
864
|
-
const checked = (0,
|
|
880
|
+
const checked = (0, import_utils28.enumOptionsIsSelected)(option.value, checkboxesValues);
|
|
865
881
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
866
|
-
const indexOptionId = (0,
|
|
882
|
+
const indexOptionId = (0, import_utils28.optionId)(id, index);
|
|
867
883
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
868
884
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
869
885
|
Checkbox,
|
|
@@ -874,25 +890,26 @@ function CheckboxesWidget({ id, disabled, options, value, autofocus, readonly, r
|
|
|
874
890
|
disabled: disabled || itemDisabled || readonly,
|
|
875
891
|
onCheckedChange: (state) => {
|
|
876
892
|
if (state) {
|
|
877
|
-
onChange((0,
|
|
893
|
+
onChange((0, import_utils28.enumOptionsSelectValue)(index, checkboxesValues, enumOptions));
|
|
878
894
|
} else {
|
|
879
|
-
onChange((0,
|
|
895
|
+
onChange((0, import_utils28.enumOptionsDeselectValue)(index, checkboxesValues, enumOptions));
|
|
880
896
|
}
|
|
881
897
|
},
|
|
898
|
+
className,
|
|
882
899
|
checked,
|
|
883
900
|
autoFocus: autofocus && index === 0,
|
|
884
901
|
onBlur: _onBlur,
|
|
885
902
|
onFocus: _onFocus,
|
|
886
|
-
"aria-describedby": (0,
|
|
903
|
+
"aria-describedby": (0, import_utils28.ariaDescribedByIds)(id)
|
|
887
904
|
}
|
|
888
905
|
),
|
|
889
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { className: "leading-tight", htmlFor: (0,
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label, { className: "leading-tight", htmlFor: (0, import_utils28.optionId)(id, index), children: option.label })
|
|
890
907
|
] }, indexOptionId);
|
|
891
908
|
}) });
|
|
892
909
|
}
|
|
893
910
|
|
|
894
911
|
// src/RadioWidget/RadioWidget.tsx
|
|
895
|
-
var
|
|
912
|
+
var import_utils31 = require("@rjsf/utils");
|
|
896
913
|
|
|
897
914
|
// src/components/ui/radio-group.tsx
|
|
898
915
|
var import_react_radio_group = require("@radix-ui/react-radio-group");
|
|
@@ -927,12 +944,13 @@ function RadioWidget({
|
|
|
927
944
|
readonly,
|
|
928
945
|
onChange,
|
|
929
946
|
onBlur,
|
|
930
|
-
onFocus
|
|
947
|
+
onFocus,
|
|
948
|
+
className
|
|
931
949
|
}) {
|
|
932
950
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
933
|
-
const _onChange = (value2) => onChange((0,
|
|
934
|
-
const _onBlur = ({ target }) => onBlur(id, (0,
|
|
935
|
-
const _onFocus = ({ target }) => onFocus(id, (0,
|
|
951
|
+
const _onChange = (value2) => onChange((0, import_utils31.enumOptionsValueForIndex)(value2, enumOptions, emptyValue));
|
|
952
|
+
const _onBlur = ({ target }) => onBlur(id, (0, import_utils31.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
953
|
+
const _onFocus = ({ target }) => onFocus(id, (0, import_utils31.enumOptionsValueForIndex)(target && target.value, enumOptions, emptyValue));
|
|
936
954
|
const inline = Boolean(options && options.inline);
|
|
937
955
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mb-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
938
956
|
RadioGroup,
|
|
@@ -945,31 +963,31 @@ function RadioWidget({
|
|
|
945
963
|
},
|
|
946
964
|
onBlur: _onBlur,
|
|
947
965
|
onFocus: _onFocus,
|
|
948
|
-
"aria-describedby": (0,
|
|
966
|
+
"aria-describedby": (0, import_utils31.ariaDescribedByIds)(id),
|
|
949
967
|
orientation: inline ? "horizontal" : "vertical",
|
|
950
|
-
className: cn("flex flex-wrap", { "flex-col": !inline }),
|
|
968
|
+
className: cn("flex flex-wrap", { "flex-col": !inline }, className),
|
|
951
969
|
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
952
970
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
953
|
-
const checked = (0,
|
|
971
|
+
const checked = (0, import_utils31.enumOptionsIsSelected)(option.value, value);
|
|
954
972
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
955
973
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
956
974
|
RadioGroupItem,
|
|
957
975
|
{
|
|
958
976
|
checked,
|
|
959
977
|
value: index.toString(),
|
|
960
|
-
id: (0,
|
|
978
|
+
id: (0, import_utils31.optionId)(id, index),
|
|
961
979
|
disabled: itemDisabled
|
|
962
980
|
}
|
|
963
981
|
),
|
|
964
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { className: "leading-tight", htmlFor: (0,
|
|
965
|
-
] }, (0,
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Label, { className: "leading-tight", htmlFor: (0, import_utils31.optionId)(id, index), children: option.label })
|
|
983
|
+
] }, (0, import_utils31.optionId)(id, index));
|
|
966
984
|
})
|
|
967
985
|
}
|
|
968
986
|
) });
|
|
969
987
|
}
|
|
970
988
|
|
|
971
989
|
// src/RangeWidget/RangeWidget.tsx
|
|
972
|
-
var
|
|
990
|
+
var import_utils34 = require("@rjsf/utils");
|
|
973
991
|
var import_pick = __toESM(require("lodash/pick"), 1);
|
|
974
992
|
|
|
975
993
|
// src/components/ui/slider.tsx
|
|
@@ -1052,7 +1070,7 @@ function RangeWidget({
|
|
|
1052
1070
|
id
|
|
1053
1071
|
}) {
|
|
1054
1072
|
const _onChange = (value2) => onChange(value2[0]);
|
|
1055
|
-
const sliderProps = { value, label, id, ...(0,
|
|
1073
|
+
const sliderProps = { value, label, id, ...(0, import_utils34.rangeSpec)(schema) };
|
|
1056
1074
|
const uiProps = { id, ...(0, import_pick.default)(options.props || {}, allowedProps) };
|
|
1057
1075
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
1058
1076
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -1065,7 +1083,7 @@ function RangeWidget({
|
|
|
1065
1083
|
value: [value],
|
|
1066
1084
|
onValueChange: _onChange,
|
|
1067
1085
|
...uiProps,
|
|
1068
|
-
"aria-describedby": (0,
|
|
1086
|
+
"aria-describedby": (0, import_utils34.ariaDescribedByIds)(id)
|
|
1069
1087
|
}
|
|
1070
1088
|
),
|
|
1071
1089
|
value
|
|
@@ -1073,7 +1091,7 @@ function RangeWidget({
|
|
|
1073
1091
|
}
|
|
1074
1092
|
|
|
1075
1093
|
// src/SelectWidget/SelectWidget.tsx
|
|
1076
|
-
var
|
|
1094
|
+
var import_utils40 = require("@rjsf/utils");
|
|
1077
1095
|
|
|
1078
1096
|
// src/components/ui/fancy-multi-select.tsx
|
|
1079
1097
|
var import_cmdk2 = require("cmdk");
|
|
@@ -1463,14 +1481,15 @@ function SelectWidget({
|
|
|
1463
1481
|
onFocus,
|
|
1464
1482
|
defaultValue,
|
|
1465
1483
|
placeholder,
|
|
1466
|
-
rawErrors = []
|
|
1484
|
+
rawErrors = [],
|
|
1485
|
+
className
|
|
1467
1486
|
}) {
|
|
1468
1487
|
const { enumOptions, enumDisabled, emptyValue: optEmptyValue } = options;
|
|
1469
1488
|
const _onFancyFocus = () => {
|
|
1470
|
-
onFocus(id, (0,
|
|
1489
|
+
onFocus(id, (0, import_utils40.enumOptionsValueForIndex)(value, enumOptions, optEmptyValue));
|
|
1471
1490
|
};
|
|
1472
1491
|
const _onFancyBlur = () => {
|
|
1473
|
-
onBlur(id, (0,
|
|
1492
|
+
onBlur(id, (0, import_utils40.enumOptionsValueForIndex)(value, enumOptions, optEmptyValue));
|
|
1474
1493
|
};
|
|
1475
1494
|
const items = enumOptions?.map(({ value: value2, label }, index) => ({
|
|
1476
1495
|
value: multiple ? value2 : index.toString(),
|
|
@@ -1478,22 +1497,23 @@ function SelectWidget({
|
|
|
1478
1497
|
index,
|
|
1479
1498
|
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(value2)
|
|
1480
1499
|
}));
|
|
1500
|
+
const cnClassName = cn({ "border-destructive": rawErrors.length > 0 }, className);
|
|
1481
1501
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-0.5", children: !multiple ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1482
1502
|
FancySelect,
|
|
1483
1503
|
{
|
|
1484
1504
|
items,
|
|
1485
|
-
selected: (0,
|
|
1505
|
+
selected: (0, import_utils40.enumOptionsIndexForValue)(value ?? defaultValue, enumOptions, false),
|
|
1486
1506
|
onValueChange: (selectedValue) => {
|
|
1487
|
-
onChange((0,
|
|
1507
|
+
onChange((0, import_utils40.enumOptionsValueForIndex)(selectedValue, enumOptions, optEmptyValue));
|
|
1488
1508
|
},
|
|
1489
1509
|
autoFocus: autofocus,
|
|
1490
1510
|
disabled: disabled || readonly,
|
|
1491
1511
|
required,
|
|
1492
1512
|
placeholder,
|
|
1493
|
-
className:
|
|
1513
|
+
className: cnClassName,
|
|
1494
1514
|
onFocus: _onFancyFocus,
|
|
1495
1515
|
onBlur: _onFancyBlur,
|
|
1496
|
-
ariaDescribedby: (0,
|
|
1516
|
+
ariaDescribedby: (0, import_utils40.ariaDescribedByIds)(id)
|
|
1497
1517
|
}
|
|
1498
1518
|
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1499
1519
|
FancyMultiSelect,
|
|
@@ -1502,11 +1522,11 @@ function SelectWidget({
|
|
|
1502
1522
|
autoFocus: autofocus,
|
|
1503
1523
|
disabled: disabled || readonly,
|
|
1504
1524
|
multiple: true,
|
|
1505
|
-
className:
|
|
1525
|
+
className: cnClassName,
|
|
1506
1526
|
items,
|
|
1507
1527
|
selected: value,
|
|
1508
1528
|
onValueChange: (values) => {
|
|
1509
|
-
onChange((0,
|
|
1529
|
+
onChange((0, import_utils40.enumOptionsValueForIndex)(values, enumOptions, optEmptyValue));
|
|
1510
1530
|
},
|
|
1511
1531
|
onFocus: _onFancyFocus,
|
|
1512
1532
|
onBlur: _onFancyBlur
|
|
@@ -1515,7 +1535,7 @@ function SelectWidget({
|
|
|
1515
1535
|
}
|
|
1516
1536
|
|
|
1517
1537
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1518
|
-
var
|
|
1538
|
+
var import_utils43 = require("@rjsf/utils");
|
|
1519
1539
|
|
|
1520
1540
|
// src/components/ui/textarea.tsx
|
|
1521
1541
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -1546,7 +1566,8 @@ function TextareaWidget({
|
|
|
1546
1566
|
onBlur,
|
|
1547
1567
|
onFocus,
|
|
1548
1568
|
onChange,
|
|
1549
|
-
options
|
|
1569
|
+
options,
|
|
1570
|
+
className
|
|
1550
1571
|
}) {
|
|
1551
1572
|
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
1552
1573
|
const _onBlur = ({ target }) => onBlur(id, target && target.value);
|
|
@@ -1566,7 +1587,8 @@ function TextareaWidget({
|
|
|
1566
1587
|
onChange: _onChange,
|
|
1567
1588
|
onBlur: _onBlur,
|
|
1568
1589
|
onFocus: _onFocus,
|
|
1569
|
-
"aria-describedby": (0,
|
|
1590
|
+
"aria-describedby": (0, import_utils43.ariaDescribedByIds)(id),
|
|
1591
|
+
className
|
|
1570
1592
|
}
|
|
1571
1593
|
) });
|
|
1572
1594
|
}
|