@rjsf/daisyui 6.5.2 → 6.6.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.
Files changed (42) hide show
  1. package/dist/chakra-ui.esm.js +122 -122
  2. package/dist/chakra-ui.esm.js.map +4 -4
  3. package/dist/chakra-ui.umd.js +94 -94
  4. package/dist/index.cjs +129 -129
  5. package/dist/index.cjs.map +4 -4
  6. package/lib/DaisyUIForm.js.map +1 -1
  7. package/lib/templates/BaseInputTemplate/BaseInputTemplate.js +1 -1
  8. package/lib/templates/BaseInputTemplate/BaseInputTemplate.js.map +1 -1
  9. package/lib/templates/ButtonTemplates/AddButton.js +1 -1
  10. package/lib/templates/ButtonTemplates/AddButton.js.map +1 -1
  11. package/lib/templates/ButtonTemplates/DaisyUIButton.d.ts +1 -1
  12. package/lib/templates/ButtonTemplates/IconButton.js +1 -1
  13. package/lib/templates/ButtonTemplates/IconButton.js.map +1 -1
  14. package/lib/templates/ButtonTemplates/index.d.ts +1 -1
  15. package/lib/templates/ButtonTemplates/index.js +1 -1
  16. package/lib/templates/ButtonTemplates/index.js.map +1 -1
  17. package/lib/templates/DescriptionField/DescriptionField.js.map +1 -1
  18. package/lib/templates/FieldHelpTemplate/FieldHelpTemplate.js +1 -1
  19. package/lib/templates/FieldHelpTemplate/FieldHelpTemplate.js.map +1 -1
  20. package/lib/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.js.map +1 -1
  21. package/lib/tsconfig.tsbuildinfo +1 -1
  22. package/lib/widgets/DateTimeWidget/DateTimeWidget.js +1 -1
  23. package/lib/widgets/DateTimeWidget/DateTimeWidget.js.map +1 -1
  24. package/lib/widgets/DateWidget/DateWidget.js +1 -1
  25. package/lib/widgets/DateWidget/DateWidget.js.map +1 -1
  26. package/lib/widgets/Widgets.d.ts +1 -1
  27. package/lib/widgets/Widgets.js +1 -1
  28. package/lib/widgets/Widgets.js.map +1 -1
  29. package/package.json +19 -19
  30. package/src/DaisyUIForm.tsx +1 -0
  31. package/src/templates/BaseInputTemplate/BaseInputTemplate.tsx +1 -1
  32. package/src/templates/ButtonTemplates/AddButton.tsx +2 -2
  33. package/src/templates/ButtonTemplates/DaisyUIButton.tsx +2 -2
  34. package/src/templates/ButtonTemplates/IconButton.tsx +2 -2
  35. package/src/templates/ButtonTemplates/index.ts +1 -1
  36. package/src/templates/DescriptionField/DescriptionField.tsx +1 -1
  37. package/src/templates/FieldHelpTemplate/FieldHelpTemplate.tsx +1 -1
  38. package/src/templates/OptionalDataControlsTemplate/OptionalDataControlsTemplate.tsx +1 -1
  39. package/src/tsconfig.json +0 -2
  40. package/src/widgets/DateTimeWidget/DateTimeWidget.tsx +3 -2
  41. package/src/widgets/DateWidget/DateWidget.tsx +3 -2
  42. package/src/widgets/Widgets.tsx +1 -1
@@ -206,12 +206,12 @@ function ArrayFieldTemplate(props) {
206
206
 
207
207
  // src/templates/BaseInputTemplate/BaseInputTemplate.tsx
208
208
  import { useCallback as useCallback2 } from "react";
209
+ import { SchemaExamples } from "@rjsf/core";
209
210
  import {
210
211
  getInputProps,
211
212
  ariaDescribedByIds,
212
213
  examplesId
213
214
  } from "@rjsf/utils";
214
- import { SchemaExamples } from "@rjsf/core";
215
215
  import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
216
216
  function BaseInputTemplate(props) {
217
217
  const {
@@ -296,9 +296,9 @@ function BaseInputTemplate(props) {
296
296
  }
297
297
 
298
298
  // src/templates/ButtonTemplates/AddButton.tsx
299
- import { TranslatableString as TranslatableString2 } from "@rjsf/utils";
300
299
  import { library } from "@fortawesome/fontawesome-svg-core";
301
300
  import { faArrowDown, faArrowUp, faCopy, faTrash, faPlus } from "@fortawesome/free-solid-svg-icons";
301
+ import { TranslatableString as TranslatableString2 } from "@rjsf/utils";
302
302
 
303
303
  // src/templates/ButtonTemplates/DaisyUIButton.tsx
304
304
  import { memo } from "react";
@@ -337,40 +337,21 @@ function AddButton({
337
337
  ) }) });
338
338
  }
339
339
 
340
- // src/templates/ButtonTemplates/SubmitButton.tsx
341
- import { getSubmitButtonOptions } from "@rjsf/utils";
342
- import { jsx as jsx7 } from "react/jsx-runtime";
343
- function SubmitButton({ uiSchema }) {
344
- const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
345
- if (norender) {
346
- return null;
347
- }
348
- return /* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
349
- "button",
350
- {
351
- type: "submit",
352
- ...submitButtonProps,
353
- className: `btn btn-primary btn-primary-content ${submitButtonProps.className || ""}`,
354
- children: submitText
355
- }
356
- ) });
357
- }
358
-
359
340
  // src/templates/ButtonTemplates/IconButton.tsx
360
- import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
361
341
  import { faCopy as faCopy2, faArrowDown as faArrowDown2, faArrowUp as faArrowUp2, faTrash as faTrash2, faXmark } from "@fortawesome/free-solid-svg-icons";
362
- import { jsx as jsx8 } from "react/jsx-runtime";
342
+ import { TranslatableString as TranslatableString3 } from "@rjsf/utils";
343
+ import { jsx as jsx7 } from "react/jsx-runtime";
363
344
  function CopyButton(props) {
364
345
  const {
365
346
  registry: { translateString }
366
347
  } = props;
367
- return /* @__PURE__ */ jsx8(DaisyUIButton_default, { title: translateString(TranslatableString3.CopyButton), ...props, icon: faCopy2 });
348
+ return /* @__PURE__ */ jsx7(DaisyUIButton_default, { title: translateString(TranslatableString3.CopyButton), ...props, icon: faCopy2 });
368
349
  }
369
350
  function MoveDownButton(props) {
370
351
  const {
371
352
  registry: { translateString }
372
353
  } = props;
373
- return /* @__PURE__ */ jsx8(
354
+ return /* @__PURE__ */ jsx7(
374
355
  DaisyUIButton_default,
375
356
  {
376
357
  title: translateString(TranslatableString3.MoveDownButton),
@@ -383,7 +364,7 @@ function MoveUpButton(props) {
383
364
  const {
384
365
  registry: { translateString }
385
366
  } = props;
386
- return /* @__PURE__ */ jsx8(
367
+ return /* @__PURE__ */ jsx7(
387
368
  DaisyUIButton_default,
388
369
  {
389
370
  title: translateString(TranslatableString3.MoveUpButton),
@@ -396,7 +377,7 @@ function RemoveButton(props) {
396
377
  const {
397
378
  registry: { translateString }
398
379
  } = props;
399
- return /* @__PURE__ */ jsx8(
380
+ return /* @__PURE__ */ jsx7(
400
381
  DaisyUIButton_default,
401
382
  {
402
383
  title: translateString(TranslatableString3.RemoveButton),
@@ -410,7 +391,7 @@ function ClearButton(props) {
410
391
  const {
411
392
  registry: { translateString }
412
393
  } = props;
413
- return /* @__PURE__ */ jsx8(
394
+ return /* @__PURE__ */ jsx7(
414
395
  DaisyUIButton_default,
415
396
  {
416
397
  title: translateString(TranslatableString3.ClearButton),
@@ -421,6 +402,25 @@ function ClearButton(props) {
421
402
  );
422
403
  }
423
404
 
405
+ // src/templates/ButtonTemplates/SubmitButton.tsx
406
+ import { getSubmitButtonOptions } from "@rjsf/utils";
407
+ import { jsx as jsx8 } from "react/jsx-runtime";
408
+ function SubmitButton({ uiSchema }) {
409
+ const { submitText, norender, props: submitButtonProps = {} } = getSubmitButtonOptions(uiSchema);
410
+ if (norender) {
411
+ return null;
412
+ }
413
+ return /* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(
414
+ "button",
415
+ {
416
+ type: "submit",
417
+ ...submitButtonProps,
418
+ className: `btn btn-primary btn-primary-content ${submitButtonProps.className || ""}`,
419
+ children: submitText
420
+ }
421
+ ) });
422
+ }
423
+
424
424
  // src/templates/DescriptionField/DescriptionField.tsx
425
425
  import { RichDescription } from "@rjsf/core";
426
426
  import { jsx as jsx9 } from "react/jsx-runtime";
@@ -447,8 +447,8 @@ function FieldErrorTemplate(props) {
447
447
  }
448
448
 
449
449
  // src/templates/FieldHelpTemplate/FieldHelpTemplate.tsx
450
- import { helpId } from "@rjsf/utils";
451
450
  import { RichHelp } from "@rjsf/core";
451
+ import { helpId } from "@rjsf/utils";
452
452
  import { jsx as jsx12 } from "react/jsx-runtime";
453
453
  function FieldHelpTemplate(props) {
454
454
  const { help, uiSchema, registry, fieldPathId } = props;
@@ -866,94 +866,14 @@ function AltDateWidget(props) {
866
866
  ] });
867
867
  }
868
868
 
869
- // src/widgets/CheckboxWidget/CheckboxWidget.tsx
870
- import { useCallback as useCallback3 } from "react";
871
- import { getTemplate as getTemplate5, descriptionId as descriptionId2 } from "@rjsf/utils";
872
- import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
873
- function CheckboxWidget(props) {
874
- const {
875
- id,
876
- htmlName,
877
- value,
878
- required,
879
- disabled,
880
- hideLabel,
881
- label,
882
- readonly,
883
- registry,
884
- options,
885
- schema,
886
- uiSchema,
887
- onChange,
888
- onFocus,
889
- onBlur
890
- } = props;
891
- const DescriptionFieldTemplate = getTemplate5(
892
- "DescriptionFieldTemplate",
893
- registry,
894
- options
895
- );
896
- const description = options.description || schema.description;
897
- const handleFocus = useCallback3(() => {
898
- if (onFocus) {
899
- onFocus(id, value);
900
- }
901
- }, [onFocus, id, value]);
902
- const handleBlur = useCallback3(() => {
903
- if (onBlur) {
904
- onBlur(id, value);
905
- }
906
- }, [onBlur, id, value]);
907
- const handleChange = useCallback3(
908
- (event) => {
909
- onChange(event.target.checked);
910
- },
911
- [onChange]
912
- );
913
- const input = /* @__PURE__ */ jsx22(
914
- "input",
915
- {
916
- type: "checkbox",
917
- id,
918
- name: htmlName || id,
919
- checked: value,
920
- required,
921
- disabled: disabled || readonly,
922
- onChange: handleChange,
923
- onFocus: handleFocus,
924
- onBlur: handleBlur,
925
- className: "checkbox"
926
- }
927
- );
928
- return /* @__PURE__ */ jsxs11("div", { className: "form-control", children: [
929
- !hideLabel && description && /* @__PURE__ */ jsx22(
930
- DescriptionFieldTemplate,
931
- {
932
- id: descriptionId2(id),
933
- description,
934
- schema,
935
- uiSchema,
936
- registry
937
- }
938
- ),
939
- hideLabel || !label ? input : /* @__PURE__ */ jsxs11("label", { className: "label cursor-pointer justify-start", children: [
940
- /* @__PURE__ */ jsx22("div", { className: "mr-2", children: input }),
941
- /* @__PURE__ */ jsxs11("span", { className: "label-text", children: [
942
- label,
943
- required && /* @__PURE__ */ jsx22("span", { className: "text-error ml-1", children: "*" })
944
- ] })
945
- ] })
946
- ] });
947
- }
948
-
949
869
  // src/widgets/CheckboxesWidget/CheckboxesWidget.tsx
950
- import { useCallback as useCallback4 } from "react";
870
+ import { useCallback as useCallback3 } from "react";
951
871
  import {
952
872
  enumOptionValueDecoder,
953
873
  enumOptionValueEncoder,
954
874
  getOptionValueFormat
955
875
  } from "@rjsf/utils";
956
- import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
876
+ import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
957
877
  function CheckboxesWidget({
958
878
  id,
959
879
  htmlName,
@@ -969,7 +889,7 @@ function CheckboxesWidget({
969
889
  const { enumOptions, emptyValue } = options;
970
890
  const optionValueFormat = getOptionValueFormat(options);
971
891
  const isEnumeratedObject = enumOptions && enumOptions[0]?.value && typeof enumOptions[0].value === "object";
972
- const isChecked = useCallback4(
892
+ const isChecked = useCallback3(
973
893
  (option) => {
974
894
  if (!Array.isArray(value)) {
975
895
  return false;
@@ -981,7 +901,7 @@ function CheckboxesWidget({
981
901
  },
982
902
  [value, isEnumeratedObject]
983
903
  );
984
- const handleChange = useCallback4(
904
+ const handleChange = useCallback3(
985
905
  (event) => {
986
906
  const index = Number(event.target.dataset.index);
987
907
  const option = enumOptions?.[index];
@@ -998,7 +918,7 @@ function CheckboxesWidget({
998
918
  },
999
919
  [onChange, value, isChecked, isEnumeratedObject, enumOptions]
1000
920
  );
1001
- const handleFocus = useCallback4(
921
+ const handleFocus = useCallback3(
1002
922
  (event) => {
1003
923
  if (onFocus) {
1004
924
  onFocus(id, enumOptionValueDecoder(event.target.value, enumOptions, optionValueFormat, emptyValue));
@@ -1006,7 +926,7 @@ function CheckboxesWidget({
1006
926
  },
1007
927
  [onFocus, id, enumOptions, optionValueFormat, emptyValue]
1008
928
  );
1009
- const handleBlur = useCallback4(
929
+ const handleBlur = useCallback3(
1010
930
  (event) => {
1011
931
  if (onBlur) {
1012
932
  onBlur(id, enumOptionValueDecoder(event.target.value, enumOptions, optionValueFormat, emptyValue));
@@ -1014,8 +934,8 @@ function CheckboxesWidget({
1014
934
  },
1015
935
  [onBlur, id, enumOptions, optionValueFormat, emptyValue]
1016
936
  );
1017
- return /* @__PURE__ */ jsx23("div", { className: "form-control", children: /* @__PURE__ */ jsx23("div", { className: "flex flex-col gap-2 mt-1", children: enumOptions?.map((option, index) => /* @__PURE__ */ jsxs12("label", { className: "flex items-center cursor-pointer gap-2", children: [
1018
- /* @__PURE__ */ jsx23(
937
+ return /* @__PURE__ */ jsx22("div", { className: "form-control", children: /* @__PURE__ */ jsx22("div", { className: "flex flex-col gap-2 mt-1", children: enumOptions?.map((option, index) => /* @__PURE__ */ jsxs11("label", { className: "flex items-center cursor-pointer gap-2", children: [
938
+ /* @__PURE__ */ jsx22(
1019
939
  "input",
1020
940
  {
1021
941
  type: "checkbox",
@@ -1032,10 +952,90 @@ function CheckboxesWidget({
1032
952
  onBlur: handleBlur
1033
953
  }
1034
954
  ),
1035
- /* @__PURE__ */ jsx23("span", { className: "label-text", children: option.label })
955
+ /* @__PURE__ */ jsx22("span", { className: "label-text", children: option.label })
1036
956
  ] }, option.value)) }) });
1037
957
  }
1038
958
 
959
+ // src/widgets/CheckboxWidget/CheckboxWidget.tsx
960
+ import { useCallback as useCallback4 } from "react";
961
+ import { getTemplate as getTemplate5, descriptionId as descriptionId2 } from "@rjsf/utils";
962
+ import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
963
+ function CheckboxWidget(props) {
964
+ const {
965
+ id,
966
+ htmlName,
967
+ value,
968
+ required,
969
+ disabled,
970
+ hideLabel,
971
+ label,
972
+ readonly,
973
+ registry,
974
+ options,
975
+ schema,
976
+ uiSchema,
977
+ onChange,
978
+ onFocus,
979
+ onBlur
980
+ } = props;
981
+ const DescriptionFieldTemplate = getTemplate5(
982
+ "DescriptionFieldTemplate",
983
+ registry,
984
+ options
985
+ );
986
+ const description = options.description || schema.description;
987
+ const handleFocus = useCallback4(() => {
988
+ if (onFocus) {
989
+ onFocus(id, value);
990
+ }
991
+ }, [onFocus, id, value]);
992
+ const handleBlur = useCallback4(() => {
993
+ if (onBlur) {
994
+ onBlur(id, value);
995
+ }
996
+ }, [onBlur, id, value]);
997
+ const handleChange = useCallback4(
998
+ (event) => {
999
+ onChange(event.target.checked);
1000
+ },
1001
+ [onChange]
1002
+ );
1003
+ const input = /* @__PURE__ */ jsx23(
1004
+ "input",
1005
+ {
1006
+ type: "checkbox",
1007
+ id,
1008
+ name: htmlName || id,
1009
+ checked: value,
1010
+ required,
1011
+ disabled: disabled || readonly,
1012
+ onChange: handleChange,
1013
+ onFocus: handleFocus,
1014
+ onBlur: handleBlur,
1015
+ className: "checkbox"
1016
+ }
1017
+ );
1018
+ return /* @__PURE__ */ jsxs12("div", { className: "form-control", children: [
1019
+ !hideLabel && description && /* @__PURE__ */ jsx23(
1020
+ DescriptionFieldTemplate,
1021
+ {
1022
+ id: descriptionId2(id),
1023
+ description,
1024
+ schema,
1025
+ uiSchema,
1026
+ registry
1027
+ }
1028
+ ),
1029
+ hideLabel || !label ? input : /* @__PURE__ */ jsxs12("label", { className: "label cursor-pointer justify-start", children: [
1030
+ /* @__PURE__ */ jsx23("div", { className: "mr-2", children: input }),
1031
+ /* @__PURE__ */ jsxs12("span", { className: "label-text", children: [
1032
+ label,
1033
+ required && /* @__PURE__ */ jsx23("span", { className: "text-error ml-1", children: "*" })
1034
+ ] })
1035
+ ] })
1036
+ ] });
1037
+ }
1038
+
1039
1039
  // src/widgets/DateTimeWidget/DateTimeWidget.tsx
1040
1040
  import { memo as memo2, useCallback as useCallback5, useEffect, useMemo, useRef, useState } from "react";
1041
1041
  import { faCalendar } from "@fortawesome/free-solid-svg-icons";
@@ -1108,8 +1108,8 @@ function DateTimePickerPopup({ selectedDate, month, onMonthChange, onSelect, onT
1108
1108
  onMonthChange,
1109
1109
  onSelect,
1110
1110
  captionLayout: "dropdown",
1111
- fromYear: 1900,
1112
- toYear: (/* @__PURE__ */ new Date()).getFullYear() + 10,
1111
+ startMonth: new Date(1900, 0),
1112
+ endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11),
1113
1113
  showOutsideDays: true,
1114
1114
  classNames: dayPickerStyles.classNames,
1115
1115
  modifiers: customDayModifiers,
@@ -1350,8 +1350,8 @@ function DatePickerPopup({ selectedDate, month, onMonthChange, onSelect }) {
1350
1350
  onMonthChange,
1351
1351
  onSelect,
1352
1352
  captionLayout: "dropdown",
1353
- fromYear: 1900,
1354
- toYear: (/* @__PURE__ */ new Date()).getFullYear() + 10,
1353
+ startMonth: new Date(1900, 0),
1354
+ endMonth: new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11),
1355
1355
  showOutsideDays: true,
1356
1356
  classNames: dayPickerStyles2.classNames,
1357
1357
  modifiers: customDayModifiers,