@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,294 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input styles using defineStyle with $iterator expansion.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '../utils/buildViewStyleVariants';
|
|
9
|
-
import { InputSize, InputType } from './types';
|
|
10
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } 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
11
|
|
|
12
|
+
// Wrap theme for $iterator support
|
|
13
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
size: InputSize;
|
|
15
|
-
type: InputType;
|
|
16
|
-
focused: boolean;
|
|
17
|
-
hasError: boolean;
|
|
18
|
-
disabled: boolean;
|
|
19
|
-
}
|
|
15
|
+
type InputType = 'outlined' | 'filled' | 'bare';
|
|
20
16
|
|
|
21
|
-
type InputDynamicProps = {
|
|
17
|
+
export type InputDynamicProps = {
|
|
22
18
|
type?: InputType;
|
|
23
19
|
focused?: boolean;
|
|
24
20
|
hasError?: boolean;
|
|
25
21
|
disabled?: boolean;
|
|
22
|
+
margin?: ViewStyleSize;
|
|
23
|
+
marginVertical?: ViewStyleSize;
|
|
24
|
+
marginHorizontal?: ViewStyleSize;
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
function getContainerDynamicStyles(theme: Theme, props: InputDynamicProps) {
|
|
32
|
-
const { type = 'outlined', focused = false, hasError = false, disabled = false } = props;
|
|
33
|
-
const focusColor = theme.intents.primary.primary;
|
|
34
|
-
const errorColor = theme.intents.error.primary;
|
|
35
|
-
|
|
36
|
-
// Base styles by type
|
|
37
|
-
let backgroundColor = 'transparent';
|
|
38
|
-
let borderWidth = 1;
|
|
39
|
-
let borderColor = theme.colors.border.primary;
|
|
40
|
-
let borderStyle = 'solid' as const;
|
|
41
|
-
|
|
42
|
-
if (type === 'filled') {
|
|
43
|
-
backgroundColor = theme.colors.surface.secondary;
|
|
44
|
-
borderWidth = 0;
|
|
45
|
-
} else if (type === 'bare') {
|
|
46
|
-
backgroundColor = 'transparent';
|
|
47
|
-
borderWidth = 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Error state takes precedence
|
|
51
|
-
if (hasError) {
|
|
52
|
-
borderColor = errorColor;
|
|
53
|
-
borderWidth = 1;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Focus state (error still takes precedence for color)
|
|
57
|
-
if (focused && !hasError) {
|
|
58
|
-
borderColor = focusColor;
|
|
59
|
-
borderWidth = 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Disabled state
|
|
63
|
-
if (disabled) {
|
|
64
|
-
backgroundColor = theme.colors.surface.secondary;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
backgroundColor,
|
|
69
|
-
borderWidth,
|
|
70
|
-
borderColor,
|
|
71
|
-
borderStyle,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Create dynamic container styles
|
|
28
|
+
* Input styles with type/state handling.
|
|
77
29
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
30
|
+
export const inputStyles = defineStyle('Input', (theme: Theme) => ({
|
|
31
|
+
container: ({ type = 'outlined', focused = false, hasError = false, disabled = false }: InputDynamicProps) => ({
|
|
32
|
+
display: 'flex' as const,
|
|
33
|
+
flexDirection: 'row' as const,
|
|
34
|
+
alignItems: 'center' as const,
|
|
35
|
+
width: '100%',
|
|
36
|
+
minWidth: 0,
|
|
37
|
+
borderRadius: theme.radii.md,
|
|
38
|
+
borderWidth: 1,
|
|
39
|
+
borderStyle: 'solid' as const,
|
|
40
|
+
borderColor: theme.colors.border.primary,
|
|
41
|
+
variants: {
|
|
42
|
+
type: {
|
|
43
|
+
outlined: {
|
|
44
|
+
backgroundColor: theme.colors.surface.primary,
|
|
45
|
+
borderColor: theme.colors.border.primary,
|
|
46
|
+
},
|
|
47
|
+
filled: {
|
|
48
|
+
backgroundColor: theme.colors.surface.secondary,
|
|
49
|
+
borderColor: 'transparent',
|
|
50
|
+
},
|
|
51
|
+
bare: {
|
|
52
|
+
backgroundColor: 'transparent',
|
|
53
|
+
borderWidth: 0,
|
|
54
|
+
borderColor: 'transparent',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
focused: {
|
|
58
|
+
true: {
|
|
59
|
+
borderColor: theme.intents.primary.primary,
|
|
60
|
+
},
|
|
61
|
+
false: {
|
|
62
|
+
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
disabled: {
|
|
66
|
+
true: { opacity: 0.8, _web: { cursor: 'not-allowed' } },
|
|
67
|
+
false: { opacity: 1 }
|
|
68
|
+
},
|
|
69
|
+
hasError: {
|
|
70
|
+
true: { borderColor: theme.intents.error.primary },
|
|
71
|
+
false: { borderColor: theme.colors.border.primary },
|
|
72
|
+
},
|
|
73
|
+
// $iterator expands for each input size
|
|
74
|
+
size: {
|
|
75
|
+
height: theme.sizes.$input.height,
|
|
76
|
+
paddingHorizontal: theme.sizes.$input.paddingHorizontal,
|
|
77
|
+
},
|
|
78
|
+
margin: {
|
|
79
|
+
margin: theme.sizes.$view.padding,
|
|
80
|
+
},
|
|
81
|
+
marginVertical: {
|
|
82
|
+
marginVertical: theme.sizes.$view.padding,
|
|
83
|
+
},
|
|
84
|
+
marginHorizontal: {
|
|
85
|
+
marginHorizontal: theme.sizes.$view.padding,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
_web: {
|
|
89
|
+
boxSizing: 'border-box',
|
|
90
|
+
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
101
91
|
}
|
|
92
|
+
}),
|
|
102
93
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
variants: {
|
|
113
|
-
size: buildSizeVariants(theme, 'input', (size) => ({
|
|
114
|
-
height: size.height,
|
|
115
|
-
paddingHorizontal: size.paddingHorizontal,
|
|
116
|
-
})),
|
|
117
|
-
// Spacing variants from FormInputStyleProps
|
|
118
|
-
margin: buildMarginVariants(theme),
|
|
119
|
-
marginVertical: buildMarginVerticalVariants(theme),
|
|
120
|
-
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
121
|
-
},
|
|
122
|
-
_web: {
|
|
123
|
-
boxSizing: 'border-box',
|
|
124
|
-
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
125
|
-
border: webBorder,
|
|
126
|
-
boxShadow: webBoxShadow,
|
|
127
|
-
cursor: disabled ? 'not-allowed' : 'text',
|
|
94
|
+
input: (_props: InputDynamicProps) => ({
|
|
95
|
+
flex: 1,
|
|
96
|
+
minWidth: 0,
|
|
97
|
+
backgroundColor: 'transparent' as const,
|
|
98
|
+
color: theme.colors.text.primary,
|
|
99
|
+
fontWeight: '400' as const,
|
|
100
|
+
variants: {
|
|
101
|
+
size: {
|
|
102
|
+
fontSize: theme.sizes.$input.fontSize,
|
|
128
103
|
},
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
104
|
+
},
|
|
105
|
+
_web: {
|
|
106
|
+
border: 'none',
|
|
107
|
+
outline: 'none',
|
|
108
|
+
fontFamily: 'inherit',
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
132
111
|
|
|
133
|
-
|
|
134
|
-
* Create left icon container styles
|
|
135
|
-
*/
|
|
136
|
-
function createLeftIconContainerStyles(theme: Theme) {
|
|
137
|
-
return () => ({
|
|
112
|
+
leftIconContainer: (_props: InputDynamicProps) => ({
|
|
138
113
|
display: 'flex' as const,
|
|
139
114
|
alignItems: 'center' as const,
|
|
140
115
|
justifyContent: 'center' as const,
|
|
141
116
|
flexShrink: 0,
|
|
142
117
|
variants: {
|
|
143
|
-
size:
|
|
144
|
-
marginRight:
|
|
145
|
-
}
|
|
118
|
+
size: {
|
|
119
|
+
marginRight: theme.sizes.$input.iconMargin,
|
|
120
|
+
},
|
|
146
121
|
},
|
|
147
|
-
})
|
|
148
|
-
}
|
|
122
|
+
}),
|
|
149
123
|
|
|
150
|
-
|
|
151
|
-
* Create right icon container styles
|
|
152
|
-
*/
|
|
153
|
-
function createRightIconContainerStyles(theme: Theme) {
|
|
154
|
-
return () => ({
|
|
124
|
+
rightIconContainer: (_props: InputDynamicProps) => ({
|
|
155
125
|
display: 'flex' as const,
|
|
156
126
|
alignItems: 'center' as const,
|
|
157
127
|
justifyContent: 'center' as const,
|
|
158
128
|
flexShrink: 0,
|
|
159
129
|
variants: {
|
|
160
|
-
size:
|
|
161
|
-
marginLeft:
|
|
162
|
-
}
|
|
130
|
+
size: {
|
|
131
|
+
marginLeft: theme.sizes.$input.iconMargin,
|
|
132
|
+
},
|
|
163
133
|
},
|
|
164
|
-
})
|
|
165
|
-
}
|
|
134
|
+
}),
|
|
166
135
|
|
|
167
|
-
|
|
168
|
-
* Create left icon styles
|
|
169
|
-
*/
|
|
170
|
-
function createLeftIconStyles(theme: Theme) {
|
|
171
|
-
return () => ({
|
|
136
|
+
leftIcon: (_props: InputDynamicProps) => ({
|
|
172
137
|
color: theme.colors.text.secondary,
|
|
173
138
|
variants: {
|
|
174
|
-
size:
|
|
175
|
-
fontSize:
|
|
176
|
-
width:
|
|
177
|
-
height:
|
|
178
|
-
}
|
|
139
|
+
size: {
|
|
140
|
+
fontSize: theme.sizes.$input.iconSize,
|
|
141
|
+
width: theme.sizes.$input.iconSize,
|
|
142
|
+
height: theme.sizes.$input.iconSize,
|
|
143
|
+
},
|
|
179
144
|
},
|
|
180
|
-
})
|
|
181
|
-
}
|
|
145
|
+
}),
|
|
182
146
|
|
|
183
|
-
|
|
184
|
-
* Create right icon styles
|
|
185
|
-
*/
|
|
186
|
-
function createRightIconStyles(theme: Theme) {
|
|
187
|
-
return () => ({
|
|
147
|
+
rightIcon: (_props: InputDynamicProps) => ({
|
|
188
148
|
display: 'flex' as const,
|
|
189
149
|
alignItems: 'center' as const,
|
|
190
150
|
justifyContent: 'center' as const,
|
|
191
151
|
flexShrink: 0,
|
|
192
152
|
color: theme.colors.text.secondary,
|
|
193
153
|
variants: {
|
|
194
|
-
size:
|
|
195
|
-
fontSize:
|
|
196
|
-
width:
|
|
197
|
-
height:
|
|
198
|
-
}
|
|
154
|
+
size: {
|
|
155
|
+
fontSize: theme.sizes.$input.iconSize,
|
|
156
|
+
width: theme.sizes.$input.iconSize,
|
|
157
|
+
height: theme.sizes.$input.iconSize,
|
|
158
|
+
},
|
|
199
159
|
},
|
|
200
|
-
})
|
|
201
|
-
}
|
|
160
|
+
}),
|
|
202
161
|
|
|
203
|
-
|
|
204
|
-
* Create password toggle styles
|
|
205
|
-
*/
|
|
206
|
-
function createPasswordToggleStyles(theme: Theme) {
|
|
207
|
-
return () => ({
|
|
162
|
+
passwordToggle: (_props: InputDynamicProps) => ({
|
|
208
163
|
display: 'flex' as const,
|
|
209
164
|
alignItems: 'center' as const,
|
|
210
165
|
justifyContent: 'center' as const,
|
|
211
166
|
flexShrink: 0,
|
|
212
167
|
padding: 0,
|
|
213
168
|
variants: {
|
|
214
|
-
size:
|
|
215
|
-
marginLeft:
|
|
216
|
-
}
|
|
169
|
+
size: {
|
|
170
|
+
marginLeft: theme.sizes.$input.iconMargin,
|
|
171
|
+
},
|
|
217
172
|
},
|
|
218
173
|
_web: {
|
|
219
174
|
background: 'transparent',
|
|
220
175
|
border: 'none',
|
|
221
176
|
cursor: 'pointer',
|
|
222
|
-
_hover: {
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
_active: {
|
|
226
|
-
opacity: 0.5,
|
|
227
|
-
},
|
|
177
|
+
_hover: { opacity: 0.7 },
|
|
178
|
+
_active: { opacity: 0.5 },
|
|
228
179
|
},
|
|
229
|
-
})
|
|
230
|
-
}
|
|
180
|
+
}),
|
|
231
181
|
|
|
232
|
-
|
|
233
|
-
* Create password toggle icon styles
|
|
234
|
-
*/
|
|
235
|
-
function createPasswordToggleIconStyles(theme: Theme) {
|
|
236
|
-
return () => ({
|
|
182
|
+
passwordToggleIcon: (_props: InputDynamicProps) => ({
|
|
237
183
|
display: 'flex' as const,
|
|
238
184
|
alignItems: 'center' as const,
|
|
239
185
|
justifyContent: 'center' as const,
|
|
240
186
|
flexShrink: 0,
|
|
241
187
|
color: theme.colors.text.secondary,
|
|
242
188
|
variants: {
|
|
243
|
-
size:
|
|
244
|
-
fontSize:
|
|
245
|
-
width:
|
|
246
|
-
height:
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Create input styles
|
|
254
|
-
*/
|
|
255
|
-
function createInputStyles(theme: Theme) {
|
|
256
|
-
return () => ({
|
|
257
|
-
flex: 1,
|
|
258
|
-
minWidth: 0,
|
|
259
|
-
backgroundColor: 'transparent',
|
|
260
|
-
color: theme.colors.text.primary,
|
|
261
|
-
fontWeight: '400' as const,
|
|
262
|
-
variants: {
|
|
263
|
-
size: buildSizeVariants(theme, 'input', (size) => ({
|
|
264
|
-
fontSize: size.fontSize,
|
|
265
|
-
})),
|
|
266
|
-
},
|
|
267
|
-
_web: {
|
|
268
|
-
border: 'none',
|
|
269
|
-
outline: 'none',
|
|
270
|
-
fontFamily: 'inherit',
|
|
189
|
+
size: {
|
|
190
|
+
fontSize: theme.sizes.$input.iconSize,
|
|
191
|
+
width: theme.sizes.$input.iconSize,
|
|
192
|
+
height: theme.sizes.$input.iconSize,
|
|
193
|
+
},
|
|
271
194
|
},
|
|
272
|
-
})
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
276
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
277
|
-
export const inputStyles = StyleSheet.create((theme: Theme) => {
|
|
278
|
-
// Apply extensions to main visual elements
|
|
279
|
-
const extended = applyExtensions('Input', theme, {
|
|
280
|
-
container: createContainerStyles(theme),
|
|
281
|
-
input: createInputStyles(theme),
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
return {
|
|
285
|
-
...extended,
|
|
286
|
-
// Minor utility styles (not extended)
|
|
287
|
-
leftIconContainer: createLeftIconContainerStyles(theme)(),
|
|
288
|
-
rightIconContainer: createRightIconContainerStyles(theme)(),
|
|
289
|
-
leftIcon: createLeftIconStyles(theme)(),
|
|
290
|
-
rightIcon: createRightIconStyles(theme)(),
|
|
291
|
-
passwordToggle: createPasswordToggleStyles(theme)(),
|
|
292
|
-
passwordToggleIcon: createPasswordToggleIconStyles(theme)(),
|
|
293
|
-
};
|
|
294
|
-
});
|
|
195
|
+
}),
|
|
196
|
+
}));
|
package/src/Input/Input.web.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { isValidElement, useState, useMemo, useRef } from 'react';
|
|
2
2
|
import { getWebProps } from 'react-native-unistyles/web';
|
|
3
3
|
import { IconSvg } from '../Icon/IconSvg/IconSvg.web';
|
|
4
|
-
import { isIconName
|
|
4
|
+
import { isIconName } from '../Icon/icon-resolver';
|
|
5
5
|
import useMergeRefs from '../hooks/useMergeRefs';
|
|
6
6
|
import { inputStyles } from './Input.styles';
|
|
7
7
|
import { InputProps } from './types';
|
|
@@ -184,10 +184,9 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
|
|
|
184
184
|
if (!leftIcon) return null;
|
|
185
185
|
|
|
186
186
|
if (isIconName(leftIcon)) {
|
|
187
|
-
const iconPath = resolveIconPath(leftIcon);
|
|
188
187
|
return (
|
|
189
188
|
<IconSvg
|
|
190
|
-
|
|
189
|
+
name={leftIcon}
|
|
191
190
|
{...leftIconProps}
|
|
192
191
|
aria-label={leftIcon}
|
|
193
192
|
/>
|
|
@@ -204,10 +203,9 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
|
|
|
204
203
|
if (!rightIcon) return null;
|
|
205
204
|
|
|
206
205
|
if (isIconName(rightIcon)) {
|
|
207
|
-
const iconPath = resolveIconPath(rightIcon);
|
|
208
206
|
return (
|
|
209
207
|
<IconSvg
|
|
210
|
-
|
|
208
|
+
name={rightIcon}
|
|
211
209
|
{...rightIconProps}
|
|
212
210
|
aria-label={rightIcon}
|
|
213
211
|
/>
|
|
@@ -222,10 +220,9 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
|
|
|
222
220
|
// Helper to render password toggle icon
|
|
223
221
|
const renderPasswordToggleIcon = () => {
|
|
224
222
|
const iconName = isPasswordVisible ? 'eye-off' : 'eye';
|
|
225
|
-
const iconPath = resolveIconPath(iconName);
|
|
226
223
|
return (
|
|
227
224
|
<IconSvg
|
|
228
|
-
|
|
225
|
+
name={iconName}
|
|
229
226
|
{...passwordToggleIconProps}
|
|
230
227
|
aria-label={iconName}
|
|
231
228
|
/>
|
|
@@ -290,4 +287,4 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(({
|
|
|
290
287
|
|
|
291
288
|
Input.displayName = 'Input';
|
|
292
289
|
|
|
293
|
-
export default Input;
|
|
290
|
+
export default Input;
|
package/src/List/List.native.tsx
CHANGED
|
@@ -37,7 +37,7 @@ const List = forwardRef<View, ListProps>(({
|
|
|
37
37
|
accessibilityHidden,
|
|
38
38
|
});
|
|
39
39
|
}, [accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityHidden]);
|
|
40
|
-
// Apply
|
|
40
|
+
// Apply variants
|
|
41
41
|
listStyles.useVariants({
|
|
42
42
|
size,
|
|
43
43
|
scrollable,
|
|
@@ -50,8 +50,11 @@ const List = forwardRef<View, ListProps>(({
|
|
|
50
50
|
marginHorizontal,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
+
// Call container style as function to get theme-reactive styles
|
|
54
|
+
const containerBaseStyle = (listStyles.container as any)({ type, scrollable });
|
|
55
|
+
|
|
53
56
|
const containerStyle = [
|
|
54
|
-
|
|
57
|
+
containerBaseStyle,
|
|
55
58
|
maxHeight ? { maxHeight } : undefined,
|
|
56
59
|
style,
|
|
57
60
|
];
|