@admin-layout/gluestack-ui-mobile 11.0.4-alpha.0 → 12.0.16-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/CHANGELOG.md +60 -4
  2. package/lib/__tests__/prolayout-layout-feature.test.js +1 -1
  3. package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -1
  4. package/lib/components/AuthWrapper.js +5 -3
  5. package/lib/components/AuthWrapper.js.map +1 -1
  6. package/lib/components/ErrorBounday.js.map +1 -1
  7. package/lib/components/NavigationComponent.js.map +1 -1
  8. package/lib/components/UnAuthenticatedComponent.js.map +1 -1
  9. package/lib/components/WithConfiguration.js +4 -4
  10. package/lib/components/WithConfiguration.js.map +1 -1
  11. package/lib/components/WithPermission.js +1 -1
  12. package/lib/components/WithPermission.js.map +1 -1
  13. package/lib/components/WithPolicy.js +2 -2
  14. package/lib/components/WithPolicy.js.map +1 -1
  15. package/lib/components/ui/accordion/index.web.d.ts +209 -0
  16. package/lib/components/ui/accordion/index.web.js +156 -0
  17. package/lib/components/ui/accordion/index.web.js.map +1 -0
  18. package/lib/components/ui/actionsheet/index.web.d.ts +872 -0
  19. package/lib/components/ui/actionsheet/index.web.js +286 -0
  20. package/lib/components/ui/actionsheet/index.web.js.map +1 -0
  21. package/lib/components/ui/alert/index.web.d.ts +135 -0
  22. package/lib/components/ui/alert/index.web.js +38 -0
  23. package/lib/components/ui/alert/index.web.js.map +1 -0
  24. package/lib/components/ui/alert-dialog/index.web.d.ts +64 -0
  25. package/lib/components/ui/alert-dialog/index.web.js +139 -0
  26. package/lib/components/ui/alert-dialog/index.web.js.map +1 -0
  27. package/lib/components/ui/avatar/index.web.d.ts +21 -0
  28. package/lib/components/ui/avatar/index.web.js +92 -0
  29. package/lib/components/ui/avatar/index.web.js.map +1 -0
  30. package/lib/components/ui/badge/index.web.d.ts +382 -0
  31. package/lib/components/ui/badge/index.web.js +138 -0
  32. package/lib/components/ui/badge/index.web.js.map +1 -0
  33. package/lib/components/ui/button/index.web.d.ts +247 -0
  34. package/lib/components/ui/button/index.web.js +57 -0
  35. package/lib/components/ui/button/index.web.js.map +1 -0
  36. package/lib/components/ui/checkbox/index.web.d.ts +265 -0
  37. package/lib/components/ui/checkbox/index.web.js +77 -0
  38. package/lib/components/ui/checkbox/index.web.js.map +1 -0
  39. package/lib/components/ui/divider/index.web.d.ts +53 -0
  40. package/lib/components/ui/divider/index.web.js +21 -0
  41. package/lib/components/ui/divider/index.web.js.map +1 -0
  42. package/lib/components/ui/drawer/index.web.d.ts +174 -0
  43. package/lib/components/ui/drawer/index.web.js +65 -0
  44. package/lib/components/ui/drawer/index.web.js.map +1 -0
  45. package/lib/components/ui/fab/index.web.d.ts +520 -0
  46. package/lib/components/ui/fab/index.web.js +146 -0
  47. package/lib/components/ui/fab/index.web.js.map +1 -0
  48. package/lib/components/ui/flat-list/index.web.d.ts +21 -0
  49. package/lib/components/ui/flat-list/index.web.js +41 -0
  50. package/lib/components/ui/flat-list/index.web.js.map +1 -0
  51. package/lib/components/ui/form-control/index.web.d.ts +2071 -0
  52. package/lib/components/ui/form-control/index.web.js +290 -0
  53. package/lib/components/ui/form-control/index.web.js.map +1 -0
  54. package/lib/components/ui/image/index.web.d.ts +142 -0
  55. package/lib/components/ui/image/index.web.js +29 -0
  56. package/lib/components/ui/image/index.web.js.map +1 -0
  57. package/lib/components/ui/image-background/index.web.d.ts +8 -0
  58. package/lib/components/ui/image-background/index.web.js +23 -0
  59. package/lib/components/ui/image-background/index.web.js.map +1 -0
  60. package/lib/components/ui/input/index.web.d.ts +163 -0
  61. package/lib/components/ui/input/index.web.js +50 -0
  62. package/lib/components/ui/input/index.web.js.map +1 -0
  63. package/lib/components/ui/input-accessory-view/index.web.d.ts +9 -0
  64. package/lib/components/ui/input-accessory-view/index.web.js +16 -0
  65. package/lib/components/ui/input-accessory-view/index.web.js.map +1 -0
  66. package/lib/components/ui/keyboard-avoiding-view/index.web.d.ts +9 -0
  67. package/lib/components/ui/keyboard-avoiding-view/index.web.js +8 -0
  68. package/lib/components/ui/keyboard-avoiding-view/index.web.js.map +1 -0
  69. package/lib/components/ui/link/index.web.d.ts +365 -0
  70. package/lib/components/ui/link/index.web.js +70 -0
  71. package/lib/components/ui/link/index.web.js.map +1 -0
  72. package/lib/components/ui/menu/index.web.d.ts +142 -0
  73. package/lib/components/ui/menu/index.web.js +83 -0
  74. package/lib/components/ui/menu/index.web.js.map +1 -0
  75. package/lib/components/ui/modal/index.web.d.ts +111 -0
  76. package/lib/components/ui/modal/index.web.js +58 -0
  77. package/lib/components/ui/modal/index.web.js.map +1 -0
  78. package/lib/components/ui/popover/index.web.d.ts +309 -0
  79. package/lib/components/ui/popover/index.web.js +184 -0
  80. package/lib/components/ui/popover/index.web.js.map +1 -0
  81. package/lib/components/ui/portal/index.web.d.ts +9 -0
  82. package/lib/components/ui/portal/index.web.js +16 -0
  83. package/lib/components/ui/portal/index.web.js.map +1 -0
  84. package/lib/components/ui/pressable/index.web.d.ts +8 -0
  85. package/lib/components/ui/pressable/index.web.js +44 -0
  86. package/lib/components/ui/pressable/index.web.js.map +1 -0
  87. package/lib/components/ui/progress/index.web.d.ts +237 -0
  88. package/lib/components/ui/progress/index.web.js +73 -0
  89. package/lib/components/ui/progress/index.web.js.map +1 -0
  90. package/lib/components/ui/radio/index.web.d.ts +224 -0
  91. package/lib/components/ui/radio/index.web.js +69 -0
  92. package/lib/components/ui/radio/index.web.js.map +1 -0
  93. package/lib/components/ui/refresh-control/index.web.d.ts +14 -0
  94. package/lib/components/ui/refresh-control/index.web.js +69 -0
  95. package/lib/components/ui/refresh-control/index.web.js.map +1 -0
  96. package/lib/components/ui/safe-area-view/index.web.d.ts +6 -0
  97. package/lib/components/ui/safe-area-view/index.web.js +10 -0
  98. package/lib/components/ui/safe-area-view/index.web.js.map +1 -0
  99. package/lib/components/ui/scroll-view/index.web.d.ts +44 -0
  100. package/lib/components/ui/scroll-view/index.web.js +41 -0
  101. package/lib/components/ui/scroll-view/index.web.js.map +1 -0
  102. package/lib/components/ui/section-list/index.web.d.ts +26 -0
  103. package/lib/components/ui/section-list/index.web.js +35 -0
  104. package/lib/components/ui/section-list/index.web.js.map +1 -0
  105. package/lib/components/ui/select/index.web.d.ts +162 -0
  106. package/lib/components/ui/select/index.web.js +51 -0
  107. package/lib/components/ui/select/index.web.js.map +1 -0
  108. package/lib/components/ui/slider/index.web.d.ts +223 -0
  109. package/lib/components/ui/slider/index.web.js +189 -0
  110. package/lib/components/ui/slider/index.web.js.map +1 -0
  111. package/lib/components/ui/spinner/index.web.d.ts +176 -0
  112. package/lib/components/ui/spinner/index.web.js +55 -0
  113. package/lib/components/ui/spinner/index.web.js.map +1 -0
  114. package/lib/components/ui/status-bar/index.web.d.ts +14 -0
  115. package/lib/components/ui/status-bar/index.web.js +7 -0
  116. package/lib/components/ui/status-bar/index.web.js.map +1 -0
  117. package/lib/components/ui/switch/index.web.d.ts +71 -0
  118. package/lib/components/ui/switch/index.web.js +27 -0
  119. package/lib/components/ui/switch/index.web.js.map +1 -0
  120. package/lib/components/ui/tabs/index.web.d.ts +351 -0
  121. package/lib/components/ui/tabs/index.web.js +120 -0
  122. package/lib/components/ui/tabs/index.web.js.map +1 -0
  123. package/lib/components/ui/textarea/index.web.d.ts +162 -0
  124. package/lib/components/ui/textarea/index.web.js +50 -0
  125. package/lib/components/ui/textarea/index.web.js.map +1 -0
  126. package/lib/components/ui/toast/index.web.d.ts +225 -0
  127. package/lib/components/ui/toast/index.web.js +80 -0
  128. package/lib/components/ui/toast/index.web.js.map +1 -0
  129. package/lib/components/ui/tooltip/index.web.d.ts +86 -0
  130. package/lib/components/ui/tooltip/index.web.js +110 -0
  131. package/lib/components/ui/tooltip/index.web.js.map +1 -0
  132. package/lib/components/ui/view/index.web.d.ts +2 -0
  133. package/lib/components/ui/view/index.web.js +7 -0
  134. package/lib/components/ui/view/index.web.js.map +1 -0
  135. package/lib/components/ui/virtualized-list/index.web.d.ts +19 -0
  136. package/lib/components/ui/virtualized-list/index.web.js +30 -0
  137. package/lib/components/ui/virtualized-list/index.web.js.map +1 -0
  138. package/lib/components/usePermissionAutoFetch.d.ts +7 -19
  139. package/lib/components/with-interactions-lifecycle-managed.js.map +1 -1
  140. package/lib/components/with-interactions-managed.js +2 -3
  141. package/lib/components/with-interactions-managed.js.map +1 -1
  142. package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +47 -47
  143. package/lib/containers/layout/DrawerConfig.d.ts +31 -31
  144. package/lib/containers/layout/module.js +1 -1
  145. package/lib/containers/layout/module.js.map +1 -1
  146. package/lib/interfaces/settings.d.ts +1 -0
  147. package/lib/redux/settings.d.ts +4 -9
  148. package/lib/utils/routeConfigKeyReplace.test.js +1 -1
  149. package/lib/utils/routeConfigKeyReplace.test.js.map +1 -1
  150. package/package.json +7 -4
  151. package/src/__tests__/prolayout-layout-feature.test.tsx +2 -2
  152. package/src/components/AuthWrapper.tsx +6 -3
  153. package/src/components/ErrorBounday.tsx +18 -19
  154. package/src/components/NavigationComponent.tsx +1 -1
  155. package/src/components/UnAuthenticatedComponent.tsx +1 -3
  156. package/src/components/WithConfiguration.tsx +5 -8
  157. package/src/components/WithPermission.tsx +1 -1
  158. package/src/components/WithPolicy.tsx +4 -3
  159. package/src/components/ui/accordion/index.web.tsx +294 -0
  160. package/src/components/ui/actionsheet/index.web.tsx +555 -0
  161. package/src/components/ui/alert/index.web.tsx +71 -0
  162. package/src/components/ui/alert-dialog/index.web.tsx +241 -0
  163. package/src/components/ui/avatar/index.web.tsx +150 -0
  164. package/src/components/ui/badge/index.web.tsx +188 -0
  165. package/src/components/ui/button/index.web.tsx +86 -0
  166. package/src/components/ui/checkbox/index.web.tsx +151 -0
  167. package/src/components/ui/divider/index.web.tsx +37 -0
  168. package/src/components/ui/drawer/index.web.tsx +144 -0
  169. package/src/components/ui/fab/index.web.tsx +201 -0
  170. package/src/components/ui/flat-list/index.web.tsx +89 -0
  171. package/src/components/ui/form-control/index.web.tsx +451 -0
  172. package/src/components/ui/image/index.web.tsx +43 -0
  173. package/src/components/ui/image-background/index.web.tsx +43 -0
  174. package/src/components/ui/input/index.web.tsx +80 -0
  175. package/src/components/ui/input-accessory-view/index.web.tsx +31 -0
  176. package/src/components/ui/keyboard-avoiding-view/index.web.tsx +23 -0
  177. package/src/components/ui/link/index.web.tsx +103 -0
  178. package/src/components/ui/menu/index.web.tsx +159 -0
  179. package/src/components/ui/modal/index.web.tsx +135 -0
  180. package/src/components/ui/popover/index.web.tsx +326 -0
  181. package/src/components/ui/portal/index.web.tsx +34 -0
  182. package/src/components/ui/pressable/index.web.tsx +73 -0
  183. package/src/components/ui/progress/index.web.tsx +123 -0
  184. package/src/components/ui/radio/index.web.tsx +130 -0
  185. package/src/components/ui/refresh-control/index.web.tsx +104 -0
  186. package/src/components/ui/safe-area-view/index.web.tsx +24 -0
  187. package/src/components/ui/scroll-view/index.web.tsx +142 -0
  188. package/src/components/ui/section-list/index.web.tsx +93 -0
  189. package/src/components/ui/select/index.web.tsx +83 -0
  190. package/src/components/ui/slider/index.web.tsx +283 -0
  191. package/src/components/ui/spinner/index.web.tsx +81 -0
  192. package/src/components/ui/status-bar/index.web.tsx +20 -0
  193. package/src/components/ui/switch/index.web.tsx +44 -0
  194. package/src/components/ui/tabs/index.web.tsx +205 -0
  195. package/src/components/ui/textarea/index.web.tsx +86 -0
  196. package/src/components/ui/toast/index.web.tsx +132 -0
  197. package/src/components/ui/tooltip/index.web.tsx +155 -0
  198. package/src/components/ui/view/index.web.tsx +15 -0
  199. package/src/components/ui/virtualized-list/index.web.tsx +84 -0
  200. package/src/components/with-interactions-lifecycle-managed.tsx +0 -4
  201. package/src/components/with-interactions-managed.tsx +3 -4
  202. package/src/containers/layout/module.ts +1 -1
  203. package/src/interfaces/settings.ts +1 -0
  204. package/src/utils/routeConfigKeyReplace.test.ts +4 -4
@@ -0,0 +1,326 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { createPopover } from '@gluestack-ui/popover';
4
+ import { Motion, createMotionAnimatedComponent, AnimatePresence } from '@legendapp/motion';
5
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
6
+ import { withStyleContext, useStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
7
+ import { cssInterop } from 'nativewind';
8
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
9
+
10
+ // Create web-specific components
11
+ const Div = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>((props, ref) => <div ref={ref} {...props} />);
12
+ Div.displayName = 'Div';
13
+
14
+ const Button = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'>>((props, ref) => (
15
+ <button type="button" ref={ref} {...props} />
16
+ ));
17
+ Button.displayName = 'Button';
18
+
19
+ const AnimatedDiv = createMotionAnimatedComponent(Div);
20
+ const MotionDiv = Motion.View;
21
+ const SCOPE = 'POPOVER';
22
+
23
+ const UIPopover = createPopover({
24
+ Root: withStyleContext(Div, SCOPE),
25
+ Arrow: MotionDiv,
26
+ Backdrop: AnimatedDiv,
27
+ Body: Div,
28
+ CloseButton: Button,
29
+ Content: MotionDiv,
30
+ Footer: Div,
31
+ Header: Div,
32
+ AnimatePresence: AnimatePresence,
33
+ });
34
+
35
+ cssInterop(MotionDiv, { className: 'style' });
36
+ cssInterop(AnimatedDiv, { className: 'style' });
37
+
38
+ const SIZES = {
39
+ xs: 'xs',
40
+ sm: 'sm',
41
+ md: 'md',
42
+ lg: 'lg',
43
+ full: 'full',
44
+ } as const;
45
+
46
+ type Size = keyof typeof SIZES;
47
+
48
+ const popoverStyle = tva({
49
+ base: 'group/popover w-full h-full justify-center items-center pointer-events-none',
50
+ variants: {
51
+ size: {
52
+ [SIZES.xs]: '',
53
+ [SIZES.sm]: '',
54
+ [SIZES.md]: '',
55
+ [SIZES.lg]: '',
56
+ [SIZES.full]: '',
57
+ },
58
+ },
59
+ });
60
+
61
+ const popoverArrowStyle = tva({
62
+ base: 'bg-background-0 z-[1] border absolute overflow-hidden h-3.5 w-3.5 border-outline-100',
63
+ variants: {
64
+ placement: {
65
+ 'top left':
66
+ 'data-[flip=false]:border-t-0 data-[flip=false]:border-l-0 data-[flip=true]:border-b-0 data-[flip=true]:border-r-0',
67
+ top: 'data-[flip=false]:border-t-0 data-[flip=false]:border-l-0 data-[flip=true]:border-b-0 data-[flip=true]:border-r-0',
68
+ 'top right':
69
+ 'data-[flip=false]:border-t-0 data-[flip=false]:border-l-0 data-[flip=true]:border-b-0 data-[flip=true]:border-r-0',
70
+ bottom: 'data-[flip=false]:border-b-0 data-[flip=false]:border-r-0 data-[flip=true]:border-t-0 data-[flip=true]:border-l-0',
71
+ 'bottom left':
72
+ 'data-[flip=false]:border-b-0 data-[flip=false]:border-r-0 data-[flip=true]:border-t-0 data-[flip=true]:border-l-0',
73
+ 'bottom right':
74
+ 'data-[flip=false]:border-b-0 data-[flip=false]:border-r-0 data-[flip=true]:border-t-0 data-[flip=true]:border-l-0',
75
+ left: 'data-[flip=false]:border-l-0 data-[flip=false]:border-b-0 data-[flip=true]:border-r-0 data-[flip=true]:border-t-0',
76
+ 'left top':
77
+ 'data-[flip=false]:border-l-0 data-[flip=false]:border-b-0 data-[flip=true]:border-r-0 data-[flip=true]:border-t-0',
78
+ 'left bottom':
79
+ 'data-[flip=false]:border-l-0 data-[flip=false]:border-b-0 data-[flip=true]:border-r-0 data-[flip=true]:border-t-0',
80
+ right: 'data-[flip=false]:border-r-0 data-[flip=false]:border-t-0 data-[flip=true]:border-l-0 data-[flip=true]:border-b-0',
81
+ 'right top':
82
+ 'data-[flip=false]:border-r-0 data-[flip=false]:border-t-0 data-[flip=true]:border-l-0 data-[flip=true]:border-b-0',
83
+ 'right bottom':
84
+ 'data-[flip=false]:border-r-0 data-[flip=false]:border-t-0 data-[flip=true]:border-l-0 data-[flip=true]:border-b-0',
85
+ } as const,
86
+ },
87
+ });
88
+
89
+ const popoverBackdropStyle = tva({
90
+ base: 'absolute left-0 top-0 right-0 bottom-0 cursor-default',
91
+ });
92
+
93
+ const popoverCloseButtonStyle = tva({
94
+ base: 'group/popover-close-button z-[1] rounded-sm data-[focus-visible=true]:bg-background-100 outline-0 cursor-pointer',
95
+ });
96
+
97
+ const popoverContentStyle = tva({
98
+ base: 'bg-background-0 rounded-lg overflow-hidden border border-outline-100 w-full',
99
+ parentVariants: {
100
+ size: {
101
+ [SIZES.xs]: 'max-w-[360px] p-3.5',
102
+ [SIZES.sm]: 'max-w-[420px] p-4',
103
+ [SIZES.md]: 'max-w-[510px] p-[18px]',
104
+ [SIZES.lg]: 'max-w-[640px] p-5',
105
+ [SIZES.full]: 'p-6',
106
+ },
107
+ },
108
+ });
109
+
110
+ const popoverHeaderStyle = tva({
111
+ base: 'flex-row justify-between items-center',
112
+ });
113
+
114
+ const popoverBodyStyle = tva({
115
+ base: '',
116
+ });
117
+
118
+ const popoverFooterStyle = tva({
119
+ base: 'flex-row justify-between items-center',
120
+ });
121
+
122
+ type IPopoverProps = React.ComponentProps<typeof UIPopover> &
123
+ VariantProps<typeof popoverStyle> & { className?: string };
124
+
125
+ type IPopoverArrowProps = React.ComponentProps<typeof UIPopover.Arrow> &
126
+ VariantProps<typeof popoverArrowStyle> & { className?: string };
127
+
128
+ type IPopoverContentProps = React.ComponentProps<typeof UIPopover.Content> &
129
+ VariantProps<typeof popoverContentStyle> & { className?: string };
130
+
131
+ type IPopoverHeaderProps = React.ComponentProps<typeof UIPopover.Header> &
132
+ VariantProps<typeof popoverHeaderStyle> & { className?: string };
133
+
134
+ type IPopoverFooterProps = React.ComponentProps<typeof UIPopover.Footer> &
135
+ VariantProps<typeof popoverFooterStyle> & { className?: string };
136
+
137
+ type IPopoverBodyProps = React.ComponentProps<typeof UIPopover.Body> &
138
+ VariantProps<typeof popoverBodyStyle> & { className?: string };
139
+
140
+ type IPopoverBackdropProps = React.ComponentProps<typeof UIPopover.Backdrop> &
141
+ VariantProps<typeof popoverBackdropStyle> & { className?: string };
142
+
143
+ type IPopoverCloseButtonProps = React.ComponentProps<typeof UIPopover.CloseButton> &
144
+ VariantProps<typeof popoverCloseButtonStyle> & { className?: string };
145
+
146
+ const Popover = React.forwardRef<React.ElementRef<typeof UIPopover>, IPopoverProps>(
147
+ ({ className, size = 'md', placement = 'bottom', ...props }, ref) => {
148
+ return (
149
+ <UIPopover
150
+ ref={ref}
151
+ placement={placement}
152
+ {...props}
153
+ className={popoverStyle({ size: size as Size, class: className })}
154
+ context={{ size, placement }}
155
+ />
156
+ );
157
+ },
158
+ );
159
+
160
+ const PopoverContent = React.forwardRef<React.ElementRef<typeof UIPopover.Content>, IPopoverContentProps>(
161
+ ({ className, size, ...props }, ref) => {
162
+ const { size: parentSize } = useStyleContext(SCOPE);
163
+
164
+ return (
165
+ <UIPopover.Content
166
+ ref={ref}
167
+ transition={{
168
+ type: 'spring',
169
+ damping: 18,
170
+ stiffness: 250,
171
+ mass: 0.9,
172
+ opacity: {
173
+ type: 'timing',
174
+ duration: 50,
175
+ delay: 50,
176
+ },
177
+ }}
178
+ {...props}
179
+ className={popoverContentStyle({
180
+ parentVariants: {
181
+ size: parentSize as Size,
182
+ },
183
+ size: size as Size,
184
+ class: className,
185
+ })}
186
+ />
187
+ );
188
+ },
189
+ );
190
+
191
+ const PopoverArrow = React.forwardRef<React.ElementRef<typeof UIPopover.Arrow>, IPopoverArrowProps>(
192
+ ({ className, ...props }, ref) => {
193
+ const { placement } = useStyleContext(SCOPE);
194
+ return (
195
+ <UIPopover.Arrow
196
+ ref={ref}
197
+ transition={{
198
+ type: 'spring',
199
+ damping: 18,
200
+ stiffness: 250,
201
+ mass: 0.9,
202
+ opacity: {
203
+ type: 'timing',
204
+ duration: 50,
205
+ delay: 50,
206
+ },
207
+ }}
208
+ {...props}
209
+ className={popoverArrowStyle({
210
+ class: className,
211
+ placement,
212
+ })}
213
+ />
214
+ );
215
+ },
216
+ );
217
+
218
+ const PopoverBackdrop = React.forwardRef<React.ElementRef<typeof UIPopover.Backdrop>, IPopoverBackdropProps>(
219
+ ({ className, ...props }, ref) => {
220
+ return (
221
+ <UIPopover.Backdrop
222
+ ref={ref}
223
+ {...props}
224
+ initial={{
225
+ opacity: 0,
226
+ }}
227
+ animate={{
228
+ opacity: 0.1,
229
+ }}
230
+ exit={{
231
+ opacity: 0,
232
+ }}
233
+ transition={{
234
+ type: 'spring',
235
+ damping: 18,
236
+ stiffness: 450,
237
+ mass: 0.9,
238
+ opacity: {
239
+ type: 'timing',
240
+ duration: 50,
241
+ delay: 50,
242
+ },
243
+ }}
244
+ className={popoverBackdropStyle({
245
+ class: className,
246
+ })}
247
+ />
248
+ );
249
+ },
250
+ );
251
+
252
+ const PopoverBody = React.forwardRef<React.ElementRef<typeof UIPopover.Body>, IPopoverBodyProps>(
253
+ ({ className, ...props }, ref) => {
254
+ return (
255
+ <UIPopover.Body
256
+ ref={ref}
257
+ {...props}
258
+ className={popoverBodyStyle({
259
+ class: className,
260
+ })}
261
+ />
262
+ );
263
+ },
264
+ );
265
+
266
+ const PopoverCloseButton = React.forwardRef<React.ElementRef<typeof UIPopover.CloseButton>, IPopoverCloseButtonProps>(
267
+ ({ className, ...props }, ref) => {
268
+ return (
269
+ <UIPopover.CloseButton
270
+ ref={ref}
271
+ {...props}
272
+ className={popoverCloseButtonStyle({
273
+ class: className,
274
+ })}
275
+ />
276
+ );
277
+ },
278
+ );
279
+
280
+ const PopoverFooter = React.forwardRef<React.ElementRef<typeof UIPopover.Footer>, IPopoverFooterProps>(
281
+ ({ className, ...props }, ref) => {
282
+ return (
283
+ <UIPopover.Footer
284
+ ref={ref}
285
+ {...props}
286
+ className={popoverFooterStyle({
287
+ class: className,
288
+ })}
289
+ />
290
+ );
291
+ },
292
+ );
293
+
294
+ const PopoverHeader = React.forwardRef<React.ElementRef<typeof UIPopover.Header>, IPopoverHeaderProps>(
295
+ ({ className, ...props }, ref) => {
296
+ return (
297
+ <UIPopover.Header
298
+ ref={ref}
299
+ {...props}
300
+ className={popoverHeaderStyle({
301
+ class: className,
302
+ })}
303
+ />
304
+ );
305
+ },
306
+ );
307
+
308
+ Popover.displayName = 'Popover';
309
+ PopoverArrow.displayName = 'PopoverArrow';
310
+ PopoverBackdrop.displayName = 'PopoverBackdrop';
311
+ PopoverContent.displayName = 'PopoverContent';
312
+ PopoverHeader.displayName = 'PopoverHeader';
313
+ PopoverFooter.displayName = 'PopoverFooter';
314
+ PopoverBody.displayName = 'PopoverBody';
315
+ PopoverCloseButton.displayName = 'PopoverCloseButton';
316
+
317
+ export {
318
+ Popover,
319
+ PopoverBackdrop,
320
+ PopoverArrow,
321
+ PopoverCloseButton,
322
+ PopoverFooter,
323
+ PopoverHeader,
324
+ PopoverBody,
325
+ PopoverContent,
326
+ };
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { createPortal } from 'react-dom';
4
+
5
+ interface PortalProps {
6
+ children?: React.ReactNode;
7
+ containerRef?: React.RefObject<HTMLElement>;
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ }
11
+
12
+ export const Portal = React.forwardRef<HTMLDivElement, PortalProps>(
13
+ ({ children, containerRef, className, style, ...props }, ref) => {
14
+ const [mounted, setMounted] = React.useState(false);
15
+
16
+ React.useEffect(() => {
17
+ setMounted(true);
18
+ return () => setMounted(false);
19
+ }, []);
20
+
21
+ if (!mounted) return null;
22
+
23
+ const container = containerRef?.current ?? document.body;
24
+
25
+ return createPortal(
26
+ <div ref={ref} className={className} style={style} {...props}>
27
+ {children}
28
+ </div>,
29
+ container,
30
+ );
31
+ },
32
+ );
33
+
34
+ Portal.displayName = 'Portal';
@@ -0,0 +1,73 @@
1
+ 'use client';
2
+ import React, { forwardRef, useState } from 'react';
3
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
4
+ import { clsx } from 'clsx';
5
+
6
+ const pressableStyle = tva({
7
+ base: 'cursor-pointer select-none outline-none',
8
+ variants: {
9
+ disabled: {
10
+ true: 'opacity-40 cursor-not-allowed',
11
+ },
12
+ pressed: {
13
+ true: 'opacity-70',
14
+ },
15
+ hovered: {
16
+ true: 'hover:opacity-80',
17
+ },
18
+ focused: {
19
+ true: 'focus:ring-2 focus:ring-offset-2 focus:ring-blue-500',
20
+ },
21
+ },
22
+ });
23
+
24
+ type PressableProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> & {
25
+ onPress?: (event: React.MouseEvent<HTMLButtonElement>) => void;
26
+ onPressIn?: (event: React.MouseEvent<HTMLButtonElement>) => void;
27
+ onPressOut?: (event: React.MouseEvent<HTMLButtonElement>) => void;
28
+ disabled?: boolean;
29
+ className?: string;
30
+ };
31
+
32
+ export const Pressable = forwardRef<HTMLButtonElement, PressableProps>(
33
+ ({ onPress, onPressIn, onPressOut, disabled, className, children, ...props }, ref) => {
34
+ const [isPressed, setIsPressed] = useState(false);
35
+ const [isHovered, setIsHovered] = useState(false);
36
+ const [isFocused, setIsFocused] = useState(false);
37
+
38
+ return (
39
+ <button
40
+ ref={ref}
41
+ className={pressableStyle({
42
+ disabled,
43
+ pressed: isPressed,
44
+ hovered: isHovered,
45
+ focused: isFocused,
46
+ class: clsx(className),
47
+ })}
48
+ disabled={disabled}
49
+ onClick={onPress}
50
+ onMouseDown={(e) => {
51
+ setIsPressed(true);
52
+ onPressIn?.(e);
53
+ }}
54
+ onMouseUp={(e) => {
55
+ setIsPressed(false);
56
+ onPressOut?.(e);
57
+ }}
58
+ onMouseEnter={() => setIsHovered(true)}
59
+ onMouseLeave={() => {
60
+ setIsHovered(false);
61
+ setIsPressed(false);
62
+ }}
63
+ onFocus={() => setIsFocused(true)}
64
+ onBlur={() => setIsFocused(false)}
65
+ {...props}
66
+ >
67
+ {children}
68
+ </button>
69
+ );
70
+ },
71
+ );
72
+
73
+ Pressable.displayName = 'Pressable';
@@ -0,0 +1,123 @@
1
+ 'use client';
2
+ import React, { forwardRef } from 'react';
3
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
4
+ import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
5
+ import { cssInterop } from 'nativewind';
6
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
7
+
8
+ const SCOPE = 'PROGRESS';
9
+
10
+ const progressStyle = tva({
11
+ base: 'w-full overflow-hidden bg-gray-200 rounded-full',
12
+ variants: {
13
+ size: {
14
+ xs: 'h-1',
15
+ sm: 'h-2',
16
+ md: 'h-3',
17
+ lg: 'h-4',
18
+ },
19
+ variant: {
20
+ determinate: '',
21
+ indeterminate: 'relative',
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ size: 'md',
26
+ variant: 'determinate',
27
+ },
28
+ });
29
+
30
+ const fillerStyle = tva({
31
+ base: 'h-full rounded-full transition-all duration-300 ease-in-out',
32
+ variants: {
33
+ variant: {
34
+ determinate: '',
35
+ indeterminate: 'absolute animate-progress-indeterminate',
36
+ },
37
+ colorScheme: {
38
+ primary: 'bg-blue-600',
39
+ success: 'bg-green-600',
40
+ warning: 'bg-yellow-600',
41
+ error: 'bg-red-600',
42
+ },
43
+ },
44
+ defaultVariants: {
45
+ variant: 'determinate',
46
+ colorScheme: 'primary',
47
+ },
48
+ });
49
+
50
+ type IProgressProps = React.ComponentProps<'div'> & {
51
+ value?: number;
52
+ min?: number;
53
+ max?: number;
54
+ size?: VariantProps<typeof progressStyle>['size'];
55
+ variant?: VariantProps<typeof progressStyle>['variant'];
56
+ colorScheme?: VariantProps<typeof fillerStyle>['colorScheme'];
57
+ isIndeterminate?: boolean;
58
+ };
59
+
60
+ const Progress = forwardRef<HTMLDivElement, IProgressProps>(
61
+ (
62
+ {
63
+ className,
64
+ value = 0,
65
+ min = 0,
66
+ max = 100,
67
+ size,
68
+ variant: variantProp,
69
+ colorScheme,
70
+ isIndeterminate,
71
+ ...props
72
+ },
73
+ ref,
74
+ ) => {
75
+ const variant = isIndeterminate ? 'indeterminate' : variantProp || 'determinate';
76
+ const percentage = Math.min(100, Math.max(0, ((value - min) / (max - min)) * 100));
77
+
78
+ return (
79
+ <div
80
+ ref={ref}
81
+ role="progressbar"
82
+ aria-valuemin={min}
83
+ aria-valuemax={max}
84
+ aria-valuenow={isIndeterminate ? undefined : value}
85
+ className={progressStyle({ size, variant, class: className })}
86
+ {...props}
87
+ >
88
+ <div
89
+ className={fillerStyle({ variant, colorScheme })}
90
+ style={{
91
+ width: variant === 'determinate' ? `${percentage}%` : '40%',
92
+ }}
93
+ />
94
+ </div>
95
+ );
96
+ },
97
+ );
98
+
99
+ Progress.displayName = 'Progress';
100
+
101
+ export { Progress };
102
+
103
+ // Add keyframes for indeterminate animation to your global CSS:
104
+ const styles = `
105
+ @keyframes progress-indeterminate {
106
+ 0% {
107
+ left: -40%;
108
+ }
109
+ 100% {
110
+ left: 100%;
111
+ }
112
+ }
113
+
114
+ .animate-progress-indeterminate {
115
+ animation: progress-indeterminate 1.5s infinite ease-in-out;
116
+ }
117
+ `;
118
+
119
+ if (typeof document !== 'undefined') {
120
+ const styleSheet = document.createElement('style');
121
+ styleSheet.textContent = styles;
122
+ document.head.appendChild(styleSheet);
123
+ }
@@ -0,0 +1,130 @@
1
+ 'use client';
2
+ import React, { forwardRef, createContext, useContext } from 'react';
3
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
4
+ import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
5
+ import { cssInterop } from 'nativewind';
6
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
7
+
8
+ const SCOPE = 'RADIO';
9
+
10
+ const radioStyle = tva({
11
+ base: 'form-radio h-4 w-4 text-blue-600 transition duration-150 ease-in-out',
12
+ variants: {
13
+ size: {
14
+ sm: 'h-3 w-3',
15
+ md: 'h-4 w-4',
16
+ lg: 'h-5 w-5',
17
+ },
18
+ status: {
19
+ error: 'border-red-500 focus:border-red-500 focus:ring-red-500',
20
+ success: 'border-green-500 focus:border-green-500 focus:ring-green-500',
21
+ warning: 'border-yellow-500 focus:border-yellow-500 focus:ring-yellow-500',
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ size: 'md',
26
+ },
27
+ });
28
+
29
+ const labelStyle = tva({
30
+ base: 'ml-2 select-none',
31
+ variants: {
32
+ size: {
33
+ sm: 'text-sm',
34
+ md: 'text-base',
35
+ lg: 'text-lg',
36
+ },
37
+ disabled: {
38
+ true: 'opacity-50 cursor-not-allowed',
39
+ },
40
+ },
41
+ defaultVariants: {
42
+ size: 'md',
43
+ },
44
+ });
45
+
46
+ type RadioGroupContextType = {
47
+ value?: string;
48
+ onChange?: (value: string) => void;
49
+ name?: string;
50
+ size?: VariantProps<typeof radioStyle>['size'];
51
+ status?: VariantProps<typeof radioStyle>['status'];
52
+ };
53
+
54
+ const RadioGroupContext = createContext<RadioGroupContextType>({});
55
+
56
+ export const RadioGroup = forwardRef<HTMLDivElement, React.ComponentProps<'div'> & RadioGroupContextType>(
57
+ ({ value, onChange, name, size, status, ...props }, ref) => {
58
+ return (
59
+ <RadioGroupContext.Provider value={{ value, onChange, name, size, status }}>
60
+ <div ref={ref} role="radiogroup" {...props} />
61
+ </RadioGroupContext.Provider>
62
+ );
63
+ },
64
+ );
65
+
66
+ RadioGroup.displayName = 'RadioGroup';
67
+
68
+ export const RadioLabel = forwardRef<
69
+ HTMLLabelElement,
70
+ React.ComponentProps<'label'> & {
71
+ size?: VariantProps<typeof labelStyle>['size'];
72
+ disabled?: boolean;
73
+ }
74
+ >(({ className, size, disabled, ...props }, ref) => {
75
+ return <label ref={ref} className={labelStyle({ size, disabled, class: className })} {...props} />;
76
+ });
77
+
78
+ RadioLabel.displayName = 'RadioLabel';
79
+
80
+ export const RadioIcon = forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
81
+ ({ className, children, ...props }, ref) => {
82
+ return (
83
+ <div ref={ref} className={`flex items-center justify-center ${className || ''}`} {...props}>
84
+ {children}
85
+ </div>
86
+ );
87
+ },
88
+ );
89
+
90
+ RadioIcon.displayName = 'RadioIcon';
91
+
92
+ type IRadioProps = Omit<React.ComponentProps<'input'>, 'size'> & {
93
+ value: string;
94
+ size?: VariantProps<typeof radioStyle>['size'];
95
+ status?: VariantProps<typeof radioStyle>['status'];
96
+ };
97
+
98
+ const Radio = forwardRef<HTMLInputElement, IRadioProps>(
99
+ ({ className, value, size: itemSize, status: itemStatus, onChange, ...props }, ref) => {
100
+ const group = useContext(RadioGroupContext);
101
+ const size = itemSize || group.size;
102
+ const status = itemStatus || group.status;
103
+
104
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
105
+ if (onChange) {
106
+ onChange(e);
107
+ }
108
+ if (group.onChange) {
109
+ group.onChange(e.target.value);
110
+ }
111
+ };
112
+
113
+ return (
114
+ <input
115
+ ref={ref}
116
+ type="radio"
117
+ value={value}
118
+ checked={group.value === value}
119
+ name={group.name}
120
+ onChange={handleChange}
121
+ className={radioStyle({ size, status, class: className })}
122
+ {...props}
123
+ />
124
+ );
125
+ },
126
+ );
127
+
128
+ Radio.displayName = 'Radio';
129
+
130
+ export { Radio };