@rjsf/daisyui 6.0.2 → 6.1.0

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.
@@ -88,7 +88,7 @@ import {
88
88
  } from "@rjsf/utils";
89
89
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
90
90
  function ArrayFieldItemTemplate(props) {
91
- const { children, buttonsProps, hasToolbar, registry, uiSchema, index, totalItems } = props;
91
+ const { children, buttonsProps, displayLabel, hasToolbar, registry, uiSchema, index, totalItems } = props;
92
92
  const uiOptions = getUiOptions(uiSchema);
93
93
  const ArrayFieldItemButtonsTemplate2 = getTemplate(
94
94
  "ArrayFieldItemButtonsTemplate",
@@ -100,10 +100,16 @@ function ArrayFieldItemTemplate(props) {
100
100
  const borderRadius = isFirstItem ? "rounded-t-lg" : isLastItem ? "rounded-b-lg" : "";
101
101
  const marginBottom = isLastItem ? "" : "mb-[-1px]";
102
102
  const zIndex = index === void 0 ? "" : "z-" + (10 - Math.min(index, 9));
103
- return /* @__PURE__ */ jsxs2("fieldset", { className: `fieldset bg-base-100 border border-base-300 p-4 ${borderRadius} ${marginBottom} ${zIndex}`, children: [
104
- children,
105
- hasToolbar && /* @__PURE__ */ jsx2("div", { className: "flex justify-end mt-2", children: /* @__PURE__ */ jsx2(ArrayFieldItemButtonsTemplate2, { ...buttonsProps }) })
106
- ] });
103
+ return /* @__PURE__ */ jsxs2(
104
+ "fieldset",
105
+ {
106
+ className: `fieldset bg-base-100 border border-base-300 p-4 flex ${borderRadius} ${marginBottom} ${zIndex}`,
107
+ children: [
108
+ children,
109
+ hasToolbar && /* @__PURE__ */ jsx2("div", { className: `flex justify-end ${displayLabel ? "mt-5" : "mt-1"}`, children: /* @__PURE__ */ jsx2(ArrayFieldItemButtonsTemplate2, { ...buttonsProps }) })
110
+ ]
111
+ }
112
+ );
107
113
  }
108
114
 
109
115
  // src/templates/ArrayFieldTemplate/ArrayFieldTemplate.tsx
@@ -227,11 +233,11 @@ function BaseInputTemplate(props) {
227
233
  placeholder
228
234
  } = props;
229
235
  const inputProps = getInputProps(schema, type, options);
230
- let className = "input input-bordered";
236
+ let className = "input input-bordered w-full";
231
237
  let isMulti = multiple;
232
238
  if (type === "file") {
233
239
  isMulti = schema.type === "array" || Boolean(options.multiple);
234
- className = "file-input w-full";
240
+ className = "file-input";
235
241
  }
236
242
  const { step, min, max, accept, ...rest } = inputProps;
237
243
  const htmlInputProps = { step, min, max, accept, ...schema.examples ? { list: examplesId(id) } : void 0 };
@@ -415,10 +421,15 @@ function FieldErrorTemplate(props) {
415
421
  }
416
422
 
417
423
  // src/templates/FieldHelpTemplate/FieldHelpTemplate.tsx
424
+ import { helpId } from "@rjsf/utils";
425
+ import { RichHelp } from "@rjsf/core";
418
426
  import { jsx as jsx12 } from "react/jsx-runtime";
419
427
  function FieldHelpTemplate(props) {
420
- const { help } = props;
421
- return /* @__PURE__ */ jsx12("div", { className: "rjsf-field-help-template text-gray-500 text-sm", children: /* @__PURE__ */ jsx12("div", { children: help }) });
428
+ const { help, uiSchema, registry, fieldPathId } = props;
429
+ if (!help) {
430
+ return null;
431
+ }
432
+ return /* @__PURE__ */ jsx12("div", { id: helpId(fieldPathId), className: "rjsf-field-help-template text-gray-500 text-sm", children: /* @__PURE__ */ jsx12(RichHelp, { help, registry, uiSchema }) });
422
433
  }
423
434
 
424
435
  // src/templates/FieldTemplate/FieldTemplate.tsx
@@ -469,6 +480,7 @@ function FieldTemplate(props) {
469
480
  disabled: divProps.disabled,
470
481
  id,
471
482
  label,
483
+ displayLabel,
472
484
  onKeyRename,
473
485
  onKeyRenameBlur,
474
486
  onRemoveProperty,
@@ -483,6 +495,7 @@ function FieldTemplate(props) {
483
495
  required && /* @__PURE__ */ jsx13("span", { className: "text-error ml-1", children: "*" })
484
496
  ] }) }),
485
497
  children,
498
+ displayLabel && description ? description : null,
486
499
  errors,
487
500
  help
488
501
  ] })
@@ -664,6 +677,7 @@ function WrapIfAdditionalTemplate(props) {
664
677
  disabled,
665
678
  id,
666
679
  label,
680
+ displayLabel,
667
681
  readonly,
668
682
  required,
669
683
  schema,
@@ -671,6 +685,7 @@ function WrapIfAdditionalTemplate(props) {
671
685
  onKeyRename,
672
686
  onKeyRenameBlur,
673
687
  onRemoveProperty,
688
+ rawDescription,
674
689
  registry,
675
690
  ...rest
676
691
  } = props;
@@ -678,12 +693,14 @@ function WrapIfAdditionalTemplate(props) {
678
693
  const { templates, translateString } = registry;
679
694
  const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
680
695
  const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
696
+ const marginDesc = rawDescription ? 10 : 0;
697
+ const margin = displayLabel ? 32 + marginDesc : 10;
681
698
  if (!additional) {
682
- return /* @__PURE__ */ jsx19("div", { className: classNames, children });
699
+ return /* @__PURE__ */ jsx19("div", { className: `flex-grow ${classNames}`, children });
683
700
  }
684
701
  return /* @__PURE__ */ jsx19("div", { className: `wrap-if-additional-template ${classNames}`, ...rest, children: /* @__PURE__ */ jsxs9("div", { className: "flex items-baseline", style: { justifyContent: "space-between" }, children: [
685
702
  /* @__PURE__ */ jsxs9("div", { children: [
686
- /* @__PURE__ */ jsx19("label", { htmlFor: `${id}-key`, className: "label", children: /* @__PURE__ */ jsx19("span", { className: "label-text", children: keyLabel }) }),
703
+ displayLabel && /* @__PURE__ */ jsx19("label", { htmlFor: `${id}-key`, className: "label", children: /* @__PURE__ */ jsx19("span", { className: "label-text", children: keyLabel }) }),
687
704
  /* @__PURE__ */ jsx19(
688
705
  "input",
689
706
  {
@@ -697,7 +714,7 @@ function WrapIfAdditionalTemplate(props) {
697
714
  )
698
715
  ] }),
699
716
  children,
700
- /* @__PURE__ */ jsx19("div", { className: "flex self-center", children: /* @__PURE__ */ jsx19(
717
+ /* @__PURE__ */ jsx19("div", { className: "flex self-start", style: { marginTop: `${margin}px` }, children: /* @__PURE__ */ jsx19(
701
718
  RemoveButton2,
702
719
  {
703
720
  id: buttonId4(id, "remove"),