@idealyst/components 1.1.7 → 1.1.9
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/plugin/web.js +280 -532
- 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/Accordion/Accordion.web.tsx +1 -3
- 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/Alert/Alert.web.tsx +3 -4
- 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/Badge/Badge.web.tsx +8 -15
- package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
- package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
- package/src/Breadcrumb/Breadcrumb.web.tsx +31 -30
- package/src/Button/Button.native.tsx +14 -21
- package/src/Button/Button.styles.tsx +103 -140
- package/src/Button/Button.web.tsx +9 -19
- 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 +7 -8
- package/src/Chip/Chip.styles.old.tsx +184 -0
- package/src/Chip/Chip.styles.tsx +34 -72
- package/src/Chip/Chip.web.tsx +3 -5
- 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/Dialog/Dialog.web.tsx +3 -3
- package/src/Dialog/types.ts +1 -1
- 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 +62 -21
- package/src/Icon/IconRegistry.native.ts +41 -0
- package/src/Icon/IconRegistry.ts +107 -0
- package/src/Icon/IconSvg/IconSvg.web.tsx +28 -5
- package/src/Icon/icon-resolver.ts +12 -43
- package/src/Icon/index.native.ts +2 -1
- package/src/Icon/index.ts +1 -0
- package/src/Icon/index.web.ts +1 -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 +134 -232
- package/src/Input/Input.web.tsx +5 -8
- 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 +16 -11
- package/src/List/ListItem.web.tsx +26 -16
- 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 +10 -7
- 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 +19 -26
- package/src/Screen/Screen.styles.old.tsx +87 -0
- package/src/Screen/Screen.styles.tsx +103 -68
- package/src/Screen/Screen.web.tsx +2 -2
- package/src/Select/Select.native.tsx +42 -33
- package/src/Select/Select.styles.old.tsx +353 -0
- package/src/Select/Select.styles.tsx +214 -300
- package/src/Select/Select.web.tsx +45 -33
- 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/Slider/Slider.web.tsx +2 -4
- package/src/Switch/Switch.native.tsx +9 -7
- package/src/Switch/Switch.styles.old.tsx +203 -0
- package/src/Switch/Switch.styles.tsx +101 -174
- package/src/Switch/Switch.web.tsx +7 -8
- 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 +180 -68
- package/src/Table/Table.styles.old.tsx +311 -0
- package/src/Table/Table.styles.tsx +140 -281
- package/src/Table/Table.web.tsx +169 -70
- 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 +3 -2
- package/src/Text/index.ts +1 -0
- package/src/TextArea/TextArea.native.tsx +21 -8
- package/src/TextArea/TextArea.styles.old.tsx +213 -0
- package/src/TextArea/TextArea.styles.tsx +87 -187
- package/src/TextArea/TextArea.web.tsx +17 -6
- 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 +41 -13
- package/src/View/View.styles.old.tsx +125 -0
- package/src/View/View.styles.tsx +76 -106
- package/src/View/View.web.tsx +5 -21
- package/src/View/types.ts +31 -3
- package/src/examples/ButtonExamples.tsx +20 -0
- package/src/examples/CardExamples.tsx +0 -6
- package/src/extensions/extendComponent.ts +61 -0
- package/src/index.ts +1 -1
|
@@ -1,107 +1,86 @@
|
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
+
borderWidth: 1,
|
|
39
|
+
borderColor: theme.colors.border.primary,
|
|
40
|
+
borderRadius: theme.radii.md,
|
|
41
|
+
variants: {
|
|
42
|
+
margin: {
|
|
43
|
+
margin: theme.sizes.$view.padding,
|
|
44
|
+
},
|
|
45
|
+
marginVertical: {
|
|
46
|
+
marginVertical: theme.sizes.$view.padding,
|
|
47
|
+
},
|
|
48
|
+
marginHorizontal: {
|
|
49
|
+
marginHorizontal: theme.sizes.$view.padding,
|
|
50
|
+
},
|
|
46
51
|
},
|
|
47
|
-
}
|
|
52
|
+
}),
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
label: ({ disabled = false }: TextAreaDynamicProps) => ({
|
|
55
|
+
fontSize: 14,
|
|
56
|
+
fontWeight: '500' as const,
|
|
57
|
+
color: theme.colors.text.primary,
|
|
58
|
+
}),
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
textareaContainer: (_props: TextAreaDynamicProps) => ({
|
|
61
|
+
position: 'relative' as const,
|
|
62
|
+
variants: {
|
|
63
|
+
disabled: {
|
|
64
|
+
true: {
|
|
65
|
+
opacity: 1,
|
|
66
|
+
},
|
|
67
|
+
false: {
|
|
68
|
+
opacity: 0.8,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
55
73
|
|
|
56
|
-
|
|
74
|
+
textarea: ({ disabled = false, resize = 'none' }: TextAreaDynamicProps) => ({
|
|
57
75
|
width: '100%',
|
|
58
76
|
color: theme.colors.text.primary,
|
|
59
|
-
|
|
60
|
-
borderWidth: 1,
|
|
61
|
-
borderStyle: 'solid',
|
|
62
|
-
borderColor: theme.colors.border.primary,
|
|
63
|
-
borderRadius: 8,
|
|
64
|
-
lineHeight: 'normal',
|
|
65
|
-
...intentStyles,
|
|
77
|
+
opacity: disabled ? 0.5 : 1,
|
|
66
78
|
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
|
-
},
|
|
79
|
+
size: {
|
|
80
|
+
fontSize: theme.sizes.$textarea.fontSize,
|
|
81
|
+
padding: theme.sizes.$textarea.padding,
|
|
82
|
+
lineHeight: theme.sizes.$textarea.lineHeight,
|
|
83
|
+
minHeight: theme.sizes.$textarea.minHeight,
|
|
105
84
|
},
|
|
106
85
|
},
|
|
107
86
|
_web: {
|
|
@@ -110,109 +89,30 @@ const createTextareaStyles = (theme: Theme) => {
|
|
|
110
89
|
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
111
90
|
boxSizing: 'border-box',
|
|
112
91
|
overflowY: 'hidden',
|
|
92
|
+
cursor: disabled ? 'not-allowed' : 'text',
|
|
93
|
+
resize: resize,
|
|
113
94
|
},
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}
|
|
95
|
+
}),
|
|
117
96
|
|
|
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 () => ({
|
|
97
|
+
helperText: ({ hasError = false }: TextAreaDynamicProps) => ({
|
|
157
98
|
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
|
-
}
|
|
99
|
+
color: hasError ? theme.intents.error.primary : theme.colors.text.secondary,
|
|
100
|
+
}),
|
|
169
101
|
|
|
170
|
-
|
|
171
|
-
return () => ({
|
|
102
|
+
footer: (_props: TextAreaDynamicProps) => ({
|
|
172
103
|
display: 'flex' as const,
|
|
173
104
|
flexDirection: 'row' as const,
|
|
174
105
|
justifyContent: 'space-between' as const,
|
|
175
106
|
alignItems: 'center' as const,
|
|
176
107
|
gap: 4,
|
|
177
|
-
})
|
|
178
|
-
}
|
|
108
|
+
}),
|
|
179
109
|
|
|
180
|
-
|
|
181
|
-
return () => ({
|
|
110
|
+
characterCount: ({ isNearLimit = false, isAtLimit = false }: TextAreaDynamicProps) => ({
|
|
182
111
|
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
|
-
});
|
|
112
|
+
color: isAtLimit
|
|
113
|
+
? theme.intents.error.primary
|
|
114
|
+
: isNearLimit
|
|
115
|
+
? theme.intents.warning.primary
|
|
116
|
+
: theme.colors.text.secondary,
|
|
117
|
+
}),
|
|
118
|
+
}));
|
|
@@ -127,12 +127,23 @@ const TextArea = forwardRef<HTMLDivElement, TextAreaProps>(({
|
|
|
127
127
|
marginHorizontal,
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
130
|
+
// Get dynamic styles - call as functions for theme reactivity
|
|
131
|
+
const containerStyle = (textAreaStyles.container as any)({});
|
|
132
|
+
const labelStyle = (textAreaStyles.label as any)({ disabled });
|
|
133
|
+
const textareaContainerStyle = (textAreaStyles.textareaContainer as any)({});
|
|
134
|
+
const footerStyle = (textAreaStyles.footer as any)({});
|
|
135
|
+
const helperTextStyle = (textAreaStyles.helperText as any)({ hasError });
|
|
136
|
+
const characterCountStyle = (textAreaStyles.characterCount as any)({
|
|
137
|
+
isNearLimit: maxLength ? value.length >= maxLength * 0.9 : false,
|
|
138
|
+
isAtLimit: maxLength ? value.length >= maxLength : false,
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
const containerProps = getWebProps([containerStyle, style as any]);
|
|
142
|
+
const labelProps = getWebProps([labelStyle]);
|
|
143
|
+
const textareaContainerProps = getWebProps([textareaContainerStyle]);
|
|
144
|
+
const footerProps = getWebProps([footerStyle]);
|
|
145
|
+
const helperTextProps = getWebProps([helperTextStyle]);
|
|
146
|
+
const characterCountProps = getWebProps([characterCountStyle]);
|
|
136
147
|
|
|
137
148
|
const adjustHeight = () => {
|
|
138
149
|
if (!autoGrow || !textareaRef.current) return;
|
|
@@ -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
|
+
}));
|