@idealyst/components 1.1.7 → 1.1.9
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/plugin/web.js +280 -532
- 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/Accordion/Accordion.web.tsx +1 -3
- 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/Alert/Alert.web.tsx +3 -4
- 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/Badge/Badge.web.tsx +8 -15
- package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
- package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
- package/src/Breadcrumb/Breadcrumb.web.tsx +31 -30
- package/src/Button/Button.native.tsx +14 -21
- package/src/Button/Button.styles.tsx +103 -140
- package/src/Button/Button.web.tsx +9 -19
- 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 +7 -8
- package/src/Chip/Chip.styles.old.tsx +184 -0
- package/src/Chip/Chip.styles.tsx +34 -72
- package/src/Chip/Chip.web.tsx +3 -5
- 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/Dialog/Dialog.web.tsx +3 -3
- package/src/Dialog/types.ts +1 -1
- 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 +62 -21
- package/src/Icon/IconRegistry.native.ts +41 -0
- package/src/Icon/IconRegistry.ts +107 -0
- package/src/Icon/IconSvg/IconSvg.web.tsx +28 -5
- package/src/Icon/icon-resolver.ts +12 -43
- package/src/Icon/index.native.ts +2 -1
- package/src/Icon/index.ts +1 -0
- package/src/Icon/index.web.ts +1 -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 +134 -232
- package/src/Input/Input.web.tsx +5 -8
- 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 +16 -11
- package/src/List/ListItem.web.tsx +26 -16
- 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 +10 -7
- 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 +19 -26
- package/src/Screen/Screen.styles.old.tsx +87 -0
- package/src/Screen/Screen.styles.tsx +103 -68
- package/src/Screen/Screen.web.tsx +2 -2
- package/src/Select/Select.native.tsx +42 -33
- package/src/Select/Select.styles.old.tsx +353 -0
- package/src/Select/Select.styles.tsx +214 -300
- package/src/Select/Select.web.tsx +45 -33
- 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/Slider/Slider.web.tsx +2 -4
- package/src/Switch/Switch.native.tsx +9 -7
- package/src/Switch/Switch.styles.old.tsx +203 -0
- package/src/Switch/Switch.styles.tsx +101 -174
- package/src/Switch/Switch.web.tsx +7 -8
- 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 +180 -68
- package/src/Table/Table.styles.old.tsx +311 -0
- package/src/Table/Table.styles.tsx +140 -281
- package/src/Table/Table.web.tsx +169 -70
- 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 +3 -2
- package/src/Text/index.ts +1 -0
- package/src/TextArea/TextArea.native.tsx +21 -8
- package/src/TextArea/TextArea.styles.old.tsx +213 -0
- package/src/TextArea/TextArea.styles.tsx +87 -187
- package/src/TextArea/TextArea.web.tsx +17 -6
- 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 +41 -13
- package/src/View/View.styles.old.tsx +125 -0
- package/src/View/View.styles.tsx +76 -106
- package/src/View/View.web.tsx +5 -21
- package/src/View/types.ts +31 -3
- package/src/examples/ButtonExamples.tsx +20 -0
- package/src/examples/CardExamples.tsx +0 -6
- package/src/extensions/extendComponent.ts +61 -0
- package/src/index.ts +1 -1
|
@@ -1,347 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TabBar 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 { TabBarPillMode, TabBarSizeVariant, TabBarType, TabBarIconPosition, TabBarJustify } 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
|
-
|
|
17
|
-
|
|
18
|
-
pillMode?: TabBarPillMode;
|
|
19
|
-
};
|
|
9
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
10
|
+
void StyleSheet;
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
size?: TabBarSizeVariant;
|
|
24
|
-
active?: boolean;
|
|
25
|
-
pillMode?: TabBarPillMode;
|
|
26
|
-
};
|
|
12
|
+
// Wrap theme for $iterator support
|
|
13
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
27
14
|
|
|
28
|
-
type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
15
|
+
type TabBarType = 'standard' | 'underline' | 'pills';
|
|
16
|
+
type TabBarPillMode = 'light' | 'dark';
|
|
17
|
+
type TabBarIconPosition = 'left' | 'top';
|
|
18
|
+
type TabBarJustify = 'start' | 'center' | 'equal' | 'space-between';
|
|
33
19
|
|
|
34
|
-
type
|
|
20
|
+
export type TabBarDynamicProps = {
|
|
21
|
+
size?: Size;
|
|
35
22
|
type?: TabBarType;
|
|
36
23
|
pillMode?: TabBarPillMode;
|
|
24
|
+
active?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
iconPosition?: TabBarIconPosition;
|
|
27
|
+
justify?: TabBarJustify;
|
|
28
|
+
gap?: ViewStyleSize;
|
|
29
|
+
padding?: ViewStyleSize;
|
|
30
|
+
paddingVertical?: ViewStyleSize;
|
|
31
|
+
paddingHorizontal?: ViewStyleSize;
|
|
32
|
+
margin?: ViewStyleSize;
|
|
33
|
+
marginVertical?: ViewStyleSize;
|
|
34
|
+
marginHorizontal?: ViewStyleSize;
|
|
37
35
|
};
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
function getContainerBackgroundColor(theme: Theme, type: TabBarType, pillMode: TabBarPillMode): string | undefined {
|
|
43
|
-
if (type === 'pills') {
|
|
44
|
-
return pillMode === 'dark' ? theme.colors.surface.inverse : theme.colors.surface.secondary;
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Get tab padding based on type and size (pills have compact padding)
|
|
51
|
-
*/
|
|
52
|
-
function getTabPadding(type: TabBarType, size: TabBarSizeVariant): { paddingVertical?: number; paddingHorizontal?: number } {
|
|
53
|
-
if (type !== 'pills') return {};
|
|
54
|
-
|
|
55
|
-
const paddingMap: Record<TabBarSizeVariant, { paddingVertical: number; paddingHorizontal: number }> = {
|
|
56
|
-
xs: { paddingVertical: 2, paddingHorizontal: 10 },
|
|
57
|
-
sm: { paddingVertical: 4, paddingHorizontal: 12 },
|
|
58
|
-
md: { paddingVertical: 6, paddingHorizontal: 16 },
|
|
59
|
-
lg: { paddingVertical: 8, paddingHorizontal: 20 },
|
|
60
|
-
xl: { paddingVertical: 10, paddingHorizontal: 24 },
|
|
61
|
-
};
|
|
62
|
-
return paddingMap[size] || paddingMap.md;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Get tab text color based on type and active state
|
|
67
|
-
*/
|
|
68
|
-
function getTabColor(theme: Theme, type: TabBarType, active: boolean): string | undefined {
|
|
69
|
-
if (!active) return undefined;
|
|
70
|
-
if (type === 'pills') return theme.intents.primary.contrast;
|
|
71
|
-
if (type === 'underline') return theme.intents.primary.primary;
|
|
72
|
-
return theme.colors.text.primary;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Get label color based on type, pillMode, and active state
|
|
77
|
-
*/
|
|
78
|
-
function getLabelColor(theme: Theme, type: TabBarType, pillMode: TabBarPillMode, active: boolean): string | undefined {
|
|
79
|
-
if (!active) return undefined;
|
|
80
|
-
if (type === 'pills') return theme.colors.text.primary;
|
|
81
|
-
if (type === 'underline') return theme.intents.primary.primary;
|
|
82
|
-
return theme.colors.text.primary;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Get indicator background color based on type and pillMode
|
|
87
|
-
*/
|
|
88
|
-
function getIndicatorBackgroundColor(theme: Theme, type: TabBarType, pillMode: TabBarPillMode): string | undefined {
|
|
89
|
-
if (type === 'pills') {
|
|
90
|
-
return pillMode === 'dark' ? theme.colors.surface.secondary : theme.colors.surface.tertiary;
|
|
91
|
-
}
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Create size variants for tab
|
|
97
|
-
*/
|
|
98
|
-
function createTabSizeVariants(theme: Theme) {
|
|
99
|
-
return buildSizeVariants(theme, 'tabBar', (size) => ({
|
|
100
|
-
fontSize: size.fontSize,
|
|
101
|
-
padding: size.padding,
|
|
102
|
-
lineHeight: size.lineHeight,
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Create size variants for label
|
|
108
|
-
*/
|
|
109
|
-
function createLabelSizeVariants(theme: Theme) {
|
|
110
|
-
return buildSizeVariants(theme, 'tabBar', (size) => ({
|
|
111
|
-
fontSize: size.fontSize,
|
|
112
|
-
lineHeight: size.lineHeight,
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Create size variants for icon
|
|
38
|
+
* TabBar styles with type/pillMode/active handling.
|
|
118
39
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const bgColor = getContainerBackgroundColor(theme, type, pillMode);
|
|
40
|
+
export const tabBarStyles = defineStyle('TabBar', (theme: Theme) => ({
|
|
41
|
+
container: ({ type = 'standard', pillMode = 'light', justify = 'start' }: TabBarDynamicProps) => {
|
|
42
|
+
const backgroundColor = type === 'pills'
|
|
43
|
+
? (pillMode === 'dark' ? theme.colors.surface.inverse : theme.colors.surface.secondary)
|
|
44
|
+
: undefined;
|
|
45
|
+
|
|
46
|
+
const justifyContent = {
|
|
47
|
+
start: 'flex-start',
|
|
48
|
+
center: 'center',
|
|
49
|
+
equal: 'stretch',
|
|
50
|
+
'space-between': 'space-between',
|
|
51
|
+
}[justify];
|
|
132
52
|
|
|
133
53
|
return {
|
|
134
|
-
display: 'flex',
|
|
135
|
-
flexDirection: 'row',
|
|
54
|
+
display: 'flex' as const,
|
|
55
|
+
flexDirection: 'row' as const,
|
|
136
56
|
gap: type === 'pills' ? 4 : 0,
|
|
137
|
-
position: 'relative',
|
|
57
|
+
position: 'relative' as const,
|
|
138
58
|
borderBottomWidth: type === 'pills' ? 0 : 1,
|
|
139
59
|
borderBottomStyle: 'solid' as const,
|
|
140
60
|
borderBottomColor: theme.colors.border.primary,
|
|
141
61
|
padding: type === 'pills' ? 4 : undefined,
|
|
142
|
-
backgroundColor:
|
|
143
|
-
overflow: type === 'pills' ? 'hidden' as const : undefined,
|
|
144
|
-
alignSelf: type === 'pills' ? 'flex-start' as const : undefined,
|
|
62
|
+
backgroundColor: backgroundColor || (type === 'pills' ? theme.colors.surface.secondary : undefined),
|
|
63
|
+
overflow: type === 'pills' ? ('hidden' as const) : undefined,
|
|
64
|
+
alignSelf: type === 'pills' ? ('flex-start' as const) : undefined,
|
|
145
65
|
width: type === 'pills' ? undefined : '100%',
|
|
146
66
|
borderRadius: type === 'pills' ? 9999 : undefined,
|
|
67
|
+
justifyContent: justifyContent as any,
|
|
147
68
|
variants: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
69
|
+
gap: {
|
|
70
|
+
gap: theme.sizes.$view.padding,
|
|
71
|
+
},
|
|
72
|
+
padding: {
|
|
73
|
+
padding: theme.sizes.$view.padding,
|
|
74
|
+
},
|
|
75
|
+
paddingVertical: {
|
|
76
|
+
paddingVertical: theme.sizes.$view.padding,
|
|
77
|
+
},
|
|
78
|
+
paddingHorizontal: {
|
|
79
|
+
paddingHorizontal: theme.sizes.$view.padding,
|
|
80
|
+
},
|
|
81
|
+
margin: {
|
|
82
|
+
margin: theme.sizes.$view.padding,
|
|
83
|
+
},
|
|
84
|
+
marginVertical: {
|
|
85
|
+
marginVertical: theme.sizes.$view.padding,
|
|
86
|
+
},
|
|
87
|
+
marginHorizontal: {
|
|
88
|
+
marginHorizontal: theme.sizes.$view.padding,
|
|
153
89
|
},
|
|
154
|
-
|
|
155
|
-
gap: buildGapVariants(theme),
|
|
156
|
-
padding: buildPaddingVariants(theme),
|
|
157
|
-
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
158
|
-
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
159
|
-
margin: buildMarginVariants(theme),
|
|
160
|
-
marginVertical: buildMarginVerticalVariants(theme),
|
|
161
|
-
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
162
|
-
} as const,
|
|
90
|
+
},
|
|
163
91
|
} as const;
|
|
164
|
-
}
|
|
165
|
-
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
tab: ({ type = 'standard', size = 'md', active = false, pillMode = 'light', disabled = false, iconPosition = 'left', justify = 'start' }: TabBarDynamicProps) => {
|
|
95
|
+
// Tab padding for pills
|
|
96
|
+
const paddingMap: Record<Size, { paddingVertical: number; paddingHorizontal: number }> = {
|
|
97
|
+
xs: { paddingVertical: 2, paddingHorizontal: 10 },
|
|
98
|
+
sm: { paddingVertical: 4, paddingHorizontal: 12 },
|
|
99
|
+
md: { paddingVertical: 6, paddingHorizontal: 16 },
|
|
100
|
+
lg: { paddingVertical: 8, paddingHorizontal: 20 },
|
|
101
|
+
xl: { paddingVertical: 10, paddingHorizontal: 24 },
|
|
102
|
+
};
|
|
103
|
+
const tabPadding = type === 'pills' ? paddingMap[size] : {};
|
|
166
104
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const color = getTabColor(theme, type, active);
|
|
105
|
+
// Color based on type and active state
|
|
106
|
+
let color = active ? theme.colors.text.primary : theme.colors.text.secondary;
|
|
107
|
+
if (active) {
|
|
108
|
+
if (type === 'pills') color = theme.intents.primary.contrast;
|
|
109
|
+
else if (type === 'underline') color = theme.intents.primary.primary;
|
|
110
|
+
}
|
|
174
111
|
|
|
175
112
|
return {
|
|
176
|
-
display: 'flex',
|
|
177
|
-
flexDirection: 'row',
|
|
178
|
-
alignItems: 'center',
|
|
179
|
-
justifyContent: 'center',
|
|
180
|
-
fontWeight: '500',
|
|
113
|
+
display: 'flex' as const,
|
|
114
|
+
flexDirection: iconPosition === 'top' ? ('column' as const) : ('row' as const),
|
|
115
|
+
alignItems: 'center' as const,
|
|
116
|
+
justifyContent: 'center' as const,
|
|
117
|
+
fontWeight: '500' as const,
|
|
181
118
|
flex: justify === 'equal' ? 1 : undefined,
|
|
182
|
-
color
|
|
183
|
-
position: 'relative',
|
|
119
|
+
color,
|
|
120
|
+
position: 'relative' as const,
|
|
184
121
|
zIndex: 2,
|
|
185
|
-
backgroundColor: 'transparent',
|
|
122
|
+
backgroundColor: 'transparent' as const,
|
|
186
123
|
gap: 6,
|
|
187
124
|
borderRadius: type === 'pills' ? 9999 : undefined,
|
|
125
|
+
opacity: disabled ? 0.5 : 1,
|
|
188
126
|
...tabPadding,
|
|
189
127
|
variants: {
|
|
190
|
-
size:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
_web: { cursor: 'not-allowed' },
|
|
195
|
-
},
|
|
196
|
-
false: {
|
|
197
|
-
_web: { _hover: { color: theme.colors.text.primary } },
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
iconPosition: {
|
|
201
|
-
left: { flexDirection: 'row' },
|
|
202
|
-
top: { flexDirection: 'column' },
|
|
128
|
+
size: {
|
|
129
|
+
fontSize: theme.sizes.$tabBar.fontSize,
|
|
130
|
+
padding: theme.sizes.$tabBar.padding,
|
|
131
|
+
lineHeight: theme.sizes.$tabBar.lineHeight,
|
|
203
132
|
},
|
|
204
|
-
|
|
205
|
-
start: {},
|
|
206
|
-
center: {},
|
|
207
|
-
equal: { flex: 1 },
|
|
208
|
-
'space-between': {},
|
|
209
|
-
},
|
|
210
|
-
} as const,
|
|
133
|
+
},
|
|
211
134
|
_web: {
|
|
212
135
|
border: 'none',
|
|
213
|
-
cursor: 'pointer',
|
|
136
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
214
137
|
outline: 'none',
|
|
215
138
|
transition: 'color 0.2s ease',
|
|
139
|
+
_hover: disabled ? {} : { color: theme.colors.text.primary },
|
|
216
140
|
},
|
|
217
141
|
} as const;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
142
|
+
},
|
|
220
143
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
144
|
+
tabLabel: ({ type = 'standard', active = false, pillMode = 'light', disabled = false }: TabBarDynamicProps) => {
|
|
145
|
+
let color = active ? theme.colors.text.primary : theme.colors.text.secondary;
|
|
146
|
+
if (active) {
|
|
147
|
+
if (type === 'pills') color = theme.colors.text.primary;
|
|
148
|
+
else if (type === 'underline') color = theme.intents.primary.primary;
|
|
149
|
+
}
|
|
227
150
|
|
|
228
151
|
return {
|
|
229
|
-
position: 'relative',
|
|
152
|
+
position: 'relative' as const,
|
|
230
153
|
zIndex: 3,
|
|
231
|
-
fontWeight: '500',
|
|
232
|
-
color
|
|
154
|
+
fontWeight: '500' as const,
|
|
155
|
+
color,
|
|
156
|
+
opacity: disabled ? 0.5 : 1,
|
|
233
157
|
variants: {
|
|
234
|
-
size:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
false: {},
|
|
158
|
+
size: {
|
|
159
|
+
fontSize: theme.sizes.$tabBar.fontSize,
|
|
160
|
+
lineHeight: theme.sizes.$tabBar.lineHeight,
|
|
238
161
|
},
|
|
239
162
|
},
|
|
240
163
|
} as const;
|
|
241
|
-
}
|
|
242
|
-
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
tabIcon: ({ active = false, disabled = false, iconPosition = 'left' }: TabBarDynamicProps) => ({
|
|
167
|
+
display: 'flex' as const,
|
|
168
|
+
alignItems: 'center' as const,
|
|
169
|
+
justifyContent: 'center' as const,
|
|
170
|
+
opacity: disabled ? 0.5 : 1,
|
|
171
|
+
marginBottom: iconPosition === 'top' ? 2 : 0,
|
|
172
|
+
variants: {
|
|
173
|
+
size: {
|
|
174
|
+
width: theme.sizes.$tabBar.fontSize,
|
|
175
|
+
height: theme.sizes.$tabBar.fontSize,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
}),
|
|
243
179
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return ({ type = 'standard', pillMode = 'light' }: IndicatorDynamicProps) => {
|
|
249
|
-
const bgColor = getIndicatorBackgroundColor(theme, type, pillMode);
|
|
180
|
+
indicator: ({ type = 'standard', pillMode = 'light' }: TabBarDynamicProps) => {
|
|
181
|
+
const backgroundColor = type === 'pills'
|
|
182
|
+
? (pillMode === 'dark' ? theme.colors.surface.secondary : theme.colors.surface.tertiary)
|
|
183
|
+
: theme.intents.primary.primary;
|
|
250
184
|
|
|
251
185
|
const typeStyles = type === 'pills' ? {
|
|
252
186
|
borderRadius: 9999,
|
|
253
187
|
bottom: 4,
|
|
254
188
|
top: 4,
|
|
255
189
|
left: 0,
|
|
256
|
-
backgroundColor: bgColor,
|
|
257
190
|
} : {
|
|
258
191
|
bottom: -1,
|
|
259
192
|
height: 2,
|
|
260
|
-
backgroundColor: theme.intents.primary.primary,
|
|
261
193
|
};
|
|
262
194
|
|
|
263
195
|
return {
|
|
264
|
-
position: 'absolute',
|
|
265
|
-
pointerEvents: 'none',
|
|
196
|
+
position: 'absolute' as const,
|
|
197
|
+
pointerEvents: 'none' as const,
|
|
266
198
|
zIndex: 1,
|
|
199
|
+
backgroundColor,
|
|
267
200
|
...typeStyles,
|
|
268
201
|
_web: {
|
|
269
202
|
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
270
203
|
},
|
|
271
204
|
} as const;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Create icon styles (static, no compound variants)
|
|
277
|
-
*/
|
|
278
|
-
function createIconStyles(theme: Theme) {
|
|
279
|
-
return {
|
|
280
|
-
display: 'flex',
|
|
281
|
-
alignItems: 'center',
|
|
282
|
-
justifyContent: 'center',
|
|
283
|
-
variants: {
|
|
284
|
-
size: createIconSizeVariants(theme),
|
|
285
|
-
active: {
|
|
286
|
-
true: {},
|
|
287
|
-
false: {},
|
|
288
|
-
},
|
|
289
|
-
disabled: {
|
|
290
|
-
true: { opacity: 0.5 },
|
|
291
|
-
false: {},
|
|
292
|
-
},
|
|
293
|
-
iconPosition: {
|
|
294
|
-
left: {},
|
|
295
|
-
top: { marginBottom: 2 },
|
|
296
|
-
},
|
|
297
|
-
} as const,
|
|
298
|
-
} as const;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
302
|
-
export const tabBarStyles = StyleSheet.create((theme: Theme) => {
|
|
303
|
-
// Apply extensions to main visual elements
|
|
304
|
-
const extended = applyExtensions('TabBar', theme, {
|
|
305
|
-
container: createContainerStyles(theme),
|
|
306
|
-
tab: createTabStyles(theme),
|
|
307
|
-
indicator: createIndicatorStyles(theme),
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
return {
|
|
311
|
-
...extended,
|
|
312
|
-
// Minor utility styles (not extended)
|
|
313
|
-
tabLabel: createTabLabelStyles(theme),
|
|
314
|
-
tabIcon: createIconStyles(theme),
|
|
315
|
-
};
|
|
316
|
-
});
|
|
205
|
+
},
|
|
206
|
+
}));
|
|
317
207
|
|
|
318
208
|
// Export individual style sheets for backwards compatibility
|
|
319
|
-
export const tabBarContainerStyles =
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
export const tabBarTabStyles = StyleSheet.create((theme: Theme) => {
|
|
326
|
-
return {
|
|
327
|
-
tab: createTabStyles(theme),
|
|
328
|
-
} as const;
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
export const tabBarLabelStyles = StyleSheet.create((theme: Theme) => {
|
|
332
|
-
return {
|
|
333
|
-
tabLabel: createTabLabelStyles(theme),
|
|
334
|
-
} as const;
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
export const tabBarIndicatorStyles = StyleSheet.create((theme: Theme) => {
|
|
338
|
-
return {
|
|
339
|
-
indicator: createIndicatorStyles(theme),
|
|
340
|
-
} as const;
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
export const tabBarIconStyles = StyleSheet.create((theme: Theme) => {
|
|
344
|
-
return {
|
|
345
|
-
tabIcon: createIconStyles(theme),
|
|
346
|
-
} as const;
|
|
347
|
-
});
|
|
209
|
+
export const tabBarContainerStyles = tabBarStyles;
|
|
210
|
+
export const tabBarTabStyles = tabBarStyles;
|
|
211
|
+
export const tabBarLabelStyles = tabBarStyles;
|
|
212
|
+
export const tabBarIndicatorStyles = tabBarStyles;
|
|
213
|
+
export const tabBarIconStyles = tabBarStyles;
|