@idealyst/components 1.1.6 → 1.1.8
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/package.json +8 -3
- package/src/Accordion/Accordion.native.tsx +22 -14
- package/src/Accordion/Accordion.styles.old.tsx +298 -0
- package/src/Accordion/Accordion.styles.tsx +139 -248
- package/src/Accordion/Accordion.web.tsx +12 -7
- package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -2
- package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
- package/src/ActivityIndicator/ActivityIndicator.styles.tsx +43 -62
- package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -2
- package/src/Alert/Alert.native.tsx +26 -15
- package/src/Alert/Alert.styles.old.tsx +209 -0
- package/src/Alert/Alert.styles.tsx +108 -281
- package/src/Alert/Alert.web.tsx +6 -10
- package/src/Avatar/Avatar.native.tsx +5 -2
- package/src/Avatar/Avatar.styles.old.tsx +99 -0
- package/src/Avatar/Avatar.styles.tsx +47 -62
- package/src/Avatar/Avatar.web.tsx +2 -2
- package/src/Badge/Badge.native.tsx +2 -2
- package/src/Badge/Badge.styles.old.tsx +157 -0
- package/src/Badge/Badge.styles.tsx +69 -108
- package/src/Badge/Badge.web.tsx +6 -6
- package/src/Breadcrumb/Breadcrumb.native.tsx +12 -5
- package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
- package/src/Breadcrumb/Breadcrumb.styles.tsx +93 -209
- package/src/Breadcrumb/Breadcrumb.web.tsx +39 -27
- package/src/Button/Button.native.tsx +39 -14
- package/src/Button/Button.styles.tsx +99 -253
- package/src/Button/Button.web.tsx +10 -8
- package/src/Card/Card.native.tsx +8 -4
- package/src/Card/Card.styles.old.tsx +160 -0
- package/src/Card/Card.styles.tsx +107 -142
- package/src/Card/Card.web.tsx +6 -4
- package/src/Checkbox/Checkbox.native.tsx +14 -6
- package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
- package/src/Checkbox/Checkbox.styles.tsx +109 -197
- package/src/Checkbox/Checkbox.web.tsx +7 -7
- package/src/Chip/Chip.native.tsx +5 -5
- package/src/Chip/Chip.styles.old.tsx +184 -0
- package/src/Chip/Chip.styles.tsx +34 -22
- package/src/Chip/Chip.web.tsx +5 -5
- package/src/Dialog/Dialog.native.tsx +16 -7
- package/src/Dialog/Dialog.styles.old.tsx +202 -0
- package/src/Dialog/Dialog.styles.tsx +108 -132
- package/src/Dialog/Dialog.web.tsx +4 -4
- package/src/Divider/Divider.native.tsx +29 -42
- package/src/Divider/Divider.styles.old.tsx +172 -0
- package/src/Divider/Divider.styles.tsx +116 -242
- package/src/Divider/Divider.web.tsx +17 -14
- package/src/Icon/Icon.native.tsx +12 -4
- package/src/Icon/Icon.styles.old.tsx +81 -0
- package/src/Icon/Icon.styles.tsx +52 -60
- package/src/Icon/Icon.web.tsx +43 -7
- package/src/Icon/IconSvg/IconSvg.web.tsx +2 -0
- package/src/Image/Image.styles.old.tsx +69 -0
- package/src/Image/Image.styles.tsx +45 -43
- package/src/Input/Input.native.tsx +140 -56
- package/src/Input/Input.styles.old.tsx +289 -0
- package/src/Input/Input.styles.tsx +177 -228
- package/src/Input/Input.web.tsx +5 -8
- package/src/Link/Link.native.tsx +4 -1
- package/src/List/List.native.tsx +5 -2
- package/src/List/List.styles.old.tsx +242 -0
- package/src/List/List.styles.tsx +178 -240
- package/src/List/ListItem.native.tsx +16 -8
- package/src/List/ListItem.web.tsx +26 -15
- package/src/Menu/Menu.native.tsx +1 -1
- package/src/Menu/Menu.styles.old.tsx +197 -0
- package/src/Menu/Menu.styles.tsx +90 -156
- package/src/Menu/Menu.web.tsx +2 -2
- package/src/Menu/MenuItem.native.tsx +9 -5
- package/src/Menu/MenuItem.styles.old.tsx +114 -0
- package/src/Menu/MenuItem.styles.tsx +71 -104
- package/src/Menu/MenuItem.web.tsx +23 -5
- package/src/Popover/Popover.native.tsx +10 -4
- package/src/Popover/Popover.styles.old.tsx +135 -0
- package/src/Popover/Popover.styles.tsx +46 -96
- package/src/Popover/Popover.web.tsx +1 -1
- package/src/Pressable/Pressable.native.tsx +3 -1
- package/src/Pressable/Pressable.styles.old.tsx +27 -0
- package/src/Pressable/Pressable.styles.tsx +35 -20
- package/src/Pressable/Pressable.web.tsx +1 -1
- package/src/Progress/Progress.native.tsx +15 -6
- package/src/Progress/Progress.styles.old.tsx +200 -0
- package/src/Progress/Progress.styles.tsx +69 -118
- package/src/Progress/Progress.web.tsx +10 -9
- package/src/RadioButton/RadioButton.native.tsx +10 -4
- package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
- package/src/RadioButton/RadioButton.styles.tsx +81 -145
- package/src/RadioButton/RadioButton.web.tsx +4 -4
- package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
- package/src/SVGImage/SVGImage.styles.tsx +35 -66
- package/src/Screen/Screen.native.tsx +30 -27
- package/src/Screen/Screen.styles.old.tsx +87 -0
- package/src/Screen/Screen.styles.tsx +120 -71
- package/src/Screen/Screen.web.tsx +2 -2
- package/src/Select/Select.native.tsx +44 -29
- package/src/Select/Select.styles.old.tsx +353 -0
- package/src/Select/Select.styles.tsx +244 -293
- package/src/Select/Select.web.tsx +5 -5
- package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
- package/src/Skeleton/Skeleton.styles.tsx +31 -43
- package/src/Slider/Slider.native.tsx +9 -5
- package/src/Slider/Slider.styles.old.tsx +259 -0
- package/src/Slider/Slider.styles.tsx +157 -227
- package/src/Slider/Slider.web.tsx +5 -5
- package/src/Switch/Switch.native.tsx +11 -5
- package/src/Switch/Switch.styles.old.tsx +203 -0
- package/src/Switch/Switch.styles.tsx +103 -149
- package/src/Switch/Switch.web.tsx +8 -8
- package/src/TabBar/TabBar.native.tsx +24 -31
- package/src/TabBar/TabBar.styles.old.tsx +343 -0
- package/src/TabBar/TabBar.styles.tsx +204 -494
- package/src/TabBar/TabBar.web.tsx +21 -33
- package/src/Table/Table.native.tsx +18 -9
- package/src/Table/Table.styles.old.tsx +311 -0
- package/src/Table/Table.styles.tsx +151 -278
- package/src/Table/Table.web.tsx +1 -1
- package/src/Text/Text.native.tsx +1 -4
- package/src/Text/Text.style.demo.tsx +16 -0
- package/src/Text/Text.styles.old.tsx +219 -0
- package/src/Text/Text.styles.tsx +94 -78
- package/src/Text/Text.web.tsx +2 -2
- package/src/Text/index.ts +1 -0
- package/src/TextArea/TextArea.styles.old.tsx +213 -0
- package/src/TextArea/TextArea.styles.tsx +101 -157
- package/src/Tooltip/Tooltip.native.tsx +2 -2
- package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
- package/src/Tooltip/Tooltip.styles.tsx +38 -53
- package/src/Tooltip/Tooltip.web.tsx +2 -2
- package/src/Video/Video.styles.old.tsx +51 -0
- package/src/Video/Video.styles.tsx +32 -28
- package/src/View/View.native.tsx +12 -12
- package/src/View/View.styles.old.tsx +125 -0
- package/src/View/View.styles.tsx +84 -103
- package/src/View/View.web.tsx +14 -2
- package/src/examples/CardExamples.tsx +0 -6
- package/src/extensions/applyExtension.ts +210 -0
- package/src/extensions/extendComponent.ts +438 -0
- package/src/extensions/index.ts +102 -0
- package/src/extensions/types.ts +497 -0
- package/src/globals.ts +16 -0
- package/src/index.native.ts +4 -0
- package/src/index.ts +28 -0
- package/src/utils/deepMerge.ts +54 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idealyst/components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Shared component library for React and React Native",
|
|
5
5
|
"documentation": "https://github.com/IdealystIO/idealyst-framework/tree/main/packages/components#readme",
|
|
6
6
|
"readme": "README.md",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"require": "./src/index.ts",
|
|
26
26
|
"types": "./src/index.ts"
|
|
27
27
|
},
|
|
28
|
+
"./extensions": {
|
|
29
|
+
"import": "./src/extensions/index.ts",
|
|
30
|
+
"require": "./src/extensions/index.ts",
|
|
31
|
+
"types": "./src/extensions/index.ts"
|
|
32
|
+
},
|
|
28
33
|
"./utils": {
|
|
29
34
|
"import": "./src/utils/index.ts",
|
|
30
35
|
"require": "./src/utils/index.ts",
|
|
@@ -51,7 +56,7 @@
|
|
|
51
56
|
"publish:npm": "npm publish"
|
|
52
57
|
},
|
|
53
58
|
"peerDependencies": {
|
|
54
|
-
"@idealyst/theme": "^1.1.
|
|
59
|
+
"@idealyst/theme": "^1.1.8",
|
|
55
60
|
"@mdi/js": ">=7.0.0",
|
|
56
61
|
"@mdi/react": ">=1.0.0",
|
|
57
62
|
"@react-native-vector-icons/common": ">=12.0.0",
|
|
@@ -101,7 +106,7 @@
|
|
|
101
106
|
}
|
|
102
107
|
},
|
|
103
108
|
"devDependencies": {
|
|
104
|
-
"@idealyst/theme": "^1.1.
|
|
109
|
+
"@idealyst/theme": "^1.1.8",
|
|
105
110
|
"@mdi/react": "^1.6.1",
|
|
106
111
|
"@types/react": "^19.1.0",
|
|
107
112
|
"react": "^19.1.0",
|
|
@@ -30,15 +30,21 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
|
30
30
|
const iconRotation = useSharedValue(0);
|
|
31
31
|
const [measuredHeight, setMeasuredHeight] = useState(0);
|
|
32
32
|
|
|
33
|
-
// Apply item-specific variants
|
|
33
|
+
// Apply item-specific variants (for size, expanded, disabled)
|
|
34
34
|
accordionStyles.useVariants({
|
|
35
|
-
type,
|
|
36
|
-
isLast,
|
|
37
35
|
size,
|
|
38
36
|
expanded: isExpanded,
|
|
39
37
|
disabled: Boolean(item.disabled),
|
|
40
38
|
});
|
|
41
39
|
|
|
40
|
+
// Get dynamic styles - call as functions to get theme-reactive styles
|
|
41
|
+
const itemStyle = (accordionStyles.item as any)({ type, isLast });
|
|
42
|
+
const headerStyle = (accordionStyles.header as any)({});
|
|
43
|
+
const iconStyle = (accordionStyles.icon as any)({});
|
|
44
|
+
const contentStyle = (accordionStyles.content as any)({});
|
|
45
|
+
const titleStyle = (accordionStyles.title as any)({});
|
|
46
|
+
const contentInnerStyle = (contentInnerStyle as any)({});
|
|
47
|
+
|
|
42
48
|
// Animate height and icon rotation when expanded state changes
|
|
43
49
|
useEffect(() => {
|
|
44
50
|
contentHeight.value = withTiming(
|
|
@@ -74,9 +80,9 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
|
74
80
|
};
|
|
75
81
|
|
|
76
82
|
return (
|
|
77
|
-
<View style={
|
|
83
|
+
<View style={itemStyle} testID={testID}>
|
|
78
84
|
<TouchableOpacity
|
|
79
|
-
style={
|
|
85
|
+
style={headerStyle}
|
|
80
86
|
onPress={onToggle}
|
|
81
87
|
disabled={item.disabled}
|
|
82
88
|
activeOpacity={0.7}
|
|
@@ -84,16 +90,16 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
|
84
90
|
accessibilityLabel={item.title}
|
|
85
91
|
accessibilityState={{ expanded: isExpanded, disabled: item.disabled }}
|
|
86
92
|
>
|
|
87
|
-
<View style={
|
|
88
|
-
<Text style={
|
|
93
|
+
<View style={titleStyle}>
|
|
94
|
+
<Text style={headerStyle}>
|
|
89
95
|
{item.title}
|
|
90
96
|
</Text>
|
|
91
97
|
</View>
|
|
92
|
-
<Animated.View style={[
|
|
98
|
+
<Animated.View style={[iconStyle, animatedIconStyle]}>
|
|
93
99
|
<MaterialCommunityIcons
|
|
94
100
|
name="chevron-down"
|
|
95
101
|
size={20}
|
|
96
|
-
style={
|
|
102
|
+
style={iconStyle}
|
|
97
103
|
/>
|
|
98
104
|
</Animated.View>
|
|
99
105
|
</TouchableOpacity>
|
|
@@ -103,9 +109,9 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
|
103
109
|
style={{ position: 'absolute', opacity: 0, zIndex: -1 }}
|
|
104
110
|
onLayout={handleContentLayout}
|
|
105
111
|
>
|
|
106
|
-
<View style={
|
|
112
|
+
<View style={contentInnerStyle}>
|
|
107
113
|
{typeof item.content === 'string' ? (
|
|
108
|
-
<Text style={
|
|
114
|
+
<Text style={contentInnerStyle}>
|
|
109
115
|
{item.content}
|
|
110
116
|
</Text>
|
|
111
117
|
) : (
|
|
@@ -116,9 +122,9 @@ const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
|
116
122
|
|
|
117
123
|
{/* Animated visible content */}
|
|
118
124
|
<Animated.View style={animatedContentStyle}>
|
|
119
|
-
<View style={
|
|
125
|
+
<View style={contentInnerStyle}>
|
|
120
126
|
{typeof item.content === 'string' ? (
|
|
121
|
-
<Text style={
|
|
127
|
+
<Text style={contentInnerStyle}>
|
|
122
128
|
{item.content}
|
|
123
129
|
</Text>
|
|
124
130
|
) : (
|
|
@@ -196,8 +202,10 @@ const Accordion = forwardRef<View, AccordionProps>(({
|
|
|
196
202
|
});
|
|
197
203
|
};
|
|
198
204
|
|
|
205
|
+
const containerStyle = (accordionStyles.container as any)({});
|
|
206
|
+
|
|
199
207
|
return (
|
|
200
|
-
<View ref={ref} nativeID={id} style={[
|
|
208
|
+
<View ref={ref} nativeID={id} style={[containerStyle, style]} testID={testID} {...nativeA11yProps}>
|
|
201
209
|
{items.map((item, index) => (
|
|
202
210
|
<AccordionItem
|
|
203
211
|
key={item.id}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles, Size } from '@idealyst/theme';
|
|
3
|
+
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildGapVariants,
|
|
6
|
+
buildPaddingVariants,
|
|
7
|
+
buildPaddingVerticalVariants,
|
|
8
|
+
buildPaddingHorizontalVariants,
|
|
9
|
+
buildMarginVariants,
|
|
10
|
+
buildMarginVerticalVariants,
|
|
11
|
+
buildMarginHorizontalVariants,
|
|
12
|
+
} from '../utils/buildViewStyleVariants';
|
|
13
|
+
import { AccordionType } from './types';
|
|
14
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
15
|
+
|
|
16
|
+
type AccordionSize = Size;
|
|
17
|
+
|
|
18
|
+
type AccordionVariants = {
|
|
19
|
+
size: AccordionSize;
|
|
20
|
+
type: AccordionType;
|
|
21
|
+
expanded: boolean;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
isLast: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ExpandedAccordionStyles = StylesheetStyles<keyof AccordionVariants>;
|
|
27
|
+
|
|
28
|
+
type ItemDynamicProps = {
|
|
29
|
+
type?: AccordionType;
|
|
30
|
+
isLast?: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create type variants for container
|
|
35
|
+
*/
|
|
36
|
+
function createContainerTypeVariants(theme: Theme) {
|
|
37
|
+
return {
|
|
38
|
+
standard: {
|
|
39
|
+
gap: 0,
|
|
40
|
+
},
|
|
41
|
+
separated: {
|
|
42
|
+
gap: 8,
|
|
43
|
+
},
|
|
44
|
+
bordered: {
|
|
45
|
+
gap: 0,
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderStyle: 'solid' as const,
|
|
48
|
+
borderColor: theme.colors.border.primary,
|
|
49
|
+
borderRadius: 8,
|
|
50
|
+
overflow: 'hidden' as const,
|
|
51
|
+
},
|
|
52
|
+
} as const;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get item styles based on type and isLast
|
|
57
|
+
*/
|
|
58
|
+
function getItemTypeStyles(theme: Theme, type: AccordionType, isLast: boolean) {
|
|
59
|
+
switch (type) {
|
|
60
|
+
case 'standard':
|
|
61
|
+
return {
|
|
62
|
+
borderBottomWidth: isLast ? 0 : 1,
|
|
63
|
+
borderBottomStyle: 'solid' as const,
|
|
64
|
+
borderBottomColor: theme.colors.border.primary,
|
|
65
|
+
};
|
|
66
|
+
case 'separated':
|
|
67
|
+
return {
|
|
68
|
+
borderWidth: 1,
|
|
69
|
+
borderStyle: 'solid' as const,
|
|
70
|
+
borderColor: theme.colors.border.primary,
|
|
71
|
+
borderRadius: 8,
|
|
72
|
+
overflow: 'hidden' as const,
|
|
73
|
+
};
|
|
74
|
+
case 'bordered':
|
|
75
|
+
return {
|
|
76
|
+
borderBottomWidth: isLast ? 0 : 1,
|
|
77
|
+
borderBottomStyle: 'solid' as const,
|
|
78
|
+
borderBottomColor: theme.colors.border.primary,
|
|
79
|
+
};
|
|
80
|
+
default:
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Create dynamic item styles
|
|
87
|
+
*/
|
|
88
|
+
function createItemStyles(theme: Theme) {
|
|
89
|
+
return ({ type = 'standard', isLast = false }: ItemDynamicProps) => {
|
|
90
|
+
const typeStyles = getItemTypeStyles(theme, type, isLast);
|
|
91
|
+
return {
|
|
92
|
+
display: 'flex' as const,
|
|
93
|
+
flexDirection: 'column' as const,
|
|
94
|
+
...typeStyles,
|
|
95
|
+
variants: {
|
|
96
|
+
size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
|
|
97
|
+
expanded: { true: {}, false: {} },
|
|
98
|
+
disabled: { true: {}, false: {} },
|
|
99
|
+
},
|
|
100
|
+
} as const;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Create size variants for header
|
|
106
|
+
*/
|
|
107
|
+
function createHeaderSizeVariants(theme: Theme) {
|
|
108
|
+
return buildSizeVariants(theme, 'accordion', (size) => ({
|
|
109
|
+
fontSize: size.headerFontSize,
|
|
110
|
+
padding: size.headerPadding,
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Create size variants for icon
|
|
116
|
+
*/
|
|
117
|
+
function createIconSizeVariants(theme: Theme) {
|
|
118
|
+
return buildSizeVariants(theme, 'accordion', (size) => ({
|
|
119
|
+
width: size.iconSize,
|
|
120
|
+
height: size.iconSize,
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Create size variants for content inner
|
|
126
|
+
*/
|
|
127
|
+
function createContentInnerSizeVariants(theme: Theme) {
|
|
128
|
+
return buildSizeVariants(theme, 'accordion', (size) => ({
|
|
129
|
+
fontSize: size.headerFontSize,
|
|
130
|
+
padding: size.contentPadding,
|
|
131
|
+
paddingTop: 0,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Helper functions to create static styles wrapped in dynamic functions
|
|
136
|
+
function createContainerStyles(theme: Theme) {
|
|
137
|
+
return () => ({
|
|
138
|
+
display: 'flex' as const,
|
|
139
|
+
flexDirection: 'column' as const,
|
|
140
|
+
variants: {
|
|
141
|
+
size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
|
|
142
|
+
type: createContainerTypeVariants(theme),
|
|
143
|
+
expanded: { true: {}, false: {} },
|
|
144
|
+
disabled: { true: {}, false: {} },
|
|
145
|
+
isLast: { true: {}, false: {} },
|
|
146
|
+
// Spacing variants from ContainerStyleProps
|
|
147
|
+
gap: buildGapVariants(theme),
|
|
148
|
+
padding: buildPaddingVariants(theme),
|
|
149
|
+
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
150
|
+
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
151
|
+
margin: buildMarginVariants(theme),
|
|
152
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
153
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function createHeaderStyles(theme: Theme) {
|
|
159
|
+
return () => ({
|
|
160
|
+
display: 'flex' as const,
|
|
161
|
+
flexDirection: 'row' as const,
|
|
162
|
+
alignItems: 'center' as const,
|
|
163
|
+
justifyContent: 'space-between' as const,
|
|
164
|
+
width: '100%' as const,
|
|
165
|
+
backgroundColor: 'transparent' as const,
|
|
166
|
+
color: theme.colors.text.primary,
|
|
167
|
+
textAlign: 'left' as const,
|
|
168
|
+
variants: {
|
|
169
|
+
size: createHeaderSizeVariants(theme),
|
|
170
|
+
type: { standard: {}, separated: {}, bordered: {} },
|
|
171
|
+
expanded: {
|
|
172
|
+
true: {
|
|
173
|
+
fontWeight: '600' as const,
|
|
174
|
+
},
|
|
175
|
+
false: {
|
|
176
|
+
fontWeight: '500' as const,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
disabled: {
|
|
180
|
+
true: {
|
|
181
|
+
opacity: 0.5,
|
|
182
|
+
_web: {
|
|
183
|
+
cursor: 'not-allowed' as const,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
false: {
|
|
187
|
+
_web: {
|
|
188
|
+
cursor: 'pointer' as const,
|
|
189
|
+
_hover: {
|
|
190
|
+
backgroundColor: theme.colors.surface.secondary,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
isLast: { true: {}, false: {} },
|
|
196
|
+
} as const,
|
|
197
|
+
_web: {
|
|
198
|
+
border: 'none' as const,
|
|
199
|
+
outline: 'none' as const,
|
|
200
|
+
transition: 'background-color 0.2s ease' as const,
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function createTitleStyles() {
|
|
206
|
+
return () => ({
|
|
207
|
+
flex: 1,
|
|
208
|
+
variants: {
|
|
209
|
+
size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
|
|
210
|
+
type: { standard: {}, separated: {}, bordered: {} },
|
|
211
|
+
expanded: { true: {}, false: {} },
|
|
212
|
+
disabled: { true: {}, false: {} },
|
|
213
|
+
isLast: { true: {}, false: {} },
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function createIconStyles(theme: Theme) {
|
|
219
|
+
return () => ({
|
|
220
|
+
display: 'flex' as const,
|
|
221
|
+
alignItems: 'center' as const,
|
|
222
|
+
justifyContent: 'center' as const,
|
|
223
|
+
marginLeft: 8,
|
|
224
|
+
color: theme.intents.primary.primary,
|
|
225
|
+
variants: {
|
|
226
|
+
size: createIconSizeVariants(theme),
|
|
227
|
+
type: { standard: {}, separated: {}, bordered: {} },
|
|
228
|
+
expanded: {
|
|
229
|
+
true: {
|
|
230
|
+
_web: {
|
|
231
|
+
transform: 'rotate(180deg)' as const,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
false: {
|
|
235
|
+
_web: {
|
|
236
|
+
transform: 'rotate(0deg)' as const,
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
disabled: { true: {}, false: {} },
|
|
241
|
+
isLast: { true: {}, false: {} },
|
|
242
|
+
},
|
|
243
|
+
_web: {
|
|
244
|
+
transition: 'transform 0.2s ease' as const,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function createContentStyles() {
|
|
250
|
+
return () => ({
|
|
251
|
+
overflow: 'hidden' as const,
|
|
252
|
+
variants: {
|
|
253
|
+
size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
|
|
254
|
+
type: { standard: {}, separated: {}, bordered: {} },
|
|
255
|
+
expanded: {
|
|
256
|
+
true: {
|
|
257
|
+
maxHeight: 2000,
|
|
258
|
+
},
|
|
259
|
+
false: {
|
|
260
|
+
maxHeight: 0,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
disabled: { true: {}, false: {} },
|
|
264
|
+
isLast: { true: {}, false: {} },
|
|
265
|
+
},
|
|
266
|
+
_web: {
|
|
267
|
+
transition: 'height 0.15s ease, padding 0.3s ease' as const,
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function createContentInnerStyles(theme: Theme) {
|
|
273
|
+
return () => ({
|
|
274
|
+
color: theme.colors.text.secondary,
|
|
275
|
+
variants: {
|
|
276
|
+
size: createContentInnerSizeVariants(theme),
|
|
277
|
+
type: { standard: {}, separated: {}, bordered: {} },
|
|
278
|
+
expanded: { true: {}, false: {} },
|
|
279
|
+
disabled: { true: {}, false: {} },
|
|
280
|
+
isLast: { true: {}, false: {} },
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
286
|
+
export const accordionStyles = StyleSheet.create((theme: Theme) => {
|
|
287
|
+
// Apply extensions to main visual elements
|
|
288
|
+
|
|
289
|
+
return applyExtensions('Accordion', theme, {container: createContainerStyles(theme),
|
|
290
|
+
item: createItemStyles(theme),
|
|
291
|
+
header: createHeaderStyles(theme),
|
|
292
|
+
content: createContentStyles(),
|
|
293
|
+
icon: createIconStyles(theme),
|
|
294
|
+
// Additional styles (merged from return)
|
|
295
|
+
// Minor utility styles (not extended)
|
|
296
|
+
title: createTitleStyles()(),
|
|
297
|
+
contentInner: createContentInnerStyles(theme)()});
|
|
298
|
+
});
|