@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.
- package/COMPONENTS.md +1806 -663
- package/README.md +14 -10
- package/dist/index.d.mts +274 -85
- package/dist/index.d.ts +274 -85
- package/dist/index.js +1048 -321
- package/dist/index.mjs +1046 -324
- package/package.json +3 -2
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/AlertBanner/AlertBanner.tsx +50 -45
- package/src/components/Avatar/Avatar.tsx +61 -17
- package/src/components/Badge/Badge.tsx +17 -15
- package/src/components/Button/Button.tsx +31 -42
- package/src/components/Card/Card.tsx +4 -4
- package/src/components/CategoryStrip/CategoryStrip.tsx +185 -0
- package/src/components/CategoryStrip/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +44 -16
- package/src/components/Chip/Chip.tsx +1 -1
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +9 -9
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +1 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +6 -4
- package/src/components/EmptyState/EmptyState.tsx +9 -9
- package/src/components/IconButton/IconButton.tsx +74 -34
- package/src/components/Input/Input.tsx +15 -13
- package/src/components/LabelValue/LabelValue.tsx +1 -1
- package/src/components/ListItem/ListItem.tsx +5 -5
- package/src/components/MediaCard/MediaCard.tsx +249 -0
- package/src/components/MediaCard/index.ts +2 -0
- package/src/components/Pressable/Pressable.tsx +100 -0
- package/src/components/Pressable/index.ts +1 -0
- package/src/components/Progress/Progress.tsx +14 -7
- package/src/components/RadioGroup/RadioGroup.tsx +1 -1
- package/src/components/Select/Select.tsx +5 -5
- package/src/components/Sheet/Sheet.tsx +35 -15
- package/src/components/Skeleton/Skeleton.tsx +34 -7
- package/src/components/Slider/Slider.tsx +2 -2
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Switch/Switch.tsx +31 -4
- package/src/components/Tabs/Tabs.tsx +63 -45
- package/src/components/Text/Text.tsx +59 -10
- package/src/components/Textarea/Textarea.tsx +4 -3
- package/src/components/Toast/Toast.tsx +77 -36
- package/src/components/Toggle/Toggle.tsx +3 -3
- package/src/index.ts +8 -2
- package/src/theme/ThemeProvider.tsx +11 -10
- package/src/theme/colorUtils.ts +80 -0
- package/src/theme/colors.ts +76 -35
- package/src/theme/index.ts +2 -2
- package/src/theme/types.ts +27 -13
- package/src/tokens.ts +150 -13
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
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:
|
|
38
|
-
shadowOpacity: 0.
|
|
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.
|
|
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.
|
|
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
|
+
}
|