@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,106 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextArea styles using defineStyle with dynamic props.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
buildMarginVariants,
|
|
6
|
-
buildMarginVerticalVariants,
|
|
7
|
-
buildMarginHorizontalVariants,
|
|
8
|
-
} from '../utils/buildViewStyleVariants';
|
|
9
|
-
import { TextAreaIntentVariant } from './types';
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme, Intent, Size } from '@idealyst/theme';
|
|
7
|
+
import { ViewStyleSize } from '../utils/viewStyleProps';
|
|
10
8
|
|
|
9
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
10
|
+
void StyleSheet;
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
};
|
|
23
29
|
|
|
24
30
|
/**
|
|
25
|
-
*
|
|
31
|
+
* TextArea styles with intent/disabled/error handling.
|
|
26
32
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}),
|
|
31
50
|
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
}),
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
58
|
+
textareaContainer: (_props: TextAreaDynamicProps) => ({
|
|
59
|
+
position: 'relative' as const,
|
|
60
|
+
}),
|
|
39
61
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
borderColor: intentValue.primary,
|
|
44
|
-
boxShadow: `0 0 0 2px ${intentValue.primary}33`,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
62
|
+
textarea: ({ intent = 'primary', disabled = false, hasError = false, resize = 'none' }: TextAreaDynamicProps) => {
|
|
63
|
+
const intentValue = theme.intents[intent];
|
|
64
|
+
const errorColor = theme.intents.error.primary;
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
}
|
|
50
73
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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` };
|
|
54
78
|
|
|
55
79
|
return {
|
|
56
80
|
width: '100%',
|
|
57
81
|
color: theme.colors.text.primary,
|
|
58
|
-
backgroundColor: theme.colors.surface.primary,
|
|
82
|
+
backgroundColor: disabled ? theme.colors.surface.secondary : theme.colors.surface.primary,
|
|
59
83
|
borderWidth: 1,
|
|
60
|
-
borderStyle: 'solid',
|
|
61
|
-
borderColor
|
|
84
|
+
borderStyle: 'solid' as const,
|
|
85
|
+
borderColor,
|
|
62
86
|
borderRadius: 8,
|
|
63
|
-
|
|
64
|
-
...intentStyles,
|
|
87
|
+
opacity: disabled ? 0.5 : 1,
|
|
65
88
|
variants: {
|
|
66
|
-
size:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_web: {
|
|
72
|
-
cursor: 'not-allowed',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
false: {},
|
|
76
|
-
},
|
|
77
|
-
hasError: {
|
|
78
|
-
true: {
|
|
79
|
-
borderColor: theme.intents.error.primary,
|
|
80
|
-
},
|
|
81
|
-
false: {},
|
|
82
|
-
},
|
|
83
|
-
resize: {
|
|
84
|
-
none: {
|
|
85
|
-
_web: {
|
|
86
|
-
resize: 'none',
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
vertical: {
|
|
90
|
-
_web: {
|
|
91
|
-
resize: 'vertical',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
horizontal: {
|
|
95
|
-
_web: {
|
|
96
|
-
resize: 'horizontal',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
both: {
|
|
100
|
-
_web: {
|
|
101
|
-
resize: 'both',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
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,
|
|
104
94
|
},
|
|
105
95
|
},
|
|
106
96
|
_web: {
|
|
@@ -109,78 +99,32 @@ const createTextareaStyles = (theme: Theme) => {
|
|
|
109
99
|
transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
|
|
110
100
|
boxSizing: 'border-box',
|
|
111
101
|
overflowY: 'hidden',
|
|
102
|
+
cursor: disabled ? 'not-allowed' : 'text',
|
|
103
|
+
resize: resize,
|
|
104
|
+
_focus: disabled ? {} : webFocusStyles,
|
|
112
105
|
},
|
|
113
106
|
} as const;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
107
|
+
},
|
|
116
108
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
},
|
|
140
|
-
false: {},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
textareaContainer: {
|
|
145
|
-
position: 'relative',
|
|
146
|
-
},
|
|
147
|
-
textarea: createTextareaStyles(theme),
|
|
148
|
-
helperText: {
|
|
149
|
-
fontSize: 12,
|
|
150
|
-
color: theme.colors.text.secondary,
|
|
151
|
-
variants: {
|
|
152
|
-
hasError: {
|
|
153
|
-
true: {
|
|
154
|
-
color: theme.intents.error.primary,
|
|
155
|
-
},
|
|
156
|
-
false: {},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
footer: {
|
|
161
|
-
display: 'flex',
|
|
162
|
-
flexDirection: 'row',
|
|
163
|
-
justifyContent: 'space-between',
|
|
164
|
-
alignItems: 'center',
|
|
165
|
-
gap: 4,
|
|
166
|
-
},
|
|
167
|
-
characterCount: {
|
|
168
|
-
fontSize: 12,
|
|
169
|
-
color: theme.colors.text.secondary,
|
|
170
|
-
variants: {
|
|
171
|
-
isNearLimit: {
|
|
172
|
-
true: {
|
|
173
|
-
color: theme.intents.warning.primary,
|
|
174
|
-
},
|
|
175
|
-
false: {},
|
|
176
|
-
},
|
|
177
|
-
isAtLimit: {
|
|
178
|
-
true: {
|
|
179
|
-
color: theme.intents.error.primary,
|
|
180
|
-
},
|
|
181
|
-
false: {},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
});
|
|
109
|
+
helperText: ({ hasError = false }: TextAreaDynamicProps) => ({
|
|
110
|
+
fontSize: 12,
|
|
111
|
+
color: hasError ? theme.intents.error.primary : theme.colors.text.secondary,
|
|
112
|
+
}),
|
|
113
|
+
|
|
114
|
+
footer: (_props: TextAreaDynamicProps) => ({
|
|
115
|
+
display: 'flex' as const,
|
|
116
|
+
flexDirection: 'row' as const,
|
|
117
|
+
justifyContent: 'space-between' as const,
|
|
118
|
+
alignItems: 'center' as const,
|
|
119
|
+
gap: 4,
|
|
120
|
+
}),
|
|
121
|
+
|
|
122
|
+
characterCount: ({ isNearLimit = false, isAtLimit = false }: TextAreaDynamicProps) => ({
|
|
123
|
+
fontSize: 12,
|
|
124
|
+
color: isAtLimit
|
|
125
|
+
? theme.intents.error.primary
|
|
126
|
+
: isNearLimit
|
|
127
|
+
? theme.intents.warning.primary
|
|
128
|
+
: theme.colors.text.secondary,
|
|
129
|
+
}),
|
|
130
|
+
}));
|
|
@@ -159,14 +159,14 @@ const Tooltip = forwardRef<View, TooltipProps>(({
|
|
|
159
159
|
<Pressable style={{ flex: 1 }} onPress={() => setVisible(false)}>
|
|
160
160
|
<View
|
|
161
161
|
style={[
|
|
162
|
-
tooltipStyles.tooltip,
|
|
162
|
+
(tooltipStyles.tooltip as any)({}),
|
|
163
163
|
{ position: 'absolute' },
|
|
164
164
|
getPositionStyle(),
|
|
165
165
|
]}
|
|
166
166
|
pointerEvents="none"
|
|
167
167
|
>
|
|
168
168
|
{typeof content === 'string' ? (
|
|
169
|
-
<Text style={tooltipStyles.tooltip}>{content}</Text>
|
|
169
|
+
<Text style={(tooltipStyles.tooltip as any)({})}>{content}</Text>
|
|
170
170
|
) : (
|
|
171
171
|
content
|
|
172
172
|
)}
|
|
@@ -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,56 +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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return buildSizeVariants(theme, 'tooltip', (size) => ({
|
|
23
|
-
fontSize: size.fontSize,
|
|
24
|
-
padding: size.padding,
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function createTooltipIntentVariants(theme: Theme) {
|
|
29
|
-
const intents: Record<string, any> = {};
|
|
30
|
-
|
|
31
|
-
for (const [intentName, intentValue] of Object.entries(theme.intents)) {
|
|
32
|
-
intents[intentName] = {
|
|
33
|
-
backgroundColor: intentValue.primary,
|
|
34
|
-
color: intentValue.contrast,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return intents;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
42
|
-
// transform on native cannot resolve function calls to extract variant structures.
|
|
43
|
-
// @ts-ignore - TS language server needs restart to pick up theme structure changes
|
|
44
|
-
export const tooltipStyles = StyleSheet.create((theme: Theme) => {
|
|
45
|
-
return {
|
|
46
|
-
container: {
|
|
47
|
-
position: 'relative',
|
|
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>;
|
|
13
|
+
|
|
14
|
+
export type TooltipDynamicProps = {
|
|
15
|
+
size?: Size;
|
|
16
|
+
intent?: Intent;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Tooltip styles with size and intent variants.
|
|
21
|
+
*/
|
|
22
|
+
export const tooltipStyles = defineStyle('Tooltip', (theme: Theme) => ({
|
|
23
|
+
container: (_props: TooltipDynamicProps) => ({
|
|
24
|
+
position: 'relative' as const,
|
|
48
25
|
_web: {
|
|
49
26
|
display: 'inline-flex',
|
|
50
27
|
width: 'fit-content',
|
|
51
28
|
},
|
|
52
|
-
}
|
|
53
|
-
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
tooltip: (_props: TooltipDynamicProps) => ({
|
|
54
32
|
borderRadius: 8,
|
|
55
33
|
maxWidth: 300,
|
|
56
34
|
shadowColor: '#000',
|
|
@@ -59,8 +37,16 @@ export const tooltipStyles = StyleSheet.create((theme: Theme) => {
|
|
|
59
37
|
shadowRadius: 8,
|
|
60
38
|
elevation: 4,
|
|
61
39
|
variants: {
|
|
62
|
-
size
|
|
63
|
-
|
|
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
|
+
},
|
|
64
50
|
},
|
|
65
51
|
_web: {
|
|
66
52
|
boxShadow: '0 2px 8px rgba(0, 0, 0, 0.15)',
|
|
@@ -68,6 +54,5 @@ export const tooltipStyles = StyleSheet.create((theme: Theme) => {
|
|
|
68
54
|
width: 'max-content',
|
|
69
55
|
wordWrap: 'break-word',
|
|
70
56
|
},
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
});
|
|
57
|
+
}),
|
|
58
|
+
}));
|
|
@@ -47,8 +47,8 @@ const Tooltip: React.FC<TooltipProps> = ({
|
|
|
47
47
|
intent,
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
const containerProps = getWebProps([tooltipStyles.container, style as any]);
|
|
51
|
-
const tooltipContentProps = getWebProps(tooltipStyles.tooltip);
|
|
50
|
+
const containerProps = getWebProps([(tooltipStyles.container as any)({}), style as any]);
|
|
51
|
+
const tooltipContentProps = getWebProps([(tooltipStyles.tooltip as any)({})]);
|
|
52
52
|
|
|
53
53
|
const handleMouseEnter = () => {
|
|
54
54
|
if (timeoutRef.current) {
|
|
@@ -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,39 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video styles using defineStyle.
|
|
3
|
+
*/
|
|
1
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
-
import {
|
|
5
|
+
import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
|
|
6
|
+
import type { Theme as BaseTheme } from '@idealyst/theme';
|
|
3
7
|
|
|
4
|
-
|
|
8
|
+
// Required: Unistyles must see StyleSheet usage in original source to process this file
|
|
9
|
+
void StyleSheet;
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
video: ExpandedVideoStyles;
|
|
9
|
-
fallback: ExpandedVideoStyles;
|
|
10
|
-
}
|
|
11
|
+
// Wrap theme for $iterator support
|
|
12
|
+
type Theme = ThemeStyleWrapper<BaseTheme>;
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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) => ({
|
|
21
|
+
position: 'relative' as const,
|
|
22
|
+
overflow: 'hidden' as const,
|
|
20
23
|
backgroundColor: theme.colors['black'],
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
video: (_props: VideoDynamicProps) => ({
|
|
27
|
+
width: '100%' as const,
|
|
28
|
+
height: '100%' as const,
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
fallback: (_props: VideoDynamicProps) => ({
|
|
32
|
+
position: 'absolute' as const,
|
|
28
33
|
top: 0,
|
|
29
34
|
left: 0,
|
|
30
35
|
right: 0,
|
|
31
36
|
bottom: 0,
|
|
32
|
-
display: 'flex',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
justifyContent: 'center',
|
|
37
|
+
display: 'flex' as const,
|
|
38
|
+
alignItems: 'center' as const,
|
|
39
|
+
justifyContent: 'center' as const,
|
|
35
40
|
backgroundColor: theme.colors['gray.300'],
|
|
36
41
|
color: theme.colors['gray.600'],
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
});
|
|
42
|
+
}),
|
|
43
|
+
}));
|