@rjsf/daisyui 6.0.0-beta.13 → 6.0.0-beta.14

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.
@@ -419,6 +419,10 @@ function FieldHelpTemplate(props) {
419
419
  }
420
420
 
421
421
  // src/templates/FieldTemplate/FieldTemplate.tsx
422
+ import {
423
+ getTemplate as getTemplate3,
424
+ getUiOptions as getUiOptions3
425
+ } from "@rjsf/utils";
422
426
  import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
423
427
  function FieldTemplate(props) {
424
428
  const {
@@ -448,15 +452,37 @@ function FieldTemplate(props) {
448
452
  ...divProps
449
453
  } = props;
450
454
  const isCheckbox = schema.type === "boolean";
451
- return /* @__PURE__ */ jsxs5("div", { className: `field-template mb-3 ${classNames || ""}`, ...divProps, children: [
452
- displayLabel && !isCheckbox && /* @__PURE__ */ jsx13("label", { htmlFor: id, className: "label", children: /* @__PURE__ */ jsxs5("span", { className: "label-text font-medium", children: [
455
+ const uiOptions = getUiOptions3(uiSchema);
456
+ const WrapIfAdditionalTemplate2 = getTemplate3(
457
+ "WrapIfAdditionalTemplate",
458
+ registry,
459
+ uiOptions
460
+ );
461
+ return /* @__PURE__ */ jsx13(
462
+ WrapIfAdditionalTemplate2,
463
+ {
464
+ classNames,
465
+ disabled: divProps.disabled,
466
+ id,
453
467
  label,
454
- required && /* @__PURE__ */ jsx13("span", { className: "text-error ml-1", children: "*" })
455
- ] }) }),
456
- children,
457
- errors,
458
- help
459
- ] });
468
+ onDropPropertyClick,
469
+ onKeyChange,
470
+ readonly,
471
+ required,
472
+ schema,
473
+ uiSchema,
474
+ registry,
475
+ children: /* @__PURE__ */ jsxs5("div", { className: `field-template mb-3 ${classNames || ""}`, ...divProps, children: [
476
+ displayLabel && !isCheckbox && /* @__PURE__ */ jsx13("label", { htmlFor: id, className: "label", children: /* @__PURE__ */ jsxs5("span", { className: "label-text font-medium", children: [
477
+ label,
478
+ required && /* @__PURE__ */ jsx13("span", { className: "text-error ml-1", children: "*" })
479
+ ] }) }),
480
+ children,
481
+ errors,
482
+ help
483
+ ] })
484
+ }
485
+ );
460
486
  }
461
487
 
462
488
  // src/templates/GridTemplate/GridTemplate.tsx
@@ -483,8 +509,8 @@ function MultiSchemaFieldTemplate(props) {
483
509
  import {
484
510
  canExpand,
485
511
  descriptionId,
486
- getTemplate as getTemplate3,
487
- getUiOptions as getUiOptions3,
512
+ getTemplate as getTemplate4,
513
+ getUiOptions as getUiOptions4,
488
514
  titleId,
489
515
  buttonId as buttonId3
490
516
  } from "@rjsf/utils";
@@ -504,9 +530,9 @@ function ObjectFieldTemplate(props) {
504
530
  onAddClick,
505
531
  registry
506
532
  } = props;
507
- const uiOptions = getUiOptions3(uiSchema);
508
- const TitleFieldTemplate = getTemplate3("TitleFieldTemplate", registry, uiOptions);
509
- const DescriptionFieldTemplate = getTemplate3(
533
+ const uiOptions = getUiOptions4(uiSchema);
534
+ const TitleFieldTemplate = getTemplate4("TitleFieldTemplate", registry, uiOptions);
535
+ const DescriptionFieldTemplate = getTemplate4(
510
536
  "DescriptionFieldTemplate",
511
537
  registry,
512
538
  uiOptions
@@ -564,11 +590,11 @@ function ObjectFieldTemplate(props) {
564
590
  }
565
591
 
566
592
  // src/templates/TitleField/TitleField.tsx
567
- import { getUiOptions as getUiOptions4 } from "@rjsf/utils";
593
+ import { getUiOptions as getUiOptions5 } from "@rjsf/utils";
568
594
  import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
569
595
  function TitleField(props) {
570
596
  const { id, title, uiSchema } = props;
571
- const uiOptions = getUiOptions4(uiSchema);
597
+ const uiOptions = getUiOptions5(uiSchema);
572
598
  return /* @__PURE__ */ jsxs8("div", { id, className: "title-field mb-6", children: [
573
599
  /* @__PURE__ */ jsx17("h2", { className: "text-3xl font-bold text-primary mb-2", children: uiOptions.title || title }),
574
600
  /* @__PURE__ */ jsx17("div", { className: "divider divider-primary" })
@@ -578,8 +604,9 @@ function TitleField(props) {
578
604
  // src/templates/WrapIfAdditionalTemplate/WrapIfAdditionalTemplate.tsx
579
605
  import { useCallback as useCallback3 } from "react";
580
606
  import {
581
- TranslatableString as TranslatableString4,
582
- buttonId as buttonId4
607
+ buttonId as buttonId4,
608
+ ADDITIONAL_PROPERTY_FLAG,
609
+ TranslatableString as TranslatableString4
583
610
  } from "@rjsf/utils";
584
611
  import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
585
612
  function WrapIfAdditionalTemplate(props) {
@@ -592,12 +619,16 @@ function WrapIfAdditionalTemplate(props) {
592
619
  readonly,
593
620
  required,
594
621
  schema,
622
+ uiSchema,
595
623
  onKeyChange,
596
624
  onDropPropertyClick,
597
625
  registry,
598
626
  ...rest
599
627
  } = props;
600
- const { translateString } = registry;
628
+ const additional = ADDITIONAL_PROPERTY_FLAG in schema;
629
+ const { templates, translateString } = registry;
630
+ const { RemoveButton: RemoveButton2 } = templates.ButtonTemplates;
631
+ const keyLabel = translateString(TranslatableString4.KeyLabel, [label]);
601
632
  const handleBlur = useCallback3(
602
633
  (event) => {
603
634
  onKeyChange(event.target.value);
@@ -607,8 +638,12 @@ function WrapIfAdditionalTemplate(props) {
607
638
  const handleRemove = useCallback3(() => {
608
639
  onDropPropertyClick(label)();
609
640
  }, [onDropPropertyClick, label]);
610
- return /* @__PURE__ */ jsxs9("div", { className: `wrap-if-additional-template ${classNames}`, ...rest, children: [
611
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center", children: [
641
+ if (!additional) {
642
+ return /* @__PURE__ */ jsx18("div", { className: classNames, children });
643
+ }
644
+ return /* @__PURE__ */ jsx18("div", { className: `wrap-if-additional-template ${classNames}`, ...rest, children: /* @__PURE__ */ jsxs9("div", { className: "flex items-baseline", style: { justifyContent: "space-between" }, children: [
645
+ /* @__PURE__ */ jsxs9("div", { children: [
646
+ /* @__PURE__ */ jsx18("label", { htmlFor: `${id}-key`, className: "label", children: /* @__PURE__ */ jsx18("span", { className: "label-text", children: keyLabel }) }),
612
647
  /* @__PURE__ */ jsx18(
613
648
  "input",
614
649
  {
@@ -619,20 +654,21 @@ function WrapIfAdditionalTemplate(props) {
619
654
  defaultValue: label,
620
655
  disabled: disabled || readonly
621
656
  }
622
- ),
623
- schema.additionalProperties && /* @__PURE__ */ jsx18(
624
- "button",
625
- {
626
- id: buttonId4(id, "remove"),
627
- className: "rjsf-array-item-remove btn btn-danger ml-2",
628
- onClick: handleRemove,
629
- disabled: disabled || readonly,
630
- children: translateString(TranslatableString4.RemoveButton)
631
- }
632
657
  )
633
658
  ] }),
634
- children
635
- ] });
659
+ children,
660
+ /* @__PURE__ */ jsx18("div", { className: "flex self-center", children: /* @__PURE__ */ jsx18(
661
+ RemoveButton2,
662
+ {
663
+ id: buttonId4(id, "remove"),
664
+ className: "rjsf-object-property-remove",
665
+ disabled: disabled || readonly,
666
+ onClick: handleRemove,
667
+ uiSchema,
668
+ registry
669
+ }
670
+ ) })
671
+ ] }) });
636
672
  }
637
673
 
638
674
  // src/templates/Templates.tsx
@@ -873,7 +909,7 @@ function AltDateWidget({
873
909
 
874
910
  // src/widgets/CheckboxWidget/CheckboxWidget.tsx
875
911
  import { useCallback as useCallback5 } from "react";
876
- import { getTemplate as getTemplate4, descriptionId as descriptionId2 } from "@rjsf/utils";
912
+ import { getTemplate as getTemplate5, descriptionId as descriptionId2 } from "@rjsf/utils";
877
913
  import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
878
914
  function CheckboxWidget(props) {
879
915
  const {
@@ -892,7 +928,7 @@ function CheckboxWidget(props) {
892
928
  onFocus,
893
929
  onBlur
894
930
  } = props;
895
- const DescriptionFieldTemplate = getTemplate4(
931
+ const DescriptionFieldTemplate = getTemplate5(
896
932
  "DescriptionFieldTemplate",
897
933
  registry,
898
934
  options
@@ -1224,7 +1260,7 @@ function DateTimeWidget(props) {
1224
1260
  };
1225
1261
  document.addEventListener("keydown", handleEscape);
1226
1262
  return () => document.removeEventListener("keydown", handleEscape);
1227
- }, [id, isOpen, onBlur, value]);
1263
+ }, [id, isOpen, setIsOpen, onBlur, value]);
1228
1264
  const handleDoneClick = useCallback7(() => {
1229
1265
  setIsOpen(false);
1230
1266
  onChange(localDate ? localDate.toISOString() : "");
@@ -1232,7 +1268,7 @@ function DateTimeWidget(props) {
1232
1268
  onBlur(id, value);
1233
1269
  }
1234
1270
  inputRef.current?.focus();
1235
- }, [localDate, onChange, onBlur, id, value]);
1271
+ }, [localDate, onChange, onBlur, id, value, setIsOpen]);
1236
1272
  return /* @__PURE__ */ jsx23("div", { className: "form-control my-4 w-full relative", children: /* @__PURE__ */ jsxs13(
1237
1273
  "div",
1238
1274
  {
@@ -1487,7 +1523,7 @@ function DateWidget(props) {
1487
1523
  };
1488
1524
  document.addEventListener("keydown", handleEscape);
1489
1525
  return () => document.removeEventListener("keydown", handleEscape);
1490
- }, [id, isOpen, onBlur, value]);
1526
+ }, [id, isOpen, setIsOpen, onBlur, value]);
1491
1527
  const handleDoneClick = useCallback8(() => {
1492
1528
  setIsOpen(false);
1493
1529
  onChange(localDate ? localDate.toISOString() : "");
@@ -1495,7 +1531,7 @@ function DateWidget(props) {
1495
1531
  onBlur(id, value);
1496
1532
  }
1497
1533
  inputRef.current?.focus();
1498
- }, [localDate, onChange, onBlur, id, value]);
1534
+ }, [localDate, onChange, onBlur, id, value, setIsOpen]);
1499
1535
  return /* @__PURE__ */ jsx24("div", { className: "form-control my-4 w-full relative", children: /* @__PURE__ */ jsxs14(
1500
1536
  "div",
1501
1537
  {