@flipova/foundation 1.13.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 (260) 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 -9
  173. package/dist/index.d.ts +40 -9
  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 -142
  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/index-CuaJA3gM.d.mts +0 -78
  236. package/dist/index-CuaJA3gM.d.ts +0 -78
  237. package/dist/registry/index.d.mts +0 -10160
  238. package/dist/registry/index.d.ts +0 -10160
  239. package/dist/registry/index.js +0 -392
  240. package/dist/registry/index.js.map +0 -1
  241. package/dist/registry/index.mjs +0 -3
  242. package/dist/registry/index.mjs.map +0 -1
  243. package/dist/theme/index.d.mts +0 -109
  244. package/dist/theme/index.d.ts +0 -109
  245. package/dist/theme/index.js +0 -28
  246. package/dist/theme/index.js.map +0 -1
  247. package/dist/theme/index.mjs +0 -3
  248. package/dist/theme/index.mjs.map +0 -1
  249. package/dist/tokens/index.d.mts +0 -423
  250. package/dist/tokens/index.d.ts +0 -423
  251. package/dist/tokens/index.js +0 -44
  252. package/dist/tokens/index.js.map +0 -1
  253. package/dist/tokens/index.mjs +0 -3
  254. package/dist/tokens/index.mjs.map +0 -1
  255. package/dist/types/index.d.mts +0 -202
  256. package/dist/types/index.d.ts +0 -202
  257. package/dist/types/index.js +0 -4
  258. package/dist/types/index.js.map +0 -1
  259. package/dist/types/index.mjs +0 -3
  260. package/dist/types/index.mjs.map +0 -1
@@ -0,0 +1,186 @@
1
+ 'use client';
2
+ import { createMenu } from '@gluestack-ui/core/menu/creator';
3
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
4
+
5
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
6
+ import { cssInterop } from 'nativewind';
7
+ import React from 'react';
8
+ import { Pressable, ScrollView, Text, View } from 'react-native';
9
+ import Animated, { FadeOut, ZoomIn } from 'react-native-reanimated';
10
+
11
+ const AnimatedView = Animated.createAnimatedComponent(ScrollView);
12
+
13
+ const menuStyle = tva({
14
+ base: 'rounded-md bg-popover text-popover-foreground border border-border p-1 shadow-hard-5 max-h-[300px] overflow-y-auto',
15
+ });
16
+
17
+ const menuItemStyle = tva({
18
+ base: 'min-w-[200px] p-3 flex-row items-center rounded data-[hover=true]:bg-accent data-[hover=true]:text-accent-foreground data-[active=true]:bg-accent data-[active=true]:text-accent-foreground data-[focus=true]:bg-accent data-[focus=true]:text-accent-foreground data-[focus=true]:web:outline-none data-[focus=true]:web:outline-0 data-[disabled=true]:opacity-40 data-[disabled=true]:web:cursor-not-allowed data-[focus-visible=true]:web:outline-2 data-[focus-visible=true]:web:outline-ring data-[focus-visible=true]:web:outline data-[focus-visible=true]:web:cursor-pointer data-[disabled=true]:data-[focus=true]:bg-transparent',
19
+ });
20
+
21
+ const menuBackdropStyle = tva({
22
+ base: 'absolute top-0 bottom-0 left-0 right-0 web:cursor-default',
23
+ });
24
+
25
+ const menuSeparatorStyle = tva({
26
+ base: 'bg-border h-px w-full',
27
+ });
28
+
29
+ const menuItemLabelStyle = tva({
30
+ base: 'text-popover-foreground font-normal font-body',
31
+
32
+ variants: {
33
+ isTruncated: {
34
+ true: 'web:truncate',
35
+ },
36
+ bold: {
37
+ true: 'font-bold',
38
+ },
39
+ underline: {
40
+ true: 'underline',
41
+ },
42
+ strikeThrough: {
43
+ true: 'line-through',
44
+ },
45
+ sub: {
46
+ true: 'text-xs',
47
+ },
48
+ italic: {
49
+ true: 'italic',
50
+ },
51
+ highlight: {
52
+ true: 'bg-yellow-500',
53
+ },
54
+ },
55
+ });
56
+
57
+ const BackdropPressable = React.forwardRef<
58
+ React.ComponentRef<typeof Pressable>,
59
+ React.ComponentPropsWithoutRef<typeof Pressable> &
60
+ VariantProps<typeof menuBackdropStyle>
61
+ >(function BackdropPressable({ className, ...props }, ref) {
62
+ return (
63
+ <Pressable
64
+ ref={ref}
65
+ className={menuBackdropStyle({
66
+ class: className,
67
+ })}
68
+ {...props}
69
+ />
70
+ );
71
+ });
72
+
73
+ type IMenuItemProps = VariantProps<typeof menuItemStyle> & {
74
+ className?: string;
75
+ } & React.ComponentPropsWithoutRef<typeof Pressable>;
76
+
77
+ const Item = React.forwardRef<
78
+ React.ComponentRef<typeof Pressable>,
79
+ IMenuItemProps
80
+ >(function Item({ className, ...props }, ref) {
81
+ return (
82
+ <Pressable
83
+ ref={ref}
84
+ className={menuItemStyle({
85
+ class: className,
86
+ })}
87
+ {...props}
88
+ />
89
+ );
90
+ });
91
+
92
+ const Separator = React.forwardRef<
93
+ React.ComponentRef<typeof View>,
94
+ React.ComponentPropsWithoutRef<typeof View> &
95
+ VariantProps<typeof menuSeparatorStyle>
96
+ >(function Separator({ className, ...props }, ref) {
97
+ return (
98
+ <View
99
+ ref={ref}
100
+ className={menuSeparatorStyle({ class: className })}
101
+ {...props}
102
+ />
103
+ );
104
+ });
105
+
106
+ cssInterop(AnimatedView, { className: 'style' });
107
+
108
+
109
+
110
+ export const UIMenu = createMenu({
111
+ Root: AnimatedView,
112
+ Item: Item,
113
+ Label: Text,
114
+ Backdrop: BackdropPressable,
115
+ Separator: Separator,
116
+ });
117
+
118
+
119
+ type IMenuProps = React.ComponentProps<typeof UIMenu> &
120
+ VariantProps<typeof menuStyle> & { className?: string };
121
+ type IMenuItemLabelProps = React.ComponentProps<typeof UIMenu.ItemLabel> &
122
+ VariantProps<typeof menuItemLabelStyle> & { className?: string };
123
+
124
+ const Menu = React.forwardRef<React.ComponentRef<typeof UIMenu>, IMenuProps>(
125
+ function Menu({ className, ...props }, ref) {
126
+ return (
127
+ <UIMenu
128
+ entering={ZoomIn.duration(150).withInitialValues({
129
+ transform: [{ scale: 0.9 }],
130
+ opacity: 0,
131
+ })}
132
+ exiting={FadeOut.duration(150)}
133
+ ref={ref}
134
+ className={menuStyle({
135
+ class: className,
136
+ })}
137
+ {...props}
138
+ />
139
+ );
140
+ }
141
+ );
142
+
143
+ const MenuItem = UIMenu.Item;
144
+
145
+ const MenuItemLabel = React.forwardRef<
146
+ React.ComponentRef<typeof UIMenu.ItemLabel>,
147
+ IMenuItemLabelProps
148
+ >(function MenuItemLabel(
149
+ {
150
+ className,
151
+ isTruncated,
152
+ bold,
153
+ underline,
154
+ strikeThrough,
155
+ sub,
156
+ italic,
157
+ highlight,
158
+ ...props
159
+ },
160
+ ref
161
+ ) {
162
+ return (
163
+ <UIMenu.ItemLabel
164
+ ref={ref}
165
+ className={menuItemLabelStyle({
166
+ isTruncated: isTruncated as boolean,
167
+ bold: bold as boolean,
168
+ underline: underline as boolean,
169
+ strikeThrough: strikeThrough as boolean,
170
+ sub: sub as boolean,
171
+ italic: italic as boolean,
172
+ highlight: highlight as boolean,
173
+ class: className,
174
+ })}
175
+ {...props}
176
+ />
177
+ );
178
+ });
179
+
180
+ const MenuSeparator = UIMenu.Separator;
181
+
182
+ Menu.displayName = 'Menu';
183
+ MenuItem.displayName = 'MenuItem';
184
+ MenuItemLabel.displayName = 'MenuItemLabel';
185
+ MenuSeparator.displayName = 'MenuSeparator';
186
+ export { Menu, MenuItem, MenuItemLabel, MenuSeparator };
@@ -0,0 +1,237 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { createModal } from '@gluestack-ui/core/modal/creator';
4
+ import { Pressable, View, ScrollView } from 'react-native';
5
+ import Animated, {
6
+ FadeIn,
7
+ FadeOut,
8
+ ZoomIn,
9
+ ZoomOut,
10
+ Easing,
11
+ } from 'react-native-reanimated';
12
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
13
+ import {
14
+ withStyleContext,
15
+ useStyleContext,
16
+ } from '@gluestack-ui/utils/nativewind-utils';
17
+ import { cssInterop } from 'nativewind';
18
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
19
+
20
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
21
+ const AnimatedView = Animated.createAnimatedComponent(View);
22
+ const SCOPE = 'MODAL';
23
+
24
+ const UIModal = createModal({
25
+ Root: withStyleContext(View as any, SCOPE),
26
+ Backdrop: AnimatedPressable,
27
+ Content: AnimatedView,
28
+ Body: ScrollView,
29
+ CloseButton: Pressable,
30
+ Footer: View,
31
+ Header: View,
32
+ });
33
+
34
+ cssInterop(AnimatedPressable, { className: 'style' });
35
+ cssInterop(AnimatedView, { className: 'style' });
36
+
37
+ const modalStyle = tva({
38
+ base: 'group/modal w-full h-full justify-center items-center web:pointer-events-none',
39
+ variants: {
40
+ size: {
41
+ xs: '',
42
+ sm: '',
43
+ md: '',
44
+ lg: '',
45
+ full: '',
46
+ },
47
+ },
48
+ });
49
+
50
+ const modalBackdropStyle = tva({
51
+ base: 'absolute left-0 top-0 right-0 bottom-0 bg-black/50 web:cursor-default',
52
+ });
53
+
54
+ const modalContentStyle = tva({
55
+ base: 'bg-background rounded-md overflow-hidden border border-border/80 shadow-hard-2 p-6',
56
+ parentVariants: {
57
+ size: {
58
+ xs: 'w-[60%] max-w-[360px]',
59
+ sm: 'w-[70%] max-w-[420px]',
60
+ md: 'w-[80%] max-w-[510px]',
61
+ lg: 'w-[90%] max-w-[640px]',
62
+ full: 'w-full',
63
+ },
64
+ },
65
+ });
66
+
67
+ const modalBodyStyle = tva({
68
+ base: 'mt-2 mb-6',
69
+ });
70
+
71
+ const modalCloseButtonStyle = tva({
72
+ base: 'group/modal-close-button z-10 rounded data-[focus-visible=true]:web:bg-background/90 web:outline-0 cursor-pointer',
73
+ });
74
+
75
+ const modalHeaderStyle = tva({
76
+ base: 'justify-between items-center flex-row',
77
+ });
78
+
79
+ const modalFooterStyle = tva({
80
+ base: 'flex-row justify-end items-center gap-2',
81
+ });
82
+
83
+ type IModalProps = React.ComponentProps<typeof UIModal> &
84
+ VariantProps<typeof modalStyle> & { className?: string };
85
+
86
+ type IModalBackdropProps = React.ComponentProps<typeof UIModal.Backdrop> &
87
+ VariantProps<typeof modalBackdropStyle> & { className?: string };
88
+
89
+ type IModalContentProps = React.ComponentProps<typeof UIModal.Content> &
90
+ VariantProps<typeof modalContentStyle> & { className?: string };
91
+
92
+ type IModalHeaderProps = React.ComponentProps<typeof UIModal.Header> &
93
+ VariantProps<typeof modalHeaderStyle> & { className?: string };
94
+
95
+ type IModalBodyProps = React.ComponentProps<typeof UIModal.Body> &
96
+ VariantProps<typeof modalBodyStyle> & { className?: string };
97
+
98
+ type IModalFooterProps = React.ComponentProps<typeof UIModal.Footer> &
99
+ VariantProps<typeof modalFooterStyle> & { className?: string };
100
+
101
+ type IModalCloseButtonProps = React.ComponentProps<typeof UIModal.CloseButton> &
102
+ VariantProps<typeof modalCloseButtonStyle> & { className?: string };
103
+
104
+ const Modal = React.forwardRef<React.ComponentRef<typeof UIModal>, IModalProps>(
105
+ ({ className, size = 'md', ...props }, ref) => (
106
+ <UIModal
107
+ ref={ref}
108
+ {...props}
109
+ pointerEvents="box-none"
110
+ className={modalStyle({ size, class: className })}
111
+ context={{ size }}
112
+ />
113
+ )
114
+ );
115
+
116
+ const ModalBackdrop = React.forwardRef<
117
+ React.ComponentRef<typeof UIModal.Backdrop>,
118
+ IModalBackdropProps
119
+ >(function ModalBackdrop({ className, ...props }, ref) {
120
+ return (
121
+ <UIModal.Backdrop
122
+ ref={ref}
123
+ entering={FadeIn.duration(200).easing(Easing.linear)}
124
+ exiting={FadeOut.duration(200).easing(Easing.linear)}
125
+ {...props}
126
+ className={modalBackdropStyle({
127
+ class: className,
128
+ })}
129
+ />
130
+ );
131
+ });
132
+
133
+ const ModalContent = React.forwardRef<
134
+ React.ComponentRef<typeof UIModal.Content>,
135
+ IModalContentProps
136
+ >(function ModalContent({ className, size, ...props }, ref) {
137
+ const { size: parentSize } = useStyleContext(SCOPE);
138
+
139
+ return (
140
+ <UIModal.Content
141
+ ref={ref}
142
+ entering={ZoomIn.duration(200).withInitialValues({
143
+ transform: [{ scale: 0.9 }],
144
+ opacity: 0,
145
+ })}
146
+ exiting={FadeOut.duration(200)}
147
+ {...props}
148
+ className={modalContentStyle({
149
+ parentVariants: {
150
+ size: parentSize,
151
+ },
152
+ size,
153
+ class: className,
154
+ })}
155
+ pointerEvents="auto"
156
+ />
157
+ );
158
+ });
159
+
160
+ const ModalHeader = React.forwardRef<
161
+ React.ComponentRef<typeof UIModal.Header>,
162
+ IModalHeaderProps
163
+ >(function ModalHeader({ className, ...props }, ref) {
164
+ return (
165
+ <UIModal.Header
166
+ ref={ref}
167
+ {...props}
168
+ className={modalHeaderStyle({
169
+ class: className,
170
+ })}
171
+ />
172
+ );
173
+ });
174
+
175
+ const ModalBody = React.forwardRef<
176
+ React.ComponentRef<typeof UIModal.Body>,
177
+ IModalBodyProps
178
+ >(function ModalBody({ className, ...props }, ref) {
179
+ return (
180
+ <UIModal.Body
181
+ scrollEnabled={false}
182
+ ref={ref}
183
+ {...props}
184
+ className={modalBodyStyle({
185
+ class: className,
186
+ })}
187
+ />
188
+ );
189
+ });
190
+
191
+ const ModalFooter = React.forwardRef<
192
+ React.ComponentRef<typeof UIModal.Footer>,
193
+ IModalFooterProps
194
+ >(function ModalFooter({ className, ...props }, ref) {
195
+ return (
196
+ <UIModal.Footer
197
+ ref={ref}
198
+ {...props}
199
+ className={modalFooterStyle({
200
+ class: className,
201
+ })}
202
+ />
203
+ );
204
+ });
205
+
206
+ const ModalCloseButton = React.forwardRef<
207
+ React.ComponentRef<typeof UIModal.CloseButton>,
208
+ IModalCloseButtonProps
209
+ >(function ModalCloseButton({ className, ...props }, ref) {
210
+ return (
211
+ <UIModal.CloseButton
212
+ ref={ref}
213
+ {...props}
214
+ className={modalCloseButtonStyle({
215
+ class: className,
216
+ })}
217
+ />
218
+ );
219
+ });
220
+
221
+ Modal.displayName = 'Modal';
222
+ ModalBackdrop.displayName = 'ModalBackdrop';
223
+ ModalContent.displayName = 'ModalContent';
224
+ ModalHeader.displayName = 'ModalHeader';
225
+ ModalBody.displayName = 'ModalBody';
226
+ ModalFooter.displayName = 'ModalFooter';
227
+ ModalCloseButton.displayName = 'ModalCloseButton';
228
+
229
+ export {
230
+ Modal,
231
+ ModalBackdrop,
232
+ ModalContent,
233
+ ModalCloseButton,
234
+ ModalHeader,
235
+ ModalBody,
236
+ ModalFooter,
237
+ };
@@ -0,0 +1,272 @@
1
+ 'use client';
2
+ import { createPopover } from '@gluestack-ui/core/popover/creator';
3
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
4
+ import {
5
+ tva,
6
+ useStyleContext,
7
+ withStyleContext,
8
+ } from '@gluestack-ui/utils/nativewind-utils';
9
+ import { cssInterop } from 'nativewind';
10
+ import React from 'react';
11
+ import { Pressable, ScrollView, View } from 'react-native';
12
+ import Animated, {
13
+ FadeIn,
14
+ FadeOut,
15
+ ZoomIn,
16
+ ZoomOut,
17
+ } from 'react-native-reanimated';
18
+
19
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
20
+ const AnimatedView = Animated.createAnimatedComponent(View);
21
+
22
+ const SCOPE = 'POPOVER';
23
+
24
+ const UIPopover = createPopover({
25
+ Root: withStyleContext(AnimatedView, SCOPE),
26
+ Arrow: View,
27
+ Backdrop: AnimatedPressable,
28
+ Body: ScrollView,
29
+ CloseButton: Pressable,
30
+ Content: View,
31
+ Footer: View,
32
+ Header: View,
33
+ });
34
+
35
+ cssInterop(AnimatedView, { className: 'style' });
36
+ cssInterop(AnimatedPressable, { className: 'style' });
37
+
38
+ const popoverStyle = tva({
39
+ base: 'group/popover w-full h-full justify-center items-center web:pointer-events-none',
40
+ });
41
+
42
+ const popoverArrowStyle = tva({
43
+ base: 'bg-popover z-[1] border absolute overflow-hidden h-3.5 w-3.5 border-border dark:border-border/90',
44
+ variants: {
45
+ placement: {
46
+ 'top left':
47
+ 'data-[flip=false]:border-t-0 data-[flip=false]:border-l-0 data-[flip=true]:border-b-0 data-[flip=true]:border-r-0',
48
+ 'top':
49
+ 'data-[flip=false]:border-t-0 data-[flip=false]:border-l-0 data-[flip=true]:border-b-0 data-[flip=true]:border-r-0',
50
+ 'top right':
51
+ 'data-[flip=false]:border-t-0 data-[flip=false]:border-l-0 data-[flip=true]:border-b-0 data-[flip=true]:border-r-0',
52
+ 'bottom':
53
+ 'data-[flip=false]:border-b-0 data-[flip=false]:border-r-0 data-[flip=true]:border-t-0 data-[flip=true]:border-l-0',
54
+ 'bottom left':
55
+ 'data-[flip=false]:border-b-0 data-[flip=false]:border-r-0 data-[flip=true]:border-t-0 data-[flip=true]:border-l-0',
56
+ 'bottom right':
57
+ 'data-[flip=false]:border-b-0 data-[flip=false]:border-r-0 data-[flip=true]:border-t-0 data-[flip=true]:border-l-0',
58
+ 'left':
59
+ 'data-[flip=false]:border-l-0 data-[flip=false]:border-b-0 data-[flip=true]:border-r-0 data-[flip=true]:border-t-0',
60
+ 'left top':
61
+ 'data-[flip=false]:border-l-0 data-[flip=false]:border-b-0 data-[flip=true]:border-r-0 data-[flip=true]:border-t-0',
62
+ 'left bottom':
63
+ 'data-[flip=false]:border-l-0 data-[flip=false]:border-b-0 data-[flip=true]:border-r-0 data-[flip=true]:border-t-0',
64
+ 'right':
65
+ 'data-[flip=false]:border-r-0 data-[flip=false]:border-t-0 data-[flip=true]:border-l-0 data-[flip=true]:border-b-0',
66
+ 'right top':
67
+ 'data-[flip=false]:border-r-0 data-[flip=false]:border-t-0 data-[flip=true]:border-l-0 data-[flip=true]:border-b-0',
68
+ 'right bottom':
69
+ 'data-[flip=false]:border-r-0 data-[flip=false]:border-t-0 data-[flip=true]:border-l-0 data-[flip=true]:border-b-0',
70
+ },
71
+ },
72
+ });
73
+
74
+ const popoverBackdropStyle = tva({
75
+ base: 'absolute left-0 top-0 right-0 bottom-0 web:cursor-default',
76
+ });
77
+
78
+ const popoverCloseButtonStyle = tva({
79
+ base: 'group/popover-close-button z-[1] rounded-sm p-2 data-[focus-visible=true]:bg-accent web:outline-0 web:cursor-pointer data-[hover=true]:bg-accent/50',
80
+ });
81
+
82
+ const popoverContentStyle = tva({
83
+ base: 'bg-popover text-popover-foreground rounded-lg overflow-hidden border border-border dark:border-border/10 shadow-md p-4 w-full max-w-xs web:pointer-events-auto',
84
+ });
85
+
86
+ const popoverHeaderStyle = tva({
87
+ base: 'flex-row justify-between items-center',
88
+ });
89
+
90
+ const popoverBodyStyle = tva({
91
+ base: '',
92
+ });
93
+
94
+ const popoverFooterStyle = tva({
95
+ base: 'flex-row justify-between items-center',
96
+ });
97
+
98
+ type IPopoverProps = React.ComponentProps<typeof UIPopover> &
99
+ VariantProps<typeof popoverStyle> & { className?: string };
100
+
101
+ type IPopoverArrowProps = React.ComponentProps<typeof UIPopover.Arrow> &
102
+ VariantProps<typeof popoverArrowStyle> & { className?: string };
103
+
104
+ type IPopoverContentProps = React.ComponentProps<typeof UIPopover.Content> &
105
+ VariantProps<typeof popoverContentStyle> & { className?: string };
106
+
107
+ type IPopoverHeaderProps = React.ComponentProps<typeof UIPopover.Header> &
108
+ VariantProps<typeof popoverHeaderStyle> & { className?: string };
109
+
110
+ type IPopoverFooterProps = React.ComponentProps<typeof UIPopover.Footer> &
111
+ VariantProps<typeof popoverFooterStyle> & { className?: string };
112
+
113
+ type IPopoverBodyProps = React.ComponentProps<typeof UIPopover.Body> &
114
+ VariantProps<typeof popoverBodyStyle> & { className?: string };
115
+
116
+ type IPopoverBackdropProps = React.ComponentProps<typeof UIPopover.Backdrop> &
117
+ VariantProps<typeof popoverBackdropStyle> & { className?: string };
118
+
119
+ type IPopoverCloseButtonProps = React.ComponentProps<
120
+ typeof UIPopover.CloseButton
121
+ > &
122
+ VariantProps<typeof popoverCloseButtonStyle> & { className?: string };
123
+
124
+ const Popover = React.forwardRef<
125
+ React.ComponentRef<typeof UIPopover>,
126
+ IPopoverProps
127
+ >(function Popover({ className, placement = 'bottom', ...props }, ref) {
128
+ return (
129
+ <UIPopover
130
+ ref={ref}
131
+ placement={placement}
132
+ {...props}
133
+ entering={FadeIn.duration(200).withInitialValues({
134
+ opacity: 0,
135
+ })}
136
+ exiting={FadeOut.duration(150)}
137
+ className={popoverStyle({ class: className })}
138
+ context={{ placement }}
139
+ pointerEvents="box-none"
140
+ />
141
+ );
142
+ });
143
+
144
+ const PopoverContent = React.forwardRef<
145
+ React.ComponentRef<typeof UIPopover.Content>,
146
+ IPopoverContentProps
147
+ >(function PopoverContent({ className, ...props }, ref) {
148
+ return (
149
+ <UIPopover.Content
150
+ ref={ref}
151
+ {...props}
152
+ className={popoverContentStyle({
153
+ class: className,
154
+ })}
155
+ pointerEvents="auto"
156
+ />
157
+ );
158
+ });
159
+
160
+ const PopoverArrow = React.forwardRef<
161
+ React.ComponentRef<typeof UIPopover.Arrow>,
162
+ IPopoverArrowProps
163
+ >(function PopoverArrow({ className, ...props }, ref) {
164
+ const { placement } = useStyleContext(SCOPE);
165
+ return (
166
+ <UIPopover.Arrow
167
+ ref={ref}
168
+ {...props}
169
+ className={popoverArrowStyle({
170
+ class: className,
171
+ placement,
172
+ })}
173
+ />
174
+ );
175
+ });
176
+
177
+ const PopoverBackdrop = React.forwardRef<
178
+ React.ComponentRef<typeof UIPopover.Backdrop>,
179
+ IPopoverBackdropProps
180
+ >(function PopoverBackdrop({ className, ...props }, ref) {
181
+ return (
182
+ <UIPopover.Backdrop
183
+ ref={ref}
184
+ entering={FadeIn.duration(100).delay(50)}
185
+ exiting={FadeOut.duration(100)}
186
+ {...props}
187
+ className={popoverBackdropStyle({
188
+ class: className,
189
+ })}
190
+ />
191
+ );
192
+ });
193
+
194
+ const PopoverBody = React.forwardRef<
195
+ React.ComponentRef<typeof UIPopover.Body>,
196
+ IPopoverBodyProps
197
+ >(function PopoverBody({ className, ...props }, ref) {
198
+ return (
199
+ <UIPopover.Body
200
+ ref={ref}
201
+ {...props}
202
+ className={popoverBodyStyle({
203
+ class: className,
204
+ })}
205
+ />
206
+ );
207
+ });
208
+
209
+ const PopoverCloseButton = React.forwardRef<
210
+ React.ComponentRef<typeof UIPopover.CloseButton>,
211
+ IPopoverCloseButtonProps
212
+ >(function PopoverCloseButton({ className, ...props }, ref) {
213
+ return (
214
+ <UIPopover.CloseButton
215
+ ref={ref}
216
+ {...props}
217
+ className={popoverCloseButtonStyle({
218
+ class: className,
219
+ })}
220
+ />
221
+ );
222
+ });
223
+
224
+ const PopoverFooter = React.forwardRef<
225
+ React.ComponentRef<typeof UIPopover.Footer>,
226
+ IPopoverFooterProps
227
+ >(function PopoverFooter({ className, ...props }, ref) {
228
+ return (
229
+ <UIPopover.Footer
230
+ ref={ref}
231
+ {...props}
232
+ className={popoverFooterStyle({
233
+ class: className,
234
+ })}
235
+ />
236
+ );
237
+ });
238
+
239
+ const PopoverHeader = React.forwardRef<
240
+ React.ComponentRef<typeof UIPopover.Header>,
241
+ IPopoverHeaderProps
242
+ >(function PopoverHeader({ className, ...props }, ref) {
243
+ return (
244
+ <UIPopover.Header
245
+ ref={ref}
246
+ {...props}
247
+ className={popoverHeaderStyle({
248
+ class: className,
249
+ })}
250
+ />
251
+ );
252
+ });
253
+
254
+ Popover.displayName = 'Popover';
255
+ PopoverArrow.displayName = 'PopoverArrow';
256
+ PopoverBackdrop.displayName = 'PopoverBackdrop';
257
+ PopoverContent.displayName = 'PopoverContent';
258
+ PopoverHeader.displayName = 'PopoverHeader';
259
+ PopoverFooter.displayName = 'PopoverFooter';
260
+ PopoverBody.displayName = 'PopoverBody';
261
+ PopoverCloseButton.displayName = 'PopoverCloseButton';
262
+
263
+ export {
264
+ Popover,
265
+ PopoverArrow,
266
+ PopoverBackdrop,
267
+ PopoverBody,
268
+ PopoverCloseButton,
269
+ PopoverContent,
270
+ PopoverFooter,
271
+ PopoverHeader,
272
+ };
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { Overlay } from '@gluestack-ui/core/overlay/creator';
4
+ import { cssInterop } from 'nativewind';
5
+
6
+ cssInterop(Overlay, { className: 'style' });
7
+
8
+ const Portal = React.forwardRef<
9
+ React.ComponentRef<typeof Overlay>,
10
+ React.ComponentProps<typeof Overlay>
11
+ >(function Portal({ ...props }, ref) {
12
+ return <Overlay {...props} ref={ref} />;
13
+ });
14
+
15
+ Portal.displayName = 'Portal';
16
+
17
+ export { Portal };