@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
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;EAEnC;;EAEA,YAAY;;EAEZ;;EAEA,aAAa;;EAEb,QAAQ;;EAER;;EAEA;EAEA;;EAEA,eAAe;;EAEf;;EAEA,YAAYA;;;;;cAMR,WAAU,WAAA,YAAA,MAAA,MAAA,cAAA,cAAA,qBAQb,gCAAW,IAAA"}
@@ -5,27 +5,30 @@ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { VisuallyHidden } from "@react-aria/visually-hidden";
6
6
  import { Switch } from "@heroui/switch";
7
7
  // src/Switch/Switch.tsx
8
- const switchVariants = tv({ slots: {
9
- base: "",
10
- endContent: "",
11
- errorMessage: "ml-1 mt-1",
12
- label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]",
13
- outerWrapper: "place-content-center",
14
- startContent: "",
15
- thumb: "",
16
- thumbIcon: "",
17
- wrapper: ""
18
- } });
8
+ const switchVariants = tv({
9
+ slots: {
10
+ base: "",
11
+ endContent: "",
12
+ errorMessage: "ml-1 mt-1",
13
+ label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]",
14
+ outerWrapper: "place-content-center",
15
+ startContent: "",
16
+ thumb: "",
17
+ thumbIcon: "",
18
+ wrapper: ""
19
+ },
20
+ variants: { readOnly: { true: { base: "**:cursor-not-allowed cursor-not-allowed opacity-disabled" } } }
21
+ });
19
22
  /**
20
23
  * Switch component based on [HeroUI Switch](https://www.heroui.com//docs/components/switch)
21
24
  */
22
25
  const Switch$1 = ({ className = void 0, endContent = void 0, name, size = void 0, startContent = void 0, thumbIcon = void 0, ...uniformFieldProps }) => {
23
- const { ariaLabel, defaultValue, disabled, errorMessage, field, getErrorMessageProps, getHelperWrapperProps, invalid, label, onBlur, onChange, ref, required, testId } = useUniformField({
26
+ const { ariaLabel, defaultValue, disabled, errorMessage, field, getErrorMessageProps, getHelperWrapperProps, invalid, label, onBlur, onChange, readOnly, ref, required, testId } = useUniformField({
24
27
  name,
25
28
  ...uniformFieldProps
26
29
  });
27
30
  const visualSwitchRef = useRef(null);
28
- const variants = switchVariants();
31
+ const variants = switchVariants({ readOnly });
29
32
  const classNames = variantsToClassNames(variants, className, "outerWrapper");
30
33
  return /* @__PURE__ */ jsxs("div", {
31
34
  className: classNames.outerWrapper,
@@ -37,7 +40,7 @@ const Switch$1 = ({ className = void 0, endContent = void 0, name, size = void 0
37
40
  name,
38
41
  onBlur,
39
42
  onChange: (e) => {
40
- onChange(e.target.checked);
43
+ if (!readOnly) onChange(e.target.checked);
41
44
  },
42
45
  onFocus: () => {
43
46
  visualSwitchRef.current?.focus();
@@ -54,6 +57,7 @@ const Switch$1 = ({ className = void 0, endContent = void 0, name, size = void 0
54
57
  defaultSelected: !!defaultValue,
55
58
  endContent,
56
59
  isDisabled: disabled,
60
+ isReadOnly: readOnly,
57
61
  isSelected: !!field.value,
58
62
  name: `${name}_switch`,
59
63
  onValueChange: onChange,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["Switch","HeroSwitch","Switch"],"sources":["../../src/Switch/Switch.tsx","../../src/Switch/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { SwitchProps as HeroSwitchProps } from '@heroui/switch';\nimport type { ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { Switch as HeroSwitch } from '@heroui/switch';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const switchVariants = tv({\n slots: {\n base: '',\n endContent: '',\n errorMessage: 'ml-1 mt-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n outerWrapper: 'place-content-center',\n startContent: '',\n thumb: '',\n thumbIcon: '',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof switchVariants>;\ntype ClassName = TVClassName<typeof switchVariants>;\n\nexport interface SwitchProps 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 /** CSS class name */\n className?: ClassName;\n /** whether the select should be disabled */\n disabled?: boolean;\n /** Icon to be displayed at the end of the switch (when enabled) */\n endContent?: ReactNode;\n /** component displayed next to the switch */\n label?: ReactNode;\n /** name the field is registered under */\n name: string;\n /* Size of the switch */\n size?: 'sm' | 'md' | 'lg';\n /** Icon to be displayed at the start of the switch (when disabled) */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Icon to be displayed inside the thumb */\n thumbIcon?: HeroSwitchProps['thumbIcon'];\n}\n\n/**\n * Switch component based on [HeroUI Switch](https://www.heroui.com//docs/components/switch)\n */\nconst Switch = ({\n className = undefined,\n endContent = undefined,\n name,\n size = undefined,\n startContent = undefined,\n thumbIcon = undefined,\n ...uniformFieldProps\n}: SwitchProps) => {\n const {\n ariaLabel,\n defaultValue,\n disabled,\n errorMessage,\n field,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n label,\n onBlur,\n onChange,\n ref,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Ref for the visual switch to forward focus\n const visualSwitchRef = useRef<HTMLInputElement>(null);\n\n // classNames from slots\n const variants = switchVariants();\n const classNames = variantsToClassNames(variants, className, 'outerWrapper');\n\n return (\n <div className={classNames.outerWrapper}>\n {/* Visually hidden input for form accessibility and focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n checked={!!field.value}\n name={name}\n onBlur={onBlur}\n onChange={(e) => {\n onChange(e.target.checked);\n }}\n onFocus={() => {\n // When RHF focuses this hidden input (e.g., on validation error),\n // forward focus to the visual switch to show focus ring\n visualSwitchRef.current?.focus();\n }}\n type=\"checkbox\"\n />\n </VisuallyHidden>\n {/* Visual HeroSwitch component */}\n <HeroSwitch\n ref={visualSwitchRef}\n aria-label={ariaLabel}\n classNames={classNames}\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultSelected={!!defaultValue}\n endContent={endContent}\n isDisabled={disabled}\n isSelected={!!field.value}\n name={`${name}_switch`}\n onValueChange={onChange}\n size={size}\n startContent={startContent}\n thumbIcon={thumbIcon}\n >\n {label}\n </HeroSwitch>\n {invalid ? (\n <div\n {...getHelperWrapperProps()}\n className={cn(\n getHelperWrapperProps()?.className,\n // force helper to be visible (for some reason it's hidden by default) and remove margin\n 'ml-0 block',\n )}\n >\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Switch;\n","import Switch from './Switch';\n\nexport type { SwitchProps } from './Switch';\n\nexport { switchVariants } from './Switch';\n\nexport default Switch;\n"],"mappings":";;;;;;;AAaA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;CACL,MAAM;CACN,YAAY;CACZ,cAAc;CAGd,OACE;CACF,cAAc;CACd,cAAc;CACd,OAAO;CACP,WAAW;CACX,SAAS;AACX,EACF,CAAC;;;;AA+BD,MAAMA,YAAU,EACd,YAAY,KAAA,GACZ,aAAa,KAAA,GACb,MACA,OAAO,KAAA,GACP,eAAe,KAAA,GACf,YAAY,KAAA,GACZ,GAAG,wBACc;CACjB,MAAM,EACJ,WACA,cACA,UACA,cACA,OACA,sBACA,uBACA,SACA,OACA,QACA,UACA,KACA,UACA,WACE,gBAAgB;EAClB;EACA,GAAG;CACL,CAAC;CAGD,MAAM,kBAAkB,OAAyB,IAAI;CAGrD,MAAM,WAAW,eAAe;CAChC,MAAM,aAAa,qBAAqB,UAAU,WAAW,cAAc;CAE3E,OACE,qBAAC,OAAD;EAAK,WAAW,WAAW;EAA3B,UAAA;GAEE,oBAAC,gBAAD,EAAA,UACE,oBAAC,SAAD;IACO;IACL,cAAY;IACZ,SAAS,CAAC,CAAC,MAAM;IACX;IACE;IACR,WAAW,MAAM;KACf,SAAS,EAAE,OAAO,OAAO;IAC3B;IACA,eAAe;KAGb,gBAAgB,SAAS,MAAM;IACjC;IACA,MAAK;GACN,CAAA,EACa,CAAA;GAEhB,oBAACC,QAAD;IACE,KAAK;IACL,cAAY;IACA;IACZ,gBAAc;IACd,iBAAe;IACf,eAAa;IACb,iBAAiB,CAAC,CAAC;IACP;IACZ,YAAY;IACZ,YAAY,CAAC,CAAC,MAAM;IACpB,MAAM,GAAG,KAAK;IACd,eAAe;IACT;IACQ;IACH;IAEV,UAAA;GACS,CAAA;GACX,UACC,oBAAC,OAAD;IACE,GAAI,sBAAsB;IAC1B,WAAW,GACT,sBAAsB,CAAC,EAAE,WAEzB,YACF;IAEA,UAAA,oBAAC,OAAD;KAAK,GAAI,qBAAqB;KAAI,UAAA;IAAkB,CAAA;GACjD,CAAA,IACH;EACD;;AAET;;AChJA,IAAA,iBAAeC"}
1
+ {"version":3,"file":"index.mjs","names":["Switch","HeroSwitch","Switch"],"sources":["../../src/Switch/Switch.tsx","../../src/Switch/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { SwitchProps as HeroSwitchProps } from '@heroui/switch';\nimport type { ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { Switch as HeroSwitch } from '@heroui/switch';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const switchVariants = tv({\n slots: {\n base: '',\n endContent: '',\n errorMessage: 'ml-1 mt-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n outerWrapper: 'place-content-center',\n startContent: '',\n thumb: '',\n thumbIcon: '',\n wrapper: '',\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 switchVariants>;\ntype ClassName = TVClassName<typeof switchVariants>;\n\nexport interface SwitchProps 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 /** CSS class name */\n className?: ClassName;\n /** whether the select should be disabled */\n disabled?: boolean;\n /** Icon to be displayed at the end of the switch (when enabled) */\n endContent?: ReactNode;\n /** component displayed next to the switch */\n label?: ReactNode;\n /** name the field is registered under */\n name: string;\n /** Prevents changes while keeping the switch focusable and its value in validation and submission */\n readOnly?: boolean;\n /* Size of the switch */\n size?: 'sm' | 'md' | 'lg';\n /** Icon to be displayed at the start of the switch (when disabled) */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Icon to be displayed inside the thumb */\n thumbIcon?: HeroSwitchProps['thumbIcon'];\n}\n\n/**\n * Switch component based on [HeroUI Switch](https://www.heroui.com//docs/components/switch)\n */\nconst Switch = ({\n className = undefined,\n endContent = undefined,\n name,\n size = undefined,\n startContent = undefined,\n thumbIcon = undefined,\n ...uniformFieldProps\n}: SwitchProps) => {\n const {\n ariaLabel,\n defaultValue,\n disabled,\n errorMessage,\n field,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n label,\n onBlur,\n onChange,\n readOnly,\n ref,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Ref for the visual switch to forward focus\n const visualSwitchRef = useRef<HTMLInputElement>(null);\n\n // classNames from slots\n const variants = switchVariants({ readOnly });\n const classNames = variantsToClassNames(variants, className, 'outerWrapper');\n\n return (\n <div className={classNames.outerWrapper}>\n {/* Visually hidden input for form accessibility and focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n checked={!!field.value}\n name={name}\n onBlur={onBlur}\n onChange={(e) => {\n if (!readOnly) {\n onChange(e.target.checked);\n }\n }}\n onFocus={() => {\n // When RHF focuses this hidden input (e.g., on validation error),\n // forward focus to the visual switch to show focus ring\n visualSwitchRef.current?.focus();\n }}\n type=\"checkbox\"\n />\n </VisuallyHidden>\n {/* Visual HeroSwitch component */}\n <HeroSwitch\n ref={visualSwitchRef}\n aria-label={ariaLabel}\n classNames={classNames}\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n defaultSelected={!!defaultValue}\n endContent={endContent}\n isDisabled={disabled}\n isReadOnly={readOnly}\n isSelected={!!field.value}\n name={`${name}_switch`}\n onValueChange={onChange}\n size={size}\n startContent={startContent}\n thumbIcon={thumbIcon}\n >\n {label}\n </HeroSwitch>\n {invalid ? (\n <div\n {...getHelperWrapperProps()}\n className={cn(\n getHelperWrapperProps()?.className,\n // force helper to be visible (for some reason it's hidden by default) and remove margin\n 'ml-0 block',\n )}\n >\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Switch;\n","import Switch from './Switch';\n\nexport type { SwitchProps } from './Switch';\n\nexport { switchVariants } from './Switch';\n\nexport default Switch;\n"],"mappings":";;;;;;;AAaA,MAAa,iBAAiB,GAAG;CAC/B,OAAO;EACL,MAAM;EACN,YAAY;EACZ,cAAc;EAGd,OACE;EACF,cAAc;EACd,cAAc;EACd,OAAO;EACP,WAAW;EACX,SAAS;CACX;CACA,UAAU,EACR,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF,EACF;AACF,CAAC;;;;AAiCD,MAAMA,YAAU,EACd,YAAY,KAAA,GACZ,aAAa,KAAA,GACb,MACA,OAAO,KAAA,GACP,eAAe,KAAA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