@idealyst/components 1.1.7 → 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 +3 -3
- package/src/Accordion/Accordion.native.tsx +8 -6
- package/src/Accordion/Accordion.styles.old.tsx +298 -0
- package/src/Accordion/Accordion.styles.tsx +102 -236
- package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
- package/src/ActivityIndicator/ActivityIndicator.styles.tsx +44 -74
- package/src/Alert/Alert.native.tsx +16 -6
- package/src/Alert/Alert.styles.old.tsx +209 -0
- package/src/Alert/Alert.styles.tsx +67 -149
- package/src/Avatar/Avatar.styles.old.tsx +99 -0
- package/src/Avatar/Avatar.styles.tsx +35 -80
- package/src/Badge/Badge.styles.old.tsx +157 -0
- package/src/Badge/Badge.styles.tsx +61 -121
- package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
- package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
- package/src/Breadcrumb/Breadcrumb.web.tsx +28 -23
- package/src/Button/Button.styles.tsx +89 -141
- package/src/Card/Card.native.tsx +7 -11
- package/src/Card/Card.styles.old.tsx +160 -0
- package/src/Card/Card.styles.tsx +105 -142
- package/src/Card/Card.web.tsx +5 -4
- package/src/Checkbox/Checkbox.native.tsx +9 -5
- package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
- package/src/Checkbox/Checkbox.styles.tsx +104 -216
- package/src/Checkbox/Checkbox.web.tsx +6 -6
- package/src/Chip/Chip.styles.old.tsx +184 -0
- package/src/Chip/Chip.styles.tsx +34 -72
- package/src/Dialog/Dialog.native.tsx +7 -4
- package/src/Dialog/Dialog.styles.old.tsx +202 -0
- package/src/Dialog/Dialog.styles.tsx +69 -133
- package/src/Divider/Divider.styles.old.tsx +172 -0
- package/src/Divider/Divider.styles.tsx +62 -84
- package/src/Icon/Icon.native.tsx +8 -8
- package/src/Icon/Icon.styles.old.tsx +81 -0
- package/src/Icon/Icon.styles.tsx +52 -66
- 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 +46 -60
- package/src/Input/Input.native.tsx +138 -53
- package/src/Input/Input.styles.old.tsx +289 -0
- package/src/Input/Input.styles.tsx +127 -198
- package/src/List/List.native.tsx +5 -2
- package/src/List/List.styles.old.tsx +242 -0
- package/src/List/List.styles.tsx +179 -215
- package/src/List/ListItem.native.tsx +12 -6
- package/src/List/ListItem.web.tsx +23 -13
- package/src/Menu/Menu.styles.old.tsx +197 -0
- package/src/Menu/Menu.styles.tsx +68 -150
- package/src/Menu/MenuItem.native.tsx +5 -3
- package/src/Menu/MenuItem.styles.old.tsx +114 -0
- package/src/Menu/MenuItem.styles.tsx +57 -89
- package/src/Menu/MenuItem.web.tsx +8 -3
- package/src/Popover/Popover.native.tsx +10 -4
- package/src/Popover/Popover.styles.old.tsx +135 -0
- package/src/Popover/Popover.styles.tsx +51 -112
- package/src/Pressable/Pressable.styles.old.tsx +27 -0
- package/src/Pressable/Pressable.styles.tsx +35 -27
- package/src/Progress/Progress.styles.old.tsx +200 -0
- package/src/Progress/Progress.styles.tsx +75 -164
- package/src/RadioButton/RadioButton.native.tsx +4 -3
- package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
- package/src/RadioButton/RadioButton.styles.tsx +83 -154
- package/src/RadioButton/RadioButton.web.tsx +2 -2
- package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
- package/src/SVGImage/SVGImage.styles.tsx +35 -78
- package/src/Screen/Screen.native.tsx +18 -25
- package/src/Screen/Screen.styles.old.tsx +87 -0
- package/src/Screen/Screen.styles.tsx +105 -67
- package/src/Screen/Screen.web.tsx +1 -1
- package/src/Select/Select.native.tsx +42 -33
- package/src/Select/Select.styles.old.tsx +353 -0
- package/src/Select/Select.styles.tsx +223 -292
- package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
- package/src/Skeleton/Skeleton.styles.tsx +29 -53
- package/src/Slider/Slider.styles.old.tsx +259 -0
- package/src/Slider/Slider.styles.tsx +153 -234
- package/src/Switch/Switch.native.tsx +7 -5
- package/src/Switch/Switch.styles.old.tsx +203 -0
- package/src/Switch/Switch.styles.tsx +101 -174
- package/src/Switch/Switch.web.tsx +5 -5
- package/src/TabBar/TabBar.native.tsx +3 -2
- package/src/TabBar/TabBar.styles.old.tsx +343 -0
- package/src/TabBar/TabBar.styles.tsx +145 -279
- package/src/Table/Table.native.tsx +18 -9
- package/src/Table/Table.styles.old.tsx +311 -0
- package/src/Table/Table.styles.tsx +152 -286
- package/src/Text/Text.native.tsx +1 -3
- 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 -84
- 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 +93 -181
- package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
- package/src/Tooltip/Tooltip.styles.tsx +32 -56
- package/src/Video/Video.styles.old.tsx +51 -0
- package/src/Video/Video.styles.tsx +32 -44
- package/src/View/View.native.tsx +12 -14
- package/src/View/View.styles.old.tsx +125 -0
- package/src/View/View.styles.tsx +76 -106
- package/src/View/View.web.tsx +1 -0
- package/src/examples/CardExamples.tsx +0 -6
- package/src/extensions/extendComponent.ts +61 -0
|
@@ -1,302 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accordion styles using defineStyle with dynamic props.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme, Size } from '@idealyst/theme';
|
|
7
|
+
import { ViewStyleSize } from '../utils/viewStyleProps';
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
10
|
+
void StyleSheet;
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type: AccordionType;
|
|
21
|
-
expanded: boolean;
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
isLast: boolean;
|
|
24
|
-
}
|
|
12
|
+
// Wrap theme for $iterator support
|
|
13
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
type AccordionType = 'standard' | 'separated' | 'bordered';
|
|
27
16
|
|
|
28
|
-
type
|
|
17
|
+
export type AccordionDynamicProps = {
|
|
18
|
+
size?: Size;
|
|
29
19
|
type?: AccordionType;
|
|
20
|
+
expanded?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
30
22
|
isLast?: boolean;
|
|
23
|
+
gap?: ViewStyleSize;
|
|
24
|
+
padding?: ViewStyleSize;
|
|
25
|
+
paddingVertical?: ViewStyleSize;
|
|
26
|
+
paddingHorizontal?: ViewStyleSize;
|
|
27
|
+
margin?: ViewStyleSize;
|
|
28
|
+
marginVertical?: ViewStyleSize;
|
|
29
|
+
marginHorizontal?: ViewStyleSize;
|
|
31
30
|
};
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
33
|
+
* Accordion styles with type/expanded/disabled handling.
|
|
35
34
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
gap: 0,
|
|
40
|
-
},
|
|
41
|
-
separated: {
|
|
42
|
-
gap: 8,
|
|
43
|
-
},
|
|
44
|
-
bordered: {
|
|
45
|
-
gap: 0,
|
|
35
|
+
export const accordionStyles = defineStyle('Accordion', (theme: Theme) => ({
|
|
36
|
+
container: ({ type = 'standard' }: AccordionDynamicProps) => {
|
|
37
|
+
const typeStyles = type === 'bordered' ? {
|
|
46
38
|
borderWidth: 1,
|
|
47
39
|
borderStyle: 'solid' as const,
|
|
48
40
|
borderColor: theme.colors.border.primary,
|
|
49
41
|
borderRadius: 8,
|
|
50
42
|
overflow: 'hidden' as const,
|
|
51
|
-
}
|
|
52
|
-
} as const;
|
|
53
|
-
}
|
|
43
|
+
} : {};
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
return {
|
|
46
|
+
display: 'flex' as const,
|
|
47
|
+
flexDirection: 'column' as const,
|
|
48
|
+
gap: type === 'separated' ? 8 : 0,
|
|
49
|
+
...typeStyles,
|
|
50
|
+
variants: {
|
|
51
|
+
gap: {
|
|
52
|
+
gap: theme.sizes.$view.padding,
|
|
53
|
+
},
|
|
54
|
+
padding: {
|
|
55
|
+
padding: theme.sizes.$view.padding,
|
|
56
|
+
},
|
|
57
|
+
paddingVertical: {
|
|
58
|
+
paddingVertical: theme.sizes.$view.padding,
|
|
59
|
+
},
|
|
60
|
+
paddingHorizontal: {
|
|
61
|
+
paddingHorizontal: theme.sizes.$view.padding,
|
|
62
|
+
},
|
|
63
|
+
margin: {
|
|
64
|
+
margin: theme.sizes.$view.padding,
|
|
65
|
+
},
|
|
66
|
+
marginVertical: {
|
|
67
|
+
marginVertical: theme.sizes.$view.padding,
|
|
68
|
+
},
|
|
69
|
+
marginHorizontal: {
|
|
70
|
+
marginHorizontal: theme.sizes.$view.padding,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
} as const;
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
item: ({ type = 'standard', isLast = false }: AccordionDynamicProps) => {
|
|
77
|
+
let typeStyles = {};
|
|
78
|
+
|
|
79
|
+
if (type === 'standard' || type === 'bordered') {
|
|
80
|
+
typeStyles = {
|
|
62
81
|
borderBottomWidth: isLast ? 0 : 1,
|
|
63
82
|
borderBottomStyle: 'solid' as const,
|
|
64
83
|
borderBottomColor: theme.colors.border.primary,
|
|
65
84
|
};
|
|
66
|
-
|
|
67
|
-
|
|
85
|
+
} else if (type === 'separated') {
|
|
86
|
+
typeStyles = {
|
|
68
87
|
borderWidth: 1,
|
|
69
88
|
borderStyle: 'solid' as const,
|
|
70
89
|
borderColor: theme.colors.border.primary,
|
|
71
90
|
borderRadius: 8,
|
|
72
91
|
overflow: 'hidden' as const,
|
|
73
92
|
};
|
|
74
|
-
|
|
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
|
-
}
|
|
93
|
+
}
|
|
84
94
|
|
|
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
95
|
return {
|
|
92
96
|
display: 'flex' as const,
|
|
93
97
|
flexDirection: 'column' as const,
|
|
94
98
|
...typeStyles,
|
|
95
|
-
variants: {
|
|
96
|
-
size: { xs: {}, sm: {}, md: {}, lg: {}, xl: {} },
|
|
97
|
-
expanded: { true: {}, false: {} },
|
|
98
|
-
disabled: { true: {}, false: {} },
|
|
99
|
-
},
|
|
100
99
|
} as const;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
100
|
+
},
|
|
103
101
|
|
|
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 () => ({
|
|
102
|
+
header: ({ expanded = false, disabled = false }: AccordionDynamicProps) => ({
|
|
160
103
|
display: 'flex' as const,
|
|
161
104
|
flexDirection: 'row' as const,
|
|
162
105
|
alignItems: 'center' as const,
|
|
163
106
|
justifyContent: 'space-between' as const,
|
|
164
|
-
width: '100%'
|
|
107
|
+
width: '100%',
|
|
165
108
|
backgroundColor: 'transparent' as const,
|
|
166
109
|
color: theme.colors.text.primary,
|
|
167
110
|
textAlign: 'left' as const,
|
|
111
|
+
fontWeight: expanded ? ('600' as const) : ('500' as const),
|
|
112
|
+
opacity: disabled ? 0.5 : 1,
|
|
168
113
|
variants: {
|
|
169
|
-
size:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
true: {
|
|
173
|
-
fontWeight: '600' as const,
|
|
174
|
-
},
|
|
175
|
-
false: {
|
|
176
|
-
fontWeight: '500' as const,
|
|
177
|
-
},
|
|
114
|
+
size: {
|
|
115
|
+
fontSize: theme.sizes.$accordion.headerFontSize,
|
|
116
|
+
padding: theme.sizes.$accordion.headerPadding,
|
|
178
117
|
},
|
|
179
|
-
|
|
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,
|
|
118
|
+
},
|
|
197
119
|
_web: {
|
|
198
|
-
border: 'none'
|
|
199
|
-
outline: 'none'
|
|
200
|
-
|
|
120
|
+
border: 'none',
|
|
121
|
+
outline: 'none',
|
|
122
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
123
|
+
transition: 'background-color 0.2s ease',
|
|
124
|
+
_hover: disabled ? {} : { backgroundColor: theme.colors.surface.secondary },
|
|
201
125
|
},
|
|
202
|
-
})
|
|
203
|
-
}
|
|
126
|
+
}),
|
|
204
127
|
|
|
205
|
-
|
|
206
|
-
return () => ({
|
|
128
|
+
title: (_props: AccordionDynamicProps) => ({
|
|
207
129
|
flex: 1,
|
|
208
|
-
|
|
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
|
-
}
|
|
130
|
+
}),
|
|
217
131
|
|
|
218
|
-
|
|
219
|
-
return () => ({
|
|
132
|
+
icon: ({ expanded = false }: AccordionDynamicProps) => ({
|
|
220
133
|
display: 'flex' as const,
|
|
221
134
|
alignItems: 'center' as const,
|
|
222
135
|
justifyContent: 'center' as const,
|
|
223
136
|
marginLeft: 8,
|
|
224
137
|
color: theme.intents.primary.primary,
|
|
225
138
|
variants: {
|
|
226
|
-
size:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
true: {
|
|
230
|
-
_web: {
|
|
231
|
-
transform: 'rotate(180deg)' as const,
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
false: {
|
|
235
|
-
_web: {
|
|
236
|
-
transform: 'rotate(0deg)' as const,
|
|
237
|
-
},
|
|
238
|
-
},
|
|
139
|
+
size: {
|
|
140
|
+
width: theme.sizes.$accordion.iconSize,
|
|
141
|
+
height: theme.sizes.$accordion.iconSize,
|
|
239
142
|
},
|
|
240
|
-
disabled: { true: {}, false: {} },
|
|
241
|
-
isLast: { true: {}, false: {} },
|
|
242
143
|
},
|
|
243
144
|
_web: {
|
|
244
|
-
transition: 'transform 0.2s ease'
|
|
145
|
+
transition: 'transform 0.2s ease',
|
|
146
|
+
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
245
147
|
},
|
|
246
|
-
})
|
|
247
|
-
}
|
|
148
|
+
}),
|
|
248
149
|
|
|
249
|
-
|
|
250
|
-
return () => ({
|
|
150
|
+
content: ({ expanded = false }: AccordionDynamicProps) => ({
|
|
251
151
|
overflow: 'hidden' as const,
|
|
252
|
-
|
|
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
|
-
},
|
|
152
|
+
maxHeight: expanded ? 2000 : 0,
|
|
266
153
|
_web: {
|
|
267
|
-
transition: 'height 0.15s ease, padding 0.3s ease'
|
|
154
|
+
transition: 'height 0.15s ease, padding 0.3s ease',
|
|
268
155
|
},
|
|
269
|
-
})
|
|
270
|
-
}
|
|
156
|
+
}),
|
|
271
157
|
|
|
272
|
-
|
|
273
|
-
return () => ({
|
|
158
|
+
contentInner: (_props: AccordionDynamicProps) => ({
|
|
274
159
|
color: theme.colors.text.secondary,
|
|
275
160
|
variants: {
|
|
276
|
-
size:
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
161
|
+
size: {
|
|
162
|
+
fontSize: theme.sizes.$accordion.headerFontSize,
|
|
163
|
+
padding: theme.sizes.$accordion.contentPadding,
|
|
164
|
+
paddingTop: 0,
|
|
165
|
+
},
|
|
281
166
|
},
|
|
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
|
-
const extended = applyExtensions('Accordion', theme, {
|
|
289
|
-
container: createContainerStyles(theme),
|
|
290
|
-
item: createItemStyles(theme),
|
|
291
|
-
header: createHeaderStyles(theme),
|
|
292
|
-
content: createContentStyles(),
|
|
293
|
-
icon: createIconStyles(theme),
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
return {
|
|
297
|
-
...extended,
|
|
298
|
-
// Minor utility styles (not extended)
|
|
299
|
-
title: createTitleStyles()(),
|
|
300
|
-
contentInner: createContentInnerStyles(theme)(),
|
|
301
|
-
};
|
|
302
|
-
});
|
|
167
|
+
}),
|
|
168
|
+
}));
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles, Intent, Size} from '@idealyst/theme';
|
|
3
|
+
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
+
|
|
6
|
+
type ActivityIndicatorSize = Size;
|
|
7
|
+
type ActivityIndicatorIntent = Intent;
|
|
8
|
+
|
|
9
|
+
type ActivityIndicatorVariants = {
|
|
10
|
+
size: ActivityIndicatorSize;
|
|
11
|
+
intent: ActivityIndicatorIntent;
|
|
12
|
+
animating: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ExpandedActivityIndicatorStyles = StylesheetStyles<keyof ActivityIndicatorVariants>;
|
|
16
|
+
|
|
17
|
+
export type ActivityIndicatorStylesheet = {
|
|
18
|
+
container: ExpandedActivityIndicatorStyles;
|
|
19
|
+
spinner: ExpandedActivityIndicatorStyles;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function createContainerSizeVariants(theme: Theme) {
|
|
23
|
+
return buildSizeVariants(theme, 'activityIndicator', (size) => ({
|
|
24
|
+
width: size.size,
|
|
25
|
+
height: size.size,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function createSpinnerSizeVariants(theme: Theme) {
|
|
30
|
+
return buildSizeVariants(theme, 'activityIndicator', (size) => ({
|
|
31
|
+
width: size.size,
|
|
32
|
+
height: size.size,
|
|
33
|
+
borderWidth: size.borderWidth,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getSpinnerColor(theme: Theme, intent: ActivityIndicatorIntent) {
|
|
38
|
+
return theme.intents[intent].primary;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function createSpinnerStyles(theme: Theme) {
|
|
42
|
+
return ({ intent }: Partial<ActivityIndicatorVariants>) => {
|
|
43
|
+
const color = getSpinnerColor(theme, intent);
|
|
44
|
+
return {
|
|
45
|
+
borderRadius: 9999,
|
|
46
|
+
borderStyle: 'solid',
|
|
47
|
+
color,
|
|
48
|
+
variants: {
|
|
49
|
+
size: createSpinnerSizeVariants(theme),
|
|
50
|
+
animating: {
|
|
51
|
+
true: {},
|
|
52
|
+
false: {},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
_web: {
|
|
56
|
+
borderColor: 'transparent',
|
|
57
|
+
borderTopColor: color,
|
|
58
|
+
borderRightColor: color,
|
|
59
|
+
animation: 'spin 1s linear infinite',
|
|
60
|
+
boxSizing: 'border-box',
|
|
61
|
+
},
|
|
62
|
+
} as const;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Style creators for extension support
|
|
67
|
+
function createContainerStyles(theme: Theme) {
|
|
68
|
+
return () => ({
|
|
69
|
+
alignItems: 'center' as const,
|
|
70
|
+
justifyContent: 'center' as const,
|
|
71
|
+
variants: {
|
|
72
|
+
size: createContainerSizeVariants(theme),
|
|
73
|
+
animating: {
|
|
74
|
+
true: {
|
|
75
|
+
opacity: 1,
|
|
76
|
+
},
|
|
77
|
+
false: {
|
|
78
|
+
opacity: 0,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
86
|
+
// transform on native cannot resolve function calls to extract variant structures.
|
|
87
|
+
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
88
|
+
export const activityIndicatorStyles = StyleSheet.create((theme: Theme) => {
|
|
89
|
+
// Apply extensions to main visual elements
|
|
90
|
+
return applyExtensions('ActivityIndicator', theme, {
|
|
91
|
+
container: createContainerStyles(theme),
|
|
92
|
+
spinner: createSpinnerStyles(theme),
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -1,52 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActivityIndicator styles using defineStyle with $iterator expansion.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
intent: ActivityIndicatorIntent;
|
|
12
|
-
animating: boolean;
|
|
13
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
14
13
|
|
|
15
|
-
export type
|
|
14
|
+
export type ActivityIndicatorDynamicProps = {
|
|
15
|
+
size?: Size;
|
|
16
|
+
intent?: Intent;
|
|
17
|
+
animating?: boolean;
|
|
18
|
+
};
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* ActivityIndicator styles with size and intent handling.
|
|
22
|
+
*/
|
|
23
|
+
export const activityIndicatorStyles = defineStyle('ActivityIndicator', (theme: Theme) => ({
|
|
24
|
+
container: (_props: ActivityIndicatorDynamicProps) => ({
|
|
25
|
+
alignItems: 'center' as const,
|
|
26
|
+
justifyContent: 'center' as const,
|
|
27
|
+
variants: {
|
|
28
|
+
// $iterator expands for each activityIndicator size
|
|
29
|
+
size: {
|
|
30
|
+
width: theme.sizes.$activityIndicator.size,
|
|
31
|
+
height: theme.sizes.$activityIndicator.size,
|
|
32
|
+
},
|
|
33
|
+
animating: {
|
|
34
|
+
true: { opacity: 1 },
|
|
35
|
+
false: { opacity: 0 },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
spinner: ({ intent = 'primary' }: ActivityIndicatorDynamicProps) => {
|
|
41
|
+
// Inline color access for Unistyles to trace
|
|
42
|
+
const color = theme.intents[intent].primary;
|
|
40
43
|
|
|
41
|
-
function createSpinnerStyles(theme: Theme) {
|
|
42
|
-
return ({ intent }: Partial<ActivityIndicatorVariants>) => {
|
|
43
|
-
const color = getSpinnerColor(theme, intent);
|
|
44
44
|
return {
|
|
45
45
|
borderRadius: 9999,
|
|
46
|
-
borderStyle: 'solid',
|
|
46
|
+
borderStyle: 'solid' as const,
|
|
47
47
|
color,
|
|
48
48
|
variants: {
|
|
49
|
-
size:
|
|
49
|
+
size: {
|
|
50
|
+
width: theme.sizes.$activityIndicator.size,
|
|
51
|
+
height: theme.sizes.$activityIndicator.size,
|
|
52
|
+
borderWidth: theme.sizes.$activityIndicator.borderWidth,
|
|
53
|
+
},
|
|
50
54
|
animating: {
|
|
51
55
|
true: {},
|
|
52
56
|
false: {},
|
|
@@ -60,39 +64,5 @@ function createSpinnerStyles(theme: Theme) {
|
|
|
60
64
|
boxSizing: 'border-box',
|
|
61
65
|
},
|
|
62
66
|
} as const;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Style creators for extension support
|
|
67
|
-
function createContainerStyles(theme: Theme) {
|
|
68
|
-
return () => ({
|
|
69
|
-
alignItems: 'center' as const,
|
|
70
|
-
justifyContent: 'center' as const,
|
|
71
|
-
variants: {
|
|
72
|
-
size: createContainerSizeVariants(theme),
|
|
73
|
-
animating: {
|
|
74
|
-
true: {
|
|
75
|
-
opacity: 1,
|
|
76
|
-
},
|
|
77
|
-
false: {
|
|
78
|
-
opacity: 0,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
86
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
87
|
-
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
88
|
-
export const activityIndicatorStyles = StyleSheet.create((theme: Theme) => {
|
|
89
|
-
// Apply extensions to main visual elements
|
|
90
|
-
const extended = applyExtensions('ActivityIndicator', theme, {
|
|
91
|
-
container: createContainerStyles(theme),
|
|
92
|
-
spinner: createSpinnerStyles(theme),
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
...extended,
|
|
97
|
-
};
|
|
98
|
-
});
|
|
67
|
+
},
|
|
68
|
+
}));
|