@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
@@ -9,7 +9,7 @@ import {
9
9
  } from './TabBar.styles';
10
10
  import type { TabBarProps, TabBarItem } from './types';
11
11
  import useMergeRefs from '../hooks/useMergeRefs';
12
- import { getWebAriaProps, generateAccessibilityId, TAB_KEYS } from '../utils/accessibility';
12
+ import { getWebAriaProps, generateAccessibilityId } from '../utils/accessibility';
13
13
 
14
14
  // Icon size mapping based on size variant
15
15
  const ICON_SIZES: Record<string, number> = {
@@ -66,23 +66,7 @@ const Tab: React.FC<TabProps> = ({
66
66
  }) => {
67
67
  const iconSize = ICON_SIZES[size || 'md'] || 18;
68
68
 
69
- // Apply tab and label types for this specific tab
70
- tabBarTabStyles.useVariants({
71
- size,
72
- type,
73
- active: isActive,
74
- disabled: Boolean(item.disabled),
75
- pillMode,
76
- iconPosition,
77
- justify,
78
- });
79
- tabBarLabelStyles.useVariants({
80
- size,
81
- type,
82
- pillMode,
83
- active: isActive,
84
- disabled: Boolean(item.disabled),
85
- });
69
+ // Apply icon variants (size, disabled, iconPosition)
86
70
  tabBarIconStyles.useVariants({
87
71
  size,
88
72
  active: isActive,
@@ -90,9 +74,13 @@ const Tab: React.FC<TabProps> = ({
90
74
  iconPosition,
91
75
  });
92
76
 
93
- const tabProps = getWebProps([tabBarTabStyles.tab]);
94
- const labelProps = getWebProps([tabBarLabelStyles.tabLabel]);
95
- const iconProps = getWebProps([tabBarIconStyles.tabIcon]);
77
+ // Compute dynamic styles for this tab
78
+ const tabStyle = (tabBarTabStyles.tab as any)({ type, size, active: isActive, pillMode, justify });
79
+ const labelStyle = (tabBarLabelStyles.tabLabel as any)({ type, active: isActive, pillMode });
80
+
81
+ const tabProps = getWebProps([tabStyle]);
82
+ const labelProps = getWebProps([labelStyle]);
83
+ const iconProps = getWebProps([tabBarIconStyles.tabIcon as any]);
96
84
 
97
85
  // Merge refs from getWebProps with our tracking ref
98
86
  const mergedRef = useMergeRefs<HTMLButtonElement>(
@@ -174,16 +162,16 @@ const TabBar: React.FC<TabBarProps> = ({
174
162
  const currentIndex = enabledItems.findIndex(item => item.value === itemValue);
175
163
  let nextIndex = -1;
176
164
 
177
- if (TAB_KEYS.next.includes(key)) {
165
+ if (key === 'ArrowRight') {
178
166
  e.preventDefault();
179
167
  nextIndex = currentIndex < enabledItems.length - 1 ? currentIndex + 1 : 0;
180
- } else if (TAB_KEYS.prev.includes(key)) {
168
+ } else if (key === 'ArrowLeft') {
181
169
  e.preventDefault();
182
170
  nextIndex = currentIndex > 0 ? currentIndex - 1 : enabledItems.length - 1;
183
- } else if (TAB_KEYS.first.includes(key)) {
171
+ } else if (key === 'Home') {
184
172
  e.preventDefault();
185
173
  nextIndex = 0;
186
- } else if (TAB_KEYS.last.includes(key)) {
174
+ } else if (key === 'End') {
187
175
  e.preventDefault();
188
176
  nextIndex = enabledItems.length - 1;
189
177
  }
@@ -255,11 +243,8 @@ const TabBar: React.FC<TabBarProps> = ({
255
243
  onChange?.(itemValue);
256
244
  };
257
245
 
258
- // Apply container and indicator types
259
- tabBarContainerStyles.useVariants({
260
- type,
261
- size,
262
- pillMode,
246
+ // Apply container variants (for spacing only)
247
+ (tabBarContainerStyles.useVariants as any)({
263
248
  justify,
264
249
  gap,
265
250
  padding,
@@ -269,10 +254,13 @@ const TabBar: React.FC<TabBarProps> = ({
269
254
  marginVertical,
270
255
  marginHorizontal,
271
256
  });
272
- const containerProps = getWebProps([tabBarContainerStyles.container, style as any]);
273
257
 
274
- tabBarIndicatorStyles.useVariants({ type, pillMode });
275
- const indicatorProps = getWebProps([tabBarIndicatorStyles.indicator]);
258
+ // Compute dynamic container and indicator styles
259
+ const containerStyle = (tabBarContainerStyles.container as any)({ type, pillMode });
260
+ const containerProps = getWebProps([containerStyle, style as any]);
261
+
262
+ const indicatorVisualStyle = (tabBarIndicatorStyles.indicator as any)({ type, pillMode });
263
+ const indicatorProps = getWebProps([indicatorVisualStyle]);
276
264
 
277
265
  // Merge container ref with getWebProps ref
278
266
  const mergedContainerRef = useMergeRefs<HTMLDivElement>(
@@ -50,6 +50,15 @@ function TableInner<T = any>({
50
50
  marginHorizontal,
51
51
  });
52
52
 
53
+ // Call styles as functions to get theme-reactive styles
54
+ const containerStyle = (tableStyles.container as any)({});
55
+ const tableStyle = (tableStyles.table as any)({});
56
+ const theadStyle = (tableStyles.thead as any)({});
57
+ const tbodyStyle = (tableStyles.tbody as any)({});
58
+ const rowStyle = (tableStyles.row as any)({});
59
+ const headerCellStyle = (tableStyles.headerCell as any)({});
60
+ const cellStyle = (tableStyles.cell as any)({});
61
+
53
62
  // Helper to get cell value
54
63
  const getCellValue = (column: TableColumn<T>, row: T, rowIndex: number) => {
55
64
  if (column.render) {
@@ -57,7 +66,7 @@ function TableInner<T = any>({
57
66
  return column.render(value, row, rowIndex);
58
67
  }
59
68
  const value = column.dataIndex ? (row as any)[column.dataIndex] : '';
60
- return <Text style={tableStyles.cell}>{String(value)}</Text>;
69
+ return <Text style={cellStyle}>{String(value)}</Text>;
61
70
  };
62
71
 
63
72
  const isClickable = !!onRowPress;
@@ -67,13 +76,13 @@ function TableInner<T = any>({
67
76
  ref={ref}
68
77
  nativeID={id}
69
78
  horizontal
70
- style={[tableStyles.container, style]}
79
+ style={[containerStyle, style]}
71
80
  testID={testID}
72
81
  {...nativeA11yProps}
73
82
  >
74
- <View style={tableStyles.table}>
83
+ <View style={tableStyle}>
75
84
  {/* Header */}
76
- <View style={tableStyles.thead}>
85
+ <View style={theadStyle}>
77
86
  <View style={{ flexDirection: 'row' }}>
78
87
  {columns.map((column) => {
79
88
  tableStyles.useVariants({
@@ -86,11 +95,11 @@ function TableInner<T = any>({
86
95
  <View
87
96
  key={column.key}
88
97
  style={[
89
- tableStyles.headerCell,
98
+ headerCellStyle,
90
99
  { width: column.width, flex: column.width ? undefined : 1 },
91
100
  ]}
92
101
  >
93
- <Text style={tableStyles.headerCell}>
102
+ <Text style={headerCellStyle}>
94
103
  {column.title}
95
104
  </Text>
96
105
  </View>
@@ -100,7 +109,7 @@ function TableInner<T = any>({
100
109
  </View>
101
110
 
102
111
  {/* Body */}
103
- <View style={tableStyles.tbody}>
112
+ <View style={tbodyStyle}>
104
113
  {data.map((row, rowIndex) => {
105
114
  tableStyles.useVariants({
106
115
  type,
@@ -112,7 +121,7 @@ function TableInner<T = any>({
112
121
  return (
113
122
  <RowComponent
114
123
  key={rowIndex}
115
- style={tableStyles.row}
124
+ style={rowStyle}
116
125
  onPress={isClickable ? () => onRowPress?.(row, rowIndex) : undefined}
117
126
  testID={`${testID}-row-${rowIndex}`}
118
127
  >
@@ -128,7 +137,7 @@ function TableInner<T = any>({
128
137
  <View
129
138
  key={column.key}
130
139
  style={[
131
- tableStyles.cell,
140
+ cellStyle,
132
141
  { width: column.width, flex: column.width ? undefined : 1 },
133
142
  ]}
134
143
  >
@@ -0,0 +1,311 @@
1
+ import { StyleSheet } from 'react-native-unistyles';
2
+ import { Theme, StylesheetStyles, CompoundVariants, Size } from '@idealyst/theme';
3
+ import { buildSizeVariants } from '../utils/buildSizeVariants';
4
+ import {
5
+ buildGapVariants,
6
+ buildPaddingVariants,
7
+ buildPaddingVerticalVariants,
8
+ buildPaddingHorizontalVariants,
9
+ buildMarginVariants,
10
+ buildMarginVerticalVariants,
11
+ buildMarginHorizontalVariants,
12
+ } from '../utils/buildViewStyleVariants';
13
+ import { applyExtensions } from '../extensions/applyExtension';
14
+
15
+ type TableType = 'default' | 'bordered' | 'striped';
16
+
17
+ type TableRowVariants = {
18
+ type: TableType;
19
+ clickable: boolean;
20
+ }
21
+ /**
22
+ * Create type variants for container
23
+ */
24
+ function createContainerTypeVariants(theme: Theme) {
25
+ return {
26
+ standard: {
27
+ borderWidth: 1,
28
+ borderStyle: 'solid',
29
+ borderColor: theme.colors.border.primary,
30
+ borderRadius: 8,
31
+ overflow: 'hidden',
32
+ _web: {
33
+ border: `1px solid ${theme.colors.border.primary}`,
34
+ },
35
+ },
36
+ bordered: {
37
+ borderWidth: 1,
38
+ borderStyle: 'solid',
39
+ borderColor: theme.colors.border.primary,
40
+ borderRadius: 8,
41
+ overflow: 'hidden',
42
+ _web: {
43
+ border: `1px solid ${theme.colors.border.primary}`,
44
+ },
45
+ },
46
+ striped: {
47
+ borderWidth: 1,
48
+ borderStyle: 'solid',
49
+ borderColor: theme.colors.border.primary,
50
+ borderRadius: 8,
51
+ overflow: 'hidden',
52
+ _web: {
53
+ border: `1px solid ${theme.colors.border.primary}`,
54
+ },
55
+ },
56
+ } as const;
57
+ }
58
+
59
+ /**
60
+ * Create type variants for row
61
+ */
62
+ function createRowTypeVariants(theme: Theme) {
63
+ return {
64
+ standard: {},
65
+ bordered: {
66
+ borderBottomWidth: 1,
67
+ borderBottomStyle: 'solid',
68
+ borderBottomColor: theme.colors.border.primary,
69
+ _web: {
70
+ borderBottom: `1px solid ${theme.colors.border.primary}`,
71
+ },
72
+ },
73
+ striped: {
74
+ borderBottomWidth: 1,
75
+ borderBottomStyle: 'solid',
76
+ borderBottomColor: theme.colors.border.primary,
77
+ _web: {
78
+ borderBottom: `1px solid ${theme.colors.border.primary}`,
79
+ ':nth-child(even)': {
80
+ backgroundColor: theme.colors.surface.secondary,
81
+ },
82
+ },
83
+ },
84
+ } as const;
85
+ }
86
+
87
+ /**
88
+ * Create compound variants for row
89
+ */
90
+ function createRowCompoundVariants(theme: Theme): CompoundVariants<keyof TableRowVariants> {
91
+ return [
92
+ {
93
+ type: 'striped',
94
+ clickable: true,
95
+ styles: {
96
+ _web: {
97
+ _hover: {
98
+ backgroundColor: theme.colors.surface.tertiary,
99
+ },
100
+ },
101
+ },
102
+ },
103
+ ] as const;
104
+ }
105
+
106
+ /**
107
+ * Create size variants for header cell
108
+ */
109
+ function createHeaderCellSizeVariants(theme: Theme) {
110
+ return buildSizeVariants(theme, 'table', (size) => ({
111
+ padding: size.padding,
112
+ fontSize: size.fontSize,
113
+ lineHeight: size.lineHeight,
114
+ }));
115
+ }
116
+
117
+ /**
118
+ * Create type variants for header cell
119
+ */
120
+ function createHeaderCellTypeVariants(theme: Theme) {
121
+ return {
122
+ standard: {},
123
+ bordered: {
124
+ borderRightWidth: 1,
125
+ borderRightStyle: 'solid',
126
+ borderRightColor: theme.colors.border.primary,
127
+ _web: {
128
+ borderRight: `1px solid ${theme.colors.border.primary}`,
129
+ ':last-child': {
130
+ borderRight: 'none',
131
+ },
132
+ },
133
+ },
134
+ striped: {},
135
+ } as const;
136
+ }
137
+
138
+ /**
139
+ * Create size variants for cell
140
+ */
141
+ function createCellSizeVariants(theme: Theme) {
142
+ return buildSizeVariants(theme, 'table', (size) => ({
143
+ padding: size.padding,
144
+ fontSize: size.fontSize,
145
+ lineHeight: size.lineHeight,
146
+ }));
147
+ }
148
+
149
+ /**
150
+ * Create type variants for cell
151
+ */
152
+ function createCellTypeVariants(theme: Theme) {
153
+ return {
154
+ standard: {},
155
+ bordered: {
156
+ borderRightWidth: 1,
157
+ borderRightStyle: 'solid',
158
+ borderRightColor: theme.colors.border.primary,
159
+ _web: {
160
+ borderRight: `1px solid ${theme.colors.border.primary}`,
161
+ ':last-child': {
162
+ borderRight: 'none',
163
+ },
164
+ },
165
+ },
166
+ striped: {},
167
+ } as const;
168
+ }
169
+
170
+ function createContainerStyles(theme: Theme) {
171
+ return () => ({
172
+ width: '100%',
173
+ _web: {
174
+ overflow: 'auto',
175
+ },
176
+ variants: {
177
+ type: createContainerTypeVariants(theme),
178
+ // Spacing variants from ContainerStyleProps
179
+ gap: buildGapVariants(theme),
180
+ padding: buildPaddingVariants(theme),
181
+ paddingVertical: buildPaddingVerticalVariants(theme),
182
+ paddingHorizontal: buildPaddingHorizontalVariants(theme),
183
+ margin: buildMarginVariants(theme),
184
+ marginVertical: buildMarginVerticalVariants(theme),
185
+ marginHorizontal: buildMarginHorizontalVariants(theme),
186
+ },
187
+ });
188
+ }
189
+
190
+ const createTableStyles = (theme: Theme) => {
191
+ return {
192
+ width: '100%',
193
+ _web: {
194
+ borderCollapse: 'collapse',
195
+ },
196
+ } as const;
197
+ }
198
+
199
+ const createTheadStyles = (theme: Theme) => {
200
+ return {
201
+ backgroundColor: theme.colors.surface.secondary,
202
+ variants: {
203
+ sticky: {
204
+ true: {
205
+ _web: {
206
+ position: 'sticky',
207
+ top: 0,
208
+ zIndex: 10,
209
+ }
210
+ },
211
+ false: {},
212
+ },
213
+ },
214
+ } as const;
215
+ }
216
+
217
+ const createRowStyles = (theme: Theme) => {
218
+ return {
219
+ variants: {
220
+ type: createRowTypeVariants(theme),
221
+ clickable: {
222
+ true: {
223
+ _web: {
224
+ cursor: 'pointer',
225
+ _hover: {
226
+ backgroundColor: theme.colors.surface.secondary,
227
+ },
228
+ },
229
+ },
230
+ false: {},
231
+ },
232
+ },
233
+ compoundVariants: createRowCompoundVariants(theme),
234
+ _web: {
235
+ transition: 'background-color 0.2s ease',
236
+ },
237
+ } as const;
238
+ }
239
+
240
+ const createHeaderCellStyles = (theme: Theme) => {
241
+ return {
242
+ flexDirection: 'row',
243
+ alignItems: 'center',
244
+ textAlign: 'left',
245
+ fontWeight: '600',
246
+ color: theme.colors.text.primary,
247
+ borderBottomWidth: 2,
248
+ borderBottomStyle: 'solid',
249
+ borderBottomColor: theme.colors.border.primary,
250
+ _web: {
251
+ borderBottom: `2px solid ${theme.colors.border.primary}`,
252
+ },
253
+ variants: {
254
+ size: createHeaderCellSizeVariants(theme),
255
+ align: {
256
+ left: {
257
+ textAlign: 'left',
258
+ justifyContent: 'flex-start',
259
+ },
260
+ center: {
261
+ textAlign: 'center',
262
+ justifyContent: 'center',
263
+ },
264
+ right: {
265
+ textAlign: 'right',
266
+ justifyContent: 'flex-end',
267
+ },
268
+ },
269
+ type: createHeaderCellTypeVariants(theme),
270
+ },
271
+ } as const;
272
+ }
273
+
274
+ const createCellStyles = (theme: Theme) => {
275
+ return {
276
+ flexDirection: 'row',
277
+ alignItems: 'center',
278
+ textAlign: 'left',
279
+ color: theme.colors.text.primary,
280
+ variants: {
281
+ size: createCellSizeVariants(theme),
282
+ align: {
283
+ left: {
284
+ textAlign: 'left',
285
+ justifyContent: 'flex-start',
286
+ },
287
+ center: {
288
+ textAlign: 'center',
289
+ justifyContent: 'center',
290
+ },
291
+ right: {
292
+ textAlign: 'right',
293
+ justifyContent: 'flex-end',
294
+ },
295
+ },
296
+ type: createCellTypeVariants(theme),
297
+ },
298
+ } as const;
299
+ }
300
+
301
+ export const tableStyles = StyleSheet.create((theme: Theme) => {
302
+ return applyExtensions('Table', theme, {
303
+ container: createContainerStyles(theme),
304
+ table: createTableStyles(theme),
305
+ thead: createTheadStyles(theme),
306
+ tbody: {},
307
+ row: createRowStyles(theme),
308
+ headerCell: createHeaderCellStyles(theme),
309
+ cell: createCellStyles(theme),
310
+ });
311
+ });