@flipova/foundation 1.14.0 → 2.0.5

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 (268) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/README.md +53 -178
  3. package/components/ui/accordion/ANIMATION_CUSTOMIZATION.md +162 -0
  4. package/components/ui/accordion/AccordionAnimatedHeight.tsx +56 -0
  5. package/components/ui/accordion/AccordionAnimatedIcon.tsx +41 -0
  6. package/components/ui/accordion/AnimatedHeight.tsx +56 -0
  7. package/components/ui/accordion/AnimatedIcon.tsx +41 -0
  8. package/components/ui/accordion/MIGRATION_SUMMARY.md +250 -0
  9. package/components/ui/accordion/USAGE_EXAMPLE.tsx +179 -0
  10. package/components/ui/accordion/animation-config.ts +32 -0
  11. package/components/ui/accordion/index.tsx +253 -0
  12. package/components/ui/actionsheet/index.tsx +511 -0
  13. package/components/ui/alert/index.tsx +158 -0
  14. package/components/ui/alert-dialog/index.tsx +254 -0
  15. package/components/ui/avatar/index.tsx +139 -0
  16. package/components/ui/badge/index.tsx +163 -0
  17. package/components/ui/bottomsheet/index.tsx +477 -0
  18. package/components/ui/box/index.tsx +19 -0
  19. package/components/ui/box/index.web.tsx +19 -0
  20. package/components/ui/box/styles.tsx +10 -0
  21. package/components/ui/button/index.tsx +264 -0
  22. package/components/ui/calendar/creator.tsx +366 -0
  23. package/components/ui/calendar/index.tsx +462 -0
  24. package/components/ui/calendar/styles.tsx +140 -0
  25. package/components/ui/card/index.tsx +23 -0
  26. package/components/ui/card/index.web.tsx +26 -0
  27. package/components/ui/card/styles.tsx +16 -0
  28. package/components/ui/center/index.tsx +22 -0
  29. package/components/ui/center/index.web.tsx +20 -0
  30. package/components/ui/center/styles.tsx +8 -0
  31. package/components/ui/checkbox/index.tsx +184 -0
  32. package/components/ui/date-time-picker/creator.tsx +109 -0
  33. package/components/ui/date-time-picker/index.tsx +585 -0
  34. package/components/ui/date-time-picker/index.web.tsx +217 -0
  35. package/components/ui/date-time-picker/styles.tsx +56 -0
  36. package/components/ui/divider/index.tsx +40 -0
  37. package/components/ui/drawer/index.tsx +362 -0
  38. package/components/ui/fab/index.tsx +215 -0
  39. package/components/ui/flat-list/index.tsx +21 -0
  40. package/components/ui/form-control/index.tsx +352 -0
  41. package/components/ui/gluestack-ui-provider/config.ts +72 -0
  42. package/components/ui/gluestack-ui-provider/index.tsx +47 -0
  43. package/components/ui/gluestack-ui-provider/index.web.tsx +96 -0
  44. package/components/ui/gluestack-ui-provider/script.ts +19 -0
  45. package/components/ui/gluestack-ui-provider/tokens.d.ts +17 -0
  46. package/components/ui/gluestack-ui-provider/tokens.js +188 -0
  47. package/components/ui/gluestack-ui-provider/useGluestackColors.ts +82 -0
  48. package/components/ui/grid/index.tsx +283 -0
  49. package/components/ui/grid/index.web.tsx +66 -0
  50. package/components/ui/grid/styles.tsx +15 -0
  51. package/components/ui/heading/index.tsx +220 -0
  52. package/components/ui/heading/index.web.tsx +202 -0
  53. package/components/ui/heading/styles.tsx +43 -0
  54. package/components/ui/hstack/index.tsx +27 -0
  55. package/components/ui/hstack/index.web.tsx +26 -0
  56. package/components/ui/hstack/styles.tsx +25 -0
  57. package/components/ui/icon/index.tsx +1588 -0
  58. package/components/ui/icon/index.web.tsx +1573 -0
  59. package/components/ui/image/index.tsx +48 -0
  60. package/components/ui/image-background/index.tsx +25 -0
  61. package/components/ui/image-viewer/index.tsx +743 -0
  62. package/components/ui/image-viewer/index.web.tsx +302 -0
  63. package/components/ui/index.ts +58 -0
  64. package/components/ui/input/index.tsx +125 -0
  65. package/components/ui/input-accessory-view/index.tsx +2 -0
  66. package/components/ui/keyboard-avoiding-view/index.tsx +2 -0
  67. package/components/ui/link/index.tsx +102 -0
  68. package/components/ui/liquid-glass/index.tsx +74 -0
  69. package/components/ui/menu/index.tsx +186 -0
  70. package/components/ui/modal/index.tsx +237 -0
  71. package/components/ui/popover/index.tsx +272 -0
  72. package/components/ui/portal/index.tsx +17 -0
  73. package/components/ui/pressable/index.tsx +39 -0
  74. package/components/ui/progress/index.tsx +83 -0
  75. package/components/ui/radio/index.tsx +217 -0
  76. package/components/ui/refresh-control/index.tsx +2 -0
  77. package/components/ui/safe-area-view/index.tsx +2 -0
  78. package/components/ui/scroll-view/index.tsx +2 -0
  79. package/components/ui/section-list/index.tsx +2 -0
  80. package/components/ui/select/index.tsx +277 -0
  81. package/components/ui/select/select-actionsheet.tsx +562 -0
  82. package/components/ui/skeleton/index.tsx +105 -0
  83. package/components/ui/skeleton/index.web.tsx +103 -0
  84. package/components/ui/skeleton/styles.tsx +35 -0
  85. package/components/ui/slider/index.tsx +181 -0
  86. package/components/ui/spinner/index.tsx +40 -0
  87. package/components/ui/status-bar/index.tsx +2 -0
  88. package/components/ui/switch/index.tsx +41 -0
  89. package/components/ui/table/index.tsx +210 -0
  90. package/components/ui/table/index.web.tsx +157 -0
  91. package/components/ui/table/styles.tsx +44 -0
  92. package/components/ui/tabs/TabsAnimatedIndicator.tsx +160 -0
  93. package/components/ui/tabs/animation-config.ts +3 -0
  94. package/components/ui/tabs/creator.tsx +206 -0
  95. package/components/ui/tabs/index.tsx +484 -0
  96. package/components/ui/text/index.tsx +48 -0
  97. package/components/ui/text/index.web.tsx +45 -0
  98. package/components/ui/text/styles.tsx +47 -0
  99. package/components/ui/textarea/index.tsx +94 -0
  100. package/components/ui/toast/index.tsx +252 -0
  101. package/components/ui/tooltip/index.tsx +131 -0
  102. package/components/ui/view/index.tsx +2 -0
  103. package/components/ui/virtualized-list/index.tsx +2 -0
  104. package/components/ui/vstack/index.tsx +28 -0
  105. package/components/ui/vstack/index.web.tsx +27 -0
  106. package/components/ui/vstack/styles.tsx +25 -0
  107. package/design/canonical.index.txt +53 -0
  108. package/design/documentation.xml +519 -0
  109. package/design/manifest.xml +90 -0
  110. package/design/schema.xsd +639 -0
  111. package/design/themes.xml +204 -0
  112. package/design/tokens.xml +510 -0
  113. package/design/tools/design.js +165 -0
  114. package/design/tools/npm.js +65 -0
  115. package/design/tools/requirements.txt +35 -0
  116. package/design/tools/sources/.checker/__init__.py +81 -0
  117. package/design/tools/sources/.checker/checks.py +198 -0
  118. package/design/tools/sources/.checker/cli.py +154 -0
  119. package/design/tools/sources/.checker/io.py +242 -0
  120. package/design/tools/sources/.checker/model.py +144 -0
  121. package/design/tools/sources/.checker/registry.py +115 -0
  122. package/design/tools/sources/.checker/report.py +21 -0
  123. package/design/tools/sources/.docgen/__init__.py +45 -0
  124. package/design/tools/sources/.docgen/cli.py +101 -0
  125. package/design/tools/sources/.docgen/model.py +147 -0
  126. package/design/tools/sources/.docgen/reference.py +97 -0
  127. package/design/tools/sources/.docgen/site.py +145 -0
  128. package/design/tools/sources/.docgen/xsddoc.py +329 -0
  129. package/design/tools/sources/.generate/__init__.py +35 -0
  130. package/design/tools/sources/.generate/cli.py +76 -0
  131. package/design/tools/sources/.generate/common.py +33 -0
  132. package/design/tools/sources/.generate/config.py +119 -0
  133. package/design/tools/sources/.generate/model.py +51 -0
  134. package/design/tools/sources/.generate/tokens.py +141 -0
  135. package/design/tools/sources/.linter/__init__.py +9 -0
  136. package/design/tools/sources/.linter/cli.py +44 -0
  137. package/design/tools/sources/.linter/discovery.py +30 -0
  138. package/design/tools/sources/.linter/errors.py +45 -0
  139. package/design/tools/sources/.linter/linter.py +68 -0
  140. package/design/tools/sources/.xmleditor/__init__.py +74 -0
  141. package/design/tools/sources/.xmleditor/blocks.py +185 -0
  142. package/design/tools/sources/.xmleditor/cli.py +141 -0
  143. package/design/tools/sources/.xmleditor/editor.py +906 -0
  144. package/design/tools/sources/.xmleditor/model.py +708 -0
  145. package/design/tools/sources/.xmleditor/widgets.py +1832 -0
  146. package/design/tools/sources/.xmleditor/xsdmodel.py +753 -0
  147. package/design/tools/sources/checker.py +55 -0
  148. package/design/tools/sources/docgen.py +66 -0
  149. package/design/tools/sources/generate.py +48 -0
  150. package/design/tools/sources/linter.py +54 -0
  151. package/design/tools/sources/ruff.toml +12 -0
  152. package/design/tools/sources/xmleditor.py +62 -0
  153. package/design/tools/unix/_venv_python.sh +16 -0
  154. package/design/tools/unix/check.sh +13 -0
  155. package/design/tools/unix/doc.sh +14 -0
  156. package/design/tools/unix/gen.sh +14 -0
  157. package/design/tools/unix/lint.sh +10 -0
  158. package/design/tools/unix/run.sh +20 -0
  159. package/design/tools/unix/verify.sh +12 -0
  160. package/design/tools/unix/xmledit.sh +12 -0
  161. package/design/tools/windows/check.cmd +12 -0
  162. package/design/tools/windows/doc.cmd +12 -0
  163. package/design/tools/windows/gen.cmd +11 -0
  164. package/design/tools/windows/lint.cmd +9 -0
  165. package/design/tools/windows/run.cmd +26 -0
  166. package/design/tools/windows/verify.cmd +10 -0
  167. package/design/tools/windows/xmledit.cmd +10 -0
  168. package/dist/chunk-LV4UIEQN.js +9730 -0
  169. package/dist/chunk-LV4UIEQN.js.map +1 -0
  170. package/dist/chunk-WNVU3BM2.mjs +9401 -0
  171. package/dist/chunk-WNVU3BM2.mjs.map +1 -0
  172. package/dist/index.d.mts +40 -10
  173. package/dist/index.d.ts +40 -10
  174. package/dist/index.js +726 -414
  175. package/dist/index.mjs +1 -5
  176. package/dist/ui/index.d.mts +6931 -3070
  177. package/dist/ui/index.d.ts +6931 -3070
  178. package/dist/ui/index.js +779 -352
  179. package/dist/ui/index.mjs +1 -2
  180. package/package.json +66 -149
  181. package/dist/chunk-2XORADW6.js +0 -24552
  182. package/dist/chunk-2XORADW6.js.map +0 -1
  183. package/dist/chunk-52BHHF5M.js +0 -46
  184. package/dist/chunk-52BHHF5M.js.map +0 -1
  185. package/dist/chunk-5647JY7Z.mjs +0 -100
  186. package/dist/chunk-5647JY7Z.mjs.map +0 -1
  187. package/dist/chunk-5N5HC4ZA.mjs +0 -3
  188. package/dist/chunk-5N5HC4ZA.mjs.map +0 -1
  189. package/dist/chunk-7QFZMGL6.js +0 -8583
  190. package/dist/chunk-7QFZMGL6.js.map +0 -1
  191. package/dist/chunk-ASZEP37D.js +0 -423
  192. package/dist/chunk-ASZEP37D.js.map +0 -1
  193. package/dist/chunk-BH5SU2JQ.mjs +0 -8282
  194. package/dist/chunk-BH5SU2JQ.mjs.map +0 -1
  195. package/dist/chunk-BO65GO53.mjs +0 -422
  196. package/dist/chunk-BO65GO53.mjs.map +0 -1
  197. package/dist/chunk-BSVXX52E.mjs +0 -413
  198. package/dist/chunk-BSVXX52E.mjs.map +0 -1
  199. package/dist/chunk-DNV5UBNF.mjs +0 -3
  200. package/dist/chunk-DNV5UBNF.mjs.map +0 -1
  201. package/dist/chunk-EDTAMUO2.js +0 -8310
  202. package/dist/chunk-EDTAMUO2.js.map +0 -1
  203. package/dist/chunk-IJTI6EX4.js +0 -4
  204. package/dist/chunk-IJTI6EX4.js.map +0 -1
  205. package/dist/chunk-M3YLASM2.js +0 -428
  206. package/dist/chunk-M3YLASM2.js.map +0 -1
  207. package/dist/chunk-OXKOGLXE.js +0 -4
  208. package/dist/chunk-OXKOGLXE.js.map +0 -1
  209. package/dist/chunk-RQXQK3ZO.mjs +0 -8486
  210. package/dist/chunk-RQXQK3ZO.mjs.map +0 -1
  211. package/dist/chunk-SR25V4EA.mjs +0 -40
  212. package/dist/chunk-SR25V4EA.mjs.map +0 -1
  213. package/dist/chunk-UB34WFEQ.js +0 -106
  214. package/dist/chunk-UB34WFEQ.js.map +0 -1
  215. package/dist/chunk-ZBRWXKDF.mjs +0 -24431
  216. package/dist/chunk-ZBRWXKDF.mjs.map +0 -1
  217. package/dist/cli/ds.d.mts +0 -1
  218. package/dist/cli/ds.d.ts +0 -1
  219. package/dist/cli/ds.js +0 -602
  220. package/dist/cli/ds.js.map +0 -1
  221. package/dist/cli/ds.mjs +0 -579
  222. package/dist/cli/ds.mjs.map +0 -1
  223. package/dist/cli/flipova.d.mts +0 -1
  224. package/dist/cli/flipova.d.ts +0 -1
  225. package/dist/cli/flipova.js +0 -161
  226. package/dist/cli/flipova.js.map +0 -1
  227. package/dist/cli/flipova.mjs +0 -154
  228. package/dist/cli/flipova.mjs.map +0 -1
  229. package/dist/config/index.d.mts +0 -123
  230. package/dist/config/index.d.ts +0 -123
  231. package/dist/config/index.js +0 -28
  232. package/dist/config/index.js.map +0 -1
  233. package/dist/config/index.mjs +0 -3
  234. package/dist/config/index.mjs.map +0 -1
  235. package/dist/createTheme-DQeX3s0I.d.mts +0 -78
  236. package/dist/createTheme-Y4jfz4-u.d.ts +0 -78
  237. package/dist/index-CuaJA3gM.d.mts +0 -78
  238. package/dist/index-CuaJA3gM.d.ts +0 -78
  239. package/dist/registry/index.d.mts +0 -10160
  240. package/dist/registry/index.d.ts +0 -10160
  241. package/dist/registry/index.js +0 -392
  242. package/dist/registry/index.js.map +0 -1
  243. package/dist/registry/index.mjs +0 -3
  244. package/dist/registry/index.mjs.map +0 -1
  245. package/dist/theme/index.d.mts +0 -35
  246. package/dist/theme/index.d.ts +0 -35
  247. package/dist/theme/index.js +0 -28
  248. package/dist/theme/index.js.map +0 -1
  249. package/dist/theme/index.mjs +0 -3
  250. package/dist/theme/index.mjs.map +0 -1
  251. package/dist/tokens/index.d.mts +0 -423
  252. package/dist/tokens/index.d.ts +0 -423
  253. package/dist/tokens/index.js +0 -44
  254. package/dist/tokens/index.js.map +0 -1
  255. package/dist/tokens/index.mjs +0 -3
  256. package/dist/tokens/index.mjs.map +0 -1
  257. package/dist/types/index.d.mts +0 -202
  258. package/dist/types/index.d.ts +0 -202
  259. package/dist/types/index.js +0 -4
  260. package/dist/types/index.js.map +0 -1
  261. package/dist/types/index.mjs +0 -3
  262. package/dist/types/index.mjs.map +0 -1
  263. package/dist/web/index.d.mts +0 -316
  264. package/dist/web/index.d.ts +0 -316
  265. package/dist/web/index.js +0 -1500
  266. package/dist/web/index.js.map +0 -1
  267. package/dist/web/index.mjs +0 -1396
  268. package/dist/web/index.mjs.map +0 -1
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import { gridStyle, gridItemStyle } from './styles';
3
+
4
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
5
+
6
+ type IGridProps = React.ComponentPropsWithoutRef<'div'> &
7
+ VariantProps<typeof gridStyle> & {
8
+ gap?: number;
9
+ rowGap?: number;
10
+ columnGap?: number;
11
+ flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
12
+ padding?: number;
13
+ paddingLeft?: number;
14
+ paddingRight?: number;
15
+ paddingStart?: number;
16
+ paddingEnd?: number;
17
+ _extra: {
18
+ className: string;
19
+ };
20
+ };
21
+
22
+ const Grid = React.forwardRef<HTMLDivElement, IGridProps>(function Grid(
23
+ { className, _extra, ...props },
24
+ ref
25
+ ) {
26
+ const gridClass = _extra?.className;
27
+ const finalGridClass = gridClass ?? '';
28
+ return (
29
+ <div
30
+ ref={ref}
31
+ className={gridStyle({
32
+ class: className + ' ' + finalGridClass,
33
+ })}
34
+ {...props}
35
+ />
36
+ );
37
+ });
38
+
39
+ type IGridItemProps = React.ComponentPropsWithoutRef<'div'> &
40
+ VariantProps<typeof gridItemStyle> & {
41
+ index?: number;
42
+ _extra: {
43
+ className: string;
44
+ };
45
+ };
46
+ const GridItem = React.forwardRef<HTMLDivElement, IGridItemProps>(
47
+ function GridItem({ className, _extra, ...props }, ref) {
48
+ const gridItemClass = _extra?.className;
49
+
50
+ const finalGridItemClass = gridItemClass ?? '';
51
+ return (
52
+ <div
53
+ ref={ref}
54
+ className={gridItemStyle({
55
+ class: className + ' ' + finalGridItemClass,
56
+ })}
57
+ {...props}
58
+ />
59
+ );
60
+ }
61
+ );
62
+
63
+ Grid.displayName = 'Grid';
64
+ GridItem.displayName = 'GridItem';
65
+
66
+ export { Grid, GridItem };
@@ -0,0 +1,15 @@
1
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
2
+ import { isWeb } from '@gluestack-ui/utils/nativewind-utils';
3
+
4
+ const gridBaseStyle = isWeb
5
+ ? 'grid grid-cols-12'
6
+ : 'box-border flex-row flex-wrap justify-start';
7
+ const gridItemBaseStyle = isWeb ? 'w-auto col-span-1' : '';
8
+
9
+ export const gridStyle = tva({
10
+ base: `w-full ${gridBaseStyle}`,
11
+ });
12
+
13
+ export const gridItemStyle = tva({
14
+ base: `w-full ${gridItemBaseStyle}`,
15
+ });
@@ -0,0 +1,220 @@
1
+ import React, { forwardRef, memo } from 'react';
2
+ import { H1, H2, H3, H4, H5, H6 } from '@expo/html-elements';
3
+ import { headingStyle } from './styles';
4
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
5
+ import { cssInterop } from 'nativewind';
6
+
7
+ type IHeadingProps = VariantProps<typeof headingStyle> &
8
+ React.ComponentPropsWithoutRef<typeof H1> & {
9
+ as?: React.ElementType;
10
+ };
11
+
12
+ cssInterop(H1, { className: 'style' });
13
+ cssInterop(H2, { className: 'style' });
14
+ cssInterop(H3, { className: 'style' });
15
+ cssInterop(H4, { className: 'style' });
16
+ cssInterop(H5, { className: 'style' });
17
+ cssInterop(H6, { className: 'style' });
18
+
19
+ const MappedHeading = memo(
20
+ forwardRef<React.ComponentRef<typeof H1>, IHeadingProps>(
21
+ function MappedHeading(
22
+ {
23
+ size,
24
+ className,
25
+ isTruncated,
26
+ bold,
27
+ underline,
28
+ strikeThrough,
29
+ sub,
30
+ italic,
31
+ highlight,
32
+ ...props
33
+ },
34
+ ref
35
+ ) {
36
+ switch (size) {
37
+ case '5xl':
38
+ case '4xl':
39
+ case '3xl':
40
+ return (
41
+ <H1
42
+ className={headingStyle({
43
+ size,
44
+ isTruncated: isTruncated as boolean,
45
+ bold: bold as boolean,
46
+ underline: underline as boolean,
47
+ strikeThrough: strikeThrough as boolean,
48
+ sub: sub as boolean,
49
+ italic: italic as boolean,
50
+ highlight: highlight as boolean,
51
+ class: className,
52
+ })}
53
+ {...props}
54
+ // @ts-expect-error : type issue
55
+ ref={ref}
56
+ />
57
+ );
58
+ case '2xl':
59
+ return (
60
+ <H2
61
+ className={headingStyle({
62
+ size,
63
+ isTruncated: isTruncated as boolean,
64
+ bold: bold as boolean,
65
+ underline: underline as boolean,
66
+ strikeThrough: strikeThrough as boolean,
67
+ sub: sub as boolean,
68
+ italic: italic as boolean,
69
+ highlight: highlight as boolean,
70
+ class: className,
71
+ })}
72
+ {...props}
73
+ // @ts-expect-error : type issue
74
+ ref={ref}
75
+ />
76
+ );
77
+ case 'xl':
78
+ return (
79
+ <H3
80
+ className={headingStyle({
81
+ size,
82
+ isTruncated: isTruncated as boolean,
83
+ bold: bold as boolean,
84
+ underline: underline as boolean,
85
+ strikeThrough: strikeThrough as boolean,
86
+ sub: sub as boolean,
87
+ italic: italic as boolean,
88
+ highlight: highlight as boolean,
89
+ class: className,
90
+ })}
91
+ {...props}
92
+ // @ts-expect-error : type issue
93
+ ref={ref}
94
+ />
95
+ );
96
+ case 'lg':
97
+ return (
98
+ <H4
99
+ className={headingStyle({
100
+ size,
101
+ isTruncated: isTruncated as boolean,
102
+ bold: bold as boolean,
103
+ underline: underline as boolean,
104
+ strikeThrough: strikeThrough as boolean,
105
+ sub: sub as boolean,
106
+ italic: italic as boolean,
107
+ highlight: highlight as boolean,
108
+ class: className,
109
+ })}
110
+ {...props}
111
+ // @ts-expect-error : type issue
112
+ ref={ref}
113
+ />
114
+ );
115
+ case 'md':
116
+ return (
117
+ <H5
118
+ className={headingStyle({
119
+ size,
120
+ isTruncated: isTruncated as boolean,
121
+ bold: bold as boolean,
122
+ underline: underline as boolean,
123
+ strikeThrough: strikeThrough as boolean,
124
+ sub: sub as boolean,
125
+ italic: italic as boolean,
126
+ highlight: highlight as boolean,
127
+ class: className,
128
+ })}
129
+ {...props}
130
+ // @ts-expect-error : type issue
131
+ ref={ref}
132
+ />
133
+ );
134
+ case 'sm':
135
+ case 'xs':
136
+ return (
137
+ <H6
138
+ className={headingStyle({
139
+ size,
140
+ isTruncated: isTruncated as boolean,
141
+ bold: bold as boolean,
142
+ underline: underline as boolean,
143
+ strikeThrough: strikeThrough as boolean,
144
+ sub: sub as boolean,
145
+ italic: italic as boolean,
146
+ highlight: highlight as boolean,
147
+ class: className,
148
+ })}
149
+ {...props}
150
+ // @ts-expect-error : type issue
151
+ ref={ref}
152
+ />
153
+ );
154
+ default:
155
+ return (
156
+ <H4
157
+ className={headingStyle({
158
+ size,
159
+ isTruncated: isTruncated as boolean,
160
+ bold: bold as boolean,
161
+ underline: underline as boolean,
162
+ strikeThrough: strikeThrough as boolean,
163
+ sub: sub as boolean,
164
+ italic: italic as boolean,
165
+ highlight: highlight as boolean,
166
+ class: className,
167
+ })}
168
+ {...props}
169
+ // @ts-expect-error : type issue
170
+ ref={ref}
171
+ />
172
+ );
173
+ }
174
+ }
175
+ )
176
+ );
177
+
178
+ const Heading = memo(
179
+ forwardRef<React.ComponentRef<typeof H1>, IHeadingProps>(function Heading(
180
+ { className, size = 'lg', as: AsComp, ...props },
181
+ ref
182
+ ) {
183
+ const {
184
+ isTruncated,
185
+ bold,
186
+ underline,
187
+ strikeThrough,
188
+ sub,
189
+ italic,
190
+ highlight,
191
+ } = props;
192
+
193
+ if (AsComp) {
194
+ return (
195
+ <AsComp
196
+ className={headingStyle({
197
+ size,
198
+ isTruncated: isTruncated as boolean,
199
+ bold: bold as boolean,
200
+ underline: underline as boolean,
201
+ strikeThrough: strikeThrough as boolean,
202
+ sub: sub as boolean,
203
+ italic: italic as boolean,
204
+ highlight: highlight as boolean,
205
+ class: className,
206
+ })}
207
+ {...props}
208
+ />
209
+ );
210
+ }
211
+
212
+ return (
213
+ <MappedHeading className={className} size={size} ref={ref} {...props} />
214
+ );
215
+ })
216
+ );
217
+
218
+ Heading.displayName = 'Heading';
219
+
220
+ export { Heading };
@@ -0,0 +1,202 @@
1
+ import React, { forwardRef, memo } from 'react';
2
+ import { headingStyle } from './styles';
3
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
4
+ type IHeadingProps = VariantProps<typeof headingStyle> &
5
+ React.ComponentPropsWithoutRef<'h1'> & {
6
+ as?: React.ElementType;
7
+ };
8
+
9
+ const MappedHeading = memo(
10
+ forwardRef<HTMLHeadingElement, IHeadingProps>(function MappedHeading(
11
+ {
12
+ size,
13
+ className,
14
+ isTruncated,
15
+ bold,
16
+ underline,
17
+ strikeThrough,
18
+ sub,
19
+ italic,
20
+ highlight,
21
+ ...props
22
+ },
23
+ ref
24
+ ) {
25
+ switch (size) {
26
+ case '5xl':
27
+ case '4xl':
28
+ case '3xl':
29
+ return (
30
+ <h1
31
+ className={headingStyle({
32
+ size,
33
+ isTruncated: isTruncated as boolean,
34
+ bold: bold as boolean,
35
+ underline: underline as boolean,
36
+ strikeThrough: strikeThrough as boolean,
37
+ sub: sub as boolean,
38
+ italic: italic as boolean,
39
+ highlight: highlight as boolean,
40
+ class: className,
41
+ })}
42
+ {...props}
43
+ ref={ref}
44
+ />
45
+ );
46
+ case '2xl':
47
+ return (
48
+ <h2
49
+ className={headingStyle({
50
+ size,
51
+ isTruncated: isTruncated as boolean,
52
+ bold: bold as boolean,
53
+ underline: underline as boolean,
54
+ strikeThrough: strikeThrough as boolean,
55
+ sub: sub as boolean,
56
+ italic: italic as boolean,
57
+ highlight: highlight as boolean,
58
+ class: className,
59
+ })}
60
+ {...props}
61
+ ref={ref}
62
+ />
63
+ );
64
+ case 'xl':
65
+ return (
66
+ <h3
67
+ className={headingStyle({
68
+ size,
69
+ isTruncated: isTruncated as boolean,
70
+ bold: bold as boolean,
71
+ underline: underline as boolean,
72
+ strikeThrough: strikeThrough as boolean,
73
+ sub: sub as boolean,
74
+ italic: italic as boolean,
75
+ highlight: highlight as boolean,
76
+ class: className,
77
+ })}
78
+ {...props}
79
+ ref={ref}
80
+ />
81
+ );
82
+ case 'lg':
83
+ return (
84
+ <h4
85
+ className={headingStyle({
86
+ size,
87
+ isTruncated: isTruncated as boolean,
88
+ bold: bold as boolean,
89
+ underline: underline as boolean,
90
+ strikeThrough: strikeThrough as boolean,
91
+ sub: sub as boolean,
92
+ italic: italic as boolean,
93
+ highlight: highlight as boolean,
94
+ class: className,
95
+ })}
96
+ {...props}
97
+ ref={ref}
98
+ />
99
+ );
100
+ case 'md':
101
+ return (
102
+ <h5
103
+ className={headingStyle({
104
+ size,
105
+ isTruncated: isTruncated as boolean,
106
+ bold: bold as boolean,
107
+ underline: underline as boolean,
108
+ strikeThrough: strikeThrough as boolean,
109
+ sub: sub as boolean,
110
+ italic: italic as boolean,
111
+ highlight: highlight as boolean,
112
+ class: className,
113
+ })}
114
+ {...props}
115
+ ref={ref}
116
+ />
117
+ );
118
+ case 'sm':
119
+ case 'xs':
120
+ return (
121
+ <h6
122
+ className={headingStyle({
123
+ size,
124
+ isTruncated: isTruncated as boolean,
125
+ bold: bold as boolean,
126
+ underline: underline as boolean,
127
+ strikeThrough: strikeThrough as boolean,
128
+ sub: sub as boolean,
129
+ italic: italic as boolean,
130
+ highlight: highlight as boolean,
131
+ class: className,
132
+ })}
133
+ {...props}
134
+ ref={ref}
135
+ />
136
+ );
137
+ default:
138
+ return (
139
+ <h4
140
+ className={headingStyle({
141
+ size,
142
+ isTruncated: isTruncated as boolean,
143
+ bold: bold as boolean,
144
+ underline: underline as boolean,
145
+ strikeThrough: strikeThrough as boolean,
146
+ sub: sub as boolean,
147
+ italic: italic as boolean,
148
+ highlight: highlight as boolean,
149
+ class: className,
150
+ })}
151
+ {...props}
152
+ ref={ref}
153
+ />
154
+ );
155
+ }
156
+ })
157
+ );
158
+
159
+ const Heading = memo(
160
+ forwardRef<HTMLHeadingElement, IHeadingProps>(function Heading(
161
+ { className, size = 'lg', as: AsComp, ...props },
162
+ ref
163
+ ) {
164
+ const {
165
+ isTruncated,
166
+ bold,
167
+ underline,
168
+ strikeThrough,
169
+ sub,
170
+ italic,
171
+ highlight,
172
+ } = props;
173
+
174
+ if (AsComp) {
175
+ return (
176
+ <AsComp
177
+ className={headingStyle({
178
+ size,
179
+ isTruncated: isTruncated as boolean,
180
+ bold: bold as boolean,
181
+ underline: underline as boolean,
182
+ strikeThrough: strikeThrough as boolean,
183
+ sub: sub as boolean,
184
+ italic: italic as boolean,
185
+ highlight: highlight as boolean,
186
+ class: className,
187
+ })}
188
+ {...props}
189
+ ref={ref}
190
+ />
191
+ );
192
+ }
193
+
194
+ return (
195
+ <MappedHeading className={className} size={size} ref={ref} {...props} />
196
+ );
197
+ })
198
+ );
199
+
200
+ Heading.displayName = 'Heading';
201
+
202
+ export { Heading };
@@ -0,0 +1,43 @@
1
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
2
+ import { isWeb } from '@gluestack-ui/utils/nativewind-utils';
3
+ const baseStyle = isWeb
4
+ ? 'font-sans tracking-sm bg-transparent border-0 box-border display-inline list-none margin-0 padding-0 position-relative text-start no-underline whitespace-pre-wrap word-wrap-break-word'
5
+ : '';
6
+
7
+ export const headingStyle = tva({
8
+ base: `text-foreground font-bold font-heading tracking-sm my-0 ${baseStyle}`,
9
+ variants: {
10
+ isTruncated: {
11
+ true: 'truncate',
12
+ },
13
+ bold: {
14
+ true: 'font-bold',
15
+ },
16
+ underline: {
17
+ true: 'underline',
18
+ },
19
+ strikeThrough: {
20
+ true: 'line-through',
21
+ },
22
+ sub: {
23
+ true: 'text-xs',
24
+ },
25
+ italic: {
26
+ true: 'italic',
27
+ },
28
+ highlight: {
29
+ true: 'bg-yellow-500',
30
+ },
31
+ size: {
32
+ '5xl': 'text-6xl',
33
+ '4xl': 'text-5xl',
34
+ '3xl': 'text-4xl',
35
+ '2xl': 'text-3xl',
36
+ 'xl': 'text-2xl',
37
+ 'lg': 'text-xl',
38
+ 'md': 'text-lg',
39
+ 'sm': 'text-base',
40
+ 'xs': 'text-sm',
41
+ },
42
+ },
43
+ });
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
3
+ import { View } from 'react-native';
4
+ import type { ViewProps } from 'react-native';
5
+ import { hstackStyle } from './styles';
6
+
7
+ type IHStackProps = ViewProps & VariantProps<typeof hstackStyle>;
8
+
9
+ const HStack = React.forwardRef<React.ComponentRef<typeof View>, IHStackProps>(
10
+ function HStack({ className, space, reversed, ...props }, ref) {
11
+ return (
12
+ <View
13
+ className={hstackStyle({
14
+ space,
15
+ reversed: reversed as boolean,
16
+ class: className,
17
+ })}
18
+ {...props}
19
+ ref={ref}
20
+ />
21
+ );
22
+ }
23
+ );
24
+
25
+ HStack.displayName = 'HStack';
26
+
27
+ export { HStack };
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
3
+ import { hstackStyle } from './styles';
4
+
5
+ type IHStackProps = React.ComponentPropsWithoutRef<'div'> &
6
+ VariantProps<typeof hstackStyle>;
7
+
8
+ const HStack = React.forwardRef<React.ComponentRef<'div'>, IHStackProps>(
9
+ function HStack({ className, space, reversed, ...props }, ref) {
10
+ return (
11
+ <div
12
+ className={hstackStyle({
13
+ space,
14
+ reversed: reversed as boolean,
15
+ class: className,
16
+ })}
17
+ {...props}
18
+ ref={ref}
19
+ />
20
+ );
21
+ }
22
+ );
23
+
24
+ HStack.displayName = 'HStack';
25
+
26
+ export { HStack };
@@ -0,0 +1,25 @@
1
+ import { isWeb } from '@gluestack-ui/utils/nativewind-utils';
2
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
3
+
4
+ const baseStyle = isWeb
5
+ ? 'flex relative z-0 box-border border-0 list-none min-w-0 min-h-0 bg-transparent items-stretch m-0 p-0 text-decoration-none'
6
+ : '';
7
+
8
+ export const hstackStyle = tva({
9
+ base: `flex-row ${baseStyle}`,
10
+ variants: {
11
+ space: {
12
+ 'xs': 'gap-1',
13
+ 'sm': 'gap-2',
14
+ 'md': 'gap-3',
15
+ 'lg': 'gap-4',
16
+ 'xl': 'gap-5',
17
+ '2xl': 'gap-6',
18
+ '3xl': 'gap-7',
19
+ '4xl': 'gap-8',
20
+ },
21
+ reversed: {
22
+ true: 'flex-row-reverse',
23
+ },
24
+ },
25
+ });