@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.
Files changed (129) hide show
  1. package/package.json +3 -3
  2. package/plugin/web.js +280 -532
  3. package/src/Accordion/Accordion.native.tsx +8 -6
  4. package/src/Accordion/Accordion.styles.old.tsx +298 -0
  5. package/src/Accordion/Accordion.styles.tsx +102 -236
  6. package/src/Accordion/Accordion.web.tsx +1 -3
  7. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +94 -0
  8. package/src/ActivityIndicator/ActivityIndicator.styles.tsx +44 -74
  9. package/src/Alert/Alert.native.tsx +16 -6
  10. package/src/Alert/Alert.styles.old.tsx +209 -0
  11. package/src/Alert/Alert.styles.tsx +67 -149
  12. package/src/Alert/Alert.web.tsx +3 -4
  13. package/src/Avatar/Avatar.styles.old.tsx +99 -0
  14. package/src/Avatar/Avatar.styles.tsx +35 -80
  15. package/src/Badge/Badge.styles.old.tsx +157 -0
  16. package/src/Badge/Badge.styles.tsx +61 -121
  17. package/src/Badge/Badge.web.tsx +8 -15
  18. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +231 -0
  19. package/src/Breadcrumb/Breadcrumb.styles.tsx +83 -200
  20. package/src/Breadcrumb/Breadcrumb.web.tsx +31 -30
  21. package/src/Button/Button.native.tsx +14 -21
  22. package/src/Button/Button.styles.tsx +103 -140
  23. package/src/Button/Button.web.tsx +9 -19
  24. package/src/Card/Card.native.tsx +7 -11
  25. package/src/Card/Card.styles.old.tsx +160 -0
  26. package/src/Card/Card.styles.tsx +105 -142
  27. package/src/Card/Card.web.tsx +5 -4
  28. package/src/Checkbox/Checkbox.native.tsx +9 -5
  29. package/src/Checkbox/Checkbox.styles.old.tsx +271 -0
  30. package/src/Checkbox/Checkbox.styles.tsx +104 -216
  31. package/src/Checkbox/Checkbox.web.tsx +7 -8
  32. package/src/Chip/Chip.styles.old.tsx +184 -0
  33. package/src/Chip/Chip.styles.tsx +34 -72
  34. package/src/Chip/Chip.web.tsx +3 -5
  35. package/src/Dialog/Dialog.native.tsx +7 -4
  36. package/src/Dialog/Dialog.styles.old.tsx +202 -0
  37. package/src/Dialog/Dialog.styles.tsx +69 -133
  38. package/src/Dialog/Dialog.web.tsx +3 -3
  39. package/src/Dialog/types.ts +1 -1
  40. package/src/Divider/Divider.styles.old.tsx +172 -0
  41. package/src/Divider/Divider.styles.tsx +62 -84
  42. package/src/Icon/Icon.native.tsx +8 -8
  43. package/src/Icon/Icon.styles.old.tsx +81 -0
  44. package/src/Icon/Icon.styles.tsx +52 -66
  45. package/src/Icon/Icon.web.tsx +62 -21
  46. package/src/Icon/IconRegistry.native.ts +41 -0
  47. package/src/Icon/IconRegistry.ts +107 -0
  48. package/src/Icon/IconSvg/IconSvg.web.tsx +28 -5
  49. package/src/Icon/icon-resolver.ts +12 -43
  50. package/src/Icon/index.native.ts +2 -1
  51. package/src/Icon/index.ts +1 -0
  52. package/src/Icon/index.web.ts +1 -0
  53. package/src/Image/Image.styles.old.tsx +69 -0
  54. package/src/Image/Image.styles.tsx +46 -60
  55. package/src/Input/Input.native.tsx +138 -53
  56. package/src/Input/Input.styles.old.tsx +289 -0
  57. package/src/Input/Input.styles.tsx +134 -232
  58. package/src/Input/Input.web.tsx +5 -8
  59. package/src/List/List.native.tsx +5 -2
  60. package/src/List/List.styles.old.tsx +242 -0
  61. package/src/List/List.styles.tsx +179 -215
  62. package/src/List/ListItem.native.tsx +16 -11
  63. package/src/List/ListItem.web.tsx +26 -16
  64. package/src/Menu/Menu.styles.old.tsx +197 -0
  65. package/src/Menu/Menu.styles.tsx +68 -150
  66. package/src/Menu/MenuItem.native.tsx +5 -3
  67. package/src/Menu/MenuItem.styles.old.tsx +114 -0
  68. package/src/Menu/MenuItem.styles.tsx +57 -89
  69. package/src/Menu/MenuItem.web.tsx +10 -7
  70. package/src/Popover/Popover.native.tsx +10 -4
  71. package/src/Popover/Popover.styles.old.tsx +135 -0
  72. package/src/Popover/Popover.styles.tsx +51 -112
  73. package/src/Pressable/Pressable.styles.old.tsx +27 -0
  74. package/src/Pressable/Pressable.styles.tsx +35 -27
  75. package/src/Progress/Progress.styles.old.tsx +200 -0
  76. package/src/Progress/Progress.styles.tsx +75 -164
  77. package/src/RadioButton/RadioButton.native.tsx +4 -3
  78. package/src/RadioButton/RadioButton.styles.old.tsx +175 -0
  79. package/src/RadioButton/RadioButton.styles.tsx +83 -154
  80. package/src/RadioButton/RadioButton.web.tsx +2 -2
  81. package/src/SVGImage/SVGImage.styles.old.tsx +86 -0
  82. package/src/SVGImage/SVGImage.styles.tsx +35 -78
  83. package/src/Screen/Screen.native.tsx +19 -26
  84. package/src/Screen/Screen.styles.old.tsx +87 -0
  85. package/src/Screen/Screen.styles.tsx +103 -68
  86. package/src/Screen/Screen.web.tsx +2 -2
  87. package/src/Select/Select.native.tsx +42 -33
  88. package/src/Select/Select.styles.old.tsx +353 -0
  89. package/src/Select/Select.styles.tsx +214 -300
  90. package/src/Select/Select.web.tsx +45 -33
  91. package/src/Skeleton/Skeleton.styles.old.tsx +67 -0
  92. package/src/Skeleton/Skeleton.styles.tsx +29 -53
  93. package/src/Slider/Slider.styles.old.tsx +259 -0
  94. package/src/Slider/Slider.styles.tsx +153 -234
  95. package/src/Slider/Slider.web.tsx +2 -4
  96. package/src/Switch/Switch.native.tsx +9 -7
  97. package/src/Switch/Switch.styles.old.tsx +203 -0
  98. package/src/Switch/Switch.styles.tsx +101 -174
  99. package/src/Switch/Switch.web.tsx +7 -8
  100. package/src/TabBar/TabBar.native.tsx +3 -2
  101. package/src/TabBar/TabBar.styles.old.tsx +343 -0
  102. package/src/TabBar/TabBar.styles.tsx +145 -279
  103. package/src/Table/Table.native.tsx +180 -68
  104. package/src/Table/Table.styles.old.tsx +311 -0
  105. package/src/Table/Table.styles.tsx +140 -281
  106. package/src/Table/Table.web.tsx +169 -70
  107. package/src/Text/Text.native.tsx +1 -3
  108. package/src/Text/Text.style.demo.tsx +16 -0
  109. package/src/Text/Text.styles.old.tsx +219 -0
  110. package/src/Text/Text.styles.tsx +94 -84
  111. package/src/Text/Text.web.tsx +3 -2
  112. package/src/Text/index.ts +1 -0
  113. package/src/TextArea/TextArea.native.tsx +21 -8
  114. package/src/TextArea/TextArea.styles.old.tsx +213 -0
  115. package/src/TextArea/TextArea.styles.tsx +87 -187
  116. package/src/TextArea/TextArea.web.tsx +17 -6
  117. package/src/Tooltip/Tooltip.styles.old.tsx +82 -0
  118. package/src/Tooltip/Tooltip.styles.tsx +32 -56
  119. package/src/Video/Video.styles.old.tsx +51 -0
  120. package/src/Video/Video.styles.tsx +32 -44
  121. package/src/View/View.native.tsx +41 -13
  122. package/src/View/View.styles.old.tsx +125 -0
  123. package/src/View/View.styles.tsx +76 -106
  124. package/src/View/View.web.tsx +5 -21
  125. package/src/View/types.ts +31 -3
  126. package/src/examples/ButtonExamples.tsx +20 -0
  127. package/src/examples/CardExamples.tsx +0 -6
  128. package/src/extensions/extendComponent.ts +61 -0
  129. package/src/index.ts +1 -1
@@ -1,73 +1,29 @@
1
+ /**
2
+ * Dialog styles using defineStyle with dynamic props.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles } from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
4
- type DialogSize = 'sm' | 'md' | 'lg' | 'fullscreen';
5
- type DialogType = 'default' | 'alert' | 'confirmation';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme } from '@idealyst/theme';
6
7
 
7
- type DialogVariants = {
8
- size: DialogSize;
9
- type: DialogType;
10
- }
8
+ // Required: Unistyles must see StyleSheet usage in original source to process this file
9
+ void StyleSheet;
11
10
 
12
- export type ExpandedDialogStyles = StylesheetStyles<keyof DialogVariants>;
11
+ // Wrap theme for $iterator support
12
+ type Theme = ThemeStyleWrapper<BaseTheme>;
13
13
 
14
- export type DialogStylesheet = {
15
- backdrop: ExpandedDialogStyles;
16
- container: ExpandedDialogStyles;
17
- header: ExpandedDialogStyles;
18
- title: ExpandedDialogStyles;
19
- closeButton: ExpandedDialogStyles;
20
- closeButtonText: ExpandedDialogStyles;
21
- content: ExpandedDialogStyles;
22
- modal: ExpandedDialogStyles;
23
- }
14
+ type DialogSize = 'sm' | 'md' | 'lg' | 'fullscreen';
15
+ type DialogType = 'default' | 'alert' | 'confirmation';
24
16
 
25
- /**
26
- * Create size variants for container
27
- */
28
- function createContainerSizeVariants() {
29
- return {
30
- sm: {
31
- width: '90%',
32
- maxWidth: 400,
33
- },
34
- md: {
35
- width: '90%',
36
- maxWidth: 600,
37
- },
38
- lg: {
39
- width: '90%',
40
- maxWidth: 800,
41
- },
42
- fullscreen: {
43
- width: '100%',
44
- height: '100%',
45
- borderRadius: 0,
46
- maxHeight: '100%',
47
- },
48
- } as const;
49
- }
17
+ export type DialogDynamicProps = {
18
+ size?: DialogSize;
19
+ type?: DialogType;
20
+ };
50
21
 
51
22
  /**
52
- * Create type variants for container
23
+ * Dialog styles with size/type handling.
53
24
  */
54
- function createContainerTypeVariants(theme: Theme) {
55
- return {
56
- standard: {},
57
- alert: {
58
- borderTopWidth: 4,
59
- borderTopColor: theme.colors.border.primary,
60
- },
61
- confirmation: {
62
- borderTopWidth: 4,
63
- borderTopColor: theme.colors.border.primary,
64
- },
65
- } as const;
66
- }
67
-
68
- // Helper functions to create static styles wrapped in dynamic functions
69
- function createBackdropStyles() {
70
- return () => ({
25
+ export const dialogStyles = defineStyle('Dialog', (theme: Theme) => ({
26
+ backdrop: (_props: DialogDynamicProps) => ({
71
27
  position: 'absolute' as const,
72
28
  top: 0,
73
29
  left: 0,
@@ -82,37 +38,47 @@ function createBackdropStyles() {
82
38
  position: 'fixed',
83
39
  transition: 'opacity 150ms ease-out',
84
40
  },
85
- });
86
- }
41
+ }),
87
42
 
88
- function createDialogContainerStyles(theme: Theme) {
89
- return () => ({
90
- backgroundColor: theme.colors.surface.primary,
91
- borderRadius: 12,
92
- shadowColor: '#000',
93
- shadowOffset: { width: 0, height: 10 },
94
- shadowOpacity: 0.25,
95
- shadowRadius: 20,
96
- elevation: 10,
97
- maxHeight: '90%',
98
- variants: {
99
- size: createContainerSizeVariants(),
100
- type: createContainerTypeVariants(theme),
101
- },
102
- _web: {
103
- position: 'relative',
104
- display: 'flex',
105
- flexDirection: 'column',
106
- overflow: 'auto',
107
- boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
108
- transition: 'opacity 150ms ease-out, transform 150ms ease-out',
109
- transformOrigin: 'center center',
110
- },
111
- });
112
- }
43
+ container: ({ size = 'md', type = 'default' }: DialogDynamicProps) => {
44
+ // Size dimensions
45
+ const sizeStyles = {
46
+ sm: { width: '90%', maxWidth: 400 },
47
+ md: { width: '90%', maxWidth: 600 },
48
+ lg: { width: '90%', maxWidth: 800 },
49
+ fullscreen: { width: '100%', height: '100%', borderRadius: 0, maxHeight: '100%' },
50
+ }[size];
113
51
 
114
- function createHeaderStyles(theme: Theme) {
115
- return () => ({
52
+ // Type-specific styles
53
+ const typeStyles = type !== 'default' ? {
54
+ borderTopWidth: 4,
55
+ borderTopColor: theme.colors.border.primary,
56
+ } : {};
57
+
58
+ return {
59
+ backgroundColor: theme.colors.surface.primary,
60
+ borderRadius: 12,
61
+ shadowColor: '#000',
62
+ shadowOffset: { width: 0, height: 10 },
63
+ shadowOpacity: 0.25,
64
+ shadowRadius: 20,
65
+ elevation: 10,
66
+ maxHeight: '90%',
67
+ ...sizeStyles,
68
+ ...typeStyles,
69
+ _web: {
70
+ position: 'relative',
71
+ display: 'flex',
72
+ flexDirection: 'column',
73
+ overflow: 'auto',
74
+ boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
75
+ transition: 'opacity 150ms ease-out, transform 150ms ease-out',
76
+ transformOrigin: 'center center',
77
+ },
78
+ } as const;
79
+ },
80
+
81
+ header: (_props: DialogDynamicProps) => ({
116
82
  borderBottomWidth: 1,
117
83
  borderBottomColor: theme.colors.border.primary,
118
84
  display: 'flex' as const,
@@ -122,11 +88,9 @@ function createHeaderStyles(theme: Theme) {
122
88
  _web: {
123
89
  borderBottomStyle: 'solid',
124
90
  },
125
- });
126
- }
91
+ }),
127
92
 
128
- function createTitleStyles(theme: Theme) {
129
- return () => ({
93
+ title: (_props: DialogDynamicProps) => ({
130
94
  marginLeft: 24,
131
95
  fontSize: 18,
132
96
  paddingVertical: 16,
@@ -136,11 +100,9 @@ function createTitleStyles(theme: Theme) {
136
100
  _web: {
137
101
  paddingVertical: 4,
138
102
  },
139
- });
140
- }
103
+ }),
141
104
 
142
- function createCloseButtonStyles(theme: Theme) {
143
- return () => ({
105
+ closeButton: (_props: DialogDynamicProps) => ({
144
106
  width: 32,
145
107
  height: 32,
146
108
  marginRight: 16,
@@ -156,51 +118,25 @@ function createCloseButtonStyles(theme: Theme) {
156
118
  backgroundColor: theme.colors.surface.secondary,
157
119
  },
158
120
  },
159
- });
160
- }
121
+ }),
161
122
 
162
- function createCloseButtonTextStyles(theme: Theme) {
163
- return () => ({
123
+ closeButtonText: (_props: DialogDynamicProps) => ({
164
124
  fontSize: 18,
165
125
  color: theme.colors.text.secondary,
166
126
  fontWeight: '500' as const,
167
- });
168
- }
127
+ }),
169
128
 
170
- function createContentStyles() {
171
- return () => ({
129
+ content: (_props: DialogDynamicProps) => ({
172
130
  padding: 24,
173
131
  _web: {
174
132
  overflow: 'visible',
175
133
  maxHeight: 'none',
176
134
  },
177
- });
178
- }
135
+ }),
179
136
 
180
- function createModalStyles() {
181
- return () => ({
137
+ modal: (_props: DialogDynamicProps) => ({
182
138
  margin: 0,
183
139
  justifyContent: 'center' as const,
184
140
  alignItems: 'center' as const,
185
- });
186
- }
187
-
188
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel transform on native cannot resolve function calls to extract variant structures.
189
- export const dialogStyles = StyleSheet.create((theme: Theme) => {
190
- // Apply extensions to main visual elements
191
- const extended = applyExtensions('Dialog', theme, {
192
- backdrop: createBackdropStyles(),
193
- container: createDialogContainerStyles(theme),
194
- header: createHeaderStyles(theme),
195
- content: createContentStyles(),
196
- });
197
-
198
- return {
199
- ...extended,
200
- // Minor utility styles (not extended)
201
- title: createTitleStyles(theme)(),
202
- closeButton: createCloseButtonStyles(theme)(),
203
- closeButtonText: createCloseButtonTextStyles(theme)(),
204
- modal: createModalStyles()(),
205
- };
206
- });
141
+ }),
142
+ }));
@@ -13,7 +13,7 @@ const Dialog = forwardRef<HTMLDivElement, DialogProps>(({
13
13
  title,
14
14
  children,
15
15
  size = 'md',
16
- type = 'standard',
16
+ type = 'default',
17
17
  showCloseButton = true,
18
18
  closeOnBackdropClick = true,
19
19
  closeOnEscapeKey = true,
@@ -144,8 +144,8 @@ const Dialog = forwardRef<HTMLDivElement, DialogProps>(({
144
144
  : { opacity: 0, transform: 'scale(0.96) translateY(-4px)' }
145
145
  ]);
146
146
  const headerProps = getWebProps([(dialogStyles.header as any)({})]);
147
- const titleProps = getWebProps([dialogStyles.title]);
148
- const closeButtonProps = getWebProps([dialogStyles.closeButton]);
147
+ const titleProps = getWebProps([(dialogStyles.title as any)({})]);
148
+ const closeButtonProps = getWebProps([(dialogStyles.closeButton as any)({})]);
149
149
  const contentProps = getWebProps([(dialogStyles.content as any)({})]);
150
150
 
151
151
  const mergedBackdropRef = useMergeRefs(ref, backdropProps.ref);
@@ -5,7 +5,7 @@ import { InteractiveAccessibilityProps } from '../utils/accessibility';
5
5
 
6
6
  // Component-specific type aliases for future extensibility
7
7
  export type DialogSizeVariant = 'sm' | 'md' | 'lg' | 'fullscreen';
8
- export type DialogType = 'standard' | 'alert' | 'confirmation';
8
+ export type DialogType = 'default' | 'alert' | 'confirmation';
9
9
  export type DialogAnimationType = 'slide' | 'fade' | 'none';
10
10
 
11
11
  export interface DialogProps extends BaseProps, InteractiveAccessibilityProps {
@@ -0,0 +1,172 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme, Intent } from '@idealyst/theme';
3
+ import { applyExtensions } from '../extensions/applyExtension';
4
+
5
+ type DividerOrientation = 'horizontal' | 'vertical';
6
+ type DividerThickness = 'thin' | 'md' | 'thick';
7
+ type DividerType = 'solid' | 'dashed' | 'dotted';
8
+ type DividerIntent = Intent | 'secondary' | 'neutral' | 'info';
9
+ type DividerLength = 'full' | 'auto';
10
+ type DividerSpacing = 'none' | 'sm' | 'md' | 'lg';
11
+
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
+ };
24
+
25
+ function getIntentColor(theme: Theme, intent: DividerIntent): string {
26
+ if (intent === 'secondary') return theme.colors.border.primary;
27
+ if (intent === 'neutral') return theme.colors.border.secondary;
28
+ if (intent === 'info') return theme.intents.primary.primary;
29
+ return theme.intents[intent as Intent].primary;
30
+ }
31
+
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
+ }
40
+
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
+ }
50
+
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) => {
62
+ const color = getIntentColor(theme, intent);
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
+ },
98
+ },
99
+ _web: webBorderStyles,
100
+ } as const;
101
+ };
102
+ }
103
+
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
+ };
121
+ }
122
+
123
+ // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
124
+ // transform on native cannot resolve function calls to extract variant structures.
125
+ export const dividerStyles = StyleSheet.create((theme: Theme) => {
126
+ // Apply extensions to main visual elements
127
+
128
+ return applyExtensions('Divider', theme, {divider: createDividerStyles(theme),
129
+ // Additional styles (merged from return)
130
+ // Minor utility styles (not extended)
131
+ container: {
132
+ alignItems: 'center',
133
+ justifyContent: 'center',
134
+ display: 'flex',
135
+ variants: {
136
+ orientation: {
137
+ horizontal: {
138
+ flexDirection: 'row',
139
+ width: '100%',
140
+ },
141
+ vertical: {
142
+ flexDirection: 'column',
143
+ height: '100%',
144
+ },
145
+ },
146
+ spacing: {
147
+ none: { gap: 0 },
148
+ xs: { gap: 4 },
149
+ sm: { gap: 8 },
150
+ md: { gap: 16 },
151
+ lg: { gap: 24 },
152
+ xl: { gap: 32 },
153
+ },
154
+ },
155
+ },
156
+ content: {
157
+ backgroundColor: theme.colors.surface.primary,
158
+ color: theme.colors.text.secondary,
159
+ fontSize: 14,
160
+ variants: {
161
+ orientation: {
162
+ horizontal: {
163
+ paddingHorizontal: 8,
164
+ },
165
+ vertical: {
166
+ paddingVertical: 8,
167
+ },
168
+ },
169
+ },
170
+ },
171
+ line: createLineStyles(theme)});
172
+ });
@@ -1,15 +1,24 @@
1
+ /**
2
+ * Divider styles using defineStyle with dynamic functions.
3
+ */
1
4
  import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Intent } from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
5
+ import { defineStyle, ThemeStyleWrapper } from '@idealyst/theme';
6
+ import type { Theme as BaseTheme, Intent } 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>;
4
13
 
5
14
  type DividerOrientation = 'horizontal' | 'vertical';
6
15
  type DividerThickness = 'thin' | 'md' | 'thick';
7
16
  type DividerType = 'solid' | 'dashed' | 'dotted';
8
17
  type DividerIntent = Intent | 'secondary' | 'neutral' | 'info';
9
- type DividerLength = 'full' | 'auto';
10
18
  type DividerSpacing = 'none' | 'sm' | 'md' | 'lg';
19
+ type DividerLength = 'full' | 'auto';
11
20
 
12
- type DividerDynamicProps = {
21
+ export type DividerDynamicProps = {
13
22
  orientation?: DividerOrientation;
14
23
  thickness?: DividerThickness;
15
24
  type?: DividerType;
@@ -17,18 +26,11 @@ type DividerDynamicProps = {
17
26
  spacing?: DividerSpacing;
18
27
  };
19
28
 
20
- type LineDynamicProps = {
29
+ export type LineDynamicProps = {
21
30
  orientation?: DividerOrientation;
22
31
  thickness?: DividerThickness;
23
32
  };
24
33
 
25
- function getIntentColor(theme: Theme, intent: DividerIntent): string {
26
- if (intent === 'secondary') return theme.colors.border.primary;
27
- if (intent === 'neutral') return theme.colors.border.secondary;
28
- if (intent === 'info') return theme.intents.primary.primary;
29
- return theme.intents[intent as Intent].primary;
30
- }
31
-
32
34
  function getThicknessValue(thickness: DividerThickness): number {
33
35
  switch (thickness) {
34
36
  case 'thin': return 1;
@@ -49,34 +51,38 @@ function getSpacingValue(spacing: DividerSpacing): number {
49
51
  }
50
52
 
51
53
  /**
52
- * Create dynamic divider styles
54
+ * Divider styles with dynamic functions for orientation/thickness/intent combinations.
53
55
  */
54
- function createDividerStyles(theme: Theme) {
55
- return ({
56
+ export const dividerStyles = defineStyle('Divider', (theme: Theme) => ({
57
+ divider: ({
56
58
  orientation = 'horizontal',
57
59
  thickness = 'thin',
58
60
  type = 'solid',
59
61
  intent = 'neutral',
60
62
  spacing = 'md'
61
63
  }: DividerDynamicProps) => {
62
- const color = getIntentColor(theme, intent);
63
64
  const thicknessValue = getThicknessValue(thickness);
64
65
  const spacingValue = getSpacingValue(spacing);
65
-
66
66
  const isHorizontal = orientation === 'horizontal';
67
67
  const isDashedOrDotted = type === 'dashed' || type === 'dotted';
68
68
 
69
- // Base dimension styles based on orientation and thickness
69
+ // Get color based on intent - inline for Unistyles to trace
70
+ const color = intent === 'secondary'
71
+ ? theme.colors.border.primary
72
+ : intent === 'neutral'
73
+ ? theme.colors.border.secondary
74
+ : intent === 'info'
75
+ ? theme.intents.primary.primary
76
+ : theme.intents[intent as Intent].primary;
77
+
70
78
  const dimensionStyles = isHorizontal
71
79
  ? { width: '100%', height: thicknessValue, flexDirection: 'row' as const }
72
80
  : { width: thicknessValue, height: '100%', flexDirection: 'column' as const };
73
81
 
74
- // Spacing styles based on orientation
75
82
  const spacingStyles = isHorizontal
76
83
  ? { marginVertical: spacingValue }
77
84
  : { marginHorizontal: spacingValue };
78
85
 
79
- // Web-specific border styles for dashed/dotted
80
86
  const webBorderStyles = isDashedOrDotted ? {
81
87
  border: 'none',
82
88
  backgroundColor: 'transparent',
@@ -98,14 +104,41 @@ function createDividerStyles(theme: Theme) {
98
104
  },
99
105
  _web: webBorderStyles,
100
106
  } as const;
101
- };
102
- }
107
+ },
108
+
109
+ container: (_props: { orientation?: DividerOrientation; spacing?: DividerSpacing }) => ({
110
+ alignItems: 'center',
111
+ justifyContent: 'center',
112
+ display: 'flex',
113
+ variants: {
114
+ orientation: {
115
+ horizontal: { flexDirection: 'row', width: '100%' },
116
+ vertical: { flexDirection: 'column', height: '100%' },
117
+ },
118
+ spacing: {
119
+ none: { gap: 0 },
120
+ xs: { gap: 4 },
121
+ sm: { gap: 8 },
122
+ md: { gap: 16 },
123
+ lg: { gap: 24 },
124
+ xl: { gap: 32 },
125
+ },
126
+ },
127
+ }),
128
+
129
+ content: (_props: { orientation?: DividerOrientation }) => ({
130
+ backgroundColor: theme.colors.surface.primary,
131
+ color: theme.colors.text.secondary,
132
+ fontSize: 14,
133
+ variants: {
134
+ orientation: {
135
+ horizontal: { paddingHorizontal: 8 },
136
+ vertical: { paddingVertical: 8 },
137
+ },
138
+ },
139
+ }),
103
140
 
104
- /**
105
- * Create dynamic line styles (for dividers with content)
106
- */
107
- function createLineStyles(theme: Theme) {
108
- return ({ orientation = 'horizontal', thickness = 'thin' }: LineDynamicProps) => {
141
+ line: ({ orientation = 'horizontal', thickness = 'thin' }: LineDynamicProps) => {
109
142
  const thicknessValue = getThicknessValue(thickness);
110
143
  const isHorizontal = orientation === 'horizontal';
111
144
 
@@ -117,60 +150,5 @@ function createLineStyles(theme: Theme) {
117
150
  : { width: thicknessValue }
118
151
  ),
119
152
  } as const;
120
- };
121
- }
122
-
123
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
124
- // transform on native cannot resolve function calls to extract variant structures.
125
- export const dividerStyles = StyleSheet.create((theme: Theme) => {
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%',
143
- },
144
- vertical: {
145
- flexDirection: 'column',
146
- height: '100%',
147
- },
148
- },
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 },
156
- },
157
- },
158
- },
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
- },
171
- },
172
- },
173
- },
174
- line: createLineStyles(theme),
175
- };
176
- });
153
+ },
154
+ }));