@rjsf/mantine 6.4.2 → 6.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/index.cjs +59 -45
- package/dist/index.cjs.map +2 -2
- package/dist/mantine.esm.js +69 -49
- package/dist/mantine.esm.js.map +3 -3
- package/dist/mantine.umd.js +59 -45
- package/lib/Form/index.js +1 -1
- package/lib/Theme/index.js +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +4 -4
- package/lib/templates/BaseInputTemplate.js +3 -2
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ButtonTemplates/AddButton.js +2 -2
- package/lib/templates/ButtonTemplates/IconButton.js +1 -1
- package/lib/templates/ButtonTemplates/index.js +3 -3
- package/lib/templates/ErrorList.js +1 -1
- package/lib/templates/OptionalDataControlsTemplate.js +2 -2
- package/lib/templates/WrapIfAdditionalTemplate.js +1 -1
- package/lib/templates/WrapIfAdditionalTemplate.js.map +1 -1
- package/lib/templates/index.js +16 -16
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/widgets/CheckboxesWidget.js +10 -9
- package/lib/widgets/CheckboxesWidget.js.map +1 -1
- package/lib/widgets/ColorWidget.js +1 -1
- package/lib/widgets/DateTime/DateTimeWidget.js +1 -1
- package/lib/widgets/DateTime/DateWidget.js +1 -1
- package/lib/widgets/DateTime/index.d.ts +5 -5
- package/lib/widgets/DateTime/index.js +5 -5
- package/lib/widgets/FileWidget.js +1 -1
- package/lib/widgets/PasswordWidget.js +1 -1
- package/lib/widgets/RadioWidget.js +10 -9
- package/lib/widgets/RadioWidget.js.map +1 -1
- package/lib/widgets/RangeWidget.js +1 -1
- package/lib/widgets/SelectWidget.js +30 -13
- package/lib/widgets/SelectWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.js +1 -1
- package/lib/widgets/index.js +10 -10
- package/package.json +8 -8
- package/src/templates/BaseInputTemplate.tsx +5 -1
- package/src/templates/WrapIfAdditionalTemplate.tsx +1 -0
- package/src/widgets/CheckboxesWidget.tsx +11 -8
- package/src/widgets/RadioWidget.tsx +11 -8
- package/src/widgets/SelectWidget.tsx +40 -32
package/dist/index.cjs
CHANGED
|
@@ -277,17 +277,20 @@ function BaseInputTemplate(props) {
|
|
|
277
277
|
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
278
278
|
list: schema.examples ? (0, import_utils4.examplesId)(id) : void 0
|
|
279
279
|
};
|
|
280
|
+
const { min, max, ...restInputProps } = inputProps;
|
|
280
281
|
const input = inputProps.type === "number" || inputProps.type === "integer" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
281
282
|
import_core4.NumberInput,
|
|
282
283
|
{
|
|
283
284
|
onChange: !readonly ? handleNumberChange : void 0,
|
|
284
285
|
...componentProps,
|
|
285
|
-
...
|
|
286
|
+
...restInputProps,
|
|
286
287
|
...themeProps,
|
|
287
288
|
step: typeof inputProps.step === "number" ? inputProps.step : 1,
|
|
288
289
|
type: "text",
|
|
289
290
|
description,
|
|
290
291
|
value,
|
|
292
|
+
min: typeof min === "number" ? min : void 0,
|
|
293
|
+
max: typeof max === "number" ? max : void 0,
|
|
291
294
|
"aria-describedby": (0, import_utils4.ariaDescribedByIds)(id, !!schema.examples)
|
|
292
295
|
}
|
|
293
296
|
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -872,7 +875,8 @@ function WrapIfAdditionalTemplate(props) {
|
|
|
872
875
|
id: `${id}-key`,
|
|
873
876
|
name: `${id}-key`,
|
|
874
877
|
onBlur: !readonly ? onKeyRenameBlur : void 0
|
|
875
|
-
}
|
|
878
|
+
},
|
|
879
|
+
label
|
|
876
880
|
) }),
|
|
877
881
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_core18.Grid.Col, { span: 6, className: "form-additional", children })
|
|
878
882
|
] }),
|
|
@@ -1175,30 +1179,31 @@ function CheckboxesWidget(props) {
|
|
|
1175
1179
|
onFocus
|
|
1176
1180
|
} = props;
|
|
1177
1181
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1182
|
+
const optionValueFormat = (0, import_utils18.getOptionValueFormat)(options);
|
|
1178
1183
|
const themeProps = cleanupOptions(options);
|
|
1179
1184
|
const handleChange = (0, import_react4.useCallback)(
|
|
1180
1185
|
(nextValue) => {
|
|
1181
1186
|
if (!disabled && !readonly && onChange) {
|
|
1182
|
-
onChange((0, import_utils18.
|
|
1187
|
+
onChange((0, import_utils18.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
1183
1188
|
}
|
|
1184
1189
|
},
|
|
1185
|
-
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1190
|
+
[onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]
|
|
1186
1191
|
);
|
|
1187
1192
|
const handleBlur = (0, import_react4.useCallback)(
|
|
1188
1193
|
({ target }) => {
|
|
1189
1194
|
if (onBlur) {
|
|
1190
|
-
onBlur(id, (0, import_utils18.
|
|
1195
|
+
onBlur(id, (0, import_utils18.enumOptionValueDecoder)(target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1191
1196
|
}
|
|
1192
1197
|
},
|
|
1193
|
-
[onBlur, id, enumOptions, emptyValue]
|
|
1198
|
+
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
1194
1199
|
);
|
|
1195
1200
|
const handleFocus = (0, import_react4.useCallback)(
|
|
1196
1201
|
({ target }) => {
|
|
1197
1202
|
if (onFocus) {
|
|
1198
|
-
onFocus(id, (0, import_utils18.
|
|
1203
|
+
onFocus(id, (0, import_utils18.enumOptionValueDecoder)(target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1199
1204
|
}
|
|
1200
1205
|
},
|
|
1201
|
-
[onFocus, id, enumOptions, emptyValue]
|
|
1206
|
+
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
1202
1207
|
);
|
|
1203
1208
|
const selectedIndexes = (0, import_utils18.enumOptionsIndexForValue)(value, enumOptions, true);
|
|
1204
1209
|
return Array.isArray(enumOptions) && enumOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
@@ -1219,7 +1224,7 @@ function CheckboxesWidget(props) {
|
|
|
1219
1224
|
{
|
|
1220
1225
|
id: (0, import_utils18.optionId)(id, i),
|
|
1221
1226
|
name: htmlName || id,
|
|
1222
|
-
value:
|
|
1227
|
+
value: (0, import_utils18.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
1223
1228
|
label: option.label,
|
|
1224
1229
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1225
1230
|
autoFocus: i === 0 && autofocus,
|
|
@@ -1538,30 +1543,31 @@ function RadioWidget(props) {
|
|
|
1538
1543
|
onFocus
|
|
1539
1544
|
} = props;
|
|
1540
1545
|
const { enumOptions, enumDisabled, inline, emptyValue } = options;
|
|
1546
|
+
const optionValueFormat = (0, import_utils27.getOptionValueFormat)(options);
|
|
1541
1547
|
const themeProps = cleanupOptions(options);
|
|
1542
1548
|
const handleChange = (0, import_react9.useCallback)(
|
|
1543
1549
|
(nextValue) => {
|
|
1544
1550
|
if (!disabled && !readonly && onChange) {
|
|
1545
|
-
onChange((0, import_utils27.
|
|
1551
|
+
onChange((0, import_utils27.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
1546
1552
|
}
|
|
1547
1553
|
},
|
|
1548
|
-
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1554
|
+
[onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]
|
|
1549
1555
|
);
|
|
1550
1556
|
const handleBlur = (0, import_react9.useCallback)(
|
|
1551
1557
|
({ target }) => {
|
|
1552
1558
|
if (onBlur) {
|
|
1553
|
-
onBlur(id, (0, import_utils27.
|
|
1559
|
+
onBlur(id, (0, import_utils27.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1554
1560
|
}
|
|
1555
1561
|
},
|
|
1556
|
-
[onBlur, id, enumOptions, emptyValue]
|
|
1562
|
+
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
1557
1563
|
);
|
|
1558
1564
|
const handleFocus = (0, import_react9.useCallback)(
|
|
1559
1565
|
({ target }) => {
|
|
1560
1566
|
if (onFocus) {
|
|
1561
|
-
onFocus(id, (0, import_utils27.
|
|
1567
|
+
onFocus(id, (0, import_utils27.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1562
1568
|
}
|
|
1563
1569
|
},
|
|
1564
|
-
[onFocus, id, enumOptions, emptyValue]
|
|
1570
|
+
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
1565
1571
|
);
|
|
1566
1572
|
const selected = (0, import_utils27.enumOptionsIndexForValue)(value, enumOptions);
|
|
1567
1573
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -1581,7 +1587,7 @@ function RadioWidget(props) {
|
|
|
1581
1587
|
import_core26.Radio,
|
|
1582
1588
|
{
|
|
1583
1589
|
id: (0, import_utils27.optionId)(id, i),
|
|
1584
|
-
value:
|
|
1590
|
+
value: (0, import_utils27.enumOptionValueEncoder)(option.value, i, optionValueFormat),
|
|
1585
1591
|
label: option.label,
|
|
1586
1592
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1,
|
|
1587
1593
|
autoFocus: i === 0 && autofocus,
|
|
@@ -1687,64 +1693,72 @@ function SelectWidget(props) {
|
|
|
1687
1693
|
onFocus
|
|
1688
1694
|
} = props;
|
|
1689
1695
|
const { enumOptions, enumDisabled, emptyValue } = options;
|
|
1696
|
+
const optionValueFormat = (0, import_utils31.getOptionValueFormat)(options);
|
|
1690
1697
|
const themeProps = cleanupOptions(options);
|
|
1691
1698
|
const handleChange = (0, import_react11.useCallback)(
|
|
1692
1699
|
(nextValue) => {
|
|
1693
1700
|
if (!disabled && !readonly && onChange) {
|
|
1694
|
-
onChange((0, import_utils31.
|
|
1701
|
+
onChange((0, import_utils31.enumOptionValueDecoder)(nextValue, enumOptions, optionValueFormat, emptyValue));
|
|
1695
1702
|
}
|
|
1696
1703
|
},
|
|
1697
|
-
[onChange, disabled, readonly, enumOptions, emptyValue]
|
|
1704
|
+
[onChange, disabled, readonly, enumOptions, emptyValue, optionValueFormat]
|
|
1698
1705
|
);
|
|
1699
1706
|
const handleBlur = (0, import_react11.useCallback)(
|
|
1700
1707
|
({ target }) => {
|
|
1701
1708
|
if (onBlur) {
|
|
1702
|
-
onBlur(id, (0, import_utils31.
|
|
1709
|
+
onBlur(id, (0, import_utils31.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1703
1710
|
}
|
|
1704
1711
|
},
|
|
1705
|
-
[onBlur, id, enumOptions, emptyValue]
|
|
1712
|
+
[onBlur, id, enumOptions, emptyValue, optionValueFormat]
|
|
1706
1713
|
);
|
|
1707
1714
|
const handleFocus = (0, import_react11.useCallback)(
|
|
1708
1715
|
({ target }) => {
|
|
1709
1716
|
if (onFocus) {
|
|
1710
|
-
onFocus(id, (0, import_utils31.
|
|
1717
|
+
onFocus(id, (0, import_utils31.enumOptionValueDecoder)(target && target.value, enumOptions, optionValueFormat, emptyValue));
|
|
1711
1718
|
}
|
|
1712
1719
|
},
|
|
1713
|
-
[onFocus, id, enumOptions, emptyValue]
|
|
1720
|
+
[onFocus, id, enumOptions, emptyValue, optionValueFormat]
|
|
1714
1721
|
);
|
|
1715
|
-
const selectedIndexes = (0, import_utils31.enumOptionsIndexForValue)(value, enumOptions, multiple);
|
|
1716
1722
|
const selectOptions = (0, import_react11.useMemo)(() => {
|
|
1717
1723
|
if (Array.isArray(enumOptions)) {
|
|
1718
1724
|
return enumOptions.map((option, index) => ({
|
|
1719
1725
|
key: String(index),
|
|
1720
|
-
value:
|
|
1726
|
+
value: (0, import_utils31.enumOptionValueEncoder)(option.value, index, optionValueFormat),
|
|
1721
1727
|
label: option.label,
|
|
1722
1728
|
disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(option.value) !== -1
|
|
1723
1729
|
}));
|
|
1724
1730
|
}
|
|
1725
1731
|
return [];
|
|
1726
|
-
}, [enumDisabled, enumOptions]);
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1729
|
-
|
|
1732
|
+
}, [enumDisabled, enumOptions, optionValueFormat]);
|
|
1733
|
+
const sharedProps = {
|
|
1734
|
+
id,
|
|
1735
|
+
name: htmlName || id,
|
|
1736
|
+
label: (0, import_utils31.labelValue)(label || void 0, hideLabel, false),
|
|
1737
|
+
data: selectOptions,
|
|
1738
|
+
onChange: !readonly ? handleChange : void 0,
|
|
1739
|
+
onBlur: !readonly ? handleBlur : void 0,
|
|
1740
|
+
onFocus: !readonly ? handleFocus : void 0,
|
|
1741
|
+
autoFocus: autofocus,
|
|
1742
|
+
placeholder,
|
|
1743
|
+
disabled: disabled || readonly,
|
|
1744
|
+
required,
|
|
1745
|
+
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1746
|
+
searchable: true,
|
|
1747
|
+
"aria-describedby": (0, import_utils31.ariaDescribedByIds)(id),
|
|
1748
|
+
comboboxProps: { withinPortal: false },
|
|
1749
|
+
...themeProps
|
|
1750
|
+
};
|
|
1751
|
+
return multiple ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1752
|
+
import_core28.MultiSelect,
|
|
1730
1753
|
{
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
autoFocus: autofocus,
|
|
1740
|
-
placeholder,
|
|
1741
|
-
disabled: disabled || readonly,
|
|
1742
|
-
required,
|
|
1743
|
-
error: rawErrors && rawErrors.length > 0 ? rawErrors.join("\n") : void 0,
|
|
1744
|
-
searchable: true,
|
|
1745
|
-
...themeProps,
|
|
1746
|
-
"aria-describedby": (0, import_utils31.ariaDescribedByIds)(id),
|
|
1747
|
-
comboboxProps: { withinPortal: false }
|
|
1754
|
+
...sharedProps,
|
|
1755
|
+
value: (0, import_utils31.enumOptionSelectedValue)(value, enumOptions, true, optionValueFormat, [])
|
|
1756
|
+
}
|
|
1757
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1758
|
+
import_core28.Select,
|
|
1759
|
+
{
|
|
1760
|
+
...sharedProps,
|
|
1761
|
+
value: (0, import_utils31.enumOptionSelectedValue)(value, enumOptions, false, optionValueFormat, null)
|
|
1748
1762
|
}
|
|
1749
1763
|
);
|
|
1750
1764
|
}
|