@rjsf/chakra-ui 5.3.1 → 5.5.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.cjs.development.js +58 -55
- package/dist/chakra-ui.cjs.development.js.map +1 -1
- package/dist/chakra-ui.cjs.production.min.js +1 -1
- package/dist/chakra-ui.cjs.production.min.js.map +1 -1
- package/dist/chakra-ui.esm.js +59 -56
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +58 -55
- package/dist/chakra-ui.umd.development.js.map +1 -1
- package/dist/chakra-ui.umd.production.min.js +1 -1
- package/dist/chakra-ui.umd.production.min.js.map +1 -1
- package/package.json +8 -8
package/dist/chakra-ui.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withTheme } from '@rjsf/core';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { TranslatableString, getUiOptions, getTemplate, getInputProps, examplesId, ariaDescribedByIds, errorId, helpId, titleId, descriptionId, canExpand, getSubmitButtonOptions, ADDITIONAL_PROPERTY_FLAG, parseDateString, toDateString, pad, schemaRequiresTrueValue, enumOptionsIndexForValue, enumOptionsValueForIndex, enumOptionsIsSelected, optionId, rangeSpec } from '@rjsf/utils';
|
|
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
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
5
|
import { AddIcon, WarningIcon, CopyIcon, ArrowDownIcon, ArrowUpIcon, DeleteIcon } from '@chakra-ui/icons';
|
|
6
6
|
import { useMemo, memo, useState, useEffect } from 'react';
|
|
@@ -197,6 +197,7 @@ function BaseInputTemplate(props) {
|
|
|
197
197
|
type = props.type,
|
|
198
198
|
value = props.value,
|
|
199
199
|
label = props.label,
|
|
200
|
+
hideLabel = props.hideLabel,
|
|
200
201
|
schema = props.schema,
|
|
201
202
|
uiSchema = props.uiSchema,
|
|
202
203
|
onChange = props.onChange,
|
|
@@ -209,13 +210,11 @@ function BaseInputTemplate(props) {
|
|
|
209
210
|
rawErrors = props.rawErrors,
|
|
210
211
|
autofocus = props.autofocus,
|
|
211
212
|
placeholder = props.placeholder,
|
|
212
|
-
disabled = props.disabled
|
|
213
|
-
registry = props.registry;
|
|
213
|
+
disabled = props.disabled;
|
|
214
214
|
var inputProps = getInputProps(schema, type, options);
|
|
215
215
|
var chakraProps = getChakra({
|
|
216
216
|
uiSchema: uiSchema
|
|
217
217
|
});
|
|
218
|
-
var schemaUtils = registry.schemaUtils;
|
|
219
218
|
var _onChange = function _onChange(_ref) {
|
|
220
219
|
var value = _ref.target.value;
|
|
221
220
|
return onChange(value === '' ? options.emptyValue : value);
|
|
@@ -228,7 +227,6 @@ function BaseInputTemplate(props) {
|
|
|
228
227
|
var value = _ref3.target.value;
|
|
229
228
|
return onFocus(id, value);
|
|
230
229
|
};
|
|
231
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
232
230
|
return jsxs(FormControl, _extends({
|
|
233
231
|
mb: 1
|
|
234
232
|
}, chakraProps, {
|
|
@@ -236,11 +234,11 @@ function BaseInputTemplate(props) {
|
|
|
236
234
|
isRequired: required,
|
|
237
235
|
isReadOnly: readonly,
|
|
238
236
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
239
|
-
children: [
|
|
237
|
+
children: [labelValue(jsx(FormLabel, {
|
|
240
238
|
htmlFor: id,
|
|
241
239
|
id: id + "-label",
|
|
242
|
-
children: label
|
|
243
|
-
})
|
|
240
|
+
children: label
|
|
241
|
+
}), hideLabel || !label), jsx(Input, _extends({
|
|
244
242
|
id: id,
|
|
245
243
|
name: id,
|
|
246
244
|
value: value || value === 0 ? value : '',
|
|
@@ -467,16 +465,16 @@ function ObjectFieldTemplate(props) {
|
|
|
467
465
|
// Button templates are not overridden in the uiSchema
|
|
468
466
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
469
467
|
return jsxs(Fragment, {
|
|
470
|
-
children: [
|
|
468
|
+
children: [title && jsx(TitleFieldTemplate, {
|
|
471
469
|
id: titleId(idSchema),
|
|
472
|
-
title:
|
|
470
|
+
title: title,
|
|
473
471
|
required: required,
|
|
474
472
|
schema: schema,
|
|
475
473
|
uiSchema: uiSchema,
|
|
476
474
|
registry: registry
|
|
477
|
-
}),
|
|
475
|
+
}), description && jsx(DescriptionFieldTemplate, {
|
|
478
476
|
id: descriptionId(idSchema),
|
|
479
|
-
description:
|
|
477
|
+
description: description,
|
|
480
478
|
schema: schema,
|
|
481
479
|
uiSchema: uiSchema,
|
|
482
480
|
registry: registry
|
|
@@ -812,6 +810,9 @@ function CheckboxWidget(props) {
|
|
|
812
810
|
onBlur = props.onBlur,
|
|
813
811
|
onFocus = props.onFocus,
|
|
814
812
|
label = props.label,
|
|
813
|
+
hideLabel = props.hideLabel,
|
|
814
|
+
registry = props.registry,
|
|
815
|
+
options = props.options,
|
|
815
816
|
uiSchema = props.uiSchema,
|
|
816
817
|
schema = props.schema;
|
|
817
818
|
var chakraProps = getChakra({
|
|
@@ -821,6 +822,8 @@ function CheckboxWidget(props) {
|
|
|
821
822
|
// the "required" attribute if the field value must be "true", due to the
|
|
822
823
|
// "const" or "enum" keywords
|
|
823
824
|
var required = schemaRequiresTrueValue(schema);
|
|
825
|
+
var DescriptionFieldTemplate = getTemplate('DescriptionFieldTemplate', registry, options);
|
|
826
|
+
var description = options.description || schema.description;
|
|
824
827
|
var _onChange = function _onChange(_ref) {
|
|
825
828
|
var checked = _ref.target.checked;
|
|
826
829
|
return onChange(checked);
|
|
@@ -833,11 +836,17 @@ function CheckboxWidget(props) {
|
|
|
833
836
|
var value = _ref3.target.value;
|
|
834
837
|
return onFocus(id, value);
|
|
835
838
|
};
|
|
836
|
-
return
|
|
839
|
+
return jsxs(FormControl, _extends({
|
|
837
840
|
mb: 1
|
|
838
841
|
}, chakraProps, {
|
|
839
842
|
isRequired: required,
|
|
840
|
-
children: jsx(
|
|
843
|
+
children: [!hideLabel && !!description && jsx(DescriptionFieldTemplate, {
|
|
844
|
+
id: descriptionId(id),
|
|
845
|
+
description: description,
|
|
846
|
+
schema: schema,
|
|
847
|
+
uiSchema: uiSchema,
|
|
848
|
+
registry: registry
|
|
849
|
+
}), jsx(Checkbox, {
|
|
841
850
|
id: id,
|
|
842
851
|
name: id,
|
|
843
852
|
isChecked: typeof value === 'undefined' ? false : value,
|
|
@@ -846,10 +855,10 @@ function CheckboxWidget(props) {
|
|
|
846
855
|
onBlur: _onBlur,
|
|
847
856
|
onFocus: _onFocus,
|
|
848
857
|
"aria-describedby": ariaDescribedByIds(id),
|
|
849
|
-
children:
|
|
858
|
+
children: labelValue(jsx(Text, {
|
|
850
859
|
children: label
|
|
851
|
-
})
|
|
852
|
-
})
|
|
860
|
+
}), hideLabel || !label)
|
|
861
|
+
})]
|
|
853
862
|
}));
|
|
854
863
|
}
|
|
855
864
|
|
|
@@ -864,10 +873,10 @@ function CheckboxesWidget(props) {
|
|
|
864
873
|
onFocus = props.onFocus,
|
|
865
874
|
required = props.required,
|
|
866
875
|
label = props.label,
|
|
876
|
+
hideLabel = props.hideLabel,
|
|
867
877
|
uiSchema = props.uiSchema,
|
|
868
878
|
_props$rawErrors = props.rawErrors,
|
|
869
|
-
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors
|
|
870
|
-
schema = props.schema;
|
|
879
|
+
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
|
|
871
880
|
var enumOptions = options.enumOptions,
|
|
872
881
|
enumDisabled = options.enumDisabled,
|
|
873
882
|
emptyValue = options.emptyValue;
|
|
@@ -892,11 +901,11 @@ function CheckboxesWidget(props) {
|
|
|
892
901
|
isRequired: required,
|
|
893
902
|
isReadOnly: readonly,
|
|
894
903
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
895
|
-
children: [jsx(FormLabel, {
|
|
904
|
+
children: [labelValue(jsx(FormLabel, {
|
|
896
905
|
htmlFor: id,
|
|
897
906
|
id: id + "-label",
|
|
898
|
-
children: label
|
|
899
|
-
}), jsx(CheckboxGroup, {
|
|
907
|
+
children: label
|
|
908
|
+
}), hideLabel || !label), jsx(CheckboxGroup, {
|
|
900
909
|
onChange: function onChange(option) {
|
|
901
910
|
return _onChange(enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
902
911
|
},
|
|
@@ -926,14 +935,15 @@ function CheckboxesWidget(props) {
|
|
|
926
935
|
}
|
|
927
936
|
|
|
928
937
|
function RadioWidget(_ref) {
|
|
938
|
+
var _enumOptionsIndexForV;
|
|
929
939
|
var id = _ref.id,
|
|
930
|
-
schema = _ref.schema,
|
|
931
940
|
options = _ref.options,
|
|
932
941
|
value = _ref.value,
|
|
933
942
|
required = _ref.required,
|
|
934
943
|
disabled = _ref.disabled,
|
|
935
944
|
readonly = _ref.readonly,
|
|
936
945
|
label = _ref.label,
|
|
946
|
+
hideLabel = _ref.hideLabel,
|
|
937
947
|
onChange = _ref.onChange,
|
|
938
948
|
onBlur = _ref.onBlur,
|
|
939
949
|
onFocus = _ref.onFocus,
|
|
@@ -956,18 +966,18 @@ function RadioWidget(_ref) {
|
|
|
956
966
|
return onFocus(id, enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
957
967
|
};
|
|
958
968
|
var row = options ? options.inline : false;
|
|
959
|
-
var selectedIndex = enumOptionsIndexForValue(value, enumOptions);
|
|
969
|
+
var selectedIndex = (_enumOptionsIndexForV = enumOptionsIndexForValue(value, enumOptions)) != null ? _enumOptionsIndexForV : null;
|
|
960
970
|
return jsxs(FormControl, _extends({
|
|
961
971
|
mb: 1
|
|
962
972
|
}, chakraProps, {
|
|
963
973
|
isDisabled: disabled || readonly,
|
|
964
974
|
isRequired: required,
|
|
965
975
|
isReadOnly: readonly,
|
|
966
|
-
children: [jsx(FormLabel, {
|
|
976
|
+
children: [labelValue(jsx(FormLabel, {
|
|
967
977
|
htmlFor: id,
|
|
968
978
|
id: id + "-label",
|
|
969
|
-
children: label
|
|
970
|
-
}), jsx(RadioGroup, {
|
|
979
|
+
children: label
|
|
980
|
+
}), hideLabel || !label), jsx(RadioGroup, {
|
|
971
981
|
onChange: _onChange,
|
|
972
982
|
onBlur: _onBlur,
|
|
973
983
|
onFocus: _onFocus,
|
|
@@ -1001,9 +1011,8 @@ function RangeWidget(_ref) {
|
|
|
1001
1011
|
uiSchema = _ref.uiSchema,
|
|
1002
1012
|
onChange = _ref.onChange,
|
|
1003
1013
|
label = _ref.label,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
var schemaUtils = registry.schemaUtils;
|
|
1014
|
+
hideLabel = _ref.hideLabel,
|
|
1015
|
+
id = _ref.id;
|
|
1007
1016
|
var chakraProps = getChakra({
|
|
1008
1017
|
uiSchema: uiSchema
|
|
1009
1018
|
});
|
|
@@ -1012,7 +1021,6 @@ function RangeWidget(_ref) {
|
|
|
1012
1021
|
label: label,
|
|
1013
1022
|
id: id
|
|
1014
1023
|
}, rangeSpec(schema));
|
|
1015
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1016
1024
|
var _onChange = function _onChange(value) {
|
|
1017
1025
|
return onChange(value === undefined ? options.emptyValue : value);
|
|
1018
1026
|
};
|
|
@@ -1027,10 +1035,10 @@ function RangeWidget(_ref) {
|
|
|
1027
1035
|
return jsxs(FormControl, _extends({
|
|
1028
1036
|
mb: 1
|
|
1029
1037
|
}, chakraProps, {
|
|
1030
|
-
children: [
|
|
1038
|
+
children: [labelValue(jsx(FormLabel, {
|
|
1031
1039
|
htmlFor: id,
|
|
1032
|
-
children: label
|
|
1033
|
-
})
|
|
1040
|
+
children: label
|
|
1041
|
+
}), hideLabel || !label), jsxs(Slider, _extends({}, sliderWidgetProps, {
|
|
1034
1042
|
id: id,
|
|
1035
1043
|
name: id,
|
|
1036
1044
|
isDisabled: disabled || readonly,
|
|
@@ -1046,10 +1054,10 @@ function RangeWidget(_ref) {
|
|
|
1046
1054
|
}
|
|
1047
1055
|
|
|
1048
1056
|
function SelectWidget(props) {
|
|
1049
|
-
var
|
|
1050
|
-
id = props.id,
|
|
1057
|
+
var id = props.id,
|
|
1051
1058
|
options = props.options,
|
|
1052
1059
|
label = props.label,
|
|
1060
|
+
hideLabel = props.hideLabel,
|
|
1053
1061
|
placeholder = props.placeholder,
|
|
1054
1062
|
multiple = props.multiple,
|
|
1055
1063
|
required = props.required,
|
|
@@ -1114,10 +1122,11 @@ function SelectWidget(props) {
|
|
|
1114
1122
|
isRequired: required,
|
|
1115
1123
|
isReadOnly: readonly,
|
|
1116
1124
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1117
|
-
children: [(
|
|
1118
|
-
htmlFor:
|
|
1119
|
-
|
|
1120
|
-
|
|
1125
|
+
children: [labelValue(jsx(FormLabel, {
|
|
1126
|
+
htmlFor: id,
|
|
1127
|
+
id: id + "-label",
|
|
1128
|
+
children: label
|
|
1129
|
+
}), hideLabel || !label), jsx(Select, {
|
|
1121
1130
|
inputId: id,
|
|
1122
1131
|
name: id,
|
|
1123
1132
|
isMulti: isMultiple,
|
|
@@ -1139,6 +1148,7 @@ function TextareaWidget(_ref) {
|
|
|
1139
1148
|
placeholder = _ref.placeholder,
|
|
1140
1149
|
value = _ref.value,
|
|
1141
1150
|
label = _ref.label,
|
|
1151
|
+
hideLabel = _ref.hideLabel,
|
|
1142
1152
|
disabled = _ref.disabled,
|
|
1143
1153
|
autofocus = _ref.autofocus,
|
|
1144
1154
|
readonly = _ref.readonly,
|
|
@@ -1146,16 +1156,12 @@ function TextareaWidget(_ref) {
|
|
|
1146
1156
|
onFocus = _ref.onFocus,
|
|
1147
1157
|
onChange = _ref.onChange,
|
|
1148
1158
|
options = _ref.options,
|
|
1149
|
-
schema = _ref.schema,
|
|
1150
1159
|
uiSchema = _ref.uiSchema,
|
|
1151
1160
|
required = _ref.required,
|
|
1152
|
-
rawErrors = _ref.rawErrors
|
|
1153
|
-
registry = _ref.registry;
|
|
1161
|
+
rawErrors = _ref.rawErrors;
|
|
1154
1162
|
var chakraProps = getChakra({
|
|
1155
1163
|
uiSchema: uiSchema
|
|
1156
1164
|
});
|
|
1157
|
-
var schemaUtils = registry.schemaUtils;
|
|
1158
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1159
1165
|
var _onChange = function _onChange(_ref2) {
|
|
1160
1166
|
var value = _ref2.target.value;
|
|
1161
1167
|
return onChange(value === '' ? options.emptyValue : value);
|
|
@@ -1175,10 +1181,10 @@ function TextareaWidget(_ref) {
|
|
|
1175
1181
|
isRequired: required,
|
|
1176
1182
|
isReadOnly: readonly,
|
|
1177
1183
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1178
|
-
children: [
|
|
1184
|
+
children: [labelValue(jsx(FormLabel, {
|
|
1179
1185
|
htmlFor: id,
|
|
1180
|
-
children: label
|
|
1181
|
-
})
|
|
1186
|
+
children: label
|
|
1187
|
+
}), hideLabel || !label), jsx(Textarea, {
|
|
1182
1188
|
id: id,
|
|
1183
1189
|
name: id,
|
|
1184
1190
|
value: value != null ? value : '',
|
|
@@ -1194,20 +1200,17 @@ function TextareaWidget(_ref) {
|
|
|
1194
1200
|
|
|
1195
1201
|
function UpDownWidget(props) {
|
|
1196
1202
|
var id = props.id,
|
|
1197
|
-
schema = props.schema,
|
|
1198
1203
|
uiSchema = props.uiSchema,
|
|
1199
1204
|
readonly = props.readonly,
|
|
1200
1205
|
disabled = props.disabled,
|
|
1201
1206
|
label = props.label,
|
|
1207
|
+
hideLabel = props.hideLabel,
|
|
1202
1208
|
value = props.value,
|
|
1203
1209
|
onChange = props.onChange,
|
|
1204
1210
|
onBlur = props.onBlur,
|
|
1205
1211
|
onFocus = props.onFocus,
|
|
1206
1212
|
rawErrors = props.rawErrors,
|
|
1207
|
-
required = props.required
|
|
1208
|
-
registry = props.registry;
|
|
1209
|
-
var schemaUtils = registry.schemaUtils;
|
|
1210
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1213
|
+
required = props.required;
|
|
1211
1214
|
var chakraProps = getChakra({
|
|
1212
1215
|
uiSchema: uiSchema
|
|
1213
1216
|
});
|
|
@@ -1229,10 +1232,10 @@ function UpDownWidget(props) {
|
|
|
1229
1232
|
isRequired: required,
|
|
1230
1233
|
isReadOnly: readonly,
|
|
1231
1234
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1232
|
-
children: [
|
|
1235
|
+
children: [labelValue(jsx(FormLabel, {
|
|
1233
1236
|
htmlFor: id,
|
|
1234
|
-
children: label
|
|
1235
|
-
})
|
|
1237
|
+
children: label
|
|
1238
|
+
}), hideLabel || !label), jsxs(NumberInput, {
|
|
1236
1239
|
value: value != null ? value : '',
|
|
1237
1240
|
onChange: _onChange,
|
|
1238
1241
|
onBlur: _onBlur,
|