@admin-layout/gluestack-ui-mobile 10.0.9-alpha.42 → 10.0.9-alpha.53

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 (166) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/components/ui/accordion/index.web.d.ts +209 -0
  3. package/lib/components/ui/accordion/index.web.js +156 -0
  4. package/lib/components/ui/accordion/index.web.js.map +1 -0
  5. package/lib/components/ui/actionsheet/index.web.d.ts +872 -0
  6. package/lib/components/ui/actionsheet/index.web.js +286 -0
  7. package/lib/components/ui/actionsheet/index.web.js.map +1 -0
  8. package/lib/components/ui/alert/index.web.d.ts +135 -0
  9. package/lib/components/ui/alert/index.web.js +38 -0
  10. package/lib/components/ui/alert/index.web.js.map +1 -0
  11. package/lib/components/ui/alert-dialog/index.web.d.ts +64 -0
  12. package/lib/components/ui/alert-dialog/index.web.js +139 -0
  13. package/lib/components/ui/alert-dialog/index.web.js.map +1 -0
  14. package/lib/components/ui/avatar/index.web.d.ts +21 -0
  15. package/lib/components/ui/avatar/index.web.js +92 -0
  16. package/lib/components/ui/avatar/index.web.js.map +1 -0
  17. package/lib/components/ui/badge/index.web.d.ts +382 -0
  18. package/lib/components/ui/badge/index.web.js +138 -0
  19. package/lib/components/ui/badge/index.web.js.map +1 -0
  20. package/lib/components/ui/button/index.web.d.ts +247 -0
  21. package/lib/components/ui/button/index.web.js +57 -0
  22. package/lib/components/ui/button/index.web.js.map +1 -0
  23. package/lib/components/ui/checkbox/index.web.d.ts +265 -0
  24. package/lib/components/ui/checkbox/index.web.js +77 -0
  25. package/lib/components/ui/checkbox/index.web.js.map +1 -0
  26. package/lib/components/ui/divider/index.web.d.ts +53 -0
  27. package/lib/components/ui/divider/index.web.js +21 -0
  28. package/lib/components/ui/divider/index.web.js.map +1 -0
  29. package/lib/components/ui/drawer/index.web.d.ts +174 -0
  30. package/lib/components/ui/drawer/index.web.js +65 -0
  31. package/lib/components/ui/drawer/index.web.js.map +1 -0
  32. package/lib/components/ui/fab/index.web.d.ts +520 -0
  33. package/lib/components/ui/fab/index.web.js +146 -0
  34. package/lib/components/ui/fab/index.web.js.map +1 -0
  35. package/lib/components/ui/flat-list/index.web.d.ts +21 -0
  36. package/lib/components/ui/flat-list/index.web.js +41 -0
  37. package/lib/components/ui/flat-list/index.web.js.map +1 -0
  38. package/lib/components/ui/form-control/index.web.d.ts +2071 -0
  39. package/lib/components/ui/form-control/index.web.js +290 -0
  40. package/lib/components/ui/form-control/index.web.js.map +1 -0
  41. package/lib/components/ui/image/index.web.d.ts +142 -0
  42. package/lib/components/ui/image/index.web.js +29 -0
  43. package/lib/components/ui/image/index.web.js.map +1 -0
  44. package/lib/components/ui/image-background/index.web.d.ts +8 -0
  45. package/lib/components/ui/image-background/index.web.js +23 -0
  46. package/lib/components/ui/image-background/index.web.js.map +1 -0
  47. package/lib/components/ui/input/index.web.d.ts +163 -0
  48. package/lib/components/ui/input/index.web.js +50 -0
  49. package/lib/components/ui/input/index.web.js.map +1 -0
  50. package/lib/components/ui/input-accessory-view/index.web.d.ts +9 -0
  51. package/lib/components/ui/input-accessory-view/index.web.js +16 -0
  52. package/lib/components/ui/input-accessory-view/index.web.js.map +1 -0
  53. package/lib/components/ui/keyboard-avoiding-view/index.web.d.ts +9 -0
  54. package/lib/components/ui/keyboard-avoiding-view/index.web.js +8 -0
  55. package/lib/components/ui/keyboard-avoiding-view/index.web.js.map +1 -0
  56. package/lib/components/ui/link/index.web.d.ts +365 -0
  57. package/lib/components/ui/link/index.web.js +70 -0
  58. package/lib/components/ui/link/index.web.js.map +1 -0
  59. package/lib/components/ui/menu/index.web.d.ts +142 -0
  60. package/lib/components/ui/menu/index.web.js +83 -0
  61. package/lib/components/ui/menu/index.web.js.map +1 -0
  62. package/lib/components/ui/modal/index.web.d.ts +111 -0
  63. package/lib/components/ui/modal/index.web.js +58 -0
  64. package/lib/components/ui/modal/index.web.js.map +1 -0
  65. package/lib/components/ui/popover/index.web.d.ts +309 -0
  66. package/lib/components/ui/popover/index.web.js +184 -0
  67. package/lib/components/ui/popover/index.web.js.map +1 -0
  68. package/lib/components/ui/portal/index.web.d.ts +9 -0
  69. package/lib/components/ui/portal/index.web.js +16 -0
  70. package/lib/components/ui/portal/index.web.js.map +1 -0
  71. package/lib/components/ui/pressable/index.web.d.ts +8 -0
  72. package/lib/components/ui/pressable/index.web.js +44 -0
  73. package/lib/components/ui/pressable/index.web.js.map +1 -0
  74. package/lib/components/ui/progress/index.web.d.ts +237 -0
  75. package/lib/components/ui/progress/index.web.js +73 -0
  76. package/lib/components/ui/progress/index.web.js.map +1 -0
  77. package/lib/components/ui/radio/index.web.d.ts +224 -0
  78. package/lib/components/ui/radio/index.web.js +69 -0
  79. package/lib/components/ui/radio/index.web.js.map +1 -0
  80. package/lib/components/ui/refresh-control/index.web.d.ts +14 -0
  81. package/lib/components/ui/refresh-control/index.web.js +69 -0
  82. package/lib/components/ui/refresh-control/index.web.js.map +1 -0
  83. package/lib/components/ui/safe-area-view/index.web.d.ts +6 -0
  84. package/lib/components/ui/safe-area-view/index.web.js +10 -0
  85. package/lib/components/ui/safe-area-view/index.web.js.map +1 -0
  86. package/lib/components/ui/scroll-view/index.web.d.ts +44 -0
  87. package/lib/components/ui/scroll-view/index.web.js +41 -0
  88. package/lib/components/ui/scroll-view/index.web.js.map +1 -0
  89. package/lib/components/ui/section-list/index.web.d.ts +26 -0
  90. package/lib/components/ui/section-list/index.web.js +35 -0
  91. package/lib/components/ui/section-list/index.web.js.map +1 -0
  92. package/lib/components/ui/select/index.web.d.ts +162 -0
  93. package/lib/components/ui/select/index.web.js +51 -0
  94. package/lib/components/ui/select/index.web.js.map +1 -0
  95. package/lib/components/ui/slider/index.web.d.ts +223 -0
  96. package/lib/components/ui/slider/index.web.js +189 -0
  97. package/lib/components/ui/slider/index.web.js.map +1 -0
  98. package/lib/components/ui/spinner/index.web.d.ts +176 -0
  99. package/lib/components/ui/spinner/index.web.js +55 -0
  100. package/lib/components/ui/spinner/index.web.js.map +1 -0
  101. package/lib/components/ui/status-bar/index.web.d.ts +14 -0
  102. package/lib/components/ui/status-bar/index.web.js +7 -0
  103. package/lib/components/ui/status-bar/index.web.js.map +1 -0
  104. package/lib/components/ui/switch/index.web.d.ts +71 -0
  105. package/lib/components/ui/switch/index.web.js +27 -0
  106. package/lib/components/ui/switch/index.web.js.map +1 -0
  107. package/lib/components/ui/tabs/index.web.d.ts +351 -0
  108. package/lib/components/ui/tabs/index.web.js +120 -0
  109. package/lib/components/ui/tabs/index.web.js.map +1 -0
  110. package/lib/components/ui/textarea/index.web.d.ts +162 -0
  111. package/lib/components/ui/textarea/index.web.js +50 -0
  112. package/lib/components/ui/textarea/index.web.js.map +1 -0
  113. package/lib/components/ui/toast/index.web.d.ts +225 -0
  114. package/lib/components/ui/toast/index.web.js +80 -0
  115. package/lib/components/ui/toast/index.web.js.map +1 -0
  116. package/lib/components/ui/tooltip/index.web.d.ts +86 -0
  117. package/lib/components/ui/tooltip/index.web.js +110 -0
  118. package/lib/components/ui/tooltip/index.web.js.map +1 -0
  119. package/lib/components/ui/view/index.web.d.ts +2 -0
  120. package/lib/components/ui/view/index.web.js +7 -0
  121. package/lib/components/ui/view/index.web.js.map +1 -0
  122. package/lib/components/ui/virtualized-list/index.web.d.ts +19 -0
  123. package/lib/components/ui/virtualized-list/index.web.js +30 -0
  124. package/lib/components/ui/virtualized-list/index.web.js.map +1 -0
  125. package/package.json +8 -4
  126. package/src/components/ui/accordion/index.web.tsx +294 -0
  127. package/src/components/ui/actionsheet/index.web.tsx +555 -0
  128. package/src/components/ui/alert/index.web.tsx +71 -0
  129. package/src/components/ui/alert-dialog/index.web.tsx +241 -0
  130. package/src/components/ui/avatar/index.web.tsx +150 -0
  131. package/src/components/ui/badge/index.web.tsx +188 -0
  132. package/src/components/ui/button/index.web.tsx +86 -0
  133. package/src/components/ui/checkbox/index.web.tsx +151 -0
  134. package/src/components/ui/divider/index.web.tsx +37 -0
  135. package/src/components/ui/drawer/index.web.tsx +144 -0
  136. package/src/components/ui/fab/index.web.tsx +201 -0
  137. package/src/components/ui/flat-list/index.web.tsx +89 -0
  138. package/src/components/ui/form-control/index.web.tsx +451 -0
  139. package/src/components/ui/image/index.web.tsx +43 -0
  140. package/src/components/ui/image-background/index.web.tsx +43 -0
  141. package/src/components/ui/input/index.web.tsx +80 -0
  142. package/src/components/ui/input-accessory-view/index.web.tsx +31 -0
  143. package/src/components/ui/keyboard-avoiding-view/index.web.tsx +23 -0
  144. package/src/components/ui/link/index.web.tsx +103 -0
  145. package/src/components/ui/menu/index.web.tsx +159 -0
  146. package/src/components/ui/modal/index.web.tsx +135 -0
  147. package/src/components/ui/popover/index.web.tsx +326 -0
  148. package/src/components/ui/portal/index.web.tsx +34 -0
  149. package/src/components/ui/pressable/index.web.tsx +73 -0
  150. package/src/components/ui/progress/index.web.tsx +123 -0
  151. package/src/components/ui/radio/index.web.tsx +130 -0
  152. package/src/components/ui/refresh-control/index.web.tsx +104 -0
  153. package/src/components/ui/safe-area-view/index.web.tsx +24 -0
  154. package/src/components/ui/scroll-view/index.web.tsx +142 -0
  155. package/src/components/ui/section-list/index.web.tsx +93 -0
  156. package/src/components/ui/select/index.web.tsx +83 -0
  157. package/src/components/ui/slider/index.web.tsx +283 -0
  158. package/src/components/ui/spinner/index.web.tsx +81 -0
  159. package/src/components/ui/status-bar/index.web.tsx +20 -0
  160. package/src/components/ui/switch/index.web.tsx +44 -0
  161. package/src/components/ui/tabs/index.web.tsx +205 -0
  162. package/src/components/ui/textarea/index.web.tsx +86 -0
  163. package/src/components/ui/toast/index.web.tsx +132 -0
  164. package/src/components/ui/tooltip/index.web.tsx +155 -0
  165. package/src/components/ui/view/index.web.tsx +15 -0
  166. package/src/components/ui/virtualized-list/index.web.tsx +84 -0
@@ -0,0 +1,283 @@
1
+ 'use client';
2
+ import { createSlider } from '@gluestack-ui/slider';
3
+ import React from 'react';
4
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
5
+ import { withStyleContext, useStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
6
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
7
+ import { cssInterop } from 'nativewind';
8
+
9
+ const SCOPE = 'SLIDER';
10
+
11
+ // Create styled components for web
12
+ const StyledRoot = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement>>((props, ref) => (
13
+ <div ref={ref} {...props} />
14
+ ));
15
+
16
+ const StyledThumb = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement>>((props, ref) => (
17
+ <div ref={ref} {...props} />
18
+ ));
19
+
20
+ const StyledTrack = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement>>((props, ref) => (
21
+ <div ref={ref} {...props} />
22
+ ));
23
+
24
+ const StyledFilledTrack = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement>>((props, ref) => (
25
+ <div ref={ref} {...props} />
26
+ ));
27
+
28
+ const StyledThumbInteraction = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement>>((props, ref) => (
29
+ <div ref={ref} {...props} />
30
+ ));
31
+
32
+ const Root = withStyleContext(StyledRoot, SCOPE);
33
+ export const UISlider = createSlider({
34
+ Root,
35
+ Thumb: StyledThumb,
36
+ Track: StyledTrack,
37
+ FilledTrack: StyledFilledTrack,
38
+ ThumbInteraction: StyledThumbInteraction,
39
+ });
40
+
41
+ // Remove problematic cssInterop for now as it's causing type issues
42
+ // cssInterop(UISlider.Track, {
43
+ // target: false,
44
+ // nativeStyleToProp: {
45
+ // style: true,
46
+ // },
47
+ // });
48
+
49
+ const sliderStyle = tva({
50
+ base: 'justify-center items-center data-[disabled=true]:opacity-40 data-[disabled=true]:pointer-events-none',
51
+ variants: {
52
+ orientation: {
53
+ horizontal: 'w-full',
54
+ vertical: 'h-full',
55
+ },
56
+ size: {
57
+ sm: '',
58
+ md: '',
59
+ lg: '',
60
+ },
61
+ isReversed: {
62
+ true: '',
63
+ false: '',
64
+ },
65
+ },
66
+ });
67
+
68
+ const sliderThumbStyle = tva({
69
+ base: 'bg-primary-500 absolute rounded-full data-[focus=true]:bg-primary-600 data-[active=true]:bg-primary-600 data-[hover=true]:bg-primary-600 data-[disabled=true]:bg-primary-500 cursor-pointer data-[active=true]:outline data-[active=true]:outline-4 data-[active=true]:outline-primary-400 shadow-hard-1',
70
+ parentVariants: {
71
+ size: {
72
+ sm: 'h-4 w-4',
73
+ md: 'h-5 w-5',
74
+ lg: 'h-6 w-6',
75
+ },
76
+ },
77
+ });
78
+
79
+ const sliderTrackStyle = tva({
80
+ base: 'bg-background-300 rounded-lg overflow-hidden',
81
+ parentVariants: {
82
+ orientation: {
83
+ horizontal: 'w-full',
84
+ vertical: 'h-full',
85
+ },
86
+ isReversed: {
87
+ true: '',
88
+ false: '',
89
+ },
90
+ size: {
91
+ sm: '',
92
+ md: '',
93
+ lg: '',
94
+ },
95
+ },
96
+ parentCompoundVariants: [
97
+ {
98
+ orientation: 'horizontal',
99
+ size: 'sm',
100
+ class: 'h-1 flex-row',
101
+ },
102
+ {
103
+ orientation: 'horizontal',
104
+ size: 'sm',
105
+ isReversed: true,
106
+ class: 'h-1 flex-row-reverse',
107
+ },
108
+ {
109
+ orientation: 'horizontal',
110
+ size: 'md',
111
+ class: 'h-1 flex-row',
112
+ },
113
+ {
114
+ orientation: 'horizontal',
115
+ size: 'md',
116
+ isReversed: true,
117
+ class: 'h-[5px] flex-row-reverse',
118
+ },
119
+ {
120
+ orientation: 'horizontal',
121
+ size: 'lg',
122
+ class: 'h-1.5 flex-row',
123
+ },
124
+ {
125
+ orientation: 'horizontal',
126
+ size: 'lg',
127
+ isReversed: true,
128
+ class: 'h-1.5 flex-row-reverse',
129
+ },
130
+ {
131
+ orientation: 'vertical',
132
+ size: 'sm',
133
+ class: 'w-1 flex-col-reverse',
134
+ },
135
+ {
136
+ orientation: 'vertical',
137
+ size: 'sm',
138
+ isReversed: true,
139
+ class: 'w-1 flex-col',
140
+ },
141
+ {
142
+ orientation: 'vertical',
143
+ size: 'md',
144
+ class: 'w-[5px] flex-col-reverse',
145
+ },
146
+ {
147
+ orientation: 'vertical',
148
+ size: 'md',
149
+ isReversed: true,
150
+ class: 'w-[5px] flex-col',
151
+ },
152
+ {
153
+ orientation: 'vertical',
154
+ size: 'lg',
155
+ class: 'w-1.5 flex-col-reverse',
156
+ },
157
+ {
158
+ orientation: 'vertical',
159
+ size: 'lg',
160
+ isReversed: true,
161
+ class: 'w-1.5 flex-col',
162
+ },
163
+ ],
164
+ });
165
+
166
+ const sliderFilledTrackStyle = tva({
167
+ base: 'bg-primary-500 data-[focus=true]:bg-primary-600 data-[active=true]:bg-primary-600 data-[hover=true]:bg-primary-600',
168
+ parentVariants: {
169
+ orientation: {
170
+ horizontal: 'h-full',
171
+ vertical: 'w-full',
172
+ },
173
+ },
174
+ });
175
+
176
+ interface BaseSliderProps {
177
+ className?: string;
178
+ size?: 'sm' | 'md' | 'lg';
179
+ orientation?: 'horizontal' | 'vertical';
180
+ isReversed?: boolean;
181
+ style?: React.CSSProperties;
182
+ children?: React.ReactNode;
183
+ onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
184
+ onMouseDown?: (event: React.MouseEvent<HTMLDivElement>) => void;
185
+ onMouseUp?: (event: React.MouseEvent<HTMLDivElement>) => void;
186
+ onMouseEnter?: (event: React.MouseEvent<HTMLDivElement>) => void;
187
+ onMouseLeave?: (event: React.MouseEvent<HTMLDivElement>) => void;
188
+ }
189
+
190
+ type ISliderProps = React.ComponentProps<typeof UISlider> & VariantProps<typeof sliderStyle> & BaseSliderProps;
191
+
192
+ const Slider = React.forwardRef<React.ElementRef<typeof UISlider>, ISliderProps>(
193
+ ({ className, size = 'md', orientation = 'horizontal', isReversed = false, ...props }, ref) => {
194
+ return (
195
+ <UISlider
196
+ ref={ref}
197
+ isReversed={isReversed}
198
+ orientation={orientation}
199
+ {...props}
200
+ className={sliderStyle({
201
+ orientation,
202
+ isReversed,
203
+ class: className,
204
+ })}
205
+ context={{ size, orientation, isReversed }}
206
+ />
207
+ );
208
+ },
209
+ );
210
+
211
+ type ISliderThumbProps = React.ComponentProps<typeof UISlider.Thumb> &
212
+ VariantProps<typeof sliderThumbStyle> &
213
+ BaseSliderProps;
214
+
215
+ const SliderThumb = React.forwardRef<React.ElementRef<typeof UISlider.Thumb>, ISliderThumbProps>(
216
+ ({ className, size, ...props }, ref) => {
217
+ const { size: parentSize } = useStyleContext(SCOPE);
218
+
219
+ return (
220
+ <UISlider.Thumb
221
+ ref={ref}
222
+ {...props}
223
+ className={sliderThumbStyle({
224
+ parentVariants: {
225
+ size: parentSize,
226
+ },
227
+ size,
228
+ class: className,
229
+ })}
230
+ />
231
+ );
232
+ },
233
+ );
234
+
235
+ type ISliderTrackProps = React.ComponentProps<typeof UISlider.Track> &
236
+ VariantProps<typeof sliderTrackStyle> &
237
+ BaseSliderProps;
238
+
239
+ const SliderTrack = React.forwardRef<React.ElementRef<typeof UISlider.Track>, ISliderTrackProps>(
240
+ ({ className, ...props }, ref) => {
241
+ const { orientation: parentOrientation, size: parentSize, isReversed } = useStyleContext(SCOPE);
242
+
243
+ return (
244
+ <UISlider.Track
245
+ ref={ref}
246
+ {...props}
247
+ className={sliderTrackStyle({
248
+ parentVariants: {
249
+ orientation: parentOrientation,
250
+ size: parentSize,
251
+ isReversed,
252
+ },
253
+ class: className,
254
+ })}
255
+ />
256
+ );
257
+ },
258
+ );
259
+
260
+ type ISliderFilledTrackProps = React.ComponentProps<typeof UISlider.FilledTrack> &
261
+ VariantProps<typeof sliderFilledTrackStyle> &
262
+ BaseSliderProps;
263
+
264
+ const SliderFilledTrack = React.forwardRef<React.ElementRef<typeof UISlider.FilledTrack>, ISliderFilledTrackProps>(
265
+ ({ className, ...props }, ref) => {
266
+ const { orientation: parentOrientation } = useStyleContext(SCOPE);
267
+
268
+ return (
269
+ <UISlider.FilledTrack
270
+ ref={ref}
271
+ {...props}
272
+ className={sliderFilledTrackStyle({
273
+ parentVariants: {
274
+ orientation: parentOrientation,
275
+ },
276
+ class: className,
277
+ })}
278
+ />
279
+ );
280
+ },
281
+ );
282
+
283
+ export { Slider, SliderThumb, SliderTrack, SliderFilledTrack };
@@ -0,0 +1,81 @@
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 = 'SPINNER';
9
+
10
+ const spinnerStyle = tva({
11
+ base: 'inline-block rounded-full border-[2px] border-t-transparent animate-spin',
12
+ variants: {
13
+ size: {
14
+ xs: 'h-3 w-3 border-[1px]',
15
+ sm: 'h-4 w-4 border-[1.5px]',
16
+ md: 'h-6 w-6 border-[2px]',
17
+ lg: 'h-8 w-8 border-[2.5px]',
18
+ xl: 'h-12 w-12 border-[3px]',
19
+ },
20
+ colorScheme: {
21
+ primary: 'border-blue-600',
22
+ success: 'border-green-600',
23
+ warning: 'border-yellow-600',
24
+ error: 'border-red-600',
25
+ light: 'border-white',
26
+ dark: 'border-gray-900',
27
+ },
28
+ },
29
+ defaultVariants: {
30
+ size: 'md',
31
+ colorScheme: 'primary',
32
+ },
33
+ });
34
+
35
+ type ISpinnerProps = React.ComponentProps<'div'> & {
36
+ size?: VariantProps<typeof spinnerStyle>['size'];
37
+ colorScheme?: VariantProps<typeof spinnerStyle>['colorScheme'];
38
+ label?: string;
39
+ };
40
+
41
+ const Spinner = forwardRef<HTMLDivElement, ISpinnerProps>(
42
+ ({ className, size, colorScheme, label = 'Loading...', ...props }, ref) => {
43
+ return (
44
+ <div
45
+ ref={ref}
46
+ role="status"
47
+ aria-label={label}
48
+ className={spinnerStyle({ size, colorScheme, class: className })}
49
+ {...props}
50
+ >
51
+ <span className="sr-only">{label}</span>
52
+ </div>
53
+ );
54
+ },
55
+ );
56
+
57
+ Spinner.displayName = 'Spinner';
58
+
59
+ export { Spinner };
60
+
61
+ // Add keyframes for spin animation to your global CSS:
62
+ const styles = `
63
+ @keyframes spin {
64
+ from {
65
+ transform: rotate(0deg);
66
+ }
67
+ to {
68
+ transform: rotate(360deg);
69
+ }
70
+ }
71
+
72
+ .animate-spin {
73
+ animation: spin 0.8s linear infinite;
74
+ }
75
+ `;
76
+
77
+ if (typeof document !== 'undefined') {
78
+ const styleSheet = document.createElement('style');
79
+ styleSheet.textContent = styles;
80
+ document.head.appendChild(styleSheet);
81
+ }
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import React from 'react';
3
+
4
+ interface StatusBarProps {
5
+ animated?: boolean;
6
+ backgroundColor?: string;
7
+ barStyle?: 'default' | 'light-content' | 'dark-content';
8
+ hidden?: boolean;
9
+ networkActivityIndicatorVisible?: boolean;
10
+ showHideTransition?: 'fade' | 'slide';
11
+ translucent?: boolean;
12
+ }
13
+
14
+ const StatusBar = (_props: StatusBarProps): null => {
15
+ return null;
16
+ };
17
+
18
+ StatusBar.displayName = 'StatusBar';
19
+
20
+ export { StatusBar };
@@ -0,0 +1,44 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { createSwitch } from '@gluestack-ui/switch';
4
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
5
+ import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
6
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
7
+
8
+ const WebSwitch = ({ value, onValueChange, disabled, ...props }: any) => {
9
+ return (
10
+ <input
11
+ type="checkbox"
12
+ checked={value}
13
+ onChange={(e) => onValueChange?.(e.target.checked)}
14
+ disabled={disabled}
15
+ {...props}
16
+ />
17
+ );
18
+ };
19
+
20
+ const UISwitch = createSwitch({
21
+ Root: withStyleContext(WebSwitch),
22
+ });
23
+
24
+ const switchStyle = tva({
25
+ base: 'appearance-none relative inline-block w-10 h-6 rounded-full bg-gray-300 transition-colors duration-200 ease-in-out cursor-pointer focus:outline-none focus:ring-2 focus:ring-indicator-primary checked:bg-primary-500 disabled:cursor-not-allowed disabled:opacity-40 data-[invalid=true]:border-error-700 data-[invalid=true]:border-2',
26
+ variants: {
27
+ size: {
28
+ sm: 'w-8 h-5',
29
+ md: 'w-10 h-6',
30
+ lg: 'w-12 h-7',
31
+ },
32
+ },
33
+ });
34
+
35
+ type ISwitchProps = React.ComponentProps<typeof UISwitch> & VariantProps<typeof switchStyle>;
36
+
37
+ const Switch = React.forwardRef<React.ElementRef<typeof UISwitch>, ISwitchProps>(
38
+ ({ className, size = 'md', ...props }, ref) => {
39
+ return <UISwitch ref={ref} {...props} className={switchStyle({ size, class: className })} />;
40
+ },
41
+ );
42
+
43
+ Switch.displayName = 'Switch';
44
+ export { Switch };
@@ -0,0 +1,205 @@
1
+ 'use client';
2
+ import React, { forwardRef, createContext, useContext, useEffect, useRef, useState } 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 = 'TABS';
9
+
10
+ const tabListStyle = tva({
11
+ base: 'flex border-b border-gray-200',
12
+ variants: {
13
+ align: {
14
+ start: 'justify-start',
15
+ center: 'justify-center',
16
+ end: 'justify-end',
17
+ },
18
+ size: {
19
+ sm: 'gap-2',
20
+ md: 'gap-4',
21
+ lg: 'gap-6',
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ align: 'start',
26
+ size: 'md',
27
+ },
28
+ });
29
+
30
+ const tabStyle = tva({
31
+ base: 'px-4 py-2 font-medium focus:outline-none focus:ring-2 focus:ring-blue-500 rounded-t-lg transition-colors',
32
+ variants: {
33
+ variant: {
34
+ line: '-mb-px border-b-2 hover:border-gray-300',
35
+ enclosed: 'border border-b-0 hover:bg-gray-50',
36
+ soft: 'hover:bg-gray-100 rounded-lg',
37
+ },
38
+ size: {
39
+ sm: 'text-sm',
40
+ md: 'text-base',
41
+ lg: 'text-lg',
42
+ },
43
+ state: {
44
+ active: {
45
+ line: 'border-blue-500 text-blue-600',
46
+ enclosed: 'border-gray-200 bg-white',
47
+ soft: 'bg-gray-100 text-blue-600',
48
+ },
49
+ inactive: {
50
+ line: 'border-transparent text-gray-500',
51
+ enclosed: 'border-transparent text-gray-500',
52
+ soft: 'text-gray-500',
53
+ },
54
+ },
55
+ },
56
+ defaultVariants: {
57
+ variant: 'line',
58
+ size: 'md',
59
+ state: 'inactive',
60
+ },
61
+ });
62
+
63
+ const tabPanelStyle = tva({
64
+ base: 'mt-4 focus:outline-none focus:ring-2 focus:ring-blue-500 rounded-lg',
65
+ });
66
+
67
+ type TabsContextType = {
68
+ selectedIndex: number;
69
+ onChange: (index: number) => void;
70
+ variant?: VariantProps<typeof tabStyle>['variant'];
71
+ size?: VariantProps<typeof tabStyle>['size'];
72
+ };
73
+
74
+ const TabsContext = createContext<TabsContextType>({
75
+ selectedIndex: 0,
76
+ onChange: () => {},
77
+ });
78
+
79
+ type ITabsProps = React.ComponentProps<'div'> & {
80
+ defaultIndex?: number;
81
+ onChange?: (index: number) => void;
82
+ variant?: VariantProps<typeof tabStyle>['variant'];
83
+ size?: VariantProps<typeof tabStyle>['size'];
84
+ };
85
+
86
+ export const Tabs = forwardRef<HTMLDivElement, ITabsProps>(
87
+ ({ defaultIndex = 0, onChange, variant = 'line', size = 'md', children, ...props }, ref) => {
88
+ const [selectedIndex, setSelectedIndex] = useState(defaultIndex);
89
+
90
+ const handleChange = (index: number) => {
91
+ setSelectedIndex(index);
92
+ if (onChange) onChange(index);
93
+ };
94
+
95
+ return (
96
+ <TabsContext.Provider value={{ selectedIndex, onChange: handleChange, variant, size }}>
97
+ <div ref={ref} {...props}>
98
+ {children}
99
+ </div>
100
+ </TabsContext.Provider>
101
+ );
102
+ },
103
+ );
104
+
105
+ Tabs.displayName = 'Tabs';
106
+
107
+ type ITabListProps = React.ComponentProps<'div'> & {
108
+ align?: VariantProps<typeof tabListStyle>['align'];
109
+ size?: VariantProps<typeof tabListStyle>['size'];
110
+ };
111
+
112
+ export const TabList = forwardRef<HTMLDivElement, ITabListProps>(
113
+ ({ className, align, size: sizeProp, children, ...props }, ref) => {
114
+ const { size } = useContext(TabsContext);
115
+
116
+ return (
117
+ <div
118
+ ref={ref}
119
+ role="tablist"
120
+ className={tabListStyle({ align, size: sizeProp || size, class: className })}
121
+ {...props}
122
+ >
123
+ {children}
124
+ </div>
125
+ );
126
+ },
127
+ );
128
+
129
+ TabList.displayName = 'TabList';
130
+
131
+ type ITabProps = Omit<React.ComponentProps<'button'>, 'value'> & {
132
+ index?: number;
133
+ };
134
+
135
+ export const Tab = forwardRef<HTMLButtonElement, ITabProps>(
136
+ ({ className, index = 0, onClick, onKeyDown, children, ...props }, ref) => {
137
+ const { selectedIndex, onChange, variant, size } = useContext(TabsContext);
138
+ const isSelected = selectedIndex === index;
139
+
140
+ const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
141
+ if (onClick) onClick(e);
142
+ onChange(index);
143
+ };
144
+
145
+ const handleKeyDown = (e: React.KeyboardEvent<HTMLButtonElement>) => {
146
+ if (onKeyDown) onKeyDown(e);
147
+ if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
148
+ e.preventDefault();
149
+ const tabList = e.currentTarget.parentElement;
150
+ if (tabList) {
151
+ const tabs = Array.from(tabList.querySelectorAll('[role="tab"]'));
152
+ const currentIndex = tabs.indexOf(e.currentTarget);
153
+ const nextIndex = e.key === 'ArrowLeft' ? currentIndex - 1 : currentIndex + 1;
154
+ if (nextIndex >= 0 && nextIndex < tabs.length) {
155
+ (tabs[nextIndex] as HTMLButtonElement).focus();
156
+ onChange(nextIndex);
157
+ }
158
+ }
159
+ }
160
+ };
161
+
162
+ return (
163
+ <button
164
+ ref={ref}
165
+ role="tab"
166
+ aria-selected={isSelected}
167
+ tabIndex={isSelected ? 0 : -1}
168
+ onClick={handleClick}
169
+ onKeyDown={handleKeyDown}
170
+ className={tabStyle({
171
+ variant,
172
+ size,
173
+ state: isSelected ? 'active' : 'inactive',
174
+ class: className,
175
+ })}
176
+ {...props}
177
+ >
178
+ {children}
179
+ </button>
180
+ );
181
+ },
182
+ );
183
+
184
+ Tab.displayName = 'Tab';
185
+
186
+ type ITabPanelProps = React.ComponentProps<'div'> & {
187
+ index?: number;
188
+ };
189
+
190
+ export const TabPanel = forwardRef<HTMLDivElement, ITabPanelProps>(
191
+ ({ className, index = 0, children, ...props }, ref) => {
192
+ const { selectedIndex } = useContext(TabsContext);
193
+ const isSelected = selectedIndex === index;
194
+
195
+ if (!isSelected) return null;
196
+
197
+ return (
198
+ <div ref={ref} role="tabpanel" tabIndex={0} className={tabPanelStyle({ class: className })} {...props}>
199
+ {children}
200
+ </div>
201
+ );
202
+ },
203
+ );
204
+
205
+ TabPanel.displayName = 'TabPanel';