@fuf-stack/uniform 1.10.2 → 1.10.3
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/{chunk-ZIMWVUMQ.js → chunk-4RQJCFM7.js} +7 -2
- package/dist/chunk-4RQJCFM7.js.map +1 -0
- package/dist/{chunk-NXBYGCPL.cjs → chunk-OT3A4LEE.cjs} +7 -2
- package/dist/chunk-OT3A4LEE.cjs.map +1 -0
- package/dist/hooks/useClientValidation/index.d.cts +2 -2
- package/dist/hooks/useClientValidation/index.d.ts +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/package.json +2 -2
- 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
|
@@ -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,oBA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IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,EACX;AACF,CAAC;AA0BD,IAAM,YAAY,CAAC,OAKG;AALH,eACjB;AAAA;AAAA,IACA,WAAW,aAAa;AAAA,IACxB;AAAA,EApFF,IAiFmB,IAId,8BAJc,IAId;AAAA,IAHH;AAAA,IACA;AAAA,IACA;AAAA;AApFF,MAAAC;AAuFE,QAAM,EAAE,OAAO,eAAe,SAAS,MAAM,IAAI,gBAAgB;AAAA,IAC/D;AAAA,KACG,kBACJ;AAGD,QAAM,YAAY,YAAW,+BAAO;AAGpC,QAAM,WAAW,kBAAkB,EAAE,SAAS,UAAU,CAAC;AACzD,QAAM,YAAY,qBAAqB,UAAU,YAAY,MAAM;AAEnE,SACE,qBAAC,SAAI,WAAW,UAAU,MAEvB;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"]}
|
|
@@ -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,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,iBA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AY,QAAA,GAAA,CAAW,MAAA,GAAA,KAAA,EAAA,KAAA,EAAA,EAAA,KAAA,CAAO,OAAA,CAAA;AAGpC,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;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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _fuf_stack_veto_dist_types_d_CSVd_Qmh from '@fuf-stack/veto/dist/types.d-CSVd_Qmh';
|
|
2
2
|
import { VetoTypeAny } from '@fuf-stack/veto';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -142,6 +142,6 @@ declare const useClientValidation: <TData = unknown>(data: TData | null | undefi
|
|
|
142
142
|
* // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
|
-
declare const clientValidationSchemaByName: <T extends VetoTypeAny>(name: string, fieldSchema: T) =>
|
|
145
|
+
declare const clientValidationSchemaByName: <T extends VetoTypeAny>(name: string, fieldSchema: T) => _fuf_stack_veto_dist_types_d_CSVd_Qmh.Z;
|
|
146
146
|
|
|
147
147
|
export { clientValidationSchemaByName, useClientValidation };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _fuf_stack_veto_dist_types_d_CSVd_Qmh from '@fuf-stack/veto/dist/types.d-CSVd_Qmh';
|
|
2
2
|
import { VetoTypeAny } from '@fuf-stack/veto';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -142,6 +142,6 @@ declare const useClientValidation: <TData = unknown>(data: TData | null | undefi
|
|
|
142
142
|
* // => objectLoose({ tags: array(vt.string().refine(...).nullish()).optional() })
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
|
-
declare const clientValidationSchemaByName: <T extends VetoTypeAny>(name: string, fieldSchema: T) =>
|
|
145
|
+
declare const clientValidationSchemaByName: <T extends VetoTypeAny>(name: string, fieldSchema: T) => _fuf_stack_veto_dist_types_d_CSVd_Qmh.Z;
|
|
146
146
|
|
|
147
147
|
export { clientValidationSchemaByName, useClientValidation };
|
package/dist/index.cjs
CHANGED
|
@@ -42,20 +42,20 @@ 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 _chunkTTD3KL6Ecjs = require('./chunk-TTD3KL6E.cjs');
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var _chunkECUVOZGQcjs = require('./chunk-ECUVOZGQ.cjs');
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
var
|
|
58
|
+
var _chunk3ZQXSGR2cjs = require('./chunk-3ZQXSGR2.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
@@ -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 = _chunkECUVOZGQcjs.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.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -42,20 +42,20 @@ 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
|
+
import {
|
|
51
|
+
Grid_default
|
|
52
|
+
} from "./chunk-B62HKKMS.js";
|
|
50
53
|
import {
|
|
51
54
|
Input_default
|
|
52
55
|
} from "./chunk-EVASKP6Q.js";
|
|
53
56
|
import {
|
|
54
57
|
useInputValueDebounce
|
|
55
58
|
} from "./chunk-LEMQGDFE.js";
|
|
56
|
-
import {
|
|
57
|
-
Grid_default
|
|
58
|
-
} from "./chunk-B62HKKMS.js";
|
|
59
59
|
import {
|
|
60
60
|
RadioBoxes_default,
|
|
61
61
|
radioBoxVariants
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuf-stack/uniform",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
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": "80d7fb49b7e58adccc74eb604c0e2ef040ae1513"
|
|
212
212
|
}
|
|
@@ -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;AAC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AA,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,SAAS,MAAAA,KAAI,IAAI,4BAA4B;;;ACF7C;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,s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