@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles } from '@idealyst/theme';
|
|
3
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
4
|
+
|
|
5
|
+
type SkeletonShape = 'rectangle' | 'rounded' | 'circle';
|
|
6
|
+
type SkeletonAnimation = 'pulse' | 'wave' | 'none';
|
|
7
|
+
|
|
8
|
+
type SkeletonVariants = {
|
|
9
|
+
shape: SkeletonShape;
|
|
10
|
+
animation: SkeletonAnimation;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ExpandedSkeletonStyles = StylesheetStyles<keyof SkeletonVariants>;
|
|
14
|
+
export type ExpandedSkeletonGroupStyles = StylesheetStyles<never>;
|
|
15
|
+
|
|
16
|
+
export type SkeletonStylesheet = {
|
|
17
|
+
skeleton: ExpandedSkeletonStyles;
|
|
18
|
+
group: ExpandedSkeletonGroupStyles;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Create shape variants for skeleton
|
|
23
|
+
*/
|
|
24
|
+
function createShapeVariants(theme: Theme) {
|
|
25
|
+
return {
|
|
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 () => ({
|
|
41
|
+
backgroundColor: theme.colors.surface.tertiary,
|
|
42
|
+
overflow: 'hidden' as const,
|
|
43
|
+
variants: {
|
|
44
|
+
shape: createShapeVariants(theme),
|
|
45
|
+
animation: {
|
|
46
|
+
pulse: {},
|
|
47
|
+
wave: {},
|
|
48
|
+
none: {},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
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
|
+
|
|
60
|
+
return applyExtensions('Skeleton', theme, {skeleton: createSkeletonStyles(theme),
|
|
61
|
+
// Additional styles (merged from return)
|
|
62
|
+
// Minor utility styles (not extended)
|
|
63
|
+
group: {
|
|
64
|
+
display: 'flex',
|
|
65
|
+
flexDirection: 'column',
|
|
66
|
+
}});
|
|
67
|
+
});
|
|
@@ -1,59 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton styles using defineStyle.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } from '@idealyst/theme';
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
animation: SkeletonAnimation;
|
|
10
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
type SkeletonShape = 'rectangle' | 'rounded' | 'circle';
|
|
15
|
+
type SkeletonAnimation = 'pulse' | 'wave' | 'none';
|
|
14
16
|
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
export type SkeletonDynamicProps = {
|
|
18
|
+
shape?: SkeletonShape;
|
|
19
|
+
animation?: SkeletonAnimation;
|
|
20
|
+
};
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
|
-
*
|
|
23
|
+
* Skeleton styles with shape and animation variants.
|
|
22
24
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
rectangle: {
|
|
26
|
-
borderRadius: 0,
|
|
27
|
-
},
|
|
28
|
-
rounded: {
|
|
29
|
-
borderRadius: 8,
|
|
30
|
-
},
|
|
31
|
-
circle: {
|
|
32
|
-
borderRadius: 9999,
|
|
33
|
-
},
|
|
34
|
-
} as const;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
38
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
39
|
-
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
40
|
-
export const skeletonStyles = StyleSheet.create((theme: Theme) => {
|
|
41
|
-
return {
|
|
42
|
-
skeleton: {
|
|
25
|
+
export const skeletonStyles = defineStyle('Skeleton', (theme: Theme) => ({
|
|
26
|
+
skeleton: (_props: SkeletonDynamicProps) => ({
|
|
43
27
|
backgroundColor: theme.colors.surface.tertiary,
|
|
44
|
-
overflow: 'hidden',
|
|
28
|
+
overflow: 'hidden' as const,
|
|
45
29
|
variants: {
|
|
46
|
-
shape:
|
|
30
|
+
shape: {
|
|
31
|
+
rectangle: { borderRadius: 0 },
|
|
32
|
+
rounded: { borderRadius: 8 },
|
|
33
|
+
circle: { borderRadius: 9999 },
|
|
34
|
+
},
|
|
47
35
|
animation: {
|
|
48
36
|
pulse: {},
|
|
49
37
|
wave: {},
|
|
50
38
|
none: {},
|
|
51
39
|
},
|
|
52
40
|
},
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
41
|
+
}),
|
|
42
|
+
|
|
43
|
+
group: (_props: {}) => ({
|
|
44
|
+
display: 'flex' as const,
|
|
45
|
+
flexDirection: 'column' as const,
|
|
46
|
+
}),
|
|
47
|
+
}));
|
|
@@ -193,7 +193,7 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
193
193
|
if (!icon) return null;
|
|
194
194
|
|
|
195
195
|
if (typeof icon === 'string' && isIconName(icon)) {
|
|
196
|
-
const iconStyle = sliderStyles.thumbIcon({ intent });
|
|
196
|
+
const iconStyle = (sliderStyles.thumbIcon as any)({ intent });
|
|
197
197
|
return (
|
|
198
198
|
<MaterialCommunityIcons
|
|
199
199
|
name={icon}
|
|
@@ -206,8 +206,12 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
206
206
|
return icon;
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
// Get dynamic styles
|
|
210
|
+
const containerStyle = (sliderStyles.container as any)({});
|
|
211
|
+
const trackStyle = (sliderStyles.track as any)({});
|
|
212
|
+
|
|
209
213
|
return (
|
|
210
|
-
<View ref={ref} nativeID={id} style={[
|
|
214
|
+
<View ref={ref} nativeID={id} style={[containerStyle, style]} testID={testID} {...nativeA11yProps}>
|
|
211
215
|
{showValue && (
|
|
212
216
|
<View style={sliderStyles.valueLabel as any}>
|
|
213
217
|
<Text>{value}</Text>
|
|
@@ -217,7 +221,7 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
217
221
|
<View style={sliderStyles.sliderWrapper}>
|
|
218
222
|
<GestureDetector gesture={composedGesture}>
|
|
219
223
|
<View
|
|
220
|
-
style={
|
|
224
|
+
style={trackStyle}
|
|
221
225
|
onLayout={(e) => {
|
|
222
226
|
const width = e.nativeEvent.layout.width;
|
|
223
227
|
trackWidth.value = width;
|
|
@@ -226,7 +230,7 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
226
230
|
>
|
|
227
231
|
{/* Filled track */}
|
|
228
232
|
<Animated.View
|
|
229
|
-
style={[sliderStyles.filledTrack({ intent }), filledTrackAnimatedStyle]}
|
|
233
|
+
style={[(sliderStyles.filledTrack as any)({ intent }), filledTrackAnimatedStyle]}
|
|
230
234
|
/>
|
|
231
235
|
|
|
232
236
|
{/* Marks */}
|
|
@@ -262,7 +266,7 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
262
266
|
{/* Thumb */}
|
|
263
267
|
<Animated.View
|
|
264
268
|
style={[
|
|
265
|
-
sliderStyles.thumb({ intent, disabled }),
|
|
269
|
+
(sliderStyles.thumb as any)({ intent, disabled }),
|
|
266
270
|
{
|
|
267
271
|
// Manual positioning/sizing for native layout
|
|
268
272
|
position: 'absolute',
|
|
@@ -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
|
+
});
|