@idealyst/components 1.2.12 → 1.2.14

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 (47) hide show
  1. package/package.json +3 -3
  2. package/src/ActivityIndicator/ActivityIndicator.native.tsx +3 -3
  3. package/src/ActivityIndicator/ActivityIndicator.web.tsx +3 -3
  4. package/src/Avatar/Avatar.native.tsx +1 -1
  5. package/src/Breadcrumb/Breadcrumb.native.tsx +20 -21
  6. package/src/Dialog/Dialog.native.tsx +2 -2
  7. package/src/Icon/types.ts +3 -0
  8. package/src/Skeleton/Skeleton.native.tsx +3 -3
  9. package/src/Skeleton/Skeleton.web.tsx +3 -3
  10. package/src/Slider/Slider.native.tsx +2 -2
  11. package/src/TabBar/TabBar.native.tsx +2 -2
  12. package/src/index.native.ts +1 -1
  13. package/src/index.ts +1 -1
  14. package/src/Accordion/Accordion.styles.old.tsx +0 -298
  15. package/src/ActivityIndicator/ActivityIndicator.styles.old.tsx +0 -94
  16. package/src/Alert/Alert.styles.old.tsx +0 -209
  17. package/src/Avatar/Avatar.styles.old.tsx +0 -99
  18. package/src/Badge/Badge.styles.old.tsx +0 -157
  19. package/src/Breadcrumb/Breadcrumb.styles.old.tsx +0 -231
  20. package/src/Card/Card.styles.old.tsx +0 -160
  21. package/src/Checkbox/Checkbox.styles.old.tsx +0 -271
  22. package/src/Chip/Chip.styles.old.tsx +0 -184
  23. package/src/Dialog/Dialog.styles.old.tsx +0 -202
  24. package/src/Divider/Divider.styles.old.tsx +0 -172
  25. package/src/Icon/Icon.styles.old.tsx +0 -81
  26. package/src/Image/Image.styles.old.tsx +0 -69
  27. package/src/Input/Input.styles.old.tsx +0 -289
  28. package/src/List/List.styles.old.tsx +0 -242
  29. package/src/Menu/Menu.styles.old.tsx +0 -197
  30. package/src/Menu/MenuItem.styles.old.tsx +0 -114
  31. package/src/Popover/Popover.styles.old.tsx +0 -135
  32. package/src/Pressable/Pressable.styles.old.tsx +0 -27
  33. package/src/Progress/Progress.styles.old.tsx +0 -200
  34. package/src/RadioButton/RadioButton.styles.old.tsx +0 -175
  35. package/src/SVGImage/SVGImage.styles.old.tsx +0 -86
  36. package/src/Screen/Screen.styles.old.tsx +0 -87
  37. package/src/Select/Select.styles.old.tsx +0 -353
  38. package/src/Skeleton/Skeleton.styles.old.tsx +0 -67
  39. package/src/Slider/Slider.styles.old.tsx +0 -259
  40. package/src/Switch/Switch.styles.old.tsx +0 -203
  41. package/src/TabBar/TabBar.styles.old.tsx +0 -343
  42. package/src/Table/Table.styles.old.tsx +0 -311
  43. package/src/Text/Text.styles.old.tsx +0 -219
  44. package/src/TextArea/TextArea.styles.old.tsx +0 -213
  45. package/src/Tooltip/Tooltip.styles.old.tsx +0 -82
  46. package/src/Video/Video.styles.old.tsx +0 -51
  47. package/src/View/View.styles.old.tsx +0 -125
@@ -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
- });
@@ -1,202 +0,0 @@
1
- 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';
6
-
7
- type DialogVariants = {
8
- size: DialogSize;
9
- type: DialogType;
10
- }
11
-
12
- export type ExpandedDialogStyles = StylesheetStyles<keyof DialogVariants>;
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
- }
24
-
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
- }
50
-
51
- /**
52
- * Create type variants for container
53
- */
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 () => ({
71
- position: 'absolute' as const,
72
- top: 0,
73
- left: 0,
74
- right: 0,
75
- bottom: 0,
76
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
77
- display: 'flex' as const,
78
- alignItems: 'center' as const,
79
- justifyContent: 'center' as const,
80
- zIndex: 1000,
81
- _web: {
82
- position: 'fixed',
83
- transition: 'opacity 150ms ease-out',
84
- },
85
- });
86
- }
87
-
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
- }
113
-
114
- function createHeaderStyles(theme: Theme) {
115
- return () => ({
116
- borderBottomWidth: 1,
117
- borderBottomColor: theme.colors.border.primary,
118
- display: 'flex' as const,
119
- flexDirection: 'row' as const,
120
- alignItems: 'center' as const,
121
- justifyContent: 'space-between' as const,
122
- _web: {
123
- borderBottomStyle: 'solid',
124
- },
125
- });
126
- }
127
-
128
- function createTitleStyles(theme: Theme) {
129
- return () => ({
130
- marginLeft: 24,
131
- fontSize: 18,
132
- paddingVertical: 16,
133
- fontWeight: '600' as const,
134
- color: theme.colors.text.primary,
135
- flex: 1,
136
- _web: {
137
- paddingVertical: 4,
138
- },
139
- });
140
- }
141
-
142
- function createCloseButtonStyles(theme: Theme) {
143
- return () => ({
144
- width: 32,
145
- height: 32,
146
- marginRight: 16,
147
- borderRadius: 16,
148
- backgroundColor: 'transparent' as const,
149
- display: 'flex' as const,
150
- alignItems: 'center' as const,
151
- justifyContent: 'center' as const,
152
- _web: {
153
- border: 'none',
154
- cursor: 'pointer',
155
- _hover: {
156
- backgroundColor: theme.colors.surface.secondary,
157
- },
158
- },
159
- });
160
- }
161
-
162
- function createCloseButtonTextStyles(theme: Theme) {
163
- return () => ({
164
- fontSize: 18,
165
- color: theme.colors.text.secondary,
166
- fontWeight: '500' as const,
167
- });
168
- }
169
-
170
- function createContentStyles() {
171
- return () => ({
172
- padding: 24,
173
- _web: {
174
- overflow: 'visible',
175
- maxHeight: 'none',
176
- },
177
- });
178
- }
179
-
180
- function createModalStyles() {
181
- return () => ({
182
- margin: 0,
183
- justifyContent: 'center' as const,
184
- 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
-
192
- return applyExtensions('Dialog', theme, {backdrop: createBackdropStyles(),
193
- container: createDialogContainerStyles(theme),
194
- header: createHeaderStyles(theme),
195
- content: createContentStyles(),
196
- // Additional styles (merged from return)
197
- // Minor utility styles (not extended)
198
- title: createTitleStyles(theme)(),
199
- closeButton: createCloseButtonStyles(theme)(),
200
- closeButtonText: createCloseButtonTextStyles(theme)(),
201
- modal: createModalStyles()()});
202
- });
@@ -1,172 +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 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,81 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles, Intent, Color, getColorFromString } from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import { IconSizeVariant } from './types';
5
- import { applyExtensions } from '../extensions/applyExtension';
6
-
7
- type IconVariants = {
8
- size: IconSizeVariant;
9
- intent?: Intent;
10
- color?: Color;
11
- }
12
-
13
- export type ExpandedIconStyles = StylesheetStyles<keyof IconVariants>;
14
-
15
- export type IconStylesheet = {
16
- icon: ExpandedIconStyles;
17
- }
18
-
19
- /**
20
- * Create color variants for icon
21
- */
22
- function getIconColor(theme: Theme, color?: Color, intent?: Intent): string {
23
- if (intent) {
24
- return theme.intents[intent]?.primary
25
- } else if (color) {
26
- return getColorFromString(theme, color);
27
- }
28
- return theme.colors.text.primary;
29
- }
30
-
31
- export function buildIconSize(theme: Theme, size?: IconSizeVariant) {
32
- // Handle direct numeric sizes
33
- if (typeof size === 'number') {
34
- return {
35
- width: size,
36
- height: size,
37
- };
38
- }
39
-
40
- // Default to 'md' if size is undefined
41
- const sizeKey = size || 'md';
42
- const iconSize = theme.sizes.icon[sizeKey];
43
-
44
- if (typeof iconSize === 'number') {
45
- return {
46
- width: iconSize,
47
- height: iconSize,
48
- };
49
- }
50
-
51
- return buildSizeVariants(theme, 'icon', (size) => ({
52
- width: size.width,
53
- height: size.height,
54
- }))[sizeKey];
55
- }
56
-
57
- function createIconStyles(theme: Theme) {
58
- return ({ color, intent, size }: Partial<IconVariants>) => {
59
- const iconSize = buildIconSize(theme, size);
60
- return {
61
- width: iconSize.width,
62
- height: iconSize.height,
63
- color: getIconColor(theme, color, intent),
64
- _web: {
65
- display: 'inline-block',
66
- verticalAlign: 'middle',
67
- flexShrink: 0,
68
- lineHeight: 0,
69
- },
70
- } as const;
71
- }
72
- }
73
-
74
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
75
- // transform on native cannot resolve function calls to extract variant structures.
76
- export const iconStyles = StyleSheet.create((theme: Theme) => {
77
- // Apply extensions to main visual elements
78
- return applyExtensions('Icon', theme, {
79
- icon: createIconStyles(theme),
80
- });
81
- });
@@ -1,69 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, StylesheetStyles} from '@idealyst/theme';
3
- import { applyExtensions } from '../extensions/applyExtension';
4
-
5
- type ImageVariants = {}
6
-
7
- export type ExpandedImageStyles = StylesheetStyles<keyof ImageVariants>;
8
-
9
- export type ImageStylesheet = {
10
- container: ExpandedImageStyles;
11
- image: ExpandedImageStyles;
12
- placeholder: ExpandedImageStyles;
13
- fallback: ExpandedImageStyles;
14
- loadingIndicator: ExpandedImageStyles;
15
- }
16
-
17
- // Style creators for extension support
18
- function createContainerStyles(theme: Theme) {
19
- return () => ({
20
- position: 'relative' as const,
21
- overflow: 'hidden' as const,
22
- backgroundColor: theme.colors['gray.200'],
23
- });
24
- }
25
-
26
- function createImageStyles() {
27
- return () => ({
28
- width: '100%' as const,
29
- height: '100%' as const,
30
- });
31
- }
32
-
33
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
34
- // transform on native cannot resolve function calls to extract variant structures.
35
- // @ts-ignore - TS language server needs restart to pick up theme structure changes
36
- export const imageStyles = StyleSheet.create((theme: Theme) => {
37
- // Apply extensions to main visual elements
38
-
39
- return applyExtensions('Image', theme, {container: createContainerStyles(theme),
40
- image: createImageStyles(),
41
- // Additional styles (merged from return)
42
- // Minor utility styles (not extended)
43
- placeholder: {
44
- position: 'absolute',
45
- top: 0,
46
- left: 0,
47
- right: 0,
48
- bottom: 0,
49
- display: 'flex',
50
- alignItems: 'center',
51
- justifyContent: 'center',
52
- backgroundColor: theme.colors['gray.200'],
53
- },
54
- fallback: {
55
- position: 'absolute',
56
- top: 0,
57
- left: 0,
58
- right: 0,
59
- bottom: 0,
60
- display: 'flex',
61
- alignItems: 'center',
62
- justifyContent: 'center',
63
- backgroundColor: theme.colors['gray.300'],
64
- color: theme.colors['gray.600'],
65
- },
66
- loadingIndicator: {
67
- color: theme.colors['gray.600'],
68
- }});
69
- });