@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,484 @@
1
+ 'use client';
2
+ import React, { useEffect, useRef, useCallback, useMemo } from 'react';
3
+ import { createTabs, TabsContext } from './creator';
4
+ import { PrimitiveIcon, UIIcon } from '@gluestack-ui/core/icon/creator';
5
+ import {
6
+ tva,
7
+ withStyleContext,
8
+ useStyleContext,
9
+ type VariantProps,
10
+ } from '@gluestack-ui/utils/nativewind-utils';
11
+ import { cssInterop } from 'nativewind';
12
+ import { Pressable, Text, View, FlatList, Platform } from 'react-native';
13
+ import Animated, {
14
+ useAnimatedStyle,
15
+ useSharedValue,
16
+ withSpring,
17
+ useAnimatedScrollHandler,
18
+ runOnJS,
19
+ } from 'react-native-reanimated';
20
+ import { TabsAnimatedIndicator } from './TabsAnimatedIndicator';
21
+
22
+ const SCOPE = 'TABS';
23
+ const AnimatedView = Animated.createAnimatedComponent(View);
24
+ const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
25
+ Platform.OS === 'web' ? cssInterop(AnimatedView,{className:{target:'style'}}) : AnimatedView
26
+ /** Styles */
27
+
28
+ const tabsStyle = tva({
29
+ base: 'w-full gap-1',
30
+ });
31
+
32
+ const tabsListStyle = tva({
33
+ base: 'flex relative z-10 bg-muted p-1 rounded-lg',
34
+ variants: {
35
+ orientation: {
36
+ horizontal: 'flex-row',
37
+ vertical: 'flex-col',
38
+ },
39
+ },
40
+ });
41
+
42
+ const tabsTriggerStyle = tva({
43
+ base: 'justify-center relative z-30 items-center web:outline-none data-[disabled=true]:opacity-40 data-[focus-visible=true]:web:ring-2 data-[focus-visible=true]:web:ring-primary/20 px-3 py-1.5 flex-row gap-1',
44
+ parentVariants: {
45
+ variant: {
46
+ underlined: '',
47
+ filled: 'rounded-lg',
48
+ },
49
+ },
50
+ });
51
+
52
+ const tabsTriggerTextStyle = tva({
53
+ base: 'text-foreground/70 data-[selected=true]:text-foreground font-medium data-[hover=true]:text-foreground/90 ',
54
+
55
+ });
56
+
57
+ const tabsTriggerIconStyle = tva({
58
+ base: 'h-4 w-4 fill-none pointer-events-none shrink-0 text-foreground/70 data-[selected=true]:text-foreground',
59
+
60
+ });
61
+
62
+ const tabsContentStyle = tva({
63
+ base: 'p-2 h-auto',
64
+ });
65
+
66
+ const tabsContentWrapperStyle = tva({
67
+ base: 'overflow-hidden rounded-lg',
68
+ });
69
+
70
+ const tabsIndicatorStyle = tva({
71
+ base: 'pointer-events-none',
72
+ parentVariants: {
73
+ variant: {
74
+ underlined: 'border-b border-primary',
75
+ filled: 'bg-background z-20 rounded-lg',
76
+ },
77
+ },
78
+ });
79
+
80
+ /** Creator */
81
+
82
+ const Root = withStyleContext(View, SCOPE);
83
+
84
+ const UITabs = createTabs({
85
+ Root,
86
+ List: View,
87
+ Trigger: Pressable,
88
+ Content: View,
89
+ ContentWrapper: AnimatedView,
90
+ TriggerText: Text,
91
+ TriggerIcon: UIIcon,
92
+ Indicator: View,
93
+ });
94
+
95
+ cssInterop(PrimitiveIcon, {
96
+ className: {
97
+ target: 'style',
98
+ nativeStyleToProp: {
99
+ height: true,
100
+ width: true,
101
+ fill: true,
102
+ color: 'classNameColor',
103
+ stroke: true,
104
+ } as any,
105
+ },
106
+ });
107
+
108
+ /** Type definitions */
109
+
110
+ type ITabsProps = React.ComponentPropsWithoutRef<typeof UITabs> &
111
+ VariantProps<typeof tabsStyle> & {
112
+ variant?: 'underlined' | 'filled';
113
+
114
+ };
115
+
116
+ type ITabsListProps = React.ComponentPropsWithoutRef<typeof UITabs.List>;
117
+
118
+ type ITabsTriggerProps = React.ComponentPropsWithoutRef<typeof UITabs.Trigger>;
119
+
120
+ type ITabsContentProps = React.ComponentPropsWithoutRef<typeof UITabs.Content>;
121
+
122
+ type ITabsContentWrapperProps = React.ComponentPropsWithoutRef<
123
+ typeof UITabs.ContentWrapper
124
+ >;
125
+
126
+ type ITabsTriggerTextProps = React.ComponentPropsWithoutRef<
127
+ typeof UITabs.TriggerText
128
+ >;
129
+
130
+ type ITabsTriggerIconProps = React.ComponentPropsWithoutRef<
131
+ typeof UITabs.TriggerIcon
132
+ > & {
133
+ as?: React.ElementType;
134
+ };
135
+
136
+ type ITabsIndicatorProps = React.ComponentPropsWithoutRef<
137
+ typeof UITabs.Indicator
138
+ >;
139
+
140
+ /** Components */
141
+
142
+ const Tabs = React.forwardRef<React.ComponentRef<typeof UITabs>, ITabsProps>(
143
+ ({ className, variant = 'filled', ...props }, ref) => {
144
+ return (
145
+ <UITabs
146
+ ref={ref}
147
+ {...props}
148
+ className={tabsStyle({ class: className })}
149
+ // @ts-ignore - pass variants to context
150
+ context={{ variant}}
151
+ />
152
+ );
153
+ }
154
+ );
155
+
156
+ const TabsList = React.forwardRef<
157
+ React.ComponentRef<typeof UITabs.List>,
158
+ ITabsListProps
159
+ >(({ className, children, ...props }, ref) => {
160
+ const context = React.useContext(TabsContext);
161
+
162
+ const flatListRef = useRef<any>(null);
163
+
164
+ if (!context) return null;
165
+
166
+ const { orientation, setScrollOffset, selectedKey, listRef } = context;
167
+
168
+ // Shared value for indicator sync
169
+ const animatedScrollOffset = useSharedValue(0);
170
+
171
+ /**
172
+ * Expose shared value to context
173
+ */
174
+ useEffect(() => {
175
+ if (context) {
176
+ // @ts-ignore
177
+ context.animatedScrollOffset = animatedScrollOffset;
178
+ }
179
+ }, [context, animatedScrollOffset]);
180
+
181
+ /**
182
+ * Auto scroll to selected tab
183
+ */
184
+ useEffect(() => {
185
+ if (orientation !== 'horizontal' || !selectedKey) return;
186
+
187
+ const childArray = React.Children.toArray(children);
188
+ const triggers = childArray.filter(
189
+ (child: any) => child?.type?.displayName !== 'TabsIndicator'
190
+ );
191
+
192
+ const selectedIndex = triggers.findIndex(
193
+ (child: any) => child?.props?.value === selectedKey
194
+ );
195
+
196
+ if (selectedIndex >= 0 && flatListRef.current) {
197
+ const timer = setTimeout(() => {
198
+ try {
199
+ flatListRef.current.scrollToIndex({
200
+ index: selectedIndex,
201
+ animated: true,
202
+ viewPosition: 0.5,
203
+ });
204
+ } catch {}
205
+ }, 100);
206
+
207
+ return () => clearTimeout(timer);
208
+ }
209
+ }, [selectedKey, orientation, children]);
210
+
211
+ /**
212
+ * Native animated scroll handler (ONLY for iOS / Android)
213
+ */
214
+ const nativeScrollHandler =
215
+ Platform.OS === 'web'
216
+ ? undefined
217
+ : useAnimatedScrollHandler({
218
+ onScroll: (event) => {
219
+ 'worklet';
220
+ const x = event.contentOffset.x;
221
+ animatedScrollOffset.value = x;
222
+ runOnJS(setScrollOffset)(x);
223
+ },
224
+ });
225
+
226
+ /**
227
+ * Web scroll handler (JS thread)
228
+ */
229
+ const handleWebScroll = (e: any) => {
230
+ const x = e.nativeEvent.contentOffset.x;
231
+ animatedScrollOffset.value = x;
232
+ setScrollOffset(x);
233
+ };
234
+
235
+ /**
236
+ * Horizontal tabs → FlatList
237
+ */
238
+ // Memoize the split so FlatList's `data` prop stays referentially stable
239
+ // across scroll-driven re-renders (scrollOffset in context ticks on every
240
+ // scroll event; without this, FlatList re-renders every cell every frame,
241
+ // firing onLayout → measureTrigger on every scroll tick).
242
+ const { triggers, indicator } = useMemo(() => {
243
+ const childArray = React.Children.toArray(children);
244
+ return {
245
+ triggers: childArray.filter(
246
+ (child: any) => child?.type?.displayName !== 'TabsIndicator'
247
+ ),
248
+ indicator: childArray.find(
249
+ (child: any) => child?.type?.displayName === 'TabsIndicator'
250
+ ),
251
+ };
252
+ }, [children]);
253
+
254
+ if (orientation === 'horizontal') {
255
+ return (
256
+ <View
257
+ ref={listRef}
258
+ className={tabsListStyle({ orientation, class: className })}
259
+ >
260
+ {indicator}
261
+
262
+ <AnimatedFlatList
263
+ ref={flatListRef}
264
+ horizontal
265
+ data={triggers}
266
+ renderItem={({ item }) => item as any}
267
+ keyExtractor={(item: any, index) =>
268
+ item?.props?.value ?? `tab-${index}`
269
+ }
270
+ showsHorizontalScrollIndicator={false}
271
+ scrollEventThrottle={16}
272
+ style={{ zIndex: 100 }}
273
+ onScroll={
274
+ Platform.OS === 'web' ? handleWebScroll : nativeScrollHandler
275
+ }
276
+ onScrollToIndexFailed={(info) => {
277
+ setTimeout(() => {
278
+ try {
279
+ flatListRef.current?.scrollToIndex({
280
+ index: info.index,
281
+ animated: false,
282
+ viewPosition: 0.5,
283
+ });
284
+ } catch {}
285
+ }, 500);
286
+ }}
287
+ {...props}
288
+ />
289
+ </View>
290
+ );
291
+ }
292
+
293
+ /**
294
+ * Vertical tabs → default List
295
+ */
296
+ return (
297
+ <UITabs.List
298
+ ref={ref}
299
+ {...props}
300
+ className={tabsListStyle({ orientation, class: className })}
301
+ >
302
+ {children}
303
+ </UITabs.List>
304
+ );
305
+ });
306
+
307
+
308
+ const TabsTrigger = React.forwardRef<
309
+ React.ComponentRef<typeof UITabs.Trigger>,
310
+ ITabsTriggerProps
311
+ >(({ className, ...props }, ref) => {
312
+ const { variant } = useStyleContext(SCOPE);
313
+
314
+ return (
315
+ <UITabs.Trigger
316
+ ref={ref}
317
+ {...props}
318
+ className={tabsTriggerStyle({
319
+ parentVariants: { variant },
320
+ class: className,
321
+ })}
322
+ />
323
+ );
324
+ });
325
+
326
+ const TabsContent = React.forwardRef<
327
+ React.ComponentRef<typeof UITabs.Content>,
328
+ ITabsContentProps
329
+ >(({ className, ...props }, ref) => {
330
+ return (
331
+ <UITabs.Content
332
+ ref={ref}
333
+ {...props}
334
+ className={tabsContentStyle({ class: className })}
335
+ />
336
+ );
337
+ });
338
+
339
+ const TabsContentWrapper = React.forwardRef<
340
+ React.ComponentRef<typeof UITabs.ContentWrapper>,
341
+ ITabsContentWrapperProps
342
+ >(({ className, targetHeight, ...props }: any, ref) => {
343
+ const context = React.useContext(TabsContext);
344
+
345
+ // Get the height of the selected content from the layouts Map
346
+ const selectedLayout = context?.selectedKey
347
+ ? context.contentLayouts.get(context.selectedKey)
348
+ : null;
349
+ const height = selectedLayout?.height || 0;
350
+
351
+ // Use shared value for Reanimated with initial height
352
+ const heightValue = useSharedValue(height);
353
+ const isFirstRender = React.useRef(true);
354
+
355
+ // Update shared value when height changes
356
+ React.useEffect(() => {
357
+ if (height > 0) {
358
+ if (isFirstRender.current) {
359
+ // Set initial height without animation
360
+ heightValue.value = height;
361
+ isFirstRender.current = false;
362
+ } else {
363
+ // Animate height changes
364
+ heightValue.value = withSpring(height,{duration:100});
365
+ }
366
+ }
367
+ }, [height, heightValue]);
368
+
369
+ // Animated style for height transitions
370
+ const animatedStyle = useAnimatedStyle(() => {
371
+ return {
372
+ height: heightValue.value > 0 ? heightValue.value : 'auto',
373
+ };
374
+ }, []);
375
+
376
+ return (
377
+ <UITabs.ContentWrapper
378
+ ref={ref}
379
+ style={animatedStyle}
380
+ {...props}
381
+ className={tabsContentWrapperStyle({ class: className })}
382
+ />
383
+ );
384
+ });
385
+
386
+ const TabsTriggerText = React.forwardRef<
387
+ React.ComponentRef<typeof UITabs.TriggerText>,
388
+ ITabsTriggerTextProps
389
+ >(({ className, ...props }, ref) => {
390
+
391
+
392
+ return (
393
+ <UITabs.TriggerText
394
+ ref={ref}
395
+ {...props}
396
+ className={tabsTriggerTextStyle({
397
+
398
+ class: className,
399
+ })}
400
+ />
401
+ );
402
+ });
403
+
404
+ const TabsTriggerIcon = React.forwardRef<
405
+ React.ComponentRef<typeof UITabs.TriggerIcon>,
406
+ ITabsTriggerIconProps
407
+ >(({ className, ...props }, ref) => {
408
+ const { variant } = useStyleContext(SCOPE);
409
+
410
+ // Remove `dataSet` ONLY on web to avoid React DOM warning
411
+ const safeProps =
412
+ Platform.OS === 'web'
413
+ ? (() => {
414
+ const { dataSet, ...rest } = props as any;
415
+ return rest;
416
+ })()
417
+ : props;
418
+
419
+ return (
420
+ <UITabs.TriggerIcon
421
+ ref={ref}
422
+ {...safeProps}
423
+ className={tabsTriggerIconStyle({
424
+ parentVariants: { variant },
425
+ class: className,
426
+ })}
427
+ />
428
+ );
429
+ });
430
+
431
+
432
+ const TabsIndicator = React.forwardRef<
433
+ React.ComponentRef<typeof UITabs.Indicator>,
434
+ ITabsIndicatorProps
435
+ >(({ className, ...props }, ref) => {
436
+ const context = React.useContext(TabsContext);
437
+
438
+ const { variant } = useStyleContext(SCOPE);
439
+
440
+ if (!context) {
441
+ return null;
442
+ }
443
+
444
+ const { selectedKey, orientation, triggerLayouts, scrollOffset } = context;
445
+ // @ts-ignore - Get animated scroll offset from context
446
+ const animatedScrollOffset = context.animatedScrollOffset;
447
+
448
+ return (
449
+ <TabsAnimatedIndicator
450
+ ref={ref}
451
+ selectedKey={selectedKey}
452
+ orientation={orientation}
453
+ triggerLayouts={triggerLayouts}
454
+ scrollOffset={scrollOffset}
455
+ animatedScrollOffset={animatedScrollOffset}
456
+ className={tabsIndicatorStyle({
457
+ parentVariants: { variant },
458
+ class: className,
459
+ })}
460
+ {...props}
461
+ />
462
+ );
463
+ });
464
+
465
+
466
+ Tabs.displayName = 'Tabs';
467
+ TabsList.displayName = 'TabsList';
468
+ TabsTrigger.displayName = 'TabsTrigger';
469
+ TabsContent.displayName = 'TabsContent';
470
+ TabsContentWrapper.displayName = 'TabsContentWrapper';
471
+ TabsTriggerText.displayName = 'TabsTriggerText';
472
+ TabsTriggerIcon.displayName = 'TabsTriggerIcon';
473
+ TabsIndicator.displayName = 'TabsIndicator'
474
+
475
+ export {
476
+ Tabs,
477
+ TabsList,
478
+ TabsTrigger,
479
+ TabsContent,
480
+ TabsContentWrapper,
481
+ TabsTriggerText,
482
+ TabsTriggerIcon,
483
+ TabsIndicator,
484
+ };
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+
3
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
4
+ import { Text as RNText } from 'react-native';
5
+ import { textStyle } from './styles';
6
+
7
+ type ITextProps = React.ComponentProps<typeof RNText> &
8
+ VariantProps<typeof textStyle>;
9
+
10
+ const Text = React.forwardRef<React.ComponentRef<typeof RNText>, ITextProps>(
11
+ function Text(
12
+ {
13
+ className,
14
+ isTruncated,
15
+ bold,
16
+ underline,
17
+ strikeThrough,
18
+ size = 'md',
19
+ sub,
20
+ italic,
21
+ highlight,
22
+ ...props
23
+ },
24
+ ref
25
+ ) {
26
+ return (
27
+ <RNText
28
+ className={textStyle({
29
+ isTruncated: isTruncated as boolean,
30
+ bold: bold as boolean,
31
+ underline: underline as boolean,
32
+ strikeThrough: strikeThrough as boolean,
33
+ size,
34
+ sub: sub as boolean,
35
+ italic: italic as boolean,
36
+ highlight: highlight as boolean,
37
+ class: className,
38
+ })}
39
+ {...props}
40
+ ref={ref}
41
+ />
42
+ );
43
+ }
44
+ );
45
+
46
+ Text.displayName = 'Text';
47
+
48
+ export { Text };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
3
+ import { textStyle } from './styles';
4
+
5
+ type ITextProps = React.ComponentProps<'span'> & VariantProps<typeof textStyle>;
6
+
7
+ const Text = React.forwardRef<React.ComponentRef<'span'>, ITextProps>(
8
+ function Text(
9
+ {
10
+ className,
11
+ isTruncated,
12
+ bold,
13
+ underline,
14
+ strikeThrough,
15
+ size = 'md',
16
+ sub,
17
+ italic,
18
+ highlight,
19
+ ...props
20
+ }: { className?: string } & ITextProps,
21
+ ref
22
+ ) {
23
+ return (
24
+ <span
25
+ className={textStyle({
26
+ isTruncated: isTruncated as boolean,
27
+ bold: bold as boolean,
28
+ underline: underline as boolean,
29
+ strikeThrough: strikeThrough as boolean,
30
+ size,
31
+ sub: sub as boolean,
32
+ italic: italic as boolean,
33
+ highlight: highlight as boolean,
34
+ class: className,
35
+ })}
36
+ {...props}
37
+ ref={ref}
38
+ />
39
+ );
40
+ }
41
+ );
42
+
43
+ Text.displayName = 'Text';
44
+
45
+ export { Text };
@@ -0,0 +1,47 @@
1
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
2
+ import { isWeb } from '@gluestack-ui/utils/nativewind-utils';
3
+
4
+ const baseStyle = isWeb
5
+ ? 'font-sans tracking-sm my-0 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'
6
+ : '';
7
+
8
+ export const textStyle = tva({
9
+ base: `text-foreground font-body ${baseStyle}`,
10
+
11
+ variants: {
12
+ isTruncated: {
13
+ true: 'web:truncate',
14
+ },
15
+ bold: {
16
+ true: 'font-bold',
17
+ },
18
+ underline: {
19
+ true: 'underline',
20
+ },
21
+ strikeThrough: {
22
+ true: 'line-through',
23
+ },
24
+ size: {
25
+ '2xs': 'text-2xs',
26
+ 'xs': 'text-xs',
27
+ 'sm': 'text-sm',
28
+ 'md': 'text-base',
29
+ 'lg': 'text-lg',
30
+ 'xl': 'text-xl',
31
+ '2xl': 'text-2xl',
32
+ '3xl': 'text-3xl',
33
+ '4xl': 'text-4xl',
34
+ '5xl': 'text-5xl',
35
+ '6xl': 'text-6xl',
36
+ },
37
+ sub: {
38
+ true: 'text-xs',
39
+ },
40
+ italic: {
41
+ true: 'italic',
42
+ },
43
+ highlight: {
44
+ true: 'bg-yellow-500',
45
+ },
46
+ },
47
+ });
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { createTextarea } from '@gluestack-ui/core/textarea/creator';
4
+ import { View, TextInput } from 'react-native';
5
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
6
+ import {
7
+ withStyleContext,
8
+ useStyleContext,
9
+ } from '@gluestack-ui/utils/nativewind-utils';
10
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
11
+
12
+ const SCOPE = 'TEXTAREA';
13
+ const UITextarea = createTextarea({
14
+ Root: withStyleContext(View, SCOPE),
15
+ Input: TextInput,
16
+ });
17
+
18
+ const textareaStyle = tva({
19
+ base: 'w-full h-[100px] border border-border dark:bg-input/30 rounded data-[hover=true]:border-border/80 data-[focus=true]:border-primary/80 data-[focus=true]:data-[hover=true]:border-primary/80 data-[disabled=true]:opacity-40 data-[disabled=true]:bg-background/90 data-[disabled=true]:data-[hover=true]:border-border/80',
20
+
21
+ variants: {
22
+ variant: {
23
+ default:
24
+ 'data-[focus=true]:border-primary/80 data-[focus=true]:web:ring-1 data-[focus=true]:web:ring-inset data-[focus=true]:web:ring-indicator-primary data-[invalid=true]:border-destructive data-[invalid=true]:web:ring-1 data-[invalid=true]:web:ring-inset data-[invalid=true]:web:ring-indicator-error data-[invalid=true]:data-[hover=true]:border-destructive data-[invalid=true]:data-[focus=true]:data-[hover=true]:border-primary/80 data-[invalid=true]:data-[focus=true]:data-[hover=true]:web:ring-1 data-[invalid=true]:data-[focus=true]:data-[hover=true]:web:ring-inset data-[invalid=true]:data-[focus=true]:data-[hover=true]:web:ring-indicator-primary data-[invalid=true]:data-[disabled=true]:data-[hover=true]:border-destructive data-[invalid=true]:data-[disabled=true]:data-[hover=true]:web:ring-1 data-[invalid=true]:data-[disabled=true]:data-[hover=true]:web:ring-inset data-[invalid=true]:data-[disabled=true]:data-[hover=true]:web:ring-indicator-error ',
25
+ },
26
+ size: {
27
+ sm: '',
28
+ md: '',
29
+ lg: '',
30
+ xl: '',
31
+ },
32
+ },
33
+ });
34
+
35
+ const textareaInputStyle = tva({
36
+ base: 'p-2 web:outline-0 web:outline-none flex-1 text-foreground placeholder:text-foreground/60 web:cursor-text web:data-[disabled=true]:cursor-not-allowed',
37
+ parentVariants: {
38
+ size: {
39
+ sm: 'text-sm',
40
+ md: 'text-base',
41
+ lg: 'text-lg',
42
+ xl: 'text-xl',
43
+ },
44
+ },
45
+ });
46
+
47
+ type ITextareaProps = React.ComponentProps<typeof UITextarea> &
48
+ VariantProps<typeof textareaStyle>;
49
+
50
+ const Textarea = React.forwardRef<
51
+ React.ComponentRef<typeof UITextarea>,
52
+ ITextareaProps
53
+ >(function Textarea(
54
+ { className, variant = 'default', size = 'md', ...props },
55
+ ref
56
+ ) {
57
+ return (
58
+ <UITextarea
59
+ ref={ref}
60
+ {...props}
61
+ className={textareaStyle({ variant, class: className })}
62
+ context={{ size }}
63
+ />
64
+ );
65
+ });
66
+
67
+ type ITextareaInputProps = React.ComponentProps<typeof UITextarea.Input> &
68
+ VariantProps<typeof textareaInputStyle>;
69
+
70
+ const TextareaInput = React.forwardRef<
71
+ React.ComponentRef<typeof UITextarea.Input>,
72
+ ITextareaInputProps
73
+ >(function TextareaInput({ className, ...props }, ref) {
74
+ const { size: parentSize } = useStyleContext(SCOPE);
75
+
76
+ return (
77
+ <UITextarea.Input
78
+ ref={ref}
79
+ {...props}
80
+ textAlignVertical="top"
81
+ className={textareaInputStyle({
82
+ parentVariants: {
83
+ size: parentSize,
84
+ },
85
+ class: className,
86
+ })}
87
+ />
88
+ );
89
+ });
90
+
91
+ Textarea.displayName = 'Textarea';
92
+ TextareaInput.displayName = 'TextareaInput';
93
+
94
+ export { Textarea, TextareaInput };