@retray-dev/ui-kit 6.1.0 → 7.0.1
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 +447 -13
- package/EXAMPLES.md +248 -0
- package/README.md +11 -10
- package/dist/Accordion.d.mts +28 -0
- package/dist/Accordion.d.ts +28 -0
- package/dist/Accordion.js +340 -0
- package/dist/Accordion.mjs +6 -0
- package/dist/AlertBanner.d.mts +16 -0
- package/dist/AlertBanner.d.ts +16 -0
- package/dist/AlertBanner.js +247 -0
- package/dist/AlertBanner.mjs +5 -0
- package/dist/Avatar.d.mts +20 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +234 -0
- package/dist/Avatar.mjs +3 -0
- package/dist/Badge.d.mts +26 -0
- package/dist/Badge.d.ts +26 -0
- package/dist/Badge.js +247 -0
- package/dist/Badge.mjs +4 -0
- package/dist/Button.d.mts +25 -0
- package/dist/Button.d.ts +25 -0
- package/dist/Button.js +414 -0
- package/dist/Button.mjs +8 -0
- package/dist/ButtonGroup.d.mts +26 -0
- package/dist/ButtonGroup.d.ts +26 -0
- package/dist/ButtonGroup.js +52 -0
- package/dist/ButtonGroup.mjs +2 -0
- package/dist/Card.d.mts +39 -0
- package/dist/Card.d.ts +39 -0
- package/dist/Card.js +329 -0
- package/dist/Card.mjs +7 -0
- package/dist/CategoryStrip.d.mts +26 -0
- package/dist/CategoryStrip.d.ts +26 -0
- package/dist/CategoryStrip.js +396 -0
- package/dist/CategoryStrip.mjs +9 -0
- package/dist/Checkbox.d.mts +14 -0
- package/dist/Checkbox.d.ts +14 -0
- package/dist/Checkbox.js +304 -0
- package/dist/Checkbox.mjs +7 -0
- package/dist/Chip.d.mts +31 -0
- package/dist/Chip.d.ts +31 -0
- package/dist/Chip.js +370 -0
- package/dist/Chip.mjs +8 -0
- package/dist/ConfirmDialog.d.mts +15 -0
- package/dist/ConfirmDialog.d.ts +15 -0
- package/dist/ConfirmDialog.js +530 -0
- package/dist/ConfirmDialog.mjs +9 -0
- package/dist/CurrencyDisplay.d.mts +24 -0
- package/dist/CurrencyDisplay.d.ts +24 -0
- package/dist/CurrencyDisplay.js +189 -0
- package/dist/CurrencyDisplay.mjs +3 -0
- package/dist/CurrencyInput.d.mts +26 -0
- package/dist/CurrencyInput.d.ts +26 -0
- package/dist/CurrencyInput.js +404 -0
- package/dist/CurrencyInput.mjs +7 -0
- package/dist/DetailRow.d.mts +32 -0
- package/dist/DetailRow.d.ts +32 -0
- package/dist/DetailRow.js +275 -0
- package/dist/DetailRow.mjs +4 -0
- package/dist/EmptyState.d.mts +27 -0
- package/dist/EmptyState.d.ts +27 -0
- package/dist/EmptyState.js +503 -0
- package/dist/EmptyState.mjs +9 -0
- package/dist/Form.d.mts +52 -0
- package/dist/Form.d.ts +52 -0
- package/dist/Form.js +204 -0
- package/dist/Form.mjs +3 -0
- package/dist/IconButton.d.mts +22 -0
- package/dist/IconButton.d.ts +22 -0
- package/dist/IconButton.js +383 -0
- package/dist/IconButton.mjs +7 -0
- package/dist/Input.d.mts +23 -0
- package/dist/Input.d.ts +23 -0
- package/dist/Input.js +351 -0
- package/dist/Input.mjs +6 -0
- package/dist/LabelValue.d.mts +16 -0
- package/dist/LabelValue.d.ts +16 -0
- package/dist/LabelValue.js +225 -0
- package/dist/LabelValue.mjs +4 -0
- package/dist/ListGroup.d.mts +34 -0
- package/dist/ListGroup.d.ts +34 -0
- package/dist/ListGroup.js +217 -0
- package/dist/ListGroup.mjs +4 -0
- package/dist/ListItem.d.mts +64 -0
- package/dist/ListItem.d.ts +64 -0
- package/dist/ListItem.js +430 -0
- package/dist/ListItem.mjs +8 -0
- package/dist/MediaCard.d.mts +39 -0
- package/dist/MediaCard.d.ts +39 -0
- package/dist/MediaCard.js +427 -0
- package/dist/MediaCard.mjs +8 -0
- package/dist/MenuGroup.d.mts +34 -0
- package/dist/MenuGroup.d.ts +34 -0
- package/dist/MenuGroup.js +217 -0
- package/dist/MenuGroup.mjs +4 -0
- package/dist/MenuItem.d.mts +48 -0
- package/dist/MenuItem.d.ts +48 -0
- package/dist/MenuItem.js +403 -0
- package/dist/MenuItem.mjs +8 -0
- package/dist/MonthPicker.d.mts +20 -0
- package/dist/MonthPicker.d.ts +20 -0
- package/dist/MonthPicker.js +234 -0
- package/dist/MonthPicker.mjs +4 -0
- package/dist/Pressable.d.mts +34 -0
- package/dist/Pressable.d.ts +34 -0
- package/dist/Pressable.js +132 -0
- package/dist/Pressable.mjs +4 -0
- package/dist/Progress.d.mts +14 -0
- package/dist/Progress.d.ts +14 -0
- package/dist/Progress.js +191 -0
- package/dist/Progress.mjs +4 -0
- package/dist/RadioGroup.d.mts +19 -0
- package/dist/RadioGroup.d.ts +19 -0
- package/dist/RadioGroup.js +341 -0
- package/dist/RadioGroup.mjs +7 -0
- package/dist/Select.d.mts +22 -0
- package/dist/Select.d.ts +22 -0
- package/dist/Select.js +441 -0
- package/dist/Select.mjs +6 -0
- package/dist/Separator.d.mts +10 -0
- package/dist/Separator.d.ts +10 -0
- package/dist/Separator.js +156 -0
- package/dist/Separator.mjs +2 -0
- package/dist/Sheet.d.mts +81 -0
- package/dist/Sheet.d.ts +81 -0
- package/dist/Sheet.js +340 -0
- package/dist/Sheet.mjs +4 -0
- package/dist/Skeleton.d.mts +17 -0
- package/dist/Skeleton.d.ts +17 -0
- package/dist/Skeleton.js +205 -0
- package/dist/Skeleton.mjs +4 -0
- package/dist/Slider.d.mts +20 -0
- package/dist/Slider.d.ts +20 -0
- package/dist/Slider.js +232 -0
- package/dist/Slider.mjs +4 -0
- package/dist/Spinner.d.mts +12 -0
- package/dist/Spinner.d.ts +12 -0
- package/dist/Spinner.js +172 -0
- package/dist/Spinner.mjs +3 -0
- package/dist/Switch.d.mts +13 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +261 -0
- package/dist/Switch.mjs +5 -0
- package/dist/Tabs.d.mts +27 -0
- package/dist/Tabs.d.ts +27 -0
- package/dist/Tabs.js +389 -0
- package/dist/Tabs.mjs +6 -0
- package/dist/Text.d.mts +12 -0
- package/dist/Text.d.ts +12 -0
- package/dist/Text.js +311 -0
- package/dist/Text.mjs +4 -0
- package/dist/Textarea.d.mts +16 -0
- package/dist/Textarea.d.ts +16 -0
- package/dist/Textarea.js +333 -0
- package/dist/Textarea.mjs +6 -0
- package/dist/Toast.d.mts +47 -0
- package/dist/Toast.d.ts +47 -0
- package/dist/Toast.js +185 -0
- package/dist/Toast.mjs +3 -0
- package/dist/Toggle.d.mts +33 -0
- package/dist/Toggle.d.ts +33 -0
- package/dist/Toggle.js +397 -0
- package/dist/Toggle.mjs +8 -0
- package/dist/VirtualList.d.mts +19 -0
- package/dist/VirtualList.d.ts +19 -0
- package/dist/VirtualList.js +38 -0
- package/dist/VirtualList.mjs +1 -0
- package/dist/chunk-2CE3TQVY.mjs +11 -0
- package/dist/chunk-2UYENBLV.mjs +49 -0
- package/dist/chunk-3BBOZ3OQ.mjs +41 -0
- package/dist/chunk-5IKW3VNC.mjs +43 -0
- package/dist/chunk-63357L2X.mjs +51 -0
- package/dist/chunk-6LQYY7HC.mjs +127 -0
- package/dist/chunk-6Q64UFIA.mjs +71 -0
- package/dist/chunk-76PFOSM2.mjs +41 -0
- package/dist/chunk-7H2OR44A.mjs +14 -0
- package/dist/chunk-A4MDAP7G.mjs +42 -0
- package/dist/chunk-AU2VDY4P.mjs +190 -0
- package/dist/chunk-BRKYVJVV.mjs +60 -0
- package/dist/chunk-CRYBX2CM.mjs +146 -0
- package/dist/chunk-DITNP6PL.mjs +106 -0
- package/dist/chunk-FTLJOUOQ.mjs +97 -0
- package/dist/chunk-GCWOGZYL.mjs +104 -0
- package/dist/chunk-GNGLDL6Z.mjs +60 -0
- package/dist/chunk-GPOUINK5.mjs +148 -0
- package/dist/chunk-HSPSMN6U.mjs +115 -0
- package/dist/chunk-IRRY3CRZ.mjs +82 -0
- package/dist/chunk-JB67UOB5.mjs +92 -0
- package/dist/chunk-JBLL7U3U.mjs +64 -0
- package/dist/chunk-KWCPOM6W.mjs +136 -0
- package/dist/chunk-KZJRQOIU.mjs +64 -0
- package/dist/chunk-L7E7TVEZ.mjs +145 -0
- package/dist/chunk-LG4DO3DK.mjs +174 -0
- package/dist/chunk-LWG526VX.mjs +139 -0
- package/dist/chunk-MN7OG7IY.mjs +96 -0
- package/dist/chunk-MX6HRKMI.mjs +29 -0
- package/dist/chunk-NC5ZTR2Y.mjs +32 -0
- package/dist/chunk-NQGVLMWG.mjs +90 -0
- package/dist/chunk-QCNARS3X.mjs +46 -0
- package/dist/chunk-QXGYKWI7.mjs +134 -0
- package/dist/chunk-QY3X2UYR.mjs +191 -0
- package/dist/chunk-RKLHUDZS.mjs +92 -0
- package/dist/chunk-RMMK64W5.mjs +54 -0
- package/dist/chunk-RR2VQLKE.mjs +190 -0
- package/dist/chunk-RTC3CFXF.mjs +29 -0
- package/dist/chunk-SBZYEV4S.mjs +61 -0
- package/dist/chunk-SOA2Z4RB.mjs +82 -0
- package/dist/chunk-SOYNZDVY.mjs +151 -0
- package/dist/chunk-T7XZ7H7Y.mjs +57 -0
- package/dist/chunk-TAJ2PQ2O.mjs +163 -0
- package/dist/chunk-U4N7WF4Z.mjs +108 -0
- package/dist/chunk-URDE3EUU.mjs +132 -0
- package/dist/chunk-URLL5JBR.mjs +245 -0
- package/dist/chunk-XDMN67KV.mjs +59 -0
- package/dist/chunk-Y6MXOREN.mjs +120 -0
- package/dist/chunk-YZJAFS4P.mjs +131 -0
- package/dist/index.d.mts +94 -852
- package/dist/index.d.ts +94 -852
- package/dist/index.js +1387 -942
- package/dist/index.mjs +50 -3844
- package/package.json +23 -14
- package/src/assets/fonts/Sohne-Bold.otf +0 -0
- package/src/assets/fonts/Sohne-BoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBold.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLight.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Italic.otf +0 -0
- package/src/assets/fonts/Sohne-Light.otf +0 -0
- package/src/assets/fonts/Sohne-LightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Medium.otf +0 -0
- package/src/assets/fonts/Sohne-MediumItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Regular.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBold.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Bold.otf +0 -0
- package/src/assets/fonts/SohneMono-BoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBold.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLight.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Italic.otf +0 -0
- package/src/assets/fonts/SohneMono-Light.otf +0 -0
- package/src/assets/fonts/SohneMono-LightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Medium.otf +0 -0
- package/src/assets/fonts/SohneMono-MediumItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Regular.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBold.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBoldItalic.otf +0 -0
- package/src/components/Accordion/Accordion.tsx +13 -15
- package/src/components/AlertBanner/AlertBanner.tsx +33 -12
- package/src/components/Avatar/Avatar.tsx +4 -2
- package/src/components/Badge/Badge.tsx +4 -2
- package/src/components/Button/Button.tsx +30 -29
- package/src/components/ButtonGroup/ButtonGroup.tsx +13 -10
- package/src/components/Card/Card.tsx +36 -65
- package/src/components/CategoryStrip/CategoryStrip.tsx +68 -58
- package/src/components/Checkbox/Checkbox.tsx +41 -55
- package/src/components/Chip/Chip.tsx +49 -84
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +2 -2
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +4 -2
- package/src/components/CurrencyInput/CurrencyInput.tsx +2 -2
- package/src/components/DetailRow/DetailRow.tsx +9 -7
- package/src/components/EmptyState/EmptyState.tsx +2 -2
- package/src/components/Form/Form.tsx +149 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +24 -20
- package/src/components/Input/Input.tsx +63 -50
- package/src/components/LabelValue/LabelValue.tsx +6 -4
- package/src/components/ListGroup/ListGroup.tsx +145 -0
- package/src/components/ListGroup/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +30 -43
- package/src/components/MediaCard/MediaCard.tsx +31 -29
- package/src/components/MenuGroup/MenuGroup.tsx +145 -0
- package/src/components/MenuGroup/index.ts +1 -0
- package/src/components/MenuItem/MenuItem.tsx +29 -40
- package/src/components/MonthPicker/MonthPicker.tsx +14 -4
- package/src/components/Pressable/Pressable.tsx +27 -46
- package/src/components/Progress/Progress.tsx +21 -12
- package/src/components/RadioGroup/RadioGroup.tsx +55 -32
- package/src/components/Select/Select.tsx +23 -21
- package/src/components/Separator/Separator.tsx +1 -3
- package/src/components/Sheet/Sheet.tsx +85 -18
- package/src/components/Skeleton/Skeleton.tsx +25 -14
- package/src/components/Slider/Slider.tsx +13 -3
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Switch/Switch.tsx +70 -52
- package/src/components/Tabs/Tabs.tsx +59 -47
- package/src/components/Text/Text.tsx +3 -1
- package/src/components/Textarea/Textarea.tsx +44 -23
- package/src/components/Toast/Toast.tsx +6 -6
- package/src/components/Toggle/Toggle.tsx +86 -68
- package/src/components/VirtualList/VirtualList.tsx +60 -0
- package/src/components/VirtualList/index.ts +1 -0
- package/src/fonts.ts +38 -20
- package/src/index.ts +5 -1
- package/src/theme/colors.ts +53 -39
- package/src/theme/types.ts +3 -0
- package/src/tokens.ts +49 -39
- package/src/utils/animations.ts +58 -0
- package/src/utils/icons.ts +47 -20
- package/src/utils/useColorTransition.ts +40 -0
- package/src/utils/usePressScale.ts +75 -0
- 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/EXAMPLES.md
CHANGED
|
@@ -541,6 +541,254 @@ const styles = StyleSheet.create({
|
|
|
541
541
|
|
|
542
542
|
---
|
|
543
543
|
|
|
544
|
+
## Example 4: Settings Screen with Compound Components
|
|
545
|
+
|
|
546
|
+
**Use case:** App settings screen demonstrating MenuGroup, ListGroup, and Form compound components for standardized layouts.
|
|
547
|
+
|
|
548
|
+
**Components used:** MenuGroup, ListGroup, Form, MenuItem, ListItem, Input, Textarea, Select, Switch, Avatar, Badge, Button
|
|
549
|
+
|
|
550
|
+
**Features:**
|
|
551
|
+
- MenuGroup with auto-separators for settings navigation
|
|
552
|
+
- ListGroup for account info display
|
|
553
|
+
- Form with sections for structured input
|
|
554
|
+
- Compound component headers and footers
|
|
555
|
+
- Mixed card and plain variants
|
|
556
|
+
|
|
557
|
+
### State Setup
|
|
558
|
+
|
|
559
|
+
```tsx
|
|
560
|
+
const [name, setName] = useState('Julian Cruz')
|
|
561
|
+
const [email, setEmail] = useState('julian@email.com')
|
|
562
|
+
const [bio, setBio] = useState('')
|
|
563
|
+
const [notifications, setNotifications] = useState(true)
|
|
564
|
+
const [darkMode, setDarkMode] = useState(false)
|
|
565
|
+
const [language, setLanguage] = useState('es')
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### Implementation
|
|
569
|
+
|
|
570
|
+
```tsx
|
|
571
|
+
import { View, ScrollView, StyleSheet } from 'react-native'
|
|
572
|
+
import {
|
|
573
|
+
MenuGroup,
|
|
574
|
+
MenuItem,
|
|
575
|
+
ListGroup,
|
|
576
|
+
ListItem,
|
|
577
|
+
Form,
|
|
578
|
+
Input,
|
|
579
|
+
Textarea,
|
|
580
|
+
Select,
|
|
581
|
+
Switch,
|
|
582
|
+
Avatar,
|
|
583
|
+
Badge,
|
|
584
|
+
Button,
|
|
585
|
+
Card,
|
|
586
|
+
Text,
|
|
587
|
+
useTheme,
|
|
588
|
+
useToast,
|
|
589
|
+
} from '@retray-dev/ui-kit'
|
|
590
|
+
|
|
591
|
+
function SettingsScreen() {
|
|
592
|
+
const { colors } = useTheme()
|
|
593
|
+
const { toast } = useToast()
|
|
594
|
+
|
|
595
|
+
return (
|
|
596
|
+
<ScrollView contentContainerStyle={styles.content}>
|
|
597
|
+
{/* Profile Section with ListGroup */}
|
|
598
|
+
<Text variant="caption" style={{ marginBottom: 8, paddingHorizontal: 4 }}>
|
|
599
|
+
Profile
|
|
600
|
+
</Text>
|
|
601
|
+
<ListGroup variant="card">
|
|
602
|
+
<ListGroup.Header>Account Overview</ListGroup.Header>
|
|
603
|
+
<ListItem
|
|
604
|
+
leftRender={<Avatar fallbackText={name} size={40} status="online" />}
|
|
605
|
+
title={name}
|
|
606
|
+
subtitle={email}
|
|
607
|
+
rightRender={<Badge label="Pro" variant="success" size="sm" />}
|
|
608
|
+
onPress={() => toast.success('Profile tapped')}
|
|
609
|
+
/>
|
|
610
|
+
<ListItem
|
|
611
|
+
leftIcon="calendar"
|
|
612
|
+
title="Member since"
|
|
613
|
+
subtitle="Jan 2022"
|
|
614
|
+
rightRender="2 years"
|
|
615
|
+
/>
|
|
616
|
+
<ListItem
|
|
617
|
+
leftIcon="star"
|
|
618
|
+
title="Reviews"
|
|
619
|
+
subtitle="Total written"
|
|
620
|
+
rightRender="24"
|
|
621
|
+
/>
|
|
622
|
+
<ListGroup.Footer>Last updated today</ListGroup.Footer>
|
|
623
|
+
</ListGroup>
|
|
624
|
+
|
|
625
|
+
<View style={{ height: 24 }} />
|
|
626
|
+
|
|
627
|
+
{/* Settings Menu with MenuGroup */}
|
|
628
|
+
<Text variant="caption" style={{ marginBottom: 8, paddingHorizontal: 4 }}>
|
|
629
|
+
Account Settings
|
|
630
|
+
</Text>
|
|
631
|
+
<MenuGroup variant="card">
|
|
632
|
+
<MenuGroup.Header>Personal</MenuGroup.Header>
|
|
633
|
+
<MenuItem
|
|
634
|
+
label="Personal Information"
|
|
635
|
+
subtitle="Name, email, phone"
|
|
636
|
+
iconName="user"
|
|
637
|
+
onPress={() => toast('Personal Info')}
|
|
638
|
+
/>
|
|
639
|
+
<MenuItem
|
|
640
|
+
label="Security & Privacy"
|
|
641
|
+
iconName="shield"
|
|
642
|
+
onPress={() => toast('Security')}
|
|
643
|
+
/>
|
|
644
|
+
<MenuItem
|
|
645
|
+
label="Payments & Payouts"
|
|
646
|
+
iconName="credit-card"
|
|
647
|
+
rightRender={<Badge label="2" variant="warning" size="sm" />}
|
|
648
|
+
onPress={() => toast('Payments')}
|
|
649
|
+
/>
|
|
650
|
+
</MenuGroup>
|
|
651
|
+
|
|
652
|
+
<View style={{ height: 16 }} />
|
|
653
|
+
|
|
654
|
+
{/* Preferences with switches */}
|
|
655
|
+
<MenuGroup variant="card">
|
|
656
|
+
<MenuGroup.Header>Preferences</MenuGroup.Header>
|
|
657
|
+
<MenuItem
|
|
658
|
+
label="Notifications"
|
|
659
|
+
subtitle="Push, email, and SMS"
|
|
660
|
+
iconName="bell"
|
|
661
|
+
rightRender={
|
|
662
|
+
<Switch checked={notifications} onCheckedChange={setNotifications} />
|
|
663
|
+
}
|
|
664
|
+
onPress={() => {}}
|
|
665
|
+
/>
|
|
666
|
+
<MenuItem
|
|
667
|
+
label="Dark Mode"
|
|
668
|
+
iconName="moon"
|
|
669
|
+
rightRender={<Switch checked={darkMode} onCheckedChange={setDarkMode} />}
|
|
670
|
+
onPress={() => {}}
|
|
671
|
+
/>
|
|
672
|
+
<MenuItem
|
|
673
|
+
label="Language"
|
|
674
|
+
iconName="globe"
|
|
675
|
+
rightRender={<Text color={colors.foregroundMuted}>English</Text>}
|
|
676
|
+
onPress={() => toast('Language')}
|
|
677
|
+
/>
|
|
678
|
+
</MenuGroup>
|
|
679
|
+
|
|
680
|
+
<View style={{ height: 24 }} />
|
|
681
|
+
|
|
682
|
+
{/* Edit Profile Form */}
|
|
683
|
+
<Card>
|
|
684
|
+
<Form>
|
|
685
|
+
<Form.Section
|
|
686
|
+
title="Edit Profile"
|
|
687
|
+
description="Update your personal information"
|
|
688
|
+
>
|
|
689
|
+
<Form.Field label="Full Name" required>
|
|
690
|
+
<Input
|
|
691
|
+
value={name}
|
|
692
|
+
onChangeText={setName}
|
|
693
|
+
placeholder="Your name"
|
|
694
|
+
prefixIcon="user"
|
|
695
|
+
/>
|
|
696
|
+
</Form.Field>
|
|
697
|
+
|
|
698
|
+
<Form.Field label="Email" required>
|
|
699
|
+
<Input
|
|
700
|
+
value={email}
|
|
701
|
+
onChangeText={setEmail}
|
|
702
|
+
placeholder="you@example.com"
|
|
703
|
+
keyboardType="email-address"
|
|
704
|
+
prefixIcon="mail"
|
|
705
|
+
/>
|
|
706
|
+
</Form.Field>
|
|
707
|
+
|
|
708
|
+
<Form.Field label="Bio">
|
|
709
|
+
<Textarea
|
|
710
|
+
value={bio}
|
|
711
|
+
onChangeText={setBio}
|
|
712
|
+
placeholder="Tell us about yourself"
|
|
713
|
+
rows={3}
|
|
714
|
+
/>
|
|
715
|
+
</Form.Field>
|
|
716
|
+
|
|
717
|
+
<Form.Field label="Language">
|
|
718
|
+
<Select
|
|
719
|
+
value={language}
|
|
720
|
+
onValueChange={setLanguage}
|
|
721
|
+
options={[
|
|
722
|
+
{ label: 'English', value: 'en' },
|
|
723
|
+
{ label: 'Español', value: 'es' },
|
|
724
|
+
{ label: 'Français', value: 'fr' },
|
|
725
|
+
]}
|
|
726
|
+
/>
|
|
727
|
+
</Form.Field>
|
|
728
|
+
</Form.Section>
|
|
729
|
+
|
|
730
|
+
<Form.Footer>
|
|
731
|
+
<Button
|
|
732
|
+
label="Cancel"
|
|
733
|
+
variant="secondary"
|
|
734
|
+
onPress={() => toast('Cancelled')}
|
|
735
|
+
/>
|
|
736
|
+
<Button
|
|
737
|
+
label="Save Changes"
|
|
738
|
+
onPress={() => toast.success('Profile updated')}
|
|
739
|
+
/>
|
|
740
|
+
</Form.Footer>
|
|
741
|
+
</Form>
|
|
742
|
+
</Card>
|
|
743
|
+
|
|
744
|
+
<View style={{ height: 24 }} />
|
|
745
|
+
|
|
746
|
+
{/* Support MenuGroup */}
|
|
747
|
+
<Text variant="caption" style={{ marginBottom: 8, paddingHorizontal: 4 }}>
|
|
748
|
+
Support
|
|
749
|
+
</Text>
|
|
750
|
+
<MenuGroup variant="card">
|
|
751
|
+
<MenuItem
|
|
752
|
+
label="Help Center"
|
|
753
|
+
iconName="help-circle"
|
|
754
|
+
onPress={() => toast('Help')}
|
|
755
|
+
/>
|
|
756
|
+
<MenuItem
|
|
757
|
+
label="Report an Issue"
|
|
758
|
+
iconName="alert-triangle"
|
|
759
|
+
onPress={() => toast('Report')}
|
|
760
|
+
/>
|
|
761
|
+
<MenuItem
|
|
762
|
+
label="Terms of Service"
|
|
763
|
+
iconName="file-text"
|
|
764
|
+
onPress={() => toast('Terms')}
|
|
765
|
+
/>
|
|
766
|
+
</MenuGroup>
|
|
767
|
+
|
|
768
|
+
<View style={{ height: 32 }} />
|
|
769
|
+
</ScrollView>
|
|
770
|
+
)
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
const styles = StyleSheet.create({
|
|
774
|
+
content: {
|
|
775
|
+
padding: 16,
|
|
776
|
+
paddingBottom: 48,
|
|
777
|
+
},
|
|
778
|
+
})
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
**Key patterns demonstrated:**
|
|
782
|
+
|
|
783
|
+
1. **MenuGroup auto-separators** — No need to add `showSeparator` to each MenuItem
|
|
784
|
+
2. **ListGroup with header/footer** — Compound components for structured lists
|
|
785
|
+
3. **Form.Section** — Grouped fields with title and description
|
|
786
|
+
4. **Form.Footer** — Button row with automatic spacing
|
|
787
|
+
5. **Mixed variants** — `variant="card"` for standalone groups, `variant="plain"` inside Card
|
|
788
|
+
6. **rightRender flexibility** — Switch, Badge, Text, or custom content
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
544
792
|
## Common Patterns
|
|
545
793
|
|
|
546
794
|
### Full-Screen Overlay Pattern
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
5
|
- 37 components across 7 categories
|
|
6
|
-
- Light/dark theme with 12 public tokens (
|
|
6
|
+
- Light/dark theme with 12 public tokens (25 resolved) 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-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
|
|
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 react-native-size-matters react-native-svg react-native-screens
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
For Expo projects, run `npx expo install` instead to get SDK-compatible versions.
|
|
@@ -42,14 +42,14 @@ module.exports = function (api) {
|
|
|
42
42
|
|
|
43
43
|
## Typography
|
|
44
44
|
|
|
45
|
-
All components use **
|
|
45
|
+
All components use **Sohne** font family. You must load the fonts at app root before rendering any component:
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
48
|
import { useFonts } from 'expo-font'
|
|
49
|
-
import {
|
|
49
|
+
import { SohneFonts } from '@retray-dev/ui-kit/fonts'
|
|
50
50
|
|
|
51
51
|
export default function App() {
|
|
52
|
-
const [fontsLoaded] = useFonts(
|
|
52
|
+
const [fontsLoaded] = useFonts(SohneFonts)
|
|
53
53
|
if (!fontsLoaded) return null
|
|
54
54
|
|
|
55
55
|
return (
|
|
@@ -58,7 +58,7 @@ export default function App() {
|
|
|
58
58
|
}
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
The library ships
|
|
61
|
+
The library ships 28 font files (14 Sohne base + 14 SohneMono, each with 7 weights + italic variants) as raw `.otf` files. Metro resolves them at bundle time.
|
|
62
62
|
|
|
63
63
|
## Setup
|
|
64
64
|
|
|
@@ -113,9 +113,9 @@ import { useTheme } from '@retray-dev/ui-kit'
|
|
|
113
113
|
const { colors, colorScheme } = useTheme()
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
**Public tokens (12 — override these):** `background`, `foreground`, `card`, `primary`, `primaryForeground`, `border`, `destructive`, `destructiveForeground`, `success`, `successForeground`, `warning`, `warningForeground`
|
|
116
|
+
**Public tokens (12 — override these):** `background`, `foreground`, `card`, `primary`, `primaryForeground`, `border`, `destructive`, `destructiveForeground`, `success`, `successForeground`, `warning`, `warningForeground`. Optional: `overlay`, `accent`, `accentForeground`.
|
|
117
117
|
|
|
118
|
-
**Derived tokens (read-only via `useTheme()`):** `foregroundSubtle`, `foregroundMuted`, `surface`, `surfaceStrong`, `destructiveTint`, `destructiveBorder`, `successTint`, `successBorder`, `warningTint`, `warningBorder`, `ring`, `input`
|
|
118
|
+
**Derived tokens (read-only via `useTheme()`):** `foregroundSubtle`, `foregroundMuted`, `surface`, `surfaceStrong`, `destructiveTint`, `destructiveBorder`, `successTint`, `successBorder`, `warningTint`, `warningBorder`, `ring`, `input`, `separator`, `overlay`, `accentResolved`, `accentForegroundResolved`
|
|
119
119
|
|
|
120
120
|
## Design Tokens
|
|
121
121
|
|
|
@@ -146,8 +146,9 @@ import { SPACING, ICON_SIZES, RADIUS, SHADOWS, BREAKPOINTS, TYPOGRAPHY } from '@
|
|
|
146
146
|
| Composition | `Tabs`, `Accordion` |
|
|
147
147
|
| Overlays | `Sheet`, `ConfirmDialog` |
|
|
148
148
|
| Feedback | `Toast` / `ToastProvider` / `useToast` |
|
|
149
|
-
| Data | `ListItem`, `Chip` / `ChipGroup`, `LabelValue`, `MonthPicker`, `CategoryStrip`, `DetailRow`
|
|
150
|
-
|
|
|
149
|
+
| Data | `ListItem`, `ListGroup`, `MenuItem`, `MenuGroup`, `Chip` / `ChipGroup`, `LabelValue`, `MonthPicker`, `CategoryStrip`, `DetailRow`, `MediaCard`, `VirtualList` |
|
|
150
|
+
| Forms | `Form` |
|
|
151
|
+
| Utilities | `Pressable`, `Icon` |
|
|
151
152
|
|
|
152
153
|
### Quick examples
|
|
153
154
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface AccordionItem {
|
|
5
|
+
value: string;
|
|
6
|
+
trigger: string;
|
|
7
|
+
content: React.ReactNode;
|
|
8
|
+
/** Icon name from @expo/vector-icons rendered left of trigger. */
|
|
9
|
+
iconName?: string;
|
|
10
|
+
/** Custom icon node rendered left of trigger. */
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
/** Override icon color. Defaults to foregroundMuted. */
|
|
13
|
+
iconColor?: string;
|
|
14
|
+
}
|
|
15
|
+
interface AccordionProps {
|
|
16
|
+
items: AccordionItem[];
|
|
17
|
+
/**
|
|
18
|
+
* - `'single'` (default): only one item can be open at a time. Opening another closes the current one.
|
|
19
|
+
* - `'multiple'`: any number of items can be open simultaneously.
|
|
20
|
+
*/
|
|
21
|
+
type?: 'single' | 'multiple';
|
|
22
|
+
/** Item value(s) that should be open on first render. */
|
|
23
|
+
defaultValue?: string | string[];
|
|
24
|
+
style?: ViewStyle;
|
|
25
|
+
}
|
|
26
|
+
declare function Accordion({ items, type, defaultValue, style }: AccordionProps): React.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { Accordion, type AccordionItem, type AccordionProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface AccordionItem {
|
|
5
|
+
value: string;
|
|
6
|
+
trigger: string;
|
|
7
|
+
content: React.ReactNode;
|
|
8
|
+
/** Icon name from @expo/vector-icons rendered left of trigger. */
|
|
9
|
+
iconName?: string;
|
|
10
|
+
/** Custom icon node rendered left of trigger. */
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
/** Override icon color. Defaults to foregroundMuted. */
|
|
13
|
+
iconColor?: string;
|
|
14
|
+
}
|
|
15
|
+
interface AccordionProps {
|
|
16
|
+
items: AccordionItem[];
|
|
17
|
+
/**
|
|
18
|
+
* - `'single'` (default): only one item can be open at a time. Opening another closes the current one.
|
|
19
|
+
* - `'multiple'`: any number of items can be open simultaneously.
|
|
20
|
+
*/
|
|
21
|
+
type?: 'single' | 'multiple';
|
|
22
|
+
/** Item value(s) that should be open on first render. */
|
|
23
|
+
defaultValue?: string | string[];
|
|
24
|
+
style?: ViewStyle;
|
|
25
|
+
}
|
|
26
|
+
declare function Accordion({ items, type, defaultValue, style }: AccordionProps): React.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { Accordion, type AccordionItem, type AccordionProps };
|