@admin-layout/gluestack-ui-mobile 10.0.9-alpha.9 → 10.1.1-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.
- package/CHANGELOG.md +1 -9
- package/lib/components/ui/accordion/index.web.d.ts +209 -0
- package/lib/components/ui/accordion/index.web.js +156 -0
- package/lib/components/ui/accordion/index.web.js.map +1 -0
- package/lib/components/ui/actionsheet/index.web.d.ts +872 -0
- package/lib/components/ui/actionsheet/index.web.js +286 -0
- package/lib/components/ui/actionsheet/index.web.js.map +1 -0
- package/lib/components/ui/alert/index.web.d.ts +135 -0
- package/lib/components/ui/alert/index.web.js +38 -0
- package/lib/components/ui/alert/index.web.js.map +1 -0
- package/lib/components/ui/alert-dialog/index.web.d.ts +64 -0
- package/lib/components/ui/alert-dialog/index.web.js +139 -0
- package/lib/components/ui/alert-dialog/index.web.js.map +1 -0
- package/lib/components/ui/avatar/index.web.d.ts +21 -0
- package/lib/components/ui/avatar/index.web.js +92 -0
- package/lib/components/ui/avatar/index.web.js.map +1 -0
- package/lib/components/ui/badge/index.web.d.ts +382 -0
- package/lib/components/ui/badge/index.web.js +138 -0
- package/lib/components/ui/badge/index.web.js.map +1 -0
- package/lib/components/ui/button/index.web.d.ts +247 -0
- package/lib/components/ui/button/index.web.js +57 -0
- package/lib/components/ui/button/index.web.js.map +1 -0
- package/lib/components/ui/checkbox/index.web.d.ts +265 -0
- package/lib/components/ui/checkbox/index.web.js +77 -0
- package/lib/components/ui/checkbox/index.web.js.map +1 -0
- package/lib/components/ui/divider/index.web.d.ts +53 -0
- package/lib/components/ui/divider/index.web.js +21 -0
- package/lib/components/ui/divider/index.web.js.map +1 -0
- package/lib/components/ui/drawer/index.web.d.ts +174 -0
- package/lib/components/ui/drawer/index.web.js +65 -0
- package/lib/components/ui/drawer/index.web.js.map +1 -0
- package/lib/components/ui/fab/index.web.d.ts +520 -0
- package/lib/components/ui/fab/index.web.js +146 -0
- package/lib/components/ui/fab/index.web.js.map +1 -0
- package/lib/components/ui/flat-list/index.web.d.ts +21 -0
- package/lib/components/ui/flat-list/index.web.js +41 -0
- package/lib/components/ui/flat-list/index.web.js.map +1 -0
- package/lib/components/ui/form-control/index.web.d.ts +2071 -0
- package/lib/components/ui/form-control/index.web.js +290 -0
- package/lib/components/ui/form-control/index.web.js.map +1 -0
- package/lib/components/ui/image/index.web.d.ts +142 -0
- package/lib/components/ui/image/index.web.js +29 -0
- package/lib/components/ui/image/index.web.js.map +1 -0
- package/lib/components/ui/image-background/index.web.d.ts +8 -0
- package/lib/components/ui/image-background/index.web.js +23 -0
- package/lib/components/ui/image-background/index.web.js.map +1 -0
- package/lib/components/ui/input/index.web.d.ts +163 -0
- package/lib/components/ui/input/index.web.js +50 -0
- package/lib/components/ui/input/index.web.js.map +1 -0
- package/lib/components/ui/input-accessory-view/index.web.d.ts +9 -0
- package/lib/components/ui/input-accessory-view/index.web.js +16 -0
- package/lib/components/ui/input-accessory-view/index.web.js.map +1 -0
- package/lib/components/ui/keyboard-avoiding-view/index.web.d.ts +9 -0
- package/lib/components/ui/keyboard-avoiding-view/index.web.js +8 -0
- package/lib/components/ui/keyboard-avoiding-view/index.web.js.map +1 -0
- package/lib/components/ui/link/index.web.d.ts +365 -0
- package/lib/components/ui/link/index.web.js +70 -0
- package/lib/components/ui/link/index.web.js.map +1 -0
- package/lib/components/ui/menu/index.web.d.ts +142 -0
- package/lib/components/ui/menu/index.web.js +83 -0
- package/lib/components/ui/menu/index.web.js.map +1 -0
- package/lib/components/ui/modal/index.web.d.ts +111 -0
- package/lib/components/ui/modal/index.web.js +58 -0
- package/lib/components/ui/modal/index.web.js.map +1 -0
- package/lib/components/ui/popover/index.web.d.ts +309 -0
- package/lib/components/ui/popover/index.web.js +184 -0
- package/lib/components/ui/popover/index.web.js.map +1 -0
- package/lib/components/ui/portal/index.web.d.ts +9 -0
- package/lib/components/ui/portal/index.web.js +16 -0
- package/lib/components/ui/portal/index.web.js.map +1 -0
- package/lib/components/ui/pressable/index.web.d.ts +8 -0
- package/lib/components/ui/pressable/index.web.js +44 -0
- package/lib/components/ui/pressable/index.web.js.map +1 -0
- package/lib/components/ui/progress/index.web.d.ts +237 -0
- package/lib/components/ui/progress/index.web.js +73 -0
- package/lib/components/ui/progress/index.web.js.map +1 -0
- package/lib/components/ui/radio/index.web.d.ts +224 -0
- package/lib/components/ui/radio/index.web.js +69 -0
- package/lib/components/ui/radio/index.web.js.map +1 -0
- package/lib/components/ui/refresh-control/index.web.d.ts +14 -0
- package/lib/components/ui/refresh-control/index.web.js +69 -0
- package/lib/components/ui/refresh-control/index.web.js.map +1 -0
- package/lib/components/ui/safe-area-view/index.web.d.ts +6 -0
- package/lib/components/ui/safe-area-view/index.web.js +10 -0
- package/lib/components/ui/safe-area-view/index.web.js.map +1 -0
- package/lib/components/ui/scroll-view/index.web.d.ts +44 -0
- package/lib/components/ui/scroll-view/index.web.js +41 -0
- package/lib/components/ui/scroll-view/index.web.js.map +1 -0
- package/lib/components/ui/section-list/index.web.d.ts +26 -0
- package/lib/components/ui/section-list/index.web.js +35 -0
- package/lib/components/ui/section-list/index.web.js.map +1 -0
- package/lib/components/ui/select/index.web.d.ts +162 -0
- package/lib/components/ui/select/index.web.js +51 -0
- package/lib/components/ui/select/index.web.js.map +1 -0
- package/lib/components/ui/slider/index.web.d.ts +223 -0
- package/lib/components/ui/slider/index.web.js +189 -0
- package/lib/components/ui/slider/index.web.js.map +1 -0
- package/lib/components/ui/spinner/index.web.d.ts +176 -0
- package/lib/components/ui/spinner/index.web.js +55 -0
- package/lib/components/ui/spinner/index.web.js.map +1 -0
- package/lib/components/ui/status-bar/index.web.d.ts +14 -0
- package/lib/components/ui/status-bar/index.web.js +7 -0
- package/lib/components/ui/status-bar/index.web.js.map +1 -0
- package/lib/components/ui/switch/index.web.d.ts +71 -0
- package/lib/components/ui/switch/index.web.js +27 -0
- package/lib/components/ui/switch/index.web.js.map +1 -0
- package/lib/components/ui/tabs/index.web.d.ts +351 -0
- package/lib/components/ui/tabs/index.web.js +120 -0
- package/lib/components/ui/tabs/index.web.js.map +1 -0
- package/lib/components/ui/textarea/index.web.d.ts +162 -0
- package/lib/components/ui/textarea/index.web.js +50 -0
- package/lib/components/ui/textarea/index.web.js.map +1 -0
- package/lib/components/ui/toast/index.web.d.ts +225 -0
- package/lib/components/ui/toast/index.web.js +80 -0
- package/lib/components/ui/toast/index.web.js.map +1 -0
- package/lib/components/ui/tooltip/index.web.d.ts +86 -0
- package/lib/components/ui/tooltip/index.web.js +110 -0
- package/lib/components/ui/tooltip/index.web.js.map +1 -0
- package/lib/components/ui/view/index.web.d.ts +2 -0
- package/lib/components/ui/view/index.web.js +7 -0
- package/lib/components/ui/view/index.web.js.map +1 -0
- package/lib/components/ui/virtualized-list/index.web.d.ts +19 -0
- package/lib/components/ui/virtualized-list/index.web.js +30 -0
- package/lib/components/ui/virtualized-list/index.web.js.map +1 -0
- package/lib/components/usePermissionAutoFetch.d.ts +7 -19
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +47 -47
- package/lib/containers/layout/DrawerConfig.d.ts +31 -31
- package/lib/redux/settings.d.ts +3 -9
- package/package.json +9 -5
- package/src/components/ui/accordion/index.web.tsx +294 -0
- package/src/components/ui/actionsheet/index.web.tsx +555 -0
- package/src/components/ui/alert/index.web.tsx +71 -0
- package/src/components/ui/alert-dialog/index.web.tsx +241 -0
- package/src/components/ui/avatar/index.web.tsx +150 -0
- package/src/components/ui/badge/index.web.tsx +188 -0
- package/src/components/ui/button/index.web.tsx +86 -0
- package/src/components/ui/checkbox/index.web.tsx +151 -0
- package/src/components/ui/divider/index.web.tsx +37 -0
- package/src/components/ui/drawer/index.web.tsx +144 -0
- package/src/components/ui/fab/index.web.tsx +201 -0
- package/src/components/ui/flat-list/index.web.tsx +89 -0
- package/src/components/ui/form-control/index.web.tsx +451 -0
- package/src/components/ui/image/index.web.tsx +43 -0
- package/src/components/ui/image-background/index.web.tsx +43 -0
- package/src/components/ui/input/index.web.tsx +80 -0
- package/src/components/ui/input-accessory-view/index.web.tsx +31 -0
- package/src/components/ui/keyboard-avoiding-view/index.web.tsx +23 -0
- package/src/components/ui/link/index.web.tsx +103 -0
- package/src/components/ui/menu/index.web.tsx +159 -0
- package/src/components/ui/modal/index.web.tsx +135 -0
- package/src/components/ui/popover/index.web.tsx +326 -0
- package/src/components/ui/portal/index.web.tsx +34 -0
- package/src/components/ui/pressable/index.web.tsx +73 -0
- package/src/components/ui/progress/index.web.tsx +123 -0
- package/src/components/ui/radio/index.web.tsx +130 -0
- package/src/components/ui/refresh-control/index.web.tsx +104 -0
- package/src/components/ui/safe-area-view/index.web.tsx +24 -0
- package/src/components/ui/scroll-view/index.web.tsx +142 -0
- package/src/components/ui/section-list/index.web.tsx +93 -0
- package/src/components/ui/select/index.web.tsx +83 -0
- package/src/components/ui/slider/index.web.tsx +283 -0
- package/src/components/ui/spinner/index.web.tsx +81 -0
- package/src/components/ui/status-bar/index.web.tsx +20 -0
- package/src/components/ui/switch/index.web.tsx +44 -0
- package/src/components/ui/tabs/index.web.tsx +205 -0
- package/src/components/ui/textarea/index.web.tsx +86 -0
- package/src/components/ui/toast/index.web.tsx +132 -0
- package/src/components/ui/tooltip/index.web.tsx +155 -0
- package/src/components/ui/view/index.web.tsx +15 -0
- package/src/components/ui/virtualized-list/index.web.tsx +84 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createFormControl } from '@gluestack-ui/form-control';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import { withStyleContext, useStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
6
|
+
import { cssInterop } from 'nativewind';
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
8
|
+
import { PrimitiveIcon, UIIcon } from '@gluestack-ui/icon';
|
|
9
|
+
|
|
10
|
+
const SCOPE = 'FORM_CONTROL';
|
|
11
|
+
|
|
12
|
+
const formControlStyle = tva({
|
|
13
|
+
base: 'flex flex-col',
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: '',
|
|
17
|
+
md: '',
|
|
18
|
+
lg: '',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const formControlErrorIconStyle = tva({
|
|
24
|
+
base: 'text-error-700 fill-none',
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
'2xs': 'h-3 w-3',
|
|
28
|
+
xs: 'h-3.5 w-3.5',
|
|
29
|
+
sm: 'h-4 w-4',
|
|
30
|
+
md: 'h-[18px] w-[18px]',
|
|
31
|
+
lg: 'h-5 w-5',
|
|
32
|
+
xl: 'h-6 w-6',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const formControlErrorStyle = tva({
|
|
38
|
+
base: 'flex flex-row justify-start items-center mt-1 gap-1',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const formControlErrorTextStyle = tva({
|
|
42
|
+
base: 'text-error-700',
|
|
43
|
+
variants: {
|
|
44
|
+
isTruncated: {
|
|
45
|
+
true: 'truncate',
|
|
46
|
+
},
|
|
47
|
+
bold: {
|
|
48
|
+
true: 'font-bold',
|
|
49
|
+
},
|
|
50
|
+
underline: {
|
|
51
|
+
true: 'underline',
|
|
52
|
+
},
|
|
53
|
+
strikeThrough: {
|
|
54
|
+
true: 'line-through',
|
|
55
|
+
},
|
|
56
|
+
size: {
|
|
57
|
+
'2xs': 'text-2xs',
|
|
58
|
+
xs: 'text-xs',
|
|
59
|
+
sm: 'text-sm',
|
|
60
|
+
md: 'text-base',
|
|
61
|
+
lg: 'text-lg',
|
|
62
|
+
xl: 'text-xl',
|
|
63
|
+
'2xl': 'text-2xl',
|
|
64
|
+
'3xl': 'text-3xl',
|
|
65
|
+
'4xl': 'text-4xl',
|
|
66
|
+
'5xl': 'text-5xl',
|
|
67
|
+
'6xl': 'text-6xl',
|
|
68
|
+
},
|
|
69
|
+
sub: {
|
|
70
|
+
true: 'text-xs',
|
|
71
|
+
},
|
|
72
|
+
italic: {
|
|
73
|
+
true: 'italic',
|
|
74
|
+
},
|
|
75
|
+
highlight: {
|
|
76
|
+
true: 'bg-yellow-500',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const formControlHelperStyle = tva({
|
|
82
|
+
base: 'flex flex-row justify-start items-center mt-1',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const formControlHelperTextStyle = tva({
|
|
86
|
+
base: 'text-typography-500',
|
|
87
|
+
variants: {
|
|
88
|
+
isTruncated: {
|
|
89
|
+
true: 'truncate',
|
|
90
|
+
},
|
|
91
|
+
bold: {
|
|
92
|
+
true: 'font-bold',
|
|
93
|
+
},
|
|
94
|
+
underline: {
|
|
95
|
+
true: 'underline',
|
|
96
|
+
},
|
|
97
|
+
strikeThrough: {
|
|
98
|
+
true: 'line-through',
|
|
99
|
+
},
|
|
100
|
+
size: {
|
|
101
|
+
'2xs': 'text-2xs',
|
|
102
|
+
xs: 'text-xs',
|
|
103
|
+
sm: 'text-xs',
|
|
104
|
+
md: 'text-sm',
|
|
105
|
+
lg: 'text-base',
|
|
106
|
+
xl: 'text-xl',
|
|
107
|
+
'2xl': 'text-2xl',
|
|
108
|
+
'3xl': 'text-3xl',
|
|
109
|
+
'4xl': 'text-4xl',
|
|
110
|
+
'5xl': 'text-5xl',
|
|
111
|
+
'6xl': 'text-6xl',
|
|
112
|
+
},
|
|
113
|
+
sub: {
|
|
114
|
+
true: 'text-xs',
|
|
115
|
+
},
|
|
116
|
+
italic: {
|
|
117
|
+
true: 'italic',
|
|
118
|
+
},
|
|
119
|
+
highlight: {
|
|
120
|
+
true: 'bg-yellow-500',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const formControlLabelStyle = tva({
|
|
126
|
+
base: 'flex flex-row justify-start items-center mb-1',
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const formControlLabelTextStyle = tva({
|
|
130
|
+
base: 'font-medium text-typography-900',
|
|
131
|
+
variants: {
|
|
132
|
+
isTruncated: {
|
|
133
|
+
true: 'truncate',
|
|
134
|
+
},
|
|
135
|
+
bold: {
|
|
136
|
+
true: 'font-bold',
|
|
137
|
+
},
|
|
138
|
+
underline: {
|
|
139
|
+
true: 'underline',
|
|
140
|
+
},
|
|
141
|
+
strikeThrough: {
|
|
142
|
+
true: 'line-through',
|
|
143
|
+
},
|
|
144
|
+
size: {
|
|
145
|
+
'2xs': 'text-2xs',
|
|
146
|
+
xs: 'text-xs',
|
|
147
|
+
sm: 'text-sm',
|
|
148
|
+
md: 'text-base',
|
|
149
|
+
lg: 'text-lg',
|
|
150
|
+
xl: 'text-xl',
|
|
151
|
+
'2xl': 'text-2xl',
|
|
152
|
+
'3xl': 'text-3xl',
|
|
153
|
+
'4xl': 'text-4xl',
|
|
154
|
+
'5xl': 'text-5xl',
|
|
155
|
+
'6xl': 'text-6xl',
|
|
156
|
+
},
|
|
157
|
+
sub: {
|
|
158
|
+
true: 'text-xs',
|
|
159
|
+
},
|
|
160
|
+
italic: {
|
|
161
|
+
true: 'italic',
|
|
162
|
+
},
|
|
163
|
+
highlight: {
|
|
164
|
+
true: 'bg-yellow-500',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const formControlLabelAstrickStyle = tva({
|
|
170
|
+
base: 'font-medium text-typography-900',
|
|
171
|
+
variants: {
|
|
172
|
+
isTruncated: {
|
|
173
|
+
true: 'truncate',
|
|
174
|
+
},
|
|
175
|
+
bold: {
|
|
176
|
+
true: 'font-bold',
|
|
177
|
+
},
|
|
178
|
+
underline: {
|
|
179
|
+
true: 'underline',
|
|
180
|
+
},
|
|
181
|
+
strikeThrough: {
|
|
182
|
+
true: 'line-through',
|
|
183
|
+
},
|
|
184
|
+
size: {
|
|
185
|
+
'2xs': 'text-2xs',
|
|
186
|
+
xs: 'text-xs',
|
|
187
|
+
sm: 'text-sm',
|
|
188
|
+
md: 'text-base',
|
|
189
|
+
lg: 'text-lg',
|
|
190
|
+
xl: 'text-xl',
|
|
191
|
+
'2xl': 'text-2xl',
|
|
192
|
+
'3xl': 'text-3xl',
|
|
193
|
+
'4xl': 'text-4xl',
|
|
194
|
+
'5xl': 'text-5xl',
|
|
195
|
+
'6xl': 'text-6xl',
|
|
196
|
+
},
|
|
197
|
+
sub: {
|
|
198
|
+
true: 'text-xs',
|
|
199
|
+
},
|
|
200
|
+
italic: {
|
|
201
|
+
true: 'italic',
|
|
202
|
+
},
|
|
203
|
+
highlight: {
|
|
204
|
+
true: 'bg-yellow-500',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
type IFormControlLabelAstrickProps = React.ComponentPropsWithoutRef<'span'> &
|
|
210
|
+
VariantProps<typeof formControlLabelAstrickStyle>;
|
|
211
|
+
|
|
212
|
+
const FormControlLabelAstrick = React.forwardRef<HTMLSpanElement, IFormControlLabelAstrickProps>(
|
|
213
|
+
({ className, ...props }, ref) => {
|
|
214
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<span
|
|
218
|
+
ref={ref}
|
|
219
|
+
className={formControlLabelAstrickStyle({
|
|
220
|
+
parentVariants: { size: parentSize },
|
|
221
|
+
class: className,
|
|
222
|
+
})}
|
|
223
|
+
{...props}
|
|
224
|
+
/>
|
|
225
|
+
);
|
|
226
|
+
},
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
type FormControlErrorComponent = React.ForwardRefExoticComponent<
|
|
230
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
231
|
+
>;
|
|
232
|
+
|
|
233
|
+
type FormControlErrorTextComponent = React.ForwardRefExoticComponent<
|
|
234
|
+
React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>
|
|
235
|
+
>;
|
|
236
|
+
|
|
237
|
+
type FormControlLabelComponent = React.ForwardRefExoticComponent<
|
|
238
|
+
React.HTMLAttributes<HTMLLabelElement> & React.RefAttributes<HTMLLabelElement>
|
|
239
|
+
>;
|
|
240
|
+
|
|
241
|
+
type FormControlLabelTextComponent = React.ForwardRefExoticComponent<
|
|
242
|
+
React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>
|
|
243
|
+
>;
|
|
244
|
+
|
|
245
|
+
type FormControlHelperComponent = React.ForwardRefExoticComponent<
|
|
246
|
+
React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>
|
|
247
|
+
>;
|
|
248
|
+
|
|
249
|
+
type FormControlHelperTextComponent = React.ForwardRefExoticComponent<
|
|
250
|
+
React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>
|
|
251
|
+
>;
|
|
252
|
+
|
|
253
|
+
export const UIFormControl = createFormControl({
|
|
254
|
+
Root: withStyleContext('form' as any, SCOPE),
|
|
255
|
+
Error: 'div' as any as unknown as FormControlErrorComponent,
|
|
256
|
+
ErrorText: 'span' as any as unknown as FormControlErrorTextComponent,
|
|
257
|
+
ErrorIcon: UIIcon,
|
|
258
|
+
Label: 'label' as any as unknown as FormControlLabelComponent,
|
|
259
|
+
LabelText: 'span' as any as unknown as FormControlLabelTextComponent,
|
|
260
|
+
LabelAstrick: FormControlLabelAstrick,
|
|
261
|
+
Helper: 'div' as any as unknown as FormControlHelperComponent,
|
|
262
|
+
HelperText: 'span' as any as unknown as FormControlHelperTextComponent,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
cssInterop(PrimitiveIcon, {
|
|
266
|
+
className: {
|
|
267
|
+
target: 'style',
|
|
268
|
+
nativeStyleToProp: {
|
|
269
|
+
height: true,
|
|
270
|
+
width: true,
|
|
271
|
+
fill: true,
|
|
272
|
+
color: true,
|
|
273
|
+
stroke: true,
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
type IFormControlProps = React.ComponentProps<typeof UIFormControl> & VariantProps<typeof formControlStyle>;
|
|
279
|
+
|
|
280
|
+
const FormControl = React.forwardRef<React.ElementRef<typeof UIFormControl>, IFormControlProps>(
|
|
281
|
+
({ className, size = 'md', ...props }, ref) => {
|
|
282
|
+
const contextValue = { size };
|
|
283
|
+
return (
|
|
284
|
+
<UIFormControl
|
|
285
|
+
ref={ref}
|
|
286
|
+
className={formControlStyle({ size, class: className })}
|
|
287
|
+
{...props}
|
|
288
|
+
data-context={JSON.stringify(contextValue)}
|
|
289
|
+
/>
|
|
290
|
+
);
|
|
291
|
+
},
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
type IFormControlErrorProps = React.ComponentProps<typeof UIFormControl.Error> &
|
|
295
|
+
VariantProps<typeof formControlErrorStyle> &
|
|
296
|
+
React.HTMLAttributes<HTMLDivElement>;
|
|
297
|
+
|
|
298
|
+
const FormControlError = React.forwardRef<HTMLDivElement, IFormControlErrorProps>(({ className, ...props }, ref) => {
|
|
299
|
+
return <UIFormControl.Error ref={ref as any} className={formControlErrorStyle({ class: className })} {...props} />;
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
type IFormControlErrorTextProps = React.ComponentProps<typeof UIFormControl.Error.Text> &
|
|
303
|
+
VariantProps<typeof formControlErrorTextStyle> &
|
|
304
|
+
React.HTMLAttributes<HTMLSpanElement>;
|
|
305
|
+
|
|
306
|
+
const FormControlErrorText = React.forwardRef<HTMLSpanElement, IFormControlErrorTextProps>(
|
|
307
|
+
({ className, size, ...props }, ref) => {
|
|
308
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
309
|
+
return (
|
|
310
|
+
<UIFormControl.Error.Text
|
|
311
|
+
ref={ref as any}
|
|
312
|
+
className={formControlErrorTextStyle({
|
|
313
|
+
parentVariants: { size: parentSize },
|
|
314
|
+
size,
|
|
315
|
+
class: className,
|
|
316
|
+
})}
|
|
317
|
+
{...props}
|
|
318
|
+
/>
|
|
319
|
+
);
|
|
320
|
+
},
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
type IFormControlErrorIconProps = React.ComponentProps<typeof UIFormControl.Error.Icon> &
|
|
324
|
+
VariantProps<typeof formControlErrorIconStyle> & {
|
|
325
|
+
height?: number;
|
|
326
|
+
width?: number;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
const FormControlErrorIcon = React.forwardRef<
|
|
330
|
+
React.ElementRef<typeof UIFormControl.Error.Icon>,
|
|
331
|
+
IFormControlErrorIconProps
|
|
332
|
+
>(({ className, size, ...props }, ref) => {
|
|
333
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
334
|
+
|
|
335
|
+
if (typeof size === 'number') {
|
|
336
|
+
return (
|
|
337
|
+
<UIFormControl.Error.Icon
|
|
338
|
+
ref={ref}
|
|
339
|
+
{...props}
|
|
340
|
+
className={formControlErrorIconStyle({ class: className })}
|
|
341
|
+
size={size}
|
|
342
|
+
/>
|
|
343
|
+
);
|
|
344
|
+
} else if ((props.height !== undefined || props.width !== undefined) && size === undefined) {
|
|
345
|
+
return (
|
|
346
|
+
<UIFormControl.Error.Icon
|
|
347
|
+
ref={ref}
|
|
348
|
+
{...props}
|
|
349
|
+
className={formControlErrorIconStyle({ class: className })}
|
|
350
|
+
/>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
return (
|
|
354
|
+
<UIFormControl.Error.Icon
|
|
355
|
+
className={formControlErrorIconStyle({
|
|
356
|
+
parentVariants: { size: parentSize },
|
|
357
|
+
size,
|
|
358
|
+
class: className,
|
|
359
|
+
})}
|
|
360
|
+
{...props}
|
|
361
|
+
/>
|
|
362
|
+
);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
type IFormControlLabelProps = React.ComponentProps<typeof UIFormControl.Label> &
|
|
366
|
+
VariantProps<typeof formControlLabelStyle> &
|
|
367
|
+
React.HTMLAttributes<HTMLLabelElement>;
|
|
368
|
+
|
|
369
|
+
const FormControlLabel = React.forwardRef<HTMLLabelElement, IFormControlLabelProps>(({ className, ...props }, ref) => {
|
|
370
|
+
return <UIFormControl.Label ref={ref as any} className={formControlLabelStyle({ class: className })} {...props} />;
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
type IFormControlLabelTextProps = React.ComponentProps<typeof UIFormControl.Label.Text> &
|
|
374
|
+
VariantProps<typeof formControlLabelTextStyle> &
|
|
375
|
+
React.HTMLAttributes<HTMLSpanElement>;
|
|
376
|
+
|
|
377
|
+
const FormControlLabelText = React.forwardRef<HTMLSpanElement, IFormControlLabelTextProps>(
|
|
378
|
+
({ className, size, ...props }, ref) => {
|
|
379
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
380
|
+
return (
|
|
381
|
+
<UIFormControl.Label.Text
|
|
382
|
+
ref={ref as any}
|
|
383
|
+
className={formControlLabelTextStyle({
|
|
384
|
+
parentVariants: { size: parentSize },
|
|
385
|
+
size,
|
|
386
|
+
class: className,
|
|
387
|
+
})}
|
|
388
|
+
{...props}
|
|
389
|
+
/>
|
|
390
|
+
);
|
|
391
|
+
},
|
|
392
|
+
);
|
|
393
|
+
|
|
394
|
+
type IFormControlHelperProps = React.ComponentProps<typeof UIFormControl.Helper> &
|
|
395
|
+
VariantProps<typeof formControlHelperStyle> &
|
|
396
|
+
React.HTMLAttributes<HTMLDivElement>;
|
|
397
|
+
|
|
398
|
+
const FormControlHelper = React.forwardRef<HTMLDivElement, IFormControlHelperProps>(({ className, ...props }, ref) => {
|
|
399
|
+
return (
|
|
400
|
+
<UIFormControl.Helper
|
|
401
|
+
ref={ref as any}
|
|
402
|
+
className={formControlHelperStyle({
|
|
403
|
+
class: className,
|
|
404
|
+
})}
|
|
405
|
+
{...props}
|
|
406
|
+
/>
|
|
407
|
+
);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
type IFormControlHelperTextProps = React.ComponentProps<typeof UIFormControl.Helper.Text> &
|
|
411
|
+
VariantProps<typeof formControlHelperTextStyle> &
|
|
412
|
+
React.HTMLAttributes<HTMLSpanElement>;
|
|
413
|
+
|
|
414
|
+
const FormControlHelperText = React.forwardRef<HTMLSpanElement, IFormControlHelperTextProps>(
|
|
415
|
+
({ className, size, ...props }, ref) => {
|
|
416
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
417
|
+
return (
|
|
418
|
+
<UIFormControl.Helper.Text
|
|
419
|
+
ref={ref as any}
|
|
420
|
+
className={formControlHelperTextStyle({
|
|
421
|
+
parentVariants: { size: parentSize },
|
|
422
|
+
size,
|
|
423
|
+
class: className,
|
|
424
|
+
})}
|
|
425
|
+
{...props}
|
|
426
|
+
/>
|
|
427
|
+
);
|
|
428
|
+
},
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
FormControl.displayName = 'FormControl';
|
|
432
|
+
FormControlError.displayName = 'FormControlError';
|
|
433
|
+
FormControlErrorText.displayName = 'FormControlErrorText';
|
|
434
|
+
FormControlErrorIcon.displayName = 'FormControlErrorIcon';
|
|
435
|
+
FormControlLabel.displayName = 'FormControlLabel';
|
|
436
|
+
FormControlLabelText.displayName = 'FormControlLabelText';
|
|
437
|
+
FormControlLabelAstrick.displayName = 'FormControlLabelAstrick';
|
|
438
|
+
FormControlHelper.displayName = 'FormControlHelper';
|
|
439
|
+
FormControlHelperText.displayName = 'FormControlHelperText';
|
|
440
|
+
|
|
441
|
+
export {
|
|
442
|
+
FormControl,
|
|
443
|
+
FormControlError,
|
|
444
|
+
FormControlErrorText,
|
|
445
|
+
FormControlErrorIcon,
|
|
446
|
+
FormControlLabel,
|
|
447
|
+
FormControlLabelText,
|
|
448
|
+
FormControlLabelAstrick,
|
|
449
|
+
FormControlHelper,
|
|
450
|
+
FormControlHelperText,
|
|
451
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createImage } from '@gluestack-ui/image';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
6
|
+
|
|
7
|
+
const imageStyle = tva({
|
|
8
|
+
base: 'max-w-full',
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
'2xs': 'h-6 w-6',
|
|
12
|
+
xs: 'h-10 w-10',
|
|
13
|
+
sm: 'h-16 w-16',
|
|
14
|
+
md: 'h-20 w-20',
|
|
15
|
+
lg: 'h-24 w-24',
|
|
16
|
+
xl: 'h-32 w-32',
|
|
17
|
+
'2xl': 'h-64 w-64',
|
|
18
|
+
full: 'h-full w-full',
|
|
19
|
+
none: '',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
interface ImageBaseProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> {
|
|
25
|
+
source?: { uri: string };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ImgComponent = ({ source, ...props }: ImageBaseProps) => <img src={source?.uri || ''} {...props} />;
|
|
29
|
+
|
|
30
|
+
ImgComponent.displayName = 'ImgComponent';
|
|
31
|
+
|
|
32
|
+
const UIImage = createImage({ Root: ImgComponent });
|
|
33
|
+
|
|
34
|
+
interface ImageProps extends VariantProps<typeof imageStyle>, ImageBaseProps {
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Image = ({ size = 'md', className, ...props }: ImageProps) => {
|
|
39
|
+
return <UIImage className={imageStyle({ size, class: className })} {...props} />;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
Image.displayName = 'Image';
|
|
43
|
+
export { Image };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
|
|
6
|
+
const imageBackgroundStyle = tva({
|
|
7
|
+
base: 'bg-no-repeat bg-center bg-cover',
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
type ImageBackgroundProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
11
|
+
source: { uri: string } | number;
|
|
12
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ImageBackground = forwardRef<HTMLDivElement, ImageBackgroundProps>(
|
|
17
|
+
({ source, resizeMode = 'cover', className, style, children, ...props }, ref) => {
|
|
18
|
+
const imageUrl = typeof source === 'number' ? source : source.uri;
|
|
19
|
+
const backgroundSize = {
|
|
20
|
+
cover: 'cover',
|
|
21
|
+
contain: 'contain',
|
|
22
|
+
stretch: '100% 100%',
|
|
23
|
+
center: 'auto',
|
|
24
|
+
}[resizeMode];
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
ref={ref}
|
|
29
|
+
className={imageBackgroundStyle({ class: clsx(className) })}
|
|
30
|
+
style={{
|
|
31
|
+
...style,
|
|
32
|
+
backgroundImage: `url(${imageUrl})`,
|
|
33
|
+
backgroundSize,
|
|
34
|
+
}}
|
|
35
|
+
{...props}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
ImageBackground.displayName = 'ImageBackground';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { createInput } from '@gluestack-ui/input';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
6
|
+
import { cssInterop } from 'nativewind';
|
|
7
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
8
|
+
|
|
9
|
+
const SCOPE = 'INPUT';
|
|
10
|
+
|
|
11
|
+
const StyledInput = forwardRef<HTMLInputElement, any>(
|
|
12
|
+
({ onChangeText, onChange, secureTextEntry, placeholder, placeholderTextColor, ...props }, ref) => {
|
|
13
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
14
|
+
if (onChange) {
|
|
15
|
+
onChange(e);
|
|
16
|
+
}
|
|
17
|
+
if (onChangeText) {
|
|
18
|
+
onChangeText(e.target.value);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<input
|
|
24
|
+
ref={ref}
|
|
25
|
+
type={secureTextEntry ? 'password' : 'text'}
|
|
26
|
+
placeholder={placeholder}
|
|
27
|
+
onChange={handleChange}
|
|
28
|
+
style={{
|
|
29
|
+
...props.style,
|
|
30
|
+
'::placeholder': {
|
|
31
|
+
color: placeholderTextColor,
|
|
32
|
+
},
|
|
33
|
+
}}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
StyledInput.displayName = 'StyledInput';
|
|
41
|
+
|
|
42
|
+
const inputStyle = tva({
|
|
43
|
+
base: 'px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent',
|
|
44
|
+
variants: {
|
|
45
|
+
size: {
|
|
46
|
+
sm: 'text-sm h-8',
|
|
47
|
+
md: 'text-base h-10',
|
|
48
|
+
lg: 'text-lg h-12',
|
|
49
|
+
},
|
|
50
|
+
variant: {
|
|
51
|
+
outline: 'bg-transparent',
|
|
52
|
+
filled: 'bg-gray-100',
|
|
53
|
+
unstyled: '',
|
|
54
|
+
},
|
|
55
|
+
state: {
|
|
56
|
+
error: 'border-red-500 focus:ring-red-500',
|
|
57
|
+
success: 'border-green-500 focus:ring-green-500',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
size: 'md',
|
|
62
|
+
variant: 'outline',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
type IInputProps = React.ComponentProps<typeof StyledInput> &
|
|
67
|
+
VariantProps<typeof inputStyle> & {
|
|
68
|
+
className?: string;
|
|
69
|
+
onChangeText?: (text: string) => void;
|
|
70
|
+
secureTextEntry?: boolean;
|
|
71
|
+
placeholderTextColor?: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const Input = React.forwardRef<HTMLInputElement, IInputProps>(({ className, size, variant, state, ...props }, ref) => {
|
|
75
|
+
return <StyledInput ref={ref} className={inputStyle({ size, variant, state, class: className })} {...props} />;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
Input.displayName = 'Input';
|
|
79
|
+
|
|
80
|
+
export { Input };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
interface InputAccessoryViewProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
nativeID?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const InputAccessoryView = ({ children, style, backgroundColor, ...props }: InputAccessoryViewProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
style={{
|
|
16
|
+
position: 'fixed',
|
|
17
|
+
bottom: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
right: 0,
|
|
20
|
+
backgroundColor: backgroundColor || '#ffffff',
|
|
21
|
+
borderTopWidth: '1px',
|
|
22
|
+
borderTopStyle: 'solid',
|
|
23
|
+
borderTopColor: '#e5e5e5',
|
|
24
|
+
...style,
|
|
25
|
+
}}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
interface KeyboardAvoidingViewProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
behavior?: 'height' | 'position' | 'padding';
|
|
6
|
+
keyboardVerticalOffset?: number;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const KeyboardAvoidingView = forwardRef<HTMLDivElement, KeyboardAvoidingViewProps>(
|
|
12
|
+
({ children, style, ...props }, ref) => {
|
|
13
|
+
return (
|
|
14
|
+
<div ref={ref} style={style} {...props}>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
KeyboardAvoidingView.displayName = 'KeyboardAvoidingView';
|
|
22
|
+
|
|
23
|
+
export { KeyboardAvoidingView };
|