@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,366 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
WakaResourceGauge,
|
|
4
|
+
WakaResourceGaugeGroup,
|
|
5
|
+
WakaCpuGauge,
|
|
6
|
+
WakaRamGauge,
|
|
7
|
+
WakaStorageGauge,
|
|
8
|
+
WakaNetworkGauge,
|
|
9
|
+
useResourceGauge,
|
|
10
|
+
} from './index'
|
|
11
|
+
import * as React from 'react'
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof WakaResourceGauge> = {
|
|
14
|
+
title: 'Components/Charts/WakaResourceGauge',
|
|
15
|
+
component: WakaResourceGauge,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: 'centered',
|
|
18
|
+
docs: {
|
|
19
|
+
description: {
|
|
20
|
+
component: 'A circular gauge component for displaying resource usage (CPU, RAM, Storage, etc.) with customizable thresholds, animations, and color zones.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
tags: ['autodocs'],
|
|
25
|
+
argTypes: {
|
|
26
|
+
value: {
|
|
27
|
+
control: { type: 'range', min: 0, max: 100, step: 1 },
|
|
28
|
+
description: 'Current value',
|
|
29
|
+
},
|
|
30
|
+
max: {
|
|
31
|
+
control: { type: 'range', min: 50, max: 200, step: 10 },
|
|
32
|
+
description: 'Maximum value',
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
control: 'select',
|
|
36
|
+
options: ['sm', 'md', 'lg'],
|
|
37
|
+
description: 'Gauge size',
|
|
38
|
+
},
|
|
39
|
+
variant: {
|
|
40
|
+
control: 'select',
|
|
41
|
+
options: ['full', 'semi', 'quarter'],
|
|
42
|
+
description: 'Gauge variant',
|
|
43
|
+
},
|
|
44
|
+
showValue: {
|
|
45
|
+
control: 'boolean',
|
|
46
|
+
description: 'Show value in center',
|
|
47
|
+
},
|
|
48
|
+
showLabel: {
|
|
49
|
+
control: 'boolean',
|
|
50
|
+
description: 'Show label',
|
|
51
|
+
},
|
|
52
|
+
animated: {
|
|
53
|
+
control: 'boolean',
|
|
54
|
+
description: 'Enable animations',
|
|
55
|
+
},
|
|
56
|
+
glowOnDanger: {
|
|
57
|
+
control: 'boolean',
|
|
58
|
+
description: 'Enable glow effect in danger zone',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default meta
|
|
64
|
+
type Story = StoryObj<typeof WakaResourceGauge>
|
|
65
|
+
|
|
66
|
+
export const Default: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
value: 65,
|
|
69
|
+
label: 'CPU',
|
|
70
|
+
},
|
|
71
|
+
render: (args) => <WakaResourceGauge {...args} />,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const Sizes: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<div className="flex items-end gap-8">
|
|
77
|
+
<div className="text-center">
|
|
78
|
+
<WakaResourceGauge value={45} label="Small" size="sm" />
|
|
79
|
+
</div>
|
|
80
|
+
<div className="text-center">
|
|
81
|
+
<WakaResourceGauge value={65} label="Medium" size="md" />
|
|
82
|
+
</div>
|
|
83
|
+
<div className="text-center">
|
|
84
|
+
<WakaResourceGauge value={85} label="Large" size="lg" />
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Variants: Story = {
|
|
91
|
+
render: () => (
|
|
92
|
+
<div className="flex items-start gap-8">
|
|
93
|
+
<div className="text-center">
|
|
94
|
+
<WakaResourceGauge value={72} label="Full" variant="full" />
|
|
95
|
+
</div>
|
|
96
|
+
<div className="text-center">
|
|
97
|
+
<WakaResourceGauge value={72} label="Semi" variant="semi" />
|
|
98
|
+
</div>
|
|
99
|
+
<div className="text-center">
|
|
100
|
+
<WakaResourceGauge value={72} label="Quarter" variant="quarter" />
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const ThresholdZones: Story = {
|
|
107
|
+
render: () => (
|
|
108
|
+
<div className="flex gap-8">
|
|
109
|
+
<div className="text-center">
|
|
110
|
+
<WakaResourceGauge value={45} label="Safe Zone" />
|
|
111
|
+
<p className="text-xs text-green-600 mt-1">Below 70%</p>
|
|
112
|
+
</div>
|
|
113
|
+
<div className="text-center">
|
|
114
|
+
<WakaResourceGauge value={78} label="Warning Zone" />
|
|
115
|
+
<p className="text-xs text-yellow-600 mt-1">70% - 85%</p>
|
|
116
|
+
</div>
|
|
117
|
+
<div className="text-center">
|
|
118
|
+
<WakaResourceGauge value={92} label="Danger Zone" />
|
|
119
|
+
<p className="text-xs text-red-600 mt-1">Above 85%</p>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
),
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export const CustomThresholds: Story = {
|
|
126
|
+
render: () => (
|
|
127
|
+
<div className="flex gap-8">
|
|
128
|
+
<div className="text-center">
|
|
129
|
+
<WakaResourceGauge
|
|
130
|
+
value={55}
|
|
131
|
+
label="Conservative"
|
|
132
|
+
thresholds={{ warning: 50, danger: 70 }}
|
|
133
|
+
/>
|
|
134
|
+
<p className="text-xs text-muted-foreground mt-1">Warn at 50%</p>
|
|
135
|
+
</div>
|
|
136
|
+
<div className="text-center">
|
|
137
|
+
<WakaResourceGauge
|
|
138
|
+
value={55}
|
|
139
|
+
label="Default"
|
|
140
|
+
thresholds={{ warning: 70, danger: 85 }}
|
|
141
|
+
/>
|
|
142
|
+
<p className="text-xs text-muted-foreground mt-1">Warn at 70%</p>
|
|
143
|
+
</div>
|
|
144
|
+
<div className="text-center">
|
|
145
|
+
<WakaResourceGauge
|
|
146
|
+
value={55}
|
|
147
|
+
label="Lenient"
|
|
148
|
+
thresholds={{ warning: 80, danger: 95 }}
|
|
149
|
+
/>
|
|
150
|
+
<p className="text-xs text-muted-foreground mt-1">Warn at 80%</p>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
),
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const PresetGauges: Story = {
|
|
157
|
+
render: () => (
|
|
158
|
+
<div className="flex gap-8">
|
|
159
|
+
<WakaCpuGauge value={67} />
|
|
160
|
+
<WakaRamGauge value={48} max={64} />
|
|
161
|
+
<WakaStorageGauge value={256} max={512} />
|
|
162
|
+
<WakaNetworkGauge value={450} max={1000} />
|
|
163
|
+
</div>
|
|
164
|
+
),
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export const WithHistory: Story = {
|
|
168
|
+
render: () => {
|
|
169
|
+
const history = [45, 52, 48, 55, 62, 58, 65, 72, 68, 75, 82, 78, 85, 88, 82]
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<div className="flex gap-8">
|
|
173
|
+
<WakaResourceGauge
|
|
174
|
+
value={82}
|
|
175
|
+
label="With Sparkline"
|
|
176
|
+
history={history}
|
|
177
|
+
/>
|
|
178
|
+
<WakaResourceGauge
|
|
179
|
+
value={65}
|
|
180
|
+
label="No Sparkline"
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
)
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const GaugeGroup: Story = {
|
|
188
|
+
render: () => (
|
|
189
|
+
<WakaResourceGaugeGroup
|
|
190
|
+
gauges={[
|
|
191
|
+
{ id: 'cpu', value: 72, label: 'CPU' },
|
|
192
|
+
{ id: 'ram', value: 58, label: 'RAM', unit: 'GB', max: 64 },
|
|
193
|
+
{ id: 'disk', value: 340, label: 'Disk', unit: 'GB', max: 500 },
|
|
194
|
+
{ id: 'net', value: 45, label: 'Network', unit: 'Mbps' },
|
|
195
|
+
]}
|
|
196
|
+
gap="lg"
|
|
197
|
+
/>
|
|
198
|
+
),
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const VerticalGroup: Story = {
|
|
202
|
+
render: () => (
|
|
203
|
+
<WakaResourceGaugeGroup
|
|
204
|
+
gauges={[
|
|
205
|
+
{ id: 'cpu', value: 72, label: 'CPU', size: 'sm' },
|
|
206
|
+
{ id: 'ram', value: 58, label: 'RAM', size: 'sm' },
|
|
207
|
+
{ id: 'disk', value: 85, label: 'Disk', size: 'sm' },
|
|
208
|
+
]}
|
|
209
|
+
direction="vertical"
|
|
210
|
+
gap="md"
|
|
211
|
+
/>
|
|
212
|
+
),
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export const NoValue: Story = {
|
|
216
|
+
render: () => (
|
|
217
|
+
<WakaResourceGauge value={75} label="CPU" showValue={false} />
|
|
218
|
+
),
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const NoLabel: Story = {
|
|
222
|
+
render: () => (
|
|
223
|
+
<WakaResourceGauge value={75} label="CPU" showLabel={false} />
|
|
224
|
+
),
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export const NoGlow: Story = {
|
|
228
|
+
render: () => (
|
|
229
|
+
<div className="flex gap-8">
|
|
230
|
+
<div className="text-center">
|
|
231
|
+
<WakaResourceGauge value={92} label="With Glow" glowOnDanger />
|
|
232
|
+
</div>
|
|
233
|
+
<div className="text-center">
|
|
234
|
+
<WakaResourceGauge value={92} label="No Glow" glowOnDanger={false} />
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
),
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export const NoAnimation: Story = {
|
|
241
|
+
render: () => (
|
|
242
|
+
<WakaResourceGauge value={75} label="Static" animated={false} />
|
|
243
|
+
),
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export const WithHook: Story = {
|
|
247
|
+
render: () => {
|
|
248
|
+
const { value, percentage, history, updateValue } = useResourceGauge(50, 100)
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<div className="space-y-4">
|
|
252
|
+
<div className="flex gap-2 justify-center">
|
|
253
|
+
<button
|
|
254
|
+
onClick={() => updateValue(value - 10)}
|
|
255
|
+
className="px-3 py-1 text-sm border rounded hover:bg-muted"
|
|
256
|
+
>
|
|
257
|
+
-10
|
|
258
|
+
</button>
|
|
259
|
+
<button
|
|
260
|
+
onClick={() => updateValue(value + 10)}
|
|
261
|
+
className="px-3 py-1 text-sm border rounded hover:bg-muted"
|
|
262
|
+
>
|
|
263
|
+
+10
|
|
264
|
+
</button>
|
|
265
|
+
<button
|
|
266
|
+
onClick={() => updateValue(Math.floor(Math.random() * 100))}
|
|
267
|
+
className="px-3 py-1 text-sm border rounded hover:bg-muted"
|
|
268
|
+
>
|
|
269
|
+
Random
|
|
270
|
+
</button>
|
|
271
|
+
</div>
|
|
272
|
+
<WakaResourceGauge
|
|
273
|
+
value={value}
|
|
274
|
+
label="Interactive"
|
|
275
|
+
history={history}
|
|
276
|
+
/>
|
|
277
|
+
<p className="text-sm text-muted-foreground text-center">
|
|
278
|
+
Value: {value} | Percentage: {percentage.toFixed(1)}%
|
|
279
|
+
</p>
|
|
280
|
+
</div>
|
|
281
|
+
)
|
|
282
|
+
},
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export const ServerDashboard: Story = {
|
|
286
|
+
render: () => {
|
|
287
|
+
const cpuHistory = [42, 45, 48, 52, 55, 58, 62, 65, 68, 72]
|
|
288
|
+
const ramHistory = [55, 54, 56, 58, 57, 59, 61, 60, 62, 64]
|
|
289
|
+
|
|
290
|
+
return (
|
|
291
|
+
<div className="w-[600px] p-6 border rounded-lg">
|
|
292
|
+
<div className="flex justify-between items-start mb-6">
|
|
293
|
+
<div>
|
|
294
|
+
<h3 className="text-lg font-semibold">Server Status</h3>
|
|
295
|
+
<p className="text-sm text-muted-foreground">Production Web Server 01</p>
|
|
296
|
+
</div>
|
|
297
|
+
<div className="flex items-center gap-2">
|
|
298
|
+
<div className="w-2 h-2 rounded-full bg-green-500 animate-pulse" />
|
|
299
|
+
<span className="text-sm text-green-600">Healthy</span>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
<div className="flex justify-center gap-12">
|
|
303
|
+
<WakaResourceGauge
|
|
304
|
+
value={72}
|
|
305
|
+
label="CPU"
|
|
306
|
+
size="lg"
|
|
307
|
+
history={cpuHistory}
|
|
308
|
+
/>
|
|
309
|
+
<WakaResourceGauge
|
|
310
|
+
value={64}
|
|
311
|
+
label="RAM"
|
|
312
|
+
unit="GB"
|
|
313
|
+
max={128}
|
|
314
|
+
size="lg"
|
|
315
|
+
history={ramHistory}
|
|
316
|
+
/>
|
|
317
|
+
<WakaResourceGauge
|
|
318
|
+
value={340}
|
|
319
|
+
label="Disk"
|
|
320
|
+
unit="GB"
|
|
321
|
+
max={500}
|
|
322
|
+
size="lg"
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
)
|
|
327
|
+
},
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export const CompactResourceMonitor: Story = {
|
|
331
|
+
render: () => (
|
|
332
|
+
<div className="w-[300px] p-4 border rounded-lg">
|
|
333
|
+
<h4 className="text-sm font-medium mb-4">Resource Monitor</h4>
|
|
334
|
+
<div className="flex justify-around">
|
|
335
|
+
<WakaResourceGauge value={72} label="CPU" size="sm" variant="semi" />
|
|
336
|
+
<WakaResourceGauge value={58} label="RAM" size="sm" variant="semi" />
|
|
337
|
+
<WakaResourceGauge value={45} label="Net" size="sm" variant="semi" />
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
),
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export const CriticalAlert: Story = {
|
|
344
|
+
render: () => (
|
|
345
|
+
<div className="p-6 border border-red-200 bg-red-50 rounded-lg dark:border-red-900 dark:bg-red-950/50">
|
|
346
|
+
<div className="flex items-center gap-4 mb-4">
|
|
347
|
+
<div className="w-3 h-3 rounded-full bg-red-500 animate-pulse" />
|
|
348
|
+
<h3 className="text-lg font-semibold text-red-700 dark:text-red-400">Critical Resource Alert</h3>
|
|
349
|
+
</div>
|
|
350
|
+
<div className="flex gap-8 justify-center">
|
|
351
|
+
<WakaResourceGauge
|
|
352
|
+
value={95}
|
|
353
|
+
label="CPU"
|
|
354
|
+
size="lg"
|
|
355
|
+
glowOnDanger
|
|
356
|
+
/>
|
|
357
|
+
<WakaResourceGauge
|
|
358
|
+
value={92}
|
|
359
|
+
label="Memory"
|
|
360
|
+
size="lg"
|
|
361
|
+
glowOnDanger
|
|
362
|
+
/>
|
|
363
|
+
</div>
|
|
364
|
+
</div>
|
|
365
|
+
),
|
|
366
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { WakaRichTextEditor } from './index'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof WakaRichTextEditor> = {
|
|
6
|
+
title: 'Components/Forms/WakaRichTextEditor',
|
|
7
|
+
component: WakaRichTextEditor,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A rich text editor with toolbar, formatting options, and character count.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
showCharacterCount: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
description: 'Show character count',
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
control: 'boolean',
|
|
24
|
+
description: 'Disable the editor',
|
|
25
|
+
},
|
|
26
|
+
editable: {
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
description: 'Make content editable',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
type Story = StoryObj<typeof WakaRichTextEditor>
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
render: function EditorDemo() {
|
|
38
|
+
const [content, setContent] = React.useState('<p>Start typing...</p>')
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className="w-[600px]">
|
|
42
|
+
<WakaRichTextEditor
|
|
43
|
+
value={content}
|
|
44
|
+
onChange={setContent}
|
|
45
|
+
label="Content"
|
|
46
|
+
placeholder="Write something..."
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const WithCharacterCount: Story = {
|
|
54
|
+
render: function CharCountDemo() {
|
|
55
|
+
const [content, setContent] = React.useState('')
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className="w-[600px]">
|
|
59
|
+
<WakaRichTextEditor
|
|
60
|
+
value={content}
|
|
61
|
+
onChange={setContent}
|
|
62
|
+
label="Description"
|
|
63
|
+
showCharacterCount
|
|
64
|
+
maxLength={500}
|
|
65
|
+
placeholder="Enter description (max 500 characters)"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const CustomToolbar: Story = {
|
|
73
|
+
render: function CustomToolbarDemo() {
|
|
74
|
+
const [content, setContent] = React.useState('')
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div className="w-[600px]">
|
|
78
|
+
<WakaRichTextEditor
|
|
79
|
+
value={content}
|
|
80
|
+
onChange={setContent}
|
|
81
|
+
label="Simple Editor"
|
|
82
|
+
toolbar={[
|
|
83
|
+
['bold', 'italic', 'underline'],
|
|
84
|
+
['bulletList', 'orderedList'],
|
|
85
|
+
['undo', 'redo'],
|
|
86
|
+
]}
|
|
87
|
+
placeholder="Simple toolbar..."
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const FullToolbar: Story = {
|
|
95
|
+
render: function FullToolbarDemo() {
|
|
96
|
+
const [content, setContent] = React.useState('')
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<div className="w-[700px]">
|
|
100
|
+
<WakaRichTextEditor
|
|
101
|
+
value={content}
|
|
102
|
+
onChange={setContent}
|
|
103
|
+
label="Full Editor"
|
|
104
|
+
toolbar={[
|
|
105
|
+
['bold', 'italic', 'underline', 'strike'],
|
|
106
|
+
['h1', 'h2', 'h3'],
|
|
107
|
+
['bulletList', 'orderedList', 'blockquote'],
|
|
108
|
+
['alignLeft', 'alignCenter', 'alignRight'],
|
|
109
|
+
['link', 'code'],
|
|
110
|
+
['undo', 'redo'],
|
|
111
|
+
]}
|
|
112
|
+
minHeight={300}
|
|
113
|
+
showCharacterCount
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const WithDescription: Story = {
|
|
121
|
+
render: function DescriptionDemo() {
|
|
122
|
+
const [content, setContent] = React.useState('')
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<div className="w-[600px]">
|
|
126
|
+
<WakaRichTextEditor
|
|
127
|
+
value={content}
|
|
128
|
+
onChange={setContent}
|
|
129
|
+
label="Article Content"
|
|
130
|
+
description="Write your article content. Use the toolbar to format text."
|
|
131
|
+
placeholder="Start writing your article..."
|
|
132
|
+
minHeight={250}
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
)
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const WithError: Story = {
|
|
140
|
+
render: function ErrorDemo() {
|
|
141
|
+
const [content, setContent] = React.useState('')
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<div className="w-[600px]">
|
|
145
|
+
<WakaRichTextEditor
|
|
146
|
+
value={content}
|
|
147
|
+
onChange={setContent}
|
|
148
|
+
label="Required Content"
|
|
149
|
+
error="Content is required"
|
|
150
|
+
placeholder="Enter required content..."
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
)
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const Disabled: Story = {
|
|
158
|
+
render: () => (
|
|
159
|
+
<div className="w-[600px]">
|
|
160
|
+
<WakaRichTextEditor
|
|
161
|
+
value="<p>This content cannot be edited.</p>"
|
|
162
|
+
label="Disabled Editor"
|
|
163
|
+
disabled
|
|
164
|
+
/>
|
|
165
|
+
</div>
|
|
166
|
+
),
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const ReadOnly: Story = {
|
|
170
|
+
render: () => (
|
|
171
|
+
<div className="w-[600px]">
|
|
172
|
+
<WakaRichTextEditor
|
|
173
|
+
value="<p><strong>Read-only content</strong></p><p>This content is displayed but cannot be edited.</p>"
|
|
174
|
+
label="Read Only"
|
|
175
|
+
editable={false}
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
),
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const MinimalHeight: Story = {
|
|
182
|
+
render: function MinimalDemo() {
|
|
183
|
+
const [content, setContent] = React.useState('')
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div className="w-[600px]">
|
|
187
|
+
<WakaRichTextEditor
|
|
188
|
+
value={content}
|
|
189
|
+
onChange={setContent}
|
|
190
|
+
label="Short Note"
|
|
191
|
+
minHeight={100}
|
|
192
|
+
toolbar={[['bold', 'italic'], ['undo', 'redo']]}
|
|
193
|
+
placeholder="Quick note..."
|
|
194
|
+
/>
|
|
195
|
+
</div>
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const BlogPostEditor: Story = {
|
|
201
|
+
render: function BlogPostDemo() {
|
|
202
|
+
const [content, setContent] = React.useState('')
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<div className="w-[700px] space-y-4 p-4 border rounded-lg">
|
|
206
|
+
<div>
|
|
207
|
+
<h3 className="font-semibold text-lg">Create Blog Post</h3>
|
|
208
|
+
<p className="text-sm text-muted-foreground">
|
|
209
|
+
Write and format your blog post content
|
|
210
|
+
</p>
|
|
211
|
+
</div>
|
|
212
|
+
<div className="space-y-2">
|
|
213
|
+
<label className="text-sm font-medium">Title</label>
|
|
214
|
+
<input
|
|
215
|
+
type="text"
|
|
216
|
+
className="w-full px-3 py-2 border rounded-md"
|
|
217
|
+
placeholder="Enter post title..."
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
<WakaRichTextEditor
|
|
221
|
+
value={content}
|
|
222
|
+
onChange={setContent}
|
|
223
|
+
label="Content"
|
|
224
|
+
minHeight={350}
|
|
225
|
+
showCharacterCount
|
|
226
|
+
toolbar={[
|
|
227
|
+
['bold', 'italic', 'underline'],
|
|
228
|
+
['h2', 'h3'],
|
|
229
|
+
['bulletList', 'orderedList', 'blockquote'],
|
|
230
|
+
['link', 'code'],
|
|
231
|
+
['undo', 'redo'],
|
|
232
|
+
]}
|
|
233
|
+
placeholder="Write your blog post content..."
|
|
234
|
+
/>
|
|
235
|
+
</div>
|
|
236
|
+
)
|
|
237
|
+
},
|
|
238
|
+
}
|