@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/index.cjs
CHANGED
|
@@ -191,7 +191,9 @@ var uiOptionsKeys = [
|
|
|
191
191
|
"removable",
|
|
192
192
|
"duplicateKeySuffixSeparator",
|
|
193
193
|
"enumOptions",
|
|
194
|
-
"enableMarkdownInDescription"
|
|
194
|
+
"enableMarkdownInDescription",
|
|
195
|
+
"enableMarkdownInHelp",
|
|
196
|
+
"globalOptions"
|
|
195
197
|
];
|
|
196
198
|
function cleanupOptions(options) {
|
|
197
199
|
const result = {};
|
|
@@ -225,8 +227,10 @@ function BaseInputTemplate(props) {
|
|
|
225
227
|
onFocus,
|
|
226
228
|
options,
|
|
227
229
|
rawErrors,
|
|
228
|
-
children
|
|
230
|
+
children,
|
|
231
|
+
registry
|
|
229
232
|
} = props;
|
|
233
|
+
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
230
234
|
const inputProps = (0, import_utils4.getInputProps)(schema, type, options, false);
|
|
231
235
|
const description = hideLabel ? void 0 : options.description || schema.description;
|
|
232
236
|
const themeProps = cleanupOptions(options);
|
|
@@ -234,7 +238,7 @@ function BaseInputTemplate(props) {
|
|
|
234
238
|
const handleChange = (0, import_react.useCallback)(
|
|
235
239
|
(e) => {
|
|
236
240
|
const handler = onChangeOverride ? onChangeOverride : onChange;
|
|
237
|
-
const value2 = e.target.value === "" ? options.emptyValue
|
|
241
|
+
const value2 = e.target.value === "" ? options.emptyValue : e.target.value;
|
|
238
242
|
handler(value2);
|
|
239
243
|
},
|
|
240
244
|
[onChange, onChangeOverride, options]
|
|
@@ -251,6 +255,14 @@ function BaseInputTemplate(props) {
|
|
|
251
255
|
},
|
|
252
256
|
[onFocus, id]
|
|
253
257
|
);
|
|
258
|
+
const handleClear = (0, import_react.useCallback)(
|
|
259
|
+
(e) => {
|
|
260
|
+
e.preventDefault();
|
|
261
|
+
e.stopPropagation();
|
|
262
|
+
onChange(options.emptyValue ?? "");
|
|
263
|
+
},
|
|
264
|
+
[onChange, options.emptyValue]
|
|
265
|
+
);
|
|
254
266
|
const componentProps = {
|
|
255
267
|
id,
|
|
256
268
|
name: htmlName || id,
|
|
@@ -291,6 +303,7 @@ function BaseInputTemplate(props) {
|
|
|
291
303
|
);
|
|
292
304
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
293
305
|
input,
|
|
306
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ClearButton2, { registry, onClick: handleClear }),
|
|
294
307
|
children,
|
|
295
308
|
Array.isArray(schema.examples) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("datalist", { id: (0, import_utils4.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
|
|
296
309
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: example }, example);
|
|
@@ -559,6 +572,12 @@ function RemoveButton(props) {
|
|
|
559
572
|
}
|
|
560
573
|
);
|
|
561
574
|
}
|
|
575
|
+
function ClearButton(props) {
|
|
576
|
+
const {
|
|
577
|
+
registry: { translateString }
|
|
578
|
+
} = props;
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconButton, { title: translateString(import_utils8.TranslatableString.ClearButton), variant: "subtle", ...props, icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(X, {}) });
|
|
580
|
+
}
|
|
562
581
|
|
|
563
582
|
// src/templates/ButtonTemplates/AddButton.tsx
|
|
564
583
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
@@ -577,7 +596,8 @@ function buttonTemplates() {
|
|
|
577
596
|
CopyButton,
|
|
578
597
|
MoveDownButton,
|
|
579
598
|
MoveUpButton,
|
|
580
|
-
RemoveButton
|
|
599
|
+
RemoveButton,
|
|
600
|
+
ClearButton
|
|
581
601
|
};
|
|
582
602
|
}
|
|
583
603
|
var ButtonTemplates_default = buttonTemplates;
|
|
@@ -1451,7 +1471,7 @@ function PasswordWidget(props) {
|
|
|
1451
1471
|
onBlur,
|
|
1452
1472
|
onFocus
|
|
1453
1473
|
} = props;
|
|
1454
|
-
const emptyValue = options.emptyValue
|
|
1474
|
+
const emptyValue = options.emptyValue;
|
|
1455
1475
|
const themeProps = cleanupOptions(options);
|
|
1456
1476
|
const handleChange = (0, import_react8.useCallback)(
|
|
1457
1477
|
(e) => {
|
|
@@ -1755,7 +1775,7 @@ function TextareaWidget(props) {
|
|
|
1755
1775
|
onFocus
|
|
1756
1776
|
} = props;
|
|
1757
1777
|
const themeProps = cleanupOptions(options);
|
|
1758
|
-
const emptyValue = options?.emptyValue
|
|
1778
|
+
const emptyValue = options?.emptyValue;
|
|
1759
1779
|
const handleChange = (0, import_react12.useCallback)(
|
|
1760
1780
|
(e) => {
|
|
1761
1781
|
onChange(e.target.value === "" ? emptyValue : e.target.value);
|