@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
@@ -0,0 +1,497 @@
1
+ import { Theme } from '@idealyst/theme';
2
+ import type { ViewStyle, TextStyle, ImageStyle } from 'react-native';
3
+
4
+ /**
5
+ * Generic styles type that covers most style properties.
6
+ * This is intentionally broad to allow flexibility in extensions.
7
+ */
8
+ export type Styles = ViewStyle & TextStyle & Partial<ImageStyle> & Record<string, any>;
9
+
10
+ /**
11
+ * An element style in an extension can be either:
12
+ * - A static styles object
13
+ * - A function that receives props and returns styles (for prop-aware extensions)
14
+ */
15
+ export type ElementStyle = Styles | ((props: any) => Styles);
16
+
17
+ /**
18
+ * A style extension can be either:
19
+ * - A partial style object (with static or function element styles)
20
+ * - A function that receives the theme and returns partial styles
21
+ */
22
+ export type StyleExtension<T> = Partial<T> | ((theme: Theme) => Partial<T>);
23
+
24
+ // ============================================================================
25
+ // Component Styleable Elements
26
+ // Each type defines the valid styleable elements for a component.
27
+ // These are derived from the XxxStylesheet types in @idealyst/theme/components
28
+ // ============================================================================
29
+
30
+ /**
31
+ * Button styleable elements.
32
+ * Each element can be either a static styles object or a function (props) => styles.
33
+ * @see ButtonStylesheet in @idealyst/theme/components/button
34
+ */
35
+ export type ButtonStyleableElements = {
36
+ button: ElementStyle;
37
+ text: ElementStyle;
38
+ icon: ElementStyle;
39
+ iconContainer: ElementStyle;
40
+ };
41
+
42
+ /**
43
+ * Card styleable elements.
44
+ * @see CardStylesheet in @idealyst/theme/components/card
45
+ */
46
+ export type CardStyleableElements = {
47
+ card: Styles;
48
+ };
49
+
50
+ /**
51
+ * Input styleable elements.
52
+ * @see InputStylesheet in @idealyst/theme/components/input
53
+ */
54
+ export type InputStyleableElements = {
55
+ container: Styles;
56
+ leftIconContainer: Styles;
57
+ rightIconContainer: Styles;
58
+ leftIcon: Styles;
59
+ rightIcon: Styles;
60
+ passwordToggle: Styles;
61
+ passwordToggleIcon: Styles;
62
+ input: Styles;
63
+ };
64
+
65
+ /**
66
+ * Chip styleable elements.
67
+ * @see ChipStylesheet in @idealyst/theme/components/chip
68
+ */
69
+ export type ChipStyleableElements = {
70
+ container: Styles;
71
+ label: Styles;
72
+ icon: Styles;
73
+ deleteButton: Styles;
74
+ deleteIcon: Styles;
75
+ };
76
+
77
+ /**
78
+ * Alert styleable elements.
79
+ * @see AlertStylesheet in @idealyst/theme/components/alert
80
+ */
81
+ export type AlertStyleableElements = {
82
+ container: Styles;
83
+ iconContainer: Styles;
84
+ content: Styles;
85
+ title: Styles;
86
+ message: Styles;
87
+ actions: Styles;
88
+ closeButton: Styles;
89
+ closeIcon: Styles;
90
+ };
91
+
92
+ /**
93
+ * Switch styleable elements.
94
+ * @see SwitchStylesheet in @idealyst/theme/components/switch
95
+ */
96
+ export type SwitchStyleableElements = {
97
+ container: Styles;
98
+ switchContainer: Styles;
99
+ switchTrack: Styles;
100
+ switchThumb: Styles;
101
+ thumbIcon: Styles;
102
+ label: Styles;
103
+ };
104
+
105
+ /**
106
+ * Select styleable elements.
107
+ * @see SelectStylesheet in @idealyst/theme/components/select
108
+ */
109
+ export type SelectStyleableElements = {
110
+ container: Styles;
111
+ label: Styles;
112
+ trigger: Styles;
113
+ triggerContent: Styles;
114
+ triggerText: Styles;
115
+ placeholder: Styles;
116
+ icon: Styles;
117
+ chevron: Styles;
118
+ chevronOpen: Styles;
119
+ dropdown: Styles;
120
+ searchContainer: Styles;
121
+ searchInput: Styles;
122
+ optionsList: Styles;
123
+ option: Styles;
124
+ optionContent: Styles;
125
+ optionIcon: Styles;
126
+ optionText: Styles;
127
+ optionTextDisabled: Styles;
128
+ helperText: Styles;
129
+ overlay: Styles;
130
+ };
131
+
132
+ /**
133
+ * Badge styleable elements.
134
+ * @see BadgeStylesheet in @idealyst/theme/components/badge
135
+ */
136
+ export type BadgeStyleableElements = {
137
+ container: Styles;
138
+ text: Styles;
139
+ };
140
+
141
+ /**
142
+ * Avatar styleable elements.
143
+ * @see AvatarStylesheet in @idealyst/theme/components/avatar
144
+ */
145
+ export type AvatarStyleableElements = {
146
+ container: Styles;
147
+ image: Styles;
148
+ fallback: Styles;
149
+ fallbackText: Styles;
150
+ };
151
+
152
+ /**
153
+ * Progress styleable elements.
154
+ * @see ProgressStylesheet in @idealyst/theme/components/progress
155
+ */
156
+ export type ProgressStyleableElements = {
157
+ container: Styles;
158
+ track: Styles;
159
+ fill: Styles;
160
+ label: Styles;
161
+ };
162
+
163
+ /**
164
+ * Checkbox styleable elements.
165
+ * @see CheckboxStylesheet in @idealyst/theme/components/checkbox
166
+ */
167
+ export type CheckboxStyleableElements = {
168
+ container: Styles;
169
+ checkbox: Styles;
170
+ checkIcon: Styles;
171
+ label: Styles;
172
+ };
173
+
174
+ /**
175
+ * RadioButton styleable elements.
176
+ * @see RadioButtonStylesheet in @idealyst/theme/components/radio-button
177
+ */
178
+ export type RadioButtonStyleableElements = {
179
+ container: Styles;
180
+ radio: Styles;
181
+ radioDot: Styles;
182
+ label: Styles;
183
+ };
184
+
185
+ /**
186
+ * Slider styleable elements.
187
+ * @see SliderStylesheet in @idealyst/theme/components/slider
188
+ */
189
+ export type SliderStyleableElements = {
190
+ container: Styles;
191
+ track: Styles;
192
+ trackFill: Styles;
193
+ thumb: Styles;
194
+ thumbIcon: Styles;
195
+ mark: Styles;
196
+ label: Styles;
197
+ };
198
+
199
+ /**
200
+ * TextArea styleable elements.
201
+ * @see TextAreaStylesheet in @idealyst/theme/components/textarea
202
+ */
203
+ export type TextAreaStyleableElements = {
204
+ container: Styles;
205
+ input: Styles;
206
+ label: Styles;
207
+ helperText: Styles;
208
+ };
209
+
210
+ /**
211
+ * Accordion styleable elements.
212
+ * @see AccordionStylesheet in @idealyst/theme/components/accordion
213
+ */
214
+ export type AccordionStyleableElements = {
215
+ container: Styles;
216
+ item: Styles;
217
+ header: Styles;
218
+ headerText: Styles;
219
+ icon: Styles;
220
+ content: Styles;
221
+ };
222
+
223
+ /**
224
+ * Dialog styleable elements.
225
+ * @see DialogStylesheet in @idealyst/theme/components/dialog
226
+ */
227
+ export type DialogStyleableElements = {
228
+ overlay: Styles;
229
+ container: Styles;
230
+ header: Styles;
231
+ title: Styles;
232
+ closeButton: Styles;
233
+ closeIcon: Styles;
234
+ content: Styles;
235
+ footer: Styles;
236
+ };
237
+
238
+ /**
239
+ * Menu styleable elements.
240
+ * @see MenuStylesheet in @idealyst/theme/components/menu
241
+ */
242
+ export type MenuStyleableElements = {
243
+ container: Styles;
244
+ trigger: Styles;
245
+ dropdown: Styles;
246
+ item: Styles;
247
+ itemIcon: Styles;
248
+ itemText: Styles;
249
+ divider: Styles;
250
+ };
251
+
252
+ /**
253
+ * MenuItem styleable elements.
254
+ * @see MenuItemStylesheet in @idealyst/theme/components/menu-item
255
+ */
256
+ export type MenuItemStyleableElements = {
257
+ container: Styles;
258
+ icon: Styles;
259
+ text: Styles;
260
+ };
261
+
262
+ /**
263
+ * List styleable elements.
264
+ * @see ListStylesheet in @idealyst/theme/components/list
265
+ */
266
+ export type ListStyleableElements = {
267
+ container: Styles;
268
+ item: Styles;
269
+ itemIcon: Styles;
270
+ itemText: Styles;
271
+ itemDescription: Styles;
272
+ itemRight: Styles;
273
+ section: Styles;
274
+ sectionHeader: Styles;
275
+ divider: Styles;
276
+ };
277
+
278
+ /**
279
+ * TabBar styleable elements.
280
+ * @see TabBarStylesheet in @idealyst/theme/components/tab-bar
281
+ */
282
+ export type TabBarStyleableElements = {
283
+ container: Styles;
284
+ tab: Styles;
285
+ tabIcon: Styles;
286
+ tabText: Styles;
287
+ indicator: Styles;
288
+ };
289
+
290
+ /**
291
+ * Table styleable elements.
292
+ * @see TableStylesheet in @idealyst/theme/components/table
293
+ */
294
+ export type TableStyleableElements = {
295
+ container: Styles;
296
+ header: Styles;
297
+ headerCell: Styles;
298
+ headerText: Styles;
299
+ row: Styles;
300
+ cell: Styles;
301
+ cellText: Styles;
302
+ };
303
+
304
+ /**
305
+ * Tooltip styleable elements.
306
+ * @see TooltipStylesheet in @idealyst/theme/components/tooltip
307
+ */
308
+ export type TooltipStyleableElements = {
309
+ container: Styles;
310
+ content: Styles;
311
+ text: Styles;
312
+ arrow: Styles;
313
+ };
314
+
315
+ /**
316
+ * Popover styleable elements.
317
+ * @see PopoverStylesheet in @idealyst/theme/components/popover
318
+ */
319
+ export type PopoverStyleableElements = {
320
+ overlay: Styles;
321
+ container: Styles;
322
+ content: Styles;
323
+ arrow: Styles;
324
+ };
325
+
326
+ /**
327
+ * Breadcrumb styleable elements.
328
+ * @see BreadcrumbStylesheet in @idealyst/theme/components/breadcrumb
329
+ */
330
+ export type BreadcrumbStyleableElements = {
331
+ container: Styles;
332
+ item: Styles;
333
+ itemText: Styles;
334
+ separator: Styles;
335
+ };
336
+
337
+ /**
338
+ * ActivityIndicator styleable elements.
339
+ * @see ActivityIndicatorStylesheet in @idealyst/theme/components/activity-indicator
340
+ */
341
+ export type ActivityIndicatorStyleableElements = {
342
+ container: Styles;
343
+ spinner: Styles;
344
+ };
345
+
346
+ /**
347
+ * Skeleton styleable elements.
348
+ * @see SkeletonStylesheet in @idealyst/theme/components/skeleton
349
+ */
350
+ export type SkeletonStyleableElements = {
351
+ container: Styles;
352
+ bone: Styles;
353
+ };
354
+
355
+ /**
356
+ * Divider styleable elements.
357
+ * @see DividerStylesheet in @idealyst/theme/components/divider
358
+ */
359
+ export type DividerStyleableElements = {
360
+ divider: Styles;
361
+ };
362
+
363
+ /**
364
+ * Text styleable elements.
365
+ * @see TextStylesheet in @idealyst/theme/components/text
366
+ */
367
+ export type TextStyleableElements = {
368
+ text: Styles;
369
+ };
370
+
371
+ /**
372
+ * View styleable elements.
373
+ * @see ViewStylesheet in @idealyst/theme/components/view
374
+ */
375
+ export type ViewStyleableElements = {
376
+ view: Styles;
377
+ };
378
+
379
+ /**
380
+ * Icon styleable elements.
381
+ * @see IconStylesheet in @idealyst/theme/components/icon
382
+ */
383
+ export type IconStyleableElements = {
384
+ icon: Styles;
385
+ };
386
+
387
+ /**
388
+ * Image styleable elements.
389
+ * @see ImageStylesheet in @idealyst/theme/components/image
390
+ */
391
+ export type ImageStyleableElements = {
392
+ container: Styles;
393
+ image: Styles;
394
+ };
395
+
396
+ /**
397
+ * Pressable styleable elements.
398
+ * @see PressableStylesheet in @idealyst/theme/components/pressable
399
+ */
400
+ export type PressableStyleableElements = {
401
+ pressable: Styles;
402
+ };
403
+
404
+ /**
405
+ * Screen styleable elements.
406
+ * @see ScreenStylesheet in @idealyst/theme/components/screen
407
+ */
408
+ export type ScreenStyleableElements = {
409
+ container: Styles;
410
+ content: Styles;
411
+ };
412
+
413
+ // ============================================================================
414
+ // Master Component Style Elements Map
415
+ // ============================================================================
416
+
417
+ /**
418
+ * Extension interface for custom components.
419
+ * Users can extend this via declaration merging to add their own components.
420
+ *
421
+ * @example
422
+ * ```typescript
423
+ * // In your app's type declarations (e.g., src/types/components.d.ts)
424
+ * declare module '@idealyst/components' {
425
+ * interface ComponentStyleExtensions {
426
+ * MyCustomButton: {
427
+ * container: Styles;
428
+ * label: Styles;
429
+ * icon: Styles;
430
+ * };
431
+ * MyCard: {
432
+ * wrapper: Styles;
433
+ * header: Styles;
434
+ * body: Styles;
435
+ * };
436
+ * }
437
+ * }
438
+ *
439
+ * // Then use extendComponent with your custom component
440
+ * extendComponent('MyCustomButton', {
441
+ * container: { borderRadius: 20 },
442
+ * label: { fontWeight: 'bold' },
443
+ * });
444
+ * ```
445
+ */
446
+ export interface ComponentStyleExtensions {}
447
+
448
+ /**
449
+ * Built-in component style elements.
450
+ * Maps component names to their styleable elements.
451
+ */
452
+ interface BuiltInComponentStyleElements {
453
+ Button: ButtonStyleableElements;
454
+ Card: CardStyleableElements;
455
+ Input: InputStyleableElements;
456
+ Chip: ChipStyleableElements;
457
+ Alert: AlertStyleableElements;
458
+ Switch: SwitchStyleableElements;
459
+ Select: SelectStyleableElements;
460
+ Badge: BadgeStyleableElements;
461
+ Avatar: AvatarStyleableElements;
462
+ Progress: ProgressStyleableElements;
463
+ Checkbox: CheckboxStyleableElements;
464
+ RadioButton: RadioButtonStyleableElements;
465
+ Slider: SliderStyleableElements;
466
+ TextArea: TextAreaStyleableElements;
467
+ Accordion: AccordionStyleableElements;
468
+ Dialog: DialogStyleableElements;
469
+ Menu: MenuStyleableElements;
470
+ MenuItem: MenuItemStyleableElements;
471
+ List: ListStyleableElements;
472
+ TabBar: TabBarStyleableElements;
473
+ Table: TableStyleableElements;
474
+ Tooltip: TooltipStyleableElements;
475
+ Popover: PopoverStyleableElements;
476
+ Breadcrumb: BreadcrumbStyleableElements;
477
+ ActivityIndicator: ActivityIndicatorStyleableElements;
478
+ Skeleton: SkeletonStyleableElements;
479
+ Divider: DividerStyleableElements;
480
+ Text: TextStyleableElements;
481
+ View: ViewStyleableElements;
482
+ Icon: IconStyleableElements;
483
+ Image: ImageStyleableElements;
484
+ Pressable: PressableStyleableElements;
485
+ Screen: ScreenStyleableElements;
486
+ }
487
+
488
+ /**
489
+ * Combined component style elements including built-in and custom components.
490
+ * This is the source of truth for type-safe component extensions.
491
+ */
492
+ export type ComponentStyleElements = BuiltInComponentStyleElements & ComponentStyleExtensions;
493
+
494
+ /**
495
+ * All available component names for extensions.
496
+ */
497
+ export type ComponentName = keyof ComponentStyleElements;
package/src/globals.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Global type declarations for the components package.
3
+ * Sets up Unistyles theme types.
4
+ */
5
+ import { Theme } from '@idealyst/theme';
6
+
7
+ // Declare UnistylesThemes to match @idealyst/theme
8
+ declare module 'react-native-unistyles' {
9
+ export interface UnistylesThemes {
10
+ light: Theme;
11
+ dark: Theme;
12
+ }
13
+ }
14
+
15
+ // Force this module to be included
16
+ export {};
@@ -101,6 +101,9 @@ export * from './Chip/types';
101
101
  export { default as Breadcrumb } from './Breadcrumb';
102
102
  export * from './Breadcrumb/types';
103
103
 
104
+ export { default as Link } from './Link';
105
+ export * from './Link/types';
106
+
104
107
  export type { ButtonProps } from './Button/types';
105
108
  export type { TextProps } from './Text/types';
106
109
  export type { ViewProps } from './View/types';
@@ -133,6 +136,7 @@ export type { AlertProps } from './Alert/types';
133
136
  export type { SkeletonProps, SkeletonGroupProps, SkeletonShape, SkeletonAnimation } from './Skeleton/types';
134
137
  export type { ChipProps, ChipSize, ChipIntent } from './Chip/types';
135
138
  export type { BreadcrumbProps, BreadcrumbItem } from './Breadcrumb/types';
139
+ export type { LinkProps } from './Link/types';
136
140
 
137
141
  // Event utilities
138
142
  export * from './utils/events';
package/src/index.ts CHANGED
@@ -1,3 +1,6 @@
1
+ // Import globals to set up Unistyles theme types
2
+ import './globals';
3
+
1
4
  import useMergeRefs from './hooks/useMergeRefs';
2
5
 
3
6
  export { default as Button } from './Button';
@@ -149,4 +152,29 @@ export * from './utils/events';
149
152
  export * from './utils/viewStyleProps';
150
153
  export * from './utils/buildViewStyleVariants';
151
154
 
155
+ // Component style extensions
156
+ export {
157
+ extendComponent,
158
+ clearExtension,
159
+ clearAllExtensions,
160
+ hasExtension,
161
+ getExtendedComponents,
162
+ getExtensionCount,
163
+ } from './extensions';
164
+
165
+ export type {
166
+ ComponentStyleElements,
167
+ ComponentStyleExtensions,
168
+ ComponentName,
169
+ StyleExtension,
170
+ Styles,
171
+ ButtonStyleableElements,
172
+ CardStyleableElements,
173
+ InputStyleableElements,
174
+ ChipStyleableElements,
175
+ AlertStyleableElements,
176
+ SwitchStyleableElements,
177
+ SelectStyleableElements,
178
+ } from './extensions';
179
+
152
180
  export type { AppTheme } from '@idealyst/theme';
@@ -14,9 +14,31 @@ function isPlainObject(value: unknown): value is Record<string, any> {
14
14
  * Deep merge two objects together, with the second object taking priority.
15
15
  * Arrays and non-plain objects are replaced rather than merged.
16
16
  *
17
+ * Special handling:
18
+ * - Setting a value to `undefined` removes that key from the result
19
+ * - Nested objects (like `_web`, `variants`) are recursively merged
20
+ *
17
21
  * @param target - The base object
18
22
  * @param source - The object to merge in (takes priority)
19
23
  * @returns A new merged object
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * // Basic merge
28
+ * deepMerge({ a: 1, b: 2 }, { b: 3, c: 4 })
29
+ * // => { a: 1, b: 3, c: 4 }
30
+ *
31
+ * // Nested _web merge
32
+ * deepMerge(
33
+ * { padding: 10, _web: { cursor: 'pointer', display: 'flex' } },
34
+ * { _web: { cursor: 'default' } }
35
+ * )
36
+ * // => { padding: 10, _web: { cursor: 'default', display: 'flex' } }
37
+ *
38
+ * // Remove property with undefined
39
+ * deepMerge({ a: 1, b: 2 }, { b: undefined })
40
+ * // => { a: 1 }
41
+ * ```
20
42
  */
21
43
  export function deepMerge<T extends Record<string, any>, S extends Record<string, any>>(
22
44
  target: T,
@@ -29,11 +51,15 @@ export function deepMerge<T extends Record<string, any>, S extends Record<string
29
51
  const sourceValue = source[key]
30
52
  const targetValue = result[key]
31
53
 
54
+ // If source value is undefined, remove the key entirely
55
+ if (sourceValue === undefined) {
56
+ delete result[key]
57
+ }
32
58
  // If both values are plain objects, merge them recursively
33
- if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
59
+ else if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
34
60
  result[key] = deepMerge(targetValue, sourceValue)
35
61
  } else {
36
- // Otherwise, source value takes priority (including arrays, primitives, null, undefined)
62
+ // Otherwise, source value takes priority (including arrays, primitives, null)
37
63
  result[key] = sourceValue
38
64
  }
39
65
  }
@@ -41,3 +67,29 @@ export function deepMerge<T extends Record<string, any>, S extends Record<string
41
67
 
42
68
  return result as T & S
43
69
  }
70
+
71
+ /**
72
+ * Deep merge multiple objects together, with later objects taking priority.
73
+ * This is useful for merging multiple extensions in order.
74
+ *
75
+ * @param objects - Objects to merge (later ones have higher precedence)
76
+ * @returns A new merged object
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * deepMergeAll(
81
+ * { a: 1, b: 2 }, // base
82
+ * { b: 3, c: 4 }, // first extension
83
+ * { c: 5, d: 6 } // second extension (highest precedence)
84
+ * )
85
+ * // => { a: 1, b: 3, c: 5, d: 6 }
86
+ * ```
87
+ */
88
+ export function deepMergeAll<T extends Record<string, any>>(
89
+ ...objects: (T | undefined | null)[]
90
+ ): T {
91
+ return objects.reduce<T>((acc, obj) => {
92
+ if (obj == null) return acc
93
+ return deepMerge(acc, obj) as T
94
+ }, {} as T)
95
+ }