@idealyst/components 1.2.13 → 1.2.14
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/ActivityIndicator/ActivityIndicator.native.tsx +3 -3
- package/src/ActivityIndicator/ActivityIndicator.web.tsx +3 -3
- package/src/Avatar/Avatar.native.tsx +1 -1
- package/src/Breadcrumb/Breadcrumb.native.tsx +20 -21
- package/src/Dialog/Dialog.native.tsx +2 -2
- package/src/Icon/types.ts +3 -0
- package/src/Skeleton/Skeleton.native.tsx +3 -3
- package/src/Skeleton/Skeleton.web.tsx +3 -3
- package/src/Slider/Slider.native.tsx +2 -2
- package/src/TabBar/TabBar.native.tsx +2 -2
- package/src/index.native.ts +1 -1
- package/src/index.ts +1 -1
- package/src/Accordion/Accordion.styles.old.tsx +0 -298
- package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +0 -94
- package/src/Alert/Alert.styles.old.tsx +0 -209
- package/src/Avatar/Avatar.styles.old.tsx +0 -99
- package/src/Badge/Badge.styles.old.tsx +0 -157
- package/src/Breadcrumb/Breadcrumb.styles.old.tsx +0 -231
- package/src/Card/Card.styles.old.tsx +0 -160
- package/src/Checkbox/Checkbox.styles.old.tsx +0 -271
- package/src/Chip/Chip.styles.old.tsx +0 -184
- package/src/Dialog/Dialog.styles.old.tsx +0 -202
- package/src/Divider/Divider.styles.old.tsx +0 -172
- package/src/Icon/Icon.styles.old.tsx +0 -81
- package/src/Image/Image.styles.old.tsx +0 -69
- package/src/Input/Input.styles.old.tsx +0 -289
- package/src/List/List.styles.old.tsx +0 -242
- package/src/Menu/Menu.styles.old.tsx +0 -197
- package/src/Menu/MenuItem.styles.old.tsx +0 -114
- package/src/Popover/Popover.styles.old.tsx +0 -135
- package/src/Pressable/Pressable.styles.old.tsx +0 -27
- package/src/Progress/Progress.styles.old.tsx +0 -200
- package/src/RadioButton/RadioButton.styles.old.tsx +0 -175
- package/src/SVGImage/SVGImage.styles.old.tsx +0 -86
- package/src/Screen/Screen.styles.old.tsx +0 -87
- package/src/Select/Select.styles.old.tsx +0 -353
- package/src/Skeleton/Skeleton.styles.old.tsx +0 -67
- package/src/Slider/Slider.styles.old.tsx +0 -259
- package/src/Switch/Switch.styles.old.tsx +0 -203
- package/src/TabBar/TabBar.styles.old.tsx +0 -343
- package/src/Table/Table.styles.old.tsx +0 -311
- package/src/Text/Text.styles.old.tsx +0 -219
- package/src/TextArea/TextArea.styles.old.tsx +0 -213
- package/src/Tooltip/Tooltip.styles.old.tsx +0 -82
- package/src/Video/Video.styles.old.tsx +0 -51
- package/src/View/View.styles.old.tsx +0 -125
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { Theme, StylesheetStyles, CompoundVariants, Intent, Size } from '@idealyst/theme';
|
|
3
|
-
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
-
|
|
6
|
-
type MenuSize = Size;
|
|
7
|
-
type MenuIntent = Intent;
|
|
8
|
-
|
|
9
|
-
type MenuVariants = {
|
|
10
|
-
size: MenuSize;
|
|
11
|
-
intent: MenuIntent;
|
|
12
|
-
disabled: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type ExpandedMenuStyles = StylesheetStyles<keyof MenuVariants>;
|
|
16
|
-
|
|
17
|
-
export type MenuStylesheet = {
|
|
18
|
-
overlay: ExpandedMenuStyles;
|
|
19
|
-
menu: ExpandedMenuStyles;
|
|
20
|
-
separator: ExpandedMenuStyles;
|
|
21
|
-
item: ExpandedMenuStyles;
|
|
22
|
-
icon: ExpandedMenuStyles;
|
|
23
|
-
label: ExpandedMenuStyles;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Create size variants for menu item
|
|
28
|
-
*/
|
|
29
|
-
function createItemSizeVariants(theme: Theme) {
|
|
30
|
-
return buildSizeVariants(theme, 'menu', (size) => ({
|
|
31
|
-
paddingVertical: size.paddingVertical,
|
|
32
|
-
paddingHorizontal: size.paddingHorizontal,
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get hover styles for menu item based on intent
|
|
38
|
-
*/
|
|
39
|
-
function getItemHoverStyles(theme: Theme, intent: MenuIntent) {
|
|
40
|
-
if (intent === 'neutral') {
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
const intentValue = theme.intents[intent];
|
|
44
|
-
return {
|
|
45
|
-
_web: {
|
|
46
|
-
_hover: {
|
|
47
|
-
backgroundColor: intentValue.light + '20',
|
|
48
|
-
color: intentValue.primary,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
} as const;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Create compound variants for menu item
|
|
56
|
-
*/
|
|
57
|
-
function createItemCompoundVariants(theme: Theme): CompoundVariants<keyof MenuVariants> {
|
|
58
|
-
return [
|
|
59
|
-
{
|
|
60
|
-
disabled: true,
|
|
61
|
-
styles: {
|
|
62
|
-
_web: {
|
|
63
|
-
_hover: {
|
|
64
|
-
backgroundColor: 'transparent',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
] as const;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Create size variants for icon
|
|
74
|
-
*/
|
|
75
|
-
function createIconSizeVariants(theme: Theme) {
|
|
76
|
-
return buildSizeVariants(theme, 'menu', (size) => ({
|
|
77
|
-
width: size.iconSize,
|
|
78
|
-
height: size.iconSize,
|
|
79
|
-
fontSize: size.iconSize,
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Create size variants for label
|
|
85
|
-
*/
|
|
86
|
-
function createLabelSizeVariants(theme: Theme) {
|
|
87
|
-
return buildSizeVariants(theme, 'menu', (size) => ({
|
|
88
|
-
fontSize: size.labelFontSize,
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Main element style creators (for extension support)
|
|
93
|
-
function createOverlayStyles(theme: Theme) {
|
|
94
|
-
return () => ({
|
|
95
|
-
backgroundColor: 'transparent',
|
|
96
|
-
_web: {
|
|
97
|
-
position: 'fixed' as const,
|
|
98
|
-
top: 0,
|
|
99
|
-
left: 0,
|
|
100
|
-
right: 0,
|
|
101
|
-
bottom: 0,
|
|
102
|
-
zIndex: 999,
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function createMenuStyles(theme: Theme) {
|
|
108
|
-
return () => ({
|
|
109
|
-
position: 'absolute' as const,
|
|
110
|
-
zIndex: 1000,
|
|
111
|
-
backgroundColor: theme.colors.surface.primary,
|
|
112
|
-
borderWidth: 1,
|
|
113
|
-
borderStyle: 'solid' as const,
|
|
114
|
-
borderColor: theme.colors.border.primary,
|
|
115
|
-
borderRadius: 8,
|
|
116
|
-
minWidth: 120,
|
|
117
|
-
maxWidth: 400,
|
|
118
|
-
padding: 4,
|
|
119
|
-
display: 'flex' as const,
|
|
120
|
-
flexDirection: 'column' as const,
|
|
121
|
-
_web: {
|
|
122
|
-
border: `1px solid ${theme.colors.border.primary}`,
|
|
123
|
-
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
|
|
124
|
-
width: 'fit-content',
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function createItemStyles(theme: Theme) {
|
|
130
|
-
return ({ intent }: Partial<MenuVariants>) => {
|
|
131
|
-
const hoverStyles = getItemHoverStyles(theme, intent ?? 'neutral');
|
|
132
|
-
return {
|
|
133
|
-
flexDirection: 'row',
|
|
134
|
-
alignItems: 'center',
|
|
135
|
-
backgroundColor: 'transparent',
|
|
136
|
-
borderRadius: 4,
|
|
137
|
-
minHeight: 44,
|
|
138
|
-
variants: {
|
|
139
|
-
size: createItemSizeVariants(theme),
|
|
140
|
-
disabled: {
|
|
141
|
-
true: {
|
|
142
|
-
opacity: 0.5,
|
|
143
|
-
_web: {
|
|
144
|
-
cursor: 'not-allowed',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
false: {},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
compoundVariants: createItemCompoundVariants(theme),
|
|
151
|
-
_web: {
|
|
152
|
-
cursor: 'pointer',
|
|
153
|
-
border: 'none',
|
|
154
|
-
outline: 'none',
|
|
155
|
-
transition: 'background-color 0.2s ease',
|
|
156
|
-
textAlign: 'left',
|
|
157
|
-
_hover: {
|
|
158
|
-
backgroundColor: theme.colors.surface.secondary,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
...hoverStyles,
|
|
162
|
-
} as const;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
167
|
-
export const menuStyles = StyleSheet.create((theme: Theme) => {
|
|
168
|
-
// Apply extensions to main visual elements
|
|
169
|
-
|
|
170
|
-
return applyExtensions('Menu', theme, {overlay: createOverlayStyles(theme),
|
|
171
|
-
menu: createMenuStyles(theme),
|
|
172
|
-
item: createItemStyles(theme),
|
|
173
|
-
// Additional styles (merged from return)
|
|
174
|
-
// Minor utility styles (not extended)
|
|
175
|
-
separator: {
|
|
176
|
-
height: 1,
|
|
177
|
-
backgroundColor: theme.colors.border.primary,
|
|
178
|
-
marginTop: 4,
|
|
179
|
-
marginBottom: 4,
|
|
180
|
-
},
|
|
181
|
-
icon: {
|
|
182
|
-
alignItems: 'center',
|
|
183
|
-
justifyContent: 'center',
|
|
184
|
-
flexShrink: 0,
|
|
185
|
-
marginRight: 8,
|
|
186
|
-
variants: {
|
|
187
|
-
size: createIconSizeVariants(theme),
|
|
188
|
-
} as const,
|
|
189
|
-
} as const,
|
|
190
|
-
label: {
|
|
191
|
-
flex: 1,
|
|
192
|
-
color: theme.colors.text.primary,
|
|
193
|
-
variants: {
|
|
194
|
-
size: createLabelSizeVariants(theme),
|
|
195
|
-
} as const,
|
|
196
|
-
} as const});
|
|
197
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { Theme, Intent } from '@idealyst/theme';
|
|
3
|
-
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
-
|
|
6
|
-
type MenuItemDynamicProps = {
|
|
7
|
-
intent?: Intent;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Get hover styles for menu item based on intent
|
|
12
|
-
*/
|
|
13
|
-
function getItemHoverStyles(theme: Theme, intent: Intent) {
|
|
14
|
-
if (intent === 'neutral') {
|
|
15
|
-
return {
|
|
16
|
-
_web: {
|
|
17
|
-
_hover: {
|
|
18
|
-
backgroundColor: theme.colors.surface.secondary,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
} as const;
|
|
22
|
-
}
|
|
23
|
-
const intentValue = theme.intents[intent];
|
|
24
|
-
return {
|
|
25
|
-
_web: {
|
|
26
|
-
_hover: {
|
|
27
|
-
backgroundColor: intentValue.light,
|
|
28
|
-
color: intentValue.primary,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
} as const;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Create dynamic item styles
|
|
36
|
-
*/
|
|
37
|
-
function createItemStyles(theme: Theme) {
|
|
38
|
-
return ({ intent = 'neutral' }: MenuItemDynamicProps) => {
|
|
39
|
-
const hoverStyles = getItemHoverStyles(theme, intent);
|
|
40
|
-
return {
|
|
41
|
-
flexDirection: 'row',
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
backgroundColor: 'transparent',
|
|
44
|
-
borderRadius: 4,
|
|
45
|
-
minHeight: 44,
|
|
46
|
-
variants: {
|
|
47
|
-
size: buildSizeVariants(theme, 'menu', (size) => ({
|
|
48
|
-
paddingVertical: size.paddingVertical,
|
|
49
|
-
paddingHorizontal: size.paddingHorizontal,
|
|
50
|
-
})),
|
|
51
|
-
disabled: {
|
|
52
|
-
true: {
|
|
53
|
-
opacity: 0.5,
|
|
54
|
-
_web: {
|
|
55
|
-
cursor: 'not-allowed',
|
|
56
|
-
_hover: {
|
|
57
|
-
backgroundColor: 'transparent',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
false: {},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
_web: {
|
|
65
|
-
display: 'flex',
|
|
66
|
-
width: '100%',
|
|
67
|
-
cursor: 'pointer',
|
|
68
|
-
border: 'none',
|
|
69
|
-
borderWidth: 0,
|
|
70
|
-
outline: 'none',
|
|
71
|
-
transition: 'background-color 0.2s ease',
|
|
72
|
-
textAlign: 'left',
|
|
73
|
-
_hover: {
|
|
74
|
-
backgroundColor: theme.colors.surface.secondary,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
...hoverStyles,
|
|
78
|
-
} as const;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
83
|
-
export const menuItemStyles = StyleSheet.create((theme: Theme) => {
|
|
84
|
-
// Apply extensions to main visual elements
|
|
85
|
-
|
|
86
|
-
return applyExtensions('MenuItem', theme, {item: createItemStyles(theme),
|
|
87
|
-
// Additional styles (merged from return)
|
|
88
|
-
// Minor utility styles (not extended)
|
|
89
|
-
icon: {
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
justifyContent: 'center',
|
|
92
|
-
flexShrink: 0,
|
|
93
|
-
marginRight: 12,
|
|
94
|
-
variants: {
|
|
95
|
-
size: buildSizeVariants(theme, 'menu', (size) => ({
|
|
96
|
-
width: size.iconSize,
|
|
97
|
-
height: size.iconSize,
|
|
98
|
-
fontSize: size.iconSize,
|
|
99
|
-
}))
|
|
100
|
-
},
|
|
101
|
-
_web: {
|
|
102
|
-
display: 'flex',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
label: {
|
|
106
|
-
flex: 1,
|
|
107
|
-
color: theme.colors.text.primary,
|
|
108
|
-
variants: {
|
|
109
|
-
size: buildSizeVariants(theme, 'menu', (size) => ({
|
|
110
|
-
fontSize: size.labelFontSize,
|
|
111
|
-
})),
|
|
112
|
-
},
|
|
113
|
-
}});
|
|
114
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { Theme, StylesheetStyles } from '@idealyst/theme';
|
|
3
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
4
|
-
|
|
5
|
-
type PopoverPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
6
|
-
|
|
7
|
-
type PopoverVariants = {
|
|
8
|
-
placement: PopoverPlacement;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type ExpandedPopoverStyles = StylesheetStyles<keyof PopoverVariants>;
|
|
12
|
-
|
|
13
|
-
export type PopoverStylesheet = {
|
|
14
|
-
container: ExpandedPopoverStyles;
|
|
15
|
-
content: ExpandedPopoverStyles;
|
|
16
|
-
arrow: ExpandedPopoverStyles;
|
|
17
|
-
backdrop: ExpandedPopoverStyles;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function createArrowPlacementVariants(theme: Theme) {
|
|
21
|
-
return {
|
|
22
|
-
top: {
|
|
23
|
-
bottom: -6,
|
|
24
|
-
_web: {
|
|
25
|
-
left: '50%',
|
|
26
|
-
marginLeft: -6,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
'top-start': {
|
|
30
|
-
bottom: -6,
|
|
31
|
-
left: 16,
|
|
32
|
-
},
|
|
33
|
-
'top-end': {
|
|
34
|
-
bottom: -6,
|
|
35
|
-
right: 16,
|
|
36
|
-
},
|
|
37
|
-
bottom: {
|
|
38
|
-
top: -6,
|
|
39
|
-
_web: {
|
|
40
|
-
left: '50%',
|
|
41
|
-
marginLeft: -6,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
'bottom-start': {
|
|
45
|
-
top: -6,
|
|
46
|
-
left: 16,
|
|
47
|
-
},
|
|
48
|
-
'bottom-end': {
|
|
49
|
-
top: -6,
|
|
50
|
-
right: 16,
|
|
51
|
-
},
|
|
52
|
-
left: {
|
|
53
|
-
right: -6,
|
|
54
|
-
_web: {
|
|
55
|
-
top: '50%',
|
|
56
|
-
marginTop: -6,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
'left-start': {
|
|
60
|
-
right: -6,
|
|
61
|
-
top: 16,
|
|
62
|
-
},
|
|
63
|
-
'left-end': {
|
|
64
|
-
right: -6,
|
|
65
|
-
bottom: 16,
|
|
66
|
-
},
|
|
67
|
-
right: {
|
|
68
|
-
left: -6,
|
|
69
|
-
_web: {
|
|
70
|
-
top: '50%',
|
|
71
|
-
marginTop: -6,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
'right-start': {
|
|
75
|
-
left: -6,
|
|
76
|
-
top: 16,
|
|
77
|
-
},
|
|
78
|
-
'right-end': {
|
|
79
|
-
left: -6,
|
|
80
|
-
bottom: 16,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Style creators for extension support
|
|
86
|
-
function createContainerStyles(theme: Theme) {
|
|
87
|
-
return () => ({
|
|
88
|
-
backgroundColor: theme.colors.surface.primary,
|
|
89
|
-
borderRadius: 8,
|
|
90
|
-
borderWidth: 1,
|
|
91
|
-
borderColor: theme.colors.border.primary,
|
|
92
|
-
borderStyle: 'solid' as const,
|
|
93
|
-
shadowColor: '#000',
|
|
94
|
-
shadowOffset: { width: 0, height: 4 },
|
|
95
|
-
shadowOpacity: 0.1,
|
|
96
|
-
shadowRadius: 12,
|
|
97
|
-
elevation: 8,
|
|
98
|
-
_web: {
|
|
99
|
-
border: `1px solid ${theme.colors.border.primary}`,
|
|
100
|
-
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
101
|
-
transition: 'opacity 150ms ease-out, transform 150ms ease-out',
|
|
102
|
-
transformOrigin: 'center center',
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
108
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
109
|
-
export const popoverStyles = StyleSheet.create((theme: Theme) => {
|
|
110
|
-
// Apply extensions to main visual elements
|
|
111
|
-
|
|
112
|
-
return applyExtensions('Popover', theme, {container: createContainerStyles(theme),
|
|
113
|
-
// Additional styles (merged from return)
|
|
114
|
-
// Minor utility styles (not extended)
|
|
115
|
-
content: {
|
|
116
|
-
padding: 16,
|
|
117
|
-
},
|
|
118
|
-
arrow: {
|
|
119
|
-
position: 'absolute',
|
|
120
|
-
width: 12,
|
|
121
|
-
height: 12,
|
|
122
|
-
backgroundColor: theme.colors.surface.primary,
|
|
123
|
-
variants: {
|
|
124
|
-
placement: createArrowPlacementVariants(theme),
|
|
125
|
-
},
|
|
126
|
-
_web: {
|
|
127
|
-
transform: 'rotate(45deg)',
|
|
128
|
-
boxShadow: '-2px 2px 4px rgba(0, 0, 0, 0.1)',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
backdrop: {
|
|
132
|
-
flex: 1,
|
|
133
|
-
backgroundColor: 'transparent',
|
|
134
|
-
}});
|
|
135
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { Theme } from '@idealyst/theme';
|
|
3
|
-
import {
|
|
4
|
-
buildPaddingVariants,
|
|
5
|
-
buildPaddingVerticalVariants,
|
|
6
|
-
buildPaddingHorizontalVariants,
|
|
7
|
-
} from '../utils/buildViewStyleVariants';
|
|
8
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
9
|
-
|
|
10
|
-
// Style creators for extension support
|
|
11
|
-
function createPressableStyles(theme: Theme) {
|
|
12
|
-
return () => ({
|
|
13
|
-
variants: {
|
|
14
|
-
// Spacing variants from PressableSpacingStyleProps
|
|
15
|
-
padding: buildPaddingVariants(theme),
|
|
16
|
-
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
17
|
-
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const pressableStyles = StyleSheet.create((theme: Theme) => {
|
|
23
|
-
// Apply extensions to main visual elements
|
|
24
|
-
return applyExtensions('Pressable', theme, {
|
|
25
|
-
pressable: createPressableStyles(theme),
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { Theme, Intent, Size } from '@idealyst/theme';
|
|
3
|
-
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
-
|
|
6
|
-
type ProgressSize = Size;
|
|
7
|
-
type ProgressIntent = Intent;
|
|
8
|
-
|
|
9
|
-
export type ProgressVariants = {
|
|
10
|
-
size: ProgressSize;
|
|
11
|
-
intent: ProgressIntent;
|
|
12
|
-
rounded: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type ProgressDynamicProps = {
|
|
16
|
-
intent?: ProgressIntent;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function createLinearTrackSizeVariants(theme: Theme) {
|
|
20
|
-
return buildSizeVariants(theme, 'progress', (size) => ({
|
|
21
|
-
height: size.linearHeight,
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function createCircularContainerSizeVariants(theme: Theme) {
|
|
26
|
-
return buildSizeVariants(theme, 'progress', (size) => ({
|
|
27
|
-
width: size.circularSize,
|
|
28
|
-
height: size.circularSize,
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function createLabelSizeVariants(theme: Theme) {
|
|
33
|
-
return buildSizeVariants(theme, 'progress', (size) => ({
|
|
34
|
-
fontSize: size.labelFontSize,
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function createCircularLabelSizeVariants(theme: Theme) {
|
|
39
|
-
return buildSizeVariants(theme, 'progress', (size) => ({
|
|
40
|
-
fontSize: size.circularLabelFontSize,
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Get bar background color based on intent
|
|
46
|
-
*/
|
|
47
|
-
function getBarBackgroundColor(theme: Theme, intent: ProgressIntent): string {
|
|
48
|
-
return theme.intents[intent].primary;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Create dynamic linear bar styles
|
|
53
|
-
*/
|
|
54
|
-
function createLinearBarStyles(theme: Theme) {
|
|
55
|
-
return ({ intent = 'primary' }: ProgressDynamicProps) => {
|
|
56
|
-
return {
|
|
57
|
-
height: '100%' as const,
|
|
58
|
-
backgroundColor: getBarBackgroundColor(theme, intent),
|
|
59
|
-
variants: {
|
|
60
|
-
rounded: {
|
|
61
|
-
true: { borderRadius: 9999 },
|
|
62
|
-
false: { borderRadius: 0 },
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
_web: {
|
|
66
|
-
transition: 'width 0.3s ease' as const,
|
|
67
|
-
},
|
|
68
|
-
} as const;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Create dynamic indeterminate bar styles
|
|
74
|
-
*/
|
|
75
|
-
function createIndeterminateBarStyles(theme: Theme) {
|
|
76
|
-
return ({ intent = 'primary' }: ProgressDynamicProps) => {
|
|
77
|
-
return {
|
|
78
|
-
position: 'absolute' as const,
|
|
79
|
-
height: '100%' as const,
|
|
80
|
-
width: '40%' as const,
|
|
81
|
-
backgroundColor: getBarBackgroundColor(theme, intent),
|
|
82
|
-
variants: {
|
|
83
|
-
rounded: {
|
|
84
|
-
true: { borderRadius: 9999 },
|
|
85
|
-
false: { borderRadius: 0 },
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
} as const;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Create dynamic circular bar styles
|
|
94
|
-
*/
|
|
95
|
-
function createCircularBarStyles(theme: Theme) {
|
|
96
|
-
return ({ intent = 'primary' }: ProgressDynamicProps) => {
|
|
97
|
-
return {
|
|
98
|
-
_web: {
|
|
99
|
-
stroke: getBarBackgroundColor(theme, intent),
|
|
100
|
-
},
|
|
101
|
-
} as const;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Create container styles
|
|
107
|
-
*/
|
|
108
|
-
function createContainerStyles() {
|
|
109
|
-
return () => ({
|
|
110
|
-
gap: 4 as const,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Create linear track styles
|
|
116
|
-
*/
|
|
117
|
-
function createLinearTrackStyles(theme: Theme) {
|
|
118
|
-
return () => ({
|
|
119
|
-
backgroundColor: theme.colors.border.secondary,
|
|
120
|
-
overflow: 'hidden' as const,
|
|
121
|
-
position: 'relative' as const,
|
|
122
|
-
variants: {
|
|
123
|
-
size: createLinearTrackSizeVariants(theme),
|
|
124
|
-
rounded: {
|
|
125
|
-
true: { borderRadius: 9999 },
|
|
126
|
-
false: { borderRadius: 0 },
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Create circular container styles
|
|
134
|
-
*/
|
|
135
|
-
function createCircularContainerStyles(theme: Theme) {
|
|
136
|
-
return () => ({
|
|
137
|
-
alignItems: 'center' as const,
|
|
138
|
-
justifyContent: 'center' as const,
|
|
139
|
-
position: 'relative' as const,
|
|
140
|
-
variants: {
|
|
141
|
-
size: createCircularContainerSizeVariants(theme),
|
|
142
|
-
} as const,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Create circular track styles
|
|
148
|
-
*/
|
|
149
|
-
function createCircularTrackStyles(theme: Theme) {
|
|
150
|
-
return () => ({
|
|
151
|
-
_web: {
|
|
152
|
-
stroke: theme.colors.border.secondary,
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Create label styles
|
|
159
|
-
*/
|
|
160
|
-
function createLabelStyles(theme: Theme) {
|
|
161
|
-
return () => ({
|
|
162
|
-
color: theme.colors.text.primary,
|
|
163
|
-
textAlign: 'center' as const,
|
|
164
|
-
variants: {
|
|
165
|
-
size: createLabelSizeVariants(theme),
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Create circular label styles
|
|
172
|
-
*/
|
|
173
|
-
function createCircularLabelStyles(theme: Theme) {
|
|
174
|
-
return () => ({
|
|
175
|
-
position: 'absolute' as const,
|
|
176
|
-
fontWeight: '600' as const,
|
|
177
|
-
color: theme.colors.text.primary,
|
|
178
|
-
variants: {
|
|
179
|
-
size: createCircularLabelSizeVariants(theme),
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
185
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
186
|
-
export const progressStyles = StyleSheet.create((theme: Theme) => {
|
|
187
|
-
// Apply extensions to main visual elements
|
|
188
|
-
|
|
189
|
-
return applyExtensions('Progress', theme, {container: createContainerStyles(),
|
|
190
|
-
linearTrack: createLinearTrackStyles(theme),
|
|
191
|
-
linearBar: createLinearBarStyles(theme),
|
|
192
|
-
// Additional styles (merged from return)
|
|
193
|
-
// Minor utility styles (not extended)
|
|
194
|
-
indeterminateBar: createIndeterminateBarStyles(theme),
|
|
195
|
-
circularContainer: createCircularContainerStyles(theme)(),
|
|
196
|
-
circularTrack: createCircularTrackStyles(theme)(),
|
|
197
|
-
circularBar: createCircularBarStyles(theme),
|
|
198
|
-
label: createLabelStyles(theme)(),
|
|
199
|
-
circularLabel: createCircularLabelStyles(theme)()});
|
|
200
|
-
});
|