@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
|
@@ -1,71 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton styles using defineStyle.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } from '@idealyst/theme';
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
animation: SkeletonAnimation;
|
|
11
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
type SkeletonShape = 'rectangle' | 'rounded' | 'circle';
|
|
15
|
+
type SkeletonAnimation = 'pulse' | 'wave' | 'none';
|
|
15
16
|
|
|
16
|
-
export type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
17
|
+
export type SkeletonDynamicProps = {
|
|
18
|
+
shape?: SkeletonShape;
|
|
19
|
+
animation?: SkeletonAnimation;
|
|
20
|
+
};
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Skeleton styles with shape and animation variants.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
rectangle: {
|
|
27
|
-
borderRadius: 0,
|
|
28
|
-
},
|
|
29
|
-
rounded: {
|
|
30
|
-
borderRadius: 8,
|
|
31
|
-
},
|
|
32
|
-
circle: {
|
|
33
|
-
borderRadius: 9999,
|
|
34
|
-
},
|
|
35
|
-
} as const;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Style creators for extension support
|
|
39
|
-
function createSkeletonStyles(theme: Theme) {
|
|
40
|
-
return () => ({
|
|
25
|
+
export const skeletonStyles = defineStyle('Skeleton', (theme: Theme) => ({
|
|
26
|
+
skeleton: (_props: SkeletonDynamicProps) => ({
|
|
41
27
|
backgroundColor: theme.colors.surface.tertiary,
|
|
42
28
|
overflow: 'hidden' as const,
|
|
43
29
|
variants: {
|
|
44
|
-
shape:
|
|
30
|
+
shape: {
|
|
31
|
+
rectangle: { borderRadius: 0 },
|
|
32
|
+
rounded: { borderRadius: 8 },
|
|
33
|
+
circle: { borderRadius: 9999 },
|
|
34
|
+
},
|
|
45
35
|
animation: {
|
|
46
36
|
pulse: {},
|
|
47
37
|
wave: {},
|
|
48
38
|
none: {},
|
|
49
39
|
},
|
|
50
40
|
},
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
55
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
56
|
-
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
57
|
-
export const skeletonStyles = StyleSheet.create((theme: Theme) => {
|
|
58
|
-
// Apply extensions to main visual elements
|
|
59
|
-
const extended = applyExtensions('Skeleton', theme, {
|
|
60
|
-
skeleton: createSkeletonStyles(theme),
|
|
61
|
-
});
|
|
41
|
+
}),
|
|
62
42
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
flexDirection: 'column',
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
});
|
|
43
|
+
group: (_props: {}) => ({
|
|
44
|
+
display: 'flex' as const,
|
|
45
|
+
flexDirection: 'column' as const,
|
|
46
|
+
}),
|
|
47
|
+
}));
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, Size, Styles} from '@idealyst/theme';
|
|
3
|
+
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildMarginVariants,
|
|
6
|
+
buildMarginVerticalVariants,
|
|
7
|
+
buildMarginHorizontalVariants,
|
|
8
|
+
} from '../utils/buildViewStyleVariants';
|
|
9
|
+
import { SliderIntentVariant } from './types';
|
|
10
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create size variants for track
|
|
14
|
+
*/
|
|
15
|
+
function createTrackSizeVariants(theme: Theme) {
|
|
16
|
+
const variants = {} as Record<Size, Styles>;
|
|
17
|
+
for (const sizeKey in theme.sizes.slider) {
|
|
18
|
+
const size = sizeKey as Size;
|
|
19
|
+
variants[size] = {
|
|
20
|
+
height: theme.sizes.slider[size].trackHeight,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return variants;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get filled track color based on intent
|
|
28
|
+
*/
|
|
29
|
+
function getFilledTrackColor(theme: Theme, intent: SliderIntentVariant) {
|
|
30
|
+
return theme.intents[intent].primary;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create size variants for thumb
|
|
35
|
+
*/
|
|
36
|
+
function createThumbSizeVariants(theme: Theme) {
|
|
37
|
+
return buildSizeVariants(theme, 'slider', (size) => ({
|
|
38
|
+
width: size.thumbSize,
|
|
39
|
+
height: size.thumbSize,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get thumb border color based on intent
|
|
45
|
+
*/
|
|
46
|
+
function getThumbBorderColor(theme: Theme, intent: SliderIntentVariant) {
|
|
47
|
+
return theme.intents[intent].primary;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Create size variants for thumb icon
|
|
52
|
+
*/
|
|
53
|
+
function createThumbIconSizeVariants(theme: Theme) {
|
|
54
|
+
return buildSizeVariants(theme, 'slider', (size) => ({
|
|
55
|
+
width: size.thumbIconSize,
|
|
56
|
+
height: size.thumbIconSize,
|
|
57
|
+
minWidth: size.thumbIconSize,
|
|
58
|
+
maxWidth: size.thumbIconSize,
|
|
59
|
+
minHeight: size.thumbIconSize,
|
|
60
|
+
maxHeight: size.thumbIconSize,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get thumb icon color based on intent
|
|
66
|
+
*/
|
|
67
|
+
function getThumbIconColor(theme: Theme, intent: SliderIntentVariant){
|
|
68
|
+
return theme.intents[intent].primary;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Create size variants for mark
|
|
73
|
+
*/
|
|
74
|
+
function createMarkSizeVariants(theme: Theme) {
|
|
75
|
+
return buildSizeVariants(theme, 'slider', (size) => ({
|
|
76
|
+
height: size.markHeight,
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const createFilledTrackStyles = (theme: Theme) => {
|
|
81
|
+
return ({ intent }: { intent: SliderIntentVariant }) => {
|
|
82
|
+
return {
|
|
83
|
+
position: 'absolute',
|
|
84
|
+
height: '100%',
|
|
85
|
+
borderRadius: 9999,
|
|
86
|
+
top: 0,
|
|
87
|
+
left: 0,
|
|
88
|
+
backgroundColor: getFilledTrackColor(theme, intent),
|
|
89
|
+
} as const;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const createThumbStyles = (theme: Theme) => {
|
|
94
|
+
return ({ intent, disabled }: { intent: SliderIntentVariant, disabled: boolean }) => {
|
|
95
|
+
return {
|
|
96
|
+
position: 'absolute',
|
|
97
|
+
backgroundColor: theme.colors.surface.primary,
|
|
98
|
+
borderRadius: 9999,
|
|
99
|
+
borderWidth: 2,
|
|
100
|
+
borderStyle: 'solid',
|
|
101
|
+
borderColor: getThumbBorderColor(theme, intent),
|
|
102
|
+
top: '50%',
|
|
103
|
+
display: 'flex',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
shadowColor: '#000',
|
|
107
|
+
shadowOffset: { width: 0, height: 2 },
|
|
108
|
+
shadowOpacity: 0.2,
|
|
109
|
+
shadowRadius: 4,
|
|
110
|
+
elevation: 2,
|
|
111
|
+
variants: {
|
|
112
|
+
size: createThumbSizeVariants(theme),
|
|
113
|
+
disabled: {
|
|
114
|
+
true: {
|
|
115
|
+
opacity: 0.6,
|
|
116
|
+
_web: {
|
|
117
|
+
cursor: 'not-allowed',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
false: {
|
|
121
|
+
opacity: 1,
|
|
122
|
+
_web: {
|
|
123
|
+
cursor: 'grab',
|
|
124
|
+
_hover: {
|
|
125
|
+
transform: 'translate(-50%, -50%) scale(1.05)',
|
|
126
|
+
},
|
|
127
|
+
_active: {
|
|
128
|
+
cursor: 'grabbing',
|
|
129
|
+
transform: 'translate(-50%, -50%) scale(1.1)',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
_web: {
|
|
136
|
+
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.2)',
|
|
137
|
+
transform: 'translate(-50%, -50%)',
|
|
138
|
+
transition: 'transform 0.15s ease, box-shadow 0.2s ease',
|
|
139
|
+
},
|
|
140
|
+
} as const;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const createThumbIconStyles = (theme: Theme) => {
|
|
145
|
+
return ({ intent }: { intent: SliderIntentVariant }) => {
|
|
146
|
+
return {
|
|
147
|
+
display: 'flex',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
flexShrink: 0,
|
|
151
|
+
color: getThumbIconColor(theme, intent),
|
|
152
|
+
variants: {
|
|
153
|
+
size: createThumbIconSizeVariants(theme),
|
|
154
|
+
},
|
|
155
|
+
} as const;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Container style creator for extension support
|
|
160
|
+
function createContainerStyles(theme: Theme) {
|
|
161
|
+
return () => ({
|
|
162
|
+
gap: 4,
|
|
163
|
+
paddingVertical: 8,
|
|
164
|
+
variants: {
|
|
165
|
+
margin: buildMarginVariants(theme),
|
|
166
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
167
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Track style creator for extension support
|
|
173
|
+
function createTrackStyles(theme: Theme) {
|
|
174
|
+
return () => ({
|
|
175
|
+
backgroundColor: theme.colors.surface.tertiary,
|
|
176
|
+
borderRadius: 9999,
|
|
177
|
+
position: 'relative' as const,
|
|
178
|
+
variants: {
|
|
179
|
+
size: createTrackSizeVariants(theme),
|
|
180
|
+
disabled: {
|
|
181
|
+
true: {
|
|
182
|
+
opacity: 0.5,
|
|
183
|
+
_web: { cursor: 'not-allowed' },
|
|
184
|
+
},
|
|
185
|
+
false: {
|
|
186
|
+
opacity: 1,
|
|
187
|
+
_web: { cursor: 'pointer' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
} as const,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
195
|
+
export const sliderStyles = StyleSheet.create((theme: Theme) => {
|
|
196
|
+
// Apply extensions to main visual elements
|
|
197
|
+
|
|
198
|
+
return applyExtensions('Slider', theme, {container: createContainerStyles(theme),
|
|
199
|
+
track: createTrackStyles(theme),
|
|
200
|
+
filledTrack: createFilledTrackStyles(theme),
|
|
201
|
+
thumb: createThumbStyles(theme),
|
|
202
|
+
thumbIcon: createThumbIconStyles(theme),
|
|
203
|
+
// Additional styles (merged from return)
|
|
204
|
+
// Minor utility styles
|
|
205
|
+
sliderWrapper: {
|
|
206
|
+
position: 'relative',
|
|
207
|
+
paddingVertical: 4,
|
|
208
|
+
},
|
|
209
|
+
thumbActive: {
|
|
210
|
+
_web: {
|
|
211
|
+
transform: 'translate(-50%, -50%) scale(1.1)',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
valueLabel: {
|
|
215
|
+
fontSize: 12,
|
|
216
|
+
fontWeight: '600',
|
|
217
|
+
color: theme.colors.text.primary,
|
|
218
|
+
textAlign: 'center',
|
|
219
|
+
},
|
|
220
|
+
minMaxLabels: {
|
|
221
|
+
flexDirection: 'row',
|
|
222
|
+
justifyContent: 'space-between',
|
|
223
|
+
marginTop: 4,
|
|
224
|
+
},
|
|
225
|
+
minMaxLabel: {
|
|
226
|
+
fontSize: 12,
|
|
227
|
+
color: theme.colors.text.secondary,
|
|
228
|
+
},
|
|
229
|
+
mark: {
|
|
230
|
+
position: 'absolute',
|
|
231
|
+
width: 2,
|
|
232
|
+
backgroundColor: theme.colors.border.secondary,
|
|
233
|
+
top: '50%',
|
|
234
|
+
variants: {
|
|
235
|
+
size: createMarkSizeVariants(theme),
|
|
236
|
+
},
|
|
237
|
+
_web: {
|
|
238
|
+
transform: 'translate(-50%, -50%)',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
marks: {
|
|
242
|
+
position: 'absolute',
|
|
243
|
+
width: '100%',
|
|
244
|
+
height: '100%',
|
|
245
|
+
top: 0,
|
|
246
|
+
left: 0,
|
|
247
|
+
},
|
|
248
|
+
markLabel: {
|
|
249
|
+
position: 'absolute',
|
|
250
|
+
fontSize: 10,
|
|
251
|
+
color: theme.colors.text.secondary,
|
|
252
|
+
top: '100%',
|
|
253
|
+
marginTop: 4,
|
|
254
|
+
_web: {
|
|
255
|
+
transform: 'translateX(-50%)',
|
|
256
|
+
whiteSpace: 'nowrap',
|
|
257
|
+
},
|
|
258
|
+
}});
|
|
259
|
+
});
|