@rjsf/chakra-ui 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/chakra-ui.esm.js +147 -189
- package/dist/chakra-ui.esm.js.map +3 -3
- package/dist/chakra-ui.umd.js +135 -133
- package/dist/index.cjs +237 -234
- package/dist/index.cjs.map +3 -3
- package/lib/AddButton/AddButton.d.ts +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/AltDateTimeWidget/AltDateTimeWidget.d.ts +1 -1
- package/lib/AltDateWidget/AltDateWidget.d.ts +1 -1
- package/lib/AltDateWidget/AltDateWidget.js +1 -1
- package/lib/AltDateWidget/AltDateWidget.js.map +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +1 -1
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +1 -1
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +5 -5
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/ChakraFrameProvider.js +1 -3
- package/lib/ChakraFrameProvider.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +4 -4
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js +4 -4
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.d.ts +1 -1
- package/lib/ErrorList/ErrorList.d.ts +1 -1
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +1 -3
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/FieldTemplate/FieldTemplate.d.ts +1 -1
- package/lib/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/Form/Form.d.ts +3 -3
- package/lib/Form/Form.js.map +1 -1
- package/lib/GridTemplate/GridTemplate.d.ts +1 -1
- package/lib/IconButton/ChakraIconButton.d.ts +2 -2
- package/lib/IconButton/ChakraIconButton.js.map +1 -1
- package/lib/IconButton/IconButton.d.ts +13 -7
- package/lib/IconButton/IconButton.js +11 -5
- package/lib/IconButton/IconButton.js.map +1 -1
- package/lib/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/NativeSelectWidget/NativeSelectWidget.d.ts +1 -1
- package/lib/NativeSelectWidget/NativeSelectWidget.js +13 -15
- package/lib/NativeSelectWidget/NativeSelectWidget.js.map +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +1 -1
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +2 -2
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js +1 -1
- package/lib/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/RadioWidget/RadioWidget.d.ts +1 -1
- package/lib/RadioWidget/RadioWidget.js +6 -6
- package/lib/RadioWidget/RadioWidget.js.map +1 -1
- package/lib/RangeWidget/RangeWidget.d.ts +1 -1
- package/lib/RangeWidget/RangeWidget.js +5 -5
- package/lib/RangeWidget/RangeWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.d.ts +1 -1
- package/lib/SelectWidget/SelectWidget.js +15 -17
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/SubmitButton/SubmitButton.d.ts +1 -1
- package/lib/SubmitButton/SubmitButton.js.map +1 -1
- package/lib/Templates/Templates.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.d.ts +1 -1
- package/lib/TextareaWidget/TextareaWidget.js +5 -5
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -1
- package/lib/Theme/Theme.d.ts +2 -2
- package/lib/TitleField/TitleField.d.ts +1 -1
- package/lib/UpDownWidget/UpDownWidget.d.ts +1 -1
- package/lib/UpDownWidget/UpDownWidget.js +5 -5
- package/lib/UpDownWidget/UpDownWidget.js.map +1 -1
- package/lib/Widgets/Widgets.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/components/ui/alert.d.ts +1 -1
- package/lib/components/ui/alert.js +1 -1
- package/lib/components/ui/alert.js.map +1 -1
- package/lib/components/ui/checkbox.d.ts +1 -1
- package/lib/components/ui/checkbox.js +1 -1
- package/lib/components/ui/checkbox.js.map +1 -1
- package/lib/components/ui/close-button.js +1 -1
- package/lib/components/ui/close-button.js.map +1 -1
- package/lib/components/ui/field.d.ts +1 -1
- package/lib/components/ui/field.js +1 -1
- package/lib/components/ui/field.js.map +1 -1
- package/lib/components/ui/number-input.js +1 -1
- package/lib/components/ui/number-input.js.map +1 -1
- package/lib/components/ui/radio.d.ts +1 -1
- package/lib/components/ui/radio.js +1 -1
- package/lib/components/ui/radio.js.map +1 -1
- package/lib/components/ui/select.d.ts +1 -1
- package/lib/components/ui/select.js +13 -17
- package/lib/components/ui/select.js.map +1 -1
- package/lib/components/ui/slider.d.ts +2 -2
- package/lib/components/ui/slider.js +19 -19
- package/lib/components/ui/slider.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js.map +1 -1
- package/package.json +6 -7
- package/src/AddButton/AddButton.tsx +2 -1
- package/src/AltDateTimeWidget/AltDateTimeWidget.tsx +1 -1
- package/src/AltDateWidget/AltDateWidget.tsx +2 -10
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +3 -9
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +2 -9
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +11 -18
- package/src/ChakraFrameProvider.tsx +7 -9
- package/src/CheckboxWidget/CheckboxWidget.tsx +10 -12
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +8 -11
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +3 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +8 -8
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +2 -1
- package/src/FieldTemplate/FieldTemplate.tsx +2 -8
- package/src/Form/Form.tsx +4 -3
- package/src/GridTemplate/GridTemplate.tsx +1 -1
- package/src/IconButton/ChakraIconButton.tsx +9 -3
- package/src/IconButton/IconButton.tsx +15 -7
- package/src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/NativeSelectWidget/NativeSelectWidget.tsx +20 -29
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +4 -18
- package/src/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +3 -2
- package/src/RadioWidget/RadioWidget.tsx +13 -16
- package/src/RangeWidget/RangeWidget.tsx +11 -18
- package/src/SelectWidget/SelectWidget.tsx +24 -27
- package/src/SubmitButton/SubmitButton.tsx +2 -1
- package/src/Templates/Templates.ts +1 -1
- package/src/TextareaWidget/TextareaWidget.tsx +10 -16
- package/src/Theme/Theme.tsx +2 -2
- package/src/TitleField/TitleField.tsx +1 -1
- package/src/UpDownWidget/UpDownWidget.tsx +10 -16
- package/src/Widgets/Widgets.ts +1 -1
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +2 -9
- package/src/components/ui/alert.tsx +3 -2
- package/src/components/ui/checkbox.tsx +3 -2
- package/src/components/ui/close-button.tsx +5 -7
- package/src/components/ui/field.tsx +3 -2
- package/src/components/ui/number-input.tsx +1 -1
- package/src/components/ui/radio.tsx +3 -2
- package/src/components/ui/select.tsx +31 -36
- package/src/components/ui/slider.tsx +37 -35
- package/src/utils.ts +3 -2
package/dist/chakra-ui.esm.js
CHANGED
|
@@ -19,10 +19,7 @@ function AddButton({
|
|
|
19
19
|
|
|
20
20
|
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
21
21
|
import { Box, ButtonGroup, HStack } from "@chakra-ui/react";
|
|
22
|
-
import {
|
|
23
|
-
getTemplate,
|
|
24
|
-
getUiOptions
|
|
25
|
-
} from "@rjsf/utils";
|
|
22
|
+
import { getTemplate, getUiOptions } from "@rjsf/utils";
|
|
26
23
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
27
24
|
function ArrayFieldItemTemplate(props) {
|
|
28
25
|
const { children, buttonsProps, hasToolbar, uiSchema, registry } = props;
|
|
@@ -40,11 +37,7 @@ function ArrayFieldItemTemplate(props) {
|
|
|
40
37
|
|
|
41
38
|
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
42
39
|
import { Box as Box2, Grid, GridItem } from "@chakra-ui/react";
|
|
43
|
-
import {
|
|
44
|
-
getTemplate as getTemplate2,
|
|
45
|
-
getUiOptions as getUiOptions2,
|
|
46
|
-
buttonId
|
|
47
|
-
} from "@rjsf/utils";
|
|
40
|
+
import { getTemplate as getTemplate2, getUiOptions as getUiOptions2, buttonId } from "@rjsf/utils";
|
|
48
41
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
49
42
|
function ArrayFieldTemplate(props) {
|
|
50
43
|
const {
|
|
@@ -123,18 +116,13 @@ function ArrayFieldTemplate(props) {
|
|
|
123
116
|
import { useCallback } from "react";
|
|
124
117
|
import { Input } from "@chakra-ui/react";
|
|
125
118
|
import { SchemaExamples } from "@rjsf/core";
|
|
126
|
-
import {
|
|
127
|
-
ariaDescribedByIds,
|
|
128
|
-
examplesId,
|
|
129
|
-
labelValue,
|
|
130
|
-
getInputProps
|
|
131
|
-
} from "@rjsf/utils";
|
|
119
|
+
import { ariaDescribedByIds, examplesId, labelValue, getInputProps } from "@rjsf/utils";
|
|
132
120
|
|
|
133
121
|
// src/components/ui/field.tsx
|
|
134
122
|
import { forwardRef } from "react";
|
|
135
123
|
import { Field as ChakraField } from "@chakra-ui/react";
|
|
136
124
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
137
|
-
var Field = forwardRef(
|
|
125
|
+
var Field = forwardRef((props, ref) => {
|
|
138
126
|
const { label, children, helperText, errorText, optionalText, ...rest } = props;
|
|
139
127
|
return /* @__PURE__ */ jsxs4(ChakraField.Root, { ref, ...rest, children: [
|
|
140
128
|
label && /* @__PURE__ */ jsxs4(ChakraField.Label, { children: [
|
|
@@ -188,9 +176,9 @@ function BaseInputTemplate(props) {
|
|
|
188
176
|
} = props;
|
|
189
177
|
const inputProps = getInputProps(schema, type, options);
|
|
190
178
|
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
const
|
|
179
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
180
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
181
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
194
182
|
const onClear = useCallback(
|
|
195
183
|
(e) => {
|
|
196
184
|
e.preventDefault();
|
|
@@ -217,9 +205,9 @@ function BaseInputTemplate(props) {
|
|
|
217
205
|
id,
|
|
218
206
|
name: htmlName || id,
|
|
219
207
|
value: value || value === 0 ? value : "",
|
|
220
|
-
onChange: onChangeOverride ||
|
|
221
|
-
onBlur:
|
|
222
|
-
onFocus:
|
|
208
|
+
onChange: onChangeOverride || handleChange,
|
|
209
|
+
onBlur: handleBlur,
|
|
210
|
+
onFocus: handleFocus,
|
|
223
211
|
autoFocus: autofocus,
|
|
224
212
|
placeholder,
|
|
225
213
|
...inputProps,
|
|
@@ -258,13 +246,11 @@ import { forwardRef as forwardRef2 } from "react";
|
|
|
258
246
|
import { IconButton as ChakraIconButton } from "@chakra-ui/react";
|
|
259
247
|
import { LuX } from "react-icons/lu";
|
|
260
248
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
261
|
-
var CloseButton = forwardRef2(
|
|
262
|
-
return /* @__PURE__ */ jsx7(ChakraIconButton, { variant: "ghost", "aria-label": "Close", ref, ...props, children: props.children ?? /* @__PURE__ */ jsx7(LuX, {}) });
|
|
263
|
-
});
|
|
249
|
+
var CloseButton = forwardRef2((props, ref) => /* @__PURE__ */ jsx7(ChakraIconButton, { variant: "ghost", "aria-label": "Close", ref, ...props, children: props.children ?? /* @__PURE__ */ jsx7(LuX, {}) }));
|
|
264
250
|
|
|
265
251
|
// src/components/ui/alert.tsx
|
|
266
252
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
267
|
-
var Alert = forwardRef3(
|
|
253
|
+
var Alert = forwardRef3((props, ref) => {
|
|
268
254
|
const { title, children, closable, onClose, startElement, endElement, ...rest } = props;
|
|
269
255
|
return /* @__PURE__ */ jsxs6(ChakraAlert.Root, { ref, ...rest, children: [
|
|
270
256
|
startElement || /* @__PURE__ */ jsx8(ChakraAlert.Indicator, {}),
|
|
@@ -284,7 +270,10 @@ function ErrorList({
|
|
|
284
270
|
registry
|
|
285
271
|
}) {
|
|
286
272
|
const { translateString } = registry;
|
|
287
|
-
return /* @__PURE__ */ jsx9(Alert, { status: "error", title: translateString(TranslatableString2.ErrorsLabel), mb: 3, children: /* @__PURE__ */ jsx9(ListRoot, { listStylePosition: "inside", children: errors.map((error, i) =>
|
|
273
|
+
return /* @__PURE__ */ jsx9(Alert, { status: "error", title: translateString(TranslatableString2.ErrorsLabel), mb: 3, children: /* @__PURE__ */ jsx9(ListRoot, { listStylePosition: "inside", children: errors.map((error, i) => (
|
|
274
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
275
|
+
/* @__PURE__ */ jsx9(ListItem, { children: error.stack }, i)
|
|
276
|
+
)) }) });
|
|
288
277
|
}
|
|
289
278
|
|
|
290
279
|
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
@@ -297,9 +286,10 @@ function FieldErrorTemplate(props) {
|
|
|
297
286
|
return null;
|
|
298
287
|
}
|
|
299
288
|
const id = errorId(fieldPathId);
|
|
300
|
-
return errors.map((error, i) =>
|
|
301
|
-
|
|
302
|
-
|
|
289
|
+
return errors.map((error, i) => (
|
|
290
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
291
|
+
/* @__PURE__ */ jsx10(Fieldset.ErrorText, { mt: 0, id, children: error }, i)
|
|
292
|
+
));
|
|
303
293
|
}
|
|
304
294
|
|
|
305
295
|
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
@@ -317,10 +307,7 @@ function FieldHelpTemplate(props) {
|
|
|
317
307
|
|
|
318
308
|
// src/FieldTemplate/FieldTemplate.tsx
|
|
319
309
|
import { Fieldset as Fieldset2 } from "@chakra-ui/react";
|
|
320
|
-
import {
|
|
321
|
-
getTemplate as getTemplate3,
|
|
322
|
-
getUiOptions as getUiOptions3
|
|
323
|
-
} from "@rjsf/utils";
|
|
310
|
+
import { getTemplate as getTemplate3, getUiOptions as getUiOptions3 } from "@rjsf/utils";
|
|
324
311
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
325
312
|
function FieldTemplate(props) {
|
|
326
313
|
const {
|
|
@@ -406,16 +393,18 @@ ChakraIconButton2.displayName = "ChakraIconButton";
|
|
|
406
393
|
var ChakraIconButton_default = memo(ChakraIconButton2);
|
|
407
394
|
|
|
408
395
|
// src/IconButton/IconButton.tsx
|
|
396
|
+
import { memo as memo2 } from "react";
|
|
409
397
|
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
410
398
|
import { ArrowUpIcon, ArrowDownIcon, CopyIcon, DeleteIcon, X } from "lucide-react";
|
|
411
399
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
412
|
-
function
|
|
400
|
+
function CopyButtonFn(props) {
|
|
413
401
|
const {
|
|
414
402
|
registry: { translateString }
|
|
415
403
|
} = props;
|
|
416
404
|
return /* @__PURE__ */ jsx15(ChakraIconButton_default, { title: translateString(TranslatableString3.CopyButton), ...props, icon: /* @__PURE__ */ jsx15(CopyIcon, {}) });
|
|
417
405
|
}
|
|
418
|
-
|
|
406
|
+
var CopyButton = memo2(CopyButtonFn);
|
|
407
|
+
function MoveDownButtonFn(props) {
|
|
419
408
|
const {
|
|
420
409
|
registry: { translateString }
|
|
421
410
|
} = props;
|
|
@@ -428,7 +417,8 @@ function MoveDownButton(props) {
|
|
|
428
417
|
}
|
|
429
418
|
);
|
|
430
419
|
}
|
|
431
|
-
|
|
420
|
+
var MoveDownButton = memo2(MoveDownButtonFn);
|
|
421
|
+
function MoveUpButtonFn(props) {
|
|
432
422
|
const {
|
|
433
423
|
registry: { translateString }
|
|
434
424
|
} = props;
|
|
@@ -441,7 +431,8 @@ function MoveUpButton(props) {
|
|
|
441
431
|
}
|
|
442
432
|
);
|
|
443
433
|
}
|
|
444
|
-
|
|
434
|
+
var MoveUpButton = memo2(MoveUpButtonFn);
|
|
435
|
+
function RemoveButtonFn(props) {
|
|
445
436
|
const {
|
|
446
437
|
registry: { translateString }
|
|
447
438
|
} = props;
|
|
@@ -454,12 +445,14 @@ function RemoveButton(props) {
|
|
|
454
445
|
}
|
|
455
446
|
);
|
|
456
447
|
}
|
|
457
|
-
|
|
448
|
+
var RemoveButton = memo2(RemoveButtonFn);
|
|
449
|
+
function ClearButtonFn(props) {
|
|
458
450
|
const {
|
|
459
451
|
registry: { translateString }
|
|
460
452
|
} = props;
|
|
461
453
|
return /* @__PURE__ */ jsx15(ChakraIconButton_default, { title: translateString(TranslatableString3.ClearButton), ...props, icon: /* @__PURE__ */ jsx15(X, {}) });
|
|
462
454
|
}
|
|
455
|
+
var ClearButton = memo2(ClearButtonFn);
|
|
463
456
|
|
|
464
457
|
// src/MultiSchemaFieldTemplate/MultiSchemaFieldTemplate.tsx
|
|
465
458
|
import { Box as Box3, Card } from "@chakra-ui/react";
|
|
@@ -474,14 +467,7 @@ function MultiSchemaFieldTemplate(props) {
|
|
|
474
467
|
|
|
475
468
|
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
476
469
|
import { Grid as Grid3, GridItem as GridItem3 } from "@chakra-ui/react";
|
|
477
|
-
import {
|
|
478
|
-
buttonId as buttonId2,
|
|
479
|
-
canExpand,
|
|
480
|
-
descriptionId,
|
|
481
|
-
getTemplate as getTemplate4,
|
|
482
|
-
getUiOptions as getUiOptions4,
|
|
483
|
-
titleId
|
|
484
|
-
} from "@rjsf/utils";
|
|
470
|
+
import { buttonId as buttonId2, canExpand, descriptionId, getTemplate as getTemplate4, getUiOptions as getUiOptions4, titleId } from "@rjsf/utils";
|
|
485
471
|
import { Fragment, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
486
472
|
function ObjectFieldTemplate(props) {
|
|
487
473
|
const {
|
|
@@ -536,7 +522,7 @@ function ObjectFieldTemplate(props) {
|
|
|
536
522
|
/* @__PURE__ */ jsxs9(Grid3, { gap: description ? 2 : 4, mb: 4, children: [
|
|
537
523
|
!showOptionalDataControlInTitle ? /* @__PURE__ */ jsx17(GridItem3, { children: optionalDataControl }) : void 0,
|
|
538
524
|
properties.map(
|
|
539
|
-
(element
|
|
525
|
+
(element) => element.hidden ? element.content : /* @__PURE__ */ jsx17(GridItem3, { children: element.content }, element.name)
|
|
540
526
|
),
|
|
541
527
|
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx17(GridItem3, { justifySelf: "flex-end", children: /* @__PURE__ */ jsx17(
|
|
542
528
|
AddButton2,
|
|
@@ -572,7 +558,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
572
558
|
variant: "subtle"
|
|
573
559
|
}
|
|
574
560
|
);
|
|
575
|
-
}
|
|
561
|
+
}
|
|
562
|
+
if (onRemoveClick) {
|
|
576
563
|
return /* @__PURE__ */ jsx18(
|
|
577
564
|
RemoveButton,
|
|
578
565
|
{
|
|
@@ -625,11 +612,7 @@ function TitleField({
|
|
|
625
612
|
|
|
626
613
|
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
627
614
|
import { Grid as Grid4, GridItem as GridItem4, Input as Input2 } from "@chakra-ui/react";
|
|
628
|
-
import {
|
|
629
|
-
ADDITIONAL_PROPERTY_FLAG,
|
|
630
|
-
buttonId as buttonId3,
|
|
631
|
-
TranslatableString as TranslatableString4
|
|
632
|
-
} from "@rjsf/utils";
|
|
615
|
+
import { ADDITIONAL_PROPERTY_FLAG, buttonId as buttonId3, TranslatableString as TranslatableString4 } from "@rjsf/utils";
|
|
633
616
|
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
634
617
|
function WrapIfAdditionalTemplate(props) {
|
|
635
618
|
const {
|
|
@@ -741,11 +724,7 @@ var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
|
741
724
|
|
|
742
725
|
// src/AltDateWidget/AltDateWidget.tsx
|
|
743
726
|
import { Box as Box6, Button as Button3, FieldsetRoot } from "@chakra-ui/react";
|
|
744
|
-
import {
|
|
745
|
-
DateElement,
|
|
746
|
-
TranslatableString as TranslatableString5,
|
|
747
|
-
useAltDateWidgetProps
|
|
748
|
-
} from "@rjsf/utils";
|
|
727
|
+
import { DateElement, TranslatableString as TranslatableString5, useAltDateWidgetProps } from "@rjsf/utils";
|
|
749
728
|
import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
750
729
|
function AltDateWidget({
|
|
751
730
|
autofocus = false,
|
|
@@ -808,7 +787,7 @@ import {
|
|
|
808
787
|
import { forwardRef as forwardRef4 } from "react";
|
|
809
788
|
import { Checkbox as ChakraCheckbox } from "@chakra-ui/react";
|
|
810
789
|
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
811
|
-
var Checkbox = forwardRef4(
|
|
790
|
+
var Checkbox = forwardRef4((props, ref) => {
|
|
812
791
|
const { icon, children, inputProps, rootRef, ...rest } = props;
|
|
813
792
|
return /* @__PURE__ */ jsxs13(ChakraCheckbox.Root, { ref: rootRef, ...rest, children: [
|
|
814
793
|
/* @__PURE__ */ jsx24(ChakraCheckbox.HiddenInput, { ref, ...inputProps }),
|
|
@@ -838,8 +817,8 @@ function CheckboxesWidget(props) {
|
|
|
838
817
|
} = props;
|
|
839
818
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
840
819
|
const optionValueFormat = getOptionValueFormat(options);
|
|
841
|
-
const
|
|
842
|
-
const
|
|
820
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
821
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
843
822
|
const row = options ? options.inline : false;
|
|
844
823
|
const selectValue = enumOptionSelectedValue(value, enumOptions, true, optionValueFormat, []);
|
|
845
824
|
const chakraProps = getChakra({ uiSchema });
|
|
@@ -861,7 +840,7 @@ function CheckboxesWidget(props) {
|
|
|
861
840
|
readOnly: readonly,
|
|
862
841
|
invalid: required && value.length === 0,
|
|
863
842
|
children: /* @__PURE__ */ jsx25(Stack, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
864
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
843
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
865
844
|
return /* @__PURE__ */ jsx25(
|
|
866
845
|
Checkbox,
|
|
867
846
|
{
|
|
@@ -869,11 +848,11 @@ function CheckboxesWidget(props) {
|
|
|
869
848
|
name: htmlName || id,
|
|
870
849
|
value: enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
871
850
|
disabled: disabled || itemDisabled || readonly,
|
|
872
|
-
onBlur:
|
|
873
|
-
onFocus:
|
|
851
|
+
onBlur: handleBlur,
|
|
852
|
+
onFocus: handleFocus,
|
|
874
853
|
children: option.label && /* @__PURE__ */ jsx25(Text3, { children: option.label })
|
|
875
854
|
},
|
|
876
|
-
|
|
855
|
+
String(option.value)
|
|
877
856
|
);
|
|
878
857
|
}) })
|
|
879
858
|
}
|
|
@@ -920,9 +899,9 @@ function CheckboxWidget(props) {
|
|
|
920
899
|
const uiOptions = getUiOptions5(uiSchema);
|
|
921
900
|
const isCheckbox = uiOptions.widget === "checkbox";
|
|
922
901
|
const description = isCheckbox ? void 0 : options.description ?? schema.description;
|
|
923
|
-
const
|
|
924
|
-
const
|
|
925
|
-
const
|
|
902
|
+
const handleChange = ({ checked }) => onChange(checked);
|
|
903
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.checked);
|
|
904
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.checked);
|
|
926
905
|
const chakraProps = getChakra({ uiSchema });
|
|
927
906
|
return /* @__PURE__ */ jsxs15(Field, { mb: 1, required, ...chakraProps, children: [
|
|
928
907
|
!hideLabel && description && /* @__PURE__ */ jsx26(
|
|
@@ -942,9 +921,9 @@ function CheckboxWidget(props) {
|
|
|
942
921
|
name: htmlName || id,
|
|
943
922
|
checked: typeof value === "undefined" ? false : value,
|
|
944
923
|
disabled: disabled || readonly,
|
|
945
|
-
onCheckedChange:
|
|
946
|
-
onBlur:
|
|
947
|
-
onFocus:
|
|
924
|
+
onCheckedChange: handleChange,
|
|
925
|
+
onBlur: handleBlur,
|
|
926
|
+
onFocus: handleFocus,
|
|
948
927
|
"aria-describedby": ariaDescribedByIds3(id),
|
|
949
928
|
children: labelValue3(/* @__PURE__ */ jsx26(Text4, { children: label }), hideLabel || !label)
|
|
950
929
|
}
|
|
@@ -955,12 +934,7 @@ function CheckboxWidget(props) {
|
|
|
955
934
|
// src/NativeSelectWidget/NativeSelectWidget.tsx
|
|
956
935
|
import { useMemo } from "react";
|
|
957
936
|
import { createListCollection, NativeSelect } from "@chakra-ui/react";
|
|
958
|
-
import {
|
|
959
|
-
ariaDescribedByIds as ariaDescribedByIds4,
|
|
960
|
-
enumOptionsIndexForValue,
|
|
961
|
-
enumOptionsValueForIndex,
|
|
962
|
-
labelValue as labelValue4
|
|
963
|
-
} from "@rjsf/utils";
|
|
937
|
+
import { ariaDescribedByIds as ariaDescribedByIds4, enumOptionsIndexForValue, enumOptionsValueForIndex, labelValue as labelValue4 } from "@rjsf/utils";
|
|
964
938
|
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
965
939
|
function NativeSelectWidget(props) {
|
|
966
940
|
const {
|
|
@@ -983,27 +957,25 @@ function NativeSelectWidget(props) {
|
|
|
983
957
|
uiSchema
|
|
984
958
|
} = props;
|
|
985
959
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
};
|
|
989
|
-
const _onBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
990
|
-
const _onFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
960
|
+
const handleChange = ({ target }) => onChange(enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
961
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
962
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
991
963
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
992
964
|
const { valueLabelMap, displayEnumOptions } = useMemo(() => {
|
|
993
|
-
const
|
|
994
|
-
let
|
|
965
|
+
const computedValueLabelMap = {};
|
|
966
|
+
let computedOptions = [];
|
|
995
967
|
if (Array.isArray(enumOptions)) {
|
|
996
|
-
|
|
997
|
-
const { value:
|
|
998
|
-
|
|
968
|
+
computedOptions = enumOptions.map((option, index) => {
|
|
969
|
+
const { value: enumValue, label: enumLabel } = option;
|
|
970
|
+
computedValueLabelMap[index] = enumLabel || String(enumValue);
|
|
999
971
|
return {
|
|
1000
|
-
label:
|
|
972
|
+
label: enumLabel,
|
|
1001
973
|
value: String(index),
|
|
1002
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
974
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1003
975
|
};
|
|
1004
976
|
});
|
|
1005
977
|
}
|
|
1006
|
-
return { valueLabelMap:
|
|
978
|
+
return { valueLabelMap: computedValueLabelMap, displayEnumOptions: computedOptions };
|
|
1007
979
|
}, [enumDisabled, enumOptions]);
|
|
1008
980
|
const selectedIndex = enumOptionsIndexForValue(value, enumOptions, false);
|
|
1009
981
|
const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
|
|
@@ -1032,9 +1004,9 @@ function NativeSelectWidget(props) {
|
|
|
1032
1004
|
NativeSelect.Field,
|
|
1033
1005
|
{
|
|
1034
1006
|
id,
|
|
1035
|
-
onBlur:
|
|
1036
|
-
onChange:
|
|
1037
|
-
onFocus:
|
|
1007
|
+
onBlur: handleBlur,
|
|
1008
|
+
onChange: handleChange,
|
|
1009
|
+
onFocus: handleFocus,
|
|
1038
1010
|
autoFocus: autofocus,
|
|
1039
1011
|
value: formValue,
|
|
1040
1012
|
"aria-describedby": ariaDescribedByIds4(id),
|
|
@@ -1066,7 +1038,7 @@ import {
|
|
|
1066
1038
|
import { forwardRef as forwardRef5 } from "react";
|
|
1067
1039
|
import { RadioGroup as ChakraRadioGroup } from "@chakra-ui/react";
|
|
1068
1040
|
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1069
|
-
var Radio = forwardRef5(
|
|
1041
|
+
var Radio = forwardRef5((props, ref) => {
|
|
1070
1042
|
const { children, inputProps, rootRef, ...rest } = props;
|
|
1071
1043
|
return /* @__PURE__ */ jsxs17(ChakraRadioGroup.Item, { ref: rootRef, ...rest, children: [
|
|
1072
1044
|
/* @__PURE__ */ jsx28(ChakraRadioGroup.ItemHiddenInput, { ref, ...inputProps }),
|
|
@@ -1095,9 +1067,9 @@ function RadioWidget({
|
|
|
1095
1067
|
}) {
|
|
1096
1068
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1097
1069
|
const optionValueFormat = getOptionValueFormat2(options);
|
|
1098
|
-
const
|
|
1099
|
-
const
|
|
1100
|
-
const
|
|
1070
|
+
const handleChange = ({ target: { value: enumValue } }) => onChange(enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1071
|
+
const handleBlur = ({ target: { value: enumValue } }) => onBlur(id, enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1072
|
+
const handleFocus = ({ target: { value: enumValue } }) => onFocus(id, enumOptionValueDecoder2(enumValue, enumOptions, optionValueFormat, emptyValue));
|
|
1101
1073
|
const row = options ? options.inline : false;
|
|
1102
1074
|
const selectValue = enumOptionSelectedValue2(value, enumOptions, false, optionValueFormat, null);
|
|
1103
1075
|
const chakraProps = getChakra({ uiSchema });
|
|
@@ -1113,14 +1085,14 @@ function RadioWidget({
|
|
|
1113
1085
|
children: /* @__PURE__ */ jsx29(
|
|
1114
1086
|
RadioGroup,
|
|
1115
1087
|
{
|
|
1116
|
-
onChange:
|
|
1117
|
-
onBlur:
|
|
1118
|
-
onFocus:
|
|
1088
|
+
onChange: handleChange,
|
|
1089
|
+
onBlur: handleBlur,
|
|
1090
|
+
onFocus: handleFocus,
|
|
1119
1091
|
value: selectValue,
|
|
1120
1092
|
name: htmlName || id,
|
|
1121
1093
|
"aria-describedby": ariaDescribedByIds5(id),
|
|
1122
1094
|
children: /* @__PURE__ */ jsx29(Stack2, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1123
|
-
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.
|
|
1095
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.includes(option.value);
|
|
1124
1096
|
return /* @__PURE__ */ jsx29(
|
|
1125
1097
|
Radio,
|
|
1126
1098
|
{
|
|
@@ -1129,7 +1101,7 @@ function RadioWidget({
|
|
|
1129
1101
|
disabled: disabled || itemDisabled || readonly,
|
|
1130
1102
|
children: option.label
|
|
1131
1103
|
},
|
|
1132
|
-
|
|
1104
|
+
String(option.value)
|
|
1133
1105
|
);
|
|
1134
1106
|
}) })
|
|
1135
1107
|
}
|
|
@@ -1139,17 +1111,30 @@ function RadioWidget({
|
|
|
1139
1111
|
}
|
|
1140
1112
|
|
|
1141
1113
|
// src/RangeWidget/RangeWidget.tsx
|
|
1142
|
-
import {
|
|
1143
|
-
ariaDescribedByIds as ariaDescribedByIds6,
|
|
1144
|
-
labelValue as labelValue6,
|
|
1145
|
-
rangeSpec
|
|
1146
|
-
} from "@rjsf/utils";
|
|
1114
|
+
import { ariaDescribedByIds as ariaDescribedByIds6, labelValue as labelValue6, rangeSpec } from "@rjsf/utils";
|
|
1147
1115
|
|
|
1148
1116
|
// src/components/ui/slider.tsx
|
|
1149
1117
|
import { forwardRef as forwardRef6 } from "react";
|
|
1150
1118
|
import { Slider as ChakraSlider, HStack as HStack2 } from "@chakra-ui/react";
|
|
1151
1119
|
import { Fragment as Fragment2, jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1152
|
-
var
|
|
1120
|
+
var SliderMarks = forwardRef6((props, ref) => {
|
|
1121
|
+
const { marks } = props;
|
|
1122
|
+
if (!marks?.length) {
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
1125
|
+
return /* @__PURE__ */ jsx30(ChakraSlider.MarkerGroup, { ref, children: marks.map((mark, index) => {
|
|
1126
|
+
const value = typeof mark === "number" ? mark : mark.value;
|
|
1127
|
+
const label = typeof mark === "number" ? void 0 : mark.label;
|
|
1128
|
+
return (
|
|
1129
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1130
|
+
/* @__PURE__ */ jsxs18(ChakraSlider.Marker, { value, children: [
|
|
1131
|
+
/* @__PURE__ */ jsx30(ChakraSlider.MarkerIndicator, {}),
|
|
1132
|
+
label
|
|
1133
|
+
] }, index)
|
|
1134
|
+
);
|
|
1135
|
+
}) });
|
|
1136
|
+
});
|
|
1137
|
+
var Slider = forwardRef6((props, ref) => {
|
|
1153
1138
|
const { marks: marksProp, showValue, ...rest } = props;
|
|
1154
1139
|
const value = props.defaultValue ?? props.value;
|
|
1155
1140
|
const marks = marksProp?.map((mark) => {
|
|
@@ -1170,22 +1155,11 @@ var Slider = forwardRef6(function Slider2(props, ref) {
|
|
|
1170
1155
|
});
|
|
1171
1156
|
function SliderThumbs(props) {
|
|
1172
1157
|
const { value } = props;
|
|
1173
|
-
return /* @__PURE__ */ jsx30(Fragment2, { children: value?.map((_, index) =>
|
|
1158
|
+
return /* @__PURE__ */ jsx30(Fragment2, { children: value?.map((_, index) => (
|
|
1159
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1160
|
+
/* @__PURE__ */ jsx30(ChakraSlider.Thumb, { index, children: /* @__PURE__ */ jsx30(ChakraSlider.HiddenInput, {}) }, index)
|
|
1161
|
+
)) });
|
|
1174
1162
|
}
|
|
1175
|
-
var SliderMarks = forwardRef6(function SliderMarks2(props, ref) {
|
|
1176
|
-
const { marks } = props;
|
|
1177
|
-
if (!marks?.length) {
|
|
1178
|
-
return null;
|
|
1179
|
-
}
|
|
1180
|
-
return /* @__PURE__ */ jsx30(ChakraSlider.MarkerGroup, { ref, children: marks.map((mark, index) => {
|
|
1181
|
-
const value = typeof mark === "number" ? mark : mark.value;
|
|
1182
|
-
const label = typeof mark === "number" ? void 0 : mark.label;
|
|
1183
|
-
return /* @__PURE__ */ jsxs18(ChakraSlider.Marker, { value, children: [
|
|
1184
|
-
/* @__PURE__ */ jsx30(ChakraSlider.MarkerIndicator, {}),
|
|
1185
|
-
label
|
|
1186
|
-
] }, index);
|
|
1187
|
-
}) });
|
|
1188
|
-
});
|
|
1189
1163
|
|
|
1190
1164
|
// src/RangeWidget/RangeWidget.tsx
|
|
1191
1165
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
@@ -1203,9 +1177,9 @@ function RangeWidget({
|
|
|
1203
1177
|
id,
|
|
1204
1178
|
uiSchema
|
|
1205
1179
|
}) {
|
|
1206
|
-
const
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1180
|
+
const handleChange = ({ value: newValue }) => onChange(newValue === void 0 ? options.emptyValue : newValue[0]);
|
|
1181
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1182
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1209
1183
|
const chakraProps = getChakra({ uiSchema });
|
|
1210
1184
|
return /* @__PURE__ */ jsx31(Field, { mb: 1, label: labelValue6(label, hideLabel || !label), ...chakraProps, children: /* @__PURE__ */ jsx31(
|
|
1211
1185
|
Slider,
|
|
@@ -1215,9 +1189,9 @@ function RangeWidget({
|
|
|
1215
1189
|
name: id,
|
|
1216
1190
|
disabled: disabled || readonly,
|
|
1217
1191
|
value: [value],
|
|
1218
|
-
onValueChange:
|
|
1219
|
-
onBlur:
|
|
1220
|
-
onFocus:
|
|
1192
|
+
onValueChange: handleChange,
|
|
1193
|
+
onBlur: handleBlur,
|
|
1194
|
+
onFocus: handleFocus,
|
|
1221
1195
|
"aria-describedby": ariaDescribedByIds6(id)
|
|
1222
1196
|
}
|
|
1223
1197
|
) });
|
|
@@ -1239,7 +1213,8 @@ import {
|
|
|
1239
1213
|
import { forwardRef as forwardRef7 } from "react";
|
|
1240
1214
|
import { Select as ChakraSelect, Portal } from "@chakra-ui/react";
|
|
1241
1215
|
import { Fragment as Fragment3, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1242
|
-
var
|
|
1216
|
+
var SelectClearTrigger = forwardRef7((props, ref) => /* @__PURE__ */ jsx32(ChakraSelect.ClearTrigger, { asChild: true, ...props, ref, children: /* @__PURE__ */ jsx32(CloseButton, { size: "xs", variant: "plain", focusVisibleRing: "inside", focusRingWidth: "2px", pointerEvents: "auto" }) }));
|
|
1217
|
+
var SelectTrigger = forwardRef7((props, ref) => {
|
|
1243
1218
|
const { children, clearable, ...rest } = props;
|
|
1244
1219
|
return /* @__PURE__ */ jsxs19(ChakraSelect.Control, { ...rest, children: [
|
|
1245
1220
|
/* @__PURE__ */ jsx32(ChakraSelect.Trigger, { ref, children }),
|
|
@@ -1249,23 +1224,18 @@ var SelectTrigger = forwardRef7(function SelectTrigger2(props, ref) {
|
|
|
1249
1224
|
] })
|
|
1250
1225
|
] });
|
|
1251
1226
|
});
|
|
1252
|
-
var
|
|
1253
|
-
function SelectClearTrigger2(props, ref) {
|
|
1254
|
-
return /* @__PURE__ */ jsx32(ChakraSelect.ClearTrigger, { asChild: true, ...props, ref, children: /* @__PURE__ */ jsx32(CloseButton, { size: "xs", variant: "plain", focusVisibleRing: "inside", focusRingWidth: "2px", pointerEvents: "auto" }) });
|
|
1255
|
-
}
|
|
1256
|
-
);
|
|
1257
|
-
var SelectContent = forwardRef7(function SelectContent2(props, ref) {
|
|
1227
|
+
var SelectContent = forwardRef7((props, ref) => {
|
|
1258
1228
|
const { portalled = true, portalRef, ...rest } = props;
|
|
1259
1229
|
return /* @__PURE__ */ jsx32(Portal, { disabled: !portalled, container: portalRef, children: /* @__PURE__ */ jsx32(ChakraSelect.Positioner, { children: /* @__PURE__ */ jsx32(ChakraSelect.Content, { ...rest, ref }) }) });
|
|
1260
1230
|
});
|
|
1261
|
-
var SelectItem = forwardRef7(
|
|
1231
|
+
var SelectItem = forwardRef7((props, ref) => {
|
|
1262
1232
|
const { item, children, ...rest } = props;
|
|
1263
1233
|
return /* @__PURE__ */ jsxs19(ChakraSelect.Item, { item, ...rest, ref, children: [
|
|
1264
1234
|
children,
|
|
1265
1235
|
/* @__PURE__ */ jsx32(ChakraSelect.ItemIndicator, {})
|
|
1266
1236
|
] }, item.value);
|
|
1267
1237
|
});
|
|
1268
|
-
var SelectValueText = forwardRef7(
|
|
1238
|
+
var SelectValueText = forwardRef7((props, ref) => {
|
|
1269
1239
|
const { children, ...rest } = props;
|
|
1270
1240
|
return /* @__PURE__ */ jsx32(ChakraSelect.ValueText, { ...rest, ref, children: /* @__PURE__ */ jsx32(ChakraSelect.Context, { children: (select) => {
|
|
1271
1241
|
const items = select.selectedItems;
|
|
@@ -1281,13 +1251,11 @@ var SelectValueText = forwardRef7(function SelectValueText2(props, ref) {
|
|
|
1281
1251
|
return `${items.length} selected`;
|
|
1282
1252
|
} }) });
|
|
1283
1253
|
});
|
|
1284
|
-
var SelectRoot = forwardRef7(
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
});
|
|
1290
|
-
var SelectItemGroup = forwardRef7(function SelectItemGroup2(props, ref) {
|
|
1254
|
+
var SelectRoot = forwardRef7((props, ref) => /* @__PURE__ */ jsx32(ChakraSelect.Root, { ...props, ref, positioning: { sameWidth: true, ...props.positioning }, children: props.asChild ? props.children : /* @__PURE__ */ jsxs19(Fragment3, { children: [
|
|
1255
|
+
/* @__PURE__ */ jsx32(ChakraSelect.HiddenSelect, {}),
|
|
1256
|
+
props.children
|
|
1257
|
+
] }) }));
|
|
1258
|
+
var SelectItemGroup = forwardRef7((props, ref) => {
|
|
1291
1259
|
const { children, label, ...rest } = props;
|
|
1292
1260
|
return /* @__PURE__ */ jsxs19(ChakraSelect.ItemGroup, { ...rest, ref, children: [
|
|
1293
1261
|
/* @__PURE__ */ jsx32(ChakraSelect.ItemGroupLabel, { children: label }),
|
|
@@ -1322,34 +1290,32 @@ function SelectWidget(props) {
|
|
|
1322
1290
|
} = props;
|
|
1323
1291
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1324
1292
|
const optionValueFormat = getOptionValueFormat3(options);
|
|
1325
|
-
const
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
const _onSingleChange = ({ value: value2 }) => {
|
|
1329
|
-
const selected = enumOptionValueDecoder3(value2, enumOptions, optionValueFormat, emptyValue);
|
|
1293
|
+
const handleMultiChange = ({ value: newValue }) => onChange(enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, emptyValue));
|
|
1294
|
+
const handleSingleChange = ({ value: newValue }) => {
|
|
1295
|
+
const selected = enumOptionValueDecoder3(newValue, enumOptions, optionValueFormat, emptyValue);
|
|
1330
1296
|
return onChange(Array.isArray(selected) && selected.length === 1 ? selected[0] : selected);
|
|
1331
1297
|
};
|
|
1332
|
-
const
|
|
1333
|
-
const
|
|
1298
|
+
const handleBlur = ({ target }) => onBlur(id, enumOptionValueDecoder3(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1299
|
+
const handleFocus = ({ target }) => onFocus(id, enumOptionValueDecoder3(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1334
1300
|
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1335
1301
|
const displayEnumOptions = useMemo2(() => {
|
|
1336
|
-
let
|
|
1302
|
+
let computedOptions = [];
|
|
1337
1303
|
if (Array.isArray(enumOptions)) {
|
|
1338
|
-
|
|
1339
|
-
const { value:
|
|
1304
|
+
computedOptions = enumOptions.map((option, index) => {
|
|
1305
|
+
const { value: enumValue, label: enumLabel } = option;
|
|
1340
1306
|
return {
|
|
1341
|
-
label:
|
|
1342
|
-
value: enumOptionValueEncoder3(
|
|
1343
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1307
|
+
label: enumLabel,
|
|
1308
|
+
value: enumOptionValueEncoder3(enumValue, index, optionValueFormat),
|
|
1309
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(enumValue)
|
|
1344
1310
|
};
|
|
1345
1311
|
});
|
|
1346
1312
|
if (showPlaceholderOption) {
|
|
1347
|
-
|
|
1313
|
+
computedOptions.unshift({ value: "", label: placeholder || "" });
|
|
1348
1314
|
}
|
|
1349
1315
|
}
|
|
1350
|
-
return
|
|
1316
|
+
return computedOptions;
|
|
1351
1317
|
}, [enumDisabled, enumOptions, placeholder, showPlaceholderOption, optionValueFormat]);
|
|
1352
|
-
const isMultiple = typeof multiple !== "undefined" && multiple
|
|
1318
|
+
const isMultiple = typeof multiple !== "undefined" && multiple && Boolean(enumOptions);
|
|
1353
1319
|
const formValue = [
|
|
1354
1320
|
enumOptionSelectedValue3(value, enumOptions, isMultiple, optionValueFormat, isMultiple ? [] : "")
|
|
1355
1321
|
].flat().filter((v) => v !== "");
|
|
@@ -1378,9 +1344,9 @@ function SelectWidget(props) {
|
|
|
1378
1344
|
name: htmlName || id,
|
|
1379
1345
|
multiple: isMultiple,
|
|
1380
1346
|
closeOnSelect: !isMultiple,
|
|
1381
|
-
onBlur:
|
|
1382
|
-
onValueChange: isMultiple ?
|
|
1383
|
-
onFocus:
|
|
1347
|
+
onBlur: handleBlur,
|
|
1348
|
+
onValueChange: isMultiple ? handleMultiChange : handleSingleChange,
|
|
1349
|
+
onFocus: handleFocus,
|
|
1384
1350
|
autoFocus: autofocus,
|
|
1385
1351
|
value: formValue,
|
|
1386
1352
|
"aria-describedby": ariaDescribedByIds7(id),
|
|
@@ -1400,10 +1366,7 @@ function SelectWidget(props) {
|
|
|
1400
1366
|
|
|
1401
1367
|
// src/TextareaWidget/TextareaWidget.tsx
|
|
1402
1368
|
import { Textarea } from "@chakra-ui/react";
|
|
1403
|
-
import {
|
|
1404
|
-
ariaDescribedByIds as ariaDescribedByIds8,
|
|
1405
|
-
labelValue as labelValue8
|
|
1406
|
-
} from "@rjsf/utils";
|
|
1369
|
+
import { ariaDescribedByIds as ariaDescribedByIds8, labelValue as labelValue8 } from "@rjsf/utils";
|
|
1407
1370
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1408
1371
|
function TextareaWidget({
|
|
1409
1372
|
id,
|
|
@@ -1423,9 +1386,9 @@ function TextareaWidget({
|
|
|
1423
1386
|
rawErrors,
|
|
1424
1387
|
uiSchema
|
|
1425
1388
|
}) {
|
|
1426
|
-
const
|
|
1427
|
-
const
|
|
1428
|
-
const
|
|
1389
|
+
const handleChange = ({ target: { value: newValue } }) => onChange(newValue === "" ? options.emptyValue : newValue);
|
|
1390
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1391
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1429
1392
|
const chakraProps = getChakra({ uiSchema });
|
|
1430
1393
|
return /* @__PURE__ */ jsx34(
|
|
1431
1394
|
Field,
|
|
@@ -1445,9 +1408,9 @@ function TextareaWidget({
|
|
|
1445
1408
|
value: value ?? "",
|
|
1446
1409
|
placeholder,
|
|
1447
1410
|
autoFocus: autofocus,
|
|
1448
|
-
onChange:
|
|
1449
|
-
onBlur:
|
|
1450
|
-
onFocus:
|
|
1411
|
+
onChange: handleChange,
|
|
1412
|
+
onBlur: handleBlur,
|
|
1413
|
+
onFocus: handleFocus,
|
|
1451
1414
|
rows: options.rows,
|
|
1452
1415
|
"aria-describedby": ariaDescribedByIds8(id)
|
|
1453
1416
|
}
|
|
@@ -1457,16 +1420,13 @@ function TextareaWidget({
|
|
|
1457
1420
|
}
|
|
1458
1421
|
|
|
1459
1422
|
// src/UpDownWidget/UpDownWidget.tsx
|
|
1460
|
-
import {
|
|
1461
|
-
ariaDescribedByIds as ariaDescribedByIds9,
|
|
1462
|
-
labelValue as labelValue9
|
|
1463
|
-
} from "@rjsf/utils";
|
|
1423
|
+
import { ariaDescribedByIds as ariaDescribedByIds9, labelValue as labelValue9 } from "@rjsf/utils";
|
|
1464
1424
|
|
|
1465
1425
|
// src/components/ui/number-input.tsx
|
|
1466
1426
|
import { forwardRef as forwardRef8, useEffect, useRef as useRef2 } from "react";
|
|
1467
1427
|
import { NumberInput as ChakraNumberInput } from "@chakra-ui/react";
|
|
1468
1428
|
import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1469
|
-
var NumberInputRoot = forwardRef8(
|
|
1429
|
+
var NumberInputRoot = forwardRef8((props, ref) => {
|
|
1470
1430
|
const inputRef = useRef2(null);
|
|
1471
1431
|
useEffect(() => {
|
|
1472
1432
|
if (inputRef.current) {
|
|
@@ -1486,9 +1446,9 @@ var NumberInputRoot = forwardRef8(function NumberInput(props, ref) {
|
|
|
1486
1446
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1487
1447
|
function UpDownWidget(props) {
|
|
1488
1448
|
const { id, readonly, disabled, label, hideLabel, value, onChange, onBlur, onFocus, rawErrors, required } = props;
|
|
1489
|
-
const
|
|
1490
|
-
const
|
|
1491
|
-
const
|
|
1449
|
+
const handleChange = ({ value: newValue }) => onChange(newValue);
|
|
1450
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
1451
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
1492
1452
|
const chakraProps = getChakra({ uiSchema: props.uiSchema });
|
|
1493
1453
|
return /* @__PURE__ */ jsx36(
|
|
1494
1454
|
Field,
|
|
@@ -1504,9 +1464,9 @@ function UpDownWidget(props) {
|
|
|
1504
1464
|
NumberInputRoot,
|
|
1505
1465
|
{
|
|
1506
1466
|
value,
|
|
1507
|
-
onValueChange:
|
|
1508
|
-
onBlur:
|
|
1509
|
-
onFocus:
|
|
1467
|
+
onValueChange: handleChange,
|
|
1468
|
+
onBlur: handleBlur,
|
|
1469
|
+
onFocus: handleFocus,
|
|
1510
1470
|
"aria-describedby": ariaDescribedByIds9(id),
|
|
1511
1471
|
id,
|
|
1512
1472
|
name: id
|
|
@@ -1558,9 +1518,7 @@ var memoizedCreateCacheWithContainer = weakMemoize((container) => {
|
|
|
1558
1518
|
const newCache = createCache({ container, key: "rjsf" });
|
|
1559
1519
|
return newCache;
|
|
1560
1520
|
});
|
|
1561
|
-
var __createChakraFrameProvider = (props) => ({ document }) => {
|
|
1562
|
-
return /* @__PURE__ */ jsx37("div", { style: { margin: 2 }, children: /* @__PURE__ */ jsx37(CacheProvider, { value: memoizedCreateCacheWithContainer(document.head), children: /* @__PURE__ */ jsx37(ChakraProvider, { value: defaultSystem2, children: props.children }) }) });
|
|
1563
|
-
};
|
|
1521
|
+
var __createChakraFrameProvider = (props) => ({ document }) => /* @__PURE__ */ jsx37("div", { style: { margin: 2 }, children: /* @__PURE__ */ jsx37(CacheProvider, { value: memoizedCreateCacheWithContainer(document.head), children: /* @__PURE__ */ jsx37(ChakraProvider, { value: defaultSystem2, children: props.children }) }) });
|
|
1564
1522
|
|
|
1565
1523
|
// src/index.ts
|
|
1566
1524
|
var index_default = Form_default;
|