@rjsf/mantine 6.1.2 → 6.2.4
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 +23 -3
- package/dist/index.cjs.map +3 -3
- package/dist/mantine.esm.js +23 -3
- package/dist/mantine.esm.js.map +3 -3
- package/dist/mantine.umd.js +23 -3
- package/lib/templates/BaseInputTemplate.js +9 -2
- 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/package.json +7 -7
- package/src/templates/BaseInputTemplate.tsx +15 -1
- package/src/templates/ButtonTemplates/IconButton.tsx +12 -0
- package/src/templates/ButtonTemplates/index.ts +2 -1
- package/src/utils.ts +2 -0
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);
|
|
@@ -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;
|