@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.
Files changed (144) hide show
  1. package/package.json +8 -3
  2. package/src/Accordion/Accordion.native.tsx +22 -14
  3. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  4. package/src/Accordion/Accordion.styles.tsx +139 -248
  5. package/src/Accordion/Accordion.web.tsx +12 -7
  6. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -2
  7. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  8. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +43 -62
  9. package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -2
  10. package/src/Alert/Alert.native.tsx +26 -15
  11. package/src/Alert/Alert.styles.old.tsx +209 -0
  12. package/src/Alert/Alert.styles.tsx +108 -281
  13. package/src/Alert/Alert.web.tsx +6 -10
  14. package/src/Avatar/Avatar.native.tsx +5 -2
  15. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  16. package/src/Avatar/Avatar.styles.tsx +47 -62
  17. package/src/Avatar/Avatar.web.tsx +2 -2
  18. package/src/Badge/Badge.native.tsx +2 -2
  19. package/src/Badge/Badge.styles.old.tsx +157 -0
  20. package/src/Badge/Badge.styles.tsx +69 -108
  21. package/src/Badge/Badge.web.tsx +6 -6
  22. package/src/Breadcrumb/Breadcrumb.native.tsx +12 -5
  23. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  24. package/src/Breadcrumb/Breadcrumb.styles.tsx +93 -209
  25. package/src/Breadcrumb/Breadcrumb.web.tsx +39 -27
  26. package/src/Button/Button.native.tsx +39 -14
  27. package/src/Button/Button.styles.tsx +99 -253
  28. package/src/Button/Button.web.tsx +10 -8
  29. package/src/Card/Card.native.tsx +8 -4
  30. package/src/Card/Card.styles.old.tsx +160 -0
  31. package/src/Card/Card.styles.tsx +107 -142
  32. package/src/Card/Card.web.tsx +6 -4
  33. package/src/Checkbox/Checkbox.native.tsx +14 -6
  34. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  35. package/src/Checkbox/Checkbox.styles.tsx +109 -197
  36. package/src/Checkbox/Checkbox.web.tsx +7 -7
  37. package/src/Chip/Chip.native.tsx +5 -5
  38. package/src/Chip/Chip.styles.old.tsx +184 -0
  39. package/src/Chip/Chip.styles.tsx +34 -22
  40. package/src/Chip/Chip.web.tsx +5 -5
  41. package/src/Dialog/Dialog.native.tsx +16 -7
  42. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  43. package/src/Dialog/Dialog.styles.tsx +108 -132
  44. package/src/Dialog/Dialog.web.tsx +4 -4
  45. package/src/Divider/Divider.native.tsx +29 -42
  46. package/src/Divider/Divider.styles.old.tsx +172 -0
  47. package/src/Divider/Divider.styles.tsx +116 -242
  48. package/src/Divider/Divider.web.tsx +17 -14
  49. package/src/Icon/Icon.native.tsx +12 -4
  50. package/src/Icon/Icon.styles.old.tsx +81 -0
  51. package/src/Icon/Icon.styles.tsx +52 -60
  52. package/src/Icon/Icon.web.tsx +43 -7
  53. package/src/Icon/IconSvg/IconSvg.web.tsx +2 -0
  54. package/src/Image/Image.styles.old.tsx +69 -0
  55. package/src/Image/Image.styles.tsx +45 -43
  56. package/src/Input/Input.native.tsx +140 -56
  57. package/src/Input/Input.styles.old.tsx +289 -0
  58. package/src/Input/Input.styles.tsx +177 -228
  59. package/src/Input/Input.web.tsx +5 -8
  60. package/src/Link/Link.native.tsx +4 -1
  61. package/src/List/List.native.tsx +5 -2
  62. package/src/List/List.styles.old.tsx +242 -0
  63. package/src/List/List.styles.tsx +178 -240
  64. package/src/List/ListItem.native.tsx +16 -8
  65. package/src/List/ListItem.web.tsx +26 -15
  66. package/src/Menu/Menu.native.tsx +1 -1
  67. package/src/Menu/Menu.styles.old.tsx +197 -0
  68. package/src/Menu/Menu.styles.tsx +90 -156
  69. package/src/Menu/Menu.web.tsx +2 -2
  70. package/src/Menu/MenuItem.native.tsx +9 -5
  71. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  72. package/src/Menu/MenuItem.styles.tsx +71 -104
  73. package/src/Menu/MenuItem.web.tsx +23 -5
  74. package/src/Popover/Popover.native.tsx +10 -4
  75. package/src/Popover/Popover.styles.old.tsx +135 -0
  76. package/src/Popover/Popover.styles.tsx +46 -96
  77. package/src/Popover/Popover.web.tsx +1 -1
  78. package/src/Pressable/Pressable.native.tsx +3 -1
  79. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  80. package/src/Pressable/Pressable.styles.tsx +35 -20
  81. package/src/Pressable/Pressable.web.tsx +1 -1
  82. package/src/Progress/Progress.native.tsx +15 -6
  83. package/src/Progress/Progress.styles.old.tsx +200 -0
  84. package/src/Progress/Progress.styles.tsx +69 -118
  85. package/src/Progress/Progress.web.tsx +10 -9
  86. package/src/RadioButton/RadioButton.native.tsx +10 -4
  87. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  88. package/src/RadioButton/RadioButton.styles.tsx +81 -145
  89. package/src/RadioButton/RadioButton.web.tsx +4 -4
  90. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  91. package/src/SVGImage/SVGImage.styles.tsx +35 -66
  92. package/src/Screen/Screen.native.tsx +30 -27
  93. package/src/Screen/Screen.styles.old.tsx +87 -0
  94. package/src/Screen/Screen.styles.tsx +120 -71
  95. package/src/Screen/Screen.web.tsx +2 -2
  96. package/src/Select/Select.native.tsx +44 -29
  97. package/src/Select/Select.styles.old.tsx +353 -0
  98. package/src/Select/Select.styles.tsx +244 -293
  99. package/src/Select/Select.web.tsx +5 -5
  100. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  101. package/src/Skeleton/Skeleton.styles.tsx +31 -43
  102. package/src/Slider/Slider.native.tsx +9 -5
  103. package/src/Slider/Slider.styles.old.tsx +259 -0
  104. package/src/Slider/Slider.styles.tsx +157 -227
  105. package/src/Slider/Slider.web.tsx +5 -5
  106. package/src/Switch/Switch.native.tsx +11 -5
  107. package/src/Switch/Switch.styles.old.tsx +203 -0
  108. package/src/Switch/Switch.styles.tsx +103 -149
  109. package/src/Switch/Switch.web.tsx +8 -8
  110. package/src/TabBar/TabBar.native.tsx +24 -31
  111. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  112. package/src/TabBar/TabBar.styles.tsx +204 -494
  113. package/src/TabBar/TabBar.web.tsx +21 -33
  114. package/src/Table/Table.native.tsx +18 -9
  115. package/src/Table/Table.styles.old.tsx +311 -0
  116. package/src/Table/Table.styles.tsx +151 -278
  117. package/src/Table/Table.web.tsx +1 -1
  118. package/src/Text/Text.native.tsx +1 -4
  119. package/src/Text/Text.style.demo.tsx +16 -0
  120. package/src/Text/Text.styles.old.tsx +219 -0
  121. package/src/Text/Text.styles.tsx +94 -78
  122. package/src/Text/Text.web.tsx +2 -2
  123. package/src/Text/index.ts +1 -0
  124. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  125. package/src/TextArea/TextArea.styles.tsx +101 -157
  126. package/src/Tooltip/Tooltip.native.tsx +2 -2
  127. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  128. package/src/Tooltip/Tooltip.styles.tsx +38 -53
  129. package/src/Tooltip/Tooltip.web.tsx +2 -2
  130. package/src/Video/Video.styles.old.tsx +51 -0
  131. package/src/Video/Video.styles.tsx +32 -28
  132. package/src/View/View.native.tsx +12 -12
  133. package/src/View/View.styles.old.tsx +125 -0
  134. package/src/View/View.styles.tsx +84 -103
  135. package/src/View/View.web.tsx +14 -2
  136. package/src/examples/CardExamples.tsx +0 -6
  137. package/src/extensions/applyExtension.ts +210 -0
  138. package/src/extensions/extendComponent.ts +438 -0
  139. package/src/extensions/index.ts +102 -0
  140. package/src/extensions/types.ts +497 -0
  141. package/src/globals.ts +16 -0
  142. package/src/index.native.ts +4 -0
  143. package/src/index.ts +28 -0
  144. 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 { 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';
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
- * Create size variants for textarea
14
- */
15
- function createTextareaSizeVariants(theme: Theme) {
16
- return buildSizeVariants(theme, 'textarea', (size) => ({
17
- fontSize: size.fontSize,
18
- padding: size.padding,
19
- lineHeight: size.lineHeight,
20
- minHeight: size.minHeight,
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
- * Get textarea styles based on intent, disabled, and hasError state
31
+ * TextArea styles with intent/disabled/error handling.
26
32
  */
27
- function getTextareaIntentStyles(theme: Theme, intent: TextAreaIntentVariant, disabled: boolean, hasError: boolean) {
28
- if (disabled || hasError) {
29
- return {} as const;
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
- const intentValue = theme.intents[intent];
33
- const baseStyles: any = {};
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
- // For success and warning, set border color
36
- if (intent === 'success' || intent === 'warning') {
37
- baseStyles.borderColor = intentValue.primary;
38
- }
58
+ textareaContainer: (_props: TextAreaDynamicProps) => ({
59
+ position: 'relative' as const,
60
+ }),
39
61
 
40
- // Focus styles for all intents when not disabled and not in error
41
- baseStyles._web = {
42
- _focus: {
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
- return baseStyles;
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
- const createTextareaStyles = (theme: Theme) => {
52
- return ({ intent, disabled, hasError }: { intent: TextAreaIntentVariant, disabled: boolean, hasError: boolean }) => {
53
- const intentStyles = getTextareaIntentStyles(theme, intent, disabled, hasError);
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: theme.colors.border.primary,
84
+ borderStyle: 'solid' as const,
85
+ borderColor,
62
86
  borderRadius: 8,
63
- lineHeight: 'normal',
64
- ...intentStyles,
87
+ opacity: disabled ? 0.5 : 1,
65
88
  variants: {
66
- size: createTextareaSizeVariants(theme),
67
- disabled: {
68
- true: {
69
- opacity: 0.5,
70
- backgroundColor: theme.colors.surface.secondary,
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
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
118
- export const textAreaStyles = StyleSheet.create((theme: Theme) => {
119
- return {
120
- container: {
121
- display: 'flex',
122
- flexDirection: 'column',
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
- label: {
132
- fontSize: 14,
133
- fontWeight: '500',
134
- color: theme.colors.text.primary,
135
- variants: {
136
- disabled: {
137
- true: {
138
- opacity: 0.5,
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 { Theme, StylesheetStyles, Intent, Size} from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
-
5
- type TooltipSize = Size;
6
- type TooltipIntent = Intent;
7
-
8
- type TooltipTooltipVariants = {
9
- size: TooltipSize;
10
- intent: TooltipIntent;
11
- }
12
-
13
- export type ExpandedTooltipTooltipStyles = StylesheetStyles<keyof TooltipTooltipVariants>;
14
- export type ExpandedTooltipStyles = StylesheetStyles<never>;
15
-
16
- export type TooltipStylesheet = {
17
- container: ExpandedTooltipStyles;
18
- tooltip: ExpandedTooltipTooltipStyles;
19
- }
20
-
21
- function createTooltipSizeVariants(theme: Theme) {
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
- } as const,
53
- tooltip: {
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: createTooltipSizeVariants(theme),
63
- intent: createTooltipIntentVariants(theme),
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
- } as const,
72
- } as const;
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 { Theme, StylesheetStyles} from '@idealyst/theme';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme } from '@idealyst/theme';
3
7
 
4
- export type ExpandedVideoStyles = StylesheetStyles<never>;
8
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
9
+ void StyleSheet;
5
10
 
6
- export type VideoStylesheet = {
7
- container: ExpandedVideoStyles;
8
- video: ExpandedVideoStyles;
9
- fallback: ExpandedVideoStyles;
10
- }
11
+ // Wrap theme for $iterator support
12
+ type Theme = ThemeStyleWrapper<BaseTheme>;
11
13
 
12
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
13
- // transform on native cannot resolve function calls to extract variant structures.
14
- // @ts-ignore - TS language server needs restart to pick up theme structure changes
15
- export const videoStyles = StyleSheet.create((theme: Theme) => {
16
- return {
17
- container: {
18
- position: 'relative',
19
- overflow: 'hidden',
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
- video: {
23
- width: '100%',
24
- height: '100%',
25
- },
26
- fallback: {
27
- position: 'absolute',
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
+ }));