@idealyst/components 1.2.13 → 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,289 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme, Size } from '@idealyst/theme';
3
- import { buildSizeVariants } from '../utils/buildSizeVariants';
4
- import {
5
- buildMarginVariants,
6
- buildMarginVerticalVariants,
7
- buildMarginHorizontalVariants,
8
- } from '../utils/buildViewStyleVariants';
9
- import { InputSize, InputType } from './types';
10
- import { applyExtensions } from '../extensions/applyExtension';
11
-
12
- export type InputVariants = {
13
- size: InputSize;
14
- type: InputType;
15
- focused: boolean;
16
- hasError: boolean;
17
- disabled: boolean;
18
- }
19
-
20
- type InputDynamicProps = {
21
- type?: InputType;
22
- focused?: boolean;
23
- hasError?: boolean;
24
- disabled?: boolean;
25
- };
26
-
27
- /**
28
- * Get container border/background styles based on type, focused, hasError, disabled
29
- */
30
- function getContainerDynamicStyles(theme: Theme, props: InputDynamicProps) {
31
- const { type = 'outlined', focused = false, hasError = false, disabled = false } = props;
32
- const focusColor = theme.intents.primary.primary;
33
- const errorColor = theme.intents.error.primary;
34
-
35
- // Base styles by type
36
- let backgroundColor = 'transparent';
37
- let borderWidth = 1;
38
- let borderColor = theme.colors.border.primary;
39
- let borderStyle = 'solid' as const;
40
-
41
- if (type === 'filled') {
42
- backgroundColor = theme.colors.surface.secondary;
43
- borderWidth = 0;
44
- } else if (type === 'bare') {
45
- backgroundColor = 'transparent';
46
- borderWidth = 0;
47
- }
48
-
49
- // Error state takes precedence
50
- if (hasError) {
51
- borderColor = errorColor;
52
- borderWidth = 1;
53
- }
54
-
55
- // Focus state (error still takes precedence for color)
56
- if (focused && !hasError) {
57
- borderColor = focusColor;
58
- borderWidth = 1;
59
- }
60
-
61
- // Disabled state
62
- if (disabled) {
63
- backgroundColor = theme.colors.surface.secondary;
64
- }
65
-
66
- return {
67
- backgroundColor,
68
- borderWidth,
69
- borderColor,
70
- borderStyle,
71
- };
72
- }
73
-
74
- /**
75
- * Create dynamic container styles
76
- */
77
- function createContainerStyles(theme: Theme) {
78
- return (props: InputDynamicProps) => {
79
- const { type = 'outlined', focused = false, hasError = false, disabled = false } = props;
80
- const dynamicStyles = getContainerDynamicStyles(theme, props);
81
- const focusColor = theme.intents.primary.primary;
82
- const errorColor = theme.intents.error.primary;
83
-
84
- // Web-specific border and shadow
85
- let webBorder = `1px solid ${dynamicStyles.borderColor}`;
86
- let webBoxShadow = 'none';
87
-
88
- if (type === 'filled' || type === 'bare') {
89
- webBorder = 'none';
90
- }
91
-
92
- if (hasError) {
93
- webBorder = `1px solid ${errorColor}`;
94
- if (focused) {
95
- webBoxShadow = `0 0 0 2px ${errorColor}20`;
96
- }
97
- } else if (focused) {
98
- webBorder = `1px solid ${focusColor}`;
99
- webBoxShadow = `0 0 0 2px ${focusColor}20`;
100
- }
101
-
102
- return {
103
- display: 'flex',
104
- flexDirection: 'row',
105
- alignItems: 'center',
106
- width: '100%',
107
- minWidth: 0,
108
- borderRadius: 8,
109
- ...dynamicStyles,
110
- opacity: disabled ? 0.6 : 1,
111
- variants: {
112
- size: buildSizeVariants(theme, 'input', (size) => ({
113
- height: size.height,
114
- paddingHorizontal: size.paddingHorizontal,
115
- })),
116
- // Spacing variants from FormInputStyleProps
117
- margin: buildMarginVariants(theme),
118
- marginVertical: buildMarginVerticalVariants(theme),
119
- marginHorizontal: buildMarginHorizontalVariants(theme),
120
- },
121
- _web: {
122
- boxSizing: 'border-box',
123
- transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
124
- border: webBorder,
125
- boxShadow: webBoxShadow,
126
- cursor: disabled ? 'not-allowed' : 'text',
127
- },
128
- } as const;
129
- };
130
- }
131
-
132
- /**
133
- * Create left icon container styles
134
- */
135
- function createLeftIconContainerStyles(theme: Theme) {
136
- return () => ({
137
- display: 'flex' as const,
138
- alignItems: 'center' as const,
139
- justifyContent: 'center' as const,
140
- flexShrink: 0,
141
- variants: {
142
- size: buildSizeVariants(theme, 'input', (size) => ({
143
- marginRight: size.iconMargin,
144
- })),
145
- },
146
- });
147
- }
148
-
149
- /**
150
- * Create right icon container styles
151
- */
152
- function createRightIconContainerStyles(theme: Theme) {
153
- return () => ({
154
- display: 'flex' as const,
155
- alignItems: 'center' as const,
156
- justifyContent: 'center' as const,
157
- flexShrink: 0,
158
- variants: {
159
- size: buildSizeVariants(theme, 'input', (size) => ({
160
- marginLeft: size.iconMargin,
161
- })),
162
- },
163
- });
164
- }
165
-
166
- /**
167
- * Create left icon styles
168
- */
169
- function createLeftIconStyles(theme: Theme) {
170
- return () => ({
171
- color: theme.colors.text.secondary,
172
- variants: {
173
- size: buildSizeVariants(theme, 'input', (size) => ({
174
- fontSize: size.iconSize,
175
- width: size.iconSize,
176
- height: size.iconSize,
177
- })),
178
- },
179
- });
180
- }
181
-
182
- /**
183
- * Create right icon styles
184
- */
185
- function createRightIconStyles(theme: Theme) {
186
- return () => ({
187
- display: 'flex' as const,
188
- alignItems: 'center' as const,
189
- justifyContent: 'center' as const,
190
- flexShrink: 0,
191
- color: theme.colors.text.secondary,
192
- variants: {
193
- size: buildSizeVariants(theme, 'input', (size) => ({
194
- fontSize: size.iconSize,
195
- width: size.iconSize,
196
- height: size.iconSize,
197
- })),
198
- },
199
- });
200
- }
201
-
202
- /**
203
- * Create password toggle styles
204
- */
205
- function createPasswordToggleStyles(theme: Theme) {
206
- return () => ({
207
- display: 'flex' as const,
208
- alignItems: 'center' as const,
209
- justifyContent: 'center' as const,
210
- flexShrink: 0,
211
- padding: 0,
212
- variants: {
213
- size: buildSizeVariants(theme, 'input', (size) => ({
214
- marginLeft: size.iconMargin,
215
- })),
216
- },
217
- _web: {
218
- background: 'transparent',
219
- border: 'none',
220
- cursor: 'pointer',
221
- _hover: {
222
- opacity: 0.7,
223
- },
224
- _active: {
225
- opacity: 0.5,
226
- },
227
- },
228
- });
229
- }
230
-
231
- /**
232
- * Create password toggle icon styles
233
- */
234
- function createPasswordToggleIconStyles(theme: Theme) {
235
- return () => ({
236
- display: 'flex' as const,
237
- alignItems: 'center' as const,
238
- justifyContent: 'center' as const,
239
- flexShrink: 0,
240
- color: theme.colors.text.secondary,
241
- variants: {
242
- size: buildSizeVariants(theme, 'input', (size) => ({
243
- fontSize: size.iconSize,
244
- width: size.iconSize,
245
- height: size.iconSize,
246
- })),
247
- },
248
- });
249
- }
250
-
251
- /**
252
- * Create input styles
253
- */
254
- function createInputStyles(theme: Theme) {
255
- return () => ({
256
- flex: 1,
257
- minWidth: 0,
258
- backgroundColor: 'transparent',
259
- color: theme.colors.text.primary,
260
- fontWeight: '400' as const,
261
- variants: {
262
- size: buildSizeVariants(theme, 'input', (size) => ({
263
- fontSize: size.fontSize,
264
- })),
265
- },
266
- _web: {
267
- border: 'none',
268
- outline: 'none',
269
- fontFamily: 'inherit',
270
- },
271
- });
272
- }
273
-
274
- // Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
275
- // transform on native cannot resolve function calls to extract variant structures.
276
- export const inputStyles = StyleSheet.create((theme: Theme) => {
277
- // Apply extensions to main visual elements
278
-
279
- return applyExtensions('Input', theme, {container: createContainerStyles(theme),
280
- input: createInputStyles(theme),
281
- // Additional styles (merged from return)
282
- // Minor utility styles (not extended)
283
- leftIconContainer: createLeftIconContainerStyles(theme)(),
284
- rightIconContainer: createRightIconContainerStyles(theme)(),
285
- leftIcon: createLeftIconStyles(theme)(),
286
- rightIcon: createRightIconStyles(theme)(),
287
- passwordToggle: createPasswordToggleStyles(theme)(),
288
- passwordToggleIcon: createPasswordToggleIconStyles(theme)()});
289
- });
@@ -1,242 +0,0 @@
1
- import { StyleSheet } from 'react-native-unistyles';
2
- import { Theme } 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 { ListSizeVariant, ListType } from './types';
14
- import { applyExtensions } from '../extensions/applyExtension';
15
-
16
- type ListVariants = {
17
- type: ListType;
18
- size: ListSizeVariant;
19
- scrollable: boolean;
20
- active: boolean;
21
- selected: boolean;
22
- disabled: boolean;
23
- clickable: boolean;
24
- };
25
-
26
- /**
27
- * Create type variants for container
28
- */
29
- function createContainerTypeVariants(theme: Theme) {
30
- return {
31
- default: {
32
- backgroundColor: 'transparent',
33
- },
34
- bordered: {
35
- backgroundColor: theme.colors.surface.primary,
36
- borderWidth: 1,
37
- borderColor: theme.colors.border.primary,
38
- borderRadius: 8,
39
- _web: {
40
- overflow: 'hidden',
41
- border: `1px solid ${theme.colors.border.primary}`,
42
- },
43
- },
44
- divided: {
45
- backgroundColor: 'transparent',
46
- },
47
- };
48
- }
49
-
50
- type ItemDynamicProps = {
51
- type?: ListType;
52
- disabled?: boolean;
53
- clickable?: boolean;
54
- };
55
-
56
- /**
57
- * Get item hover styles based on disabled and clickable state
58
- */
59
- function getItemHoverStyles(theme: Theme, disabled: boolean, clickable: boolean) {
60
- if (disabled || !clickable) {
61
- return {
62
- backgroundColor: 'transparent',
63
- borderRadius: 0,
64
- };
65
- }
66
- return {
67
- backgroundColor: theme.colors.surface.secondary,
68
- borderRadius: 4,
69
- };
70
- }
71
-
72
- // Container style creator for extension support
73
- function createContainerStyles(theme: Theme) {
74
- return () => ({
75
- display: 'flex' as const,
76
- flexDirection: 'column' as const,
77
- width: '100%',
78
- variants: {
79
- type: createContainerTypeVariants(theme),
80
- scrollable: {
81
- true: {
82
- _web: {
83
- overflow: 'auto',
84
- },
85
- },
86
- false: {},
87
- },
88
- // Spacing variants from ContainerStyleProps
89
- gap: buildGapVariants(theme),
90
- padding: buildPaddingVariants(theme),
91
- paddingVertical: buildPaddingVerticalVariants(theme),
92
- paddingHorizontal: buildPaddingHorizontalVariants(theme),
93
- margin: buildMarginVariants(theme),
94
- marginVertical: buildMarginVerticalVariants(theme),
95
- marginHorizontal: buildMarginHorizontalVariants(theme),
96
- },
97
- });
98
- }
99
-
100
- // Item style creator for extension support
101
- function createItemStyles(theme: Theme) {
102
- return ({ type = 'default', disabled = false, clickable = true }: ItemDynamicProps) => {
103
- const hoverStyles = getItemHoverStyles(theme, disabled, clickable);
104
- return {
105
- display: 'flex',
106
- flexDirection: 'row',
107
- alignItems: 'center',
108
- backgroundColor: 'transparent',
109
- textAlign: 'left',
110
- borderBottomWidth: type === 'divided' ? 1 : 0,
111
- borderBottomStyle: type === 'divided' ? 'solid' as const : undefined,
112
- borderBottomColor: type === 'divided' ? theme.colors.border.primary : undefined,
113
- variants: {
114
- size: buildSizeVariants(theme, 'list', (size) => ({
115
- paddingVertical: size.paddingVertical,
116
- paddingHorizontal: size.paddingHorizontal,
117
- minHeight: size.minHeight,
118
- })),
119
- active: {
120
- true: {
121
- backgroundColor: theme.colors.surface.secondary,
122
- },
123
- false: {},
124
- },
125
- selected: {
126
- true: {
127
- backgroundColor: theme.intents.primary.light + '20',
128
- borderLeftWidth: 3,
129
- borderLeftColor: theme.intents.primary.primary,
130
- _web: {
131
- borderLeft: `3px solid ${theme.intents.primary.primary}`,
132
- },
133
- },
134
- false: {},
135
- },
136
- } as const,
137
- opacity: disabled ? 0.5 : 1,
138
- _web: {
139
- border: 'none',
140
- cursor: disabled ? 'not-allowed' : (clickable ? 'pointer' : 'default'),
141
- outline: 'none',
142
- transition: 'background-color 0.2s ease, border-color 0.2s ease',
143
- borderBottom: type === 'divided' ? `1px solid ${theme.colors.border.primary}` : undefined,
144
- _hover: hoverStyles,
145
- },
146
- } as const;
147
- };
148
- }
149
-
150
- export const listStyles = StyleSheet.create((theme: Theme) => {
151
- // Apply extensions to main visual elements
152
-
153
- return applyExtensions('List', theme, {container: createContainerStyles(theme),
154
- item: createItemStyles(theme),
155
- // Additional styles (merged from return)
156
- // Minor utility styles (not extended)
157
- itemContent: {
158
- display: 'flex',
159
- flexDirection: 'row',
160
- alignItems: 'center',
161
- flex: 1,
162
- gap: 8,
163
- },
164
- leading: {
165
- display: 'flex',
166
- alignItems: 'center',
167
- justifyContent: 'center',
168
- marginRight: 8,
169
- color: theme.colors.text.secondary,
170
- variants: {
171
- size: buildSizeVariants(theme, 'list', (size) => ({
172
- width: size.iconSize,
173
- height: size.iconSize,
174
- })),
175
- } as const,
176
- } as const,
177
- labelContainer: {
178
- flex: 1,
179
- display: 'flex',
180
- flexDirection: 'column',
181
- },
182
- label: {
183
- fontWeight: '500',
184
- color: theme.colors.text.primary,
185
- variants: {
186
- size: buildSizeVariants(theme, 'list', (size) => ({
187
- fontSize: size.labelFontSize,
188
- lineHeight: size.labelLineHeight,
189
- })),
190
- disabled: {
191
- true: {
192
- color: theme.colors.text.secondary,
193
- },
194
- false: {},
195
- },
196
- selected: {
197
- true: {
198
- color: theme.intents.primary.primary,
199
- fontWeight: '600',
200
- },
201
- false: {},
202
- },
203
- },
204
- },
205
- trailing: {
206
- display: 'flex',
207
- alignItems: 'center',
208
- justifyContent: 'center',
209
- marginLeft: 8,
210
- color: theme.colors.text.secondary,
211
- flexShrink: 0,
212
- },
213
- trailingIcon: {
214
- display: 'flex',
215
- alignItems: 'center',
216
- justifyContent: 'center',
217
- variants: {
218
- size: buildSizeVariants(theme, 'list', (size) => ({
219
- width: size.iconSize,
220
- height: size.iconSize,
221
- })),
222
- },
223
- },
224
- section: {
225
- display: 'flex',
226
- flexDirection: 'column',
227
- },
228
- sectionTitle: {
229
- fontWeight: '600',
230
- fontSize: 12,
231
- lineHeight: 16,
232
- textTransform: 'uppercase',
233
- letterSpacing: 0.5,
234
- color: theme.colors.text.secondary,
235
- padding: 8,
236
- paddingBottom: 4,
237
- },
238
- sectionContent: {
239
- display: 'flex',
240
- flexDirection: 'column',
241
- }});
242
- });