@retray-dev/ui-kit 2.5.2 → 2.6.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 +152 -5
- package/dist/index.d.mts +98 -8
- package/dist/index.d.ts +98 -8
- package/dist/index.js +240 -166
- package/dist/index.mjs +185 -119
- package/package.json +1 -1
- package/src/components/AlertBanner/AlertBanner.tsx +14 -2
- package/src/components/Badge/Badge.tsx +16 -2
- package/src/components/Button/Button.tsx +20 -3
- package/src/components/EmptyState/EmptyState.tsx +15 -3
- package/src/components/Input/Input.tsx +29 -8
- package/src/components/ListItem/ListItem.tsx +26 -3
- package/src/components/Toast/Toast.tsx +11 -1
- package/src/components/Toggle/Toggle.tsx +27 -2
- package/src/index.ts +4 -0
- package/src/utils/icons.ts +73 -0
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (v2.
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v2.6.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
|
|
|
@@ -153,6 +153,8 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
153
153
|
| fullWidth | `boolean` | `false` | Stretches to container width (`alignSelf: 'stretch'`) |
|
|
154
154
|
| disabled | `boolean` | — | Reduces opacity to 0.5 |
|
|
155
155
|
| icon | `React.ReactNode \| ((props: { label, size, variant }) => React.ReactNode)` | — | Icon rendered alongside the label. Can be a node or a render function |
|
|
156
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons` (e.g. `"arrow-right"`). See [icons.expo.fyi](https://icons.expo.fyi). Takes precedence over `icon` |
|
|
157
|
+
| iconColor | `string` | — | Override icon color. Defaults to variant label color |
|
|
156
158
|
| iconPosition | `'left' \| 'right'` | `'left'` | Side the icon appears on |
|
|
157
159
|
|
|
158
160
|
**Variants:**
|
|
@@ -170,7 +172,8 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
170
172
|
<Button label="Cancel" variant="ghost" onPress={onCancel} />
|
|
171
173
|
<Button label="Delete" variant="outline" size="sm" />
|
|
172
174
|
<Button label="Submitting..." loading fullWidth />
|
|
173
|
-
<Button label="
|
|
175
|
+
<Button label="Continue" iconName="arrow-right" iconPosition="right" />
|
|
176
|
+
<Button label="Delete" variant="destructive" iconName="trash-2" />
|
|
174
177
|
```
|
|
175
178
|
|
|
176
179
|
---
|
|
@@ -190,6 +193,10 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
190
193
|
| suffix | `string \| ReactNode` | — | Content rendered after the input field (e.g., `"kg"` or a button) |
|
|
191
194
|
| prefixStyle | `TextStyle` | — | Style applied to the prefix text when prefix is a string |
|
|
192
195
|
| suffixStyle | `TextStyle` | — | Style applied to the suffix text when suffix is a string |
|
|
196
|
+
| prefixIcon | `string` | — | Icon name from `@expo/vector-icons` rendered before the input. Takes precedence over `prefix` |
|
|
197
|
+
| suffixIcon | `string` | — | Icon name from `@expo/vector-icons` rendered after the input. Takes precedence over `suffix` (unless `type="password"`) |
|
|
198
|
+
| prefixIconColor | `string` | — | Override prefix icon color. Defaults to `mutedForeground` |
|
|
199
|
+
| suffixIconColor | `string` | — | Override suffix icon color. Defaults to `mutedForeground` |
|
|
193
200
|
| type | `'text' \| 'password'` | `'text'` | When `'password'`, shows a visibility toggle button in the suffix slot |
|
|
194
201
|
| containerStyle | `ViewStyle` | — | Style for the outer container `View` |
|
|
195
202
|
|
|
@@ -202,6 +209,8 @@ import type { ThemeColors } from '@retray-dev/ui-kit'
|
|
|
202
209
|
<Input label="Username" hint="Must be at least 4 characters" />
|
|
203
210
|
<Input label="Amount" prefix="$" placeholder="0.00" keyboardType="numeric" />
|
|
204
211
|
<Input label="Weight" suffix="kg" placeholder="0" />
|
|
212
|
+
<Input placeholder="Search..." prefixIcon="search" />
|
|
213
|
+
<Input placeholder="Amount" prefixIcon="dollar-sign" suffixIcon="check" />
|
|
205
214
|
```
|
|
206
215
|
|
|
207
216
|
---
|
|
@@ -285,6 +294,8 @@ const [amount, setAmount] = useState(0)
|
|
|
285
294
|
| variant | `'default' \| 'secondary' \| 'destructive' \| 'outline'` | `'default'` | — |
|
|
286
295
|
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | Controls padding and font size |
|
|
287
296
|
| icon | `ReactNode` | — | Icon rendered before the label/children |
|
|
297
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon` |
|
|
298
|
+
| iconColor | `string` | — | Override icon color. Defaults to variant foreground color |
|
|
288
299
|
| style | `ViewStyle` | — | — |
|
|
289
300
|
|
|
290
301
|
**Example:**
|
|
@@ -293,7 +304,8 @@ const [amount, setAmount] = useState(0)
|
|
|
293
304
|
<Badge label="Error" variant="destructive" />
|
|
294
305
|
<Badge label="Draft" variant="secondary" size="sm" />
|
|
295
306
|
<Badge label="Beta" variant="outline" />
|
|
296
|
-
<Badge
|
|
307
|
+
<Badge label="Active" variant="default" iconName="check" size="sm" />
|
|
308
|
+
<Badge label="Error" variant="destructive" iconName="alert-circle" />
|
|
297
309
|
```
|
|
298
310
|
|
|
299
311
|
---
|
|
@@ -528,6 +540,8 @@ All sub-components (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`,
|
|
|
528
540
|
| description | `string` | — | Detail text |
|
|
529
541
|
| variant | `'default' \| 'destructive' \| 'success'` | `'default'` | Controls border/text color |
|
|
530
542
|
| icon | `ReactNode` | — | Icon placed to the left of the text content. Defaults to a variant-appropriate symbol (`ℹ`, `⚠`, `✓`) |
|
|
543
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon` (but still falls back to the variant default when neither is set) |
|
|
544
|
+
| iconColor | `string` | — | Override icon color. Defaults to the variant title color |
|
|
531
545
|
| style | `ViewStyle` | — | — |
|
|
532
546
|
|
|
533
547
|
**Example:**
|
|
@@ -535,6 +549,7 @@ All sub-components (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`,
|
|
|
535
549
|
<AlertBanner title="Info" description="Your session will expire in 5 minutes." />
|
|
536
550
|
<AlertBanner variant="destructive" title="Error" description="Failed to save. Try again." />
|
|
537
551
|
<AlertBanner variant="success" title="Done" description="Your changes have been saved." />
|
|
552
|
+
<AlertBanner iconName="bell" title="Reminder" description="Complete your profile." />
|
|
538
553
|
```
|
|
539
554
|
|
|
540
555
|
---
|
|
@@ -549,6 +564,8 @@ All sub-components (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`,
|
|
|
549
564
|
| title | `string` | required | — |
|
|
550
565
|
| description | `string` | — | — |
|
|
551
566
|
| icon | `ReactNode` | — | Shown in a 48×48 muted square above the text |
|
|
567
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon`. Sized automatically (48 default, 32 compact) |
|
|
568
|
+
| iconColor | `string` | — | Override icon color. Defaults to `mutedForeground` |
|
|
552
569
|
| action | `ReactNode` | — | Usually a `Button`, placed below the text |
|
|
553
570
|
| size | `'default' \| 'compact'` | `'default'` | `compact` hides description/action, uses a 36×36 icon, smaller title (15px), and tighter spacing |
|
|
554
571
|
| style | `ViewStyle` | — | — |
|
|
@@ -560,6 +577,8 @@ All sub-components (`CardHeader`, `CardTitle`, `CardDescription`, `CardContent`,
|
|
|
560
577
|
description="You're all caught up!"
|
|
561
578
|
action={<Button label="Refresh" variant="outline" size="sm" />}
|
|
562
579
|
/>
|
|
580
|
+
<EmptyState iconName="inbox" title="No messages" description="You're all caught up." />
|
|
581
|
+
<EmptyState iconName="search" title="No results" size="compact" />
|
|
563
582
|
```
|
|
564
583
|
|
|
565
584
|
---
|
|
@@ -621,14 +640,19 @@ const [accepted, setAccepted] = useState(false)
|
|
|
621
640
|
| label | `string` | — | Text label |
|
|
622
641
|
| icon | `ReactNode \| ((pressed: boolean) => ReactNode)` | — | Icon shown when not pressed — can be combined with `label` |
|
|
623
642
|
| activeIcon | `ReactNode \| ((pressed: boolean) => ReactNode)` | — | Icon shown when pressed. If omitted, a default `✓` check mark is shown |
|
|
643
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons` shown when not pressed. Takes precedence over `icon` |
|
|
644
|
+
| activeIconName | `string` | — | Icon name shown when pressed. Takes precedence over `activeIcon` |
|
|
645
|
+
| iconColor | `string` | — | Override inactive icon color. Defaults to `mutedForeground` |
|
|
646
|
+
| activeIconColor | `string` | — | Override active icon color. Defaults to `primary` |
|
|
624
647
|
|
|
625
648
|
**Animation:** `borderColor` and `backgroundColor` animate via `Animated.timing` (150ms, `Easing.out`) on press state change. `borderWidth` stays fixed at 2pt to prevent layout jumps.
|
|
626
649
|
|
|
627
650
|
**Example:**
|
|
628
651
|
```tsx
|
|
629
652
|
<Toggle pressed={bold} onPressedChange={setBold} label="Bold" variant="outline" />
|
|
653
|
+
<Toggle pressed={muted} onPressedChange={setMuted} iconName="volume-x" activeIconName="volume" />
|
|
630
654
|
|
|
631
|
-
// With custom active icon
|
|
655
|
+
// With custom active icon (ReactNode)
|
|
632
656
|
<Toggle
|
|
633
657
|
pressed={favorited}
|
|
634
658
|
onPressedChange={setFavorited}
|
|
@@ -873,6 +897,9 @@ function MyComponent() {
|
|
|
873
897
|
onPress={async () => {
|
|
874
898
|
await save()
|
|
875
899
|
toast({ title: 'Saved', description: 'Your changes were saved.', variant: 'success' })
|
|
900
|
+
// With custom icon name
|
|
901
|
+
toast({ title: 'Saved', variant: 'success', iconName: 'check-circle' })
|
|
902
|
+
toast({ title: 'Oops', variant: 'destructive', iconName: 'x-circle' })
|
|
876
903
|
}}
|
|
877
904
|
/>
|
|
878
905
|
)
|
|
@@ -888,6 +915,8 @@ function MyComponent() {
|
|
|
888
915
|
| variant | `'default' \| 'destructive' \| 'success'` | `'default'` | `default`: dark background. `destructive`: red. `success`: green |
|
|
889
916
|
| duration | `number` (ms) | `3000` | Auto-dismiss after this delay |
|
|
890
917
|
| icon | `ReactNode` | — | Custom icon node. Defaults to a variant-appropriate symbol (`✓`, `✖`, `ℹ`) at 22px |
|
|
918
|
+
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon` |
|
|
919
|
+
| iconColor | `string` | — | Override icon color. Defaults to variant text color |
|
|
891
920
|
|
|
892
921
|
**`dismiss(id)`:** Dismiss a toast programmatically. The `id` is returned by the `toast()` call — store it if you need programmatic dismissal.
|
|
893
922
|
|
|
@@ -913,6 +942,10 @@ function MyComponent() {
|
|
|
913
942
|
| caption | `string` | — | Tertiary / caption line below the subtitle (12px / 400 weight, 70% opacity) |
|
|
914
943
|
| leftRender | `ReactNode` | — | Arbitrary content in a fixed 44×44pt left slot (avatar, icon, image, etc.) |
|
|
915
944
|
| rightRender | `string \| ReactNode` | — | Content on the right edge. Strings are styled as muted text (15px); pass ReactNode for Badges, prices, switches, etc. |
|
|
945
|
+
| leftIcon | `string` | — | Icon name from `@expo/vector-icons` in the left slot. Takes precedence over `leftRender`. Size 24, color `foreground` |
|
|
946
|
+
| rightIcon | `string` | — | Icon name from `@expo/vector-icons` in the right slot. Takes precedence over `rightRender`. Size 24, color `mutedForeground` |
|
|
947
|
+
| leftIconColor | `string` | — | Override left icon color |
|
|
948
|
+
| rightIconColor | `string` | — | Override right icon color |
|
|
916
949
|
| variant | `'plain' \| 'card'` | `'plain'` | `plain`: no background, sits inside a parent surface. `card`: standalone surface with background, border, and shadow |
|
|
917
950
|
| showChevron | `boolean` | `false` | Shows a `›` chevron on the far right. Ignored when `rightRender` is set |
|
|
918
951
|
| showSeparator | `boolean` | `false` | Renders a hairline separator at the bottom. Useful when stacking multiple plain items in a list |
|
|
@@ -952,10 +985,14 @@ function MyComponent() {
|
|
|
952
985
|
onPress={() => navigate('detail', { id: item.id })}
|
|
953
986
|
/>
|
|
954
987
|
|
|
988
|
+
// Icon name props (no manual imports needed)
|
|
989
|
+
<ListItem title="Profile" leftIcon="user" rightIcon="chevron-right" onPress={() => {}} />
|
|
990
|
+
<ListItem title="Notifications" leftIcon="bell" subtitle="3 unread" showChevron />
|
|
991
|
+
|
|
955
992
|
// Card variant (standalone surface)
|
|
956
993
|
<ListItem
|
|
957
994
|
variant="card"
|
|
958
|
-
|
|
995
|
+
leftIcon="credit-card"
|
|
959
996
|
title="Balance"
|
|
960
997
|
subtitle="Available funds"
|
|
961
998
|
rightRender="$12.500"
|
|
@@ -1117,3 +1154,113 @@ const [period, setPeriod] = useState({ month: new Date().getMonth() + 1, year: n
|
|
|
1117
1154
|
<MonthPicker value={period} onChange={setPeriod} />
|
|
1118
1155
|
// Displays: "April 2026"
|
|
1119
1156
|
```
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
## Icon System
|
|
1161
|
+
|
|
1162
|
+
The library ships a built-in icon resolver so you can pass a plain icon name string to any component — no manual imports, no size guessing, no color math.
|
|
1163
|
+
|
|
1164
|
+
### Supported families
|
|
1165
|
+
|
|
1166
|
+
Icons are resolved by checking each family's glyph map in priority order (first match wins):
|
|
1167
|
+
|
|
1168
|
+
| Priority | Family | Best for |
|
|
1169
|
+
|---|---|---|
|
|
1170
|
+
| 1 (highest) | `Feather` | Clean line icons, UI essentials |
|
|
1171
|
+
| 2 | `AntDesign` | Semantic UI icons |
|
|
1172
|
+
| 3 | `Entypo` | Social, media, navigation icons |
|
|
1173
|
+
| 4 | `FontAwesome5` | Wide coverage of named icons |
|
|
1174
|
+
| 5 | `MaterialIcons` | Material-style icons |
|
|
1175
|
+
| 6 (lowest) | `Ionicons` | Fallback |
|
|
1176
|
+
|
|
1177
|
+
Browse all available icons: **https://icons.expo.fyi**
|
|
1178
|
+
|
|
1179
|
+
### Standalone `Icon` component
|
|
1180
|
+
|
|
1181
|
+
```tsx
|
|
1182
|
+
import { Icon } from '@retray-dev/ui-kit'
|
|
1183
|
+
|
|
1184
|
+
<Icon name="home" size={24} color="#000" />
|
|
1185
|
+
<Icon name="star" size={20} color={colors.primary} />
|
|
1186
|
+
|
|
1187
|
+
// Force a specific family when the same name exists in multiple families:
|
|
1188
|
+
<Icon name="heart" size={24} color="red" family="FontAwesome5" />
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
**Props:**
|
|
1192
|
+
|
|
1193
|
+
| Prop | Type | Required | Description |
|
|
1194
|
+
|---|---|---|---|
|
|
1195
|
+
| `name` | `string` | Yes | Icon name (e.g. `"home"`, `"star"`, `"arrow-right"`) |
|
|
1196
|
+
| `size` | `number` | Yes | Icon size in points |
|
|
1197
|
+
| `color` | `string` | Yes | Icon color |
|
|
1198
|
+
| `family` | `IconFamily` | No | Override resolved family |
|
|
1199
|
+
|
|
1200
|
+
Returns `null` (no crash) if the icon name is not found in any family.
|
|
1201
|
+
|
|
1202
|
+
### `renderIcon` helper
|
|
1203
|
+
|
|
1204
|
+
```tsx
|
|
1205
|
+
import { renderIcon } from '@retray-dev/ui-kit'
|
|
1206
|
+
|
|
1207
|
+
const node = renderIcon('check', 18, colors.primary)
|
|
1208
|
+
```
|
|
1209
|
+
|
|
1210
|
+
### `iconName` props on components
|
|
1211
|
+
|
|
1212
|
+
Each component that accepts icon slots now has a corresponding `iconName` prop. Pass the icon name as a string and the library resolves size and color automatically.
|
|
1213
|
+
|
|
1214
|
+
| Component | Prop(s) | Slot | Default size | Default color |
|
|
1215
|
+
|---|---|---|---|---|
|
|
1216
|
+
| `Button` | `iconName`, `iconColor` | Left or right of label | sm=16 / md=18 / lg=20 | Variant label color |
|
|
1217
|
+
| `Input` | `prefixIcon`, `prefixIconColor` | Before input text | 20 | `mutedForeground` |
|
|
1218
|
+
| `Input` | `suffixIcon`, `suffixIconColor` | After input text | 20 | `mutedForeground` |
|
|
1219
|
+
| `ListItem` | `leftIcon`, `leftIconColor` | Left 44×44 slot | 24 | `foreground` |
|
|
1220
|
+
| `ListItem` | `rightIcon`, `rightIconColor` | Right slot | 24 | `mutedForeground` |
|
|
1221
|
+
| `Badge` | `iconName`, `iconColor` | Before label | sm=10 / md=12 / lg=14 | Variant foreground |
|
|
1222
|
+
| `Toggle` | `iconName`, `iconColor` | When not pressed | sm=16 / md=18 / lg=20 | `mutedForeground` |
|
|
1223
|
+
| `Toggle` | `activeIconName`, `activeIconColor` | When pressed | sm=16 / md=18 / lg=20 | `primary` |
|
|
1224
|
+
| `AlertBanner` | `iconName`, `iconColor` | Left of content | 18 | Variant title color |
|
|
1225
|
+
| `EmptyState` | `iconName`, `iconColor` | Center icon slot | default=48 / compact=32 | `mutedForeground` |
|
|
1226
|
+
| `Toast` | `iconName`, `iconColor` | Left of message | 22 | Variant text color |
|
|
1227
|
+
|
|
1228
|
+
**Precedence:** `iconName` takes precedence over the corresponding ReactNode prop (`icon`, `prefix`, `suffix`, etc.) when both are supplied.
|
|
1229
|
+
|
|
1230
|
+
**Backward compatibility:** All existing `icon`, `prefix`, `suffix`, `leftRender`, `rightRender` ReactNode props continue to work exactly as before.
|
|
1231
|
+
|
|
1232
|
+
**Example — Button with icon:**
|
|
1233
|
+
```tsx
|
|
1234
|
+
<Button label="Continue" iconName="arrow-right" iconPosition="right" />
|
|
1235
|
+
<Button label="Delete" variant="destructive" iconName="trash-2" />
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
**Example — Input with icons:**
|
|
1239
|
+
```tsx
|
|
1240
|
+
<Input placeholder="Search..." prefixIcon="search" />
|
|
1241
|
+
<Input placeholder="Amount" prefixIcon="dollar-sign" suffixIcon="check" />
|
|
1242
|
+
```
|
|
1243
|
+
|
|
1244
|
+
**Example — ListItem with icons:**
|
|
1245
|
+
```tsx
|
|
1246
|
+
<ListItem title="Profile" leftIcon="user" rightIcon="chevron-right" />
|
|
1247
|
+
<ListItem title="Notifications" leftIcon="bell" subtitle="3 unread" showChevron />
|
|
1248
|
+
```
|
|
1249
|
+
|
|
1250
|
+
**Example — Badge with icon:**
|
|
1251
|
+
```tsx
|
|
1252
|
+
<Badge label="Active" variant="default" iconName="check" size="sm" />
|
|
1253
|
+
<Badge label="Error" variant="destructive" iconName="alert-circle" />
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
**Example — Toast with icon:**
|
|
1257
|
+
```tsx
|
|
1258
|
+
const { toast } = useToast()
|
|
1259
|
+
toast({ title: "Saved", variant: "success", iconName: "check-circle" })
|
|
1260
|
+
toast({ title: "Oops", variant: "destructive", iconName: "x-circle" })
|
|
1261
|
+
```
|
|
1262
|
+
|
|
1263
|
+
**Example — EmptyState with icon:**
|
|
1264
|
+
```tsx
|
|
1265
|
+
<EmptyState iconName="inbox" title="No messages" description="You're all caught up." />
|
|
1266
|
+
```
|
package/dist/index.d.mts
CHANGED
|
@@ -75,10 +75,18 @@ interface ButtonProps extends TouchableOpacityProps {
|
|
|
75
75
|
size: ButtonSize;
|
|
76
76
|
variant: ButtonVariant;
|
|
77
77
|
}) => React.ReactNode);
|
|
78
|
+
/**
|
|
79
|
+
* Icon name from `@expo/vector-icons` (e.g. `"home"`, `"star"`, `"arrow-right"`).
|
|
80
|
+
* See https://icons.expo.fyi to browse available icons.
|
|
81
|
+
* Takes precedence over `icon` when both are supplied.
|
|
82
|
+
*/
|
|
83
|
+
iconName?: string;
|
|
84
|
+
/** Override the resolved icon color. Defaults to the label foreground color for the active variant. */
|
|
85
|
+
iconColor?: string;
|
|
78
86
|
/** Side the icon appears on. Defaults to `'left'`. */
|
|
79
87
|
iconPosition?: 'left' | 'right';
|
|
80
88
|
}
|
|
81
|
-
declare function Button({ label, variant, size, loading, fullWidth, icon, iconPosition, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
|
|
89
|
+
declare function Button({ label, variant, size, loading, fullWidth, icon, iconName, iconColor, iconPosition, disabled, style, onPress, ...props }: ButtonProps): React.JSX.Element;
|
|
82
90
|
|
|
83
91
|
type TextVariant = 'h1' | 'h2' | 'h3' | 'body' | 'caption' | 'label';
|
|
84
92
|
interface TextProps extends TextProps$1 {
|
|
@@ -101,12 +109,26 @@ interface InputProps extends TextInputProps {
|
|
|
101
109
|
prefixStyle?: TextStyle;
|
|
102
110
|
/** Style applied to suffix text if suffix is a string. */
|
|
103
111
|
suffixStyle?: TextStyle;
|
|
112
|
+
/**
|
|
113
|
+
* Icon name from `@expo/vector-icons` rendered before the input text.
|
|
114
|
+
* See https://icons.expo.fyi. Takes precedence over `prefix`.
|
|
115
|
+
*/
|
|
116
|
+
prefixIcon?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Icon name from `@expo/vector-icons` rendered after the input text.
|
|
119
|
+
* See https://icons.expo.fyi. Takes precedence over `suffix` (unless `type="password"`).
|
|
120
|
+
*/
|
|
121
|
+
suffixIcon?: string;
|
|
122
|
+
/** Override the resolved prefix icon color. Defaults to `mutedForeground`. */
|
|
123
|
+
prefixIconColor?: string;
|
|
124
|
+
/** Override the resolved suffix icon color. Defaults to `mutedForeground`. */
|
|
125
|
+
suffixIconColor?: string;
|
|
104
126
|
/** Input type. When set to \`'password'\`, shows a toggle button to reveal/hide text. */
|
|
105
127
|
type?: 'text' | 'password';
|
|
106
128
|
/** Style for the outer container \`View\`. Use \`style\` (from \`TextInputProps\`) to style the \`TextInput\` itself. */
|
|
107
129
|
containerStyle?: ViewStyle;
|
|
108
130
|
}
|
|
109
|
-
declare function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, type, containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }: InputProps): React.JSX.Element;
|
|
131
|
+
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;
|
|
110
132
|
|
|
111
133
|
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline';
|
|
112
134
|
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
@@ -118,9 +140,16 @@ interface BadgeProps {
|
|
|
118
140
|
size?: BadgeSize;
|
|
119
141
|
/** Icon rendered before the label/children. */
|
|
120
142
|
icon?: React.ReactNode;
|
|
143
|
+
/**
|
|
144
|
+
* Icon name from `@expo/vector-icons` rendered before the label.
|
|
145
|
+
* See https://icons.expo.fyi. Takes precedence over `icon`.
|
|
146
|
+
*/
|
|
147
|
+
iconName?: string;
|
|
148
|
+
/** Override the resolved icon color. Defaults to the variant foreground color. */
|
|
149
|
+
iconColor?: string;
|
|
121
150
|
style?: ViewStyle;
|
|
122
151
|
}
|
|
123
|
-
declare function Badge({ label, children, variant, size, icon, style }: BadgeProps): React.JSX.Element;
|
|
152
|
+
declare function Badge({ label, children, variant, size, icon, iconName, iconColor, style }: BadgeProps): React.JSX.Element;
|
|
124
153
|
|
|
125
154
|
type CardVariant = 'elevated' | 'outlined' | 'filled';
|
|
126
155
|
interface CardProps {
|
|
@@ -196,9 +225,16 @@ interface AlertBannerProps {
|
|
|
196
225
|
description?: string;
|
|
197
226
|
variant?: AlertBannerVariant;
|
|
198
227
|
icon?: React.ReactNode;
|
|
228
|
+
/**
|
|
229
|
+
* Icon name from `@expo/vector-icons`. See https://icons.expo.fyi.
|
|
230
|
+
* Takes precedence over `icon`. When neither is set, a default variant icon is shown.
|
|
231
|
+
*/
|
|
232
|
+
iconName?: string;
|
|
233
|
+
/** Override the resolved icon color. Defaults to the variant title color. */
|
|
234
|
+
iconColor?: string;
|
|
199
235
|
style?: ViewStyle;
|
|
200
236
|
}
|
|
201
|
-
declare function AlertBanner({ title, description, variant, icon, style }: AlertBannerProps): React.JSX.Element;
|
|
237
|
+
declare function AlertBanner({ title, description, variant, icon, iconName, iconColor, style }: AlertBannerProps): React.JSX.Element;
|
|
202
238
|
|
|
203
239
|
interface ProgressProps {
|
|
204
240
|
/** Current progress value. Clamped to `[0, max]`. Defaults to `0`. */
|
|
@@ -211,6 +247,13 @@ declare function Progress({ value, max, style }: ProgressProps): React.JSX.Eleme
|
|
|
211
247
|
|
|
212
248
|
interface EmptyStateProps {
|
|
213
249
|
icon?: React.ReactNode;
|
|
250
|
+
/**
|
|
251
|
+
* Icon name from `@expo/vector-icons`. See https://icons.expo.fyi.
|
|
252
|
+
* Takes precedence over `icon`. Sized automatically to fit the slot (48 default, 32 compact).
|
|
253
|
+
*/
|
|
254
|
+
iconName?: string;
|
|
255
|
+
/** Override the resolved icon color. Defaults to `mutedForeground`. */
|
|
256
|
+
iconColor?: string;
|
|
214
257
|
title: string;
|
|
215
258
|
description?: string;
|
|
216
259
|
action?: React.ReactNode;
|
|
@@ -218,7 +261,7 @@ interface EmptyStateProps {
|
|
|
218
261
|
size?: 'default' | 'compact';
|
|
219
262
|
style?: ViewStyle;
|
|
220
263
|
}
|
|
221
|
-
declare function EmptyState({ icon, title, description, action, size, style }: EmptyStateProps): React.JSX.Element;
|
|
264
|
+
declare function EmptyState({ icon, iconName, iconColor, title, description, action, size, style }: EmptyStateProps): React.JSX.Element;
|
|
222
265
|
|
|
223
266
|
interface TextareaProps extends TextInputProps {
|
|
224
267
|
label?: string;
|
|
@@ -262,8 +305,22 @@ interface ToggleProps extends TouchableOpacityProps {
|
|
|
262
305
|
icon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
|
|
263
306
|
/** Icon to show when pressed/active. If omitted, a default check mark is used. */
|
|
264
307
|
activeIcon?: React.ReactNode | ((pressed: boolean) => React.ReactNode);
|
|
308
|
+
/**
|
|
309
|
+
* Icon name from `@expo/vector-icons` shown when not pressed.
|
|
310
|
+
* See https://icons.expo.fyi. Takes precedence over `icon`.
|
|
311
|
+
*/
|
|
312
|
+
iconName?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Icon name from `@expo/vector-icons` shown when pressed/active.
|
|
315
|
+
* See https://icons.expo.fyi. Takes precedence over `activeIcon`.
|
|
316
|
+
*/
|
|
317
|
+
activeIconName?: string;
|
|
318
|
+
/** Override the resolved inactive icon color. Defaults to `mutedForeground`. */
|
|
319
|
+
iconColor?: string;
|
|
320
|
+
/** Override the resolved active icon color. Defaults to `primary`. */
|
|
321
|
+
activeIconColor?: string;
|
|
265
322
|
}
|
|
266
|
-
declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, activeIcon, disabled, style, ...props }: ToggleProps): React.JSX.Element;
|
|
323
|
+
declare function Toggle({ pressed, onPressedChange, variant, size, label, icon, activeIcon, iconName, activeIconName, iconColor, activeIconColor, disabled, style, ...props }: ToggleProps): React.JSX.Element;
|
|
267
324
|
|
|
268
325
|
interface RadioOption {
|
|
269
326
|
label: string;
|
|
@@ -378,6 +435,13 @@ interface ToastItem {
|
|
|
378
435
|
description?: string;
|
|
379
436
|
variant?: ToastVariant;
|
|
380
437
|
icon?: React.ReactNode;
|
|
438
|
+
/**
|
|
439
|
+
* Icon name from `@expo/vector-icons`. See https://icons.expo.fyi.
|
|
440
|
+
* Takes precedence over `icon`. When neither is set, a default variant icon is shown.
|
|
441
|
+
*/
|
|
442
|
+
iconName?: string;
|
|
443
|
+
/** Override the resolved icon color. Defaults to the variant text color. */
|
|
444
|
+
iconColor?: string;
|
|
381
445
|
/** Auto-dismiss delay in milliseconds. Defaults to `3000`. */
|
|
382
446
|
duration?: number;
|
|
383
447
|
}
|
|
@@ -446,6 +510,20 @@ interface ListItemProps {
|
|
|
446
510
|
trailing?: React.ReactNode | string;
|
|
447
511
|
/** @deprecated Use `leftRender` instead. */
|
|
448
512
|
icon?: React.ReactNode;
|
|
513
|
+
/**
|
|
514
|
+
* Icon name from `@expo/vector-icons` rendered in the left slot.
|
|
515
|
+
* See https://icons.expo.fyi. Takes precedence over `leftRender`.
|
|
516
|
+
*/
|
|
517
|
+
leftIcon?: string;
|
|
518
|
+
/**
|
|
519
|
+
* Icon name from `@expo/vector-icons` rendered in the right slot.
|
|
520
|
+
* See https://icons.expo.fyi. Takes precedence over `rightRender`.
|
|
521
|
+
*/
|
|
522
|
+
rightIcon?: string;
|
|
523
|
+
/** Override the resolved left icon color. Defaults to `foreground`. */
|
|
524
|
+
leftIconColor?: string;
|
|
525
|
+
/** Override the resolved right icon color. Defaults to `mutedForeground`. */
|
|
526
|
+
rightIconColor?: string;
|
|
449
527
|
title: string;
|
|
450
528
|
/** Secondary line below the title. */
|
|
451
529
|
subtitle?: string;
|
|
@@ -471,7 +549,7 @@ interface ListItemProps {
|
|
|
471
549
|
/** Style applied to the caption Text. */
|
|
472
550
|
captionStyle?: TextStyle;
|
|
473
551
|
}
|
|
474
|
-
declare function ListItem({ leftRender, rightRender, trailing, icon, title, subtitle, caption, variant, showChevron, showSeparator, onPress, disabled, style, titleStyle, subtitleStyle, captionStyle, }: ListItemProps): React.JSX.Element;
|
|
552
|
+
declare function ListItem({ leftRender, rightRender, trailing, icon, leftIcon, rightIcon, leftIconColor, rightIconColor, title, subtitle, caption, variant, showChevron, showSeparator, onPress, disabled, style, titleStyle, subtitleStyle, captionStyle, }: ListItemProps): React.JSX.Element;
|
|
475
553
|
|
|
476
554
|
interface ChipProps {
|
|
477
555
|
label: string;
|
|
@@ -525,4 +603,16 @@ interface MonthPickerProps {
|
|
|
525
603
|
}
|
|
526
604
|
declare function MonthPicker({ value, onChange, style }: MonthPickerProps): React.JSX.Element;
|
|
527
605
|
|
|
528
|
-
|
|
606
|
+
type IconFamily = 'Feather' | 'AntDesign' | 'Entypo' | 'FontAwesome5' | 'MaterialIcons' | 'Ionicons';
|
|
607
|
+
interface IconProps {
|
|
608
|
+
/** Icon name from any supported @expo/vector-icons family. See https://icons.expo.fyi */
|
|
609
|
+
name: string;
|
|
610
|
+
size: number;
|
|
611
|
+
color: string;
|
|
612
|
+
/** Override the resolved family when the same name exists in multiple families. */
|
|
613
|
+
family?: IconFamily;
|
|
614
|
+
}
|
|
615
|
+
declare function Icon({ name, size, color, family }: IconProps): React.ReactElement | null;
|
|
616
|
+
declare function renderIcon(name: string, size: number, color: string): React.ReactElement | null;
|
|
617
|
+
|
|
618
|
+
export { Accordion, type AccordionItem, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerVariant, Avatar, type AvatarProps, type AvatarSize, 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, type IconFamily, type IconProps, Input, type InputProps, LabelValue, type LabelValueProps, ListItem, type ListItemProps, MonthPicker, type MonthPickerProps, type MonthPickerValue, Progress, type ProgressProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, Slider, type SliderProps, 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 };
|