@flipova/foundation 2.3.0 → 2.4.0-beta.1
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/README.md +157 -156
- package/components/ui/accordion/ANIMATION_CUSTOMIZATION.md +16 -7
- package/components/ui/accordion/AccordionAnimatedHeight.tsx +3 -15
- package/components/ui/accordion/AccordionAnimatedIcon.tsx +2 -9
- package/components/ui/accordion/AnimatedHeight.tsx +3 -15
- package/components/ui/accordion/AnimatedIcon.tsx +2 -9
- package/components/ui/accordion/MIGRATION_SUMMARY.md +22 -11
- package/components/ui/accordion/USAGE_EXAMPLE.tsx +10 -25
- package/components/ui/accordion/index.tsx +71 -139
- package/components/ui/actionsheet/index.tsx +63 -105
- package/components/ui/alert/index.tsx +20 -50
- package/components/ui/alert-dialog/index.tsx +23 -48
- package/components/ui/avatar/index.tsx +32 -68
- package/components/ui/badge/index.tsx +18 -49
- package/components/ui/bottomsheet/index.tsx +20 -52
- package/components/ui/box/index.tsx +4 -9
- package/components/ui/box/index.web.tsx +3 -9
- package/components/ui/button/index.tsx +73 -109
- package/components/ui/calendar/creator.tsx +69 -30
- package/components/ui/calendar/index.tsx +81 -159
- package/components/ui/calendar/styles.tsx +10 -10
- package/components/ui/card/index.tsx +8 -9
- package/components/ui/card/index.web.tsx +4 -10
- package/components/ui/center/index.tsx +6 -11
- package/components/ui/center/index.web.tsx +3 -9
- package/components/ui/checkbox/index.tsx +46 -107
- package/components/ui/date-time-picker/creator.tsx +14 -1
- package/components/ui/date-time-picker/index.tsx +107 -156
- package/components/ui/date-time-picker/index.web.tsx +11 -33
- package/components/ui/date-time-picker/styles.tsx +5 -5
- package/components/ui/divider/index.tsx +5 -6
- package/components/ui/drawer/index.tsx +108 -128
- package/components/ui/fab/index.tsx +25 -68
- package/components/ui/flat-list/index.tsx +11 -8
- package/components/ui/form-control/index.tsx +49 -90
- package/components/ui/gluestack-ui-provider/index.tsx +4 -18
- package/components/ui/gluestack-ui-provider/index.web.tsx +10 -11
- package/components/ui/gluestack-ui-provider/script.ts +1 -3
- package/components/ui/gluestack-ui-provider/theme-context.ts +2 -2
- package/components/ui/gluestack-ui-provider/useGluestackColors.ts +2 -6
- package/components/ui/grid/index.tsx +128 -165
- package/components/ui/grid/index.web.tsx +17 -19
- package/components/ui/grid/styles.tsx +1 -3
- package/components/ui/heading/index.tsx +146 -169
- package/components/ui/heading/index.web.tsx +7 -28
- package/components/ui/heading/styles.tsx +5 -5
- package/components/ui/hstack/index.tsx +16 -15
- package/components/ui/hstack/index.web.tsx +17 -17
- package/components/ui/hstack/styles.tsx +5 -5
- package/components/ui/icon/index.tsx +95 -486
- package/components/ui/icon/index.web.tsx +79 -439
- package/components/ui/image/index.tsx +13 -18
- package/components/ui/image-viewer/index.tsx +149 -221
- package/components/ui/image-viewer/index.web.tsx +88 -113
- package/components/ui/input/index.tsx +20 -33
- package/components/ui/link/index.tsx +16 -22
- package/components/ui/liquid-glass/index.tsx +19 -25
- package/components/ui/menu/index.tsx +44 -66
- package/components/ui/modal/index.tsx +70 -91
- package/components/ui/popover/index.tsx +102 -121
- package/components/ui/portal/index.tsx +5 -6
- package/components/ui/pressable/index.tsx +5 -9
- package/components/ui/progress/index.tsx +4 -11
- package/components/ui/radio/index.tsx +47 -83
- package/components/ui/select/index.tsx +38 -59
- package/components/ui/select/select-actionsheet.tsx +61 -108
- package/components/ui/skeleton/index.tsx +22 -43
- package/components/ui/skeleton/index.web.tsx +63 -75
- package/components/ui/slider/index.tsx +36 -56
- package/components/ui/spinner/index.tsx +1 -10
- package/components/ui/switch/index.tsx +6 -13
- package/components/ui/table/index.tsx +39 -102
- package/components/ui/table/index.web.tsx +41 -79
- package/components/ui/tabs/TabsAnimatedIndicator.tsx +10 -38
- package/components/ui/tabs/creator.tsx +32 -24
- package/components/ui/tabs/index.tsx +253 -309
- package/components/ui/text/index.tsx +23 -37
- package/components/ui/text/index.web.tsx +33 -35
- package/components/ui/text/styles.tsx +5 -5
- package/components/ui/textarea/index.tsx +24 -38
- package/components/ui/toast/index.tsx +47 -52
- package/components/ui/tooltip/index.tsx +12 -28
- package/components/ui/vstack/index.tsx +17 -17
- package/components/ui/vstack/index.web.tsx +17 -17
- package/components/ui/vstack/styles.tsx +5 -5
- package/design/tools/design.js +15 -12
- package/design/tools/npm.js +4 -3
- package/dist/{chunk-B277QSR5.mjs → chunk-2R66P5X5.mjs} +1816 -3124
- package/dist/chunk-2R66P5X5.mjs.map +1 -0
- package/dist/{chunk-GD37RFBR.js → chunk-LCTFQJZM.js} +1816 -3124
- package/dist/chunk-LCTFQJZM.js.map +1 -0
- package/dist/index.js +294 -294
- package/dist/index.mjs +1 -1
- package/dist/ui/index.js +294 -294
- package/dist/ui/index.mjs +1 -1
- package/package.json +12 -7
- package/dist/chunk-B277QSR5.mjs.map +0 -1
- package/dist/chunk-GD37RFBR.js.map +0 -1
|
@@ -28,18 +28,15 @@ export function BasicAccordionExample() {
|
|
|
28
28
|
<AccordionItem value="item-1">
|
|
29
29
|
<AccordionHeader>
|
|
30
30
|
<AccordionTrigger>
|
|
31
|
-
<AccordionTitleText>
|
|
32
|
-
How do I place an order?
|
|
33
|
-
</AccordionTitleText>
|
|
31
|
+
<AccordionTitleText>How do I place an order?</AccordionTitleText>
|
|
34
32
|
{/* Icon automatically rotates 180° when expanded! */}
|
|
35
33
|
<AccordionIcon as={ChevronDownIcon} />
|
|
36
34
|
</AccordionTrigger>
|
|
37
35
|
</AccordionHeader>
|
|
38
36
|
<AccordionContent>
|
|
39
37
|
<AccordionContentText>
|
|
40
|
-
To place an order, simply select the products you want, proceed to
|
|
41
|
-
|
|
42
|
-
your purchase.
|
|
38
|
+
To place an order, simply select the products you want, proceed to checkout, provide shipping and payment
|
|
39
|
+
information, and finalize your purchase.
|
|
43
40
|
</AccordionContentText>
|
|
44
41
|
</AccordionContent>
|
|
45
42
|
</AccordionItem>
|
|
@@ -47,16 +44,14 @@ export function BasicAccordionExample() {
|
|
|
47
44
|
<AccordionItem value="item-2">
|
|
48
45
|
<AccordionHeader>
|
|
49
46
|
<AccordionTrigger>
|
|
50
|
-
<AccordionTitleText>
|
|
51
|
-
What payment methods do you accept?
|
|
52
|
-
</AccordionTitleText>
|
|
47
|
+
<AccordionTitleText>What payment methods do you accept?</AccordionTitleText>
|
|
53
48
|
<AccordionIcon as={ChevronDownIcon} />
|
|
54
49
|
</AccordionTrigger>
|
|
55
50
|
</AccordionHeader>
|
|
56
51
|
<AccordionContent>
|
|
57
52
|
<AccordionContentText>
|
|
58
|
-
We accept all major credit cards, including Visa, Mastercard, and
|
|
59
|
-
|
|
53
|
+
We accept all major credit cards, including Visa, Mastercard, and American Express. We also support payments
|
|
54
|
+
through PayPal.
|
|
60
55
|
</AccordionContentText>
|
|
61
56
|
</AccordionContent>
|
|
62
57
|
</AccordionItem>
|
|
@@ -76,11 +71,7 @@ export function OldApproach() {
|
|
|
76
71
|
<>
|
|
77
72
|
<AccordionTitleText>Question?</AccordionTitleText>
|
|
78
73
|
{/* Had to manually switch icons */}
|
|
79
|
-
{isExpanded ?
|
|
80
|
-
<AccordionIcon as={ChevronUpIcon} />
|
|
81
|
-
) : (
|
|
82
|
-
<AccordionIcon as={ChevronDownIcon} />
|
|
83
|
-
)}
|
|
74
|
+
{isExpanded ? <AccordionIcon as={ChevronUpIcon} /> : <AccordionIcon as={ChevronDownIcon} />}
|
|
84
75
|
</>
|
|
85
76
|
)}
|
|
86
77
|
</AccordionTrigger>
|
|
@@ -107,9 +98,7 @@ export function ManualControlExample() {
|
|
|
107
98
|
<AccordionTrigger>
|
|
108
99
|
{({ isExpanded }) => (
|
|
109
100
|
<>
|
|
110
|
-
<AccordionTitleText>
|
|
111
|
-
{isExpanded ? 'Click to collapse' : 'Click to expand'}
|
|
112
|
-
</AccordionTitleText>
|
|
101
|
+
<AccordionTitleText>{isExpanded ? 'Click to collapse' : 'Click to expand'}</AccordionTitleText>
|
|
113
102
|
{/* Icon still rotates automatically */}
|
|
114
103
|
<AccordionIcon as={ChevronDownIcon} />
|
|
115
104
|
</>
|
|
@@ -133,9 +122,7 @@ export function MultipleAccordionsExample() {
|
|
|
133
122
|
</AccordionTrigger>
|
|
134
123
|
</AccordionHeader>
|
|
135
124
|
<AccordionContent>
|
|
136
|
-
<AccordionContentText>
|
|
137
|
-
60fps animations, icon rotation, fully customizable.
|
|
138
|
-
</AccordionContentText>
|
|
125
|
+
<AccordionContentText>60fps animations, icon rotation, fully customizable.</AccordionContentText>
|
|
139
126
|
</AccordionContent>
|
|
140
127
|
</AccordionItem>
|
|
141
128
|
|
|
@@ -147,9 +134,7 @@ export function MultipleAccordionsExample() {
|
|
|
147
134
|
</AccordionTrigger>
|
|
148
135
|
</AccordionHeader>
|
|
149
136
|
<AccordionContent>
|
|
150
|
-
<AccordionContentText>
|
|
151
|
-
Runs on UI thread using React Native Reanimated.
|
|
152
|
-
</AccordionContentText>
|
|
137
|
+
<AccordionContentText>Runs on UI thread using React Native Reanimated.</AccordionContentText>
|
|
153
138
|
</AccordionContent>
|
|
154
139
|
</AccordionItem>
|
|
155
140
|
</Accordion>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { H3 } from '@expo/html-elements';
|
|
3
|
-
import {
|
|
4
|
-
createAccordion,
|
|
5
|
-
AccordionItemContext,
|
|
6
|
-
} from '@gluestack-ui/core/accordion/creator';
|
|
3
|
+
import { createAccordion, AccordionItemContext } from '@gluestack-ui/core/accordion/creator';
|
|
7
4
|
import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
8
5
|
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
9
6
|
import { cssInterop } from 'nativewind';
|
|
@@ -44,13 +41,10 @@ const accordionContentStyle = tva({
|
|
|
44
41
|
});
|
|
45
42
|
|
|
46
43
|
const accordionTriggerStyle = tva({
|
|
47
|
-
|
|
48
44
|
base: 'w-full flex-row justify-between items-center web:outline-none focus:outline-none data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed data-[focus-visible=true]:bg-background/10 gap-3',
|
|
49
45
|
});
|
|
50
46
|
|
|
51
|
-
const Header = (
|
|
52
|
-
Platform.OS === 'web' ? H3 : View
|
|
53
|
-
) as React.ComponentType<TextProps>;
|
|
47
|
+
const Header = (Platform.OS === 'web' ? H3 : View) as React.ComponentType<TextProps>;
|
|
54
48
|
|
|
55
49
|
/** Creator */
|
|
56
50
|
const UIAccordion = createAccordion({
|
|
@@ -85,158 +79,90 @@ cssInterop(H3, {
|
|
|
85
79
|
|
|
86
80
|
type IAccordionProps = React.ComponentPropsWithoutRef<typeof UIAccordion>;
|
|
87
81
|
|
|
88
|
-
type IAccordionItemProps = React.ComponentPropsWithoutRef<
|
|
89
|
-
typeof UIAccordion.Item
|
|
90
|
-
>;
|
|
82
|
+
type IAccordionItemProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Item>;
|
|
91
83
|
|
|
92
|
-
type IAccordionContentProps = React.ComponentPropsWithoutRef<
|
|
93
|
-
typeof UIAccordion.Content
|
|
94
|
-
>;
|
|
84
|
+
type IAccordionContentProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Content>;
|
|
95
85
|
|
|
96
|
-
type IAccordionContentTextProps = React.ComponentPropsWithoutRef<
|
|
97
|
-
typeof UIAccordion.ContentText
|
|
98
|
-
>;
|
|
86
|
+
type IAccordionContentTextProps = React.ComponentPropsWithoutRef<typeof UIAccordion.ContentText>;
|
|
99
87
|
|
|
100
|
-
type IAccordionIconProps = React.ComponentPropsWithoutRef<
|
|
101
|
-
typeof UIAccordion.Icon
|
|
102
|
-
> & {
|
|
88
|
+
type IAccordionIconProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Icon> & {
|
|
103
89
|
as?: React.ElementType;
|
|
104
90
|
height?: number;
|
|
105
91
|
width?: number;
|
|
106
92
|
};
|
|
107
93
|
|
|
108
|
-
type IAccordionHeaderProps = React.ComponentPropsWithoutRef<
|
|
109
|
-
typeof UIAccordion.Header
|
|
110
|
-
>;
|
|
94
|
+
type IAccordionHeaderProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Header>;
|
|
111
95
|
|
|
112
|
-
type IAccordionTriggerProps = React.ComponentPropsWithoutRef<
|
|
113
|
-
typeof UIAccordion.Trigger
|
|
114
|
-
>;
|
|
96
|
+
type IAccordionTriggerProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Trigger>;
|
|
115
97
|
|
|
116
|
-
type IAccordionTitleTextProps = React.ComponentPropsWithoutRef<
|
|
117
|
-
typeof UIAccordion.TitleText
|
|
118
|
-
>;
|
|
98
|
+
type IAccordionTitleTextProps = React.ComponentPropsWithoutRef<typeof UIAccordion.TitleText>;
|
|
119
99
|
|
|
120
100
|
/** Components */
|
|
121
101
|
|
|
122
|
-
const Accordion = React.forwardRef<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
<UIAccordion
|
|
128
|
-
ref={ref}
|
|
129
|
-
{...props}
|
|
130
|
-
className={accordionStyle({ class: className })}
|
|
131
|
-
/>
|
|
132
|
-
);
|
|
133
|
-
});
|
|
102
|
+
const Accordion = React.forwardRef<React.ComponentRef<typeof UIAccordion>, IAccordionProps>(
|
|
103
|
+
({ className, ...props }, ref) => {
|
|
104
|
+
return <UIAccordion ref={ref} {...props} className={accordionStyle({ class: className })} />;
|
|
105
|
+
},
|
|
106
|
+
);
|
|
134
107
|
|
|
135
|
-
const AccordionItem = React.forwardRef<
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<UIAccordion.Item
|
|
141
|
-
ref={ref}
|
|
142
|
-
{...props}
|
|
143
|
-
className={accordionItemStyle({ class: className })}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
});
|
|
108
|
+
const AccordionItem = React.forwardRef<React.ComponentRef<typeof UIAccordion.Item>, IAccordionItemProps>(
|
|
109
|
+
({ className, ...props }, ref) => {
|
|
110
|
+
return <UIAccordion.Item ref={ref} {...props} className={accordionItemStyle({ class: className })} />;
|
|
111
|
+
},
|
|
112
|
+
);
|
|
147
113
|
|
|
148
|
-
const AccordionContent = React.forwardRef<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
<UIAccordion.Content
|
|
160
|
-
ref={ref}
|
|
161
|
-
{...props}
|
|
162
|
-
className={accordionContentStyle({ class: className })}
|
|
163
|
-
/>
|
|
164
|
-
</AnimatedHeight>
|
|
165
|
-
);
|
|
166
|
-
});
|
|
114
|
+
const AccordionContent = React.forwardRef<React.ComponentRef<typeof UIAccordion.Content>, IAccordionContentProps>(
|
|
115
|
+
function AccordionContent({ className, ...props }, ref) {
|
|
116
|
+
const { isExpanded } = React.useContext(AccordionItemContext);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<AnimatedHeight isExpanded={isExpanded} duration={accordionAnimationConfig.contentDuration}>
|
|
120
|
+
<UIAccordion.Content ref={ref} {...props} className={accordionContentStyle({ class: className })} />
|
|
121
|
+
</AnimatedHeight>
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
167
125
|
|
|
168
126
|
const AccordionContentText = React.forwardRef<
|
|
169
127
|
React.ComponentRef<typeof UIAccordion.ContentText>,
|
|
170
128
|
IAccordionContentTextProps
|
|
171
129
|
>(function AccordionContentText({ className, ...props }, ref) {
|
|
172
|
-
return (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
duration={accordionAnimationConfig.iconDuration}
|
|
191
|
-
rotation={accordionAnimationConfig.iconRotation}
|
|
192
|
-
>
|
|
193
|
-
<UIAccordion.Icon
|
|
194
|
-
ref={ref}
|
|
195
|
-
{...props}
|
|
196
|
-
className={accordionIconStyle({ class: className })}
|
|
197
|
-
/>
|
|
198
|
-
</AnimatedIcon>
|
|
199
|
-
);
|
|
200
|
-
});
|
|
130
|
+
return <UIAccordion.ContentText ref={ref} {...props} className={accordionContentTextStyle({ class: className })} />;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const AccordionIcon = React.forwardRef<React.ComponentRef<typeof UIAccordion.Icon>, IAccordionIconProps>(
|
|
134
|
+
function AccordionIcon({ className, ...props }, ref) {
|
|
135
|
+
const { isExpanded } = React.useContext(AccordionItemContext);
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<AnimatedIcon
|
|
139
|
+
isExpanded={isExpanded}
|
|
140
|
+
duration={accordionAnimationConfig.iconDuration}
|
|
141
|
+
rotation={accordionAnimationConfig.iconRotation}
|
|
142
|
+
>
|
|
143
|
+
<UIAccordion.Icon ref={ref} {...props} className={accordionIconStyle({ class: className })} />
|
|
144
|
+
</AnimatedIcon>
|
|
145
|
+
);
|
|
146
|
+
},
|
|
147
|
+
);
|
|
201
148
|
|
|
202
|
-
const AccordionHeader = React.forwardRef<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
<UIAccordion.Header
|
|
208
|
-
ref={ref}
|
|
209
|
-
{...props}
|
|
210
|
-
className={accordionHeaderStyle({ class: className })}
|
|
211
|
-
/>
|
|
212
|
-
);
|
|
213
|
-
});
|
|
149
|
+
const AccordionHeader = React.forwardRef<React.ComponentRef<typeof UIAccordion.Header>, IAccordionHeaderProps>(
|
|
150
|
+
function AccordionHeader({ className, ...props }, ref) {
|
|
151
|
+
return <UIAccordion.Header ref={ref} {...props} className={accordionHeaderStyle({ class: className })} />;
|
|
152
|
+
},
|
|
153
|
+
);
|
|
214
154
|
|
|
215
|
-
const AccordionTrigger = React.forwardRef<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
<UIAccordion.Trigger
|
|
221
|
-
ref={ref}
|
|
222
|
-
{...props}
|
|
223
|
-
className={accordionTriggerStyle({ class: className })}
|
|
224
|
-
/>
|
|
225
|
-
);
|
|
226
|
-
});
|
|
155
|
+
const AccordionTrigger = React.forwardRef<React.ComponentRef<typeof UIAccordion.Trigger>, IAccordionTriggerProps>(
|
|
156
|
+
function AccordionTrigger({ className, ...props }, ref) {
|
|
157
|
+
return <UIAccordion.Trigger ref={ref} {...props} className={accordionTriggerStyle({ class: className })} />;
|
|
158
|
+
},
|
|
159
|
+
);
|
|
227
160
|
|
|
228
|
-
const AccordionTitleText = React.forwardRef<
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<UIAccordion.TitleText
|
|
234
|
-
ref={ref}
|
|
235
|
-
{...props}
|
|
236
|
-
className={accordionTitleTextStyle({ class: className })}
|
|
237
|
-
/>
|
|
238
|
-
);
|
|
239
|
-
});
|
|
161
|
+
const AccordionTitleText = React.forwardRef<React.ComponentRef<typeof UIAccordion.TitleText>, IAccordionTitleTextProps>(
|
|
162
|
+
function AccordionTitleText({ className, ...props }, ref) {
|
|
163
|
+
return <UIAccordion.TitleText ref={ref} {...props} className={accordionTitleTextStyle({ class: className })} />;
|
|
164
|
+
},
|
|
165
|
+
);
|
|
240
166
|
|
|
241
167
|
Accordion.displayName = 'Accordion';
|
|
242
168
|
AccordionItem.displayName = 'AccordionItem';
|
|
@@ -248,6 +174,12 @@ AccordionIcon.displayName = 'AccordionIcon';
|
|
|
248
174
|
AccordionContent.displayName = 'AccordionContent';
|
|
249
175
|
|
|
250
176
|
export {
|
|
251
|
-
Accordion,
|
|
177
|
+
Accordion,
|
|
178
|
+
AccordionContent,
|
|
179
|
+
AccordionContentText,
|
|
180
|
+
AccordionHeader,
|
|
181
|
+
AccordionIcon,
|
|
182
|
+
AccordionItem,
|
|
183
|
+
AccordionTitleText,
|
|
184
|
+
AccordionTrigger,
|
|
252
185
|
};
|
|
253
|
-
|
|
@@ -17,17 +17,12 @@ import { UIIcon } from '@gluestack-ui/core/icon/creator';
|
|
|
17
17
|
import { tva } from '@gluestack-ui/utils/nativewind-utils';
|
|
18
18
|
import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils';
|
|
19
19
|
import { cssInterop } from 'nativewind';
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const ItemWrapper = React.forwardRef<
|
|
28
|
-
React.ComponentRef<typeof Pressable>,
|
|
29
|
-
PressableProps
|
|
30
|
-
>(function ItemWrapper({ ...props }, ref) {
|
|
20
|
+
import { Motion, AnimatePresence, createMotionAnimatedComponent, MotionComponentProps } from '@legendapp/motion';
|
|
21
|
+
|
|
22
|
+
const ItemWrapper = React.forwardRef<React.ComponentRef<typeof Pressable>, PressableProps>(function ItemWrapper(
|
|
23
|
+
{ ...props },
|
|
24
|
+
ref,
|
|
25
|
+
) {
|
|
31
26
|
return <Pressable {...props} ref={ref} />;
|
|
32
27
|
});
|
|
33
28
|
|
|
@@ -39,9 +34,7 @@ const MotionView = Motion.View as React.ComponentType<IMotionViewProps>;
|
|
|
39
34
|
type IAnimatedPressableProps = React.ComponentProps<typeof Pressable> &
|
|
40
35
|
MotionComponentProps<typeof Pressable, ViewStyle, unknown, unknown, unknown>;
|
|
41
36
|
|
|
42
|
-
const AnimatedPressable = createMotionAnimatedComponent(
|
|
43
|
-
Pressable
|
|
44
|
-
) as React.ComponentType<IAnimatedPressableProps>;
|
|
37
|
+
const AnimatedPressable = createMotionAnimatedComponent(Pressable) as React.ComponentType<IAnimatedPressableProps>;
|
|
45
38
|
|
|
46
39
|
export const UIActionsheet = createActionsheet({
|
|
47
40
|
Root: View,
|
|
@@ -190,8 +183,7 @@ const actionsheetIconStyle = tva({
|
|
|
190
183
|
base: 'text-foreground fill-none h-4 w-4',
|
|
191
184
|
});
|
|
192
185
|
|
|
193
|
-
type IActionsheetProps = VariantProps<typeof actionsheetStyle> &
|
|
194
|
-
React.ComponentPropsWithoutRef<typeof UIActionsheet>;
|
|
186
|
+
type IActionsheetProps = VariantProps<typeof actionsheetStyle> & React.ComponentPropsWithoutRef<typeof UIActionsheet>;
|
|
195
187
|
|
|
196
188
|
type IActionsheetContentProps = VariantProps<typeof actionsheetContentStyle> &
|
|
197
189
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.Content> & {
|
|
@@ -204,14 +196,10 @@ type IActionsheetItemProps = VariantProps<typeof actionsheetItemStyle> &
|
|
|
204
196
|
type IActionsheetItemTextProps = VariantProps<typeof actionsheetItemTextStyle> &
|
|
205
197
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.ItemText>;
|
|
206
198
|
|
|
207
|
-
type IActionsheetDragIndicatorProps = VariantProps<
|
|
208
|
-
typeof actionsheetDragIndicatorStyle
|
|
209
|
-
> &
|
|
199
|
+
type IActionsheetDragIndicatorProps = VariantProps<typeof actionsheetDragIndicatorStyle> &
|
|
210
200
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.DragIndicator>;
|
|
211
201
|
|
|
212
|
-
type IActionsheetDragIndicatorWrapperProps = VariantProps<
|
|
213
|
-
typeof actionsheetDragIndicatorWrapperStyle
|
|
214
|
-
> &
|
|
202
|
+
type IActionsheetDragIndicatorWrapperProps = VariantProps<typeof actionsheetDragIndicatorWrapperStyle> &
|
|
215
203
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.DragIndicatorWrapper>;
|
|
216
204
|
|
|
217
205
|
type IActionsheetBackdropProps = VariantProps<typeof actionsheetBackdropStyle> &
|
|
@@ -219,27 +207,19 @@ type IActionsheetBackdropProps = VariantProps<typeof actionsheetBackdropStyle> &
|
|
|
219
207
|
className?: string;
|
|
220
208
|
};
|
|
221
209
|
|
|
222
|
-
type IActionsheetScrollViewProps = VariantProps<
|
|
223
|
-
typeof actionsheetScrollViewStyle
|
|
224
|
-
> &
|
|
210
|
+
type IActionsheetScrollViewProps = VariantProps<typeof actionsheetScrollViewStyle> &
|
|
225
211
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.ScrollView>;
|
|
226
212
|
|
|
227
|
-
type IActionsheetVirtualizedListProps = VariantProps<
|
|
228
|
-
typeof actionsheetVirtualizedListStyle
|
|
229
|
-
> &
|
|
213
|
+
type IActionsheetVirtualizedListProps = VariantProps<typeof actionsheetVirtualizedListStyle> &
|
|
230
214
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.VirtualizedList>;
|
|
231
215
|
|
|
232
216
|
type IActionsheetFlatListProps = VariantProps<typeof actionsheetFlatListStyle> &
|
|
233
217
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.FlatList>;
|
|
234
218
|
|
|
235
|
-
type IActionsheetSectionListProps = VariantProps<
|
|
236
|
-
typeof actionsheetSectionListStyle
|
|
237
|
-
> &
|
|
219
|
+
type IActionsheetSectionListProps = VariantProps<typeof actionsheetSectionListStyle> &
|
|
238
220
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.SectionList>;
|
|
239
221
|
|
|
240
|
-
type IActionsheetSectionHeaderTextProps = VariantProps<
|
|
241
|
-
typeof actionsheetSectionHeaderTextStyle
|
|
242
|
-
> &
|
|
222
|
+
type IActionsheetSectionHeaderTextProps = VariantProps<typeof actionsheetSectionHeaderTextStyle> &
|
|
243
223
|
React.ComponentPropsWithoutRef<typeof UIActionsheet.SectionHeaderText>;
|
|
244
224
|
|
|
245
225
|
type IActionsheetIconProps = VariantProps<typeof actionsheetIconStyle> &
|
|
@@ -250,10 +230,10 @@ type IActionsheetIconProps = VariantProps<typeof actionsheetIconStyle> &
|
|
|
250
230
|
width?: number;
|
|
251
231
|
};
|
|
252
232
|
|
|
253
|
-
const Actionsheet = React.forwardRef<
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
233
|
+
const Actionsheet = React.forwardRef<React.ComponentRef<typeof UIActionsheet>, IActionsheetProps>(function Actionsheet(
|
|
234
|
+
{ className, ...props },
|
|
235
|
+
ref,
|
|
236
|
+
) {
|
|
257
237
|
return (
|
|
258
238
|
<UIActionsheet
|
|
259
239
|
className={actionsheetStyle({
|
|
@@ -265,43 +245,38 @@ const Actionsheet = React.forwardRef<
|
|
|
265
245
|
);
|
|
266
246
|
});
|
|
267
247
|
|
|
268
|
-
const ActionsheetContent = React.forwardRef<
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
});
|
|
248
|
+
const ActionsheetContent = React.forwardRef<React.ComponentRef<typeof UIActionsheet.Content>, IActionsheetContentProps>(
|
|
249
|
+
function ActionsheetContent({ className, ...props }, ref) {
|
|
250
|
+
return (
|
|
251
|
+
<UIActionsheet.Content
|
|
252
|
+
className={actionsheetContentStyle({
|
|
253
|
+
class: className,
|
|
254
|
+
})}
|
|
255
|
+
ref={ref}
|
|
256
|
+
{...props}
|
|
257
|
+
/>
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
);
|
|
282
261
|
|
|
283
|
-
const ActionsheetItem = React.forwardRef<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
});
|
|
262
|
+
const ActionsheetItem = React.forwardRef<React.ComponentRef<typeof UIActionsheet.Item>, IActionsheetItemProps>(
|
|
263
|
+
function ActionsheetItem({ className, ...props }, ref) {
|
|
264
|
+
return (
|
|
265
|
+
<UIActionsheet.Item
|
|
266
|
+
className={actionsheetItemStyle({
|
|
267
|
+
class: className,
|
|
268
|
+
})}
|
|
269
|
+
ref={ref}
|
|
270
|
+
{...props}
|
|
271
|
+
/>
|
|
272
|
+
);
|
|
273
|
+
},
|
|
274
|
+
);
|
|
297
275
|
|
|
298
276
|
const ActionsheetItemText = React.forwardRef<
|
|
299
277
|
React.ComponentRef<typeof UIActionsheet.ItemText>,
|
|
300
278
|
IActionsheetItemTextProps
|
|
301
|
-
>(function ActionsheetItemText(
|
|
302
|
-
{ isTruncated, bold, underline, strikeThrough, className, ...props },
|
|
303
|
-
ref
|
|
304
|
-
) {
|
|
279
|
+
>(function ActionsheetItemText({ isTruncated, bold, underline, strikeThrough, className, ...props }, ref) {
|
|
305
280
|
return (
|
|
306
281
|
<UIActionsheet.ItemText
|
|
307
282
|
className={actionsheetItemTextStyle({
|
|
@@ -439,18 +414,8 @@ const ActionsheetSectionHeaderText = React.forwardRef<
|
|
|
439
414
|
React.ComponentRef<typeof UIActionsheet.SectionHeaderText>,
|
|
440
415
|
IActionsheetSectionHeaderTextProps
|
|
441
416
|
>(function ActionsheetSectionHeaderText(
|
|
442
|
-
{
|
|
443
|
-
|
|
444
|
-
isTruncated,
|
|
445
|
-
bold,
|
|
446
|
-
underline,
|
|
447
|
-
strikeThrough,
|
|
448
|
-
sub,
|
|
449
|
-
italic,
|
|
450
|
-
highlight,
|
|
451
|
-
...props
|
|
452
|
-
},
|
|
453
|
-
ref
|
|
417
|
+
{ className, isTruncated, bold, underline, strikeThrough, sub, italic, highlight, ...props },
|
|
418
|
+
ref,
|
|
454
419
|
) {
|
|
455
420
|
return (
|
|
456
421
|
<UIActionsheet.SectionHeaderText
|
|
@@ -470,29 +435,22 @@ const ActionsheetSectionHeaderText = React.forwardRef<
|
|
|
470
435
|
);
|
|
471
436
|
});
|
|
472
437
|
|
|
473
|
-
const ActionsheetIcon = React.forwardRef<
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
)
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
<UIActionsheet.Icon
|
|
490
|
-
className={actionsheetIconStyle({ class: className })}
|
|
491
|
-
ref={ref}
|
|
492
|
-
{...props}
|
|
493
|
-
/>
|
|
494
|
-
);
|
|
495
|
-
});
|
|
438
|
+
const ActionsheetIcon = React.forwardRef<React.ComponentRef<typeof UIActionsheet.Icon>, IActionsheetIconProps>(
|
|
439
|
+
function ActionsheetIcon({ className, height, width, ...props }, ref) {
|
|
440
|
+
if (typeof height === 'number' || typeof width === 'number') {
|
|
441
|
+
return (
|
|
442
|
+
<UIActionsheet.Icon
|
|
443
|
+
ref={ref}
|
|
444
|
+
{...props}
|
|
445
|
+
height={height}
|
|
446
|
+
width={width}
|
|
447
|
+
className={actionsheetIconStyle({ class: className })}
|
|
448
|
+
/>
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
return <UIActionsheet.Icon className={actionsheetIconStyle({ class: className })} ref={ref} {...props} />;
|
|
452
|
+
},
|
|
453
|
+
);
|
|
496
454
|
|
|
497
455
|
export {
|
|
498
456
|
Actionsheet,
|