@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/Chip/Chip.styles.tsx
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chip styles using defineStyle with dynamic size/intent/type/selected handling.
|
|
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';
|
|
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>;
|
|
4
13
|
|
|
5
|
-
type ChipSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
14
|
type ChipType = 'filled' | 'outlined' | 'soft';
|
|
7
|
-
type ChipIntent = Intent;
|
|
8
15
|
|
|
9
|
-
type ChipDynamicProps = {
|
|
10
|
-
size
|
|
11
|
-
intent
|
|
12
|
-
type
|
|
13
|
-
selected
|
|
16
|
+
export type ChipDynamicProps = {
|
|
17
|
+
size?: Size;
|
|
18
|
+
intent?: Intent;
|
|
19
|
+
type?: ChipType;
|
|
20
|
+
selected?: boolean;
|
|
14
21
|
disabled?: boolean;
|
|
15
22
|
};
|
|
16
23
|
|
|
17
|
-
type ChipDeleteButtonProps = {
|
|
18
|
-
size: ChipSize;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
25
|
+
* Chip styles with size/intent/type/selected handling.
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
export const chipStyles = defineStyle('Chip', (theme: Theme) => ({
|
|
28
|
+
container: ({ size = 'md', intent = 'primary', type = 'filled', selected = false, disabled = false }: ChipDynamicProps) => {
|
|
26
29
|
const intentValue = theme.intents[intent];
|
|
27
30
|
const sizeValue = theme.sizes.chip[size];
|
|
28
31
|
|
|
@@ -61,20 +64,14 @@ function createContainerStyles(theme: Theme) {
|
|
|
61
64
|
borderStyle: borderWidth > 0 ? ('solid' as const) : undefined,
|
|
62
65
|
opacity: disabled ? 0.5 : 1,
|
|
63
66
|
} as const;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
67
|
+
},
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
* Create label styles
|
|
69
|
-
*/
|
|
70
|
-
function createLabelStyles(theme: Theme) {
|
|
71
|
-
return ({ size, intent, type, selected }: ChipDynamicProps) => {
|
|
69
|
+
label: ({ size = 'md', intent = 'primary', type = 'filled', selected = false }: ChipDynamicProps) => {
|
|
72
70
|
const intentValue = theme.intents[intent];
|
|
73
71
|
const sizeValue = theme.sizes.chip[size];
|
|
74
72
|
|
|
75
73
|
// Compute color based on type and selected state
|
|
76
74
|
let color: string;
|
|
77
|
-
|
|
78
75
|
if (type === 'filled') {
|
|
79
76
|
color = selected ? intentValue.primary : intentValue.contrast;
|
|
80
77
|
} else if (type === 'outlined') {
|
|
@@ -84,31 +81,25 @@ function createLabelStyles(theme: Theme) {
|
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
return {
|
|
87
|
-
fontFamily: 'inherit',
|
|
84
|
+
fontFamily: 'inherit' as const,
|
|
88
85
|
fontWeight: '500' as const,
|
|
89
86
|
fontSize: sizeValue.fontSize as number,
|
|
90
87
|
lineHeight: sizeValue.lineHeight as number,
|
|
91
88
|
color,
|
|
92
89
|
} as const;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
90
|
+
},
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
* Create icon styles
|
|
98
|
-
*/
|
|
99
|
-
function createIconStyles(theme: Theme) {
|
|
100
|
-
return ({ size, intent, type, selected }: ChipDynamicProps) => {
|
|
92
|
+
icon: ({ size = 'md', intent = 'primary', type = 'filled', selected = false }: ChipDynamicProps) => {
|
|
101
93
|
const intentValue = theme.intents[intent];
|
|
102
94
|
const sizeValue = theme.sizes.chip[size];
|
|
103
95
|
|
|
104
|
-
//
|
|
96
|
+
// Same color logic as label
|
|
105
97
|
let color: string;
|
|
106
|
-
|
|
107
98
|
if (type === 'filled') {
|
|
108
99
|
color = selected ? intentValue.primary : intentValue.contrast;
|
|
109
100
|
} else if (type === 'outlined') {
|
|
110
101
|
color = selected ? theme.colors.text.inverse : intentValue.primary;
|
|
111
|
-
} else {
|
|
102
|
+
} else {
|
|
112
103
|
color = selected ? theme.colors.text.inverse : intentValue.dark;
|
|
113
104
|
}
|
|
114
105
|
|
|
@@ -120,14 +111,9 @@ function createIconStyles(theme: Theme) {
|
|
|
120
111
|
height: sizeValue.iconSize as number,
|
|
121
112
|
color,
|
|
122
113
|
} as const;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
114
|
+
},
|
|
125
115
|
|
|
126
|
-
|
|
127
|
-
* Create delete button styles
|
|
128
|
-
*/
|
|
129
|
-
function createDeleteButtonStyles(theme: Theme) {
|
|
130
|
-
return ({ size }: ChipDeleteButtonProps) => {
|
|
116
|
+
deleteButton: ({ size = 'md' }: ChipDynamicProps) => {
|
|
131
117
|
const sizeValue = theme.sizes.chip[size];
|
|
132
118
|
|
|
133
119
|
return {
|
|
@@ -140,25 +126,19 @@ function createDeleteButtonStyles(theme: Theme) {
|
|
|
140
126
|
width: sizeValue.iconSize as number,
|
|
141
127
|
height: sizeValue.iconSize as number,
|
|
142
128
|
} as const;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
129
|
+
},
|
|
145
130
|
|
|
146
|
-
|
|
147
|
-
* Create delete icon styles
|
|
148
|
-
*/
|
|
149
|
-
function createDeleteIconStyles(theme: Theme) {
|
|
150
|
-
return ({ size, intent, type, selected }: ChipDynamicProps) => {
|
|
131
|
+
deleteIcon: ({ size = 'md', intent = 'primary', type = 'filled', selected = false }: ChipDynamicProps) => {
|
|
151
132
|
const intentValue = theme.intents[intent];
|
|
152
133
|
const sizeValue = theme.sizes.chip[size];
|
|
153
134
|
|
|
154
|
-
//
|
|
135
|
+
// Same color logic as label/icon
|
|
155
136
|
let color: string;
|
|
156
|
-
|
|
157
137
|
if (type === 'filled') {
|
|
158
138
|
color = selected ? intentValue.primary : intentValue.contrast;
|
|
159
139
|
} else if (type === 'outlined') {
|
|
160
140
|
color = selected ? theme.colors.text.inverse : intentValue.primary;
|
|
161
|
-
} else {
|
|
141
|
+
} else {
|
|
162
142
|
color = selected ? theme.colors.text.inverse : intentValue.dark;
|
|
163
143
|
}
|
|
164
144
|
|
|
@@ -166,23 +146,5 @@ function createDeleteIconStyles(theme: Theme) {
|
|
|
166
146
|
fontSize: sizeValue.iconSize as number,
|
|
167
147
|
color,
|
|
168
148
|
} as const;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
173
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
174
|
-
export const chipStyles = StyleSheet.create((theme: Theme) => {
|
|
175
|
-
// Apply extensions to main visual elements
|
|
176
|
-
const extended = applyExtensions('Chip', theme, {
|
|
177
|
-
container: createContainerStyles(theme),
|
|
178
|
-
label: createLabelStyles(theme),
|
|
179
|
-
icon: createIconStyles(theme),
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
return {
|
|
183
|
-
...extended,
|
|
184
|
-
// Minor utility styles (not extended)
|
|
185
|
-
deleteButton: createDeleteButtonStyles(theme),
|
|
186
|
-
deleteIcon: createDeleteIconStyles(theme),
|
|
187
|
-
};
|
|
188
|
-
});
|
|
149
|
+
},
|
|
150
|
+
}));
|
|
@@ -115,10 +115,13 @@ const Dialog = forwardRef<View, DialogProps>(({
|
|
|
115
115
|
};
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
// Get dynamic styles
|
|
118
|
+
// Get dynamic styles - call as functions for theme reactivity
|
|
119
119
|
const backdropStyle = (dialogStyles.backdrop as any)({});
|
|
120
120
|
const containerStyle = (dialogStyles.container as any)({});
|
|
121
121
|
const headerStyle = (dialogStyles.header as any)({});
|
|
122
|
+
const titleStyle = (dialogStyles.title as any)({});
|
|
123
|
+
const closeButtonStyle = (dialogStyles.closeButton as any)({});
|
|
124
|
+
const closeButtonTextStyle = (dialogStyles.closeButtonText as any)({});
|
|
122
125
|
const contentStyle = (dialogStyles.content as any)({});
|
|
123
126
|
|
|
124
127
|
return (
|
|
@@ -137,18 +140,18 @@ const Dialog = forwardRef<View, DialogProps>(({
|
|
|
137
140
|
{(title || showCloseButton) && (
|
|
138
141
|
<View style={headerStyle}>
|
|
139
142
|
{title && (
|
|
140
|
-
<Text style={
|
|
143
|
+
<Text style={titleStyle}>
|
|
141
144
|
{title}
|
|
142
145
|
</Text>
|
|
143
146
|
)}
|
|
144
147
|
{showCloseButton && (
|
|
145
148
|
<TouchableOpacity
|
|
146
|
-
style={
|
|
149
|
+
style={closeButtonStyle}
|
|
147
150
|
onPress={handleClosePress}
|
|
148
151
|
accessibilityLabel="Close dialog"
|
|
149
152
|
accessibilityRole="button"
|
|
150
153
|
>
|
|
151
|
-
<Text style={
|
|
154
|
+
<Text style={closeButtonTextStyle}>×</Text>
|
|
152
155
|
</TouchableOpacity>
|
|
153
156
|
)}
|
|
154
157
|
</View>
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles } from '@idealyst/theme';
|
|
3
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
4
|
+
type DialogSize = 'sm' | 'md' | 'lg' | 'fullscreen';
|
|
5
|
+
type DialogType = 'default' | 'alert' | 'confirmation';
|
|
6
|
+
|
|
7
|
+
type DialogVariants = {
|
|
8
|
+
size: DialogSize;
|
|
9
|
+
type: DialogType;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ExpandedDialogStyles = StylesheetStyles<keyof DialogVariants>;
|
|
13
|
+
|
|
14
|
+
export type DialogStylesheet = {
|
|
15
|
+
backdrop: ExpandedDialogStyles;
|
|
16
|
+
container: ExpandedDialogStyles;
|
|
17
|
+
header: ExpandedDialogStyles;
|
|
18
|
+
title: ExpandedDialogStyles;
|
|
19
|
+
closeButton: ExpandedDialogStyles;
|
|
20
|
+
closeButtonText: ExpandedDialogStyles;
|
|
21
|
+
content: ExpandedDialogStyles;
|
|
22
|
+
modal: ExpandedDialogStyles;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create size variants for container
|
|
27
|
+
*/
|
|
28
|
+
function createContainerSizeVariants() {
|
|
29
|
+
return {
|
|
30
|
+
sm: {
|
|
31
|
+
width: '90%',
|
|
32
|
+
maxWidth: 400,
|
|
33
|
+
},
|
|
34
|
+
md: {
|
|
35
|
+
width: '90%',
|
|
36
|
+
maxWidth: 600,
|
|
37
|
+
},
|
|
38
|
+
lg: {
|
|
39
|
+
width: '90%',
|
|
40
|
+
maxWidth: 800,
|
|
41
|
+
},
|
|
42
|
+
fullscreen: {
|
|
43
|
+
width: '100%',
|
|
44
|
+
height: '100%',
|
|
45
|
+
borderRadius: 0,
|
|
46
|
+
maxHeight: '100%',
|
|
47
|
+
},
|
|
48
|
+
} as const;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Create type variants for container
|
|
53
|
+
*/
|
|
54
|
+
function createContainerTypeVariants(theme: Theme) {
|
|
55
|
+
return {
|
|
56
|
+
standard: {},
|
|
57
|
+
alert: {
|
|
58
|
+
borderTopWidth: 4,
|
|
59
|
+
borderTopColor: theme.colors.border.primary,
|
|
60
|
+
},
|
|
61
|
+
confirmation: {
|
|
62
|
+
borderTopWidth: 4,
|
|
63
|
+
borderTopColor: theme.colors.border.primary,
|
|
64
|
+
},
|
|
65
|
+
} as const;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Helper functions to create static styles wrapped in dynamic functions
|
|
69
|
+
function createBackdropStyles() {
|
|
70
|
+
return () => ({
|
|
71
|
+
position: 'absolute' as const,
|
|
72
|
+
top: 0,
|
|
73
|
+
left: 0,
|
|
74
|
+
right: 0,
|
|
75
|
+
bottom: 0,
|
|
76
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
77
|
+
display: 'flex' as const,
|
|
78
|
+
alignItems: 'center' as const,
|
|
79
|
+
justifyContent: 'center' as const,
|
|
80
|
+
zIndex: 1000,
|
|
81
|
+
_web: {
|
|
82
|
+
position: 'fixed',
|
|
83
|
+
transition: 'opacity 150ms ease-out',
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function createDialogContainerStyles(theme: Theme) {
|
|
89
|
+
return () => ({
|
|
90
|
+
backgroundColor: theme.colors.surface.primary,
|
|
91
|
+
borderRadius: 12,
|
|
92
|
+
shadowColor: '#000',
|
|
93
|
+
shadowOffset: { width: 0, height: 10 },
|
|
94
|
+
shadowOpacity: 0.25,
|
|
95
|
+
shadowRadius: 20,
|
|
96
|
+
elevation: 10,
|
|
97
|
+
maxHeight: '90%',
|
|
98
|
+
variants: {
|
|
99
|
+
size: createContainerSizeVariants(),
|
|
100
|
+
type: createContainerTypeVariants(theme),
|
|
101
|
+
},
|
|
102
|
+
_web: {
|
|
103
|
+
position: 'relative',
|
|
104
|
+
display: 'flex',
|
|
105
|
+
flexDirection: 'column',
|
|
106
|
+
overflow: 'auto',
|
|
107
|
+
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
108
|
+
transition: 'opacity 150ms ease-out, transform 150ms ease-out',
|
|
109
|
+
transformOrigin: 'center center',
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function createHeaderStyles(theme: Theme) {
|
|
115
|
+
return () => ({
|
|
116
|
+
borderBottomWidth: 1,
|
|
117
|
+
borderBottomColor: theme.colors.border.primary,
|
|
118
|
+
display: 'flex' as const,
|
|
119
|
+
flexDirection: 'row' as const,
|
|
120
|
+
alignItems: 'center' as const,
|
|
121
|
+
justifyContent: 'space-between' as const,
|
|
122
|
+
_web: {
|
|
123
|
+
borderBottomStyle: 'solid',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function createTitleStyles(theme: Theme) {
|
|
129
|
+
return () => ({
|
|
130
|
+
marginLeft: 24,
|
|
131
|
+
fontSize: 18,
|
|
132
|
+
paddingVertical: 16,
|
|
133
|
+
fontWeight: '600' as const,
|
|
134
|
+
color: theme.colors.text.primary,
|
|
135
|
+
flex: 1,
|
|
136
|
+
_web: {
|
|
137
|
+
paddingVertical: 4,
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function createCloseButtonStyles(theme: Theme) {
|
|
143
|
+
return () => ({
|
|
144
|
+
width: 32,
|
|
145
|
+
height: 32,
|
|
146
|
+
marginRight: 16,
|
|
147
|
+
borderRadius: 16,
|
|
148
|
+
backgroundColor: 'transparent' as const,
|
|
149
|
+
display: 'flex' as const,
|
|
150
|
+
alignItems: 'center' as const,
|
|
151
|
+
justifyContent: 'center' as const,
|
|
152
|
+
_web: {
|
|
153
|
+
border: 'none',
|
|
154
|
+
cursor: 'pointer',
|
|
155
|
+
_hover: {
|
|
156
|
+
backgroundColor: theme.colors.surface.secondary,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function createCloseButtonTextStyles(theme: Theme) {
|
|
163
|
+
return () => ({
|
|
164
|
+
fontSize: 18,
|
|
165
|
+
color: theme.colors.text.secondary,
|
|
166
|
+
fontWeight: '500' as const,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function createContentStyles() {
|
|
171
|
+
return () => ({
|
|
172
|
+
padding: 24,
|
|
173
|
+
_web: {
|
|
174
|
+
overflow: 'visible',
|
|
175
|
+
maxHeight: 'none',
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function createModalStyles() {
|
|
181
|
+
return () => ({
|
|
182
|
+
margin: 0,
|
|
183
|
+
justifyContent: 'center' as const,
|
|
184
|
+
alignItems: 'center' as const,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
189
|
+
export const dialogStyles = StyleSheet.create((theme: Theme) => {
|
|
190
|
+
// Apply extensions to main visual elements
|
|
191
|
+
|
|
192
|
+
return applyExtensions('Dialog', theme, {backdrop: createBackdropStyles(),
|
|
193
|
+
container: createDialogContainerStyles(theme),
|
|
194
|
+
header: createHeaderStyles(theme),
|
|
195
|
+
content: createContentStyles(),
|
|
196
|
+
// Additional styles (merged from return)
|
|
197
|
+
// Minor utility styles (not extended)
|
|
198
|
+
title: createTitleStyles(theme)(),
|
|
199
|
+
closeButton: createCloseButtonStyles(theme)(),
|
|
200
|
+
closeButtonText: createCloseButtonTextStyles(theme)(),
|
|
201
|
+
modal: createModalStyles()()});
|
|
202
|
+
});
|
|
@@ -1,73 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dialog styles using defineStyle with dynamic props.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
type DialogSize = 'sm' | 'md' | 'lg' | 'fullscreen';
|
|
5
|
-
type DialogType = 'default' | 'alert' | 'confirmation';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } from '@idealyst/theme';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type: DialogType;
|
|
10
|
-
}
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
container: ExpandedDialogStyles;
|
|
17
|
-
header: ExpandedDialogStyles;
|
|
18
|
-
title: ExpandedDialogStyles;
|
|
19
|
-
closeButton: ExpandedDialogStyles;
|
|
20
|
-
closeButtonText: ExpandedDialogStyles;
|
|
21
|
-
content: ExpandedDialogStyles;
|
|
22
|
-
modal: ExpandedDialogStyles;
|
|
23
|
-
}
|
|
14
|
+
type DialogSize = 'sm' | 'md' | 'lg' | 'fullscreen';
|
|
15
|
+
type DialogType = 'default' | 'alert' | 'confirmation';
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
sm: {
|
|
31
|
-
width: '90%',
|
|
32
|
-
maxWidth: 400,
|
|
33
|
-
},
|
|
34
|
-
md: {
|
|
35
|
-
width: '90%',
|
|
36
|
-
maxWidth: 600,
|
|
37
|
-
},
|
|
38
|
-
lg: {
|
|
39
|
-
width: '90%',
|
|
40
|
-
maxWidth: 800,
|
|
41
|
-
},
|
|
42
|
-
fullscreen: {
|
|
43
|
-
width: '100%',
|
|
44
|
-
height: '100%',
|
|
45
|
-
borderRadius: 0,
|
|
46
|
-
maxHeight: '100%',
|
|
47
|
-
},
|
|
48
|
-
} as const;
|
|
49
|
-
}
|
|
17
|
+
export type DialogDynamicProps = {
|
|
18
|
+
size?: DialogSize;
|
|
19
|
+
type?: DialogType;
|
|
20
|
+
};
|
|
50
21
|
|
|
51
22
|
/**
|
|
52
|
-
*
|
|
23
|
+
* Dialog styles with size/type handling.
|
|
53
24
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
standard: {},
|
|
57
|
-
alert: {
|
|
58
|
-
borderTopWidth: 4,
|
|
59
|
-
borderTopColor: theme.colors.border.primary,
|
|
60
|
-
},
|
|
61
|
-
confirmation: {
|
|
62
|
-
borderTopWidth: 4,
|
|
63
|
-
borderTopColor: theme.colors.border.primary,
|
|
64
|
-
},
|
|
65
|
-
} as const;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Helper functions to create static styles wrapped in dynamic functions
|
|
69
|
-
function createBackdropStyles() {
|
|
70
|
-
return () => ({
|
|
25
|
+
export const dialogStyles = defineStyle('Dialog', (theme: Theme) => ({
|
|
26
|
+
backdrop: (_props: DialogDynamicProps) => ({
|
|
71
27
|
position: 'absolute' as const,
|
|
72
28
|
top: 0,
|
|
73
29
|
left: 0,
|
|
@@ -82,37 +38,47 @@ function createBackdropStyles() {
|
|
|
82
38
|
position: 'fixed',
|
|
83
39
|
transition: 'opacity 150ms ease-out',
|
|
84
40
|
},
|
|
85
|
-
})
|
|
86
|
-
}
|
|
41
|
+
}),
|
|
87
42
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
elevation: 10,
|
|
97
|
-
maxHeight: '90%',
|
|
98
|
-
variants: {
|
|
99
|
-
size: createContainerSizeVariants(),
|
|
100
|
-
type: createContainerTypeVariants(theme),
|
|
101
|
-
},
|
|
102
|
-
_web: {
|
|
103
|
-
position: 'relative',
|
|
104
|
-
display: 'flex',
|
|
105
|
-
flexDirection: 'column',
|
|
106
|
-
overflow: 'auto',
|
|
107
|
-
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
108
|
-
transition: 'opacity 150ms ease-out, transform 150ms ease-out',
|
|
109
|
-
transformOrigin: 'center center',
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
}
|
|
43
|
+
container: ({ size = 'md', type = 'default' }: DialogDynamicProps) => {
|
|
44
|
+
// Size dimensions
|
|
45
|
+
const sizeStyles = {
|
|
46
|
+
sm: { width: '90%', maxWidth: 400 },
|
|
47
|
+
md: { width: '90%', maxWidth: 600 },
|
|
48
|
+
lg: { width: '90%', maxWidth: 800 },
|
|
49
|
+
fullscreen: { width: '100%', height: '100%', borderRadius: 0, maxHeight: '100%' },
|
|
50
|
+
}[size];
|
|
113
51
|
|
|
114
|
-
|
|
115
|
-
|
|
52
|
+
// Type-specific styles
|
|
53
|
+
const typeStyles = type !== 'default' ? {
|
|
54
|
+
borderTopWidth: 4,
|
|
55
|
+
borderTopColor: theme.colors.border.primary,
|
|
56
|
+
} : {};
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
backgroundColor: theme.colors.surface.primary,
|
|
60
|
+
borderRadius: 12,
|
|
61
|
+
shadowColor: '#000',
|
|
62
|
+
shadowOffset: { width: 0, height: 10 },
|
|
63
|
+
shadowOpacity: 0.25,
|
|
64
|
+
shadowRadius: 20,
|
|
65
|
+
elevation: 10,
|
|
66
|
+
maxHeight: '90%',
|
|
67
|
+
...sizeStyles,
|
|
68
|
+
...typeStyles,
|
|
69
|
+
_web: {
|
|
70
|
+
position: 'relative',
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
overflow: 'auto',
|
|
74
|
+
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
75
|
+
transition: 'opacity 150ms ease-out, transform 150ms ease-out',
|
|
76
|
+
transformOrigin: 'center center',
|
|
77
|
+
},
|
|
78
|
+
} as const;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
header: (_props: DialogDynamicProps) => ({
|
|
116
82
|
borderBottomWidth: 1,
|
|
117
83
|
borderBottomColor: theme.colors.border.primary,
|
|
118
84
|
display: 'flex' as const,
|
|
@@ -122,11 +88,9 @@ function createHeaderStyles(theme: Theme) {
|
|
|
122
88
|
_web: {
|
|
123
89
|
borderBottomStyle: 'solid',
|
|
124
90
|
},
|
|
125
|
-
})
|
|
126
|
-
}
|
|
91
|
+
}),
|
|
127
92
|
|
|
128
|
-
|
|
129
|
-
return () => ({
|
|
93
|
+
title: (_props: DialogDynamicProps) => ({
|
|
130
94
|
marginLeft: 24,
|
|
131
95
|
fontSize: 18,
|
|
132
96
|
paddingVertical: 16,
|
|
@@ -136,11 +100,9 @@ function createTitleStyles(theme: Theme) {
|
|
|
136
100
|
_web: {
|
|
137
101
|
paddingVertical: 4,
|
|
138
102
|
},
|
|
139
|
-
})
|
|
140
|
-
}
|
|
103
|
+
}),
|
|
141
104
|
|
|
142
|
-
|
|
143
|
-
return () => ({
|
|
105
|
+
closeButton: (_props: DialogDynamicProps) => ({
|
|
144
106
|
width: 32,
|
|
145
107
|
height: 32,
|
|
146
108
|
marginRight: 16,
|
|
@@ -156,51 +118,25 @@ function createCloseButtonStyles(theme: Theme) {
|
|
|
156
118
|
backgroundColor: theme.colors.surface.secondary,
|
|
157
119
|
},
|
|
158
120
|
},
|
|
159
|
-
})
|
|
160
|
-
}
|
|
121
|
+
}),
|
|
161
122
|
|
|
162
|
-
|
|
163
|
-
return () => ({
|
|
123
|
+
closeButtonText: (_props: DialogDynamicProps) => ({
|
|
164
124
|
fontSize: 18,
|
|
165
125
|
color: theme.colors.text.secondary,
|
|
166
126
|
fontWeight: '500' as const,
|
|
167
|
-
})
|
|
168
|
-
}
|
|
127
|
+
}),
|
|
169
128
|
|
|
170
|
-
|
|
171
|
-
return () => ({
|
|
129
|
+
content: (_props: DialogDynamicProps) => ({
|
|
172
130
|
padding: 24,
|
|
173
131
|
_web: {
|
|
174
132
|
overflow: 'visible',
|
|
175
133
|
maxHeight: 'none',
|
|
176
134
|
},
|
|
177
|
-
})
|
|
178
|
-
}
|
|
135
|
+
}),
|
|
179
136
|
|
|
180
|
-
|
|
181
|
-
return () => ({
|
|
137
|
+
modal: (_props: DialogDynamicProps) => ({
|
|
182
138
|
margin: 0,
|
|
183
139
|
justifyContent: 'center' as const,
|
|
184
140
|
alignItems: 'center' as const,
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
189
|
-
export const dialogStyles = StyleSheet.create((theme: Theme) => {
|
|
190
|
-
// Apply extensions to main visual elements
|
|
191
|
-
const extended = applyExtensions('Dialog', theme, {
|
|
192
|
-
backdrop: createBackdropStyles(),
|
|
193
|
-
container: createDialogContainerStyles(theme),
|
|
194
|
-
header: createHeaderStyles(theme),
|
|
195
|
-
content: createContentStyles(),
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
return {
|
|
199
|
-
...extended,
|
|
200
|
-
// Minor utility styles (not extended)
|
|
201
|
-
title: createTitleStyles(theme)(),
|
|
202
|
-
closeButton: createCloseButtonStyles(theme)(),
|
|
203
|
-
closeButtonText: createCloseButtonTextStyles(theme)(),
|
|
204
|
-
modal: createModalStyles()(),
|
|
205
|
-
};
|
|
206
|
-
});
|
|
141
|
+
}),
|
|
142
|
+
}));
|