@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.
Files changed (129) hide show
  1. package/package.json +3 -3
  2. package/plugin/web.js +280 -532
  3. package/src/Accordion/Accordion.native.tsx +8 -6
  4. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  5. package/src/Accordion/Accordion.styles.tsx +102 -236
  6. package/src/Accordion/Accordion.web.tsx +1 -3
  7. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  8. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +44 -74
  9. package/src/Alert/Alert.native.tsx +16 -6
  10. package/src/Alert/Alert.styles.old.tsx +209 -0
  11. package/src/Alert/Alert.styles.tsx +67 -149
  12. package/src/Alert/Alert.web.tsx +3 -4
  13. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  14. package/src/Avatar/Avatar.styles.tsx +35 -80
  15. package/src/Badge/Badge.styles.old.tsx +157 -0
  16. package/src/Badge/Badge.styles.tsx +61 -121
  17. package/src/Badge/Badge.web.tsx +8 -15
  18. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  19. package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
  20. package/src/Breadcrumb/Breadcrumb.web.tsx +31 -30
  21. package/src/Button/Button.native.tsx +14 -21
  22. package/src/Button/Button.styles.tsx +103 -140
  23. package/src/Button/Button.web.tsx +9 -19
  24. package/src/Card/Card.native.tsx +7 -11
  25. package/src/Card/Card.styles.old.tsx +160 -0
  26. package/src/Card/Card.styles.tsx +105 -142
  27. package/src/Card/Card.web.tsx +5 -4
  28. package/src/Checkbox/Checkbox.native.tsx +9 -5
  29. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  30. package/src/Checkbox/Checkbox.styles.tsx +104 -216
  31. package/src/Checkbox/Checkbox.web.tsx +7 -8
  32. package/src/Chip/Chip.styles.old.tsx +184 -0
  33. package/src/Chip/Chip.styles.tsx +34 -72
  34. package/src/Chip/Chip.web.tsx +3 -5
  35. package/src/Dialog/Dialog.native.tsx +7 -4
  36. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  37. package/src/Dialog/Dialog.styles.tsx +69 -133
  38. package/src/Dialog/Dialog.web.tsx +3 -3
  39. package/src/Dialog/types.ts +1 -1
  40. package/src/Divider/Divider.styles.old.tsx +172 -0
  41. package/src/Divider/Divider.styles.tsx +62 -84
  42. package/src/Icon/Icon.native.tsx +8 -8
  43. package/src/Icon/Icon.styles.old.tsx +81 -0
  44. package/src/Icon/Icon.styles.tsx +52 -66
  45. package/src/Icon/Icon.web.tsx +62 -21
  46. package/src/Icon/IconRegistry.native.ts +41 -0
  47. package/src/Icon/IconRegistry.ts +107 -0
  48. package/src/Icon/IconSvg/IconSvg.web.tsx +28 -5
  49. package/src/Icon/icon-resolver.ts +12 -43
  50. package/src/Icon/index.native.ts +2 -1
  51. package/src/Icon/index.ts +1 -0
  52. package/src/Icon/index.web.ts +1 -0
  53. package/src/Image/Image.styles.old.tsx +69 -0
  54. package/src/Image/Image.styles.tsx +46 -60
  55. package/src/Input/Input.native.tsx +138 -53
  56. package/src/Input/Input.styles.old.tsx +289 -0
  57. package/src/Input/Input.styles.tsx +134 -232
  58. package/src/Input/Input.web.tsx +5 -8
  59. package/src/List/List.native.tsx +5 -2
  60. package/src/List/List.styles.old.tsx +242 -0
  61. package/src/List/List.styles.tsx +179 -215
  62. package/src/List/ListItem.native.tsx +16 -11
  63. package/src/List/ListItem.web.tsx +26 -16
  64. package/src/Menu/Menu.styles.old.tsx +197 -0
  65. package/src/Menu/Menu.styles.tsx +68 -150
  66. package/src/Menu/MenuItem.native.tsx +5 -3
  67. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  68. package/src/Menu/MenuItem.styles.tsx +57 -89
  69. package/src/Menu/MenuItem.web.tsx +10 -7
  70. package/src/Popover/Popover.native.tsx +10 -4
  71. package/src/Popover/Popover.styles.old.tsx +135 -0
  72. package/src/Popover/Popover.styles.tsx +51 -112
  73. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  74. package/src/Pressable/Pressable.styles.tsx +35 -27
  75. package/src/Progress/Progress.styles.old.tsx +200 -0
  76. package/src/Progress/Progress.styles.tsx +75 -164
  77. package/src/RadioButton/RadioButton.native.tsx +4 -3
  78. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  79. package/src/RadioButton/RadioButton.styles.tsx +83 -154
  80. package/src/RadioButton/RadioButton.web.tsx +2 -2
  81. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  82. package/src/SVGImage/SVGImage.styles.tsx +35 -78
  83. package/src/Screen/Screen.native.tsx +19 -26
  84. package/src/Screen/Screen.styles.old.tsx +87 -0
  85. package/src/Screen/Screen.styles.tsx +103 -68
  86. package/src/Screen/Screen.web.tsx +2 -2
  87. package/src/Select/Select.native.tsx +42 -33
  88. package/src/Select/Select.styles.old.tsx +353 -0
  89. package/src/Select/Select.styles.tsx +214 -300
  90. package/src/Select/Select.web.tsx +45 -33
  91. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  92. package/src/Skeleton/Skeleton.styles.tsx +29 -53
  93. package/src/Slider/Slider.styles.old.tsx +259 -0
  94. package/src/Slider/Slider.styles.tsx +153 -234
  95. package/src/Slider/Slider.web.tsx +2 -4
  96. package/src/Switch/Switch.native.tsx +9 -7
  97. package/src/Switch/Switch.styles.old.tsx +203 -0
  98. package/src/Switch/Switch.styles.tsx +101 -174
  99. package/src/Switch/Switch.web.tsx +7 -8
  100. package/src/TabBar/TabBar.native.tsx +3 -2
  101. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  102. package/src/TabBar/TabBar.styles.tsx +145 -279
  103. package/src/Table/Table.native.tsx +180 -68
  104. package/src/Table/Table.styles.old.tsx +311 -0
  105. package/src/Table/Table.styles.tsx +140 -281
  106. package/src/Table/Table.web.tsx +169 -70
  107. package/src/Text/Text.native.tsx +1 -3
  108. package/src/Text/Text.style.demo.tsx +16 -0
  109. package/src/Text/Text.styles.old.tsx +219 -0
  110. package/src/Text/Text.styles.tsx +94 -84
  111. package/src/Text/Text.web.tsx +3 -2
  112. package/src/Text/index.ts +1 -0
  113. package/src/TextArea/TextArea.native.tsx +21 -8
  114. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  115. package/src/TextArea/TextArea.styles.tsx +87 -187
  116. package/src/TextArea/TextArea.web.tsx +17 -6
  117. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  118. package/src/Tooltip/Tooltip.styles.tsx +32 -56
  119. package/src/Video/Video.styles.old.tsx +51 -0
  120. package/src/Video/Video.styles.tsx +32 -44
  121. package/src/View/View.native.tsx +41 -13
  122. package/src/View/View.styles.old.tsx +125 -0
  123. package/src/View/View.styles.tsx +76 -106
  124. package/src/View/View.web.tsx +5 -21
  125. package/src/View/types.ts +31 -3
  126. package/src/examples/ButtonExamples.tsx +20 -0
  127. package/src/examples/CardExamples.tsx +0 -6
  128. package/src/extensions/extendComponent.ts +61 -0
  129. package/src/index.ts +1 -1
@@ -1,157 +1,145 @@
1
+ /**
2
+ * Select styles using defineStyle with dynamic props.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Intent, Size } from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import {
5
- buildMarginVariants,
6
- buildMarginVerticalVariants,
7
- buildMarginHorizontalVariants,
8
- } from '../utils/buildViewStyleVariants';
9
- import { SelectIntentVariant } from './types';
10
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
7
+ import { ViewStyleSize } from '../utils/viewStyleProps';
11
8
 
12
- // Type definitions
13
- type SelectSize = Size;
14
- type SelectType = 'outlined' | 'filled';
9
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
10
+ void StyleSheet;
15
11
 
16
- type SelectTriggerVariants = {
17
- type: SelectType;
18
- size: SelectSize;
19
- intent: SelectIntentVariant;
20
- disabled: boolean;
21
- error: boolean;
22
- focused: boolean;
23
- }
12
+ // Wrap theme for $iterator support
13
+ type Theme = ThemeStyleWrapper<BaseTheme>;
24
14
 
15
+ type SelectType = 'outlined' | 'filled';
25
16
 
26
- export type ExpandedSelectTriggerStyles = StylesheetStyles<keyof SelectTriggerVariants>;
27
- export type ExpandedSelectStyles = StylesheetStyles<never>;
17
+ export type SelectDynamicProps = {
18
+ size?: Size;
19
+ intent?: Intent;
20
+ type?: SelectType;
21
+ disabled?: boolean;
22
+ error?: boolean;
23
+ focused?: boolean;
24
+ margin?: ViewStyleSize;
25
+ marginVertical?: ViewStyleSize;
26
+ marginHorizontal?: ViewStyleSize;
27
+ };
28
28
 
29
- function createTriggerTypeVariants(theme: Theme) {
30
- return {
31
- outlined: {
32
- backgroundColor: theme.colors.surface.primary,
33
- borderColor: theme.colors.border.primary,
34
- _web: {
35
- border: `1px solid ${theme.colors.border.primary}`,
29
+ /**
30
+ * Select styles with type/intent/error/focused handling.
31
+ */
32
+ export const selectStyles = defineStyle('Select', (theme: Theme) => ({
33
+ container: (_props: SelectDynamicProps) => ({
34
+ position: 'relative' as const,
35
+ variants: {
36
+ margin: {
37
+ margin: theme.sizes.$view.padding,
36
38
  },
37
- },
38
- filled: {
39
- backgroundColor: theme.colors.surface.secondary,
40
- borderColor: 'transparent',
41
- _web: {
42
- border: '1px solid transparent',
39
+ marginVertical: {
40
+ marginVertical: theme.sizes.$view.padding,
41
+ },
42
+ marginHorizontal: {
43
+ marginHorizontal: theme.sizes.$view.padding,
43
44
  },
44
45
  },
45
- } as const;
46
- }
46
+ }),
47
47
 
48
- function createTriggerSizeVariants(theme: Theme) {
49
- return buildSizeVariants(theme, 'select', (size) => ({
50
- paddingHorizontal: size.paddingHorizontal,
51
- minHeight: size.minHeight,
52
- }));
53
- }
48
+ label: (_props: SelectDynamicProps) => ({
49
+ fontSize: 14,
50
+ fontWeight: '500' as const,
51
+ color: theme.colors.text.primary,
52
+ marginBottom: 4,
53
+ }),
54
54
 
55
- function createIntentVariants(theme: Theme, type: SelectType, intent: SelectIntentVariant) {
56
- if (intent === 'neutral') {
57
- return {};
58
- }
55
+ trigger: ({ type = 'outlined', intent = 'neutral', disabled = false, error = false, focused = false }: SelectDynamicProps) => ({
56
+ position: 'relative' as const,
57
+ flexDirection: 'row' as const,
58
+ alignItems: 'center' as const,
59
+ justifyContent: 'space-between' as const,
60
+ borderWidth: 1,
61
+ borderStyle: 'solid' as const,
62
+ opacity: disabled ? 0.6 : 1,
63
+ variants: {
64
+ type: {
65
+ filled: {
66
+ backgroundColor: theme.colors.surface.secondary,
67
+ borderColor: 'transparent',
68
+ },
69
+ outlined: {
70
+ backgroundColor: theme.colors.surface.primary,
71
+ borderWidth: 1,
72
+ borderColor: theme.colors.border.primary,
73
+ }
74
+ },
75
+ size: theme.sizes.$select,
76
+ },
77
+ _web: {
78
+ display: 'flex',
79
+ boxSizing: 'border-box',
80
+ cursor: disabled ? 'not-allowed' : 'pointer',
81
+ border: `1px solid`,
82
+ transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
83
+ _hover: disabled ? {} : { opacity: 0.9 },
84
+ _active: disabled ? {} : { opacity: 0.8 },
85
+ _focus: { outline: 'none' },
86
+ },
87
+ }),
59
88
 
60
- const intentValue = (theme.intents as any)[intent];
89
+ triggerContent: (_props: SelectDynamicProps) => ({
90
+ flex: 1,
91
+ flexDirection: 'row' as const,
92
+ alignItems: 'center' as const,
93
+ }),
61
94
 
62
- if (type === 'outlined') {
63
- return {
64
- borderColor: intentValue.primary,
65
- _web: {
66
- border: `1px solid ${intentValue.primary}`,
95
+ triggerText: (_props: SelectDynamicProps) => ({
96
+ color: theme.colors.text.primary,
97
+ flex: 1,
98
+ variants: {
99
+ size: {
100
+ fontSize: theme.sizes.$select.fontSize,
67
101
  },
68
- } as const;
69
- }
102
+ },
103
+ }),
70
104
 
71
- return {} as const;
72
- }
105
+ placeholder: (_props: SelectDynamicProps) => ({
106
+ color: theme.colors.text.secondary,
107
+ variants: {
108
+ size: {
109
+ fontSize: theme.sizes.$select.fontSize,
110
+ },
111
+ },
112
+ }),
73
113
 
74
- function buildDynamicTriggerStyles(theme: Theme) {
75
- return ({ type, intent }: Partial<SelectTriggerVariants>) => {
76
- const intentStyles = createIntentVariants(theme, type, intent);
114
+ icon: (_props: SelectDynamicProps) => ({
115
+ marginLeft: 4,
116
+ color: theme.colors.text.secondary,
117
+ }),
77
118
 
78
- return {
79
- position: 'relative',
80
- flexDirection: 'row',
81
- alignItems: 'center',
82
- justifyContent: 'space-between',
83
- borderRadius: 8,
84
- borderWidth: 1,
85
- borderStyle: 'solid',
86
- ...intentStyles,
87
- variants: {
88
- type: createTriggerTypeVariants(theme),
89
- size: createTriggerSizeVariants(theme),
90
- disabled: {
91
- true: {
92
- opacity: 0.6,
93
- _web: {
94
- cursor: 'not-allowed',
95
- },
96
- },
97
- false: {
98
- _web: {
99
- cursor: 'pointer',
100
- _hover: {
101
- opacity: 0.9,
102
- },
103
- _active: {
104
- opacity: 0.8,
105
- },
106
- },
107
- },
108
- },
109
- error: {
110
- true: {
111
- borderColor: theme.intents.error.primary,
112
- _web: {
113
- border: `1px solid ${theme.intents.error.primary}`,
114
- },
115
- },
116
- false: {},
117
- },
118
- focused: {
119
- true: {
120
- borderColor: theme.intents.primary.primary,
121
- _web: {
122
- border: `1px solid ${theme.intents.primary.primary}`,
123
- boxShadow: `0 0 0 2px ${theme.intents.primary.primary}20`,
124
- outline: 'none',
125
- },
126
- },
127
- false: {},
128
- },
129
- },
130
- _web: {
131
- display: 'flex',
132
- boxSizing: 'border-box',
133
- _focus: {
134
- outline: 'none',
135
- },
119
+ chevron: (_props: SelectDynamicProps) => ({
120
+ display: 'flex' as const,
121
+ alignItems: 'center' as const,
122
+ justifyContent: 'center' as const,
123
+ marginLeft: 4,
124
+ color: theme.colors.text.secondary,
125
+ variants: {
126
+ size: {
127
+ width: theme.sizes.$select.iconSize,
128
+ height: theme.sizes.$select.iconSize,
136
129
  },
137
- } as const;
138
- }
139
- }
130
+ },
131
+ _web: {
132
+ transition: 'transform 0.2s ease',
133
+ },
134
+ }),
140
135
 
141
- // Main element style creators (wrapped for extension support)
142
- function createContainerStyles(theme: Theme) {
143
- return () => ({
144
- position: 'relative' as const,
145
- variants: {
146
- margin: buildMarginVariants(theme),
147
- marginVertical: buildMarginVerticalVariants(theme),
148
- marginHorizontal: buildMarginHorizontalVariants(theme),
136
+ chevronOpen: (_props: SelectDynamicProps) => ({
137
+ _web: {
138
+ transform: 'rotate(180deg)',
149
139
  },
150
- });
151
- }
140
+ }),
152
141
 
153
- function createDropdownStyles(theme: Theme) {
154
- return () => ({
142
+ dropdown: (_props: SelectDynamicProps) => ({
155
143
  position: 'absolute' as const,
156
144
  top: '100%',
157
145
  left: 0,
@@ -175,185 +163,111 @@ function createDropdownStyles(theme: Theme) {
175
163
  boxShadow: '0 8px 24px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06)',
176
164
  overflowY: 'auto',
177
165
  },
178
- });
179
- }
166
+ }),
180
167
 
181
- function createOptionStyles(theme: Theme) {
182
- return () => ({
183
- paddingHorizontal: 8,
184
- paddingVertical: 4,
185
- flexDirection: 'row' as const,
186
- alignItems: 'center' as const,
187
- minHeight: 36,
168
+ searchContainer: (_props: SelectDynamicProps) => ({
169
+ padding: 8,
170
+ borderBottomWidth: 1,
171
+ borderBottomColor: theme.colors.border.primary,
188
172
  _web: {
189
- display: 'flex',
190
- cursor: 'pointer',
191
- _hover: {
192
- backgroundColor: theme.colors.surface.secondary,
193
- },
194
- _active: {
195
- opacity: 0.8,
196
- },
173
+ borderBottom: `1px solid ${theme.colors.border.primary}`,
197
174
  },
198
- });
199
- }
200
-
201
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
202
- // transform on native cannot resolve function calls to extract variant structures.
203
- export const selectStyles = StyleSheet.create((theme: Theme) => {
204
- // Apply extensions to main visual elements
205
- const extendedStyles = applyExtensions('Select', theme, {
206
- container: createContainerStyles(theme),
207
- trigger: buildDynamicTriggerStyles(theme),
208
- dropdown: createDropdownStyles(theme),
209
- option: createOptionStyles(theme),
210
- });
175
+ }),
211
176
 
212
- return {
213
- // Extended main elements
214
- ...extendedStyles,
215
- // Minor utility styles (not extended)
216
- label: {
217
- fontSize: 14,
218
- fontWeight: '500',
219
- color: theme.colors.text.primary,
220
- marginBottom: 4,
221
- },
222
- triggerContent: {
223
- flex: 1,
224
- flexDirection: 'row',
225
- alignItems: 'center',
226
- },
227
- triggerText: {
228
- color: theme.colors.text.primary,
229
- flex: 1,
230
- variants: {
231
- size: buildSizeVariants(theme, 'select', (size: any) => ({
232
- fontSize: size.fontSize,
233
- })),
177
+ searchInput: (_props: SelectDynamicProps) => ({
178
+ padding: 4,
179
+ borderRadius: 4,
180
+ borderWidth: 1,
181
+ borderStyle: 'solid' as const,
182
+ borderColor: theme.colors.border.primary,
183
+ backgroundColor: theme.colors.surface.primary,
184
+ variants: {
185
+ size: {
186
+ fontSize: theme.sizes.$select.fontSize,
234
187
  },
235
188
  },
236
- placeholder: {
237
- color: theme.colors.text.secondary,
238
- variants: {
239
- size: buildSizeVariants(theme, 'select', (size: any) => ({
240
- fontSize: size.fontSize,
241
- })),
189
+ _web: {
190
+ border: `1px solid ${theme.colors.border.primary}`,
191
+ outline: 'none',
192
+ _focus: {
193
+ borderColor: theme.intents.primary.primary,
242
194
  },
243
195
  },
244
- icon: {
245
- marginLeft: 4,
246
- color: theme.colors.text.secondary,
247
- },
248
- chevron: {
196
+ }),
197
+
198
+ optionsList: (_props: SelectDynamicProps) => ({
199
+ paddingVertical: 4,
200
+ }),
201
+
202
+ option: ({ disabled = false }: SelectDynamicProps) => ({
203
+ paddingHorizontal: 8,
204
+ paddingVertical: 4,
205
+ flexDirection: 'row' as const,
206
+ alignItems: 'center' as const,
207
+ minHeight: 36,
208
+ opacity: disabled ? theme.interaction.opacity.disabled : 1,
209
+ _web: {
249
210
  display: 'flex',
250
- alignItems: 'center',
251
- justifyContent: 'center',
252
- marginLeft: 4,
253
- color: theme.colors.text.secondary,
254
- variants: {
255
- size: buildSizeVariants(theme, 'select', (size: any) => ({
256
- width: size.iconSize,
257
- height: size.iconSize,
258
- })),
259
- },
260
- _web: {
261
- transition: 'transform 0.2s ease',
262
- },
263
- },
264
- chevronOpen: {
265
- _web: {
266
- transform: 'rotate(180deg)',
267
- }
268
- },
269
- searchContainer: {
270
- padding: 8,
271
- borderBottomWidth: 1,
272
- borderBottomStyle: 'solid',
273
- borderBottomColor: theme.colors.border.primary,
274
- _web: {
275
- borderBottom: `1px solid ${theme.colors.border.primary}`,
276
- },
211
+ cursor: disabled ? 'not-allowed' : 'pointer',
212
+ _hover: disabled ? {} : { backgroundColor: theme.colors.surface.secondary },
213
+ _active: disabled ? {} : { opacity: 0.8 },
277
214
  },
278
- searchInput: {
279
- padding: 4,
280
- borderRadius: 4,
281
- borderWidth: 1,
282
- borderStyle: 'solid',
283
- borderColor: theme.colors.border.primary,
284
- backgroundColor: theme.colors.surface.primary,
285
- variants: {
286
- size: buildSizeVariants(theme, 'select', (size: any) => ({
287
- fontSize: size.fontSize,
288
- })),
289
- },
290
- _web: {
291
- border: `1px solid ${theme.colors.border.primary}`,
292
- outline: 'none',
293
- _focus: {
294
- borderColor: theme.intents.primary.primary,
295
- },
296
- },
297
- },
298
- optionsList: {
299
- paddingVertical: 4,
300
- },
301
- optionFocused: {
302
- backgroundColor: theme.interaction.focusedBackground,
303
- _web: {
304
- outline: `1px solid ${theme.interaction.focusBorder}`,
305
- outlineOffset: -1,
306
- },
307
- },
308
- optionDisabled: {
309
- opacity: theme.interaction.opacity.disabled,
310
- _web: {
311
- cursor: 'not-allowed',
312
- },
313
- },
314
- optionContent: {
315
- flexDirection: 'row',
316
- alignItems: 'center',
317
- flex: 1,
318
- },
319
- optionIcon: {
320
- marginRight: 4,
321
- },
322
- optionText: {
323
- color: theme.colors.text.primary,
324
- flex: 1,
325
- variants: {
326
- size: buildSizeVariants(theme, 'select', (size: any) => ({
327
- fontSize: size.fontSize,
328
- })),
329
- },
215
+ }),
216
+
217
+ optionFocused: (_props: SelectDynamicProps) => ({
218
+ backgroundColor: theme.interaction.focusedBackground,
219
+ _web: {
220
+ outline: `1px solid ${theme.interaction.focusBorder}`,
221
+ outlineOffset: -1,
330
222
  },
331
- optionTextDisabled: {
332
- color: theme.colors.text.secondary,
223
+ }),
224
+
225
+ optionDisabled: (_props: SelectDynamicProps) => ({
226
+ opacity: theme.interaction.opacity.disabled,
227
+ _web: {
228
+ cursor: 'not-allowed',
333
229
  },
334
- helperText: {
335
- fontSize: 12,
336
- marginTop: 4,
337
- color: theme.colors.text.secondary,
338
- variants: {
339
- error: {
340
- true: {
341
- color: theme.intents.error.primary,
342
- },
343
- false: {},
344
- },
230
+ }),
231
+
232
+ optionContent: (_props: SelectDynamicProps) => ({
233
+ flexDirection: 'row' as const,
234
+ alignItems: 'center' as const,
235
+ flex: 1,
236
+ }),
237
+
238
+ optionIcon: (_props: SelectDynamicProps) => ({
239
+ marginRight: 4,
240
+ }),
241
+
242
+ optionText: (_props: SelectDynamicProps) => ({
243
+ color: theme.colors.text.primary,
244
+ flex: 1,
245
+ variants: {
246
+ size: {
247
+ fontSize: theme.sizes.$select.fontSize,
345
248
  },
346
249
  },
347
- overlay: {
348
- position: 'absolute',
349
- top: 0,
350
- left: 0,
351
- right: 0,
352
- bottom: 0,
353
- zIndex: 999,
354
- _web: {
355
- position: 'fixed',
356
- },
250
+ }),
251
+
252
+ optionTextDisabled: (_props: SelectDynamicProps) => ({
253
+ color: theme.colors.text.secondary,
254
+ }),
255
+
256
+ helperText: ({ error = false }: SelectDynamicProps) => ({
257
+ fontSize: 12,
258
+ marginTop: 4,
259
+ color: error ? theme.intents.error.primary : theme.colors.text.secondary,
260
+ }),
261
+
262
+ overlay: (_props: SelectDynamicProps) => ({
263
+ position: 'absolute' as const,
264
+ top: 0,
265
+ left: 0,
266
+ right: 0,
267
+ bottom: 0,
268
+ zIndex: 999,
269
+ _web: {
270
+ position: 'fixed',
357
271
  },
358
- } as const;
359
- });
272
+ }),
273
+ }));