@rjsf/chakra-ui 6.5.2 → 6.6.0
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 +309 -309
- package/dist/chakra-ui.esm.js.map +4 -4
- package/dist/chakra-ui.umd.js +188 -188
- package/dist/index.cjs +339 -339
- package/dist/index.cjs.map +4 -4
- package/lib/AddButton/AddButton.js +1 -1
- package/lib/AddButton/AddButton.js.map +1 -1
- package/lib/AltDateWidget/AltDateWidget.js.map +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js +1 -1
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/ChakraFrameProvider.js +2 -2
- package/lib/ChakraFrameProvider.js.map +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js +1 -1
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -1
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -1
- package/lib/DescriptionField/DescriptionField.js +1 -1
- package/lib/DescriptionField/DescriptionField.js.map +1 -1
- package/lib/ErrorList/ErrorList.js +1 -1
- package/lib/ErrorList/ErrorList.js.map +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +1 -1
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +1 -1
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
- package/lib/Form/Form.js.map +1 -1
- package/lib/NativeSelectWidget/NativeSelectWidget.js +1 -1
- package/lib/NativeSelectWidget/NativeSelectWidget.js.map +1 -1
- package/lib/SelectWidget/SelectWidget.js +1 -1
- package/lib/SelectWidget/SelectWidget.js.map +1 -1
- package/lib/Templates/Templates.js +1 -1
- package/lib/Templates/Templates.js.map +1 -1
- package/lib/Theme/Theme.js.map +1 -1
- package/lib/TitleField/TitleField.js.map +1 -1
- package/lib/UpDownWidget/UpDownWidget.js.map +1 -1
- package/lib/Widgets/Widgets.js +2 -2
- package/lib/Widgets/Widgets.js.map +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +1 -1
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +18 -19
- package/src/AddButton/AddButton.tsx +1 -1
- package/src/AltDateWidget/AltDateWidget.tsx +1 -0
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +1 -1
- package/src/ChakraFrameProvider.tsx +2 -2
- package/src/CheckboxWidget/CheckboxWidget.tsx +1 -1
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +1 -1
- package/src/DescriptionField/DescriptionField.tsx +1 -1
- package/src/ErrorList/ErrorList.tsx +1 -1
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +1 -1
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +1 -1
- package/src/Form/Form.tsx +2 -1
- package/src/NativeSelectWidget/NativeSelectWidget.tsx +1 -1
- package/src/SelectWidget/SelectWidget.tsx +1 -2
- package/src/Templates/Templates.ts +3 -2
- package/src/Theme/Theme.tsx +1 -1
- package/src/TitleField/TitleField.tsx +1 -1
- package/src/UpDownWidget/UpDownWidget.tsx +1 -2
- package/src/Widgets/Widgets.ts +4 -3
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +1 -1
- package/src/tsconfig.json +0 -1
- package/src/utils.ts +1 -1
package/dist/chakra-ui.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/chakra-ui"] = {}, global.core, global.
|
|
5
|
-
})(this, (function (exports, core,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@rjsf/core'), require('@chakra-ui/react'), require('@rjsf/utils'), require('lucide-react'), require('react/jsx-runtime'), require('react'), require('@emotion/is-prop-valid'), require('react-icons/lu'), require('@emotion/cache'), require('@emotion/react'), require('@emotion/weak-memoize')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@rjsf/core', '@chakra-ui/react', '@rjsf/utils', 'lucide-react', 'react/jsx-runtime', 'react', '@emotion/is-prop-valid', 'react-icons/lu', '@emotion/cache', '@emotion/react', '@emotion/weak-memoize'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@rjsf/chakra-ui"] = {}, global.core, global.react$1, global.utils, global.lucideReact, global.jsxRuntime, global.react, global.shouldForwardProp, global.lu, global.createCache, global.react$2, global.weakMemoize));
|
|
5
|
+
})(this, (function (exports, core, react$1, utils, lucideReact, jsxRuntime, react, shouldForwardProp, lu, createCache, react$2, weakMemoize) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// src/Form/Form.tsx
|
|
8
8
|
function AddButton({
|
|
@@ -220,63 +220,6 @@
|
|
|
220
220
|
const { translateString } = registry;
|
|
221
221
|
return /* @__PURE__ */ jsxRuntime.jsx(Alert, { status: "error", title: translateString(utils.TranslatableString.ErrorsLabel), mb: 3, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.ListRoot, { listStylePosition: "inside", children: errors.map((error, i) => /* @__PURE__ */ jsxRuntime.jsx(react$1.ListItem, { children: error.stack }, i)) }) });
|
|
222
222
|
}
|
|
223
|
-
function ChakraIconButton2(props) {
|
|
224
|
-
const { icon, iconType, uiSchema, registry, ...otherProps } = props;
|
|
225
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react$1.IconButton, { "aria-label": props.title, ...otherProps, children: icon });
|
|
226
|
-
}
|
|
227
|
-
ChakraIconButton2.displayName = "ChakraIconButton";
|
|
228
|
-
var ChakraIconButton_default = react.memo(ChakraIconButton2);
|
|
229
|
-
function CopyButton(props) {
|
|
230
|
-
const {
|
|
231
|
-
registry: { translateString }
|
|
232
|
-
} = props;
|
|
233
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ChakraIconButton_default, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) });
|
|
234
|
-
}
|
|
235
|
-
function MoveDownButton(props) {
|
|
236
|
-
const {
|
|
237
|
-
registry: { translateString }
|
|
238
|
-
} = props;
|
|
239
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
240
|
-
ChakraIconButton_default,
|
|
241
|
-
{
|
|
242
|
-
title: translateString(utils.TranslatableString.MoveDownButton),
|
|
243
|
-
...props,
|
|
244
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDownIcon, {})
|
|
245
|
-
}
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
function MoveUpButton(props) {
|
|
249
|
-
const {
|
|
250
|
-
registry: { translateString }
|
|
251
|
-
} = props;
|
|
252
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
253
|
-
ChakraIconButton_default,
|
|
254
|
-
{
|
|
255
|
-
title: translateString(utils.TranslatableString.MoveUpButton),
|
|
256
|
-
...props,
|
|
257
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpIcon, {})
|
|
258
|
-
}
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
function RemoveButton(props) {
|
|
262
|
-
const {
|
|
263
|
-
registry: { translateString }
|
|
264
|
-
} = props;
|
|
265
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
266
|
-
ChakraIconButton_default,
|
|
267
|
-
{
|
|
268
|
-
title: translateString(utils.TranslatableString.RemoveButton),
|
|
269
|
-
...props,
|
|
270
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.DeleteIcon, {})
|
|
271
|
-
}
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
function ClearButton(props) {
|
|
275
|
-
const {
|
|
276
|
-
registry: { translateString }
|
|
277
|
-
} = props;
|
|
278
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ChakraIconButton_default, { title: translateString(utils.TranslatableString.ClearButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) });
|
|
279
|
-
}
|
|
280
223
|
function FieldErrorTemplate(props) {
|
|
281
224
|
const { errors = [], fieldPathId } = props;
|
|
282
225
|
if (errors.length === 0) {
|
|
@@ -361,6 +304,63 @@
|
|
|
361
304
|
}
|
|
362
305
|
return /* @__PURE__ */ jsxRuntime.jsx(react$1.Grid, { ...rest, children });
|
|
363
306
|
}
|
|
307
|
+
function ChakraIconButton2(props) {
|
|
308
|
+
const { icon, iconType, uiSchema, registry, ...otherProps } = props;
|
|
309
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.IconButton, { "aria-label": props.title, ...otherProps, children: icon });
|
|
310
|
+
}
|
|
311
|
+
ChakraIconButton2.displayName = "ChakraIconButton";
|
|
312
|
+
var ChakraIconButton_default = react.memo(ChakraIconButton2);
|
|
313
|
+
function CopyButton(props) {
|
|
314
|
+
const {
|
|
315
|
+
registry: { translateString }
|
|
316
|
+
} = props;
|
|
317
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChakraIconButton_default, { title: translateString(utils.TranslatableString.CopyButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {}) });
|
|
318
|
+
}
|
|
319
|
+
function MoveDownButton(props) {
|
|
320
|
+
const {
|
|
321
|
+
registry: { translateString }
|
|
322
|
+
} = props;
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
324
|
+
ChakraIconButton_default,
|
|
325
|
+
{
|
|
326
|
+
title: translateString(utils.TranslatableString.MoveDownButton),
|
|
327
|
+
...props,
|
|
328
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDownIcon, {})
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
function MoveUpButton(props) {
|
|
333
|
+
const {
|
|
334
|
+
registry: { translateString }
|
|
335
|
+
} = props;
|
|
336
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
|
+
ChakraIconButton_default,
|
|
338
|
+
{
|
|
339
|
+
title: translateString(utils.TranslatableString.MoveUpButton),
|
|
340
|
+
...props,
|
|
341
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpIcon, {})
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
function RemoveButton(props) {
|
|
346
|
+
const {
|
|
347
|
+
registry: { translateString }
|
|
348
|
+
} = props;
|
|
349
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
350
|
+
ChakraIconButton_default,
|
|
351
|
+
{
|
|
352
|
+
title: translateString(utils.TranslatableString.RemoveButton),
|
|
353
|
+
...props,
|
|
354
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.DeleteIcon, {})
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
function ClearButton(props) {
|
|
359
|
+
const {
|
|
360
|
+
registry: { translateString }
|
|
361
|
+
} = props;
|
|
362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChakraIconButton_default, { title: translateString(utils.TranslatableString.ClearButton), ...props, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) });
|
|
363
|
+
}
|
|
364
364
|
function MultiSchemaFieldTemplate(props) {
|
|
365
365
|
const { optionSchemaField, selector } = props;
|
|
366
366
|
return /* @__PURE__ */ jsxRuntime.jsx(react$1.Card.Root, { mb: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.Card.Body, { pb: 2, children: [
|
|
@@ -650,6 +650,69 @@
|
|
|
650
650
|
children != null && /* @__PURE__ */ jsxRuntime.jsx(react$1.Checkbox.Label, { children })
|
|
651
651
|
] });
|
|
652
652
|
});
|
|
653
|
+
function CheckboxesWidget(props) {
|
|
654
|
+
const {
|
|
655
|
+
id,
|
|
656
|
+
htmlName,
|
|
657
|
+
disabled,
|
|
658
|
+
options,
|
|
659
|
+
value,
|
|
660
|
+
readonly,
|
|
661
|
+
onChange,
|
|
662
|
+
onBlur,
|
|
663
|
+
onFocus,
|
|
664
|
+
required,
|
|
665
|
+
label,
|
|
666
|
+
rawErrors = [],
|
|
667
|
+
hideLabel,
|
|
668
|
+
uiSchema
|
|
669
|
+
} = props;
|
|
670
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
671
|
+
const optionValueFormat = utils.getOptionValueFormat(options);
|
|
672
|
+
const _onBlur = ({ target }) => onBlur(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
673
|
+
const _onFocus = ({ target }) => onFocus(id, utils.enumOptionValueDecoder(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
674
|
+
const row = options ? options.inline : false;
|
|
675
|
+
const selectValue = utils.enumOptionSelectedValue(value, enumOptions, true, optionValueFormat, []);
|
|
676
|
+
const chakraProps = getChakra({ });
|
|
677
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
678
|
+
react$1.FieldsetRoot,
|
|
679
|
+
{
|
|
680
|
+
mb: 1,
|
|
681
|
+
disabled: disabled || readonly,
|
|
682
|
+
invalid: rawErrors && rawErrors.length > 0,
|
|
683
|
+
...chakraProps,
|
|
684
|
+
children: [
|
|
685
|
+
!hideLabel && label && /* @__PURE__ */ jsxRuntime.jsx(react$1.FieldsetLegend, { children: utils.labelValue(label) }),
|
|
686
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
687
|
+
react$1.CheckboxGroup,
|
|
688
|
+
{
|
|
689
|
+
onValueChange: (option) => onChange(utils.enumOptionValueDecoder(option, enumOptions, optionValueFormat, emptyValue)),
|
|
690
|
+
value: selectValue,
|
|
691
|
+
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
692
|
+
readOnly: readonly,
|
|
693
|
+
invalid: required && value.length === 0,
|
|
694
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Stack, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
695
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
696
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
Checkbox,
|
|
698
|
+
{
|
|
699
|
+
id: utils.optionId(id, index),
|
|
700
|
+
name: htmlName || id,
|
|
701
|
+
value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
702
|
+
disabled: disabled || itemDisabled || readonly,
|
|
703
|
+
onBlur: _onBlur,
|
|
704
|
+
onFocus: _onFocus,
|
|
705
|
+
children: option.label && /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { children: option.label })
|
|
706
|
+
},
|
|
707
|
+
index
|
|
708
|
+
);
|
|
709
|
+
}) })
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
}
|
|
653
716
|
function CheckboxWidget(props) {
|
|
654
717
|
const {
|
|
655
718
|
id,
|
|
@@ -707,66 +770,90 @@
|
|
|
707
770
|
)
|
|
708
771
|
] });
|
|
709
772
|
}
|
|
710
|
-
function
|
|
773
|
+
function NativeSelectWidget(props) {
|
|
711
774
|
const {
|
|
712
775
|
id,
|
|
713
|
-
htmlName,
|
|
714
|
-
disabled,
|
|
715
776
|
options,
|
|
716
|
-
|
|
777
|
+
label,
|
|
778
|
+
hideLabel,
|
|
779
|
+
placeholder,
|
|
780
|
+
multiple,
|
|
781
|
+
required,
|
|
782
|
+
disabled,
|
|
717
783
|
readonly,
|
|
784
|
+
value,
|
|
785
|
+
autofocus,
|
|
718
786
|
onChange,
|
|
719
787
|
onBlur,
|
|
720
788
|
onFocus,
|
|
721
|
-
required,
|
|
722
|
-
label,
|
|
723
789
|
rawErrors = [],
|
|
724
|
-
|
|
790
|
+
schema,
|
|
725
791
|
uiSchema
|
|
726
792
|
} = props;
|
|
727
793
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
const
|
|
794
|
+
const _onChange = ({ target }) => {
|
|
795
|
+
return onChange(utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
796
|
+
};
|
|
797
|
+
const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
798
|
+
const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
799
|
+
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
800
|
+
const { valueLabelMap, displayEnumOptions } = react.useMemo(() => {
|
|
801
|
+
const valueLabelMap2 = {};
|
|
802
|
+
let displayEnumOptions2 = [];
|
|
803
|
+
if (Array.isArray(enumOptions)) {
|
|
804
|
+
displayEnumOptions2 = enumOptions.map((option, index) => {
|
|
805
|
+
const { value: value2, label: label2 } = option;
|
|
806
|
+
valueLabelMap2[index] = label2 || String(value2);
|
|
807
|
+
return {
|
|
808
|
+
label: label2,
|
|
809
|
+
value: String(index),
|
|
810
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
|
|
811
|
+
};
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
return { valueLabelMap: valueLabelMap2, displayEnumOptions: displayEnumOptions2 };
|
|
815
|
+
}, [enumDisabled, enumOptions]);
|
|
816
|
+
const selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions, false);
|
|
817
|
+
const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
|
|
818
|
+
{
|
|
819
|
+
label: valueLabelMap[selectedIndex] || "",
|
|
820
|
+
value: selectedIndex.toString()
|
|
821
|
+
}
|
|
822
|
+
] : [];
|
|
823
|
+
const formValue = getSingleValue()[0]?.value || "";
|
|
824
|
+
const selectOptions = react$1.createListCollection({
|
|
825
|
+
items: displayEnumOptions.filter((item) => item.value)
|
|
826
|
+
});
|
|
733
827
|
const chakraProps = getChakra({ });
|
|
734
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
735
|
-
|
|
828
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
829
|
+
Field,
|
|
736
830
|
{
|
|
737
831
|
mb: 1,
|
|
738
832
|
disabled: disabled || readonly,
|
|
833
|
+
required,
|
|
834
|
+
readOnly: readonly,
|
|
739
835
|
invalid: rawErrors && rawErrors.length > 0,
|
|
836
|
+
label: utils.labelValue(label, hideLabel || !label),
|
|
740
837
|
...chakraProps,
|
|
741
|
-
children: [
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
react$1.CheckboxGroup,
|
|
838
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.NativeSelect.Root, { children: [
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
840
|
+
react$1.NativeSelect.Field,
|
|
745
841
|
{
|
|
746
|
-
|
|
747
|
-
|
|
842
|
+
id,
|
|
843
|
+
onBlur: _onBlur,
|
|
844
|
+
onChange: _onChange,
|
|
845
|
+
onFocus: _onFocus,
|
|
846
|
+
autoFocus: autofocus,
|
|
847
|
+
value: formValue,
|
|
748
848
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
754
|
-
Checkbox,
|
|
755
|
-
{
|
|
756
|
-
id: utils.optionId(id, index),
|
|
757
|
-
name: htmlName || id,
|
|
758
|
-
value: utils.enumOptionValueEncoder(option.value, index, optionValueFormat),
|
|
759
|
-
disabled: disabled || itemDisabled || readonly,
|
|
760
|
-
onBlur: _onBlur,
|
|
761
|
-
onFocus: _onFocus,
|
|
762
|
-
children: option.label && /* @__PURE__ */ jsxRuntime.jsx(react$1.Text, { children: option.label })
|
|
763
|
-
},
|
|
764
|
-
index
|
|
765
|
-
);
|
|
766
|
-
}) })
|
|
849
|
+
children: [
|
|
850
|
+
showPlaceholderOption ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, hidden: true, children: placeholder || "" }) : void 0,
|
|
851
|
+
selectOptions.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.value, children: item.label }, item.value))
|
|
852
|
+
]
|
|
767
853
|
}
|
|
768
|
-
)
|
|
769
|
-
|
|
854
|
+
),
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx(react$1.NativeSelect.Indicator, {})
|
|
856
|
+
] })
|
|
770
857
|
}
|
|
771
858
|
);
|
|
772
859
|
}
|
|
@@ -1063,93 +1150,6 @@
|
|
|
1063
1150
|
}
|
|
1064
1151
|
);
|
|
1065
1152
|
}
|
|
1066
|
-
function NativeSelectWidget(props) {
|
|
1067
|
-
const {
|
|
1068
|
-
id,
|
|
1069
|
-
options,
|
|
1070
|
-
label,
|
|
1071
|
-
hideLabel,
|
|
1072
|
-
placeholder,
|
|
1073
|
-
multiple,
|
|
1074
|
-
required,
|
|
1075
|
-
disabled,
|
|
1076
|
-
readonly,
|
|
1077
|
-
value,
|
|
1078
|
-
autofocus,
|
|
1079
|
-
onChange,
|
|
1080
|
-
onBlur,
|
|
1081
|
-
onFocus,
|
|
1082
|
-
rawErrors = [],
|
|
1083
|
-
schema,
|
|
1084
|
-
uiSchema
|
|
1085
|
-
} = props;
|
|
1086
|
-
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1087
|
-
const _onChange = ({ target }) => {
|
|
1088
|
-
return onChange(utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
1089
|
-
};
|
|
1090
|
-
const _onBlur = ({ target }) => onBlur(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
1091
|
-
const _onFocus = ({ target }) => onFocus(id, utils.enumOptionsValueForIndex(target && target.value, enumOptions, emptyValue));
|
|
1092
|
-
const showPlaceholderOption = !multiple && schema.default === void 0;
|
|
1093
|
-
const { valueLabelMap, displayEnumOptions } = react.useMemo(() => {
|
|
1094
|
-
const valueLabelMap2 = {};
|
|
1095
|
-
let displayEnumOptions2 = [];
|
|
1096
|
-
if (Array.isArray(enumOptions)) {
|
|
1097
|
-
displayEnumOptions2 = enumOptions.map((option, index) => {
|
|
1098
|
-
const { value: value2, label: label2 } = option;
|
|
1099
|
-
valueLabelMap2[index] = label2 || String(value2);
|
|
1100
|
-
return {
|
|
1101
|
-
label: label2,
|
|
1102
|
-
value: String(index),
|
|
1103
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
|
|
1104
|
-
};
|
|
1105
|
-
});
|
|
1106
|
-
}
|
|
1107
|
-
return { valueLabelMap: valueLabelMap2, displayEnumOptions: displayEnumOptions2 };
|
|
1108
|
-
}, [enumDisabled, enumOptions]);
|
|
1109
|
-
const selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions, false);
|
|
1110
|
-
const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
|
|
1111
|
-
{
|
|
1112
|
-
label: valueLabelMap[selectedIndex] || "",
|
|
1113
|
-
value: selectedIndex.toString()
|
|
1114
|
-
}
|
|
1115
|
-
] : [];
|
|
1116
|
-
const formValue = getSingleValue()[0]?.value || "";
|
|
1117
|
-
const selectOptions = react$1.createListCollection({
|
|
1118
|
-
items: displayEnumOptions.filter((item) => item.value)
|
|
1119
|
-
});
|
|
1120
|
-
const chakraProps = getChakra({ });
|
|
1121
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1122
|
-
Field,
|
|
1123
|
-
{
|
|
1124
|
-
mb: 1,
|
|
1125
|
-
disabled: disabled || readonly,
|
|
1126
|
-
required,
|
|
1127
|
-
readOnly: readonly,
|
|
1128
|
-
invalid: rawErrors && rawErrors.length > 0,
|
|
1129
|
-
label: utils.labelValue(label, hideLabel || !label),
|
|
1130
|
-
...chakraProps,
|
|
1131
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.NativeSelect.Root, { children: [
|
|
1132
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1133
|
-
react$1.NativeSelect.Field,
|
|
1134
|
-
{
|
|
1135
|
-
id,
|
|
1136
|
-
onBlur: _onBlur,
|
|
1137
|
-
onChange: _onChange,
|
|
1138
|
-
onFocus: _onFocus,
|
|
1139
|
-
autoFocus: autofocus,
|
|
1140
|
-
value: formValue,
|
|
1141
|
-
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
1142
|
-
children: [
|
|
1143
|
-
showPlaceholderOption ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, hidden: true, children: placeholder || "" }) : void 0,
|
|
1144
|
-
selectOptions.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.value, children: item.label }, item.value))
|
|
1145
|
-
]
|
|
1146
|
-
}
|
|
1147
|
-
),
|
|
1148
|
-
/* @__PURE__ */ jsxRuntime.jsx(react$1.NativeSelect.Indicator, {})
|
|
1149
|
-
] })
|
|
1150
|
-
}
|
|
1151
|
-
);
|
|
1152
|
-
}
|
|
1153
1153
|
function TextareaWidget({
|
|
1154
1154
|
id,
|
|
1155
1155
|
htmlName,
|