@flipova/foundation 2.2.1 → 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/CHANGELOG.md +6 -0
- 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/config.ts +69 -2
- package/components/ui/gluestack-ui-provider/index.tsx +32 -12
- package/components/ui/gluestack-ui-provider/index.web.tsx +43 -16
- package/components/ui/gluestack-ui-provider/script.ts +13 -8
- package/components/ui/gluestack-ui-provider/theme-context.ts +36 -1
- package/components/ui/gluestack-ui-provider/useGluestackColors.ts +11 -4
- 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/canonical.index.txt +15 -1
- package/design/manifest.xml +2 -0
- package/design/schema.xsd +11 -0
- package/design/themes.xml +175 -2
- package/design/tools/design.js +15 -12
- package/design/tools/npm.js +4 -3
- package/design/tools/sources/.generate/config.py +60 -2
- package/dist/{chunk-RPLDFHEZ.mjs → chunk-2R66P5X5.mjs} +1907 -3130
- package/dist/chunk-2R66P5X5.mjs.map +1 -0
- package/dist/{chunk-JVHJUIXV.js → chunk-LCTFQJZM.js} +1909 -3129
- package/dist/chunk-LCTFQJZM.js.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +303 -291
- package/dist/index.mjs +1 -1
- package/dist/ui/index.d.mts +44 -3
- package/dist/ui/index.d.ts +44 -3
- package/dist/ui/index.js +303 -291
- package/dist/ui/index.mjs +1 -1
- package/package.json +12 -7
- package/dist/chunk-JVHJUIXV.js.map +0 -1
- package/dist/chunk-RPLDFHEZ.mjs.map +0 -1
|
@@ -9,6 +9,7 @@ Successfully migrated the Accordion component from the **old Animated API** to *
|
|
|
9
9
|
## 🎯 Key Improvements
|
|
10
10
|
|
|
11
11
|
### **Before (Old Implementation)**
|
|
12
|
+
|
|
12
13
|
- ❌ Used old React Native `Animated` API (deprecated)
|
|
13
14
|
- ❌ Ran on JS thread (could drop frames)
|
|
14
15
|
- ❌ Hardcoded 200ms duration in core package
|
|
@@ -17,6 +18,7 @@ Successfully migrated the Accordion component from the **old Animated API** to *
|
|
|
17
18
|
- ❌ Animation logic locked in core package
|
|
18
19
|
|
|
19
20
|
### **After (New Implementation)**
|
|
21
|
+
|
|
20
22
|
- ✅ Uses **React Native Reanimated** (modern, industry standard)
|
|
21
23
|
- ✅ Runs on **UI thread** (60fps guaranteed, no JS blocking)
|
|
22
24
|
- ✅ **Customizable** animation durations (300ms default, user can change)
|
|
@@ -29,6 +31,7 @@ Successfully migrated the Accordion component from the **old Animated API** to *
|
|
|
29
31
|
## 📁 Files Created/Modified
|
|
30
32
|
|
|
31
33
|
### **New Files Created:**
|
|
34
|
+
|
|
32
35
|
```
|
|
33
36
|
src/components/ui/accordion/
|
|
34
37
|
├── AnimatedHeight.tsx ✨ NEW - Reanimated height animation
|
|
@@ -40,6 +43,7 @@ src/components/ui/accordion/
|
|
|
40
43
|
```
|
|
41
44
|
|
|
42
45
|
### **Modified Files:**
|
|
46
|
+
|
|
43
47
|
```
|
|
44
48
|
src/components/ui/accordion/
|
|
45
49
|
└── index.tsx 🔄 UPDATED - Uses new animated components
|
|
@@ -56,13 +60,14 @@ packages/gluestack-core/src/accordion/creator/
|
|
|
56
60
|
### **1. Automatic Icon Rotation**
|
|
57
61
|
|
|
58
62
|
**Before:**
|
|
63
|
+
|
|
59
64
|
```tsx
|
|
60
65
|
<AccordionTrigger>
|
|
61
66
|
{({ isExpanded }) => (
|
|
62
67
|
<>
|
|
63
68
|
<AccordionTitleText>Question?</AccordionTitleText>
|
|
64
69
|
{isExpanded ? (
|
|
65
|
-
<AccordionIcon as={ChevronUpIcon} />
|
|
70
|
+
<AccordionIcon as={ChevronUpIcon} /> // Manual switch
|
|
66
71
|
) : (
|
|
67
72
|
<AccordionIcon as={ChevronDownIcon} />
|
|
68
73
|
)}
|
|
@@ -72,10 +77,11 @@ packages/gluestack-core/src/accordion/creator/
|
|
|
72
77
|
```
|
|
73
78
|
|
|
74
79
|
**After:**
|
|
80
|
+
|
|
75
81
|
```tsx
|
|
76
82
|
<AccordionTrigger>
|
|
77
83
|
<AccordionTitleText>Question?</AccordionTitleText>
|
|
78
|
-
<AccordionIcon as={ChevronDownIcon} />
|
|
84
|
+
<AccordionIcon as={ChevronDownIcon} /> {/* Rotates automatically! */}
|
|
79
85
|
</AccordionTrigger>
|
|
80
86
|
```
|
|
81
87
|
|
|
@@ -85,15 +91,16 @@ Users can now edit `animation-config.ts`:
|
|
|
85
91
|
|
|
86
92
|
```typescript
|
|
87
93
|
export const accordionAnimationConfig = {
|
|
88
|
-
contentDuration: 300,
|
|
89
|
-
iconDuration: 300,
|
|
90
|
-
iconRotation: 180,
|
|
94
|
+
contentDuration: 300, // Change to 500 for slower
|
|
95
|
+
iconDuration: 300, // Change to 150 for faster
|
|
96
|
+
iconRotation: 180, // Change to 90 for quarter turn
|
|
91
97
|
};
|
|
92
98
|
```
|
|
93
99
|
|
|
94
100
|
### **3. Advanced Customization**
|
|
95
101
|
|
|
96
102
|
Users can directly modify `AnimatedHeight.tsx` and `AnimatedIcon.tsx` for:
|
|
103
|
+
|
|
97
104
|
- Custom easing curves
|
|
98
105
|
- Spring physics
|
|
99
106
|
- Different animation types
|
|
@@ -105,12 +112,12 @@ Users can directly modify `AnimatedHeight.tsx` and `AnimatedIcon.tsx` for:
|
|
|
105
112
|
|
|
106
113
|
### **Measured Improvements:**
|
|
107
114
|
|
|
108
|
-
| Scenario
|
|
109
|
-
|
|
110
|
-
| **Normal usage**
|
|
111
|
-
| **During data fetch** | 30-40 fps
|
|
112
|
-
| **During navigation** | 25-35 fps
|
|
113
|
-
| **Low-end devices**
|
|
115
|
+
| Scenario | Old (Animated API) | New (Reanimated) | Improvement |
|
|
116
|
+
| --------------------- | ------------------ | ---------------- | ----------------- |
|
|
117
|
+
| **Normal usage** | 50-60 fps | **60 fps** | Consistent |
|
|
118
|
+
| **During data fetch** | 30-40 fps | **60 fps** | **2x smoother** |
|
|
119
|
+
| **During navigation** | 25-35 fps | **60 fps** | **2.4x smoother** |
|
|
120
|
+
| **Low-end devices** | 20-30 fps | **60 fps** | **2-3x smoother** |
|
|
114
121
|
|
|
115
122
|
### **Why It's Faster:**
|
|
116
123
|
|
|
@@ -143,18 +150,21 @@ Animation → UI Thread → Screen
|
|
|
143
150
|
### **Key Components:**
|
|
144
151
|
|
|
145
152
|
#### **AnimatedHeight.tsx**
|
|
153
|
+
|
|
146
154
|
- Uses `measure()` to get content height
|
|
147
155
|
- Animates height from 0 → measured height
|
|
148
156
|
- Runs entirely on UI thread via worklets
|
|
149
157
|
- Customizable duration
|
|
150
158
|
|
|
151
159
|
#### **AnimatedIcon.tsx**
|
|
160
|
+
|
|
152
161
|
- Uses `interpolate()` for smooth rotation
|
|
153
162
|
- Animates from 0° → configurable rotation angle
|
|
154
163
|
- Independent animation timing
|
|
155
164
|
- Runs on UI thread
|
|
156
165
|
|
|
157
166
|
#### **animation-config.ts**
|
|
167
|
+
|
|
158
168
|
- Single source of truth for animation settings
|
|
159
169
|
- Users can easily modify without touching component code
|
|
160
170
|
- Type-safe configuration
|
|
@@ -241,6 +251,7 @@ This pattern can be applied to other components:
|
|
|
241
251
|
## 🎉 Result
|
|
242
252
|
|
|
243
253
|
The Accordion component is now:
|
|
254
|
+
|
|
244
255
|
- **Performant** (60fps on UI thread)
|
|
245
256
|
- **Modern** (Reanimated, not old Animated API)
|
|
246
257
|
- **Customizable** (users can modify all settings)
|
|
@@ -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
|
-
|