@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,123 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from './index'
|
|
3
|
+
import { Button } from '../button'
|
|
4
|
+
import { ChevronsUpDown } from 'lucide-react'
|
|
5
|
+
import * as React from 'react'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Collapsible> = {
|
|
8
|
+
title: 'Components/Collapsible',
|
|
9
|
+
component: Collapsible,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: 'An interactive component which expands/collapses a panel.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof Collapsible>
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
render: function CollapsibleDemo() {
|
|
26
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Collapsible
|
|
30
|
+
open={isOpen}
|
|
31
|
+
onOpenChange={setIsOpen}
|
|
32
|
+
className="w-[350px] space-y-2"
|
|
33
|
+
>
|
|
34
|
+
<div className="flex items-center justify-between space-x-4 px-4">
|
|
35
|
+
<h4 className="text-sm font-semibold">
|
|
36
|
+
@peduarte starred 3 repositories
|
|
37
|
+
</h4>
|
|
38
|
+
<CollapsibleTrigger asChild>
|
|
39
|
+
<Button variant="ghost" size="sm" className="w-9 p-0">
|
|
40
|
+
<ChevronsUpDown className="h-4 w-4" />
|
|
41
|
+
<span className="sr-only">Toggle</span>
|
|
42
|
+
</Button>
|
|
43
|
+
</CollapsibleTrigger>
|
|
44
|
+
</div>
|
|
45
|
+
<div className="rounded-md border px-4 py-3 font-mono text-sm">
|
|
46
|
+
@radix-ui/primitives
|
|
47
|
+
</div>
|
|
48
|
+
<CollapsibleContent className="space-y-2">
|
|
49
|
+
<div className="rounded-md border px-4 py-3 font-mono text-sm">
|
|
50
|
+
@radix-ui/colors
|
|
51
|
+
</div>
|
|
52
|
+
<div className="rounded-md border px-4 py-3 font-mono text-sm">
|
|
53
|
+
@stitches/react
|
|
54
|
+
</div>
|
|
55
|
+
</CollapsibleContent>
|
|
56
|
+
</Collapsible>
|
|
57
|
+
)
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const OpenByDefault: Story = {
|
|
62
|
+
render: () => (
|
|
63
|
+
<Collapsible defaultOpen className="w-[350px] space-y-2">
|
|
64
|
+
<div className="flex items-center justify-between space-x-4 px-4">
|
|
65
|
+
<h4 className="text-sm font-semibold">Settings</h4>
|
|
66
|
+
<CollapsibleTrigger asChild>
|
|
67
|
+
<Button variant="ghost" size="sm" className="w-9 p-0">
|
|
68
|
+
<ChevronsUpDown className="h-4 w-4" />
|
|
69
|
+
</Button>
|
|
70
|
+
</CollapsibleTrigger>
|
|
71
|
+
</div>
|
|
72
|
+
<CollapsibleContent className="space-y-2">
|
|
73
|
+
<div className="rounded-md border px-4 py-3 text-sm">
|
|
74
|
+
<label className="flex items-center justify-between">
|
|
75
|
+
<span>Dark mode</span>
|
|
76
|
+
<input type="checkbox" className="h-4 w-4" />
|
|
77
|
+
</label>
|
|
78
|
+
</div>
|
|
79
|
+
<div className="rounded-md border px-4 py-3 text-sm">
|
|
80
|
+
<label className="flex items-center justify-between">
|
|
81
|
+
<span>Notifications</span>
|
|
82
|
+
<input type="checkbox" className="h-4 w-4" defaultChecked />
|
|
83
|
+
</label>
|
|
84
|
+
</div>
|
|
85
|
+
</CollapsibleContent>
|
|
86
|
+
</Collapsible>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Nested: Story = {
|
|
91
|
+
render: () => (
|
|
92
|
+
<div className="w-[350px] space-y-2">
|
|
93
|
+
<Collapsible>
|
|
94
|
+
<div className="flex items-center justify-between space-x-4 px-4">
|
|
95
|
+
<h4 className="text-sm font-semibold">Section 1</h4>
|
|
96
|
+
<CollapsibleTrigger asChild>
|
|
97
|
+
<Button variant="ghost" size="sm" className="w-9 p-0">
|
|
98
|
+
<ChevronsUpDown className="h-4 w-4" />
|
|
99
|
+
</Button>
|
|
100
|
+
</CollapsibleTrigger>
|
|
101
|
+
</div>
|
|
102
|
+
<CollapsibleContent className="space-y-2 mt-2">
|
|
103
|
+
<div className="rounded-md border px-4 py-3 text-sm">Content 1</div>
|
|
104
|
+
<div className="rounded-md border px-4 py-3 text-sm">Content 2</div>
|
|
105
|
+
</CollapsibleContent>
|
|
106
|
+
</Collapsible>
|
|
107
|
+
<Collapsible>
|
|
108
|
+
<div className="flex items-center justify-between space-x-4 px-4">
|
|
109
|
+
<h4 className="text-sm font-semibold">Section 2</h4>
|
|
110
|
+
<CollapsibleTrigger asChild>
|
|
111
|
+
<Button variant="ghost" size="sm" className="w-9 p-0">
|
|
112
|
+
<ChevronsUpDown className="h-4 w-4" />
|
|
113
|
+
</Button>
|
|
114
|
+
</CollapsibleTrigger>
|
|
115
|
+
</div>
|
|
116
|
+
<CollapsibleContent className="space-y-2 mt-2">
|
|
117
|
+
<div className="rounded-md border px-4 py-3 text-sm">Content A</div>
|
|
118
|
+
<div className="rounded-md border px-4 py-3 text-sm">Content B</div>
|
|
119
|
+
</CollapsibleContent>
|
|
120
|
+
</Collapsible>
|
|
121
|
+
</div>
|
|
122
|
+
),
|
|
123
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
Command,
|
|
4
|
+
CommandDialog,
|
|
5
|
+
CommandEmpty,
|
|
6
|
+
CommandGroup,
|
|
7
|
+
CommandInput,
|
|
8
|
+
CommandItem,
|
|
9
|
+
CommandList,
|
|
10
|
+
CommandSeparator,
|
|
11
|
+
CommandShortcut,
|
|
12
|
+
} from './index'
|
|
13
|
+
import { Button } from '../button'
|
|
14
|
+
import {
|
|
15
|
+
Calculator,
|
|
16
|
+
Calendar,
|
|
17
|
+
CreditCard,
|
|
18
|
+
Settings,
|
|
19
|
+
Smile,
|
|
20
|
+
User,
|
|
21
|
+
} from 'lucide-react'
|
|
22
|
+
import * as React from 'react'
|
|
23
|
+
|
|
24
|
+
const meta: Meta<typeof Command> = {
|
|
25
|
+
title: 'Components/Command',
|
|
26
|
+
component: Command,
|
|
27
|
+
parameters: {
|
|
28
|
+
layout: 'centered',
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component: 'Fast, composable, unstyled command menu for React.',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
tags: ['autodocs'],
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default meta
|
|
39
|
+
type Story = StoryObj<typeof Command>
|
|
40
|
+
|
|
41
|
+
export const Default: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
className: 'rounded-lg border shadow-md w-[400px]',
|
|
44
|
+
},
|
|
45
|
+
render: (args) => (
|
|
46
|
+
<Command {...args}>
|
|
47
|
+
<CommandInput placeholder="Type a command or search..." />
|
|
48
|
+
<CommandList>
|
|
49
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
50
|
+
<CommandGroup heading="Suggestions">
|
|
51
|
+
<CommandItem>
|
|
52
|
+
<Calendar className="mr-2 h-4 w-4" />
|
|
53
|
+
<span>Calendar</span>
|
|
54
|
+
</CommandItem>
|
|
55
|
+
<CommandItem>
|
|
56
|
+
<Smile className="mr-2 h-4 w-4" />
|
|
57
|
+
<span>Search Emoji</span>
|
|
58
|
+
</CommandItem>
|
|
59
|
+
<CommandItem>
|
|
60
|
+
<Calculator className="mr-2 h-4 w-4" />
|
|
61
|
+
<span>Calculator</span>
|
|
62
|
+
</CommandItem>
|
|
63
|
+
</CommandGroup>
|
|
64
|
+
<CommandSeparator />
|
|
65
|
+
<CommandGroup heading="Settings">
|
|
66
|
+
<CommandItem>
|
|
67
|
+
<User className="mr-2 h-4 w-4" />
|
|
68
|
+
<span>Profile</span>
|
|
69
|
+
<CommandShortcut>⌘P</CommandShortcut>
|
|
70
|
+
</CommandItem>
|
|
71
|
+
<CommandItem>
|
|
72
|
+
<CreditCard className="mr-2 h-4 w-4" />
|
|
73
|
+
<span>Billing</span>
|
|
74
|
+
<CommandShortcut>⌘B</CommandShortcut>
|
|
75
|
+
</CommandItem>
|
|
76
|
+
<CommandItem>
|
|
77
|
+
<Settings className="mr-2 h-4 w-4" />
|
|
78
|
+
<span>Settings</span>
|
|
79
|
+
<CommandShortcut>⌘S</CommandShortcut>
|
|
80
|
+
</CommandItem>
|
|
81
|
+
</CommandGroup>
|
|
82
|
+
</CommandList>
|
|
83
|
+
</Command>
|
|
84
|
+
),
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const DialogExample: Story = {
|
|
88
|
+
render: function CommandDialogDemo() {
|
|
89
|
+
const [open, setOpen] = React.useState(false)
|
|
90
|
+
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
const down = (e: KeyboardEvent) => {
|
|
93
|
+
if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
|
|
94
|
+
e.preventDefault()
|
|
95
|
+
setOpen((open) => !open)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
document.addEventListener('keydown', down)
|
|
99
|
+
return () => document.removeEventListener('keydown', down)
|
|
100
|
+
}, [])
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<>
|
|
104
|
+
<p className="text-sm text-muted-foreground mb-4">
|
|
105
|
+
Press{' '}
|
|
106
|
+
<kbd className="pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100">
|
|
107
|
+
<span className="text-xs">⌘</span>K
|
|
108
|
+
</kbd>
|
|
109
|
+
</p>
|
|
110
|
+
<Button onClick={() => setOpen(true)} variant="outline">
|
|
111
|
+
Open Command Menu
|
|
112
|
+
</Button>
|
|
113
|
+
<CommandDialog open={open} onOpenChange={setOpen}>
|
|
114
|
+
<CommandInput placeholder="Type a command or search..." />
|
|
115
|
+
<CommandList>
|
|
116
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
117
|
+
<CommandGroup heading="Suggestions">
|
|
118
|
+
<CommandItem>
|
|
119
|
+
<Calendar className="mr-2 h-4 w-4" />
|
|
120
|
+
<span>Calendar</span>
|
|
121
|
+
</CommandItem>
|
|
122
|
+
<CommandItem>
|
|
123
|
+
<Smile className="mr-2 h-4 w-4" />
|
|
124
|
+
<span>Search Emoji</span>
|
|
125
|
+
</CommandItem>
|
|
126
|
+
<CommandItem>
|
|
127
|
+
<Calculator className="mr-2 h-4 w-4" />
|
|
128
|
+
<span>Calculator</span>
|
|
129
|
+
</CommandItem>
|
|
130
|
+
</CommandGroup>
|
|
131
|
+
<CommandSeparator />
|
|
132
|
+
<CommandGroup heading="Settings">
|
|
133
|
+
<CommandItem>
|
|
134
|
+
<User className="mr-2 h-4 w-4" />
|
|
135
|
+
<span>Profile</span>
|
|
136
|
+
<CommandShortcut>⌘P</CommandShortcut>
|
|
137
|
+
</CommandItem>
|
|
138
|
+
<CommandItem>
|
|
139
|
+
<CreditCard className="mr-2 h-4 w-4" />
|
|
140
|
+
<span>Billing</span>
|
|
141
|
+
<CommandShortcut>⌘B</CommandShortcut>
|
|
142
|
+
</CommandItem>
|
|
143
|
+
<CommandItem>
|
|
144
|
+
<Settings className="mr-2 h-4 w-4" />
|
|
145
|
+
<span>Settings</span>
|
|
146
|
+
<CommandShortcut>⌘S</CommandShortcut>
|
|
147
|
+
</CommandItem>
|
|
148
|
+
</CommandGroup>
|
|
149
|
+
</CommandList>
|
|
150
|
+
</CommandDialog>
|
|
151
|
+
</>
|
|
152
|
+
)
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const WithGroups: Story = {
|
|
157
|
+
render: () => (
|
|
158
|
+
<Command className="rounded-lg border shadow-md w-[400px]">
|
|
159
|
+
<CommandInput placeholder="Search..." />
|
|
160
|
+
<CommandList>
|
|
161
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
162
|
+
<CommandGroup heading="Recent">
|
|
163
|
+
<CommandItem>
|
|
164
|
+
<Calendar className="mr-2 h-4 w-4" />
|
|
165
|
+
<span>Meeting with team</span>
|
|
166
|
+
</CommandItem>
|
|
167
|
+
<CommandItem>
|
|
168
|
+
<User className="mr-2 h-4 w-4" />
|
|
169
|
+
<span>John Doe</span>
|
|
170
|
+
</CommandItem>
|
|
171
|
+
</CommandGroup>
|
|
172
|
+
<CommandSeparator />
|
|
173
|
+
<CommandGroup heading="Files">
|
|
174
|
+
<CommandItem>design-system.fig</CommandItem>
|
|
175
|
+
<CommandItem>components.tsx</CommandItem>
|
|
176
|
+
<CommandItem>package.json</CommandItem>
|
|
177
|
+
</CommandGroup>
|
|
178
|
+
<CommandSeparator />
|
|
179
|
+
<CommandGroup heading="Actions">
|
|
180
|
+
<CommandItem>
|
|
181
|
+
<Settings className="mr-2 h-4 w-4" />
|
|
182
|
+
<span>Settings</span>
|
|
183
|
+
<CommandShortcut>⌘,</CommandShortcut>
|
|
184
|
+
</CommandItem>
|
|
185
|
+
</CommandGroup>
|
|
186
|
+
</CommandList>
|
|
187
|
+
</Command>
|
|
188
|
+
),
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export const Simple: Story = {
|
|
192
|
+
render: () => (
|
|
193
|
+
<Command className="rounded-lg border shadow-md w-[300px]">
|
|
194
|
+
<CommandInput placeholder="Search..." />
|
|
195
|
+
<CommandList>
|
|
196
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
197
|
+
<CommandGroup>
|
|
198
|
+
<CommandItem>Apple</CommandItem>
|
|
199
|
+
<CommandItem>Banana</CommandItem>
|
|
200
|
+
<CommandItem>Cherry</CommandItem>
|
|
201
|
+
<CommandItem>Date</CommandItem>
|
|
202
|
+
<CommandItem>Elderberry</CommandItem>
|
|
203
|
+
</CommandGroup>
|
|
204
|
+
</CommandList>
|
|
205
|
+
</Command>
|
|
206
|
+
),
|
|
207
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
ContextMenu,
|
|
4
|
+
ContextMenuCheckboxItem,
|
|
5
|
+
ContextMenuContent,
|
|
6
|
+
ContextMenuItem,
|
|
7
|
+
ContextMenuLabel,
|
|
8
|
+
ContextMenuRadioGroup,
|
|
9
|
+
ContextMenuRadioItem,
|
|
10
|
+
ContextMenuSeparator,
|
|
11
|
+
ContextMenuShortcut,
|
|
12
|
+
ContextMenuSub,
|
|
13
|
+
ContextMenuSubContent,
|
|
14
|
+
ContextMenuSubTrigger,
|
|
15
|
+
ContextMenuTrigger,
|
|
16
|
+
} from './index'
|
|
17
|
+
import * as React from 'react'
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof ContextMenu> = {
|
|
20
|
+
title: 'Components/ContextMenu',
|
|
21
|
+
component: ContextMenu,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'centered',
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component: 'Displays a menu to the user triggered by right-click.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
tags: ['autodocs'],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default meta
|
|
34
|
+
type Story = StoryObj<typeof ContextMenu>
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: {},
|
|
38
|
+
render: (args) => (
|
|
39
|
+
<ContextMenu {...args}>
|
|
40
|
+
<ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
|
|
41
|
+
Right click here
|
|
42
|
+
</ContextMenuTrigger>
|
|
43
|
+
<ContextMenuContent className="w-64">
|
|
44
|
+
<ContextMenuItem inset>
|
|
45
|
+
Back
|
|
46
|
+
<ContextMenuShortcut>⌘[</ContextMenuShortcut>
|
|
47
|
+
</ContextMenuItem>
|
|
48
|
+
<ContextMenuItem inset disabled>
|
|
49
|
+
Forward
|
|
50
|
+
<ContextMenuShortcut>⌘]</ContextMenuShortcut>
|
|
51
|
+
</ContextMenuItem>
|
|
52
|
+
<ContextMenuItem inset>
|
|
53
|
+
Reload
|
|
54
|
+
<ContextMenuShortcut>⌘R</ContextMenuShortcut>
|
|
55
|
+
</ContextMenuItem>
|
|
56
|
+
<ContextMenuSub>
|
|
57
|
+
<ContextMenuSubTrigger inset>More Tools</ContextMenuSubTrigger>
|
|
58
|
+
<ContextMenuSubContent className="w-48">
|
|
59
|
+
<ContextMenuItem>
|
|
60
|
+
Save Page As...
|
|
61
|
+
<ContextMenuShortcut>⇧⌘S</ContextMenuShortcut>
|
|
62
|
+
</ContextMenuItem>
|
|
63
|
+
<ContextMenuItem>Create Shortcut...</ContextMenuItem>
|
|
64
|
+
<ContextMenuItem>Name Window...</ContextMenuItem>
|
|
65
|
+
<ContextMenuSeparator />
|
|
66
|
+
<ContextMenuItem>Developer Tools</ContextMenuItem>
|
|
67
|
+
</ContextMenuSubContent>
|
|
68
|
+
</ContextMenuSub>
|
|
69
|
+
<ContextMenuSeparator />
|
|
70
|
+
<ContextMenuCheckboxItem checked>
|
|
71
|
+
Show Bookmarks Bar
|
|
72
|
+
<ContextMenuShortcut>⌘⇧B</ContextMenuShortcut>
|
|
73
|
+
</ContextMenuCheckboxItem>
|
|
74
|
+
<ContextMenuCheckboxItem>Show Full URLs</ContextMenuCheckboxItem>
|
|
75
|
+
<ContextMenuSeparator />
|
|
76
|
+
<ContextMenuRadioGroup value="pedro">
|
|
77
|
+
<ContextMenuLabel inset>People</ContextMenuLabel>
|
|
78
|
+
<ContextMenuSeparator />
|
|
79
|
+
<ContextMenuRadioItem value="pedro">
|
|
80
|
+
Pedro Duarte
|
|
81
|
+
</ContextMenuRadioItem>
|
|
82
|
+
<ContextMenuRadioItem value="colm">Colm Tuite</ContextMenuRadioItem>
|
|
83
|
+
</ContextMenuRadioGroup>
|
|
84
|
+
</ContextMenuContent>
|
|
85
|
+
</ContextMenu>
|
|
86
|
+
),
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const Simple: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<ContextMenu>
|
|
92
|
+
<ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
|
|
93
|
+
Right click here
|
|
94
|
+
</ContextMenuTrigger>
|
|
95
|
+
<ContextMenuContent>
|
|
96
|
+
<ContextMenuItem>Cut</ContextMenuItem>
|
|
97
|
+
<ContextMenuItem>Copy</ContextMenuItem>
|
|
98
|
+
<ContextMenuItem>Paste</ContextMenuItem>
|
|
99
|
+
<ContextMenuSeparator />
|
|
100
|
+
<ContextMenuItem>Delete</ContextMenuItem>
|
|
101
|
+
</ContextMenuContent>
|
|
102
|
+
</ContextMenu>
|
|
103
|
+
),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const WithCheckboxes: Story = {
|
|
107
|
+
render: function ContextMenuWithCheckboxes() {
|
|
108
|
+
const [showStatusBar, setShowStatusBar] = React.useState(true)
|
|
109
|
+
const [showActivityBar, setShowActivityBar] = React.useState(false)
|
|
110
|
+
const [showPanel, setShowPanel] = React.useState(false)
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<ContextMenu>
|
|
114
|
+
<ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
|
|
115
|
+
Right click here
|
|
116
|
+
</ContextMenuTrigger>
|
|
117
|
+
<ContextMenuContent className="w-64">
|
|
118
|
+
<ContextMenuLabel>Appearance</ContextMenuLabel>
|
|
119
|
+
<ContextMenuSeparator />
|
|
120
|
+
<ContextMenuCheckboxItem
|
|
121
|
+
checked={showStatusBar}
|
|
122
|
+
onCheckedChange={setShowStatusBar}
|
|
123
|
+
>
|
|
124
|
+
Status Bar
|
|
125
|
+
</ContextMenuCheckboxItem>
|
|
126
|
+
<ContextMenuCheckboxItem
|
|
127
|
+
checked={showActivityBar}
|
|
128
|
+
onCheckedChange={setShowActivityBar}
|
|
129
|
+
>
|
|
130
|
+
Activity Bar
|
|
131
|
+
</ContextMenuCheckboxItem>
|
|
132
|
+
<ContextMenuCheckboxItem
|
|
133
|
+
checked={showPanel}
|
|
134
|
+
onCheckedChange={setShowPanel}
|
|
135
|
+
>
|
|
136
|
+
Panel
|
|
137
|
+
</ContextMenuCheckboxItem>
|
|
138
|
+
</ContextMenuContent>
|
|
139
|
+
</ContextMenu>
|
|
140
|
+
)
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const WithRadioGroup: Story = {
|
|
145
|
+
render: function ContextMenuWithRadio() {
|
|
146
|
+
const [theme, setTheme] = React.useState('system')
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<ContextMenu>
|
|
150
|
+
<ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
|
|
151
|
+
Right click here
|
|
152
|
+
</ContextMenuTrigger>
|
|
153
|
+
<ContextMenuContent className="w-64">
|
|
154
|
+
<ContextMenuLabel>Theme</ContextMenuLabel>
|
|
155
|
+
<ContextMenuSeparator />
|
|
156
|
+
<ContextMenuRadioGroup value={theme} onValueChange={setTheme}>
|
|
157
|
+
<ContextMenuRadioItem value="light">Light</ContextMenuRadioItem>
|
|
158
|
+
<ContextMenuRadioItem value="dark">Dark</ContextMenuRadioItem>
|
|
159
|
+
<ContextMenuRadioItem value="system">System</ContextMenuRadioItem>
|
|
160
|
+
</ContextMenuRadioGroup>
|
|
161
|
+
</ContextMenuContent>
|
|
162
|
+
</ContextMenu>
|
|
163
|
+
)
|
|
164
|
+
},
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export const FileExplorer: Story = {
|
|
168
|
+
render: () => (
|
|
169
|
+
<ContextMenu>
|
|
170
|
+
<ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm bg-muted/50">
|
|
171
|
+
<div className="text-center">
|
|
172
|
+
<div className="text-4xl mb-2">📁</div>
|
|
173
|
+
<div className="text-sm text-muted-foreground">my-folder</div>
|
|
174
|
+
</div>
|
|
175
|
+
</ContextMenuTrigger>
|
|
176
|
+
<ContextMenuContent className="w-64">
|
|
177
|
+
<ContextMenuItem>
|
|
178
|
+
Open
|
|
179
|
+
<ContextMenuShortcut>↵</ContextMenuShortcut>
|
|
180
|
+
</ContextMenuItem>
|
|
181
|
+
<ContextMenuItem>Open With...</ContextMenuItem>
|
|
182
|
+
<ContextMenuSeparator />
|
|
183
|
+
<ContextMenuItem>
|
|
184
|
+
Cut
|
|
185
|
+
<ContextMenuShortcut>⌘X</ContextMenuShortcut>
|
|
186
|
+
</ContextMenuItem>
|
|
187
|
+
<ContextMenuItem>
|
|
188
|
+
Copy
|
|
189
|
+
<ContextMenuShortcut>⌘C</ContextMenuShortcut>
|
|
190
|
+
</ContextMenuItem>
|
|
191
|
+
<ContextMenuItem disabled>
|
|
192
|
+
Paste
|
|
193
|
+
<ContextMenuShortcut>⌘V</ContextMenuShortcut>
|
|
194
|
+
</ContextMenuItem>
|
|
195
|
+
<ContextMenuSeparator />
|
|
196
|
+
<ContextMenuSub>
|
|
197
|
+
<ContextMenuSubTrigger>Share</ContextMenuSubTrigger>
|
|
198
|
+
<ContextMenuSubContent>
|
|
199
|
+
<ContextMenuItem>Email</ContextMenuItem>
|
|
200
|
+
<ContextMenuItem>Messages</ContextMenuItem>
|
|
201
|
+
<ContextMenuItem>AirDrop</ContextMenuItem>
|
|
202
|
+
</ContextMenuSubContent>
|
|
203
|
+
</ContextMenuSub>
|
|
204
|
+
<ContextMenuSeparator />
|
|
205
|
+
<ContextMenuItem>
|
|
206
|
+
Rename
|
|
207
|
+
</ContextMenuItem>
|
|
208
|
+
<ContextMenuItem className="text-destructive">
|
|
209
|
+
Move to Trash
|
|
210
|
+
<ContextMenuShortcut>⌘⌫</ContextMenuShortcut>
|
|
211
|
+
</ContextMenuItem>
|
|
212
|
+
<ContextMenuSeparator />
|
|
213
|
+
<ContextMenuItem>
|
|
214
|
+
Get Info
|
|
215
|
+
<ContextMenuShortcut>⌘I</ContextMenuShortcut>
|
|
216
|
+
</ContextMenuItem>
|
|
217
|
+
</ContextMenuContent>
|
|
218
|
+
</ContextMenu>
|
|
219
|
+
),
|
|
220
|
+
}
|