@wakastellar/ui 2.3.5 → 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/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/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-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/error-pages/ErrorPages.stories.tsx +401 -0
- 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/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/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/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/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,366 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { WakaTypewriter, WakaTypewriterHeading, WakaTypewriterCode, WakaTypewriterLines, useTypewriter } from './index'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof WakaTypewriter> = {
|
|
6
|
+
title: 'Components/Effects/WakaTypewriter',
|
|
7
|
+
component: WakaTypewriter,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A typewriter animation component with configurable speed, cursor, and multi-line support.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
typeSpeed: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['slow', 'normal', 'fast'],
|
|
21
|
+
description: 'Typing speed',
|
|
22
|
+
},
|
|
23
|
+
deleteSpeed: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['slow', 'normal', 'fast'],
|
|
26
|
+
description: 'Delete speed',
|
|
27
|
+
},
|
|
28
|
+
loop: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Loop through strings',
|
|
31
|
+
},
|
|
32
|
+
cursor: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: 'Show blinking cursor',
|
|
35
|
+
},
|
|
36
|
+
cursorChar: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'Custom cursor character',
|
|
39
|
+
},
|
|
40
|
+
startDelay: {
|
|
41
|
+
control: { type: 'range', min: 0, max: 2000, step: 100 },
|
|
42
|
+
description: 'Delay before starting in ms',
|
|
43
|
+
},
|
|
44
|
+
pauseDelay: {
|
|
45
|
+
control: { type: 'range', min: 500, max: 5000, step: 250 },
|
|
46
|
+
description: 'Pause after typing in ms',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default meta
|
|
52
|
+
type Story = StoryObj<typeof WakaTypewriter>
|
|
53
|
+
|
|
54
|
+
export const Default: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
strings: [
|
|
57
|
+
'Hello, World!',
|
|
58
|
+
'Welcome to Storybook',
|
|
59
|
+
'This is a typewriter effect',
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
render: (args) => (
|
|
63
|
+
<div className="text-2xl font-semibold">
|
|
64
|
+
<WakaTypewriter {...args} />
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const SingleString: Story = {
|
|
70
|
+
render: () => (
|
|
71
|
+
<div className="text-xl">
|
|
72
|
+
<WakaTypewriter
|
|
73
|
+
strings={['This text types once and stops.']}
|
|
74
|
+
loop={false}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
),
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const Speeds: Story = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<div className="space-y-6">
|
|
83
|
+
<div>
|
|
84
|
+
<p className="text-sm text-muted-foreground mb-2">Slow</p>
|
|
85
|
+
<WakaTypewriter
|
|
86
|
+
strings={['Slow typing speed...']}
|
|
87
|
+
typeSpeed="slow"
|
|
88
|
+
loop={false}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
<div>
|
|
92
|
+
<p className="text-sm text-muted-foreground mb-2">Normal</p>
|
|
93
|
+
<WakaTypewriter
|
|
94
|
+
strings={['Normal typing speed...']}
|
|
95
|
+
typeSpeed="normal"
|
|
96
|
+
loop={false}
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
<div>
|
|
100
|
+
<p className="text-sm text-muted-foreground mb-2">Fast</p>
|
|
101
|
+
<WakaTypewriter
|
|
102
|
+
strings={['Fast typing speed...']}
|
|
103
|
+
typeSpeed="fast"
|
|
104
|
+
loop={false}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const CursorStyles: Story = {
|
|
112
|
+
render: () => (
|
|
113
|
+
<div className="space-y-6 text-xl">
|
|
114
|
+
<div>
|
|
115
|
+
<WakaTypewriter
|
|
116
|
+
strings={['Default cursor |']}
|
|
117
|
+
cursorChar="|"
|
|
118
|
+
loop={false}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
<div>
|
|
122
|
+
<WakaTypewriter
|
|
123
|
+
strings={['Underscore cursor _']}
|
|
124
|
+
cursorChar="_"
|
|
125
|
+
loop={false}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<WakaTypewriter
|
|
130
|
+
strings={['Block cursor █']}
|
|
131
|
+
cursorChar="█"
|
|
132
|
+
loop={false}
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
<div>
|
|
136
|
+
<WakaTypewriter
|
|
137
|
+
strings={['No cursor']}
|
|
138
|
+
cursor={false}
|
|
139
|
+
loop={false}
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const Headings: Story = {
|
|
147
|
+
render: () => (
|
|
148
|
+
<div className="space-y-6">
|
|
149
|
+
<WakaTypewriterHeading
|
|
150
|
+
level={1}
|
|
151
|
+
strings={['Build amazing products']}
|
|
152
|
+
loop={false}
|
|
153
|
+
/>
|
|
154
|
+
<WakaTypewriterHeading
|
|
155
|
+
level={2}
|
|
156
|
+
strings={['Scale with confidence']}
|
|
157
|
+
loop={false}
|
|
158
|
+
startDelay={1500}
|
|
159
|
+
/>
|
|
160
|
+
<WakaTypewriterHeading
|
|
161
|
+
level={3}
|
|
162
|
+
strings={['Ship faster than ever']}
|
|
163
|
+
loop={false}
|
|
164
|
+
startDelay={3000}
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
167
|
+
),
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const CodeTyping: Story = {
|
|
171
|
+
render: () => (
|
|
172
|
+
<div className="space-y-4">
|
|
173
|
+
<p className="text-muted-foreground">Install with:</p>
|
|
174
|
+
<WakaTypewriterCode
|
|
175
|
+
strings={[
|
|
176
|
+
'npm install @wakastellar/ui',
|
|
177
|
+
'pnpm add @wakastellar/ui',
|
|
178
|
+
'yarn add @wakastellar/ui',
|
|
179
|
+
]}
|
|
180
|
+
pauseDelay={3000}
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
),
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const MultipleLines: Story = {
|
|
187
|
+
render: () => (
|
|
188
|
+
<WakaTypewriterLines
|
|
189
|
+
lines={[
|
|
190
|
+
'First line appears...',
|
|
191
|
+
'Then the second line...',
|
|
192
|
+
'And finally the third!',
|
|
193
|
+
]}
|
|
194
|
+
staggerDelay={1500}
|
|
195
|
+
className="text-lg"
|
|
196
|
+
/>
|
|
197
|
+
),
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const HeroSection: Story = {
|
|
201
|
+
render: () => (
|
|
202
|
+
<div className="text-center max-w-2xl">
|
|
203
|
+
<WakaTypewriterHeading
|
|
204
|
+
level={1}
|
|
205
|
+
strings={[
|
|
206
|
+
'Build faster.',
|
|
207
|
+
'Ship sooner.',
|
|
208
|
+
'Scale better.',
|
|
209
|
+
]}
|
|
210
|
+
pauseDelay={2500}
|
|
211
|
+
className="text-5xl"
|
|
212
|
+
/>
|
|
213
|
+
<p className="mt-6 text-xl text-muted-foreground">
|
|
214
|
+
The modern component library for React applications
|
|
215
|
+
</p>
|
|
216
|
+
</div>
|
|
217
|
+
),
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export const ChatSimulation: Story = {
|
|
221
|
+
render: () => {
|
|
222
|
+
const [messages, setMessages] = React.useState<string[]>([])
|
|
223
|
+
|
|
224
|
+
const chatMessages = [
|
|
225
|
+
'Hey! How can I help you today?',
|
|
226
|
+
"I'm here to assist with your coding questions.",
|
|
227
|
+
'Feel free to ask anything!',
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
React.useEffect(() => {
|
|
231
|
+
let i = 0
|
|
232
|
+
const interval = setInterval(() => {
|
|
233
|
+
if (i < chatMessages.length) {
|
|
234
|
+
setMessages((prev) => [...prev, chatMessages[i]])
|
|
235
|
+
i++
|
|
236
|
+
} else {
|
|
237
|
+
clearInterval(interval)
|
|
238
|
+
}
|
|
239
|
+
}, 3000)
|
|
240
|
+
return () => clearInterval(interval)
|
|
241
|
+
}, [])
|
|
242
|
+
|
|
243
|
+
return (
|
|
244
|
+
<div className="w-[400px] border rounded-lg p-4 space-y-4">
|
|
245
|
+
<div className="flex items-center gap-2 pb-2 border-b">
|
|
246
|
+
<div className="w-3 h-3 rounded-full bg-green-500" />
|
|
247
|
+
<span className="font-medium">AI Assistant</span>
|
|
248
|
+
</div>
|
|
249
|
+
<div className="space-y-3 min-h-[200px]">
|
|
250
|
+
{messages.map((msg, i) => (
|
|
251
|
+
<div key={i} className="bg-muted p-3 rounded-lg">
|
|
252
|
+
<WakaTypewriter
|
|
253
|
+
strings={[msg]}
|
|
254
|
+
typeSpeed="fast"
|
|
255
|
+
loop={false}
|
|
256
|
+
cursor={i === messages.length - 1}
|
|
257
|
+
/>
|
|
258
|
+
</div>
|
|
259
|
+
))}
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
)
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export const TerminalEffect: Story = {
|
|
267
|
+
render: () => (
|
|
268
|
+
<div className="w-[500px] bg-gray-900 text-green-400 rounded-lg p-4 font-mono text-sm">
|
|
269
|
+
<div className="flex items-center gap-2 mb-4">
|
|
270
|
+
<div className="w-3 h-3 rounded-full bg-red-500" />
|
|
271
|
+
<div className="w-3 h-3 rounded-full bg-yellow-500" />
|
|
272
|
+
<div className="w-3 h-3 rounded-full bg-green-500" />
|
|
273
|
+
<span className="ml-2 text-gray-500">terminal</span>
|
|
274
|
+
</div>
|
|
275
|
+
<WakaTypewriterLines
|
|
276
|
+
lines={[
|
|
277
|
+
'$ npm install @wakastellar/ui',
|
|
278
|
+
'Installing dependencies...',
|
|
279
|
+
'✓ Added 42 packages in 3.2s',
|
|
280
|
+
'$ npm run dev',
|
|
281
|
+
'Starting development server...',
|
|
282
|
+
'✓ Ready on http://localhost:3000',
|
|
283
|
+
]}
|
|
284
|
+
staggerDelay={800}
|
|
285
|
+
typeSpeed="fast"
|
|
286
|
+
cursorChar="_"
|
|
287
|
+
className="space-y-1"
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
290
|
+
),
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export const WithHook: Story = {
|
|
294
|
+
render: () => {
|
|
295
|
+
const { text, isTyping, restart, pause, resume, isActive } = useTypewriter({
|
|
296
|
+
strings: ['Using the useTypewriter hook', 'Full programmatic control', 'Pause, resume, and restart'],
|
|
297
|
+
typeSpeed: 50,
|
|
298
|
+
deleteSpeed: 25,
|
|
299
|
+
startDelay: 500,
|
|
300
|
+
pauseDelay: 2000,
|
|
301
|
+
nextDelay: 500,
|
|
302
|
+
loop: true,
|
|
303
|
+
pauseOnChars: '.,!?',
|
|
304
|
+
charPauseDuration: 300,
|
|
305
|
+
active: true,
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<div className="space-y-4">
|
|
310
|
+
<div className="text-2xl font-semibold min-h-[40px]">
|
|
311
|
+
{text}
|
|
312
|
+
<span className="animate-pulse">|</span>
|
|
313
|
+
</div>
|
|
314
|
+
<div className="flex gap-2">
|
|
315
|
+
<button
|
|
316
|
+
onClick={restart}
|
|
317
|
+
className="px-3 py-1 text-sm border rounded hover:bg-muted"
|
|
318
|
+
>
|
|
319
|
+
Restart
|
|
320
|
+
</button>
|
|
321
|
+
<button
|
|
322
|
+
onClick={isActive ? pause : resume}
|
|
323
|
+
className="px-3 py-1 text-sm border rounded hover:bg-muted"
|
|
324
|
+
>
|
|
325
|
+
{isActive ? 'Pause' : 'Resume'}
|
|
326
|
+
</button>
|
|
327
|
+
</div>
|
|
328
|
+
<p className="text-sm text-muted-foreground">
|
|
329
|
+
Status: {isTyping ? 'Typing...' : 'Deleting...'}
|
|
330
|
+
</p>
|
|
331
|
+
</div>
|
|
332
|
+
)
|
|
333
|
+
},
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export const PauseOnPunctuation: Story = {
|
|
337
|
+
render: () => (
|
|
338
|
+
<div className="text-xl">
|
|
339
|
+
<WakaTypewriter
|
|
340
|
+
strings={['Hello, world! How are you? I hope you are doing well.']}
|
|
341
|
+
pauseOnChars=".,!?"
|
|
342
|
+
charPauseDuration={500}
|
|
343
|
+
loop={false}
|
|
344
|
+
/>
|
|
345
|
+
</div>
|
|
346
|
+
),
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export const Callbacks: Story = {
|
|
350
|
+
render: () => {
|
|
351
|
+
const [status, setStatus] = React.useState('Waiting...')
|
|
352
|
+
|
|
353
|
+
return (
|
|
354
|
+
<div className="space-y-4">
|
|
355
|
+
<WakaTypewriter
|
|
356
|
+
strings={['First string', 'Second string', 'Third string']}
|
|
357
|
+
onTypeComplete={(index) => setStatus(`Finished typing string ${index + 1}`)}
|
|
358
|
+
onDeleteComplete={(index) => setStatus(`Finished deleting string ${index + 1}`)}
|
|
359
|
+
onComplete={() => setStatus('All strings completed!')}
|
|
360
|
+
loop={false}
|
|
361
|
+
/>
|
|
362
|
+
<p className="text-sm text-muted-foreground">{status}</p>
|
|
363
|
+
</div>
|
|
364
|
+
)
|
|
365
|
+
},
|
|
366
|
+
}
|