@admin-layout/gluestack-ui-mobile 11.0.4-alpha.0 → 12.0.16-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 +60 -4
- package/lib/__tests__/prolayout-layout-feature.test.js +1 -1
- package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -1
- package/lib/components/AuthWrapper.js +5 -3
- package/lib/components/AuthWrapper.js.map +1 -1
- package/lib/components/ErrorBounday.js.map +1 -1
- package/lib/components/NavigationComponent.js.map +1 -1
- package/lib/components/UnAuthenticatedComponent.js.map +1 -1
- package/lib/components/WithConfiguration.js +4 -4
- package/lib/components/WithConfiguration.js.map +1 -1
- package/lib/components/WithPermission.js +1 -1
- package/lib/components/WithPermission.js.map +1 -1
- package/lib/components/WithPolicy.js +2 -2
- package/lib/components/WithPolicy.js.map +1 -1
- 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/components/with-interactions-lifecycle-managed.js.map +1 -1
- package/lib/components/with-interactions-managed.js +2 -3
- package/lib/components/with-interactions-managed.js.map +1 -1
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +47 -47
- package/lib/containers/layout/DrawerConfig.d.ts +31 -31
- package/lib/containers/layout/module.js +1 -1
- package/lib/containers/layout/module.js.map +1 -1
- package/lib/interfaces/settings.d.ts +1 -0
- package/lib/redux/settings.d.ts +4 -9
- package/lib/utils/routeConfigKeyReplace.test.js +1 -1
- package/lib/utils/routeConfigKeyReplace.test.js.map +1 -1
- package/package.json +7 -4
- package/src/__tests__/prolayout-layout-feature.test.tsx +2 -2
- package/src/components/AuthWrapper.tsx +6 -3
- package/src/components/ErrorBounday.tsx +18 -19
- package/src/components/NavigationComponent.tsx +1 -1
- package/src/components/UnAuthenticatedComponent.tsx +1 -3
- package/src/components/WithConfiguration.tsx +5 -8
- package/src/components/WithPermission.tsx +1 -1
- package/src/components/WithPolicy.tsx +4 -3
- 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
- package/src/components/with-interactions-lifecycle-managed.tsx +0 -4
- package/src/components/with-interactions-managed.tsx +3 -4
- package/src/containers/layout/module.ts +1 -1
- package/src/interfaces/settings.ts +1 -0
- package/src/utils/routeConfigKeyReplace.test.ts +4 -4
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createAccordion } from '@gluestack-ui/accordion';
|
|
4
|
+
import { tva } from '@gluestack-ui/nativewind-utils/tva';
|
|
5
|
+
import type { VariantProps } from '@gluestack-ui/nativewind-utils';
|
|
6
|
+
import { withStyleContext, useStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
|
|
7
|
+
import { UIIcon } from '@gluestack-ui/icon';
|
|
8
|
+
|
|
9
|
+
const SCOPE = 'ACCORDION';
|
|
10
|
+
|
|
11
|
+
/** Styles */
|
|
12
|
+
const accordionStyle = tva({
|
|
13
|
+
base: 'w-full',
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
filled: 'bg-white shadow-hard-2',
|
|
17
|
+
unfilled: '',
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
sm: '',
|
|
21
|
+
md: '',
|
|
22
|
+
lg: '',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const accordionItemStyle = tva({
|
|
28
|
+
base: '',
|
|
29
|
+
parentVariants: {
|
|
30
|
+
variant: {
|
|
31
|
+
filled: 'bg-background-0',
|
|
32
|
+
unfilled: 'bg-transparent',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const accordionTitleTextStyle = tva({
|
|
38
|
+
base: 'text-typography-900 font-bold flex-1 text-left',
|
|
39
|
+
parentVariants: {
|
|
40
|
+
size: {
|
|
41
|
+
sm: 'text-sm',
|
|
42
|
+
md: 'text-base',
|
|
43
|
+
lg: 'text-lg',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const accordionIconStyle = tva({
|
|
49
|
+
base: 'text-typography-900 fill-none',
|
|
50
|
+
parentVariants: {
|
|
51
|
+
size: {
|
|
52
|
+
'2xs': 'h-3 w-3',
|
|
53
|
+
xs: 'h-3.5 w-3.5',
|
|
54
|
+
sm: 'h-4 w-4',
|
|
55
|
+
md: 'h-[18px] w-[18px]',
|
|
56
|
+
lg: 'h-5 w-5',
|
|
57
|
+
xl: 'h-6 w-6',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const accordionContentTextStyle = tva({
|
|
63
|
+
base: 'text-typography-700 font-normal',
|
|
64
|
+
parentVariants: {
|
|
65
|
+
size: {
|
|
66
|
+
sm: 'text-sm',
|
|
67
|
+
md: 'text-base',
|
|
68
|
+
lg: 'text-lg',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const accordionHeaderStyle = tva({
|
|
74
|
+
base: 'mx-0 my-0',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const accordionContentStyle = tva({
|
|
78
|
+
base: 'pt-1 pb-3 px-4',
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const accordionTriggerStyle = tva({
|
|
82
|
+
base: 'w-full flex-row justify-between items-center outline-none focus:outline-none data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed data-[focus-visible=true]:bg-background-50 py-3 px-4',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Create web-specific components
|
|
86
|
+
const RootComponent = withStyleContext('div' as any, SCOPE);
|
|
87
|
+
const ItemComponent = React.forwardRef((props: any, ref) => <div {...props} ref={ref} />);
|
|
88
|
+
const HeaderComponent = React.forwardRef((props: any, ref) => <h3 {...props} ref={ref} />);
|
|
89
|
+
const TriggerComponent = React.forwardRef((props: any, ref) => <button {...props} ref={ref} />);
|
|
90
|
+
const TitleTextComponent = React.forwardRef((props: any, ref) => <span {...props} ref={ref} />);
|
|
91
|
+
const ContentTextComponent = React.forwardRef((props: any, ref) => <p {...props} ref={ref} />);
|
|
92
|
+
const ContentComponent = React.forwardRef((props: any, ref) => <div {...props} ref={ref} />);
|
|
93
|
+
|
|
94
|
+
/** Creator */
|
|
95
|
+
const UIAccordion = createAccordion({
|
|
96
|
+
Root: RootComponent,
|
|
97
|
+
Item: ItemComponent,
|
|
98
|
+
Header: HeaderComponent,
|
|
99
|
+
Trigger: TriggerComponent,
|
|
100
|
+
Icon: UIIcon,
|
|
101
|
+
TitleText: TitleTextComponent,
|
|
102
|
+
ContentText: ContentTextComponent,
|
|
103
|
+
Content: ContentComponent,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
type StyleContextType = {
|
|
107
|
+
variant?: 'filled' | 'unfilled';
|
|
108
|
+
size?: 'sm' | 'md' | 'lg';
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type IAccordionProps = React.ComponentPropsWithoutRef<typeof UIAccordion> &
|
|
112
|
+
VariantProps<typeof accordionStyle> & {
|
|
113
|
+
context?: StyleContextType;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
type IAccordionItemProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Item> &
|
|
117
|
+
VariantProps<typeof accordionItemStyle>;
|
|
118
|
+
|
|
119
|
+
type IAccordionContentProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Content> &
|
|
120
|
+
VariantProps<typeof accordionContentStyle>;
|
|
121
|
+
|
|
122
|
+
type IAccordionContentTextProps = React.ComponentPropsWithoutRef<typeof UIAccordion.ContentText> &
|
|
123
|
+
VariantProps<typeof accordionContentTextStyle>;
|
|
124
|
+
|
|
125
|
+
type IAccordionIconProps = VariantProps<typeof accordionIconStyle> &
|
|
126
|
+
React.ComponentPropsWithoutRef<typeof UIAccordion.Icon> & {
|
|
127
|
+
as?: React.ElementType;
|
|
128
|
+
height?: number;
|
|
129
|
+
width?: number;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
type IAccordionHeaderProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Header> &
|
|
133
|
+
VariantProps<typeof accordionHeaderStyle>;
|
|
134
|
+
|
|
135
|
+
type IAccordionTriggerProps = React.ComponentPropsWithoutRef<typeof UIAccordion.Trigger> &
|
|
136
|
+
VariantProps<typeof accordionTriggerStyle>;
|
|
137
|
+
|
|
138
|
+
type IAccordionTitleTextProps = React.ComponentPropsWithoutRef<typeof UIAccordion.TitleText> &
|
|
139
|
+
VariantProps<typeof accordionTitleTextStyle>;
|
|
140
|
+
|
|
141
|
+
/** Components */
|
|
142
|
+
const Accordion = React.forwardRef<React.ElementRef<typeof UIAccordion>, IAccordionProps>(
|
|
143
|
+
({ className, variant = 'filled', size = 'md', ...props }, ref) => {
|
|
144
|
+
return (
|
|
145
|
+
<UIAccordion
|
|
146
|
+
ref={ref}
|
|
147
|
+
{...props}
|
|
148
|
+
className={accordionStyle({ variant, class: className })}
|
|
149
|
+
context={{ variant, size }}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const AccordionItem = React.forwardRef<React.ElementRef<typeof UIAccordion.Item>, IAccordionItemProps>(
|
|
156
|
+
({ className, ...props }, ref) => {
|
|
157
|
+
const { variant } = useStyleContext(SCOPE);
|
|
158
|
+
return (
|
|
159
|
+
<UIAccordion.Item
|
|
160
|
+
ref={ref}
|
|
161
|
+
{...props}
|
|
162
|
+
className={accordionItemStyle({
|
|
163
|
+
parentVariants: { variant },
|
|
164
|
+
class: className,
|
|
165
|
+
})}
|
|
166
|
+
/>
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const AccordionContent = React.forwardRef<React.ElementRef<typeof UIAccordion.Content>, IAccordionContentProps>(
|
|
172
|
+
({ className, ...props }, ref) => {
|
|
173
|
+
return (
|
|
174
|
+
<UIAccordion.Content
|
|
175
|
+
ref={ref}
|
|
176
|
+
{...props}
|
|
177
|
+
className={accordionContentStyle({
|
|
178
|
+
class: className,
|
|
179
|
+
})}
|
|
180
|
+
/>
|
|
181
|
+
);
|
|
182
|
+
},
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const AccordionContentText = React.forwardRef<
|
|
186
|
+
React.ElementRef<typeof UIAccordion.ContentText>,
|
|
187
|
+
IAccordionContentTextProps
|
|
188
|
+
>(({ className, ...props }, ref) => {
|
|
189
|
+
const { size } = useStyleContext(SCOPE);
|
|
190
|
+
return (
|
|
191
|
+
<UIAccordion.ContentText
|
|
192
|
+
ref={ref}
|
|
193
|
+
{...props}
|
|
194
|
+
className={accordionContentTextStyle({
|
|
195
|
+
parentVariants: { size },
|
|
196
|
+
class: className,
|
|
197
|
+
})}
|
|
198
|
+
/>
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const AccordionIcon = React.forwardRef<React.ElementRef<typeof UIAccordion.Icon>, IAccordionIconProps>(
|
|
203
|
+
({ size, className, ...props }, ref) => {
|
|
204
|
+
const { size: parentSize } = useStyleContext(SCOPE);
|
|
205
|
+
|
|
206
|
+
if (typeof size === 'number') {
|
|
207
|
+
return (
|
|
208
|
+
<UIAccordion.Icon
|
|
209
|
+
ref={ref}
|
|
210
|
+
{...props}
|
|
211
|
+
className={accordionIconStyle({ class: className })}
|
|
212
|
+
size={size}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
} else if ((props.height !== undefined || props.width !== undefined) && size === undefined) {
|
|
216
|
+
return <UIAccordion.Icon ref={ref} {...props} className={accordionIconStyle({ class: className })} />;
|
|
217
|
+
}
|
|
218
|
+
return (
|
|
219
|
+
<UIAccordion.Icon
|
|
220
|
+
ref={ref}
|
|
221
|
+
{...props}
|
|
222
|
+
className={accordionIconStyle({
|
|
223
|
+
size,
|
|
224
|
+
class: className,
|
|
225
|
+
parentVariants: { size: parentSize },
|
|
226
|
+
})}
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
const AccordionHeader = React.forwardRef<React.ElementRef<typeof UIAccordion.Header>, IAccordionHeaderProps>(
|
|
233
|
+
({ className, ...props }, ref) => {
|
|
234
|
+
return (
|
|
235
|
+
<UIAccordion.Header
|
|
236
|
+
ref={ref}
|
|
237
|
+
{...props}
|
|
238
|
+
className={accordionHeaderStyle({
|
|
239
|
+
class: className,
|
|
240
|
+
})}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
},
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
const AccordionTrigger = React.forwardRef<React.ElementRef<typeof UIAccordion.Trigger>, IAccordionTriggerProps>(
|
|
247
|
+
({ className, ...props }, ref) => {
|
|
248
|
+
return (
|
|
249
|
+
<UIAccordion.Trigger
|
|
250
|
+
ref={ref}
|
|
251
|
+
{...props}
|
|
252
|
+
className={accordionTriggerStyle({
|
|
253
|
+
class: className,
|
|
254
|
+
})}
|
|
255
|
+
/>
|
|
256
|
+
);
|
|
257
|
+
},
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const AccordionTitleText = React.forwardRef<React.ElementRef<typeof UIAccordion.TitleText>, IAccordionTitleTextProps>(
|
|
261
|
+
({ className, ...props }, ref) => {
|
|
262
|
+
const { size } = useStyleContext(SCOPE);
|
|
263
|
+
return (
|
|
264
|
+
<UIAccordion.TitleText
|
|
265
|
+
ref={ref}
|
|
266
|
+
{...props}
|
|
267
|
+
className={accordionTitleTextStyle({
|
|
268
|
+
parentVariants: { size },
|
|
269
|
+
class: className,
|
|
270
|
+
})}
|
|
271
|
+
/>
|
|
272
|
+
);
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
Accordion.displayName = 'Accordion';
|
|
277
|
+
AccordionItem.displayName = 'AccordionItem';
|
|
278
|
+
AccordionHeader.displayName = 'AccordionHeader';
|
|
279
|
+
AccordionTrigger.displayName = 'AccordionTrigger';
|
|
280
|
+
AccordionTitleText.displayName = 'AccordionTitleText';
|
|
281
|
+
AccordionContentText.displayName = 'AccordionContentText';
|
|
282
|
+
AccordionIcon.displayName = 'AccordionIcon';
|
|
283
|
+
AccordionContent.displayName = 'AccordionContent';
|
|
284
|
+
|
|
285
|
+
export {
|
|
286
|
+
Accordion,
|
|
287
|
+
AccordionItem,
|
|
288
|
+
AccordionHeader,
|
|
289
|
+
AccordionTrigger,
|
|
290
|
+
AccordionTitleText,
|
|
291
|
+
AccordionContentText,
|
|
292
|
+
AccordionIcon,
|
|
293
|
+
AccordionContent,
|
|
294
|
+
};
|