@mzc-fe/design-system 0.0.6 → 0.0.7-rc.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/components/accordion/accordion.tsx +114 -0
- package/components/accordion/index.ts +1 -0
- package/components/alert/alert.tsx +97 -0
- package/components/alert/index.ts +1 -0
- package/components/alert-dialog/alert-dialog.tsx +190 -0
- package/components/alert-dialog/index.ts +1 -0
- package/components/aspect-ratio/aspect-ratio.tsx +23 -0
- package/components/aspect-ratio/index.ts +1 -0
- package/components/avatar/avatar.tsx +62 -0
- package/components/avatar/index.ts +1 -0
- package/components/badge/badge.tsx +58 -0
- package/components/badge/index.ts +1 -0
- package/components/breadcrumb/breadcrumb.tsx +132 -0
- package/components/breadcrumb/index.ts +1 -0
- package/components/button/button.tsx +77 -0
- package/components/button/index.ts +1 -0
- package/components/button-group/button-group.tsx +99 -0
- package/components/button-group/index.ts +1 -0
- package/components/calendar/calendar.tsx +235 -0
- package/components/calendar/index.ts +1 -0
- package/components/card/card.tsx +107 -0
- package/components/card/index.ts +1 -0
- package/components/carousel/carousel.tsx +263 -0
- package/components/carousel/index.ts +1 -0
- package/components/chart/chart.tsx +377 -0
- package/components/chart/index.ts +1 -0
- package/components/checkbox/checkbox.tsx +41 -0
- package/components/checkbox/index.ts +1 -0
- package/components/collapsible/collapsible.tsx +44 -0
- package/components/collapsible/index.ts +1 -0
- package/components/command/command.tsx +201 -0
- package/components/command/index.ts +1 -0
- package/components/context-menu/context-menu.tsx +270 -0
- package/components/context-menu/index.ts +1 -0
- package/components/dialog/dialog.tsx +166 -0
- package/components/dialog/index.ts +1 -0
- package/components/drawer/drawer.tsx +154 -0
- package/components/drawer/index.ts +1 -0
- package/components/dropdown-menu/dropdown-menu.tsx +276 -0
- package/components/dropdown-menu/index.ts +1 -0
- package/components/empty/empty.tsx +129 -0
- package/components/empty/index.ts +1 -0
- package/components/field/field.tsx +272 -0
- package/components/field/index.ts +1 -0
- package/components/form/form.tsx +197 -0
- package/components/form/index.ts +1 -0
- package/components/hover-card/hover-card.tsx +57 -0
- package/components/hover-card/index.ts +1 -0
- package/components/input/index.ts +1 -0
- package/components/input/input.tsx +31 -0
- package/components/input-group/index.ts +1 -0
- package/components/input-group/input-group.tsx +189 -0
- package/components/input-otp/index.ts +1 -0
- package/components/input-otp/input-otp.tsx +99 -0
- package/components/item/index.ts +1 -0
- package/components/item/item.tsx +225 -0
- package/components/kbd/index.ts +1 -0
- package/components/kbd/kbd.tsx +38 -0
- package/components/label/index.ts +1 -0
- package/components/label/label.tsx +33 -0
- package/components/menubar/index.ts +1 -0
- package/components/menubar/menubar.tsx +299 -0
- package/components/navigation-menu/index.ts +1 -0
- package/components/navigation-menu/navigation-menu.tsx +194 -0
- package/components/pagination/index.ts +1 -0
- package/components/pagination/pagination.tsx +153 -0
- package/components/popover/index.ts +1 -0
- package/components/popover/popover.tsx +106 -0
- package/components/progress/index.ts +1 -0
- package/components/progress/progress.tsx +39 -0
- package/components/radio-group/index.ts +1 -0
- package/components/radio-group/radio-group.tsx +57 -0
- package/components/resizable/index.ts +1 -0
- package/components/resizable/resizable.tsx +73 -0
- package/components/scroll-area/index.ts +1 -0
- package/components/scroll-area/scroll-area.tsx +72 -0
- package/components/select/index.ts +1 -0
- package/components/select/select.tsx +213 -0
- package/components/separator/index.ts +1 -0
- package/components/separator/separator.tsx +39 -0
- package/components/sheet/index.ts +1 -0
- package/components/sheet/sheet.tsx +160 -0
- package/components/sidebar/index.ts +1 -0
- package/components/sidebar/sidebar.tsx +776 -0
- package/components/skeleton/index.ts +1 -0
- package/components/skeleton/skeleton.tsx +21 -0
- package/components/slider/index.ts +1 -0
- package/components/slider/slider.tsx +75 -0
- package/components/sonner/index.ts +2 -0
- package/components/sonner/sonner.tsx +52 -0
- package/components/spinner/index.ts +1 -0
- package/components/spinner/spinner.tsx +26 -0
- package/components/switch/index.ts +1 -0
- package/components/switch/switch.tsx +39 -0
- package/components/table/index.ts +1 -0
- package/components/table/table.tsx +140 -0
- package/components/tabs/index.ts +1 -0
- package/components/tabs/tabs.tsx +94 -0
- package/components/textarea/index.ts +1 -0
- package/components/textarea/textarea.tsx +26 -0
- package/components/toggle/index.ts +1 -0
- package/components/toggle/toggle.tsx +58 -0
- package/components/toggle-group/index.ts +1 -0
- package/components/toggle-group/toggle-group.tsx +97 -0
- package/components/tooltip/index.ts +1 -0
- package/components/tooltip/tooltip.tsx +82 -0
- package/dist/components/accordion/accordion.d.ts +50 -0
- package/dist/components/alert/alert.d.ts +31 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +35 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +12 -0
- package/dist/components/avatar/avatar.d.ts +11 -0
- package/dist/components/badge/badge.d.ts +12 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +23 -0
- package/dist/components/button/button.d.ts +15 -0
- package/dist/components/button-group/button-group.d.ts +16 -0
- package/dist/components/calendar/calendar.d.ts +15 -0
- package/dist/components/card/card.d.ts +15 -0
- package/dist/components/carousel/carousel.d.ts +24 -0
- package/dist/components/chart/chart.d.ts +20 -0
- package/dist/components/checkbox/checkbox.d.ts +9 -0
- package/dist/components/collapsible/collapsible.d.ts +13 -0
- package/dist/components/command/command.d.ts +18 -0
- package/dist/components/context-menu/context-menu.d.ts +18 -0
- package/dist/components/dialog/dialog.d.ts +25 -0
- package/dist/components/drawer/drawer.d.ts +18 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +21 -0
- package/dist/components/empty/empty.d.ts +25 -0
- package/dist/components/field/field.d.ts +26 -0
- package/dist/components/form/form.d.ts +30 -1
- package/dist/components/hover-card/hover-card.d.ts +13 -0
- package/dist/components/input/input.d.ts +10 -0
- package/dist/components/input-group/input-group.d.ts +19 -0
- package/dist/components/input-otp/input-otp.d.ts +23 -0
- package/dist/components/item/item.d.ts +33 -1
- package/dist/components/kbd/kbd.d.ts +10 -0
- package/dist/components/label/label.d.ts +9 -0
- package/dist/components/menubar/menubar.d.ts +25 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +26 -0
- package/dist/components/pagination/pagination.d.ts +26 -0
- package/dist/components/popover/popover.d.ts +17 -0
- package/dist/components/progress/progress.d.ts +10 -0
- package/dist/components/radio-group/radio-group.d.ts +12 -0
- package/dist/components/resizable/resizable.d.ts +19 -0
- package/dist/components/scroll-area/scroll-area.d.ts +14 -0
- package/dist/components/select/select.d.ts +25 -0
- package/dist/components/separator/separator.d.ts +11 -0
- package/dist/components/sheet/sheet.d.ts +23 -0
- package/dist/components/sidebar/sidebar.d.ts +50 -0
- package/dist/components/skeleton/skeleton.d.ts +8 -0
- package/dist/components/slider/slider.d.ts +12 -0
- package/dist/components/sonner/sonner.d.ts +14 -0
- package/dist/components/spinner/spinner.d.ts +9 -0
- package/dist/components/switch/switch.d.ts +8 -0
- package/dist/components/table/table.d.ts +26 -0
- package/dist/components/tabs/tabs.d.ts +16 -6
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/toggle/toggle.d.ts +13 -0
- package/dist/components/toggle-group/toggle-group.d.ts +1 -0
- package/dist/components/tooltip/tooltip.d.ts +21 -0
- package/dist/design-system.css +1 -1
- package/dist/design-system.es.js +3481 -28494
- package/dist/design-system.umd.js +4 -257
- package/foundations/ThemeProvider.tsx +77 -0
- package/foundations/color.css +232 -0
- package/foundations/palette.css +249 -0
- package/foundations/spacing.css +8 -0
- package/foundations/typography.css +143 -0
- package/hooks/use-mobile.ts +19 -0
- package/index.css +173 -0
- package/index.ts +339 -0
- package/lib/utils.ts +6 -0
- package/package.json +40 -19
- package/README.md +0 -184
|
@@ -0,0 +1,77 @@
|
|
|
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 buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-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",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
13
|
+
destructive:
|
|
14
|
+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
15
|
+
outline:
|
|
16
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
17
|
+
secondary:
|
|
18
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost:
|
|
20
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
25
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
26
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
"icon-sm": "size-8",
|
|
29
|
+
"icon-lg": "size-10",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
variant: "default",
|
|
34
|
+
size: "default",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 클릭 가능한 버튼 컴포넌트입니다.
|
|
41
|
+
* 다양한 variant와 size를 지원합니다.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <Button variant="default">기본 버튼</Button>
|
|
46
|
+
* <Button variant="destructive">삭제</Button>
|
|
47
|
+
* <Button variant="outline" size="sm">작은 버튼</Button>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param props.variant - 버튼 스타일: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
|
|
51
|
+
* @param props.size - 버튼 크기: 'default' | 'sm' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg'
|
|
52
|
+
* @param props.asChild - true면 자식 요소로 렌더링 (링크 등)
|
|
53
|
+
*/
|
|
54
|
+
function Button({
|
|
55
|
+
className,
|
|
56
|
+
variant = "default",
|
|
57
|
+
size = "default",
|
|
58
|
+
asChild = false,
|
|
59
|
+
...props
|
|
60
|
+
}: React.ComponentProps<"button"> &
|
|
61
|
+
VariantProps<typeof buttonVariants> & {
|
|
62
|
+
asChild?: boolean
|
|
63
|
+
}) {
|
|
64
|
+
const Comp = asChild ? Slot : "button"
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Comp
|
|
68
|
+
data-slot="button"
|
|
69
|
+
data-variant={variant}
|
|
70
|
+
data-size={size}
|
|
71
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
import { Separator } from "@/components/separator";
|
|
6
|
+
|
|
7
|
+
const buttonGroupVariants = cva(
|
|
8
|
+
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
orientation: {
|
|
12
|
+
horizontal:
|
|
13
|
+
"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
14
|
+
vertical:
|
|
15
|
+
"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
orientation: "horizontal",
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 관련 버튼들을 그룹으로 묶어주는 컴포넌트입니다.
|
|
26
|
+
*
|
|
27
|
+
* @param props.orientation - 버튼 그룹 방향 ('horizontal' | 'vertical')
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <ButtonGroup>
|
|
32
|
+
* <Button>One</Button>
|
|
33
|
+
* <Button>Two</Button>
|
|
34
|
+
* <Button>Three</Button>
|
|
35
|
+
* </ButtonGroup>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function ButtonGroup({
|
|
39
|
+
className,
|
|
40
|
+
orientation,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
role="group"
|
|
46
|
+
data-slot="button-group"
|
|
47
|
+
data-orientation={orientation}
|
|
48
|
+
className={cn(buttonGroupVariants({ orientation }), className)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** 버튼 그룹 내 텍스트 레이블 컴포넌트입니다. */
|
|
55
|
+
function ButtonGroupText({
|
|
56
|
+
className,
|
|
57
|
+
asChild = false,
|
|
58
|
+
...props
|
|
59
|
+
}: React.ComponentProps<"div"> & {
|
|
60
|
+
asChild?: boolean;
|
|
61
|
+
}) {
|
|
62
|
+
const Comp = asChild ? Slot : "div";
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Comp
|
|
66
|
+
className={cn(
|
|
67
|
+
"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
68
|
+
className
|
|
69
|
+
)}
|
|
70
|
+
{...props}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** 버튼 그룹 내 구분선 컴포넌트입니다. */
|
|
76
|
+
function ButtonGroupSeparator({
|
|
77
|
+
className,
|
|
78
|
+
orientation = "vertical",
|
|
79
|
+
...props
|
|
80
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
81
|
+
return (
|
|
82
|
+
<Separator
|
|
83
|
+
data-slot="button-group-separator"
|
|
84
|
+
orientation={orientation}
|
|
85
|
+
className={cn(
|
|
86
|
+
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
|
|
87
|
+
className
|
|
88
|
+
)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {
|
|
95
|
+
ButtonGroup,
|
|
96
|
+
ButtonGroupSeparator,
|
|
97
|
+
ButtonGroupText,
|
|
98
|
+
buttonGroupVariants,
|
|
99
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button-group";
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
ChevronDownIcon,
|
|
6
|
+
ChevronLeftIcon,
|
|
7
|
+
ChevronRightIcon,
|
|
8
|
+
} from "lucide-react";
|
|
9
|
+
import {
|
|
10
|
+
DayPicker,
|
|
11
|
+
getDefaultClassNames,
|
|
12
|
+
type DayButton,
|
|
13
|
+
} from "react-day-picker";
|
|
14
|
+
|
|
15
|
+
import { cn } from "@/lib/utils";
|
|
16
|
+
import { Button, buttonVariants } from "@/components/button";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 날짜 선택을 위한 캘린더 컴포넌트입니다.
|
|
20
|
+
*
|
|
21
|
+
* @param props.mode - 선택 모드 ('single' | 'range' | 'multiple')
|
|
22
|
+
* @param props.showOutsideDays - 현재 월 외의 날짜 표시 여부
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Calendar
|
|
27
|
+
* mode="single"
|
|
28
|
+
* selected={date}
|
|
29
|
+
* onSelect={setDate}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function Calendar({
|
|
34
|
+
className,
|
|
35
|
+
classNames,
|
|
36
|
+
showOutsideDays = true,
|
|
37
|
+
captionLayout = "label",
|
|
38
|
+
buttonVariant = "ghost",
|
|
39
|
+
formatters,
|
|
40
|
+
components,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<typeof DayPicker> & {
|
|
43
|
+
buttonVariant?: React.ComponentProps<typeof Button>["variant"];
|
|
44
|
+
}) {
|
|
45
|
+
const defaultClassNames = getDefaultClassNames();
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<DayPicker
|
|
49
|
+
showOutsideDays={showOutsideDays}
|
|
50
|
+
className={cn(
|
|
51
|
+
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
|
|
52
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
53
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
54
|
+
className
|
|
55
|
+
)}
|
|
56
|
+
captionLayout={captionLayout}
|
|
57
|
+
formatters={{
|
|
58
|
+
formatMonthDropdown: (date) =>
|
|
59
|
+
date.toLocaleString("default", { month: "short" }),
|
|
60
|
+
...formatters,
|
|
61
|
+
}}
|
|
62
|
+
classNames={{
|
|
63
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
64
|
+
months: cn(
|
|
65
|
+
"flex gap-4 flex-col md:flex-row relative",
|
|
66
|
+
defaultClassNames.months
|
|
67
|
+
),
|
|
68
|
+
month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
|
|
69
|
+
nav: cn(
|
|
70
|
+
"flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
|
|
71
|
+
defaultClassNames.nav
|
|
72
|
+
),
|
|
73
|
+
button_previous: cn(
|
|
74
|
+
buttonVariants({ variant: buttonVariant }),
|
|
75
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
76
|
+
defaultClassNames.button_previous
|
|
77
|
+
),
|
|
78
|
+
button_next: cn(
|
|
79
|
+
buttonVariants({ variant: buttonVariant }),
|
|
80
|
+
"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
|
|
81
|
+
defaultClassNames.button_next
|
|
82
|
+
),
|
|
83
|
+
month_caption: cn(
|
|
84
|
+
"flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
|
|
85
|
+
defaultClassNames.month_caption
|
|
86
|
+
),
|
|
87
|
+
dropdowns: cn(
|
|
88
|
+
"w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
|
|
89
|
+
defaultClassNames.dropdowns
|
|
90
|
+
),
|
|
91
|
+
dropdown_root: cn(
|
|
92
|
+
"relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
93
|
+
defaultClassNames.dropdown_root
|
|
94
|
+
),
|
|
95
|
+
dropdown: cn(
|
|
96
|
+
"absolute bg-popover inset-0 opacity-0",
|
|
97
|
+
defaultClassNames.dropdown
|
|
98
|
+
),
|
|
99
|
+
caption_label: cn(
|
|
100
|
+
"select-none font-medium",
|
|
101
|
+
captionLayout === "label"
|
|
102
|
+
? "text-sm"
|
|
103
|
+
: "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
|
|
104
|
+
defaultClassNames.caption_label
|
|
105
|
+
),
|
|
106
|
+
table: "w-full border-collapse",
|
|
107
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
108
|
+
weekday: cn(
|
|
109
|
+
"text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
|
|
110
|
+
defaultClassNames.weekday
|
|
111
|
+
),
|
|
112
|
+
week: cn("flex w-full mt-2", defaultClassNames.week),
|
|
113
|
+
week_number_header: cn(
|
|
114
|
+
"select-none w-(--cell-size)",
|
|
115
|
+
defaultClassNames.week_number_header
|
|
116
|
+
),
|
|
117
|
+
week_number: cn(
|
|
118
|
+
"text-[0.8rem] select-none text-muted-foreground",
|
|
119
|
+
defaultClassNames.week_number
|
|
120
|
+
),
|
|
121
|
+
day: cn(
|
|
122
|
+
"relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
|
|
123
|
+
props.showWeekNumber
|
|
124
|
+
? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
|
|
125
|
+
: "[&:first-child[data-selected=true]_button]:rounded-l-md",
|
|
126
|
+
defaultClassNames.day
|
|
127
|
+
),
|
|
128
|
+
range_start: cn(
|
|
129
|
+
"rounded-l-md bg-accent",
|
|
130
|
+
defaultClassNames.range_start
|
|
131
|
+
),
|
|
132
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
133
|
+
range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
|
|
134
|
+
today: cn(
|
|
135
|
+
"bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
|
|
136
|
+
defaultClassNames.today
|
|
137
|
+
),
|
|
138
|
+
outside: cn(
|
|
139
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
140
|
+
defaultClassNames.outside
|
|
141
|
+
),
|
|
142
|
+
disabled: cn(
|
|
143
|
+
"text-muted-foreground opacity-50",
|
|
144
|
+
defaultClassNames.disabled
|
|
145
|
+
),
|
|
146
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
147
|
+
...classNames,
|
|
148
|
+
}}
|
|
149
|
+
components={{
|
|
150
|
+
Root: ({ className, rootRef, ...props }) => {
|
|
151
|
+
return (
|
|
152
|
+
<div
|
|
153
|
+
data-slot="calendar"
|
|
154
|
+
ref={rootRef}
|
|
155
|
+
className={cn(className)}
|
|
156
|
+
{...props}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
},
|
|
160
|
+
Chevron: ({ className, orientation, ...props }) => {
|
|
161
|
+
if (orientation === "left") {
|
|
162
|
+
return (
|
|
163
|
+
<ChevronLeftIcon className={cn("size-4", className)} {...props} />
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (orientation === "right") {
|
|
168
|
+
return (
|
|
169
|
+
<ChevronRightIcon
|
|
170
|
+
className={cn("size-4", className)}
|
|
171
|
+
{...props}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<ChevronDownIcon className={cn("size-4", className)} {...props} />
|
|
178
|
+
);
|
|
179
|
+
},
|
|
180
|
+
DayButton: CalendarDayButton,
|
|
181
|
+
WeekNumber: ({ children, ...props }) => {
|
|
182
|
+
return (
|
|
183
|
+
<td {...props}>
|
|
184
|
+
<div className="flex size-(--cell-size) items-center justify-center text-center">
|
|
185
|
+
{children}
|
|
186
|
+
</div>
|
|
187
|
+
</td>
|
|
188
|
+
);
|
|
189
|
+
},
|
|
190
|
+
...components,
|
|
191
|
+
}}
|
|
192
|
+
{...props}
|
|
193
|
+
/>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function CalendarDayButton({
|
|
198
|
+
className,
|
|
199
|
+
day,
|
|
200
|
+
modifiers,
|
|
201
|
+
...props
|
|
202
|
+
}: React.ComponentProps<typeof DayButton>) {
|
|
203
|
+
const defaultClassNames = getDefaultClassNames();
|
|
204
|
+
|
|
205
|
+
const ref = React.useRef<HTMLButtonElement>(null);
|
|
206
|
+
React.useEffect(() => {
|
|
207
|
+
if (modifiers.focused) ref.current?.focus();
|
|
208
|
+
}, [modifiers.focused]);
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<Button
|
|
212
|
+
ref={ref}
|
|
213
|
+
variant="ghost"
|
|
214
|
+
size="icon"
|
|
215
|
+
data-day={day.date.toLocaleDateString()}
|
|
216
|
+
data-selected-single={
|
|
217
|
+
modifiers.selected &&
|
|
218
|
+
!modifiers.range_start &&
|
|
219
|
+
!modifiers.range_end &&
|
|
220
|
+
!modifiers.range_middle
|
|
221
|
+
}
|
|
222
|
+
data-range-start={modifiers.range_start}
|
|
223
|
+
data-range-end={modifiers.range_end}
|
|
224
|
+
data-range-middle={modifiers.range_middle}
|
|
225
|
+
className={cn(
|
|
226
|
+
"data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
227
|
+
defaultClassNames.day,
|
|
228
|
+
className
|
|
229
|
+
)}
|
|
230
|
+
{...props}
|
|
231
|
+
/>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./calendar";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 콘텐츠를 그룹화하여 표시하는 카드 컴포넌트입니다.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <Card>
|
|
11
|
+
* <CardHeader>
|
|
12
|
+
* <CardTitle>제목</CardTitle>
|
|
13
|
+
* <CardDescription>설명</CardDescription>
|
|
14
|
+
* </CardHeader>
|
|
15
|
+
* <CardContent>내용</CardContent>
|
|
16
|
+
* <CardFooter>푸터</CardFooter>
|
|
17
|
+
* </Card>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
data-slot="card"
|
|
24
|
+
className={cn(
|
|
25
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
data-slot="card-header"
|
|
37
|
+
className={cn(
|
|
38
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
data-slot="card-title"
|
|
50
|
+
className={cn("leading-none font-semibold", className)}
|
|
51
|
+
{...props}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
data-slot="card-description"
|
|
60
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
data-slot="card-action"
|
|
70
|
+
className={cn(
|
|
71
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
80
|
+
return (
|
|
81
|
+
<div
|
|
82
|
+
data-slot="card-content"
|
|
83
|
+
className={cn("px-6", className)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
90
|
+
return (
|
|
91
|
+
<div
|
|
92
|
+
data-slot="card-footer"
|
|
93
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
Card,
|
|
101
|
+
CardHeader,
|
|
102
|
+
CardFooter,
|
|
103
|
+
CardTitle,
|
|
104
|
+
CardAction,
|
|
105
|
+
CardDescription,
|
|
106
|
+
CardContent,
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./card";
|