@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
|
@@ -1,51 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActivityIndicator styles using defineStyle with $iterator expansion.
|
|
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, Intent, Size } 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
|
-
intent: ActivityIndicatorIntent;
|
|
11
|
-
animating: boolean;
|
|
12
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type ActivityIndicatorDynamicProps = {
|
|
15
|
+
size?: Size;
|
|
16
|
+
intent?: Intent;
|
|
17
|
+
animating?: boolean;
|
|
18
|
+
};
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
20
|
+
/**
|
|
21
|
+
* ActivityIndicator styles with size and intent handling.
|
|
22
|
+
*/
|
|
23
|
+
export const activityIndicatorStyles = defineStyle('ActivityIndicator', (theme: Theme) => ({
|
|
24
|
+
container: (_props: ActivityIndicatorDynamicProps) => ({
|
|
25
|
+
alignItems: 'center' as const,
|
|
26
|
+
justifyContent: 'center' as const,
|
|
27
|
+
variants: {
|
|
28
|
+
// $iterator expands for each activityIndicator size
|
|
29
|
+
size: {
|
|
30
|
+
width: theme.sizes.$activityIndicator.size,
|
|
31
|
+
height: theme.sizes.$activityIndicator.size,
|
|
32
|
+
},
|
|
33
|
+
animating: {
|
|
34
|
+
true: { opacity: 1 },
|
|
35
|
+
false: { opacity: 0 },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
spinner: ({ intent = 'primary' }: ActivityIndicatorDynamicProps) => {
|
|
41
|
+
// Inline color access for Unistyles to trace
|
|
42
|
+
const color = theme.intents[intent].primary;
|
|
39
43
|
|
|
40
|
-
function createSpinnerStyles(theme: Theme) {
|
|
41
|
-
return ({ intent }: Partial<ActivityIndicatorVariants>) => {
|
|
42
|
-
const color = getSpinnerColor(theme, intent);
|
|
43
44
|
return {
|
|
44
45
|
borderRadius: 9999,
|
|
45
|
-
borderStyle: 'solid',
|
|
46
|
+
borderStyle: 'solid' as const,
|
|
46
47
|
color,
|
|
47
48
|
variants: {
|
|
48
|
-
size:
|
|
49
|
+
size: {
|
|
50
|
+
width: theme.sizes.$activityIndicator.size,
|
|
51
|
+
height: theme.sizes.$activityIndicator.size,
|
|
52
|
+
borderWidth: theme.sizes.$activityIndicator.borderWidth,
|
|
53
|
+
},
|
|
49
54
|
animating: {
|
|
50
55
|
true: {},
|
|
51
56
|
false: {},
|
|
@@ -59,29 +64,5 @@ function createSpinnerStyles(theme: Theme) {
|
|
|
59
64
|
boxSizing: 'border-box',
|
|
60
65
|
},
|
|
61
66
|
} as const;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
66
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
67
|
-
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
68
|
-
export const activityIndicatorStyles = StyleSheet.create((theme: Theme) => {
|
|
69
|
-
return {
|
|
70
|
-
container: {
|
|
71
|
-
alignItems: 'center',
|
|
72
|
-
justifyContent: 'center',
|
|
73
|
-
variants: {
|
|
74
|
-
size: createContainerSizeVariants(theme),
|
|
75
|
-
animating: {
|
|
76
|
-
true: {
|
|
77
|
-
opacity: 1,
|
|
78
|
-
},
|
|
79
|
-
false: {
|
|
80
|
-
opacity: 0,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
67
|
},
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
});
|
|
68
|
+
}));
|
|
@@ -48,7 +48,7 @@ const ActivityIndicator = forwardRef<HTMLDivElement, ActivityIndicatorProps>(({
|
|
|
48
48
|
|
|
49
49
|
// Create the style array following the official documentation pattern
|
|
50
50
|
const containerStyleArray = [
|
|
51
|
-
activityIndicatorStyles.container,
|
|
51
|
+
(activityIndicatorStyles.container as any)({}),
|
|
52
52
|
customSize && {
|
|
53
53
|
width: customSize,
|
|
54
54
|
height: customSize,
|
|
@@ -57,7 +57,7 @@ const ActivityIndicator = forwardRef<HTMLDivElement, ActivityIndicatorProps>(({
|
|
|
57
57
|
];
|
|
58
58
|
|
|
59
59
|
const spinnerStyleArray = [
|
|
60
|
-
activityIndicatorStyles.spinner({
|
|
60
|
+
(activityIndicatorStyles.spinner as any)({
|
|
61
61
|
intent,
|
|
62
62
|
}),
|
|
63
63
|
customSize ? {
|
|
@@ -30,11 +30,16 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
30
30
|
testID,
|
|
31
31
|
id,
|
|
32
32
|
}, ref) => {
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
// Call all styles as functions to get theme-reactive styles
|
|
34
|
+
const dynamicProps = { intent, type };
|
|
35
|
+
const containerStyle = (alertStyles.container as any)(dynamicProps);
|
|
36
|
+
const iconContainerStyle = (alertStyles.iconContainer as any)(dynamicProps);
|
|
37
|
+
const titleStyle = (alertStyles.title as any)(dynamicProps);
|
|
38
|
+
const messageStyle = (alertStyles.message as any)(dynamicProps);
|
|
39
|
+
const contentStyle = (alertStyles.content as any)({});
|
|
40
|
+
const actionsStyle = (alertStyles.actions as any)({});
|
|
41
|
+
const closeButtonStyle = (alertStyles.closeButton as any)({});
|
|
42
|
+
const closeIconStyle = (alertStyles.closeIcon as any)(dynamicProps);
|
|
38
43
|
|
|
39
44
|
const displayIcon = icon !== undefined ? icon : (showIcon ? defaultIcons[intent] : null);
|
|
40
45
|
|
|
@@ -47,7 +52,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
47
52
|
<MaterialCommunityIcons
|
|
48
53
|
name={displayIcon}
|
|
49
54
|
size={20}
|
|
50
|
-
style={
|
|
55
|
+
style={iconContainerStyle}
|
|
51
56
|
/>
|
|
52
57
|
);
|
|
53
58
|
} else if (isValidElement(displayIcon)) {
|
|
@@ -60,33 +65,39 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
60
65
|
<View
|
|
61
66
|
ref={ref}
|
|
62
67
|
nativeID={id}
|
|
63
|
-
style={[
|
|
68
|
+
style={[containerStyle, style]}
|
|
64
69
|
testID={testID}
|
|
65
70
|
accessibilityRole="alert"
|
|
66
71
|
>
|
|
67
72
|
{displayIcon && (
|
|
68
|
-
<View style={
|
|
73
|
+
<View style={iconContainerStyle}>
|
|
69
74
|
{renderIcon()}
|
|
70
75
|
</View>
|
|
71
76
|
)}
|
|
72
77
|
|
|
73
|
-
<View style={
|
|
78
|
+
<View style={contentStyle}>
|
|
74
79
|
{title && (
|
|
75
|
-
<Text style={
|
|
80
|
+
<Text style={titleStyle}>
|
|
76
81
|
{title}
|
|
77
82
|
</Text>
|
|
78
83
|
)}
|
|
79
84
|
|
|
80
85
|
{message && (
|
|
81
|
-
<Text style={
|
|
86
|
+
<Text style={messageStyle}>
|
|
82
87
|
{message}
|
|
83
88
|
</Text>
|
|
84
89
|
)}
|
|
85
90
|
|
|
86
|
-
{children
|
|
91
|
+
{children && (
|
|
92
|
+
typeof children === 'string' ? (
|
|
93
|
+
<Text style={messageStyle}>{children}</Text>
|
|
94
|
+
) : (
|
|
95
|
+
children
|
|
96
|
+
)
|
|
97
|
+
)}
|
|
87
98
|
|
|
88
99
|
{actions && (
|
|
89
|
-
<View style={
|
|
100
|
+
<View style={actionsStyle}>
|
|
90
101
|
{actions}
|
|
91
102
|
</View>
|
|
92
103
|
)}
|
|
@@ -94,7 +105,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
94
105
|
|
|
95
106
|
{dismissible && onDismiss && (
|
|
96
107
|
<TouchableOpacity
|
|
97
|
-
style={
|
|
108
|
+
style={closeButtonStyle}
|
|
98
109
|
onPress={onDismiss}
|
|
99
110
|
accessibilityLabel="Dismiss alert"
|
|
100
111
|
accessibilityRole="button"
|
|
@@ -102,7 +113,7 @@ const Alert = forwardRef<ComponentRef<typeof View>, AlertProps>(({
|
|
|
102
113
|
<MaterialCommunityIcons
|
|
103
114
|
name="close"
|
|
104
115
|
size={16}
|
|
105
|
-
style={
|
|
116
|
+
style={closeIconStyle}
|
|
106
117
|
/>
|
|
107
118
|
</TouchableOpacity>
|
|
108
119
|
)}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, Intent } from '@idealyst/theme';
|
|
3
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
4
|
+
|
|
5
|
+
type AlertType = 'filled' | 'outlined' | 'soft';
|
|
6
|
+
type AlertIntent = Intent;
|
|
7
|
+
|
|
8
|
+
export type AlertVariants = {
|
|
9
|
+
type: AlertType;
|
|
10
|
+
intent: AlertIntent;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type AlertDynamicProps = {
|
|
14
|
+
intent?: AlertIntent;
|
|
15
|
+
type?: AlertType;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get the intent value, mapping 'info' to 'primary' for backwards compatibility
|
|
20
|
+
*/
|
|
21
|
+
function getIntentValue(theme: Theme, intent: AlertIntent) {
|
|
22
|
+
return theme.intents[intent];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get container background color based on intent and type
|
|
27
|
+
*/
|
|
28
|
+
function getContainerBackgroundColor(theme: Theme, intent: AlertIntent, type: AlertType): string {
|
|
29
|
+
const intentValue = getIntentValue(theme, intent);
|
|
30
|
+
if (type === 'filled') {
|
|
31
|
+
return intentValue.primary;
|
|
32
|
+
}
|
|
33
|
+
if (type === 'soft') {
|
|
34
|
+
return intentValue.light;
|
|
35
|
+
}
|
|
36
|
+
return 'transparent'; // outlined
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get container border color based on intent and type
|
|
41
|
+
*/
|
|
42
|
+
function getContainerBorderColor(theme: Theme, intent: AlertIntent, type: AlertType): string {
|
|
43
|
+
const intentValue = getIntentValue(theme, intent);
|
|
44
|
+
if (type === 'filled' || type === 'outlined') {
|
|
45
|
+
return intentValue.primary;
|
|
46
|
+
}
|
|
47
|
+
return intentValue.light; // soft
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Get icon/title color based on intent and type
|
|
52
|
+
*/
|
|
53
|
+
function getIconTitleColor(theme: Theme, intent: AlertIntent, type: AlertType): string {
|
|
54
|
+
const intentValue = getIntentValue(theme, intent);
|
|
55
|
+
if (type === 'filled') {
|
|
56
|
+
return intentValue.contrast;
|
|
57
|
+
}
|
|
58
|
+
return intentValue.primary; // outlined, soft
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get message color based on intent and type
|
|
63
|
+
*/
|
|
64
|
+
function getMessageColor(theme: Theme, intent: AlertIntent, type: AlertType): string {
|
|
65
|
+
const intentValue = getIntentValue(theme, intent);
|
|
66
|
+
if (type === 'filled') {
|
|
67
|
+
return intentValue.contrast;
|
|
68
|
+
}
|
|
69
|
+
return theme.colors.text.primary; // outlined, soft
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Create dynamic container styles
|
|
74
|
+
*/
|
|
75
|
+
function createContainerStyles(theme: Theme) {
|
|
76
|
+
return ({ intent = 'neutral', type = 'soft' }: AlertDynamicProps) => {
|
|
77
|
+
return {
|
|
78
|
+
display: 'flex',
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'flex-start',
|
|
81
|
+
gap: 8,
|
|
82
|
+
padding: 16,
|
|
83
|
+
borderRadius: 8,
|
|
84
|
+
borderWidth: 1,
|
|
85
|
+
borderStyle: 'solid' as const,
|
|
86
|
+
backgroundColor: getContainerBackgroundColor(theme, intent, type),
|
|
87
|
+
borderColor: getContainerBorderColor(theme, intent, type),
|
|
88
|
+
} as const;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Create dynamic icon container styles
|
|
94
|
+
*/
|
|
95
|
+
function createIconContainerStyles(theme: Theme) {
|
|
96
|
+
return ({ intent = 'neutral', type = 'soft' }: AlertDynamicProps) => {
|
|
97
|
+
return {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
justifyContent: 'center',
|
|
101
|
+
flexShrink: 0,
|
|
102
|
+
width: 24,
|
|
103
|
+
height: 24,
|
|
104
|
+
color: getIconTitleColor(theme, intent, type),
|
|
105
|
+
} as const;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Create dynamic title styles
|
|
111
|
+
*/
|
|
112
|
+
function createTitleStyles(theme: Theme) {
|
|
113
|
+
return ({ intent = 'neutral', type = 'soft' }: AlertDynamicProps) => {
|
|
114
|
+
return {
|
|
115
|
+
fontSize: 16,
|
|
116
|
+
lineHeight: 24,
|
|
117
|
+
fontWeight: '600',
|
|
118
|
+
color: getIconTitleColor(theme, intent, type),
|
|
119
|
+
} as const;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Create dynamic message styles
|
|
125
|
+
*/
|
|
126
|
+
function createMessageStyles(theme: Theme) {
|
|
127
|
+
return ({ intent = 'neutral', type = 'soft' }: AlertDynamicProps) => {
|
|
128
|
+
return {
|
|
129
|
+
fontSize: 14,
|
|
130
|
+
lineHeight: 20,
|
|
131
|
+
color: getMessageColor(theme, intent, type),
|
|
132
|
+
} as const;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Create content styles
|
|
138
|
+
*/
|
|
139
|
+
function createContentStyles() {
|
|
140
|
+
return () => ({
|
|
141
|
+
flex: 1,
|
|
142
|
+
display: 'flex' as const,
|
|
143
|
+
flexDirection: 'column' as const,
|
|
144
|
+
gap: 4,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Create actions styles
|
|
150
|
+
*/
|
|
151
|
+
function createActionsStyles() {
|
|
152
|
+
return () => ({
|
|
153
|
+
marginTop: 4,
|
|
154
|
+
display: 'flex' as const,
|
|
155
|
+
flexDirection: 'row' as const,
|
|
156
|
+
gap: 8,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Create close button styles
|
|
162
|
+
*/
|
|
163
|
+
function createCloseButtonStyles() {
|
|
164
|
+
return () => ({
|
|
165
|
+
padding: 4,
|
|
166
|
+
backgroundColor: 'transparent',
|
|
167
|
+
borderRadius: 4,
|
|
168
|
+
display: 'flex' as const,
|
|
169
|
+
alignItems: 'center' as const,
|
|
170
|
+
justifyContent: 'center' as const,
|
|
171
|
+
flexShrink: 0,
|
|
172
|
+
_web: {
|
|
173
|
+
border: 'none',
|
|
174
|
+
cursor: 'pointer',
|
|
175
|
+
outline: 'none',
|
|
176
|
+
_hover: {
|
|
177
|
+
backgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Create close icon styles
|
|
185
|
+
*/
|
|
186
|
+
function createCloseIconStyles() {
|
|
187
|
+
return () => ({
|
|
188
|
+
display: 'flex' as const,
|
|
189
|
+
alignItems: 'center' as const,
|
|
190
|
+
justifyContent: 'center' as const,
|
|
191
|
+
width: 16,
|
|
192
|
+
height: 16,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export const alertStyles = StyleSheet.create((theme: Theme) => {
|
|
197
|
+
// Apply extensions to main visual elements
|
|
198
|
+
|
|
199
|
+
return applyExtensions('Alert', theme, {container: createContainerStyles(theme),
|
|
200
|
+
iconContainer: createIconContainerStyles(theme),
|
|
201
|
+
title: createTitleStyles(theme),
|
|
202
|
+
message: createMessageStyles(theme),
|
|
203
|
+
// Additional styles (merged from return)
|
|
204
|
+
// Minor utility styles (not extended)
|
|
205
|
+
content: createContentStyles()(),
|
|
206
|
+
actions: createActionsStyles()(),
|
|
207
|
+
closeButton: createCloseButtonStyles()(),
|
|
208
|
+
closeIcon: createCloseIconStyles()()});
|
|
209
|
+
});
|