@rjsf/mantine 6.6.0 → 6.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +110 -83
- package/dist/index.cjs.map +3 -3
- package/dist/mantine.esm.js +82 -119
- package/dist/mantine.esm.js.map +3 -3
- package/dist/mantine.umd.js +127 -101
- package/lib/Form/index.d.ts +3 -3
- package/lib/Form/index.js.map +1 -1
- package/lib/Theme/index.d.ts +2 -2
- package/lib/templates/ArrayFieldItemTemplate.d.ts +1 -1
- package/lib/templates/ArrayFieldItemTemplate.js +1 -1
- package/lib/templates/ArrayFieldItemTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTemplate.d.ts +1 -1
- package/lib/templates/ArrayFieldTemplate.js +1 -1
- package/lib/templates/ArrayFieldTemplate.js.map +1 -1
- package/lib/templates/ArrayFieldTitleTemplate.d.ts +1 -1
- package/lib/templates/ArrayFieldTitleTemplate.js +1 -1
- package/lib/templates/ArrayFieldTitleTemplate.js.map +1 -1
- package/lib/templates/BaseInputTemplate.d.ts +1 -1
- package/lib/templates/BaseInputTemplate.js +5 -5
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ButtonTemplates/AddButton.d.ts +1 -1
- package/lib/templates/ButtonTemplates/AddButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/IconButton.d.ts +15 -8
- package/lib/templates/ButtonTemplates/IconButton.js +14 -6
- package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/SubmitButton.d.ts +1 -1
- package/lib/templates/ButtonTemplates/SubmitButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/index.d.ts +1 -1
- package/lib/templates/DescriptionField.d.ts +1 -1
- package/lib/templates/ErrorList.d.ts +1 -1
- package/lib/templates/ErrorList.js.map +1 -1
- package/lib/templates/FieldErrorTemplate.d.ts +1 -1
- package/lib/templates/FieldErrorTemplate.js.map +1 -1
- package/lib/templates/FieldHelpTemplate.d.ts +1 -1
- package/lib/templates/FieldHelpTemplate.js.map +1 -1
- package/lib/templates/FieldTemplate.d.ts +1 -1
- package/lib/templates/FieldTemplate.js +1 -1
- package/lib/templates/FieldTemplate.js.map +1 -1
- package/lib/templates/GridTemplate.d.ts +1 -1
- package/lib/templates/MultiSchemaFieldTemplate.d.ts +1 -1
- package/lib/templates/ObjectFieldTemplate.d.ts +1 -1
- package/lib/templates/ObjectFieldTemplate.js +1 -1
- package/lib/templates/ObjectFieldTemplate.js.map +1 -1
- package/lib/templates/OptionalDataControlsTemplate.d.ts +1 -1
- package/lib/templates/OptionalDataControlsTemplate.js +1 -1
- package/lib/templates/OptionalDataControlsTemplate.js.map +1 -1
- package/lib/templates/TitleField.d.ts +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.d.ts +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/templates/icons.d.ts +1 -1
- package/lib/templates/index.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js.map +1 -1
- package/lib/widgets/CheckboxWidget.d.ts +2 -2
- package/lib/widgets/CheckboxWidget.js +1 -1
- package/lib/widgets/CheckboxWidget.js.map +1 -1
- package/lib/widgets/CheckboxesWidget.d.ts +1 -1
- package/lib/widgets/CheckboxesWidget.js +1 -1
- package/lib/widgets/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/ColorWidget.d.ts +1 -1
- package/lib/widgets/ColorWidget.js +1 -1
- package/lib/widgets/ColorWidget.js.map +1 -1
- package/lib/widgets/DateTime/AltDateTimeWidget.d.ts +1 -1
- package/lib/widgets/DateTime/AltDateWidget.d.ts +1 -1
- package/lib/widgets/DateTime/AltDateWidget.js +1 -1
- package/lib/widgets/DateTime/AltDateWidget.js.map +1 -1
- package/lib/widgets/DateTime/DateTimeInput.d.ts +1 -1
- package/lib/widgets/DateTime/DateTimeInput.js +1 -1
- package/lib/widgets/DateTime/DateTimeInput.js.map +1 -1
- package/lib/widgets/DateTime/DateTimeWidget.d.ts +1 -1
- package/lib/widgets/DateTime/DateWidget.d.ts +1 -1
- package/lib/widgets/DateTime/TimeWidget.d.ts +1 -1
- package/lib/widgets/DateTime/TimeWidget.js +1 -1
- package/lib/widgets/DateTime/TimeWidget.js.map +1 -1
- package/lib/widgets/FileWidget.d.ts +1 -1
- package/lib/widgets/FileWidget.js +2 -1
- package/lib/widgets/FileWidget.js.map +1 -1
- package/lib/widgets/PasswordWidget.d.ts +1 -1
- package/lib/widgets/PasswordWidget.js +2 -2
- package/lib/widgets/PasswordWidget.js.map +1 -1
- package/lib/widgets/RadioWidget.d.ts +1 -1
- package/lib/widgets/RadioWidget.js +1 -1
- package/lib/widgets/RadioWidget.js.map +1 -1
- package/lib/widgets/RangeWidget.d.ts +1 -1
- package/lib/widgets/RangeWidget.js +1 -1
- package/lib/widgets/RangeWidget.js.map +1 -1
- package/lib/widgets/SelectWidget.d.ts +1 -1
- package/lib/widgets/SelectWidget.js +1 -1
- package/lib/widgets/SelectWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.d.ts +2 -2
- package/lib/widgets/TextareaWidget.js +1 -1
- package/lib/widgets/TextareaWidget.js.map +1 -1
- package/lib/widgets/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/Form/index.ts +4 -3
- package/src/Theme/index.ts +2 -2
- package/src/templates/ArrayFieldItemTemplate.tsx +2 -8
- package/src/templates/ArrayFieldTemplate.tsx +2 -9
- package/src/templates/ArrayFieldTitleTemplate.tsx +2 -8
- package/src/templates/BaseInputTemplate.tsx +8 -15
- package/src/templates/ButtonTemplates/AddButton.tsx +2 -1
- package/src/templates/ButtonTemplates/IconButton.tsx +19 -10
- package/src/templates/ButtonTemplates/SubmitButton.tsx +2 -1
- package/src/templates/ButtonTemplates/index.ts +1 -1
- package/src/templates/DescriptionField.tsx +1 -1
- package/src/templates/ErrorList.tsx +3 -1
- package/src/templates/FieldErrorTemplate.tsx +3 -1
- package/src/templates/FieldHelpTemplate.tsx +2 -1
- package/src/templates/FieldTemplate.tsx +2 -8
- package/src/templates/GridTemplate.tsx +1 -1
- package/src/templates/MultiSchemaFieldTemplate.tsx +1 -1
- package/src/templates/ObjectFieldTemplate.tsx +4 -8
- package/src/templates/OptionalDataControlsTemplate.tsx +3 -2
- package/src/templates/TitleField.tsx +1 -1
- package/src/templates/WrapIfAdditionalTemplate.tsx +2 -10
- package/src/templates/icons.tsx +1 -1
- package/src/templates/index.ts +1 -1
- package/src/utils.ts +2 -2
- package/src/widgets/CheckboxWidget.tsx +4 -11
- package/src/widgets/CheckboxesWidget.tsx +5 -7
- package/src/widgets/ColorWidget.tsx +4 -9
- package/src/widgets/DateTime/AltDateTimeWidget.tsx +1 -1
- package/src/widgets/DateTime/AltDateWidget.tsx +4 -12
- package/src/widgets/DateTime/DateTimeInput.tsx +2 -8
- package/src/widgets/DateTime/DateTimeWidget.tsx +1 -1
- package/src/widgets/DateTime/DateWidget.tsx +1 -1
- package/src/widgets/DateTime/TimeWidget.tsx +4 -9
- package/src/widgets/FileWidget.tsx +4 -9
- package/src/widgets/PasswordWidget.tsx +5 -10
- package/src/widgets/RadioWidget.tsx +5 -7
- package/src/widgets/RangeWidget.tsx +3 -9
- package/src/widgets/SelectWidget.tsx +4 -6
- package/src/widgets/TextareaWidget.tsx +4 -9
- package/src/widgets/index.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -235,12 +235,12 @@ function BaseInputTemplate(props) {
|
|
|
235
235
|
const inputProps = (0, import_utils4.getInputProps)(schema, type, options, false);
|
|
236
236
|
const description = hideLabel ? void 0 : options.description || schema.description;
|
|
237
237
|
const themeProps = cleanupOptions(options);
|
|
238
|
-
const handleNumberChange = (0, import_react.useCallback)((
|
|
238
|
+
const handleNumberChange = (0, import_react.useCallback)((newValue) => onChange(newValue), [onChange]);
|
|
239
239
|
const handleChange = (0, import_react.useCallback)(
|
|
240
240
|
(e) => {
|
|
241
|
-
const handler = onChangeOverride
|
|
242
|
-
const
|
|
243
|
-
handler(
|
|
241
|
+
const handler = onChangeOverride || onChange;
|
|
242
|
+
const newValue = e.target.value === "" ? options.emptyValue : e.target.value;
|
|
243
|
+
handler(newValue);
|
|
244
244
|
},
|
|
245
245
|
[onChange, onChangeOverride, options]
|
|
246
246
|
);
|
|
@@ -462,10 +462,11 @@ function ExclamationCircle({ size, style, ...others }) {
|
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
// src/templates/ButtonTemplates/IconButton.tsx
|
|
465
|
+
var import_react2 = require("react");
|
|
465
466
|
var import_core6 = require("@mantine/core");
|
|
466
467
|
var import_utils6 = require("@rjsf/utils");
|
|
467
468
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
468
|
-
function
|
|
469
|
+
function IconButtonFn(props) {
|
|
469
470
|
const { icon, iconType = "sm", color, onClick, uiSchema, registry, ...otherProps } = props;
|
|
470
471
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
471
472
|
import_core6.ActionIcon,
|
|
@@ -478,13 +479,16 @@ function IconButton(props) {
|
|
|
478
479
|
}
|
|
479
480
|
);
|
|
480
481
|
}
|
|
481
|
-
|
|
482
|
+
var IconButton = (0, import_react2.memo)(IconButtonFn);
|
|
483
|
+
var IconButton_default = IconButton;
|
|
484
|
+
function CopyButtonFn(props) {
|
|
482
485
|
const {
|
|
483
486
|
registry: { translateString }
|
|
484
487
|
} = props;
|
|
485
488
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils6.TranslatableString.CopyButton), variant: "subtle", ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Copy, {}) });
|
|
486
489
|
}
|
|
487
|
-
|
|
490
|
+
var CopyButton = (0, import_react2.memo)(CopyButtonFn);
|
|
491
|
+
function MoveDownButtonFn(props) {
|
|
488
492
|
const {
|
|
489
493
|
registry: { translateString }
|
|
490
494
|
} = props;
|
|
@@ -498,7 +502,8 @@ function MoveDownButton(props) {
|
|
|
498
502
|
}
|
|
499
503
|
);
|
|
500
504
|
}
|
|
501
|
-
|
|
505
|
+
var MoveDownButton = (0, import_react2.memo)(MoveDownButtonFn);
|
|
506
|
+
function MoveUpButtonFn(props) {
|
|
502
507
|
const {
|
|
503
508
|
registry: { translateString }
|
|
504
509
|
} = props;
|
|
@@ -512,7 +517,8 @@ function MoveUpButton(props) {
|
|
|
512
517
|
}
|
|
513
518
|
);
|
|
514
519
|
}
|
|
515
|
-
|
|
520
|
+
var MoveUpButton = (0, import_react2.memo)(MoveUpButtonFn);
|
|
521
|
+
function RemoveButtonFn(props) {
|
|
516
522
|
const {
|
|
517
523
|
registry: { translateString }
|
|
518
524
|
} = props;
|
|
@@ -527,12 +533,14 @@ function RemoveButton(props) {
|
|
|
527
533
|
}
|
|
528
534
|
);
|
|
529
535
|
}
|
|
530
|
-
|
|
536
|
+
var RemoveButton = (0, import_react2.memo)(RemoveButtonFn);
|
|
537
|
+
function ClearButtonFn(props) {
|
|
531
538
|
const {
|
|
532
539
|
registry: { translateString }
|
|
533
540
|
} = props;
|
|
534
541
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconButton, { title: translateString(import_utils6.TranslatableString.ClearButton), variant: "subtle", ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(X, {}) });
|
|
535
542
|
}
|
|
543
|
+
var ClearButton = (0, import_react2.memo)(ClearButtonFn);
|
|
536
544
|
|
|
537
545
|
// src/templates/ButtonTemplates/AddButton.tsx
|
|
538
546
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -540,7 +548,7 @@ function AddButton(props) {
|
|
|
540
548
|
const {
|
|
541
549
|
registry: { translateString }
|
|
542
550
|
} = props;
|
|
543
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IconButton_default, { title: translateString(import_utils7.TranslatableString.AddItemButton), variant: "subtle", ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Plus, {}) });
|
|
544
552
|
}
|
|
545
553
|
|
|
546
554
|
// src/templates/ButtonTemplates/SubmitButton.tsx
|
|
@@ -597,7 +605,10 @@ function ErrorList({
|
|
|
597
605
|
variant: "transparent",
|
|
598
606
|
title: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core10.Title, { order: 5, fw: "normal", children: translateString(import_utils9.TranslatableString.ErrorsLabel) }),
|
|
599
607
|
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ExclamationCircle, {}),
|
|
600
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core10.List, { children: errors.map((error, index) =>
|
|
608
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core10.List, { children: errors.map((error, index) => (
|
|
609
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
610
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_core10.List.Item, { c: "red", children: error.stack }, `error-${index}`)
|
|
611
|
+
)) })
|
|
601
612
|
}
|
|
602
613
|
);
|
|
603
614
|
}
|
|
@@ -605,7 +616,10 @@ function ErrorList({
|
|
|
605
616
|
// src/templates/FieldErrorTemplate.tsx
|
|
606
617
|
var import_core11 = require("@mantine/core");
|
|
607
618
|
var import_utils10 = require("@rjsf/utils");
|
|
608
|
-
var import_jsx_runtime11 =
|
|
619
|
+
var import_jsx_runtime11 = (
|
|
620
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
621
|
+
require("react/jsx-runtime")
|
|
622
|
+
);
|
|
609
623
|
function FieldErrorTemplate({ errors, fieldPathId }) {
|
|
610
624
|
if (!errors || !errors.length) {
|
|
611
625
|
return null;
|
|
@@ -804,7 +818,8 @@ function OptionalDataControlsTemplate(props) {
|
|
|
804
818
|
title: label
|
|
805
819
|
}
|
|
806
820
|
);
|
|
807
|
-
}
|
|
821
|
+
}
|
|
822
|
+
if (onRemoveClick) {
|
|
808
823
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
809
824
|
RemoveButton,
|
|
810
825
|
{
|
|
@@ -931,7 +946,7 @@ var import_dayjs2 = __toESM(require("dayjs"), 1);
|
|
|
931
946
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"), 1);
|
|
932
947
|
|
|
933
948
|
// src/widgets/CheckboxesWidget.tsx
|
|
934
|
-
var
|
|
949
|
+
var import_react3 = require("react");
|
|
935
950
|
var import_core20 = require("@mantine/core");
|
|
936
951
|
var import_utils15 = require("@rjsf/utils");
|
|
937
952
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
@@ -955,7 +970,7 @@ function CheckboxesWidget(props) {
|
|
|
955
970
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
956
971
|
const optionValueFormat = (0, import_utils15.getOptionValueFormat)(options);
|
|
957
972
|
const themeProps = cleanupOptions(options);
|
|
958
|
-
const handleChange = (0,
|
|
973
|
+
const handleChange = (0, import_react3.useCallback)(
|
|
959
974
|
(nextValue) => {
|
|
960
975
|
if (!disabled && !readonly && onChange) {
|
|
961
976
|
onChange((0, import_utils15.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -963,7 +978,7 @@ function CheckboxesWidget(props) {
|
|
|
963
978
|
},
|
|
964
979
|
[onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]
|
|
965
980
|
);
|
|
966
|
-
const handleBlur = (0,
|
|
981
|
+
const handleBlur = (0, import_react3.useCallback)(
|
|
967
982
|
({ target }) => {
|
|
968
983
|
if (onBlur) {
|
|
969
984
|
onBlur(id, (0, import_utils15.enumOptionValueDecoder)(target.value, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -971,7 +986,7 @@ function CheckboxesWidget(props) {
|
|
|
971
986
|
},
|
|
972
987
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
973
988
|
);
|
|
974
|
-
const handleFocus = (0,
|
|
989
|
+
const handleFocus = (0, import_react3.useCallback)(
|
|
975
990
|
({ target }) => {
|
|
976
991
|
if (onFocus) {
|
|
977
992
|
onFocus(id, (0, import_utils15.enumOptionValueDecoder)(target.value, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1000,12 +1015,12 @@ function CheckboxesWidget(props) {
|
|
|
1000
1015
|
name: htmlName || id,
|
|
1001
1016
|
value: (0, import_utils15.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
1002
1017
|
label: option.label,
|
|
1003
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1018
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
1004
1019
|
autoFocus: i === 0 && autofocus,
|
|
1005
1020
|
onBlur: handleBlur,
|
|
1006
1021
|
onFocus: handleFocus
|
|
1007
1022
|
},
|
|
1008
|
-
|
|
1023
|
+
String(option.value)
|
|
1009
1024
|
)) }) : null
|
|
1010
1025
|
}
|
|
1011
1026
|
)
|
|
@@ -1013,7 +1028,7 @@ function CheckboxesWidget(props) {
|
|
|
1013
1028
|
}
|
|
1014
1029
|
|
|
1015
1030
|
// src/widgets/CheckboxWidget.tsx
|
|
1016
|
-
var
|
|
1031
|
+
var import_react4 = require("react");
|
|
1017
1032
|
var import_core21 = require("@mantine/core");
|
|
1018
1033
|
var import_utils17 = require("@rjsf/utils");
|
|
1019
1034
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -1043,7 +1058,7 @@ function CheckboxWidget(props) {
|
|
|
1043
1058
|
registry,
|
|
1044
1059
|
options
|
|
1045
1060
|
);
|
|
1046
|
-
const handleCheckboxChange = (0,
|
|
1061
|
+
const handleCheckboxChange = (0, import_react4.useCallback)(
|
|
1047
1062
|
(e) => {
|
|
1048
1063
|
if (!disabled && !readonly && onChange) {
|
|
1049
1064
|
onChange(e.currentTarget.checked);
|
|
@@ -1051,7 +1066,7 @@ function CheckboxWidget(props) {
|
|
|
1051
1066
|
},
|
|
1052
1067
|
[onChange, disabled, readonly]
|
|
1053
1068
|
);
|
|
1054
|
-
const handleBlur = (0,
|
|
1069
|
+
const handleBlur = (0, import_react4.useCallback)(
|
|
1055
1070
|
({ target }) => {
|
|
1056
1071
|
if (onBlur) {
|
|
1057
1072
|
onBlur(id, target.checked);
|
|
@@ -1059,7 +1074,7 @@ function CheckboxWidget(props) {
|
|
|
1059
1074
|
},
|
|
1060
1075
|
[onBlur, id]
|
|
1061
1076
|
);
|
|
1062
|
-
const handleFocus = (0,
|
|
1077
|
+
const handleFocus = (0, import_react4.useCallback)(
|
|
1063
1078
|
({ target }) => {
|
|
1064
1079
|
if (onFocus) {
|
|
1065
1080
|
onFocus(id, target.checked);
|
|
@@ -1100,7 +1115,7 @@ function CheckboxWidget(props) {
|
|
|
1100
1115
|
}
|
|
1101
1116
|
|
|
1102
1117
|
// src/widgets/ColorWidget.tsx
|
|
1103
|
-
var
|
|
1118
|
+
var import_react5 = require("react");
|
|
1104
1119
|
var import_core22 = require("@mantine/core");
|
|
1105
1120
|
var import_utils18 = require("@rjsf/utils");
|
|
1106
1121
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -1123,13 +1138,13 @@ function ColorWidget(props) {
|
|
|
1123
1138
|
onFocus
|
|
1124
1139
|
} = props;
|
|
1125
1140
|
const themeProps = cleanupOptions(options);
|
|
1126
|
-
const handleChange = (0,
|
|
1141
|
+
const handleChange = (0, import_react5.useCallback)(
|
|
1127
1142
|
(nextValue) => {
|
|
1128
1143
|
onChange(nextValue);
|
|
1129
1144
|
},
|
|
1130
1145
|
[onChange]
|
|
1131
1146
|
);
|
|
1132
|
-
const handleBlur = (0,
|
|
1147
|
+
const handleBlur = (0, import_react5.useCallback)(
|
|
1133
1148
|
({ target }) => {
|
|
1134
1149
|
if (onBlur) {
|
|
1135
1150
|
onBlur(id, target && target.value);
|
|
@@ -1137,7 +1152,7 @@ function ColorWidget(props) {
|
|
|
1137
1152
|
},
|
|
1138
1153
|
[onBlur, id]
|
|
1139
1154
|
);
|
|
1140
|
-
const handleFocus = (0,
|
|
1155
|
+
const handleFocus = (0, import_react5.useCallback)(
|
|
1141
1156
|
({ target }) => {
|
|
1142
1157
|
if (onFocus) {
|
|
1143
1158
|
onFocus(id, target && target.value);
|
|
@@ -1187,34 +1202,40 @@ function AltDateWidget(props) {
|
|
|
1187
1202
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_core23.Flex, { gap: "xs", align: "center", wrap: "nowrap", children: [
|
|
1188
1203
|
elements.map((elemProps, i) => {
|
|
1189
1204
|
const elemId = `${id}_${elemProps.type}`;
|
|
1190
|
-
return
|
|
1191
|
-
|
|
1192
|
-
{
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1205
|
+
return (
|
|
1206
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_core23.Box, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1208
|
+
import_core23.Select,
|
|
1209
|
+
{
|
|
1210
|
+
id: elemId,
|
|
1211
|
+
name: elemId,
|
|
1212
|
+
placeholder: elemProps.type,
|
|
1213
|
+
disabled: disabled || readonly,
|
|
1214
|
+
data: (0, import_utils20.dateRangeOptions)(elemProps.range[0], elemProps.range[1]).map((item) => item.value.toString()),
|
|
1215
|
+
value: !elemProps.value || elemProps.value < 0 ? null : elemProps.value.toString(),
|
|
1216
|
+
onChange: (v) => handleChange(elemProps.type, v || void 0),
|
|
1217
|
+
searchable: false,
|
|
1218
|
+
allowDeselect: false,
|
|
1219
|
+
comboboxProps: { withinPortal: false },
|
|
1220
|
+
"aria-describedby": (0, import_utils20.ariaDescribedByIds)(elemId)
|
|
1221
|
+
}
|
|
1222
|
+
) }, i)
|
|
1223
|
+
);
|
|
1206
1224
|
}),
|
|
1207
1225
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_core23.Group, { wrap: "nowrap", gap: 3, children: [
|
|
1208
1226
|
(options.hideNowButton !== "undefined" ? !options.hideNowButton : true) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_core23.Button, { variant: "subtle", size: "xs", onClick: handleSetNow, children: translateString(import_utils20.TranslatableString.NowLabel) }),
|
|
1209
1227
|
(options.hideClearButton !== "undefined" ? !options.hideClearButton : true) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_core23.Button, { variant: "subtle", size: "xs", onClick: handleClear, children: translateString(import_utils20.TranslatableString.ClearLabel) })
|
|
1210
1228
|
] })
|
|
1211
1229
|
] }),
|
|
1212
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) =>
|
|
1230
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => (
|
|
1231
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_core23.Input.Error, { children: error }, `alt-date-widget-input-errors-${index}`)
|
|
1233
|
+
))
|
|
1213
1234
|
] });
|
|
1214
1235
|
}
|
|
1215
1236
|
|
|
1216
1237
|
// src/widgets/DateTime/DateTimeInput.tsx
|
|
1217
|
-
var
|
|
1238
|
+
var import_react6 = require("react");
|
|
1218
1239
|
var import_dates = require("@mantine/dates");
|
|
1219
1240
|
var import_utils21 = require("@rjsf/utils");
|
|
1220
1241
|
var import_dayjs = __toESM(require("dayjs"), 1);
|
|
@@ -1252,18 +1273,18 @@ function DateTimeInput(props) {
|
|
|
1252
1273
|
valueFormat,
|
|
1253
1274
|
displayFormat
|
|
1254
1275
|
} = props;
|
|
1255
|
-
const handleChange = (0,
|
|
1276
|
+
const handleChange = (0, import_react6.useCallback)(
|
|
1256
1277
|
(nextValue) => {
|
|
1257
1278
|
onChange(dateFormat(nextValue, valueFormat));
|
|
1258
1279
|
},
|
|
1259
1280
|
[onChange, valueFormat]
|
|
1260
1281
|
);
|
|
1261
|
-
const handleBlur = (0,
|
|
1282
|
+
const handleBlur = (0, import_react6.useCallback)(() => {
|
|
1262
1283
|
if (onBlur) {
|
|
1263
1284
|
onBlur(id, value);
|
|
1264
1285
|
}
|
|
1265
1286
|
}, [onBlur, id, value]);
|
|
1266
|
-
const handleFocus = (0,
|
|
1287
|
+
const handleFocus = (0, import_react6.useCallback)(() => {
|
|
1267
1288
|
if (onFocus) {
|
|
1268
1289
|
onFocus(id, value);
|
|
1269
1290
|
}
|
|
@@ -1324,7 +1345,7 @@ function DateTimeWidget(props) {
|
|
|
1324
1345
|
}
|
|
1325
1346
|
|
|
1326
1347
|
// src/widgets/DateTime/TimeWidget.tsx
|
|
1327
|
-
var
|
|
1348
|
+
var import_react7 = require("react");
|
|
1328
1349
|
var import_dates2 = require("@mantine/dates");
|
|
1329
1350
|
var import_utils22 = require("@rjsf/utils");
|
|
1330
1351
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -1347,13 +1368,13 @@ function TimeWidget(props) {
|
|
|
1347
1368
|
onFocus
|
|
1348
1369
|
} = props;
|
|
1349
1370
|
const emptyValue = options.emptyValue || "";
|
|
1350
|
-
const handleChange = (0,
|
|
1371
|
+
const handleChange = (0, import_react7.useCallback)(
|
|
1351
1372
|
(e) => {
|
|
1352
1373
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1353
1374
|
},
|
|
1354
1375
|
[onChange, emptyValue]
|
|
1355
1376
|
);
|
|
1356
|
-
const handleBlur = (0,
|
|
1377
|
+
const handleBlur = (0, import_react7.useCallback)(
|
|
1357
1378
|
({ target }) => {
|
|
1358
1379
|
if (onBlur) {
|
|
1359
1380
|
onBlur(id, target && target.value);
|
|
@@ -1361,7 +1382,7 @@ function TimeWidget(props) {
|
|
|
1361
1382
|
},
|
|
1362
1383
|
[onBlur, id]
|
|
1363
1384
|
);
|
|
1364
|
-
const handleFocus = (0,
|
|
1385
|
+
const handleFocus = (0, import_react7.useCallback)(
|
|
1365
1386
|
({ target }) => {
|
|
1366
1387
|
if (onFocus) {
|
|
1367
1388
|
onFocus(id, target && target.value);
|
|
@@ -1392,10 +1413,13 @@ function TimeWidget(props) {
|
|
|
1392
1413
|
}
|
|
1393
1414
|
|
|
1394
1415
|
// src/widgets/FileWidget.tsx
|
|
1395
|
-
var
|
|
1416
|
+
var import_react8 = require("react");
|
|
1396
1417
|
var import_core24 = require("@mantine/core");
|
|
1397
1418
|
var import_utils23 = require("@rjsf/utils");
|
|
1398
|
-
var import_jsx_runtime29 =
|
|
1419
|
+
var import_jsx_runtime29 = (
|
|
1420
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1421
|
+
require("react/jsx-runtime")
|
|
1422
|
+
);
|
|
1399
1423
|
function FileWidget(props) {
|
|
1400
1424
|
const {
|
|
1401
1425
|
id,
|
|
@@ -1415,7 +1439,7 @@ function FileWidget(props) {
|
|
|
1415
1439
|
} = props;
|
|
1416
1440
|
const { filesInfo, handleChange, handleRemove } = (0, import_utils23.useFileWidgetProps)(value, onChange, multiple);
|
|
1417
1441
|
const themeProps = cleanupOptions(options);
|
|
1418
|
-
const handleOnChange = (0,
|
|
1442
|
+
const handleOnChange = (0, import_react8.useCallback)(
|
|
1419
1443
|
(files) => {
|
|
1420
1444
|
if (typeof files === "object") {
|
|
1421
1445
|
void handleChange(files);
|
|
@@ -1423,7 +1447,7 @@ function FileWidget(props) {
|
|
|
1423
1447
|
},
|
|
1424
1448
|
[handleChange]
|
|
1425
1449
|
);
|
|
1426
|
-
const ValueComponent = (0,
|
|
1450
|
+
const ValueComponent = (0, import_react8.useCallback)(() => {
|
|
1427
1451
|
if (Array.isArray(filesInfo) && filesInfo.length > 0) {
|
|
1428
1452
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_core24.Pill.Group, { children: filesInfo.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_core24.Pill, { withRemoveButton: true, onRemove: () => handleRemove(index), children: file.name }, index)) });
|
|
1429
1453
|
}
|
|
@@ -1451,7 +1475,7 @@ function FileWidget(props) {
|
|
|
1451
1475
|
}
|
|
1452
1476
|
|
|
1453
1477
|
// src/widgets/PasswordWidget.tsx
|
|
1454
|
-
var
|
|
1478
|
+
var import_react9 = require("react");
|
|
1455
1479
|
var import_core25 = require("@mantine/core");
|
|
1456
1480
|
var import_utils25 = require("@rjsf/utils");
|
|
1457
1481
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
@@ -1473,15 +1497,15 @@ function PasswordWidget(props) {
|
|
|
1473
1497
|
onBlur,
|
|
1474
1498
|
onFocus
|
|
1475
1499
|
} = props;
|
|
1476
|
-
const emptyValue = options
|
|
1500
|
+
const { emptyValue } = options;
|
|
1477
1501
|
const themeProps = cleanupOptions(options);
|
|
1478
|
-
const handleChange = (0,
|
|
1502
|
+
const handleChange = (0, import_react9.useCallback)(
|
|
1479
1503
|
(e) => {
|
|
1480
1504
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1481
1505
|
},
|
|
1482
1506
|
[onChange, emptyValue]
|
|
1483
1507
|
);
|
|
1484
|
-
const handleBlur = (0,
|
|
1508
|
+
const handleBlur = (0, import_react9.useCallback)(
|
|
1485
1509
|
({ target }) => {
|
|
1486
1510
|
if (onBlur) {
|
|
1487
1511
|
onBlur(id, target && target.value);
|
|
@@ -1489,7 +1513,7 @@ function PasswordWidget(props) {
|
|
|
1489
1513
|
},
|
|
1490
1514
|
[onBlur, id]
|
|
1491
1515
|
);
|
|
1492
|
-
const handleFocus = (0,
|
|
1516
|
+
const handleFocus = (0, import_react9.useCallback)(
|
|
1493
1517
|
({ target }) => {
|
|
1494
1518
|
if (onFocus) {
|
|
1495
1519
|
onFocus(id, target && target.value);
|
|
@@ -1519,7 +1543,7 @@ function PasswordWidget(props) {
|
|
|
1519
1543
|
}
|
|
1520
1544
|
|
|
1521
1545
|
// src/widgets/RadioWidget.tsx
|
|
1522
|
-
var
|
|
1546
|
+
var import_react10 = require("react");
|
|
1523
1547
|
var import_core26 = require("@mantine/core");
|
|
1524
1548
|
var import_utils27 = require("@rjsf/utils");
|
|
1525
1549
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -1543,7 +1567,7 @@ function RadioWidget(props) {
|
|
|
1543
1567
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1544
1568
|
const optionValueFormat = (0, import_utils27.getOptionValueFormat)(options);
|
|
1545
1569
|
const themeProps = cleanupOptions(options);
|
|
1546
|
-
const handleChange = (0,
|
|
1570
|
+
const handleChange = (0, import_react10.useCallback)(
|
|
1547
1571
|
(nextValue) => {
|
|
1548
1572
|
if (!disabled && !readonly && onChange) {
|
|
1549
1573
|
onChange((0, import_utils27.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1551,7 +1575,7 @@ function RadioWidget(props) {
|
|
|
1551
1575
|
},
|
|
1552
1576
|
[onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]
|
|
1553
1577
|
);
|
|
1554
|
-
const handleBlur = (0,
|
|
1578
|
+
const handleBlur = (0, import_react10.useCallback)(
|
|
1555
1579
|
({ target }) => {
|
|
1556
1580
|
if (onBlur) {
|
|
1557
1581
|
onBlur(id, (0, import_utils27.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1559,7 +1583,7 @@ function RadioWidget(props) {
|
|
|
1559
1583
|
},
|
|
1560
1584
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
1561
1585
|
);
|
|
1562
|
-
const handleFocus = (0,
|
|
1586
|
+
const handleFocus = (0, import_react10.useCallback)(
|
|
1563
1587
|
({ target }) => {
|
|
1564
1588
|
if (onFocus) {
|
|
1565
1589
|
onFocus(id, (0, import_utils27.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1587,19 +1611,19 @@ function RadioWidget(props) {
|
|
|
1587
1611
|
id: (0, import_utils27.optionId)(id, i),
|
|
1588
1612
|
value: (0, import_utils27.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
1589
1613
|
label: option.label,
|
|
1590
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1614
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value),
|
|
1591
1615
|
autoFocus: i === 0 && autofocus,
|
|
1592
1616
|
onBlur: handleBlur,
|
|
1593
1617
|
onFocus: handleFocus
|
|
1594
1618
|
},
|
|
1595
|
-
|
|
1619
|
+
String(option.value)
|
|
1596
1620
|
)) }) : null
|
|
1597
1621
|
}
|
|
1598
1622
|
);
|
|
1599
1623
|
}
|
|
1600
1624
|
|
|
1601
1625
|
// src/widgets/RangeWidget.tsx
|
|
1602
|
-
var
|
|
1626
|
+
var import_react11 = require("react");
|
|
1603
1627
|
var import_core27 = require("@mantine/core");
|
|
1604
1628
|
var import_utils29 = require("@rjsf/utils");
|
|
1605
1629
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
@@ -1623,7 +1647,7 @@ function RangeWidget(props) {
|
|
|
1623
1647
|
} = props;
|
|
1624
1648
|
const themeProps = cleanupOptions(options);
|
|
1625
1649
|
const { min, max, step } = (0, import_utils29.rangeSpec)(schema);
|
|
1626
|
-
const handleChange = (0,
|
|
1650
|
+
const handleChange = (0, import_react11.useCallback)(
|
|
1627
1651
|
(nextValue) => {
|
|
1628
1652
|
if (!disabled && !readonly && onChange) {
|
|
1629
1653
|
onChange(nextValue);
|
|
@@ -1631,12 +1655,12 @@ function RangeWidget(props) {
|
|
|
1631
1655
|
},
|
|
1632
1656
|
[onChange, disabled, readonly]
|
|
1633
1657
|
);
|
|
1634
|
-
const handleBlur = (0,
|
|
1658
|
+
const handleBlur = (0, import_react11.useCallback)(() => {
|
|
1635
1659
|
if (onBlur) {
|
|
1636
1660
|
onBlur(id, value);
|
|
1637
1661
|
}
|
|
1638
1662
|
}, [onBlur, id, value]);
|
|
1639
|
-
const handleFocus = (0,
|
|
1663
|
+
const handleFocus = (0, import_react11.useCallback)(() => {
|
|
1640
1664
|
if (onFocus) {
|
|
1641
1665
|
onFocus(id, value);
|
|
1642
1666
|
}
|
|
@@ -1662,12 +1686,15 @@ function RangeWidget(props) {
|
|
|
1662
1686
|
"aria-describedby": (0, import_utils29.ariaDescribedByIds)(id)
|
|
1663
1687
|
}
|
|
1664
1688
|
),
|
|
1665
|
-
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) =>
|
|
1689
|
+
rawErrors && rawErrors?.length > 0 && rawErrors.map((error, index) => (
|
|
1690
|
+
// oxlint-disable-next-line react/no-array-index-key
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_core27.Input.Error, { children: error }, `range-widget-input-errors-${index}`)
|
|
1692
|
+
))
|
|
1666
1693
|
] });
|
|
1667
1694
|
}
|
|
1668
1695
|
|
|
1669
1696
|
// src/widgets/SelectWidget.tsx
|
|
1670
|
-
var
|
|
1697
|
+
var import_react12 = require("react");
|
|
1671
1698
|
var import_core28 = require("@mantine/core");
|
|
1672
1699
|
var import_utils31 = require("@rjsf/utils");
|
|
1673
1700
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
@@ -1693,7 +1720,7 @@ function SelectWidget(props) {
|
|
|
1693
1720
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1694
1721
|
const optionValueFormat = (0, import_utils31.getOptionValueFormat)(options);
|
|
1695
1722
|
const themeProps = cleanupOptions(options);
|
|
1696
|
-
const handleChange = (0,
|
|
1723
|
+
const handleChange = (0, import_react12.useCallback)(
|
|
1697
1724
|
(nextValue) => {
|
|
1698
1725
|
if (!disabled && !readonly && onChange) {
|
|
1699
1726
|
onChange((0, import_utils31.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1701,7 +1728,7 @@ function SelectWidget(props) {
|
|
|
1701
1728
|
},
|
|
1702
1729
|
[onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]
|
|
1703
1730
|
);
|
|
1704
|
-
const handleBlur = (0,
|
|
1731
|
+
const handleBlur = (0, import_react12.useCallback)(
|
|
1705
1732
|
({ target }) => {
|
|
1706
1733
|
if (onBlur) {
|
|
1707
1734
|
onBlur(id, (0, import_utils31.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1709,7 +1736,7 @@ function SelectWidget(props) {
|
|
|
1709
1736
|
},
|
|
1710
1737
|
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
1711
1738
|
);
|
|
1712
|
-
const handleFocus = (0,
|
|
1739
|
+
const handleFocus = (0, import_react12.useCallback)(
|
|
1713
1740
|
({ target }) => {
|
|
1714
1741
|
if (onFocus) {
|
|
1715
1742
|
onFocus(id, (0, import_utils31.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
@@ -1717,13 +1744,13 @@ function SelectWidget(props) {
|
|
|
1717
1744
|
},
|
|
1718
1745
|
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
1719
1746
|
);
|
|
1720
|
-
const selectOptions = (0,
|
|
1747
|
+
const selectOptions = (0, import_react12.useMemo)(() => {
|
|
1721
1748
|
if (Array.isArray(enumOptions)) {
|
|
1722
1749
|
return enumOptions.map((option, index) => ({
|
|
1723
1750
|
key: String(index),
|
|
1724
1751
|
value: (0, import_utils31.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
1725
1752
|
label: option.label,
|
|
1726
|
-
disabled: Array.isArray(enumDisabled) && enumDisabled.
|
|
1753
|
+
disabled: Array.isArray(enumDisabled) && enumDisabled.includes(option.value)
|
|
1727
1754
|
}));
|
|
1728
1755
|
}
|
|
1729
1756
|
return [];
|
|
@@ -1762,7 +1789,7 @@ function SelectWidget(props) {
|
|
|
1762
1789
|
}
|
|
1763
1790
|
|
|
1764
1791
|
// src/widgets/TextareaWidget.tsx
|
|
1765
|
-
var
|
|
1792
|
+
var import_react13 = require("react");
|
|
1766
1793
|
var import_core29 = require("@mantine/core");
|
|
1767
1794
|
var import_utils33 = require("@rjsf/utils");
|
|
1768
1795
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
@@ -1787,13 +1814,13 @@ function TextareaWidget(props) {
|
|
|
1787
1814
|
} = props;
|
|
1788
1815
|
const themeProps = cleanupOptions(options);
|
|
1789
1816
|
const emptyValue = options?.emptyValue;
|
|
1790
|
-
const handleChange = (0,
|
|
1817
|
+
const handleChange = (0, import_react13.useCallback)(
|
|
1791
1818
|
(e) => {
|
|
1792
1819
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|
|
1793
1820
|
},
|
|
1794
1821
|
[onChange, emptyValue]
|
|
1795
1822
|
);
|
|
1796
|
-
const handleBlur = (0,
|
|
1823
|
+
const handleBlur = (0, import_react13.useCallback)(
|
|
1797
1824
|
({ target }) => {
|
|
1798
1825
|
if (onBlur) {
|
|
1799
1826
|
onBlur(id, target && target.value);
|
|
@@ -1801,7 +1828,7 @@ function TextareaWidget(props) {
|
|
|
1801
1828
|
},
|
|
1802
1829
|
[onBlur, id]
|
|
1803
1830
|
);
|
|
1804
|
-
const handleFocus = (0,
|
|
1831
|
+
const handleFocus = (0, import_react13.useCallback)(
|
|
1805
1832
|
({ target }) => {
|
|
1806
1833
|
if (onFocus) {
|
|
1807
1834
|
onFocus(id, target && target.value);
|