@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,269 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "date-picker",
|
|
3
|
+
"category": "Inputs",
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"exportName": "DatePicker",
|
|
6
|
+
"files": [
|
|
7
|
+
"src/components/ui/date-picker.tsx"
|
|
8
|
+
],
|
|
9
|
+
"summary": "A floating-label date field that opens the calendar in a draggable spring sheet.",
|
|
10
|
+
"props": [
|
|
11
|
+
[
|
|
12
|
+
"label",
|
|
13
|
+
"string",
|
|
14
|
+
"—",
|
|
15
|
+
"Rests in the field, floats onto the border when open or filled."
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"floatingLabel",
|
|
19
|
+
"boolean",
|
|
20
|
+
"true",
|
|
21
|
+
"Set to false to put the label above the field as static text (no notch) and show placeholder inside."
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"mode",
|
|
25
|
+
"'single' | 'range'",
|
|
26
|
+
"'single'",
|
|
27
|
+
"One date or a start / end range."
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"value",
|
|
31
|
+
"Date | { start, end } | null",
|
|
32
|
+
"—",
|
|
33
|
+
"Controlled value."
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"defaultValue",
|
|
37
|
+
"Date | { start, end } | null",
|
|
38
|
+
"null",
|
|
39
|
+
"Initial value when uncontrolled."
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"onChange",
|
|
43
|
+
"(value) => void",
|
|
44
|
+
"—",
|
|
45
|
+
"Called with the committed date / range, or null when cleared."
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"presentation",
|
|
49
|
+
"'auto' | 'sheet' | 'dialog' | 'popover'",
|
|
50
|
+
"'auto'",
|
|
51
|
+
"auto: bottom sheet on phones, centred dialog from 640pt wide · sheet: always a bottom sheet with drag-to-dismiss · dialog: always a centred modal · popover: drops under the field."
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"presets",
|
|
55
|
+
"boolean | { label, value | () => value }[]",
|
|
56
|
+
"—",
|
|
57
|
+
"true adds built-in shortcuts (Today, Next 7 days, Next weekend, This month…); or pass your own."
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"confirm",
|
|
61
|
+
"boolean",
|
|
62
|
+
"false",
|
|
63
|
+
"Stage picks behind Clear / Done; otherwise picking (or finishing a range) closes the picker."
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"clearable",
|
|
67
|
+
"boolean",
|
|
68
|
+
"false",
|
|
69
|
+
"Show an × in the field that clears the value."
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"format",
|
|
73
|
+
"(date: Date) => string",
|
|
74
|
+
"—",
|
|
75
|
+
"Custom formatter for each date shown in the field."
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"formatOptions",
|
|
79
|
+
"Intl.DateTimeFormatOptions",
|
|
80
|
+
"{ day, month: 'short', year }",
|
|
81
|
+
"Intl options for the field text."
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"locale",
|
|
85
|
+
"string",
|
|
86
|
+
"device",
|
|
87
|
+
"Locale for the field and the calendar."
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"size",
|
|
91
|
+
"'sm' | 'md' | 'lg'",
|
|
92
|
+
"'md'",
|
|
93
|
+
"Field height 46 / 56 / 66 and type size."
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"placeholder",
|
|
97
|
+
"string",
|
|
98
|
+
"—",
|
|
99
|
+
"Shown in the field while open with nothing picked, and in the sheet header."
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"title",
|
|
103
|
+
"string",
|
|
104
|
+
"label",
|
|
105
|
+
"Sheet heading."
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"minDate / maxDate",
|
|
109
|
+
"Date",
|
|
110
|
+
"—",
|
|
111
|
+
"Selectable bounds; presets outside them are disabled."
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"isDateDisabled",
|
|
115
|
+
"(date: Date) => boolean",
|
|
116
|
+
"—",
|
|
117
|
+
"Disable individual days."
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"markedDates",
|
|
121
|
+
"Record<string, string | string[]>",
|
|
122
|
+
"—",
|
|
123
|
+
"Event dots, passed to Calendar."
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"weekStartsOn",
|
|
127
|
+
"0 | 1",
|
|
128
|
+
"0",
|
|
129
|
+
"First day of the week."
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
"showOutsideDays",
|
|
133
|
+
"boolean",
|
|
134
|
+
"false",
|
|
135
|
+
"Show neighbouring-month days in the grid."
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
"error",
|
|
139
|
+
"string",
|
|
140
|
+
"—",
|
|
141
|
+
"Red border, icon message and one shake."
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"success",
|
|
145
|
+
"boolean | string",
|
|
146
|
+
"—",
|
|
147
|
+
"Success border and check; a string is shown under the field."
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
"helper",
|
|
151
|
+
"string",
|
|
152
|
+
"—",
|
|
153
|
+
"Hint under the field."
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"disabled",
|
|
157
|
+
"boolean",
|
|
158
|
+
"false",
|
|
159
|
+
"Dims the field and blocks opening."
|
|
160
|
+
],
|
|
161
|
+
[
|
|
162
|
+
"accent",
|
|
163
|
+
"string",
|
|
164
|
+
"theme accent",
|
|
165
|
+
"Focus, halo and selection colour."
|
|
166
|
+
],
|
|
167
|
+
[
|
|
168
|
+
"surface",
|
|
169
|
+
"string",
|
|
170
|
+
"theme background",
|
|
171
|
+
"Background behind the field (the label notch uses it)."
|
|
172
|
+
],
|
|
173
|
+
[
|
|
174
|
+
"onOpenChange",
|
|
175
|
+
"(open: boolean) => void",
|
|
176
|
+
"—",
|
|
177
|
+
"Called when the picker opens or closes."
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"style",
|
|
181
|
+
"StyleProp<ViewStyle>",
|
|
182
|
+
"—",
|
|
183
|
+
"Root container style."
|
|
184
|
+
],
|
|
185
|
+
[
|
|
186
|
+
"fieldStyle",
|
|
187
|
+
"StyleProp<ViewStyle>",
|
|
188
|
+
"—",
|
|
189
|
+
"The bordered box: background, border width / colour, radius, height, padding. Wins over the computed style; a borderColor replaces the resting border only (focus, error and success colours still show). A numeric height / borderRadius re-centres the label and resizes the halo."
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
"inputStyle",
|
|
193
|
+
"StyleProp<TextStyle>",
|
|
194
|
+
"—",
|
|
195
|
+
"The formatted date text in the trigger."
|
|
196
|
+
],
|
|
197
|
+
[
|
|
198
|
+
"labelStyle",
|
|
199
|
+
"StyleProp<TextStyle>",
|
|
200
|
+
"—",
|
|
201
|
+
"Label in both modes (floating and above). color is the resting colour — focus (accent), error and success still take over; fontSize sets the resting size, it floats at the same ratio and the notch follows its width."
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"messageStyle",
|
|
205
|
+
"StyleProp<TextStyle>",
|
|
206
|
+
"—",
|
|
207
|
+
"Helper / error / success text. color applies to the helper; error and success keep their tone colour."
|
|
208
|
+
],
|
|
209
|
+
[
|
|
210
|
+
"placeholderTextColor",
|
|
211
|
+
"string",
|
|
212
|
+
"theme mutedForeground",
|
|
213
|
+
"Placeholder colour in the trigger."
|
|
214
|
+
],
|
|
215
|
+
[
|
|
216
|
+
"iconColor",
|
|
217
|
+
"string",
|
|
218
|
+
"theme mutedForeground",
|
|
219
|
+
"Calendar icon and clear × colour at rest (calendar turns accent while open)."
|
|
220
|
+
],
|
|
221
|
+
[
|
|
222
|
+
"menuStyle",
|
|
223
|
+
"StyleProp<ViewStyle>",
|
|
224
|
+
"—",
|
|
225
|
+
"Sheet / dialog / popover panel — background, border, radius, padding, shadow (transform and opacity are animated)."
|
|
226
|
+
]
|
|
227
|
+
],
|
|
228
|
+
"behavior": [
|
|
229
|
+
[
|
|
230
|
+
"Touch",
|
|
231
|
+
"Tap the field to open the picker. In a sheet, drag the grabber header down (or flick it) to dismiss."
|
|
232
|
+
],
|
|
233
|
+
[
|
|
234
|
+
"Motion",
|
|
235
|
+
"The label floats onto the border and a focus halo springs in while open. An error shakes the field once and its message springs in below."
|
|
236
|
+
],
|
|
237
|
+
[
|
|
238
|
+
"Screen readers",
|
|
239
|
+
"The field is a button labelled with your label, with the date (or \"Not set\") as its value and an expanded state. Helper, error and success messages are polite live regions."
|
|
240
|
+
],
|
|
241
|
+
[
|
|
242
|
+
"Platforms",
|
|
243
|
+
"With presentation 'auto' it opens a bottom sheet on phones and a centred dialog from 640pt wide."
|
|
244
|
+
]
|
|
245
|
+
],
|
|
246
|
+
"usage": "import { useState } from 'react';\nimport { DatePicker } from '@/components/ui/date-picker';\n\nconst [date, setDate] = useState<Date | null>(null);\n<DatePicker label=\"Date of birth\" value={date} onChange={setDate} maxDate={new Date()} />",
|
|
247
|
+
"examples": [
|
|
248
|
+
{
|
|
249
|
+
"name": "Birthday",
|
|
250
|
+
"title": "Birthday",
|
|
251
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type TextProps, type ViewProps } from 'react-native';\nimport { DatePicker, type DatePickerPresentation, type DateRange } from '@/components/ui/date-picker';\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 s.card,\n { borderRadius: radius.xl, borderColor: colors.border, backgroundColor: colors.card },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());\n\ntype Opens = Exclude<DatePickerPresentation, 'auto'>;\n\nconst OPENS: { key: Opens; label: string }[] = [\n { key: 'sheet', label: 'Sheet' },\n { key: 'dialog', label: 'Modal' },\n { key: 'popover', label: 'Popover' },\n];\n\n/** Card header with a compact switch for how the picker opens. */\nfunction Header({ title, opens, onOpens }: { title: string; opens: Opens; onOpens: (o: Opens) => void }) {\n const { colors, radius } = useKit();\n return (\n <View style={s.header}>\n <Text style={[s.title, { color: colors.foreground }]} numberOfLines={1}>\n {title}\n </Text>\n <View style={[s.switch, { backgroundColor: colors.muted, borderRadius: radius.md }]} accessibilityRole=\"radiogroup\">\n {OPENS.map((o) => {\n const on = o.key === opens;\n return (\n <Pressable\n key={o.key}\n onPress={() => onOpens(o.key)}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked: on }}\n accessibilityLabel={`Open as ${o.label}`}\n style={[s.switchItem, { borderRadius: Math.max(0, radius.md - 3) }, on && { backgroundColor: colors.background }]}\n >\n <Text style={[s.switchText, { color: on ? colors.foreground : colors.mutedForeground }]}>{o.label}</Text>\n </Pressable>\n );\n })}\n </View>\n </View>\n );\n}\n\nconst s = StyleSheet.create({\n card: { padding: 16, borderWidth: StyleSheet.hairlineWidth, gap: 14 },\n header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10 },\n title: { flexShrink: 1, fontSize: 15, fontWeight: '400' },\n switch: { flexDirection: 'row', padding: 3 },\n switchItem: { height: 28, paddingHorizontal: 10, alignItems: 'center', justifyContent: 'center' },\n switchText: { fontSize: 12.5, fontWeight: '400' },\n label: { fontSize: 12, fontWeight: '400', letterSpacing: 0.4, textTransform: 'uppercase', marginBottom: -6 },\n button: { height: 46, alignItems: 'center', justifyContent: 'center' },\n buttonText: { fontSize: 15, fontWeight: '400' },\n});\n\nexport default function Birthday() {\n const [date, setDate] = useState<Date | null>(new Date(1994, 5, 12));\n const age = date ? Math.floor((today.getTime() - date.getTime()) / (365.25 * 86400000)) : null;\n const [opens, setOpens] = useState<Opens>('sheet');\n return (\n <Card>\n <Header title=\"Profile\" opens={opens} onOpens={setOpens} />\n <DatePicker\n key={opens}\n presentation={opens}\n label=\"Date of birth\"\n value={date}\n onChange={setDate}\n maxDate={today}\n formatOptions={{ day: 'numeric', month: 'long', year: 'numeric' }}\n helper={age !== null ? `You're ${age}. Tap the month title to jump years.` : 'Used to personalise your plan.'}\n />\n </Card>\n );\n}\n"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"name": "TripDates",
|
|
255
|
+
"title": "Trip Dates",
|
|
256
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type TextProps, type ViewProps } from 'react-native';\nimport { DatePicker, type DatePickerPresentation, type DateRange } from '@/components/ui/date-picker';\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 s.card,\n { borderRadius: radius.xl, borderColor: colors.border, backgroundColor: colors.card },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());\n\ntype Opens = Exclude<DatePickerPresentation, 'auto'>;\n\nconst OPENS: { key: Opens; label: string }[] = [\n { key: 'sheet', label: 'Sheet' },\n { key: 'dialog', label: 'Modal' },\n { key: 'popover', label: 'Popover' },\n];\n\n/** Card header with a compact switch for how the picker opens. */\nfunction Header({ title, opens, onOpens }: { title: string; opens: Opens; onOpens: (o: Opens) => void }) {\n const { colors, radius } = useKit();\n return (\n <View style={s.header}>\n <Text style={[s.title, { color: colors.foreground }]} numberOfLines={1}>\n {title}\n </Text>\n <View style={[s.switch, { backgroundColor: colors.muted, borderRadius: radius.md }]} accessibilityRole=\"radiogroup\">\n {OPENS.map((o) => {\n const on = o.key === opens;\n return (\n <Pressable\n key={o.key}\n onPress={() => onOpens(o.key)}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked: on }}\n accessibilityLabel={`Open as ${o.label}`}\n style={[s.switchItem, { borderRadius: Math.max(0, radius.md - 3) }, on && { backgroundColor: colors.background }]}\n >\n <Text style={[s.switchText, { color: on ? colors.foreground : colors.mutedForeground }]}>{o.label}</Text>\n </Pressable>\n );\n })}\n </View>\n </View>\n );\n}\n\nconst s = StyleSheet.create({\n card: { padding: 16, borderWidth: StyleSheet.hairlineWidth, gap: 14 },\n header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10 },\n title: { flexShrink: 1, fontSize: 15, fontWeight: '400' },\n switch: { flexDirection: 'row', padding: 3 },\n switchItem: { height: 28, paddingHorizontal: 10, alignItems: 'center', justifyContent: 'center' },\n switchText: { fontSize: 12.5, fontWeight: '400' },\n label: { fontSize: 12, fontWeight: '400', letterSpacing: 0.4, textTransform: 'uppercase', marginBottom: -6 },\n button: { height: 46, alignItems: 'center', justifyContent: 'center' },\n buttonText: { fontSize: 15, fontWeight: '400' },\n});\n\nexport default function TripDates() {\n const [trip, setTrip] = useState<DateRange | null>(null);\n const nights = trip?.start && trip.end ? Math.round((trip.end.getTime() - trip.start.getTime()) / 86400000) : 0;\n const [opens, setOpens] = useState<Opens>('dialog');\n return (\n <Card>\n <Header title=\"Trip · Kyoto\" opens={opens} onOpens={setOpens} />\n <DatePicker\n key={opens}\n presentation={opens}\n mode=\"range\"\n label=\"Check-in – Check-out\"\n title=\"When are you travelling?\"\n placeholder=\"Add dates\"\n value={trip}\n onChange={setTrip}\n presets\n confirm\n clearable\n minDate={today}\n success={nights ? `${nights} night${nights > 1 ? 's' : ''} · free cancellation until 48h before` : undefined}\n />\n </Card>\n );\n}\n"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"name": "Deadline",
|
|
260
|
+
"title": "Deadline",
|
|
261
|
+
"code": "import React, { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View, type TextProps, type ViewProps } from 'react-native';\nimport { DatePicker, type DatePickerPresentation, type DateRange } from '@/components/ui/date-picker';\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 s.card,\n { borderRadius: radius.xl, borderColor: colors.border, backgroundColor: colors.card },\n style,\n ]}\n {...rest}\n />\n );\n}\n\nconst today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());\n\ntype Opens = Exclude<DatePickerPresentation, 'auto'>;\n\nconst OPENS: { key: Opens; label: string }[] = [\n { key: 'sheet', label: 'Sheet' },\n { key: 'dialog', label: 'Modal' },\n { key: 'popover', label: 'Popover' },\n];\n\n/** Card header with a compact switch for how the picker opens. */\nfunction Header({ title, opens, onOpens }: { title: string; opens: Opens; onOpens: (o: Opens) => void }) {\n const { colors, radius } = useKit();\n return (\n <View style={s.header}>\n <Text style={[s.title, { color: colors.foreground }]} numberOfLines={1}>\n {title}\n </Text>\n <View style={[s.switch, { backgroundColor: colors.muted, borderRadius: radius.md }]} accessibilityRole=\"radiogroup\">\n {OPENS.map((o) => {\n const on = o.key === opens;\n return (\n <Pressable\n key={o.key}\n onPress={() => onOpens(o.key)}\n accessibilityRole=\"radio\"\n accessibilityState={{ checked: on }}\n accessibilityLabel={`Open as ${o.label}`}\n style={[s.switchItem, { borderRadius: Math.max(0, radius.md - 3) }, on && { backgroundColor: colors.background }]}\n >\n <Text style={[s.switchText, { color: on ? colors.foreground : colors.mutedForeground }]}>{o.label}</Text>\n </Pressable>\n );\n })}\n </View>\n </View>\n );\n}\n\nconst s = StyleSheet.create({\n card: { padding: 16, borderWidth: StyleSheet.hairlineWidth, gap: 14 },\n header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10 },\n title: { flexShrink: 1, fontSize: 15, fontWeight: '400' },\n switch: { flexDirection: 'row', padding: 3 },\n switchItem: { height: 28, paddingHorizontal: 10, alignItems: 'center', justifyContent: 'center' },\n switchText: { fontSize: 12.5, fontWeight: '400' },\n label: { fontSize: 12, fontWeight: '400', letterSpacing: 0.4, textTransform: 'uppercase', marginBottom: -6 },\n button: { height: 46, alignItems: 'center', justifyContent: 'center' },\n buttonText: { fontSize: 15, fontWeight: '400' },\n});\n\nexport default function Deadline() {\n const { colors, radius } = useKit();\n const [due, setDue] = useState<Date | null>(null);\n const [submitted, setSubmitted] = useState(false);\n const [opens, setOpens] = useState<Opens>('popover');\n return (\n <Card>\n <Header title=\"New task\" opens={opens} onOpens={setOpens} />\n <DatePicker\n key={opens}\n presentation={opens}\n label=\"Due date\"\n value={due}\n onChange={setDue}\n minDate={today}\n isDateDisabled={(d) => d.getDay() === 0 || d.getDay() === 6}\n presets={[\n { label: 'Tomorrow', value: () => new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1) },\n { label: 'End of month', value: () => new Date(today.getFullYear(), today.getMonth() + 1, 0) },\n ]}\n error={submitted && !due ? 'Pick a due date so the team can plan around it' : undefined}\n helper=\"Weekdays only.\"\n />\n <Pressable\n onPress={() => setSubmitted(true)}\n style={({ pressed }) => [s.button, { backgroundColor: colors.accent, borderRadius: radius.md, opacity: pressed ? 0.85 : 1 }]}\n accessibilityRole=\"button\"\n >\n <Text style={[s.buttonText, { color: colors.accentForeground }]}>Create task</Text>\n </Pressable>\n </Card>\n );\n}\n"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "Sizes",
|
|
265
|
+
"title": "Sizes",
|
|
266
|
+
"code": "import { Pressable, StyleSheet, Text, View, type TextProps, type ViewProps } from 'react-native';\nimport { DatePicker, type DatePickerPresentation, type DateRange } from '@/components/ui/date-picker';\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 s.card,\n { borderRadius: radius.xl, borderColor: colors.border, backgroundColor: colors.card },\n style,\n ]}\n {...rest}\n />\n );\n}\n\n/** Text in the kit's ink: `tone=\"muted\"` for secondary copy. */\nfunction Ink({ tone, style, ...rest }: TextProps & { tone?: 'muted' }) {\n const { colors } = useKit();\n return <Text style={[{ color: tone === 'muted' ? colors.mutedForeground : colors.foreground }, style]} {...rest} />;\n}\n\nconst today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());\n\nconst s = StyleSheet.create({\n card: { padding: 16, borderWidth: StyleSheet.hairlineWidth, gap: 14 },\n header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10 },\n title: { flexShrink: 1, fontSize: 15, fontWeight: '400' },\n switch: { flexDirection: 'row', padding: 3 },\n switchItem: { height: 28, paddingHorizontal: 10, alignItems: 'center', justifyContent: 'center' },\n switchText: { fontSize: 12.5, fontWeight: '400' },\n label: { fontSize: 12, fontWeight: '400', letterSpacing: 0.4, textTransform: 'uppercase', marginBottom: -6 },\n button: { height: 46, alignItems: 'center', justifyContent: 'center' },\n buttonText: { fontSize: 15, fontWeight: '400' },\n});\n\nexport default function Sizes() {\n const d = new Date(today.getFullYear(), today.getMonth(), 24);\n return (\n <Card>\n <Ink tone=\"muted\" style={s.label}>Small</Ink>\n <DatePicker size=\"sm\" label=\"Invoice date\" defaultValue={d} />\n <Ink tone=\"muted\" style={s.label}>Medium</Ink>\n <DatePicker size=\"md\" label=\"Invoice date\" defaultValue={d} />\n <Ink tone=\"muted\" style={s.label}>Large</Ink>\n <DatePicker size=\"lg\" label=\"Invoice date\" defaultValue={d} />\n <Ink tone=\"muted\" style={s.label}>Disabled</Ink>\n <DatePicker disabled label=\"Invoice date\" defaultValue={d} />\n </Card>\n );\n}\n"
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dialog",
|
|
3
|
+
"category": "Overlays",
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"exportName": "Dialog",
|
|
6
|
+
"files": [
|
|
7
|
+
"src/components/ui/dialog.tsx"
|
|
8
|
+
],
|
|
9
|
+
"summary": "A centred alert whose card springs up from 0.92 while its tone icon draws itself.",
|
|
10
|
+
"props": [
|
|
11
|
+
[
|
|
12
|
+
"open / defaultOpen",
|
|
13
|
+
"boolean",
|
|
14
|
+
"false",
|
|
15
|
+
"Controlled / uncontrolled visibility."
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"onOpenChange",
|
|
19
|
+
"(open: boolean) => void",
|
|
20
|
+
"—",
|
|
21
|
+
"Called on scrim tap, back, Escape and actions."
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"variant",
|
|
25
|
+
"\"default\" | \"destructive\"",
|
|
26
|
+
"\"default\"",
|
|
27
|
+
"Destructive adds a warning icon, a danger confirm and a warning haptic on open. The old \"sheet\" value is deprecated and renders as default."
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"tone",
|
|
31
|
+
"\"info\" | \"success\" | \"warning\" | \"danger\"",
|
|
32
|
+
"—",
|
|
33
|
+
"Living icon in a halo above the title with a soft glow of its colour; success / warning open with a matching haptic."
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"appearance",
|
|
37
|
+
"\"modern\" | \"ios\"",
|
|
38
|
+
"\"modern\"",
|
|
39
|
+
"Pill buttons, or iOS full-width text buttons split by hairlines."
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"title / description",
|
|
43
|
+
"string",
|
|
44
|
+
"—",
|
|
45
|
+
"Heading and body copy."
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"prompt",
|
|
49
|
+
"{ defaultValue?, value?, onChangeText?, placeholder?, secureTextEntry?, keyboardType?, maxLength?, … }",
|
|
50
|
+
"—",
|
|
51
|
+
"Adds a text field (a prompt dialog). Its text is passed to onConfirm / onPress; Return submits."
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"error",
|
|
55
|
+
"string",
|
|
56
|
+
"—",
|
|
57
|
+
"Error text under the field or description."
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
"children",
|
|
61
|
+
"ReactNode",
|
|
62
|
+
"—",
|
|
63
|
+
"Custom content above the actions."
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"actions",
|
|
67
|
+
"{ label, onPress?, role?, disabled? }[]",
|
|
68
|
+
"Cancel + Confirm",
|
|
69
|
+
"Buttons. role: primary | default | destructive | cancel. onPress(value) may return a promise (spinner) or false (stays open and shakes)."
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
"confirmLabel / cancelLabel",
|
|
73
|
+
"string / string | null",
|
|
74
|
+
"\"Continue\" / \"Cancel\"",
|
|
75
|
+
"Labels for the default buttons; cancelLabel null leaves a single button."
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"onConfirm / onCancel",
|
|
79
|
+
"(value) => void | false | Promise · () => void",
|
|
80
|
+
"—",
|
|
81
|
+
"Handlers for the default buttons (onCancel also fires on scrim, back and Escape)."
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
"loading",
|
|
85
|
+
"boolean",
|
|
86
|
+
"false",
|
|
87
|
+
"Spinner on the confirm button; other buttons and dismissal are disabled."
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"actionsLayout",
|
|
91
|
+
"\"auto\" | \"row\" | \"stack\"",
|
|
92
|
+
"\"auto\"",
|
|
93
|
+
"Two short buttons side by side, otherwise stacked with Cancel last."
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"icon",
|
|
97
|
+
"ReactNode | false",
|
|
98
|
+
"tone icon",
|
|
99
|
+
"Custom node inside the halo, or false to hide it."
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
"dismissible",
|
|
103
|
+
"boolean",
|
|
104
|
+
"true",
|
|
105
|
+
"Close on scrim tap, back and Escape."
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"haptics",
|
|
109
|
+
"boolean",
|
|
110
|
+
"true",
|
|
111
|
+
"Warning on open for destructive dialogs, success for success, error on shake."
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"accent",
|
|
115
|
+
"string",
|
|
116
|
+
"theme primary (accent in ios)",
|
|
117
|
+
"Colour of the primary action."
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"style",
|
|
121
|
+
"StyleProp<ViewStyle>",
|
|
122
|
+
"—",
|
|
123
|
+
"Card style."
|
|
124
|
+
]
|
|
125
|
+
],
|
|
126
|
+
"behavior": [
|
|
127
|
+
[
|
|
128
|
+
"Motion",
|
|
129
|
+
"The scrim fades in while the card springs to full size. A confirm that returns false keeps it open and shakes it."
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
"Reduced motion",
|
|
133
|
+
"The card fades in without the scale spring, and the tone icon appears fully drawn instead of animating. The shake is skipped."
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
"Haptics",
|
|
137
|
+
"A warning tick on open for destructive, warning and danger dialogs, success for the success tone, and an error buzz on shake."
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
"Screen readers",
|
|
141
|
+
"The title is a header; destructive, warning and danger dialogs use the alert role. Buttons report disabled and busy, and the error text is a polite live region."
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"Keyboard",
|
|
145
|
+
"Escape closes it on web, and Return submits a prompt field."
|
|
146
|
+
]
|
|
147
|
+
],
|
|
148
|
+
"usage": "import { useState } from 'react';\nimport { Dialog } from '@/components/ui/dialog';\n\nconst [open, setOpen] = useState(false);\n<Dialog\n open={open} onOpenChange={setOpen}\n variant=\"destructive\"\n title=\"Delete this project?\"\n confirmLabel=\"Delete\"\n/>",
|
|
149
|
+
"examples": [
|
|
150
|
+
{
|
|
151
|
+
"name": "Basic",
|
|
152
|
+
"title": "Basic",
|
|
153
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\n\nexport default function Basic() {\n const [open, setOpen] = useState(false);\n return (\n <View style={{ alignItems: 'center' }}>\n <Button variant=\"accent\" onPress={() => setOpen(true)}>\n Enable notifications\n </Button>\n <Dialog\n open={open}\n onOpenChange={setOpen}\n tone=\"info\"\n title=\"Turn on notifications?\"\n description=\"Get a heads-up when someone mentions you, replies to your post or shares a file.\"\n cancelLabel=\"Not now\"\n confirmLabel=\"Allow\"\n />\n </View>\n );\n}\n"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "Destructive",
|
|
157
|
+
"title": "Destructive",
|
|
158
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\nimport { useKit } from '@/lib/kit';\n\nfunction useMuted() {\n const { colors } = useKit();\n return { fontSize: 13, color: colors.mutedForeground, textAlign: 'center' as const };\n}\n\nexport default function Destructive() {\n const muted = useMuted();\n const [open, setOpen] = useState(false);\n const [status, setStatus] = useState('');\n return (\n <View style={{ alignItems: 'center', gap: 10 }}>\n <Button variant=\"destructive\" onPress={() => setOpen(true)}>\n Delete project\n </Button>\n {status ? <Text style={muted}>{status}</Text> : null}\n <Dialog\n open={open}\n onOpenChange={setOpen}\n variant=\"destructive\"\n title=\"Delete “Mobile redesign”?\"\n description=\"This permanently removes the project, its 48 files and all comments. This can't be undone.\"\n confirmLabel=\"Delete\"\n onConfirm={() =>\n new Promise<void>((resolve) =>\n setTimeout(() => {\n setStatus('“Mobile redesign” was deleted');\n resolve();\n }, 1200),\n )\n }\n />\n </View>\n );\n}\n"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "WithForm",
|
|
162
|
+
"title": "With Form",
|
|
163
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\nimport { useKit } from '@/lib/kit';\n\nfunction useMuted() {\n const { colors } = useKit();\n return { fontSize: 13, color: colors.mutedForeground, textAlign: 'center' as const };\n}\n\nexport default function WithForm() {\n const muted = useMuted();\n const [open, setOpen] = useState(false);\n const [name, setName] = useState('Q3 roadmap');\n const [error, setError] = useState('');\n return (\n <View style={{ alignItems: 'center', gap: 10 }}>\n <Button variant=\"secondary\" onPress={() => setOpen(true)}>\n Rename board\n </Button>\n <Text style={muted}>Board: {name}</Text>\n <Dialog\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n setError('');\n }}\n title=\"Rename board\"\n description=\"Everyone with access will see the new name.\"\n prompt={{ defaultValue: name, placeholder: 'Board name', maxLength: 40, onChangeText: () => setError('') }}\n error={error}\n confirmLabel=\"Save\"\n onConfirm={(value) => {\n const next = value.trim();\n if (!next) {\n setError('Give the board a name.');\n return false;\n }\n setName(next);\n }}\n />\n </View>\n );\n}\n"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "PaymentSent",
|
|
167
|
+
"title": "Payment Sent",
|
|
168
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\n\nexport default function PaymentSent() {\n const [open, setOpen] = useState(false);\n return (\n <View style={{ alignItems: 'center' }}>\n <Button variant=\"accent\" onPress={() => setOpen(true)}>\n Send ₹1,850\n </Button>\n <Dialog\n open={open}\n onOpenChange={setOpen}\n tone=\"success\"\n title=\"Payment sent\"\n description=\"₹1,850 is on its way to Lena Fischer for “Dinner at Tasca”. She'll get it in a few seconds.\"\n cancelLabel={null}\n confirmLabel=\"Done\"\n />\n </View>\n );\n}\n"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "SignOut",
|
|
172
|
+
"title": "Sign Out",
|
|
173
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\nimport { useKit } from '@/lib/kit';\n\nfunction useMuted() {\n const { colors } = useKit();\n return { fontSize: 13, color: colors.mutedForeground, textAlign: 'center' as const };\n}\n\nexport default function SignOut() {\n const muted = useMuted();\n const [open, setOpen] = useState(false);\n const [status, setStatus] = useState('iOS-style hairline buttons');\n return (\n <View style={{ alignItems: 'center', gap: 10 }}>\n <Button variant=\"outline\" onPress={() => setOpen(true)}>\n Sign out\n </Button>\n <Text style={muted}>{status}</Text>\n <Dialog\n open={open}\n onOpenChange={setOpen}\n appearance=\"ios\"\n title=\"Sign out of Northwind?\"\n description=\"Offline drafts on this device will be removed.\"\n actions={[\n { label: 'Cancel', role: 'cancel' },\n { label: 'Sign out', role: 'destructive', onPress: () => setStatus('Signed out') },\n ]}\n />\n </View>\n );\n}\n"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "ThreeActions",
|
|
177
|
+
"title": "Three Actions",
|
|
178
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\n\nexport default function ThreeActions() {\n const [open, setOpen] = useState(false);\n return (\n <View style={{ alignItems: 'center' }}>\n <Button variant=\"outline\" onPress={() => setOpen(true)}>\n Close document\n </Button>\n <Dialog\n open={open}\n onOpenChange={setOpen}\n appearance=\"ios\"\n title=\"Save changes to “Pitch deck”?\"\n description=\"Your edits will be lost if you don't save them.\"\n actions={[\n { label: 'Save', role: 'primary' },\n { label: \"Don't save\", role: 'destructive' },\n { label: 'Cancel', role: 'cancel' },\n ]}\n />\n </View>\n );\n}\n"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "ActionSheetDemo",
|
|
182
|
+
"title": "Action Sheet Demo",
|
|
183
|
+
"code": "import React, { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { ActionSheet } from '@/components/ui/action-sheet';\nimport { Button } from '@/components/ui/button';\nimport { Dialog } from '@/components/ui/dialog';\nimport { useKit } from '@/lib/kit';\n\nfunction useMuted() {\n const { colors } = useKit();\n return { fontSize: 13, color: colors.mutedForeground, textAlign: 'center' as const };\n}\n\nexport default function ActionSheetDemo() {\n const muted = useMuted();\n const [open, setOpen] = useState(false);\n return (\n <View style={{ alignItems: 'center', gap: 8 }}>\n <Button variant=\"outline\" onPress={() => setOpen(true)}>\n Change profile photo\n </Button>\n <Text style={muted}>Bottom choices live in Action Sheet — not Dialog.</Text>\n <ActionSheet\n open={open}\n onOpenChange={setOpen}\n title=\"Profile photo\"\n message=\"Your photo is visible to everyone in your workspace.\"\n actions={[\n { label: 'Take photo' },\n { label: 'Choose from library' },\n { label: 'Remove photo', destructive: true },\n ]}\n />\n </View>\n );\n}\n"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|