@expokit/cli 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +46 -2
- package/bin/expo-kit.js +1266 -0
- package/bin/lib.mjs +343 -0
- package/bin/mcp.mjs +345 -0
- package/package.json +49 -4
- package/registry/_docs/accordion.json +115 -0
- package/registry/_docs/action-sheet.json +138 -0
- package/registry/_docs/alert.json +155 -0
- package/registry/_docs/avatar.json +227 -0
- package/registry/_docs/badge.json +148 -0
- package/registry/_docs/bottom-nav.json +143 -0
- package/registry/_docs/bottom-sheet.json +186 -0
- package/registry/_docs/bullet.json +27 -0
- package/registry/_docs/button-3d.json +138 -0
- package/registry/_docs/button.json +131 -0
- package/registry/_docs/calendar.json +198 -0
- package/registry/_docs/card-stack.json +124 -0
- package/registry/_docs/card.json +131 -0
- package/registry/_docs/carousel.json +122 -0
- package/registry/_docs/chat.json +184 -0
- package/registry/_docs/checkbox.json +109 -0
- package/registry/_docs/checkout.json +105 -0
- package/registry/_docs/chip-group.json +132 -0
- package/registry/_docs/color-swatch.json +82 -0
- package/registry/_docs/confetti.json +102 -0
- package/registry/_docs/coupon.json +192 -0
- package/registry/_docs/cube-pager.json +100 -0
- package/registry/_docs/dashboard.json +123 -0
- package/registry/_docs/date-picker.json +269 -0
- package/registry/_docs/dialog.json +186 -0
- package/registry/_docs/drawer.json +199 -0
- package/registry/_docs/fab.json +144 -0
- package/registry/_docs/flip-card.json +127 -0
- package/registry/_docs/floating-input.json +211 -0
- package/registry/_docs/gift-card.json +124 -0
- package/registry/_docs/glass-button.json +142 -0
- package/registry/_docs/glass-nav-bar.json +102 -0
- package/registry/_docs/glass-search-bar.json +114 -0
- package/registry/_docs/glass-segmented.json +94 -0
- package/registry/_docs/glass-sheet.json +136 -0
- package/registry/_docs/glass-tab-bar.json +100 -0
- package/registry/_docs/glass.json +94 -0
- package/registry/_docs/inbox.json +75 -0
- package/registry/_docs/isometric-bar.json +75 -0
- package/registry/_docs/kit.json +14 -0
- package/registry/_docs/kpi-card.json +14 -0
- package/registry/_docs/like-button.json +92 -0
- package/registry/_docs/liquidglass-tab.json +30 -0
- package/registry/_docs/list-item.json +216 -0
- package/registry/_docs/loyalty-card.json +124 -0
- package/registry/_docs/morph-button.json +128 -0
- package/registry/_docs/number-ticker.json +112 -0
- package/registry/_docs/offers.json +81 -0
- package/registry/_docs/onboarding.json +69 -0
- package/registry/_docs/otp-input.json +158 -0
- package/registry/_docs/pagination-dots.json +108 -0
- package/registry/_docs/parallax-layers.json +104 -0
- package/registry/_docs/parallax-scroll.json +210 -0
- package/registry/_docs/password-input.json +112 -0
- package/registry/_docs/payment-card.json +169 -0
- package/registry/_docs/pixel-bar.json +69 -0
- package/registry/_docs/polar-area.json +81 -0
- package/registry/_docs/profile.json +87 -0
- package/registry/_docs/progress-steps.json +116 -0
- package/registry/_docs/progress.json +152 -0
- package/registry/_docs/radio-group.json +112 -0
- package/registry/_docs/rating.json +114 -0
- package/registry/_docs/ring-carousel.json +122 -0
- package/registry/_docs/scratch-card.json +110 -0
- package/registry/_docs/search-bar.json +160 -0
- package/registry/_docs/search-results.json +123 -0
- package/registry/_docs/segmented-control.json +123 -0
- package/registry/_docs/select.json +277 -0
- package/registry/_docs/settings.json +75 -0
- package/registry/_docs/shimmer-button.json +98 -0
- package/registry/_docs/sign-in.json +201 -0
- package/registry/_docs/skeleton.json +162 -0
- package/registry/_docs/slide-to-confirm.json +108 -0
- package/registry/_docs/slider.json +177 -0
- package/registry/_docs/spin-wheel.json +138 -0
- package/registry/_docs/spinner.json +121 -0
- package/registry/_docs/stateful-button.json +184 -0
- package/registry/_docs/stepper.json +184 -0
- package/registry/_docs/swipe-deck.json +118 -0
- package/registry/_docs/swipeable-row.json +95 -0
- package/registry/_docs/switch.json +124 -0
- package/registry/_docs/tabs.json +129 -0
- package/registry/_docs/tag-input.json +148 -0
- package/registry/_docs/text-animation.json +141 -0
- package/registry/_docs/textarea.json +191 -0
- package/registry/_docs/ticket-card.json +194 -0
- package/registry/_docs/ticket-shape.json +14 -0
- package/registry/_docs/tilt-card.json +157 -0
- package/registry/_docs/time-picker.json +269 -0
- package/registry/_docs/timeline-chart.json +33 -0
- package/registry/_docs/timeline.json +172 -0
- package/registry/_docs/toast.json +185 -0
- package/registry/_docs/treemap.json +33 -0
- package/registry/_docs/waterfall.json +39 -0
- package/registry/_docs/wheel-list.json +122 -0
- package/registry/accordion/files/src/components/ui/accordion.tsx +233 -0
- package/registry/accordion/files/src/lib/kit.tsx +219 -0
- package/registry/accordion.json +17 -0
- package/registry/action-sheet/files/src/components/ui/action-sheet.tsx +580 -0
- package/registry/action-sheet/files/src/lib/kit.tsx +219 -0
- package/registry/action-sheet.json +18 -0
- package/registry/alert/files/src/components/ui/alert.tsx +654 -0
- package/registry/alert/files/src/components/ui/button.tsx +274 -0
- package/registry/alert/files/src/lib/kit.tsx +219 -0
- package/registry/alert.json +20 -0
- package/registry/avatar/files/src/components/ui/avatar.tsx +790 -0
- package/registry/avatar/files/src/lib/kit.tsx +219 -0
- package/registry/avatar.json +18 -0
- package/registry/badge/files/src/components/ui/badge.tsx +626 -0
- package/registry/badge/files/src/lib/kit.tsx +219 -0
- package/registry/badge.json +17 -0
- package/registry/bottom-nav/files/src/components/ui/bottom-nav.tsx +1050 -0
- package/registry/bottom-nav/files/src/lib/kit.tsx +219 -0
- package/registry/bottom-nav.json +18 -0
- package/registry/bottom-sheet/files/src/components/ui/bottom-sheet.tsx +585 -0
- package/registry/bottom-sheet/files/src/lib/kit.tsx +219 -0
- package/registry/bottom-sheet.json +17 -0
- package/registry/bullet.json +14 -0
- package/registry/button/files/src/components/ui/button.tsx +274 -0
- package/registry/button/files/src/lib/kit.tsx +219 -0
- package/registry/button-3d/files/src/components/ui/button-3d.tsx +212 -0
- package/registry/button-3d/files/src/lib/kit.tsx +219 -0
- package/registry/button-3d.json +18 -0
- package/registry/button.json +18 -0
- package/registry/calendar/files/src/components/ui/calendar.tsx +822 -0
- package/registry/calendar/files/src/lib/kit.tsx +219 -0
- package/registry/calendar.json +17 -0
- package/registry/card/files/src/components/ui/card.tsx +300 -0
- package/registry/card/files/src/lib/kit.tsx +219 -0
- package/registry/card-stack.json +15 -0
- package/registry/card.json +17 -0
- package/registry/carousel.json +15 -0
- package/registry/chat.json +18 -0
- package/registry/checkbox/files/src/components/ui/checkbox.tsx +150 -0
- package/registry/checkbox/files/src/lib/kit.tsx +219 -0
- package/registry/checkbox.json +17 -0
- package/registry/checkout.json +26 -0
- package/registry/chip-group/files/src/components/ui/chip-group.tsx +269 -0
- package/registry/chip-group/files/src/lib/kit.tsx +219 -0
- package/registry/chip-group.json +17 -0
- package/registry/color-swatch.json +17 -0
- package/registry/confetti/files/src/components/ui/confetti.tsx +222 -0
- package/registry/confetti/files/src/lib/kit.tsx +219 -0
- package/registry/confetti.json +15 -0
- package/registry/coupon/files/src/components/ui/coupon.tsx +698 -0
- package/registry/coupon/files/src/components/ui/flip-card.tsx +205 -0
- package/registry/coupon/files/src/components/ui/tilt-card.tsx +635 -0
- package/registry/coupon/files/src/lib/kit.tsx +219 -0
- package/registry/coupon/files/src/lib/ticket-shape.tsx +543 -0
- package/registry/coupon.json +23 -0
- package/registry/cube-pager.json +15 -0
- package/registry/dashboard.json +32 -0
- package/registry/date-picker/files/src/components/ui/calendar.tsx +822 -0
- package/registry/date-picker/files/src/components/ui/date-picker.tsx +796 -0
- package/registry/date-picker/files/src/lib/kit.tsx +219 -0
- package/registry/date-picker.json +19 -0
- package/registry/dialog/files/src/components/ui/dialog.tsx +759 -0
- package/registry/dialog/files/src/lib/kit.tsx +219 -0
- package/registry/dialog.json +18 -0
- package/registry/drawer/files/src/components/ui/drawer.tsx +1135 -0
- package/registry/drawer/files/src/lib/kit.tsx +219 -0
- package/registry/drawer.json +18 -0
- package/registry/fab.json +18 -0
- package/registry/flip-card/files/src/components/ui/flip-card.tsx +205 -0
- package/registry/flip-card/files/src/lib/kit.tsx +219 -0
- package/registry/flip-card.json +15 -0
- package/registry/floating-input/files/src/components/ui/floating-input.tsx +528 -0
- package/registry/floating-input/files/src/lib/kit.tsx +219 -0
- package/registry/floating-input.json +17 -0
- package/registry/gift-card.json +21 -0
- package/registry/glass-button.json +22 -0
- package/registry/glass-nav-bar.json +21 -0
- package/registry/glass-search-bar.json +21 -0
- package/registry/glass-segmented.json +22 -0
- package/registry/glass-sheet.json +22 -0
- package/registry/glass-tab-bar.json +22 -0
- package/registry/glass.json +19 -0
- package/registry/inbox.json +30 -0
- package/registry/isometric-bar.json +14 -0
- package/registry/kit/files/src/lib/kit.tsx +219 -0
- package/registry/kit.json +11 -0
- package/registry/kpi-card/files/src/components/charts/kpi-card.tsx +45 -0
- package/registry/kpi-card.json +14 -0
- package/registry/like-button.json +18 -0
- package/registry/liquidglass-tab/files/src/app/(tabs)/_layout.tsx +97 -0
- package/registry/liquidglass-tab/files/src/app/(tabs)/alerts.tsx +5 -0
- package/registry/liquidglass-tab/files/src/app/(tabs)/explore.tsx +5 -0
- package/registry/liquidglass-tab/files/src/app/(tabs)/index.tsx +5 -0
- package/registry/liquidglass-tab/files/src/app/(tabs)/profile.tsx +5 -0
- package/registry/liquidglass-tab/files/src/app/_layout.tsx +33 -0
- package/registry/liquidglass-tab/files/src/components/GlassTabBar.tsx +259 -0
- package/registry/liquidglass-tab/files/src/components/TabScreen.tsx +122 -0
- package/registry/liquidglass-tab/files/src/lib/tab-bar.ts +61 -0
- package/registry/liquidglass-tab/files/src/lib/tab-icons.ts +130 -0
- package/registry/liquidglass-tab/files/src/lib/tabs.ts +108 -0
- package/registry/liquidglass-tab.json +23 -0
- package/registry/list-item/files/src/components/ui/list-item.tsx +508 -0
- package/registry/list-item/files/src/lib/kit.tsx +219 -0
- package/registry/list-item.json +17 -0
- package/registry/loyalty-card.json +23 -0
- package/registry/morph-button.json +18 -0
- package/registry/number-ticker.json +15 -0
- package/registry/offers.json +24 -0
- package/registry/onboarding.json +17 -0
- package/registry/otp-input/files/src/components/ui/otp-input.tsx +380 -0
- package/registry/otp-input/files/src/lib/kit.tsx +219 -0
- package/registry/otp-input.json +17 -0
- package/registry/pagination-dots/files/src/components/ui/pagination-dots.tsx +262 -0
- package/registry/pagination-dots/files/src/lib/kit.tsx +219 -0
- package/registry/pagination-dots.json +15 -0
- package/registry/parallax-layers.json +15 -0
- package/registry/parallax-scroll.json +17 -0
- package/registry/password-input/files/src/components/ui/floating-input.tsx +528 -0
- package/registry/password-input/files/src/components/ui/password-input.tsx +271 -0
- package/registry/password-input/files/src/lib/kit.tsx +219 -0
- package/registry/password-input.json +19 -0
- package/registry/payment-card/files/src/components/ui/flip-card.tsx +205 -0
- package/registry/payment-card/files/src/components/ui/payment-card.tsx +385 -0
- package/registry/payment-card/files/src/components/ui/tilt-card.tsx +635 -0
- package/registry/payment-card/files/src/lib/kit.tsx +219 -0
- package/registry/payment-card.json +21 -0
- package/registry/pixel-bar.json +14 -0
- package/registry/polar-area.json +14 -0
- package/registry/profile.json +17 -0
- package/registry/progress/files/src/components/ui/progress.tsx +883 -0
- package/registry/progress/files/src/lib/kit.tsx +219 -0
- package/registry/progress-steps/files/src/components/ui/progress-steps.tsx +559 -0
- package/registry/progress-steps/files/src/lib/kit.tsx +219 -0
- package/registry/progress-steps.json +18 -0
- package/registry/progress.json +17 -0
- package/registry/radio-group/files/src/components/ui/radio-group.tsx +327 -0
- package/registry/radio-group/files/src/lib/kit.tsx +219 -0
- package/registry/radio-group.json +18 -0
- package/registry/rating.json +18 -0
- package/registry/ring-carousel.json +15 -0
- package/registry/scratch-card.json +18 -0
- package/registry/search-bar/files/src/components/ui/search-bar.tsx +530 -0
- package/registry/search-bar/files/src/lib/kit.tsx +219 -0
- package/registry/search-bar.json +17 -0
- package/registry/search-results.json +30 -0
- package/registry/segmented-control/files/src/components/ui/segmented-control.tsx +341 -0
- package/registry/segmented-control/files/src/lib/kit.tsx +219 -0
- package/registry/segmented-control.json +18 -0
- package/registry/select/files/src/components/ui/select.tsx +1398 -0
- package/registry/select/files/src/lib/kit.tsx +219 -0
- package/registry/select.json +17 -0
- package/registry/settings.json +26 -0
- package/registry/shimmer-button.json +17 -0
- package/registry/sign-in.json +26 -0
- package/registry/skeleton/files/src/components/ui/skeleton.tsx +799 -0
- package/registry/skeleton/files/src/lib/kit.tsx +219 -0
- package/registry/skeleton.json +17 -0
- package/registry/slide-to-confirm.json +18 -0
- package/registry/slider/files/src/components/ui/slider.tsx +716 -0
- package/registry/slider/files/src/lib/kit.tsx +219 -0
- package/registry/slider.json +17 -0
- package/registry/spin-wheel.json +18 -0
- package/registry/spinner/files/src/components/ui/spinner.tsx +748 -0
- package/registry/spinner/files/src/lib/kit.tsx +219 -0
- package/registry/spinner.json +17 -0
- package/registry/stateful-button/files/src/components/ui/stateful-button.tsx +532 -0
- package/registry/stateful-button/files/src/lib/kit.tsx +219 -0
- package/registry/stateful-button.json +18 -0
- package/registry/stepper/files/src/components/ui/stepper.tsx +646 -0
- package/registry/stepper/files/src/lib/kit.tsx +219 -0
- package/registry/stepper.json +17 -0
- package/registry/swipe-deck.json +15 -0
- package/registry/swipeable-row.json +15 -0
- package/registry/switch/files/src/components/ui/switch.tsx +344 -0
- package/registry/switch/files/src/lib/kit.tsx +219 -0
- package/registry/switch.json +18 -0
- package/registry/tabs/files/src/components/ui/tabs.tsx +539 -0
- package/registry/tabs/files/src/lib/kit.tsx +219 -0
- package/registry/tabs.json +17 -0
- package/registry/tag-input/files/src/components/ui/tag-input.tsx +720 -0
- package/registry/tag-input/files/src/lib/kit.tsx +219 -0
- package/registry/tag-input.json +17 -0
- package/registry/text-animation/files/src/components/ui/text-animation.tsx +650 -0
- package/registry/text-animation/files/src/lib/kit.tsx +219 -0
- package/registry/text-animation.json +15 -0
- package/registry/textarea/files/src/components/ui/textarea.tsx +553 -0
- package/registry/textarea/files/src/lib/kit.tsx +219 -0
- package/registry/textarea.json +17 -0
- package/registry/ticket-card.json +24 -0
- package/registry/ticket-shape/files/src/lib/kit.tsx +219 -0
- package/registry/ticket-shape/files/src/lib/ticket-shape.tsx +543 -0
- package/registry/ticket-shape.json +17 -0
- package/registry/tilt-card/files/src/components/ui/tilt-card.tsx +635 -0
- package/registry/tilt-card/files/src/lib/kit.tsx +219 -0
- package/registry/tilt-card.json +17 -0
- package/registry/time-picker/files/src/components/ui/time-picker.tsx +1159 -0
- package/registry/time-picker/files/src/lib/kit.tsx +219 -0
- package/registry/time-picker.json +17 -0
- package/registry/timeline/files/src/components/ui/avatar.tsx +790 -0
- package/registry/timeline/files/src/components/ui/timeline.tsx +1059 -0
- package/registry/timeline/files/src/lib/kit.tsx +219 -0
- package/registry/timeline-chart.json +14 -0
- package/registry/timeline.json +20 -0
- package/registry/toast/files/src/components/ui/button.tsx +274 -0
- package/registry/toast/files/src/components/ui/toast.tsx +1284 -0
- package/registry/toast/files/src/lib/kit.tsx +219 -0
- package/registry/toast.json +20 -0
- package/registry/treemap.json +14 -0
- package/registry/waterfall.json +14 -0
- package/registry/wheel-list.json +17 -0
- package/schema/components.schema.json +13 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stepper",
|
|
3
|
+
"category": "Inputs",
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"exportName": "Stepper",
|
|
6
|
+
"files": [
|
|
7
|
+
"src/components/ui/stepper.tsx"
|
|
8
|
+
],
|
|
9
|
+
"summary": "A quantity stepper whose digits roll up or down as the number changes.",
|
|
10
|
+
"props": [
|
|
11
|
+
[
|
|
12
|
+
"value / defaultValue",
|
|
13
|
+
"number",
|
|
14
|
+
"min or 0",
|
|
15
|
+
"Controlled or uncontrolled value."
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"onValueChange",
|
|
19
|
+
"(value) => void",
|
|
20
|
+
"—",
|
|
21
|
+
"Called on every step."
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"min / max",
|
|
25
|
+
"number",
|
|
26
|
+
"0 / ∞",
|
|
27
|
+
"Limits; the matching button dims and a press past it bumps the number."
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"step",
|
|
31
|
+
"number",
|
|
32
|
+
"1",
|
|
33
|
+
"Increment (decimals are respected, e.g. 0.5)."
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"variant",
|
|
37
|
+
"\"outline\" | \"filled\" | \"cart\" | \"compact\"",
|
|
38
|
+
"\"outline\"",
|
|
39
|
+
"Round outlined buttons, one tinted capsule, an accent cart button that collapses to + at 0, or small tinted buttons. Old names still work: default → outline, pill / segmented → filled, vertical → filled + vertical."
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"size",
|
|
43
|
+
"\"sm\" | \"md\" | \"lg\"",
|
|
44
|
+
"\"md\"",
|
|
45
|
+
"32 / 36 / 44pt buttons (touch area always ≥ 44pt); the number and icons scale too. compact is always 28pt."
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"orientation",
|
|
49
|
+
"\"horizontal\" | \"vertical\"",
|
|
50
|
+
"\"horizontal\"",
|
|
51
|
+
"Stack + / number / − (outline, filled, compact)."
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"format",
|
|
55
|
+
"(value) => string",
|
|
56
|
+
"—",
|
|
57
|
+
"Display format, e.g. currency; every changed character rolls."
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"suffix",
|
|
61
|
+
"string | (value) => string",
|
|
62
|
+
"—",
|
|
63
|
+
"Muted unit after the number: \"kg\", or (n) => n === 1 ? \"night\" : \"nights\"."
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"addLabel",
|
|
67
|
+
"string",
|
|
68
|
+
"—",
|
|
69
|
+
"cart: text beside the + while collapsed, e.g. \"Add\"."
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"repeat",
|
|
73
|
+
"boolean",
|
|
74
|
+
"true",
|
|
75
|
+
"Hold to keep stepping, speeding up."
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"label",
|
|
79
|
+
"string",
|
|
80
|
+
"—",
|
|
81
|
+
"Title on the left; the control moves to the right edge."
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"description",
|
|
85
|
+
"string",
|
|
86
|
+
"—",
|
|
87
|
+
"Muted line under the label."
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"disabled",
|
|
91
|
+
"boolean",
|
|
92
|
+
"false",
|
|
93
|
+
"Dims and blocks the control."
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"accent",
|
|
97
|
+
"string",
|
|
98
|
+
"theme accent",
|
|
99
|
+
"Icons (filled, compact), press tint (outline), fill (cart)."
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"iconColor",
|
|
103
|
+
"string",
|
|
104
|
+
"—",
|
|
105
|
+
"Overrides the − / + icon colour."
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"accessibilityLabel",
|
|
109
|
+
"string",
|
|
110
|
+
"label",
|
|
111
|
+
"Read by screen readers; the control is adjustable (swipe up / down)."
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"style",
|
|
115
|
+
"StyleProp<ViewStyle>",
|
|
116
|
+
"—",
|
|
117
|
+
"The control, or the whole row when label / description is set."
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"buttonStyle",
|
|
121
|
+
"StyleProp<ViewStyle>",
|
|
122
|
+
"—",
|
|
123
|
+
"Applied to each − / + button."
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"valueStyle",
|
|
127
|
+
"StyleProp<TextStyle>",
|
|
128
|
+
"—",
|
|
129
|
+
"Applied to the number (fontSize, colour, weight)."
|
|
130
|
+
]
|
|
131
|
+
],
|
|
132
|
+
"behavior": [
|
|
133
|
+
[
|
|
134
|
+
"Touch",
|
|
135
|
+
"Hold a button to keep stepping, speeding up as you hold. The cart variant opens from a single + into − 1 +, with a trash can at 1."
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"Motion",
|
|
139
|
+
"Each changed character slides out as the new one slides in; buttons spring on press and a press past min or max gives a small bump."
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"Screen readers",
|
|
143
|
+
"One adjustable element with min, max and the formatted value (suffix included), plus 'Increase' and 'Decrease' actions."
|
|
144
|
+
]
|
|
145
|
+
],
|
|
146
|
+
"usage": "import { useState } from 'react';\nimport { Stepper } from '@/components/ui/stepper';\n\nconst [guests, setGuests] = useState(2);\n<Stepper value={guests} onValueChange={setGuests} min={1} max={16} label=\"Guests\" />",
|
|
147
|
+
"examples": [
|
|
148
|
+
{
|
|
149
|
+
"name": "Cart",
|
|
150
|
+
"title": "Cart",
|
|
151
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst eyebrow = { fontSize: 12, fontWeight: '400', letterSpacing: 0.6, textTransform: 'uppercase' } as const;\n\nconst money = (n: number) => {\n const [int, frac] = n.toFixed(2).split('.');\n return `₹${int.replace(/(\\d)(?=(\\d\\d)+\\d$)/g, '$1,')}${frac === '00' ? '' : `.${frac}`}`;\n};\n\nconst MENU = [\n { key: 'bowl', emoji: '🥗', name: 'Harvest bowl', note: 'Kale, squash, tahini', price: 349 },\n { key: 'ramen', emoji: '🍜', name: 'Miso ramen', note: 'Spicy · extra egg', price: 420 },\n { key: 'mochi', emoji: '🍡', name: 'Mochi trio', note: 'Matcha, yuzu, sesame', price: 180 },\n];\n\nexport default function Cart() {\n const { colors, radius } = useKit();\n const [qty, setQty] = useState<Record<string, number>>({ bowl: 1, ramen: 2, mochi: 0 });\n const total = MENU.reduce((sum, it) => sum + it.price * (qty[it.key] ?? 0), 0);\n return (\n <Card>\n <Text style={[eyebrow, { color: colors.mutedForeground }]}>Your order</Text>\n {MENU.map((it) => (\n <View key={it.key} style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>\n <View style={{ width: 44, height: 44, borderRadius: radius.scale(12), backgroundColor: colors.muted, alignItems: 'center', justifyContent: 'center' }}>\n <Text style={{ fontSize: 22 }}>{it.emoji}</Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={{ fontSize: 15, fontWeight: '400', color: colors.foreground }}>{it.name}</Text>\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>{money(it.price)} · {it.note}</Text>\n </View>\n <Stepper\n variant=\"cart\"\n size=\"sm\"\n value={qty[it.key]}\n onValueChange={(n) => setQty((q) => ({ ...q, [it.key]: n }))}\n max={9}\n accessibilityLabel={`${it.name} quantity`}\n />\n </View>\n ))}\n <View style={{ height: StyleSheet.hairlineWidth, backgroundColor: colors.border }} />\n <View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'baseline' }}>\n <Text style={{ fontSize: 15, fontWeight: '400', color: colors.foreground }}>Subtotal</Text>\n <Text style={{ fontSize: 18, fontWeight: '400', color: colors.foreground, fontVariant: ['tabular-nums'] }}>{money(total)}</Text>\n </View>\n </Card>\n );\n}\n"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "Guests",
|
|
155
|
+
"title": "Guests",
|
|
156
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nexport default function Guests() {\n const { colors } = useKit();\n const [adults, setAdults] = useState(2);\n const [children, setChildren] = useState(0);\n const [infants, setInfants] = useState(0);\n const cap = 6;\n const rule = <View style={{ height: StyleSheet.hairlineWidth, backgroundColor: colors.border }} />;\n return (\n <Card style={{ gap: 14 }}>\n <Stepper label=\"Adults\" description=\"Ages 13 or above\" value={adults} onValueChange={setAdults} min={1} max={cap - children} />\n {rule}\n <Stepper label=\"Children\" description=\"Ages 2–12\" value={children} onValueChange={setChildren} max={cap - adults} />\n {rule}\n <Stepper label=\"Infants\" description=\"Under 2\" value={infants} onValueChange={setInfants} max={5} />\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>\n This place has a maximum of {cap} guests, not including infants.\n </Text>\n </Card>\n );\n}\n"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "AddToBag",
|
|
160
|
+
"title": "Add To Bag",
|
|
161
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst money = (n: number) => {\n const [int, frac] = n.toFixed(2).split('.');\n return `₹${int.replace(/(\\d)(?=(\\d\\d)+\\d$)/g, '$1,')}${frac === '00' ? '' : `.${frac}`}`;\n};\n\nexport default function AddToBag() {\n const { colors, radius } = useKit();\n const [qty, setQty] = useState(1);\n const price = 1899;\n return (\n <Card>\n <View style={{ gap: 2 }}>\n <Text style={{ fontSize: 17, fontWeight: '400', color: colors.foreground }}>Linen overshirt</Text>\n <Text style={{ fontSize: 13, color: colors.mutedForeground }}>Sand · Size M · Free returns</Text>\n </View>\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 12 }}>\n <Stepper variant=\"filled\" size=\"lg\" value={qty} onValueChange={setQty} min={1} max={10} accessibilityLabel=\"Quantity\" />\n <Pressable\n accessibilityRole=\"button\"\n style={({ pressed }) => ({\n flex: 1,\n height: 44,\n borderRadius: radius.capsule(44),\n backgroundColor: colors.primary,\n alignItems: 'center',\n justifyContent: 'center',\n opacity: pressed ? 0.85 : 1,\n })}\n >\n <Text style={{ fontSize: 15, fontWeight: '400', color: colors.primaryForeground, fontVariant: ['tabular-nums'] }}>\n Add to bag · {money(price * qty)}\n </Text>\n </Pressable>\n </View>\n <Text style={{ fontSize: 12, color: colors.mutedForeground }}>Only 10 left — hold + to add faster.</Text>\n </Card>\n );\n}\n"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "Menu",
|
|
165
|
+
"title": "Menu",
|
|
166
|
+
"code": "import { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst eyebrow = { fontSize: 12, fontWeight: '400', letterSpacing: 0.6, textTransform: 'uppercase' } as const;\n\nexport default function Menu() {\n const { colors } = useKit();\n return (\n <Card>\n <Text style={[eyebrow, { color: colors.mutedForeground }]}>Popular</Text>\n <Stepper variant=\"cart\" addLabel=\"Add\" label=\"Pistachio croissant\" description=\"₹220 · Baked this morning\" accessibilityLabel=\"Pistachio croissant\" />\n <Stepper variant=\"cart\" addLabel=\"Add\" label=\"Iced oat latte\" description=\"₹280 · 16 oz\" defaultValue={1} accessibilityLabel=\"Iced oat latte\" />\n </Card>\n );\n}\n"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "Formatted",
|
|
170
|
+
"title": "Formatted",
|
|
171
|
+
"code": "import { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst money = (n: number) => {\n const [int, frac] = n.toFixed(2).split('.');\n return `₹${int.replace(/(\\d)(?=(\\d\\d)+\\d$)/g, '$1,')}${frac === '00' ? '' : `.${frac}`}`;\n};\n\nexport default function Formatted() {\n return (\n <Card style={{ gap: 16 }}>\n <Stepper variant=\"filled\" size=\"sm\" label=\"Nights\" description=\"Check-in Fri, Oct 24\" defaultValue={3} min={1} max={28} suffix={(n) => (n === 1 ? 'night' : 'nights')} />\n <Stepper variant=\"filled\" size=\"sm\" label=\"Driver tip\" description=\"100% goes to your driver\" defaultValue={50} step={10} min={0} max={500} format={money} />\n <Stepper variant=\"filled\" size=\"sm\" label=\"Search radius\" defaultValue={2.5} step={0.5} min={0.5} max={10} suffix=\"km\" />\n <Stepper variant=\"compact\" label=\"Seats\" description=\"₹499 per seat / month\" defaultValue={5} min={1} max={50} />\n </Card>\n );\n}\n"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "Sizes",
|
|
175
|
+
"title": "Sizes",
|
|
176
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nexport default function Sizes() {\n const { colors } = useKit();\n const row = (name: string, el: React.ReactNode) => (\n <View key={name} style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', minHeight: 48 }}>\n <Text style={{ fontSize: 13, fontWeight: '400', color: colors.mutedForeground }}>{name}</Text>\n {el}\n </View>\n );\n return (\n <Card style={{ gap: 4 }}>\n {row('Small', <Stepper size=\"sm\" defaultValue={2} max={20} accessibilityLabel=\"Small stepper\" />)}\n {row('Medium', <Stepper size=\"md\" defaultValue={2} max={20} accessibilityLabel=\"Medium stepper\" />)}\n {row('Large', <Stepper size=\"lg\" defaultValue={2} max={20} accessibilityLabel=\"Large stepper\" />)}\n {row('Compact', <Stepper variant=\"compact\" defaultValue={2} max={20} accessibilityLabel=\"Compact stepper\" />)}\n </Card>\n );\n}\n"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "Colors",
|
|
180
|
+
"title": "Colors",
|
|
181
|
+
"code": "import { Pressable, StyleSheet, Text, View, type ViewProps } from 'react-native';\nimport { Stepper } from '@/components/ui/stepper';\nimport { useKit } from '@/lib/kit';\n\n/** Demo card that follows the kit theme, so the docs radius / accent picker reshapes it too. */\nfunction Card({ style, ...rest }: ViewProps) {\n const { colors, radius } = useKit();\n return (\n <View\n style={[\n { backgroundColor: colors.card, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth, borderRadius: radius.xl, padding: 16, gap: 12 },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nexport default function Colors() {\n const { colors } = useKit();\n return (\n <Card style={{ gap: 16 }}>\n <Stepper variant=\"filled\" accent={colors.success} label=\"Water\" description=\"Glasses today\" defaultValue={6} max={12} />\n <Stepper variant=\"compact\" accent={colors.warning} label=\"Espresso shots\" defaultValue={2} max={4} />\n <Stepper variant=\"cart\" accent={colors.danger} addLabel=\"Add\" label=\"Hot sauce\" description=\"₹30 each\" />\n </Card>\n );\n}\n"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swipe-deck",
|
|
3
|
+
"category": "3D",
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"exportName": "SwipeDeck",
|
|
6
|
+
"files": [
|
|
7
|
+
"src/components/ui/swipe-deck.tsx"
|
|
8
|
+
],
|
|
9
|
+
"summary": "A card stack you swipe left or right; the top card leans in 3D and stamps a label.",
|
|
10
|
+
"props": [
|
|
11
|
+
[
|
|
12
|
+
"data",
|
|
13
|
+
"T[]",
|
|
14
|
+
"—",
|
|
15
|
+
"Items, one card each (top first)."
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"renderItem",
|
|
19
|
+
"(item: T, index: number) => ReactNode",
|
|
20
|
+
"—",
|
|
21
|
+
"Render a card."
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"keyExtractor",
|
|
25
|
+
"(item: T, index: number) => string",
|
|
26
|
+
"index",
|
|
27
|
+
"React key for each card."
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"height",
|
|
31
|
+
"number",
|
|
32
|
+
"380",
|
|
33
|
+
"Card height."
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"onSwipe",
|
|
37
|
+
"(direction, item, index) => void",
|
|
38
|
+
"—",
|
|
39
|
+
"Fires when a card leaves, with \"left\" or \"right\"."
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"index / onIndexChange",
|
|
43
|
+
"number / (index) => void",
|
|
44
|
+
"— / —",
|
|
45
|
+
"Controlled top card; a fresh batch (first key changed) starts from the top on its own."
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"disabled",
|
|
49
|
+
"boolean",
|
|
50
|
+
"false",
|
|
51
|
+
"Swiping off (e.g. out of likes)."
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"onEmpty",
|
|
55
|
+
"() => void",
|
|
56
|
+
"—",
|
|
57
|
+
"Fires once every card is gone."
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"renderEmpty",
|
|
61
|
+
"() => ReactNode",
|
|
62
|
+
"—",
|
|
63
|
+
"Shown when the deck is empty."
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"rightLabel / leftLabel",
|
|
67
|
+
"string | null",
|
|
68
|
+
"\"LIKE\" / \"NOPE\"",
|
|
69
|
+
"Stamp shown while dragging; null hides it."
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"rightColor / leftColor",
|
|
73
|
+
"string",
|
|
74
|
+
"theme success / danger",
|
|
75
|
+
"Stamp colours."
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"stack",
|
|
79
|
+
"number",
|
|
80
|
+
"2",
|
|
81
|
+
"Cards visible behind the top one."
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"radius",
|
|
85
|
+
"number",
|
|
86
|
+
"24",
|
|
87
|
+
"Corner radius of each card."
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"ref",
|
|
91
|
+
"{ swipe(direction), undo() }",
|
|
92
|
+
"—",
|
|
93
|
+
"Throw the top card from a button, or bring the last one back; reset() starts again from the first card."
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"style",
|
|
97
|
+
"StyleProp<ViewStyle>",
|
|
98
|
+
"—",
|
|
99
|
+
"Style for the root view."
|
|
100
|
+
]
|
|
101
|
+
],
|
|
102
|
+
"behavior": [
|
|
103
|
+
[
|
|
104
|
+
"Touch",
|
|
105
|
+
"Drag the top card past the threshold or flick it to throw it off; a short drag springs back. A ref exposes swipe, undo and reset for buttons."
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"Motion",
|
|
109
|
+
"The card follows your finger, rotates and tilts in 3D, washes in the right or left colour and shows the stamp, while the next card rises."
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"Screen readers",
|
|
113
|
+
"Only the top card is exposed. It offers the right and left labels as accessibility actions, which throw the card that way."
|
|
114
|
+
]
|
|
115
|
+
],
|
|
116
|
+
"usage": null,
|
|
117
|
+
"examples": []
|
|
118
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swipeable-row",
|
|
3
|
+
"category": "Display",
|
|
4
|
+
"aliases": [
|
|
5
|
+
"swipeable-list",
|
|
6
|
+
"swipe-actions"
|
|
7
|
+
],
|
|
8
|
+
"exportName": "SwipeableRow",
|
|
9
|
+
"files": [
|
|
10
|
+
"src/components/ui/swipeable-row.tsx"
|
|
11
|
+
],
|
|
12
|
+
"summary": "A mail-style row whose actions fan out and grow as you drag it sideways.",
|
|
13
|
+
"props": [
|
|
14
|
+
[
|
|
15
|
+
"leftActions",
|
|
16
|
+
"SwipeAction[]",
|
|
17
|
+
"[]",
|
|
18
|
+
"Revealed by swiping right; the first is the edge (full-swipe) action."
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"rightActions",
|
|
22
|
+
"SwipeAction[]",
|
|
23
|
+
"[]",
|
|
24
|
+
"Revealed by swiping left; the last is the edge (full-swipe) action."
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"SwipeAction",
|
|
28
|
+
"{ label, color, icon?, onPress?, destructive? }",
|
|
29
|
+
"—",
|
|
30
|
+
"destructive collapses the row before calling onPress."
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"actionWidth",
|
|
34
|
+
"number",
|
|
35
|
+
"76",
|
|
36
|
+
"Width of each action when resting open."
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
"fullSwipe",
|
|
40
|
+
"boolean",
|
|
41
|
+
"true",
|
|
42
|
+
"Swiping past half the row fires the edge action."
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
"closeOnActionPress",
|
|
46
|
+
"boolean",
|
|
47
|
+
"true",
|
|
48
|
+
"Spring closed after an action is tapped."
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"onOpen / onClose",
|
|
52
|
+
"(side) => void / () => void",
|
|
53
|
+
"—",
|
|
54
|
+
"Open state callbacks."
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
"disabled",
|
|
58
|
+
"boolean",
|
|
59
|
+
"false",
|
|
60
|
+
"Turns swiping off."
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"contentStyle",
|
|
64
|
+
"StyleProp<ViewStyle>",
|
|
65
|
+
"theme background",
|
|
66
|
+
"Style of the sliding foreground — keep its background opaque."
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
"style",
|
|
70
|
+
"StyleProp<ViewStyle>",
|
|
71
|
+
"—",
|
|
72
|
+
"Style for the outer row that holds the actions behind the sliding content."
|
|
73
|
+
]
|
|
74
|
+
],
|
|
75
|
+
"behavior": [
|
|
76
|
+
[
|
|
77
|
+
"Touch",
|
|
78
|
+
"Drag sideways to reveal the actions; a full swipe past half the row fires the edge action. Tap the open row to close it."
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
"Motion",
|
|
82
|
+
"Actions fan out and grow with your finger, the edge action stretches across on a full swipe, and destructive actions slide away and collapse the row."
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"Screen readers",
|
|
86
|
+
"Every action is offered as a named accessibility action on the row, and each revealed action is a labelled button."
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
"Web",
|
|
90
|
+
"Built on PanResponder, so a mouse drag works too; the row shows a grab cursor and text selection is turned off."
|
|
91
|
+
]
|
|
92
|
+
],
|
|
93
|
+
"usage": null,
|
|
94
|
+
"examples": []
|
|
95
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "switch",
|
|
3
|
+
"category": "Selection",
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"exportName": "Switch",
|
|
6
|
+
"files": [
|
|
7
|
+
"src/components/ui/switch.tsx"
|
|
8
|
+
],
|
|
9
|
+
"summary": "A toggle whose thumb squashes and stretches toward the other side while held.",
|
|
10
|
+
"props": [
|
|
11
|
+
[
|
|
12
|
+
"value / onValueChange",
|
|
13
|
+
"boolean",
|
|
14
|
+
"—",
|
|
15
|
+
"Controlled state (or use defaultValue)."
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"defaultValue",
|
|
19
|
+
"boolean",
|
|
20
|
+
"false",
|
|
21
|
+
"Initial state when uncontrolled."
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"variant",
|
|
25
|
+
"\"ios\" | \"material\" | \"icon\"",
|
|
26
|
+
"\"ios\"",
|
|
27
|
+
"Look of the track and thumb."
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"size",
|
|
31
|
+
"\"sm\" | \"md\" | \"lg\"",
|
|
32
|
+
"\"md\"",
|
|
33
|
+
"24 / 31 / 38pt tall."
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"icon",
|
|
37
|
+
"\"theme\" | \"check\"",
|
|
38
|
+
"\"theme\"",
|
|
39
|
+
"Sun / moon or ✕ / check inside the thumb (variant=\"icon\")."
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"label",
|
|
43
|
+
"string",
|
|
44
|
+
"—",
|
|
45
|
+
"Turns it into a settings row with the switch on the right."
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"description",
|
|
49
|
+
"string",
|
|
50
|
+
"—",
|
|
51
|
+
"Secondary line under the label."
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"accent",
|
|
55
|
+
"string",
|
|
56
|
+
"theme accent",
|
|
57
|
+
"Track colour when on."
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"haptics",
|
|
61
|
+
"boolean",
|
|
62
|
+
"true",
|
|
63
|
+
"Light tap when it flips."
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"disabled",
|
|
67
|
+
"boolean",
|
|
68
|
+
"false",
|
|
69
|
+
"Dims and blocks presses."
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"style",
|
|
73
|
+
"StyleProp<ViewStyle>",
|
|
74
|
+
"—",
|
|
75
|
+
"Style for the pressable — the switch itself, or the whole settings row when label is set."
|
|
76
|
+
]
|
|
77
|
+
],
|
|
78
|
+
"behavior": [
|
|
79
|
+
[
|
|
80
|
+
"Touch",
|
|
81
|
+
"Tap to flip, or drag the thumb across. Passing label (and description) turns it into a settings row."
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"Motion",
|
|
85
|
+
"The thumb stretches toward its destination while pressed, springs over with a soft halo, and the track cross-fades."
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"Haptics",
|
|
89
|
+
"A light impact on every flip; turn it off with haptics={false}."
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
"Screen readers",
|
|
93
|
+
"A switch role with checked and disabled state, labelled by accessibilityLabel or label."
|
|
94
|
+
]
|
|
95
|
+
],
|
|
96
|
+
"usage": "import { useState } from 'react';\nimport { Switch } from '@/components/ui/switch';\n\nconst [wifi, setWifi] = useState(true);\n<Switch label=\"Wi-Fi\" value={wifi} onValueChange={setWifi} />",
|
|
97
|
+
"examples": [
|
|
98
|
+
{
|
|
99
|
+
"name": "IOS",
|
|
100
|
+
"title": "IOS",
|
|
101
|
+
"code": "import { View } from 'react-native';\nimport { Switch } from '@/components/ui/switch';\n\nexport default function IOS() {\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 20 }}>\n <Switch defaultValue />\n <Switch />\n <Switch defaultValue accent=\"#22c55e\" />\n <Switch defaultValue disabled />\n </View>\n );\n}\n"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "Material",
|
|
105
|
+
"title": "Material",
|
|
106
|
+
"code": "import { View } from 'react-native';\nimport { Switch } from '@/components/ui/switch';\n\nexport default function Material() {\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 20 }}>\n <Switch variant=\"material\" defaultValue />\n <Switch variant=\"material\" />\n <Switch variant=\"material\" defaultValue />\n </View>\n );\n}\n"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "Icons",
|
|
110
|
+
"title": "Icons",
|
|
111
|
+
"code": "import React, { useState } from 'react';\nimport { View } from 'react-native';\nimport { Switch } from '@/components/ui/switch';\n\nexport default function Icons() {\n const [dark, setDark] = useState(false);\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 16 }}>\n <Switch variant=\"icon\" size=\"lg\" value={dark} onValueChange={setDark} accessibilityLabel=\"Dark mode\" />\n <Switch variant=\"icon\" icon=\"check\" defaultValue accessibilityLabel=\"Auto-save\" />\n </View>\n );\n}\n"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "SettingsRows",
|
|
115
|
+
"title": "Settings Rows",
|
|
116
|
+
"code": "import { View } from 'react-native';\nimport { Switch } from '@/components/ui/switch';\nimport { useKit } from '@/lib/kit';\n\nexport default function SettingsRows() {\n const { colors, radius } = useKit();\n const rows = [\n { label: 'Push notifications', description: 'Replies, mentions and direct messages.', on: true },\n { label: 'Weekly digest', description: \"A summary of your team's activity every Monday.\" },\n { label: 'Share usage data', description: 'Managed by your organisation.', disabled: true },\n ];\n return (\n <View style={{ borderRadius: radius.lg, borderWidth: 1, borderColor: colors.border, backgroundColor: colors.card, overflow: 'hidden' }}>\n {rows.map((r, i) => (\n <Switch\n key={r.label}\n label={r.label}\n description={r.description}\n defaultValue={r.on}\n disabled={r.disabled}\n style={{ paddingHorizontal: 16, paddingVertical: 12, borderTopWidth: i ? 1 : 0, borderColor: colors.border }}\n />\n ))}\n </View>\n );\n}\n"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Sizes",
|
|
120
|
+
"title": "Sizes",
|
|
121
|
+
"code": "import { View } from 'react-native';\nimport { Switch } from '@/components/ui/switch';\n\nexport default function Sizes() {\n return (\n <View style={{ flexDirection: 'row', alignItems: 'center', gap: 20 }}>\n <Switch size=\"sm\" defaultValue />\n <Switch size=\"md\" defaultValue />\n <Switch size=\"lg\" defaultValue />\n </View>\n );\n}\n"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|