@rjsf/chakra-ui 5.3.0 → 5.4.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 +56 -54
- 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 +57 -55
- package/dist/chakra-ui.esm.js.map +1 -1
- package/dist/chakra-ui.umd.development.js +56 -54
- 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 +7 -8
|
@@ -206,6 +206,7 @@ function BaseInputTemplate(props) {
|
|
|
206
206
|
type = props.type,
|
|
207
207
|
value = props.value,
|
|
208
208
|
label = props.label,
|
|
209
|
+
hideLabel = props.hideLabel,
|
|
209
210
|
schema = props.schema,
|
|
210
211
|
uiSchema = props.uiSchema,
|
|
211
212
|
onChange = props.onChange,
|
|
@@ -218,13 +219,11 @@ function BaseInputTemplate(props) {
|
|
|
218
219
|
rawErrors = props.rawErrors,
|
|
219
220
|
autofocus = props.autofocus,
|
|
220
221
|
placeholder = props.placeholder,
|
|
221
|
-
disabled = props.disabled
|
|
222
|
-
registry = props.registry;
|
|
222
|
+
disabled = props.disabled;
|
|
223
223
|
var inputProps = utils.getInputProps(schema, type, options);
|
|
224
224
|
var chakraProps = getChakra({
|
|
225
225
|
uiSchema: uiSchema
|
|
226
226
|
});
|
|
227
|
-
var schemaUtils = registry.schemaUtils;
|
|
228
227
|
var _onChange = function _onChange(_ref) {
|
|
229
228
|
var value = _ref.target.value;
|
|
230
229
|
return onChange(value === '' ? options.emptyValue : value);
|
|
@@ -237,7 +236,6 @@ function BaseInputTemplate(props) {
|
|
|
237
236
|
var value = _ref3.target.value;
|
|
238
237
|
return onFocus(id, value);
|
|
239
238
|
};
|
|
240
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
241
239
|
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
242
240
|
mb: 1
|
|
243
241
|
}, chakraProps, {
|
|
@@ -245,11 +243,11 @@ function BaseInputTemplate(props) {
|
|
|
245
243
|
isRequired: required,
|
|
246
244
|
isReadOnly: readonly,
|
|
247
245
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
248
|
-
children: [
|
|
246
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
249
247
|
htmlFor: id,
|
|
250
248
|
id: id + "-label",
|
|
251
|
-
children: label
|
|
252
|
-
})
|
|
249
|
+
children: label
|
|
250
|
+
}), hideLabel || !label), jsxRuntime.jsx(react.Input, _extends({
|
|
253
251
|
id: id,
|
|
254
252
|
name: id,
|
|
255
253
|
value: value || value === 0 ? value : '',
|
|
@@ -476,16 +474,16 @@ function ObjectFieldTemplate(props) {
|
|
|
476
474
|
// Button templates are not overridden in the uiSchema
|
|
477
475
|
var AddButton = registry.templates.ButtonTemplates.AddButton;
|
|
478
476
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
479
|
-
children: [
|
|
477
|
+
children: [title && jsxRuntime.jsx(TitleFieldTemplate, {
|
|
480
478
|
id: utils.titleId(idSchema),
|
|
481
|
-
title:
|
|
479
|
+
title: title,
|
|
482
480
|
required: required,
|
|
483
481
|
schema: schema,
|
|
484
482
|
uiSchema: uiSchema,
|
|
485
483
|
registry: registry
|
|
486
|
-
}),
|
|
484
|
+
}), description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
487
485
|
id: utils.descriptionId(idSchema),
|
|
488
|
-
description:
|
|
486
|
+
description: description,
|
|
489
487
|
schema: schema,
|
|
490
488
|
uiSchema: uiSchema,
|
|
491
489
|
registry: registry
|
|
@@ -821,6 +819,9 @@ function CheckboxWidget(props) {
|
|
|
821
819
|
onBlur = props.onBlur,
|
|
822
820
|
onFocus = props.onFocus,
|
|
823
821
|
label = props.label,
|
|
822
|
+
hideLabel = props.hideLabel,
|
|
823
|
+
registry = props.registry,
|
|
824
|
+
options = props.options,
|
|
824
825
|
uiSchema = props.uiSchema,
|
|
825
826
|
schema = props.schema;
|
|
826
827
|
var chakraProps = getChakra({
|
|
@@ -830,6 +831,8 @@ function CheckboxWidget(props) {
|
|
|
830
831
|
// the "required" attribute if the field value must be "true", due to the
|
|
831
832
|
// "const" or "enum" keywords
|
|
832
833
|
var required = utils.schemaRequiresTrueValue(schema);
|
|
834
|
+
var DescriptionFieldTemplate = utils.getTemplate('DescriptionFieldTemplate', registry, options);
|
|
835
|
+
var description = options.description || schema.description;
|
|
833
836
|
var _onChange = function _onChange(_ref) {
|
|
834
837
|
var checked = _ref.target.checked;
|
|
835
838
|
return onChange(checked);
|
|
@@ -842,11 +845,17 @@ function CheckboxWidget(props) {
|
|
|
842
845
|
var value = _ref3.target.value;
|
|
843
846
|
return onFocus(id, value);
|
|
844
847
|
};
|
|
845
|
-
return jsxRuntime.
|
|
848
|
+
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
846
849
|
mb: 1
|
|
847
850
|
}, chakraProps, {
|
|
848
851
|
isRequired: required,
|
|
849
|
-
children: jsxRuntime.jsx(
|
|
852
|
+
children: [!hideLabel && !!description && jsxRuntime.jsx(DescriptionFieldTemplate, {
|
|
853
|
+
id: utils.descriptionId(id),
|
|
854
|
+
description: description,
|
|
855
|
+
schema: schema,
|
|
856
|
+
uiSchema: uiSchema,
|
|
857
|
+
registry: registry
|
|
858
|
+
}), jsxRuntime.jsx(react.Checkbox, {
|
|
850
859
|
id: id,
|
|
851
860
|
name: id,
|
|
852
861
|
isChecked: typeof value === 'undefined' ? false : value,
|
|
@@ -855,10 +864,10 @@ function CheckboxWidget(props) {
|
|
|
855
864
|
onBlur: _onBlur,
|
|
856
865
|
onFocus: _onFocus,
|
|
857
866
|
"aria-describedby": utils.ariaDescribedByIds(id),
|
|
858
|
-
children:
|
|
867
|
+
children: utils.labelValue(jsxRuntime.jsx(react.Text, {
|
|
859
868
|
children: label
|
|
860
|
-
})
|
|
861
|
-
})
|
|
869
|
+
}), hideLabel || !label)
|
|
870
|
+
})]
|
|
862
871
|
}));
|
|
863
872
|
}
|
|
864
873
|
|
|
@@ -873,10 +882,10 @@ function CheckboxesWidget(props) {
|
|
|
873
882
|
onFocus = props.onFocus,
|
|
874
883
|
required = props.required,
|
|
875
884
|
label = props.label,
|
|
885
|
+
hideLabel = props.hideLabel,
|
|
876
886
|
uiSchema = props.uiSchema,
|
|
877
887
|
_props$rawErrors = props.rawErrors,
|
|
878
|
-
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors
|
|
879
|
-
schema = props.schema;
|
|
888
|
+
rawErrors = _props$rawErrors === void 0 ? [] : _props$rawErrors;
|
|
880
889
|
var enumOptions = options.enumOptions,
|
|
881
890
|
enumDisabled = options.enumDisabled,
|
|
882
891
|
emptyValue = options.emptyValue;
|
|
@@ -901,11 +910,11 @@ function CheckboxesWidget(props) {
|
|
|
901
910
|
isRequired: required,
|
|
902
911
|
isReadOnly: readonly,
|
|
903
912
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
904
|
-
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
913
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
905
914
|
htmlFor: id,
|
|
906
915
|
id: id + "-label",
|
|
907
|
-
children: label
|
|
908
|
-
}), jsxRuntime.jsx(react.CheckboxGroup, {
|
|
916
|
+
children: label
|
|
917
|
+
}), hideLabel || !label), jsxRuntime.jsx(react.CheckboxGroup, {
|
|
909
918
|
onChange: function onChange(option) {
|
|
910
919
|
return _onChange(utils.enumOptionsValueForIndex(option, enumOptions, emptyValue));
|
|
911
920
|
},
|
|
@@ -935,14 +944,15 @@ function CheckboxesWidget(props) {
|
|
|
935
944
|
}
|
|
936
945
|
|
|
937
946
|
function RadioWidget(_ref) {
|
|
947
|
+
var _enumOptionsIndexForV;
|
|
938
948
|
var id = _ref.id,
|
|
939
|
-
schema = _ref.schema,
|
|
940
949
|
options = _ref.options,
|
|
941
950
|
value = _ref.value,
|
|
942
951
|
required = _ref.required,
|
|
943
952
|
disabled = _ref.disabled,
|
|
944
953
|
readonly = _ref.readonly,
|
|
945
954
|
label = _ref.label,
|
|
955
|
+
hideLabel = _ref.hideLabel,
|
|
946
956
|
onChange = _ref.onChange,
|
|
947
957
|
onBlur = _ref.onBlur,
|
|
948
958
|
onFocus = _ref.onFocus,
|
|
@@ -965,18 +975,18 @@ function RadioWidget(_ref) {
|
|
|
965
975
|
return onFocus(id, utils.enumOptionsValueForIndex(value, enumOptions, emptyValue));
|
|
966
976
|
};
|
|
967
977
|
var row = options ? options.inline : false;
|
|
968
|
-
var selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions);
|
|
978
|
+
var selectedIndex = (_enumOptionsIndexForV = utils.enumOptionsIndexForValue(value, enumOptions)) != null ? _enumOptionsIndexForV : null;
|
|
969
979
|
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
970
980
|
mb: 1
|
|
971
981
|
}, chakraProps, {
|
|
972
982
|
isDisabled: disabled || readonly,
|
|
973
983
|
isRequired: required,
|
|
974
984
|
isReadOnly: readonly,
|
|
975
|
-
children: [jsxRuntime.jsx(react.FormLabel, {
|
|
985
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
976
986
|
htmlFor: id,
|
|
977
987
|
id: id + "-label",
|
|
978
|
-
children: label
|
|
979
|
-
}), jsxRuntime.jsx(react.RadioGroup, {
|
|
988
|
+
children: label
|
|
989
|
+
}), hideLabel || !label), jsxRuntime.jsx(react.RadioGroup, {
|
|
980
990
|
onChange: _onChange,
|
|
981
991
|
onBlur: _onBlur,
|
|
982
992
|
onFocus: _onFocus,
|
|
@@ -1010,9 +1020,8 @@ function RangeWidget(_ref) {
|
|
|
1010
1020
|
uiSchema = _ref.uiSchema,
|
|
1011
1021
|
onChange = _ref.onChange,
|
|
1012
1022
|
label = _ref.label,
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
var schemaUtils = registry.schemaUtils;
|
|
1023
|
+
hideLabel = _ref.hideLabel,
|
|
1024
|
+
id = _ref.id;
|
|
1016
1025
|
var chakraProps = getChakra({
|
|
1017
1026
|
uiSchema: uiSchema
|
|
1018
1027
|
});
|
|
@@ -1021,7 +1030,6 @@ function RangeWidget(_ref) {
|
|
|
1021
1030
|
label: label,
|
|
1022
1031
|
id: id
|
|
1023
1032
|
}, utils.rangeSpec(schema));
|
|
1024
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1025
1033
|
var _onChange = function _onChange(value) {
|
|
1026
1034
|
return onChange(value === undefined ? options.emptyValue : value);
|
|
1027
1035
|
};
|
|
@@ -1036,10 +1044,10 @@ function RangeWidget(_ref) {
|
|
|
1036
1044
|
return jsxRuntime.jsxs(react.FormControl, _extends({
|
|
1037
1045
|
mb: 1
|
|
1038
1046
|
}, chakraProps, {
|
|
1039
|
-
children: [
|
|
1047
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
1040
1048
|
htmlFor: id,
|
|
1041
|
-
children: label
|
|
1042
|
-
})
|
|
1049
|
+
children: label
|
|
1050
|
+
}), hideLabel || !label), jsxRuntime.jsxs(react.Slider, _extends({}, sliderWidgetProps, {
|
|
1043
1051
|
id: id,
|
|
1044
1052
|
name: id,
|
|
1045
1053
|
isDisabled: disabled || readonly,
|
|
@@ -1055,10 +1063,10 @@ function RangeWidget(_ref) {
|
|
|
1055
1063
|
}
|
|
1056
1064
|
|
|
1057
1065
|
function SelectWidget(props) {
|
|
1058
|
-
var
|
|
1059
|
-
id = props.id,
|
|
1066
|
+
var id = props.id,
|
|
1060
1067
|
options = props.options,
|
|
1061
1068
|
label = props.label,
|
|
1069
|
+
hideLabel = props.hideLabel,
|
|
1062
1070
|
placeholder = props.placeholder,
|
|
1063
1071
|
multiple = props.multiple,
|
|
1064
1072
|
required = props.required,
|
|
@@ -1123,10 +1131,10 @@ function SelectWidget(props) {
|
|
|
1123
1131
|
isRequired: required,
|
|
1124
1132
|
isReadOnly: readonly,
|
|
1125
1133
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1126
|
-
children: [(
|
|
1134
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
1127
1135
|
htmlFor: isMultiple ? undefined : id,
|
|
1128
|
-
children: label
|
|
1129
|
-
}), jsxRuntime.jsx(chakraReactSelect.Select, {
|
|
1136
|
+
children: label
|
|
1137
|
+
}), hideLabel || !label), jsxRuntime.jsx(chakraReactSelect.Select, {
|
|
1130
1138
|
inputId: id,
|
|
1131
1139
|
name: id,
|
|
1132
1140
|
isMulti: isMultiple,
|
|
@@ -1148,6 +1156,7 @@ function TextareaWidget(_ref) {
|
|
|
1148
1156
|
placeholder = _ref.placeholder,
|
|
1149
1157
|
value = _ref.value,
|
|
1150
1158
|
label = _ref.label,
|
|
1159
|
+
hideLabel = _ref.hideLabel,
|
|
1151
1160
|
disabled = _ref.disabled,
|
|
1152
1161
|
autofocus = _ref.autofocus,
|
|
1153
1162
|
readonly = _ref.readonly,
|
|
@@ -1155,16 +1164,12 @@ function TextareaWidget(_ref) {
|
|
|
1155
1164
|
onFocus = _ref.onFocus,
|
|
1156
1165
|
onChange = _ref.onChange,
|
|
1157
1166
|
options = _ref.options,
|
|
1158
|
-
schema = _ref.schema,
|
|
1159
1167
|
uiSchema = _ref.uiSchema,
|
|
1160
1168
|
required = _ref.required,
|
|
1161
|
-
rawErrors = _ref.rawErrors
|
|
1162
|
-
registry = _ref.registry;
|
|
1169
|
+
rawErrors = _ref.rawErrors;
|
|
1163
1170
|
var chakraProps = getChakra({
|
|
1164
1171
|
uiSchema: uiSchema
|
|
1165
1172
|
});
|
|
1166
|
-
var schemaUtils = registry.schemaUtils;
|
|
1167
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1168
1173
|
var _onChange = function _onChange(_ref2) {
|
|
1169
1174
|
var value = _ref2.target.value;
|
|
1170
1175
|
return onChange(value === '' ? options.emptyValue : value);
|
|
@@ -1184,10 +1189,10 @@ function TextareaWidget(_ref) {
|
|
|
1184
1189
|
isRequired: required,
|
|
1185
1190
|
isReadOnly: readonly,
|
|
1186
1191
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1187
|
-
children: [
|
|
1192
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
1188
1193
|
htmlFor: id,
|
|
1189
|
-
children: label
|
|
1190
|
-
})
|
|
1194
|
+
children: label
|
|
1195
|
+
}), hideLabel || !label), jsxRuntime.jsx(react.Textarea, {
|
|
1191
1196
|
id: id,
|
|
1192
1197
|
name: id,
|
|
1193
1198
|
value: value != null ? value : '',
|
|
@@ -1203,20 +1208,17 @@ function TextareaWidget(_ref) {
|
|
|
1203
1208
|
|
|
1204
1209
|
function UpDownWidget(props) {
|
|
1205
1210
|
var id = props.id,
|
|
1206
|
-
schema = props.schema,
|
|
1207
1211
|
uiSchema = props.uiSchema,
|
|
1208
1212
|
readonly = props.readonly,
|
|
1209
1213
|
disabled = props.disabled,
|
|
1210
1214
|
label = props.label,
|
|
1215
|
+
hideLabel = props.hideLabel,
|
|
1211
1216
|
value = props.value,
|
|
1212
1217
|
onChange = props.onChange,
|
|
1213
1218
|
onBlur = props.onBlur,
|
|
1214
1219
|
onFocus = props.onFocus,
|
|
1215
1220
|
rawErrors = props.rawErrors,
|
|
1216
|
-
required = props.required
|
|
1217
|
-
registry = props.registry;
|
|
1218
|
-
var schemaUtils = registry.schemaUtils;
|
|
1219
|
-
var displayLabel = schemaUtils.getDisplayLabel(schema, uiSchema) && (!!label || !!schema.title);
|
|
1221
|
+
required = props.required;
|
|
1220
1222
|
var chakraProps = getChakra({
|
|
1221
1223
|
uiSchema: uiSchema
|
|
1222
1224
|
});
|
|
@@ -1238,10 +1240,10 @@ function UpDownWidget(props) {
|
|
|
1238
1240
|
isRequired: required,
|
|
1239
1241
|
isReadOnly: readonly,
|
|
1240
1242
|
isInvalid: rawErrors && rawErrors.length > 0,
|
|
1241
|
-
children: [
|
|
1243
|
+
children: [utils.labelValue(jsxRuntime.jsx(react.FormLabel, {
|
|
1242
1244
|
htmlFor: id,
|
|
1243
|
-
children: label
|
|
1244
|
-
})
|
|
1245
|
+
children: label
|
|
1246
|
+
}), hideLabel || !label), jsxRuntime.jsxs(react.NumberInput, {
|
|
1245
1247
|
value: value != null ? value : '',
|
|
1246
1248
|
onChange: _onChange,
|
|
1247
1249
|
onBlur: _onBlur,
|