@idealyst/components 1.1.7 → 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 +3 -3
- 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/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/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/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
- package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
- package/src/Breadcrumb/Breadcrumb.web.tsx +28 -23
- package/src/Button/Button.styles.tsx +89 -141
- 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 +6 -6
- package/src/Chip/Chip.styles.old.tsx +184 -0
- package/src/Chip/Chip.styles.tsx +34 -72
- 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/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 +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 +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 +127 -198
- 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 +12 -6
- package/src/List/ListItem.web.tsx +23 -13
- 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 +8 -3
- 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 +18 -25
- package/src/Screen/Screen.styles.old.tsx +87 -0
- package/src/Screen/Screen.styles.tsx +105 -67
- package/src/Screen/Screen.web.tsx +1 -1
- package/src/Select/Select.native.tsx +42 -33
- package/src/Select/Select.styles.old.tsx +353 -0
- package/src/Select/Select.styles.tsx +223 -292
- 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/Switch/Switch.native.tsx +7 -5
- package/src/Switch/Switch.styles.old.tsx +203 -0
- package/src/Switch/Switch.styles.tsx +101 -174
- package/src/Switch/Switch.web.tsx +5 -5
- 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 +18 -9
- package/src/Table/Table.styles.old.tsx +311 -0
- package/src/Table/Table.styles.tsx +152 -286
- 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 +2 -2
- package/src/Text/index.ts +1 -0
- package/src/TextArea/TextArea.styles.old.tsx +213 -0
- package/src/TextArea/TextArea.styles.tsx +93 -181
- 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 +12 -14
- package/src/View/View.styles.old.tsx +125 -0
- package/src/View/View.styles.tsx +76 -106
- package/src/View/View.web.tsx +1 -0
- package/src/examples/CardExamples.tsx +0 -6
- package/src/extensions/extendComponent.ts +61 -0
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
|
];
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme } 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 { ListSizeVariant, ListType } from './types';
|
|
14
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
15
|
+
|
|
16
|
+
type ListVariants = {
|
|
17
|
+
type: ListType;
|
|
18
|
+
size: ListSizeVariant;
|
|
19
|
+
scrollable: boolean;
|
|
20
|
+
active: boolean;
|
|
21
|
+
selected: boolean;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
clickable: boolean;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Create type variants for container
|
|
28
|
+
*/
|
|
29
|
+
function createContainerTypeVariants(theme: Theme) {
|
|
30
|
+
return {
|
|
31
|
+
default: {
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
},
|
|
34
|
+
bordered: {
|
|
35
|
+
backgroundColor: theme.colors.surface.primary,
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
borderColor: theme.colors.border.primary,
|
|
38
|
+
borderRadius: 8,
|
|
39
|
+
_web: {
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
border: `1px solid ${theme.colors.border.primary}`,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
divided: {
|
|
45
|
+
backgroundColor: 'transparent',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type ItemDynamicProps = {
|
|
51
|
+
type?: ListType;
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
clickable?: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get item hover styles based on disabled and clickable state
|
|
58
|
+
*/
|
|
59
|
+
function getItemHoverStyles(theme: Theme, disabled: boolean, clickable: boolean) {
|
|
60
|
+
if (disabled || !clickable) {
|
|
61
|
+
return {
|
|
62
|
+
backgroundColor: 'transparent',
|
|
63
|
+
borderRadius: 0,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
backgroundColor: theme.colors.surface.secondary,
|
|
68
|
+
borderRadius: 4,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Container style creator for extension support
|
|
73
|
+
function createContainerStyles(theme: Theme) {
|
|
74
|
+
return () => ({
|
|
75
|
+
display: 'flex' as const,
|
|
76
|
+
flexDirection: 'column' as const,
|
|
77
|
+
width: '100%',
|
|
78
|
+
variants: {
|
|
79
|
+
type: createContainerTypeVariants(theme),
|
|
80
|
+
scrollable: {
|
|
81
|
+
true: {
|
|
82
|
+
_web: {
|
|
83
|
+
overflow: 'auto',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
false: {},
|
|
87
|
+
},
|
|
88
|
+
// Spacing variants from ContainerStyleProps
|
|
89
|
+
gap: buildGapVariants(theme),
|
|
90
|
+
padding: buildPaddingVariants(theme),
|
|
91
|
+
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
92
|
+
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
93
|
+
margin: buildMarginVariants(theme),
|
|
94
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
95
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Item style creator for extension support
|
|
101
|
+
function createItemStyles(theme: Theme) {
|
|
102
|
+
return ({ type = 'default', disabled = false, clickable = true }: ItemDynamicProps) => {
|
|
103
|
+
const hoverStyles = getItemHoverStyles(theme, disabled, clickable);
|
|
104
|
+
return {
|
|
105
|
+
display: 'flex',
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
backgroundColor: 'transparent',
|
|
109
|
+
textAlign: 'left',
|
|
110
|
+
borderBottomWidth: type === 'divided' ? 1 : 0,
|
|
111
|
+
borderBottomStyle: type === 'divided' ? 'solid' as const : undefined,
|
|
112
|
+
borderBottomColor: type === 'divided' ? theme.colors.border.primary : undefined,
|
|
113
|
+
variants: {
|
|
114
|
+
size: buildSizeVariants(theme, 'list', (size) => ({
|
|
115
|
+
paddingVertical: size.paddingVertical,
|
|
116
|
+
paddingHorizontal: size.paddingHorizontal,
|
|
117
|
+
minHeight: size.minHeight,
|
|
118
|
+
})),
|
|
119
|
+
active: {
|
|
120
|
+
true: {
|
|
121
|
+
backgroundColor: theme.colors.surface.secondary,
|
|
122
|
+
},
|
|
123
|
+
false: {},
|
|
124
|
+
},
|
|
125
|
+
selected: {
|
|
126
|
+
true: {
|
|
127
|
+
backgroundColor: theme.intents.primary.light + '20',
|
|
128
|
+
borderLeftWidth: 3,
|
|
129
|
+
borderLeftColor: theme.intents.primary.primary,
|
|
130
|
+
_web: {
|
|
131
|
+
borderLeft: `3px solid ${theme.intents.primary.primary}`,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
false: {},
|
|
135
|
+
},
|
|
136
|
+
} as const,
|
|
137
|
+
opacity: disabled ? 0.5 : 1,
|
|
138
|
+
_web: {
|
|
139
|
+
border: 'none',
|
|
140
|
+
cursor: disabled ? 'not-allowed' : (clickable ? 'pointer' : 'default'),
|
|
141
|
+
outline: 'none',
|
|
142
|
+
transition: 'background-color 0.2s ease, border-color 0.2s ease',
|
|
143
|
+
borderBottom: type === 'divided' ? `1px solid ${theme.colors.border.primary}` : undefined,
|
|
144
|
+
_hover: hoverStyles,
|
|
145
|
+
},
|
|
146
|
+
} as const;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const listStyles = StyleSheet.create((theme: Theme) => {
|
|
151
|
+
// Apply extensions to main visual elements
|
|
152
|
+
|
|
153
|
+
return applyExtensions('List', theme, {container: createContainerStyles(theme),
|
|
154
|
+
item: createItemStyles(theme),
|
|
155
|
+
// Additional styles (merged from return)
|
|
156
|
+
// Minor utility styles (not extended)
|
|
157
|
+
itemContent: {
|
|
158
|
+
display: 'flex',
|
|
159
|
+
flexDirection: 'row',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
flex: 1,
|
|
162
|
+
gap: 8,
|
|
163
|
+
},
|
|
164
|
+
leading: {
|
|
165
|
+
display: 'flex',
|
|
166
|
+
alignItems: 'center',
|
|
167
|
+
justifyContent: 'center',
|
|
168
|
+
marginRight: 8,
|
|
169
|
+
color: theme.colors.text.secondary,
|
|
170
|
+
variants: {
|
|
171
|
+
size: buildSizeVariants(theme, 'list', (size) => ({
|
|
172
|
+
width: size.iconSize,
|
|
173
|
+
height: size.iconSize,
|
|
174
|
+
})),
|
|
175
|
+
} as const,
|
|
176
|
+
} as const,
|
|
177
|
+
labelContainer: {
|
|
178
|
+
flex: 1,
|
|
179
|
+
display: 'flex',
|
|
180
|
+
flexDirection: 'column',
|
|
181
|
+
},
|
|
182
|
+
label: {
|
|
183
|
+
fontWeight: '500',
|
|
184
|
+
color: theme.colors.text.primary,
|
|
185
|
+
variants: {
|
|
186
|
+
size: buildSizeVariants(theme, 'list', (size) => ({
|
|
187
|
+
fontSize: size.labelFontSize,
|
|
188
|
+
lineHeight: size.labelLineHeight,
|
|
189
|
+
})),
|
|
190
|
+
disabled: {
|
|
191
|
+
true: {
|
|
192
|
+
color: theme.colors.text.secondary,
|
|
193
|
+
},
|
|
194
|
+
false: {},
|
|
195
|
+
},
|
|
196
|
+
selected: {
|
|
197
|
+
true: {
|
|
198
|
+
color: theme.intents.primary.primary,
|
|
199
|
+
fontWeight: '600',
|
|
200
|
+
},
|
|
201
|
+
false: {},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
trailing: {
|
|
206
|
+
display: 'flex',
|
|
207
|
+
alignItems: 'center',
|
|
208
|
+
justifyContent: 'center',
|
|
209
|
+
marginLeft: 8,
|
|
210
|
+
color: theme.colors.text.secondary,
|
|
211
|
+
flexShrink: 0,
|
|
212
|
+
},
|
|
213
|
+
trailingIcon: {
|
|
214
|
+
display: 'flex',
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
justifyContent: 'center',
|
|
217
|
+
variants: {
|
|
218
|
+
size: buildSizeVariants(theme, 'list', (size) => ({
|
|
219
|
+
width: size.iconSize,
|
|
220
|
+
height: size.iconSize,
|
|
221
|
+
})),
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
section: {
|
|
225
|
+
display: 'flex',
|
|
226
|
+
flexDirection: 'column',
|
|
227
|
+
},
|
|
228
|
+
sectionTitle: {
|
|
229
|
+
fontWeight: '600',
|
|
230
|
+
fontSize: 12,
|
|
231
|
+
lineHeight: 16,
|
|
232
|
+
textTransform: 'uppercase',
|
|
233
|
+
letterSpacing: 0.5,
|
|
234
|
+
color: theme.colors.text.secondary,
|
|
235
|
+
padding: 8,
|
|
236
|
+
paddingBottom: 4,
|
|
237
|
+
},
|
|
238
|
+
sectionContent: {
|
|
239
|
+
display: 'flex',
|
|
240
|
+
flexDirection: 'column',
|
|
241
|
+
}});
|
|
242
|
+
});
|