@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.
Files changed (68) hide show
  1. package/README.md +2 -2
  2. package/lib/module/components/exports.js +1 -1
  3. package/lib/module/components/exports.js.map +1 -1
  4. package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.js +2 -0
  5. package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.js.map +1 -0
  6. package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.md +159 -0
  7. package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.js +2 -0
  8. package/lib/module/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.js.map +1 -0
  9. package/lib/module/components/primitives/F0Text/AnimatedF0Text/index.js +2 -0
  10. package/lib/module/components/primitives/F0Text/AnimatedF0Text/index.js.map +1 -0
  11. package/lib/module/components/primitives/F0Text/F0Text/F0Text.js +2 -0
  12. package/lib/module/components/primitives/F0Text/F0Text/F0Text.js.map +1 -0
  13. package/lib/module/components/primitives/F0Text/F0Text/F0Text.md +320 -0
  14. package/lib/module/components/primitives/F0Text/F0Text/F0Text.styles.js +2 -0
  15. package/lib/module/components/primitives/F0Text/F0Text/F0Text.styles.js.map +1 -0
  16. package/lib/module/components/primitives/F0Text/F0Text/F0Text.types.js +2 -0
  17. package/lib/module/components/primitives/F0Text/F0Text/F0Text.types.js.map +1 -0
  18. package/lib/module/components/primitives/F0Text/F0Text/index.js +2 -0
  19. package/lib/module/components/primitives/F0Text/F0Text/index.js.map +1 -0
  20. package/lib/module/components/primitives/F0Text/index.js +2 -0
  21. package/lib/module/components/primitives/F0Text/index.js.map +1 -0
  22. package/lib/module/index.js +1 -1
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/lib/utils.js +1 -1
  25. package/lib/module/lib/utils.js.map +1 -1
  26. package/lib/module/styles/theme.css +7 -0
  27. package/lib/typescript/components/exports.d.ts +1 -0
  28. package/lib/typescript/components/exports.d.ts.map +1 -1
  29. package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.d.ts +5 -0
  30. package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.d.ts.map +1 -0
  31. package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.d.ts +45 -0
  32. package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.d.ts.map +1 -0
  33. package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/index.d.ts +8 -0
  34. package/lib/typescript/components/primitives/F0Text/AnimatedF0Text/index.d.ts.map +1 -0
  35. package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.d.ts +8 -0
  36. package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.d.ts.map +1 -0
  37. package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.styles.d.ts +144 -0
  38. package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.styles.d.ts.map +1 -0
  39. package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.types.d.ts +86 -0
  40. package/lib/typescript/components/primitives/F0Text/F0Text/F0Text.types.d.ts.map +1 -0
  41. package/lib/typescript/components/primitives/F0Text/F0Text/index.d.ts +9 -0
  42. package/lib/typescript/components/primitives/F0Text/F0Text/index.d.ts.map +1 -0
  43. package/lib/typescript/components/primitives/F0Text/index.d.ts +12 -0
  44. package/lib/typescript/components/primitives/F0Text/index.d.ts.map +1 -0
  45. package/lib/typescript/index.d.ts +1 -1
  46. package/lib/typescript/index.d.ts.map +1 -1
  47. package/lib/typescript/lib/utils.d.ts +9 -0
  48. package/lib/typescript/lib/utils.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/components/exports.ts +3 -0
  51. package/src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.md +159 -0
  52. package/src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.tsx +72 -0
  53. package/src/components/primitives/F0Text/AnimatedF0Text/AnimatedF0Text.types.ts +61 -0
  54. package/src/components/primitives/F0Text/AnimatedF0Text/__tests__/AnimatedF0Text.spec.tsx +131 -0
  55. package/src/components/primitives/F0Text/AnimatedF0Text/__tests__/__snapshots__/AnimatedF0Text.spec.tsx.snap +144 -0
  56. package/src/components/primitives/F0Text/AnimatedF0Text/index.ts +8 -0
  57. package/src/components/primitives/F0Text/F0Text/F0Text.md +320 -0
  58. package/src/components/primitives/F0Text/F0Text/F0Text.styles.ts +71 -0
  59. package/src/components/primitives/F0Text/F0Text/F0Text.tsx +76 -0
  60. package/src/components/primitives/F0Text/F0Text/F0Text.types.ts +134 -0
  61. package/src/components/primitives/F0Text/F0Text/__tests__/F0Text.spec.tsx +228 -0
  62. package/src/components/primitives/F0Text/F0Text/__tests__/__snapshots__/F0Text.spec.tsx.snap +325 -0
  63. package/src/components/primitives/F0Text/F0Text/index.ts +22 -0
  64. package/src/components/primitives/F0Text/index.ts +26 -0
  65. package/src/index.ts +1 -1
  66. package/src/lib/__tests__/utils.spec.ts +48 -0
  67. package/src/lib/utils.ts +19 -0
  68. package/src/styles/theme.css +7 -0
@@ -0,0 +1,325 @@
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
+
3
+ exports[`F0Text Snapshots renders all color variants: color-accent 1`] = `
4
+ <Text
5
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-accent text-left"
6
+ >
7
+ accent
8
+ text
9
+ </Text>
10
+ `;
11
+
12
+ exports[`F0Text Snapshots renders all color variants: color-critical 1`] = `
13
+ <Text
14
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-critical text-left"
15
+ >
16
+ critical
17
+ text
18
+ </Text>
19
+ `;
20
+
21
+ exports[`F0Text Snapshots renders all color variants: color-default 1`] = `
22
+ <Text
23
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
24
+ >
25
+ default
26
+ text
27
+ </Text>
28
+ `;
29
+
30
+ exports[`F0Text Snapshots renders all color variants: color-disabled 1`] = `
31
+ <Text
32
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-disabled text-left"
33
+ >
34
+ disabled
35
+ text
36
+ </Text>
37
+ `;
38
+
39
+ exports[`F0Text Snapshots renders all color variants: color-info 1`] = `
40
+ <Text
41
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-info text-left"
42
+ >
43
+ info
44
+ text
45
+ </Text>
46
+ `;
47
+
48
+ exports[`F0Text Snapshots renders all color variants: color-inverse 1`] = `
49
+ <Text
50
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-inverse text-left"
51
+ >
52
+ inverse
53
+ text
54
+ </Text>
55
+ `;
56
+
57
+ exports[`F0Text Snapshots renders all color variants: color-inverse-secondary 1`] = `
58
+ <Text
59
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-inverse-secondary text-left"
60
+ >
61
+ inverse-secondary
62
+ text
63
+ </Text>
64
+ `;
65
+
66
+ exports[`F0Text Snapshots renders all color variants: color-positive 1`] = `
67
+ <Text
68
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-positive text-left"
69
+ >
70
+ positive
71
+ text
72
+ </Text>
73
+ `;
74
+
75
+ exports[`F0Text Snapshots renders all color variants: color-secondary 1`] = `
76
+ <Text
77
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-secondary text-left"
78
+ >
79
+ secondary
80
+ text
81
+ </Text>
82
+ `;
83
+
84
+ exports[`F0Text Snapshots renders all color variants: color-selected 1`] = `
85
+ <Text
86
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-selected text-left"
87
+ >
88
+ selected
89
+ text
90
+ </Text>
91
+ `;
92
+
93
+ exports[`F0Text Snapshots renders all color variants: color-tertiary 1`] = `
94
+ <Text
95
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-tertiary text-left"
96
+ >
97
+ tertiary
98
+ text
99
+ </Text>
100
+ `;
101
+
102
+ exports[`F0Text Snapshots renders all color variants: color-warning 1`] = `
103
+ <Text
104
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground-warning text-left"
105
+ >
106
+ warning
107
+ text
108
+ </Text>
109
+ `;
110
+
111
+ exports[`F0Text Snapshots renders all typography variants: variant-body-md-default 1`] = `
112
+ <Text
113
+ className="text-[16px] leading-[24px] font-normal text-f0-foreground text-left"
114
+ >
115
+ body-md-default
116
+ text
117
+ </Text>
118
+ `;
119
+
120
+ exports[`F0Text Snapshots renders all typography variants: variant-body-md-medium 1`] = `
121
+ <Text
122
+ className="text-[16px] leading-[24px] font-medium text-f0-foreground text-left"
123
+ >
124
+ body-md-medium
125
+ text
126
+ </Text>
127
+ `;
128
+
129
+ exports[`F0Text Snapshots renders all typography variants: variant-body-md-semibold 1`] = `
130
+ <Text
131
+ className="text-[16px] leading-[24px] font-semibold text-f0-foreground text-left"
132
+ >
133
+ body-md-semibold
134
+ text
135
+ </Text>
136
+ `;
137
+
138
+ exports[`F0Text Snapshots renders all typography variants: variant-body-sm-default 1`] = `
139
+ <Text
140
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
141
+ >
142
+ body-sm-default
143
+ text
144
+ </Text>
145
+ `;
146
+
147
+ exports[`F0Text Snapshots renders all typography variants: variant-body-sm-medium 1`] = `
148
+ <Text
149
+ className="text-[14px] leading-[20px] font-medium text-f0-foreground text-left"
150
+ >
151
+ body-sm-medium
152
+ text
153
+ </Text>
154
+ `;
155
+
156
+ exports[`F0Text Snapshots renders all typography variants: variant-body-sm-semibold 1`] = `
157
+ <Text
158
+ className="text-[14px] leading-[20px] font-semibold text-f0-foreground text-left"
159
+ >
160
+ body-sm-semibold
161
+ text
162
+ </Text>
163
+ `;
164
+
165
+ exports[`F0Text Snapshots renders all typography variants: variant-body-xs-medium 1`] = `
166
+ <Text
167
+ className="text-[12px] leading-[16px] font-medium text-f0-foreground text-left"
168
+ >
169
+ body-xs-medium
170
+ text
171
+ </Text>
172
+ `;
173
+
174
+ exports[`F0Text Snapshots renders all typography variants: variant-heading-lg 1`] = `
175
+ <Text
176
+ className="text-[24px] leading-[32px] tracking-[-0.2px] font-semibold text-f0-foreground text-left"
177
+ >
178
+ heading-lg
179
+ text
180
+ </Text>
181
+ `;
182
+
183
+ exports[`F0Text Snapshots renders all typography variants: variant-heading-md 1`] = `
184
+ <Text
185
+ className="text-[20px] leading-[28px] tracking-[-0.2px] font-semibold text-f0-foreground text-left"
186
+ >
187
+ heading-md
188
+ text
189
+ </Text>
190
+ `;
191
+
192
+ exports[`F0Text Snapshots renders all typography variants: variant-heading-sm 1`] = `
193
+ <Text
194
+ className="text-[16px] leading-[24px] font-semibold text-f0-foreground text-left"
195
+ >
196
+ heading-sm
197
+ text
198
+ </Text>
199
+ `;
200
+
201
+ exports[`F0Text Snapshots renders all typography variants: variant-heading-xl 1`] = `
202
+ <Text
203
+ className="text-[36px] leading-[40px] tracking-[-0.2px] font-semibold text-f0-foreground text-left"
204
+ >
205
+ heading-xl
206
+ text
207
+ </Text>
208
+ `;
209
+
210
+ exports[`F0Text Snapshots renders with alignment options: align-center 1`] = `
211
+ <Text
212
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-center"
213
+ >
214
+ center
215
+ text
216
+ </Text>
217
+ `;
218
+
219
+ exports[`F0Text Snapshots renders with alignment options: align-justify 1`] = `
220
+ <Text
221
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-justify"
222
+ >
223
+ justify
224
+ text
225
+ </Text>
226
+ `;
227
+
228
+ exports[`F0Text Snapshots renders with alignment options: align-left 1`] = `
229
+ <Text
230
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
231
+ >
232
+ left
233
+ text
234
+ </Text>
235
+ `;
236
+
237
+ exports[`F0Text Snapshots renders with alignment options: align-right 1`] = `
238
+ <Text
239
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-right"
240
+ >
241
+ right
242
+ text
243
+ </Text>
244
+ `;
245
+
246
+ exports[`F0Text Snapshots renders with default variant (body-sm-default) 1`] = `
247
+ <Text
248
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
249
+ >
250
+ Default text
251
+ </Text>
252
+ `;
253
+
254
+ exports[`F0Text Snapshots renders with numberOfLines truncation 1`] = `
255
+ <Text
256
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
257
+ ellipsizeMode="tail"
258
+ numberOfLines={2}
259
+ >
260
+ This is a very long text that should be truncated after two lines with an ellipsis at the end
261
+ </Text>
262
+ `;
263
+
264
+ exports[`F0Text Snapshots renders with text decorations: decoration-line-through 1`] = `
265
+ <Text
266
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left line-through"
267
+ >
268
+ line-through
269
+ text
270
+ </Text>
271
+ `;
272
+
273
+ exports[`F0Text Snapshots renders with text decorations: decoration-none 1`] = `
274
+ <Text
275
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
276
+ >
277
+ none
278
+ text
279
+ </Text>
280
+ `;
281
+
282
+ exports[`F0Text Snapshots renders with text decorations: decoration-underline 1`] = `
283
+ <Text
284
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left underline"
285
+ >
286
+ underline
287
+ text
288
+ </Text>
289
+ `;
290
+
291
+ exports[`F0Text Snapshots renders with text transforms: transform-capitalize 1`] = `
292
+ <Text
293
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left capitalize"
294
+ >
295
+ capitalize
296
+ text
297
+ </Text>
298
+ `;
299
+
300
+ exports[`F0Text Snapshots renders with text transforms: transform-lowercase 1`] = `
301
+ <Text
302
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left lowercase"
303
+ >
304
+ lowercase
305
+ text
306
+ </Text>
307
+ `;
308
+
309
+ exports[`F0Text Snapshots renders with text transforms: transform-none 1`] = `
310
+ <Text
311
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left"
312
+ >
313
+ none
314
+ text
315
+ </Text>
316
+ `;
317
+
318
+ exports[`F0Text Snapshots renders with text transforms: transform-uppercase 1`] = `
319
+ <Text
320
+ className="text-[14px] leading-[20px] font-normal text-f0-foreground text-left uppercase"
321
+ >
322
+ uppercase
323
+ text
324
+ </Text>
325
+ `;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * F0Text - Text primitive component
3
+ *
4
+ * @see F0Text.md for documentation
5
+ */
6
+
7
+ export { F0Text } from "./F0Text"
8
+ export type {
9
+ F0TextProps,
10
+ TypographyVariant,
11
+ TextColor,
12
+ TextAlign,
13
+ TextDecoration,
14
+ TextTransform,
15
+ } from "./F0Text"
16
+ export {
17
+ TYPOGRAPHY_VARIANTS,
18
+ TEXT_COLORS,
19
+ TEXT_ALIGN,
20
+ TEXT_DECORATIONS,
21
+ TEXT_TRANSFORMS,
22
+ } from "./F0Text"
@@ -0,0 +1,26 @@
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
+
8
+ export { F0Text } from "./F0Text"
9
+ export type {
10
+ F0TextProps,
11
+ TypographyVariant,
12
+ TextColor,
13
+ TextAlign,
14
+ TextDecoration,
15
+ TextTransform,
16
+ } from "./F0Text"
17
+ export {
18
+ TYPOGRAPHY_VARIANTS,
19
+ TEXT_COLORS,
20
+ TEXT_ALIGN,
21
+ TEXT_DECORATIONS,
22
+ TEXT_TRANSFORMS,
23
+ } from "./F0Text"
24
+
25
+ export { AnimatedF0Text } from "./AnimatedF0Text"
26
+ export type { AnimatedF0TextProps } from "./AnimatedF0Text"
package/src/index.ts CHANGED
@@ -5,4 +5,4 @@ export * from "./components/exports"
5
5
  export * from "./icons"
6
6
 
7
7
  // Export utilities
8
- export { cn } from "./lib/utils"
8
+ export { cn, omitProps } from "./lib/utils"
@@ -0,0 +1,48 @@
1
+ import { cn, omitProps } from "../utils"
2
+
3
+ describe("utils", () => {
4
+ describe("omitProps", () => {
5
+ it("returns empty object when given empty object", () => {
6
+ expect(omitProps({}, ["style"])).toEqual({})
7
+ })
8
+
9
+ it("returns all props when no keys to omit", () => {
10
+ const props = { a: 1, b: 2, c: 3 }
11
+ expect(omitProps(props, [])).toEqual(props)
12
+ })
13
+
14
+ it("omits single key", () => {
15
+ const props = { a: 1, b: 2, style: { color: "red" } }
16
+ expect(omitProps(props, ["style"])).toEqual({ a: 1, b: 2 })
17
+ })
18
+
19
+ it("omits multiple keys", () => {
20
+ const props = { a: 1, style: { color: "red" }, className: "text-lg" }
21
+ expect(omitProps(props, ["style", "className"])).toEqual({ a: 1 })
22
+ })
23
+
24
+ it("does not mutate original object", () => {
25
+ const props = { a: 1, style: { color: "red" } }
26
+ omitProps(props, ["style"])
27
+ expect(props).toEqual({ a: 1, style: { color: "red" } })
28
+ })
29
+
30
+ it("works with readonly keys array (F0_TEXT_BANNED_PROPS pattern)", () => {
31
+ const BANNED = ["style"] as const
32
+ const props = { a: 1, style: { color: "red" } }
33
+ expect(omitProps(props, BANNED)).toEqual({ a: 1 })
34
+ })
35
+
36
+ it("ignores keys that do not exist", () => {
37
+ const props = { a: 1, b: 2 }
38
+ expect(omitProps(props, ["style", "className"])).toEqual({ a: 1, b: 2 })
39
+ })
40
+ })
41
+
42
+ describe("cn", () => {
43
+ it("merges class names", () => {
44
+ expect(cn("foo", "bar")).toContain("foo")
45
+ expect(cn("foo", "bar")).toContain("bar")
46
+ })
47
+ })
48
+ })
package/src/lib/utils.ts CHANGED
@@ -7,3 +7,22 @@ export function cn(...args: CnOptions): string {
7
7
  }) ?? ""
8
8
  )
9
9
  }
10
+
11
+ /**
12
+ * Omits specified keys from an object at runtime.
13
+ * Used to filter blocked props (e.g. style, className) before spreading to primitives.
14
+ *
15
+ * @example
16
+ * omitProps(rest, ["style"])
17
+ * omitProps(rest, ["style", "className"])
18
+ */
19
+ export function omitProps<T extends Record<string, unknown>, K extends string>(
20
+ obj: T,
21
+ keys: readonly K[]
22
+ ): Omit<T, K> {
23
+ const result = { ...obj }
24
+ for (const key of keys) {
25
+ delete result[key as keyof T]
26
+ }
27
+ return result as Omit<T, K>
28
+ }
@@ -77,6 +77,13 @@
77
77
  --tracking-4xl: -0.02em;
78
78
 
79
79
  /* Semantic Typography Tokens - F0Text Variants */
80
+ /* Heading xl */
81
+ --p-text-heading-xl-font-size: 2.25rem; /* 36px */
82
+ --p-text-heading-xl-font-line-height: 2.5rem; /* 40px */
83
+ --p-text-heading-xl-font-letter-spacing: -0.2px;
84
+ --p-text-heading-xl-font-weight: 600;
85
+ --p-text-heading-xl-font-family: Inter;
86
+
80
87
  /* Heading lg */
81
88
  --p-text-heading-lg-font-size: 1.5rem; /* 24px */
82
89
  --p-text-heading-lg-font-line-height: 2rem; /* 32px */