@fuf-stack/uniform 1.28.1 → 1.30.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 (71) hide show
  1. package/README.md +6 -0
  2. package/dist/Checkboxes/index.d.mts +57 -10
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +8 -3
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +129 -1120
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +38 -32
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.mjs +2 -2
  11. package/dist/FieldCard/index.mjs +1 -1
  12. package/dist/FieldReset/index.d.mts +415 -0
  13. package/dist/FieldReset/index.d.mts.map +1 -0
  14. package/dist/FieldReset/index.mjs +241 -0
  15. package/dist/FieldReset/index.mjs.map +1 -0
  16. package/dist/Form/index.d.mts +2 -2
  17. package/dist/Form/index.mjs +2 -2
  18. package/dist/Form/index.mjs.map +1 -1
  19. package/dist/{FormContext-BnNJYZOo.d.mts → FormContext-Dvt3MiKq.d.mts} +3 -3
  20. package/dist/{FormContext-BnNJYZOo.d.mts.map → FormContext-Dvt3MiKq.d.mts.map} +1 -1
  21. package/dist/Input/index.d.mts +63 -452
  22. package/dist/Input/index.d.mts.map +1 -1
  23. package/dist/Input/index.mjs +20 -15
  24. package/dist/Input/index.mjs.map +1 -1
  25. package/dist/RadioBoxes/index.d.mts +163 -894
  26. package/dist/RadioBoxes/index.d.mts.map +1 -1
  27. package/dist/RadioBoxes/index.mjs +27 -20
  28. package/dist/RadioBoxes/index.mjs.map +1 -1
  29. package/dist/RadioTabs/index.d.mts +93 -43
  30. package/dist/RadioTabs/index.d.mts.map +1 -1
  31. package/dist/RadioTabs/index.mjs +8 -5
  32. package/dist/RadioTabs/index.mjs.map +1 -1
  33. package/dist/Radios/index.d.mts +122 -1027
  34. package/dist/Radios/index.d.mts.map +1 -1
  35. package/dist/Radios/index.mjs +22 -18
  36. package/dist/Radios/index.mjs.map +1 -1
  37. package/dist/Select/index.d.mts +440 -3028
  38. package/dist/Select/index.d.mts.map +1 -1
  39. package/dist/Select/index.mjs +79 -45
  40. package/dist/Select/index.mjs.map +1 -1
  41. package/dist/Slider/index.d.mts +162 -1325
  42. package/dist/Slider/index.d.mts.map +1 -1
  43. package/dist/Slider/index.mjs +41 -28
  44. package/dist/Slider/index.mjs.map +1 -1
  45. package/dist/Switch/index.d.mts +125 -944
  46. package/dist/Switch/index.d.mts.map +1 -1
  47. package/dist/Switch/index.mjs +18 -14
  48. package/dist/Switch/index.mjs.map +1 -1
  49. package/dist/SwitchBox/index.d.mts +140 -99
  50. package/dist/SwitchBox/index.d.mts.map +1 -1
  51. package/dist/SwitchBox/index.mjs +9 -6
  52. package/dist/SwitchBox/index.mjs.map +1 -1
  53. package/dist/TextArea/index.d.mts +63 -452
  54. package/dist/TextArea/index.d.mts.map +1 -1
  55. package/dist/TextArea/index.mjs +17 -13
  56. package/dist/TextArea/index.mjs.map +1 -1
  57. package/dist/Time/index.d.mts +82 -729
  58. package/dist/Time/index.d.mts.map +1 -1
  59. package/dist/Time/index.mjs +22 -18
  60. package/dist/Time/index.mjs.map +1 -1
  61. package/dist/hooks/useFormContext/index.d.mts +1 -1
  62. package/dist/hooks/useUniformField/index.d.mts +1 -1
  63. package/dist/hooks/useUniformField/index.mjs +5 -1
  64. package/dist/hooks/useUniformField/index.mjs.map +1 -1
  65. package/dist/hooks/useUniformFieldArray/index.d.mts +1 -1
  66. package/dist/{index-DaiTW5Bl.d.mts → index-DsB0_365.d.mts} +9 -2
  67. package/dist/index-DsB0_365.d.mts.map +1 -0
  68. package/dist/{useFormContext-BhPzFXwF.d.mts → useFormContext-BSSUZ0Md.d.mts} +2 -2
  69. package/dist/{useFormContext-BhPzFXwF.d.mts.map → useFormContext-BSSUZ0Md.d.mts.map} +1 -1
  70. package/package.json +5 -4
  71. package/dist/index-DaiTW5Bl.d.mts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/TextArea/TextArea.tsx"],"mappings":";;cAWa,oBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAaxB,eAAe,eAAe;KAC9B,YAAY,mBAAmB;UAEnB,sBAAsB;;EAErC;;EAEA,WAAW;;EAEX,YAAY;;EAEZ;;EAEA;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;;;;cAMI,aAAY,UAAA,WAAA,YAAA,eAAA,MAAA,gBAAA,qBAOf,kCAAa,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/TextArea/TextArea.tsx"],"mappings":";;cAWa,oBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqBxB,eAAe,eAAe;KAC9B,YAAY,mBAAmB;UAEnB,sBAAsB;;EAErC;;EAEA,WAAW;;EAEX,YAAY;;EAEZ;;EAEA;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;;;;cAMI,aAAY,UAAA,WAAA,YAAA,eAAA,MAAA,gBAAA,qBAOf,kCAAa,IAAA"}
@@ -1,24 +1,27 @@
1
- import { useUniformField } from "../hooks/useUniformField/index.mjs";
2
1
  import { useInputValueDebounce } from "../hooks/useInputValueDebounce/index.mjs";
2
+ import { useUniformField } from "../hooks/useUniformField/index.mjs";
3
3
  import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { Textarea } from "@heroui/input";
6
6
  // src/TextArea/TextArea.tsx
7
- const textAreaVariants = tv({ slots: {
8
- /** wrapper around the whole input */
9
- base: "",
10
- /** clear button */
11
- clearButton: "",
12
- /** actual input element */
13
- input: "",
14
- /** inner wrapper (HeroUI inputWrapper slot) */
15
- inputWrapper: "bg-content1 group-data-[focus=true]:border-focus"
16
- } });
7
+ const textAreaVariants = tv({
8
+ slots: {
9
+ /** wrapper around the whole input */
10
+ base: "",
11
+ /** clear button */
12
+ clearButton: "",
13
+ /** actual input element */
14
+ input: "",
15
+ /** inner wrapper (HeroUI inputWrapper slot) */
16
+ inputWrapper: "bg-content1 group-data-[focus=true]:border-focus"
17
+ },
18
+ variants: { readOnly: { true: { base: "**:cursor-not-allowed cursor-not-allowed opacity-disabled" } } }
19
+ });
17
20
  /**
18
21
  * TextArea component based on [HeroUI TextArea](https://www.heroui.com//docs/components/textarea)
19
22
  */
20
23
  const TextArea = ({ children = null, className: _className = void 0, debounceDelay = 300, name, placeholder = " ", ...uniformFieldProps }) => {
21
- const { ariaLabel, disabled, errorMessage, field: { onChange: fieldOnChange, onBlur: fieldOnBlur, value: fieldValue, ref }, invalid, label, required, testId } = useUniformField({
24
+ const { ariaLabel, disabled, errorMessage, field: { onChange: fieldOnChange, onBlur: fieldOnBlur, value: fieldValue, ref }, invalid, label, readOnly, required, testId } = useUniformField({
22
25
  name,
23
26
  ...uniformFieldProps
24
27
  });
@@ -29,7 +32,7 @@ const TextArea = ({ children = null, className: _className = void 0, debounceDel
29
32
  onChange: fieldOnChange,
30
33
  value: fieldValue
31
34
  });
32
- const variants = textAreaVariants();
35
+ const variants = textAreaVariants({ readOnly });
33
36
  const classNames = variantsToClassNames(variants, _className, "base");
34
37
  return /* @__PURE__ */ jsx(Textarea, {
35
38
  ref,
@@ -46,6 +49,7 @@ const TextArea = ({ children = null, className: _className = void 0, debounceDel
46
49
  id: testId,
47
50
  isDisabled: disabled,
48
51
  isInvalid: invalid,
52
+ isReadOnly: readOnly,
49
53
  isRequired: required,
50
54
  label,
51
55
  labelPlacement: "outside",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["HeroTextArea"],"sources":["../../src/TextArea/TextArea.tsx","../../src/TextArea/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { Textarea as HeroTextArea } from '@heroui/input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport { useUniformField } from '../hooks/useUniformField';\n\n// input variants\nexport const textAreaVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n});\n\ntype VariantProps = TVProps<typeof textAreaVariants>;\ntype ClassName = TVClassName<typeof textAreaVariants>;\n\nexport interface TextAreaProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [HeroUI TextArea](https://www.heroui.com//docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className: _className = undefined,\n debounceDelay = 300,\n name,\n placeholder = ' ',\n ...uniformFieldProps\n}: TextAreaProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // Use debounced handlers for form updates\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n name,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // classNames from slots\n const variants = textAreaVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n return (\n <HeroTextArea\n ref={ref}\n // Only add aria-label if there's no meaningful placeholder (HeroUI uses placeholder as aria-label)\n aria-label={\n !placeholder || placeholder.trim() === '' ? ariaLabel : undefined\n }\n classNames={{\n base: classNames.base,\n clearButton: classNames.clearButton,\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n placeholder={placeholder}\n value={value}\n variant=\"bordered\"\n >\n {children}\n </HeroTextArea>\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport default TextArea;\n"],"mappings":";;;;;;AAWA,MAAa,mBAAmB,GAAG,EACjC,OAAO;;CAEL,MAAM;;CAEN,aAAa;;CAEb,OAAO;;CAEP,cAAc;AAChB,EACF,CAAC;;;;AA6BD,MAAM,YAAY,EAChB,WAAW,MACX,WAAW,aAAa,KAAA,GACxB,gBAAgB,KAChB,MACA,cAAc,KACd,GAAG,wBACgB;CACnB,MAAM,EACJ,WACA,UACA,cACA,OAAO,EACL,UAAU,eACV,QAAQ,aACR,OAAO,YACP,OAEF,SACA,OACA,UACA,WACE,gBAAgB;EAAE;EAAM,GAAG;CAAkB,CAAC;CAGlD,MAAM,EAAE,UAAU,QAAQ,UAAU,sBAAsB;EACxD;EACA;EACA,QAAQ;EACR,UAAU;EACV,OAAO;CACT,CAAC;CAGD,MAAM,WAAW,iBAAiB;CAClC,MAAM,aAAa,qBAAqB,UAAU,YAAY,MAAM;CAEpE,OACE,oBAACA,UAAD;EACO;EAEL,cACE,CAAC,eAAe,YAAY,KAAK,MAAM,KAAK,YAAY,KAAA;EAE1D,YAAY;GACV,MAAM,WAAW;GACjB,aAAa,WAAW;GAExB,eAAe;GACf,OAAO,WAAW;GAClB,cAAc,WAAW;EAC3B;EACA,eAAa;EACC;EACd,IAAI;EACJ,YAAY;EACZ,WAAW;EACX,YAAY;EACL;EACP,gBAAe;EACT;EACE;EACE;EACG;EACN;EACP,SAAQ;EAEP;CACW,CAAA;AAElB;;ACrHA,IAAA,mBAAe"}
1
+ {"version":3,"file":"index.mjs","names":["HeroTextArea"],"sources":["../../src/TextArea/TextArea.tsx","../../src/TextArea/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { Textarea as HeroTextArea } from '@heroui/input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport { useUniformField } from '../hooks/useUniformField';\n\n// input variants\nexport const textAreaVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n variants: {\n readOnly: {\n true: {\n // Inner controls set their own cursors, so override every descendant.\n base: '**:cursor-not-allowed cursor-not-allowed opacity-disabled',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof textAreaVariants>;\ntype ClassName = TVClassName<typeof textAreaVariants>;\n\nexport interface TextAreaProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Prevents changes while keeping the text area focusable and its value in validation and submission */\n readOnly?: boolean;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [HeroUI TextArea](https://www.heroui.com//docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className: _className = undefined,\n debounceDelay = 300,\n name,\n placeholder = ' ',\n ...uniformFieldProps\n}: TextAreaProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n invalid,\n label,\n readOnly,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // Use debounced handlers for form updates\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n name,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // classNames from slots\n const variants = textAreaVariants({ readOnly });\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n return (\n <HeroTextArea\n ref={ref}\n // Only add aria-label if there's no meaningful placeholder (HeroUI uses placeholder as aria-label)\n aria-label={\n !placeholder || placeholder.trim() === '' ? ariaLabel : undefined\n }\n classNames={{\n base: classNames.base,\n clearButton: classNames.clearButton,\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isReadOnly={readOnly}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n placeholder={placeholder}\n value={value}\n variant=\"bordered\"\n >\n {children}\n </HeroTextArea>\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport default TextArea;\n"],"mappings":";;;;;;AAWA,MAAa,mBAAmB,GAAG;CACjC,OAAO;;EAEL,MAAM;;EAEN,aAAa;;EAEb,OAAO;;EAEP,cAAc;CAChB;CACA,UAAU,EACR,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF,EACF;AACF,CAAC;;;;AA+BD,MAAM,YAAY,EAChB,WAAW,MACX,WAAW,aAAa,KAAA,GACxB,gBAAgB,KAChB,MACA,cAAc,KACd,GAAG,wBACgB;CACnB,MAAM,EACJ,WACA,UACA,cACA,OAAO,EACL,UAAU,eACV,QAAQ,aACR,OAAO,YACP,OAEF,SACA,OACA,UACA,UACA,WACE,gBAAgB;EAAE;EAAM,GAAG;CAAkB,CAAC;CAGlD,MAAM,EAAE,UAAU,QAAQ,UAAU,sBAAsB;EACxD;EACA;EACA,QAAQ;EACR,UAAU;EACV,OAAO;CACT,CAAC;CAGD,MAAM,WAAW,iBAAiB,EAAE,SAAS,CAAC;CAC9C,MAAM,aAAa,qBAAqB,UAAU,YAAY,MAAM;CAEpE,OACE,oBAACA,UAAD;EACO;EAEL,cACE,CAAC,eAAe,YAAY,KAAK,MAAM,KAAK,YAAY,KAAA;EAE1D,YAAY;GACV,MAAM,WAAW;GACjB,aAAa,WAAW;GAExB,eAAe;GACf,OAAO,WAAW;GAClB,cAAc,WAAW;EAC3B;EACA,eAAa;EACC;EACd,IAAI;EACJ,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,YAAY;EACL;EACP,gBAAe;EACT;EACE;EACE;EACG;EACN;EACP,SAAQ;EAEP;CACW,CAAA;AAElB;;ACjIA,IAAA,mBAAe"}