@retray-dev/ui-kit 4.0.0 → 5.2.0

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 (50) hide show
  1. package/COMPONENTS.md +1806 -663
  2. package/README.md +14 -10
  3. package/dist/index.d.mts +274 -85
  4. package/dist/index.d.ts +274 -85
  5. package/dist/index.js +1048 -321
  6. package/dist/index.mjs +1046 -324
  7. package/package.json +3 -2
  8. package/src/components/Accordion/Accordion.tsx +1 -1
  9. package/src/components/AlertBanner/AlertBanner.tsx +50 -45
  10. package/src/components/Avatar/Avatar.tsx +61 -17
  11. package/src/components/Badge/Badge.tsx +17 -15
  12. package/src/components/Button/Button.tsx +31 -42
  13. package/src/components/Card/Card.tsx +4 -4
  14. package/src/components/CategoryStrip/CategoryStrip.tsx +185 -0
  15. package/src/components/CategoryStrip/index.ts +2 -0
  16. package/src/components/Checkbox/Checkbox.tsx +44 -16
  17. package/src/components/Chip/Chip.tsx +1 -1
  18. package/src/components/ConfirmDialog/ConfirmDialog.tsx +9 -9
  19. package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +1 -0
  20. package/src/components/CurrencyInput/CurrencyInput.tsx +6 -4
  21. package/src/components/EmptyState/EmptyState.tsx +9 -9
  22. package/src/components/IconButton/IconButton.tsx +74 -34
  23. package/src/components/Input/Input.tsx +15 -13
  24. package/src/components/LabelValue/LabelValue.tsx +1 -1
  25. package/src/components/ListItem/ListItem.tsx +5 -5
  26. package/src/components/MediaCard/MediaCard.tsx +249 -0
  27. package/src/components/MediaCard/index.ts +2 -0
  28. package/src/components/Pressable/Pressable.tsx +100 -0
  29. package/src/components/Pressable/index.ts +1 -0
  30. package/src/components/Progress/Progress.tsx +14 -7
  31. package/src/components/RadioGroup/RadioGroup.tsx +1 -1
  32. package/src/components/Select/Select.tsx +5 -5
  33. package/src/components/Sheet/Sheet.tsx +35 -15
  34. package/src/components/Skeleton/Skeleton.tsx +34 -7
  35. package/src/components/Slider/Slider.tsx +2 -2
  36. package/src/components/Spinner/Spinner.tsx +1 -1
  37. package/src/components/Switch/Switch.tsx +31 -4
  38. package/src/components/Tabs/Tabs.tsx +63 -45
  39. package/src/components/Text/Text.tsx +59 -10
  40. package/src/components/Textarea/Textarea.tsx +4 -3
  41. package/src/components/Toast/Toast.tsx +77 -36
  42. package/src/components/Toggle/Toggle.tsx +3 -3
  43. package/src/index.ts +8 -2
  44. package/src/theme/ThemeProvider.tsx +11 -10
  45. package/src/theme/colorUtils.ts +80 -0
  46. package/src/theme/colors.ts +76 -35
  47. package/src/theme/index.ts +2 -2
  48. package/src/theme/types.ts +27 -13
  49. package/src/tokens.ts +150 -13
  50. package/src/utils/hover.ts +25 -0
package/src/tokens.ts CHANGED
@@ -1,13 +1,18 @@
1
+ // ─── Spacing ─────────────────────────────────────────────────────────────────
2
+ // 8pt grid with 2pt micro-step. `section` for major band separators (Airbnb: 64px).
1
3
  export const SPACING = {
4
+ xxs: 2,
2
5
  xs: 4,
3
6
  sm: 8,
4
7
  md: 12,
5
- lg: 16,
6
- xl: 24,
7
- '2xl': 32,
8
- '3xl': 48,
8
+ base: 16,
9
+ lg: 24,
10
+ xl: 32,
11
+ xxl: 48,
12
+ section: 64,
9
13
  } as const
10
14
 
15
+ // ─── Icon sizes ───────────────────────────────────────────────────────────────
11
16
  export const ICON_SIZES = {
12
17
  sm: 14,
13
18
  md: 18,
@@ -16,49 +21,178 @@ export const ICON_SIZES = {
16
21
  '2xl': 32,
17
22
  } as const
18
23
 
24
+ // ─── Border radius ────────────────────────────────────────────────────────────
25
+ // Airbnb-aligned shape language — soft everywhere, no hard corners on interactive elements.
26
+ // xs: micro chips/tags sm: inputs/forms md: cards lg: sheet corners xl: primary CTAs (pill)
19
27
  export const RADIUS = {
20
- sm: 4,
21
- md: 8,
22
- lg: 12,
23
- xl: 16,
28
+ none: 0,
29
+ xs: 4,
30
+ sm: 8,
31
+ md: 14,
32
+ lg: 20,
33
+ xl: 32,
24
34
  full: 9999,
25
35
  } as const
26
36
 
37
+ // ─── Shadows ──────────────────────────────────────────────────────────────────
38
+ // Multi-tier. Default card usage = sm. Hover float = md. Modals = lg/xl.
27
39
  export const SHADOWS = {
28
40
  sm: {
29
41
  shadowColor: '#000',
30
42
  shadowOffset: { width: 0, height: 1 },
31
- shadowOpacity: 0.08,
43
+ shadowOpacity: 0.06,
32
44
  shadowRadius: 4,
33
45
  elevation: 2,
34
46
  },
35
47
  md: {
36
48
  shadowColor: '#000',
37
- shadowOffset: { width: 0, height: 3 },
38
- shadowOpacity: 0.12,
49
+ shadowOffset: { width: 0, height: 2 },
50
+ shadowOpacity: 0.10,
39
51
  shadowRadius: 8,
40
52
  elevation: 5,
41
53
  },
42
54
  lg: {
43
55
  shadowColor: '#000',
44
56
  shadowOffset: { width: 0, height: 6 },
45
- shadowOpacity: 0.2,
57
+ shadowOpacity: 0.16,
46
58
  shadowRadius: 16,
47
59
  elevation: 10,
48
60
  },
49
61
  xl: {
50
62
  shadowColor: '#000',
51
63
  shadowOffset: { width: 0, height: 12 },
52
- shadowOpacity: 0.28,
64
+ shadowOpacity: 0.24,
53
65
  shadowRadius: 24,
54
66
  elevation: 18,
55
67
  },
56
68
  } as const
57
69
 
70
+ // ─── Breakpoints ──────────────────────────────────────────────────────────────
58
71
  export const BREAKPOINTS = {
59
72
  wide: 700,
60
73
  } as const
61
74
 
75
+ // ─── Typography ───────────────────────────────────────────────────────────────
76
+ // Airbnb-inspired hierarchy. Modest weights — 500-600 on display, not 700+.
77
+ // Exception: display-hero (large number display) and display-xl always bold.
78
+ // Poppins carries the full scale. All fontFamily values reference loaded font names.
79
+ export const TYPOGRAPHY = {
80
+ 'display-hero': {
81
+ fontFamily: 'Poppins-Bold',
82
+ fontSize: 64,
83
+ fontWeight: '700' as const,
84
+ lineHeight: 70,
85
+ letterSpacing: -1,
86
+ },
87
+ 'display-xl': {
88
+ fontFamily: 'Poppins-Bold',
89
+ fontSize: 28,
90
+ fontWeight: '700' as const,
91
+ lineHeight: 40,
92
+ letterSpacing: 0,
93
+ },
94
+ 'display-lg': {
95
+ fontFamily: 'Poppins-Medium',
96
+ fontSize: 22,
97
+ fontWeight: '500' as const,
98
+ lineHeight: 26,
99
+ letterSpacing: -0.44,
100
+ },
101
+ 'display-md': {
102
+ fontFamily: 'Poppins-Bold',
103
+ fontSize: 21,
104
+ fontWeight: '700' as const,
105
+ lineHeight: 30,
106
+ letterSpacing: 0,
107
+ },
108
+ 'display-sm': {
109
+ fontFamily: 'Poppins-SemiBold',
110
+ fontSize: 20,
111
+ fontWeight: '600' as const,
112
+ lineHeight: 24,
113
+ letterSpacing: -0.18,
114
+ },
115
+ 'title-md': {
116
+ fontFamily: 'Poppins-SemiBold',
117
+ fontSize: 16,
118
+ fontWeight: '600' as const,
119
+ lineHeight: 20,
120
+ letterSpacing: 0,
121
+ },
122
+ 'title-sm': {
123
+ fontFamily: 'Poppins-Medium',
124
+ fontSize: 16,
125
+ fontWeight: '500' as const,
126
+ lineHeight: 20,
127
+ letterSpacing: 0,
128
+ },
129
+ 'body-md': {
130
+ fontFamily: 'Poppins-Regular',
131
+ fontSize: 16,
132
+ fontWeight: '400' as const,
133
+ lineHeight: 24,
134
+ letterSpacing: 0,
135
+ },
136
+ 'body-sm': {
137
+ fontFamily: 'Poppins-Regular',
138
+ fontSize: 14,
139
+ fontWeight: '400' as const,
140
+ lineHeight: 20,
141
+ letterSpacing: 0,
142
+ },
143
+ caption: {
144
+ fontFamily: 'Poppins-Medium',
145
+ fontSize: 14,
146
+ fontWeight: '500' as const,
147
+ lineHeight: 18,
148
+ letterSpacing: 0,
149
+ },
150
+ 'caption-sm': {
151
+ fontFamily: 'Poppins-Regular',
152
+ fontSize: 13,
153
+ fontWeight: '400' as const,
154
+ lineHeight: 16,
155
+ letterSpacing: 0,
156
+ },
157
+ 'badge-text': {
158
+ fontFamily: 'Poppins-SemiBold',
159
+ fontSize: 11,
160
+ fontWeight: '600' as const,
161
+ lineHeight: 13,
162
+ letterSpacing: 0,
163
+ },
164
+ 'micro-label': {
165
+ fontFamily: 'Poppins-Bold',
166
+ fontSize: 12,
167
+ fontWeight: '700' as const,
168
+ lineHeight: 16,
169
+ letterSpacing: 0,
170
+ },
171
+ 'uppercase-tag': {
172
+ fontFamily: 'Poppins-Bold',
173
+ fontSize: 8,
174
+ fontWeight: '700' as const,
175
+ lineHeight: 10,
176
+ letterSpacing: 0.32,
177
+ textTransform: 'uppercase' as const,
178
+ },
179
+ 'button-lg': {
180
+ fontFamily: 'Poppins-Medium',
181
+ fontSize: 16,
182
+ fontWeight: '500' as const,
183
+ lineHeight: 20,
184
+ letterSpacing: 0,
185
+ },
186
+ 'button-sm': {
187
+ fontFamily: 'Poppins-Medium',
188
+ fontSize: 14,
189
+ fontWeight: '500' as const,
190
+ lineHeight: 18,
191
+ letterSpacing: 0,
192
+ },
193
+ } as const
194
+
195
+ // ─── Types ────────────────────────────────────────────────────────────────────
62
196
  export type Spacing = typeof SPACING
63
197
  export type SpacingKey = keyof Spacing
64
198
 
@@ -67,3 +201,6 @@ export type IconSizeKey = keyof IconSize
67
201
 
68
202
  export type Radius = typeof RADIUS
69
203
  export type RadiusKey = keyof Radius
204
+
205
+ export type Typography = typeof TYPOGRAPHY
206
+ export type TypographyKey = keyof Typography
@@ -0,0 +1,25 @@
1
+ import { useState, useCallback } from 'react'
2
+ import { Platform } from 'react-native'
3
+
4
+ export interface HoverHandlers {
5
+ onMouseEnter?: () => void
6
+ onMouseLeave?: () => void
7
+ }
8
+
9
+ /**
10
+ * Web-only hover state hook. Returns `{ hovered, hoverHandlers }`.
11
+ * On native (iOS/Android) `hovered` is always false and handlers are no-ops.
12
+ * Spread `hoverHandlers` onto any View/TouchableOpacity to activate.
13
+ */
14
+ export function useHover(): { hovered: boolean; hoverHandlers: HoverHandlers } {
15
+ const [hovered, setHovered] = useState(false)
16
+
17
+ const onMouseEnter = useCallback(() => setHovered(true), [])
18
+ const onMouseLeave = useCallback(() => setHovered(false), [])
19
+
20
+ if (Platform.OS !== 'web') {
21
+ return { hovered: false, hoverHandlers: {} }
22
+ }
23
+
24
+ return { hovered, hoverHandlers: { onMouseEnter, onMouseLeave } }
25
+ }