@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
package/src/Icon/Icon.styles.tsx
CHANGED
|
@@ -1,79 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon styles using defineStyle with dynamic functions.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper, getColorFromString } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme, Intent, Color } from '@idealyst/theme';
|
|
4
7
|
import { IconSizeVariant } from './types';
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
10
|
+
void StyleSheet;
|
|
11
|
+
|
|
12
|
+
// Wrap theme for $iterator support
|
|
13
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
14
|
+
|
|
15
|
+
export type IconVariants = {
|
|
7
16
|
size: IconSizeVariant;
|
|
8
17
|
intent?: Intent;
|
|
9
18
|
color?: Color;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type ExpandedIconStyles = StylesheetStyles<keyof IconVariants>;
|
|
19
|
+
};
|
|
13
20
|
|
|
14
|
-
export type
|
|
15
|
-
icon: ExpandedIconStyles;
|
|
16
|
-
}
|
|
21
|
+
export type IconDynamicProps = Partial<IconVariants>;
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
24
|
+
* Icon styles with dynamic color/size handling.
|
|
20
25
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
return theme.colors.text.primary;
|
|
28
|
-
}
|
|
26
|
+
export const iconStyles = defineStyle('Icon', (theme: Theme) => ({
|
|
27
|
+
icon: ({ color, intent, size = 'md' }: IconDynamicProps) => {
|
|
28
|
+
// Handle size - can be a named size or number
|
|
29
|
+
let iconWidth: number;
|
|
30
|
+
let iconHeight: number;
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
if (typeof size === 'number') {
|
|
33
|
+
iconWidth = size;
|
|
34
|
+
iconHeight = size;
|
|
35
|
+
} else {
|
|
36
|
+
const sizeKey = size || 'md';
|
|
37
|
+
const iconSize = theme.sizes.icon[sizeKey];
|
|
38
|
+
if (typeof iconSize === 'number') {
|
|
39
|
+
iconWidth = iconSize;
|
|
40
|
+
iconHeight = iconSize;
|
|
41
|
+
} else {
|
|
42
|
+
iconWidth = (iconSize?.width as number) ?? 24;
|
|
43
|
+
iconHeight = (iconSize?.height as number) ?? 24;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
// Get color - intent takes priority, then color prop, then default
|
|
48
|
+
const iconColor = intent
|
|
49
|
+
? theme.intents[intent]?.primary
|
|
50
|
+
: color
|
|
51
|
+
? getColorFromString(theme as unknown as BaseTheme, color)
|
|
52
|
+
: theme.colors.text.primary;
|
|
42
53
|
|
|
43
|
-
if (typeof iconSize === 'number') {
|
|
44
54
|
return {
|
|
45
|
-
width:
|
|
46
|
-
height:
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return buildSizeVariants(theme, 'icon', (size) => ({
|
|
51
|
-
width: size.width,
|
|
52
|
-
height: size.height,
|
|
53
|
-
}))[sizeKey];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function createIconStyles(theme: Theme) {
|
|
57
|
-
return ({ color, intent, size }: Partial<IconVariants>) => {
|
|
58
|
-
const iconSize = buildIconSize(theme, size);
|
|
59
|
-
return {
|
|
60
|
-
width: iconSize.width,
|
|
61
|
-
height: iconSize.height,
|
|
62
|
-
color: getIconColor(theme, color, intent),
|
|
55
|
+
width: iconWidth,
|
|
56
|
+
height: iconHeight,
|
|
57
|
+
color: iconColor,
|
|
63
58
|
_web: {
|
|
64
|
-
|
|
59
|
+
fontSize: iconWidth,
|
|
60
|
+
width: '1em',
|
|
61
|
+
height: '1em',
|
|
62
|
+
display: 'inline-flex',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'center',
|
|
65
65
|
verticalAlign: 'middle',
|
|
66
66
|
flexShrink: 0,
|
|
67
|
-
lineHeight:
|
|
67
|
+
lineHeight: 1,
|
|
68
68
|
},
|
|
69
69
|
} as const;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
74
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
75
|
-
export const iconStyles = StyleSheet.create((theme: Theme) => {
|
|
76
|
-
return {
|
|
77
|
-
icon: createIconStyles(theme),
|
|
78
|
-
} as const;
|
|
79
|
-
});
|
|
70
|
+
},
|
|
71
|
+
}));
|
package/src/Icon/Icon.web.tsx
CHANGED
|
@@ -3,14 +3,16 @@ import MdiIcon from '@mdi/react';
|
|
|
3
3
|
import { IconProps } from './types';
|
|
4
4
|
import { iconStyles } from './Icon.styles';
|
|
5
5
|
import { getWebProps } from 'react-native-unistyles/web';
|
|
6
|
+
import { useUnistyles } from 'react-native-unistyles';
|
|
6
7
|
import useMergeRefs from '../hooks/useMergeRefs';
|
|
8
|
+
import { getColorFromString, Intent, Color } from '@idealyst/theme';
|
|
7
9
|
|
|
8
10
|
// Internal props that include the transformed path from Babel plugin
|
|
9
11
|
interface InternalIconProps extends IconProps {
|
|
10
12
|
path?: string; // Added by Babel plugin transformation
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
const Icon = forwardRef<
|
|
15
|
+
const Icon = forwardRef<HTMLSpanElement, IconProps>((props: InternalIconProps, ref) => {
|
|
14
16
|
const {
|
|
15
17
|
name,
|
|
16
18
|
size = 'md',
|
|
@@ -23,26 +25,60 @@ const Icon = forwardRef<HTMLDivElement, IconProps>((props: InternalIconProps, re
|
|
|
23
25
|
...restProps
|
|
24
26
|
} = props;
|
|
25
27
|
|
|
28
|
+
const { theme } = useUnistyles();
|
|
29
|
+
|
|
26
30
|
// Check if we have a path prop (from Babel plugin transformation)
|
|
27
31
|
const { path } = restProps as { path?: string };
|
|
28
|
-
|
|
32
|
+
|
|
33
|
+
// Compute size from theme
|
|
34
|
+
let iconSize: number;
|
|
35
|
+
if (typeof size === 'number') {
|
|
36
|
+
iconSize = size;
|
|
37
|
+
} else {
|
|
38
|
+
const themeSize = theme.sizes.icon[size as keyof typeof theme.sizes.icon];
|
|
39
|
+
iconSize = typeof themeSize === 'number' ? themeSize : (themeSize?.width ?? 24);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Compute color from intent or color prop or default
|
|
43
|
+
const iconColor = intent
|
|
44
|
+
? theme.intents[intent as Intent]?.primary
|
|
45
|
+
: color
|
|
46
|
+
? getColorFromString(theme, color as Color)
|
|
47
|
+
: theme.colors.text.primary;
|
|
48
|
+
|
|
49
|
+
// Use getWebProps for className generation but override with computed values
|
|
50
|
+
const iconStyle = (iconStyles.icon as any)({ intent, color, size });
|
|
51
|
+
const iconProps = getWebProps([iconStyle, style]);
|
|
29
52
|
|
|
30
53
|
const mergedRef = useMergeRefs(ref, iconProps.ref);
|
|
31
54
|
|
|
32
55
|
// Use MDI React icon when path is provided (transformed by Babel plugin)
|
|
33
56
|
return (
|
|
34
|
-
<
|
|
57
|
+
<span
|
|
35
58
|
{...iconProps}
|
|
36
59
|
ref={mergedRef}
|
|
37
|
-
id={id}
|
|
60
|
+
id={id}
|
|
61
|
+
style={{
|
|
62
|
+
...iconProps.style,
|
|
63
|
+
fontSize: iconSize,
|
|
64
|
+
width: '1em',
|
|
65
|
+
height: '1em',
|
|
66
|
+
display: 'inline-flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
flexShrink: 0,
|
|
70
|
+
lineHeight: 1,
|
|
71
|
+
color: iconColor,
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
38
74
|
<MdiIcon
|
|
39
75
|
path={path}
|
|
40
|
-
size=
|
|
41
|
-
color=
|
|
76
|
+
size="1em"
|
|
77
|
+
color="currentColor"
|
|
42
78
|
data-testid={testID}
|
|
43
79
|
aria-label={accessibilityLabel || name}
|
|
44
80
|
/>
|
|
45
|
-
</
|
|
81
|
+
</span>
|
|
46
82
|
);
|
|
47
83
|
});
|
|
48
84
|
|
|
@@ -19,6 +19,7 @@ interface IconSvgProps {
|
|
|
19
19
|
|
|
20
20
|
export const IconSvg: React.FC<IconSvgProps> = ({
|
|
21
21
|
path,
|
|
22
|
+
size = '1em',
|
|
22
23
|
color = 'currentColor',
|
|
23
24
|
style,
|
|
24
25
|
'aria-label': ariaLabel,
|
|
@@ -29,6 +30,7 @@ export const IconSvg: React.FC<IconSvgProps> = ({
|
|
|
29
30
|
<MdiIcon
|
|
30
31
|
style={style}
|
|
31
32
|
path={path}
|
|
33
|
+
size={size}
|
|
32
34
|
color={color}
|
|
33
35
|
aria-label={ariaLabel}
|
|
34
36
|
data-testid={testID}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles} from '@idealyst/theme';
|
|
3
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
4
|
+
|
|
5
|
+
type ImageVariants = {}
|
|
6
|
+
|
|
7
|
+
export type ExpandedImageStyles = StylesheetStyles<keyof ImageVariants>;
|
|
8
|
+
|
|
9
|
+
export type ImageStylesheet = {
|
|
10
|
+
container: ExpandedImageStyles;
|
|
11
|
+
image: ExpandedImageStyles;
|
|
12
|
+
placeholder: ExpandedImageStyles;
|
|
13
|
+
fallback: ExpandedImageStyles;
|
|
14
|
+
loadingIndicator: ExpandedImageStyles;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Style creators for extension support
|
|
18
|
+
function createContainerStyles(theme: Theme) {
|
|
19
|
+
return () => ({
|
|
20
|
+
position: 'relative' as const,
|
|
21
|
+
overflow: 'hidden' as const,
|
|
22
|
+
backgroundColor: theme.colors['gray.200'],
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function createImageStyles() {
|
|
27
|
+
return () => ({
|
|
28
|
+
width: '100%' as const,
|
|
29
|
+
height: '100%' as const,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
34
|
+
// transform on native cannot resolve function calls to extract variant structures.
|
|
35
|
+
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
36
|
+
export const imageStyles = StyleSheet.create((theme: Theme) => {
|
|
37
|
+
// Apply extensions to main visual elements
|
|
38
|
+
|
|
39
|
+
return applyExtensions('Image', theme, {container: createContainerStyles(theme),
|
|
40
|
+
image: createImageStyles(),
|
|
41
|
+
// Additional styles (merged from return)
|
|
42
|
+
// Minor utility styles (not extended)
|
|
43
|
+
placeholder: {
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
top: 0,
|
|
46
|
+
left: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
backgroundColor: theme.colors['gray.200'],
|
|
53
|
+
},
|
|
54
|
+
fallback: {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
top: 0,
|
|
57
|
+
left: 0,
|
|
58
|
+
right: 0,
|
|
59
|
+
bottom: 0,
|
|
60
|
+
display: 'flex',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
backgroundColor: theme.colors['gray.300'],
|
|
64
|
+
color: theme.colors['gray.600'],
|
|
65
|
+
},
|
|
66
|
+
loadingIndicator: {
|
|
67
|
+
color: theme.colors['gray.600'],
|
|
68
|
+
}});
|
|
69
|
+
});
|
|
@@ -1,57 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image styles using defineStyle.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
container: {
|
|
22
|
-
position: 'relative',
|
|
23
|
-
overflow: 'hidden',
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } from '@idealyst/theme';
|
|
7
|
+
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
10
|
+
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
13
|
+
|
|
14
|
+
export type ImageDynamicProps = {};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Image styles - simple container and image styles.
|
|
18
|
+
*/
|
|
19
|
+
export const imageStyles = defineStyle('Image', (theme: Theme) => ({
|
|
20
|
+
container: (_props: ImageDynamicProps) => ({
|
|
21
|
+
position: 'relative' as const,
|
|
22
|
+
overflow: 'hidden' as const,
|
|
24
23
|
backgroundColor: theme.colors['gray.200'],
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
image: (_props: ImageDynamicProps) => ({
|
|
27
|
+
width: '100%' as const,
|
|
28
|
+
height: '100%' as const,
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
placeholder: (_props: ImageDynamicProps) => ({
|
|
32
|
+
position: 'absolute' as const,
|
|
32
33
|
top: 0,
|
|
33
34
|
left: 0,
|
|
34
35
|
right: 0,
|
|
35
36
|
bottom: 0,
|
|
36
|
-
display: 'flex',
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
justifyContent: 'center',
|
|
37
|
+
display: 'flex' as const,
|
|
38
|
+
alignItems: 'center' as const,
|
|
39
|
+
justifyContent: 'center' as const,
|
|
39
40
|
backgroundColor: theme.colors['gray.200'],
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
}),
|
|
42
|
+
|
|
43
|
+
fallback: (_props: ImageDynamicProps) => ({
|
|
44
|
+
position: 'absolute' as const,
|
|
43
45
|
top: 0,
|
|
44
46
|
left: 0,
|
|
45
47
|
right: 0,
|
|
46
48
|
bottom: 0,
|
|
47
|
-
display: 'flex',
|
|
48
|
-
alignItems: 'center',
|
|
49
|
-
justifyContent: 'center',
|
|
49
|
+
display: 'flex' as const,
|
|
50
|
+
alignItems: 'center' as const,
|
|
51
|
+
justifyContent: 'center' as const,
|
|
50
52
|
backgroundColor: theme.colors['gray.300'],
|
|
51
53
|
color: theme.colors['gray.600'],
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
loadingIndicator: (_props: ImageDynamicProps) => ({
|
|
54
57
|
color: theme.colors['gray.600'],
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
+
}),
|
|
59
|
+
}));
|