@retray-dev/ui-kit 9.0.0 → 9.1.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 +14 -4
- package/EXAMPLES.md +19 -12
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @retray-dev/ui-kit — Component Reference (
|
|
1
|
+
# @retray-dev/ui-kit — Component Reference (v9.1.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
|
|
|
@@ -663,6 +663,8 @@ import { SohneFonts } from '@retray-dev/ui-kit/fonts'
|
|
|
663
663
|
| iconColor | `string` | — | Override icon color. Defaults to variant label color |
|
|
664
664
|
| iconPosition | `'left' \| 'right'` | `'left'` | Side the icon appears on |
|
|
665
665
|
| style | `ViewStyle` | — | Override container style |
|
|
666
|
+
| accessibilityLabel | `string` | — | Screen reader label. Defaults to `label` |
|
|
667
|
+
| accessibilityHint | `string` | — | Screen reader hint |
|
|
666
668
|
|
|
667
669
|
**Variants:**
|
|
668
670
|
|
|
@@ -804,6 +806,8 @@ import { SohneFonts } from '@retray-dev/ui-kit/fonts'
|
|
|
804
806
|
| badge | `boolean \| number` | — | Notification badge overlay |
|
|
805
807
|
| disabled | `boolean` | — | Reduces opacity to 0.5 |
|
|
806
808
|
| style | `ViewStyle` | — | — |
|
|
809
|
+
| accessibilityLabel | `string` | — | Screen reader label |
|
|
810
|
+
| accessibilityHint | `string` | — | Screen reader hint |
|
|
807
811
|
|
|
808
812
|
**Variants:** Same token logic as Button.
|
|
809
813
|
|
|
@@ -819,7 +823,7 @@ import { SohneFonts } from '@retray-dev/ui-kit/fonts'
|
|
|
819
823
|
|
|
820
824
|
| Size | Dimensions | Icon size |
|
|
821
825
|
|------|-----------|-----------|
|
|
822
|
-
| `sm` |
|
|
826
|
+
| `sm` | 44 × 44px | 18px |
|
|
823
827
|
| `md` | 44 × 44px | 20px |
|
|
824
828
|
| `lg` | 52 × 52px | 24px |
|
|
825
829
|
|
|
@@ -880,6 +884,7 @@ import { SohneFonts } from '@retray-dev/ui-kit/fonts'
|
|
|
880
884
|
| label | `string` | — | Label above the input field |
|
|
881
885
|
| error | `string` | — | Error text below — turns border `destructive` (2px) |
|
|
882
886
|
| hint | `string` | — | Helper text below (hidden when `error` is set) |
|
|
887
|
+
| disabled | `boolean` | — | Reduces opacity to 0.5, disables interaction |
|
|
883
888
|
| prefix | `string \| ReactNode` | — | Content before the input text (e.g. `"$"`, icon node) |
|
|
884
889
|
| suffix | `string \| ReactNode` | — | Content after the input text (e.g. `"kg"`, icon node) |
|
|
885
890
|
| prefixStyle | `TextStyle` | — | Style for prefix string (no effect on ReactNode) |
|
|
@@ -1710,6 +1715,8 @@ const renderItem = useCallback(({ item }) => (
|
|
|
1710
1715
|
| iconName | `string` | — | Icon name from `@expo/vector-icons`. Takes precedence over `icon` |
|
|
1711
1716
|
| iconColor | `string` | — | Override icon color. Defaults to `foregroundMuted` |
|
|
1712
1717
|
| action | `ReactNode` | — | CTA below text — typically a `Button`. Hidden in `compact` size |
|
|
1718
|
+
| actionLabel | `string` | — | Shorthand for a primary `Button` CTA — renders a default `Button` with this label. Requires `onAction`. Hidden in `compact` size |
|
|
1719
|
+
| onAction | `() => void` | — | Handler for the shorthand `actionLabel` button. Required when `actionLabel` is set |
|
|
1713
1720
|
| size | `'default' \| 'compact'` | `'default'` | `compact` is smaller, hides description and action |
|
|
1714
1721
|
| style | `ViewStyle` | — | — |
|
|
1715
1722
|
|
|
@@ -2211,7 +2218,8 @@ Add `react-native-worklets/plugin` (not `react-native-reanimated/plugin`) to `ba
|
|
|
2211
2218
|
| open | `boolean` | required | `true` presents the sheet, `false` dismisses it |
|
|
2212
2219
|
| onClose | `() => void` | required | Called on swipe-dismiss or backdrop press |
|
|
2213
2220
|
| title | `string` | — | Sheet heading |
|
|
2214
|
-
| subtitle | `string` | — | Supporting text below title
|
|
2221
|
+
| subtitle | `string` | — | Supporting text below title |
|
|
2222
|
+
| description | `string` | — | **Deprecated alias** for `subtitle` — prefer `subtitle` |
|
|
2215
2223
|
| showCloseButton | `boolean` | `false` | Show X close button in the header |
|
|
2216
2224
|
| children | `ReactNode` | — | Sheet content |
|
|
2217
2225
|
| style | `ViewStyle` | — | Inner scroll/content container style |
|
|
@@ -3028,6 +3036,7 @@ const [categories, setCategories] = useState<number[]>([1, 3])
|
|
|
3028
3036
|
| multiSelect | `boolean` | `false` | Allow multiple simultaneous selections |
|
|
3029
3037
|
| style | `ViewStyle` | — | ScrollView content container style |
|
|
3030
3038
|
| itemStyle | `ViewStyle` | — | Style applied to each chip's wrapper |
|
|
3039
|
+
| accessibilityLabel | `string` | — | Screen reader label for the scroll container |
|
|
3031
3040
|
|
|
3032
3041
|
**CategoryItem type:**
|
|
3033
3042
|
```ts
|
|
@@ -3909,11 +3918,12 @@ Used internally — not exported. `s()` horizontal scale, `vs()` vertical scale,
|
|
|
3909
3918
|
|
|
3910
3919
|
## Full Composition Examples
|
|
3911
3920
|
|
|
3912
|
-
The package includes **EXAMPLES.md** with complete, working code for
|
|
3921
|
+
The package includes **EXAMPLES.md** with complete, working code for 4 real-world app screens:
|
|
3913
3922
|
|
|
3914
3923
|
1. **Finance Dashboard** — MonthPicker, CurrencyDisplay, Progress, CategoryStrip, ListItem, DetailRow
|
|
3915
3924
|
2. **Edit Profile** — Avatar, Badge, Input, Select, Switch, Card, AlertBanner
|
|
3916
3925
|
3. **Onboarding Flow** — Badge, Progress, Input, RadioGroup, EmptyState (multi-step wizard)
|
|
3926
|
+
4. **Settings Screen** — MenuGroup, ListGroup, Form, MenuItem, ListItem, compound component patterns
|
|
3917
3927
|
|
|
3918
3928
|
**For AI agents:** Import EXAMPLES.md from the package for full source code and patterns:
|
|
3919
3929
|
|
package/EXAMPLES.md
CHANGED
|
@@ -605,7 +605,7 @@ function SettingsScreen() {
|
|
|
605
605
|
title={name}
|
|
606
606
|
subtitle={email}
|
|
607
607
|
rightRender={<Badge label="Pro" variant="success" size="sm" />}
|
|
608
|
-
onPress={() => toast
|
|
608
|
+
onPress={() => toast({ title: 'Profile tapped' })}
|
|
609
609
|
/>
|
|
610
610
|
<ListItem
|
|
611
611
|
leftIcon="calendar"
|
|
@@ -634,18 +634,18 @@ function SettingsScreen() {
|
|
|
634
634
|
label="Personal Information"
|
|
635
635
|
subtitle="Name, email, phone"
|
|
636
636
|
iconName="user"
|
|
637
|
-
onPress={() => toast('Personal Info')}
|
|
637
|
+
onPress={() => toast({ title: 'Personal Info' })}
|
|
638
638
|
/>
|
|
639
639
|
<MenuItem
|
|
640
640
|
label="Security & Privacy"
|
|
641
641
|
iconName="shield"
|
|
642
|
-
onPress={() => toast('Security')}
|
|
642
|
+
onPress={() => toast({ title: 'Security' })}
|
|
643
643
|
/>
|
|
644
644
|
<MenuItem
|
|
645
645
|
label="Payments & Payouts"
|
|
646
646
|
iconName="credit-card"
|
|
647
647
|
rightRender={<Badge label="2" variant="warning" size="sm" />}
|
|
648
|
-
onPress={() => toast('Payments')}
|
|
648
|
+
onPress={() => toast({ title: 'Payments' })}
|
|
649
649
|
/>
|
|
650
650
|
</MenuGroup>
|
|
651
651
|
|
|
@@ -673,7 +673,7 @@ function SettingsScreen() {
|
|
|
673
673
|
label="Language"
|
|
674
674
|
iconName="globe"
|
|
675
675
|
rightRender={<Text color={colors.foregroundMuted}>English</Text>}
|
|
676
|
-
onPress={() => toast('Language')}
|
|
676
|
+
onPress={() => toast({ title: 'Language' })}
|
|
677
677
|
/>
|
|
678
678
|
</MenuGroup>
|
|
679
679
|
|
|
@@ -731,11 +731,11 @@ function SettingsScreen() {
|
|
|
731
731
|
<Button
|
|
732
732
|
label="Cancel"
|
|
733
733
|
variant="secondary"
|
|
734
|
-
onPress={() => toast('Cancelled')}
|
|
734
|
+
onPress={() => toast({ title: 'Cancelled' })}
|
|
735
735
|
/>
|
|
736
736
|
<Button
|
|
737
737
|
label="Save Changes"
|
|
738
|
-
onPress={() => toast
|
|
738
|
+
onPress={() => toast({ title: 'Profile updated', variant: 'success' })}
|
|
739
739
|
/>
|
|
740
740
|
</Form.Footer>
|
|
741
741
|
</Form>
|
|
@@ -751,17 +751,17 @@ function SettingsScreen() {
|
|
|
751
751
|
<MenuItem
|
|
752
752
|
label="Help Center"
|
|
753
753
|
iconName="help-circle"
|
|
754
|
-
onPress={() => toast('Help')}
|
|
754
|
+
onPress={() => toast({ title: 'Help' })}
|
|
755
755
|
/>
|
|
756
756
|
<MenuItem
|
|
757
757
|
label="Report an Issue"
|
|
758
758
|
iconName="alert-triangle"
|
|
759
|
-
onPress={() => toast('Report')}
|
|
759
|
+
onPress={() => toast({ title: 'Report' })}
|
|
760
760
|
/>
|
|
761
761
|
<MenuItem
|
|
762
762
|
label="Terms of Service"
|
|
763
763
|
iconName="file-text"
|
|
764
|
-
onPress={() => toast('Terms')}
|
|
764
|
+
onPress={() => toast({ title: 'Terms' })}
|
|
765
765
|
/>
|
|
766
766
|
</MenuGroup>
|
|
767
767
|
|
|
@@ -845,13 +845,20 @@ Standard 12px gap between fields:
|
|
|
845
845
|
|
|
846
846
|
### Toast Feedback
|
|
847
847
|
|
|
848
|
-
|
|
848
|
+
Two equivalent APIs — use whichever fits your context:
|
|
849
849
|
|
|
850
850
|
```tsx
|
|
851
|
+
// Option A: hook (good when you need toast inside a component)
|
|
851
852
|
const { toast } = useToast()
|
|
852
|
-
|
|
853
853
|
toast({ title: 'Action completed', variant: 'success' })
|
|
854
854
|
toast({ title: 'Error occurred', variant: 'destructive' })
|
|
855
|
+
|
|
856
|
+
// Option B: direct import (good for callbacks, utilities, outside components)
|
|
857
|
+
import { toast } from '@retray-dev/ui-kit'
|
|
858
|
+
toast.success('Action completed')
|
|
859
|
+
toast.error('Error occurred')
|
|
860
|
+
toast.warning('Slow connection')
|
|
861
|
+
toast('Neutral message')
|
|
855
862
|
```
|
|
856
863
|
|
|
857
864
|
### Button Pairs & Groups
|