@retray-dev/ui-kit 2.7.0 → 3.0.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 +102 -15
- package/README.md +25 -5
- package/dist/index.d.mts +36 -6
- package/dist/index.d.ts +36 -6
- package/dist/index.js +692 -484
- package/dist/index.mjs +622 -415
- package/package.json +6 -3
- package/src/assets/fonts/Poppins-Black.ttf +0 -0
- package/src/assets/fonts/Poppins-BlackItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/src/assets/fonts/Poppins-BoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Italic.ttf +0 -0
- package/src/assets/fonts/Poppins-Light.ttf +0 -0
- package/src/assets/fonts/Poppins-LightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/src/assets/fonts/Poppins-MediumItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Thin.ttf +0 -0
- package/src/assets/fonts/Poppins-ThinItalic.ttf +0 -0
- package/src/components/Accordion/Accordion.tsx +16 -9
- package/src/components/AlertBanner/AlertBanner.tsx +35 -35
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Badge/Badge.tsx +12 -8
- package/src/components/Button/Button.tsx +9 -9
- package/src/components/Card/Card.tsx +12 -9
- package/src/components/Checkbox/Checkbox.tsx +9 -8
- package/src/components/Chip/Chip.tsx +22 -6
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +86 -38
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +1 -1
- package/src/components/CurrencyInput/CurrencyInput.tsx +11 -4
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/IconButton/IconButton.tsx +147 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/Input/Input.tsx +12 -8
- package/src/components/LabelValue/LabelValue.tsx +4 -3
- package/src/components/ListItem/ListItem.tsx +10 -9
- package/src/components/MonthPicker/MonthPicker.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +36 -35
- package/src/components/Select/Select.tsx +19 -21
- package/src/components/Sheet/Sheet.tsx +4 -3
- package/src/components/Slider/Slider.tsx +3 -3
- package/src/components/Spinner/Spinner.tsx +36 -2
- package/src/components/Switch/Switch.tsx +4 -4
- package/src/components/Tabs/Tabs.tsx +10 -16
- package/src/components/Text/Text.tsx +6 -6
- package/src/components/Textarea/Textarea.tsx +8 -6
- package/src/components/Toast/Toast.tsx +29 -23
- package/src/components/Toggle/Toggle.tsx +7 -5
- package/src/fonts.ts +30 -0
- package/src/index.ts +1 -0
- package/src/theme/colors.ts +22 -14
- package/src/theme/types.ts +4 -0
- package/src/components/Alert/Alert.tsx +0 -84
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v3.0.0)
|
|
2
2
|
|
|
3
3
|
This file is the AI reference for this package. It is shipped inside the npm package so consuming projects can import it into their `CLAUDE.md` with:
|
|
4
4
|
|
|
@@ -42,6 +42,54 @@ export default function App() {
|
|
|
42
42
|
- `BottomSheetModalProvider` must be inside `GestureHandlerRootView`
|
|
43
43
|
- `ToastProvider` must be inside `SafeAreaProvider`
|
|
44
44
|
|
|
45
|
+
## Typography — Poppins (Required)
|
|
46
|
+
|
|
47
|
+
All components use **Poppins** as the font family. You **must** load it before rendering any UI kit component, otherwise text will fall back to the system font.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { useFonts } from 'expo-font'
|
|
51
|
+
import { PoppinsFonts } from '@retray-dev/ui-kit/fonts'
|
|
52
|
+
|
|
53
|
+
export default function App() {
|
|
54
|
+
const [fontsLoaded] = useFonts(PoppinsFonts)
|
|
55
|
+
if (!fontsLoaded) return null // or show a splash screen
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
// ... your providers and app
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**How it works:**
|
|
64
|
+
1. Import `PoppinsFonts` from `@retray-dev/ui-kit/fonts` (separate export path)
|
|
65
|
+
2. Pass it to `expo-font`'s `useFonts()` hook at your app root
|
|
66
|
+
3. Metro resolves font files from `node_modules/@retray-dev/ui-kit/src/assets/fonts/` at bundle time
|
|
67
|
+
4. All library components reference fonts by family name (e.g., `fontFamily: 'Poppins-SemiBold'`)
|
|
68
|
+
|
|
69
|
+
**Why this pattern:**
|
|
70
|
+
- Fonts are NOT bundled into `dist/` — they ship as raw `.ttf` files inside `src/assets/fonts/`
|
|
71
|
+
- Metro resolves `require()` calls to these files when it bundles your app
|
|
72
|
+
- This prevents font corruption that can occur when `.ttf` files pass through bundlers like esbuild/tsup
|
|
73
|
+
|
|
74
|
+
**Setup:**
|
|
75
|
+
- Add `expo-font` to your app: `pnpm add expo-font`
|
|
76
|
+
- The `if (!fontsLoaded) return null` guard prevents text from rendering before fonts are ready
|
|
77
|
+
- Pair with `expo-splash-screen` in production to avoid a flash:
|
|
78
|
+
```tsx
|
|
79
|
+
import * as SplashScreen from 'expo-splash-screen'
|
|
80
|
+
SplashScreen.preventAutoHideAsync()
|
|
81
|
+
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (fontsLoaded) SplashScreen.hideAsync()
|
|
84
|
+
}, [fontsLoaded])
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Included weights:**
|
|
88
|
+
- Regular: `Poppins-Thin`, `Poppins-ExtraLight`, `Poppins-Light`, `Poppins-Regular`, `Poppins-Medium`, `Poppins-SemiBold`, `Poppins-Bold`, `Poppins-ExtraBold`, `Poppins-Black`
|
|
89
|
+
- Italic: `Poppins-Italic`, `Poppins-MediumItalic`, `Poppins-SemiBoldItalic`, `Poppins-BoldItalic`
|
|
90
|
+
|
|
91
|
+
**Total: 13 font files** exported from the package. Additional italic variants exist in `src/assets/fonts/` but are not exported — if you need them, open an issue.
|
|
92
|
+
|
|
45
93
|
### ThemeProvider Props
|
|
46
94
|
|
|
47
95
|
| Prop | Type | Default | Notes |
|
|
@@ -74,7 +122,7 @@ function MyComponent() {
|
|
|
74
122
|
|
|
75
123
|
## Theme Tokens
|
|
76
124
|
|
|
77
|
-
All
|
|
125
|
+
All 23 tokens are available via `useTheme().colors` and are applied exactly as provided — there is no automatic color derivation or forced contrast applied by the library. Consumers may pass partial overrides for `light` and/or `dark` and the values are used as-is.
|
|
78
126
|
|
|
79
127
|
The `ThemeColors` type (and `Theme`, `ColorScheme`) are exported directly from the package:
|
|
80
128
|
```ts
|
|
@@ -83,25 +131,29 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
83
131
|
|
|
84
132
|
| Token | Light | Dark | Semantic Role |
|
|
85
133
|
|-------|-------|------|---------------|
|
|
86
|
-
| `background` | `#ffffff` | `#
|
|
134
|
+
| `background` | `#ffffff` | `#0f0f0f` | Screen / page background |
|
|
87
135
|
| `foreground` | `#171717` | `#fafafa` | Primary text color |
|
|
88
|
-
| `card` | `#ffffff` | `#
|
|
136
|
+
| `card` | `#ffffff` | `#1c1c1c` | Card / surface background |
|
|
89
137
|
| `cardForeground` | `#171717` | `#fafafa` | Text on cards |
|
|
90
138
|
| `primary` | `#1a1a1a` | `#fafafa` | Primary action (buttons, selected states) |
|
|
91
|
-
| `primaryForeground` | `#ffffff` | `#
|
|
92
|
-
| `secondary` | `#f1f1f1` | `#
|
|
139
|
+
| `primaryForeground` | `#ffffff` | `#0f0f0f` | Text/icon on primary background |
|
|
140
|
+
| `secondary` | `#f1f1f1` | `#272727` | Secondary surfaces |
|
|
93
141
|
| `secondaryForeground` | `#171717` | `#fafafa` | Text on secondary |
|
|
94
|
-
| `muted` | `#f1f1f1` | `#
|
|
95
|
-
| `mutedForeground` | `#a2a2a2` | `#
|
|
96
|
-
| `accent` | `#e4e4e4` | `#
|
|
142
|
+
| `muted` | `#f1f1f1` | `#272727` | Muted backgrounds, skeleton fills, track fills |
|
|
143
|
+
| `mutedForeground` | `#a2a2a2` | `#9a9a9a` | Placeholder text, helper text, captions |
|
|
144
|
+
| `accent` | `#e4e4e4` | `#2e2e2e` | Hover / pressed state fills |
|
|
97
145
|
| `accentForeground` | `#171717` | `#fafafa` | Text on accent |
|
|
98
|
-
| `destructive` | `#ef4444` | `#dc2626` | Error / danger / delete actions |
|
|
99
|
-
| `destructiveForeground` | `#
|
|
100
|
-
| `
|
|
146
|
+
| `destructive` | `#ef4444` | `#dc2626` | Error / danger / delete actions — base color |
|
|
147
|
+
| `destructiveForeground` | `#ffffff` | `#ffffff` | Text on destructive |
|
|
148
|
+
| `destructiveTint` | `#fff5f5` | `#3b0a0a` | Very light/dark background tint for destructive states |
|
|
149
|
+
| `destructiveBorder` | `#fecaca` | `#7f1d1d` | Border color for destructive outlined elements |
|
|
150
|
+
| `success` | `#1a7a45` | `#166534` | Success / confirmation / done actions — base color |
|
|
151
|
+
| `successForeground` | `#ffffff` | `#ffffff` | Text on success |
|
|
152
|
+
| `successTint` | `#f0fdf4` | `#052e16` | Very light/dark background tint for success states |
|
|
153
|
+
| `successBorder` | `#bbf7d0` | `#166534` | Border color for success outlined elements |
|
|
154
|
+
| `border` | `#e5e5e5` | `#303030` | Borders and dividers |
|
|
101
155
|
| `input` | `#e5e5e5` | `#2a2a2a` | Input field border color |
|
|
102
156
|
| `ring` | `#1a1a1a` | `#fafafa` | Optional focus ring token (components may use `primary` by default) |
|
|
103
|
-
| `success` | `#16a34a` | `#22c55e` | Success state (Toast success variant) |
|
|
104
|
-
| `successForeground` | `#1a1a1a` | `#1a1a1a` | Text on success background |
|
|
105
157
|
|
|
106
158
|
---
|
|
107
159
|
|
|
@@ -271,6 +323,36 @@ const isWide = width >= BREAKPOINTS.wide
|
|
|
271
323
|
|
|
272
324
|
---
|
|
273
325
|
|
|
326
|
+
### IconButton
|
|
327
|
+
|
|
328
|
+
**Import:** `import { IconButton } from '@retray-dev/ui-kit'`
|
|
329
|
+
**When to use:** Compact icon-only pressable action — toolbars, FABs, inline icon actions. Use `Button` when a label is needed.
|
|
330
|
+
**Extends:** `TouchableOpacityProps` — all RN TouchableOpacity props pass through.
|
|
331
|
+
|
|
332
|
+
| Prop | Type | Default | Notes |
|
|
333
|
+
|------|------|---------|-------|
|
|
334
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons` (e.g. `"plus"`, `"x"`, `"home"`). Takes precedence over `icon` |
|
|
335
|
+
| icon | `React.ReactNode` | — | Custom icon node — used when `iconName` is not provided |
|
|
336
|
+
| iconColor | `string` | — | Override icon color. Defaults to variant foreground color |
|
|
337
|
+
| variant | `'primary' \| 'secondary' \| 'outline' \| 'ghost' \| 'destructive'` | `'primary'` | Visual style — same tokens as `Button` |
|
|
338
|
+
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | sm=40pt / md=44pt / lg=52pt (all ≥44pt on md/lg per HIG) |
|
|
339
|
+
| loading | `boolean` | `false` | Replaces icon with a spinner and forces disabled state |
|
|
340
|
+
| disabled | `boolean` | — | Reduces opacity to 0.5 |
|
|
341
|
+
|
|
342
|
+
**Variants:** Same color logic as `Button` — `primary`, `secondary`, `outline`, `ghost`, `destructive`.
|
|
343
|
+
|
|
344
|
+
**Animations:** Scale springs to 0.95 on `onPressIn`, back to 1.0 on `onPressOut`. `impactAsync(Light)` haptic on press.
|
|
345
|
+
|
|
346
|
+
**Example:**
|
|
347
|
+
```tsx
|
|
348
|
+
<IconButton iconName="plus" onPress={handleAdd} />
|
|
349
|
+
<IconButton iconName="x" variant="ghost" size="sm" onPress={handleClose} />
|
|
350
|
+
<IconButton iconName="trash-2" variant="destructive" onPress={handleDelete} />
|
|
351
|
+
<IconButton iconName="check" variant="outline" size="lg" loading={saving} />
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
274
356
|
### Input
|
|
275
357
|
|
|
276
358
|
**Import:** `import { Input } from '@retray-dev/ui-kit'`
|
|
@@ -455,11 +537,13 @@ const [amount, setAmount] = useState(0)
|
|
|
455
537
|
|------|------|---------|-------|
|
|
456
538
|
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | `sm`/`md` map to RN `'small'`, `lg` maps to `'large'` |
|
|
457
539
|
| color | `string` | `primary` token | Override spinner color |
|
|
540
|
+
| label | `string` | — | Text displayed below the spinner |
|
|
458
541
|
|
|
459
542
|
**Example:**
|
|
460
543
|
```tsx
|
|
461
544
|
<Spinner />
|
|
462
545
|
<Spinner size="lg" color="#6366f1" />
|
|
546
|
+
<Spinner size="lg" label="Loading..." />
|
|
463
547
|
```
|
|
464
548
|
|
|
465
549
|
---
|
|
@@ -858,7 +942,7 @@ const [accepted, setAccepted] = useState(false)
|
|
|
858
942
|
|
|
859
943
|
| Prop | Type | Default | Notes |
|
|
860
944
|
|------|------|---------|-------|
|
|
861
|
-
| tabs | `TabItem[]` | required | Each item: `{ label: string, value: string }` |
|
|
945
|
+
| tabs | `TabItem[]` | required | Each item: `{ label: string, value: string, icon?: ReactNode \| ((active: boolean) => ReactNode) }` |
|
|
862
946
|
| value | `string` | — | Controlled active tab |
|
|
863
947
|
| onValueChange | `(value: string) => void` | — | — |
|
|
864
948
|
| children | `ReactNode` | — | `TabsContent` components |
|
|
@@ -1123,6 +1207,8 @@ function MyComponent() {
|
|
|
1123
1207
|
| label | `string` | required | — |
|
|
1124
1208
|
| selected | `boolean` | `false` | Controls fill color |
|
|
1125
1209
|
| onPress | `() => void` | — | — |
|
|
1210
|
+
| icon | `ReactNode` | — | Custom icon rendered before the label |
|
|
1211
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon` |
|
|
1126
1212
|
| style | `ViewStyle` | — | — |
|
|
1127
1213
|
|
|
1128
1214
|
**`ChipGroup` Props:**
|
|
@@ -1307,6 +1393,7 @@ Each component that accepts icon slots now has a corresponding `iconName` prop.
|
|
|
1307
1393
|
| Component | Prop(s) | Slot | Default size | Default color |
|
|
1308
1394
|
|---|---|---|---|---|
|
|
1309
1395
|
| `Button` | `iconName`, `iconColor` | Left or right of label | sm=16 / md=18 / lg=20 | Variant label color |
|
|
1396
|
+
| `IconButton` | `iconName`, `iconColor` | Center (icon-only) | sm=18 / md=20 / lg=24 | Variant foreground color |
|
|
1310
1397
|
| `Input` | `prefixIcon`, `prefixIconColor` | Before input text | 20 | `mutedForeground` |
|
|
1311
1398
|
| `Input` | `suffixIcon`, `suffixIconColor` | After input text | 20 | `mutedForeground` |
|
|
1312
1399
|
| `ListItem` | `leftIcon`, `leftIconColor` | Left 44×44 slot | 24 | `foreground` |
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A personal React Native / Expo UI component library with a built-in design system, dark mode support, haptic feedback, and smooth animations.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
- Light/dark theme with
|
|
5
|
+
- 33 components across 6 categories
|
|
6
|
+
- Light/dark theme with 23 color tokens and full customization
|
|
7
7
|
- Apple HIG–compliant touch targets and haptic feedback
|
|
8
8
|
- Animated interactions: spring press, sliding tabs, accordion easing, animated progress
|
|
9
9
|
- Built with TypeScript — full type declarations included
|
|
@@ -23,7 +23,7 @@ pnpm add @retray-dev/ui-kit
|
|
|
23
23
|
Install these in your app if not already present:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
pnpm add expo-haptics expo-linear-gradient react-native-safe-area-context @gorhom/bottom-sheet react-native-reanimated react-native-gesture-handler react-native-worklets @react-native-picker/picker @react-native-community/slider @expo/vector-icons
|
|
26
|
+
pnpm add expo-font expo-haptics expo-linear-gradient react-native-safe-area-context @gorhom/bottom-sheet react-native-reanimated react-native-gesture-handler react-native-worklets @react-native-picker/picker @react-native-community/slider @expo/vector-icons
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
For Expo projects, run `npx expo install` instead to get SDK-compatible versions.
|
|
@@ -40,6 +40,26 @@ module.exports = function (api) {
|
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## Typography
|
|
44
|
+
|
|
45
|
+
All components use **Poppins** font family. You must load the fonts at app root before rendering any component:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { useFonts } from 'expo-font'
|
|
49
|
+
import { PoppinsFonts } from '@retray-dev/ui-kit/fonts'
|
|
50
|
+
|
|
51
|
+
export default function App() {
|
|
52
|
+
const [fontsLoaded] = useFonts(PoppinsFonts)
|
|
53
|
+
if (!fontsLoaded) return null
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
// ... providers and app
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The library ships 13 font files (9 regular weights + 4 italic variants) as raw `.ttf` files. Metro resolves them at bundle time.
|
|
62
|
+
|
|
43
63
|
## Setup
|
|
44
64
|
|
|
45
65
|
Wrap your app root with all required providers. Order matters.
|
|
@@ -93,7 +113,7 @@ import { useTheme } from '@retray-dev/ui-kit'
|
|
|
93
113
|
const { colors, colorScheme } = useTheme()
|
|
94
114
|
```
|
|
95
115
|
|
|
96
|
-
**Available tokens:** `background`, `foreground`, `card`, `cardForeground`, `primary`, `primaryForeground`, `secondary`, `secondaryForeground`, `muted`, `mutedForeground`, `accent`, `accentForeground`, `destructive`, `destructiveForeground`, `border`, `input`, `ring`, `success`, `successForeground`
|
|
116
|
+
**Available tokens:** `background`, `foreground`, `card`, `cardForeground`, `primary`, `primaryForeground`, `secondary`, `secondaryForeground`, `muted`, `mutedForeground`, `accent`, `accentForeground`, `destructive`, `destructiveForeground`, `destructiveTint`, `destructiveBorder`, `border`, `input`, `ring`, `success`, `successForeground`, `successTint`, `successBorder`
|
|
97
117
|
|
|
98
118
|
## Design Tokens
|
|
99
119
|
|
|
@@ -119,7 +139,7 @@ import { SPACING, ICON_SIZES, RADIUS, SHADOWS, BREAKPOINTS } from '@retray-dev/u
|
|
|
119
139
|
| ----------- | ----------------------------------------------------------------------------------------------- |
|
|
120
140
|
| Display | `Text`, `Badge`, `Avatar`, `Separator`, `Spinner`, `Skeleton`, `Progress`, `CurrencyDisplay` |
|
|
121
141
|
| Surfaces | `Card`, `AlertBanner`, `EmptyState` |
|
|
122
|
-
| Form | `Button`, `Input`, `CurrencyInput`, `CurrencyInputLarge`, `Textarea`, `Checkbox`, `Switch`, `Toggle`, `RadioGroup`, `Select`, `Slider` |
|
|
142
|
+
| Form | `Button`, `IconButton`, `Input`, `CurrencyInput`, `CurrencyInputLarge`, `Textarea`, `Checkbox`, `Switch`, `Toggle`, `RadioGroup`, `Select`, `Slider` |
|
|
123
143
|
| Composition | `Tabs`, `Accordion` |
|
|
124
144
|
| Overlays | `Sheet`, `ConfirmDialog` |
|
|
125
145
|
| Feedback | `Toast` / `ToastProvider` / `useToast` |
|
package/dist/index.d.mts
CHANGED
|
@@ -22,6 +22,10 @@ type ThemeColors = {
|
|
|
22
22
|
ring: string;
|
|
23
23
|
success: string;
|
|
24
24
|
successForeground: string;
|
|
25
|
+
destructiveTint: string;
|
|
26
|
+
destructiveBorder: string;
|
|
27
|
+
successTint: string;
|
|
28
|
+
successBorder: string;
|
|
25
29
|
};
|
|
26
30
|
type Theme = {
|
|
27
31
|
light?: Partial<ThemeColors>;
|
|
@@ -88,6 +92,25 @@ interface ButtonProps extends TouchableOpacityProps {
|
|
|
88
92
|
}
|
|
89
93
|
declare function Button({ label, variant, size, loading, fullWidth, icon, iconName, iconColor, iconPosition, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
|
|
90
94
|
|
|
95
|
+
type IconButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
|
|
96
|
+
type IconButtonSize = 'sm' | 'md' | 'lg';
|
|
97
|
+
interface IconButtonProps extends TouchableOpacityProps {
|
|
98
|
+
/**
|
|
99
|
+
* Icon name from `@expo/vector-icons` (e.g. `"home"`, `"star"`, `"plus"`).
|
|
100
|
+
* See https://icons.expo.fyi. Takes precedence over `icon` when both supplied.
|
|
101
|
+
*/
|
|
102
|
+
iconName?: string;
|
|
103
|
+
/** ReactNode icon — used when `iconName` is not provided. */
|
|
104
|
+
icon?: React.ReactNode;
|
|
105
|
+
/** Override the resolved icon color. Defaults to the foreground color for the active variant. */
|
|
106
|
+
iconColor?: string;
|
|
107
|
+
variant?: IconButtonVariant;
|
|
108
|
+
size?: IconButtonSize;
|
|
109
|
+
/** Replaces icon with a spinner and forces `disabled`. */
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
}
|
|
112
|
+
declare function IconButton({ iconName, icon, iconColor, variant, size, loading, disabled, style, onPress, ...props }: IconButtonProps): React.JSX.Element;
|
|
113
|
+
|
|
91
114
|
type TextVariant = 'h1' | 'h2' | 'h3' | 'body' | 'caption' | 'label';
|
|
92
115
|
interface TextProps extends TextProps$1 {
|
|
93
116
|
variant?: TextVariant;
|
|
@@ -130,7 +153,7 @@ interface InputProps extends TextInputProps {
|
|
|
130
153
|
}
|
|
131
154
|
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type, containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
132
155
|
|
|
133
|
-
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline';
|
|
156
|
+
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'successOutline' | 'destructiveOutline';
|
|
134
157
|
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
135
158
|
interface BadgeProps {
|
|
136
159
|
label?: string;
|
|
@@ -197,8 +220,9 @@ type SpinnerSize = 'sm' | 'md' | 'lg';
|
|
|
197
220
|
interface SpinnerProps extends Omit<ActivityIndicatorProps, 'size'> {
|
|
198
221
|
size?: SpinnerSize;
|
|
199
222
|
color?: string;
|
|
223
|
+
label?: string;
|
|
200
224
|
}
|
|
201
|
-
declare function Spinner({ size, color, ...props }: SpinnerProps): React.JSX.Element;
|
|
225
|
+
declare function Spinner({ size, color, label, ...props }: SpinnerProps): React.JSX.Element;
|
|
202
226
|
|
|
203
227
|
interface SkeletonProps {
|
|
204
228
|
width?: number | string;
|
|
@@ -339,7 +363,7 @@ declare function RadioGroup({ options, value, onValueChange, orientation, style,
|
|
|
339
363
|
interface TabItem {
|
|
340
364
|
label: string;
|
|
341
365
|
value: string;
|
|
342
|
-
icon?: React.ReactNode;
|
|
366
|
+
icon?: React.ReactNode | ((active: boolean) => React.ReactNode);
|
|
343
367
|
}
|
|
344
368
|
interface TabsProps {
|
|
345
369
|
tabs: TabItem[];
|
|
@@ -477,10 +501,12 @@ interface CurrencyInputProps {
|
|
|
477
501
|
hint?: string;
|
|
478
502
|
placeholder?: string;
|
|
479
503
|
editable?: boolean;
|
|
504
|
+
/** Icon or element rendered at the left edge inside the input field. */
|
|
505
|
+
prefixIcon?: React.ReactNode;
|
|
480
506
|
containerStyle?: ViewStyle;
|
|
481
507
|
style?: TextStyle;
|
|
482
508
|
}
|
|
483
|
-
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
|
|
509
|
+
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, prefixIcon, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
|
|
484
510
|
|
|
485
511
|
interface CurrencyDisplayProps {
|
|
486
512
|
value: number | string;
|
|
@@ -555,6 +581,10 @@ interface ChipProps {
|
|
|
555
581
|
label: string;
|
|
556
582
|
selected?: boolean;
|
|
557
583
|
onPress?: () => void;
|
|
584
|
+
/** JSX icon rendered before the label. */
|
|
585
|
+
icon?: React.ReactNode;
|
|
586
|
+
/** Icon name from @expo/vector-icons resolved automatically. */
|
|
587
|
+
iconName?: string;
|
|
558
588
|
style?: ViewStyle;
|
|
559
589
|
}
|
|
560
590
|
interface ChipOption {
|
|
@@ -569,7 +599,7 @@ interface ChipGroupProps {
|
|
|
569
599
|
multiSelect?: boolean;
|
|
570
600
|
style?: ViewStyle;
|
|
571
601
|
}
|
|
572
|
-
declare function Chip({ label, selected, onPress, style }: ChipProps): React.JSX.Element;
|
|
602
|
+
declare function Chip({ label, selected, onPress, icon, iconName, style }: ChipProps): React.JSX.Element;
|
|
573
603
|
declare function ChipGroup({ options, value, onValueChange, multiSelect, style }: ChipGroupProps): React.JSX.Element;
|
|
574
604
|
|
|
575
605
|
interface ConfirmDialogProps {
|
|
@@ -690,4 +720,4 @@ type IconSizeKey = keyof IconSize;
|
|
|
690
720
|
type Radius = typeof RADIUS;
|
|
691
721
|
type RadiusKey = keyof Radius;
|
|
692
722
|
|
|
693
|
-
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, BREAKPOINTS, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, ICON_SIZES, Icon, type IconFamily, type IconProps, type IconSize, type IconSizeKey, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RADIUS, RadioGroup, type RadioGroupProps, type RadioOption, type Radius, type RadiusKey, SHADOWS, SPACING, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type Spacing, type SpacingKey, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|
|
723
|
+
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, BREAKPOINTS, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, ICON_SIZES, Icon, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, type IconFamily, type IconProps, type IconSize, type IconSizeKey, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RADIUS, RadioGroup, type RadioGroupProps, type RadioOption, type Radius, type RadiusKey, SHADOWS, SPACING, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type Spacing, type SpacingKey, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ type ThemeColors = {
|
|
|
22
22
|
ring: string;
|
|
23
23
|
success: string;
|
|
24
24
|
successForeground: string;
|
|
25
|
+
destructiveTint: string;
|
|
26
|
+
destructiveBorder: string;
|
|
27
|
+
successTint: string;
|
|
28
|
+
successBorder: string;
|
|
25
29
|
};
|
|
26
30
|
type Theme = {
|
|
27
31
|
light?: Partial<ThemeColors>;
|
|
@@ -88,6 +92,25 @@ interface ButtonProps extends TouchableOpacityProps {
|
|
|
88
92
|
}
|
|
89
93
|
declare function Button({ label, variant, size, loading, fullWidth, icon, iconName, iconColor, iconPosition, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
|
|
90
94
|
|
|
95
|
+
type IconButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive';
|
|
96
|
+
type IconButtonSize = 'sm' | 'md' | 'lg';
|
|
97
|
+
interface IconButtonProps extends TouchableOpacityProps {
|
|
98
|
+
/**
|
|
99
|
+
* Icon name from `@expo/vector-icons` (e.g. `"home"`, `"star"`, `"plus"`).
|
|
100
|
+
* See https://icons.expo.fyi. Takes precedence over `icon` when both supplied.
|
|
101
|
+
*/
|
|
102
|
+
iconName?: string;
|
|
103
|
+
/** ReactNode icon — used when `iconName` is not provided. */
|
|
104
|
+
icon?: React.ReactNode;
|
|
105
|
+
/** Override the resolved icon color. Defaults to the foreground color for the active variant. */
|
|
106
|
+
iconColor?: string;
|
|
107
|
+
variant?: IconButtonVariant;
|
|
108
|
+
size?: IconButtonSize;
|
|
109
|
+
/** Replaces icon with a spinner and forces `disabled`. */
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
}
|
|
112
|
+
declare function IconButton({ iconName, icon, iconColor, variant, size, loading, disabled, style, onPress, ...props }: IconButtonProps): React.JSX.Element;
|
|
113
|
+
|
|
91
114
|
type TextVariant = 'h1' | 'h2' | 'h3' | 'body' | 'caption' | 'label';
|
|
92
115
|
interface TextProps extends TextProps$1 {
|
|
93
116
|
variant?: TextVariant;
|
|
@@ -130,7 +153,7 @@ interface InputProps extends TextInputProps {
|
|
|
130
153
|
}
|
|
131
154
|
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, prefixIcon, suffixIcon, prefixIconColor, suffixIconColor, type, containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
132
155
|
|
|
133
|
-
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline';
|
|
156
|
+
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline' | 'success' | 'warning' | 'successOutline' | 'destructiveOutline';
|
|
134
157
|
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
135
158
|
interface BadgeProps {
|
|
136
159
|
label?: string;
|
|
@@ -197,8 +220,9 @@ type SpinnerSize = 'sm' | 'md' | 'lg';
|
|
|
197
220
|
interface SpinnerProps extends Omit<ActivityIndicatorProps, 'size'> {
|
|
198
221
|
size?: SpinnerSize;
|
|
199
222
|
color?: string;
|
|
223
|
+
label?: string;
|
|
200
224
|
}
|
|
201
|
-
declare function Spinner({ size, color, ...props }: SpinnerProps): React.JSX.Element;
|
|
225
|
+
declare function Spinner({ size, color, label, ...props }: SpinnerProps): React.JSX.Element;
|
|
202
226
|
|
|
203
227
|
interface SkeletonProps {
|
|
204
228
|
width?: number | string;
|
|
@@ -339,7 +363,7 @@ declare function RadioGroup({ options, value, onValueChange, orientation, style,
|
|
|
339
363
|
interface TabItem {
|
|
340
364
|
label: string;
|
|
341
365
|
value: string;
|
|
342
|
-
icon?: React.ReactNode;
|
|
366
|
+
icon?: React.ReactNode | ((active: boolean) => React.ReactNode);
|
|
343
367
|
}
|
|
344
368
|
interface TabsProps {
|
|
345
369
|
tabs: TabItem[];
|
|
@@ -477,10 +501,12 @@ interface CurrencyInputProps {
|
|
|
477
501
|
hint?: string;
|
|
478
502
|
placeholder?: string;
|
|
479
503
|
editable?: boolean;
|
|
504
|
+
/** Icon or element rendered at the left edge inside the input field. */
|
|
505
|
+
prefixIcon?: React.ReactNode;
|
|
480
506
|
containerStyle?: ViewStyle;
|
|
481
507
|
style?: TextStyle;
|
|
482
508
|
}
|
|
483
|
-
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
|
|
509
|
+
declare function CurrencyInput({ value, onChangeText, onChangeValue, prefix, thousandsSeparator, size, label, error, hint, placeholder, editable, prefixIcon, containerStyle, style, }: CurrencyInputProps): React.JSX.Element;
|
|
484
510
|
|
|
485
511
|
interface CurrencyDisplayProps {
|
|
486
512
|
value: number | string;
|
|
@@ -555,6 +581,10 @@ interface ChipProps {
|
|
|
555
581
|
label: string;
|
|
556
582
|
selected?: boolean;
|
|
557
583
|
onPress?: () => void;
|
|
584
|
+
/** JSX icon rendered before the label. */
|
|
585
|
+
icon?: React.ReactNode;
|
|
586
|
+
/** Icon name from @expo/vector-icons resolved automatically. */
|
|
587
|
+
iconName?: string;
|
|
558
588
|
style?: ViewStyle;
|
|
559
589
|
}
|
|
560
590
|
interface ChipOption {
|
|
@@ -569,7 +599,7 @@ interface ChipGroupProps {
|
|
|
569
599
|
multiSelect?: boolean;
|
|
570
600
|
style?: ViewStyle;
|
|
571
601
|
}
|
|
572
|
-
declare function Chip({ label, selected, onPress, style }: ChipProps): React.JSX.Element;
|
|
602
|
+
declare function Chip({ label, selected, onPress, icon, iconName, style }: ChipProps): React.JSX.Element;
|
|
573
603
|
declare function ChipGroup({ options, value, onValueChange, multiSelect, style }: ChipGroupProps): React.JSX.Element;
|
|
574
604
|
|
|
575
605
|
interface ConfirmDialogProps {
|
|
@@ -690,4 +720,4 @@ type IconSizeKey = keyof IconSize;
|
|
|
690
720
|
type Radius = typeof RADIUS;
|
|
691
721
|
type RadiusKey = keyof Radius;
|
|
692
722
|
|
|
693
|
-
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, BREAKPOINTS, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, ICON_SIZES, Icon, type IconFamily, type IconProps, type IconSize, type IconSizeKey, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RADIUS, RadioGroup, type RadioGroupProps, type RadioOption, type Radius, type RadiusKey, SHADOWS, SPACING, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type Spacing, type SpacingKey, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|
|
723
|
+
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, BREAKPOINTS, Badge, type BadgeProps, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardProps, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, Chip, ChipGroup, type ChipGroupProps, type ChipOption, type ChipProps, type ColorScheme, ConfirmDialog, type ConfirmDialogProps, CurrencyDisplay, type CurrencyDisplayProps, CurrencyInput, CurrencyInput as CurrencyInputLarge, type CurrencyInputProps, EmptyState, type EmptyStateProps, ICON_SIZES, Icon, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, type IconFamily, type IconProps, type IconSize, type IconSizeKey, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RADIUS, RadioGroup, type RadioGroupProps, type RadioOption, type Radius, type RadiusKey, SHADOWS, SPACING, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type Spacing, type SpacingKey, Spinner, type SpinnerProps, type SpinnerSize, Switch, type SwitchProps, type TabItem, Tabs, TabsContent, type TabsContentProps, type TabsProps, Text, type TextProps, type TextVariant, Textarea, type TextareaProps, type Theme, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ToastItem, ToastProvider, type ToastProviderProps, type ToastVariant, Toggle, type ToggleProps, type ToggleSize, type ToggleVariant, defaultDark, defaultLight, renderIcon, useTheme, useToast };
|