@idealyst/components 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/Accordion/Accordion.native.tsx +8 -6
- package/src/Accordion/Accordion.styles.old.tsx +298 -0
- package/src/Accordion/Accordion.styles.tsx +102 -236
- package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
- package/src/ActivityIndicator/ActivityIndicator.styles.tsx +44 -74
- package/src/Alert/Alert.native.tsx +16 -6
- package/src/Alert/Alert.styles.old.tsx +209 -0
- package/src/Alert/Alert.styles.tsx +67 -149
- package/src/Avatar/Avatar.styles.old.tsx +99 -0
- package/src/Avatar/Avatar.styles.tsx +35 -80
- package/src/Badge/Badge.styles.old.tsx +157 -0
- package/src/Badge/Badge.styles.tsx +61 -121
- package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
- package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
- package/src/Breadcrumb/Breadcrumb.web.tsx +28 -23
- package/src/Button/Button.styles.tsx +89 -141
- package/src/Card/Card.native.tsx +7 -11
- package/src/Card/Card.styles.old.tsx +160 -0
- package/src/Card/Card.styles.tsx +105 -142
- package/src/Card/Card.web.tsx +5 -4
- package/src/Checkbox/Checkbox.native.tsx +9 -5
- package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
- package/src/Checkbox/Checkbox.styles.tsx +104 -216
- package/src/Checkbox/Checkbox.web.tsx +6 -6
- package/src/Chip/Chip.styles.old.tsx +184 -0
- package/src/Chip/Chip.styles.tsx +34 -72
- package/src/Dialog/Dialog.native.tsx +7 -4
- package/src/Dialog/Dialog.styles.old.tsx +202 -0
- package/src/Dialog/Dialog.styles.tsx +69 -133
- package/src/Divider/Divider.styles.old.tsx +172 -0
- package/src/Divider/Divider.styles.tsx +62 -84
- package/src/Icon/Icon.native.tsx +8 -8
- package/src/Icon/Icon.styles.old.tsx +81 -0
- package/src/Icon/Icon.styles.tsx +52 -66
- package/src/Icon/Icon.web.tsx +43 -7
- package/src/Icon/IconSvg/IconSvg.web.tsx +2 -0
- package/src/Image/Image.styles.old.tsx +69 -0
- package/src/Image/Image.styles.tsx +46 -60
- package/src/Input/Input.native.tsx +138 -53
- package/src/Input/Input.styles.old.tsx +289 -0
- package/src/Input/Input.styles.tsx +127 -198
- package/src/List/List.native.tsx +5 -2
- package/src/List/List.styles.old.tsx +242 -0
- package/src/List/List.styles.tsx +179 -215
- package/src/List/ListItem.native.tsx +12 -6
- package/src/List/ListItem.web.tsx +23 -13
- package/src/Menu/Menu.styles.old.tsx +197 -0
- package/src/Menu/Menu.styles.tsx +68 -150
- package/src/Menu/MenuItem.native.tsx +5 -3
- package/src/Menu/MenuItem.styles.old.tsx +114 -0
- package/src/Menu/MenuItem.styles.tsx +57 -89
- package/src/Menu/MenuItem.web.tsx +8 -3
- package/src/Popover/Popover.native.tsx +10 -4
- package/src/Popover/Popover.styles.old.tsx +135 -0
- package/src/Popover/Popover.styles.tsx +51 -112
- package/src/Pressable/Pressable.styles.old.tsx +27 -0
- package/src/Pressable/Pressable.styles.tsx +35 -27
- package/src/Progress/Progress.styles.old.tsx +200 -0
- package/src/Progress/Progress.styles.tsx +75 -164
- package/src/RadioButton/RadioButton.native.tsx +4 -3
- package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
- package/src/RadioButton/RadioButton.styles.tsx +83 -154
- package/src/RadioButton/RadioButton.web.tsx +2 -2
- package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
- package/src/SVGImage/SVGImage.styles.tsx +35 -78
- package/src/Screen/Screen.native.tsx +18 -25
- package/src/Screen/Screen.styles.old.tsx +87 -0
- package/src/Screen/Screen.styles.tsx +105 -67
- package/src/Screen/Screen.web.tsx +1 -1
- package/src/Select/Select.native.tsx +42 -33
- package/src/Select/Select.styles.old.tsx +353 -0
- package/src/Select/Select.styles.tsx +223 -292
- package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
- package/src/Skeleton/Skeleton.styles.tsx +29 -53
- package/src/Slider/Slider.styles.old.tsx +259 -0
- package/src/Slider/Slider.styles.tsx +153 -234
- package/src/Switch/Switch.native.tsx +7 -5
- package/src/Switch/Switch.styles.old.tsx +203 -0
- package/src/Switch/Switch.styles.tsx +101 -174
- package/src/Switch/Switch.web.tsx +5 -5
- package/src/TabBar/TabBar.native.tsx +3 -2
- package/src/TabBar/TabBar.styles.old.tsx +343 -0
- package/src/TabBar/TabBar.styles.tsx +145 -279
- package/src/Table/Table.native.tsx +18 -9
- package/src/Table/Table.styles.old.tsx +311 -0
- package/src/Table/Table.styles.tsx +152 -286
- package/src/Text/Text.native.tsx +1 -3
- package/src/Text/Text.style.demo.tsx +16 -0
- package/src/Text/Text.styles.old.tsx +219 -0
- package/src/Text/Text.styles.tsx +94 -84
- package/src/Text/Text.web.tsx +2 -2
- package/src/Text/index.ts +1 -0
- package/src/TextArea/TextArea.styles.old.tsx +213 -0
- package/src/TextArea/TextArea.styles.tsx +93 -181
- package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
- package/src/Tooltip/Tooltip.styles.tsx +32 -56
- package/src/Video/Video.styles.old.tsx +51 -0
- package/src/Video/Video.styles.tsx +32 -44
- package/src/View/View.native.tsx +12 -14
- package/src/View/View.styles.old.tsx +125 -0
- package/src/View/View.styles.tsx +76 -106
- package/src/View/View.web.tsx +1 -0
- package/src/examples/CardExamples.tsx +0 -6
- package/src/extensions/extendComponent.ts +61 -0
|
@@ -1,107 +1,96 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import { Theme, StylesheetStyles, Intent, Size } from '@idealyst/theme';
|
|
3
|
-
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
-
import {
|
|
5
|
-
buildMarginVariants,
|
|
6
|
-
buildMarginVerticalVariants,
|
|
7
|
-
buildMarginHorizontalVariants,
|
|
8
|
-
} from '../utils/buildViewStyleVariants';
|
|
9
|
-
import { TextAreaIntentVariant } from './types';
|
|
10
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
11
|
-
|
|
12
|
-
|
|
13
1
|
/**
|
|
14
|
-
*
|
|
2
|
+
* TextArea styles using defineStyle with dynamic props.
|
|
15
3
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
|
|
7
|
+
import { ViewStyleSize } from '../utils/viewStyleProps';
|
|
8
|
+
|
|
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
|
+
type ResizeMode = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
16
|
+
|
|
17
|
+
export type TextAreaDynamicProps = {
|
|
18
|
+
size?: Size;
|
|
19
|
+
intent?: Intent;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
hasError?: boolean;
|
|
22
|
+
resize?: ResizeMode;
|
|
23
|
+
isNearLimit?: boolean;
|
|
24
|
+
isAtLimit?: boolean;
|
|
25
|
+
margin?: ViewStyleSize;
|
|
26
|
+
marginVertical?: ViewStyleSize;
|
|
27
|
+
marginHorizontal?: ViewStyleSize;
|
|
28
|
+
};
|
|
24
29
|
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
31
|
+
* TextArea styles with intent/disabled/error handling.
|
|
27
32
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
export const textAreaStyles = defineStyle('TextArea', (theme: Theme) => ({
|
|
34
|
+
container: (_props: TextAreaDynamicProps) => ({
|
|
35
|
+
display: 'flex' as const,
|
|
36
|
+
flexDirection: 'column' as const,
|
|
37
|
+
gap: 4,
|
|
38
|
+
variants: {
|
|
39
|
+
margin: {
|
|
40
|
+
margin: theme.sizes.$view.padding,
|
|
41
|
+
},
|
|
42
|
+
marginVertical: {
|
|
43
|
+
marginVertical: theme.sizes.$view.padding,
|
|
44
|
+
},
|
|
45
|
+
marginHorizontal: {
|
|
46
|
+
marginHorizontal: theme.sizes.$view.padding,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
32
50
|
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
label: ({ disabled = false }: TextAreaDynamicProps) => ({
|
|
52
|
+
fontSize: 14,
|
|
53
|
+
fontWeight: '500' as const,
|
|
54
|
+
color: theme.colors.text.primary,
|
|
55
|
+
opacity: disabled ? 0.5 : 1,
|
|
56
|
+
}),
|
|
35
57
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
58
|
+
textareaContainer: (_props: TextAreaDynamicProps) => ({
|
|
59
|
+
position: 'relative' as const,
|
|
60
|
+
}),
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
borderColor: intentValue.primary,
|
|
45
|
-
boxShadow: `0 0 0 2px ${intentValue.primary}33`,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
62
|
+
textarea: ({ intent = 'primary', disabled = false, hasError = false, resize = 'none' }: TextAreaDynamicProps) => {
|
|
63
|
+
const intentValue = theme.intents[intent];
|
|
64
|
+
const errorColor = theme.intents.error.primary;
|
|
48
65
|
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
// Get border color based on state
|
|
67
|
+
let borderColor = theme.colors.border.primary;
|
|
68
|
+
if (hasError) {
|
|
69
|
+
borderColor = errorColor;
|
|
70
|
+
} else if (intent === 'success' || intent === 'warning') {
|
|
71
|
+
borderColor = intentValue.primary;
|
|
72
|
+
}
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
// Get web-specific styles
|
|
75
|
+
const webFocusStyles = hasError
|
|
76
|
+
? { borderColor: errorColor, boxShadow: `0 0 0 2px ${errorColor}33` }
|
|
77
|
+
: { borderColor: intentValue.primary, boxShadow: `0 0 0 2px ${intentValue.primary}33` };
|
|
55
78
|
|
|
56
79
|
return {
|
|
57
80
|
width: '100%',
|
|
58
81
|
color: theme.colors.text.primary,
|
|
59
|
-
backgroundColor: theme.colors.surface.primary,
|
|
82
|
+
backgroundColor: disabled ? theme.colors.surface.secondary : theme.colors.surface.primary,
|
|
60
83
|
borderWidth: 1,
|
|
61
|
-
borderStyle: 'solid',
|
|
62
|
-
borderColor
|
|
84
|
+
borderStyle: 'solid' as const,
|
|
85
|
+
borderColor,
|
|
63
86
|
borderRadius: 8,
|
|
64
|
-
|
|
65
|
-
...intentStyles,
|
|
87
|
+
opacity: disabled ? 0.5 : 1,
|
|
66
88
|
variants: {
|
|
67
|
-
size:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_web: {
|
|
73
|
-
cursor: 'not-allowed',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
false: {},
|
|
77
|
-
},
|
|
78
|
-
hasError: {
|
|
79
|
-
true: {
|
|
80
|
-
borderColor: theme.intents.error.primary,
|
|
81
|
-
},
|
|
82
|
-
false: {},
|
|
83
|
-
},
|
|
84
|
-
resize: {
|
|
85
|
-
none: {
|
|
86
|
-
_web: {
|
|
87
|
-
resize: 'none',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
vertical: {
|
|
91
|
-
_web: {
|
|
92
|
-
resize: 'vertical',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
horizontal: {
|
|
96
|
-
_web: {
|
|
97
|
-
resize: 'horizontal',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
both: {
|
|
101
|
-
_web: {
|
|
102
|
-
resize: 'both',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
89
|
+
size: {
|
|
90
|
+
fontSize: theme.sizes.$textarea.fontSize,
|
|
91
|
+
padding: theme.sizes.$textarea.padding,
|
|
92
|
+
lineHeight: theme.sizes.$textarea.lineHeight,
|
|
93
|
+
minHeight: theme.sizes.$textarea.minHeight,
|
|
105
94
|
},
|
|
106
95
|
},
|
|
107
96
|
_web: {
|
|
@@ -110,109 +99,32 @@ const createTextareaStyles = (theme: Theme) => {
|
|
|
110
99
|
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
111
100
|
boxSizing: 'border-box',
|
|
112
101
|
overflowY: 'hidden',
|
|
102
|
+
cursor: disabled ? 'not-allowed' : 'text',
|
|
103
|
+
resize: resize,
|
|
104
|
+
_focus: disabled ? {} : webFocusStyles,
|
|
113
105
|
},
|
|
114
106
|
} as const;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
107
|
+
},
|
|
117
108
|
|
|
118
|
-
|
|
119
|
-
function createContainerStyles(theme: Theme) {
|
|
120
|
-
return () => ({
|
|
121
|
-
display: 'flex' as const,
|
|
122
|
-
flexDirection: 'column' as const,
|
|
123
|
-
gap: 4,
|
|
124
|
-
variants: {
|
|
125
|
-
// Spacing variants from FormInputStyleProps
|
|
126
|
-
margin: buildMarginVariants(theme),
|
|
127
|
-
marginVertical: buildMarginVerticalVariants(theme),
|
|
128
|
-
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function createLabelStyles(theme: Theme) {
|
|
134
|
-
return () => ({
|
|
135
|
-
fontSize: 14,
|
|
136
|
-
fontWeight: '500' as const,
|
|
137
|
-
color: theme.colors.text.primary,
|
|
138
|
-
variants: {
|
|
139
|
-
disabled: {
|
|
140
|
-
true: {
|
|
141
|
-
opacity: 0.5,
|
|
142
|
-
},
|
|
143
|
-
false: {},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function createTextareaContainerStyles() {
|
|
150
|
-
return () => ({
|
|
151
|
-
position: 'relative' as const,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function createHelperTextStyles(theme: Theme) {
|
|
156
|
-
return () => ({
|
|
109
|
+
helperText: ({ hasError = false }: TextAreaDynamicProps) => ({
|
|
157
110
|
fontSize: 12,
|
|
158
|
-
color: theme.colors.text.secondary,
|
|
159
|
-
|
|
160
|
-
hasError: {
|
|
161
|
-
true: {
|
|
162
|
-
color: theme.intents.error.primary,
|
|
163
|
-
},
|
|
164
|
-
false: {},
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
}
|
|
111
|
+
color: hasError ? theme.intents.error.primary : theme.colors.text.secondary,
|
|
112
|
+
}),
|
|
169
113
|
|
|
170
|
-
|
|
171
|
-
return () => ({
|
|
114
|
+
footer: (_props: TextAreaDynamicProps) => ({
|
|
172
115
|
display: 'flex' as const,
|
|
173
116
|
flexDirection: 'row' as const,
|
|
174
117
|
justifyContent: 'space-between' as const,
|
|
175
118
|
alignItems: 'center' as const,
|
|
176
119
|
gap: 4,
|
|
177
|
-
})
|
|
178
|
-
}
|
|
120
|
+
}),
|
|
179
121
|
|
|
180
|
-
|
|
181
|
-
return () => ({
|
|
122
|
+
characterCount: ({ isNearLimit = false, isAtLimit = false }: TextAreaDynamicProps) => ({
|
|
182
123
|
fontSize: 12,
|
|
183
|
-
color:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
isAtLimit: {
|
|
192
|
-
true: {
|
|
193
|
-
color: theme.intents.error.primary,
|
|
194
|
-
},
|
|
195
|
-
false: {},
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
|
|
202
|
-
export const textAreaStyles = StyleSheet.create((theme: Theme) => {
|
|
203
|
-
// Apply extensions to main visual elements
|
|
204
|
-
const extended = applyExtensions('TextArea', theme, {
|
|
205
|
-
container: createContainerStyles(theme),
|
|
206
|
-
textarea: createTextareaStyles(theme),
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
return {
|
|
210
|
-
...extended,
|
|
211
|
-
// Minor utility styles (not extended)
|
|
212
|
-
label: createLabelStyles(theme)(),
|
|
213
|
-
textareaContainer: createTextareaContainerStyles()(),
|
|
214
|
-
helperText: createHelperTextStyles(theme)(),
|
|
215
|
-
footer: createFooterStyles()(),
|
|
216
|
-
characterCount: createCharacterCountStyles(theme)(),
|
|
217
|
-
};
|
|
218
|
-
});
|
|
124
|
+
color: isAtLimit
|
|
125
|
+
? theme.intents.error.primary
|
|
126
|
+
: isNearLimit
|
|
127
|
+
? theme.intents.warning.primary
|
|
128
|
+
: theme.colors.text.secondary,
|
|
129
|
+
}),
|
|
130
|
+
}));
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles, Intent, Size } from '@idealyst/theme';
|
|
3
|
+
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
+
|
|
6
|
+
type TooltipSize = Size;
|
|
7
|
+
type TooltipIntent = Intent;
|
|
8
|
+
|
|
9
|
+
type TooltipTooltipVariants = {
|
|
10
|
+
size: TooltipSize;
|
|
11
|
+
intent: TooltipIntent;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type ExpandedTooltipTooltipStyles = StylesheetStyles<keyof TooltipTooltipVariants>;
|
|
15
|
+
export type ExpandedTooltipStyles = StylesheetStyles<never>;
|
|
16
|
+
|
|
17
|
+
export type TooltipStylesheet = {
|
|
18
|
+
container: ExpandedTooltipStyles;
|
|
19
|
+
tooltip: ExpandedTooltipTooltipStyles;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function createTooltipSizeVariants(theme: Theme) {
|
|
23
|
+
return buildSizeVariants(theme, 'tooltip', (size) => ({
|
|
24
|
+
fontSize: size.fontSize,
|
|
25
|
+
padding: size.padding,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function createTooltipIntentVariants(theme: Theme) {
|
|
30
|
+
const intents: Record<string, any> = {};
|
|
31
|
+
|
|
32
|
+
for (const [intentName, intentValue] of Object.entries(theme.intents)) {
|
|
33
|
+
intents[intentName] = {
|
|
34
|
+
backgroundColor: intentValue.primary,
|
|
35
|
+
color: intentValue.contrast,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return intents;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Style creators for extension support
|
|
43
|
+
function createContainerStyles() {
|
|
44
|
+
return () => ({
|
|
45
|
+
position: 'relative' as const,
|
|
46
|
+
_web: {
|
|
47
|
+
display: 'inline-flex',
|
|
48
|
+
width: 'fit-content',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function createTooltipStyles(theme: Theme) {
|
|
54
|
+
return () => ({
|
|
55
|
+
borderRadius: 8,
|
|
56
|
+
maxWidth: 300,
|
|
57
|
+
shadowColor: '#000',
|
|
58
|
+
shadowOffset: { width: 0, height: 2 },
|
|
59
|
+
shadowOpacity: 0.15,
|
|
60
|
+
shadowRadius: 8,
|
|
61
|
+
elevation: 4,
|
|
62
|
+
variants: {
|
|
63
|
+
size: createTooltipSizeVariants(theme),
|
|
64
|
+
intent: createTooltipIntentVariants(theme),
|
|
65
|
+
},
|
|
66
|
+
_web: {
|
|
67
|
+
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
|
|
68
|
+
pointerEvents: 'none',
|
|
69
|
+
width: 'max-content',
|
|
70
|
+
wordWrap: 'break-word',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
76
|
+
// transform on native cannot resolve function calls to extract variant structures.
|
|
77
|
+
export const tooltipStyles = StyleSheet.create((theme: Theme) => {
|
|
78
|
+
return applyExtensions('Tooltip', theme, {
|
|
79
|
+
container: createContainerStyles(),
|
|
80
|
+
tooltip: createTooltipStyles(theme),
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -1,57 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip styles using defineStyle with $iterator expansion.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { applyExtensions } from '../extensions/applyExtension';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
intent: TooltipIntent;
|
|
12
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
13
13
|
|
|
14
|
-
export type
|
|
15
|
-
|
|
14
|
+
export type TooltipDynamicProps = {
|
|
15
|
+
size?: Size;
|
|
16
|
+
intent?: Intent;
|
|
17
|
+
};
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function createTooltipSizeVariants(theme: Theme) {
|
|
23
|
-
return buildSizeVariants(theme, 'tooltip', (size) => ({
|
|
24
|
-
fontSize: size.fontSize,
|
|
25
|
-
padding: size.padding,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function createTooltipIntentVariants(theme: Theme) {
|
|
30
|
-
const intents: Record<string, any> = {};
|
|
31
|
-
|
|
32
|
-
for (const [intentName, intentValue] of Object.entries(theme.intents)) {
|
|
33
|
-
intents[intentName] = {
|
|
34
|
-
backgroundColor: intentValue.primary,
|
|
35
|
-
color: intentValue.contrast,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return intents;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Style creators for extension support
|
|
43
|
-
function createContainerStyles() {
|
|
44
|
-
return () => ({
|
|
19
|
+
/**
|
|
20
|
+
* Tooltip styles with size and intent variants.
|
|
21
|
+
*/
|
|
22
|
+
export const tooltipStyles = defineStyle('Tooltip', (theme: Theme) => ({
|
|
23
|
+
container: (_props: TooltipDynamicProps) => ({
|
|
45
24
|
position: 'relative' as const,
|
|
46
25
|
_web: {
|
|
47
26
|
display: 'inline-flex',
|
|
48
27
|
width: 'fit-content',
|
|
49
28
|
},
|
|
50
|
-
})
|
|
51
|
-
}
|
|
29
|
+
}),
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
return () => ({
|
|
31
|
+
tooltip: (_props: TooltipDynamicProps) => ({
|
|
55
32
|
borderRadius: 8,
|
|
56
33
|
maxWidth: 300,
|
|
57
34
|
shadowColor: '#000',
|
|
@@ -60,8 +37,16 @@ function createTooltipStyles(theme: Theme) {
|
|
|
60
37
|
shadowRadius: 8,
|
|
61
38
|
elevation: 4,
|
|
62
39
|
variants: {
|
|
63
|
-
size
|
|
64
|
-
|
|
40
|
+
// $iterator expands for each tooltip size
|
|
41
|
+
size: {
|
|
42
|
+
fontSize: theme.sizes.$tooltip.fontSize,
|
|
43
|
+
padding: theme.sizes.$tooltip.padding,
|
|
44
|
+
},
|
|
45
|
+
// $iterator expands for each intent
|
|
46
|
+
intent: {
|
|
47
|
+
backgroundColor: theme.$intents.primary,
|
|
48
|
+
color: theme.$intents.contrast,
|
|
49
|
+
},
|
|
65
50
|
},
|
|
66
51
|
_web: {
|
|
67
52
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
|
|
@@ -69,14 +54,5 @@ function createTooltipStyles(theme: Theme) {
|
|
|
69
54
|
width: 'max-content',
|
|
70
55
|
wordWrap: 'break-word',
|
|
71
56
|
},
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
76
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
77
|
-
export const tooltipStyles = StyleSheet.create((theme: Theme) => {
|
|
78
|
-
return applyExtensions('Tooltip', theme, {
|
|
79
|
-
container: createContainerStyles(),
|
|
80
|
-
tooltip: createTooltipStyles(theme),
|
|
81
|
-
});
|
|
82
|
-
});
|
|
57
|
+
}),
|
|
58
|
+
}));
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
import { Theme, StylesheetStyles} from '@idealyst/theme';
|
|
3
|
+
import { applyExtensions } from '../extensions/applyExtension';
|
|
4
|
+
|
|
5
|
+
export type ExpandedVideoStyles = StylesheetStyles<never>;
|
|
6
|
+
|
|
7
|
+
export type VideoStylesheet = {
|
|
8
|
+
container: ExpandedVideoStyles;
|
|
9
|
+
video: ExpandedVideoStyles;
|
|
10
|
+
fallback: ExpandedVideoStyles;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Style creators for extension support
|
|
14
|
+
function createContainerStyles(theme: Theme) {
|
|
15
|
+
return () => ({
|
|
16
|
+
position: 'relative' as const,
|
|
17
|
+
overflow: 'hidden' as const,
|
|
18
|
+
backgroundColor: theme.colors['black'],
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function createVideoStyles() {
|
|
23
|
+
return () => ({
|
|
24
|
+
width: '100%' as const,
|
|
25
|
+
height: '100%' as const,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
30
|
+
// transform on native cannot resolve function calls to extract variant structures.
|
|
31
|
+
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
32
|
+
export const videoStyles = StyleSheet.create((theme: Theme) => {
|
|
33
|
+
// Apply extensions to main visual elements
|
|
34
|
+
|
|
35
|
+
return applyExtensions('Video', theme, {container: createContainerStyles(theme),
|
|
36
|
+
video: createVideoStyles(),
|
|
37
|
+
// Additional styles (merged from return)
|
|
38
|
+
// Minor utility styles (not extended)
|
|
39
|
+
fallback: {
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: 0,
|
|
42
|
+
left: 0,
|
|
43
|
+
right: 0,
|
|
44
|
+
bottom: 0,
|
|
45
|
+
display: 'flex',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
backgroundColor: theme.colors['gray.300'],
|
|
49
|
+
color: theme.colors['gray.600'],
|
|
50
|
+
}});
|
|
51
|
+
});
|
|
@@ -1,55 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video styles using defineStyle.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } from '@idealyst/theme';
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
video: ExpandedVideoStyles;
|
|
10
|
-
fallback: ExpandedVideoStyles;
|
|
11
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export type VideoDynamicProps = {};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Video styles - container, video element, and fallback.
|
|
18
|
+
*/
|
|
19
|
+
export const videoStyles = defineStyle('Video', (theme: Theme) => ({
|
|
20
|
+
container: (_props: VideoDynamicProps) => ({
|
|
16
21
|
position: 'relative' as const,
|
|
17
22
|
overflow: 'hidden' as const,
|
|
18
23
|
backgroundColor: theme.colors['black'],
|
|
19
|
-
})
|
|
20
|
-
}
|
|
24
|
+
}),
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
return () => ({
|
|
26
|
+
video: (_props: VideoDynamicProps) => ({
|
|
24
27
|
width: '100%' as const,
|
|
25
28
|
height: '100%' as const,
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
30
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
31
|
-
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
32
|
-
export const videoStyles = StyleSheet.create((theme: Theme) => {
|
|
33
|
-
// Apply extensions to main visual elements
|
|
34
|
-
const extended = applyExtensions('Video', theme, {
|
|
35
|
-
container: createContainerStyles(theme),
|
|
36
|
-
video: createVideoStyles(),
|
|
37
|
-
});
|
|
29
|
+
}),
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
color: theme.colors['gray.600'],
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
});
|
|
31
|
+
fallback: (_props: VideoDynamicProps) => ({
|
|
32
|
+
position: 'absolute' as const,
|
|
33
|
+
top: 0,
|
|
34
|
+
left: 0,
|
|
35
|
+
right: 0,
|
|
36
|
+
bottom: 0,
|
|
37
|
+
display: 'flex' as const,
|
|
38
|
+
alignItems: 'center' as const,
|
|
39
|
+
justifyContent: 'center' as const,
|
|
40
|
+
backgroundColor: theme.colors['gray.300'],
|
|
41
|
+
color: theme.colors['gray.600'],
|
|
42
|
+
}),
|
|
43
|
+
}));
|