@rjsf/mantine 6.1.1 → 6.2.3
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 +26 -6
- package/dist/index.cjs.map +3 -3
- package/dist/mantine.esm.js +26 -6
- package/dist/mantine.esm.js.map +3 -3
- package/dist/mantine.umd.js +26 -6
- package/lib/templates/BaseInputTemplate.js +10 -4
- package/lib/templates/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ButtonTemplates/IconButton.d.ts +1 -0
- package/lib/templates/ButtonTemplates/IconButton.js +4 -0
- package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/index.js +2 -1
- package/lib/templates/ButtonTemplates/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils.js +2 -0
- package/lib/utils.js.map +1 -1
- package/lib/widgets/PasswordWidget.js +1 -1
- package/lib/widgets/PasswordWidget.js.map +1 -1
- package/lib/widgets/TextareaWidget.js +1 -2
- package/lib/widgets/TextareaWidget.js.map +1 -1
- package/package.json +7 -7
- package/src/templates/BaseInputTemplate.tsx +16 -2
- package/src/templates/ButtonTemplates/IconButton.tsx +12 -0
- package/src/templates/ButtonTemplates/index.ts +2 -1
- package/src/utils.ts +2 -0
- package/src/widgets/PasswordWidget.tsx +1 -1
- package/src/widgets/TextareaWidget.tsx +1 -1
package/dist/mantine.esm.js
CHANGED
|
@@ -162,7 +162,9 @@ var uiOptionsKeys = [
|
|
|
162
162
|
"removable",
|
|
163
163
|
"duplicateKeySuffixSeparator",
|
|
164
164
|
"enumOptions",
|
|
165
|
-
"enableMarkdownInDescription"
|
|
165
|
+
"enableMarkdownInDescription",
|
|
166
|
+
"enableMarkdownInHelp",
|
|
167
|
+
"globalOptions"
|
|
166
168
|
];
|
|
167
169
|
function cleanupOptions(options) {
|
|
168
170
|
const result = {};
|
|
@@ -196,8 +198,10 @@ function BaseInputTemplate(props) {
|
|
|
196
198
|
onFocus,
|
|
197
199
|
options,
|
|
198
200
|
rawErrors,
|
|
199
|
-
children
|
|
201
|
+
children,
|
|
202
|
+
registry
|
|
200
203
|
} = props;
|
|
204
|
+
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
201
205
|
const inputProps = getInputProps(schema, type, options, false);
|
|
202
206
|
const description = hideLabel ? void 0 : options.description || schema.description;
|
|
203
207
|
const themeProps = cleanupOptions(options);
|
|
@@ -205,7 +209,7 @@ function BaseInputTemplate(props) {
|
|
|
205
209
|
const handleChange = useCallback(
|
|
206
210
|
(e) => {
|
|
207
211
|
const handler = onChangeOverride ? onChangeOverride : onChange;
|
|
208
|
-
const value2 = e.target.value === "" ? options.emptyValue
|
|
212
|
+
const value2 = e.target.value === "" ? options.emptyValue : e.target.value;
|
|
209
213
|
handler(value2);
|
|
210
214
|
},
|
|
211
215
|
[onChange, onChangeOverride, options]
|
|
@@ -222,6 +226,14 @@ function BaseInputTemplate(props) {
|
|
|
222
226
|
},
|
|
223
227
|
[onFocus, id]
|
|
224
228
|
);
|
|
229
|
+
const handleClear = useCallback(
|
|
230
|
+
(e) => {
|
|
231
|
+
e.preventDefault();
|
|
232
|
+
e.stopPropagation();
|
|
233
|
+
onChange(options.emptyValue ?? "");
|
|
234
|
+
},
|
|
235
|
+
[onChange, options.emptyValue]
|
|
236
|
+
);
|
|
225
237
|
const componentProps = {
|
|
226
238
|
id,
|
|
227
239
|
name: htmlName || id,
|
|
@@ -262,6 +274,7 @@ function BaseInputTemplate(props) {
|
|
|
262
274
|
);
|
|
263
275
|
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
264
276
|
input,
|
|
277
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick: handleClear }),
|
|
265
278
|
children,
|
|
266
279
|
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) => {
|
|
267
280
|
return /* @__PURE__ */ jsx4("option", { value: example }, example);
|
|
@@ -530,6 +543,12 @@ function RemoveButton(props) {
|
|
|
530
543
|
}
|
|
531
544
|
);
|
|
532
545
|
}
|
|
546
|
+
function ClearButton(props) {
|
|
547
|
+
const {
|
|
548
|
+
registry: { translateString }
|
|
549
|
+
} = props;
|
|
550
|
+
return /* @__PURE__ */ jsx9(IconButton, { title: translateString(TranslatableString2.ClearButton), variant: "subtle", ...props, icon: /* @__PURE__ */ jsx9(X, {}) });
|
|
551
|
+
}
|
|
533
552
|
|
|
534
553
|
// src/templates/ButtonTemplates/AddButton.tsx
|
|
535
554
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
@@ -548,7 +567,8 @@ function buttonTemplates() {
|
|
|
548
567
|
CopyButton,
|
|
549
568
|
MoveDownButton,
|
|
550
569
|
MoveUpButton,
|
|
551
|
-
RemoveButton
|
|
570
|
+
RemoveButton,
|
|
571
|
+
ClearButton
|
|
552
572
|
};
|
|
553
573
|
}
|
|
554
574
|
var ButtonTemplates_default = buttonTemplates;
|
|
@@ -1470,7 +1490,7 @@ function PasswordWidget(props) {
|
|
|
1470
1490
|
onBlur,
|
|
1471
1491
|
onFocus
|
|
1472
1492
|
} = props;
|
|
1473
|
-
const emptyValue = options.emptyValue
|
|
1493
|
+
const emptyValue = options.emptyValue;
|
|
1474
1494
|
const themeProps = cleanupOptions(options);
|
|
1475
1495
|
const handleChange = useCallback8(
|
|
1476
1496
|
(e) => {
|
|
@@ -1791,7 +1811,7 @@ function TextareaWidget(props) {
|
|
|
1791
1811
|
onFocus
|
|
1792
1812
|
} = props;
|
|
1793
1813
|
const themeProps = cleanupOptions(options);
|
|
1794
|
-
const emptyValue = options?.emptyValue
|
|
1814
|
+
const emptyValue = options?.emptyValue;
|
|
1795
1815
|
const handleChange = useCallback12(
|
|
1796
1816
|
(e) => {
|
|
1797
1817
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|