@fabrica_communications/design-system 0.1.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.
Files changed (59) hide show
  1. package/README.md +54 -0
  2. package/package.json +91 -0
  3. package/src/app/components/page.tsx +19 -0
  4. package/src/app/favicon.ico +0 -0
  5. package/src/app/foundations/colors/page.tsx +11 -0
  6. package/src/app/foundations/page.tsx +11 -0
  7. package/src/app/foundations/typography/page.tsx +11 -0
  8. package/src/app/getting-started/page.tsx +11 -0
  9. package/src/app/globals.css +3 -0
  10. package/src/app/layout.tsx +61 -0
  11. package/src/app/page.tsx +994 -0
  12. package/src/components/shared/gap.tsx +103 -0
  13. package/src/components/shared/page-header.tsx +11 -0
  14. package/src/components/shared/page-top-button.tsx +27 -0
  15. package/src/components/ui/accordion.tsx +66 -0
  16. package/src/components/ui/alert-dialog.tsx +157 -0
  17. package/src/components/ui/aspect-ratio.tsx +11 -0
  18. package/src/components/ui/badge.tsx +46 -0
  19. package/src/components/ui/breadcrumb.tsx +109 -0
  20. package/src/components/ui/button.mdx +39 -0
  21. package/src/components/ui/button.stories.tsx +88 -0
  22. package/src/components/ui/button.tsx +53 -0
  23. package/src/components/ui/card.tsx +92 -0
  24. package/src/components/ui/carousel.tsx +241 -0
  25. package/src/components/ui/checkbox.tsx +32 -0
  26. package/src/components/ui/dialog.tsx +143 -0
  27. package/src/components/ui/field.tsx +248 -0
  28. package/src/components/ui/heading.tsx +51 -0
  29. package/src/components/ui/icon-definitions.ts +532 -0
  30. package/src/components/ui/icon.tsx +115 -0
  31. package/src/components/ui/input-group.tsx +170 -0
  32. package/src/components/ui/input.tsx +21 -0
  33. package/src/components/ui/label.tsx +24 -0
  34. package/src/components/ui/native-select.tsx +48 -0
  35. package/src/components/ui/pagination.tsx +127 -0
  36. package/src/components/ui/radio-group.tsx +45 -0
  37. package/src/components/ui/scroll-area.tsx +58 -0
  38. package/src/components/ui/section-container.tsx +24 -0
  39. package/src/components/ui/select.tsx +187 -0
  40. package/src/components/ui/separator.tsx +28 -0
  41. package/src/components/ui/skeleton.tsx +13 -0
  42. package/src/components/ui/sonner.tsx +40 -0
  43. package/src/components/ui/switch.mdx +20 -0
  44. package/src/components/ui/switch.stories.tsx +54 -0
  45. package/src/components/ui/switch.tsx +66 -0
  46. package/src/components/ui/table.tsx +119 -0
  47. package/src/components/ui/tabs.tsx +66 -0
  48. package/src/components/ui/text-link.tsx +72 -0
  49. package/src/components/ui/text.tsx +54 -0
  50. package/src/components/ui/textarea.tsx +18 -0
  51. package/src/components/ui/toggle.tsx +47 -0
  52. package/src/components/ui/tooltip.tsx +61 -0
  53. package/src/index.ts +37 -0
  54. package/src/lib/utils.ts +6 -0
  55. package/src/styles/globals.css +162 -0
  56. package/src/styles/variables.css +261 -0
  57. package/tokens/design-tokens.tokens.json +1652 -0
  58. package/tokens/design-tokens.tokens/344/270/213/345/261/244.json +1659 -0
  59. package/tokens//345/205/250/343/203/227/343/203/255/343/202/270/343/202/247/343/202/257/343/203/210/345/205/261/351/200/232_design-tokens.tokens.json +572 -0
@@ -0,0 +1,103 @@
1
+ import * as React from 'react'
2
+
3
+ import { cn } from '../../lib/utils'
4
+
5
+ type GapSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
6
+
7
+ const gapMapping: Record<GapSize, string> = {
8
+ '2xs': 'var(--primitive-spacing-spacing-4)',
9
+ xs: 'var(--primitive-spacing-spacing-6)',
10
+ sm: 'var(--primitive-spacing-spacing-8)',
11
+ md: 'var(--primitive-spacing-spacing-16)',
12
+ lg: 'var(--primitive-spacing-spacing-24)',
13
+ xl: 'var(--primitive-spacing-spacing-32)',
14
+ '2xl': 'var(--primitive-spacing-spacing-48)',
15
+ }
16
+
17
+ const rowGapMapping: Record<GapSize, string> = {
18
+ '2xs': 'var(--primitive-spacing-spacing-4)',
19
+ xs: 'var(--primitive-spacing-spacing-6)',
20
+ sm: 'var(--primitive-spacing-spacing-8)',
21
+ md: 'var(--primitive-spacing-spacing-16)',
22
+ lg: 'var(--primitive-spacing-spacing-16)',
23
+ xl: 'var(--primitive-spacing-spacing-24)',
24
+ '2xl': 'var(--primitive-spacing-spacing-32)',
25
+ }
26
+
27
+ const columnGapMapping: Record<GapSize, string> = {
28
+ '2xs': 'var(--primitive-spacing-spacing-4)',
29
+ xs: 'var(--primitive-spacing-spacing-6)',
30
+ sm: 'var(--primitive-spacing-spacing-8)',
31
+ md: 'var(--primitive-spacing-spacing-16)',
32
+ lg: 'var(--primitive-spacing-spacing-24)',
33
+ xl: 'var(--primitive-spacing-spacing-32)',
34
+ '2xl': 'var(--primitive-spacing-spacing-48)',
35
+ }
36
+
37
+ interface GapProps extends React.HTMLAttributes<HTMLElement> {
38
+ as?: React.ElementType
39
+ gap?: GapSize
40
+ row?: boolean
41
+ wrap?: boolean
42
+ }
43
+
44
+ const Gap = React.forwardRef<HTMLElement, GapProps>(function Gap(
45
+ {
46
+ as: Component = 'div',
47
+ gap = 'sm',
48
+ row = false,
49
+ wrap = false,
50
+ className,
51
+ style,
52
+ children,
53
+ ...props
54
+ },
55
+ ref,
56
+ ) {
57
+ const computedStyle = React.useMemo<React.CSSProperties>(() => {
58
+ const base: React.CSSProperties = {
59
+ ...style,
60
+ }
61
+
62
+ delete base.gap
63
+
64
+ if (row) {
65
+ if (base.columnGap === undefined) {
66
+ base.columnGap = wrap ? columnGapMapping[gap] : gapMapping[gap]
67
+ }
68
+ if (base.rowGap === undefined) {
69
+ base.rowGap = wrap ? rowGapMapping[gap] : '0px'
70
+ }
71
+ } else {
72
+ if (base.rowGap === undefined) {
73
+ base.rowGap = gapMapping[gap]
74
+ }
75
+ if (base.columnGap === undefined) {
76
+ base.columnGap = '0px'
77
+ }
78
+ }
79
+
80
+ return base
81
+ }, [gap, row, wrap, style])
82
+
83
+ return (
84
+ <Component
85
+ ref={ref}
86
+ className={cn(
87
+ 'flex',
88
+ row ? 'flex-row' : 'flex-col',
89
+ wrap ? 'flex-wrap' : 'flex-nowrap',
90
+ className,
91
+ )}
92
+ style={computedStyle}
93
+ {...props}
94
+ >
95
+ {children}
96
+ </Component>
97
+ )
98
+ })
99
+
100
+ Gap.displayName = 'Gap'
101
+
102
+ export { Gap }
103
+
@@ -0,0 +1,11 @@
1
+ import Link from "next/link"
2
+ import * as React from "react"
3
+
4
+ export function PageHeader() {
5
+ return (
6
+ <header className="sticky top-0 z-40 h-[8rem] bg-white">
7
+ <Link href="/">ロゴ</Link>
8
+ </header>
9
+ )
10
+ }
11
+
@@ -0,0 +1,27 @@
1
+ 'use client'
2
+
3
+ import Link from 'next/link'
4
+ import { Icon } from '../ui/icon'
5
+ import { cn } from '../../lib/utils'
6
+
7
+ export function PageTopButton({ className }: { className?: string }) {
8
+ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
9
+ e.preventDefault()
10
+ window.scrollTo({ top: 0, behavior: 'smooth' })
11
+ }
12
+
13
+ return (
14
+ <Link
15
+ href="#"
16
+ onClick={handleClick}
17
+ className={cn(
18
+ 'fixed bottom-6 right-6 z-50 flex size-12 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
19
+ className
20
+ )}
21
+ aria-label="ページトップへ戻る"
22
+ >
23
+ <Icon name="arrow-up" size={24} aria-hidden="true" />
24
+ </Link>
25
+ )
26
+ }
27
+
@@ -0,0 +1,66 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AccordionPrimitive from "@radix-ui/react-accordion"
5
+ import { ChevronDownIcon } from "lucide-react"
6
+
7
+ import { cn } from "../../lib/utils"
8
+
9
+ function Accordion({
10
+ ...props
11
+ }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
12
+ return <AccordionPrimitive.Root data-slot="accordion" {...props} />
13
+ }
14
+
15
+ function AccordionItem({
16
+ className,
17
+ ...props
18
+ }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
19
+ return (
20
+ <AccordionPrimitive.Item
21
+ data-slot="accordion-item"
22
+ className={cn("border-b last:border-b-0", className)}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ function AccordionTrigger({
29
+ className,
30
+ children,
31
+ ...props
32
+ }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
33
+ return (
34
+ <AccordionPrimitive.Header className="flex">
35
+ <AccordionPrimitive.Trigger
36
+ data-slot="accordion-trigger"
37
+ className={cn(
38
+ "focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
39
+ className
40
+ )}
41
+ {...props}
42
+ >
43
+ {children}
44
+ <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
45
+ </AccordionPrimitive.Trigger>
46
+ </AccordionPrimitive.Header>
47
+ )
48
+ }
49
+
50
+ function AccordionContent({
51
+ className,
52
+ children,
53
+ ...props
54
+ }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
55
+ return (
56
+ <AccordionPrimitive.Content
57
+ data-slot="accordion-content"
58
+ className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
59
+ {...props}
60
+ >
61
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
62
+ </AccordionPrimitive.Content>
63
+ )
64
+ }
65
+
66
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -0,0 +1,157 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
5
+
6
+ import { cn } from "../../lib/utils"
7
+ import { buttonVariants } from "./button"
8
+
9
+ function AlertDialog({
10
+ ...props
11
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
12
+ return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
13
+ }
14
+
15
+ function AlertDialogTrigger({
16
+ ...props
17
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
18
+ return (
19
+ <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
20
+ )
21
+ }
22
+
23
+ function AlertDialogPortal({
24
+ ...props
25
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
26
+ return (
27
+ <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
28
+ )
29
+ }
30
+
31
+ function AlertDialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
35
+ return (
36
+ <AlertDialogPrimitive.Overlay
37
+ data-slot="alert-dialog-overlay"
38
+ className={cn(
39
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function AlertDialogContent({
48
+ className,
49
+ ...props
50
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
51
+ return (
52
+ <AlertDialogPortal>
53
+ <AlertDialogOverlay />
54
+ <AlertDialogPrimitive.Content
55
+ data-slot="alert-dialog-content"
56
+ className={cn(
57
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
58
+ className
59
+ )}
60
+ {...props}
61
+ />
62
+ </AlertDialogPortal>
63
+ )
64
+ }
65
+
66
+ function AlertDialogHeader({
67
+ className,
68
+ ...props
69
+ }: React.ComponentProps<"div">) {
70
+ return (
71
+ <div
72
+ data-slot="alert-dialog-header"
73
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
74
+ {...props}
75
+ />
76
+ )
77
+ }
78
+
79
+ function AlertDialogFooter({
80
+ className,
81
+ ...props
82
+ }: React.ComponentProps<"div">) {
83
+ return (
84
+ <div
85
+ data-slot="alert-dialog-footer"
86
+ className={cn(
87
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ )
93
+ }
94
+
95
+ function AlertDialogTitle({
96
+ className,
97
+ ...props
98
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
99
+ return (
100
+ <AlertDialogPrimitive.Title
101
+ data-slot="alert-dialog-title"
102
+ className={cn("text-lg font-semibold", className)}
103
+ {...props}
104
+ />
105
+ )
106
+ }
107
+
108
+ function AlertDialogDescription({
109
+ className,
110
+ ...props
111
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
112
+ return (
113
+ <AlertDialogPrimitive.Description
114
+ data-slot="alert-dialog-description"
115
+ className={cn("text-muted-foreground text-sm", className)}
116
+ {...props}
117
+ />
118
+ )
119
+ }
120
+
121
+ function AlertDialogAction({
122
+ className,
123
+ ...props
124
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
125
+ return (
126
+ <AlertDialogPrimitive.Action
127
+ className={cn(buttonVariants(), className)}
128
+ {...props}
129
+ />
130
+ )
131
+ }
132
+
133
+ function AlertDialogCancel({
134
+ className,
135
+ ...props
136
+ }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
137
+ return (
138
+ <AlertDialogPrimitive.Cancel
139
+ className={cn(buttonVariants({ variant: "neutral" }), className)}
140
+ {...props}
141
+ />
142
+ )
143
+ }
144
+
145
+ export {
146
+ AlertDialog,
147
+ AlertDialogPortal,
148
+ AlertDialogOverlay,
149
+ AlertDialogTrigger,
150
+ AlertDialogContent,
151
+ AlertDialogHeader,
152
+ AlertDialogFooter,
153
+ AlertDialogTitle,
154
+ AlertDialogDescription,
155
+ AlertDialogAction,
156
+ AlertDialogCancel,
157
+ }
@@ -0,0 +1,11 @@
1
+ "use client"
2
+
3
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
4
+
5
+ function AspectRatio({
6
+ ...props
7
+ }: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
8
+ return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
9
+ }
10
+
11
+ export { AspectRatio }
@@ -0,0 +1,46 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "../../lib/utils"
6
+
7
+ const badgeVariants = cva(
8
+ "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default:
13
+ "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
14
+ secondary:
15
+ "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
16
+ destructive:
17
+ "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
18
+ outline:
19
+ "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ },
25
+ }
26
+ )
27
+
28
+ function Badge({
29
+ className,
30
+ variant,
31
+ asChild = false,
32
+ ...props
33
+ }: React.ComponentProps<"span"> &
34
+ VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
35
+ const Comp = asChild ? Slot : "span"
36
+
37
+ return (
38
+ <Comp
39
+ data-slot="badge"
40
+ className={cn(badgeVariants({ variant }), className)}
41
+ {...props}
42
+ />
43
+ )
44
+ }
45
+
46
+ export { Badge, badgeVariants }
@@ -0,0 +1,109 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { ChevronRight, MoreHorizontal } from "lucide-react"
4
+
5
+ import { cn } from "../../lib/utils"
6
+
7
+ function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
8
+ return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
9
+ }
10
+
11
+ function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
12
+ return (
13
+ <ol
14
+ data-slot="breadcrumb-list"
15
+ className={cn(
16
+ "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
25
+ return (
26
+ <li
27
+ data-slot="breadcrumb-item"
28
+ className={cn("inline-flex items-center gap-1.5", className)}
29
+ {...props}
30
+ />
31
+ )
32
+ }
33
+
34
+ function BreadcrumbLink({
35
+ asChild,
36
+ className,
37
+ ...props
38
+ }: React.ComponentProps<"a"> & {
39
+ asChild?: boolean
40
+ }) {
41
+ const Comp = asChild ? Slot : "a"
42
+
43
+ return (
44
+ <Comp
45
+ data-slot="breadcrumb-link"
46
+ className={cn("hover:text-foreground transition-colors", className)}
47
+ {...props}
48
+ />
49
+ )
50
+ }
51
+
52
+ function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
53
+ return (
54
+ <span
55
+ data-slot="breadcrumb-page"
56
+ role="link"
57
+ aria-disabled="true"
58
+ aria-current="page"
59
+ className={cn("text-foreground font-normal", className)}
60
+ {...props}
61
+ />
62
+ )
63
+ }
64
+
65
+ function BreadcrumbSeparator({
66
+ children,
67
+ className,
68
+ ...props
69
+ }: React.ComponentProps<"li">) {
70
+ return (
71
+ <li
72
+ data-slot="breadcrumb-separator"
73
+ role="presentation"
74
+ aria-hidden="true"
75
+ className={cn("[&>svg]:size-3.5", className)}
76
+ {...props}
77
+ >
78
+ {children ?? <ChevronRight />}
79
+ </li>
80
+ )
81
+ }
82
+
83
+ function BreadcrumbEllipsis({
84
+ className,
85
+ ...props
86
+ }: React.ComponentProps<"span">) {
87
+ return (
88
+ <span
89
+ data-slot="breadcrumb-ellipsis"
90
+ role="presentation"
91
+ aria-hidden="true"
92
+ className={cn("flex size-9 items-center justify-center", className)}
93
+ {...props}
94
+ >
95
+ <MoreHorizontal className="size-4" />
96
+ <span className="sr-only">More</span>
97
+ </span>
98
+ )
99
+ }
100
+
101
+ export {
102
+ Breadcrumb,
103
+ BreadcrumbList,
104
+ BreadcrumbItem,
105
+ BreadcrumbLink,
106
+ BreadcrumbPage,
107
+ BreadcrumbSeparator,
108
+ BreadcrumbEllipsis,
109
+ }
@@ -0,0 +1,39 @@
1
+ import { Meta, Story, Canvas, Controls } from "@storybook/addon-docs/blocks";
2
+ import * as ButtonStories from "./button.stories";
3
+
4
+ <Meta of={ButtonStories} />
5
+
6
+ # Button
7
+
8
+ 基本的なボタンのバリエーションと挙動を確認します。
9
+
10
+ ## Examples
11
+
12
+ ### Primary
13
+ メインアクション。
14
+ <Canvas of={ButtonStories.Primary} />
15
+ <Controls of={ButtonStories.Primary} />
16
+
17
+ ### Accent
18
+ 強い強調アクション。
19
+ <Canvas of={ButtonStories.Accent} />
20
+
21
+ ### Neutral
22
+ セカンダリアクション。
23
+ <Canvas of={ButtonStories.Neutral} />
24
+
25
+ ### Destructive
26
+ 破壊的アクション。
27
+ <Canvas of={ButtonStories.Destructive} />
28
+
29
+ ### Small
30
+ <Canvas of={ButtonStories.Small} />
31
+
32
+ ### Icon
33
+ <Canvas of={ButtonStories.Icon} />
34
+
35
+ ### Disabled
36
+ <Canvas of={ButtonStories.Disabled} />
37
+
38
+ ### Focusable
39
+ <Canvas of={ButtonStories.Focusable} />
@@ -0,0 +1,88 @@
1
+ import type { Meta, StoryObj } from "@storybook/nextjs-vite"
2
+
3
+ import { Button } from "./button"
4
+ import { Icon as UiIcon } from "./icon"
5
+
6
+ type ButtonProps = React.ComponentProps<typeof Button>
7
+
8
+ const meta = {
9
+ title: "UI/Button",
10
+ component: Button,
11
+ parameters: {
12
+ layout: "centered",
13
+ },
14
+ argTypes: {
15
+ variant: {
16
+ control: "select",
17
+ options: ["default", "accent", "neutral", "destructive"],
18
+ },
19
+ size: {
20
+ control: "select",
21
+ options: ["default", "sm", "icon", "icon-sm"],
22
+ },
23
+ },
24
+ } satisfies Meta<ButtonProps>
25
+
26
+ export default meta
27
+ type Story = StoryObj<typeof meta>
28
+
29
+ export const Primary: Story = {
30
+ args: {
31
+ children: "Primary",
32
+ variant: "default",
33
+ size: "default",
34
+ },
35
+ }
36
+
37
+ export const Accent: Story = {
38
+ args: {
39
+ children: "Accent",
40
+ variant: "accent",
41
+ size: "default",
42
+ },
43
+ }
44
+
45
+ export const Neutral: Story = {
46
+ args: {
47
+ children: "Neutral",
48
+ variant: "neutral",
49
+ size: "default",
50
+ },
51
+ }
52
+
53
+ export const Destructive: Story = {
54
+ args: {
55
+ children: "Destructive",
56
+ variant: "destructive",
57
+ size: "default",
58
+ },
59
+ }
60
+
61
+ export const Small: Story = {
62
+ args: {
63
+ children: "Small",
64
+ size: "sm",
65
+ },
66
+ }
67
+
68
+ export const Icon: Story = {
69
+ args: {
70
+ "aria-label": "Search",
71
+ size: "icon",
72
+ children: <UiIcon name="search" />,
73
+ },
74
+ }
75
+
76
+ export const Disabled: Story = {
77
+ args: {
78
+ children: "Disabled",
79
+ disabled: true,
80
+ },
81
+ }
82
+
83
+ export const Focusable: Story = {
84
+ args: {
85
+ children: "Focusable",
86
+ variant: "neutral",
87
+ },
88
+ }