@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.
Files changed (144) hide show
  1. package/package.json +8 -3
  2. package/src/Accordion/Accordion.native.tsx +22 -14
  3. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  4. package/src/Accordion/Accordion.styles.tsx +139 -248
  5. package/src/Accordion/Accordion.web.tsx +12 -7
  6. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -2
  7. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  8. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +43 -62
  9. package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -2
  10. package/src/Alert/Alert.native.tsx +26 -15
  11. package/src/Alert/Alert.styles.old.tsx +209 -0
  12. package/src/Alert/Alert.styles.tsx +108 -281
  13. package/src/Alert/Alert.web.tsx +6 -10
  14. package/src/Avatar/Avatar.native.tsx +5 -2
  15. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  16. package/src/Avatar/Avatar.styles.tsx +47 -62
  17. package/src/Avatar/Avatar.web.tsx +2 -2
  18. package/src/Badge/Badge.native.tsx +2 -2
  19. package/src/Badge/Badge.styles.old.tsx +157 -0
  20. package/src/Badge/Badge.styles.tsx +69 -108
  21. package/src/Badge/Badge.web.tsx +6 -6
  22. package/src/Breadcrumb/Breadcrumb.native.tsx +12 -5
  23. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  24. package/src/Breadcrumb/Breadcrumb.styles.tsx +93 -209
  25. package/src/Breadcrumb/Breadcrumb.web.tsx +39 -27
  26. package/src/Button/Button.native.tsx +39 -14
  27. package/src/Button/Button.styles.tsx +99 -253
  28. package/src/Button/Button.web.tsx +10 -8
  29. package/src/Card/Card.native.tsx +8 -4
  30. package/src/Card/Card.styles.old.tsx +160 -0
  31. package/src/Card/Card.styles.tsx +107 -142
  32. package/src/Card/Card.web.tsx +6 -4
  33. package/src/Checkbox/Checkbox.native.tsx +14 -6
  34. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  35. package/src/Checkbox/Checkbox.styles.tsx +109 -197
  36. package/src/Checkbox/Checkbox.web.tsx +7 -7
  37. package/src/Chip/Chip.native.tsx +5 -5
  38. package/src/Chip/Chip.styles.old.tsx +184 -0
  39. package/src/Chip/Chip.styles.tsx +34 -22
  40. package/src/Chip/Chip.web.tsx +5 -5
  41. package/src/Dialog/Dialog.native.tsx +16 -7
  42. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  43. package/src/Dialog/Dialog.styles.tsx +108 -132
  44. package/src/Dialog/Dialog.web.tsx +4 -4
  45. package/src/Divider/Divider.native.tsx +29 -42
  46. package/src/Divider/Divider.styles.old.tsx +172 -0
  47. package/src/Divider/Divider.styles.tsx +116 -242
  48. package/src/Divider/Divider.web.tsx +17 -14
  49. package/src/Icon/Icon.native.tsx +12 -4
  50. package/src/Icon/Icon.styles.old.tsx +81 -0
  51. package/src/Icon/Icon.styles.tsx +52 -60
  52. package/src/Icon/Icon.web.tsx +43 -7
  53. package/src/Icon/IconSvg/IconSvg.web.tsx +2 -0
  54. package/src/Image/Image.styles.old.tsx +69 -0
  55. package/src/Image/Image.styles.tsx +45 -43
  56. package/src/Input/Input.native.tsx +140 -56
  57. package/src/Input/Input.styles.old.tsx +289 -0
  58. package/src/Input/Input.styles.tsx +177 -228
  59. package/src/Input/Input.web.tsx +5 -8
  60. package/src/Link/Link.native.tsx +4 -1
  61. package/src/List/List.native.tsx +5 -2
  62. package/src/List/List.styles.old.tsx +242 -0
  63. package/src/List/List.styles.tsx +178 -240
  64. package/src/List/ListItem.native.tsx +16 -8
  65. package/src/List/ListItem.web.tsx +26 -15
  66. package/src/Menu/Menu.native.tsx +1 -1
  67. package/src/Menu/Menu.styles.old.tsx +197 -0
  68. package/src/Menu/Menu.styles.tsx +90 -156
  69. package/src/Menu/Menu.web.tsx +2 -2
  70. package/src/Menu/MenuItem.native.tsx +9 -5
  71. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  72. package/src/Menu/MenuItem.styles.tsx +71 -104
  73. package/src/Menu/MenuItem.web.tsx +23 -5
  74. package/src/Popover/Popover.native.tsx +10 -4
  75. package/src/Popover/Popover.styles.old.tsx +135 -0
  76. package/src/Popover/Popover.styles.tsx +46 -96
  77. package/src/Popover/Popover.web.tsx +1 -1
  78. package/src/Pressable/Pressable.native.tsx +3 -1
  79. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  80. package/src/Pressable/Pressable.styles.tsx +35 -20
  81. package/src/Pressable/Pressable.web.tsx +1 -1
  82. package/src/Progress/Progress.native.tsx +15 -6
  83. package/src/Progress/Progress.styles.old.tsx +200 -0
  84. package/src/Progress/Progress.styles.tsx +69 -118
  85. package/src/Progress/Progress.web.tsx +10 -9
  86. package/src/RadioButton/RadioButton.native.tsx +10 -4
  87. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  88. package/src/RadioButton/RadioButton.styles.tsx +81 -145
  89. package/src/RadioButton/RadioButton.web.tsx +4 -4
  90. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  91. package/src/SVGImage/SVGImage.styles.tsx +35 -66
  92. package/src/Screen/Screen.native.tsx +30 -27
  93. package/src/Screen/Screen.styles.old.tsx +87 -0
  94. package/src/Screen/Screen.styles.tsx +120 -71
  95. package/src/Screen/Screen.web.tsx +2 -2
  96. package/src/Select/Select.native.tsx +44 -29
  97. package/src/Select/Select.styles.old.tsx +353 -0
  98. package/src/Select/Select.styles.tsx +244 -293
  99. package/src/Select/Select.web.tsx +5 -5
  100. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  101. package/src/Skeleton/Skeleton.styles.tsx +31 -43
  102. package/src/Slider/Slider.native.tsx +9 -5
  103. package/src/Slider/Slider.styles.old.tsx +259 -0
  104. package/src/Slider/Slider.styles.tsx +157 -227
  105. package/src/Slider/Slider.web.tsx +5 -5
  106. package/src/Switch/Switch.native.tsx +11 -5
  107. package/src/Switch/Switch.styles.old.tsx +203 -0
  108. package/src/Switch/Switch.styles.tsx +103 -149
  109. package/src/Switch/Switch.web.tsx +8 -8
  110. package/src/TabBar/TabBar.native.tsx +24 -31
  111. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  112. package/src/TabBar/TabBar.styles.tsx +204 -494
  113. package/src/TabBar/TabBar.web.tsx +21 -33
  114. package/src/Table/Table.native.tsx +18 -9
  115. package/src/Table/Table.styles.old.tsx +311 -0
  116. package/src/Table/Table.styles.tsx +151 -278
  117. package/src/Table/Table.web.tsx +1 -1
  118. package/src/Text/Text.native.tsx +1 -4
  119. package/src/Text/Text.style.demo.tsx +16 -0
  120. package/src/Text/Text.styles.old.tsx +219 -0
  121. package/src/Text/Text.styles.tsx +94 -78
  122. package/src/Text/Text.web.tsx +2 -2
  123. package/src/Text/index.ts +1 -0
  124. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  125. package/src/TextArea/TextArea.styles.tsx +101 -157
  126. package/src/Tooltip/Tooltip.native.tsx +2 -2
  127. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  128. package/src/Tooltip/Tooltip.styles.tsx +38 -53
  129. package/src/Tooltip/Tooltip.web.tsx +2 -2
  130. package/src/Video/Video.styles.old.tsx +51 -0
  131. package/src/Video/Video.styles.tsx +32 -28
  132. package/src/View/View.native.tsx +12 -12
  133. package/src/View/View.styles.old.tsx +125 -0
  134. package/src/View/View.styles.tsx +84 -103
  135. package/src/View/View.web.tsx +14 -2
  136. package/src/examples/CardExamples.tsx +0 -6
  137. package/src/extensions/applyExtension.ts +210 -0
  138. package/src/extensions/extendComponent.ts +438 -0
  139. package/src/extensions/index.ts +102 -0
  140. package/src/extensions/types.ts +497 -0
  141. package/src/globals.ts +16 -0
  142. package/src/index.native.ts +4 -0
  143. package/src/index.ts +28 -0
  144. package/src/utils/deepMerge.ts +54 -2
@@ -1,503 +1,213 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, CompoundVariants, 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 { TabBarPillMode, TabBarSizeVariant, TabBarType, TabBarIconPosition, TabBarJustify } from './types';
14
-
15
- type TabBarContainerVariants = {
16
- type: TabBarType;
17
- size: TabBarSizeVariant;
18
- pillMode: TabBarPillMode;
19
- justify: TabBarJustify;
20
- }
21
-
22
- type TabBarTabVariants = {
23
- size: TabBarSizeVariant;
24
- type: TabBarType;
25
- active: boolean;
26
- disabled: boolean;
27
- pillMode: TabBarPillMode;
28
- iconPosition: TabBarIconPosition;
29
- justify: TabBarJustify;
30
- }
31
-
32
- type TabBarIconVariants = {
33
- size: TabBarSizeVariant;
34
- active: boolean;
35
- disabled: boolean;
36
- iconPosition: TabBarIconPosition;
37
- }
38
-
39
- type TabBarLabelVariants = {
40
- size: TabBarSizeVariant;
41
- type: TabBarType;
42
- active: boolean;
43
- disabled: boolean;
44
- pillMode: TabBarPillMode;
45
- }
46
-
47
- type TabBarIndicatorVariants = {
48
- type: TabBarType;
49
- pillMode: TabBarPillMode;
50
- }
51
-
52
- /**
53
- * Create compound variants for container
54
- */
55
- function createContainerCompoundVariants(theme: Theme): CompoundVariants<keyof TabBarContainerVariants> {
56
- return [
57
- {
58
- type: 'pills',
59
- pillMode: 'light',
60
- styles: {
61
- backgroundColor: theme.colors.surface.secondary,
62
- },
63
- },
64
- {
65
- type: 'pills',
66
- pillMode: 'dark',
67
- styles: {
68
- backgroundColor: theme.colors.surface.inverse,
69
- },
70
- },
71
- ];
72
- }
73
-
74
- /**
75
- * Create size variants for tab
76
- */
77
- function createTabSizeVariants(theme: Theme) {
78
- return buildSizeVariants(theme, 'tabBar', (size) => ({
79
- fontSize: size.fontSize,
80
- padding: size.padding,
81
- lineHeight: size.lineHeight,
82
- }));
83
- }
84
-
85
- /**
86
- * Create compound variants for tab
87
- */
88
- function createTabCompoundVariants(theme: Theme): CompoundVariants<keyof TabBarTabVariants> {
89
- return [
90
- // Pills variant - compact padding for all sizes
91
- {
92
- type: 'pills',
93
- size: 'xs',
94
- styles: {
95
- paddingVertical: 2,
96
- paddingHorizontal: 10,
97
- },
98
- },
99
- {
100
- type: 'pills',
101
- size: 'sm',
102
- styles: {
103
- paddingVertical: 4,
104
- paddingHorizontal: 12,
105
- },
106
- },
107
- {
108
- type: 'pills',
109
- size: 'md',
110
- styles: {
111
- paddingVertical: 6,
112
- paddingHorizontal: 16,
113
- },
114
- },
115
- {
116
- type: 'pills',
117
- size: 'lg',
118
- styles: {
119
- paddingVertical: 8,
120
- paddingHorizontal: 20,
121
- },
122
- },
123
- {
124
- type: 'pills',
125
- size: 'xl',
126
- styles: {
127
- paddingVertical: 10,
128
- paddingHorizontal: 24,
129
- },
130
- },
131
- // Pills variant - active text color
132
- {
133
- type: 'pills',
134
- active: true,
135
- styles: {
136
- color: theme.intents.primary.contrast,
137
- },
138
- },
139
- // Underline variant - active text color
140
- {
141
- type: 'underline',
142
- active: true,
143
- styles: {
144
- color: theme.intents.primary.primary,
145
- },
146
- },
147
- ] as const;
148
- }
149
-
150
1
  /**
151
- * Create size variants for label
2
+ * TabBar styles using defineStyle with dynamic props.
152
3
  */
153
- function createLabelSizeVariants(theme: Theme) {
154
- return buildSizeVariants(theme, 'tabBar', (size) => ({
155
- fontSize: size.fontSize,
156
- lineHeight: size.lineHeight,
157
- }));
158
- }
159
-
160
- /**
161
- * Create compound variants for label
162
- */
163
- function createLabelCompoundVariants(theme: Theme): CompoundVariants<keyof TabBarLabelVariants> {
164
- return [
165
- // Pills light mode - light text on active (dark pill)
166
- {
167
- type: 'pills',
168
- pillMode: 'light',
169
- active: true,
170
- styles: {
171
- color: theme.colors.text.primary,
172
- },
173
- },
174
- // Pills dark mode - dark text on active (light pill)
175
- {
176
- type: 'pills',
177
- pillMode: 'dark',
178
- active: true,
179
- styles: {
180
- color: theme.colors.text.primary,
181
- },
182
- },
183
- // Underline variant - active text color
184
- {
185
- type: 'underline',
186
- active: true,
187
- styles: {
188
- color: theme.intents.primary.primary,
189
- },
190
- },
191
- ] as const;
192
- }
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Size } from '@idealyst/theme';
7
+ import { ViewStyleSize } from '../utils/viewStyleProps';
8
+
9
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
10
+ void StyleSheet;
11
+
12
+ // Wrap theme for $iterator support
13
+ type Theme = ThemeStyleWrapper<BaseTheme>;
14
+
15
+ type TabBarType = 'standard' | 'underline' | 'pills';
16
+ type TabBarPillMode = 'light' | 'dark';
17
+ type TabBarIconPosition = 'left' | 'top';
18
+ type TabBarJustify = 'start' | 'center' | 'equal' | 'space-between';
19
+
20
+ export type TabBarDynamicProps = {
21
+ size?: Size;
22
+ type?: TabBarType;
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;
35
+ };
193
36
 
194
37
  /**
195
- * Create compound variants for indicator
38
+ * TabBar styles with type/pillMode/active handling.
196
39
  */
197
- function createIndicatorCompoundVariants(theme: Theme): CompoundVariants<keyof TabBarIndicatorVariants> {
198
- return [
199
- // Pills light mode - darker pill
200
- {
201
- type: 'pills',
202
- pillMode: 'light',
203
- styles: {
204
- backgroundColor: theme.colors.surface.tertiary,
205
- },
206
- },
207
- // Pills dark mode - lighter pill
208
- {
209
- type: 'pills',
210
- pillMode: 'dark',
211
- styles: {
212
- backgroundColor: theme.colors.surface.secondary,
213
- },
214
- },
215
- ] as const;
216
- }
217
-
218
- const createContainerStyles = (theme: Theme) => {
219
- return {
220
- display: 'flex',
221
- flexDirection: 'row',
222
- gap: 0,
223
- position: 'relative',
224
- borderBottomWidth: 1,
225
- borderBottomStyle: 'solid',
226
- borderBottomColor: theme.colors.border.primary,
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];
52
+
53
+ return {
54
+ display: 'flex' as const,
55
+ flexDirection: 'row' as const,
56
+ gap: type === 'pills' ? 4 : 0,
57
+ position: 'relative' as const,
58
+ borderBottomWidth: type === 'pills' ? 0 : 1,
59
+ borderBottomStyle: 'solid' as const,
60
+ borderBottomColor: theme.colors.border.primary,
61
+ padding: type === 'pills' ? 4 : 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,
65
+ width: type === 'pills' ? undefined : '100%',
66
+ borderRadius: type === 'pills' ? 9999 : undefined,
67
+ justifyContent: justifyContent as any,
68
+ variants: {
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,
89
+ },
90
+ },
91
+ } as const;
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] : {};
104
+
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
+ }
111
+
112
+ return {
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,
118
+ flex: justify === 'equal' ? 1 : undefined,
119
+ color,
120
+ position: 'relative' as const,
121
+ zIndex: 2,
122
+ backgroundColor: 'transparent' as const,
123
+ gap: 6,
124
+ borderRadius: type === 'pills' ? 9999 : undefined,
125
+ opacity: disabled ? 0.5 : 1,
126
+ ...tabPadding,
127
+ variants: {
128
+ size: {
129
+ fontSize: theme.sizes.$tabBar.fontSize,
130
+ padding: theme.sizes.$tabBar.padding,
131
+ lineHeight: theme.sizes.$tabBar.lineHeight,
132
+ },
133
+ },
134
+ _web: {
135
+ border: 'none',
136
+ cursor: disabled ? 'not-allowed' : 'pointer',
137
+ outline: 'none',
138
+ transition: 'color 0.2s ease',
139
+ _hover: disabled ? {} : { color: theme.colors.text.primary },
140
+ },
141
+ } as const;
142
+ },
143
+
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
+ }
150
+
151
+ return {
152
+ position: 'relative' as const,
153
+ zIndex: 3,
154
+ fontWeight: '500' as const,
155
+ color,
156
+ opacity: disabled ? 0.5 : 1,
157
+ variants: {
158
+ size: {
159
+ fontSize: theme.sizes.$tabBar.fontSize,
160
+ lineHeight: theme.sizes.$tabBar.lineHeight,
161
+ },
162
+ },
163
+ } as const;
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,
227
172
  variants: {
228
- type: {
229
- standard: {},
230
- pills: {
231
- borderBottomWidth: 0,
232
- padding: 4,
233
- gap: 4,
234
- backgroundColor: theme.colors.surface.secondary,
235
- overflow: 'hidden',
236
- alignSelf: 'flex-start',
237
- },
238
- underline: {},
239
- },
240
173
  size: {
241
- xs: {},
242
- sm: {},
243
- md: {},
244
- lg: {},
245
- xl: {},
246
- },
247
- pillMode: {
248
- light: {},
249
- dark: {},
250
- },
251
- justify: {
252
- start: {
253
- justifyContent: 'flex-start',
254
- },
255
- center: {
256
- justifyContent: 'center',
257
- },
258
- equal: {
259
- justifyContent: 'stretch',
260
- width: '100%',
261
- },
262
- 'space-between': {
263
- justifyContent: 'space-between',
264
- width: '100%',
265
- },
266
- },
267
- // Spacing variants from ContainerStyleProps
268
- gap: buildGapVariants(theme),
269
- padding: buildPaddingVariants(theme),
270
- paddingVertical: buildPaddingVerticalVariants(theme),
271
- paddingHorizontal: buildPaddingHorizontalVariants(theme),
272
- margin: buildMarginVariants(theme),
273
- marginVertical: buildMarginVerticalVariants(theme),
274
- marginHorizontal: buildMarginHorizontalVariants(theme),
275
- } as const,
276
- compoundVariants: createContainerCompoundVariants(theme),
277
- } as const;
278
- }
279
-
280
- const createTabStyles = (theme: Theme) => {
281
- return {
282
- display: 'flex',
283
- flexDirection: 'row',
284
- alignItems: 'center',
285
- justifyContent: 'center',
286
- fontWeight: '500',
287
- color: theme.colors.text.secondary,
288
- position: 'relative',
289
- zIndex: 2,
290
- backgroundColor: 'transparent',
291
- gap: 6,
292
- variants: {
293
- size: createTabSizeVariants(theme),
294
- type: {
295
- standard: {},
296
- pills: {
297
- borderRadius: 9999,
298
- marginRight: 0,
299
- backgroundColor: 'transparent',
300
- },
301
- underline: {},
302
- },
303
- active: {
304
- true: {
305
- color: theme.colors.text.primary,
306
- },
307
- false: {},
308
- },
309
- disabled: {
310
- true: {
311
- opacity: 0.5,
312
- _web: {
313
- cursor: 'not-allowed',
314
- },
315
- },
316
- false: {
317
- _web: {
318
- _hover: {
319
- color: theme.colors.text.primary,
320
- },
321
- },
322
- },
323
- },
324
- pillMode: {
325
- light: {},
326
- dark: {},
327
- },
328
- iconPosition: {
329
- left: {
330
- flexDirection: 'row',
331
- },
332
- top: {
333
- flexDirection: 'column',
334
- },
335
- },
336
- justify: {
337
- start: {},
338
- center: {},
339
- equal: {
340
- flex: 1,
341
- },
342
- 'space-between': {},
343
- },
344
- } as const,
345
- compoundVariants: createTabCompoundVariants(theme),
346
- _web: {
347
- border: 'none',
348
- cursor: 'pointer',
349
- outline: 'none',
350
- transition: 'color 0.2s ease',
351
- },
352
- } as const;
353
- }
354
-
355
- const createTabLabelStyles = (theme: Theme) => {
356
- return {
357
- position: 'relative',
358
- zIndex: 3,
359
- fontWeight: '500',
360
- color: theme.colors.text.secondary,
361
- variants: {
362
- size: createLabelSizeVariants(theme),
363
- type: {
364
- standard: {},
365
- pills: {},
366
- underline: {},
367
- },
368
- active: {
369
- true: {
370
- color: theme.colors.text.primary,
371
- },
372
- false: {},
373
- },
374
- disabled: {
375
- true: {
376
- opacity: 0.5,
377
- },
378
- false: {},
379
- },
380
- pillMode: {
381
- light: {},
382
- dark: {},
383
- },
384
- },
385
- compoundVariants: createLabelCompoundVariants(theme),
386
- } as const;
387
- }
388
-
389
- const createIndicatorStyles = (theme: Theme) => {
390
- return {
391
- position: 'absolute',
392
- pointerEvents: 'none',
393
- zIndex: 1,
394
- variants: {
395
- type: {
396
- standard: {
397
- bottom: -1,
398
- height: 2,
399
- backgroundColor: theme.intents.primary.primary,
400
- },
401
- pills: {
402
- borderRadius: 9999,
403
- bottom: 4,
404
- top: 4,
405
- left: 0,
406
- },
407
- underline: {
408
- bottom: -1,
409
- height: 2,
410
- backgroundColor: theme.intents.primary.primary,
411
- },
412
- },
413
- pillMode: {
414
- light: {},
415
- dark: {},
416
- },
417
- },
418
- compoundVariants: createIndicatorCompoundVariants(theme),
419
- _web: {
420
- transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
421
- },
422
- } as const;
423
- }
424
-
425
- /**
426
- * Create size variants for icon
427
- */
428
- function createIconSizeVariants(theme: Theme) {
429
- return buildSizeVariants(theme, 'tabBar', (size) => ({
430
- width: size.iconSize || size.fontSize,
431
- height: size.iconSize || size.fontSize,
432
- }));
433
- }
434
-
435
- const createIconStyles = (theme: Theme) => {
436
- return {
437
- display: 'flex',
438
- alignItems: 'center',
439
- justifyContent: 'center',
440
- variants: {
441
- size: createIconSizeVariants(theme),
442
- active: {
443
- true: {},
444
- false: {},
445
- },
446
- disabled: {
447
- true: {
448
- opacity: 0.5,
449
- },
450
- false: {},
451
- },
452
- iconPosition: {
453
- left: {},
454
- top: {
455
- marginBottom: 2,
456
- },
457
- },
458
- } as const,
459
- } as const;
460
- }
461
-
462
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
463
- // @ts-ignore - TS language server needs restart to pick up theme structure changes
464
- export const tabBarStyles = StyleSheet.create((theme: Theme) => {
465
- return {
466
- container: createContainerStyles(theme),
467
- tab: createTabStyles(theme),
468
- tabLabel: createTabLabelStyles(theme),
469
- tabIcon: createIconStyles(theme),
470
- indicator: createIndicatorStyles(theme),
471
- };
472
- });
174
+ width: theme.sizes.$tabBar.fontSize,
175
+ height: theme.sizes.$tabBar.fontSize,
176
+ },
177
+ },
178
+ }),
179
+
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;
184
+
185
+ const typeStyles = type === 'pills' ? {
186
+ borderRadius: 9999,
187
+ bottom: 4,
188
+ top: 4,
189
+ left: 0,
190
+ } : {
191
+ bottom: -1,
192
+ height: 2,
193
+ };
194
+
195
+ return {
196
+ position: 'absolute' as const,
197
+ pointerEvents: 'none' as const,
198
+ zIndex: 1,
199
+ backgroundColor,
200
+ ...typeStyles,
201
+ _web: {
202
+ transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
203
+ },
204
+ } as const;
205
+ },
206
+ }));
473
207
 
474
208
  // Export individual style sheets for backwards compatibility
475
- export const tabBarContainerStyles = StyleSheet.create((theme: Theme) => {
476
- return {
477
- container: createContainerStyles(theme),
478
- } as const;
479
- });
480
-
481
- export const tabBarTabStyles = StyleSheet.create((theme: Theme) => {
482
- return {
483
- tab: createTabStyles(theme),
484
- } as const;
485
- });
486
-
487
- export const tabBarLabelStyles = StyleSheet.create((theme: Theme) => {
488
- return {
489
- tabLabel: createTabLabelStyles(theme),
490
- } as const;
491
- });
492
-
493
- export const tabBarIndicatorStyles = StyleSheet.create((theme: Theme) => {
494
- return {
495
- indicator: createIndicatorStyles(theme),
496
- } as const;
497
- });
498
-
499
- export const tabBarIconStyles = StyleSheet.create((theme: Theme) => {
500
- return {
501
- tabIcon: createIconStyles(theme),
502
- } as const;
503
- });
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;