@rjsf/daisyui 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/chakra-ui.esm.js +52 -23
- package/dist/chakra-ui.esm.js.map +3 -3
- package/dist/chakra-ui.umd.js +51 -22
- package/dist/index.cjs +51 -22
- package/dist/index.cjs.map +3 -3
- package/lib/templates/BaseInputTemplate/BaseInputTemplate.js +9 -2
- package/lib/templates/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
- package/lib/templates/ButtonTemplates/IconButton.d.ts +1 -0
- package/lib/templates/ButtonTemplates/IconButton.js +5 -1
- package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
- package/lib/templates/ButtonTemplates/index.d.ts +3 -2
- package/lib/templates/ButtonTemplates/index.js +3 -2
- package/lib/templates/ButtonTemplates/index.js.map +1 -1
- package/lib/templates/FieldTemplate/FieldTemplate.js +1 -1
- package/lib/templates/FieldTemplate/FieldTemplate.js.map +1 -1
- package/lib/templates/Templates.js +2 -1
- package/lib/templates/Templates.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/templates/BaseInputTemplate/BaseInputTemplate.tsx +34 -18
- package/src/templates/ButtonTemplates/IconButton.tsx +18 -1
- package/src/templates/ButtonTemplates/index.ts +3 -2
- package/src/templates/FieldTemplate/FieldTemplate.tsx +1 -0
- package/src/templates/Templates.tsx +10 -1
package/dist/chakra-ui.esm.js
CHANGED
|
@@ -230,8 +230,10 @@ function BaseInputTemplate(props) {
|
|
|
230
230
|
schema,
|
|
231
231
|
type,
|
|
232
232
|
label,
|
|
233
|
-
placeholder
|
|
233
|
+
placeholder,
|
|
234
|
+
registry
|
|
234
235
|
} = props;
|
|
236
|
+
const { ClearButton: ClearButton2 } = registry.templates.ButtonTemplates;
|
|
235
237
|
const inputProps = getInputProps(schema, type, options);
|
|
236
238
|
let className = "input input-bordered w-full";
|
|
237
239
|
let isMulti = multiple;
|
|
@@ -253,29 +255,40 @@ function BaseInputTemplate(props) {
|
|
|
253
255
|
({ target }) => onFocus && onFocus(id, target.value),
|
|
254
256
|
[onFocus, id]
|
|
255
257
|
);
|
|
258
|
+
const _onClear = useCallback2(
|
|
259
|
+
(e) => {
|
|
260
|
+
e.preventDefault();
|
|
261
|
+
e.stopPropagation();
|
|
262
|
+
onChange(options.emptyValue ?? "");
|
|
263
|
+
},
|
|
264
|
+
[onChange, options.emptyValue]
|
|
265
|
+
);
|
|
256
266
|
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
257
267
|
/* @__PURE__ */ jsxs4("div", { className: "form-control", children: [
|
|
258
268
|
/* @__PURE__ */ jsx4("label", { htmlFor: id, className: "label hidden", style: { display: "none" }, children: /* @__PURE__ */ jsx4("span", { className: "label-text", children: label }) }),
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
269
|
+
/* @__PURE__ */ jsxs4("div", { style: { position: "relative" }, children: [
|
|
270
|
+
/* @__PURE__ */ jsx4(
|
|
271
|
+
"input",
|
|
272
|
+
{
|
|
273
|
+
id,
|
|
274
|
+
name: htmlName || id,
|
|
275
|
+
value: value || value === 0 ? value : "",
|
|
276
|
+
placeholder,
|
|
277
|
+
required,
|
|
278
|
+
disabled: disabled || readonly,
|
|
279
|
+
autoFocus: autofocus,
|
|
280
|
+
className,
|
|
281
|
+
multiple: isMulti,
|
|
282
|
+
...rest,
|
|
283
|
+
...htmlInputProps,
|
|
284
|
+
onChange: onChangeOverride || _onChange,
|
|
285
|
+
onBlur: _onBlur,
|
|
286
|
+
onFocus: _onFocus,
|
|
287
|
+
"aria-describedby": ariaDescribedByIds(id, !!schema.examples)
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx4(ClearButton2, { registry, onClick: _onClear })
|
|
291
|
+
] })
|
|
279
292
|
] }),
|
|
280
293
|
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) => {
|
|
281
294
|
return /* @__PURE__ */ jsx4("option", { value: example }, example);
|
|
@@ -346,7 +359,7 @@ function SubmitButton({ uiSchema }) {
|
|
|
346
359
|
|
|
347
360
|
// src/templates/ButtonTemplates/IconButton.tsx
|
|
348
361
|
import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
|
|
349
|
-
import { faCopy as faCopy2, faArrowDown as faArrowDown2, faArrowUp as faArrowUp2, faTrash as faTrash2 } from "@fortawesome/free-solid-svg-icons";
|
|
362
|
+
import { faCopy as faCopy2, faArrowDown as faArrowDown2, faArrowUp as faArrowUp2, faTrash as faTrash2, faXmark } from "@fortawesome/free-solid-svg-icons";
|
|
350
363
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
351
364
|
function CopyButton(props) {
|
|
352
365
|
const {
|
|
@@ -394,6 +407,20 @@ function RemoveButton(props) {
|
|
|
394
407
|
}
|
|
395
408
|
);
|
|
396
409
|
}
|
|
410
|
+
function ClearButton(props) {
|
|
411
|
+
const {
|
|
412
|
+
registry: { translateString }
|
|
413
|
+
} = props;
|
|
414
|
+
return /* @__PURE__ */ jsx8(
|
|
415
|
+
DaisyUIButton_default,
|
|
416
|
+
{
|
|
417
|
+
title: translateString(TranslatableString3.ClearButton),
|
|
418
|
+
...props,
|
|
419
|
+
iconType: "default",
|
|
420
|
+
icon: faXmark
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}
|
|
397
424
|
|
|
398
425
|
// src/templates/DescriptionField/DescriptionField.tsx
|
|
399
426
|
import { RichDescription } from "@rjsf/core";
|
|
@@ -464,6 +491,7 @@ function FieldTemplate(props) {
|
|
|
464
491
|
rawDescription,
|
|
465
492
|
hidden,
|
|
466
493
|
onChange,
|
|
494
|
+
fieldPathId,
|
|
467
495
|
...divProps
|
|
468
496
|
} = props;
|
|
469
497
|
const isCheckbox = schema.type === "boolean";
|
|
@@ -741,7 +769,8 @@ function generateTemplates() {
|
|
|
741
769
|
CopyButton,
|
|
742
770
|
MoveDownButton,
|
|
743
771
|
MoveUpButton,
|
|
744
|
-
RemoveButton
|
|
772
|
+
RemoveButton,
|
|
773
|
+
ClearButton
|
|
745
774
|
},
|
|
746
775
|
DescriptionFieldTemplate: DescriptionField,
|
|
747
776
|
ErrorListTemplate: ErrorList,
|