@fuf-stack/uniform 1.29.0 → 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.
- package/README.md +6 -0
- package/dist/Checkboxes/index.d.mts +61 -14
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +8 -3
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +129 -1120
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +38 -32
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldReset/index.d.mts +1 -1
- package/dist/Form/index.d.mts +12 -12
- package/dist/{FormContext-BnNJYZOo.d.mts → FormContext-Dvt3MiKq.d.mts} +3 -3
- package/dist/{FormContext-BnNJYZOo.d.mts.map → FormContext-Dvt3MiKq.d.mts.map} +1 -1
- package/dist/Input/index.d.mts +63 -452
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +19 -14
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +157 -888
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +27 -20
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +93 -43
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +8 -5
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +128 -1033
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +22 -18
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +447 -3035
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +79 -45
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +174 -1337
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +41 -28
- package/dist/Slider/index.mjs.map +1 -1
- package/dist/Switch/index.d.mts +125 -944
- package/dist/Switch/index.d.mts.map +1 -1
- package/dist/Switch/index.mjs +18 -14
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/SwitchBox/index.d.mts +140 -99
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +9 -6
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +63 -452
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +16 -12
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +82 -729
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +22 -18
- package/dist/Time/index.mjs.map +1 -1
- package/dist/hooks/useFormContext/index.d.mts +1 -1
- package/dist/hooks/useUniformField/index.d.mts +1 -1
- package/dist/hooks/useUniformField/index.mjs +5 -1
- package/dist/hooks/useUniformField/index.mjs.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.mts +1 -1
- package/dist/{index-DaiTW5Bl.d.mts → index-DsB0_365.d.mts} +9 -2
- package/dist/index-DsB0_365.d.mts.map +1 -0
- package/dist/{useFormContext-BhPzFXwF.d.mts → useFormContext-BSSUZ0Md.d.mts} +2 -2
- package/dist/{useFormContext-BhPzFXwF.d.mts.map → useFormContext-BSSUZ0Md.d.mts.map} +1 -1
- package/package.json +2 -2
- 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
|
|
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"}
|
package/dist/TextArea/index.mjs
CHANGED
|
@@ -4,21 +4,24 @@ 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({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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,
|
|
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"}
|