@expokit/cli 0.2.0 → 0.4.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.
Files changed (232) hide show
  1. package/README.md +20 -2
  2. package/bin/expo-kit.js +219 -44
  3. package/bin/lib.mjs +110 -1
  4. package/bin/mcp.mjs +48 -19
  5. package/package.json +9 -4
  6. package/registry/_docs/accordion.json +16 -0
  7. package/registry/_docs/action-sheet.json +28 -0
  8. package/registry/_docs/alert.json +28 -0
  9. package/registry/_docs/assistant-app.json +47 -0
  10. package/registry/_docs/avatar.json +25 -1
  11. package/registry/_docs/badge.json +36 -5
  12. package/registry/_docs/bottom-nav.json +30 -6
  13. package/registry/_docs/bottom-sheet.json +28 -0
  14. package/registry/_docs/bullet.json +3 -0
  15. package/registry/_docs/button-3d.json +18 -2
  16. package/registry/_docs/button.json +16 -0
  17. package/registry/_docs/calendar.json +21 -5
  18. package/registry/_docs/card-stack.json +16 -0
  19. package/registry/_docs/card.json +20 -0
  20. package/registry/_docs/carousel.json +20 -0
  21. package/registry/_docs/chat.json +184 -0
  22. package/registry/_docs/checkbox.json +16 -0
  23. package/registry/_docs/checkout.json +10 -1
  24. package/registry/_docs/chip-group.json +16 -0
  25. package/registry/_docs/confetti.json +23 -3
  26. package/registry/_docs/coupon.json +16 -0
  27. package/registry/_docs/cube-pager.json +16 -0
  28. package/registry/_docs/dashboard.json +3 -0
  29. package/registry/_docs/date-picker.json +24 -4
  30. package/registry/_docs/dialog.json +24 -0
  31. package/registry/_docs/donut-shop.json +88 -0
  32. package/registry/_docs/drawer.json +32 -4
  33. package/registry/_docs/fab.json +24 -0
  34. package/registry/_docs/fintech-app.json +49 -0
  35. package/registry/_docs/flip-card.json +16 -0
  36. package/registry/_docs/floating-input.json +25 -5
  37. package/registry/_docs/food-app.json +47 -0
  38. package/registry/_docs/gift-card.json +16 -0
  39. package/registry/_docs/glass-button.json +24 -0
  40. package/registry/_docs/glass-nav-bar.json +24 -0
  41. package/registry/_docs/glass-search-bar.json +24 -0
  42. package/registry/_docs/glass-segmented.json +28 -0
  43. package/registry/_docs/glass-sheet.json +28 -0
  44. package/registry/_docs/glass-tab-bar.json +24 -0
  45. package/registry/_docs/glass.json +17 -1
  46. package/registry/_docs/grain.json +80 -0
  47. package/registry/_docs/inbox.json +3 -0
  48. package/registry/_docs/isometric-bar.json +3 -0
  49. package/registry/_docs/kit.json +3 -0
  50. package/registry/_docs/liquidglass-tab.json +3 -0
  51. package/registry/_docs/list-item.json +16 -0
  52. package/registry/_docs/loyalty-card.json +16 -0
  53. package/registry/_docs/morphing-button-group.json +96 -0
  54. package/registry/_docs/number-ticker.json +16 -0
  55. package/registry/_docs/offers.json +3 -0
  56. package/registry/_docs/onboarding.json +3 -0
  57. package/registry/_docs/orb-reveal.json +132 -0
  58. package/registry/_docs/otp-input.json +28 -4
  59. package/registry/_docs/parallax-layers.json +20 -0
  60. package/registry/_docs/parallax-scroll.json +24 -0
  61. package/registry/_docs/password-input.json +23 -3
  62. package/registry/_docs/payment-card.json +16 -0
  63. package/registry/_docs/pixel-bar.json +3 -0
  64. package/registry/_docs/polar-area.json +3 -0
  65. package/registry/_docs/profile.json +3 -0
  66. package/registry/_docs/progress-steps.json +24 -0
  67. package/registry/_docs/progress.json +20 -0
  68. package/registry/_docs/qr-code-button.json +122 -0
  69. package/registry/_docs/radio-group.json +20 -0
  70. package/registry/_docs/rating.json +24 -0
  71. package/registry/_docs/ring-carousel.json +20 -0
  72. package/registry/_docs/scratch-card.json +20 -0
  73. package/registry/_docs/search-bar.json +23 -3
  74. package/registry/_docs/search-results.json +3 -0
  75. package/registry/_docs/segmented-control.json +20 -0
  76. package/registry/_docs/select.json +33 -8
  77. package/registry/_docs/settings.json +9 -0
  78. package/registry/_docs/sign-in.json +3 -0
  79. package/registry/_docs/skeleton.json +22 -2
  80. package/registry/_docs/slide-to-confirm.json +24 -0
  81. package/registry/_docs/slider.json +27 -7
  82. package/registry/_docs/spin-wheel.json +24 -0
  83. package/registry/_docs/spinner.json +41 -11
  84. package/registry/_docs/stateful-button.json +184 -0
  85. package/registry/_docs/stepper.json +23 -7
  86. package/registry/_docs/swipe-deck.json +16 -0
  87. package/registry/_docs/swipeable-row.json +24 -1
  88. package/registry/_docs/switch.json +20 -0
  89. package/registry/_docs/tabs.json +24 -0
  90. package/registry/_docs/text-animation.json +141 -0
  91. package/registry/_docs/textarea.json +18 -2
  92. package/registry/_docs/ticket-card.json +20 -0
  93. package/registry/_docs/ticket-shape.json +4 -1
  94. package/registry/_docs/tilt-card.json +20 -4
  95. package/registry/_docs/time-picker.json +22 -6
  96. package/registry/_docs/timeline-chart.json +3 -0
  97. package/registry/_docs/timeline.json +18 -2
  98. package/registry/_docs/toast.json +32 -8
  99. package/registry/_docs/treemap.json +3 -0
  100. package/registry/_docs/waterfall.json +3 -0
  101. package/registry/_docs/wheel-list.json +20 -0
  102. package/registry/accordion/files/src/components/ui/accordion.tsx +5 -4
  103. package/registry/accordion/files/src/lib/kit.tsx +8 -5
  104. package/registry/action-sheet/files/src/components/ui/action-sheet.tsx +9 -8
  105. package/registry/action-sheet/files/src/lib/kit.tsx +8 -5
  106. package/registry/alert/files/src/components/ui/alert.tsx +7 -4
  107. package/registry/alert/files/src/components/ui/button.tsx +4 -3
  108. package/registry/alert/files/src/lib/kit.tsx +8 -5
  109. package/registry/assistant-app.json +49 -0
  110. package/registry/avatar/files/src/components/ui/avatar.tsx +7 -4
  111. package/registry/avatar/files/src/lib/kit.tsx +8 -5
  112. package/registry/badge/files/src/components/ui/badge.tsx +345 -21
  113. package/registry/badge/files/src/lib/kit.tsx +8 -5
  114. package/registry/badge.json +1 -1
  115. package/registry/bottom-nav/files/src/components/ui/bottom-nav.tsx +14 -7
  116. package/registry/bottom-nav/files/src/lib/kit.tsx +8 -5
  117. package/registry/bottom-sheet/files/src/components/ui/bottom-sheet.tsx +7 -6
  118. package/registry/bottom-sheet/files/src/lib/kit.tsx +8 -5
  119. package/registry/button/files/src/components/ui/button.tsx +4 -3
  120. package/registry/button/files/src/lib/kit.tsx +8 -5
  121. package/registry/button-3d/files/src/components/ui/button-3d.tsx +3 -2
  122. package/registry/button-3d/files/src/lib/kit.tsx +8 -5
  123. package/registry/calendar/files/src/components/ui/calendar.tsx +9 -5
  124. package/registry/calendar/files/src/lib/kit.tsx +8 -5
  125. package/registry/card/files/src/components/ui/card.tsx +8 -6
  126. package/registry/card/files/src/lib/kit.tsx +8 -5
  127. package/registry/chat.json +18 -0
  128. package/registry/checkbox/files/src/components/ui/checkbox.tsx +6 -5
  129. package/registry/checkbox/files/src/lib/kit.tsx +8 -5
  130. package/registry/chip-group/files/src/components/ui/chip-group.tsx +4 -2
  131. package/registry/chip-group/files/src/lib/kit.tsx +8 -5
  132. package/registry/confetti/files/src/lib/kit.tsx +8 -5
  133. package/registry/coupon/files/src/components/ui/coupon.tsx +23 -20
  134. package/registry/coupon/files/src/components/ui/flip-card.tsx +1 -1
  135. package/registry/coupon/files/src/components/ui/tilt-card.tsx +2 -2
  136. package/registry/coupon/files/src/lib/kit.tsx +8 -5
  137. package/registry/date-picker/files/src/components/ui/calendar.tsx +9 -5
  138. package/registry/date-picker/files/src/components/ui/date-picker.tsx +2 -2
  139. package/registry/date-picker/files/src/lib/kit.tsx +8 -5
  140. package/registry/dialog/files/src/components/ui/dialog.tsx +12 -6
  141. package/registry/dialog/files/src/lib/kit.tsx +8 -5
  142. package/registry/donut-shop.json +18 -0
  143. package/registry/drawer/files/src/components/ui/drawer.tsx +25 -19
  144. package/registry/drawer/files/src/lib/kit.tsx +8 -5
  145. package/registry/fintech-app.json +57 -0
  146. package/registry/flip-card/files/src/components/ui/flip-card.tsx +1 -1
  147. package/registry/flip-card/files/src/lib/kit.tsx +8 -5
  148. package/registry/floating-input/files/src/components/ui/floating-input.tsx +16 -6
  149. package/registry/floating-input/files/src/lib/kit.tsx +8 -5
  150. package/registry/food-app.json +55 -0
  151. package/registry/grain/files/src/components/ui/grain.tsx +113 -0
  152. package/registry/{tag-input → grain}/files/src/lib/kit.tsx +8 -5
  153. package/registry/grain.json +17 -0
  154. package/registry/kit/files/src/lib/kit.tsx +8 -5
  155. package/registry/liquidglass-tab/files/src/components/GlassTabBar.tsx +1 -1
  156. package/registry/liquidglass-tab/files/src/lib/tab-bar.ts +1 -1
  157. package/registry/list-item/files/src/components/ui/list-item.tsx +20 -16
  158. package/registry/list-item/files/src/lib/kit.tsx +8 -5
  159. package/registry/morphing-button-group.json +18 -0
  160. package/registry/orb-reveal.json +20 -0
  161. package/registry/otp-input/files/src/components/ui/otp-input.tsx +8 -6
  162. package/registry/otp-input/files/src/lib/kit.tsx +8 -5
  163. package/registry/password-input/files/src/components/ui/floating-input.tsx +16 -6
  164. package/registry/password-input/files/src/components/ui/password-input.tsx +2 -2
  165. package/registry/password-input/files/src/lib/kit.tsx +8 -5
  166. package/registry/payment-card/files/src/components/ui/flip-card.tsx +1 -1
  167. package/registry/payment-card/files/src/components/ui/payment-card.tsx +27 -14
  168. package/registry/payment-card/files/src/components/ui/tilt-card.tsx +2 -2
  169. package/registry/payment-card/files/src/lib/kit.tsx +8 -5
  170. package/registry/progress/files/src/components/ui/progress.tsx +8 -5
  171. package/registry/progress/files/src/lib/kit.tsx +8 -5
  172. package/registry/progress-steps/files/src/components/ui/progress-steps.tsx +15 -11
  173. package/registry/progress-steps/files/src/lib/kit.tsx +8 -5
  174. package/registry/qr-code-button.json +18 -0
  175. package/registry/radio-group/files/src/components/ui/radio-group.tsx +10 -9
  176. package/registry/radio-group/files/src/lib/kit.tsx +8 -5
  177. package/registry/search-bar/files/src/components/ui/search-bar.tsx +13 -11
  178. package/registry/search-bar/files/src/lib/kit.tsx +8 -5
  179. package/registry/segmented-control/files/src/components/ui/segmented-control.tsx +4 -2
  180. package/registry/segmented-control/files/src/lib/kit.tsx +8 -5
  181. package/registry/select/files/src/components/ui/select.tsx +3 -3
  182. package/registry/select/files/src/lib/kit.tsx +8 -5
  183. package/registry/skeleton/files/src/components/ui/skeleton.tsx +4 -4
  184. package/registry/skeleton/files/src/lib/kit.tsx +8 -5
  185. package/registry/slider/files/src/components/ui/slider.tsx +5 -4
  186. package/registry/slider/files/src/lib/kit.tsx +8 -5
  187. package/registry/spinner/files/src/components/ui/spinner.tsx +452 -34
  188. package/registry/spinner/files/src/lib/kit.tsx +8 -5
  189. package/registry/spinner.json +1 -1
  190. package/registry/stateful-button/files/src/components/ui/stateful-button.tsx +532 -0
  191. package/registry/{pagination-dots → stateful-button}/files/src/lib/kit.tsx +8 -5
  192. package/registry/stateful-button.json +18 -0
  193. package/registry/stepper/files/src/components/ui/stepper.tsx +8 -4
  194. package/registry/stepper/files/src/lib/kit.tsx +8 -5
  195. package/registry/switch/files/src/components/ui/switch.tsx +4 -3
  196. package/registry/switch/files/src/lib/kit.tsx +8 -5
  197. package/registry/tabs/files/src/components/ui/tabs.tsx +10 -8
  198. package/registry/tabs/files/src/lib/kit.tsx +8 -5
  199. package/registry/text-animation/files/src/components/ui/text-animation.tsx +650 -0
  200. package/registry/text-animation/files/src/lib/kit.tsx +222 -0
  201. package/registry/text-animation.json +15 -0
  202. package/registry/textarea/files/src/components/ui/textarea.tsx +11 -9
  203. package/registry/textarea/files/src/lib/kit.tsx +8 -5
  204. package/registry/ticket-shape/files/src/lib/kit.tsx +8 -5
  205. package/registry/tilt-card/files/src/components/ui/tilt-card.tsx +2 -2
  206. package/registry/tilt-card/files/src/lib/kit.tsx +8 -5
  207. package/registry/time-picker/files/src/components/ui/time-picker.tsx +2 -2
  208. package/registry/time-picker/files/src/lib/kit.tsx +8 -5
  209. package/registry/timeline/files/src/components/ui/avatar.tsx +7 -4
  210. package/registry/timeline/files/src/components/ui/timeline.tsx +12 -10
  211. package/registry/timeline/files/src/lib/kit.tsx +8 -5
  212. package/registry/toast/files/src/components/ui/button.tsx +4 -3
  213. package/registry/toast/files/src/components/ui/toast.tsx +13 -11
  214. package/registry/toast/files/src/lib/kit.tsx +8 -5
  215. package/schema/components.schema.json +1 -1
  216. package/registry/_docs/color-swatch.json +0 -66
  217. package/registry/_docs/kpi-card.json +0 -11
  218. package/registry/_docs/like-button.json +0 -72
  219. package/registry/_docs/morph-button.json +0 -108
  220. package/registry/_docs/pagination-dots.json +0 -88
  221. package/registry/_docs/shimmer-button.json +0 -78
  222. package/registry/_docs/tag-input.json +0 -128
  223. package/registry/color-swatch.json +0 -17
  224. package/registry/kpi-card/files/src/components/charts/kpi-card.tsx +0 -45
  225. package/registry/kpi-card.json +0 -14
  226. package/registry/like-button.json +0 -18
  227. package/registry/morph-button.json +0 -18
  228. package/registry/pagination-dots/files/src/components/ui/pagination-dots.tsx +0 -262
  229. package/registry/pagination-dots.json +0 -15
  230. package/registry/shimmer-button.json +0 -17
  231. package/registry/tag-input/files/src/components/ui/tag-input.tsx +0 -720
  232. package/registry/tag-input.json +0 -17
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "donut-shop",
3
+ "category": "Blocks",
4
+ "aliases": [],
5
+ "exportName": "DonutShop",
6
+ "files": [
7
+ "src/components/blocks/donut-shop.tsx"
8
+ ],
9
+ "summary": "Donuts roll across a carousel and zoom into a detail view beside their nutrition.",
10
+ "props": [
11
+ [
12
+ "items",
13
+ "DonutItem[]",
14
+ "5 donuts",
15
+ "{ name, price, icing, topping?, toppingColor?, image?, nutrition? }."
16
+ ],
17
+ [
18
+ "title",
19
+ "string",
20
+ "'Dunats'",
21
+ "Shop name, in a script face."
22
+ ],
23
+ [
24
+ "currency",
25
+ "string",
26
+ "'$'",
27
+ "Prefix for prices."
28
+ ],
29
+ [
30
+ "background",
31
+ "string",
32
+ "soft pink",
33
+ "Page colour in light mode."
34
+ ],
35
+ [
36
+ "initialIndex",
37
+ "number",
38
+ "0",
39
+ "Donut shown first."
40
+ ],
41
+ [
42
+ "onIndexChange",
43
+ "(index: number) => void",
44
+ "—",
45
+ "The centred donut changed."
46
+ ],
47
+ [
48
+ "onAddToCart",
49
+ "(item, quantity) => void",
50
+ "—",
51
+ "Add to Cart pressed."
52
+ ],
53
+ [
54
+ "style",
55
+ "StyleProp<ViewStyle>",
56
+ "flex: 1",
57
+ "Root style."
58
+ ]
59
+ ],
60
+ "behavior": [
61
+ [
62
+ "Swipe",
63
+ "Donuts roll a full turn per circumference travelled and snap to the nearest; the centre one is larger."
64
+ ],
65
+ [
66
+ "+",
67
+ "Grows into a + 01 − stepper; an add-to-cart bar with the running total rises from the bottom."
68
+ ],
69
+ [
70
+ "Detail",
71
+ "Tap the donut: the list pushes away, the donut zooms to the right edge and keeps turning, the name and nutrition chips slide in. Back reverses it."
72
+ ],
73
+ [
74
+ "Art",
75
+ "Drawn donuts per item (icing colour, sprinkles / drizzle / specks), or your own image per item."
76
+ ],
77
+ [
78
+ "Haptics",
79
+ "A tick on each snap and a medium impact on Add to Cart."
80
+ ],
81
+ [
82
+ "Reduced motion",
83
+ "The detail donut stops its idle spin."
84
+ ]
85
+ ],
86
+ "usage": null,
87
+ "examples": []
88
+ }
@@ -6,6 +6,7 @@
6
6
  "files": [
7
7
  "src/components/ui/drawer.tsx"
8
8
  ],
9
+ "summary": "A side drawer that follows your finger, or pushes the screen aside as a card.",
9
10
  "props": [
10
11
  [
11
12
  "content",
@@ -146,26 +147,53 @@
146
147
  "Control the surrounding Drawer from inside it."
147
148
  ]
148
149
  ],
150
+ "behavior": [
151
+ [
152
+ "Touch",
153
+ "Swipe in from the screen edge to open and drag the panel or scrim to close. Release velocity decides where it settles, and it rubber-bands past fully open."
154
+ ],
155
+ [
156
+ "Motion",
157
+ "The panel springs in over a fading scrim; variant 'push' shrinks the screen into a rounded card and slides it aside. Active items spring in an accent pill and badges pop."
158
+ ],
159
+ [
160
+ "Reduced motion",
161
+ "Opening and closing use a short timing instead of a spring, the push variant no longer scales the screen, and item and badge pops are skipped."
162
+ ],
163
+ [
164
+ "Haptics",
165
+ "A light impact when the drawer opens and a selection tick when a DrawerItem is pressed."
166
+ ],
167
+ [
168
+ "Screen readers",
169
+ "The open panel is marked modal and hides itself when closed. DrawerItems are menu items with selected and disabled states, and the badge is read with the label."
170
+ ],
171
+ [
172
+ "Keyboard",
173
+ "Escape closes it on web; Android back closes it when it is rendered inline."
174
+ ]
175
+ ],
176
+ "usage": "import { useState } from 'react';\nimport { Drawer, DrawerItem } from '@/components/ui/drawer';\n\nconst [open, setOpen] = useState(false);\n<Drawer open={open} onOpenChange={setOpen} content={<DrawerItem label=\"Inbox\" icon=\"inbox\" active />}>\n <InboxScreen onMenuPress={() => setOpen(true)} />\n</Drawer>",
149
177
  "examples": [
150
178
  {
151
179
  "name": "AppNavigation",
152
180
  "title": "App Navigation",
153
- "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n {\n height: 600,\n borderRadius: radius.scale(28),\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n backgroundColor: colors.background,\n overflow: 'hidden',\n },\n style,\n ]}\n {...rest}\n />\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n <StatusBar />\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\nfunction Initials({ name, size = 32, square, ring }: { name: string; size?: number; square?: boolean; ring?: string }) {\n const { colors, radius } = useKit();\n const letters = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((w) => w[0])\n .join('');\n return (\n <View\n style={{\n width: size,\n height: size,\n borderRadius: square ? radius.scale(size * 0.28) : radius.capsule(size),\n backgroundColor: square ? colors.foreground : alpha(colors.accent, 0.14),\n borderWidth: ring ? 2 : 0,\n borderColor: ring,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <Text style={{ fontSize: size * 0.38, color: square ? colors.background : colors.accent }}>{letters}</Text>\n </View>\n );\n}\n\nfunction Dot({ color, size = 10 }: { color: string; size?: number }) {\n const { radius } = useKit();\n return <View style={{ width: size, height: size, borderRadius: radius.capsule(size), backgroundColor: color }} />;\n}\n\n/* Mail ------------------------------------------------------------------------------------------ */\n\nconst MAIL = [\n { from: 'Lena Fischer', subject: 'Offsite agenda — final draft', snippet: 'Attached the plan for Thursday. Shout if the 10:00 slot clashes.', time: '9:41', unread: true },\n { from: 'GitHub', service: true, subject: '[northwind/app] PR #482 merged', snippet: 'feat: offline drafts for the editor (#482) was merged into main.', time: '9:12', unread: true },\n { from: 'Omar Haddad', subject: 'Re: Invoice 2041', snippet: 'Paid this morning — the receipt is in the thread below.', time: '8:03', unread: true },\n { from: 'Figma', service: true, subject: 'Priya commented on Checkout v3', snippet: '“Can we try the sheet at 90% height here?”', time: 'Tue' },\n { from: 'Stripe', service: true, subject: 'Your October payout is on its way', snippet: '₹2,48,000 will arrive in your account in 2 business days.', time: 'Mon' },\n { from: 'Jonas Weber', subject: 'Photos from Lisbon', snippet: 'Finally sorted them — 48 shots, the tram ones came out great.', time: 'Sun' },\n { from: 'Ana Costa', subject: 'Lunch next week?', snippet: 'There is a new ramen place near the office, Wednesday works.', time: 'Sat' },\n];\n\nfunction MailRow({ from, service, subject, snippet, time, unread }: (typeof MAIL)[number]) {\n const { colors } = useKit();\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={`${unread ? 'Unread. ' : ''}${from}, ${subject}`}\n style={({ pressed }) => ({ flexDirection: 'row', gap: 12, paddingVertical: 11, paddingLeft: 16, paddingRight: 14, backgroundColor: pressed ? colors.muted : 'transparent' })}\n >\n <Initials name={from} size={40} square={service} />\n <View style={{ flex: 1, minWidth: 0, gap: 1 }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>\n <Text numberOfLines={1} style={{ flex: 1, fontSize: 15, color: unread ? colors.foreground : colors.mutedForeground }}>\n {from}\n </Text>\n <Text style={{ fontSize: 12.5, color: unread ? colors.accent : colors.mutedForeground }}>{time}</Text>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>\n <Text numberOfLines={1} style={{ flex: 1, fontSize: 14, color: colors.foreground, opacity: unread ? 1 : 0.8 }}>\n {subject}\n </Text>\n {unread ? <Dot color={colors.accent} size={8} /> : null}\n </View>\n <Text numberOfLines={1} style={{ fontSize: 13.5, color: colors.mutedForeground }}>\n {snippet}\n </Text>\n </View>\n </Pressable>\n );\n}\n\nexport default function AppNavigation() {\n const { colors, radius, dark } = useKit();\n const [page, setPage] = useState('Inbox');\n const nav: [DrawerIconName, string, number?][] = [\n ['inbox', 'Inbox', 12],\n ['star', 'Starred'],\n ['send', 'Sent'],\n ['file', 'Drafts', 2],\n ['archive', 'Archive'],\n ['trash', 'Trash'],\n ];\n const labels: [string, string, number?][] = [\n ['Design reviews', colors.accent, 4],\n ['Receipts', colors.success],\n ['Travel', colors.warning, 1],\n ];\n return (\n <Frame>\n <Drawer\n variant=\"push\"\n width=\"78%\"\n topInset={STATUS_H}\n header={<DrawerProfile name=\"Maya Patel\" email=\"maya@northwind.app\" status=\"online\" onPress={() => {}} />}\n content={\n <>\n {nav.map(([icon, label, badge]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} active={page === label} onPress={() => setPage(label)} />\n ))}\n <DrawerSection title=\"Labels\" trailing={<IconButton icon=\"plus\" label=\"New label\" color={colors.mutedForeground} />} />\n {labels.map(([label, color, badge]) => (\n <DrawerItem key={label} icon={<Dot color={color} />} label={label} badge={badge} active={page === label} onPress={() => setPage(label)} />\n ))}\n </>\n }\n footer={<DrawerFooter icon=\"cloud\" label=\"Storage\" detail=\"12.4 GB of 15 GB used\" progress={0.83} />}\n >\n <Phone>\n <TopBar\n title={page}\n subtitle={page === 'Inbox' ? '3 unread · maya@northwind.app' : undefined}\n right={\n <>\n <IconButton icon=\"search\" label=\"Search mail\" />\n <View style={{ paddingRight: 6 }}>\n <Initials name=\"Maya Patel\" size={32} />\n </View>\n </>\n }\n />\n <Text style={{ paddingHorizontal: 16, paddingTop: 4, paddingBottom: 2, fontSize: 13, color: colors.mutedForeground }}>Today</Text>\n {MAIL.map((m) => (\n <MailRow key={m.subject} {...m} />\n ))}\n <View\n style={{\n position: 'absolute',\n right: 16,\n bottom: 18,\n height: 52,\n paddingHorizontal: 18,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n borderRadius: radius.scale(18),\n backgroundColor: colors.accent,\n shadowColor: dark ? colors.background : colors.foreground,\n shadowOpacity: 0.18,\n shadowRadius: 14,\n shadowOffset: { width: 0, height: 6 },\n elevation: 6,\n }}\n >\n <DrawerIcon name=\"plus\" size={20} color={colors.accentForeground} strokeWidth={2} />\n <Text style={{ fontSize: 15, color: colors.accentForeground }}>Compose</Text>\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n\n/* Workspace ------------------------------------------------------------------------------------- */\n"
181
+ "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** From the Expo Go viewer: `screen` = this IS the phone screen, so no mock frame; `bottomInset` = home indicator. */\ntype DemoProps = { screen?: boolean; bottomInset?: number };\n\n/** True when the demo fills a real phone screen: the frame and the fake status bar step aside. */\nconst ScreenMode = React.createContext(false);\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, screen = false, ...rest }: ViewProps & { screen?: boolean }) {\n const { colors, radius } = useKit();\n return (\n <ScreenMode.Provider value={screen}>\n <View\n style={[\n { backgroundColor: colors.background, overflow: 'hidden' },\n screen ? { flex: 1 } : { height: 600, borderRadius: radius.scale(28), borderWidth: StyleSheet.hairlineWidth, borderColor: colors.border },\n style,\n ]}\n {...rest}\n />\n </ScreenMode.Provider>\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n const screen = React.useContext(ScreenMode);\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n {screen ? null : <StatusBar />}\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\nfunction Initials({ name, size = 32, square, ring }: { name: string; size?: number; square?: boolean; ring?: string }) {\n const { colors, radius } = useKit();\n const letters = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((w) => w[0])\n .join('');\n return (\n <View\n style={{\n width: size,\n height: size,\n borderRadius: square ? radius.scale(size * 0.28) : radius.capsule(size),\n backgroundColor: square ? colors.foreground : alpha(colors.accent, 0.14),\n borderWidth: ring ? 2 : 0,\n borderColor: ring,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <Text style={{ fontSize: size * 0.38, color: square ? colors.background : colors.accent }}>{letters}</Text>\n </View>\n );\n}\n\nfunction Dot({ color, size = 10 }: { color: string; size?: number }) {\n const { radius } = useKit();\n return <View style={{ width: size, height: size, borderRadius: radius.capsule(size), backgroundColor: color }} />;\n}\n\n/* Mail ------------------------------------------------------------------------------------------ */\n\nconst MAIL = [\n { from: 'Lena Fischer', subject: 'Offsite agenda — final draft', snippet: 'Attached the plan for Thursday. Shout if the 10:00 slot clashes.', time: '9:41', unread: true },\n { from: 'GitHub', service: true, subject: '[northwind/app] PR #482 merged', snippet: 'feat: offline drafts for the editor (#482) was merged into main.', time: '9:12', unread: true },\n { from: 'Omar Haddad', subject: 'Re: Invoice 2041', snippet: 'Paid this morning — the receipt is in the thread below.', time: '8:03', unread: true },\n { from: 'Figma', service: true, subject: 'Priya commented on Checkout v3', snippet: '“Can we try the sheet at 90% height here?”', time: 'Tue' },\n { from: 'Stripe', service: true, subject: 'Your October payout is on its way', snippet: '₹2,48,000 will arrive in your account in 2 business days.', time: 'Mon' },\n { from: 'Jonas Weber', subject: 'Photos from Lisbon', snippet: 'Finally sorted them — 48 shots, the tram ones came out great.', time: 'Sun' },\n { from: 'Ana Costa', subject: 'Lunch next week?', snippet: 'There is a new ramen place near the office, Wednesday works.', time: 'Sat' },\n];\n\nfunction MailRow({ from, service, subject, snippet, time, unread }: (typeof MAIL)[number]) {\n const { colors } = useKit();\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={`${unread ? 'Unread. ' : ''}${from}, ${subject}`}\n style={({ pressed }) => ({ flexDirection: 'row', gap: 12, paddingVertical: 11, paddingLeft: 16, paddingRight: 14, backgroundColor: pressed ? colors.muted : 'transparent' })}\n >\n <Initials name={from} size={40} square={service} />\n <View style={{ flex: 1, minWidth: 0, gap: 1 }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>\n <Text numberOfLines={1} style={{ flex: 1, fontSize: 15, color: unread ? colors.foreground : colors.mutedForeground }}>\n {from}\n </Text>\n <Text style={{ fontSize: 12.5, color: unread ? colors.accent : colors.mutedForeground }}>{time}</Text>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>\n <Text numberOfLines={1} style={{ flex: 1, fontSize: 14, color: colors.foreground, opacity: unread ? 1 : 0.8 }}>\n {subject}\n </Text>\n {unread ? <Dot color={colors.accent} size={8} /> : null}\n </View>\n <Text numberOfLines={1} style={{ fontSize: 13.5, color: colors.mutedForeground }}>\n {snippet}\n </Text>\n </View>\n </Pressable>\n );\n}\n\nexport default function AppNavigation({ screen, bottomInset }: DemoProps) {\n const { colors, radius, dark } = useKit();\n const [page, setPage] = useState('Inbox');\n const nav: [DrawerIconName, string, number?][] = [\n ['inbox', 'Inbox', 12],\n ['star', 'Starred'],\n ['send', 'Sent'],\n ['file', 'Drafts', 2],\n ['archive', 'Archive'],\n ['trash', 'Trash'],\n ];\n const labels: [string, string, number?][] = [\n ['Design reviews', colors.accent, 4],\n ['Receipts', colors.success],\n ['Travel', colors.warning, 1],\n ];\n return (\n <Frame screen={screen}>\n <Drawer\n variant=\"push\"\n width=\"78%\"\n topInset={screen ? undefined : STATUS_H}\n bottomInset={bottomInset}\n header={<DrawerProfile name=\"Maya Patel\" email=\"maya@northwind.app\" status=\"online\" onPress={() => {}} />}\n content={\n <>\n {nav.map(([icon, label, badge]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} active={page === label} onPress={() => setPage(label)} />\n ))}\n <DrawerSection title=\"Labels\" trailing={<IconButton icon=\"plus\" label=\"New label\" color={colors.mutedForeground} />} />\n {labels.map(([label, color, badge]) => (\n <DrawerItem key={label} icon={<Dot color={color} />} label={label} badge={badge} active={page === label} onPress={() => setPage(label)} />\n ))}\n </>\n }\n footer={<DrawerFooter icon=\"cloud\" label=\"Storage\" detail=\"12.4 GB of 15 GB used\" progress={0.83} />}\n >\n <Phone>\n <TopBar\n title={page}\n subtitle={page === 'Inbox' ? '3 unread · maya@northwind.app' : undefined}\n right={\n <>\n <IconButton icon=\"search\" label=\"Search mail\" />\n <View style={{ paddingRight: 6 }}>\n <Initials name=\"Maya Patel\" size={32} />\n </View>\n </>\n }\n />\n <Text style={{ paddingHorizontal: 16, paddingTop: 4, paddingBottom: 2, fontSize: 13, color: colors.mutedForeground }}>Today</Text>\n {MAIL.map((m) => (\n <MailRow key={m.subject} {...m} />\n ))}\n <View\n style={{\n position: 'absolute',\n right: 16,\n bottom: 18 + (bottomInset ?? 0),\n height: 52,\n paddingHorizontal: 18,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n borderRadius: radius.scale(18),\n backgroundColor: colors.accent,\n shadowColor: dark ? colors.background : colors.foreground,\n shadowOpacity: 0.18,\n shadowRadius: 14,\n shadowOffset: { width: 0, height: 6 },\n elevation: 6,\n }}\n >\n <DrawerIcon name=\"plus\" size={20} color={colors.accentForeground} strokeWidth={2} />\n <Text style={{ fontSize: 15, color: colors.accentForeground }}>Compose</Text>\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n\n/* Workspace ------------------------------------------------------------------------------------- */\n"
154
182
  },
155
183
  {
156
184
  "name": "WorkspaceSwitcher",
157
185
  "title": "Workspace Switcher",
158
- "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n {\n height: 600,\n borderRadius: radius.scale(28),\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n backgroundColor: colors.background,\n overflow: 'hidden',\n },\n style,\n ]}\n {...rest}\n />\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n <StatusBar />\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\nfunction Initials({ name, size = 32, square, ring }: { name: string; size?: number; square?: boolean; ring?: string }) {\n const { colors, radius } = useKit();\n const letters = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((w) => w[0])\n .join('');\n return (\n <View\n style={{\n width: size,\n height: size,\n borderRadius: square ? radius.scale(size * 0.28) : radius.capsule(size),\n backgroundColor: square ? colors.foreground : alpha(colors.accent, 0.14),\n borderWidth: ring ? 2 : 0,\n borderColor: ring,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <Text style={{ fontSize: size * 0.38, color: square ? colors.background : colors.accent }}>{letters}</Text>\n </View>\n );\n}\n\nfunction Dot({ color, size = 10 }: { color: string; size?: number }) {\n const { radius } = useKit();\n return <View style={{ width: size, height: size, borderRadius: radius.capsule(size), backgroundColor: color }} />;\n}\n\n/* Mail ------------------------------------------------------------------------------------------ */\n\nconst WORKSPACES = [\n { name: 'Northwind', detail: 'northwind.app · 24 members' },\n { name: 'Side Quests', detail: 'Personal · 1 member' },\n { name: 'Acme Studio', detail: 'acme.studio · 8 members' },\n];\n\ntype TaskState = 'In progress' | 'In review' | 'Todo';\n\nconst TASKS: { id: string; title: string; state: TaskState; due: string; done: number; total: number; people: string[] }[] = [\n { id: 'MOB-212', title: 'Sheet snap points jitter on Android 14', state: 'In progress', due: 'Today', done: 3, total: 5, people: ['Maya Patel', 'Omar Haddad'] },\n { id: 'MOB-208', title: 'Offline drafts for the editor', state: 'In review', due: 'Thu', done: 6, total: 6, people: ['Lena Fischer'] },\n { id: 'MOB-199', title: 'Rewrite the push permission prompt', state: 'Todo', due: 'Mon', done: 0, total: 3, people: ['Priya Nair', 'Maya Patel'] },\n { id: 'MOB-187', title: 'Haptics on tab change', state: 'Todo', due: 'Oct 28', done: 1, total: 2, people: ['Jonas Weber'] },\n];\n\nfunction StatePill({ state }: { state: TaskState }) {\n const { colors, radius } = useKit();\n const tone = state === 'In progress' ? colors.accent : state === 'In review' ? colors.warning : colors.mutedForeground;\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6, height: 24, paddingHorizontal: 9, borderRadius: radius.capsule(24), backgroundColor: alpha(tone, 0.13) }}>\n <Dot color={tone} size={7} />\n <Text style={{ fontSize: 12, color: colors.foreground }}>{state}</Text>\n </View>\n );\n}\n\nfunction TaskCard({ id, title, state, due, done, total, people }: (typeof TASKS)[number]) {\n const { colors, radius, dark } = useKit();\n return (\n <View\n style={{\n padding: 14,\n gap: 10,\n borderRadius: radius.scale(16),\n backgroundColor: colors.card,\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n shadowColor: dark ? colors.background : colors.foreground,\n shadowOpacity: dark ? 0.4 : 0.05,\n shadowRadius: 10,\n shadowOffset: { width: 0, height: 3 },\n elevation: 1,\n }}\n >\n <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>\n <StatePill state={state} />\n <Text style={{ fontSize: 12, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>{id}</Text>\n </View>\n <Text numberOfLines={1} style={{ fontSize: 15.5, letterSpacing: -0.2, color: colors.foreground }}>\n {title}\n </Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 5 }}>\n <DrawerIcon name=\"calendar\" size={14} color={due === 'Today' ? colors.danger : colors.mutedForeground} />\n <Text style={{ fontSize: 12.5, color: due === 'Today' ? colors.danger : colors.mutedForeground }}>{due}</Text>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 5 }}>\n <DrawerIcon name=\"check\" size={14} color={colors.mutedForeground} />\n <Text style={{ fontSize: 12.5, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>\n {done}/{total}\n </Text>\n </View>\n <View style={{ flex: 1 }} />\n <View style={{ flexDirection: 'row' }}>\n {people.map((p, i) => (\n <View key={p} style={{ marginLeft: i ? -8 : 0 }}>\n <Initials name={p} size={26} ring={colors.card} />\n </View>\n ))}\n </View>\n </View>\n </View>\n );\n}\n\nexport default function WorkspaceSwitcher() {\n const { colors, radius } = useKit();\n const [workspace, setWorkspace] = useState(WORKSPACES[0]);\n const [picking, setPicking] = useState(false);\n const [page, setPage] = useState('My issues');\n const [filter, setFilter] = useState('Active');\n return (\n <Frame>\n <Drawer\n topInset={STATUS_H}\n header={<DrawerProfile name={workspace.name} email={workspace.detail} onPress={() => setPicking((v) => !v)} accessibilityHint=\"Switch workspace\" />}\n content={\n picking ? (\n <>\n <DrawerSection title=\"Workspaces\" divider={false} />\n {WORKSPACES.map((w) => (\n <DrawerItem\n key={w.name}\n label={w.name}\n icon={w.name === workspace.name ? 'check' : 'layers'}\n active={w.name === workspace.name}\n closeOnPress={false}\n onPress={() => {\n setWorkspace(w);\n setPicking(false);\n }}\n />\n ))}\n <DrawerItem icon=\"plus\" label=\"Create workspace\" closeOnPress={false} />\n </>\n ) : (\n <>\n {(\n [\n ['inbox', 'Inbox', 5, 'accent'],\n ['target', 'My issues', 14],\n ['search', 'Search'],\n ] as [DrawerIconName, string, number?, 'accent'?][]\n ).map(([icon, label, badge, badgeTone]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} badgeTone={badgeTone} active={page === label} onPress={() => setPage(label)} />\n ))}\n <DrawerSection title=\"Teams\" trailing={<IconButton icon=\"plus\" label=\"New team\" color={colors.mutedForeground} />} />\n {(\n [\n ['layers', 'Mobile', 8],\n ['layers', 'Platform', 3],\n ['users', 'Design'],\n ] as [DrawerIconName, string, number?][]\n ).map(([icon, label, badge]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} active={page === label} onPress={() => setPage(label)} />\n ))}\n </>\n )\n }\n footer={\n <>\n <DrawerItem icon=\"settings\" label=\"Settings\" active={page === 'Settings'} onPress={() => setPage('Settings')} />\n <DrawerItem icon=\"logout\" label=\"Log out\" tone=\"danger\" />\n </>\n }\n >\n <Phone>\n <TopBar title={page} subtitle={`${workspace.name} · Mobile team`} right={<IconButton icon=\"plus\" label=\"New issue\" />} />\n <View style={{ flexDirection: 'row', gap: 8, paddingHorizontal: 16, paddingTop: 2, paddingBottom: 12 }}>\n {[\n ['Active', '4'],\n ['Backlog', '9'],\n ['Done', '23'],\n ].map(([label, n]) => {\n const on = filter === label;\n return (\n <Pressable\n key={label}\n onPress={() => setFilter(label)}\n accessibilityRole=\"button\"\n accessibilityState={{ selected: on }}\n style={{\n height: 32,\n paddingHorizontal: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n borderRadius: radius.capsule(32),\n backgroundColor: on ? alpha(colors.accent, 0.13) : 'transparent',\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: on ? alpha(colors.accent, 0.3) : colors.border,\n }}\n >\n <Text style={{ fontSize: 13.5, color: on ? colors.accent : colors.foreground }}>{label}</Text>\n <Text style={{ fontSize: 12.5, color: on ? colors.accent : colors.mutedForeground }}>{n}</Text>\n </Pressable>\n );\n })}\n </View>\n <View style={{ paddingHorizontal: 16, gap: 10 }}>\n {TASKS.map((t) => (\n <TaskCard key={t.id} {...t} />\n ))}\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n\n/* Stays (right panel) --------------------------------------------------------------------------- */\n"
186
+ "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** From the Expo Go viewer: `screen` = this IS the phone screen, so no mock frame; `bottomInset` = home indicator. */\ntype DemoProps = { screen?: boolean; bottomInset?: number };\n\n/** True when the demo fills a real phone screen: the frame and the fake status bar step aside. */\nconst ScreenMode = React.createContext(false);\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, screen = false, ...rest }: ViewProps & { screen?: boolean }) {\n const { colors, radius } = useKit();\n return (\n <ScreenMode.Provider value={screen}>\n <View\n style={[\n { backgroundColor: colors.background, overflow: 'hidden' },\n screen ? { flex: 1 } : { height: 600, borderRadius: radius.scale(28), borderWidth: StyleSheet.hairlineWidth, borderColor: colors.border },\n style,\n ]}\n {...rest}\n />\n </ScreenMode.Provider>\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n const screen = React.useContext(ScreenMode);\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n {screen ? null : <StatusBar />}\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\nfunction Initials({ name, size = 32, square, ring }: { name: string; size?: number; square?: boolean; ring?: string }) {\n const { colors, radius } = useKit();\n const letters = name\n .split(/\\s+/)\n .slice(0, 2)\n .map((w) => w[0])\n .join('');\n return (\n <View\n style={{\n width: size,\n height: size,\n borderRadius: square ? radius.scale(size * 0.28) : radius.capsule(size),\n backgroundColor: square ? colors.foreground : alpha(colors.accent, 0.14),\n borderWidth: ring ? 2 : 0,\n borderColor: ring,\n alignItems: 'center',\n justifyContent: 'center',\n }}\n >\n <Text style={{ fontSize: size * 0.38, color: square ? colors.background : colors.accent }}>{letters}</Text>\n </View>\n );\n}\n\nfunction Dot({ color, size = 10 }: { color: string; size?: number }) {\n const { radius } = useKit();\n return <View style={{ width: size, height: size, borderRadius: radius.capsule(size), backgroundColor: color }} />;\n}\n\n/* Mail ------------------------------------------------------------------------------------------ */\n\nconst WORKSPACES = [\n { name: 'Northwind', detail: 'northwind.app · 24 members' },\n { name: 'Side Quests', detail: 'Personal · 1 member' },\n { name: 'Acme Studio', detail: 'acme.studio · 8 members' },\n];\n\ntype TaskState = 'In progress' | 'In review' | 'Todo';\n\nconst TASKS: { id: string; title: string; state: TaskState; due: string; done: number; total: number; people: string[] }[] = [\n { id: 'MOB-212', title: 'Sheet snap points jitter on Android 14', state: 'In progress', due: 'Today', done: 3, total: 5, people: ['Maya Patel', 'Omar Haddad'] },\n { id: 'MOB-208', title: 'Offline drafts for the editor', state: 'In review', due: 'Thu', done: 6, total: 6, people: ['Lena Fischer'] },\n { id: 'MOB-199', title: 'Rewrite the push permission prompt', state: 'Todo', due: 'Mon', done: 0, total: 3, people: ['Priya Nair', 'Maya Patel'] },\n { id: 'MOB-187', title: 'Haptics on tab change', state: 'Todo', due: 'Oct 28', done: 1, total: 2, people: ['Jonas Weber'] },\n];\n\nfunction StatePill({ state }: { state: TaskState }) {\n const { colors, radius } = useKit();\n const tone = state === 'In progress' ? colors.accent : state === 'In review' ? colors.warning : colors.mutedForeground;\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6, height: 24, paddingHorizontal: 9, borderRadius: radius.capsule(24), backgroundColor: alpha(tone, 0.13) }}>\n <Dot color={tone} size={7} />\n <Text style={{ fontSize: 12, color: colors.foreground }}>{state}</Text>\n </View>\n );\n}\n\nfunction TaskCard({ id, title, state, due, done, total, people }: (typeof TASKS)[number]) {\n const { colors, radius, dark } = useKit();\n return (\n <View\n style={{\n padding: 14,\n gap: 10,\n borderRadius: radius.scale(16),\n backgroundColor: colors.card,\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n shadowColor: dark ? colors.background : colors.foreground,\n shadowOpacity: dark ? 0.4 : 0.05,\n shadowRadius: 10,\n shadowOffset: { width: 0, height: 3 },\n elevation: 1,\n }}\n >\n <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>\n <StatePill state={state} />\n <Text style={{ fontSize: 12, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>{id}</Text>\n </View>\n <Text numberOfLines={1} style={{ fontSize: 15.5, letterSpacing: -0.2, color: colors.foreground }}>\n {title}\n </Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 14 }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 5 }}>\n <DrawerIcon name=\"calendar\" size={14} color={due === 'Today' ? colors.danger : colors.mutedForeground} />\n <Text style={{ fontSize: 12.5, color: due === 'Today' ? colors.danger : colors.mutedForeground }}>{due}</Text>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 5 }}>\n <DrawerIcon name=\"check\" size={14} color={colors.mutedForeground} />\n <Text style={{ fontSize: 12.5, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>\n {done}/{total}\n </Text>\n </View>\n <View style={{ flex: 1 }} />\n <View style={{ flexDirection: 'row' }}>\n {people.map((p, i) => (\n <View key={p} style={{ marginLeft: i ? -8 : 0 }}>\n <Initials name={p} size={26} ring={colors.card} />\n </View>\n ))}\n </View>\n </View>\n </View>\n );\n}\n\nexport default function WorkspaceSwitcher({ screen, bottomInset }: DemoProps) {\n const { colors, radius } = useKit();\n const [workspace, setWorkspace] = useState(WORKSPACES[0]);\n const [picking, setPicking] = useState(false);\n const [page, setPage] = useState('My issues');\n const [filter, setFilter] = useState('Active');\n return (\n <Frame screen={screen}>\n <Drawer\n topInset={screen ? undefined : STATUS_H}\n bottomInset={bottomInset}\n header={<DrawerProfile name={workspace.name} email={workspace.detail} onPress={() => setPicking((v) => !v)} accessibilityHint=\"Switch workspace\" />}\n content={\n picking ? (\n <>\n <DrawerSection title=\"Workspaces\" divider={false} />\n {WORKSPACES.map((w) => (\n <DrawerItem\n key={w.name}\n label={w.name}\n icon={w.name === workspace.name ? 'check' : 'layers'}\n active={w.name === workspace.name}\n closeOnPress={false}\n onPress={() => {\n setWorkspace(w);\n setPicking(false);\n }}\n />\n ))}\n <DrawerItem icon=\"plus\" label=\"Create workspace\" closeOnPress={false} />\n </>\n ) : (\n <>\n {(\n [\n ['inbox', 'Inbox', 5, 'accent'],\n ['target', 'My issues', 14],\n ['search', 'Search'],\n ] as [DrawerIconName, string, number?, 'accent'?][]\n ).map(([icon, label, badge, badgeTone]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} badgeTone={badgeTone} active={page === label} onPress={() => setPage(label)} />\n ))}\n <DrawerSection title=\"Teams\" trailing={<IconButton icon=\"plus\" label=\"New team\" color={colors.mutedForeground} />} />\n {(\n [\n ['layers', 'Mobile', 8],\n ['layers', 'Platform', 3],\n ['users', 'Design'],\n ] as [DrawerIconName, string, number?][]\n ).map(([icon, label, badge]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} active={page === label} onPress={() => setPage(label)} />\n ))}\n </>\n )\n }\n footer={\n <>\n <DrawerItem icon=\"settings\" label=\"Settings\" active={page === 'Settings'} onPress={() => setPage('Settings')} />\n <DrawerItem icon=\"logout\" label=\"Log out\" tone=\"danger\" />\n </>\n }\n >\n <Phone>\n <TopBar title={page} subtitle={`${workspace.name} · Mobile team`} right={<IconButton icon=\"plus\" label=\"New issue\" />} />\n <View style={{ flexDirection: 'row', gap: 8, paddingHorizontal: 16, paddingTop: 2, paddingBottom: 12 }}>\n {[\n ['Active', '4'],\n ['Backlog', '9'],\n ['Done', '23'],\n ].map(([label, n]) => {\n const on = filter === label;\n return (\n <Pressable\n key={label}\n onPress={() => setFilter(label)}\n accessibilityRole=\"button\"\n accessibilityState={{ selected: on }}\n style={{\n height: 32,\n paddingHorizontal: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n borderRadius: radius.capsule(32),\n backgroundColor: on ? alpha(colors.accent, 0.13) : 'transparent',\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: on ? alpha(colors.accent, 0.3) : colors.border,\n }}\n >\n <Text style={{ fontSize: 13.5, color: on ? colors.accent : colors.foreground }}>{label}</Text>\n <Text style={{ fontSize: 12.5, color: on ? colors.accent : colors.mutedForeground }}>{n}</Text>\n </Pressable>\n );\n })}\n </View>\n <View style={{ paddingHorizontal: 16, gap: 10 }}>\n {TASKS.map((t) => (\n <TaskCard key={t.id} {...t} />\n ))}\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n\n/* Stays (right panel) --------------------------------------------------------------------------- */\n"
159
187
  },
160
188
  {
161
189
  "name": "RightPanel",
162
190
  "title": "Right Panel",
163
- "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n {\n height: 600,\n borderRadius: radius.scale(28),\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n backgroundColor: colors.background,\n overflow: 'hidden',\n },\n style,\n ]}\n {...rest}\n />\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n <StatusBar />\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\ntype ArtKind = 'sunset' | 'grid' | 'rings' | 'stripes' | 'split';\n\n/**\n * Album art drawn with plain Views in theme colours. `size` 0 stretches to the parent width\n * (then pass `height`).\n */\nfunction Art({ kind, size, height, radiusSize }: { kind: ArtKind; size: number; height?: number; radiusSize?: number }) {\n const { colors, radius } = useKit();\n const h = height ?? size;\n const w = size || undefined;\n const d = Math.min(size || h, h);\n const box = {\n width: w,\n alignSelf: size ? undefined : ('stretch' as const),\n height: h,\n borderRadius: radiusSize ?? radius.scale(size > 60 ? 14 : 8),\n overflow: 'hidden' as const,\n };\n const on = colors.accentForeground;\n if (kind === 'sunset') {\n return (\n <View style={[box, { backgroundColor: colors.accent, alignItems: 'center' }]}>\n <View style={{ position: 'absolute', top: h * 0.3, width: d * 0.5, height: d * 0.5, borderRadius: radius.capsule(d), backgroundColor: alpha(on, 0.85) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: h * 0.34, backgroundColor: alpha(colors.foreground, 0.35) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: h * 0.22, height: Math.max(1, h * 0.03), backgroundColor: alpha(on, 0.35) }} />\n </View>\n );\n }\n if (kind === 'grid') {\n const cell = d * 0.18;\n return (\n <View style={[box, { backgroundColor: colors.foreground, alignItems: 'center', justifyContent: 'center' }]}>\n <View style={{ width: cell * 3 + cell * 0.5 * 2, flexDirection: 'row', flexWrap: 'wrap', gap: cell * 0.5 }}>\n {[1, 0.25, 0.6, 0.25, 1, 0.25, 0.6, 0.25, 1].map((a, i) => (\n <View key={i} style={{ width: cell, height: cell, borderRadius: radius.scale(cell * 0.3), backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n if (kind === 'rings') {\n return (\n <View style={[box, { backgroundColor: alpha(colors.accent, 0.16), alignItems: 'center', justifyContent: 'center' }]}>\n {[0.95, 0.7, 0.45, 0.2].map((f) => (\n <View\n key={f}\n style={{\n position: 'absolute',\n width: d * f,\n height: d * f,\n borderRadius: radius.capsule(d),\n borderWidth: Math.max(1.5, d * 0.03),\n borderColor: alpha(colors.accent, 1 - f * 0.6),\n }}\n />\n ))}\n </View>\n );\n }\n if (kind === 'stripes') {\n return (\n <View style={[box, { backgroundColor: colors.muted, justifyContent: 'center', alignItems: 'center' }]}>\n <View style={{ width: d * 1.6, gap: d * 0.07, transform: [{ rotate: '-30deg' }] }}>\n {[0.9, 0.55, 0.3, 0.55, 0.9].map((a, i) => (\n <View key={i} style={{ height: d * 0.1, backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n return (\n <View style={[box, { backgroundColor: colors.foreground, flexDirection: 'row' }]}>\n <View style={{ flex: 1, backgroundColor: colors.accent }} />\n <View style={{ flex: 1 }} />\n <View\n style={{\n position: 'absolute',\n left: (w ?? d) / 2 - d * 0.22,\n top: h / 2 - d * 0.22,\n width: d * 0.44,\n height: d * 0.44,\n borderRadius: radius.capsule(d),\n backgroundColor: colors.background,\n }}\n />\n </View>\n );\n}\n\nexport default function RightPanel() {\n const { colors, radius } = useKit();\n const [open, setOpen] = useState(false);\n const [price, setPrice] = useState('Any price');\n const [tags, setTags] = useState<string[]>(['Free cancellation']);\n const toggle = (t: string) => setTags((s) => (s.includes(t) ? s.filter((x) => x !== t) : [...s, t]));\n const count = 48 - tags.length * 9 - (price === 'Any price' ? 0 : 11);\n const active = tags.length + (price !== 'Any price' ? 1 : 0);\n return (\n <Frame>\n <Drawer\n open={open}\n onOpenChange={setOpen}\n side=\"right\"\n width=\"86%\"\n topInset={STATUS_H}\n accessibilityLabel=\"Filters\"\n header={<DrawerHeader title=\"Filters\" subtitle=\"Porto · Jun 3 – 7 · 2 guests\" showClose onClose={() => setOpen(false)} />}\n content={\n <>\n <DrawerSection title=\"Price per night\" divider={false} />\n {['Any price', 'Under ₹5,000', '₹5,000 – ₹10,000', '₹10,000+'].map((p) => (\n <DrawerItem key={p} label={p} icon={price === p ? 'check' : <View />} active={price === p} closeOnPress={false} onPress={() => setPrice(p)} />\n ))}\n <DrawerSection title=\"Amenities\" />\n {['Free cancellation', 'Breakfast included', 'Pet friendly', 'Workspace'].map((t) => (\n <DrawerItem key={t} label={t} icon={tags.includes(t) ? 'check' : <View />} active={tags.includes(t)} closeOnPress={false} onPress={() => toggle(t)} />\n ))}\n </>\n }\n footer={\n <View style={{ flexDirection: 'row', gap: 8, paddingHorizontal: 4 }}>\n <Button\n variant=\"outline\"\n style={{ flex: 1 }}\n onPress={() => {\n setPrice('Any price');\n setTags([]);\n }}\n >\n Reset\n </Button>\n <Button variant=\"accent\" style={{ flex: 1.4 }} onPress={() => setOpen(false)}>\n {`Show ${count} stays`}\n </Button>\n </View>\n }\n >\n <Phone>\n <TopBar\n menu={false}\n title=\"Stays in Porto\"\n subtitle={`${count} places · Jun 3 – 7`}\n right={\n <Button size=\"sm\" variant=\"secondary\" pill left={<DrawerIcon name=\"filter\" size={16} />} onPress={() => setOpen(true)}>\n {active ? `Filters · ${active}` : 'Filters'}\n </Button>\n }\n />\n <View style={{ paddingHorizontal: 16, paddingTop: 4, gap: 16 }}>\n {[\n { name: 'Casa da Ribeira', meta: 'River view · 1 bedroom', price: '₹6,800', rating: '4.92', art: 'sunset' as const },\n { name: 'Azulejo Loft', meta: 'Breakfast included', price: '₹4,800', rating: '4.81', art: 'grid' as const },\n { name: 'Miradouro Suites', meta: 'Free cancellation', price: '₹12,500', rating: '4.97', art: 'rings' as const },\n ].map((s) => (\n <View key={s.name} style={{ gap: 8 }}>\n <Art kind={s.art} size={0} height={112} radiusSize={radius.scale(18)} />\n <View style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 8 }}>\n <View style={{ flex: 1 }}>\n <Text style={{ fontSize: 15, color: colors.foreground }}>{s.name}</Text>\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>{s.meta}</Text>\n </View>\n <View style={{ alignItems: 'flex-end' }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>\n <DrawerIcon name=\"star\" size={13} color={colors.foreground} />\n <Text style={{ fontSize: 13, color: colors.foreground }}>{s.rating}</Text>\n </View>\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>\n <Text style={{ color: colors.foreground }}>{s.price}</Text> night\n </Text>\n </View>\n </View>\n </View>\n ))}\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n\n/* Music ----------------------------------------------------------------------------------------- */\n"
191
+ "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** From the Expo Go viewer: `screen` = this IS the phone screen, so no mock frame; `bottomInset` = home indicator. */\ntype DemoProps = { screen?: boolean; bottomInset?: number };\n\n/** True when the demo fills a real phone screen: the frame and the fake status bar step aside. */\nconst ScreenMode = React.createContext(false);\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, screen = false, ...rest }: ViewProps & { screen?: boolean }) {\n const { colors, radius } = useKit();\n return (\n <ScreenMode.Provider value={screen}>\n <View\n style={[\n { backgroundColor: colors.background, overflow: 'hidden' },\n screen ? { flex: 1 } : { height: 600, borderRadius: radius.scale(28), borderWidth: StyleSheet.hairlineWidth, borderColor: colors.border },\n style,\n ]}\n {...rest}\n />\n </ScreenMode.Provider>\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n const screen = React.useContext(ScreenMode);\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n {screen ? null : <StatusBar />}\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\ntype ArtKind = 'sunset' | 'grid' | 'rings' | 'stripes' | 'split';\n\n/**\n * Album art drawn with plain Views in theme colours. `size` 0 stretches to the parent width\n * (then pass `height`).\n */\nfunction Art({ kind, size, height, radiusSize }: { kind: ArtKind; size: number; height?: number; radiusSize?: number }) {\n const { colors, radius } = useKit();\n const h = height ?? size;\n const w = size || undefined;\n const d = Math.min(size || h, h);\n const box = {\n width: w,\n alignSelf: size ? undefined : ('stretch' as const),\n height: h,\n borderRadius: radiusSize ?? radius.scale(size > 60 ? 14 : 8),\n overflow: 'hidden' as const,\n };\n const on = colors.accentForeground;\n if (kind === 'sunset') {\n return (\n <View style={[box, { backgroundColor: colors.accent, alignItems: 'center' }]}>\n <View style={{ position: 'absolute', top: h * 0.3, width: d * 0.5, height: d * 0.5, borderRadius: radius.capsule(d), backgroundColor: alpha(on, 0.85) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: h * 0.34, backgroundColor: alpha(colors.foreground, 0.35) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: h * 0.22, height: Math.max(1, h * 0.03), backgroundColor: alpha(on, 0.35) }} />\n </View>\n );\n }\n if (kind === 'grid') {\n const cell = d * 0.18;\n return (\n <View style={[box, { backgroundColor: colors.foreground, alignItems: 'center', justifyContent: 'center' }]}>\n <View style={{ width: cell * 3 + cell * 0.5 * 2, flexDirection: 'row', flexWrap: 'wrap', gap: cell * 0.5 }}>\n {[1, 0.25, 0.6, 0.25, 1, 0.25, 0.6, 0.25, 1].map((a, i) => (\n <View key={i} style={{ width: cell, height: cell, borderRadius: radius.scale(cell * 0.3), backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n if (kind === 'rings') {\n return (\n <View style={[box, { backgroundColor: alpha(colors.accent, 0.16), alignItems: 'center', justifyContent: 'center' }]}>\n {[0.95, 0.7, 0.45, 0.2].map((f) => (\n <View\n key={f}\n style={{\n position: 'absolute',\n width: d * f,\n height: d * f,\n borderRadius: radius.capsule(d),\n borderWidth: Math.max(1.5, d * 0.03),\n borderColor: alpha(colors.accent, 1 - f * 0.6),\n }}\n />\n ))}\n </View>\n );\n }\n if (kind === 'stripes') {\n return (\n <View style={[box, { backgroundColor: colors.muted, justifyContent: 'center', alignItems: 'center' }]}>\n <View style={{ width: d * 1.6, gap: d * 0.07, transform: [{ rotate: '-30deg' }] }}>\n {[0.9, 0.55, 0.3, 0.55, 0.9].map((a, i) => (\n <View key={i} style={{ height: d * 0.1, backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n return (\n <View style={[box, { backgroundColor: colors.foreground, flexDirection: 'row' }]}>\n <View style={{ flex: 1, backgroundColor: colors.accent }} />\n <View style={{ flex: 1 }} />\n <View\n style={{\n position: 'absolute',\n left: (w ?? d) / 2 - d * 0.22,\n top: h / 2 - d * 0.22,\n width: d * 0.44,\n height: d * 0.44,\n borderRadius: radius.capsule(d),\n backgroundColor: colors.background,\n }}\n />\n </View>\n );\n}\n\nexport default function RightPanel({ screen, bottomInset }: DemoProps) {\n const { colors, radius } = useKit();\n const [open, setOpen] = useState(false);\n const [price, setPrice] = useState('Any price');\n const [tags, setTags] = useState<string[]>(['Free cancellation']);\n const toggle = (t: string) => setTags((s) => (s.includes(t) ? s.filter((x) => x !== t) : [...s, t]));\n const count = 48 - tags.length * 9 - (price === 'Any price' ? 0 : 11);\n const active = tags.length + (price !== 'Any price' ? 1 : 0);\n return (\n <Frame screen={screen}>\n <Drawer\n open={open}\n onOpenChange={setOpen}\n side=\"right\"\n width=\"86%\"\n topInset={screen ? undefined : STATUS_H}\n bottomInset={bottomInset}\n accessibilityLabel=\"Filters\"\n header={<DrawerHeader title=\"Filters\" subtitle=\"Porto · Jun 3 – 7 · 2 guests\" showClose onClose={() => setOpen(false)} />}\n content={\n <>\n <DrawerSection title=\"Price per night\" divider={false} />\n {['Any price', 'Under ₹5,000', '₹5,000 – ₹10,000', '₹10,000+'].map((p) => (\n <DrawerItem key={p} label={p} icon={price === p ? 'check' : <View />} active={price === p} closeOnPress={false} onPress={() => setPrice(p)} />\n ))}\n <DrawerSection title=\"Amenities\" />\n {['Free cancellation', 'Breakfast included', 'Pet friendly', 'Workspace'].map((t) => (\n <DrawerItem key={t} label={t} icon={tags.includes(t) ? 'check' : <View />} active={tags.includes(t)} closeOnPress={false} onPress={() => toggle(t)} />\n ))}\n </>\n }\n footer={\n <View style={{ flexDirection: 'row', gap: 8, paddingHorizontal: 4 }}>\n <Button\n variant=\"outline\"\n style={{ flex: 1 }}\n onPress={() => {\n setPrice('Any price');\n setTags([]);\n }}\n >\n Reset\n </Button>\n <Button variant=\"accent\" style={{ flex: 1.4 }} onPress={() => setOpen(false)}>\n {`Show ${count} stays`}\n </Button>\n </View>\n }\n >\n <Phone>\n <TopBar\n menu={false}\n title=\"Stays in Porto\"\n subtitle={`${count} places · Jun 3 – 7`}\n right={\n <Button size=\"sm\" variant=\"secondary\" pill left={<DrawerIcon name=\"filter\" size={16} />} onPress={() => setOpen(true)}>\n {active ? `Filters · ${active}` : 'Filters'}\n </Button>\n }\n />\n <View style={{ paddingHorizontal: 16, paddingTop: 4, gap: 16 }}>\n {[\n { name: 'Casa da Ribeira', meta: 'River view · 1 bedroom', price: '₹6,800', rating: '4.92', art: 'sunset' as const },\n { name: 'Azulejo Loft', meta: 'Breakfast included', price: '₹4,800', rating: '4.81', art: 'grid' as const },\n { name: 'Miradouro Suites', meta: 'Free cancellation', price: '₹12,500', rating: '4.97', art: 'rings' as const },\n ].map((s) => (\n <View key={s.name} style={{ gap: 8 }}>\n <Art kind={s.art} size={0} height={112} radiusSize={radius.scale(18)} />\n <View style={{ flexDirection: 'row', alignItems: 'flex-start', gap: 8 }}>\n <View style={{ flex: 1 }}>\n <Text style={{ fontSize: 15, color: colors.foreground }}>{s.name}</Text>\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>{s.meta}</Text>\n </View>\n <View style={{ alignItems: 'flex-end' }}>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 4 }}>\n <DrawerIcon name=\"star\" size={13} color={colors.foreground} />\n <Text style={{ fontSize: 13, color: colors.foreground }}>{s.rating}</Text>\n </View>\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>\n <Text style={{ color: colors.foreground }}>{s.price}</Text> night\n </Text>\n </View>\n </View>\n </View>\n ))}\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n\n/* Music ----------------------------------------------------------------------------------------- */\n"
164
192
  },
165
193
  {
166
194
  "name": "PushLayout",
167
195
  "title": "Push Layout",
168
- "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n {\n height: 600,\n borderRadius: radius.scale(28),\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n backgroundColor: colors.background,\n overflow: 'hidden',\n },\n style,\n ]}\n {...rest}\n />\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n <StatusBar />\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\ntype ArtKind = 'sunset' | 'grid' | 'rings' | 'stripes' | 'split';\n\n/**\n * Album art drawn with plain Views in theme colours. `size` 0 stretches to the parent width\n * (then pass `height`).\n */\nfunction Art({ kind, size, height, radiusSize }: { kind: ArtKind; size: number; height?: number; radiusSize?: number }) {\n const { colors, radius } = useKit();\n const h = height ?? size;\n const w = size || undefined;\n const d = Math.min(size || h, h);\n const box = {\n width: w,\n alignSelf: size ? undefined : ('stretch' as const),\n height: h,\n borderRadius: radiusSize ?? radius.scale(size > 60 ? 14 : 8),\n overflow: 'hidden' as const,\n };\n const on = colors.accentForeground;\n if (kind === 'sunset') {\n return (\n <View style={[box, { backgroundColor: colors.accent, alignItems: 'center' }]}>\n <View style={{ position: 'absolute', top: h * 0.3, width: d * 0.5, height: d * 0.5, borderRadius: radius.capsule(d), backgroundColor: alpha(on, 0.85) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: h * 0.34, backgroundColor: alpha(colors.foreground, 0.35) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: h * 0.22, height: Math.max(1, h * 0.03), backgroundColor: alpha(on, 0.35) }} />\n </View>\n );\n }\n if (kind === 'grid') {\n const cell = d * 0.18;\n return (\n <View style={[box, { backgroundColor: colors.foreground, alignItems: 'center', justifyContent: 'center' }]}>\n <View style={{ width: cell * 3 + cell * 0.5 * 2, flexDirection: 'row', flexWrap: 'wrap', gap: cell * 0.5 }}>\n {[1, 0.25, 0.6, 0.25, 1, 0.25, 0.6, 0.25, 1].map((a, i) => (\n <View key={i} style={{ width: cell, height: cell, borderRadius: radius.scale(cell * 0.3), backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n if (kind === 'rings') {\n return (\n <View style={[box, { backgroundColor: alpha(colors.accent, 0.16), alignItems: 'center', justifyContent: 'center' }]}>\n {[0.95, 0.7, 0.45, 0.2].map((f) => (\n <View\n key={f}\n style={{\n position: 'absolute',\n width: d * f,\n height: d * f,\n borderRadius: radius.capsule(d),\n borderWidth: Math.max(1.5, d * 0.03),\n borderColor: alpha(colors.accent, 1 - f * 0.6),\n }}\n />\n ))}\n </View>\n );\n }\n if (kind === 'stripes') {\n return (\n <View style={[box, { backgroundColor: colors.muted, justifyContent: 'center', alignItems: 'center' }]}>\n <View style={{ width: d * 1.6, gap: d * 0.07, transform: [{ rotate: '-30deg' }] }}>\n {[0.9, 0.55, 0.3, 0.55, 0.9].map((a, i) => (\n <View key={i} style={{ height: d * 0.1, backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n return (\n <View style={[box, { backgroundColor: colors.foreground, flexDirection: 'row' }]}>\n <View style={{ flex: 1, backgroundColor: colors.accent }} />\n <View style={{ flex: 1 }} />\n <View\n style={{\n position: 'absolute',\n left: (w ?? d) / 2 - d * 0.22,\n top: h / 2 - d * 0.22,\n width: d * 0.44,\n height: d * 0.44,\n borderRadius: radius.capsule(d),\n backgroundColor: colors.background,\n }}\n />\n </View>\n );\n}\n\n/** A right-pointing triangle made from borders (play / skip glyphs). */\nfunction Tri({ size, color, flip }: { size: number; color: string; flip?: boolean }) {\n return (\n <View\n style={{\n width: 0,\n height: 0,\n borderTopWidth: size / 2,\n borderBottomWidth: size / 2,\n borderLeftWidth: size * 0.85,\n borderTopColor: 'transparent',\n borderBottomColor: 'transparent',\n borderLeftColor: color,\n transform: flip ? [{ scaleX: -1 }] : undefined,\n }}\n />\n );\n}\n\nfunction Skip({ color, back }: { color: string; back?: boolean }) {\n const { radius } = useKit();\n return (\n <View style={{ flexDirection: back ? 'row-reverse' : 'row', alignItems: 'center', gap: 1 }}>\n <Tri size={14} color={color} flip={back} />\n <View style={{ width: 2.5, height: 14, borderRadius: radius.capsule(2.5), backgroundColor: color }} />\n </View>\n );\n}\n\nconst TRACKS: { title: string; artist: string; time: string; art: ArtKind; playing?: boolean }[] = [\n { title: 'Midnight City Lights', artist: 'Nova Arcade', time: '4:12', art: 'sunset', playing: true },\n { title: 'Paper Planes', artist: 'Juniper Fields', time: '3:27', art: 'rings' },\n { title: 'Tidal', artist: 'Okra & The Moon', time: '5:03', art: 'stripes' },\n { title: 'Slow Burn', artist: 'Halcyon Days', time: '3:48', art: 'grid' },\n { title: 'Northern Line', artist: 'The Lanterns', time: '4:31', art: 'split' },\n];\n\nexport default function PushLayout() {\n const { colors, radius, dark } = useKit();\n const [view, setView] = useState('Listen now');\n const [playing, setPlaying] = useState(true);\n return (\n <Frame>\n <Drawer\n variant=\"push\"\n width={252}\n topInset={STATUS_H}\n header={<DrawerProfile layout=\"stacked\" name=\"Jonas Weber\" email=\"Premium · 2 devices\" />}\n content={\n <>\n {(\n [\n ['home', 'Listen now'],\n ['search', 'Search'],\n ['music', 'Library', 3],\n ['bell', 'New releases', 8, 'accent'],\n ] as [DrawerIconName, string, number?, 'accent'?][]\n ).map(([icon, label, badge, badgeTone]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} badgeTone={badgeTone} active={view === label} onPress={() => setView(label)} />\n ))}\n <DrawerSection title=\"Playlists\" />\n {['Late Night Drive', 'Focus Flow', 'Sunday Coffee'].map((p, i) => (\n <DrawerItem\n key={p}\n icon={<Art kind={(['sunset', 'rings', 'stripes'] as const)[i]} size={22} radiusSize={radius.scale(5)} />}\n label={p}\n active={view === p}\n onPress={() => setView(p)}\n />\n ))}\n </>\n }\n footer={<DrawerItem icon=\"help\" label=\"Help & feedback\" closeOnPress={false} />}\n >\n <Phone>\n <TopBar title={view} right={<IconButton icon=\"search\" label=\"Search music\" />} />\n <View style={{ paddingHorizontal: 16, gap: 14 }}>\n <View\n style={{\n padding: 14,\n gap: 12,\n borderRadius: radius.scale(20),\n backgroundColor: colors.card,\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n shadowColor: dark ? colors.background : colors.foreground,\n shadowOpacity: dark ? 0.4 : 0.06,\n shadowRadius: 14,\n shadowOffset: { width: 0, height: 4 },\n elevation: 2,\n }}\n >\n <View style={{ flexDirection: 'row', gap: 14 }}>\n <Art kind=\"sunset\" size={92} />\n <View style={{ flex: 1, minWidth: 0, justifyContent: 'center', gap: 2 }}>\n <Text style={{ fontSize: 12, color: colors.accent }}>Now playing</Text>\n <Text numberOfLines={1} style={{ fontSize: 17, letterSpacing: -0.3, color: colors.foreground }}>\n Midnight City Lights\n </Text>\n <Text numberOfLines={1} style={{ fontSize: 13.5, color: colors.mutedForeground }}>\n Nova Arcade · Afterglow\n </Text>\n </View>\n </View>\n <View style={{ gap: 6 }}>\n <View style={{ height: 4, borderRadius: radius.capsule(4), backgroundColor: colors.muted, overflow: 'hidden' }}>\n <View style={{ width: '43%', height: '100%', borderRadius: radius.capsule(4), backgroundColor: colors.accent }} />\n </View>\n <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text style={{ fontSize: 11.5, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>1:48</Text>\n <Text style={{ fontSize: 11.5, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>-2:24</Text>\n </View>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 36 }}>\n <Skip color={colors.foreground} back />\n <Pressable\n onPress={() => setPlaying((v) => !v)}\n accessibilityRole=\"button\"\n accessibilityLabel={playing ? 'Pause' : 'Play'}\n style={{ width: 48, height: 48, borderRadius: radius.capsule(48), backgroundColor: colors.accent, alignItems: 'center', justifyContent: 'center' }}\n >\n {playing ? (\n <View style={{ flexDirection: 'row', gap: 5 }}>\n <View style={{ width: 4.5, height: 16, borderRadius: radius.capsule(4.5), backgroundColor: colors.accentForeground }} />\n <View style={{ width: 4.5, height: 16, borderRadius: radius.capsule(4.5), backgroundColor: colors.accentForeground }} />\n </View>\n ) : (\n <View style={{ marginLeft: 3 }}>\n <Tri size={17} color={colors.accentForeground} />\n </View>\n )}\n </Pressable>\n <Skip color={colors.foreground} />\n </View>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between' }}>\n <Text style={{ fontSize: 17, letterSpacing: -0.3, color: colors.foreground }}>Up next</Text>\n <Text style={{ fontSize: 13.5, color: colors.accent }}>See all</Text>\n </View>\n <View style={{ gap: 12 }}>\n {TRACKS.map((t) => (\n <View key={t.title} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>\n <Art kind={t.art} size={44} />\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: 15, color: t.playing ? colors.accent : colors.foreground }}>\n {t.title}\n </Text>\n <Text numberOfLines={1} style={{ fontSize: 13, color: colors.mutedForeground }}>\n {t.artist}\n </Text>\n </View>\n {t.playing ? (\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2, height: 14 }}>\n {[8, 14, 10].map((hh, i) => (\n <View key={i} style={{ width: 3, height: hh, borderRadius: radius.capsule(3), backgroundColor: colors.accent }} />\n ))}\n </View>\n ) : (\n <Text style={{ fontSize: 13, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>{t.time}</Text>\n )}\n </View>\n ))}\n </View>\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n"
196
+ "code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport {\n Drawer,\n DrawerFooter,\n DrawerHeader,\n DrawerIcon,\n DrawerItem,\n DrawerProfile,\n DrawerSection,\n useDrawer,\n type DrawerIconName,\n} from '@/components/ui/drawer';\nimport { alpha, useKit } from '@/lib/kit';\n\nconst STATUS_H = 40;\n\n/** From the Expo Go viewer: `screen` = this IS the phone screen, so no mock frame; `bottomInset` = home indicator. */\ntype DemoProps = { screen?: boolean; bottomInset?: number };\n\n/** True when the demo fills a real phone screen: the frame and the fake status bar step aside. */\nconst ScreenMode = React.createContext(false);\n\n/** Phone-sized frame that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Frame({ style, screen = false, ...rest }: ViewProps & { screen?: boolean }) {\n const { colors, radius } = useKit();\n return (\n <ScreenMode.Provider value={screen}>\n <View\n style={[\n { backgroundColor: colors.background, overflow: 'hidden' },\n screen ? { flex: 1 } : { height: 600, borderRadius: radius.scale(28), borderWidth: StyleSheet.hairlineWidth, borderColor: colors.border },\n style,\n ]}\n {...rest}\n />\n </ScreenMode.Provider>\n );\n}\n\n/** Fake status bar: time, signal and battery, drawn with Views. */\nfunction StatusBar() {\n const { colors, radius } = useKit();\n const ink = colors.foreground;\n return (\n <View style={{ height: STATUS_H, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 24 }}>\n <Text style={{ fontSize: 15, color: ink, fontVariant: ['tabular-nums'] }}>9:41</Text>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2 }}>\n {[4, 6, 8, 10].map((h) => (\n <View key={h} style={{ width: 3, height: h, borderRadius: radius.capsule(3), backgroundColor: ink }} />\n ))}\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>\n <View style={{ width: 22, height: 11, padding: 1.5, borderRadius: radius.scale(3.5), borderWidth: 1, borderColor: alpha(ink, 0.4) }}>\n <View style={{ width: '72%', flex: 1, borderRadius: radius.scale(2), backgroundColor: ink }} />\n </View>\n <View style={{ width: 1.5, height: 4, borderRadius: 1, backgroundColor: alpha(ink, 0.4) }} />\n </View>\n </View>\n </View>\n );\n}\n\n/** The app screen behind the drawer: status bar plus your content. */\nfunction Phone({ children }: { children: React.ReactNode }) {\n const { colors } = useKit();\n const screen = React.useContext(ScreenMode);\n return (\n <View style={{ flex: 1, backgroundColor: colors.background }}>\n {screen ? null : <StatusBar />}\n {children}\n </View>\n );\n}\n\nfunction IconButton({ icon, label, onPress, color }: { icon: DrawerIconName; label: string; onPress?: () => void; color?: string }) {\n const { colors, radius } = useKit();\n return (\n <Pressable\n onPress={onPress}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n style={({ pressed }) => ({\n width: 44,\n height: 44,\n borderRadius: radius.capsule(44),\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: pressed ? colors.muted : 'transparent',\n })}\n >\n <DrawerIcon name={icon} size={22} color={color ?? colors.foreground} />\n </Pressable>\n );\n}\n\n/** The hamburger: toggles the surrounding Drawer through useDrawer(). */\nfunction MenuButton() {\n const { open, setOpen } = useDrawer();\n return <IconButton icon=\"menu\" label=\"Open navigation\" onPress={() => setOpen(!open)} />;\n}\n\n/** A plain inline top bar: hamburger, title (+ subtitle) and trailing actions. */\nfunction TopBar({ title, subtitle, right, menu = true }: { title: string; subtitle?: string; right?: React.ReactNode; menu?: boolean }) {\n const { colors } = useKit();\n return (\n <View style={{ height: 56, flexDirection: 'row', alignItems: 'center', paddingLeft: menu ? 6 : 16, paddingRight: 8, gap: 4 }}>\n {menu ? <MenuButton /> : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: subtitle ? 19 : 22, letterSpacing: -0.4, color: colors.foreground }}>\n {title}\n </Text>\n {subtitle ? (\n <Text numberOfLines={1} style={{ fontSize: 12.5, color: colors.mutedForeground }}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {right}\n </View>\n );\n}\n\ntype ArtKind = 'sunset' | 'grid' | 'rings' | 'stripes' | 'split';\n\n/**\n * Album art drawn with plain Views in theme colours. `size` 0 stretches to the parent width\n * (then pass `height`).\n */\nfunction Art({ kind, size, height, radiusSize }: { kind: ArtKind; size: number; height?: number; radiusSize?: number }) {\n const { colors, radius } = useKit();\n const h = height ?? size;\n const w = size || undefined;\n const d = Math.min(size || h, h);\n const box = {\n width: w,\n alignSelf: size ? undefined : ('stretch' as const),\n height: h,\n borderRadius: radiusSize ?? radius.scale(size > 60 ? 14 : 8),\n overflow: 'hidden' as const,\n };\n const on = colors.accentForeground;\n if (kind === 'sunset') {\n return (\n <View style={[box, { backgroundColor: colors.accent, alignItems: 'center' }]}>\n <View style={{ position: 'absolute', top: h * 0.3, width: d * 0.5, height: d * 0.5, borderRadius: radius.capsule(d), backgroundColor: alpha(on, 0.85) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: 0, height: h * 0.34, backgroundColor: alpha(colors.foreground, 0.35) }} />\n <View style={{ position: 'absolute', left: 0, right: 0, bottom: h * 0.22, height: Math.max(1, h * 0.03), backgroundColor: alpha(on, 0.35) }} />\n </View>\n );\n }\n if (kind === 'grid') {\n const cell = d * 0.18;\n return (\n <View style={[box, { backgroundColor: colors.foreground, alignItems: 'center', justifyContent: 'center' }]}>\n <View style={{ width: cell * 3 + cell * 0.5 * 2, flexDirection: 'row', flexWrap: 'wrap', gap: cell * 0.5 }}>\n {[1, 0.25, 0.6, 0.25, 1, 0.25, 0.6, 0.25, 1].map((a, i) => (\n <View key={i} style={{ width: cell, height: cell, borderRadius: radius.scale(cell * 0.3), backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n if (kind === 'rings') {\n return (\n <View style={[box, { backgroundColor: alpha(colors.accent, 0.16), alignItems: 'center', justifyContent: 'center' }]}>\n {[0.95, 0.7, 0.45, 0.2].map((f) => (\n <View\n key={f}\n style={{\n position: 'absolute',\n width: d * f,\n height: d * f,\n borderRadius: radius.capsule(d),\n borderWidth: Math.max(1.5, d * 0.03),\n borderColor: alpha(colors.accent, 1 - f * 0.6),\n }}\n />\n ))}\n </View>\n );\n }\n if (kind === 'stripes') {\n return (\n <View style={[box, { backgroundColor: colors.muted, justifyContent: 'center', alignItems: 'center' }]}>\n <View style={{ width: d * 1.6, gap: d * 0.07, transform: [{ rotate: '-30deg' }] }}>\n {[0.9, 0.55, 0.3, 0.55, 0.9].map((a, i) => (\n <View key={i} style={{ height: d * 0.1, backgroundColor: alpha(colors.accent, a) }} />\n ))}\n </View>\n </View>\n );\n }\n return (\n <View style={[box, { backgroundColor: colors.foreground, flexDirection: 'row' }]}>\n <View style={{ flex: 1, backgroundColor: colors.accent }} />\n <View style={{ flex: 1 }} />\n <View\n style={{\n position: 'absolute',\n left: (w ?? d) / 2 - d * 0.22,\n top: h / 2 - d * 0.22,\n width: d * 0.44,\n height: d * 0.44,\n borderRadius: radius.capsule(d),\n backgroundColor: colors.background,\n }}\n />\n </View>\n );\n}\n\n/** A right-pointing triangle made from borders (play / skip glyphs). */\nfunction Tri({ size, color, flip }: { size: number; color: string; flip?: boolean }) {\n return (\n <View\n style={{\n width: 0,\n height: 0,\n borderTopWidth: size / 2,\n borderBottomWidth: size / 2,\n borderLeftWidth: size * 0.85,\n borderTopColor: 'transparent',\n borderBottomColor: 'transparent',\n borderLeftColor: color,\n transform: flip ? [{ scaleX: -1 }] : undefined,\n }}\n />\n );\n}\n\nfunction Skip({ color, back }: { color: string; back?: boolean }) {\n const { radius } = useKit();\n return (\n <View style={{ flexDirection: back ? 'row-reverse' : 'row', alignItems: 'center', gap: 1 }}>\n <Tri size={14} color={color} flip={back} />\n <View style={{ width: 2.5, height: 14, borderRadius: radius.capsule(2.5), backgroundColor: color }} />\n </View>\n );\n}\n\nconst TRACKS: { title: string; artist: string; time: string; art: ArtKind; playing?: boolean }[] = [\n { title: 'Midnight City Lights', artist: 'Nova Arcade', time: '4:12', art: 'sunset', playing: true },\n { title: 'Paper Planes', artist: 'Juniper Fields', time: '3:27', art: 'rings' },\n { title: 'Tidal', artist: 'Okra & The Moon', time: '5:03', art: 'stripes' },\n { title: 'Slow Burn', artist: 'Halcyon Days', time: '3:48', art: 'grid' },\n { title: 'Northern Line', artist: 'The Lanterns', time: '4:31', art: 'split' },\n];\n\nexport default function PushLayout({ screen, bottomInset }: DemoProps) {\n const { colors, radius, dark } = useKit();\n const [view, setView] = useState('Listen now');\n const [playing, setPlaying] = useState(true);\n return (\n <Frame screen={screen}>\n <Drawer\n variant=\"push\"\n width={252}\n topInset={screen ? undefined : STATUS_H}\n bottomInset={bottomInset}\n header={<DrawerProfile layout=\"stacked\" name=\"Jonas Weber\" email=\"Premium · 2 devices\" />}\n content={\n <>\n {(\n [\n ['home', 'Listen now'],\n ['search', 'Search'],\n ['music', 'Library', 3],\n ['bell', 'New releases', 8, 'accent'],\n ] as [DrawerIconName, string, number?, 'accent'?][]\n ).map(([icon, label, badge, badgeTone]) => (\n <DrawerItem key={label} icon={icon} label={label} badge={badge} badgeTone={badgeTone} active={view === label} onPress={() => setView(label)} />\n ))}\n <DrawerSection title=\"Playlists\" />\n {['Late Night Drive', 'Focus Flow', 'Sunday Coffee'].map((p, i) => (\n <DrawerItem\n key={p}\n icon={<Art kind={(['sunset', 'rings', 'stripes'] as const)[i]} size={22} radiusSize={radius.scale(5)} />}\n label={p}\n active={view === p}\n onPress={() => setView(p)}\n />\n ))}\n </>\n }\n footer={<DrawerItem icon=\"help\" label=\"Help & feedback\" closeOnPress={false} />}\n >\n <Phone>\n <TopBar title={view} right={<IconButton icon=\"search\" label=\"Search music\" />} />\n <View style={{ paddingHorizontal: 16, gap: 14 }}>\n <View\n style={{\n padding: 14,\n gap: 12,\n borderRadius: radius.scale(20),\n backgroundColor: colors.card,\n borderWidth: StyleSheet.hairlineWidth,\n borderColor: colors.border,\n shadowColor: dark ? colors.background : colors.foreground,\n shadowOpacity: dark ? 0.4 : 0.06,\n shadowRadius: 14,\n shadowOffset: { width: 0, height: 4 },\n elevation: 2,\n }}\n >\n <View style={{ flexDirection: 'row', gap: 14 }}>\n <Art kind=\"sunset\" size={92} />\n <View style={{ flex: 1, minWidth: 0, justifyContent: 'center', gap: 2 }}>\n <Text style={{ fontSize: 12, color: colors.accent }}>Now playing</Text>\n <Text numberOfLines={1} style={{ fontSize: 17, letterSpacing: -0.3, color: colors.foreground }}>\n Midnight City Lights\n </Text>\n <Text numberOfLines={1} style={{ fontSize: 13.5, color: colors.mutedForeground }}>\n Nova Arcade · Afterglow\n </Text>\n </View>\n </View>\n <View style={{ gap: 6 }}>\n <View style={{ height: 4, borderRadius: radius.capsule(4), backgroundColor: colors.muted, overflow: 'hidden' }}>\n <View style={{ width: '43%', height: '100%', borderRadius: radius.capsule(4), backgroundColor: colors.accent }} />\n </View>\n <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text style={{ fontSize: 11.5, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>1:48</Text>\n <Text style={{ fontSize: 11.5, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>-2:24</Text>\n </View>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 36 }}>\n <Skip color={colors.foreground} back />\n <Pressable\n onPress={() => setPlaying((v) => !v)}\n accessibilityRole=\"button\"\n accessibilityLabel={playing ? 'Pause' : 'Play'}\n style={{ width: 48, height: 48, borderRadius: radius.capsule(48), backgroundColor: colors.accent, alignItems: 'center', justifyContent: 'center' }}\n >\n {playing ? (\n <View style={{ flexDirection: 'row', gap: 5 }}>\n <View style={{ width: 4.5, height: 16, borderRadius: radius.capsule(4.5), backgroundColor: colors.accentForeground }} />\n <View style={{ width: 4.5, height: 16, borderRadius: radius.capsule(4.5), backgroundColor: colors.accentForeground }} />\n </View>\n ) : (\n <View style={{ marginLeft: 3 }}>\n <Tri size={17} color={colors.accentForeground} />\n </View>\n )}\n </Pressable>\n <Skip color={colors.foreground} />\n </View>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between' }}>\n <Text style={{ fontSize: 17, letterSpacing: -0.3, color: colors.foreground }}>Up next</Text>\n <Text style={{ fontSize: 13.5, color: colors.accent }}>See all</Text>\n </View>\n <View style={{ gap: 12 }}>\n {TRACKS.map((t) => (\n <View key={t.title} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>\n <Art kind={t.art} size={44} />\n <View style={{ flex: 1, minWidth: 0 }}>\n <Text numberOfLines={1} style={{ fontSize: 15, color: t.playing ? colors.accent : colors.foreground }}>\n {t.title}\n </Text>\n <Text numberOfLines={1} style={{ fontSize: 13, color: colors.mutedForeground }}>\n {t.artist}\n </Text>\n </View>\n {t.playing ? (\n <View style={{ flexDirection: 'row', alignItems: 'flex-end', gap: 2, height: 14 }}>\n {[8, 14, 10].map((hh, i) => (\n <View key={i} style={{ width: 3, height: hh, borderRadius: radius.capsule(3), backgroundColor: colors.accent }} />\n ))}\n </View>\n ) : (\n <Text style={{ fontSize: 13, color: colors.mutedForeground, fontVariant: ['tabular-nums'] }}>{t.time}</Text>\n )}\n </View>\n ))}\n </View>\n </View>\n </Phone>\n </Drawer>\n </Frame>\n );\n}\n"
169
197
  }
170
198
  ]
171
199
  }
@@ -6,6 +6,7 @@
6
6
  "files": [
7
7
  "src/components/ui/fab.tsx"
8
8
  ],
9
+ "summary": "A floating action button that fans out a staggered speed dial as its plus turns to ×.",
9
10
  "props": [
10
11
  [
11
12
  "actions",
@@ -116,5 +117,28 @@
116
117
  "Style for the absolutely positioned stack holding the main button and list actions."
117
118
  ]
118
119
  ],
120
+ "behavior": [
121
+ [
122
+ "Touch",
123
+ "Tapping the button opens the speed dial over an optional dimmed backdrop; tapping the backdrop closes it. Without actions it just calls onPress."
124
+ ],
125
+ [
126
+ "Motion",
127
+ "Actions spring out one after another as a labelled list or an arc. An extended FAB springs between a pill and a circle, and pulse loops a ring around it."
128
+ ],
129
+ [
130
+ "Reduced motion",
131
+ "The pulse ring stays off when reduce motion is on."
132
+ ],
133
+ [
134
+ "Haptics",
135
+ "A light impact when the button opens or closes the dial, or fires onPress."
136
+ ],
137
+ [
138
+ "Screen readers",
139
+ "The main button and each action are buttons; the main button reads \"Open actions\" / \"Close actions\" with an expanded state when it has a dial."
140
+ ]
141
+ ],
142
+ "usage": null,
119
143
  "examples": []
120
144
  }
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "fintech-app",
3
+ "category": "Templates",
4
+ "aliases": [],
5
+ "exportName": null,
6
+ "files": [
7
+ "src/app/(tabs)/_layout.tsx",
8
+ "src/app/(tabs)/cards.tsx",
9
+ "src/app/(tabs)/index.tsx",
10
+ "src/app/(tabs)/pay.tsx",
11
+ "src/app/(tabs)/profile.tsx",
12
+ "src/app/_layout.tsx",
13
+ "src/app/onboarding.tsx",
14
+ "src/app/settings.tsx",
15
+ "src/app/sign-in.tsx",
16
+ "src/components/fintech-app/cards-screen.tsx",
17
+ "src/components/fintech-app/pay-screen.tsx",
18
+ "src/components/fintech-app/tabs.tsx",
19
+ "src/lib/fintech-app/data.tsx",
20
+ "src/lib/fintech-app/session.tsx",
21
+ "src/lib/fintech-app/wallet.tsx"
22
+ ],
23
+ "summary": null,
24
+ "props": [],
25
+ "behavior": [
26
+ [
27
+ "Flow",
28
+ "Onboarding shows once, then phone number + one-time code, then the tabs. Signing out returns to sign in. The session is saved on the device (AsyncStorage) and guarded with Expo Router’s Stack.Protected."
29
+ ],
30
+ [
31
+ "Tabs",
32
+ "Home (scrubbable revenue chart, KPIs, pull to refresh), Cards (swipe between cards, reveal the number or CVV, freeze), Pay (payee, amount, slide to send) and Profile."
33
+ ],
34
+ [
35
+ "Payments",
36
+ "A transfer made on Pay appears at the top of Home’s transactions straight away. The send itself is a stand-in — call your payments API from the slider’s onConfirm."
37
+ ],
38
+ [
39
+ "Settings",
40
+ "Pushed from Profile. Appearance (System / Light / Dark) re-themes every kit component instantly."
41
+ ],
42
+ [
43
+ "Your backend",
44
+ "SMS code handlers in app/sign-in.tsx and the transfer in components/fintech-app/pay-screen.tsx are stand-ins that wait and succeed. Cards, payees and the dashboard numbers live in lib/fintech-app/data.tsx."
45
+ ]
46
+ ],
47
+ "usage": null,
48
+ "examples": []
49
+ }
@@ -6,6 +6,7 @@
6
6
  "files": [
7
7
  "src/components/ui/flip-card.tsx"
8
8
  ],
9
+ "summary": "A two-sided card that turns over in 3D, lifting toward you half-way through.",
9
10
  "props": [
10
11
  [
11
12
  "front",
@@ -86,6 +87,21 @@
86
87
  "Style for the root (width, margins)."
87
88
  ]
88
89
  ],
90
+ "behavior": [
91
+ [
92
+ "Touch",
93
+ "Tap to flip. With trigger 'none' it only turns when you change flipped from outside."
94
+ ],
95
+ [
96
+ "Motion",
97
+ "A gentle spring turns the card around its vertical or horizontal axis while the shadow beneath narrows as it goes edge-on. Faces swap exactly at 90° so Android never flickers."
98
+ ],
99
+ [
100
+ "Screen readers",
101
+ "The card is a button whose hint says which side is showing, with an expanded state when flipped. The hidden face is hidden from screen readers."
102
+ ]
103
+ ],
104
+ "usage": "import { FlipCard } from '@/components/ui/flip-card';\n\n<FlipCard\n accessibilityLabel=\"Boarding pass\"\n front={<PassFront flight=\"LH 402\" />}\n back={<PassBarcode code=\"ZK7Q2P\" />}\n/>",
89
105
  "examples": [
90
106
  {
91
107
  "name": "Polaroid",