@wakastellar/ui 2.3.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/dashboard/index.d.ts +4 -1
- package/dist/blocks/empty-states/index.d.ts +4 -1
- package/dist/blocks/error-pages/index.d.ts +4 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/landing/index.d.ts +4 -1
- package/dist/blocks/pricing/index.d.ts +5 -1
- package/dist/blocks/sidebar/index.d.ts +5 -1
- package/dist/index.cjs.js +130 -130
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +7905 -7856
- package/dist/stories/Button.d.ts +14 -0
- package/dist/stories/Button.stories.d.ts +8 -0
- package/dist/stories/Header.d.ts +11 -0
- package/dist/stories/Header.stories.d.ts +6 -0
- package/dist/stories/Page.d.ts +2 -0
- package/dist/stories/Page.stories.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/link.d.ts +23 -0
- package/package.json +11 -3
- package/src/blocks/activity-timeline/ActivityTimeline.stories.tsx +460 -0
- package/src/blocks/apm-overview/APMOverview.stories.tsx +435 -0
- package/src/blocks/auth-2fa/Auth2FA.stories.tsx +308 -0
- package/src/blocks/calendar-view/CalendarView.stories.tsx +398 -0
- package/src/blocks/chat/Chat.stories.tsx +466 -0
- package/src/blocks/chat-interface/ChatInterface.stories.tsx +412 -0
- package/src/blocks/checkout-flow/CheckoutFlow.stories.tsx +408 -0
- package/src/blocks/cicd-builder/CICDBuilder.stories.tsx +499 -0
- package/src/blocks/cloud-cost-dashboard/CloudCostDashboard.stories.tsx +356 -0
- package/src/blocks/container-orchestrator/ContainerOrchestrator.stories.tsx +461 -0
- package/src/blocks/dashboard/Dashboard.stories.tsx +559 -0
- package/src/blocks/dashboard/index.tsx +68 -27
- package/src/blocks/dashboard-kpi/DashboardKPI.stories.tsx +422 -0
- package/src/blocks/database-admin/DatabaseAdmin.stories.tsx +393 -0
- package/src/blocks/deployment-dashboard/DeploymentDashboard.stories.tsx +457 -0
- package/src/blocks/empty-states/EmptyStates.stories.tsx +467 -0
- package/src/blocks/empty-states/index.tsx +26 -8
- package/src/blocks/error-pages/ErrorPages.stories.tsx +401 -0
- package/src/blocks/error-pages/index.tsx +26 -8
- package/src/blocks/faq/FAQ.stories.tsx +416 -0
- package/src/blocks/file-manager/FileManager.stories.tsx +413 -0
- package/src/blocks/footer/Footer.stories.tsx +328 -0
- package/src/blocks/gitops-sync-status/GitOpsSyncStatus.stories.tsx +529 -0
- package/src/blocks/header/WakaHeader.stories.tsx +455 -0
- package/src/blocks/headtab/Headtab.stories.tsx +369 -0
- package/src/blocks/i18n-editor/I18nEditor.stories.tsx +451 -0
- package/src/blocks/incident-manager/IncidentManager.stories.tsx +464 -0
- package/src/blocks/index.ts +1 -1
- package/src/blocks/infrastructure-map/InfrastructureMap.stories.tsx +533 -0
- package/src/blocks/kanban-board/KanbanBoard.stories.tsx +494 -0
- package/src/blocks/landing/WakaLanding.stories.tsx +449 -0
- package/src/blocks/landing/index.tsx +125 -66
- package/src/blocks/language-selector/LanguageSelector.stories.tsx +345 -0
- package/src/blocks/layout/Layout.stories.tsx +373 -0
- package/src/blocks/login/Login.stories.tsx +443 -0
- package/src/blocks/on-call-schedule/OnCallSchedule.stories.tsx +381 -0
- package/src/blocks/player-profile/PlayerProfile.stories.tsx +316 -0
- package/src/blocks/pricing/WakaPricing.stories.tsx +530 -0
- package/src/blocks/pricing/index.tsx +38 -4
- package/src/blocks/profile/Profile.stories.tsx +371 -0
- package/src/blocks/release-notes/ReleaseNotes.stories.tsx +431 -0
- package/src/blocks/settings/Settings.stories.tsx +520 -0
- package/src/blocks/sidebar/WakaSidebar.stories.tsx +513 -0
- package/src/blocks/sidebar/index.tsx +49 -20
- package/src/blocks/theme-creator-block/ThemeCreatorBlock.stories.tsx +370 -0
- package/src/blocks/user-management/UserManagement.stories.tsx +411 -0
- package/src/blocks/wizard/Wizard.stories.tsx +683 -0
- package/src/components/accordion/Accordion.stories.tsx +93 -0
- package/src/components/alert/Alert.stories.tsx +95 -0
- package/src/components/alert-dialog/AlertDialog.stories.tsx +126 -0
- package/src/components/aspect-ratio/AspectRatio.stories.tsx +118 -0
- package/src/components/avatar/Avatar.stories.tsx +104 -0
- package/src/components/button/Button.stories.tsx +12 -1
- package/src/components/calendar/Calendar.stories.tsx +102 -0
- package/src/components/card/Card.stories.tsx +125 -0
- package/src/components/checkbox/Checkbox.stories.tsx +100 -0
- package/src/components/code/Code.stories.tsx +402 -0
- package/src/components/collapsible/Collapsible.stories.tsx +123 -0
- package/src/components/command/Command.stories.tsx +207 -0
- package/src/components/context-menu/ContextMenu.stories.tsx +220 -0
- package/src/components/dialog/Dialog.stories.tsx +157 -0
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +225 -0
- package/src/components/form/Form.stories.tsx +413 -0
- package/src/components/hover-card/HoverCard.stories.tsx +148 -0
- package/src/components/input-otp/InputOTP.stories.tsx +255 -0
- package/src/components/label/Label.stories.tsx +68 -0
- package/src/components/menubar/Menubar.stories.tsx +278 -0
- package/src/components/navigation-menu/NavigationMenu.stories.tsx +202 -0
- package/src/components/popover/Popover.stories.tsx +199 -0
- package/src/components/progress/Progress.stories.tsx +104 -0
- package/src/components/radio-group/RadioGroup.stories.tsx +138 -0
- package/src/components/scroll-area/ScrollArea.stories.tsx +153 -0
- package/src/components/select/Select.stories.tsx +146 -0
- package/src/components/separator/Separator.stories.tsx +117 -0
- package/src/components/sheet/Sheet.stories.tsx +195 -0
- package/src/components/skeleton/Skeleton.stories.tsx +114 -0
- package/src/components/slider/Slider.stories.tsx +157 -0
- package/src/components/switch/Switch.stories.tsx +114 -0
- package/src/components/table/Table.stories.tsx +153 -0
- package/src/components/tabs/Tabs.stories.tsx +155 -0
- package/src/components/textarea/Textarea.stories.tsx +116 -0
- package/src/components/toast/Toast.stories.tsx +160 -0
- package/src/components/toggle/Toggle.stories.tsx +125 -0
- package/src/components/tooltip/Tooltip.stories.tsx +133 -0
- package/src/components/typography/Typography.stories.tsx +207 -0
- package/src/components/waka-3d-pie-chart/Waka3DPieChart.stories.tsx +308 -0
- package/src/components/waka-achievement-unlock/WakaAchievementUnlock.stories.tsx +353 -0
- package/src/components/waka-artifact-list/WakaArtifactList.stories.tsx +258 -0
- package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +224 -0
- package/src/components/waka-badge-showcase/WakaBadgeShowcase.stories.tsx +269 -0
- package/src/components/waka-barcode/WakaBarcode.stories.tsx +227 -0
- package/src/components/waka-bottom-sheet/WakaBottomSheet.stories.tsx +408 -0
- package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +237 -0
- package/src/components/waka-build-matrix/WakaBuildMatrix.stories.tsx +328 -0
- package/src/components/waka-carousel/WakaCarousel.stories.tsx +296 -0
- package/src/components/waka-charts/WakaCharts.stories.tsx +519 -0
- package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +200 -0
- package/src/components/waka-combobox/WakaCombobox.stories.tsx +250 -0
- package/src/components/waka-container-list/WakaContainerList.stories.tsx +315 -0
- package/src/components/waka-contribution-graph/WakaContributionGraph.stories.tsx +354 -0
- package/src/components/waka-cost-breakdown/WakaCostBreakdown.stories.tsx +348 -0
- package/src/components/waka-daily-reward/WakaDailyReward.stories.tsx +365 -0
- package/src/components/waka-database-card/WakaDatabaseCard.stories.tsx +306 -0
- package/src/components/waka-date-range-picker/WakaDateRangePicker.stories.tsx +339 -0
- package/src/components/waka-datetime-picker/WakaDateTimePicker.stories.tsx +317 -0
- package/src/components/waka-deployment-lane/WakaDeploymentLane.stories.tsx +292 -0
- package/src/components/waka-dock/WakaDock.stories.tsx +332 -0
- package/src/components/waka-drawer/WakaDrawer.stories.tsx +437 -0
- package/src/components/waka-env-var-editor/WakaEnvVarEditor.stories.tsx +263 -0
- package/src/components/waka-error-shake/WakaErrorShake.stories.tsx +410 -0
- package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +239 -0
- package/src/components/waka-flow-diagram/WakaFlowDiagram.stories.tsx +365 -0
- package/src/components/waka-funnel-chart/WakaFunnelChart.stories.tsx +281 -0
- package/src/components/waka-glow-card/WakaGlowCard.stories.tsx +274 -0
- package/src/components/waka-haptic-button/WakaHapticButton.stories.tsx +349 -0
- package/src/components/waka-health-pulse/WakaHealthPulse.stories.tsx +293 -0
- package/src/components/waka-heatmap/WakaHeatmap.stories.tsx +376 -0
- package/src/components/waka-image/WakaImage.stories.tsx +255 -0
- package/src/components/waka-incident-timeline/WakaIncidentTimeline.stories.tsx +300 -0
- package/src/components/waka-kanban/WakaKanban.stories.tsx +399 -0
- package/src/components/waka-kubernetes-overview/WakaKubernetesOverview.stories.tsx +281 -0
- package/src/components/waka-leaderboard/WakaLeaderboard.stories.tsx +300 -0
- package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +313 -0
- package/src/components/waka-loading-orbit/WakaLoadingOrbit.stories.tsx +413 -0
- package/src/components/waka-log-viewer/WakaLogViewer.stories.tsx +312 -0
- package/src/components/waka-loot-box/WakaLootBox.stories.tsx +374 -0
- package/src/components/waka-metric-sparkline/WakaMetricSparkline.stories.tsx +312 -0
- package/src/components/waka-migration-list/WakaMigrationList.stories.tsx +289 -0
- package/src/components/waka-modal/WakaModal.stories.tsx +434 -0
- package/src/components/waka-morph-button/WakaMorphButton.stories.tsx +405 -0
- package/src/components/waka-network-topology/WakaNetworkTopology.stories.tsx +364 -0
- package/src/components/waka-notifications/WakaNotifications.stories.tsx +290 -0
- package/src/components/waka-number-input/WakaNumberInput.stories.tsx +282 -0
- package/src/components/waka-pagination/WakaPagination.stories.tsx +328 -0
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +318 -0
- package/src/components/waka-pipeline-view/WakaPipelineView.stories.tsx +386 -0
- package/src/components/waka-player-card/WakaPlayerCard.stories.tsx +333 -0
- package/src/components/waka-pod-card/WakaPodCard.stories.tsx +435 -0
- package/src/components/waka-qrcode/WakaQRCode.stories.tsx +232 -0
- package/src/components/waka-query-explain/WakaQueryExplain.stories.tsx +407 -0
- package/src/components/waka-quest-card/WakaQuestCard.stories.tsx +394 -0
- package/src/components/waka-quota-bar/WakaQuotaBar.stories.tsx +435 -0
- package/src/components/waka-radar-score/WakaRadarScore.stories.tsx +372 -0
- package/src/components/waka-resource-gauge/WakaResourceGauge.stories.tsx +366 -0
- package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +238 -0
- package/src/components/waka-sankey-diagram/WakaSankeyDiagram.stories.tsx +389 -0
- package/src/components/waka-scratch-card/WakaScratchCard.stories.tsx +388 -0
- package/src/components/waka-secret-card/WakaSecretCard.stories.tsx +314 -0
- package/src/components/waka-segmented-control/WakaSegmentedControl.stories.tsx +309 -0
- package/src/components/waka-server-rack/WakaServerRack.stories.tsx +382 -0
- package/src/components/waka-service-graph/WakaServiceGraph.stories.tsx +262 -0
- package/src/components/waka-skeleton-wave/WakaSkeletonWave.stories.tsx +321 -0
- package/src/components/waka-skill-tree/WakaSkillTree.stories.tsx +308 -0
- package/src/components/waka-spin-wheel/WakaSpinWheel.stories.tsx +368 -0
- package/src/components/waka-spinner/WakaSpinner.stories.tsx +156 -0
- package/src/components/waka-stat/WakaStat.stories.tsx +334 -0
- package/src/components/waka-status-matrix/WakaStatusMatrix.stories.tsx +331 -0
- package/src/components/waka-stepper/WakaStepper.stories.tsx +468 -0
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +235 -0
- package/src/components/waka-success-explosion/WakaSuccessExplosion.stories.tsx +389 -0
- package/src/components/waka-tabs-morph/WakaTabsMorph.stories.tsx +471 -0
- package/src/components/waka-terminal-output/WakaTerminalOutput.stories.tsx +351 -0
- package/src/components/waka-test-report/WakaTestReport.stories.tsx +322 -0
- package/src/components/waka-tilt-card/WakaTiltCard.stories.tsx +300 -0
- package/src/components/waka-time-picker/WakaTimePicker.stories.tsx +227 -0
- package/src/components/waka-timeline/WakaTimeline.stories.tsx +383 -0
- package/src/components/waka-tournament-bracket/WakaTournamentBracket.stories.tsx +375 -0
- package/src/components/waka-trace-viewer/WakaTraceViewer.stories.tsx +445 -0
- package/src/components/waka-tree/WakaTree.stories.tsx +359 -0
- package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +378 -0
- package/src/components/waka-typewriter/WakaTypewriter.stories.tsx +366 -0
- package/src/components/waka-versus-card/WakaVersusCard.stories.tsx +530 -0
- package/src/components/waka-video/WakaVideo.stories.tsx +203 -0
- package/src/components/waka-virtual-list/WakaVirtualList.stories.tsx +273 -0
- package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +305 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { InputOTP } from './index'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof InputOTP> = {
|
|
6
|
+
title: 'Components/Forms/InputOTP',
|
|
7
|
+
component: InputOTP,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A one-time password input component with keyboard navigation and paste support.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
length: {
|
|
19
|
+
control: 'number',
|
|
20
|
+
description: 'Number of OTP digits',
|
|
21
|
+
},
|
|
22
|
+
pattern: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
options: ['numeric', 'alphanumeric', 'alpha'],
|
|
25
|
+
description: 'Allowed character pattern',
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
control: 'select',
|
|
29
|
+
options: ['sm', 'md', 'lg'],
|
|
30
|
+
description: 'Size of the inputs',
|
|
31
|
+
},
|
|
32
|
+
secure: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: 'Mask the input (like password)',
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Disable the input',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default meta
|
|
44
|
+
type Story = StoryObj<typeof InputOTP>
|
|
45
|
+
|
|
46
|
+
export const Default: Story = {
|
|
47
|
+
render: function OTPDemo() {
|
|
48
|
+
const [value, setValue] = React.useState('')
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="space-y-4">
|
|
52
|
+
<InputOTP
|
|
53
|
+
length={6}
|
|
54
|
+
value={value}
|
|
55
|
+
onChange={setValue}
|
|
56
|
+
onComplete={(code) => console.log('Complete:', code)}
|
|
57
|
+
/>
|
|
58
|
+
<p className="text-sm text-muted-foreground text-center">
|
|
59
|
+
Enter the 6-digit code
|
|
60
|
+
</p>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const FourDigit: Story = {
|
|
67
|
+
render: function FourDigitDemo() {
|
|
68
|
+
const [value, setValue] = React.useState('')
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<InputOTP
|
|
72
|
+
length={4}
|
|
73
|
+
value={value}
|
|
74
|
+
onChange={setValue}
|
|
75
|
+
onComplete={(code) => alert(`Code: ${code}`)}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const WithSeparator: Story = {
|
|
82
|
+
render: function SeparatorDemo() {
|
|
83
|
+
const [value, setValue] = React.useState('')
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<InputOTP
|
|
87
|
+
length={6}
|
|
88
|
+
value={value}
|
|
89
|
+
onChange={setValue}
|
|
90
|
+
separator={3}
|
|
91
|
+
separatorElement={<span className="text-muted-foreground mx-1">-</span>}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
},
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const Alphanumeric: Story = {
|
|
98
|
+
render: function AlphanumericDemo() {
|
|
99
|
+
const [value, setValue] = React.useState('')
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<div className="space-y-2">
|
|
103
|
+
<InputOTP
|
|
104
|
+
length={6}
|
|
105
|
+
value={value}
|
|
106
|
+
onChange={setValue}
|
|
107
|
+
pattern="alphanumeric"
|
|
108
|
+
/>
|
|
109
|
+
<p className="text-sm text-muted-foreground text-center">
|
|
110
|
+
Letters and numbers allowed
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
|
+
)
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const Secure: Story = {
|
|
118
|
+
render: function SecureDemo() {
|
|
119
|
+
const [value, setValue] = React.useState('')
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<div className="space-y-2">
|
|
123
|
+
<InputOTP
|
|
124
|
+
length={4}
|
|
125
|
+
value={value}
|
|
126
|
+
onChange={setValue}
|
|
127
|
+
secure
|
|
128
|
+
/>
|
|
129
|
+
<p className="text-sm text-muted-foreground text-center">
|
|
130
|
+
Secure PIN entry
|
|
131
|
+
</p>
|
|
132
|
+
</div>
|
|
133
|
+
)
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const Sizes: Story = {
|
|
138
|
+
render: function SizesDemo() {
|
|
139
|
+
const [value, setValue] = React.useState('')
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<div className="space-y-6">
|
|
143
|
+
<div className="space-y-2">
|
|
144
|
+
<p className="text-sm text-muted-foreground">Small</p>
|
|
145
|
+
<InputOTP length={4} value={value} onChange={setValue} size="sm" />
|
|
146
|
+
</div>
|
|
147
|
+
<div className="space-y-2">
|
|
148
|
+
<p className="text-sm text-muted-foreground">Medium</p>
|
|
149
|
+
<InputOTP length={4} value={value} onChange={setValue} size="md" />
|
|
150
|
+
</div>
|
|
151
|
+
<div className="space-y-2">
|
|
152
|
+
<p className="text-sm text-muted-foreground">Large</p>
|
|
153
|
+
<InputOTP length={4} value={value} onChange={setValue} size="lg" />
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
)
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export const WithError: Story = {
|
|
161
|
+
render: function ErrorDemo() {
|
|
162
|
+
const [value, setValue] = React.useState('123')
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<InputOTP
|
|
166
|
+
length={6}
|
|
167
|
+
value={value}
|
|
168
|
+
onChange={setValue}
|
|
169
|
+
error="Invalid verification code"
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export const Disabled: Story = {
|
|
176
|
+
render: () => (
|
|
177
|
+
<InputOTP length={6} value="123456" disabled />
|
|
178
|
+
),
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const Prefilled: Story = {
|
|
182
|
+
render: function PrefilledDemo() {
|
|
183
|
+
const [value, setValue] = React.useState('842516')
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div className="space-y-2">
|
|
187
|
+
<InputOTP
|
|
188
|
+
length={6}
|
|
189
|
+
value={value}
|
|
190
|
+
onChange={setValue}
|
|
191
|
+
/>
|
|
192
|
+
<p className="text-sm text-green-600 text-center">
|
|
193
|
+
Code verified successfully
|
|
194
|
+
</p>
|
|
195
|
+
</div>
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const VerificationFlow: Story = {
|
|
201
|
+
render: function VerificationFlowDemo() {
|
|
202
|
+
const [value, setValue] = React.useState('')
|
|
203
|
+
const [status, setStatus] = React.useState<'idle' | 'verifying' | 'success' | 'error'>('idle')
|
|
204
|
+
|
|
205
|
+
const handleComplete = async (code: string) => {
|
|
206
|
+
setStatus('verifying')
|
|
207
|
+
// Simulate API call
|
|
208
|
+
await new Promise(resolve => setTimeout(resolve, 1500))
|
|
209
|
+
if (code === '123456') {
|
|
210
|
+
setStatus('success')
|
|
211
|
+
} else {
|
|
212
|
+
setStatus('error')
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<div className="space-y-4 p-6 border rounded-lg w-[350px]">
|
|
218
|
+
<div className="text-center">
|
|
219
|
+
<h3 className="font-semibold">Verify Your Email</h3>
|
|
220
|
+
<p className="text-sm text-muted-foreground mt-1">
|
|
221
|
+
We sent a code to your email
|
|
222
|
+
</p>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<InputOTP
|
|
226
|
+
length={6}
|
|
227
|
+
value={value}
|
|
228
|
+
onChange={(v) => {
|
|
229
|
+
setValue(v)
|
|
230
|
+
if (status === 'error') setStatus('idle')
|
|
231
|
+
}}
|
|
232
|
+
onComplete={handleComplete}
|
|
233
|
+
error={status === 'error' ? 'Invalid code. Try again.' : undefined}
|
|
234
|
+
disabled={status === 'verifying' || status === 'success'}
|
|
235
|
+
/>
|
|
236
|
+
|
|
237
|
+
{status === 'verifying' && (
|
|
238
|
+
<p className="text-sm text-muted-foreground text-center">
|
|
239
|
+
Verifying...
|
|
240
|
+
</p>
|
|
241
|
+
)}
|
|
242
|
+
|
|
243
|
+
{status === 'success' && (
|
|
244
|
+
<p className="text-sm text-green-600 text-center">
|
|
245
|
+
Email verified successfully!
|
|
246
|
+
</p>
|
|
247
|
+
)}
|
|
248
|
+
|
|
249
|
+
<p className="text-xs text-muted-foreground text-center">
|
|
250
|
+
Hint: try 123456
|
|
251
|
+
</p>
|
|
252
|
+
</div>
|
|
253
|
+
)
|
|
254
|
+
},
|
|
255
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Label } from './index'
|
|
3
|
+
import { Input } from '../input'
|
|
4
|
+
import { Checkbox } from '../checkbox'
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Label> = {
|
|
7
|
+
title: 'Components/Label',
|
|
8
|
+
component: Label,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: 'Renders an accessible label associated with controls.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof Label>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
children: 'Email address',
|
|
26
|
+
},
|
|
27
|
+
render: (args) => <Label {...args} />,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const WithInput: Story = {
|
|
31
|
+
render: () => (
|
|
32
|
+
<div className="grid w-full max-w-sm items-center gap-1.5">
|
|
33
|
+
<Label htmlFor="email">Email</Label>
|
|
34
|
+
<Input type="email" id="email" placeholder="Email" />
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const WithCheckbox: Story = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<div className="flex items-center space-x-2">
|
|
42
|
+
<Checkbox id="terms" />
|
|
43
|
+
<Label htmlFor="terms">Accept terms and conditions</Label>
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const Required: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<div className="grid w-full max-w-sm items-center gap-1.5">
|
|
51
|
+
<Label htmlFor="name">
|
|
52
|
+
Name <span className="text-destructive">*</span>
|
|
53
|
+
</Label>
|
|
54
|
+
<Input type="text" id="name" placeholder="Enter your name" />
|
|
55
|
+
</div>
|
|
56
|
+
),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Disabled: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<div className="grid w-full max-w-sm items-center gap-1.5">
|
|
62
|
+
<Label htmlFor="disabled" className="text-muted-foreground">
|
|
63
|
+
Disabled field
|
|
64
|
+
</Label>
|
|
65
|
+
<Input type="text" id="disabled" disabled placeholder="Disabled input" />
|
|
66
|
+
</div>
|
|
67
|
+
),
|
|
68
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
Menubar,
|
|
4
|
+
MenubarContent,
|
|
5
|
+
MenubarItem,
|
|
6
|
+
MenubarMenu,
|
|
7
|
+
MenubarSeparator,
|
|
8
|
+
MenubarShortcut,
|
|
9
|
+
MenubarTrigger,
|
|
10
|
+
MenubarCheckboxItem,
|
|
11
|
+
MenubarRadioGroup,
|
|
12
|
+
MenubarRadioItem,
|
|
13
|
+
MenubarSub,
|
|
14
|
+
MenubarSubContent,
|
|
15
|
+
MenubarSubTrigger,
|
|
16
|
+
} from './index'
|
|
17
|
+
import * as React from 'react'
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof Menubar> = {
|
|
20
|
+
title: 'Components/Menubar',
|
|
21
|
+
component: Menubar,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'centered',
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component: 'A visually persistent menu common in desktop applications.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
tags: ['autodocs'],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
type Story = StoryObj<typeof Menubar>
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: {},
|
|
38
|
+
render: (args) => (
|
|
39
|
+
<Menubar {...args}>
|
|
40
|
+
<MenubarMenu>
|
|
41
|
+
<MenubarTrigger>File</MenubarTrigger>
|
|
42
|
+
<MenubarContent>
|
|
43
|
+
<MenubarItem>
|
|
44
|
+
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
|
|
45
|
+
</MenubarItem>
|
|
46
|
+
<MenubarItem>
|
|
47
|
+
New Window <MenubarShortcut>⌘N</MenubarShortcut>
|
|
48
|
+
</MenubarItem>
|
|
49
|
+
<MenubarItem disabled>New Incognito Window</MenubarItem>
|
|
50
|
+
<MenubarSeparator />
|
|
51
|
+
<MenubarItem>
|
|
52
|
+
Share <MenubarShortcut>⌘S</MenubarShortcut>
|
|
53
|
+
</MenubarItem>
|
|
54
|
+
<MenubarSeparator />
|
|
55
|
+
<MenubarItem>
|
|
56
|
+
Print... <MenubarShortcut>⌘P</MenubarShortcut>
|
|
57
|
+
</MenubarItem>
|
|
58
|
+
</MenubarContent>
|
|
59
|
+
</MenubarMenu>
|
|
60
|
+
<MenubarMenu>
|
|
61
|
+
<MenubarTrigger>Edit</MenubarTrigger>
|
|
62
|
+
<MenubarContent>
|
|
63
|
+
<MenubarItem>
|
|
64
|
+
Undo <MenubarShortcut>⌘Z</MenubarShortcut>
|
|
65
|
+
</MenubarItem>
|
|
66
|
+
<MenubarItem>
|
|
67
|
+
Redo <MenubarShortcut>⇧⌘Z</MenubarShortcut>
|
|
68
|
+
</MenubarItem>
|
|
69
|
+
<MenubarSeparator />
|
|
70
|
+
<MenubarItem>
|
|
71
|
+
Cut <MenubarShortcut>⌘X</MenubarShortcut>
|
|
72
|
+
</MenubarItem>
|
|
73
|
+
<MenubarItem>
|
|
74
|
+
Copy <MenubarShortcut>⌘C</MenubarShortcut>
|
|
75
|
+
</MenubarItem>
|
|
76
|
+
<MenubarItem>
|
|
77
|
+
Paste <MenubarShortcut>⌘V</MenubarShortcut>
|
|
78
|
+
</MenubarItem>
|
|
79
|
+
</MenubarContent>
|
|
80
|
+
</MenubarMenu>
|
|
81
|
+
<MenubarMenu>
|
|
82
|
+
<MenubarTrigger>View</MenubarTrigger>
|
|
83
|
+
<MenubarContent>
|
|
84
|
+
<MenubarItem>Reload</MenubarItem>
|
|
85
|
+
<MenubarItem disabled>Force Reload</MenubarItem>
|
|
86
|
+
<MenubarSeparator />
|
|
87
|
+
<MenubarItem>Toggle Fullscreen</MenubarItem>
|
|
88
|
+
</MenubarContent>
|
|
89
|
+
</MenubarMenu>
|
|
90
|
+
</Menubar>
|
|
91
|
+
),
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const WithCheckboxes: Story = {
|
|
95
|
+
render: function MenubarWithCheckboxes() {
|
|
96
|
+
const [showBookmarks, setShowBookmarks] = React.useState(true)
|
|
97
|
+
const [showFullUrls, setShowFullUrls] = React.useState(false)
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Menubar>
|
|
101
|
+
<MenubarMenu>
|
|
102
|
+
<MenubarTrigger>View</MenubarTrigger>
|
|
103
|
+
<MenubarContent>
|
|
104
|
+
<MenubarCheckboxItem
|
|
105
|
+
checked={showBookmarks}
|
|
106
|
+
onCheckedChange={setShowBookmarks}
|
|
107
|
+
>
|
|
108
|
+
Show Bookmarks Bar
|
|
109
|
+
</MenubarCheckboxItem>
|
|
110
|
+
<MenubarCheckboxItem
|
|
111
|
+
checked={showFullUrls}
|
|
112
|
+
onCheckedChange={setShowFullUrls}
|
|
113
|
+
>
|
|
114
|
+
Show Full URLs
|
|
115
|
+
</MenubarCheckboxItem>
|
|
116
|
+
<MenubarSeparator />
|
|
117
|
+
<MenubarItem>
|
|
118
|
+
Zoom In <MenubarShortcut>⌘+</MenubarShortcut>
|
|
119
|
+
</MenubarItem>
|
|
120
|
+
<MenubarItem>
|
|
121
|
+
Zoom Out <MenubarShortcut>⌘-</MenubarShortcut>
|
|
122
|
+
</MenubarItem>
|
|
123
|
+
</MenubarContent>
|
|
124
|
+
</MenubarMenu>
|
|
125
|
+
</Menubar>
|
|
126
|
+
)
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const WithRadioGroup: Story = {
|
|
131
|
+
render: function MenubarWithRadio() {
|
|
132
|
+
const [theme, setTheme] = React.useState('system')
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Menubar>
|
|
136
|
+
<MenubarMenu>
|
|
137
|
+
<MenubarTrigger>Preferences</MenubarTrigger>
|
|
138
|
+
<MenubarContent>
|
|
139
|
+
<MenubarRadioGroup value={theme} onValueChange={setTheme}>
|
|
140
|
+
<MenubarRadioItem value="light">Light</MenubarRadioItem>
|
|
141
|
+
<MenubarRadioItem value="dark">Dark</MenubarRadioItem>
|
|
142
|
+
<MenubarRadioItem value="system">System</MenubarRadioItem>
|
|
143
|
+
</MenubarRadioGroup>
|
|
144
|
+
</MenubarContent>
|
|
145
|
+
</MenubarMenu>
|
|
146
|
+
</Menubar>
|
|
147
|
+
)
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const WithSubmenus: Story = {
|
|
152
|
+
render: () => (
|
|
153
|
+
<Menubar>
|
|
154
|
+
<MenubarMenu>
|
|
155
|
+
<MenubarTrigger>File</MenubarTrigger>
|
|
156
|
+
<MenubarContent>
|
|
157
|
+
<MenubarItem>New File</MenubarItem>
|
|
158
|
+
<MenubarSub>
|
|
159
|
+
<MenubarSubTrigger>Share</MenubarSubTrigger>
|
|
160
|
+
<MenubarSubContent>
|
|
161
|
+
<MenubarItem>Email link</MenubarItem>
|
|
162
|
+
<MenubarItem>Messages</MenubarItem>
|
|
163
|
+
<MenubarItem>Notes</MenubarItem>
|
|
164
|
+
</MenubarSubContent>
|
|
165
|
+
</MenubarSub>
|
|
166
|
+
<MenubarSeparator />
|
|
167
|
+
<MenubarItem>Print</MenubarItem>
|
|
168
|
+
</MenubarContent>
|
|
169
|
+
</MenubarMenu>
|
|
170
|
+
</Menubar>
|
|
171
|
+
),
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const FullExample: Story = {
|
|
175
|
+
render: function FullMenubar() {
|
|
176
|
+
const [bookmarksChecked, setBookmarksChecked] = React.useState(true)
|
|
177
|
+
const [fullUrlsChecked, setFullUrlsChecked] = React.useState(false)
|
|
178
|
+
const [person, setPerson] = React.useState('pedro')
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<Menubar>
|
|
182
|
+
<MenubarMenu>
|
|
183
|
+
<MenubarTrigger>File</MenubarTrigger>
|
|
184
|
+
<MenubarContent>
|
|
185
|
+
<MenubarItem>
|
|
186
|
+
New Tab <MenubarShortcut>⌘T</MenubarShortcut>
|
|
187
|
+
</MenubarItem>
|
|
188
|
+
<MenubarItem>
|
|
189
|
+
New Window <MenubarShortcut>⌘N</MenubarShortcut>
|
|
190
|
+
</MenubarItem>
|
|
191
|
+
<MenubarItem disabled>New Incognito Window</MenubarItem>
|
|
192
|
+
<MenubarSeparator />
|
|
193
|
+
<MenubarSub>
|
|
194
|
+
<MenubarSubTrigger>Share</MenubarSubTrigger>
|
|
195
|
+
<MenubarSubContent>
|
|
196
|
+
<MenubarItem>Email link</MenubarItem>
|
|
197
|
+
<MenubarItem>Messages</MenubarItem>
|
|
198
|
+
<MenubarItem>Notes</MenubarItem>
|
|
199
|
+
</MenubarSubContent>
|
|
200
|
+
</MenubarSub>
|
|
201
|
+
<MenubarSeparator />
|
|
202
|
+
<MenubarItem>
|
|
203
|
+
Print... <MenubarShortcut>⌘P</MenubarShortcut>
|
|
204
|
+
</MenubarItem>
|
|
205
|
+
</MenubarContent>
|
|
206
|
+
</MenubarMenu>
|
|
207
|
+
<MenubarMenu>
|
|
208
|
+
<MenubarTrigger>Edit</MenubarTrigger>
|
|
209
|
+
<MenubarContent>
|
|
210
|
+
<MenubarItem>
|
|
211
|
+
Undo <MenubarShortcut>⌘Z</MenubarShortcut>
|
|
212
|
+
</MenubarItem>
|
|
213
|
+
<MenubarItem>
|
|
214
|
+
Redo <MenubarShortcut>⇧⌘Z</MenubarShortcut>
|
|
215
|
+
</MenubarItem>
|
|
216
|
+
<MenubarSeparator />
|
|
217
|
+
<MenubarSub>
|
|
218
|
+
<MenubarSubTrigger>Find</MenubarSubTrigger>
|
|
219
|
+
<MenubarSubContent>
|
|
220
|
+
<MenubarItem>Search the web</MenubarItem>
|
|
221
|
+
<MenubarSeparator />
|
|
222
|
+
<MenubarItem>Find...</MenubarItem>
|
|
223
|
+
<MenubarItem>Find Next</MenubarItem>
|
|
224
|
+
<MenubarItem>Find Previous</MenubarItem>
|
|
225
|
+
</MenubarSubContent>
|
|
226
|
+
</MenubarSub>
|
|
227
|
+
<MenubarSeparator />
|
|
228
|
+
<MenubarItem>Cut</MenubarItem>
|
|
229
|
+
<MenubarItem>Copy</MenubarItem>
|
|
230
|
+
<MenubarItem>Paste</MenubarItem>
|
|
231
|
+
</MenubarContent>
|
|
232
|
+
</MenubarMenu>
|
|
233
|
+
<MenubarMenu>
|
|
234
|
+
<MenubarTrigger>View</MenubarTrigger>
|
|
235
|
+
<MenubarContent>
|
|
236
|
+
<MenubarCheckboxItem
|
|
237
|
+
checked={bookmarksChecked}
|
|
238
|
+
onCheckedChange={setBookmarksChecked}
|
|
239
|
+
>
|
|
240
|
+
Always Show Bookmarks Bar
|
|
241
|
+
</MenubarCheckboxItem>
|
|
242
|
+
<MenubarCheckboxItem
|
|
243
|
+
checked={fullUrlsChecked}
|
|
244
|
+
onCheckedChange={setFullUrlsChecked}
|
|
245
|
+
>
|
|
246
|
+
Always Show Full URLs
|
|
247
|
+
</MenubarCheckboxItem>
|
|
248
|
+
<MenubarSeparator />
|
|
249
|
+
<MenubarItem inset>
|
|
250
|
+
Reload <MenubarShortcut>⌘R</MenubarShortcut>
|
|
251
|
+
</MenubarItem>
|
|
252
|
+
<MenubarItem disabled inset>
|
|
253
|
+
Force Reload <MenubarShortcut>⇧⌘R</MenubarShortcut>
|
|
254
|
+
</MenubarItem>
|
|
255
|
+
<MenubarSeparator />
|
|
256
|
+
<MenubarItem inset>Toggle Fullscreen</MenubarItem>
|
|
257
|
+
<MenubarSeparator />
|
|
258
|
+
<MenubarItem inset>Hide Sidebar</MenubarItem>
|
|
259
|
+
</MenubarContent>
|
|
260
|
+
</MenubarMenu>
|
|
261
|
+
<MenubarMenu>
|
|
262
|
+
<MenubarTrigger>Profiles</MenubarTrigger>
|
|
263
|
+
<MenubarContent>
|
|
264
|
+
<MenubarRadioGroup value={person} onValueChange={setPerson}>
|
|
265
|
+
<MenubarRadioItem value="andy">Andy</MenubarRadioItem>
|
|
266
|
+
<MenubarRadioItem value="benoit">Benoit</MenubarRadioItem>
|
|
267
|
+
<MenubarRadioItem value="pedro">Pedro</MenubarRadioItem>
|
|
268
|
+
</MenubarRadioGroup>
|
|
269
|
+
<MenubarSeparator />
|
|
270
|
+
<MenubarItem inset>Edit...</MenubarItem>
|
|
271
|
+
<MenubarSeparator />
|
|
272
|
+
<MenubarItem inset>Add Profile...</MenubarItem>
|
|
273
|
+
</MenubarContent>
|
|
274
|
+
</MenubarMenu>
|
|
275
|
+
</Menubar>
|
|
276
|
+
)
|
|
277
|
+
},
|
|
278
|
+
}
|