@flipova/foundation 1.14.0 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +53 -178
  3. package/components/ui/accordion/ANIMATION_CUSTOMIZATION.md +162 -0
  4. package/components/ui/accordion/AccordionAnimatedHeight.tsx +56 -0
  5. package/components/ui/accordion/AccordionAnimatedIcon.tsx +41 -0
  6. package/components/ui/accordion/AnimatedHeight.tsx +56 -0
  7. package/components/ui/accordion/AnimatedIcon.tsx +41 -0
  8. package/components/ui/accordion/MIGRATION_SUMMARY.md +250 -0
  9. package/components/ui/accordion/USAGE_EXAMPLE.tsx +179 -0
  10. package/components/ui/accordion/animation-config.ts +32 -0
  11. package/components/ui/accordion/index.tsx +253 -0
  12. package/components/ui/actionsheet/index.tsx +511 -0
  13. package/components/ui/alert/index.tsx +158 -0
  14. package/components/ui/alert-dialog/index.tsx +254 -0
  15. package/components/ui/avatar/index.tsx +139 -0
  16. package/components/ui/badge/index.tsx +163 -0
  17. package/components/ui/bottomsheet/index.tsx +477 -0
  18. package/components/ui/box/index.tsx +19 -0
  19. package/components/ui/box/index.web.tsx +19 -0
  20. package/components/ui/box/styles.tsx +10 -0
  21. package/components/ui/button/index.tsx +264 -0
  22. package/components/ui/calendar/creator.tsx +366 -0
  23. package/components/ui/calendar/index.tsx +462 -0
  24. package/components/ui/calendar/styles.tsx +140 -0
  25. package/components/ui/card/index.tsx +23 -0
  26. package/components/ui/card/index.web.tsx +26 -0
  27. package/components/ui/card/styles.tsx +16 -0
  28. package/components/ui/center/index.tsx +22 -0
  29. package/components/ui/center/index.web.tsx +20 -0
  30. package/components/ui/center/styles.tsx +8 -0
  31. package/components/ui/checkbox/index.tsx +184 -0
  32. package/components/ui/date-time-picker/creator.tsx +109 -0
  33. package/components/ui/date-time-picker/index.tsx +585 -0
  34. package/components/ui/date-time-picker/index.web.tsx +217 -0
  35. package/components/ui/date-time-picker/styles.tsx +56 -0
  36. package/components/ui/divider/index.tsx +40 -0
  37. package/components/ui/drawer/index.tsx +362 -0
  38. package/components/ui/fab/index.tsx +215 -0
  39. package/components/ui/flat-list/index.tsx +21 -0
  40. package/components/ui/form-control/index.tsx +352 -0
  41. package/components/ui/gluestack-ui-provider/config.ts +72 -0
  42. package/components/ui/gluestack-ui-provider/index.tsx +47 -0
  43. package/components/ui/gluestack-ui-provider/index.web.tsx +96 -0
  44. package/components/ui/gluestack-ui-provider/script.ts +19 -0
  45. package/components/ui/gluestack-ui-provider/tokens.d.ts +17 -0
  46. package/components/ui/gluestack-ui-provider/tokens.js +188 -0
  47. package/components/ui/gluestack-ui-provider/useGluestackColors.ts +82 -0
  48. package/components/ui/grid/index.tsx +283 -0
  49. package/components/ui/grid/index.web.tsx +66 -0
  50. package/components/ui/grid/styles.tsx +15 -0
  51. package/components/ui/heading/index.tsx +220 -0
  52. package/components/ui/heading/index.web.tsx +202 -0
  53. package/components/ui/heading/styles.tsx +43 -0
  54. package/components/ui/hstack/index.tsx +27 -0
  55. package/components/ui/hstack/index.web.tsx +26 -0
  56. package/components/ui/hstack/styles.tsx +25 -0
  57. package/components/ui/icon/index.tsx +1588 -0
  58. package/components/ui/icon/index.web.tsx +1573 -0
  59. package/components/ui/image/index.tsx +48 -0
  60. package/components/ui/image-background/index.tsx +25 -0
  61. package/components/ui/image-viewer/index.tsx +743 -0
  62. package/components/ui/image-viewer/index.web.tsx +302 -0
  63. package/components/ui/index.ts +58 -0
  64. package/components/ui/input/index.tsx +125 -0
  65. package/components/ui/input-accessory-view/index.tsx +2 -0
  66. package/components/ui/keyboard-avoiding-view/index.tsx +2 -0
  67. package/components/ui/link/index.tsx +102 -0
  68. package/components/ui/liquid-glass/index.tsx +74 -0
  69. package/components/ui/menu/index.tsx +186 -0
  70. package/components/ui/modal/index.tsx +237 -0
  71. package/components/ui/popover/index.tsx +272 -0
  72. package/components/ui/portal/index.tsx +17 -0
  73. package/components/ui/pressable/index.tsx +39 -0
  74. package/components/ui/progress/index.tsx +83 -0
  75. package/components/ui/radio/index.tsx +217 -0
  76. package/components/ui/refresh-control/index.tsx +2 -0
  77. package/components/ui/safe-area-view/index.tsx +2 -0
  78. package/components/ui/scroll-view/index.tsx +2 -0
  79. package/components/ui/section-list/index.tsx +2 -0
  80. package/components/ui/select/index.tsx +277 -0
  81. package/components/ui/select/select-actionsheet.tsx +562 -0
  82. package/components/ui/skeleton/index.tsx +105 -0
  83. package/components/ui/skeleton/index.web.tsx +103 -0
  84. package/components/ui/skeleton/styles.tsx +35 -0
  85. package/components/ui/slider/index.tsx +181 -0
  86. package/components/ui/spinner/index.tsx +40 -0
  87. package/components/ui/status-bar/index.tsx +2 -0
  88. package/components/ui/switch/index.tsx +41 -0
  89. package/components/ui/table/index.tsx +210 -0
  90. package/components/ui/table/index.web.tsx +157 -0
  91. package/components/ui/table/styles.tsx +44 -0
  92. package/components/ui/tabs/TabsAnimatedIndicator.tsx +160 -0
  93. package/components/ui/tabs/animation-config.ts +3 -0
  94. package/components/ui/tabs/creator.tsx +206 -0
  95. package/components/ui/tabs/index.tsx +484 -0
  96. package/components/ui/text/index.tsx +48 -0
  97. package/components/ui/text/index.web.tsx +45 -0
  98. package/components/ui/text/styles.tsx +47 -0
  99. package/components/ui/textarea/index.tsx +94 -0
  100. package/components/ui/toast/index.tsx +252 -0
  101. package/components/ui/tooltip/index.tsx +131 -0
  102. package/components/ui/view/index.tsx +2 -0
  103. package/components/ui/virtualized-list/index.tsx +2 -0
  104. package/components/ui/vstack/index.tsx +28 -0
  105. package/components/ui/vstack/index.web.tsx +27 -0
  106. package/components/ui/vstack/styles.tsx +25 -0
  107. package/design/canonical.index.txt +53 -0
  108. package/design/documentation.xml +519 -0
  109. package/design/manifest.xml +90 -0
  110. package/design/schema.xsd +639 -0
  111. package/design/themes.xml +204 -0
  112. package/design/tokens.xml +510 -0
  113. package/design/tools/design.js +165 -0
  114. package/design/tools/npm.js +65 -0
  115. package/design/tools/requirements.txt +35 -0
  116. package/design/tools/sources/.checker/__init__.py +81 -0
  117. package/design/tools/sources/.checker/checks.py +198 -0
  118. package/design/tools/sources/.checker/cli.py +154 -0
  119. package/design/tools/sources/.checker/io.py +242 -0
  120. package/design/tools/sources/.checker/model.py +144 -0
  121. package/design/tools/sources/.checker/registry.py +115 -0
  122. package/design/tools/sources/.checker/report.py +21 -0
  123. package/design/tools/sources/.docgen/__init__.py +45 -0
  124. package/design/tools/sources/.docgen/cli.py +101 -0
  125. package/design/tools/sources/.docgen/model.py +147 -0
  126. package/design/tools/sources/.docgen/reference.py +97 -0
  127. package/design/tools/sources/.docgen/site.py +145 -0
  128. package/design/tools/sources/.docgen/xsddoc.py +329 -0
  129. package/design/tools/sources/.generate/__init__.py +35 -0
  130. package/design/tools/sources/.generate/cli.py +76 -0
  131. package/design/tools/sources/.generate/common.py +33 -0
  132. package/design/tools/sources/.generate/config.py +119 -0
  133. package/design/tools/sources/.generate/model.py +51 -0
  134. package/design/tools/sources/.generate/tokens.py +141 -0
  135. package/design/tools/sources/.linter/__init__.py +9 -0
  136. package/design/tools/sources/.linter/cli.py +44 -0
  137. package/design/tools/sources/.linter/discovery.py +30 -0
  138. package/design/tools/sources/.linter/errors.py +45 -0
  139. package/design/tools/sources/.linter/linter.py +68 -0
  140. package/design/tools/sources/.xmleditor/__init__.py +74 -0
  141. package/design/tools/sources/.xmleditor/blocks.py +185 -0
  142. package/design/tools/sources/.xmleditor/cli.py +141 -0
  143. package/design/tools/sources/.xmleditor/editor.py +906 -0
  144. package/design/tools/sources/.xmleditor/model.py +708 -0
  145. package/design/tools/sources/.xmleditor/widgets.py +1832 -0
  146. package/design/tools/sources/.xmleditor/xsdmodel.py +753 -0
  147. package/design/tools/sources/checker.py +55 -0
  148. package/design/tools/sources/docgen.py +66 -0
  149. package/design/tools/sources/generate.py +48 -0
  150. package/design/tools/sources/linter.py +54 -0
  151. package/design/tools/sources/ruff.toml +12 -0
  152. package/design/tools/sources/xmleditor.py +62 -0
  153. package/design/tools/unix/_venv_python.sh +16 -0
  154. package/design/tools/unix/check.sh +13 -0
  155. package/design/tools/unix/doc.sh +14 -0
  156. package/design/tools/unix/gen.sh +14 -0
  157. package/design/tools/unix/lint.sh +10 -0
  158. package/design/tools/unix/run.sh +20 -0
  159. package/design/tools/unix/verify.sh +12 -0
  160. package/design/tools/unix/xmledit.sh +12 -0
  161. package/design/tools/windows/check.cmd +12 -0
  162. package/design/tools/windows/doc.cmd +12 -0
  163. package/design/tools/windows/gen.cmd +11 -0
  164. package/design/tools/windows/lint.cmd +9 -0
  165. package/design/tools/windows/run.cmd +26 -0
  166. package/design/tools/windows/verify.cmd +10 -0
  167. package/design/tools/windows/xmledit.cmd +10 -0
  168. package/dist/chunk-LV4UIEQN.js +9730 -0
  169. package/dist/chunk-LV4UIEQN.js.map +1 -0
  170. package/dist/chunk-WNVU3BM2.mjs +9401 -0
  171. package/dist/chunk-WNVU3BM2.mjs.map +1 -0
  172. package/dist/index.d.mts +40 -10
  173. package/dist/index.d.ts +40 -10
  174. package/dist/index.js +726 -414
  175. package/dist/index.mjs +1 -5
  176. package/dist/ui/index.d.mts +6931 -3070
  177. package/dist/ui/index.d.ts +6931 -3070
  178. package/dist/ui/index.js +779 -352
  179. package/dist/ui/index.mjs +1 -2
  180. package/package.json +66 -149
  181. package/dist/chunk-2XORADW6.js +0 -24552
  182. package/dist/chunk-2XORADW6.js.map +0 -1
  183. package/dist/chunk-52BHHF5M.js +0 -46
  184. package/dist/chunk-52BHHF5M.js.map +0 -1
  185. package/dist/chunk-5647JY7Z.mjs +0 -100
  186. package/dist/chunk-5647JY7Z.mjs.map +0 -1
  187. package/dist/chunk-5N5HC4ZA.mjs +0 -3
  188. package/dist/chunk-5N5HC4ZA.mjs.map +0 -1
  189. package/dist/chunk-7QFZMGL6.js +0 -8583
  190. package/dist/chunk-7QFZMGL6.js.map +0 -1
  191. package/dist/chunk-ASZEP37D.js +0 -423
  192. package/dist/chunk-ASZEP37D.js.map +0 -1
  193. package/dist/chunk-BH5SU2JQ.mjs +0 -8282
  194. package/dist/chunk-BH5SU2JQ.mjs.map +0 -1
  195. package/dist/chunk-BO65GO53.mjs +0 -422
  196. package/dist/chunk-BO65GO53.mjs.map +0 -1
  197. package/dist/chunk-BSVXX52E.mjs +0 -413
  198. package/dist/chunk-BSVXX52E.mjs.map +0 -1
  199. package/dist/chunk-DNV5UBNF.mjs +0 -3
  200. package/dist/chunk-DNV5UBNF.mjs.map +0 -1
  201. package/dist/chunk-EDTAMUO2.js +0 -8310
  202. package/dist/chunk-EDTAMUO2.js.map +0 -1
  203. package/dist/chunk-IJTI6EX4.js +0 -4
  204. package/dist/chunk-IJTI6EX4.js.map +0 -1
  205. package/dist/chunk-M3YLASM2.js +0 -428
  206. package/dist/chunk-M3YLASM2.js.map +0 -1
  207. package/dist/chunk-OXKOGLXE.js +0 -4
  208. package/dist/chunk-OXKOGLXE.js.map +0 -1
  209. package/dist/chunk-RQXQK3ZO.mjs +0 -8486
  210. package/dist/chunk-RQXQK3ZO.mjs.map +0 -1
  211. package/dist/chunk-SR25V4EA.mjs +0 -40
  212. package/dist/chunk-SR25V4EA.mjs.map +0 -1
  213. package/dist/chunk-UB34WFEQ.js +0 -106
  214. package/dist/chunk-UB34WFEQ.js.map +0 -1
  215. package/dist/chunk-ZBRWXKDF.mjs +0 -24431
  216. package/dist/chunk-ZBRWXKDF.mjs.map +0 -1
  217. package/dist/cli/ds.d.mts +0 -1
  218. package/dist/cli/ds.d.ts +0 -1
  219. package/dist/cli/ds.js +0 -602
  220. package/dist/cli/ds.js.map +0 -1
  221. package/dist/cli/ds.mjs +0 -579
  222. package/dist/cli/ds.mjs.map +0 -1
  223. package/dist/cli/flipova.d.mts +0 -1
  224. package/dist/cli/flipova.d.ts +0 -1
  225. package/dist/cli/flipova.js +0 -161
  226. package/dist/cli/flipova.js.map +0 -1
  227. package/dist/cli/flipova.mjs +0 -154
  228. package/dist/cli/flipova.mjs.map +0 -1
  229. package/dist/config/index.d.mts +0 -123
  230. package/dist/config/index.d.ts +0 -123
  231. package/dist/config/index.js +0 -28
  232. package/dist/config/index.js.map +0 -1
  233. package/dist/config/index.mjs +0 -3
  234. package/dist/config/index.mjs.map +0 -1
  235. package/dist/createTheme-DQeX3s0I.d.mts +0 -78
  236. package/dist/createTheme-Y4jfz4-u.d.ts +0 -78
  237. package/dist/index-CuaJA3gM.d.mts +0 -78
  238. package/dist/index-CuaJA3gM.d.ts +0 -78
  239. package/dist/registry/index.d.mts +0 -10160
  240. package/dist/registry/index.d.ts +0 -10160
  241. package/dist/registry/index.js +0 -392
  242. package/dist/registry/index.js.map +0 -1
  243. package/dist/registry/index.mjs +0 -3
  244. package/dist/registry/index.mjs.map +0 -1
  245. package/dist/theme/index.d.mts +0 -35
  246. package/dist/theme/index.d.ts +0 -35
  247. package/dist/theme/index.js +0 -28
  248. package/dist/theme/index.js.map +0 -1
  249. package/dist/theme/index.mjs +0 -3
  250. package/dist/theme/index.mjs.map +0 -1
  251. package/dist/tokens/index.d.mts +0 -423
  252. package/dist/tokens/index.d.ts +0 -423
  253. package/dist/tokens/index.js +0 -44
  254. package/dist/tokens/index.js.map +0 -1
  255. package/dist/tokens/index.mjs +0 -3
  256. package/dist/tokens/index.mjs.map +0 -1
  257. package/dist/types/index.d.mts +0 -202
  258. package/dist/types/index.d.ts +0 -202
  259. package/dist/types/index.js +0 -4
  260. package/dist/types/index.js.map +0 -1
  261. package/dist/types/index.mjs +0 -3
  262. package/dist/types/index.mjs.map +0 -1
  263. package/dist/web/index.d.mts +0 -316
  264. package/dist/web/index.d.ts +0 -316
  265. package/dist/web/index.js +0 -1500
  266. package/dist/web/index.js.map +0 -1
  267. package/dist/web/index.mjs +0 -1396
  268. package/dist/web/index.mjs.map +0 -1
@@ -0,0 +1,217 @@
1
+ 'use client';
2
+
3
+ import React, { useState, useCallback, useMemo } from 'react';
4
+ import { View, Pressable, TextInput } from 'react-native';
5
+ import { cssInterop } from 'nativewind';
6
+ import { Calendar } from '@/components/ui/calendar';
7
+ import { PrimitiveIcon } from '@gluestack-ui/core/icon/creator';
8
+
9
+ // Apply cssInterop for Tailwind support
10
+ cssInterop(View, {
11
+ className: {
12
+ target: 'style',
13
+ },
14
+ });
15
+
16
+ type DateTimePickerMode = 'date' | 'time' | 'datetime';
17
+
18
+ interface DateTimePickerProps {
19
+ value?: Date;
20
+ onChange?: (date: Date | undefined) => void;
21
+ mode?: DateTimePickerMode;
22
+ minimumDate?: Date;
23
+ maximumDate?: Date;
24
+ disabled?: boolean;
25
+ placeholder?: string;
26
+ className?: string;
27
+ style?: any;
28
+ }
29
+
30
+ const DateTimePicker = React.forwardRef<
31
+ React.ComponentRef<typeof View>,
32
+ DateTimePickerProps
33
+ >(function DateTimePicker(
34
+ {
35
+ value,
36
+ onChange,
37
+ mode = 'datetime',
38
+ minimumDate,
39
+ maximumDate,
40
+ disabled,
41
+ placeholder = 'Select date/time',
42
+ className,
43
+ style,
44
+ },
45
+ ref
46
+ ) {
47
+ const [isOpen, setIsOpen] = useState(false);
48
+ const [tempDate, setTempDate] = useState<Date | undefined>(value);
49
+ const [tempTime, setTempTime] = useState(
50
+ value ? formatTimeForInput(value) : ''
51
+ );
52
+
53
+ const handleDateSelect = useCallback(
54
+ (date: Date) => {
55
+ setTempDate(date);
56
+ if (mode === 'date') {
57
+ onChange?.(date);
58
+ setIsOpen(false);
59
+ }
60
+ },
61
+ [mode, onChange]
62
+ );
63
+
64
+ const handleTimeChange = useCallback(
65
+ (e: React.ChangeEvent<HTMLInputElement>) => {
66
+ setTempTime(e.target.value);
67
+ },
68
+ []
69
+ );
70
+
71
+ const handleConfirm = useCallback(() => {
72
+ if (mode === 'time' && tempTime) {
73
+ const [hours, minutes] = tempTime.split(':').map(Number);
74
+ const newDate = new Date();
75
+ newDate.setHours(hours, minutes, 0, 0);
76
+ onChange?.(newDate);
77
+ } else if (tempDate) {
78
+ if (mode === 'datetime' && tempTime) {
79
+ const [hours, minutes] = tempTime.split(':').map(Number);
80
+ const combinedDate = new Date(tempDate);
81
+ combinedDate.setHours(hours, minutes, 0, 0);
82
+ onChange?.(combinedDate);
83
+ } else {
84
+ onChange?.(tempDate);
85
+ }
86
+ }
87
+ setIsOpen(false);
88
+ }, [mode, tempDate, tempTime, onChange]);
89
+
90
+ const handleCancel = useCallback(() => {
91
+ setTempDate(value);
92
+ setTempTime(value ? formatTimeForInput(value) : '');
93
+ setIsOpen(false);
94
+ }, [value]);
95
+
96
+ const displayValue = useMemo(() => {
97
+ if (!value) return '';
98
+ if (mode === 'time') return formatTimeForInput(value);
99
+ if (mode === 'date') return formatDate(value);
100
+ return `${formatDate(value)} ${formatTimeForInput(value)}`;
101
+ }, [value, mode]);
102
+
103
+ return (
104
+ <View ref={ref} className={`relative ${className || ''}`} style={style}>
105
+ {/* Trigger Input */}
106
+ <Pressable
107
+ onPress={() => !disabled && setIsOpen(true)}
108
+ className="w-full"
109
+ >
110
+ <View className="flex-row items-center border border-border rounded-md px-3 py-2 bg-background">
111
+ <TextInput
112
+ value={displayValue || placeholder}
113
+ editable={false}
114
+ className="flex-1 text-foreground text-sm"
115
+ pointerEvents="none"
116
+ />
117
+ </View>
118
+ </Pressable>
119
+
120
+ {/* Modal/Dropdown */}
121
+ {isOpen && (
122
+ <View className="absolute top-full left-0 right-0 mt-2 bg-background border border-border rounded-lg shadow-lg p-4 z-50">
123
+ {/* Date Picker */}
124
+ {(mode === 'date' || mode === 'datetime') && (
125
+ <View className="mb-4">
126
+ <Calendar
127
+ mode="single"
128
+ value={tempDate}
129
+ onValueChange={handleDateSelect}
130
+ minimumDate={minimumDate}
131
+ maximumDate={maximumDate}
132
+ />
133
+ </View>
134
+ )}
135
+
136
+ {/* Time Picker */}
137
+ {(mode === 'time' || mode === 'datetime') && (
138
+ <View className="mb-4">
139
+ <input
140
+ type="time"
141
+ value={tempTime}
142
+ onChange={handleTimeChange}
143
+ className="w-full p-2 border border-border rounded bg-background text-foreground text-sm"
144
+ aria-label="Time"
145
+ />
146
+ </View>
147
+ )}
148
+
149
+ {/* Actions */}
150
+ <View className="flex-row justify-end gap-2">
151
+ <Pressable
152
+ onPress={handleCancel}
153
+ className="px-4 py-2 rounded bg-muted"
154
+ >
155
+ <span className="text-muted-foreground text-sm">Cancel</span>
156
+ </Pressable>
157
+ <Pressable
158
+ onPress={handleConfirm}
159
+ className="px-4 py-2 rounded bg-primary"
160
+ >
161
+ <span className="text-primary-foreground text-sm">Confirm</span>
162
+ </Pressable>
163
+ </View>
164
+ </View>
165
+ )}
166
+ </View>
167
+ );
168
+ });
169
+
170
+ // Helper functions
171
+ function formatDate(date: Date): string {
172
+ return date.toLocaleDateString('en-US', {
173
+ year: 'numeric',
174
+ month: 'short',
175
+ day: 'numeric',
176
+ });
177
+ }
178
+
179
+ function formatTimeForInput(date: Date): string {
180
+ const hours = date.getHours().toString().padStart(2, '0');
181
+ const minutes = date.getMinutes().toString().padStart(2, '0');
182
+ return `${hours}:${minutes}`;
183
+ }
184
+
185
+ // Export additional components (simplified versions)
186
+ const DateTimePickerTrigger = React.forwardRef<
187
+ React.ComponentRef<typeof Pressable>,
188
+ React.ComponentProps<typeof Pressable>
189
+ >(function DateTimePickerTrigger({ children, ...props }, ref) {
190
+ return (
191
+ <Pressable ref={ref} {...props}>
192
+ {children}
193
+ </Pressable>
194
+ );
195
+ });
196
+
197
+ const DateTimePickerInput = React.forwardRef<
198
+ React.ComponentRef<typeof TextInput>,
199
+ React.ComponentProps<typeof TextInput>
200
+ >(function DateTimePickerInput(props, ref) {
201
+ return <TextInput ref={ref} {...props} />;
202
+ });
203
+
204
+ const DateTimePickerIcon = React.forwardRef<
205
+ React.ComponentRef<typeof PrimitiveIcon>,
206
+ React.ComponentProps<typeof PrimitiveIcon>
207
+ >(function DateTimePickerIcon(props, ref) {
208
+ return <PrimitiveIcon ref={ref} {...props} />;
209
+ });
210
+
211
+ export {
212
+ DateTimePicker,
213
+ DateTimePickerTrigger,
214
+ DateTimePickerInput,
215
+ DateTimePickerIcon,
216
+ };
217
+ export type { DateTimePickerProps, DateTimePickerMode };
@@ -0,0 +1,56 @@
1
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
2
+
3
+ export const dateTimePickerStyle = tva({
4
+ base: '',
5
+ });
6
+
7
+ export const dateTimePickerTriggerStyle = tva({
8
+ base: 'border border-border rounded flex-row items-center overflow-hidden data-[hover=true]:border-primary/80 data-[focus=true]:border-primary/80 data-[disabled=true]:opacity-40 data-[disabled=true]:data-[hover=true]:border-border/80',
9
+ variants: {
10
+ size: {
11
+ xl: 'h-12',
12
+ lg: 'h-11',
13
+ md: 'h-10',
14
+ sm: 'h-9',
15
+ },
16
+ variant: {
17
+ underlined:
18
+ 'border-0 border-b rounded-none data-[hover=true]:border-primary/80 data-[focus=true]:border-primary/80 data-[focus=true]:web:shadow-[inset_0_-1px_0_0] data-[focus=true]:web:shadow-primary/80 data-[invalid=true]:border-destructive data-[invalid=true]:web:shadow-destructive',
19
+ outline:
20
+ 'data-[focus=true]:border-primary/80 data-[focus=true]:web:shadow-[inset_0_0_0_1px] data-[focus=true]:data-[hover=true]:web:shadow-primary/80 data-[invalid=true]:web:shadow-[inset_0_0_0_1px] data-[invalid=true]:border-destructive data-[invalid=true]:web:shadow-destructive data-[invalid=true]:data-[hover=true]:border-destructive',
21
+ rounded:
22
+ 'rounded-full data-[focus=true]:border-primary/80 data-[focus=true]:web:shadow-[inset_0_0_0_1px] data-[focus=true]:web:shadow-primary/80 data-[invalid=true]:border-destructive data-[invalid=true]:web:shadow-destructive',
23
+ },
24
+ },
25
+ });
26
+
27
+ export const dateTimePickerInputStyle = tva({
28
+ base: 'px-3 placeholder:text-muted-foreground web:w-full h-full text-foreground/90 pointer-events-none web:outline-none ios:leading-[0px] py-0',
29
+ parentVariants: {
30
+ size: {
31
+ xl: 'text-xl',
32
+ lg: 'text-lg',
33
+ md: 'text-base',
34
+ sm: 'text-sm',
35
+ },
36
+ variant: {
37
+ underlined: 'px-0',
38
+ outline: '',
39
+ rounded: 'px-4',
40
+ },
41
+ },
42
+ });
43
+
44
+ export const dateTimePickerIconStyle = tva({
45
+ base: 'text-foreground/50 fill-none',
46
+ parentVariants: {
47
+ size: {
48
+ '2xs': 'h-3 w-3',
49
+ 'xs': 'h-3.5 w-3.5',
50
+ 'sm': 'h-4 w-4',
51
+ 'md': 'h-[18px] w-[18px]',
52
+ 'lg': 'h-5 w-5',
53
+ 'xl': 'h-6 w-6',
54
+ },
55
+ },
56
+ });
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { tva } from '@gluestack-ui/utils/nativewind-utils';
4
+ import { Platform, View } from 'react-native';
5
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
6
+
7
+ const dividerStyle = tva({
8
+ base: 'bg-border',
9
+ variants: {
10
+ orientation: {
11
+ vertical: 'w-px h-full',
12
+ horizontal: 'h-px w-auto',
13
+ },
14
+ },
15
+ });
16
+
17
+ type IUIDividerProps = React.ComponentPropsWithoutRef<typeof View> &
18
+ VariantProps<typeof dividerStyle>;
19
+
20
+ const Divider = React.forwardRef<
21
+ React.ComponentRef<typeof View>,
22
+ IUIDividerProps
23
+ >(function Divider({ className, orientation = 'horizontal', ...props }, ref) {
24
+ return (
25
+ <View
26
+ ref={ref}
27
+ {...props}
28
+ aria-orientation={orientation}
29
+ role={Platform.OS === 'web' ? 'separator' : undefined}
30
+ className={dividerStyle({
31
+ orientation,
32
+ class: className,
33
+ })}
34
+ />
35
+ );
36
+ });
37
+
38
+ Divider.displayName = 'Divider';
39
+
40
+ export { Divider };
@@ -0,0 +1,362 @@
1
+ 'use client';
2
+ import { createModal as createDrawer } from '@gluestack-ui/core/modal/creator';
3
+ import React from 'react';
4
+ import { Pressable, ScrollView, View } from 'react-native';
5
+
6
+ import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
7
+ import {
8
+ tva,
9
+ useStyleContext,
10
+ withStyleContext,
11
+ } from '@gluestack-ui/utils/nativewind-utils';
12
+ import { cssInterop } from 'nativewind';
13
+ import Animated, {
14
+ SlideInLeft,
15
+ SlideInRight,
16
+ SlideInUp,
17
+ SlideInDown,
18
+ SlideOutLeft,
19
+ SlideOutRight,
20
+ SlideOutUp,
21
+ SlideOutDown,
22
+ FadeIn,
23
+ FadeOut,
24
+ Easing,
25
+ } from 'react-native-reanimated';
26
+
27
+ const SCOPE = 'MODAL';
28
+
29
+ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
30
+ const AnimatedView = Animated.createAnimatedComponent(View);
31
+
32
+ const UIDrawer = createDrawer({
33
+ Root: withStyleContext(View as any, SCOPE),
34
+ Backdrop: AnimatedPressable,
35
+ Content: AnimatedView,
36
+ Body: ScrollView,
37
+ CloseButton: Pressable,
38
+ Footer: View,
39
+ Header: View,
40
+ });
41
+
42
+ cssInterop(AnimatedPressable, { className: 'style' });
43
+ cssInterop(AnimatedView, { className: 'style' });
44
+ const drawerStyle = tva({
45
+ base: 'w-full h-full web:pointer-events-none relative',
46
+ variants: {
47
+ size: {
48
+ sm: '',
49
+ md: '',
50
+ lg: '',
51
+ full: '',
52
+ },
53
+ anchor: {
54
+ left: 'items-start',
55
+ right: 'items-end',
56
+ top: 'justify-start',
57
+ bottom: 'justify-end',
58
+ },
59
+ },
60
+ });
61
+
62
+ const drawerBackdropStyle = tva({
63
+ base: 'absolute left-0 top-0 right-0 bottom-0 bg-black/50 web:cursor-default',
64
+ });
65
+
66
+ const drawerContentStyle = tva({
67
+ base: 'bg-background shadow-hard-5 p-6 absolute',
68
+ parentVariants: {
69
+ size: {
70
+ sm: '',
71
+ md: '',
72
+ lg: '',
73
+ full: '',
74
+ },
75
+ anchor: {
76
+ left: 'h-full border-r border-border/80',
77
+ right: 'h-full border-l border-border/80',
78
+ top: 'w-full border-b border-border/80 rounded-b-xl',
79
+ bottom: 'w-full border-t border-border/80 rounded-t-xl',
80
+ },
81
+ },
82
+ parentCompoundVariants: [
83
+ {
84
+ size: 'sm',
85
+ anchor: 'left',
86
+ class: 'sm:w-1/4 w-2/5',
87
+ },
88
+ {
89
+ size: 'sm',
90
+ anchor: 'right',
91
+ class: 'sm:w-1/4 w-2/5',
92
+ },
93
+ {
94
+ size: 'sm',
95
+ anchor: 'top',
96
+ class: 'h-1/4',
97
+ },
98
+ {
99
+ size: 'sm',
100
+ anchor: 'bottom',
101
+ class: 'h-1/4',
102
+ },
103
+ {
104
+ size: 'md',
105
+ anchor: 'left',
106
+ class: 'w-1/2',
107
+ },
108
+ {
109
+ size: 'md',
110
+ anchor: 'right',
111
+ class: 'w-1/2',
112
+ },
113
+ {
114
+ size: 'md',
115
+ anchor: 'top',
116
+ class: 'h-1/2',
117
+ },
118
+ {
119
+ size: 'md',
120
+ anchor: 'bottom',
121
+ class: 'h-1/2',
122
+ },
123
+ {
124
+ size: 'lg',
125
+ anchor: 'left',
126
+ class: 'w-3/4',
127
+ },
128
+ {
129
+ size: 'lg',
130
+ anchor: 'right',
131
+ class: 'w-3/4',
132
+ },
133
+ {
134
+ size: 'lg',
135
+ anchor: 'top',
136
+ class: 'h-3/4',
137
+ },
138
+ {
139
+ size: 'lg',
140
+ anchor: 'bottom',
141
+ class: 'h-3/4',
142
+ },
143
+ {
144
+ size: 'full',
145
+ anchor: 'left',
146
+ class: 'w-full',
147
+ },
148
+ {
149
+ size: 'full',
150
+ anchor: 'right',
151
+ class: 'w-full',
152
+ },
153
+ {
154
+ size: 'full',
155
+ anchor: 'top',
156
+ class: 'h-full',
157
+ },
158
+ {
159
+ size: 'full',
160
+ anchor: 'bottom',
161
+ class: 'h-full',
162
+ },
163
+ ],
164
+ });
165
+
166
+ const drawerCloseButtonStyle = tva({
167
+ base: 'z-10 rounded-sm p-2 data-[focus-visible=true]:bg-accent web:cursor-pointer web:outline-0 data-[hover=true]:bg-accent/50',
168
+ });
169
+
170
+ const drawerHeaderStyle = tva({
171
+ base: 'justify-between items-center flex-row pb-4',
172
+ });
173
+
174
+ const drawerBodyStyle = tva({
175
+ base: 'mt-4 mb-6 shrink-0',
176
+ });
177
+
178
+ const drawerFooterStyle = tva({
179
+ base: 'flex-col-reverse gap-2 sm:flex-row sm:justify-end pt-4',
180
+ });
181
+
182
+ type IDrawerProps = React.ComponentProps<typeof UIDrawer> &
183
+ VariantProps<typeof drawerStyle> & { className?: string };
184
+
185
+ type IDrawerBackdropProps = React.ComponentProps<typeof UIDrawer.Backdrop> &
186
+ VariantProps<typeof drawerBackdropStyle> & { className?: string };
187
+
188
+ type IDrawerContentProps = React.ComponentProps<typeof UIDrawer.Content> &
189
+ VariantProps<typeof drawerContentStyle> & { className?: string };
190
+
191
+ type IDrawerHeaderProps = React.ComponentProps<typeof UIDrawer.Header> &
192
+ VariantProps<typeof drawerHeaderStyle> & { className?: string };
193
+
194
+ type IDrawerBodyProps = React.ComponentProps<typeof UIDrawer.Body> &
195
+ VariantProps<typeof drawerBodyStyle> & { className?: string };
196
+
197
+ type IDrawerFooterProps = React.ComponentProps<typeof UIDrawer.Footer> &
198
+ VariantProps<typeof drawerFooterStyle> & { className?: string };
199
+
200
+ type IDrawerCloseButtonProps = React.ComponentProps<
201
+ typeof UIDrawer.CloseButton
202
+ > &
203
+ VariantProps<typeof drawerCloseButtonStyle> & { className?: string };
204
+
205
+ const Drawer = React.forwardRef<
206
+ React.ComponentRef<typeof UIDrawer>,
207
+ IDrawerProps
208
+ >(function Drawer({ className, size = 'md', anchor = 'left', ...props }, ref) {
209
+ return (
210
+ <UIDrawer
211
+ ref={ref}
212
+ {...props}
213
+ pointerEvents="box-none"
214
+ className={drawerStyle({ size, anchor, class: className })}
215
+ context={{ size, anchor }}
216
+ />
217
+ );
218
+ });
219
+
220
+ const DrawerBackdrop = React.forwardRef<
221
+ React.ComponentRef<typeof UIDrawer.Backdrop>,
222
+ IDrawerBackdropProps
223
+ >(function DrawerBackdrop({ className, ...props }, ref) {
224
+ return (
225
+ <UIDrawer.Backdrop
226
+ ref={ref}
227
+ entering={FadeIn.duration(200).easing(Easing.in(Easing.cubic))}
228
+ exiting={FadeOut.duration(150)}
229
+ {...props}
230
+ className={drawerBackdropStyle({
231
+ class: className,
232
+ })}
233
+ />
234
+ );
235
+ });
236
+
237
+ const DrawerContent = React.forwardRef<
238
+ React.ComponentRef<typeof UIDrawer.Content>,
239
+ IDrawerContentProps
240
+ >(function DrawerContent({ className, ...props }, ref) {
241
+ const { size: parentSize, anchor: parentAnchor } = useStyleContext(SCOPE);
242
+
243
+ // Calculate positioning classes
244
+ const customClass =
245
+ parentAnchor === 'left' || parentAnchor === 'right'
246
+ ? `top-0 ${parentAnchor === 'left' ? 'left-0' : 'right-0'}`
247
+ : `left-0 ${parentAnchor === 'top' ? 'top-0' : 'bottom-0'}`;
248
+
249
+ // Select entering and exiting animations based on anchor
250
+ const enteringAnimation =
251
+ parentAnchor === 'left'
252
+ ? SlideInLeft.duration(200).easing(Easing.in(Easing.cubic))
253
+ : parentAnchor === 'right'
254
+ ? SlideInRight.duration(200)
255
+ : parentAnchor === 'top'
256
+ ? SlideInUp.duration(200)
257
+ : SlideInDown.duration(200);
258
+
259
+ const exitingAnimation =
260
+ parentAnchor === 'left'
261
+ ? SlideOutLeft.duration(200)
262
+ : parentAnchor === 'right'
263
+ ? SlideOutRight.duration(200)
264
+ : parentAnchor === 'top'
265
+ ? SlideOutUp.duration(200)
266
+ : SlideOutDown.duration(200);
267
+
268
+ return (
269
+ <UIDrawer.Content
270
+ ref={ref}
271
+ entering={enteringAnimation}
272
+ exiting={exitingAnimation}
273
+ {...props}
274
+ className={drawerContentStyle({
275
+ parentVariants: {
276
+ size: parentSize,
277
+ anchor: parentAnchor,
278
+ },
279
+ class: `${className || ''} ${customClass}`,
280
+ })}
281
+ pointerEvents="auto"
282
+ />
283
+ );
284
+ });
285
+
286
+ const DrawerHeader = React.forwardRef<
287
+ React.ComponentRef<typeof UIDrawer.Header>,
288
+ IDrawerHeaderProps
289
+ >(function DrawerHeader({ className, ...props }, ref) {
290
+ return (
291
+ <UIDrawer.Header
292
+ ref={ref}
293
+ {...props}
294
+ className={drawerHeaderStyle({
295
+ class: className,
296
+ })}
297
+ />
298
+ );
299
+ });
300
+
301
+ const DrawerBody = React.forwardRef<
302
+ React.ComponentRef<typeof UIDrawer.Body>,
303
+ IDrawerBodyProps
304
+ >(function DrawerBody({ className, ...props }, ref) {
305
+ return (
306
+ <UIDrawer.Body
307
+ ref={ref}
308
+ {...props}
309
+ className={drawerBodyStyle({
310
+ class: className,
311
+ })}
312
+ />
313
+ );
314
+ });
315
+
316
+ const DrawerFooter = React.forwardRef<
317
+ React.ComponentRef<typeof UIDrawer.Footer>,
318
+ IDrawerFooterProps
319
+ >(function DrawerFooter({ className, ...props }, ref) {
320
+ return (
321
+ <UIDrawer.Footer
322
+ ref={ref}
323
+ {...props}
324
+ className={drawerFooterStyle({
325
+ class: className,
326
+ })}
327
+ />
328
+ );
329
+ });
330
+
331
+ const DrawerCloseButton = React.forwardRef<
332
+ React.ComponentRef<typeof UIDrawer.CloseButton>,
333
+ IDrawerCloseButtonProps
334
+ >(function DrawerCloseButton({ className, ...props }, ref) {
335
+ return (
336
+ <UIDrawer.CloseButton
337
+ ref={ref}
338
+ {...props}
339
+ className={drawerCloseButtonStyle({
340
+ class: className,
341
+ })}
342
+ />
343
+ );
344
+ });
345
+
346
+ Drawer.displayName = 'Drawer';
347
+ DrawerBackdrop.displayName = 'DrawerBackdrop';
348
+ DrawerContent.displayName = 'DrawerContent';
349
+ DrawerHeader.displayName = 'DrawerHeader';
350
+ DrawerBody.displayName = 'DrawerBody';
351
+ DrawerFooter.displayName = 'DrawerFooter';
352
+ DrawerCloseButton.displayName = 'DrawerCloseButton';
353
+
354
+ export {
355
+ Drawer,
356
+ DrawerBackdrop,
357
+ DrawerBody,
358
+ DrawerCloseButton,
359
+ DrawerContent,
360
+ DrawerFooter,
361
+ DrawerHeader,
362
+ };