@rjsf/mantine 6.1.2 → 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.
@@ -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);
@@ -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;