@idealyst/components 1.2.13 → 1.2.15

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 (95) hide show
  1. package/package.json +3 -3
  2. package/src/Accordion/Accordion.web.tsx +1 -1
  3. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -3
  4. package/src/ActivityIndicator/ActivityIndicator.web.tsx +3 -3
  5. package/src/Alert/Alert.native.tsx +1 -1
  6. package/src/Alert/Alert.web.tsx +1 -1
  7. package/src/Avatar/Avatar.native.tsx +1 -1
  8. package/src/Badge/Badge.web.tsx +6 -2
  9. package/src/Badge/types.ts +5 -0
  10. package/src/Breadcrumb/Breadcrumb.native.tsx +20 -21
  11. package/src/Button/Button.native.tsx +3 -3
  12. package/src/Button/Button.web.tsx +5 -1
  13. package/src/Button/types.ts +5 -0
  14. package/src/Card/Card.web.tsx +4 -1
  15. package/src/Card/types.ts +5 -0
  16. package/src/Dialog/Dialog.native.tsx +3 -3
  17. package/src/Divider/Divider.web.tsx +2 -2
  18. package/src/Icon/Icon.web.tsx +2 -2
  19. package/src/Icon/types.ts +3 -0
  20. package/src/Image/Image.styles.tsx +5 -5
  21. package/src/Image/Image.web.tsx +3 -3
  22. package/src/List/List.native.tsx +1 -2
  23. package/src/List/List.web.tsx +1 -2
  24. package/src/List/ListSection.web.tsx +3 -3
  25. package/src/Menu/Menu.web.tsx +8 -10
  26. package/src/Menu/MenuItem.web.tsx +1 -1
  27. package/src/Popover/Popover.web.tsx +1 -1
  28. package/src/Pressable/Pressable.web.tsx +1 -1
  29. package/src/Progress/Progress.styles.tsx +76 -30
  30. package/src/Progress/Progress.web.tsx +13 -15
  31. package/src/SVGImage/SVGImage.web.tsx +1 -1
  32. package/src/Select/Select.web.tsx +2 -2
  33. package/src/Skeleton/Skeleton.native.tsx +3 -3
  34. package/src/Skeleton/Skeleton.web.tsx +3 -3
  35. package/src/Slider/Slider.native.tsx +2 -2
  36. package/src/Slider/Slider.styles.tsx +131 -44
  37. package/src/Slider/Slider.web.tsx +22 -22
  38. package/src/TabBar/TabBar.native.tsx +2 -2
  39. package/src/Text/Text.web.tsx +29 -3
  40. package/src/Text/types.ts +14 -1
  41. package/src/TextArea/TextArea.styles.tsx +96 -57
  42. package/src/TextArea/TextArea.web.tsx +19 -28
  43. package/src/Tooltip/Tooltip.web.tsx +3 -3
  44. package/src/Video/Video.styles.tsx +3 -3
  45. package/src/Video/Video.web.tsx +1 -1
  46. package/src/View/View.styles.tsx +2 -2
  47. package/src/View/View.web.tsx +93 -9
  48. package/src/View/types.ts +5 -1
  49. package/src/examples/ViewExamples.tsx +34 -0
  50. package/src/extensions/index.ts +0 -7
  51. package/src/hooks/useMergeRefs.ts +12 -6
  52. package/src/index.native.ts +1 -1
  53. package/src/index.ts +1 -1
  54. package/src/utils/accessibility/keyboardPatterns.ts +4 -0
  55. package/src/utils/accessibility/types.ts +5 -1
  56. package/src/utils/accessibility/useAnnounce.ts +1 -1
  57. package/src/utils/accessibility/useKeyboardNavigation.ts +1 -1
  58. package/src/utils/index.ts +0 -3
  59. package/src/utils/viewStyleProps.ts +2 -0
  60. package/src/Accordion/Accordion.styles.old.tsx +0 -298
  61. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +0 -94
  62. package/src/Alert/Alert.styles.old.tsx +0 -209
  63. package/src/Avatar/Avatar.styles.old.tsx +0 -99
  64. package/src/Badge/Badge.styles.old.tsx +0 -157
  65. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +0 -231
  66. package/src/Card/Card.styles.old.tsx +0 -160
  67. package/src/Checkbox/Checkbox.styles.old.tsx +0 -271
  68. package/src/Chip/Chip.styles.old.tsx +0 -184
  69. package/src/Dialog/Dialog.styles.old.tsx +0 -202
  70. package/src/Divider/Divider.styles.old.tsx +0 -172
  71. package/src/Icon/Icon.styles.old.tsx +0 -81
  72. package/src/Image/Image.styles.old.tsx +0 -69
  73. package/src/Input/Input.styles.old.tsx +0 -289
  74. package/src/List/List.styles.old.tsx +0 -242
  75. package/src/Menu/Menu.styles.old.tsx +0 -197
  76. package/src/Menu/MenuItem.styles.old.tsx +0 -114
  77. package/src/Popover/Popover.styles.old.tsx +0 -135
  78. package/src/Pressable/Pressable.styles.old.tsx +0 -27
  79. package/src/Progress/Progress.styles.old.tsx +0 -200
  80. package/src/RadioButton/RadioButton.styles.old.tsx +0 -175
  81. package/src/SVGImage/SVGImage.styles.old.tsx +0 -86
  82. package/src/Screen/Screen.styles.old.tsx +0 -87
  83. package/src/Select/Select.styles.old.tsx +0 -353
  84. package/src/Skeleton/Skeleton.styles.old.tsx +0 -67
  85. package/src/Slider/Slider.styles.old.tsx +0 -259
  86. package/src/Switch/Switch.styles.old.tsx +0 -203
  87. package/src/TabBar/TabBar.styles.old.tsx +0 -343
  88. package/src/Table/Table.styles.old.tsx +0 -311
  89. package/src/Text/Text.styles.old.tsx +0 -219
  90. package/src/TextArea/TextArea.styles.old.tsx +0 -213
  91. package/src/Tooltip/Tooltip.styles.old.tsx +0 -82
  92. package/src/Video/Video.styles.old.tsx +0 -51
  93. package/src/View/View.styles.old.tsx +0 -125
  94. package/src/extensions/applyExtension.ts +0 -210
  95. package/src/utils/buildSizeVariants.ts +0 -16
@@ -1,160 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Intent, Radius } from '@idealyst/theme';
3
- import {
4
- buildGapVariants,
5
- buildPaddingVariants,
6
- buildPaddingVerticalVariants,
7
- buildPaddingHorizontalVariants,
8
- buildMarginVariants,
9
- buildMarginVerticalVariants,
10
- buildMarginHorizontalVariants,
11
- } from '../utils/buildViewStyleVariants';
12
- import { ViewStyleSize } from '../utils/viewStyleProps';
13
- import { applyExtensions } from '../extensions/applyExtension';
14
-
15
- type CardType = 'outlined' | 'elevated' | 'filled';
16
- type CardRadius = Radius;
17
- type CardIntent = Intent | 'info' | 'neutral';
18
-
19
- /**
20
- * Get border radius value from theme
21
- */
22
- export function getCardBorderRadius(theme: Theme, radius: CardRadius): number {
23
- return theme.radii[radius];
24
- }
25
-
26
- export type CardVariants = {
27
- type: CardType;
28
- radius: CardRadius;
29
- intent: CardIntent;
30
- clickable: boolean;
31
- disabled: boolean;
32
- // Spacing variants from ContainerStyleProps
33
- gap: ViewStyleSize;
34
- padding: ViewStyleSize;
35
- paddingVertical: ViewStyleSize;
36
- paddingHorizontal: ViewStyleSize;
37
- margin: ViewStyleSize;
38
- marginVertical: ViewStyleSize;
39
- marginHorizontal: ViewStyleSize;
40
- };
41
-
42
- type CardDynamicProps = {
43
- intent?: CardIntent;
44
- type?: CardType;
45
- };
46
-
47
- /**
48
- * Get the border color based on intent (only used for outlined type)
49
- */
50
- function getBorderColor(theme: Theme, intent: CardIntent): string {
51
- if (intent === 'info' || intent === 'neutral') {
52
- return theme.colors.border.secondary;
53
- }
54
- if (intent in theme.intents) {
55
- return theme.intents[intent as Intent].primary;
56
- }
57
- return theme.colors.border.secondary;
58
- }
59
-
60
- /**
61
- * Get type-specific styles
62
- */
63
- function getTypeStyles(theme: Theme, type: CardType, intent: CardIntent) {
64
- switch (type) {
65
- case 'outlined':
66
- return {
67
- backgroundColor: 'transparent',
68
- borderWidth: 1,
69
- borderStyle: 'solid' as const,
70
- borderColor: getBorderColor(theme, intent),
71
- };
72
- case 'elevated':
73
- return {
74
- backgroundColor: theme.colors.surface.primary,
75
- borderWidth: 0,
76
- ...theme.shadows.md,
77
- };
78
- case 'filled':
79
- return {
80
- backgroundColor: theme.colors.surface.secondary,
81
- borderWidth: 0,
82
- };
83
- default:
84
- return {};
85
- }
86
- }
87
-
88
- /**
89
- * Create dynamic card styles
90
- */
91
- function createCardStyles(theme: Theme) {
92
- return ({ intent = 'neutral', type = 'elevated' }: CardDynamicProps) => {
93
- const typeStyles = getTypeStyles(theme, type, intent);
94
- return {
95
- ...typeStyles,
96
- position: 'relative',
97
- overflow: 'hidden',
98
- variants: {
99
- radius: {
100
- none: { borderRadius: 0 },
101
- xs: { borderRadius: 2 },
102
- sm: { borderRadius: 4 },
103
- md: { borderRadius: 8 },
104
- lg: { borderRadius: 12 },
105
- xl: { borderRadius: 16 },
106
- },
107
- clickable: {
108
- true: {
109
- _web: {
110
- cursor: 'pointer',
111
- transition: 'all 0.2s ease',
112
- _hover: {
113
- transform: 'translateY(-2px)',
114
- boxShadow:
115
- '0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06)',
116
- },
117
- },
118
- },
119
- false: {
120
- _web: {
121
- cursor: 'default',
122
- },
123
- },
124
- },
125
- disabled: {
126
- true: {
127
- opacity: 0.6,
128
- _web: {
129
- cursor: 'not-allowed',
130
- },
131
- },
132
- false: {
133
- opacity: 1,
134
- },
135
- },
136
- // Spacing variants from ContainerStyleProps
137
- gap: buildGapVariants(theme),
138
- padding: buildPaddingVariants(theme),
139
- paddingVertical: buildPaddingVerticalVariants(theme),
140
- paddingHorizontal: buildPaddingHorizontalVariants(theme),
141
- margin: buildMarginVariants(theme),
142
- marginVertical: buildMarginVerticalVariants(theme),
143
- marginHorizontal: buildMarginHorizontalVariants(theme),
144
- },
145
- _web: {
146
- display: 'flex',
147
- flexDirection: 'column',
148
- boxSizing: 'border-box',
149
- },
150
- } as const;
151
- };
152
- }
153
-
154
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
155
- // transform on native cannot resolve function calls to extract variant structures.
156
- export const cardStyles = StyleSheet.create((theme: Theme) => {
157
- return applyExtensions('Card', theme, {
158
- card: createCardStyles(theme),
159
- });
160
- });
@@ -1,271 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Intent, Size } from '@idealyst/theme';
3
- import {
4
- buildMarginVariants,
5
- buildMarginVerticalVariants,
6
- buildMarginHorizontalVariants,
7
- } from '../utils/buildViewStyleVariants';
8
- import { applyExtensions } from '../extensions/applyExtension';
9
-
10
- type CheckboxSize = Size;
11
- type CheckboxIntent = Intent | 'info';
12
- type CheckboxType = 'default' | 'outlined';
13
-
14
- type CheckboxVariants = {
15
- size: CheckboxSize;
16
- intent: CheckboxIntent;
17
- type: CheckboxType;
18
- checked: boolean;
19
- disabled: boolean;
20
- visible: boolean;
21
- error: boolean;
22
- }
23
-
24
- export type ExpandedCheckboxStyles = StylesheetStyles<keyof CheckboxVariants>;
25
-
26
- export type CheckboxStylesheet = {
27
- wrapper: ExpandedCheckboxStyles;
28
- container: ExpandedCheckboxStyles;
29
- checkbox: ExpandedCheckboxStyles;
30
- label: ExpandedCheckboxStyles;
31
- checkmark: ExpandedCheckboxStyles;
32
- helperText: ExpandedCheckboxStyles;
33
- }
34
-
35
- /**
36
- * Helper to get intent colors, mapping 'info' to 'primary'
37
- */
38
- function getIntentColors(theme: Theme, intent: CheckboxIntent) {
39
- const actualIntent = intent === 'info' ? 'primary' : intent;
40
- return theme.intents[actualIntent as Intent];
41
- }
42
-
43
- /**
44
- * Create size variants for checkbox
45
- */
46
- function createCheckboxSizeVariants() {
47
- return {
48
- xs: { width: 14, height: 14 },
49
- sm: { width: 16, height: 16 },
50
- md: { width: 20, height: 20 },
51
- lg: { width: 24, height: 24 },
52
- xl: { width: 28, height: 28 },
53
- } as const;
54
- }
55
-
56
- /**
57
- * Create type variants for checkbox
58
- */
59
- function createCheckboxTypeVariants(theme: Theme) {
60
- return {
61
- default: {
62
- borderWidth: 1,
63
- borderColor: theme.colors.border.primary,
64
- _web: {
65
- border: `1px solid ${theme.colors.border.primary}`,
66
- },
67
- },
68
- outlined: {
69
- borderWidth: 2,
70
- borderColor: theme.colors.border.primary,
71
- _web: {
72
- border: `2px solid ${theme.colors.border.primary}`,
73
- },
74
- },
75
- } as const;
76
- }
77
-
78
- /**
79
- * Create checked state variants dynamically based on intent
80
- */
81
- function createCheckedVariants(theme: Theme, intent: CheckboxIntent) {
82
- const colors = getIntentColors(theme, intent);
83
-
84
- return {
85
- true: {
86
- backgroundColor: colors.primary,
87
- borderColor: colors.primary,
88
- _web: {
89
- border: `1px solid ${colors.primary}`,
90
- },
91
- },
92
- false: {
93
- backgroundColor: 'transparent',
94
- },
95
- } as const;
96
- }
97
-
98
- /**
99
- * Create size variants for label
100
- */
101
- function createLabelSizeVariants() {
102
- return {
103
- xs: { fontSize: 12 },
104
- sm: { fontSize: 14 },
105
- md: { fontSize: 16 },
106
- lg: { fontSize: 18 },
107
- xl: { fontSize: 20 },
108
- } as const;
109
- }
110
-
111
- /**
112
- * Create size variants for checkmark
113
- */
114
- function createCheckmarkSizeVariants() {
115
- return {
116
- xs: { width: 10, height: 10 },
117
- sm: { width: 12, height: 12 },
118
- md: { width: 14, height: 14 },
119
- lg: { width: 16, height: 16 },
120
- xl: { width: 20, height: 20 },
121
- } as const;
122
- }
123
-
124
- function createCheckboxStyles(theme: Theme) {
125
- return ({ intent }: Partial<CheckboxVariants>) => {
126
- return {
127
- alignItems: 'center',
128
- justifyContent: 'center',
129
- borderRadius: 4,
130
- position: 'relative',
131
- backgroundColor: 'transparent',
132
- borderColor: theme.colors.border.primary,
133
- variants: {
134
- size: createCheckboxSizeVariants(),
135
- type: createCheckboxTypeVariants(theme),
136
- checked: createCheckedVariants(theme, intent),
137
- disabled: {
138
- true: {
139
- opacity: 0.5,
140
- _web: {
141
- cursor: 'not-allowed',
142
- },
143
- },
144
- false: {
145
- opacity: 1,
146
- _web: {
147
- cursor: 'pointer',
148
- _hover: { opacity: 0.8 },
149
- _active: { opacity: 0.6 },
150
- },
151
- },
152
- },
153
- },
154
- _web: {
155
- outline: 'none',
156
- display: 'flex',
157
- boxSizing: 'border-box',
158
- userSelect: 'none',
159
- WebkitAppearance: 'none',
160
- MozAppearance: 'none',
161
- appearance: 'none',
162
- transition: 'all 0.2s ease',
163
- _focus: {
164
- outline: `2px solid ${theme.intents.primary.primary}`,
165
- outlineOffset: '2px',
166
- },
167
- },
168
- } as const;
169
- }
170
- }
171
-
172
- function createCheckmarkStyles(_theme: Theme) {
173
- return () => ({
174
- position: 'absolute' as const,
175
- display: 'flex' as const,
176
- alignItems: 'center' as const,
177
- justifyContent: 'center' as const,
178
- color: '#ffffff',
179
- variants: {
180
- size: createCheckmarkSizeVariants(),
181
- visible: {
182
- true: { opacity: 1 },
183
- false: { opacity: 0 },
184
- },
185
- },
186
- });
187
- }
188
-
189
- // Helper functions to create static styles wrapped in dynamic functions
190
- function createWrapperStyles(theme: Theme) {
191
- return () => ({
192
- flexDirection: 'column' as const,
193
- gap: 4,
194
- variants: {
195
- // Spacing variants from FormInputStyleProps
196
- margin: buildMarginVariants(theme),
197
- marginVertical: buildMarginVerticalVariants(theme),
198
- marginHorizontal: buildMarginHorizontalVariants(theme),
199
- },
200
- _web: {
201
- display: 'flex',
202
- flexDirection: 'column',
203
- alignItems: 'flex-start',
204
- width: 'auto',
205
- },
206
- });
207
- }
208
-
209
- function createContainerStyles() {
210
- return () => ({
211
- flexDirection: 'row' as const,
212
- alignItems: 'center' as const,
213
- gap: 8,
214
- _web: {
215
- display: 'flex',
216
- flexDirection: 'row',
217
- alignItems: 'center',
218
- gap: 8,
219
- width: 'fit-content',
220
- cursor: 'pointer',
221
- },
222
- });
223
- }
224
-
225
- function createLabelStyles(theme: Theme) {
226
- return () => ({
227
- color: theme.colors.text.primary,
228
- variants: {
229
- size: createLabelSizeVariants(),
230
- disabled: {
231
- true: { opacity: 0.5 },
232
- false: { opacity: 1 },
233
- },
234
- },
235
- _web: {
236
- display: 'block',
237
- textAlign: 'left',
238
- margin: 0,
239
- padding: 0,
240
- },
241
- });
242
- }
243
-
244
- function createHelperTextStyles(theme: Theme) {
245
- return () => ({
246
- fontSize: 14,
247
- color: theme.colors.text.secondary,
248
- marginTop: 2,
249
- variants: {
250
- error: {
251
- true: { color: theme.intents.error.primary },
252
- false: { color: theme.colors.text.secondary },
253
- },
254
- },
255
- });
256
- }
257
-
258
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
259
- // transform on native cannot resolve function calls to extract variant structures.
260
- export const checkboxStyles = StyleSheet.create((theme: Theme) => {
261
- // Apply extensions to main visual elements
262
-
263
- return applyExtensions('Checkbox', theme, {container: createContainerStyles(),
264
- checkbox: createCheckboxStyles(theme),
265
- checkmark: createCheckmarkStyles(theme),
266
- // Additional styles (merged from return)
267
- // Minor utility styles (not extended)
268
- wrapper: createWrapperStyles(theme)(),
269
- label: createLabelStyles(theme)(),
270
- helperText: createHelperTextStyles(theme)()});
271
- });
@@ -1,184 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Intent } from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
4
-
5
- type ChipSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
- type ChipType = 'filled' | 'outlined' | 'soft';
7
- type ChipIntent = Intent;
8
-
9
- type ChipDynamicProps = {
10
- size: ChipSize;
11
- intent: ChipIntent;
12
- type: ChipType;
13
- selected: boolean;
14
- disabled?: boolean;
15
- };
16
-
17
- type ChipDeleteButtonProps = {
18
- size: ChipSize;
19
- };
20
-
21
- /**
22
- * Create container styles
23
- */
24
- function createContainerStyles(theme: Theme) {
25
- return ({ size, intent, type, selected, disabled = false }: ChipDynamicProps) => {
26
- const intentValue = theme.intents[intent];
27
- const sizeValue = theme.sizes.chip[size];
28
-
29
- // Compute colors based on type and selected state
30
- let backgroundColor: string;
31
- let borderColor: string;
32
- let borderWidth: number;
33
-
34
- if (type === 'filled') {
35
- borderWidth = 1;
36
- backgroundColor = selected ? intentValue.contrast : intentValue.primary;
37
- borderColor = selected ? intentValue.primary : 'transparent';
38
- } else if (type === 'outlined') {
39
- borderWidth = 1;
40
- backgroundColor = selected ? intentValue.primary : 'transparent';
41
- borderColor = intentValue.primary;
42
- } else { // soft
43
- borderWidth = 0;
44
- backgroundColor = selected ? intentValue.primary : intentValue.light;
45
- borderColor = 'transparent';
46
- }
47
-
48
- return {
49
- display: 'flex' as const,
50
- flexDirection: 'row' as const,
51
- alignItems: 'center' as const,
52
- justifyContent: 'center' as const,
53
- gap: 4,
54
- paddingHorizontal: sizeValue.paddingHorizontal as number,
55
- paddingVertical: sizeValue.paddingVertical as number,
56
- minHeight: sizeValue.minHeight as number,
57
- borderRadius: sizeValue.borderRadius as number,
58
- backgroundColor,
59
- borderColor,
60
- borderWidth,
61
- borderStyle: borderWidth > 0 ? ('solid' as const) : undefined,
62
- opacity: disabled ? 0.5 : 1,
63
- } as const;
64
- };
65
- }
66
-
67
- /**
68
- * Create label styles
69
- */
70
- function createLabelStyles(theme: Theme) {
71
- return ({ size, intent, type, selected }: ChipDynamicProps) => {
72
- const intentValue = theme.intents[intent];
73
- const sizeValue = theme.sizes.chip[size];
74
-
75
- // Compute color based on type and selected state
76
- let color: string;
77
-
78
- if (type === 'filled') {
79
- color = selected ? intentValue.primary : intentValue.contrast;
80
- } else if (type === 'outlined') {
81
- color = selected ? theme.colors.text.inverse : intentValue.primary;
82
- } else { // soft
83
- color = selected ? theme.colors.text.inverse : intentValue.dark;
84
- }
85
-
86
- return {
87
- fontFamily: 'inherit',
88
- fontWeight: '500' as const,
89
- fontSize: sizeValue.fontSize as number,
90
- lineHeight: sizeValue.lineHeight as number,
91
- color,
92
- } as const;
93
- };
94
- }
95
-
96
- /**
97
- * Create icon styles
98
- */
99
- function createIconStyles(theme: Theme) {
100
- return ({ size, intent, type, selected }: ChipDynamicProps) => {
101
- const intentValue = theme.intents[intent];
102
- const sizeValue = theme.sizes.chip[size];
103
-
104
- // Compute color based on type and selected state (same logic as label)
105
- let color: string;
106
-
107
- if (type === 'filled') {
108
- color = selected ? intentValue.primary : intentValue.contrast;
109
- } else if (type === 'outlined') {
110
- color = selected ? theme.colors.text.inverse : intentValue.primary;
111
- } else { // soft
112
- color = selected ? theme.colors.text.inverse : intentValue.dark;
113
- }
114
-
115
- return {
116
- display: 'flex' as const,
117
- alignItems: 'center' as const,
118
- justifyContent: 'center' as const,
119
- width: sizeValue.iconSize as number,
120
- height: sizeValue.iconSize as number,
121
- color,
122
- } as const;
123
- };
124
- }
125
-
126
- /**
127
- * Create delete button styles
128
- */
129
- function createDeleteButtonStyles(theme: Theme) {
130
- return ({ size }: ChipDeleteButtonProps) => {
131
- const sizeValue = theme.sizes.chip[size];
132
-
133
- return {
134
- display: 'flex' as const,
135
- alignItems: 'center' as const,
136
- justifyContent: 'center' as const,
137
- padding: 0,
138
- marginLeft: 4,
139
- borderRadius: 12,
140
- width: sizeValue.iconSize as number,
141
- height: sizeValue.iconSize as number,
142
- } as const;
143
- };
144
- }
145
-
146
- /**
147
- * Create delete icon styles
148
- */
149
- function createDeleteIconStyles(theme: Theme) {
150
- return ({ size, intent, type, selected }: ChipDynamicProps) => {
151
- const intentValue = theme.intents[intent];
152
- const sizeValue = theme.sizes.chip[size];
153
-
154
- // Compute color based on type and selected state (same logic as label/icon)
155
- let color: string;
156
-
157
- if (type === 'filled') {
158
- color = selected ? intentValue.primary : intentValue.contrast;
159
- } else if (type === 'outlined') {
160
- color = selected ? theme.colors.text.inverse : intentValue.primary;
161
- } else { // soft
162
- color = selected ? theme.colors.text.inverse : intentValue.dark;
163
- }
164
-
165
- return {
166
- fontSize: sizeValue.iconSize as number,
167
- color,
168
- } as const;
169
- };
170
- }
171
-
172
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
173
- // transform on native cannot resolve function calls to extract variant structures.
174
- export const chipStyles = StyleSheet.create((theme: Theme) => {
175
- // Apply extensions to main visual elements
176
-
177
- return applyExtensions('Chip', theme, {container: createContainerStyles(theme),
178
- label: createLabelStyles(theme),
179
- icon: createIconStyles(theme),
180
- // Additional styles (merged from return)
181
- // Minor utility styles (not extended)
182
- deleteButton: createDeleteButtonStyles(theme),
183
- deleteIcon: createDeleteIconStyles(theme)});
184
- });