@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
@@ -0,0 +1,289 @@
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
+ });