@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,125 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from './index'
|
|
3
|
+
import { Button } from '../button'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Card> = {
|
|
6
|
+
title: 'Components/Card',
|
|
7
|
+
component: Card,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A container component for grouping related content and actions.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof Card>
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
className: 'w-[350px]',
|
|
25
|
+
},
|
|
26
|
+
render: (args) => (
|
|
27
|
+
<Card {...args}>
|
|
28
|
+
<CardHeader>
|
|
29
|
+
<CardTitle>Card Title</CardTitle>
|
|
30
|
+
<CardDescription>Card Description</CardDescription>
|
|
31
|
+
</CardHeader>
|
|
32
|
+
<CardContent>
|
|
33
|
+
<p>Card Content</p>
|
|
34
|
+
</CardContent>
|
|
35
|
+
<CardFooter>
|
|
36
|
+
<p>Card Footer</p>
|
|
37
|
+
</CardFooter>
|
|
38
|
+
</Card>
|
|
39
|
+
),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const WithForm: Story = {
|
|
43
|
+
render: () => (
|
|
44
|
+
<Card className="w-[350px]">
|
|
45
|
+
<CardHeader>
|
|
46
|
+
<CardTitle>Create project</CardTitle>
|
|
47
|
+
<CardDescription>Deploy your new project in one-click.</CardDescription>
|
|
48
|
+
</CardHeader>
|
|
49
|
+
<CardContent>
|
|
50
|
+
<form>
|
|
51
|
+
<div className="grid w-full items-center gap-4">
|
|
52
|
+
<div className="flex flex-col space-y-1.5">
|
|
53
|
+
<label htmlFor="name" className="text-sm font-medium">Name</label>
|
|
54
|
+
<input id="name" placeholder="Name of your project" className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm" />
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</form>
|
|
58
|
+
</CardContent>
|
|
59
|
+
<CardFooter className="flex justify-between">
|
|
60
|
+
<Button variant="outline">Cancel</Button>
|
|
61
|
+
<Button>Deploy</Button>
|
|
62
|
+
</CardFooter>
|
|
63
|
+
</Card>
|
|
64
|
+
),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const Simple: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<Card className="w-[350px]">
|
|
70
|
+
<CardHeader>
|
|
71
|
+
<CardTitle>Notifications</CardTitle>
|
|
72
|
+
</CardHeader>
|
|
73
|
+
<CardContent>
|
|
74
|
+
<p className="text-sm text-muted-foreground">
|
|
75
|
+
You have 3 unread messages.
|
|
76
|
+
</p>
|
|
77
|
+
</CardContent>
|
|
78
|
+
</Card>
|
|
79
|
+
),
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const WithImage: Story = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<Card className="w-[350px] overflow-hidden">
|
|
85
|
+
<div className="h-48 bg-gradient-to-br from-primary/20 to-primary/5" />
|
|
86
|
+
<CardHeader>
|
|
87
|
+
<CardTitle>Beautiful Gradient</CardTitle>
|
|
88
|
+
<CardDescription>A card with a gradient header</CardDescription>
|
|
89
|
+
</CardHeader>
|
|
90
|
+
<CardContent>
|
|
91
|
+
<p className="text-sm text-muted-foreground">
|
|
92
|
+
Cards can include images, gradients, or any other visual elements.
|
|
93
|
+
</p>
|
|
94
|
+
</CardContent>
|
|
95
|
+
</Card>
|
|
96
|
+
),
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const Interactive: Story = {
|
|
100
|
+
parameters: {
|
|
101
|
+
chromatic: { disableSnapshot: false },
|
|
102
|
+
},
|
|
103
|
+
render: () => (
|
|
104
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
105
|
+
<Card className="w-[250px]">
|
|
106
|
+
<CardHeader>
|
|
107
|
+
<CardTitle>Total Revenue</CardTitle>
|
|
108
|
+
<CardDescription>+20.1% from last month</CardDescription>
|
|
109
|
+
</CardHeader>
|
|
110
|
+
<CardContent>
|
|
111
|
+
<div className="text-2xl font-bold">$45,231.89</div>
|
|
112
|
+
</CardContent>
|
|
113
|
+
</Card>
|
|
114
|
+
<Card className="w-[250px]">
|
|
115
|
+
<CardHeader>
|
|
116
|
+
<CardTitle>Subscriptions</CardTitle>
|
|
117
|
+
<CardDescription>+180.1% from last month</CardDescription>
|
|
118
|
+
</CardHeader>
|
|
119
|
+
<CardContent>
|
|
120
|
+
<div className="text-2xl font-bold">+2350</div>
|
|
121
|
+
</CardContent>
|
|
122
|
+
</Card>
|
|
123
|
+
</div>
|
|
124
|
+
),
|
|
125
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Checkbox } from './index'
|
|
3
|
+
import { Label } from '../label'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Checkbox> = {
|
|
6
|
+
title: 'Components/Checkbox',
|
|
7
|
+
component: Checkbox,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A control that allows the user to toggle between checked and not checked.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
checked: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
description: 'The controlled checked state of the checkbox',
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
control: 'boolean',
|
|
24
|
+
description: 'When true, prevents the user from interacting with the checkbox',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default meta
|
|
30
|
+
type Story = StoryObj<typeof Checkbox>
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
id: 'terms',
|
|
35
|
+
disabled: false,
|
|
36
|
+
},
|
|
37
|
+
render: (args) => (
|
|
38
|
+
<div className="flex items-center space-x-2">
|
|
39
|
+
<Checkbox {...args} />
|
|
40
|
+
<Label htmlFor="terms">Accept terms and conditions</Label>
|
|
41
|
+
</div>
|
|
42
|
+
),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const Checked: Story = {
|
|
46
|
+
render: () => (
|
|
47
|
+
<div className="flex items-center space-x-2">
|
|
48
|
+
<Checkbox id="checked" defaultChecked />
|
|
49
|
+
<Label htmlFor="checked">This is checked by default</Label>
|
|
50
|
+
</div>
|
|
51
|
+
),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Disabled: Story = {
|
|
55
|
+
render: () => (
|
|
56
|
+
<div className="flex flex-col gap-4">
|
|
57
|
+
<div className="flex items-center space-x-2">
|
|
58
|
+
<Checkbox id="disabled" disabled />
|
|
59
|
+
<Label htmlFor="disabled" className="text-muted-foreground">Disabled unchecked</Label>
|
|
60
|
+
</div>
|
|
61
|
+
<div className="flex items-center space-x-2">
|
|
62
|
+
<Checkbox id="disabled-checked" disabled defaultChecked />
|
|
63
|
+
<Label htmlFor="disabled-checked" className="text-muted-foreground">Disabled checked</Label>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const WithText: Story = {
|
|
70
|
+
render: () => (
|
|
71
|
+
<div className="items-top flex space-x-2">
|
|
72
|
+
<Checkbox id="terms1" />
|
|
73
|
+
<div className="grid gap-1.5 leading-none">
|
|
74
|
+
<Label htmlFor="terms1">Accept terms and conditions</Label>
|
|
75
|
+
<p className="text-sm text-muted-foreground">
|
|
76
|
+
You agree to our Terms of Service and Privacy Policy.
|
|
77
|
+
</p>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
),
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const FormExample: Story = {
|
|
84
|
+
render: () => (
|
|
85
|
+
<div className="flex flex-col gap-3">
|
|
86
|
+
<div className="flex items-center space-x-2">
|
|
87
|
+
<Checkbox id="email" />
|
|
88
|
+
<Label htmlFor="email">Email notifications</Label>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="flex items-center space-x-2">
|
|
91
|
+
<Checkbox id="sms" />
|
|
92
|
+
<Label htmlFor="sms">SMS notifications</Label>
|
|
93
|
+
</div>
|
|
94
|
+
<div className="flex items-center space-x-2">
|
|
95
|
+
<Checkbox id="push" defaultChecked />
|
|
96
|
+
<Label htmlFor="push">Push notifications</Label>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Code } from './index'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Code> = {
|
|
6
|
+
title: 'Components/Display/Code',
|
|
7
|
+
component: Code,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'A code display component with syntax highlighting, line numbers, and copy functionality.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
variant: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['inline', 'block'],
|
|
21
|
+
description: 'Display variant',
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
control: 'select',
|
|
25
|
+
options: ['sm', 'base', 'lg'],
|
|
26
|
+
description: 'Font size',
|
|
27
|
+
},
|
|
28
|
+
language: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'Programming language for syntax highlighting',
|
|
31
|
+
},
|
|
32
|
+
showLineNumbers: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: 'Show line numbers',
|
|
35
|
+
},
|
|
36
|
+
copyable: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
description: 'Show copy button',
|
|
39
|
+
},
|
|
40
|
+
filename: {
|
|
41
|
+
control: 'text',
|
|
42
|
+
description: 'Filename to display in header',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default meta
|
|
48
|
+
type Story = StoryObj<typeof Code>
|
|
49
|
+
|
|
50
|
+
export const Inline: Story = {
|
|
51
|
+
render: () => (
|
|
52
|
+
<p className="text-base">
|
|
53
|
+
Use the <Code>npm install</Code> command to install dependencies, or run{' '}
|
|
54
|
+
<Code>yarn add package-name</Code> if you prefer Yarn.
|
|
55
|
+
</p>
|
|
56
|
+
),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Block: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<div className="w-[600px]">
|
|
62
|
+
<Code variant="block" language="typescript" copyable>
|
|
63
|
+
{`function greet(name: string): string {
|
|
64
|
+
return \`Hello, \${name}!\`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const message = greet("World")
|
|
68
|
+
console.log(message)`}
|
|
69
|
+
</Code>
|
|
70
|
+
</div>
|
|
71
|
+
),
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const WithFilename: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<div className="w-[600px]">
|
|
77
|
+
<Code variant="block" language="typescript" filename="src/utils/greet.ts" copyable>
|
|
78
|
+
{`export function greet(name: string): string {
|
|
79
|
+
return \`Hello, \${name}!\`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function farewell(name: string): string {
|
|
83
|
+
return \`Goodbye, \${name}!\`
|
|
84
|
+
}`}
|
|
85
|
+
</Code>
|
|
86
|
+
</div>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const WithLineNumbers: Story = {
|
|
91
|
+
render: () => (
|
|
92
|
+
<div className="w-[600px]">
|
|
93
|
+
<Code variant="block" language="javascript" showLineNumbers copyable>
|
|
94
|
+
{`const express = require('express')
|
|
95
|
+
const app = express()
|
|
96
|
+
const port = 3000
|
|
97
|
+
|
|
98
|
+
app.get('/', (req, res) => {
|
|
99
|
+
res.send('Hello World!')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
app.listen(port, () => {
|
|
103
|
+
console.log(\`Server running at http://localhost:\${port}\`)
|
|
104
|
+
})`}
|
|
105
|
+
</Code>
|
|
106
|
+
</div>
|
|
107
|
+
),
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const Languages: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<div className="w-[600px] space-y-6">
|
|
113
|
+
<div>
|
|
114
|
+
<p className="text-sm text-muted-foreground mb-2">TypeScript</p>
|
|
115
|
+
<Code variant="block" language="typescript" copyable>
|
|
116
|
+
{`interface User {
|
|
117
|
+
id: number
|
|
118
|
+
name: string
|
|
119
|
+
email: string
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const users: User[] = []`}
|
|
123
|
+
</Code>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div>
|
|
127
|
+
<p className="text-sm text-muted-foreground mb-2">Python</p>
|
|
128
|
+
<Code variant="block" language="python" copyable>
|
|
129
|
+
{`def fibonacci(n: int) -> list[int]:
|
|
130
|
+
if n <= 0:
|
|
131
|
+
return []
|
|
132
|
+
elif n == 1:
|
|
133
|
+
return [0]
|
|
134
|
+
|
|
135
|
+
fib = [0, 1]
|
|
136
|
+
for i in range(2, n):
|
|
137
|
+
fib.append(fib[i-1] + fib[i-2])
|
|
138
|
+
return fib`}
|
|
139
|
+
</Code>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div>
|
|
143
|
+
<p className="text-sm text-muted-foreground mb-2">Bash</p>
|
|
144
|
+
<Code variant="block" language="bash" copyable>
|
|
145
|
+
{`#!/bin/bash
|
|
146
|
+
|
|
147
|
+
echo "Installing dependencies..."
|
|
148
|
+
npm install
|
|
149
|
+
|
|
150
|
+
echo "Building project..."
|
|
151
|
+
npm run build
|
|
152
|
+
|
|
153
|
+
echo "Done!"`}
|
|
154
|
+
</Code>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div>
|
|
158
|
+
<p className="text-sm text-muted-foreground mb-2">JSON</p>
|
|
159
|
+
<Code variant="block" language="json" copyable>
|
|
160
|
+
{`{
|
|
161
|
+
"name": "@wakastellar/ui",
|
|
162
|
+
"version": "1.0.0",
|
|
163
|
+
"dependencies": {
|
|
164
|
+
"react": "^18.0.0",
|
|
165
|
+
"typescript": "^5.0.0"
|
|
166
|
+
}
|
|
167
|
+
}`}
|
|
168
|
+
</Code>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div>
|
|
172
|
+
<p className="text-sm text-muted-foreground mb-2">CSS</p>
|
|
173
|
+
<Code variant="block" language="css" copyable>
|
|
174
|
+
{`.button {
|
|
175
|
+
display: inline-flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
padding: 0.5rem 1rem;
|
|
178
|
+
border-radius: 0.375rem;
|
|
179
|
+
background-color: var(--primary);
|
|
180
|
+
color: var(--primary-foreground);
|
|
181
|
+
}`}
|
|
182
|
+
</Code>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
),
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export const Sizes: Story = {
|
|
189
|
+
render: () => (
|
|
190
|
+
<div className="w-[600px] space-y-6">
|
|
191
|
+
<div>
|
|
192
|
+
<p className="text-sm text-muted-foreground mb-2">Small</p>
|
|
193
|
+
<Code variant="block" language="javascript" size="sm">
|
|
194
|
+
{`const sum = (a, b) => a + b
|
|
195
|
+
console.log(sum(1, 2))`}
|
|
196
|
+
</Code>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div>
|
|
200
|
+
<p className="text-sm text-muted-foreground mb-2">Base (Default)</p>
|
|
201
|
+
<Code variant="block" language="javascript" size="base">
|
|
202
|
+
{`const sum = (a, b) => a + b
|
|
203
|
+
console.log(sum(1, 2))`}
|
|
204
|
+
</Code>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div>
|
|
208
|
+
<p className="text-sm text-muted-foreground mb-2">Large</p>
|
|
209
|
+
<Code variant="block" language="javascript" size="lg">
|
|
210
|
+
{`const sum = (a, b) => a + b
|
|
211
|
+
console.log(sum(1, 2))`}
|
|
212
|
+
</Code>
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
),
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export const MaxHeight: Story = {
|
|
219
|
+
render: () => (
|
|
220
|
+
<div className="w-[600px]">
|
|
221
|
+
<Code variant="block" language="typescript" maxHeight={200} copyable>
|
|
222
|
+
{`// This is a long code block that will scroll
|
|
223
|
+
interface User {
|
|
224
|
+
id: number
|
|
225
|
+
name: string
|
|
226
|
+
email: string
|
|
227
|
+
createdAt: Date
|
|
228
|
+
updatedAt: Date
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface Post {
|
|
232
|
+
id: number
|
|
233
|
+
title: string
|
|
234
|
+
content: string
|
|
235
|
+
authorId: number
|
|
236
|
+
published: boolean
|
|
237
|
+
createdAt: Date
|
|
238
|
+
updatedAt: Date
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
interface Comment {
|
|
242
|
+
id: number
|
|
243
|
+
content: string
|
|
244
|
+
postId: number
|
|
245
|
+
authorId: number
|
|
246
|
+
createdAt: Date
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
type CreateUserInput = Omit<User, 'id' | 'createdAt' | 'updatedAt'>
|
|
250
|
+
type UpdateUserInput = Partial<CreateUserInput>
|
|
251
|
+
|
|
252
|
+
type CreatePostInput = Omit<Post, 'id' | 'createdAt' | 'updatedAt'>
|
|
253
|
+
type UpdatePostInput = Partial<CreatePostInput>`}
|
|
254
|
+
</Code>
|
|
255
|
+
</div>
|
|
256
|
+
),
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export const ReactComponent: Story = {
|
|
260
|
+
render: () => (
|
|
261
|
+
<div className="w-[700px]">
|
|
262
|
+
<Code variant="block" language="tsx" filename="Button.tsx" copyable showLineNumbers>
|
|
263
|
+
{`import * as React from 'react'
|
|
264
|
+
import { cn } from '@/utils/cn'
|
|
265
|
+
|
|
266
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
267
|
+
variant?: 'default' | 'outline' | 'ghost'
|
|
268
|
+
size?: 'sm' | 'md' | 'lg'
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
272
|
+
({ className, variant = 'default', size = 'md', ...props }, ref) => {
|
|
273
|
+
return (
|
|
274
|
+
<button
|
|
275
|
+
ref={ref}
|
|
276
|
+
className={cn(
|
|
277
|
+
'inline-flex items-center justify-center rounded-md font-medium',
|
|
278
|
+
'transition-colors focus-visible:outline-none focus-visible:ring-2',
|
|
279
|
+
variantClasses[variant],
|
|
280
|
+
sizeClasses[size],
|
|
281
|
+
className
|
|
282
|
+
)}
|
|
283
|
+
{...props}
|
|
284
|
+
/>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
Button.displayName = 'Button'`}
|
|
290
|
+
</Code>
|
|
291
|
+
</div>
|
|
292
|
+
),
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export const SQL: Story = {
|
|
296
|
+
render: () => (
|
|
297
|
+
<div className="w-[600px]">
|
|
298
|
+
<Code variant="block" language="sql" copyable>
|
|
299
|
+
{`SELECT
|
|
300
|
+
users.id,
|
|
301
|
+
users.name,
|
|
302
|
+
users.email,
|
|
303
|
+
COUNT(posts.id) as post_count
|
|
304
|
+
FROM users
|
|
305
|
+
LEFT JOIN posts ON posts.author_id = users.id
|
|
306
|
+
WHERE users.created_at >= '2024-01-01'
|
|
307
|
+
GROUP BY users.id, users.name, users.email
|
|
308
|
+
HAVING COUNT(posts.id) > 5
|
|
309
|
+
ORDER BY post_count DESC
|
|
310
|
+
LIMIT 10;`}
|
|
311
|
+
</Code>
|
|
312
|
+
</div>
|
|
313
|
+
),
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export const Docker: Story = {
|
|
317
|
+
render: () => (
|
|
318
|
+
<div className="w-[600px]">
|
|
319
|
+
<Code variant="block" language="docker" filename="Dockerfile" copyable>
|
|
320
|
+
{`FROM node:20-alpine AS builder
|
|
321
|
+
|
|
322
|
+
WORKDIR /app
|
|
323
|
+
|
|
324
|
+
COPY package*.json ./
|
|
325
|
+
RUN npm ci
|
|
326
|
+
|
|
327
|
+
COPY . .
|
|
328
|
+
RUN npm run build
|
|
329
|
+
|
|
330
|
+
FROM node:20-alpine AS runner
|
|
331
|
+
|
|
332
|
+
WORKDIR /app
|
|
333
|
+
|
|
334
|
+
ENV NODE_ENV=production
|
|
335
|
+
|
|
336
|
+
COPY --from=builder /app/dist ./dist
|
|
337
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
338
|
+
|
|
339
|
+
EXPOSE 3000
|
|
340
|
+
|
|
341
|
+
CMD ["node", "dist/server.js"]`}
|
|
342
|
+
</Code>
|
|
343
|
+
</div>
|
|
344
|
+
),
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export const YAML: Story = {
|
|
348
|
+
render: () => (
|
|
349
|
+
<div className="w-[600px]">
|
|
350
|
+
<Code variant="block" language="yaml" filename=".github/workflows/ci.yml" copyable>
|
|
351
|
+
{`name: CI
|
|
352
|
+
|
|
353
|
+
on:
|
|
354
|
+
push:
|
|
355
|
+
branches: [main]
|
|
356
|
+
pull_request:
|
|
357
|
+
branches: [main]
|
|
358
|
+
|
|
359
|
+
jobs:
|
|
360
|
+
build:
|
|
361
|
+
runs-on: ubuntu-latest
|
|
362
|
+
|
|
363
|
+
steps:
|
|
364
|
+
- uses: actions/checkout@v4
|
|
365
|
+
|
|
366
|
+
- name: Setup Node.js
|
|
367
|
+
uses: actions/setup-node@v4
|
|
368
|
+
with:
|
|
369
|
+
node-version: '20'
|
|
370
|
+
cache: 'npm'
|
|
371
|
+
|
|
372
|
+
- name: Install dependencies
|
|
373
|
+
run: npm ci
|
|
374
|
+
|
|
375
|
+
- name: Run tests
|
|
376
|
+
run: npm test
|
|
377
|
+
|
|
378
|
+
- name: Build
|
|
379
|
+
run: npm run build`}
|
|
380
|
+
</Code>
|
|
381
|
+
</div>
|
|
382
|
+
),
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export const InParagraph: Story = {
|
|
386
|
+
render: () => (
|
|
387
|
+
<div className="max-w-prose space-y-4">
|
|
388
|
+
<p>
|
|
389
|
+
To install the package, run <Code>npm install @wakastellar/ui</Code> in your terminal.
|
|
390
|
+
Make sure you have Node.js version 18 or higher installed.
|
|
391
|
+
</p>
|
|
392
|
+
<p>
|
|
393
|
+
Import the components you need: <Code>{`import { Button } from '@wakastellar/ui'`}</Code>.
|
|
394
|
+
The library supports both ESM and CommonJS module formats.
|
|
395
|
+
</p>
|
|
396
|
+
<p>
|
|
397
|
+
For TypeScript users, types are included automatically. You can use the{' '}
|
|
398
|
+
<Code>ButtonProps</Code> type to extend the component's props.
|
|
399
|
+
</p>
|
|
400
|
+
</div>
|
|
401
|
+
),
|
|
402
|
+
}
|