@fuf-stack/uniform 1.10.2 → 1.10.4
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/dist/FieldCard/index.cjs +2 -2
- package/dist/FieldCard/index.d.cts +3 -1
- package/dist/FieldCard/index.d.ts +3 -1
- package/dist/FieldCard/index.js +1 -1
- package/dist/Input/index.cjs +2 -2
- package/dist/Input/index.js +1 -1
- package/dist/{chunk-ZIMWVUMQ.js → chunk-4RQJCFM7.js} +7 -2
- package/dist/chunk-4RQJCFM7.js.map +1 -0
- package/dist/{chunk-EVASKP6Q.js → chunk-FBCGU6V6.js} +3 -1
- package/dist/chunk-FBCGU6V6.js.map +1 -0
- package/dist/{chunk-ECUVOZGQ.cjs → chunk-LL5MUKJF.cjs} +3 -1
- package/dist/chunk-LL5MUKJF.cjs.map +1 -0
- package/dist/{chunk-NXBYGCPL.cjs → chunk-OT3A4LEE.cjs} +7 -2
- package/dist/chunk-OT3A4LEE.cjs.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-ECUVOZGQ.cjs.map +0 -1
- package/dist/chunk-EVASKP6Q.js.map +0 -1
- package/dist/chunk-NXBYGCPL.cjs.map +0 -1
- package/dist/chunk-ZIMWVUMQ.js.map +0 -1
package/dist/FieldCard/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkOT3A4LEEcjs = require('../chunk-OT3A4LEE.cjs');
|
|
5
5
|
require('../chunk-V3M7HL26.cjs');
|
|
6
6
|
require('../chunk-OE5BOGGX.cjs');
|
|
7
7
|
require('../chunk-NHEZXA4H.cjs');
|
|
@@ -15,5 +15,5 @@ require('../chunk-555JRYCS.cjs');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.FieldCard =
|
|
18
|
+
exports.FieldCard = _chunkOT3A4LEEcjs.FieldCard_default; exports.fieldCardVariants = _chunkOT3A4LEEcjs.fieldCardVariants;
|
|
19
19
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import { TVClassName } from '@fuf-stack/pixel-utils';
|
|
3
4
|
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
declare const fieldCardVariants: tailwind_variants.TVReturnType<{
|
|
@@ -69,11 +70,12 @@ declare const fieldCardVariants: tailwind_variants.TVReturnType<{
|
|
|
69
70
|
/** class for the error footer wrapper */
|
|
70
71
|
errorFooter: string[];
|
|
71
72
|
}, undefined, unknown, unknown, undefined>>;
|
|
73
|
+
type ClassName = TVClassName<typeof fieldCardVariants>;
|
|
72
74
|
interface FieldCardProps {
|
|
73
75
|
/** Content to render inside the card */
|
|
74
76
|
children: ReactNode;
|
|
75
77
|
/** CSS class name */
|
|
76
|
-
className?:
|
|
78
|
+
className?: ClassName;
|
|
77
79
|
/** Label content for the card header */
|
|
78
80
|
label: ReactNode;
|
|
79
81
|
/** Field name for validation */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import { TVClassName } from '@fuf-stack/pixel-utils';
|
|
3
4
|
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
declare const fieldCardVariants: tailwind_variants.TVReturnType<{
|
|
@@ -69,11 +70,12 @@ declare const fieldCardVariants: tailwind_variants.TVReturnType<{
|
|
|
69
70
|
/** class for the error footer wrapper */
|
|
70
71
|
errorFooter: string[];
|
|
71
72
|
}, undefined, unknown, unknown, undefined>>;
|
|
73
|
+
type ClassName = TVClassName<typeof fieldCardVariants>;
|
|
72
74
|
interface FieldCardProps {
|
|
73
75
|
/** Content to render inside the card */
|
|
74
76
|
children: ReactNode;
|
|
75
77
|
/** CSS class name */
|
|
76
|
-
className?:
|
|
78
|
+
className?: ClassName;
|
|
77
79
|
/** Label content for the card header */
|
|
78
80
|
label: ReactNode;
|
|
79
81
|
/** Field name for validation */
|
package/dist/FieldCard/index.js
CHANGED
package/dist/Input/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkLL5MUKJFcjs = require('../chunk-LL5MUKJF.cjs');
|
|
5
5
|
require('../chunk-3ZQXSGR2.cjs');
|
|
6
6
|
require('../chunk-V3M7HL26.cjs');
|
|
7
7
|
require('../chunk-OE5BOGGX.cjs');
|
|
@@ -16,5 +16,5 @@ require('../chunk-555JRYCS.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
exports.Input =
|
|
19
|
+
exports.Input = _chunkLL5MUKJFcjs.Input_default; exports.default = _chunkLL5MUKJFcjs.Input_default2;
|
|
20
20
|
//# sourceMappingURL=index.cjs.map
|
package/dist/Input/index.js
CHANGED
|
@@ -83,7 +83,12 @@ var fieldCardVariants = tv({
|
|
|
83
83
|
"rounded-t-small border-b p-3 font-semibold text-medium"
|
|
84
84
|
],
|
|
85
85
|
/** class for the content */
|
|
86
|
-
content: [
|
|
86
|
+
content: [
|
|
87
|
+
// same as p-3 of Card component
|
|
88
|
+
"p-3",
|
|
89
|
+
// default grid for form components (see Grid component)
|
|
90
|
+
"grid gap-4"
|
|
91
|
+
],
|
|
87
92
|
/** class for the error footer wrapper */
|
|
88
93
|
errorFooter: [
|
|
89
94
|
"border-t",
|
|
@@ -146,4 +151,4 @@ export {
|
|
|
146
151
|
fieldCardVariants,
|
|
147
152
|
FieldCard_default
|
|
148
153
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-4RQJCFM7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/FieldCard/FieldCard.tsx","../src/FieldCard/subcomponents/FieldCardValidationError.tsx"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport FieldCardValidationError from './subcomponents/FieldCardValidationError';\n\nexport const fieldCardVariants = tv({\n slots: {\n /** base class for the field card wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border bg-content1',\n ],\n /** class for the label/header */\n label: [\n // override HeroUI label positioning and display\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) for proper header size\n 'rounded-t-small border-b p-3 font-semibold text-medium',\n ],\n /** class for the content */\n content: [\n // same as p-3 of Card component\n 'p-3',\n // default grid for form components (see Grid component)\n 'grid gap-4',\n ],\n /** class for the error footer wrapper */\n errorFooter: [\n 'border-t',\n // force helper to be visible and add padding\n 'block px-3 py-2',\n ],\n },\n variants: {\n invalid: {\n true: {\n base: 'border-danger',\n label: 'border-danger text-danger',\n errorFooter: 'border-danger',\n },\n false: {\n base: 'border-divider',\n label: 'border-divider text-foreground',\n errorFooter: 'border-divider',\n },\n },\n },\n defaultVariants: {\n invalid: false,\n },\n});\n\ntype ClassName = TVClassName<typeof fieldCardVariants>;\n\nexport interface FieldCardProps {\n /** Content to render inside the card */\n children: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Label content for the card header */\n label: ReactNode;\n /** Field name for validation */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * FieldCard component - A card-styled container with label header and error footer\n *\n * Displays form field content in a card layout with:\n * - Label/title in the header\n * - Content in the body\n * - Validation errors in the footer\n * - Danger outline when validation errors exist\n */\nconst FieldCard = ({\n children,\n className: _className = undefined,\n name,\n ...uniformFieldProps\n}: FieldCardProps) => {\n const { error, getLabelProps, invalid, label } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n // className from slots\n const variants = fieldCardVariants({ invalid: hasErrors });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* card header with label */}\n {label ? (\n <div\n {...getLabelProps()}\n aria-level={3}\n className={cn(getLabelProps()?.className, className.label)}\n role=\"heading\"\n >\n {label}\n </div>\n ) : null}\n\n {/* card content */}\n <div className={className.content}>{children}</div>\n\n {/* card footer with validation errors */}\n <FieldCardValidationError className={className.errorFooter} name={name} />\n </div>\n );\n};\n\nexport default FieldCard;\n","import {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\n\nexport interface FieldCardValidationErrorProps {\n /** CSS class name for the error footer wrapper */\n className?: string;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders validation errors in the footer of a FieldCard component.\n *\n * This component handles displaying field-level validation errors with proper\n * accessibility attributes and animates them in/out using Framer Motion.\n */\nconst FieldCardValidationError = ({\n className = undefined,\n name,\n}: FieldCardValidationErrorProps) => {\n const {\n error,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n testId,\n } = useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-card-errors\"\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(getHelperWrapperProps()?.className, className)}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n error={error._errors}\n testId={testId}\n />\n </div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldCardValidationError;\n"],"mappings":";;;;;;;;;;;;;AAGA,SAAS,MAAAA,KAAI,IAAI,4BAA4B;;;ACH7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU;AAwDL;AAtCd,IAAM,2BAA2B,CAAC;AAAA,EAChC,YAAY;AAAA,EACZ;AACF,MAAqC;AA1BrC;AA2BE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,gBAAgB;AAAA,IAClB;AAAA,EACF,CAAC;AAGD,QAAM,mBAAmB,iBAAiB;AAG1C,QAAM,YAAY,YAAW,+BAAO;AAEpC,SACE,oBAAC,mBAAgB,SAAS,CAAC,kBACxB,sBACC;AAAA,IAAC,OAAO;AAAA,IAAP;AAAA,MAEC,MAAM,mBAAmB,SAAY,EAAE,SAAS,GAAG,QAAQ,EAAE;AAAA,MAC7D,SAAS,mBAAmB,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAAA,MAC5D,OAAO,EAAE,UAAU,SAAS;AAAA,MAC5B,YAAY,EAAE,UAAU,KAAK,MAAM,UAAU;AAAA,MAC7C,SACE,mBAAmB,SAAY,EAAE,SAAS,GAAG,QAAQ,OAAO;AAAA,MAG9D;AAAA,QAAC;AAAA,yCACK,sBAAsB,IAD3B;AAAA,UAEC,WAAW,IAAG,2BAAsB,MAAtB,mBAAyB,WAAW,SAAS;AAAA,UAE3D,8BAAC,wCAAQ,qBAAqB,IAA7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EvB;AAAA,YACC,gBAAAD;AAAA,MAAC;AAAA,uCACK,cAAc,IADnB;AAAA,QAEC,cAAY;AAAA,QACZ,WAAWE,KAAGD,MAAA,cAAc,MAAd,gBAAAA,IAAiB,WAAW,UAAU,KAAK;AAAA,QACzD,MAAK;AAAA,QAEJ;AAAA;AAAA,IACH,IACE;AAAA,IAGJ,gBAAAD,KAAC,SAAI,WAAW,UAAU,SAAU,UAAS;AAAA,IAG7C,gBAAAA,KAAC,oCAAyB,WAAW,UAAU,aAAa,MAAY;AAAA,KAC1E;AAEJ;AAEA,IAAO,oBAAQ;","names":["cn","jsx","_a","cn"]}
|
|
@@ -88,6 +88,8 @@ var Input = (_a) => {
|
|
|
88
88
|
ref,
|
|
89
89
|
// Only add aria-label if there's no meaningful placeholder (HeroUI uses placeholder as aria-label)
|
|
90
90
|
"aria-label": !placeholder || placeholder.trim() === "" ? ariaLabel : void 0,
|
|
91
|
+
// disable autocomplete
|
|
92
|
+
autoComplete: "off",
|
|
91
93
|
classNames: {
|
|
92
94
|
base: classNames.base,
|
|
93
95
|
clearButton: classNames.clearButton,
|
|
@@ -145,4 +147,4 @@ export {
|
|
|
145
147
|
Input_default,
|
|
146
148
|
Input_default2
|
|
147
149
|
};
|
|
148
|
-
//# sourceMappingURL=chunk-
|
|
150
|
+
//# sourceMappingURL=chunk-FBCGU6V6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Input/Input.tsx","../src/Input/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { InputProps as HeroInputProps } from '@heroui/input';\nimport type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport { Input as HeroInput } from '@heroui/input';\nimport { NumberInput as HeroNumberInput } from '@heroui/number-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 inputVariants = 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 inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface InputProps 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 /** shows clear button when input has value */\n clearable?: boolean;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** callback that is fired when the value is cleared */\n onClear?: () => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string>;\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className: _className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n name,\n onClear = undefined,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n type = undefined,\n ...uniformFieldProps\n}: InputProps) => {\n const {\n ariaLabel,\n disabled,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n errorMessage,\n invalid,\n label,\n required,\n testId,\n resetField,\n } = useUniformField({ name, type, ...uniformFieldProps });\n\n // Use hook that provides debounced onChange and enhanced blur handling\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // If input is clearable add props for clearing input value\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable\n ? {\n isClearable: true,\n onClear: () => {\n // if field had initial value we do not reset it\n // to that value, but clear it instead\n resetField(name, { defaultValue: null });\n // if onClear cb provided we call it\n if (onClear) {\n onClear();\n }\n },\n }\n : {};\n\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n // Common props for both Input and NumberInput\n const commonProps = {\n 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 // disable autocomplete\n autoComplete: 'off',\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 endContent,\n errorMessage,\n id: testId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside' as const,\n name,\n onBlur,\n placeholder,\n radius: 'sm' as const,\n size,\n startContent,\n variant: 'bordered' as const,\n ...clearableProps,\n };\n\n // Render NumberInput for number type\n if (type === 'number') {\n // Parse the string value to number - use null for empty/cleared state to keep component controlled\n const numberValue =\n value !== '' && value != null && !Number.isNaN(Number(value))\n ? Number(value)\n : null;\n\n return (\n <HeroNumberInput\n {...commonProps}\n // @ts-expect-error - HeroUI NumberInput type is not compatible with null,\n // but it needs to be for empty/cleared state to be controlled\n value={numberValue}\n // Disable thousands separator to avoid parsing issues\n formatOptions={{\n useGrouping: false,\n }}\n // NumberInput onChange receives either an event or a number\n onChange={(e: React.ChangeEvent<HTMLInputElement> | number) => {\n if (typeof e === 'number') {\n // Convert number to synthetic event and pass through debounced onChange\n onChange({\n target: { value: String(e) },\n } as React.ChangeEvent<HTMLInputElement>);\n } else {\n // Pass event through debounced onChange\n onChange(e);\n }\n }}\n />\n );\n }\n\n // Render regular Input for text/password\n return (\n <HeroInput {...commonProps} onChange={onChange} type={type} value={value} />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAS,SAAS,iBAAiB;AACnC,SAAS,eAAe,uBAAuB;AAE/C,SAAS,IAAI,4BAA4B;AAiKnC;AA3JC,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA;AAAA,IAEL,MAAM;AAAA;AAAA,IAEN,aAAa;AAAA;AAAA,IAEb,OAAO;AAAA;AAAA,IAEP,cAAc;AAAA,EAChB;AACF,CAAC;AAyCD,IAAM,QAAQ,CAAC,OAYG;AAZH,eACb;AAAA,eAAW,aAAa;AAAA,IACxB,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,IACd,OAAO;AAAA,IACP,eAAe;AAAA,IACf,OAAO;AAAA,EA5ET,IAkEe,IAWV,8BAXU,IAWV;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,OAAO;AAAA,MACP;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,gBAAgB,iBAAE,MAAM,QAAS,kBAAmB;AAGxD,QAAM,EAAE,UAAU,QAAQ,MAAM,IAAI,sBAAsB;AAAA,IACxD;AAAA,IACA,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,EACT,CAAC;AAGD,QAAM,iBACJ,YACI;AAAA,IACE,aAAa;AAAA,IACb,S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Ac;AAE9E;AAEA,IAAO,gBAAQ;;;AClMf,IAAOA,iBAAQ;","names":["Input_default"]}
|
|
@@ -88,6 +88,8 @@ var Input = (_a) => {
|
|
|
88
88
|
ref,
|
|
89
89
|
// Only add aria-label if there's no meaningful placeholder (HeroUI uses placeholder as aria-label)
|
|
90
90
|
"aria-label": !placeholder || placeholder.trim() === "" ? ariaLabel : void 0,
|
|
91
|
+
// disable autocomplete
|
|
92
|
+
autoComplete: "off",
|
|
91
93
|
classNames: {
|
|
92
94
|
base: classNames.base,
|
|
93
95
|
clearButton: classNames.clearButton,
|
|
@@ -145,4 +147,4 @@ var Input_default2 = Input_default;
|
|
|
145
147
|
|
|
146
148
|
|
|
147
149
|
exports.Input_default = Input_default; exports.Input_default2 = Input_default2;
|
|
148
|
-
//# sourceMappingURL=chunk-
|
|
150
|
+
//# sourceMappingURL=chunk-LL5MUKJF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-LL5MUKJF.cjs","../src/Input/Input.tsx","../src/Input/index.ts"],"names":["Input_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACPA,sCAAmC;AACnC,mDAA+C;AAE/C,oDAAyC;AAiKnC,+CAAA;AA3JC,IAAM,cAAA,EAAgB,4BAAA;AAAG,EAC9B,KAAA,EAAO;AAAA;AAAA,IAEL,IAAA,EAAM,EAAA;AAAA;AAAA,IAEN,WAAA,EAAa,EAAA;AAAA;AAAA,IAEb,KAAA,EAAO,EAAA;AAAA;AAAA,IAEP,YAAA,EAAc;AAAA,EAChB;AACF,CAAC,CAAA;AAyCD,IAAM,MAAA,EAAQ,CAAC,EAAA,EAAA,GAYG;AAZH,EAAA,IAAA,GAAA,EAAA,EAAA,EACb;AAAA,IAAA,SAAA,EAAW,WAAA,EAAa,KAAA,CAAA;AAA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AA,EACJ,MAAA,IAAU,GAAA,GAAM,MAAA,GAAS,KAAA,GAAQ,CAAC,MAAA,CAAO,KAAA,CAAM,MAAA,CAAO,KAAK,CAAC,EAAA,EACxD,MAAA,CAAO,KAAK,EAAA,EACZ,IAAA;AAEN,IAAA,uBACE,6BAAA;AAAA,MAAC,wBAAA;AAAA,MAAA,6CAAA,8CAAA,CAAA,CAAA,EACK,WAAA,CAAA,EADL;AAAA,QAIC,KAAA,EAAO,WAAA;AAAA,QAEP,aAAA,EAAe;AAAA,UACb,WAAA,EAAa;AAAA,QACf,CAAA;AAAA,QAEA,QAAA,EAAU,CAAC,CAAA,EAAA,GAAoD;AAC7D,UAAA,GAAA,CAAI,OAAO,EAAA,IAAM,QAAA,EAAU;AAEzB,YAAA,QAAA,CAAS;AAAA,cACP,MAAA,EAAQ,EAAE,KAAA,EAAO,MAAA,CAAO,CAAC,EAAE;AAAA,YAC7B,CAAwC,CAAA;AAAA,UAC1C,EAAA,KAAO;AAEL,YAAA,QAAA,CAAS,CAAC,CAAA;AAAA,UACZ;AAAA,QACF;AAAA,MAAA,CAAA;AAAA,IACF,CAAA;AAAA,EAEJ;AAGA,EAAA,uBACE,6BAAA,YAAC,EAAA,6CAAA,8CAAA,CAAA,CAAA,EAAc,WAAA,CAAA,EAAd,EAA2B,QAAA,EAAoB,IAAA,EAAY,MAAA,CAAA,CAAc,CAAA;AAE9E,CAAA;AAEA,IAAO,cAAA,EAAQ,KAAA;AD3Df;AACA;AExIA,IAAOA,eAAAA,EAAQ,aAAA;AF0If;AACA;AACE;AACA;AACF,+EAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-LL5MUKJF.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { InputProps as HeroInputProps } from '@heroui/input';\nimport type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport { Input as HeroInput } from '@heroui/input';\nimport { NumberInput as HeroNumberInput } from '@heroui/number-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 inputVariants = 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 inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface InputProps 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 /** shows clear button when input has value */\n clearable?: boolean;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** callback that is fired when the value is cleared */\n onClear?: () => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string>;\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className: _className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n name,\n onClear = undefined,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n type = undefined,\n ...uniformFieldProps\n}: InputProps) => {\n const {\n ariaLabel,\n disabled,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n errorMessage,\n invalid,\n label,\n required,\n testId,\n resetField,\n } = useUniformField({ name, type, ...uniformFieldProps });\n\n // Use hook that provides debounced onChange and enhanced blur handling\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // If input is clearable add props for clearing input value\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable\n ? {\n isClearable: true,\n onClear: () => {\n // if field had initial value we do not reset it\n // to that value, but clear it instead\n resetField(name, { defaultValue: null });\n // if onClear cb provided we call it\n if (onClear) {\n onClear();\n }\n },\n }\n : {};\n\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n // Common props for both Input and NumberInput\n const commonProps = {\n 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 // disable autocomplete\n autoComplete: 'off',\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 endContent,\n errorMessage,\n id: testId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside' as const,\n name,\n onBlur,\n placeholder,\n radius: 'sm' as const,\n size,\n startContent,\n variant: 'bordered' as const,\n ...clearableProps,\n };\n\n // Render NumberInput for number type\n if (type === 'number') {\n // Parse the string value to number - use null for empty/cleared state to keep component controlled\n const numberValue =\n value !== '' && value != null && !Number.isNaN(Number(value))\n ? Number(value)\n : null;\n\n return (\n <HeroNumberInput\n {...commonProps}\n // @ts-expect-error - HeroUI NumberInput type is not compatible with null,\n // but it needs to be for empty/cleared state to be controlled\n value={numberValue}\n // Disable thousands separator to avoid parsing issues\n formatOptions={{\n useGrouping: false,\n }}\n // NumberInput onChange receives either an event or a number\n onChange={(e: React.ChangeEvent<HTMLInputElement> | number) => {\n if (typeof e === 'number') {\n // Convert number to synthetic event and pass through debounced onChange\n onChange({\n target: { value: String(e) },\n } as React.ChangeEvent<HTMLInputElement>);\n } else {\n // Pass event through debounced onChange\n onChange(e);\n }\n }}\n />\n );\n }\n\n // Render regular Input for text/password\n return (\n <HeroInput {...commonProps} onChange={onChange} type={type} value={value} />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"]}
|
|
@@ -83,7 +83,12 @@ var fieldCardVariants = _pixelutils.tv.call(void 0, {
|
|
|
83
83
|
"rounded-t-small border-b p-3 font-semibold text-medium"
|
|
84
84
|
],
|
|
85
85
|
/** class for the content */
|
|
86
|
-
content: [
|
|
86
|
+
content: [
|
|
87
|
+
// same as p-3 of Card component
|
|
88
|
+
"p-3",
|
|
89
|
+
// default grid for form components (see Grid component)
|
|
90
|
+
"grid gap-4"
|
|
91
|
+
],
|
|
87
92
|
/** class for the error footer wrapper */
|
|
88
93
|
errorFooter: [
|
|
89
94
|
"border-t",
|
|
@@ -146,4 +151,4 @@ var FieldCard_default = FieldCard;
|
|
|
146
151
|
|
|
147
152
|
|
|
148
153
|
exports.fieldCardVariants = fieldCardVariants; exports.FieldCard_default = FieldCard_default;
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-OT3A4LEE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-OT3A4LEE.cjs","../src/FieldCard/FieldCard.tsx","../src/FieldCard/subcomponents/FieldCardValidationError.tsx"],"names":["_a","jsx","cn"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACTA,oDAA6C;ADW7C;AACA;AEfA;AACE;AACA;AACA;AAAA,sDACK;AACP;AAwDc,+CAAA;AAtCd,IAAM,yBAAA,EAA2B,C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AiB,SAAA,EAAW,SAAA,CAAU,KAAK,CAAA;AAAA,QACzD,IAAA,EAAK,SAAA;AAAA,QAEJ,QAAA,EAAA;AAAA,MAAA,CAAA;AAAA,IACH,EAAA,EACE,IAAA;AAAA,oBAGJC,6BAAAA,KAAC,EAAA,EAAI,SAAA,EAAW,SAAA,CAAU,OAAA,EAAU,SAAA,CAAS,CAAA;AAAA,oBAG7CA,6BAAAA,gCAAC,EAAA,EAAyB,SAAA,EAAW,SAAA,CAAU,WAAA,EAAa,KAAA,CAAY;AAAA,EAAA,EAAA,CAC1E,CAAA;AAEJ,CAAA;AAEA,IAAO,kBAAA,EAAQ,SAAA;AD0Bf;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-OT3A4LEE.cjs","sourcesContent":[null,"import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport FieldCardValidationError from './subcomponents/FieldCardValidationError';\n\nexport const fieldCardVariants = tv({\n slots: {\n /** base class for the field card wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border bg-content1',\n ],\n /** class for the label/header */\n label: [\n // override HeroUI label positioning and display\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) for proper header size\n 'rounded-t-small border-b p-3 font-semibold text-medium',\n ],\n /** class for the content */\n content: [\n // same as p-3 of Card component\n 'p-3',\n // default grid for form components (see Grid component)\n 'grid gap-4',\n ],\n /** class for the error footer wrapper */\n errorFooter: [\n 'border-t',\n // force helper to be visible and add padding\n 'block px-3 py-2',\n ],\n },\n variants: {\n invalid: {\n true: {\n base: 'border-danger',\n label: 'border-danger text-danger',\n errorFooter: 'border-danger',\n },\n false: {\n base: 'border-divider',\n label: 'border-divider text-foreground',\n errorFooter: 'border-divider',\n },\n },\n },\n defaultVariants: {\n invalid: false,\n },\n});\n\ntype ClassName = TVClassName<typeof fieldCardVariants>;\n\nexport interface FieldCardProps {\n /** Content to render inside the card */\n children: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Label content for the card header */\n label: ReactNode;\n /** Field name for validation */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * FieldCard component - A card-styled container with label header and error footer\n *\n * Displays form field content in a card layout with:\n * - Label/title in the header\n * - Content in the body\n * - Validation errors in the footer\n * - Danger outline when validation errors exist\n */\nconst FieldCard = ({\n children,\n className: _className = undefined,\n name,\n ...uniformFieldProps\n}: FieldCardProps) => {\n const { error, getLabelProps, invalid, label } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n // className from slots\n const variants = fieldCardVariants({ invalid: hasErrors });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* card header with label */}\n {label ? (\n <div\n {...getLabelProps()}\n aria-level={3}\n className={cn(getLabelProps()?.className, className.label)}\n role=\"heading\"\n >\n {label}\n </div>\n ) : null}\n\n {/* card content */}\n <div className={className.content}>{children}</div>\n\n {/* card footer with validation errors */}\n <FieldCardValidationError className={className.errorFooter} name={name} />\n </div>\n );\n};\n\nexport default FieldCard;\n","import {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\n\nexport interface FieldCardValidationErrorProps {\n /** CSS class name for the error footer wrapper */\n className?: string;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders validation errors in the footer of a FieldCard component.\n *\n * This component handles displaying field-level validation errors with proper\n * accessibility attributes and animates them in/out using Framer Motion.\n */\nconst FieldCardValidationError = ({\n className = undefined,\n name,\n}: FieldCardValidationErrorProps) => {\n const {\n error,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n testId,\n } = useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-card-errors\"\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(getHelperWrapperProps()?.className, className)}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n error={error._errors}\n testId={testId}\n />\n </div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldCardValidationError;\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -42,14 +42,14 @@ var _chunk7ZE7IZ5Rcjs = require('./chunk-7ZE7IZ5R.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var _chunkOT3A4LEEcjs = require('./chunk-OT3A4LEE.cjs');
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
var _chunkLWPZZ2AWcjs = require('./chunk-LWPZZ2AW.cjs');
|
|
49
49
|
require('./chunk-3JAVQAL5.cjs');
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
var
|
|
52
|
+
var _chunkLL5MUKJFcjs = require('./chunk-LL5MUKJF.cjs');
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
var _chunk3ZQXSGR2cjs = require('./chunk-3ZQXSGR2.cjs');
|
|
@@ -130,5 +130,5 @@ require('./chunk-555JRYCS.cjs');
|
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
|
|
133
|
-
exports.Checkboxes = _chunkYYR23V5Pcjs.Checkboxes_default; exports.FieldArray = _chunkZ6QACVK7cjs.FieldArray_default; exports.FieldCard =
|
|
133
|
+
exports.Checkboxes = _chunkYYR23V5Pcjs.Checkboxes_default; exports.FieldArray = _chunkZ6QACVK7cjs.FieldArray_default; exports.FieldCard = _chunkOT3A4LEEcjs.FieldCard_default; exports.FieldCopyTestIdButton = _chunkOE5BOGGXcjs.FieldCopyTestIdButton_default; exports.FieldValidationError = _chunkNHEZXA4Hcjs.FieldValidationError_default; exports.Form = _chunkLWPZZ2AWcjs.Form_default; exports.Grid = _chunkTTD3KL6Ecjs.Grid_default; exports.Input = _chunkLL5MUKJFcjs.Input_default; exports.RadioBoxes = _chunkTHDHNYP7cjs.RadioBoxes_default; exports.RadioTabs = _chunk6GN62PBGcjs.RadioTabs_default; exports.Radios = _chunk55VJM3KDcjs.Radios_default; exports.Select = _chunkWYM6IAIJcjs.Select_default; exports.Slider = _chunk4HFPBJ3Ocjs.Slider_default; exports.SubmitButton = _chunkWXSISX5Ycjs.SubmitButton_default; exports.Switch = _chunkRVBTLB5Gcjs.Switch_default; exports.SwitchBox = _chunkSW3NGBCEcjs.SwitchBox_default; exports.TextArea = _chunkKDNO5YO5cjs.TextArea_default; exports.checkFieldIsRequired = _chunkFYN7ZWLWcjs.checkFieldIsRequired; exports.clientValidationSchemaByName = _chunk2UQCRQEJcjs.clientValidationSchemaByName; exports.fieldCardVariants = _chunkOT3A4LEEcjs.fieldCardVariants; exports.flatArrayKey = _chunkOKJWLH7Tcjs.flatArrayKey; exports.fromNullishString = _chunkOKJWLH7Tcjs.fromNullishString; exports.nameToTestId = _chunkOKJWLH7Tcjs.nameToTestId; exports.radioBoxVariants = _chunkTHDHNYP7cjs.radioBoxVariants; exports.switchBoxVariants = _chunkSW3NGBCEcjs.switchBoxVariants; exports.toFormFormat = _chunkOKJWLH7Tcjs.toFormFormat; exports.toNullishString = _chunkOKJWLH7Tcjs.toNullishString; exports.toValidationFormat = _chunkOKJWLH7Tcjs.toValidationFormat; exports.useClientValidation = _chunk2UQCRQEJcjs.useClientValidation; exports.useController = _chunk6AWHOBNLcjs.useController; exports.useFormContext = _chunkFYN7ZWLWcjs.useFormContext; exports.useInput = _chunkPCTYJUY7cjs.useInput; exports.useInputValueDebounce = _chunk3ZQXSGR2cjs.useInputValueDebounce; exports.useInputValueTransform = _chunk56TQOKG7cjs.useInputValueTransform; exports.useUniformField = _chunkV3M7HL26cjs.useUniformField; exports.useUniformFieldArray = _chunk7ZE7IZ5Rcjs.useUniformFieldArray; exports.useWatchUserChange = _chunkHEPNEBRFcjs.useWatchUserChange;
|
|
134
134
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -42,14 +42,14 @@ import {
|
|
|
42
42
|
import {
|
|
43
43
|
FieldCard_default,
|
|
44
44
|
fieldCardVariants
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-4RQJCFM7.js";
|
|
46
46
|
import {
|
|
47
47
|
Form_default
|
|
48
48
|
} from "./chunk-UB7CSOZU.js";
|
|
49
49
|
import "./chunk-36LBVB45.js";
|
|
50
50
|
import {
|
|
51
51
|
Input_default
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-FBCGU6V6.js";
|
|
53
53
|
import {
|
|
54
54
|
useInputValueDebounce
|
|
55
55
|
} from "./chunk-LEMQGDFE.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuf-stack/uniform",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "fuf react form library",
|
|
5
5
|
"author": "Fröhlich ∧ Frei",
|
|
6
6
|
"homepage": "https://github.com/fuf-stack/pixels#readme",
|
|
@@ -208,5 +208,5 @@
|
|
|
208
208
|
"react": "19.1.1",
|
|
209
209
|
"react-dom": "19.1.1"
|
|
210
210
|
},
|
|
211
|
-
"gitHead": "
|
|
211
|
+
"gitHead": "63a9639ba71a7bc9ad17e39eb5aeb890d02fca7b"
|
|
212
212
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-ECUVOZGQ.cjs","../src/Input/Input.tsx","../src/Input/index.ts"],"names":["Input_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACPA,sCAAmC;AACnC,mDAA+C;AAE/C,oDAAyC;AA+JnC,+CAAA;AAzJC,IAAM,cAAA,EAAgB,4BAAA;AAAG,EAC9B,KAAA,EAAO;AAAA;AAAA,IAEL,IAAA,EAAM,EAAA;AAAA;AAAA,IAEN,WAAA,EAAa,EAAA;AAAA;AAAA,IAEb,KAAA,EAAO,EAAA;AAAA;AAAA,IAEP,YAAA,EAAc;AAAA,EAChB;AACF,CAAC,CAAA;AAyCD,IAAM,MAAA,EAAQ,CAAC,EAAA,EAAA,GAYG;AAZH,EAAA,IAAA,GAAA,EAAA,EAAA,EACb;AAAA,IAAA,SAAA,EAAW,WAAA,EAAa,KAAA,CAAA;AAAA,IACxB,UAAA,EAAY,KAAA;AAAA,IACZ,cAAA,EAAgB,GAAA;AAAA,IAChB,WAAA,EAAa,KAAA,CAAA;AAAA,IACb,IAAA;AAAA,IACA,QAAA,EAAU,KAAA,CAAA;AAAA,IACV,YAAA,EAAc,GAAA;AAAA,IACd,KAAA,EAAO,KAAA,CAAA;AAAA,IACP,aAAA,EAAe,KAAA,CAAA;AAAA,IACf,KAAA,EAAO,KAAA;AAAA,EA5ET,EAAA,EAkEe,EAAA,EAWV,kBAAA,EAAA,yCAAA,EAXU,EAWV;AAAA,IAVH,WAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,YAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AA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CAAS;AAAA,cACP,MAAA,EAAQ,EAAE,KAAA,EAAO,MAAA,CAAO,CAAC,EAAE;AAAA,YAC7B,CAAwC,CAAA;AAAA,UAC1C,EAAA,KAAO;AAEL,YAAA,QAAA,CAAS,CAAC,CAAA;AAAA,UACZ;AAAA,QACF;AAAA,MAAA,CAAA;AAAA,IACF,CAAA;AAAA,EAEJ;AAGA,EAAA,uBACE,6BAAA,YAAC,EAAA,6CAAA,8CAAA,CAAA,CAAA,EAAc,WAAA,CAAA,EAAd,EAA2B,QAAA,EAAoB,IAAA,EAAY,MAAA,CAAA,CAAc,CAAA;AAE9E,CAAA;AAEA,IAAO,cAAA,EAAQ,KAAA;AD3Df;AACA;AEtIA,IAAOA,eAAAA,EAAQ,aAAA;AFwIf;AACA;AACE;AACA;AACF,+EAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-ECUVOZGQ.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { InputProps as HeroInputProps } from '@heroui/input';\nimport type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport { Input as HeroInput } from '@heroui/input';\nimport { NumberInput as HeroNumberInput } from '@heroui/number-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 inputVariants = 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 inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface InputProps 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 /** shows clear button when input has value */\n clearable?: boolean;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** callback that is fired when the value is cleared */\n onClear?: () => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string>;\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className: _className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n name,\n onClear = undefined,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n type = undefined,\n ...uniformFieldProps\n}: InputProps) => {\n const {\n ariaLabel,\n disabled,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n errorMessage,\n invalid,\n label,\n required,\n testId,\n resetField,\n } = useUniformField({ name, type, ...uniformFieldProps });\n\n // Use hook that provides debounced onChange and enhanced blur handling\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // If input is clearable add props for clearing input value\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable\n ? {\n isClearable: true,\n onClear: () => {\n // if field had initial value we do not reset it\n // to that value, but clear it instead\n resetField(name, { defaultValue: null });\n // if onClear cb provided we call it\n if (onClear) {\n onClear();\n }\n },\n }\n : {};\n\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n // Common props for both Input and NumberInput\n const commonProps = {\n 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 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 endContent,\n errorMessage,\n id: testId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside' as const,\n name,\n onBlur,\n placeholder,\n radius: 'sm' as const,\n size,\n startContent,\n variant: 'bordered' as const,\n ...clearableProps,\n };\n\n // Render NumberInput for number type\n if (type === 'number') {\n // Parse the string value to number - use null for empty/cleared state to keep component controlled\n const numberValue =\n value !== '' && value != null && !Number.isNaN(Number(value))\n ? Number(value)\n : null;\n\n return (\n <HeroNumberInput\n {...commonProps}\n // @ts-expect-error - HeroUI NumberInput type is not compatible with null,\n // but it needs to be for empty/cleared state to be controlled\n value={numberValue}\n // Disable thousands separator to avoid parsing issues\n formatOptions={{\n useGrouping: false,\n }}\n // NumberInput onChange receives either an event or a number\n onChange={(e: React.ChangeEvent<HTMLInputElement> | number) => {\n if (typeof e === 'number') {\n // Convert number to synthetic event and pass through debounced onChange\n onChange({\n target: { value: String(e) },\n } as React.ChangeEvent<HTMLInputElement>);\n } else {\n // Pass event through debounced onChange\n onChange(e);\n }\n }}\n />\n );\n }\n\n // Render regular Input for text/password\n return (\n <HeroInput {...commonProps} onChange={onChange} type={type} value={value} />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Input/Input.tsx","../src/Input/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { InputProps as HeroInputProps } from '@heroui/input';\nimport type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport { Input as HeroInput } from '@heroui/input';\nimport { NumberInput as HeroNumberInput } from '@heroui/number-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 inputVariants = 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 inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface InputProps 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 /** shows clear button when input has value */\n clearable?: boolean;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** callback that is fired when the value is cleared */\n onClear?: () => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string>;\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className: _className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n name,\n onClear = undefined,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n type = undefined,\n ...uniformFieldProps\n}: InputProps) => {\n const {\n ariaLabel,\n disabled,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n errorMessage,\n invalid,\n label,\n required,\n testId,\n resetField,\n } = useUniformField({ name, type, ...uniformFieldProps });\n\n // Use hook that provides debounced onChange and enhanced blur handling\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // If input is clearable add props for clearing input value\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable\n ? {\n isClearable: true,\n onClear: () => {\n // if field had initial value we do not reset it\n // to that value, but clear it instead\n resetField(name, { defaultValue: null });\n // if onClear cb provided we call it\n if (onClear) {\n onClear();\n }\n },\n }\n : {};\n\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n // Common props for both Input and NumberInput\n const commonProps = {\n 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 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 endContent,\n errorMessage,\n id: testId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside' as const,\n name,\n onBlur,\n placeholder,\n radius: 'sm' as const,\n size,\n startContent,\n variant: 'bordered' as const,\n ...clearableProps,\n };\n\n // Render NumberInput for number type\n if (type === 'number') {\n // Parse the string value to number - use null for empty/cleared state to keep component controlled\n const numberValue =\n value !== '' && value != null && !Number.isNaN(Number(value))\n ? Number(value)\n : null;\n\n return (\n <HeroNumberInput\n {...commonProps}\n // @ts-expect-error - HeroUI NumberInput type is not compatible with null,\n // but it needs to be for empty/cleared state to be controlled\n value={numberValue}\n // Disable thousands separator to avoid parsing issues\n formatOptions={{\n useGrouping: false,\n }}\n // NumberInput onChange receives either an event or a number\n onChange={(e: React.ChangeEvent<HTMLInputElement> | number) => {\n if (typeof e === 'number') {\n // Convert number to synthetic event and pass through debounced onChange\n onChange({\n target: { value: String(e) },\n } as React.ChangeEvent<HTMLInputElement>);\n } else {\n // Pass event through debounced onChange\n onChange(e);\n }\n }}\n />\n );\n }\n\n // Render regular Input for text/password\n return (\n <HeroInput {...commonProps} onChange={onChange} type={type} value={value} />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { Input };\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;;AAKA,SAAS,SAAS,iBAAiB;AACnC,SAAS,eAAe,uBAAuB;AAE/C,SAAS,IAAI,4BAA4B;AA+JnC;AAzJC,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA;AAAA,IAEL,MAAM;AAAA;AAAA,IAEN,aAAa;AAAA;AAAA,IAEb,OAAO;AAAA;AAAA,IAEP,cAAc;AAAA,EAChB;AACF,CAAC;AAyCD,IAAM,QAAQ,CAAC,OAYG;AAZH,eACb;AAAA,eAAW,aAAa;AAAA,IACxB,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb;AAAA,IACA,UAAU;AAAA,IACV,cAAc;AAAA,IACd,OAAO;AAAA,IACP,eAAe;AAAA,IACf,OAAO;AAAA,EA5ET,IAkEe,IAWV,8BAXU,IAWV;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACL,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,OAAO;AAAA,MACP;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,gBAAgB,iBAAE,MAAM,QAAS,kBAAmB;AAGxD,QAAM,EAAE,UAAU,QAAQ,MAAM,IAAI,sBAAsB;A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C;AAAA,UACZ;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AAGA,SACE,oBAAC,4CAAc,cAAd,EAA2B,UAAoB,MAAY,QAAc;AAE9E;AAEA,IAAO,gBAAQ;;;AChMf,IAAOA,iBAAQ;","names":["Input_default"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-NXBYGCPL.cjs","../src/FieldCard/FieldCard.tsx","../src/FieldCard/subcomponents/FieldCardValidationError.tsx"],"names":["_a","jsx","cn"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACVA,oDAA6C;ADY7C;AACA;AEfA;AACE;AACA;AACA;AAAA,sDACK;AACP;AAwDc,+CAAA;AAtCd,IAAM,yBAAA,EAA2B,CAAC;AAAA,EAChC,UAAA,EAAY,KAAA,CAAA;AAAA,EACZ;AACF,CAAA,EAAA,GAAqC;AA1BrC,EAAA,IAAA,EAAA;AA2BE,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,EACF,EAAA,EAAI,+CAAA;AAAgB,IAClB;AAAA,EACF,CAAC,CAAA;AAGD,EAAA,MAAM,iBAAA,EAAmB,2CAAA,CAAiB;AAG1C,EAAA,MAAM,UAAA,EAAY,QAAA,GAAA,CAAW,MAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,KAAA,CAAO,OAAA,CAAA;AAEpC,EAAA,uBACE,6BAAA,4BAAC,EAAA,EAAgB,OAAA,EAAS,CAAC,gBAAA,EACxB,QAAA,EAAA,UAAA,kBACC,6BAAA;AAAA,IAAC,mBAAA,CAAO,GAAA;AAAA,IAAP;AAAA,MAEC,IAAA,EAAM,iBAAA,EAAmB,KAAA,EAAA,EAAY,EAAE,OAAA,EAAS,CAA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GpC,EAAA,MAAM,SAAA,EAAW,iBAAA,CAAkB,EAAE,OAAA,EAAS,UAAU,CAAC,CAAA;AACzD,EAAA,MAAM,UAAA,EAAY,8CAAA,QAAqB,EAAU,UAAA,EAAY,MAAM,CAAA;AAEnE,EAAA,uBACE,8BAAA,KAAC,EAAA,EAAI,SAAA,EAAW,SAAA,CAAU,IAAA,EAEvB,QAAA,EAAA;AAAA,IAAA,MAAA,kBACCC,6BAAAA;AAAA,MAAC,KAAA;AAAA,MAAA,6CAAA,8CAAA,CAAA,CAAA,EACK,aAAA,CAAc,CAAA,CAAA,EADnB;AAAA,QAEC,YAAA,EAAY,CAAA;AAAA,QACZ,SAAA,EAAWC,4BAAAA,CAAGF,IAAAA,EAAA,aAAA,CAAc,CAAA,EAAA,GAAd,KAAA,EAAA,KAAA,EAAA,EAAAA,GAAAA,CAAiB,SAAA,EAAW,SAAA,CAAU,KAAK,CAAA;AAAA,QACzD,IAAA,EAAK,SAAA;AAAA,QAEJ,QAAA,EAAA;AAAA,MAAA,CAAA;AAAA,IACH,EAAA,EACE,IAAA;AAAA,oBAGJC,6BAAAA,KAAC,EAAA,EAAI,SAAA,EAAW,SAAA,CAAU,OAAA,EAAU,SAAA,CAAS,CAAA;AAAA,oBAG7CA,6BAAAA,gCAAC,EAAA,EAAyB,SAAA,EAAW,SAAA,CAAU,WAAA,EAAa,KAAA,CAAY;AAAA,EAAA,EAAA,CAC1E,CAAA;AAEJ,CAAA;AAEA,IAAO,kBAAA,EAAQ,SAAA;AD6Bf;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-NXBYGCPL.cjs","sourcesContent":[null,"import type { ReactNode } from 'react';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport FieldCardValidationError from './subcomponents/FieldCardValidationError';\n\nexport const fieldCardVariants = tv({\n slots: {\n /** base class for the field card wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border bg-content1',\n ],\n /** class for the label/header */\n label: [\n // override HeroUI label positioning and display\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) for proper header size\n 'rounded-t-small border-b p-3 font-semibold text-medium',\n ],\n /** class for the content */\n content: ['p-3'],\n /** class for the error footer wrapper */\n errorFooter: [\n 'border-t',\n // force helper to be visible and add padding\n 'block px-3 py-2',\n ],\n },\n variants: {\n invalid: {\n true: {\n base: 'border-danger',\n label: 'border-danger text-danger',\n errorFooter: 'border-danger',\n },\n false: {\n base: 'border-divider',\n label: 'border-divider text-foreground',\n errorFooter: 'border-divider',\n },\n },\n },\n defaultVariants: {\n invalid: false,\n },\n});\n\nexport interface FieldCardProps {\n /** Content to render inside the card */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Label content for the card header */\n label: ReactNode;\n /** Field name for validation */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * FieldCard component - A card-styled container with label header and error footer\n *\n * Displays form field content in a card layout with:\n * - Label/title in the header\n * - Content in the body\n * - Validation errors in the footer\n * - Danger outline when validation errors exist\n */\nconst FieldCard = ({\n children,\n className: _className = undefined,\n name,\n ...uniformFieldProps\n}: FieldCardProps) => {\n const { error, getLabelProps, invalid, label } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n // className from slots\n const variants = fieldCardVariants({ invalid: hasErrors });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* card header with label */}\n {label ? (\n <div\n {...getLabelProps()}\n aria-level={3}\n className={cn(getLabelProps()?.className, className.label)}\n role=\"heading\"\n >\n {label}\n </div>\n ) : null}\n\n {/* card content */}\n <div className={className.content}>{children}</div>\n\n {/* card footer with validation errors */}\n <FieldCardValidationError className={className.errorFooter} name={name} />\n </div>\n );\n};\n\nexport default FieldCard;\n","import {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\n\nexport interface FieldCardValidationErrorProps {\n /** CSS class name for the error footer wrapper */\n className?: string;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders validation errors in the footer of a FieldCard component.\n *\n * This component handles displaying field-level validation errors with proper\n * accessibility attributes and animates them in/out using Framer Motion.\n */\nconst FieldCardValidationError = ({\n className = undefined,\n name,\n}: FieldCardValidationErrorProps) => {\n const {\n error,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n testId,\n } = useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-card-errors\"\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(getHelperWrapperProps()?.className, className)}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n error={error._errors}\n testId={testId}\n />\n </div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldCardValidationError;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/FieldCard/FieldCard.tsx","../src/FieldCard/subcomponents/FieldCardValidationError.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport FieldCardValidationError from './subcomponents/FieldCardValidationError';\n\nexport const fieldCardVariants = tv({\n slots: {\n /** base class for the field card wrapper */\n base: [\n // base styles\n 'overflow-hidden rounded-small border bg-content1',\n ],\n /** class for the label/header */\n label: [\n // override HeroUI label positioning and display\n 'pointer-events-auto! static! z-auto! block! w-full!',\n // reset any transforms or translations\n 'translate-x-0! translate-y-0! transform-none!',\n // card header styling - use text-medium (16px) for proper header size\n 'rounded-t-small border-b p-3 font-semibold text-medium',\n ],\n /** class for the content */\n content: ['p-3'],\n /** class for the error footer wrapper */\n errorFooter: [\n 'border-t',\n // force helper to be visible and add padding\n 'block px-3 py-2',\n ],\n },\n variants: {\n invalid: {\n true: {\n base: 'border-danger',\n label: 'border-danger text-danger',\n errorFooter: 'border-danger',\n },\n false: {\n base: 'border-divider',\n label: 'border-divider text-foreground',\n errorFooter: 'border-divider',\n },\n },\n },\n defaultVariants: {\n invalid: false,\n },\n});\n\nexport interface FieldCardProps {\n /** Content to render inside the card */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Label content for the card header */\n label: ReactNode;\n /** Field name for validation */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * FieldCard component - A card-styled container with label header and error footer\n *\n * Displays form field content in a card layout with:\n * - Label/title in the header\n * - Content in the body\n * - Validation errors in the footer\n * - Danger outline when validation errors exist\n */\nconst FieldCard = ({\n children,\n className: _className = undefined,\n name,\n ...uniformFieldProps\n}: FieldCardProps) => {\n const { error, getLabelProps, invalid, label } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n // className from slots\n const variants = fieldCardVariants({ invalid: hasErrors });\n const className = variantsToClassNames(variants, _className, 'base');\n\n return (\n <div className={className.base}>\n {/* card header with label */}\n {label ? (\n <div\n {...getLabelProps()}\n aria-level={3}\n className={cn(getLabelProps()?.className, className.label)}\n role=\"heading\"\n >\n {label}\n </div>\n ) : null}\n\n {/* card content */}\n <div className={className.content}>{children}</div>\n\n {/* card footer with validation errors */}\n <FieldCardValidationError className={className.errorFooter} name={name} />\n </div>\n );\n};\n\nexport default FieldCard;\n","import {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from '@fuf-stack/pixel-motion';\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../../hooks/useUniformField';\nimport FieldValidationError from '../../partials/FieldValidationError/FieldValidationError';\n\nexport interface FieldCardValidationErrorProps {\n /** CSS class name for the error footer wrapper */\n className?: string;\n /** Field name */\n name: string;\n}\n\n/**\n * Renders validation errors in the footer of a FieldCard component.\n *\n * This component handles displaying field-level validation errors with proper\n * accessibility attributes and animates them in/out using Framer Motion.\n */\nconst FieldCardValidationError = ({\n className = undefined,\n name,\n}: FieldCardValidationErrorProps) => {\n const {\n error,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n testId,\n } = useUniformField({\n name,\n });\n\n // disable all animation if user prefers reduced motion\n const disableAnimation = useReducedMotion();\n\n // @ts-expect-error - error._errors exists but not typed\n const hasErrors = invalid && error?._errors;\n\n return (\n <AnimatePresence initial={!disableAnimation}>\n {hasErrors ? (\n <motion.div\n key=\"field-card-errors\"\n exit={disableAnimation ? undefined : { opacity: 0, height: 0 }}\n initial={disableAnimation ? false : { height: 0, opacity: 0 }}\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2, ease: 'circOut' }}\n animate={\n disableAnimation ? undefined : { opacity: 1, height: 'auto' }\n }\n >\n <div\n {...getHelperWrapperProps()}\n className={cn(getHelperWrapperProps()?.className, className)}\n >\n <div {...getErrorMessageProps()}>\n <FieldValidationError\n // @ts-expect-error - error._errors exists but not typed\n error={error._errors}\n testId={testId}\n />\n </div>\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n};\n\nexport default FieldCardValidationError;\n"],"mappings":";;;;;;;;;;;;;AAEA,SAA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