@idealyst/components 1.1.6 → 1.1.7

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 (104) hide show
  1. package/package.json +8 -3
  2. package/src/Accordion/Accordion.native.tsx +15 -9
  3. package/src/Accordion/Accordion.styles.tsx +193 -168
  4. package/src/Accordion/Accordion.web.tsx +12 -7
  5. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -2
  6. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +22 -11
  7. package/src/ActivityIndicator/ActivityIndicator.web.tsx +2 -2
  8. package/src/Alert/Alert.native.tsx +11 -10
  9. package/src/Alert/Alert.styles.tsx +162 -253
  10. package/src/Alert/Alert.web.tsx +6 -10
  11. package/src/Avatar/Avatar.native.tsx +5 -2
  12. package/src/Avatar/Avatar.styles.tsx +48 -18
  13. package/src/Avatar/Avatar.web.tsx +2 -2
  14. package/src/Badge/Badge.native.tsx +2 -2
  15. package/src/Badge/Badge.styles.tsx +37 -16
  16. package/src/Badge/Badge.web.tsx +6 -6
  17. package/src/Breadcrumb/Breadcrumb.native.tsx +12 -5
  18. package/src/Breadcrumb/Breadcrumb.styles.tsx +59 -58
  19. package/src/Breadcrumb/Breadcrumb.web.tsx +13 -6
  20. package/src/Button/Button.native.tsx +39 -14
  21. package/src/Button/Button.styles.tsx +106 -208
  22. package/src/Button/Button.web.tsx +10 -8
  23. package/src/Card/Card.native.tsx +14 -6
  24. package/src/Card/Card.styles.tsx +64 -62
  25. package/src/Card/Card.web.tsx +5 -4
  26. package/src/Checkbox/Checkbox.native.tsx +7 -3
  27. package/src/Checkbox/Checkbox.styles.tsx +49 -25
  28. package/src/Checkbox/Checkbox.web.tsx +3 -3
  29. package/src/Chip/Chip.native.tsx +5 -5
  30. package/src/Chip/Chip.styles.tsx +71 -21
  31. package/src/Chip/Chip.web.tsx +5 -5
  32. package/src/Dialog/Dialog.native.tsx +10 -4
  33. package/src/Dialog/Dialog.styles.tsx +130 -90
  34. package/src/Dialog/Dialog.web.tsx +4 -4
  35. package/src/Divider/Divider.native.tsx +29 -42
  36. package/src/Divider/Divider.styles.tsx +138 -242
  37. package/src/Divider/Divider.web.tsx +17 -14
  38. package/src/Icon/Icon.native.tsx +11 -3
  39. package/src/Icon/Icon.styles.tsx +10 -4
  40. package/src/Image/Image.styles.tsx +53 -37
  41. package/src/Input/Input.native.tsx +6 -7
  42. package/src/Input/Input.styles.tsx +194 -174
  43. package/src/Input/Input.web.tsx +5 -8
  44. package/src/Link/Link.native.tsx +4 -1
  45. package/src/List/List.styles.tsx +79 -105
  46. package/src/List/ListItem.native.tsx +5 -3
  47. package/src/List/ListItem.web.tsx +4 -3
  48. package/src/Menu/Menu.native.tsx +1 -1
  49. package/src/Menu/Menu.styles.tsx +53 -37
  50. package/src/Menu/Menu.web.tsx +2 -2
  51. package/src/Menu/MenuItem.native.tsx +5 -3
  52. package/src/Menu/MenuItem.styles.tsx +68 -69
  53. package/src/Menu/MenuItem.web.tsx +16 -3
  54. package/src/Popover/Popover.native.tsx +1 -1
  55. package/src/Popover/Popover.styles.tsx +40 -29
  56. package/src/Popover/Popover.web.tsx +1 -1
  57. package/src/Pressable/Pressable.native.tsx +3 -1
  58. package/src/Pressable/Pressable.styles.tsx +20 -13
  59. package/src/Pressable/Pressable.web.tsx +1 -1
  60. package/src/Progress/Progress.native.tsx +15 -6
  61. package/src/Progress/Progress.styles.tsx +125 -85
  62. package/src/Progress/Progress.web.tsx +10 -9
  63. package/src/RadioButton/RadioButton.native.tsx +8 -3
  64. package/src/RadioButton/RadioButton.styles.tsx +44 -37
  65. package/src/RadioButton/RadioButton.web.tsx +3 -3
  66. package/src/SVGImage/SVGImage.styles.tsx +28 -16
  67. package/src/Screen/Screen.native.tsx +23 -13
  68. package/src/Screen/Screen.styles.tsx +57 -46
  69. package/src/Screen/Screen.web.tsx +1 -1
  70. package/src/Select/Select.native.tsx +11 -5
  71. package/src/Select/Select.styles.tsx +72 -52
  72. package/src/Select/Select.web.tsx +5 -5
  73. package/src/Skeleton/Skeleton.styles.tsx +26 -14
  74. package/src/Slider/Slider.native.tsx +9 -5
  75. package/src/Slider/Slider.styles.tsx +59 -48
  76. package/src/Slider/Slider.web.tsx +5 -5
  77. package/src/Switch/Switch.native.tsx +6 -2
  78. package/src/Switch/Switch.styles.tsx +46 -19
  79. package/src/Switch/Switch.web.tsx +4 -4
  80. package/src/TabBar/TabBar.native.tsx +23 -31
  81. package/src/TabBar/TabBar.styles.tsx +215 -371
  82. package/src/TabBar/TabBar.web.tsx +21 -33
  83. package/src/Table/Table.native.tsx +1 -1
  84. package/src/Table/Table.styles.tsx +11 -4
  85. package/src/Table/Table.web.tsx +1 -1
  86. package/src/Text/Text.native.tsx +3 -4
  87. package/src/Text/Text.styles.tsx +7 -1
  88. package/src/Text/Text.web.tsx +1 -1
  89. package/src/TextArea/TextArea.styles.tsx +90 -58
  90. package/src/Tooltip/Tooltip.native.tsx +2 -2
  91. package/src/Tooltip/Tooltip.styles.tsx +21 -12
  92. package/src/Tooltip/Tooltip.web.tsx +2 -2
  93. package/src/Video/Video.styles.tsx +39 -23
  94. package/src/View/View.native.tsx +4 -2
  95. package/src/View/View.styles.tsx +33 -22
  96. package/src/View/View.web.tsx +13 -2
  97. package/src/extensions/applyExtension.ts +210 -0
  98. package/src/extensions/extendComponent.ts +377 -0
  99. package/src/extensions/index.ts +102 -0
  100. package/src/extensions/types.ts +497 -0
  101. package/src/globals.ts +16 -0
  102. package/src/index.native.ts +4 -0
  103. package/src/index.ts +28 -0
  104. package/src/utils/deepMerge.ts +54 -2
@@ -16,21 +16,30 @@ const Divider = forwardRef<View, DividerProps>(({
16
16
  accessibilityLabel,
17
17
  id,
18
18
  }, ref) => {
19
- // Apply variants for main divider
19
+ // Apply variants for container, content (orientation, spacing)
20
20
  dividerStyles.useVariants({
21
+ orientation,
22
+ spacing,
23
+ length: typeof length === 'number' ? 'auto' : length,
24
+ });
25
+
26
+ // Get dynamic divider style
27
+ const dividerStyle = (dividerStyles.divider as any)({
21
28
  orientation,
22
29
  thickness,
23
- type: type as any,
30
+ type,
24
31
  intent,
25
- length: typeof length === 'number' ? 'auto' : length,
26
32
  spacing,
27
33
  });
28
34
 
29
- // Get the current styles for color and dimensions
30
- const dividerStyle = dividerStyles.divider;
31
-
32
- // Get thickness value
33
- const getThickness = () => {
35
+ // Get dynamic line style
36
+ const lineStyle = (dividerStyles.line as any)({
37
+ orientation,
38
+ thickness,
39
+ });
40
+
41
+ // Get thickness value for dashed/dotted border handling on native
42
+ const getThicknessValue = () => {
34
43
  switch (thickness) {
35
44
  case 'thin': return 1;
36
45
  case 'md': return 2;
@@ -39,11 +48,11 @@ const Divider = forwardRef<View, DividerProps>(({
39
48
  }
40
49
  };
41
50
 
42
- // For dashed/dotted variants, use border instead of background
43
- const getDashedStyle = () => {
51
+ // For dashed/dotted variants on native, we need to use border instead of background
52
+ const getNativeDashedStyle = () => {
44
53
  if (type === 'dashed' || type === 'dotted') {
45
- const actualThickness = getThickness();
46
-
54
+ const actualThickness = getThicknessValue();
55
+
47
56
  return {
48
57
  backgroundColor: 'transparent',
49
58
  borderStyle: type,
@@ -53,15 +62,11 @@ const Divider = forwardRef<View, DividerProps>(({
53
62
  borderBottomWidth: 0,
54
63
  borderLeftWidth: 0,
55
64
  borderRightWidth: 0,
56
- width: '100%',
57
- height: actualThickness,
58
65
  } : {
59
66
  borderLeftWidth: actualThickness,
60
67
  borderTopWidth: 0,
61
68
  borderBottomWidth: 0,
62
69
  borderRightWidth: 0,
63
- height: '100%',
64
- width: actualThickness,
65
70
  }),
66
71
  };
67
72
  }
@@ -70,66 +75,48 @@ const Divider = forwardRef<View, DividerProps>(({
70
75
 
71
76
  // If no children, render simple divider
72
77
  if (!children) {
73
- if (type === 'dashed' || type === 'dotted') {
74
- return (
75
- <View
76
- ref={ref}
77
- nativeID={id}
78
- style={[
79
- dividerStyle,
80
- getDashedStyle(),
81
- style,
82
- ]}
83
- testID={testID}
84
- accessibilityLabel={accessibilityLabel || "divider"}
85
- />
86
- );
87
- }
88
-
89
78
  return (
90
79
  <View
91
80
  ref={ref}
92
81
  nativeID={id}
93
- style={[dividerStyles.divider, style]}
82
+ style={[dividerStyle, getNativeDashedStyle(), style]}
94
83
  testID={testID}
95
84
  accessibilityLabel={accessibilityLabel || "divider"}
96
85
  />
97
86
  );
98
87
  }
99
88
 
100
- // For lines with content, create a simple dashed line
89
+ // For lines with content, create line segments
101
90
  const renderLineSegment = () => {
102
91
  if (type === 'dashed' || type === 'dotted') {
103
- const actualThickness = getThickness();
104
-
92
+ const actualThickness = getThicknessValue();
93
+
105
94
  return (
106
95
  <View
107
96
  style={[
108
- dividerStyles.line,
97
+ lineStyle,
109
98
  {
110
99
  backgroundColor: 'transparent',
111
100
  borderStyle: type,
112
- borderColor: dividerStyles.line.backgroundColor,
101
+ borderColor: lineStyle.backgroundColor,
113
102
  ...(orientation === 'horizontal' ? {
114
103
  borderTopWidth: actualThickness,
115
104
  borderBottomWidth: 0,
116
105
  borderLeftWidth: 0,
117
106
  borderRightWidth: 0,
118
- height: actualThickness,
119
107
  } : {
120
108
  borderLeftWidth: actualThickness,
121
109
  borderTopWidth: 0,
122
110
  borderBottomWidth: 0,
123
111
  borderRightWidth: 0,
124
- width: actualThickness,
125
112
  }),
126
113
  },
127
114
  ]}
128
115
  />
129
116
  );
130
117
  }
131
-
132
- return <View style={dividerStyles.line} />;
118
+
119
+ return <View style={lineStyle} />;
133
120
  };
134
121
 
135
122
  return (
@@ -1,5 +1,6 @@
1
1
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Intent, CompoundVariants} from '@idealyst/theme';
2
+ import { Theme, Intent } from '@idealyst/theme';
3
+ import { applyExtensions } from '../extensions/applyExtension';
3
4
 
4
5
  type DividerOrientation = 'horizontal' | 'vertical';
5
6
  type DividerThickness = 'thin' | 'md' | 'thick';
@@ -8,14 +9,18 @@ type DividerIntent = Intent | 'secondary' | 'neutral' | 'info';
8
9
  type DividerLength = 'full' | 'auto';
9
10
  type DividerSpacing = 'none' | 'sm' | 'md' | 'lg';
10
11
 
11
- type DividerVariants = {
12
- orientation: DividerOrientation;
13
- thickness: DividerThickness;
14
- type: DividerType;
15
- intent: DividerIntent;
16
- length: DividerLength;
17
- spacing: DividerSpacing;
18
- }
12
+ type DividerDynamicProps = {
13
+ orientation?: DividerOrientation;
14
+ thickness?: DividerThickness;
15
+ type?: DividerType;
16
+ intent?: DividerIntent;
17
+ spacing?: DividerSpacing;
18
+ };
19
+
20
+ type LineDynamicProps = {
21
+ orientation?: DividerOrientation;
22
+ thickness?: DividerThickness;
23
+ };
19
24
 
20
25
  function getIntentColor(theme: Theme, intent: DividerIntent): string {
21
26
  if (intent === 'secondary') return theme.colors.border.primary;
@@ -24,257 +29,148 @@ function getIntentColor(theme: Theme, intent: DividerIntent): string {
24
29
  return theme.intents[intent as Intent].primary;
25
30
  }
26
31
 
27
- function createDividerCompoundVariants(theme: Theme) {
28
- const variants: CompoundVariants<keyof DividerVariants> = [];
29
-
30
- variants.push(
31
- { orientation: 'horizontal', thickness: 'thin', styles: { height: 1 } },
32
- { orientation: 'horizontal', thickness: 'md', styles: { height: 2 } },
33
- { orientation: 'horizontal', thickness: 'thick', styles: { height: 4 } }
34
- );
35
-
36
- variants.push(
37
- { orientation: 'vertical', thickness: 'thin', styles: { width: 1 } },
38
- { orientation: 'vertical', thickness: 'md', styles: { width: 2 } },
39
- { orientation: 'vertical', thickness: 'thick', styles: { width: 4 } }
40
- );
41
-
42
- variants.push(
43
- { orientation: 'horizontal', spacing: 'sm', styles: { marginVertical: 8 } },
44
- { orientation: 'horizontal', spacing: 'md', styles: { marginVertical: 16 } },
45
- { orientation: 'horizontal', spacing: 'lg', styles: { marginVertical: 24 } }
46
- );
47
-
48
- variants.push(
49
- { orientation: 'vertical', spacing: 'sm', styles: { marginHorizontal: 8 } },
50
- { orientation: 'vertical', spacing: 'md', styles: { marginHorizontal: 16 } },
51
- { orientation: 'vertical', spacing: 'lg', styles: { marginHorizontal: 24 } }
52
- );
53
-
54
- const borderColor = theme.colors.border.secondary;
55
- variants.push(
56
- {
57
- type: 'dashed',
58
- orientation: 'horizontal',
59
- styles: {
60
- _web: {
61
- borderTop: `1px dashed ${borderColor}`,
62
- borderLeft: 'none',
63
- },
64
- },
65
- },
66
- {
67
- type: 'dashed',
68
- orientation: 'vertical',
69
- styles: {
70
- _web: {
71
- borderLeft: `1px dashed ${borderColor}`,
72
- borderTop: 'none',
73
- },
74
- },
75
- }
76
- );
32
+ function getThicknessValue(thickness: DividerThickness): number {
33
+ switch (thickness) {
34
+ case 'thin': return 1;
35
+ case 'md': return 2;
36
+ case 'thick': return 4;
37
+ default: return 1;
38
+ }
39
+ }
77
40
 
78
- variants.push(
79
- {
80
- type: 'dotted',
81
- orientation: 'horizontal',
82
- styles: {
83
- _web: {
84
- borderTop: `1px dotted ${borderColor}`,
85
- borderLeft: 'none',
86
- },
87
- },
88
- },
89
- {
90
- type: 'dotted',
91
- orientation: 'vertical',
92
- styles: {
93
- _web: {
94
- borderLeft: `1px dotted ${borderColor}`,
95
- borderTop: 'none',
96
- },
97
- },
98
- }
99
- );
41
+ function getSpacingValue(spacing: DividerSpacing): number {
42
+ switch (spacing) {
43
+ case 'none': return 0;
44
+ case 'sm': return 8;
45
+ case 'md': return 16;
46
+ case 'lg': return 24;
47
+ default: return 0;
48
+ }
49
+ }
100
50
 
101
- const intents: DividerIntent[] = ['primary', 'success', 'error', 'warning', 'info'];
102
- for (const intent of intents) {
51
+ /**
52
+ * Create dynamic divider styles
53
+ */
54
+ function createDividerStyles(theme: Theme) {
55
+ return ({
56
+ orientation = 'horizontal',
57
+ thickness = 'thin',
58
+ type = 'solid',
59
+ intent = 'neutral',
60
+ spacing = 'md'
61
+ }: DividerDynamicProps) => {
103
62
  const color = getIntentColor(theme, intent);
104
-
105
- variants.push({
106
- type: 'dashed',
107
- intent: intent,
108
- orientation: 'horizontal',
109
- styles: {
110
- borderTopColor: color,
111
- _web: { borderTop: `1px dashed ${color}` },
112
- },
113
- });
114
-
115
- variants.push({
116
- type: 'dashed',
117
- intent: intent,
118
- orientation: 'vertical',
119
- styles: {
120
- borderLeftColor: color,
121
- _web: { borderLeft: `1px dashed ${color}` },
122
- },
123
- });
124
-
125
- variants.push({
126
- type: 'dotted',
127
- intent: intent,
128
- orientation: 'horizontal',
129
- styles: {
130
- borderTopColor: color,
131
- _web: { borderTop: `1px dotted ${color}` },
132
- },
133
- });
134
-
135
- variants.push({
136
- type: 'dotted',
137
- intent: intent,
138
- orientation: 'vertical',
139
- styles: {
140
- borderLeftColor: color,
141
- _web: { borderLeft: `1px dotted ${color}` },
63
+ const thicknessValue = getThicknessValue(thickness);
64
+ const spacingValue = getSpacingValue(spacing);
65
+
66
+ const isHorizontal = orientation === 'horizontal';
67
+ const isDashedOrDotted = type === 'dashed' || type === 'dotted';
68
+
69
+ // Base dimension styles based on orientation and thickness
70
+ const dimensionStyles = isHorizontal
71
+ ? { width: '100%', height: thicknessValue, flexDirection: 'row' as const }
72
+ : { width: thicknessValue, height: '100%', flexDirection: 'column' as const };
73
+
74
+ // Spacing styles based on orientation
75
+ const spacingStyles = isHorizontal
76
+ ? { marginVertical: spacingValue }
77
+ : { marginHorizontal: spacingValue };
78
+
79
+ // Web-specific border styles for dashed/dotted
80
+ const webBorderStyles = isDashedOrDotted ? {
81
+ border: 'none',
82
+ backgroundColor: 'transparent',
83
+ ...(isHorizontal
84
+ ? { borderTop: `${thicknessValue}px ${type} ${color}` }
85
+ : { borderLeft: `${thicknessValue}px ${type} ${color}` }
86
+ ),
87
+ } : {};
88
+
89
+ return {
90
+ backgroundColor: isDashedOrDotted ? 'transparent' : color,
91
+ ...dimensionStyles,
92
+ ...spacingStyles,
93
+ variants: {
94
+ length: {
95
+ full: {},
96
+ auto: {},
97
+ },
142
98
  },
143
- });
144
- }
145
-
146
- return variants;
99
+ _web: webBorderStyles,
100
+ } as const;
101
+ };
147
102
  }
148
103
 
149
- function createLineCompoundVariants(): CompoundVariants<keyof DividerVariants> {
150
- return [
151
- { orientation: 'horizontal', thickness: 'thin', styles: { height: 1 } },
152
- { orientation: 'horizontal', thickness: 'md', styles: { height: 2 } },
153
- { orientation: 'horizontal', thickness: 'thick', styles: { height: 4 } },
154
- { orientation: 'vertical', thickness: 'thin', styles: { width: 1 } },
155
- { orientation: 'vertical', thickness: 'md', styles: { width: 2 } },
156
- { orientation: 'vertical', thickness: 'thick', styles: { width: 4 } },
157
- ] as const;
104
+ /**
105
+ * Create dynamic line styles (for dividers with content)
106
+ */
107
+ function createLineStyles(theme: Theme) {
108
+ return ({ orientation = 'horizontal', thickness = 'thin' }: LineDynamicProps) => {
109
+ const thicknessValue = getThicknessValue(thickness);
110
+ const isHorizontal = orientation === 'horizontal';
111
+
112
+ return {
113
+ backgroundColor: theme.colors.border.secondary,
114
+ flex: 1,
115
+ ...(isHorizontal
116
+ ? { height: thicknessValue }
117
+ : { width: thicknessValue }
118
+ ),
119
+ } as const;
120
+ };
158
121
  }
159
122
 
160
123
  // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
161
124
  // transform on native cannot resolve function calls to extract variant structures.
162
125
  export const dividerStyles = StyleSheet.create((theme: Theme) => {
163
- return {
164
- divider: {
165
- backgroundColor: theme.colors.border.secondary,
166
- variants: {
167
- orientation: {
168
- horizontal: {
169
- width: '100%',
170
- height: 1,
171
- flexDirection: 'row',
172
- },
173
- vertical: {
174
- width: 1,
175
- height: '100%',
176
- flexDirection: 'column',
177
- },
178
- },
179
- thickness: {
180
- thin: {},
181
- md: {},
182
- thick: {},
183
- },
184
- type: {
185
- solid: {},
186
- dashed: {
187
- backgroundColor: 'transparent',
188
- _web: {
189
- border: 'none',
190
- backgroundColor: 'transparent',
126
+ // Apply extensions to main visual elements
127
+ const extended = applyExtensions('Divider', theme, {
128
+ divider: createDividerStyles(theme),
129
+ });
130
+
131
+ return {
132
+ ...extended,
133
+ // Minor utility styles (not extended)
134
+ container: {
135
+ alignItems: 'center',
136
+ justifyContent: 'center',
137
+ display: 'flex',
138
+ variants: {
139
+ orientation: {
140
+ horizontal: {
141
+ flexDirection: 'row',
142
+ width: '100%',
191
143
  },
192
- },
193
- dotted: {
194
- backgroundColor: 'transparent',
195
- _web: {
196
- border: 'none',
197
- backgroundColor: 'transparent',
144
+ vertical: {
145
+ flexDirection: 'column',
146
+ height: '100%',
198
147
  },
199
148
  },
200
- },
201
- intent: {
202
- primary: { backgroundColor: theme.intents.primary.primary },
203
- secondary: { backgroundColor: theme.colors.border.primary },
204
- neutral: { backgroundColor: theme.colors.border.secondary },
205
- success: { backgroundColor: theme.intents.success.primary },
206
- error: { backgroundColor: theme.intents.error.primary },
207
- warning: { backgroundColor: theme.intents.warning.primary },
208
- info: { backgroundColor: theme.intents.primary.primary },
209
- },
210
- length: {
211
- full: {},
212
- auto: {},
213
- },
214
- spacing: {
215
- none: { margin: 0 },
216
- sm: {},
217
- md: {},
218
- lg: {},
219
- },
220
- },
221
- compoundVariants: createDividerCompoundVariants(theme),
222
- } as const,
223
- container: {
224
- alignItems: 'center',
225
- justifyContent: 'center',
226
- display: 'flex',
227
- variants: {
228
- orientation: {
229
- horizontal: {
230
- flexDirection: 'row',
231
- width: '100%',
232
- },
233
- vertical: {
234
- flexDirection: 'column',
235
- height: '100%',
149
+ spacing: {
150
+ none: { gap: 0 },
151
+ xs: { gap: 4 },
152
+ sm: { gap: 8 },
153
+ md: { gap: 16 },
154
+ lg: { gap: 24 },
155
+ xl: { gap: 32 },
236
156
  },
237
157
  },
238
- spacing: {
239
- none: { gap: 0 },
240
- xs: { gap: 4 },
241
- sm: { gap: 8 },
242
- md: { gap: 16 },
243
- lg: { gap: 24 },
244
- xl: { gap: 32 },
245
- },
246
158
  },
247
- },
248
- content: {
249
- backgroundColor: theme.colors.surface.primary,
250
- color: theme.colors.text.secondary,
251
- fontSize: 14,
252
- variants: {
253
- orientation: {
254
- horizontal: {
255
- paddingHorizontal: 8,
256
- },
257
- vertical: {
258
- paddingVertical: 8,
159
+ content: {
160
+ backgroundColor: theme.colors.surface.primary,
161
+ color: theme.colors.text.secondary,
162
+ fontSize: 14,
163
+ variants: {
164
+ orientation: {
165
+ horizontal: {
166
+ paddingHorizontal: 8,
167
+ },
168
+ vertical: {
169
+ paddingVertical: 8,
170
+ },
259
171
  },
260
172
  },
261
173
  },
262
- },
263
- line: {
264
- backgroundColor: theme.colors.border.secondary,
265
- flex: 1,
266
- variants: {
267
- orientation: {
268
- horizontal: { height: 1 },
269
- vertical: { width: 1 },
270
- },
271
- thickness: {
272
- thin: {},
273
- md: {},
274
- thick: {},
275
- },
276
- },
277
- compoundVariants: createLineCompoundVariants(),
278
- },
279
- };
174
+ line: createLineStyles(theme),
175
+ };
280
176
  });
@@ -17,30 +17,33 @@ const Divider = forwardRef<HTMLDivElement, DividerProps>(({
17
17
  accessibilityLabel,
18
18
  id,
19
19
  }, ref) => {
20
- // Apply variants for main divider
20
+ // Apply variants for container, content (orientation, spacing)
21
21
  dividerStyles.useVariants({
22
+ orientation,
23
+ spacing,
24
+ length: typeof length === 'number' ? 'auto' : length,
25
+ });
26
+
27
+ // Get dynamic divider style
28
+ const dividerStyle = (dividerStyles.divider as any)({
22
29
  orientation,
23
30
  thickness,
24
31
  type,
25
32
  intent,
26
- length: typeof length === 'number' ? 'auto' : length,
27
33
  spacing,
28
34
  });
29
35
 
30
- // Create style arrays
31
-
32
- const containerStyleArray = [dividerStyles.container];
33
- const contentStyleArray = [dividerStyles.content];
34
- const lineStyleArray = [dividerStyles.line];
36
+ // Get dynamic line style
37
+ const lineStyle = (dividerStyles.line as any)({
38
+ orientation,
39
+ thickness,
40
+ });
35
41
 
36
42
  // Generate web props
37
- const dividerProps = getWebProps([
38
- dividerStyles.divider,
39
- style as any,
40
- ]);
41
- const containerProps = getWebProps(containerStyleArray);
42
- const contentProps = getWebProps(contentStyleArray);
43
- const lineProps = getWebProps(lineStyleArray);
43
+ const dividerProps = getWebProps([dividerStyle, style as any]);
44
+ const containerProps = getWebProps([dividerStyles.container]);
45
+ const contentProps = getWebProps([dividerStyles.content]);
46
+ const lineProps = getWebProps([lineStyle]);
44
47
 
45
48
  const mergedDividerRef = useMergeRefs(ref, dividerProps.ref);
46
49
  const mergedContainerRef = useMergeRefs(ref, containerProps.ref);
@@ -1,7 +1,8 @@
1
- import { forwardRef } from 'react';
1
+ import { forwardRef, useMemo } from 'react';
2
2
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
3
3
  import { IconProps } from './types';
4
- import { iconStyles } from './Icon.styles';
4
+ import { iconStyles, buildIconSize } from './Icon.styles';
5
+ import { useUnistyles } from 'react-native-unistyles';
5
6
 
6
7
  const Icon = forwardRef<any, IconProps>(({
7
8
  name,
@@ -16,7 +17,13 @@ const Icon = forwardRef<any, IconProps>(({
16
17
 
17
18
 
18
19
  // Call dynamic style with variants
19
- const iconStyle = iconStyles.icon({ color, intent, size });
20
+ const iconStyle = (iconStyles.icon as any)({ color, intent, size });
21
+
22
+ const { theme } = useUnistyles();
23
+
24
+ const iconSize = useMemo(() => {
25
+ return buildIconSize(theme, size).width;
26
+ }, [theme, size]);
20
27
 
21
28
  // Get fontSize from styles for numeric size prop
22
29
 
@@ -24,6 +31,7 @@ const Icon = forwardRef<any, IconProps>(({
24
31
  <MaterialCommunityIcons
25
32
  ref={ref}
26
33
  nativeID={id}
34
+ size={iconSize}
27
35
  name={name}
28
36
  style={[iconStyle, style]}
29
37
  testID={testID}
@@ -2,6 +2,7 @@ import { StyleSheet } from 'react-native-unistyles';
2
2
  import { Theme, StylesheetStyles, Intent, Color, getColorFromString } from '@idealyst/theme';
3
3
  import { buildSizeVariants } from '../utils/buildSizeVariants';
4
4
  import { IconSizeVariant } from './types';
5
+ import { applyExtensions } from '../extensions/applyExtension';
5
6
 
6
7
  type IconVariants = {
7
8
  size: IconSizeVariant;
@@ -27,7 +28,7 @@ function getIconColor(theme: Theme, color?: Color, intent?: Intent): string {
27
28
  return theme.colors.text.primary;
28
29
  }
29
30
 
30
- function buildIconSize(theme: Theme, size?: IconSizeVariant) {
31
+ export function buildIconSize(theme: Theme, size?: IconSizeVariant) {
31
32
  // Handle direct numeric sizes
32
33
  if (typeof size === 'number') {
33
34
  return {
@@ -73,7 +74,12 @@ function createIconStyles(theme: Theme) {
73
74
  // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
74
75
  // transform on native cannot resolve function calls to extract variant structures.
75
76
  export const iconStyles = StyleSheet.create((theme: Theme) => {
76
- return {
77
- icon: createIconStyles(theme),
78
- } as const;
77
+ // Apply extensions to main visual elements
78
+ const extended = applyExtensions('Icon', theme, {
79
+ icon: createIconStyles(theme),
80
+ });
81
+
82
+ return {
83
+ ...extended,
84
+ };
79
85
  });