@factorialco/f0-react-native 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/module/components/exports.js +1 -1
- package/lib/module/components/exports.js.map +1 -1
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.js +2 -0
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.js.map +1 -0
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.md +159 -0
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.js +2 -0
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.js.map +1 -0
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/index.js +2 -0
- package/lib/module/components/primitives/F0Text/AnimatedF0Text/index.js.map +1 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.js +2 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.js.map +1 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.md +320 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.styles.js +2 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.styles.js.map +1 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.types.js +2 -0
- package/lib/module/components/primitives/F0Text/F0Text/F0Text.types.js.map +1 -0
- package/lib/module/components/primitives/F0Text/F0Text/index.js +2 -0
- package/lib/module/components/primitives/F0Text/F0Text/index.js.map +1 -0
- package/lib/module/components/primitives/F0Text/index.js +2 -0
- package/lib/module/components/primitives/F0Text/index.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/lib/utils.js +1 -1
- package/lib/module/lib/utils.js.map +1 -1
- package/lib/module/styles/theme.css +7 -0
- package/lib/typescript/components/exports.d.ts +1 -0
- package/lib/typescript/components/exports.d.ts.map +1 -1
- package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.d.ts +5 -0
- package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.d.ts +45 -0
- package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/index.d.ts +8 -0
- package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/index.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.d.ts +8 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.styles.d.ts +144 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.styles.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.types.d.ts +86 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.types.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/index.d.ts +9 -0
- package/lib/typescript/components/primitives/F0Text/F0Text/index.d.ts.map +1 -0
- package/lib/typescript/components/primitives/F0Text/index.d.ts +12 -0
- package/lib/typescript/components/primitives/F0Text/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/lib/utils.d.ts +9 -0
- package/lib/typescript/lib/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/exports.ts +3 -0
- package/src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.md +159 -0
- package/src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.tsx +72 -0
- package/src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.ts +61 -0
- package/src/components/primitives/F0Text/AnimatedF0Text/__tests__/AnimatedF0Text.spec.tsx +131 -0
- package/src/components/primitives/F0Text/AnimatedF0Text/__tests__/__snapshots__/AnimatedF0Text.spec.tsx.snap +144 -0
- package/src/components/primitives/F0Text/AnimatedF0Text/index.ts +8 -0
- package/src/components/primitives/F0Text/F0Text/F0Text.md +320 -0
- package/src/components/primitives/F0Text/F0Text/F0Text.styles.ts +71 -0
- package/src/components/primitives/F0Text/F0Text/F0Text.tsx +76 -0
- package/src/components/primitives/F0Text/F0Text/F0Text.types.ts +134 -0
- package/src/components/primitives/F0Text/F0Text/__tests__/F0Text.spec.tsx +228 -0
- package/src/components/primitives/F0Text/F0Text/__tests__/__snapshots__/F0Text.spec.tsx.snap +325 -0
- package/src/components/primitives/F0Text/F0Text/index.ts +22 -0
- package/src/components/primitives/F0Text/index.ts +26 -0
- package/src/index.ts +1 -1
- package/src/lib/__tests__/utils.spec.ts +48 -0
- package/src/lib/utils.ts +19 -0
- package/src/styles/theme.css +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedF0Text.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AA+DjE,eAAO,MAAM,cAAc,qNAAsC,CAAA;AAEjE,YAAY,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { TextProps as RNTextProps } from "react-native";
|
|
2
|
+
import type { AnimatedProps } from "react-native-reanimated";
|
|
3
|
+
import type { TextAlign, TextColor, TextDecoration, TextTransform, TypographyVariant } from "../F0Text/F0Text.types";
|
|
4
|
+
/**
|
|
5
|
+
* Props for the AnimatedF0Text component.
|
|
6
|
+
*
|
|
7
|
+
* Combines F0Text semantic typography props with Reanimated animation
|
|
8
|
+
* capabilities (`entering`, `exiting`, `layout`, animated `style`).
|
|
9
|
+
*/
|
|
10
|
+
export interface AnimatedF0TextProps extends Omit<AnimatedProps<RNTextProps>, "className"> {
|
|
11
|
+
/**
|
|
12
|
+
* Semantic typography variant
|
|
13
|
+
* @default "body-sm-default"
|
|
14
|
+
*/
|
|
15
|
+
variant?: TypographyVariant;
|
|
16
|
+
/**
|
|
17
|
+
* Text color from F0 semantic color system
|
|
18
|
+
* @default "default"
|
|
19
|
+
*/
|
|
20
|
+
color?: TextColor;
|
|
21
|
+
/**
|
|
22
|
+
* Text alignment
|
|
23
|
+
* @default "left"
|
|
24
|
+
*/
|
|
25
|
+
align?: TextAlign;
|
|
26
|
+
/**
|
|
27
|
+
* Text decoration
|
|
28
|
+
* @default "none"
|
|
29
|
+
*/
|
|
30
|
+
decoration?: TextDecoration;
|
|
31
|
+
/**
|
|
32
|
+
* Text transform
|
|
33
|
+
* @default "none"
|
|
34
|
+
*/
|
|
35
|
+
transform?: TextTransform;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of lines before truncating with ellipsis
|
|
38
|
+
*/
|
|
39
|
+
numberOfLines?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Children content
|
|
42
|
+
*/
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=AnimatedF0Text.types.d.ts.map
|
package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimatedF0Text.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAE/B;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,aAAa,CAAC,WAAW,CAAC,EAC1B,WAAW,CACZ;IACC;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAA;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IAEzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnimatedF0Text - Animated text primitive component
|
|
3
|
+
*
|
|
4
|
+
* @see AnimatedF0Text.md for documentation
|
|
5
|
+
*/
|
|
6
|
+
export { AnimatedF0Text } from "./AnimatedF0Text";
|
|
7
|
+
export type { AnimatedF0TextProps } from "./AnimatedF0Text";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/AnimatedF0Text/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text as RNText } from "react-native";
|
|
3
|
+
import { type F0TextProps } from "./F0Text.types";
|
|
4
|
+
export declare const F0Text: React.MemoExoticComponent<React.ForwardRefExoticComponent<F0TextProps & React.RefAttributes<RNText>>>;
|
|
5
|
+
export type { F0TextProps };
|
|
6
|
+
export { TYPOGRAPHY_VARIANTS, TEXT_COLORS, TEXT_ALIGN, TEXT_DECORATIONS, TEXT_TRANSFORMS, } from "./F0Text.types";
|
|
7
|
+
export type { TypographyVariant, TextColor, TextAlign, TextDecoration, TextTransform, } from "./F0Text.types";
|
|
8
|
+
//# sourceMappingURL=F0Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F0Text.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/F0Text/F0Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAK7C,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAoDvE,eAAO,MAAM,MAAM,uGAA8B,CAAA;AAGjD,YAAY,EAAE,WAAW,EAAE,CAAA;AAC3B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
/**
|
|
3
|
+
* Text component variants using tailwind-variants
|
|
4
|
+
* Font weights (font-normal, font-medium, font-semibold) map to
|
|
5
|
+
* Inter font families (Inter-Regular, Inter-Medium, Inter-SemiBold)
|
|
6
|
+
*/
|
|
7
|
+
export declare const textVariants: import("tailwind-variants").TVReturnType<{
|
|
8
|
+
variant: {
|
|
9
|
+
"heading-xl": string;
|
|
10
|
+
"heading-lg": string;
|
|
11
|
+
"heading-md": string;
|
|
12
|
+
"heading-sm": string;
|
|
13
|
+
"body-md-default": string;
|
|
14
|
+
"body-md-medium": string;
|
|
15
|
+
"body-md-semibold": string;
|
|
16
|
+
"body-sm-default": string;
|
|
17
|
+
"body-sm-medium": string;
|
|
18
|
+
"body-sm-semibold": string;
|
|
19
|
+
"body-xs-medium": string;
|
|
20
|
+
};
|
|
21
|
+
color: {
|
|
22
|
+
default: string;
|
|
23
|
+
secondary: string;
|
|
24
|
+
tertiary: string;
|
|
25
|
+
inverse: string;
|
|
26
|
+
"inverse-secondary": string;
|
|
27
|
+
disabled: string;
|
|
28
|
+
accent: string;
|
|
29
|
+
critical: string;
|
|
30
|
+
info: string;
|
|
31
|
+
warning: string;
|
|
32
|
+
positive: string;
|
|
33
|
+
selected: string;
|
|
34
|
+
};
|
|
35
|
+
align: {
|
|
36
|
+
left: string;
|
|
37
|
+
center: string;
|
|
38
|
+
right: string;
|
|
39
|
+
justify: string;
|
|
40
|
+
};
|
|
41
|
+
decoration: {
|
|
42
|
+
none: string;
|
|
43
|
+
underline: string;
|
|
44
|
+
"line-through": string;
|
|
45
|
+
};
|
|
46
|
+
transform: {
|
|
47
|
+
none: string;
|
|
48
|
+
uppercase: string;
|
|
49
|
+
lowercase: string;
|
|
50
|
+
capitalize: string;
|
|
51
|
+
};
|
|
52
|
+
}, undefined, "", {
|
|
53
|
+
variant: {
|
|
54
|
+
"heading-xl": string;
|
|
55
|
+
"heading-lg": string;
|
|
56
|
+
"heading-md": string;
|
|
57
|
+
"heading-sm": string;
|
|
58
|
+
"body-md-default": string;
|
|
59
|
+
"body-md-medium": string;
|
|
60
|
+
"body-md-semibold": string;
|
|
61
|
+
"body-sm-default": string;
|
|
62
|
+
"body-sm-medium": string;
|
|
63
|
+
"body-sm-semibold": string;
|
|
64
|
+
"body-xs-medium": string;
|
|
65
|
+
};
|
|
66
|
+
color: {
|
|
67
|
+
default: string;
|
|
68
|
+
secondary: string;
|
|
69
|
+
tertiary: string;
|
|
70
|
+
inverse: string;
|
|
71
|
+
"inverse-secondary": string;
|
|
72
|
+
disabled: string;
|
|
73
|
+
accent: string;
|
|
74
|
+
critical: string;
|
|
75
|
+
info: string;
|
|
76
|
+
warning: string;
|
|
77
|
+
positive: string;
|
|
78
|
+
selected: string;
|
|
79
|
+
};
|
|
80
|
+
align: {
|
|
81
|
+
left: string;
|
|
82
|
+
center: string;
|
|
83
|
+
right: string;
|
|
84
|
+
justify: string;
|
|
85
|
+
};
|
|
86
|
+
decoration: {
|
|
87
|
+
none: string;
|
|
88
|
+
underline: string;
|
|
89
|
+
"line-through": string;
|
|
90
|
+
};
|
|
91
|
+
transform: {
|
|
92
|
+
none: string;
|
|
93
|
+
uppercase: string;
|
|
94
|
+
lowercase: string;
|
|
95
|
+
capitalize: string;
|
|
96
|
+
};
|
|
97
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
98
|
+
variant: {
|
|
99
|
+
"heading-xl": string;
|
|
100
|
+
"heading-lg": string;
|
|
101
|
+
"heading-md": string;
|
|
102
|
+
"heading-sm": string;
|
|
103
|
+
"body-md-default": string;
|
|
104
|
+
"body-md-medium": string;
|
|
105
|
+
"body-md-semibold": string;
|
|
106
|
+
"body-sm-default": string;
|
|
107
|
+
"body-sm-medium": string;
|
|
108
|
+
"body-sm-semibold": string;
|
|
109
|
+
"body-xs-medium": string;
|
|
110
|
+
};
|
|
111
|
+
color: {
|
|
112
|
+
default: string;
|
|
113
|
+
secondary: string;
|
|
114
|
+
tertiary: string;
|
|
115
|
+
inverse: string;
|
|
116
|
+
"inverse-secondary": string;
|
|
117
|
+
disabled: string;
|
|
118
|
+
accent: string;
|
|
119
|
+
critical: string;
|
|
120
|
+
info: string;
|
|
121
|
+
warning: string;
|
|
122
|
+
positive: string;
|
|
123
|
+
selected: string;
|
|
124
|
+
};
|
|
125
|
+
align: {
|
|
126
|
+
left: string;
|
|
127
|
+
center: string;
|
|
128
|
+
right: string;
|
|
129
|
+
justify: string;
|
|
130
|
+
};
|
|
131
|
+
decoration: {
|
|
132
|
+
none: string;
|
|
133
|
+
underline: string;
|
|
134
|
+
"line-through": string;
|
|
135
|
+
};
|
|
136
|
+
transform: {
|
|
137
|
+
none: string;
|
|
138
|
+
uppercase: string;
|
|
139
|
+
lowercase: string;
|
|
140
|
+
capitalize: string;
|
|
141
|
+
};
|
|
142
|
+
}, undefined, "", unknown, unknown, undefined>>;
|
|
143
|
+
export type TextVariants = VariantProps<typeof textVariants>;
|
|
144
|
+
//# sourceMappingURL=F0Text.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F0Text.styles.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/F0Text/F0Text.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA6DvB,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { TextProps as RNTextProps } from "react-native";
|
|
2
|
+
/**
|
|
3
|
+
* Props that must not be passed through to the underlying RN Text
|
|
4
|
+
* (`style` and `className` are handled by F0 instead).
|
|
5
|
+
* Used with omitProps for runtime safety.
|
|
6
|
+
*/
|
|
7
|
+
export declare const F0_TEXT_BANNED_PROPS: readonly ["style", "className"];
|
|
8
|
+
/**
|
|
9
|
+
* Typography variant types based on semantic design tokens
|
|
10
|
+
*/
|
|
11
|
+
export declare const TYPOGRAPHY_VARIANTS: readonly ["heading-xl", "heading-lg", "heading-md", "heading-sm", "body-md-default", "body-md-medium", "body-md-semibold", "body-sm-default", "body-sm-medium", "body-sm-semibold", "body-xs-medium"];
|
|
12
|
+
export type TypographyVariant = (typeof TYPOGRAPHY_VARIANTS)[number];
|
|
13
|
+
/**
|
|
14
|
+
* Text color variants aligned with F0 semantic color system
|
|
15
|
+
*/
|
|
16
|
+
export declare const TEXT_COLORS: readonly ["default", "secondary", "tertiary", "inverse", "inverse-secondary", "disabled", "accent", "critical", "info", "warning", "positive", "selected"];
|
|
17
|
+
export type TextColor = (typeof TEXT_COLORS)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Text alignment options
|
|
20
|
+
*/
|
|
21
|
+
export declare const TEXT_ALIGN: readonly ["left", "center", "right", "justify"];
|
|
22
|
+
export type TextAlign = (typeof TEXT_ALIGN)[number];
|
|
23
|
+
/**
|
|
24
|
+
* Text decoration options
|
|
25
|
+
*/
|
|
26
|
+
export declare const TEXT_DECORATIONS: readonly ["none", "underline", "line-through"];
|
|
27
|
+
export type TextDecoration = (typeof TEXT_DECORATIONS)[number];
|
|
28
|
+
/**
|
|
29
|
+
* Text transform options
|
|
30
|
+
*/
|
|
31
|
+
export declare const TEXT_TRANSFORMS: readonly ["none", "uppercase", "lowercase", "capitalize"];
|
|
32
|
+
export type TextTransform = (typeof TEXT_TRANSFORMS)[number];
|
|
33
|
+
/**
|
|
34
|
+
* Internal props for the F0Text component.
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
interface F0TextPropsInternal extends Omit<RNTextProps, "style"> {
|
|
38
|
+
/**
|
|
39
|
+
* Semantic typography variant
|
|
40
|
+
* @default "body-sm-default"
|
|
41
|
+
*/
|
|
42
|
+
variant?: TypographyVariant;
|
|
43
|
+
/**
|
|
44
|
+
* Text color from F0 semantic color system
|
|
45
|
+
* @default "default"
|
|
46
|
+
*/
|
|
47
|
+
color?: TextColor;
|
|
48
|
+
/**
|
|
49
|
+
* Text alignment
|
|
50
|
+
* @default "left"
|
|
51
|
+
*/
|
|
52
|
+
align?: TextAlign;
|
|
53
|
+
/**
|
|
54
|
+
* Text decoration
|
|
55
|
+
* @default "none"
|
|
56
|
+
*/
|
|
57
|
+
decoration?: TextDecoration;
|
|
58
|
+
/**
|
|
59
|
+
* Text transform
|
|
60
|
+
* @default "none"
|
|
61
|
+
*/
|
|
62
|
+
transform?: TextTransform;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum number of lines before truncating with ellipsis
|
|
65
|
+
*/
|
|
66
|
+
numberOfLines?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Children content
|
|
69
|
+
*/
|
|
70
|
+
children?: React.ReactNode;
|
|
71
|
+
/**
|
|
72
|
+
* Excluded from public API via Omit<F0TextPropsInternal, "className">.
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
className?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Public props for the F0Text component
|
|
79
|
+
*
|
|
80
|
+
* Note: `className` and `style` props are NOT available.
|
|
81
|
+
* Use semantic props (variant, color, align, etc.) for typography.
|
|
82
|
+
* For spacing/layout, wrap F0Text in a View with className.
|
|
83
|
+
*/
|
|
84
|
+
export type F0TextProps = Omit<F0TextPropsInternal, "className">;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=F0Text.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"F0Text.types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/F0Text/F0Text.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,iCAAkC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,mBAAmB,uMAYtB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpE;;GAEG;AACH,eAAO,MAAM,WAAW,4JAad,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,UAAU,iDAAkD,CAAA;AAEzE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,gBAAgB,gDAAiD,CAAA;AAE9E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,eAAe,2DAKlB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D;;;GAGG;AACH,UAAU,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9D;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IAEjB;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAA;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;IAEzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* F0Text - Text primitive component
|
|
3
|
+
*
|
|
4
|
+
* @see F0Text.md for documentation
|
|
5
|
+
*/
|
|
6
|
+
export { F0Text } from "./F0Text";
|
|
7
|
+
export type { F0TextProps, TypographyVariant, TextColor, TextAlign, TextDecoration, TextTransform, } from "./F0Text";
|
|
8
|
+
export { TYPOGRAPHY_VARIANTS, TEXT_COLORS, TEXT_ALIGN, TEXT_DECORATIONS, TEXT_TRANSFORMS, } from "./F0Text";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/F0Text/F0Text/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* F0Text - Text primitive components
|
|
3
|
+
*
|
|
4
|
+
* @see F0Text/F0Text.md for documentation
|
|
5
|
+
* @see AnimatedF0Text/AnimatedF0Text.md for animated variant documentation
|
|
6
|
+
*/
|
|
7
|
+
export { F0Text } from "./F0Text";
|
|
8
|
+
export type { F0TextProps, TypographyVariant, TextColor, TextAlign, TextDecoration, TextTransform, } from "./F0Text";
|
|
9
|
+
export { TYPOGRAPHY_VARIANTS, TEXT_COLORS, TEXT_ALIGN, TEXT_DECORATIONS, TEXT_TRANSFORMS, } from "./F0Text";
|
|
10
|
+
export { AnimatedF0Text } from "./AnimatedF0Text";
|
|
11
|
+
export type { AnimatedF0TextProps } from "./AnimatedF0Text";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/F0Text/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA;AAGpC,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAA;AAGpC,cAAc,SAAS,CAAA;AAGvB,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { type CnOptions } from "tailwind-variants";
|
|
2
2
|
export declare function cn(...args: CnOptions): string;
|
|
3
|
+
/**
|
|
4
|
+
* Omits specified keys from an object at runtime.
|
|
5
|
+
* Used to filter blocked props (e.g. style, className) before spreading to primitives.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* omitProps(rest, ["style"])
|
|
9
|
+
* omitProps(rest, ["style", "className"])
|
|
10
|
+
*/
|
|
11
|
+
export declare function omitProps<T extends Record<string, unknown>, K extends string>(obj: T, keys: readonly K[]): Omit<T, K>;
|
|
3
12
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE3D,wBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,MAAM,CAM7C"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE3D,wBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,MAAM,CAM7C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,EAC3E,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,SAAS,CAAC,EAAE,GACjB,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAMZ"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# AnimatedF0Text
|
|
2
|
+
|
|
3
|
+
Animated text primitive for React Native with semantic typography variants and Reanimated animation support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- All F0Text semantic typography variants and colors
|
|
8
|
+
- Reanimated `entering`/`exiting` layout animations
|
|
9
|
+
- Animated `style` prop for custom animations via `useAnimatedStyle`
|
|
10
|
+
- Layout transition animations
|
|
11
|
+
- Shares the same typography system as F0Text
|
|
12
|
+
- Performance optimized with React.memo and useMemo
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { AnimatedF0Text } from "@factorialco/f0-react-native"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Requires `react-native-reanimated` as a peer dependency.
|
|
21
|
+
|
|
22
|
+
## When to use AnimatedF0Text vs F0Text
|
|
23
|
+
|
|
24
|
+
| Use case | Component |
|
|
25
|
+
| ------------------------------------------------- | ---------------- |
|
|
26
|
+
| Static text, no animation | `F0Text` |
|
|
27
|
+
| Text that fades in/out | `AnimatedF0Text` |
|
|
28
|
+
| Text with entering/exiting transitions | `AnimatedF0Text` |
|
|
29
|
+
| Text driven by animated values (scroll, gestures) | `AnimatedF0Text` |
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### Entering/Exiting Animations
|
|
34
|
+
|
|
35
|
+
<!-- prettier-ignore -->
|
|
36
|
+
```tsx
|
|
37
|
+
import { AnimatedF0Text } from "@factorialco/f0-react-native"
|
|
38
|
+
import { FadeIn, FadeOut, SlideInLeft } from "react-native-reanimated"
|
|
39
|
+
|
|
40
|
+
<>
|
|
41
|
+
<AnimatedF0Text
|
|
42
|
+
variant="heading-xl"
|
|
43
|
+
entering={FadeIn.duration(300)}
|
|
44
|
+
exiting={FadeOut.duration(200)}
|
|
45
|
+
>
|
|
46
|
+
Welcome back
|
|
47
|
+
</AnimatedF0Text>
|
|
48
|
+
|
|
49
|
+
<AnimatedF0Text variant="heading-md" entering={SlideInLeft.springify()}>
|
|
50
|
+
Slide in heading
|
|
51
|
+
</AnimatedF0Text>
|
|
52
|
+
</>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Custom Animated Styles
|
|
56
|
+
|
|
57
|
+
<!-- prettier-ignore -->
|
|
58
|
+
```tsx
|
|
59
|
+
import { AnimatedF0Text } from "@factorialco/f0-react-native"
|
|
60
|
+
import { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated"
|
|
61
|
+
|
|
62
|
+
const opacity = useSharedValue(0)
|
|
63
|
+
|
|
64
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
65
|
+
opacity: opacity.value,
|
|
66
|
+
transform: [{ translateY: withTiming(opacity.value * -10) }],
|
|
67
|
+
}))
|
|
68
|
+
|
|
69
|
+
<>
|
|
70
|
+
<AnimatedF0Text variant="body-md-default" style={animatedStyle}>
|
|
71
|
+
Custom animated text
|
|
72
|
+
</AnimatedF0Text>
|
|
73
|
+
</>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Layout Transitions
|
|
77
|
+
|
|
78
|
+
<!-- prettier-ignore -->
|
|
79
|
+
```tsx
|
|
80
|
+
import { AnimatedF0Text } from "@factorialco/f0-react-native"
|
|
81
|
+
import { LinearTransition } from "react-native-reanimated"
|
|
82
|
+
|
|
83
|
+
<>
|
|
84
|
+
<AnimatedF0Text
|
|
85
|
+
variant="body-sm-default"
|
|
86
|
+
layout={LinearTransition.springify()}
|
|
87
|
+
>
|
|
88
|
+
{dynamicContent}
|
|
89
|
+
</AnimatedF0Text>
|
|
90
|
+
</>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## API Reference
|
|
94
|
+
|
|
95
|
+
### Props
|
|
96
|
+
|
|
97
|
+
AnimatedF0Text accepts all F0Text semantic props plus Reanimated animation props.
|
|
98
|
+
|
|
99
|
+
#### Typography Props (shared with F0Text)
|
|
100
|
+
|
|
101
|
+
| Prop | Type | Default | Description |
|
|
102
|
+
| --------------- | ------------------- | ------------------- | ---------------------------------------- |
|
|
103
|
+
| `variant` | `TypographyVariant` | `'body-sm-default'` | Typography variant |
|
|
104
|
+
| `color` | `TextColor` | `'default'` | Text color from F0 semantic color system |
|
|
105
|
+
| `align` | `TextAlign` | `'left'` | Text alignment |
|
|
106
|
+
| `decoration` | `TextDecoration` | `'none'` | Text decoration |
|
|
107
|
+
| `transform` | `TextTransform` | `'none'` | Text transform |
|
|
108
|
+
| `numberOfLines` | `number` | `undefined` | Max lines before truncation |
|
|
109
|
+
|
|
110
|
+
#### Animation Props
|
|
111
|
+
|
|
112
|
+
| Prop | Type | Description |
|
|
113
|
+
| ---------- | ------------------------------------------------- | -------------------------------------------------------------- |
|
|
114
|
+
| `entering` | `EntryOrExitLayoutType` | Reanimated entering animation (e.g. `FadeIn`, `SlideInLeft`) |
|
|
115
|
+
| `exiting` | `EntryOrExitLayoutType` | Reanimated exiting animation (e.g. `FadeOut`, `SlideOutRight`) |
|
|
116
|
+
| `layout` | `BaseAnimationBuilder \| LayoutAnimationFunction` | Layout transition animation |
|
|
117
|
+
| `style` | `AnimatedStyle` | Animated style from `useAnimatedStyle` |
|
|
118
|
+
|
|
119
|
+
All React Native `TextProps` are also supported (onPress, testID, etc.).
|
|
120
|
+
|
|
121
|
+
### Typography Variants
|
|
122
|
+
|
|
123
|
+
See [F0Text documentation](../F0Text/F0Text.md) for the full list of typography variants and colors.
|
|
124
|
+
|
|
125
|
+
## Architecture
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
F0Text/ # Parent folder for text primitives
|
|
129
|
+
├── F0Text/ # Static text component
|
|
130
|
+
│ ├── F0Text.tsx
|
|
131
|
+
│ ├── F0Text.types.ts # Shared types (TypographyVariant, TextColor, etc.)
|
|
132
|
+
│ ├── F0Text.styles.ts # Shared styles (textVariants)
|
|
133
|
+
│ ├── F0Text.md
|
|
134
|
+
│ ├── index.ts
|
|
135
|
+
│ └── __tests__/
|
|
136
|
+
├── AnimatedF0Text/ # Animated text component
|
|
137
|
+
│ ├── AnimatedF0Text.tsx # Animated text (Reanimated Animated.Text)
|
|
138
|
+
│ ├── AnimatedF0Text.types.ts
|
|
139
|
+
│ ├── AnimatedF0Text.md
|
|
140
|
+
│ ├── index.ts
|
|
141
|
+
│ └── __tests__/
|
|
142
|
+
└── index.ts # Barrel re-exporting both
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- **Types** are imported from `../F0Text/F0Text.types.ts` (`TypographyVariant`, `TextColor`, etc.)
|
|
146
|
+
- **Styles** are imported from `../F0Text/F0Text.styles.ts` (`textVariants`)
|
|
147
|
+
|
|
148
|
+
This ensures both components always produce identical typography output.
|
|
149
|
+
|
|
150
|
+
## Accessibility
|
|
151
|
+
|
|
152
|
+
- Fully supports React Native `Text` accessibility props
|
|
153
|
+
- Animations respect the device's reduced motion setting when using Reanimated's built-in animations
|
|
154
|
+
|
|
155
|
+
## Performance
|
|
156
|
+
|
|
157
|
+
- **React.memo**: Prevents re-renders when props unchanged
|
|
158
|
+
- **useMemo**: Memoizes className computation
|
|
159
|
+
- Only imported when animation is needed (tree-shakeable)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { Text as RNText } from "react-native"
|
|
3
|
+
import Animated from "react-native-reanimated"
|
|
4
|
+
|
|
5
|
+
import { textVariants } from "../F0Text/F0Text.styles"
|
|
6
|
+
|
|
7
|
+
import type { AnimatedF0TextProps } from "./AnimatedF0Text.types"
|
|
8
|
+
|
|
9
|
+
const AnimatedText = Animated.createAnimatedComponent(RNText)
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* AnimatedF0Text - Animated text primitive with semantic typography variants
|
|
13
|
+
*
|
|
14
|
+
* Uses Reanimated's Animated.Text under the hood while sharing the same
|
|
15
|
+
* typography system as F0Text. Supports `entering`, `exiting`, `layout`
|
|
16
|
+
* animations and animated `style` props.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <AnimatedF0Text variant="heading-xl" entering={FadeIn.duration(300)}>
|
|
20
|
+
* Welcome back
|
|
21
|
+
* </AnimatedF0Text>
|
|
22
|
+
*/
|
|
23
|
+
const AnimatedF0TextComponent = React.forwardRef<
|
|
24
|
+
React.ComponentRef<typeof AnimatedText>,
|
|
25
|
+
AnimatedF0TextProps
|
|
26
|
+
>(
|
|
27
|
+
(
|
|
28
|
+
{
|
|
29
|
+
variant = "body-sm-default",
|
|
30
|
+
color = "default",
|
|
31
|
+
align = "left",
|
|
32
|
+
decoration = "none",
|
|
33
|
+
transform = "none",
|
|
34
|
+
children,
|
|
35
|
+
numberOfLines,
|
|
36
|
+
style,
|
|
37
|
+
...rest
|
|
38
|
+
},
|
|
39
|
+
ref
|
|
40
|
+
) => {
|
|
41
|
+
const textClassName = React.useMemo(
|
|
42
|
+
() =>
|
|
43
|
+
textVariants({
|
|
44
|
+
variant,
|
|
45
|
+
color,
|
|
46
|
+
align,
|
|
47
|
+
decoration,
|
|
48
|
+
transform,
|
|
49
|
+
}),
|
|
50
|
+
[variant, color, align, decoration, transform]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<AnimatedText
|
|
55
|
+
ref={ref}
|
|
56
|
+
{...rest}
|
|
57
|
+
className={textClassName}
|
|
58
|
+
style={style}
|
|
59
|
+
numberOfLines={numberOfLines}
|
|
60
|
+
ellipsizeMode={numberOfLines ? "tail" : undefined}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
</AnimatedText>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
AnimatedF0TextComponent.displayName = "AnimatedF0Text"
|
|
69
|
+
|
|
70
|
+
export const AnimatedF0Text = React.memo(AnimatedF0TextComponent)
|
|
71
|
+
|
|
72
|
+
export type { AnimatedF0TextProps }
|