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