@flipova/foundation 1.14.0 → 2.0.4

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 +175 -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,511 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { H4 } from '@expo/html-elements';
4
+ import { createActionsheet } from '@gluestack-ui/core/actionsheet/creator';
5
+ import {
6
+ Pressable,
7
+ View,
8
+ Text,
9
+ ScrollView,
10
+ VirtualizedList,
11
+ FlatList,
12
+ SectionList,
13
+ PressableProps,
14
+ ViewStyle,
15
+ } from 'react-native';
16
+ import { UIIcon } from '@gluestack-ui/core/icon/creator';
17
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
18
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
19
+ import { cssInterop } from 'nativewind';
20
+ import {
21
+ Motion,
22
+ AnimatePresence,
23
+ createMotionAnimatedComponent,
24
+ MotionComponentProps,
25
+ } from '@legendapp/motion';
26
+
27
+ const ItemWrapper = React.forwardRef<
28
+ React.ComponentRef<typeof Pressable>,
29
+ PressableProps
30
+ >(function ItemWrapper({ ...props }, ref) {
31
+ return <Pressable {...props} ref={ref} />;
32
+ });
33
+
34
+ type IMotionViewProps = React.ComponentProps<typeof View> &
35
+ MotionComponentProps<typeof View, ViewStyle, unknown, unknown, unknown>;
36
+
37
+ const MotionView = Motion.View as React.ComponentType<IMotionViewProps>;
38
+
39
+ type IAnimatedPressableProps = React.ComponentProps<typeof Pressable> &
40
+ MotionComponentProps<typeof Pressable, ViewStyle, unknown, unknown, unknown>;
41
+
42
+ const AnimatedPressable = createMotionAnimatedComponent(
43
+ Pressable
44
+ ) as React.ComponentType<IAnimatedPressableProps>;
45
+
46
+ export const UIActionsheet = createActionsheet({
47
+ Root: View,
48
+ Content: MotionView,
49
+ Item: ItemWrapper,
50
+ ItemText: Text,
51
+ DragIndicator: View,
52
+ IndicatorWrapper: View,
53
+ Backdrop: AnimatedPressable,
54
+ ScrollView: ScrollView,
55
+ VirtualizedList: VirtualizedList,
56
+ FlatList: FlatList,
57
+ SectionList: SectionList,
58
+ SectionHeaderText: H4,
59
+ Icon: UIIcon,
60
+ AnimatePresence: AnimatePresence,
61
+ });
62
+
63
+ cssInterop(UIActionsheet, { className: 'style' });
64
+ cssInterop(UIActionsheet.Content, { className: 'style' });
65
+ cssInterop(UIActionsheet.Item, { className: 'style' });
66
+ cssInterop(UIActionsheet.ItemText, { className: 'style' });
67
+ cssInterop(UIActionsheet.DragIndicator, { className: 'style' });
68
+ cssInterop(UIActionsheet.DragIndicatorWrapper, { className: 'style' });
69
+ cssInterop(UIActionsheet.Backdrop, { className: 'style' });
70
+ cssInterop(UIActionsheet.ScrollView, {
71
+ className: 'style',
72
+ contentContainerClassName: 'contentContainerStyle',
73
+ indicatorClassName: 'indicatorStyle',
74
+ });
75
+ cssInterop(UIActionsheet.VirtualizedList, {
76
+ className: 'style',
77
+ ListFooterComponentClassName: 'ListFooterComponentStyle',
78
+ ListHeaderComponentClassName: 'ListHeaderComponentStyle',
79
+ contentContainerClassName: 'contentContainerStyle',
80
+ indicatorClassName: 'indicatorStyle',
81
+ });
82
+ cssInterop(UIActionsheet.FlatList, {
83
+ className: 'style',
84
+ ListFooterComponentClassName: 'ListFooterComponentStyle',
85
+ ListHeaderComponentClassName: 'ListHeaderComponentStyle',
86
+ columnWrapperClassName: 'columnWrapperStyle',
87
+ contentContainerClassName: 'contentContainerStyle',
88
+ indicatorClassName: 'indicatorStyle',
89
+ });
90
+ cssInterop(UIActionsheet.SectionList, { className: 'style' });
91
+ cssInterop(UIActionsheet.SectionHeaderText, { className: 'style' });
92
+
93
+ cssInterop(UIIcon, {
94
+ className: {
95
+ target: 'style',
96
+ nativeStyleToProp: {
97
+ height: true,
98
+ width: true,
99
+ fill: true,
100
+ color: 'classNameColor',
101
+ stroke: true,
102
+ } as any,
103
+ },
104
+ });
105
+
106
+ const actionsheetStyle = tva({ base: 'w-full h-full web:pointer-events-none' });
107
+
108
+ const actionsheetContentStyle = tva({
109
+ base: 'items-center rounded-t-lg p-4 bg-background web:pointer-events-auto web:select-none border-t border-border dark:border-border/10 max-h-[80vh] pb-safe',
110
+ });
111
+
112
+ const actionsheetItemStyle = tva({
113
+ base: 'w-full flex-row items-center p-3 rounded-sm data-[disabled=true]:opacity-40 data-[disabled=true]:web:pointer-events-auto data-[disabled=true]:web:cursor-not-allowed data-[hover=true]:bg-accent data-[active=true]:bg-accent data-[focus=true]:bg-accent web:data-[focus-visible=true]:bg-accent gap-2',
114
+ });
115
+
116
+ const actionsheetItemTextStyle = tva({
117
+ base: 'text-foreground font-normal text-sm',
118
+ variants: {
119
+ isTruncated: {
120
+ true: '',
121
+ },
122
+ bold: {
123
+ true: 'font-bold',
124
+ },
125
+ underline: {
126
+ true: 'underline',
127
+ },
128
+ strikeThrough: {
129
+ true: 'line-through',
130
+ },
131
+ },
132
+ });
133
+
134
+ const actionsheetDragIndicatorStyle = tva({
135
+ base: 'w-[100px] h-2 bg-muted rounded-full',
136
+ });
137
+
138
+ const actionsheetDragIndicatorWrapperStyle = tva({
139
+ base: 'w-full py-1 items-center',
140
+ });
141
+
142
+ const actionsheetBackdropStyle = tva({
143
+ base: 'absolute left-0 top-0 right-0 bottom-0 bg-black/50 web:cursor-default web:pointer-events-auto',
144
+ });
145
+
146
+ const actionsheetScrollViewStyle = tva({
147
+ base: 'w-full h-auto',
148
+ });
149
+
150
+ const actionsheetVirtualizedListStyle = tva({
151
+ base: 'w-full h-auto',
152
+ });
153
+
154
+ const actionsheetFlatListStyle = tva({
155
+ base: 'w-full h-auto',
156
+ });
157
+
158
+ const actionsheetSectionListStyle = tva({
159
+ base: 'w-full h-auto',
160
+ });
161
+
162
+ const actionsheetSectionHeaderTextStyle = tva({
163
+ base: 'leading-5 font-semibold my-0 text-muted-foreground p-3 uppercase text-xs',
164
+ variants: {
165
+ isTruncated: {
166
+ true: '',
167
+ },
168
+ bold: {
169
+ true: 'font-bold',
170
+ },
171
+ underline: {
172
+ true: 'underline',
173
+ },
174
+ strikeThrough: {
175
+ true: 'line-through',
176
+ },
177
+ sub: {
178
+ true: 'text-xs',
179
+ },
180
+ italic: {
181
+ true: 'italic',
182
+ },
183
+ highlight: {
184
+ true: 'bg-yellow-500',
185
+ },
186
+ },
187
+ });
188
+
189
+ const actionsheetIconStyle = tva({
190
+ base: 'text-foreground fill-none h-4 w-4',
191
+ });
192
+
193
+ type IActionsheetProps = VariantProps<typeof actionsheetStyle> &
194
+ React.ComponentPropsWithoutRef<typeof UIActionsheet>;
195
+
196
+ type IActionsheetContentProps = VariantProps<typeof actionsheetContentStyle> &
197
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.Content> & {
198
+ className?: string;
199
+ };
200
+
201
+ type IActionsheetItemProps = VariantProps<typeof actionsheetItemStyle> &
202
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.Item>;
203
+
204
+ type IActionsheetItemTextProps = VariantProps<typeof actionsheetItemTextStyle> &
205
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.ItemText>;
206
+
207
+ type IActionsheetDragIndicatorProps = VariantProps<
208
+ typeof actionsheetDragIndicatorStyle
209
+ > &
210
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.DragIndicator>;
211
+
212
+ type IActionsheetDragIndicatorWrapperProps = VariantProps<
213
+ typeof actionsheetDragIndicatorWrapperStyle
214
+ > &
215
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.DragIndicatorWrapper>;
216
+
217
+ type IActionsheetBackdropProps = VariantProps<typeof actionsheetBackdropStyle> &
218
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.Backdrop> & {
219
+ className?: string;
220
+ };
221
+
222
+ type IActionsheetScrollViewProps = VariantProps<
223
+ typeof actionsheetScrollViewStyle
224
+ > &
225
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.ScrollView>;
226
+
227
+ type IActionsheetVirtualizedListProps = VariantProps<
228
+ typeof actionsheetVirtualizedListStyle
229
+ > &
230
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.VirtualizedList>;
231
+
232
+ type IActionsheetFlatListProps = VariantProps<typeof actionsheetFlatListStyle> &
233
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.FlatList>;
234
+
235
+ type IActionsheetSectionListProps = VariantProps<
236
+ typeof actionsheetSectionListStyle
237
+ > &
238
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.SectionList>;
239
+
240
+ type IActionsheetSectionHeaderTextProps = VariantProps<
241
+ typeof actionsheetSectionHeaderTextStyle
242
+ > &
243
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.SectionHeaderText>;
244
+
245
+ type IActionsheetIconProps = VariantProps<typeof actionsheetIconStyle> &
246
+ React.ComponentPropsWithoutRef<typeof UIActionsheet.Icon> & {
247
+ className?: string;
248
+ as?: React.ElementType;
249
+ height?: number;
250
+ width?: number;
251
+ };
252
+
253
+ const Actionsheet = React.forwardRef<
254
+ React.ComponentRef<typeof UIActionsheet>,
255
+ IActionsheetProps
256
+ >(function Actionsheet({ className, ...props }, ref) {
257
+ return (
258
+ <UIActionsheet
259
+ className={actionsheetStyle({
260
+ class: className,
261
+ })}
262
+ ref={ref}
263
+ {...props}
264
+ />
265
+ );
266
+ });
267
+
268
+ const ActionsheetContent = React.forwardRef<
269
+ React.ComponentRef<typeof UIActionsheet.Content>,
270
+ IActionsheetContentProps
271
+ >(function ActionsheetContent({ className, ...props }, ref) {
272
+ return (
273
+ <UIActionsheet.Content
274
+ className={actionsheetContentStyle({
275
+ class: className,
276
+ })}
277
+ ref={ref}
278
+ {...props}
279
+ />
280
+ );
281
+ });
282
+
283
+ const ActionsheetItem = React.forwardRef<
284
+ React.ComponentRef<typeof UIActionsheet.Item>,
285
+ IActionsheetItemProps
286
+ >(function ActionsheetItem({ className, ...props }, ref) {
287
+ return (
288
+ <UIActionsheet.Item
289
+ className={actionsheetItemStyle({
290
+ class: className,
291
+ })}
292
+ ref={ref}
293
+ {...props}
294
+ />
295
+ );
296
+ });
297
+
298
+ const ActionsheetItemText = React.forwardRef<
299
+ React.ComponentRef<typeof UIActionsheet.ItemText>,
300
+ IActionsheetItemTextProps
301
+ >(function ActionsheetItemText(
302
+ { isTruncated, bold, underline, strikeThrough, className, ...props },
303
+ ref
304
+ ) {
305
+ return (
306
+ <UIActionsheet.ItemText
307
+ className={actionsheetItemTextStyle({
308
+ class: className,
309
+ isTruncated: Boolean(isTruncated),
310
+ bold: Boolean(bold),
311
+ underline: Boolean(underline),
312
+ strikeThrough: Boolean(strikeThrough),
313
+ })}
314
+ ref={ref}
315
+ {...props}
316
+ />
317
+ );
318
+ });
319
+
320
+ const ActionsheetDragIndicator = React.forwardRef<
321
+ React.ComponentRef<typeof UIActionsheet.DragIndicator>,
322
+ IActionsheetDragIndicatorProps
323
+ >(function ActionsheetDragIndicator({ className, ...props }, ref) {
324
+ return (
325
+ <UIActionsheet.DragIndicator
326
+ className={actionsheetDragIndicatorStyle({
327
+ class: className,
328
+ })}
329
+ ref={ref}
330
+ {...props}
331
+ />
332
+ );
333
+ });
334
+
335
+ const ActionsheetDragIndicatorWrapper = React.forwardRef<
336
+ React.ComponentRef<typeof UIActionsheet.DragIndicatorWrapper>,
337
+ IActionsheetDragIndicatorWrapperProps
338
+ >(function ActionsheetDragIndicatorWrapper({ className, ...props }, ref) {
339
+ return (
340
+ <UIActionsheet.DragIndicatorWrapper
341
+ className={actionsheetDragIndicatorWrapperStyle({
342
+ class: className,
343
+ })}
344
+ ref={ref}
345
+ {...props}
346
+ />
347
+ );
348
+ });
349
+
350
+ const ActionsheetBackdrop = React.forwardRef<
351
+ React.ComponentRef<typeof UIActionsheet.Backdrop>,
352
+ IActionsheetBackdropProps
353
+ >(function ActionsheetBackdrop({ className, ...props }, ref) {
354
+ return (
355
+ <UIActionsheet.Backdrop
356
+ initial={{
357
+ opacity: 0,
358
+ }}
359
+ animate={{
360
+ opacity: 1,
361
+ }}
362
+ exit={{
363
+ opacity: 0,
364
+ }}
365
+ transition={{
366
+ type: 'timing',
367
+ duration: 200,
368
+ }}
369
+ {...props}
370
+ className={actionsheetBackdropStyle({
371
+ class: className,
372
+ })}
373
+ ref={ref}
374
+ />
375
+ );
376
+ });
377
+
378
+ const ActionsheetScrollView = React.forwardRef<
379
+ React.ComponentRef<typeof UIActionsheet.ScrollView>,
380
+ IActionsheetScrollViewProps
381
+ >(function ActionsheetScrollView({ className, ...props }, ref) {
382
+ return (
383
+ <UIActionsheet.ScrollView
384
+ className={actionsheetScrollViewStyle({
385
+ class: className,
386
+ })}
387
+ ref={ref}
388
+ {...props}
389
+ />
390
+ );
391
+ });
392
+
393
+ const ActionsheetVirtualizedList = React.forwardRef<
394
+ React.ComponentRef<typeof UIActionsheet.VirtualizedList>,
395
+ IActionsheetVirtualizedListProps
396
+ >(function ActionsheetVirtualizedList({ className, ...props }, ref) {
397
+ return (
398
+ <UIActionsheet.VirtualizedList
399
+ className={actionsheetVirtualizedListStyle({
400
+ class: className,
401
+ })}
402
+ ref={ref}
403
+ {...props}
404
+ />
405
+ );
406
+ });
407
+
408
+ const ActionsheetFlatList = React.forwardRef<
409
+ React.ComponentRef<typeof UIActionsheet.FlatList>,
410
+ IActionsheetFlatListProps
411
+ >(function ActionsheetFlatList({ className, ...props }, ref) {
412
+ return (
413
+ <UIActionsheet.FlatList
414
+ className={actionsheetFlatListStyle({
415
+ class: className,
416
+ })}
417
+ ref={ref}
418
+ {...props}
419
+ />
420
+ );
421
+ });
422
+
423
+ const ActionsheetSectionList = React.forwardRef<
424
+ React.ComponentRef<typeof UIActionsheet.SectionList>,
425
+ IActionsheetSectionListProps
426
+ >(function ActionsheetSectionList({ className, ...props }, ref) {
427
+ return (
428
+ <UIActionsheet.SectionList
429
+ className={actionsheetSectionListStyle({
430
+ class: className,
431
+ })}
432
+ ref={ref}
433
+ {...props}
434
+ />
435
+ );
436
+ });
437
+
438
+ const ActionsheetSectionHeaderText = React.forwardRef<
439
+ React.ComponentRef<typeof UIActionsheet.SectionHeaderText>,
440
+ IActionsheetSectionHeaderTextProps
441
+ >(function ActionsheetSectionHeaderText(
442
+ {
443
+ className,
444
+ isTruncated,
445
+ bold,
446
+ underline,
447
+ strikeThrough,
448
+ sub,
449
+ italic,
450
+ highlight,
451
+ ...props
452
+ },
453
+ ref
454
+ ) {
455
+ return (
456
+ <UIActionsheet.SectionHeaderText
457
+ className={actionsheetSectionHeaderTextStyle({
458
+ class: className,
459
+ isTruncated: Boolean(isTruncated),
460
+ bold: Boolean(bold),
461
+ underline: Boolean(underline),
462
+ strikeThrough: Boolean(strikeThrough),
463
+ sub: Boolean(sub),
464
+ italic: Boolean(italic),
465
+ highlight: Boolean(highlight),
466
+ })}
467
+ ref={ref}
468
+ {...props}
469
+ />
470
+ );
471
+ });
472
+
473
+ const ActionsheetIcon = React.forwardRef<
474
+ React.ComponentRef<typeof UIActionsheet.Icon>,
475
+ IActionsheetIconProps
476
+ >(function ActionsheetIcon({ className, height, width, ...props }, ref) {
477
+ if (typeof height === 'number' || typeof width === 'number') {
478
+ return (
479
+ <UIActionsheet.Icon
480
+ ref={ref}
481
+ {...props}
482
+ height={height}
483
+ width={width}
484
+ className={actionsheetIconStyle({ class: className })}
485
+ />
486
+ );
487
+ }
488
+ return (
489
+ <UIActionsheet.Icon
490
+ className={actionsheetIconStyle({ class: className })}
491
+ ref={ref}
492
+ {...props}
493
+ />
494
+ );
495
+ });
496
+
497
+ export {
498
+ Actionsheet,
499
+ ActionsheetContent,
500
+ ActionsheetItem,
501
+ ActionsheetItemText,
502
+ ActionsheetDragIndicator,
503
+ ActionsheetDragIndicatorWrapper,
504
+ ActionsheetBackdrop,
505
+ ActionsheetScrollView,
506
+ ActionsheetVirtualizedList,
507
+ ActionsheetFlatList,
508
+ ActionsheetSectionList,
509
+ ActionsheetSectionHeaderText,
510
+ ActionsheetIcon,
511
+ };
@@ -0,0 +1,158 @@
1
+ 'use client';
2
+ import { createAlert } from '@gluestack-ui/core/alert/creator';
3
+ import { View, Text } from 'react-native';
4
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
5
+ import {
6
+ withStyleContext,
7
+ useStyleContext,
8
+ } from '@gluestack-ui/utils/nativewind-utils';
9
+ import React from 'react';
10
+ import { cssInterop } from 'nativewind';
11
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
12
+ import { UIIcon } from '@gluestack-ui/core/icon/creator';
13
+
14
+ const SCOPE = 'ALERT';
15
+
16
+ const alertStyle = tva({
17
+ base: 'rounded-lg border px-2.5 py-2 flex-row gap-2 items-start ',
18
+ variants: {
19
+ variant: {
20
+ default: 'bg-card border-border',
21
+ destructive: 'bg-card border-destructive',
22
+ },
23
+ },
24
+ });
25
+
26
+ const alertTextStyle = tva({
27
+ base: 'font-medium tracking-tight text-sm flex-1',
28
+ parentVariants: {
29
+ variant: {
30
+ default: 'text-card-foreground',
31
+ destructive: 'text-destructive',
32
+ },
33
+ },
34
+ });
35
+
36
+ const alertIconStyle = tva({
37
+ base: 'fill-none w-4 h-4 mt-0.5',
38
+ parentVariants: {
39
+ variant: {
40
+ default: 'text-card-foreground',
41
+ destructive: 'text-destructive',
42
+ },
43
+ },
44
+ });
45
+
46
+ export const UIAlert = createAlert({
47
+ Root: withStyleContext(View, SCOPE),
48
+ Text: Text,
49
+ Icon: UIIcon,
50
+ });
51
+
52
+ cssInterop(UIIcon, {
53
+ className: {
54
+ target: 'style',
55
+ nativeStyleToProp: {
56
+ height: true,
57
+ width: true,
58
+ fill: true,
59
+ color: 'classNameColor',
60
+ stroke: true,
61
+ } as any,
62
+ },
63
+ });
64
+
65
+ type IAlertProps = Omit<
66
+ React.ComponentPropsWithoutRef<typeof UIAlert>,
67
+ 'context'
68
+ > &
69
+ VariantProps<typeof alertStyle>;
70
+
71
+ const Alert = React.forwardRef<React.ComponentRef<typeof UIAlert>, IAlertProps>(
72
+ function Alert({ className, variant = 'default', ...props }, ref) {
73
+ return (
74
+ <UIAlert
75
+ className={alertStyle({ variant, class: className })}
76
+ context={{ variant }}
77
+ ref={ref}
78
+ {...props}
79
+ />
80
+ );
81
+ }
82
+ );
83
+
84
+ type IAlertTextProps = React.ComponentPropsWithoutRef<typeof UIAlert.Text> &
85
+ VariantProps<typeof alertTextStyle>;
86
+
87
+ const AlertText = React.forwardRef<
88
+ React.ComponentRef<typeof UIAlert.Text>,
89
+ IAlertTextProps
90
+ >(function AlertText({ className, ...props }, ref) {
91
+ const { variant: parentVariant } = useStyleContext(SCOPE);
92
+ return (
93
+ <UIAlert.Text
94
+ className={alertTextStyle({
95
+ class: className,
96
+ parentVariants: {
97
+ variant: parentVariant,
98
+ },
99
+ })}
100
+ {...props}
101
+ ref={ref}
102
+ />
103
+ );
104
+ });
105
+
106
+ type IAlertIconProps = React.ComponentPropsWithoutRef<typeof UIAlert.Icon> &
107
+ VariantProps<typeof alertIconStyle> & {
108
+ height?: number;
109
+ width?: number;
110
+ size?: number | 'sm' | 'md' | 'lg' | 'xl';
111
+ };
112
+
113
+ const AlertIcon = React.forwardRef<
114
+ React.ComponentRef<typeof UIAlert.Icon>,
115
+ IAlertIconProps
116
+ >(function AlertIcon({ className, size = 'sm', ...props }, ref) {
117
+ const { variant: parentVariant } = useStyleContext(SCOPE);
118
+
119
+ if (typeof size === 'number') {
120
+ return (
121
+ <UIAlert.Icon
122
+ ref={ref}
123
+ {...props}
124
+ className={alertIconStyle({ class: className })}
125
+ size={size}
126
+ />
127
+ );
128
+ } else if (
129
+ (props.height !== undefined || props.width !== undefined) &&
130
+ size === undefined
131
+ ) {
132
+ return (
133
+ <UIAlert.Icon
134
+ ref={ref}
135
+ {...props}
136
+ className={alertIconStyle({ class: className })}
137
+ />
138
+ );
139
+ }
140
+ return (
141
+ <UIAlert.Icon
142
+ className={alertIconStyle({
143
+ parentVariants: {
144
+ variant: parentVariant,
145
+ },
146
+ class: className,
147
+ })}
148
+ {...props}
149
+ ref={ref}
150
+ />
151
+ );
152
+ });
153
+
154
+ Alert.displayName = 'Alert';
155
+ AlertText.displayName = 'AlertText';
156
+ AlertIcon.displayName = 'AlertIcon';
157
+
158
+ export { Alert, AlertText, AlertIcon };