@rjsf/chakra-ui 5.11.1 → 5.12.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 +845 -946
- package/dist/chakra-ui.esm.js.map +7 -1
- package/dist/chakra-ui.umd.js +1339 -0
- package/dist/index.js +1500 -5
- package/dist/index.js.map +7 -0
- package/lib/AddButton/AddButton.d.ts +3 -0
- package/lib/AddButton/AddButton.js +11 -0
- package/lib/AddButton/AddButton.js.map +1 -0
- package/lib/AddButton/index.d.ts +2 -0
- package/lib/AddButton/index.js +3 -0
- package/lib/AddButton/index.js.map +1 -0
- package/lib/AltDateTimeWidget/AltDateTimeWidget.d.ts +15 -0
- package/lib/AltDateTimeWidget/AltDateTimeWidget.js +9 -0
- package/lib/AltDateTimeWidget/AltDateTimeWidget.js.map +1 -0
- package/lib/AltDateTimeWidget/index.d.ts +2 -0
- package/lib/AltDateTimeWidget/index.js +3 -0
- package/lib/AltDateTimeWidget/index.js.map +1 -0
- package/lib/AltDateWidget/AltDateWidget.d.ts +15 -0
- package/lib/AltDateWidget/AltDateWidget.js +80 -0
- package/lib/AltDateWidget/AltDateWidget.js.map +1 -0
- package/lib/AltDateWidget/index.d.ts +2 -0
- package/lib/AltDateWidget/index.js +3 -0
- package/lib/AltDateWidget/index.js.map +1 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.d.ts +3 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js +13 -0
- package/lib/ArrayFieldItemTemplate/ArrayFieldItemTemplate.js.map +1 -0
- package/lib/ArrayFieldItemTemplate/index.d.ts +2 -0
- package/lib/ArrayFieldItemTemplate/index.js +3 -0
- package/lib/ArrayFieldItemTemplate/index.js.map +1 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.d.ts +3 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js +19 -0
- package/lib/ArrayFieldTemplate/ArrayFieldTemplate.js.map +1 -0
- package/lib/ArrayFieldTemplate/index.d.ts +2 -0
- package/lib/ArrayFieldTemplate/index.js +3 -0
- package/lib/ArrayFieldTemplate/index.js.map +1 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.d.ts +3 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.js +18 -0
- package/lib/BaseInputTemplate/BaseInputTemplate.js.map +1 -0
- package/lib/BaseInputTemplate/index.d.ts +2 -0
- package/lib/BaseInputTemplate/index.js +3 -0
- package/lib/BaseInputTemplate/index.js.map +1 -0
- package/lib/ChakraFrameProvider.d.ts +2 -0
- package/lib/ChakraFrameProvider.js +28 -0
- package/lib/ChakraFrameProvider.js.map +1 -0
- package/lib/CheckboxWidget/CheckboxWidget.d.ts +3 -0
- package/lib/CheckboxWidget/CheckboxWidget.js +19 -0
- package/lib/CheckboxWidget/CheckboxWidget.js.map +1 -0
- package/lib/CheckboxWidget/index.d.ts +2 -0
- package/lib/CheckboxWidget/index.js +3 -0
- package/lib/CheckboxWidget/index.js.map +1 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.d.ts +3 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.js +21 -0
- package/lib/CheckboxesWidget/CheckboxesWidget.js.map +1 -0
- package/lib/CheckboxesWidget/index.d.ts +2 -0
- package/lib/CheckboxesWidget/index.js +3 -0
- package/lib/CheckboxesWidget/index.js.map +1 -0
- package/lib/CssReset.d.ts +24 -0
- package/lib/CssReset.js +266 -0
- package/lib/CssReset.js.map +1 -0
- package/lib/DescriptionField/DescriptionField.d.ts +3 -0
- package/lib/DescriptionField/DescriptionField.js +12 -0
- package/lib/DescriptionField/DescriptionField.js.map +1 -0
- package/lib/DescriptionField/index.d.ts +2 -0
- package/lib/DescriptionField/index.js +3 -0
- package/lib/DescriptionField/index.js.map +1 -0
- package/lib/ErrorList/ErrorList.d.ts +3 -0
- package/lib/ErrorList/ErrorList.js +9 -0
- package/lib/ErrorList/ErrorList.js.map +1 -0
- package/lib/ErrorList/index.d.ts +2 -0
- package/lib/ErrorList/index.js +3 -0
- package/lib/ErrorList/index.js.map +1 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.d.ts +7 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js +18 -0
- package/lib/FieldErrorTemplate/FieldErrorTemplate.js.map +1 -0
- package/lib/FieldErrorTemplate/index.d.ts +2 -0
- package/lib/FieldErrorTemplate/index.js +3 -0
- package/lib/FieldErrorTemplate/index.js.map +1 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.d.ts +7 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js +16 -0
- package/lib/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -0
- package/lib/FieldHelpTemplate/index.d.ts +2 -0
- package/lib/FieldHelpTemplate/index.js +3 -0
- package/lib/FieldHelpTemplate/index.js.map +1 -0
- package/lib/FieldTemplate/FieldTemplate.d.ts +3 -0
- package/lib/FieldTemplate/FieldTemplate.js +13 -0
- package/lib/FieldTemplate/FieldTemplate.js.map +1 -0
- package/lib/FieldTemplate/index.d.ts +2 -0
- package/lib/FieldTemplate/index.js +3 -0
- package/lib/FieldTemplate/index.js.map +1 -0
- package/lib/Form/Form.d.ts +6 -0
- package/lib/Form/Form.js +7 -0
- package/lib/Form/Form.js.map +1 -0
- package/lib/Form/index.d.ts +2 -0
- package/lib/Form/index.js +3 -0
- package/lib/Form/index.js.map +1 -0
- package/lib/IconButton/ChakraIconButton.d.ts +8 -0
- package/lib/IconButton/ChakraIconButton.js +11 -0
- package/lib/IconButton/ChakraIconButton.js.map +1 -0
- package/lib/IconButton/IconButton.d.ts +6 -0
- package/lib/IconButton/IconButton.js +21 -0
- package/lib/IconButton/IconButton.js.map +1 -0
- package/lib/IconButton/index.d.ts +2 -0
- package/lib/IconButton/index.js +3 -0
- package/lib/IconButton/index.js.map +1 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.d.ts +3 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js +13 -0
- package/lib/ObjectFieldTemplate/ObjectFieldTemplate.js.map +1 -0
- package/lib/ObjectFieldTemplate/index.d.ts +2 -0
- package/lib/ObjectFieldTemplate/index.js +3 -0
- package/lib/ObjectFieldTemplate/index.js.map +1 -0
- package/lib/RadioWidget/RadioWidget.d.ts +3 -0
- package/lib/RadioWidget/RadioWidget.js +20 -0
- package/lib/RadioWidget/RadioWidget.js.map +1 -0
- package/lib/RadioWidget/index.d.ts +2 -0
- package/lib/RadioWidget/index.js +3 -0
- package/lib/RadioWidget/index.js.map +1 -0
- package/lib/RangeWidget/RangeWidget.d.ts +3 -0
- package/lib/RangeWidget/RangeWidget.js +13 -0
- package/lib/RangeWidget/RangeWidget.js.map +1 -0
- package/lib/RangeWidget/index.d.ts +2 -0
- package/lib/RangeWidget/index.js +3 -0
- package/lib/RangeWidget/index.js.map +1 -0
- package/lib/SelectWidget/SelectWidget.d.ts +3 -0
- package/lib/SelectWidget/SelectWidget.js +47 -0
- package/lib/SelectWidget/SelectWidget.js.map +1 -0
- package/lib/SelectWidget/index.d.ts +2 -0
- package/lib/SelectWidget/index.js +3 -0
- package/lib/SelectWidget/index.js.map +1 -0
- package/lib/SubmitButton/SubmitButton.d.ts +3 -0
- package/lib/SubmitButton/SubmitButton.js +11 -0
- package/lib/SubmitButton/SubmitButton.js.map +1 -0
- package/lib/SubmitButton/index.d.ts +2 -0
- package/lib/SubmitButton/index.js +3 -0
- package/lib/SubmitButton/index.js.map +1 -0
- package/lib/Templates/Templates.d.ts +4 -0
- package/lib/Templates/Templates.js +39 -0
- package/lib/Templates/Templates.js.map +1 -0
- package/lib/Templates/index.d.ts +2 -0
- package/lib/Templates/index.js +3 -0
- package/lib/Templates/index.js.map +1 -0
- package/lib/TextareaWidget/TextareaWidget.d.ts +3 -0
- package/lib/TextareaWidget/TextareaWidget.js +12 -0
- package/lib/TextareaWidget/TextareaWidget.js.map +1 -0
- package/lib/TextareaWidget/index.d.ts +2 -0
- package/lib/TextareaWidget/index.js +3 -0
- package/lib/TextareaWidget/index.js.map +1 -0
- package/lib/Theme/Theme.d.ts +5 -0
- package/lib/Theme/Theme.js +10 -0
- package/lib/Theme/Theme.js.map +1 -0
- package/lib/Theme/index.d.ts +2 -0
- package/lib/Theme/index.js +3 -0
- package/lib/Theme/index.js.map +1 -0
- package/lib/TitleField/TitleField.d.ts +3 -0
- package/lib/TitleField/TitleField.js +6 -0
- package/lib/TitleField/TitleField.js.map +1 -0
- package/lib/TitleField/index.d.ts +2 -0
- package/lib/TitleField/index.js +3 -0
- package/lib/TitleField/index.js.map +1 -0
- package/lib/UpDownWidget/UpDownWidget.d.ts +3 -0
- package/lib/UpDownWidget/UpDownWidget.js +13 -0
- package/lib/UpDownWidget/UpDownWidget.js.map +1 -0
- package/lib/UpDownWidget/index.d.ts +2 -0
- package/lib/UpDownWidget/index.js +3 -0
- package/lib/UpDownWidget/index.js.map +1 -0
- package/lib/Widgets/Widgets.d.ts +4 -0
- package/lib/Widgets/Widgets.js +24 -0
- package/lib/Widgets/Widgets.js.map +1 -0
- package/lib/Widgets/index.d.ts +2 -0
- package/lib/Widgets/index.js +3 -0
- package/lib/Widgets/index.js.map +1 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.d.ts +3 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js +17 -0
- package/lib/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.js.map +1 -0
- package/lib/WrapIfAdditionalTemplate/index.d.ts +2 -0
- package/lib/WrapIfAdditionalTemplate/index.js +3 -0
- package/lib/WrapIfAdditionalTemplate/index.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/utils.d.ts +13 -0
- package/lib/utils.js +18 -0
- package/lib/utils.js.map +1 -0
- package/package.json +22 -14
- package/src/AddButton/AddButton.tsx +16 -0
- package/src/AddButton/index.ts +2 -0
- package/src/AltDateTimeWidget/AltDateTimeWidget.tsx +16 -0
- package/src/AltDateTimeWidget/index.ts +2 -0
- package/src/AltDateWidget/AltDateWidget.tsx +165 -0
- package/src/AltDateWidget/index.ts +2 -0
- package/src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx +78 -0
- package/src/ArrayFieldItemTemplate/index.ts +2 -0
- package/src/ArrayFieldTemplate/ArrayFieldTemplate.tsx +79 -0
- package/src/ArrayFieldTemplate/index.ts +2 -0
- package/src/BaseInputTemplate/BaseInputTemplate.tsx +87 -0
- package/src/BaseInputTemplate/index.ts +2 -0
- package/src/ChakraFrameProvider.tsx +40 -0
- package/src/CheckboxWidget/CheckboxWidget.tsx +77 -0
- package/src/CheckboxWidget/index.ts +2 -0
- package/src/CheckboxesWidget/CheckboxesWidget.tsx +93 -0
- package/src/CheckboxesWidget/index.ts +2 -0
- package/src/CssReset.tsx +270 -0
- package/src/DescriptionField/DescriptionField.tsx +22 -0
- package/src/DescriptionField/index.ts +2 -0
- package/src/ErrorList/ErrorList.tsx +23 -0
- package/src/ErrorList/index.ts +2 -0
- package/src/FieldErrorTemplate/FieldErrorTemplate.tsx +30 -0
- package/src/FieldErrorTemplate/index.ts +2 -0
- package/src/FieldHelpTemplate/FieldHelpTemplate.tsx +19 -0
- package/src/FieldHelpTemplate/index.ts +2 -0
- package/src/FieldTemplate/FieldTemplate.tsx +72 -0
- package/src/FieldTemplate/index.ts +2 -0
- package/src/Form/Form.tsx +14 -0
- package/src/Form/index.ts +2 -0
- package/src/IconButton/ChakraIconButton.tsx +15 -0
- package/src/IconButton/IconButton.tsx +60 -0
- package/src/IconButton/index.ts +2 -0
- package/src/ObjectFieldTemplate/ObjectFieldTemplate.tsx +88 -0
- package/src/ObjectFieldTemplate/index.ts +2 -0
- package/src/RadioWidget/RadioWidget.tsx +78 -0
- package/src/RadioWidget/index.ts +2 -0
- package/src/RangeWidget/RangeWidget.tsx +56 -0
- package/src/RangeWidget/index.ts +2 -0
- package/src/SelectWidget/SelectWidget.tsx +121 -0
- package/src/SelectWidget/index.ts +2 -0
- package/src/SubmitButton/SubmitButton.tsx +21 -0
- package/src/SubmitButton/index.ts +2 -0
- package/src/Templates/Templates.ts +45 -0
- package/src/Templates/index.ts +2 -0
- package/src/TextareaWidget/TextareaWidget.tsx +64 -0
- package/src/TextareaWidget/index.ts +2 -0
- package/src/Theme/Theme.tsx +18 -0
- package/src/Theme/index.ts +2 -0
- package/src/TitleField/TitleField.tsx +14 -0
- package/src/TitleField/index.ts +2 -0
- package/src/UpDownWidget/UpDownWidget.tsx +58 -0
- package/src/UpDownWidget/index.ts +2 -0
- package/src/Widgets/Widgets.ts +30 -0
- package/src/Widgets/index.ts +2 -0
- package/src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx +76 -0
- package/src/WrapIfAdditionalTemplate/index.ts +2 -0
- package/src/index.ts +11 -0
- package/src/utils.ts +31 -0
- package/dist/chakra-ui.cjs.development.js +0 -1657
- package/dist/chakra-ui.cjs.development.js.map +0 -1
- package/dist/chakra-ui.cjs.production.min.js +0 -2
- package/dist/chakra-ui.cjs.production.min.js.map +0 -1
- package/dist/chakra-ui.umd.development.js +0 -1652
- package/dist/chakra-ui.umd.development.js.map +0 -1
- package/dist/chakra-ui.umd.production.min.js +0 -2
- package/dist/chakra-ui.umd.production.min.js.map +0 -1
- package/dist/index.d.ts +0 -28
package/dist/chakra-ui.esm.js
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { TranslatableString, getUiOptions, getTemplate, getInputProps, labelValue, examplesId, ariaDescribedByIds, errorId, helpId, titleId, descriptionId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, schemaRequiresTrueValue, enumOptionsIndexForValue, enumOptionsValueForIndex, enumOptionsIsSelected, optionId, rangeSpec } from '@rjsf/utils';
|
|
4
|
-
import { Button, HStack, Box, ButtonGroup, Grid, GridItem, shouldForwardProp, FormControl, FormLabel, Input, Text, Alert, AlertTitle, List, ListItem, ListIcon, IconButton, FormErrorMessage, FormHelperText, Heading, Divider, Checkbox, CheckboxGroup, Stack, RadioGroup, Radio, Slider, SliderTrack, SliderFilledTrack, SliderThumb, Textarea, NumberInput, NumberInputField, NumberInputStepper, NumberIncrementStepper, NumberDecrementStepper, ChakraProvider } from '@chakra-ui/react';
|
|
5
|
-
import { AddIcon, WarningIcon, CopyIcon, ArrowDownIcon, ArrowUpIcon, DeleteIcon } from '@chakra-ui/icons';
|
|
6
|
-
import { useMemo, memo, useState, useEffect } from 'react';
|
|
7
|
-
import { Select } from 'chakra-react-select';
|
|
8
|
-
import { Global, CacheProvider } from '@emotion/react';
|
|
9
|
-
import createCache from '@emotion/cache';
|
|
10
|
-
import weakMemoize from '@emotion/weak-memoize';
|
|
1
|
+
// src/Form/Form.tsx
|
|
2
|
+
import { withTheme } from "@rjsf/core";
|
|
11
3
|
|
|
4
|
+
// src/AddButton/AddButton.tsx
|
|
5
|
+
import { TranslatableString } from "@rjsf/utils";
|
|
6
|
+
import { Button } from "@chakra-ui/react";
|
|
7
|
+
import { AddIcon } from "@chakra-ui/icons";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
9
|
function AddButton({
|
|
13
10
|
uiSchema,
|
|
14
11
|
registry,
|
|
15
12
|
...props
|
|
16
13
|
}) {
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
} = registry;
|
|
20
|
-
return jsx(Button, {
|
|
21
|
-
leftIcon: jsx(AddIcon, {}),
|
|
22
|
-
...props,
|
|
23
|
-
children: translateString(TranslatableString.AddItemButton)
|
|
24
|
-
});
|
|
14
|
+
const { translateString } = registry;
|
|
15
|
+
return /* @__PURE__ */ jsx(Button, { leftIcon: /* @__PURE__ */ jsx(AddIcon, {}), ...props, children: translateString(TranslatableString.AddItemButton) });
|
|
25
16
|
}
|
|
26
17
|
|
|
18
|
+
// src/ArrayFieldItemTemplate/ArrayFieldItemTemplate.tsx
|
|
19
|
+
import { useMemo } from "react";
|
|
20
|
+
import { Box, ButtonGroup, HStack } from "@chakra-ui/react";
|
|
21
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
27
22
|
function ArrayFieldItemTemplate(props) {
|
|
28
23
|
const {
|
|
29
24
|
children,
|
|
@@ -41,127 +36,134 @@ function ArrayFieldItemTemplate(props) {
|
|
|
41
36
|
uiSchema,
|
|
42
37
|
registry
|
|
43
38
|
} = props;
|
|
44
|
-
const {
|
|
45
|
-
CopyButton,
|
|
46
|
-
MoveDownButton,
|
|
47
|
-
MoveUpButton,
|
|
48
|
-
RemoveButton
|
|
49
|
-
} = registry.templates.ButtonTemplates;
|
|
39
|
+
const { CopyButton: CopyButton2, MoveDownButton: MoveDownButton2, MoveUpButton: MoveUpButton2, RemoveButton: RemoveButton2 } = registry.templates.ButtonTemplates;
|
|
50
40
|
const onCopyClick = useMemo(() => onCopyIndexClick(index), [index, onCopyIndexClick]);
|
|
51
41
|
const onRemoveClick = useMemo(() => onDropIndexClick(index), [index, onDropIndexClick]);
|
|
52
42
|
const onArrowUpClick = useMemo(() => onReorderClick(index, index - 1), [index, onReorderClick]);
|
|
53
43
|
const onArrowDownClick = useMemo(() => onReorderClick(index, index + 1), [index, onReorderClick]);
|
|
54
|
-
return jsxs(HStack, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}), hasToolbar && jsx(Box, {
|
|
61
|
-
children: jsxs(ButtonGroup, {
|
|
62
|
-
isAttached: true,
|
|
63
|
-
mb: 1,
|
|
64
|
-
children: [(hasMoveUp || hasMoveDown) && jsx(MoveUpButton, {
|
|
44
|
+
return /* @__PURE__ */ jsxs(HStack, { alignItems: "flex-end", py: 1, children: [
|
|
45
|
+
/* @__PURE__ */ jsx2(Box, { w: "100%", children }),
|
|
46
|
+
hasToolbar && /* @__PURE__ */ jsx2(Box, { children: /* @__PURE__ */ jsxs(ButtonGroup, { isAttached: true, mb: 1, children: [
|
|
47
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx2(
|
|
48
|
+
MoveUpButton2,
|
|
49
|
+
{
|
|
65
50
|
disabled: disabled || readonly || !hasMoveUp,
|
|
66
51
|
onClick: onArrowUpClick,
|
|
67
|
-
uiSchema
|
|
68
|
-
registry
|
|
69
|
-
}
|
|
52
|
+
uiSchema,
|
|
53
|
+
registry
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
(hasMoveUp || hasMoveDown) && /* @__PURE__ */ jsx2(
|
|
57
|
+
MoveDownButton2,
|
|
58
|
+
{
|
|
70
59
|
disabled: disabled || readonly || !hasMoveDown,
|
|
71
60
|
onClick: onArrowDownClick,
|
|
72
|
-
uiSchema
|
|
73
|
-
registry
|
|
74
|
-
}
|
|
61
|
+
uiSchema,
|
|
62
|
+
registry
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
hasCopy && /* @__PURE__ */ jsx2(
|
|
66
|
+
CopyButton2,
|
|
67
|
+
{
|
|
75
68
|
disabled: disabled || readonly,
|
|
76
69
|
onClick: onCopyClick,
|
|
77
|
-
uiSchema
|
|
78
|
-
registry
|
|
79
|
-
}
|
|
70
|
+
uiSchema,
|
|
71
|
+
registry
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
hasRemove && /* @__PURE__ */ jsx2(
|
|
75
|
+
RemoveButton2,
|
|
76
|
+
{
|
|
80
77
|
disabled: disabled || readonly,
|
|
81
78
|
onClick: onRemoveClick,
|
|
82
|
-
uiSchema
|
|
83
|
-
registry
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
})
|
|
87
|
-
});
|
|
79
|
+
uiSchema,
|
|
80
|
+
registry
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] }) })
|
|
84
|
+
] });
|
|
88
85
|
}
|
|
89
86
|
|
|
87
|
+
// src/ArrayFieldTemplate/ArrayFieldTemplate.tsx
|
|
88
|
+
import { Box as Box2, Grid, GridItem } from "@chakra-ui/react";
|
|
89
|
+
import {
|
|
90
|
+
getTemplate,
|
|
91
|
+
getUiOptions
|
|
92
|
+
} from "@rjsf/utils";
|
|
93
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
90
94
|
function ArrayFieldTemplate(props) {
|
|
91
|
-
const {
|
|
92
|
-
canAdd,
|
|
93
|
-
disabled,
|
|
94
|
-
idSchema,
|
|
95
|
-
uiSchema,
|
|
96
|
-
items,
|
|
97
|
-
onAddClick,
|
|
98
|
-
readonly,
|
|
99
|
-
registry,
|
|
100
|
-
required,
|
|
101
|
-
schema,
|
|
102
|
-
title
|
|
103
|
-
} = props;
|
|
95
|
+
const { canAdd, disabled, idSchema, uiSchema, items, onAddClick, readonly, registry, required, schema, title } = props;
|
|
104
96
|
const uiOptions = getUiOptions(uiSchema);
|
|
105
|
-
const ArrayFieldDescriptionTemplate = getTemplate(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
const ArrayFieldDescriptionTemplate = getTemplate(
|
|
98
|
+
"ArrayFieldDescriptionTemplate",
|
|
99
|
+
registry,
|
|
100
|
+
uiOptions
|
|
101
|
+
);
|
|
102
|
+
const ArrayFieldItemTemplate2 = getTemplate(
|
|
103
|
+
"ArrayFieldItemTemplate",
|
|
104
|
+
registry,
|
|
105
|
+
uiOptions
|
|
106
|
+
);
|
|
107
|
+
const ArrayFieldTitleTemplate = getTemplate(
|
|
108
|
+
"ArrayFieldTitleTemplate",
|
|
109
|
+
registry,
|
|
110
|
+
uiOptions
|
|
111
|
+
);
|
|
109
112
|
const {
|
|
110
|
-
ButtonTemplates: {
|
|
111
|
-
AddButton
|
|
112
|
-
}
|
|
113
|
+
ButtonTemplates: { AddButton: AddButton2 }
|
|
113
114
|
} = registry.templates;
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
115
|
+
return /* @__PURE__ */ jsxs2(Box2, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx3(
|
|
117
|
+
ArrayFieldTitleTemplate,
|
|
118
|
+
{
|
|
119
|
+
idSchema,
|
|
120
|
+
title: uiOptions.title || title,
|
|
121
|
+
schema,
|
|
122
|
+
uiSchema,
|
|
123
|
+
required,
|
|
124
|
+
registry
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsx3(
|
|
128
|
+
ArrayFieldDescriptionTemplate,
|
|
129
|
+
{
|
|
130
|
+
idSchema,
|
|
131
|
+
description: uiOptions.description || schema.description,
|
|
132
|
+
schema,
|
|
133
|
+
uiSchema,
|
|
134
|
+
registry
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsxs2(Grid, { children: [
|
|
138
|
+
/* @__PURE__ */ jsx3(GridItem, { children: items.length > 0 && items.map(({ key, ...itemProps }) => /* @__PURE__ */ jsx3(ArrayFieldItemTemplate2, { ...itemProps }, key)) }),
|
|
139
|
+
canAdd && /* @__PURE__ */ jsx3(GridItem, { justifySelf: "flex-end", children: /* @__PURE__ */ jsx3(Box2, { mt: 2, children: /* @__PURE__ */ jsx3(
|
|
140
|
+
AddButton2,
|
|
141
|
+
{
|
|
142
|
+
className: "array-item-add",
|
|
143
|
+
onClick: onAddClick,
|
|
144
|
+
disabled: disabled || readonly,
|
|
145
|
+
uiSchema,
|
|
146
|
+
registry
|
|
147
|
+
}
|
|
148
|
+
) }) })
|
|
149
|
+
] }, `array-item-list-${idSchema.$id}`)
|
|
150
|
+
] });
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
154
|
+
import { FormControl, FormLabel, Input } from "@chakra-ui/react";
|
|
155
|
+
import {
|
|
156
|
+
ariaDescribedByIds,
|
|
157
|
+
examplesId,
|
|
158
|
+
labelValue,
|
|
159
|
+
getInputProps
|
|
160
|
+
} from "@rjsf/utils";
|
|
161
|
+
|
|
162
|
+
// src/utils.ts
|
|
163
|
+
import { shouldForwardProp } from "@chakra-ui/react";
|
|
164
|
+
function getChakra({ uiSchema = {} }) {
|
|
165
|
+
const chakraProps = uiSchema["ui:options"] && uiSchema["ui:options"].chakra || {};
|
|
166
|
+
Object.keys(chakraProps).forEach((key) => {
|
|
165
167
|
if (shouldForwardProp(key)) {
|
|
166
168
|
delete chakraProps[key];
|
|
167
169
|
}
|
|
@@ -169,6 +171,8 @@ function getChakra({
|
|
|
169
171
|
return chakraProps;
|
|
170
172
|
}
|
|
171
173
|
|
|
174
|
+
// src/BaseInputTemplate/BaseInputTemplate.tsx
|
|
175
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
172
176
|
function BaseInputTemplate(props) {
|
|
173
177
|
const {
|
|
174
178
|
id,
|
|
@@ -191,213 +195,176 @@ function BaseInputTemplate(props) {
|
|
|
191
195
|
disabled
|
|
192
196
|
} = props;
|
|
193
197
|
const inputProps = getInputProps(schema, type, options);
|
|
194
|
-
const chakraProps = getChakra({
|
|
195
|
-
|
|
196
|
-
});
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
198
|
+
const chakraProps = getChakra({ uiSchema });
|
|
199
|
+
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
200
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
|
|
201
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
|
|
202
|
+
return /* @__PURE__ */ jsxs3(
|
|
203
|
+
FormControl,
|
|
204
|
+
{
|
|
205
|
+
mb: 1,
|
|
206
|
+
...chakraProps,
|
|
207
|
+
isDisabled: disabled || readonly,
|
|
208
|
+
isRequired: required,
|
|
209
|
+
isReadOnly: readonly,
|
|
210
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
211
|
+
children: [
|
|
212
|
+
labelValue(
|
|
213
|
+
/* @__PURE__ */ jsx4(FormLabel, { htmlFor: id, id: `${id}-label`, children: label }),
|
|
214
|
+
hideLabel || !label
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx4(
|
|
217
|
+
Input,
|
|
218
|
+
{
|
|
219
|
+
id,
|
|
220
|
+
name: id,
|
|
221
|
+
value: value || value === 0 ? value : "",
|
|
222
|
+
onChange: onChangeOverride || _onChange,
|
|
223
|
+
onBlur: _onBlur,
|
|
224
|
+
onFocus: _onFocus,
|
|
225
|
+
autoFocus: autofocus,
|
|
226
|
+
placeholder,
|
|
227
|
+
...inputProps,
|
|
228
|
+
list: schema.examples ? examplesId(id) : void 0,
|
|
229
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
Array.isArray(schema.examples) ? /* @__PURE__ */ jsx4("datalist", { id: examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
|
|
233
|
+
return /* @__PURE__ */ jsx4("option", { value: example }, example);
|
|
234
|
+
}) }) : null
|
|
235
|
+
]
|
|
210
236
|
}
|
|
211
|
-
|
|
212
|
-
return jsxs(FormControl, {
|
|
213
|
-
mb: 1,
|
|
214
|
-
...chakraProps,
|
|
215
|
-
isDisabled: disabled || readonly,
|
|
216
|
-
isRequired: required,
|
|
217
|
-
isReadOnly: readonly,
|
|
218
|
-
isInvalid: rawErrors && rawErrors.length > 0,
|
|
219
|
-
children: [labelValue(jsx(FormLabel, {
|
|
220
|
-
htmlFor: id,
|
|
221
|
-
id: `${id}-label`,
|
|
222
|
-
children: label
|
|
223
|
-
}), hideLabel || !label), jsx(Input, {
|
|
224
|
-
id: id,
|
|
225
|
-
name: id,
|
|
226
|
-
value: value || value === 0 ? value : '',
|
|
227
|
-
onChange: onChangeOverride || _onChange,
|
|
228
|
-
onBlur: _onBlur,
|
|
229
|
-
onFocus: _onFocus,
|
|
230
|
-
autoFocus: autofocus,
|
|
231
|
-
placeholder: placeholder,
|
|
232
|
-
...inputProps,
|
|
233
|
-
list: schema.examples ? examplesId(id) : undefined,
|
|
234
|
-
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
235
|
-
}), Array.isArray(schema.examples) ? jsx("datalist", {
|
|
236
|
-
id: examplesId(id),
|
|
237
|
-
children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map(example => {
|
|
238
|
-
return jsx("option", {
|
|
239
|
-
value: example
|
|
240
|
-
}, example);
|
|
241
|
-
})
|
|
242
|
-
}) : null]
|
|
243
|
-
});
|
|
237
|
+
);
|
|
244
238
|
}
|
|
245
239
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}) {
|
|
240
|
+
// src/DescriptionField/DescriptionField.tsx
|
|
241
|
+
import { Text } from "@chakra-ui/react";
|
|
242
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
243
|
+
function DescriptionField({ description, id }) {
|
|
250
244
|
if (!description) {
|
|
251
245
|
return null;
|
|
252
246
|
}
|
|
253
|
-
if (typeof description ===
|
|
254
|
-
return
|
|
255
|
-
id: id,
|
|
256
|
-
mt: 2,
|
|
257
|
-
mb: 4,
|
|
258
|
-
children: description
|
|
259
|
-
});
|
|
247
|
+
if (typeof description === "string") {
|
|
248
|
+
return /* @__PURE__ */ jsx5(Text, { id, mt: 2, mb: 4, children: description });
|
|
260
249
|
}
|
|
261
|
-
return
|
|
262
|
-
children: description
|
|
263
|
-
});
|
|
250
|
+
return /* @__PURE__ */ jsx5(Fragment, { children: description });
|
|
264
251
|
}
|
|
265
252
|
|
|
253
|
+
// src/ErrorList/ErrorList.tsx
|
|
254
|
+
import { TranslatableString as TranslatableString2 } from "@rjsf/utils";
|
|
255
|
+
import { List, ListIcon, ListItem, Alert, AlertTitle } from "@chakra-ui/react";
|
|
256
|
+
import { WarningIcon } from "@chakra-ui/icons";
|
|
257
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
266
258
|
function ErrorList({
|
|
267
259
|
errors,
|
|
268
260
|
registry
|
|
269
261
|
}) {
|
|
270
|
-
const {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
children: [jsx(AlertTitle, {
|
|
279
|
-
children: translateString(TranslatableString.ErrorsLabel)
|
|
280
|
-
}), jsx(List, {
|
|
281
|
-
children: errors.map((error, i) => jsxs(ListItem, {
|
|
282
|
-
children: [jsx(ListIcon, {
|
|
283
|
-
as: WarningIcon,
|
|
284
|
-
color: 'red.500'
|
|
285
|
-
}), error.stack]
|
|
286
|
-
}, i))
|
|
287
|
-
})]
|
|
288
|
-
});
|
|
262
|
+
const { translateString } = registry;
|
|
263
|
+
return /* @__PURE__ */ jsxs4(Alert, { flexDirection: "column", alignItems: "flex-start", gap: 3, status: "error", children: [
|
|
264
|
+
/* @__PURE__ */ jsx6(AlertTitle, { children: translateString(TranslatableString2.ErrorsLabel) }),
|
|
265
|
+
/* @__PURE__ */ jsx6(List, { children: errors.map((error, i) => /* @__PURE__ */ jsxs4(ListItem, { children: [
|
|
266
|
+
/* @__PURE__ */ jsx6(ListIcon, { as: WarningIcon, color: "red.500" }),
|
|
267
|
+
error.stack
|
|
268
|
+
] }, i)) })
|
|
269
|
+
] });
|
|
289
270
|
}
|
|
290
271
|
|
|
272
|
+
// src/IconButton/ChakraIconButton.tsx
|
|
273
|
+
import { memo } from "react";
|
|
274
|
+
import { IconButton } from "@chakra-ui/react";
|
|
275
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
291
276
|
function ChakraIconButton(props) {
|
|
292
|
-
const {
|
|
293
|
-
|
|
294
|
-
iconType,
|
|
295
|
-
uiSchema,
|
|
296
|
-
registry,
|
|
297
|
-
...otherProps
|
|
298
|
-
} = props;
|
|
299
|
-
return jsx(IconButton, {
|
|
300
|
-
"aria-label": props.title,
|
|
301
|
-
...otherProps,
|
|
302
|
-
icon: icon
|
|
303
|
-
});
|
|
277
|
+
const { icon, iconType, uiSchema, registry, ...otherProps } = props;
|
|
278
|
+
return /* @__PURE__ */ jsx7(IconButton, { "aria-label": props.title, ...otherProps, icon });
|
|
304
279
|
}
|
|
305
|
-
ChakraIconButton.displayName =
|
|
306
|
-
var
|
|
280
|
+
ChakraIconButton.displayName = "ChakraIconButton";
|
|
281
|
+
var ChakraIconButton_default = memo(ChakraIconButton);
|
|
307
282
|
|
|
283
|
+
// src/IconButton/IconButton.tsx
|
|
284
|
+
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
285
|
+
import { ArrowUpIcon, ArrowDownIcon, CopyIcon, DeleteIcon } from "@chakra-ui/icons";
|
|
286
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
308
287
|
function CopyButton(props) {
|
|
309
288
|
const {
|
|
310
|
-
registry: {
|
|
311
|
-
translateString
|
|
312
|
-
}
|
|
289
|
+
registry: { translateString }
|
|
313
290
|
} = props;
|
|
314
|
-
return
|
|
315
|
-
title: translateString(TranslatableString.CopyButton),
|
|
316
|
-
...props,
|
|
317
|
-
icon: jsx(CopyIcon, {})
|
|
318
|
-
});
|
|
291
|
+
return /* @__PURE__ */ jsx8(ChakraIconButton_default, { title: translateString(TranslatableString3.CopyButton), ...props, icon: /* @__PURE__ */ jsx8(CopyIcon, {}) });
|
|
319
292
|
}
|
|
320
293
|
function MoveDownButton(props) {
|
|
321
294
|
const {
|
|
322
|
-
registry: {
|
|
323
|
-
translateString
|
|
324
|
-
}
|
|
295
|
+
registry: { translateString }
|
|
325
296
|
} = props;
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
297
|
+
return /* @__PURE__ */ jsx8(
|
|
298
|
+
ChakraIconButton_default,
|
|
299
|
+
{
|
|
300
|
+
title: translateString(TranslatableString3.MoveDownButton),
|
|
301
|
+
...props,
|
|
302
|
+
icon: /* @__PURE__ */ jsx8(ArrowDownIcon, {})
|
|
303
|
+
}
|
|
304
|
+
);
|
|
331
305
|
}
|
|
332
306
|
function MoveUpButton(props) {
|
|
333
307
|
const {
|
|
334
|
-
registry: {
|
|
335
|
-
translateString
|
|
336
|
-
}
|
|
308
|
+
registry: { translateString }
|
|
337
309
|
} = props;
|
|
338
|
-
return
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
310
|
+
return /* @__PURE__ */ jsx8(
|
|
311
|
+
ChakraIconButton_default,
|
|
312
|
+
{
|
|
313
|
+
title: translateString(TranslatableString3.MoveUpButton),
|
|
314
|
+
...props,
|
|
315
|
+
icon: /* @__PURE__ */ jsx8(ArrowUpIcon, {})
|
|
316
|
+
}
|
|
317
|
+
);
|
|
343
318
|
}
|
|
344
319
|
function RemoveButton(props) {
|
|
345
320
|
const {
|
|
346
|
-
registry: {
|
|
347
|
-
translateString
|
|
348
|
-
}
|
|
321
|
+
registry: { translateString }
|
|
349
322
|
} = props;
|
|
350
|
-
return
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
323
|
+
return /* @__PURE__ */ jsx8(
|
|
324
|
+
ChakraIconButton_default,
|
|
325
|
+
{
|
|
326
|
+
title: translateString(TranslatableString3.RemoveButton),
|
|
327
|
+
...props,
|
|
328
|
+
icon: /* @__PURE__ */ jsx8(DeleteIcon, {})
|
|
329
|
+
}
|
|
330
|
+
);
|
|
355
331
|
}
|
|
356
332
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
333
|
+
// src/FieldErrorTemplate/FieldErrorTemplate.tsx
|
|
334
|
+
import { errorId } from "@rjsf/utils";
|
|
335
|
+
import { FormErrorMessage, List as List2, ListItem as ListItem2 } from "@chakra-ui/react";
|
|
336
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
361
337
|
function FieldErrorTemplate(props) {
|
|
362
|
-
const {
|
|
363
|
-
errors = [],
|
|
364
|
-
idSchema
|
|
365
|
-
} = props;
|
|
338
|
+
const { errors = [], idSchema } = props;
|
|
366
339
|
if (errors.length === 0) {
|
|
367
340
|
return null;
|
|
368
341
|
}
|
|
369
342
|
const id = errorId(idSchema);
|
|
370
|
-
return
|
|
371
|
-
children:
|
|
372
|
-
|
|
373
|
-
children: jsx(FormErrorMessage, {
|
|
374
|
-
id: id,
|
|
375
|
-
children: error
|
|
376
|
-
})
|
|
377
|
-
}, i);
|
|
378
|
-
})
|
|
379
|
-
});
|
|
343
|
+
return /* @__PURE__ */ jsx9(List2, { children: errors.map((error, i) => {
|
|
344
|
+
return /* @__PURE__ */ jsx9(ListItem2, { children: /* @__PURE__ */ jsx9(FormErrorMessage, { id, children: error }) }, i);
|
|
345
|
+
}) });
|
|
380
346
|
}
|
|
381
347
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
348
|
+
// src/FieldHelpTemplate/FieldHelpTemplate.tsx
|
|
349
|
+
import { helpId } from "@rjsf/utils";
|
|
350
|
+
import { FormHelperText } from "@chakra-ui/react";
|
|
351
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
386
352
|
function FieldHelpTemplate(props) {
|
|
387
|
-
const {
|
|
388
|
-
idSchema,
|
|
389
|
-
help
|
|
390
|
-
} = props;
|
|
353
|
+
const { idSchema, help } = props;
|
|
391
354
|
if (!help) {
|
|
392
355
|
return null;
|
|
393
356
|
}
|
|
394
357
|
const id = helpId(idSchema);
|
|
395
|
-
return
|
|
396
|
-
id: id,
|
|
397
|
-
children: help
|
|
398
|
-
});
|
|
358
|
+
return /* @__PURE__ */ jsx10(FormHelperText, { id, children: help });
|
|
399
359
|
}
|
|
400
360
|
|
|
361
|
+
// src/FieldTemplate/FieldTemplate.tsx
|
|
362
|
+
import {
|
|
363
|
+
getTemplate as getTemplate2,
|
|
364
|
+
getUiOptions as getUiOptions2
|
|
365
|
+
} from "@rjsf/utils";
|
|
366
|
+
import { Text as Text2, FormControl as FormControl2 } from "@chakra-ui/react";
|
|
367
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
401
368
|
function FieldTemplate(props) {
|
|
402
369
|
const {
|
|
403
370
|
id,
|
|
@@ -421,40 +388,50 @@ function FieldTemplate(props) {
|
|
|
421
388
|
schema,
|
|
422
389
|
uiSchema
|
|
423
390
|
} = props;
|
|
424
|
-
const uiOptions =
|
|
425
|
-
const
|
|
391
|
+
const uiOptions = getUiOptions2(uiSchema);
|
|
392
|
+
const WrapIfAdditionalTemplate2 = getTemplate2(
|
|
393
|
+
"WrapIfAdditionalTemplate",
|
|
394
|
+
registry,
|
|
395
|
+
uiOptions
|
|
396
|
+
);
|
|
426
397
|
if (hidden) {
|
|
427
|
-
return
|
|
428
|
-
style: {
|
|
429
|
-
display: 'none'
|
|
430
|
-
},
|
|
431
|
-
children: children
|
|
432
|
-
});
|
|
398
|
+
return /* @__PURE__ */ jsx11("div", { style: { display: "none" }, children });
|
|
433
399
|
}
|
|
434
|
-
return
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
isInvalid: rawErrors && rawErrors.length > 0,
|
|
450
|
-
|
|
451
|
-
mt: 2,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
400
|
+
return /* @__PURE__ */ jsx11(
|
|
401
|
+
WrapIfAdditionalTemplate2,
|
|
402
|
+
{
|
|
403
|
+
classNames,
|
|
404
|
+
style,
|
|
405
|
+
disabled,
|
|
406
|
+
id,
|
|
407
|
+
label,
|
|
408
|
+
onDropPropertyClick,
|
|
409
|
+
onKeyChange,
|
|
410
|
+
readonly,
|
|
411
|
+
required,
|
|
412
|
+
schema,
|
|
413
|
+
uiSchema,
|
|
414
|
+
registry,
|
|
415
|
+
children: /* @__PURE__ */ jsxs5(FormControl2, { isRequired: required, isInvalid: rawErrors && rawErrors.length > 0, children: [
|
|
416
|
+
children,
|
|
417
|
+
displayLabel && rawDescription ? /* @__PURE__ */ jsx11(Text2, { mt: 2, children: description }) : null,
|
|
418
|
+
errors,
|
|
419
|
+
help
|
|
420
|
+
] })
|
|
421
|
+
}
|
|
422
|
+
);
|
|
456
423
|
}
|
|
457
424
|
|
|
425
|
+
// src/ObjectFieldTemplate/ObjectFieldTemplate.tsx
|
|
426
|
+
import { Grid as Grid2, GridItem as GridItem2 } from "@chakra-ui/react";
|
|
427
|
+
import {
|
|
428
|
+
canExpand,
|
|
429
|
+
descriptionId,
|
|
430
|
+
getTemplate as getTemplate3,
|
|
431
|
+
getUiOptions as getUiOptions3,
|
|
432
|
+
titleId
|
|
433
|
+
} from "@rjsf/utils";
|
|
434
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
458
435
|
function ObjectFieldTemplate(props) {
|
|
459
436
|
const {
|
|
460
437
|
description,
|
|
@@ -470,85 +447,88 @@ function ObjectFieldTemplate(props) {
|
|
|
470
447
|
onAddClick,
|
|
471
448
|
registry
|
|
472
449
|
} = props;
|
|
473
|
-
const uiOptions =
|
|
474
|
-
const TitleFieldTemplate =
|
|
475
|
-
const DescriptionFieldTemplate =
|
|
476
|
-
|
|
450
|
+
const uiOptions = getUiOptions3(uiSchema);
|
|
451
|
+
const TitleFieldTemplate = getTemplate3("TitleFieldTemplate", registry, uiOptions);
|
|
452
|
+
const DescriptionFieldTemplate = getTemplate3(
|
|
453
|
+
"DescriptionFieldTemplate",
|
|
454
|
+
registry,
|
|
455
|
+
uiOptions
|
|
456
|
+
);
|
|
477
457
|
const {
|
|
478
|
-
ButtonTemplates: {
|
|
479
|
-
AddButton
|
|
480
|
-
}
|
|
458
|
+
ButtonTemplates: { AddButton: AddButton2 }
|
|
481
459
|
} = registry.templates;
|
|
482
|
-
return
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
460
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
461
|
+
title && /* @__PURE__ */ jsx12(
|
|
462
|
+
TitleFieldTemplate,
|
|
463
|
+
{
|
|
464
|
+
id: titleId(idSchema),
|
|
465
|
+
title,
|
|
466
|
+
required,
|
|
467
|
+
schema,
|
|
468
|
+
uiSchema,
|
|
469
|
+
registry
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
description && /* @__PURE__ */ jsx12(
|
|
473
|
+
DescriptionFieldTemplate,
|
|
474
|
+
{
|
|
475
|
+
id: descriptionId(idSchema),
|
|
476
|
+
description,
|
|
477
|
+
schema,
|
|
478
|
+
uiSchema,
|
|
479
|
+
registry
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
/* @__PURE__ */ jsxs6(Grid2, { gap: description ? 2 : 6, mb: 4, children: [
|
|
483
|
+
properties.map(
|
|
484
|
+
(element, index) => element.hidden ? element.content : /* @__PURE__ */ jsx12(GridItem2, { children: element.content }, `${idSchema.$id}-${element.name}-${index}`)
|
|
485
|
+
),
|
|
486
|
+
canExpand(schema, uiSchema, formData) && /* @__PURE__ */ jsx12(GridItem2, { justifySelf: "flex-end", children: /* @__PURE__ */ jsx12(
|
|
487
|
+
AddButton2,
|
|
488
|
+
{
|
|
489
|
+
className: "object-property-expand",
|
|
505
490
|
onClick: onAddClick(schema),
|
|
506
491
|
disabled: disabled || readonly,
|
|
507
|
-
uiSchema
|
|
508
|
-
registry
|
|
509
|
-
}
|
|
510
|
-
})
|
|
511
|
-
})
|
|
512
|
-
});
|
|
492
|
+
uiSchema,
|
|
493
|
+
registry
|
|
494
|
+
}
|
|
495
|
+
) })
|
|
496
|
+
] })
|
|
497
|
+
] });
|
|
513
498
|
}
|
|
514
499
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
props: submitButtonProps
|
|
522
|
-
} = getSubmitButtonOptions(uiSchema);
|
|
500
|
+
// src/SubmitButton/SubmitButton.tsx
|
|
501
|
+
import { Box as Box3, Button as Button2 } from "@chakra-ui/react";
|
|
502
|
+
import { getSubmitButtonOptions } from "@rjsf/utils";
|
|
503
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
504
|
+
function SubmitButton({ uiSchema }) {
|
|
505
|
+
const { submitText, norender, props: submitButtonProps } = getSubmitButtonOptions(uiSchema);
|
|
523
506
|
if (norender) {
|
|
524
507
|
return null;
|
|
525
508
|
}
|
|
526
|
-
return
|
|
527
|
-
marginTop: 3,
|
|
528
|
-
children: jsx(Button, {
|
|
529
|
-
type: 'submit',
|
|
530
|
-
variant: 'solid',
|
|
531
|
-
...submitButtonProps,
|
|
532
|
-
children: submitText
|
|
533
|
-
})
|
|
534
|
-
});
|
|
509
|
+
return /* @__PURE__ */ jsx13(Box3, { marginTop: 3, children: /* @__PURE__ */ jsx13(Button2, { type: "submit", variant: "solid", ...submitButtonProps, children: submitText }) });
|
|
535
510
|
}
|
|
536
511
|
|
|
512
|
+
// src/TitleField/TitleField.tsx
|
|
513
|
+
import { Box as Box4, Divider, Heading } from "@chakra-ui/react";
|
|
514
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
537
515
|
function TitleField({
|
|
538
516
|
id,
|
|
539
517
|
title
|
|
540
518
|
}) {
|
|
541
|
-
return
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
children: [jsx(Heading, {
|
|
546
|
-
as: 'h5',
|
|
547
|
-
children: title
|
|
548
|
-
}), jsx(Divider, {})]
|
|
549
|
-
});
|
|
519
|
+
return /* @__PURE__ */ jsxs7(Box4, { id, mt: 1, mb: 4, children: [
|
|
520
|
+
/* @__PURE__ */ jsx14(Heading, { as: "h5", children: title }),
|
|
521
|
+
/* @__PURE__ */ jsx14(Divider, {})
|
|
522
|
+
] });
|
|
550
523
|
}
|
|
551
524
|
|
|
525
|
+
// src/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
|
|
526
|
+
import {
|
|
527
|
+
ADDITIONAL_PROPERTY_FLAG,
|
|
528
|
+
TranslatableString as TranslatableString4
|
|
529
|
+
} from "@rjsf/utils";
|
|
530
|
+
import { FormControl as FormControl3, FormLabel as FormLabel2, Grid as Grid3, GridItem as GridItem3, Input as Input2 } from "@chakra-ui/react";
|
|
531
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
552
532
|
function WrapIfAdditionalTemplate(props) {
|
|
553
533
|
const {
|
|
554
534
|
children,
|
|
@@ -565,61 +545,44 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
565
545
|
schema,
|
|
566
546
|
uiSchema
|
|
567
547
|
} = props;
|
|
568
|
-
const {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
// Button templates are not overridden in the uiSchema
|
|
573
|
-
const {
|
|
574
|
-
RemoveButton
|
|
575
|
-
} = templates.ButtonTemplates;
|
|
576
|
-
const keyLabel = translateString(TranslatableString.KeyLabel, [label]);
|
|
577
|
-
const additional = (ADDITIONAL_PROPERTY_FLAG in schema);
|
|
548
|
+
const { templates, translateString } = registry;
|
|
549
|
+
const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
|
|
550
|
+
const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
|
|
551
|
+
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
|
578
552
|
if (!additional) {
|
|
579
|
-
return
|
|
580
|
-
className: classNames,
|
|
581
|
-
style: style,
|
|
582
|
-
children: children
|
|
583
|
-
});
|
|
553
|
+
return /* @__PURE__ */ jsx15("div", { className: classNames, style, children });
|
|
584
554
|
}
|
|
585
|
-
const handleBlur = ({
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
gap: 2,
|
|
593
|
-
children: [jsx(GridItem, {
|
|
594
|
-
children: jsxs(FormControl, {
|
|
595
|
-
isRequired: required,
|
|
596
|
-
children: [jsx(FormLabel, {
|
|
597
|
-
htmlFor: `${id}-key`,
|
|
598
|
-
id: `${id}-key-label`,
|
|
599
|
-
children: keyLabel
|
|
600
|
-
}), jsx(Input, {
|
|
555
|
+
const handleBlur = ({ target }) => onKeyChange(target.value);
|
|
556
|
+
return /* @__PURE__ */ jsxs8(Grid3, { className: classNames, style, alignItems: "center", gap: 2, children: [
|
|
557
|
+
/* @__PURE__ */ jsx15(GridItem3, { children: /* @__PURE__ */ jsxs8(FormControl3, { isRequired: required, children: [
|
|
558
|
+
/* @__PURE__ */ jsx15(FormLabel2, { htmlFor: `${id}-key`, id: `${id}-key-label`, children: keyLabel }),
|
|
559
|
+
/* @__PURE__ */ jsx15(
|
|
560
|
+
Input2,
|
|
561
|
+
{
|
|
601
562
|
defaultValue: label,
|
|
602
563
|
disabled: disabled || readonly,
|
|
603
564
|
id: `${id}-key`,
|
|
604
565
|
name: `${id}-key`,
|
|
605
|
-
onBlur: !readonly ? handleBlur :
|
|
606
|
-
type:
|
|
566
|
+
onBlur: !readonly ? handleBlur : void 0,
|
|
567
|
+
type: "text",
|
|
607
568
|
mb: 1
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
})
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
] }) }),
|
|
572
|
+
/* @__PURE__ */ jsx15(GridItem3, { children }),
|
|
573
|
+
/* @__PURE__ */ jsx15(GridItem3, { children: /* @__PURE__ */ jsx15(
|
|
574
|
+
RemoveButton2,
|
|
575
|
+
{
|
|
614
576
|
disabled: disabled || readonly,
|
|
615
577
|
onClick: onDropPropertyClick(label),
|
|
616
|
-
uiSchema
|
|
617
|
-
registry
|
|
618
|
-
}
|
|
619
|
-
})
|
|
620
|
-
}, `${id}-key`);
|
|
578
|
+
uiSchema,
|
|
579
|
+
registry
|
|
580
|
+
}
|
|
581
|
+
) })
|
|
582
|
+
] }, `${id}-key`);
|
|
621
583
|
}
|
|
622
584
|
|
|
585
|
+
// src/Templates/Templates.ts
|
|
623
586
|
function generateTemplates() {
|
|
624
587
|
return {
|
|
625
588
|
ArrayFieldItemTemplate,
|
|
@@ -643,59 +606,52 @@ function generateTemplates() {
|
|
|
643
606
|
WrapIfAdditionalTemplate
|
|
644
607
|
};
|
|
645
608
|
}
|
|
646
|
-
var
|
|
609
|
+
var Templates_default = generateTemplates();
|
|
647
610
|
|
|
648
|
-
|
|
611
|
+
// src/AltDateWidget/AltDateWidget.tsx
|
|
612
|
+
import { useEffect, useState } from "react";
|
|
613
|
+
import {
|
|
614
|
+
ariaDescribedByIds as ariaDescribedByIds2,
|
|
615
|
+
pad,
|
|
616
|
+
parseDateString,
|
|
617
|
+
toDateString,
|
|
618
|
+
TranslatableString as TranslatableString5
|
|
619
|
+
} from "@rjsf/utils";
|
|
620
|
+
import { Box as Box5, Button as Button3 } from "@chakra-ui/react";
|
|
621
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
622
|
+
var rangeOptions = (start, stop) => {
|
|
649
623
|
const options = [];
|
|
650
624
|
for (let i = start; i <= stop; i++) {
|
|
651
|
-
options.push({
|
|
652
|
-
value: i,
|
|
653
|
-
label: pad(i, 2)
|
|
654
|
-
});
|
|
625
|
+
options.push({ value: i, label: pad(i, 2) });
|
|
655
626
|
}
|
|
656
627
|
return options;
|
|
657
628
|
};
|
|
658
629
|
function DateElement(props) {
|
|
659
|
-
const {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
});
|
|
630
|
+
const { SelectWidget: SelectWidget2 } = props.registry.widgets;
|
|
631
|
+
const value = props.value ? props.value : void 0;
|
|
632
|
+
return /* @__PURE__ */ jsx16(
|
|
633
|
+
SelectWidget2,
|
|
634
|
+
{
|
|
635
|
+
...props,
|
|
636
|
+
label: "",
|
|
637
|
+
className: "form-control",
|
|
638
|
+
onChange: (elemValue) => props.select(props.type, elemValue),
|
|
639
|
+
options: {
|
|
640
|
+
enumOptions: rangeOptions(props.range[0], props.range[1])
|
|
641
|
+
},
|
|
642
|
+
placeholder: props.type,
|
|
643
|
+
schema: { type: "integer" },
|
|
644
|
+
value,
|
|
645
|
+
"aria-describedby": ariaDescribedByIds2(props.name)
|
|
646
|
+
}
|
|
647
|
+
);
|
|
678
648
|
}
|
|
679
|
-
|
|
680
|
-
return Object.keys(state).every(key => typeof state[key] !==
|
|
649
|
+
var readyForChange = (state) => {
|
|
650
|
+
return Object.keys(state).every((key) => typeof state[key] !== "undefined" && state[key] !== -1);
|
|
681
651
|
};
|
|
682
652
|
function AltDateWidget(props) {
|
|
683
|
-
const {
|
|
684
|
-
|
|
685
|
-
disabled,
|
|
686
|
-
id,
|
|
687
|
-
onBlur,
|
|
688
|
-
onChange,
|
|
689
|
-
onFocus,
|
|
690
|
-
options,
|
|
691
|
-
readonly,
|
|
692
|
-
registry,
|
|
693
|
-
showTime,
|
|
694
|
-
value
|
|
695
|
-
} = props;
|
|
696
|
-
const {
|
|
697
|
-
translateString
|
|
698
|
-
} = registry;
|
|
653
|
+
const { autofocus, disabled, id, onBlur, onChange, onFocus, options, readonly, registry, showTime, value } = props;
|
|
654
|
+
const { translateString } = registry;
|
|
699
655
|
const [state, setState] = useState(parseDateString(value, showTime));
|
|
700
656
|
useEffect(() => {
|
|
701
657
|
setState(parseDateString(value, showTime));
|
|
@@ -703,7 +659,7 @@ function AltDateWidget(props) {
|
|
|
703
659
|
const handleChange = (property, nextValue) => {
|
|
704
660
|
const nextState = {
|
|
705
661
|
...state,
|
|
706
|
-
[property]: typeof nextValue ===
|
|
662
|
+
[property]: typeof nextValue === "undefined" ? -1 : nextValue
|
|
707
663
|
};
|
|
708
664
|
if (readyForChange(nextState)) {
|
|
709
665
|
onChange(toDateString(nextState, showTime));
|
|
@@ -711,98 +667,63 @@ function AltDateWidget(props) {
|
|
|
711
667
|
setState(nextState);
|
|
712
668
|
}
|
|
713
669
|
};
|
|
714
|
-
const handleNow = event => {
|
|
670
|
+
const handleNow = (event) => {
|
|
715
671
|
event.preventDefault();
|
|
716
672
|
if (disabled || readonly) {
|
|
717
673
|
return;
|
|
718
674
|
}
|
|
719
|
-
const nextState = parseDateString(new Date().toJSON(), showTime);
|
|
675
|
+
const nextState = parseDateString((/* @__PURE__ */ new Date()).toJSON(), showTime);
|
|
720
676
|
onChange(toDateString(nextState, showTime));
|
|
721
677
|
};
|
|
722
|
-
const handleClear = event => {
|
|
678
|
+
const handleClear = (event) => {
|
|
723
679
|
event.preventDefault();
|
|
724
680
|
if (disabled || readonly) {
|
|
725
681
|
return;
|
|
726
682
|
}
|
|
727
|
-
onChange(
|
|
683
|
+
onChange(void 0);
|
|
728
684
|
};
|
|
729
685
|
const dateElementProps = () => {
|
|
730
|
-
const {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
second
|
|
737
|
-
} = state;
|
|
738
|
-
const data = [{
|
|
739
|
-
type: 'year',
|
|
740
|
-
range: options.yearsRange,
|
|
741
|
-
value: year
|
|
742
|
-
}, {
|
|
743
|
-
type: 'month',
|
|
744
|
-
range: [1, 12],
|
|
745
|
-
value: month
|
|
746
|
-
}, {
|
|
747
|
-
type: 'day',
|
|
748
|
-
range: [1, 31],
|
|
749
|
-
value: day
|
|
750
|
-
}];
|
|
686
|
+
const { year, month, day, hour, minute, second } = state;
|
|
687
|
+
const data = [
|
|
688
|
+
{ type: "year", range: options.yearsRange, value: year },
|
|
689
|
+
{ type: "month", range: [1, 12], value: month },
|
|
690
|
+
{ type: "day", range: [1, 31], value: day }
|
|
691
|
+
];
|
|
751
692
|
if (showTime) {
|
|
752
|
-
data.push(
|
|
753
|
-
type:
|
|
754
|
-
range: [0,
|
|
755
|
-
value:
|
|
756
|
-
|
|
757
|
-
type: 'minute',
|
|
758
|
-
range: [0, 59],
|
|
759
|
-
value: minute
|
|
760
|
-
}, {
|
|
761
|
-
type: 'second',
|
|
762
|
-
range: [0, 59],
|
|
763
|
-
value: second
|
|
764
|
-
});
|
|
693
|
+
data.push(
|
|
694
|
+
{ type: "hour", range: [0, 23], value: hour },
|
|
695
|
+
{ type: "minute", range: [0, 59], value: minute },
|
|
696
|
+
{ type: "second", range: [0, 59], value: second }
|
|
697
|
+
);
|
|
765
698
|
}
|
|
766
699
|
return data;
|
|
767
700
|
};
|
|
768
|
-
return
|
|
769
|
-
children:
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}), jsxs(Box, {
|
|
795
|
-
display: 'flex',
|
|
796
|
-
children: [!options.hideNowButton && jsx(Button, {
|
|
797
|
-
onClick: e => handleNow(e),
|
|
798
|
-
mr: '2',
|
|
799
|
-
children: translateString(TranslatableString.NowLabel)
|
|
800
|
-
}), !options.hideClearButton && jsx(Button, {
|
|
801
|
-
onClick: e => handleClear(e),
|
|
802
|
-
children: translateString(TranslatableString.ClearLabel)
|
|
803
|
-
})]
|
|
804
|
-
})]
|
|
805
|
-
});
|
|
701
|
+
return /* @__PURE__ */ jsxs9(Box5, { children: [
|
|
702
|
+
/* @__PURE__ */ jsx16(Box5, { display: "flex", flexWrap: "wrap", alignItems: "center", children: dateElementProps().map((elemProps, i) => {
|
|
703
|
+
const elemId = id + "_" + elemProps.type;
|
|
704
|
+
return /* @__PURE__ */ jsx16(Box5, { mr: "2", mb: "2", children: /* @__PURE__ */ jsx16(
|
|
705
|
+
DateElement,
|
|
706
|
+
{
|
|
707
|
+
...props,
|
|
708
|
+
...elemProps,
|
|
709
|
+
autofocus: autofocus && i === 0,
|
|
710
|
+
disabled,
|
|
711
|
+
id: elemId,
|
|
712
|
+
name: id,
|
|
713
|
+
onBlur,
|
|
714
|
+
onFocus,
|
|
715
|
+
readonly,
|
|
716
|
+
registry,
|
|
717
|
+
select: handleChange,
|
|
718
|
+
value: elemProps.value < 0 ? "" : elemProps.value
|
|
719
|
+
}
|
|
720
|
+
) }, elemId);
|
|
721
|
+
}) }),
|
|
722
|
+
/* @__PURE__ */ jsxs9(Box5, { display: "flex", children: [
|
|
723
|
+
!options.hideNowButton && /* @__PURE__ */ jsx16(Button3, { onClick: (e) => handleNow(e), mr: "2", children: translateString(TranslatableString5.NowLabel) }),
|
|
724
|
+
!options.hideClearButton && /* @__PURE__ */ jsx16(Button3, { onClick: (e) => handleClear(e), children: translateString(TranslatableString5.ClearLabel) })
|
|
725
|
+
] })
|
|
726
|
+
] });
|
|
806
727
|
}
|
|
807
728
|
AltDateWidget.defaultProps = {
|
|
808
729
|
autofocus: false,
|
|
@@ -810,24 +731,33 @@ AltDateWidget.defaultProps = {
|
|
|
810
731
|
readonly: false,
|
|
811
732
|
showTime: false,
|
|
812
733
|
options: {
|
|
813
|
-
yearsRange: [1900,
|
|
734
|
+
yearsRange: [1900, (/* @__PURE__ */ new Date()).getFullYear() + 2]
|
|
814
735
|
}
|
|
815
736
|
};
|
|
737
|
+
var AltDateWidget_default = AltDateWidget;
|
|
816
738
|
|
|
739
|
+
// src/AltDateTimeWidget/AltDateTimeWidget.tsx
|
|
740
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
817
741
|
function AltDateTimeWidget(props) {
|
|
818
|
-
const {
|
|
819
|
-
|
|
820
|
-
} = props.registry.widgets;
|
|
821
|
-
return jsx(AltDateWidget, {
|
|
822
|
-
...props,
|
|
823
|
-
showTime: true
|
|
824
|
-
});
|
|
742
|
+
const { AltDateWidget: AltDateWidget2 } = props.registry.widgets;
|
|
743
|
+
return /* @__PURE__ */ jsx17(AltDateWidget2, { ...props, showTime: true });
|
|
825
744
|
}
|
|
826
745
|
AltDateTimeWidget.defaultProps = {
|
|
827
|
-
...
|
|
746
|
+
...AltDateWidget_default.defaultProps,
|
|
828
747
|
showTime: true
|
|
829
748
|
};
|
|
749
|
+
var AltDateTimeWidget_default = AltDateTimeWidget;
|
|
830
750
|
|
|
751
|
+
// src/CheckboxWidget/CheckboxWidget.tsx
|
|
752
|
+
import { Checkbox, FormControl as FormControl4, Text as Text3 } from "@chakra-ui/react";
|
|
753
|
+
import {
|
|
754
|
+
ariaDescribedByIds as ariaDescribedByIds3,
|
|
755
|
+
descriptionId as descriptionId2,
|
|
756
|
+
getTemplate as getTemplate4,
|
|
757
|
+
labelValue as labelValue2,
|
|
758
|
+
schemaRequiresTrueValue
|
|
759
|
+
} from "@rjsf/utils";
|
|
760
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
831
761
|
function CheckboxWidget(props) {
|
|
832
762
|
const {
|
|
833
763
|
id,
|
|
@@ -844,56 +774,56 @@ function CheckboxWidget(props) {
|
|
|
844
774
|
uiSchema,
|
|
845
775
|
schema
|
|
846
776
|
} = props;
|
|
847
|
-
const chakraProps = getChakra({
|
|
848
|
-
uiSchema
|
|
849
|
-
});
|
|
850
|
-
// Because an unchecked checkbox will cause html5 validation to fail, only add
|
|
851
|
-
// the "required" attribute if the field value must be "true", due to the
|
|
852
|
-
// "const" or "enum" keywords
|
|
777
|
+
const chakraProps = getChakra({ uiSchema });
|
|
853
778
|
const required = schemaRequiresTrueValue(schema);
|
|
854
|
-
const DescriptionFieldTemplate =
|
|
779
|
+
const DescriptionFieldTemplate = getTemplate4(
|
|
780
|
+
"DescriptionFieldTemplate",
|
|
781
|
+
registry,
|
|
782
|
+
options
|
|
783
|
+
);
|
|
855
784
|
const description = options.description || schema.description;
|
|
856
|
-
const _onChange = ({
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
isDisabled: disabled || readonly,
|
|
886
|
-
onChange: _onChange,
|
|
887
|
-
onBlur: _onBlur,
|
|
888
|
-
onFocus: _onFocus,
|
|
889
|
-
"aria-describedby": ariaDescribedByIds(id),
|
|
890
|
-
children: labelValue(jsx(Text, {
|
|
891
|
-
children: label
|
|
892
|
-
}), hideLabel || !label)
|
|
893
|
-
})]
|
|
894
|
-
});
|
|
785
|
+
const _onChange = ({ target: { checked } }) => onChange(checked);
|
|
786
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
|
|
787
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
|
|
788
|
+
return /* @__PURE__ */ jsxs10(FormControl4, { mb: 1, ...chakraProps, isRequired: required, children: [
|
|
789
|
+
!hideLabel && !!description && /* @__PURE__ */ jsx18(
|
|
790
|
+
DescriptionFieldTemplate,
|
|
791
|
+
{
|
|
792
|
+
id: descriptionId2(id),
|
|
793
|
+
description,
|
|
794
|
+
schema,
|
|
795
|
+
uiSchema,
|
|
796
|
+
registry
|
|
797
|
+
}
|
|
798
|
+
),
|
|
799
|
+
/* @__PURE__ */ jsx18(
|
|
800
|
+
Checkbox,
|
|
801
|
+
{
|
|
802
|
+
id,
|
|
803
|
+
name: id,
|
|
804
|
+
isChecked: typeof value === "undefined" ? false : value,
|
|
805
|
+
isDisabled: disabled || readonly,
|
|
806
|
+
onChange: _onChange,
|
|
807
|
+
onBlur: _onBlur,
|
|
808
|
+
onFocus: _onFocus,
|
|
809
|
+
"aria-describedby": ariaDescribedByIds3(id),
|
|
810
|
+
children: labelValue2(/* @__PURE__ */ jsx18(Text3, { children: label }), hideLabel || !label)
|
|
811
|
+
}
|
|
812
|
+
)
|
|
813
|
+
] });
|
|
895
814
|
}
|
|
896
815
|
|
|
816
|
+
// src/CheckboxesWidget/CheckboxesWidget.tsx
|
|
817
|
+
import { CheckboxGroup, Checkbox as Checkbox2, FormLabel as FormLabel3, FormControl as FormControl5, Text as Text4, Stack } from "@chakra-ui/react";
|
|
818
|
+
import {
|
|
819
|
+
ariaDescribedByIds as ariaDescribedByIds4,
|
|
820
|
+
enumOptionsIndexForValue,
|
|
821
|
+
enumOptionsIsSelected,
|
|
822
|
+
enumOptionsValueForIndex,
|
|
823
|
+
labelValue as labelValue3,
|
|
824
|
+
optionId
|
|
825
|
+
} from "@rjsf/utils";
|
|
826
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
897
827
|
function CheckboxesWidget(props) {
|
|
898
828
|
const {
|
|
899
829
|
id,
|
|
@@ -910,65 +840,68 @@ function CheckboxesWidget(props) {
|
|
|
910
840
|
uiSchema,
|
|
911
841
|
rawErrors = []
|
|
912
842
|
} = props;
|
|
913
|
-
const {
|
|
914
|
-
|
|
915
|
-
enumDisabled,
|
|
916
|
-
emptyValue
|
|
917
|
-
} = options;
|
|
918
|
-
const chakraProps = getChakra({
|
|
919
|
-
uiSchema
|
|
920
|
-
});
|
|
843
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
844
|
+
const chakraProps = getChakra({ uiSchema });
|
|
921
845
|
const checkboxesValues = Array.isArray(value) ? value : [value];
|
|
922
|
-
const _onBlur = ({
|
|
923
|
-
|
|
924
|
-
value
|
|
925
|
-
}
|
|
926
|
-
}) => onBlur(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
927
|
-
const _onFocus = ({
|
|
928
|
-
target: {
|
|
929
|
-
value
|
|
930
|
-
}
|
|
931
|
-
}) => onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
846
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, enumOptionsValueForIndex(value2, enumOptions, emptyValue));
|
|
847
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, enumOptionsValueForIndex(value2, enumOptions, emptyValue));
|
|
932
848
|
const row = options ? options.inline : false;
|
|
933
849
|
const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, true);
|
|
934
|
-
return
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
850
|
+
return /* @__PURE__ */ jsxs11(
|
|
851
|
+
FormControl5,
|
|
852
|
+
{
|
|
853
|
+
mb: 1,
|
|
854
|
+
...chakraProps,
|
|
855
|
+
isDisabled: disabled || readonly,
|
|
856
|
+
isRequired: required,
|
|
857
|
+
isReadOnly: readonly,
|
|
858
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
859
|
+
children: [
|
|
860
|
+
labelValue3(
|
|
861
|
+
/* @__PURE__ */ jsx19(FormLabel3, { htmlFor: id, id: `${id}-label`, children: label }),
|
|
862
|
+
hideLabel || !label
|
|
863
|
+
),
|
|
864
|
+
/* @__PURE__ */ jsx19(
|
|
865
|
+
CheckboxGroup,
|
|
866
|
+
{
|
|
867
|
+
onChange: (option) => onChange(enumOptionsValueForIndex(option, enumOptions, emptyValue)),
|
|
868
|
+
defaultValue: selectedIndexes,
|
|
869
|
+
"aria-describedby": ariaDescribedByIds4(id),
|
|
870
|
+
children: /* @__PURE__ */ jsx19(Stack, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
871
|
+
const checked = enumOptionsIsSelected(option.value, checkboxesValues);
|
|
872
|
+
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
873
|
+
return /* @__PURE__ */ jsx19(
|
|
874
|
+
Checkbox2,
|
|
875
|
+
{
|
|
876
|
+
id: optionId(id, index),
|
|
877
|
+
name: id,
|
|
878
|
+
value: String(index),
|
|
879
|
+
isChecked: checked,
|
|
880
|
+
isDisabled: disabled || itemDisabled || readonly,
|
|
881
|
+
onBlur: _onBlur,
|
|
882
|
+
onFocus: _onFocus,
|
|
883
|
+
children: option.label && /* @__PURE__ */ jsx19(Text4, { children: option.label })
|
|
884
|
+
},
|
|
885
|
+
index
|
|
886
|
+
);
|
|
887
|
+
}) })
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
);
|
|
970
893
|
}
|
|
971
894
|
|
|
895
|
+
// src/RadioWidget/RadioWidget.tsx
|
|
896
|
+
import { FormControl as FormControl6, FormLabel as FormLabel4, Radio, RadioGroup, Stack as Stack2 } from "@chakra-ui/react";
|
|
897
|
+
import {
|
|
898
|
+
ariaDescribedByIds as ariaDescribedByIds5,
|
|
899
|
+
enumOptionsIndexForValue as enumOptionsIndexForValue2,
|
|
900
|
+
enumOptionsValueForIndex as enumOptionsValueForIndex2,
|
|
901
|
+
labelValue as labelValue4,
|
|
902
|
+
optionId as optionId2
|
|
903
|
+
} from "@rjsf/utils";
|
|
904
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
972
905
|
function RadioWidget({
|
|
973
906
|
id,
|
|
974
907
|
options,
|
|
@@ -983,60 +916,53 @@ function RadioWidget({
|
|
|
983
916
|
onFocus,
|
|
984
917
|
uiSchema
|
|
985
918
|
}) {
|
|
986
|
-
const {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
const chakraProps = getChakra({
|
|
992
|
-
uiSchema
|
|
993
|
-
});
|
|
994
|
-
const _onChange = nextValue => onChange(enumOptionsValueForIndex(nextValue, enumOptions, emptyValue));
|
|
995
|
-
const _onBlur = ({
|
|
996
|
-
target: {
|
|
997
|
-
value
|
|
998
|
-
}
|
|
999
|
-
}) => onBlur(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1000
|
-
const _onFocus = ({
|
|
1001
|
-
target: {
|
|
1002
|
-
value
|
|
1003
|
-
}
|
|
1004
|
-
}) => onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
919
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
920
|
+
const chakraProps = getChakra({ uiSchema });
|
|
921
|
+
const _onChange = (nextValue) => onChange(enumOptionsValueForIndex2(nextValue, enumOptions, emptyValue));
|
|
922
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, enumOptionsValueForIndex2(value2, enumOptions, emptyValue));
|
|
923
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, enumOptionsValueForIndex2(value2, enumOptions, emptyValue));
|
|
1005
924
|
const row = options ? options.inline : false;
|
|
1006
|
-
const selectedIndex =
|
|
1007
|
-
return
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
name: id,
|
|
1023
|
-
"aria-describedby": ariaDescribedByIds(id),
|
|
1024
|
-
children: jsx(Stack, {
|
|
1025
|
-
direction: row ? 'row' : 'column',
|
|
1026
|
-
children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
925
|
+
const selectedIndex = enumOptionsIndexForValue2(value, enumOptions) ?? null;
|
|
926
|
+
return /* @__PURE__ */ jsxs12(FormControl6, { mb: 1, ...chakraProps, isDisabled: disabled || readonly, isRequired: required, isReadOnly: readonly, children: [
|
|
927
|
+
labelValue4(
|
|
928
|
+
/* @__PURE__ */ jsx20(FormLabel4, { htmlFor: id, id: `${id}-label`, children: label }),
|
|
929
|
+
hideLabel || !label
|
|
930
|
+
),
|
|
931
|
+
/* @__PURE__ */ jsx20(
|
|
932
|
+
RadioGroup,
|
|
933
|
+
{
|
|
934
|
+
onChange: _onChange,
|
|
935
|
+
onBlur: _onBlur,
|
|
936
|
+
onFocus: _onFocus,
|
|
937
|
+
value: selectedIndex,
|
|
938
|
+
name: id,
|
|
939
|
+
"aria-describedby": ariaDescribedByIds5(id),
|
|
940
|
+
children: /* @__PURE__ */ jsx20(Stack2, { direction: row ? "row" : "column", children: Array.isArray(enumOptions) && enumOptions.map((option, index) => {
|
|
1027
941
|
const itemDisabled = Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1;
|
|
1028
|
-
return
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
942
|
+
return /* @__PURE__ */ jsx20(
|
|
943
|
+
Radio,
|
|
944
|
+
{
|
|
945
|
+
value: String(index),
|
|
946
|
+
id: optionId2(id, index),
|
|
947
|
+
disabled: disabled || itemDisabled || readonly,
|
|
948
|
+
children: option.label
|
|
949
|
+
},
|
|
950
|
+
index
|
|
951
|
+
);
|
|
952
|
+
}) })
|
|
953
|
+
}
|
|
954
|
+
)
|
|
955
|
+
] });
|
|
1038
956
|
}
|
|
1039
957
|
|
|
958
|
+
// src/RangeWidget/RangeWidget.tsx
|
|
959
|
+
import { FormControl as FormControl7, FormLabel as FormLabel5, Slider, SliderFilledTrack, SliderThumb, SliderTrack } from "@chakra-ui/react";
|
|
960
|
+
import {
|
|
961
|
+
ariaDescribedByIds as ariaDescribedByIds6,
|
|
962
|
+
labelValue as labelValue5,
|
|
963
|
+
rangeSpec
|
|
964
|
+
} from "@rjsf/utils";
|
|
965
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1040
966
|
function RangeWidget({
|
|
1041
967
|
value,
|
|
1042
968
|
readonly,
|
|
@@ -1051,48 +977,43 @@ function RangeWidget({
|
|
|
1051
977
|
hideLabel,
|
|
1052
978
|
id
|
|
1053
979
|
}) {
|
|
1054
|
-
const chakraProps = getChakra({
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
id,
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
children: label
|
|
1080
|
-
}), hideLabel || !label), jsxs(Slider, {
|
|
1081
|
-
...sliderWidgetProps,
|
|
1082
|
-
id: id,
|
|
1083
|
-
name: id,
|
|
1084
|
-
isDisabled: disabled || readonly,
|
|
1085
|
-
onChange: _onChange,
|
|
1086
|
-
onBlur: _onBlur,
|
|
1087
|
-
onFocus: _onFocus,
|
|
1088
|
-
"aria-describedby": ariaDescribedByIds(id),
|
|
1089
|
-
children: [jsx(SliderTrack, {
|
|
1090
|
-
children: jsx(SliderFilledTrack, {})
|
|
1091
|
-
}), jsx(SliderThumb, {})]
|
|
1092
|
-
})]
|
|
1093
|
-
});
|
|
980
|
+
const chakraProps = getChakra({ uiSchema });
|
|
981
|
+
const sliderWidgetProps = { value, label, id, ...rangeSpec(schema) };
|
|
982
|
+
const _onChange = (value2) => onChange(value2 === void 0 ? options.emptyValue : value2);
|
|
983
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
|
|
984
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
|
|
985
|
+
return /* @__PURE__ */ jsxs13(FormControl7, { mb: 1, ...chakraProps, children: [
|
|
986
|
+
labelValue5(/* @__PURE__ */ jsx21(FormLabel5, { htmlFor: id, children: label }), hideLabel || !label),
|
|
987
|
+
/* @__PURE__ */ jsxs13(
|
|
988
|
+
Slider,
|
|
989
|
+
{
|
|
990
|
+
...sliderWidgetProps,
|
|
991
|
+
id,
|
|
992
|
+
name: id,
|
|
993
|
+
isDisabled: disabled || readonly,
|
|
994
|
+
onChange: _onChange,
|
|
995
|
+
onBlur: _onBlur,
|
|
996
|
+
onFocus: _onFocus,
|
|
997
|
+
"aria-describedby": ariaDescribedByIds6(id),
|
|
998
|
+
children: [
|
|
999
|
+
/* @__PURE__ */ jsx21(SliderTrack, { children: /* @__PURE__ */ jsx21(SliderFilledTrack, {}) }),
|
|
1000
|
+
/* @__PURE__ */ jsx21(SliderThumb, {})
|
|
1001
|
+
]
|
|
1002
|
+
}
|
|
1003
|
+
)
|
|
1004
|
+
] });
|
|
1094
1005
|
}
|
|
1095
1006
|
|
|
1007
|
+
// src/SelectWidget/SelectWidget.tsx
|
|
1008
|
+
import { FormControl as FormControl8, FormLabel as FormLabel6 } from "@chakra-ui/react";
|
|
1009
|
+
import {
|
|
1010
|
+
ariaDescribedByIds as ariaDescribedByIds7,
|
|
1011
|
+
enumOptionsIndexForValue as enumOptionsIndexForValue3,
|
|
1012
|
+
enumOptionsValueForIndex as enumOptionsValueForIndex3,
|
|
1013
|
+
labelValue as labelValue6
|
|
1014
|
+
} from "@rjsf/utils";
|
|
1015
|
+
import { Select } from "chakra-react-select";
|
|
1016
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1096
1017
|
function SelectWidget(props) {
|
|
1097
1018
|
const {
|
|
1098
1019
|
id,
|
|
@@ -1112,84 +1033,88 @@ function SelectWidget(props) {
|
|
|
1112
1033
|
rawErrors = [],
|
|
1113
1034
|
uiSchema
|
|
1114
1035
|
} = props;
|
|
1115
|
-
const {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1036
|
+
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1037
|
+
const chakraProps = getChakra({ uiSchema });
|
|
1038
|
+
const _onMultiChange = (e) => {
|
|
1039
|
+
return onChange(
|
|
1040
|
+
enumOptionsValueForIndex3(
|
|
1041
|
+
e.map((v) => {
|
|
1042
|
+
return v.value;
|
|
1043
|
+
}),
|
|
1044
|
+
enumOptions,
|
|
1045
|
+
emptyValue
|
|
1046
|
+
)
|
|
1047
|
+
);
|
|
1127
1048
|
};
|
|
1128
|
-
const _onChange = e => {
|
|
1129
|
-
return onChange(
|
|
1049
|
+
const _onChange = (e) => {
|
|
1050
|
+
return onChange(enumOptionsValueForIndex3(e.value, enumOptions, emptyValue));
|
|
1130
1051
|
};
|
|
1131
|
-
const _onBlur = ({
|
|
1132
|
-
|
|
1133
|
-
value
|
|
1134
|
-
}
|
|
1135
|
-
}) => onBlur(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1136
|
-
const _onFocus = ({
|
|
1137
|
-
target: {
|
|
1138
|
-
value
|
|
1139
|
-
}
|
|
1140
|
-
}) => onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
1052
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, enumOptionsValueForIndex3(value2, enumOptions, emptyValue));
|
|
1053
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, enumOptionsValueForIndex3(value2, enumOptions, emptyValue));
|
|
1141
1054
|
const _valueLabelMap = {};
|
|
1142
1055
|
const displayEnumOptions = Array.isArray(enumOptions) ? enumOptions.map((option, index) => {
|
|
1143
|
-
const {
|
|
1144
|
-
|
|
1145
|
-
label
|
|
1146
|
-
} = option;
|
|
1147
|
-
_valueLabelMap[index] = label || String(value);
|
|
1056
|
+
const { value: value2, label: label2 } = option;
|
|
1057
|
+
_valueLabelMap[index] = label2 || String(value2);
|
|
1148
1058
|
return {
|
|
1149
|
-
label,
|
|
1059
|
+
label: label2,
|
|
1150
1060
|
value: String(index),
|
|
1151
|
-
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(
|
|
1061
|
+
isDisabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
|
|
1152
1062
|
};
|
|
1153
1063
|
}) : [];
|
|
1154
|
-
const isMultiple = typeof multiple !==
|
|
1155
|
-
const selectedIndex =
|
|
1156
|
-
const formValue = isMultiple ? (selectedIndex || []).map(i => {
|
|
1064
|
+
const isMultiple = typeof multiple !== "undefined" && Boolean(enumOptions);
|
|
1065
|
+
const selectedIndex = enumOptionsIndexForValue3(value, enumOptions, isMultiple);
|
|
1066
|
+
const formValue = isMultiple ? (selectedIndex || []).map((i) => {
|
|
1157
1067
|
return {
|
|
1158
1068
|
label: _valueLabelMap[i],
|
|
1159
1069
|
value: i
|
|
1160
1070
|
};
|
|
1161
1071
|
}) : {
|
|
1162
|
-
label: _valueLabelMap[selectedIndex] ||
|
|
1072
|
+
label: _valueLabelMap[selectedIndex] || "",
|
|
1163
1073
|
selectedIndex
|
|
1164
1074
|
};
|
|
1165
|
-
return
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1075
|
+
return /* @__PURE__ */ jsxs14(
|
|
1076
|
+
FormControl8,
|
|
1077
|
+
{
|
|
1078
|
+
mb: 1,
|
|
1079
|
+
...chakraProps,
|
|
1080
|
+
isDisabled: disabled || readonly,
|
|
1081
|
+
isRequired: required,
|
|
1082
|
+
isReadOnly: readonly,
|
|
1083
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1084
|
+
children: [
|
|
1085
|
+
labelValue6(
|
|
1086
|
+
/* @__PURE__ */ jsx22(FormLabel6, { htmlFor: id, id: `${id}-label`, children: label }),
|
|
1087
|
+
hideLabel || !label
|
|
1088
|
+
),
|
|
1089
|
+
/* @__PURE__ */ jsx22(
|
|
1090
|
+
Select,
|
|
1091
|
+
{
|
|
1092
|
+
inputId: id,
|
|
1093
|
+
name: id,
|
|
1094
|
+
isMulti: isMultiple,
|
|
1095
|
+
options: displayEnumOptions,
|
|
1096
|
+
placeholder,
|
|
1097
|
+
closeMenuOnSelect: !isMultiple,
|
|
1098
|
+
onBlur: _onBlur,
|
|
1099
|
+
onChange: isMultiple ? _onMultiChange : _onChange,
|
|
1100
|
+
onFocus: _onFocus,
|
|
1101
|
+
autoFocus: autofocus,
|
|
1102
|
+
value: formValue,
|
|
1103
|
+
"aria-describedby": ariaDescribedByIds7(id)
|
|
1104
|
+
}
|
|
1105
|
+
)
|
|
1106
|
+
]
|
|
1107
|
+
}
|
|
1108
|
+
);
|
|
1191
1109
|
}
|
|
1192
1110
|
|
|
1111
|
+
// src/TextareaWidget/TextareaWidget.tsx
|
|
1112
|
+
import { FormControl as FormControl9, FormLabel as FormLabel7, Textarea } from "@chakra-ui/react";
|
|
1113
|
+
import {
|
|
1114
|
+
ariaDescribedByIds as ariaDescribedByIds8,
|
|
1115
|
+
labelValue as labelValue7
|
|
1116
|
+
} from "@rjsf/utils";
|
|
1117
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1193
1118
|
function TextareaWidget({
|
|
1194
1119
|
id,
|
|
1195
1120
|
placeholder,
|
|
@@ -1207,107 +1132,99 @@ function TextareaWidget({
|
|
|
1207
1132
|
required,
|
|
1208
1133
|
rawErrors
|
|
1209
1134
|
}) {
|
|
1210
|
-
const chakraProps = getChakra({
|
|
1211
|
-
|
|
1212
|
-
});
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1135
|
+
const chakraProps = getChakra({ uiSchema });
|
|
1136
|
+
const _onChange = ({ target: { value: value2 } }) => onChange(value2 === "" ? options.emptyValue : value2);
|
|
1137
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
|
|
1138
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
|
|
1139
|
+
return /* @__PURE__ */ jsxs15(
|
|
1140
|
+
FormControl9,
|
|
1141
|
+
{
|
|
1142
|
+
mb: 1,
|
|
1143
|
+
...chakraProps,
|
|
1144
|
+
isDisabled: disabled || readonly,
|
|
1145
|
+
isRequired: required,
|
|
1146
|
+
isReadOnly: readonly,
|
|
1147
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1148
|
+
children: [
|
|
1149
|
+
labelValue7(/* @__PURE__ */ jsx23(FormLabel7, { htmlFor: id, children: label }), hideLabel || !label),
|
|
1150
|
+
/* @__PURE__ */ jsx23(
|
|
1151
|
+
Textarea,
|
|
1152
|
+
{
|
|
1153
|
+
id,
|
|
1154
|
+
name: id,
|
|
1155
|
+
value: value ?? "",
|
|
1156
|
+
placeholder,
|
|
1157
|
+
autoFocus: autofocus,
|
|
1158
|
+
onChange: _onChange,
|
|
1159
|
+
onBlur: _onBlur,
|
|
1160
|
+
onFocus: _onFocus,
|
|
1161
|
+
"aria-describedby": ariaDescribedByIds8(id)
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
]
|
|
1226
1165
|
}
|
|
1227
|
-
|
|
1228
|
-
return jsxs(FormControl, {
|
|
1229
|
-
mb: 1,
|
|
1230
|
-
...chakraProps,
|
|
1231
|
-
isDisabled: disabled || readonly,
|
|
1232
|
-
isRequired: required,
|
|
1233
|
-
isReadOnly: readonly,
|
|
1234
|
-
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1235
|
-
children: [labelValue(jsx(FormLabel, {
|
|
1236
|
-
htmlFor: id,
|
|
1237
|
-
children: label
|
|
1238
|
-
}), hideLabel || !label), jsx(Textarea, {
|
|
1239
|
-
id: id,
|
|
1240
|
-
name: id,
|
|
1241
|
-
value: value ?? '',
|
|
1242
|
-
placeholder: placeholder,
|
|
1243
|
-
autoFocus: autofocus,
|
|
1244
|
-
onChange: _onChange,
|
|
1245
|
-
onBlur: _onBlur,
|
|
1246
|
-
onFocus: _onFocus,
|
|
1247
|
-
"aria-describedby": ariaDescribedByIds(id)
|
|
1248
|
-
})]
|
|
1249
|
-
});
|
|
1166
|
+
);
|
|
1250
1167
|
}
|
|
1251
1168
|
|
|
1169
|
+
// src/UpDownWidget/UpDownWidget.tsx
|
|
1170
|
+
import {
|
|
1171
|
+
NumberInput,
|
|
1172
|
+
NumberDecrementStepper,
|
|
1173
|
+
NumberIncrementStepper,
|
|
1174
|
+
NumberInputField,
|
|
1175
|
+
NumberInputStepper,
|
|
1176
|
+
FormControl as FormControl10,
|
|
1177
|
+
FormLabel as FormLabel8
|
|
1178
|
+
} from "@chakra-ui/react";
|
|
1179
|
+
import {
|
|
1180
|
+
ariaDescribedByIds as ariaDescribedByIds9,
|
|
1181
|
+
labelValue as labelValue8
|
|
1182
|
+
} from "@rjsf/utils";
|
|
1183
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1252
1184
|
function UpDownWidget(props) {
|
|
1253
|
-
const {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1185
|
+
const { id, uiSchema, readonly, disabled, label, hideLabel, value, onChange, onBlur, onFocus, rawErrors, required } = props;
|
|
1186
|
+
const chakraProps = getChakra({ uiSchema });
|
|
1187
|
+
const _onChange = (value2) => onChange(value2);
|
|
1188
|
+
const _onBlur = ({ target: { value: value2 } }) => onBlur(id, value2);
|
|
1189
|
+
const _onFocus = ({ target: { value: value2 } }) => onFocus(id, value2);
|
|
1190
|
+
return /* @__PURE__ */ jsxs16(
|
|
1191
|
+
FormControl10,
|
|
1192
|
+
{
|
|
1193
|
+
mb: 1,
|
|
1194
|
+
...chakraProps,
|
|
1195
|
+
isDisabled: disabled || readonly,
|
|
1196
|
+
isRequired: required,
|
|
1197
|
+
isReadOnly: readonly,
|
|
1198
|
+
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1199
|
+
children: [
|
|
1200
|
+
labelValue8(/* @__PURE__ */ jsx24(FormLabel8, { htmlFor: id, children: label }), hideLabel || !label),
|
|
1201
|
+
/* @__PURE__ */ jsxs16(
|
|
1202
|
+
NumberInput,
|
|
1203
|
+
{
|
|
1204
|
+
value: value ?? "",
|
|
1205
|
+
onChange: _onChange,
|
|
1206
|
+
onBlur: _onBlur,
|
|
1207
|
+
onFocus: _onFocus,
|
|
1208
|
+
"aria-describedby": ariaDescribedByIds9(id),
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ jsx24(NumberInputField, { id, name: id }),
|
|
1211
|
+
/* @__PURE__ */ jsxs16(NumberInputStepper, { children: [
|
|
1212
|
+
/* @__PURE__ */ jsx24(NumberIncrementStepper, {}),
|
|
1213
|
+
/* @__PURE__ */ jsx24(NumberDecrementStepper, {})
|
|
1214
|
+
] })
|
|
1215
|
+
]
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
]
|
|
1279
1219
|
}
|
|
1280
|
-
|
|
1281
|
-
return jsxs(FormControl, {
|
|
1282
|
-
mb: 1,
|
|
1283
|
-
...chakraProps,
|
|
1284
|
-
isDisabled: disabled || readonly,
|
|
1285
|
-
isRequired: required,
|
|
1286
|
-
isReadOnly: readonly,
|
|
1287
|
-
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1288
|
-
children: [labelValue(jsx(FormLabel, {
|
|
1289
|
-
htmlFor: id,
|
|
1290
|
-
children: label
|
|
1291
|
-
}), hideLabel || !label), jsxs(NumberInput, {
|
|
1292
|
-
value: value ?? '',
|
|
1293
|
-
onChange: _onChange,
|
|
1294
|
-
onBlur: _onBlur,
|
|
1295
|
-
onFocus: _onFocus,
|
|
1296
|
-
"aria-describedby": ariaDescribedByIds(id),
|
|
1297
|
-
children: [jsx(NumberInputField, {
|
|
1298
|
-
id: id,
|
|
1299
|
-
name: id
|
|
1300
|
-
}), jsxs(NumberInputStepper, {
|
|
1301
|
-
children: [jsx(NumberIncrementStepper, {}), jsx(NumberDecrementStepper, {})]
|
|
1302
|
-
})]
|
|
1303
|
-
})]
|
|
1304
|
-
});
|
|
1220
|
+
);
|
|
1305
1221
|
}
|
|
1306
1222
|
|
|
1223
|
+
// src/Widgets/Widgets.ts
|
|
1307
1224
|
function generateWidgets() {
|
|
1308
1225
|
return {
|
|
1309
|
-
AltDateTimeWidget,
|
|
1310
|
-
AltDateWidget,
|
|
1226
|
+
AltDateTimeWidget: AltDateTimeWidget_default,
|
|
1227
|
+
AltDateWidget: AltDateWidget_default,
|
|
1311
1228
|
CheckboxWidget,
|
|
1312
1229
|
CheckboxesWidget,
|
|
1313
1230
|
RadioWidget,
|
|
@@ -1317,44 +1234,36 @@ function generateWidgets() {
|
|
|
1317
1234
|
UpDownWidget
|
|
1318
1235
|
};
|
|
1319
1236
|
}
|
|
1320
|
-
var
|
|
1237
|
+
var Widgets_default = generateWidgets();
|
|
1321
1238
|
|
|
1239
|
+
// src/Theme/Theme.tsx
|
|
1322
1240
|
function generateTheme() {
|
|
1323
1241
|
return {
|
|
1324
1242
|
templates: generateTemplates(),
|
|
1325
1243
|
widgets: generateWidgets()
|
|
1326
1244
|
};
|
|
1327
1245
|
}
|
|
1328
|
-
var
|
|
1246
|
+
var Theme_default = generateTheme();
|
|
1329
1247
|
|
|
1248
|
+
// src/Form/Form.tsx
|
|
1330
1249
|
function generateForm() {
|
|
1331
1250
|
return withTheme(generateTheme());
|
|
1332
1251
|
}
|
|
1333
|
-
var
|
|
1252
|
+
var Form_default = generateForm();
|
|
1334
1253
|
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
* Exact duplicate of `@chakra-ui/react`'s `CSSReset` component. Except for the following:
|
|
1341
|
-
*
|
|
1342
|
-
```css
|
|
1343
|
-
input {
|
|
1344
|
-
border-width: revert;
|
|
1345
|
-
border-color: revert;
|
|
1346
|
-
border-style: revert;
|
|
1347
|
-
}
|
|
1348
|
-
.array-item > hr {
|
|
1349
|
-
margin-top: 16px;
|
|
1350
|
-
margin-bottom: 16px;
|
|
1351
|
-
}
|
|
1352
|
-
```
|
|
1254
|
+
// src/ChakraFrameProvider.tsx
|
|
1255
|
+
import { CacheProvider } from "@emotion/react";
|
|
1256
|
+
import createCache from "@emotion/cache";
|
|
1257
|
+
import weakMemoize from "@emotion/weak-memoize";
|
|
1258
|
+
import { ChakraProvider } from "@chakra-ui/react";
|
|
1353
1259
|
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1260
|
+
// src/CssReset.tsx
|
|
1261
|
+
import { Global } from "@emotion/react";
|
|
1262
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1263
|
+
var CSSReset = () => /* @__PURE__ */ jsx25(
|
|
1264
|
+
Global,
|
|
1265
|
+
{
|
|
1266
|
+
styles: `
|
|
1358
1267
|
html {
|
|
1359
1268
|
line-height: 1.5;
|
|
1360
1269
|
-webkit-text-size-adjust: 100%;
|
|
@@ -1595,45 +1504,35 @@ const CSSReset = () => jsx(Global, {
|
|
|
1595
1504
|
margin-bottom: 16px;
|
|
1596
1505
|
}
|
|
1597
1506
|
`
|
|
1598
|
-
}
|
|
1507
|
+
}
|
|
1508
|
+
);
|
|
1509
|
+
var CssReset_default = CSSReset;
|
|
1599
1510
|
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
*
|
|
1605
|
-
* We have to define ChakraFrameProvider in this library, as opposed to the playground,
|
|
1606
|
-
* in order to avoid conflicting versions of emotion, which breaks the styling.
|
|
1607
|
-
*
|
|
1608
|
-
* NOTE: This is an internal component only used by @rjsf/playground (no
|
|
1609
|
-
* backwards compatibility guarantees!)
|
|
1610
|
-
*
|
|
1611
|
-
* From: https://codesandbox.io/s/p98y9o7jz0?file=/src/frame-provider.js:0-650
|
|
1612
|
-
* Also see: https://github.com/emotion-js/emotion/issues/760#issuecomment-404353706
|
|
1613
|
-
*/
|
|
1614
|
-
const memoizedCreateCacheWithContainer = /*#__PURE__*/weakMemoize(container => {
|
|
1615
|
-
const newCache = createCache({
|
|
1616
|
-
container,
|
|
1617
|
-
key: 'rjsf'
|
|
1618
|
-
});
|
|
1511
|
+
// src/ChakraFrameProvider.tsx
|
|
1512
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1513
|
+
var memoizedCreateCacheWithContainer = weakMemoize((container) => {
|
|
1514
|
+
const newCache = createCache({ container, key: "rjsf" });
|
|
1619
1515
|
return newCache;
|
|
1620
1516
|
});
|
|
1621
|
-
|
|
1622
|
-
document
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
margin: 2
|
|
1627
|
-
},
|
|
1628
|
-
children: jsx(CacheProvider, {
|
|
1629
|
-
value: memoizedCreateCacheWithContainer(document.head),
|
|
1630
|
-
children: jsxs(ChakraProvider, {
|
|
1631
|
-
resetCSS: false,
|
|
1632
|
-
children: [jsx(CSSReset, {}), props.children]
|
|
1633
|
-
})
|
|
1634
|
-
})
|
|
1635
|
-
});
|
|
1517
|
+
var __createChakraFrameProvider = (props) => ({ document }) => {
|
|
1518
|
+
return /* @__PURE__ */ jsx26("div", { style: { margin: 2 }, children: /* @__PURE__ */ jsx26(CacheProvider, { value: memoizedCreateCacheWithContainer(document.head), children: /* @__PURE__ */ jsxs17(ChakraProvider, { resetCSS: false, children: [
|
|
1519
|
+
/* @__PURE__ */ jsx26(CssReset_default, {}),
|
|
1520
|
+
props.children
|
|
1521
|
+
] }) }) });
|
|
1636
1522
|
};
|
|
1637
1523
|
|
|
1638
|
-
|
|
1524
|
+
// src/index.ts
|
|
1525
|
+
var src_default = Form_default;
|
|
1526
|
+
export {
|
|
1527
|
+
Form_default as Form,
|
|
1528
|
+
Templates_default as Templates,
|
|
1529
|
+
Theme_default as Theme,
|
|
1530
|
+
Widgets_default as Widgets,
|
|
1531
|
+
__createChakraFrameProvider,
|
|
1532
|
+
src_default as default,
|
|
1533
|
+
generateForm,
|
|
1534
|
+
generateTemplates,
|
|
1535
|
+
generateTheme,
|
|
1536
|
+
generateWidgets
|
|
1537
|
+
};
|
|
1639
1538
|
//# sourceMappingURL=chakra-ui.esm.js.map
|