@comitor/ui 3.18.1 → 3.20.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/README.md +12 -4
- package/dist/components/composite/delta-badge.d.ts +21 -0
- package/dist/components/composite/delta-badge.js +29 -0
- package/dist/components/composite/delta-badge.js.map +1 -0
- package/dist/components/composite/empty-state.d.ts +8 -2
- package/dist/components/composite/empty-state.js +14 -2
- package/dist/components/composite/empty-state.js.map +1 -1
- package/dist/components/composite/heat-scale.d.ts +57 -0
- package/dist/components/composite/heat-scale.js +105 -0
- package/dist/components/composite/heat-scale.js.map +1 -0
- package/dist/components/composite/page-container.js +11 -1
- package/dist/components/composite/page-container.js.map +1 -1
- package/dist/components/composite/page-header.js +10 -5
- package/dist/components/composite/page-header.js.map +1 -1
- package/dist/components/composite/rank-bar-list.d.ts +38 -0
- package/dist/components/composite/rank-bar-list.js +41 -0
- package/dist/components/composite/rank-bar-list.js.map +1 -0
- package/dist/components/composite/rating-stars.d.ts +25 -0
- package/dist/components/composite/rating-stars.js +41 -0
- package/dist/components/composite/rating-stars.js.map +1 -0
- package/dist/components/composite/segmented-control.d.ts +50 -0
- package/dist/components/composite/segmented-control.js +77 -0
- package/dist/components/composite/segmented-control.js.map +1 -0
- package/dist/components/composite/stat-card.d.ts +40 -2
- package/dist/components/composite/stat-card.js +76 -4
- package/dist/components/composite/stat-card.js.map +1 -1
- package/dist/components/composite/status-pill.d.ts +6 -1
- package/dist/components/composite/status-pill.js +49 -0
- package/dist/components/composite/status-pill.js.map +1 -1
- package/dist/components/composite/text.d.ts +41 -0
- package/dist/components/composite/text.js +86 -0
- package/dist/components/composite/text.js.map +1 -0
- package/dist/components/composite/urgency-text.d.ts +20 -0
- package/dist/components/composite/urgency-text.js +28 -0
- package/dist/components/composite/urgency-text.js.map +1 -0
- package/dist/components/ui/alert.d.ts +3 -2
- package/dist/components/ui/alert.js +38 -4
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/avatar.js +4 -1
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +3 -2
- package/dist/components/ui/badge.js +46 -28
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.js +4 -4
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.d.ts +15 -26
- package/dist/components/ui/card.js +64 -11
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +7 -1
- package/dist/components/ui/dropdown-menu.js +10 -5
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/item.d.ts +11 -4
- package/dist/components/ui/item.js +73 -10
- package/dist/components/ui/item.js.map +1 -1
- package/dist/components/ui/progress.d.ts +24 -2
- package/dist/components/ui/progress.js +81 -6
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/table.d.ts +19 -5
- package/dist/components/ui/table.js +34 -14
- package/dist/components/ui/table.js.map +1 -1
- package/dist/data-grid/data-grid-row-height-menu.js +4 -1
- package/dist/data-grid/data-grid-row-height-menu.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/shell/app-header.d.ts +17 -1
- package/dist/shell/app-header.js +88 -37
- package/dist/shell/app-header.js.map +1 -1
- package/dist/shell/header-tool.d.ts +12 -0
- package/dist/shell/header-tool.js +5 -0
- package/dist/shell/header-tool.js.map +1 -0
- package/dist/shell/index.d.ts +2 -0
- package/dist/shell/index.js +2 -0
- package/dist/shell/index.js.map +1 -1
- package/dist/shell/module-switcher.d.ts +7 -1
- package/dist/shell/module-switcher.js +51 -9
- package/dist/shell/module-switcher.js.map +1 -1
- package/dist/shell/notifications-button.d.ts +6 -1
- package/dist/shell/notifications-button.js +20 -2
- package/dist/shell/notifications-button.js.map +1 -1
- package/dist/shell/shell-context.d.ts +13 -1
- package/dist/shell/shell-context.js +21 -3
- package/dist/shell/shell-context.js.map +1 -1
- package/dist/shell/sidebar-account-button.d.ts +42 -0
- package/dist/shell/sidebar-account-button.js +50 -0
- package/dist/shell/sidebar-account-button.js.map +1 -0
- package/dist/shell/sidebar-group.js +8 -7
- package/dist/shell/sidebar-group.js.map +1 -1
- package/dist/shell/sidebar-menu-item.js +39 -11
- package/dist/shell/sidebar-menu-item.js.map +1 -1
- package/dist/shell/sidebar.d.ts +18 -1
- package/dist/shell/sidebar.js +29 -9
- package/dist/shell/sidebar.js.map +1 -1
- package/dist/shell/theme-toggle.js +2 -0
- package/dist/shell/theme-toggle.js.map +1 -1
- package/dist/tokens.d.ts +36 -9
- package/dist/tokens.js +21 -8
- package/dist/tokens.js.map +1 -1
- package/package.json +1 -1
- package/styles.css +468 -13
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import { cn } from "../../lib/cn.js";
|
|
4
|
-
const cardVariants = cva("rounded-xl", {
|
|
4
|
+
const cardVariants = cva("group/card rounded-xl", {
|
|
5
5
|
variants: {
|
|
6
6
|
variant: {
|
|
7
|
-
|
|
7
|
+
/* Viền đo bằng token (3.19.0): bộ green vẽ viền bằng VÒNG BÓNG như `.w{box-shadow:var(--e1)}` của bản mẫu v4 —
|
|
8
|
+
không chiếm chỗ, nên nội dung thẻ không lệch 1px so với bản mẫu. `shadow-(…)` chứ không `[box-shadow:…]`: đi qua
|
|
9
|
+
`--tw-shadow` nên vẫn ghép với `ring-*` của app, và twMerge khử được khi app truyền `shadow-*`/`shadow-none`. */
|
|
10
|
+
default: "bg-card border-(length:--card-border-w) border-border shadow-(--card-shadow)",
|
|
8
11
|
elevated: "bg-card border border-border shadow-card",
|
|
9
12
|
outline: "bg-transparent border border-border",
|
|
10
13
|
ghost: "bg-transparent border-none"
|
|
@@ -12,6 +15,8 @@ const cardVariants = cva("rounded-xl", {
|
|
|
12
15
|
padding: {
|
|
13
16
|
none: "",
|
|
14
17
|
sm: "p-4",
|
|
18
|
+
/** 20px — mặc định của `size="sm"`; lề TRÊN theo `--card-sm-pt` (bộ green: 14px như `.cb` của bản mẫu v4). */
|
|
19
|
+
compact: "px-5 pb-5 pt-(--card-sm-pt)",
|
|
15
20
|
md: "p-6",
|
|
16
21
|
lg: "p-8"
|
|
17
22
|
}
|
|
@@ -21,21 +26,48 @@ const cardVariants = cva("rounded-xl", {
|
|
|
21
26
|
padding: "md"
|
|
22
27
|
}
|
|
23
28
|
});
|
|
24
|
-
function CardBase({ className, variant, padding, ...props }) {
|
|
25
|
-
|
|
29
|
+
function CardBase({ className, variant, padding, size = "default", ...props }) {
|
|
30
|
+
const pad = padding ?? (size === "sm" ? "compact" : "md");
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
"data-slot": "card",
|
|
35
|
+
"data-size": size,
|
|
36
|
+
className: cn(cardVariants({ variant, padding: pad }), className),
|
|
37
|
+
...props
|
|
38
|
+
}
|
|
39
|
+
);
|
|
26
40
|
}
|
|
27
|
-
|
|
41
|
+
const CARD_HEADER_INSET = "group-data-[size=sm]/card:data-[flush=false]:pt-(--card-sm-header-pt) group-data-[size=sm]/card:data-[flush=false]:px-(--card-sm-header-px) group-data-[size=sm]/card:data-[flush=true]:pb-(--card-sm-flush-header-pb)";
|
|
42
|
+
function CardHeader({ className, actions, actionsClassName, children, flush = false, ...props }) {
|
|
28
43
|
if (actions === void 0 || actions === null || actions === false) {
|
|
29
|
-
return /* @__PURE__ */ jsx(
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "card-header",
|
|
48
|
+
"data-flush": flush,
|
|
49
|
+
className: cn("flex flex-col space-y-1.5 group-data-[size=sm]/card:space-y-0.75", CARD_HEADER_INSET, className),
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
);
|
|
30
54
|
}
|
|
31
55
|
return /* @__PURE__ */ jsxs(
|
|
32
56
|
"div",
|
|
33
57
|
{
|
|
34
58
|
"data-slot": "card-header",
|
|
35
|
-
|
|
59
|
+
"data-flush": flush,
|
|
60
|
+
className: cn("flex flex-row items-start justify-between gap-3 space-y-0", CARD_HEADER_INSET, className),
|
|
36
61
|
...props,
|
|
37
62
|
children: [
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"data-slot": "card-header-text",
|
|
67
|
+
className: "flex min-w-0 flex-col space-y-1.5 group-data-[size=sm]/card:space-y-0.75",
|
|
68
|
+
children
|
|
69
|
+
}
|
|
70
|
+
),
|
|
39
71
|
/* @__PURE__ */ jsx("div", { "data-slot": "card-header-actions", className: cn("flex shrink-0 items-center gap-2", actionsClassName), children: actions })
|
|
40
72
|
]
|
|
41
73
|
}
|
|
@@ -46,19 +78,40 @@ function CardTitle({ className, ...props }) {
|
|
|
46
78
|
"h3",
|
|
47
79
|
{
|
|
48
80
|
"data-slot": "card-title",
|
|
49
|
-
className: cn(
|
|
81
|
+
className: cn(
|
|
82
|
+
"text-lg font-semibold text-foreground leading-none tracking-tight",
|
|
83
|
+
"group-data-[size=sm]/card:text-[14.5px] group-data-[size=sm]/card:leading-(--card-title-leading) group-data-[size=sm]/card:font-[620] group-data-[size=sm]/card:tracking-[-0.015em]",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
50
86
|
...props
|
|
51
87
|
}
|
|
52
88
|
);
|
|
53
89
|
}
|
|
54
90
|
function CardDescription({ className, ...props }) {
|
|
55
|
-
return /* @__PURE__ */ jsx(
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"p",
|
|
93
|
+
{
|
|
94
|
+
"data-slot": "card-description",
|
|
95
|
+
className: cn(
|
|
96
|
+
"text-sm text-muted-foreground group-data-[size=sm]/card:text-[12.5px] group-data-[size=sm]/card:leading-(--card-desc-leading)",
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
);
|
|
56
102
|
}
|
|
57
103
|
function CardAction({ className, ...props }) {
|
|
58
104
|
return /* @__PURE__ */ jsx("div", { "data-slot": "card-action", className: cn("ml-auto", className), ...props });
|
|
59
105
|
}
|
|
60
106
|
function CardContent({ className, ...props }) {
|
|
61
|
-
return /* @__PURE__ */ jsx(
|
|
107
|
+
return /* @__PURE__ */ jsx(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
"data-slot": "card-content",
|
|
111
|
+
className: cn("pt-4 group-data-[size=sm]/card:pt-(--card-sm-content-pt)", className),
|
|
112
|
+
...props
|
|
113
|
+
}
|
|
114
|
+
);
|
|
62
115
|
}
|
|
63
116
|
function CardFooter({ className, ...props }) {
|
|
64
117
|
return /* @__PURE__ */ jsx("div", { "data-slot": "card-footer", className: cn("flex items-center pt-4", className), ...props });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/card.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/*\n * Cấu trúc + style port nguyên trạng từ comitor-ds. Tên export giữ tương thích shadcn\n * (Card / CardHeader / CardTitle / CardDescription / CardContent / CardFooter), thêm\n * CardAction (bổ sung, không có trong shadcn gốc).\n */\nconst cardVariants = cva(\"rounded-xl\", {\n variants: {\n variant: {\n default: \"bg-card border border-border shadow-surface\",\n elevated: \"bg-card border border-border shadow-card\",\n outline: \"bg-transparent border border-border\",\n ghost: \"bg-transparent border-none\"\n },\n padding: {\n none: \"\",\n sm: \"p-4\",\n md: \"p-6\",\n lg: \"p-8\"\n }\n },\n defaultVariants: {\n variant: \"default\",\n padding: \"md\"\n }\n});\n\nexport interface CardProps extends React.ComponentProps<\"div\">, VariantProps<typeof cardVariants> {}\nexport interface CardHeaderProps extends React.ComponentProps<\"div\"> {\n /**\n * Nút/menu đặt ở GÓC PHẢI của header, ngang hàng với tiêu đề.\n *\n * Có nó thì header tự chuyển sang hàng ngang; bỏ trống thì bố cục dọc mặc định giữ\n * nguyên (xem chú thích ở `CardHeader`).\n */\n actions?: React.ReactNode;\n /** className riêng cho cụm `actions` (vd đổi `gap`, cho phép xuống dòng). */\n actionsClassName?: string;\n}\nexport type CardTitleProps = React.ComponentProps<\"h3\">;\nexport type CardDescriptionProps = React.ComponentProps<\"p\">;\nexport type CardActionProps = React.ComponentProps<\"div\">;\nexport type CardContentProps = React.ComponentProps<\"div\">;\nexport type CardFooterProps = React.ComponentProps<\"div\">;\n\nfunction CardBase({ className, variant, padding, ...props }: CardProps) {\n return <div data-slot=\"card\" className={cn(cardVariants({ variant, padding }), className)} {...props} />;\n}\n\n/**\n * Đầu thẻ. Mặc định XẾP DỌC (`flex-col space-y-1.5`) — tiêu đề trên, mô tả dưới.\n *\n * ─ VÌ SAO CÓ `actions` ─\n * Thẻ có nút ở góc phải là mẫu lặp lại ở mọi app, mà bố cục dọc mặc định thì chặn nó: mỗi\n * chỗ dùng đều phải ghi đè đúng một chuỗi bốn lớp `\"flex-row items-start justify-between\n * gap-3 space-y-0\"` — chép tay, dễ sót `space-y-0`, và không có gì bảo đảm hai app ghi đè\n * giống nhau. `actions` gói đúng chuỗi đó lại thành một prop.\n *\n * Mặc định KHÔNG đổi: không truyền `actions` thì lớp và cây DOM y hệt `0.2.0` (thêm một\n * `<div>` bọc chỉ xảy ra ở nhánh có actions), nên bản vá này không phá bố cục nào đang chạy.\n *\n * Quan hệ với `CardAction`: `CardAction` là ô `ml-auto` để tự lắp khi bạn ĐÃ tự đặt header\n * thành hàng ngang. `actions` làm cả hai việc — đổi bố cục *và* đặt chỗ — nên là đường đi\n * mặc định; `CardAction` giữ nguyên cho ai đã dùng.\n *\n * ```tsx\n * <CardHeader actions={<Button size=\"sm\" variant=\"ghost\">Sửa</Button>}>\n * <CardTitle>Thông tin đơn vị</CardTitle>\n * <CardDescription>Cập nhật lần cuối hôm qua</CardDescription>\n * </CardHeader>\n * ```\n */\nfunction CardHeader({ className, actions, actionsClassName, children, ...props }: CardHeaderProps) {\n if (actions === undefined || actions === null || actions === false) {\n return (\n <div data-slot=\"card-header\" className={cn(\"flex flex-col space-y-1.5\", className)} {...props}>\n {children}\n </div>\n );\n }\n\n return (\n <div\n data-slot=\"card-header\"\n className={cn(\"flex flex-row items-start justify-between gap-3 space-y-0\", className)}\n {...props}\n >\n {/* `min-w-0` để tiêu đề dài `truncate` được thay vì đẩy cụm nút ra khỏi thẻ. */}\n <div data-slot=\"card-header-text\" className=\"flex min-w-0 flex-col space-y-1.5\">\n {children}\n </div>\n <div data-slot=\"card-header-actions\" className={cn(\"flex shrink-0 items-center gap-2\", actionsClassName)}>\n {actions}\n </div>\n </div>\n );\n}\n\nfunction CardTitle({ className, ...props }: CardTitleProps) {\n return (\n <h3\n data-slot=\"card-title\"\n className={cn(\"text-lg font-semibold text-foreground leading-none tracking-tight\", className)}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: CardDescriptionProps) {\n return <p data-slot=\"card-description\" className={cn(\"text-sm text-muted-foreground\", className)} {...props} />;\n}\n\nfunction CardAction({ className, ...props }: CardActionProps) {\n return <div data-slot=\"card-action\" className={cn(\"ml-auto\", className)} {...props} />;\n}\n\nfunction CardContent({ className, ...props }: CardContentProps) {\n return <div data-slot=\"card-content\" className={cn(\"pt-4\", className)} {...props} />;\n}\n\nfunction CardFooter({ className, ...props }: CardFooterProps) {\n return <div data-slot=\"card-footer\" className={cn(\"flex items-center pt-4\", className)} {...props} />;\n}\n\n/*\n * `Card` mở cả hai lối dùng: API tên rời (Card + CardHeader/CardTitle/…) và API gộp\n * (Card.Header / Card.Title / Card.Description / Card.Content / Card.Footer / Card.Action).\n */\nconst Card = Object.assign(CardBase, {\n Header: CardHeader,\n Title: CardTitle,\n Description: CardDescription,\n Content: CardContent,\n Footer: CardFooter,\n Action: CardAction\n});\n\nexport { Card, CardAction, CardContent,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qE,SAAS;AAAA,MAC3F,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,gBAAgB,EAAE,WAAW,GAAG,MAAM,GAAyB;AACtE,SAAO,oBAAC,OAAE,aAAU,oBAAmB,WAAW,GAAG,iCAAiC,SAAS,GAAI,GAAG,OAAO;AAC/G;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AAC5D,SAAO,oBAAC,SAAI,aAAU,eAAc,WAAW,GAAG,WAAW,SAAS,GAAI,GAAG,OAAO;AACtF;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,MAAM,GAAqB;AAC9D,SAAO,oBAAC,SAAI,aAAU,gBAAe,WAAW,GAAG,QAAQ,SAAS,GAAI,GAAG,OAAO;AACpF;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AAC5D,SAAO,oBAAC,SAAI,aAAU,eAAc,WAAW,GAAG,0BAA0B,SAAS,GAAI,GAAG,OAAO;AACrG;AAMA,MAAM,OAAO,OAAO,OAAO,UAAU;AAAA,EACnC,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/card.tsx"],"sourcesContent":["import { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/*\n * Cấu trúc + style port nguyên trạng từ comitor-ds. Tên export giữ tương thích shadcn\n * (Card / CardHeader / CardTitle / CardDescription / CardContent / CardFooter), thêm\n * CardAction (bổ sung, không có trong shadcn gốc).\n */\nconst cardVariants = cva(\"group/card rounded-xl\", {\n variants: {\n variant: {\n /* Viền đo bằng token (3.19.0): bộ green vẽ viền bằng VÒNG BÓNG như `.w{box-shadow:var(--e1)}` của bản mẫu v4 —\n không chiếm chỗ, nên nội dung thẻ không lệch 1px so với bản mẫu. `shadow-(…)` chứ không `[box-shadow:…]`: đi qua\n `--tw-shadow` nên vẫn ghép với `ring-*` của app, và twMerge khử được khi app truyền `shadow-*`/`shadow-none`. */\n default: \"bg-card border-(length:--card-border-w) border-border shadow-(--card-shadow)\",\n elevated: \"bg-card border border-border shadow-card\",\n outline: \"bg-transparent border border-border\",\n ghost: \"bg-transparent border-none\"\n },\n padding: {\n none: \"\",\n sm: \"p-4\",\n /** 20px — mặc định của `size=\"sm\"`; lề TRÊN theo `--card-sm-pt` (bộ green: 14px như `.cb` của bản mẫu v4). */\n compact: \"px-5 pb-5 pt-(--card-sm-pt)\",\n md: \"p-6\",\n lg: \"p-8\"\n }\n },\n defaultVariants: {\n variant: \"default\",\n padding: \"md\"\n }\n});\n\nexport interface CardProps extends React.ComponentProps<\"div\">, VariantProps<typeof cardVariants> {\n /**\n * Cỡ chữ và nhịp của phần đầu/thân (3.19.0). `\"sm\"` = thẻ widget của bảng điều khiển (bản mẫu Imagtor v4 `.ch`/`.ct`/\n * `.cs`/`.cb`): đệm 20px (khi không truyền `padding`), tiêu đề 14,5px/620, mô tả 12,5px cách tiêu đề 3px, thân cách\n * đầu 14px. `CardHeader`/`CardTitle`/`CardDescription`/`CardContent` đọc nó qua `data-size` của thẻ — không prop riêng.\n */\n size?: \"default\" | \"sm\";\n}\nexport interface CardHeaderProps extends React.ComponentProps<\"div\"> {\n /**\n * Đầu thẻ SÁT lề thẻ (3.19.0). Ở `size=\"sm\"` đầu thẻ mặc định lùi vào theo token `--card-sm-header-*` (bộ green: như\n * `.cb > .ch` của bản mẫu v4 — tiêu đề cách mép 34px, hai bên 40px, thân bám ngay dưới). `flush` = kiểu `.cb > .w-h`\n * của v4: tiêu đề ở lề thẻ, cách thân `--card-sm-flush-header-pb`. Mặc định các bộ khác: hai kiểu như nhau.\n */\n flush?: boolean;\n /**\n * Nút/menu đặt ở GÓC PHẢI của header, ngang hàng với tiêu đề.\n *\n * Có nó thì header tự chuyển sang hàng ngang; bỏ trống thì bố cục dọc mặc định giữ\n * nguyên (xem chú thích ở `CardHeader`).\n */\n actions?: React.ReactNode;\n /** className riêng cho cụm `actions` (vd đổi `gap`, cho phép xuống dòng). */\n actionsClassName?: string;\n}\nexport type CardTitleProps = React.ComponentProps<\"h3\">;\nexport type CardDescriptionProps = React.ComponentProps<\"p\">;\nexport type CardActionProps = React.ComponentProps<\"div\">;\nexport type CardContentProps = React.ComponentProps<\"div\">;\nexport type CardFooterProps = React.ComponentProps<\"div\">;\n\nfunction CardBase({ className, variant, padding, size = \"default\", ...props }: CardProps) {\n const pad = padding ?? (size === \"sm\" ? \"compact\" : \"md\");\n return (\n <div\n data-slot=\"card\"\n data-size={size}\n className={cn(cardVariants({ variant, padding: pad }), className)}\n {...props}\n />\n );\n}\n\n/**\n * Đầu thẻ. Mặc định XẾP DỌC (`flex-col space-y-1.5`) — tiêu đề trên, mô tả dưới.\n *\n * ─ VÌ SAO CÓ `actions` ─\n * Thẻ có nút ở góc phải là mẫu lặp lại ở mọi app, mà bố cục dọc mặc định thì chặn nó: mỗi\n * chỗ dùng đều phải ghi đè đúng một chuỗi bốn lớp `\"flex-row items-start justify-between\n * gap-3 space-y-0\"` — chép tay, dễ sót `space-y-0`, và không có gì bảo đảm hai app ghi đè\n * giống nhau. `actions` gói đúng chuỗi đó lại thành một prop.\n *\n * Mặc định KHÔNG đổi: không truyền `actions` thì lớp và cây DOM y hệt `0.2.0` (thêm một\n * `<div>` bọc chỉ xảy ra ở nhánh có actions), nên bản vá này không phá bố cục nào đang chạy.\n *\n * Quan hệ với `CardAction`: `CardAction` là ô `ml-auto` để tự lắp khi bạn ĐÃ tự đặt header\n * thành hàng ngang. `actions` làm cả hai việc — đổi bố cục *và* đặt chỗ — nên là đường đi\n * mặc định; `CardAction` giữ nguyên cho ai đã dùng.\n *\n * ```tsx\n * <CardHeader actions={<Button size=\"sm\" variant=\"ghost\">Sửa</Button>}>\n * <CardTitle>Thông tin đơn vị</CardTitle>\n * <CardDescription>Cập nhật lần cuối hôm qua</CardDescription>\n * </CardHeader>\n * ```\n */\nconst CARD_HEADER_INSET =\n \"group-data-[size=sm]/card:data-[flush=false]:pt-(--card-sm-header-pt) group-data-[size=sm]/card:data-[flush=false]:px-(--card-sm-header-px) group-data-[size=sm]/card:data-[flush=true]:pb-(--card-sm-flush-header-pb)\";\n\nfunction CardHeader({ className, actions, actionsClassName, children, flush = false, ...props }: CardHeaderProps) {\n if (actions === undefined || actions === null || actions === false) {\n return (\n <div\n data-slot=\"card-header\"\n data-flush={flush}\n className={cn(\"flex flex-col space-y-1.5 group-data-[size=sm]/card:space-y-0.75\", CARD_HEADER_INSET, className)}\n {...props}\n >\n {children}\n </div>\n );\n }\n\n return (\n <div\n data-slot=\"card-header\"\n data-flush={flush}\n className={cn(\"flex flex-row items-start justify-between gap-3 space-y-0\", CARD_HEADER_INSET, className)}\n {...props}\n >\n {/* `min-w-0` để tiêu đề dài `truncate` được thay vì đẩy cụm nút ra khỏi thẻ. */}\n <div\n data-slot=\"card-header-text\"\n className=\"flex min-w-0 flex-col space-y-1.5 group-data-[size=sm]/card:space-y-0.75\"\n >\n {children}\n </div>\n <div data-slot=\"card-header-actions\" className={cn(\"flex shrink-0 items-center gap-2\", actionsClassName)}>\n {actions}\n </div>\n </div>\n );\n}\n\nfunction CardTitle({ className, ...props }: CardTitleProps) {\n return (\n <h3\n data-slot=\"card-title\"\n className={cn(\n \"text-lg font-semibold text-foreground leading-none tracking-tight\",\n \"group-data-[size=sm]/card:text-[14.5px] group-data-[size=sm]/card:leading-(--card-title-leading) group-data-[size=sm]/card:font-[620] group-data-[size=sm]/card:tracking-[-0.015em]\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CardDescription({ className, ...props }: CardDescriptionProps) {\n return (\n <p\n data-slot=\"card-description\"\n className={cn(\n \"text-sm text-muted-foreground group-data-[size=sm]/card:text-[12.5px] group-data-[size=sm]/card:leading-(--card-desc-leading)\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction CardAction({ className, ...props }: CardActionProps) {\n return <div data-slot=\"card-action\" className={cn(\"ml-auto\", className)} {...props} />;\n}\n\nfunction CardContent({ className, ...props }: CardContentProps) {\n return (\n <div\n data-slot=\"card-content\"\n className={cn(\"pt-4 group-data-[size=sm]/card:pt-(--card-sm-content-pt)\", className)}\n {...props}\n />\n );\n}\n\nfunction CardFooter({ className, ...props }: CardFooterProps) {\n return <div data-slot=\"card-footer\" className={cn(\"flex items-center pt-4\", className)} {...props} />;\n}\n\n/*\n * `Card` mở cả hai lối dùng: API tên rời (Card + CardHeader/CardTitle/…) và API gộp\n * (Card.Header / Card.Title / Card.Description / Card.Content / Card.Footer / Card.Action).\n */\nconst Card = Object.assign(CardBase, {\n Header: CardHeader,\n Title: CardTitle,\n Description: CardDescription,\n Content: CardContent,\n Footer: CardFooter,\n Action: CardAction\n});\n\nexport { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardVariants };\n"],"mappings":"AAqEI,cAkDA,YAlDA;AArEJ,SAAS,WAA8B;AAEvC,SAAS,UAAU;AAOnB,MAAM,eAAe,IAAI,yBAAyB;AAAA,EAChD,UAAU;AAAA,IACR,SAAS;AAAA;AAAA;AAAA;AAAA,MAIP,SAAS;AAAA,MACT,UAAU;AAAA,MACV,SAAS;AAAA,MACT,OAAO;AAAA,IACT;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,IAAI;AAAA;AAAA,MAEJ,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,IAAI;AAAA,IACN;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AACF,CAAC;AAiCD,SAAS,SAAS,EAAE,WAAW,SAAS,SAAS,OAAO,WAAW,GAAG,MAAM,GAAc;AACxF,QAAM,MAAM,YAAY,SAAS,OAAO,YAAY;AACpD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,aAAW;AAAA,MACX,WAAW,GAAG,aAAa,EAAE,SAAS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AAI,GAAG,OAAO;AACtF;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,MAAM,GAAqB;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,4DAA4D,SAAS;AAAA,MAClF,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AAC5D,SAAO,oBAAC,SAAI,aAAU,eAAc,WAAW,GAAG,0BAA0B,SAAS,GAAI,GAAG,OAAO;AACrG;AAMA,MAAM,OAAO,OAAO,OAAO,UAAU;AAAA,EACnC,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC;","names":[]}
|
|
@@ -34,8 +34,14 @@ type DropdownMenuRadioItemProps = React.ComponentProps<typeof DropdownMenuPrimit
|
|
|
34
34
|
declare function DropdownMenuRadioItem({ className, children, ...props }: DropdownMenuRadioItemProps): React.JSX.Element;
|
|
35
35
|
type DropdownMenuLabelProps = React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
36
36
|
inset?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* `"default"` — nhãn thường (chữ 14px đậm vừa). `"section"` (3.20.0) — nhãn MỤC chữ HOA nhỏ, màu
|
|
39
|
+
* `--muted-foreground`, đặt đầu một nhóm mục ("Vai trò của bạn"); cỡ/độ đậm/giãn chữ theo token
|
|
40
|
+
* `--menu-section-*` (green: `.acct-h` của bản mẫu v4), đệm ngang theo `--menu-item-px` để thẳng mép chữ mục.
|
|
41
|
+
*/
|
|
42
|
+
variant?: "default" | "section";
|
|
37
43
|
};
|
|
38
|
-
declare function DropdownMenuLabel({ className, inset, ...props }: DropdownMenuLabelProps): React.JSX.Element;
|
|
44
|
+
declare function DropdownMenuLabel({ className, inset, variant, ...props }: DropdownMenuLabelProps): React.JSX.Element;
|
|
39
45
|
type DropdownMenuSeparatorProps = React.ComponentProps<typeof DropdownMenuPrimitive.Separator>;
|
|
40
46
|
declare function DropdownMenuSeparator({ className, ...props }: DropdownMenuSeparatorProps): React.JSX.Element;
|
|
41
47
|
type DropdownMenuShortcutProps = React.ComponentProps<"span">;
|
|
@@ -19,7 +19,7 @@ function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
|
19
19
|
"data-slot": "dropdown-menu-content",
|
|
20
20
|
sideOffset,
|
|
21
21
|
className: cn(
|
|
22
|
-
"bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-
|
|
22
|
+
"bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-(--menu-radius) border p-(--menu-pad) shadow-overlay",
|
|
23
23
|
className
|
|
24
24
|
),
|
|
25
25
|
...props
|
|
@@ -37,7 +37,7 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
|
37
37
|
"data-inset": inset,
|
|
38
38
|
"data-variant": variant,
|
|
39
39
|
className: cn(
|
|
40
|
-
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-ink data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive-ink data-[variant=destructive]:*:[svg]:!text-destructive-ink [&_svg:not([class*='text-'])]:text-
|
|
40
|
+
"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-ink data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive-ink data-[variant=destructive]:*:[svg]:!text-destructive-ink [&_svg:not([class*='text-'])]:text-(--menu-icon-fg) relative flex cursor-default items-center gap-(--menu-item-gap) mt-1 first:mt-0 rounded-(--menu-item-radius) px-(--menu-item-px) py-(--menu-item-py) text-(length:--menu-item-text) text-(--menu-item-fg) leading-(--menu-item-leading) outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
41
41
|
className
|
|
42
42
|
),
|
|
43
43
|
...props
|
|
@@ -82,13 +82,18 @@ function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
85
|
+
function DropdownMenuLabel({ className, inset, variant = "default", ...props }) {
|
|
86
86
|
return /* @__PURE__ */ jsx(
|
|
87
87
|
DropdownMenuPrimitive.Label,
|
|
88
88
|
{
|
|
89
89
|
"data-slot": "dropdown-menu-label",
|
|
90
90
|
"data-inset": inset,
|
|
91
|
-
|
|
91
|
+
"data-variant": variant,
|
|
92
|
+
className: cn(
|
|
93
|
+
variant === "section" ? "px-(--menu-item-px) pt-2 pb-1 text-(length:--menu-section-text) leading-normal font-(--menu-section-weight) tracking-(--menu-section-tracking) uppercase text-muted-foreground" : "px-2 py-1.5 text-sm font-medium",
|
|
94
|
+
"data-[inset]:pl-8",
|
|
95
|
+
className
|
|
96
|
+
),
|
|
92
97
|
...props
|
|
93
98
|
}
|
|
94
99
|
);
|
|
@@ -98,7 +103,7 @@ function DropdownMenuSeparator({ className, ...props }) {
|
|
|
98
103
|
DropdownMenuPrimitive.Separator,
|
|
99
104
|
{
|
|
100
105
|
"data-slot": "dropdown-menu-separator",
|
|
101
|
-
className: cn("bg-border -mx
|
|
106
|
+
className: cn("bg-border mx-(--menu-separator-mx) my-(--menu-separator-my) h-px", className),
|
|
102
107
|
...props
|
|
103
108
|
}
|
|
104
109
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/dropdown-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/**\n * DropdownMenu — menu bung ra từ một nút (Radix DropdownMenu).\n *\n * Xương sống của UserMenu, menu thao tác trên dòng bảng, WorkspaceSwitcher.\n * `DropdownMenuItem` có `variant=\"destructive\"` cho mục nguy hiểm (Xóa, Đăng xuất)\n * và `inset` để thụt lề cho ngang hàng với mục có icon chọn.\n */\n\nexport type DropdownMenuProps = React.ComponentProps<typeof DropdownMenuPrimitive.Root>;\n\nfunction DropdownMenu({ ...props }: DropdownMenuProps) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof DropdownMenuPrimitive.Portal>;\n\nfunction DropdownMenuPortal({ ...props }: DropdownMenuPortalProps) {\n return <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />;\n}\n\nexport type DropdownMenuTriggerProps = React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>;\n\nfunction DropdownMenuTrigger({ ...props }: DropdownMenuTriggerProps) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\nexport type DropdownMenuContentProps = React.ComponentProps<typeof DropdownMenuPrimitive.Content>;\n\nfunction DropdownMenuContent({ className, sideOffset = 4, ...props }: DropdownMenuContentProps) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n \"bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-overlay\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport type DropdownMenuGroupProps = React.ComponentProps<typeof DropdownMenuPrimitive.Group>;\n\nfunction DropdownMenuGroup({ ...props }: DropdownMenuGroupProps) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\nexport type DropdownMenuItemVariant = \"default\" | \"destructive\";\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n /** Thụt lề trái để thẳng hàng với mục có ô đánh dấu. */\n inset?: boolean;\n /** \"destructive\" tô đỏ cho thao tác nguy hiểm. Mặc định \"default\". */\n variant?: DropdownMenuItemVariant;\n};\n\nfunction DropdownMenuItem({ className, inset, variant = \"default\", ...props }: DropdownMenuItemProps) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n // `text-destructive-ink` chứ KHÔNG `text-destructive`: `--destructive` là màu NỀN (nút xoá),\n // ghim một giá trị cho cả hai theme nên làm CHỮ trên nền popover tối chỉ được 3,53:1 ✗ —\n // và tệ thêm khi focus vì nền chuyển sang `bg-destructive/20` (2,98:1 ✗). Bậc ink đạt cả\n // hai theme, cả hai nền: 7,15:1 / 6,18:1 (light, nghỉ / focus) · 6,42:1 / 5,42:1 (dark).\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-ink data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive-ink data-[variant=destructive]:*:[svg]:!text-destructive-ink [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm px-2 py-(--menu-item-py) text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>;\n\nfunction DropdownMenuCheckboxItem({ className, children, checked, ...props }: DropdownMenuCheckboxItemProps) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm py-(--menu-item-py) pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nexport type DropdownMenuRadioGroupProps = React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>;\n\nfunction DropdownMenuRadioGroup({ ...props }: DropdownMenuRadioGroupProps) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nexport type DropdownMenuRadioItemProps = React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>;\n\nfunction DropdownMenuRadioItem({ className, children, ...props }: DropdownMenuRadioItemProps) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm py-(--menu-item-py) pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nexport type DropdownMenuLabelProps = React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n};\n\nfunction DropdownMenuLabel({ className, inset, ...props }: DropdownMenuLabelProps) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n className={cn(\"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8\", className)}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof DropdownMenuPrimitive.Separator>;\n\nfunction DropdownMenuSeparator({ className, ...props }: DropdownMenuSeparatorProps) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"bg-border -mx-1 my-1 h-px\", className)}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuShortcutProps = React.ComponentProps<\"span\">;\n\nfunction DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\"text-muted-foreground ml-auto text-xs tracking-widest\", className)}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuSubProps = React.ComponentProps<typeof DropdownMenuPrimitive.Sub>;\n\nfunction DropdownMenuSub({ ...props }: DropdownMenuSubProps) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nexport type DropdownMenuSubTriggerProps = React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n};\n\nfunction DropdownMenuSubTrigger({ className, inset, children, ...props }: DropdownMenuSubTriggerProps) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm px-2 py-(--menu-item-py) text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\n/*\n * ─ VÌ SAO `SubContent` PHẢI BỌC `Portal` ─\n *\n * Không bọc thì Radix render nó (kèm lớp bọc định vị `position: fixed`) làm CON của\n * `DropdownMenuContent`, mà `DropdownMenuContent` có `overflow-x-hidden overflow-y-auto`. `position: fixed`\n * bình thường thoát được `overflow` — TRỪ KHI có tổ tiên tạo containing block cho nó, và\n * `DropdownMenuContent` tạo đúng thứ đó: các lớp `data-[state=open]:animate-in` / `zoom-in-95` /\n * `slide-in-from-*` animate `transform`, với `animation-fill-mode: both` nên transform CÒN LẠI\n * sau khi hiệu ứng chạy xong (`scale(1)` vẫn là transform, không phải `none`).\n *\n * Hệ quả: submenu mở sang BÊN CẠNH menu cha, tức hoàn toàn nằm ngoài hộp của cha theo chiều\n * ngang, và bị `overflow-x-hidden` cắt sạch. Người dùng thấy mục có mũi tên ▸ mà bấm/rê vào\n * không ra gì — không lỗi, không cảnh báo.\n *\n * Đây là hồi quy đã biết của shadcn/ui: nó xuất hiện đúng lúc `DropdownMenuContent` được thêm\n * `max-h-… overflow-y-auto`. Bọc `Portal` đưa submenu ra thẳng `document.body`, thoát cả\n * `overflow` lẫn containing block.\n *\n * ⚠ Đừng \"sửa\" bằng cách bỏ `overflow-y-auto` ở `DropdownMenuContent`: lớp đó có việc của nó (menu\n * dài hơn màn hình thì phải cuộn được).\n */\nexport type DropdownMenuSubContentProps = React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>;\n\nfunction DropdownMenuSubContent({ className, ...props }: DropdownMenuSubContentProps) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-overlay\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,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;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,yDAAyD,SAAS;AAAA,MAC/E,GAAG;AAAA;AAAA,EACN;AAEJ;AAIA,SAAS,gBAAgB,EAAE,GAAG,MAAM,GAAyB;AAC3D,SAAO,oBAAC,sBAAsB,KAAtB,EAA0B,aAAU,qBAAqB,GAAG,OAAO;AAC7E;AAMA,SAAS,uBAAuB,EAAE,WAAW,OAAO,UAAU,GAAG,MAAM,GAAgC;AACrG,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,QACD,oBAAC,oBAAiB,WAAU,kBAAiB;AAAA;AAAA;AAAA,EAC/C;AAEJ;AAyBA,SAAS,uBAAuB,EAAE,WAAW,GAAG,MAAM,GAAgC;AACpF,SACE,oBAAC,sBAAsB,QAAtB,EACC;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/dropdown-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { CheckIcon, ChevronRightIcon, CircleIcon } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/**\n * DropdownMenu — menu bung ra từ một nút (Radix DropdownMenu).\n *\n * Xương sống của UserMenu, menu thao tác trên dòng bảng, WorkspaceSwitcher.\n * `DropdownMenuItem` có `variant=\"destructive\"` cho mục nguy hiểm (Xóa, Đăng xuất)\n * và `inset` để thụt lề cho ngang hàng với mục có icon chọn.\n */\n\nexport type DropdownMenuProps = React.ComponentProps<typeof DropdownMenuPrimitive.Root>;\n\nfunction DropdownMenu({ ...props }: DropdownMenuProps) {\n return <DropdownMenuPrimitive.Root data-slot=\"dropdown-menu\" {...props} />;\n}\n\nexport type DropdownMenuPortalProps = React.ComponentProps<typeof DropdownMenuPrimitive.Portal>;\n\nfunction DropdownMenuPortal({ ...props }: DropdownMenuPortalProps) {\n return <DropdownMenuPrimitive.Portal data-slot=\"dropdown-menu-portal\" {...props} />;\n}\n\nexport type DropdownMenuTriggerProps = React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>;\n\nfunction DropdownMenuTrigger({ ...props }: DropdownMenuTriggerProps) {\n return <DropdownMenuPrimitive.Trigger data-slot=\"dropdown-menu-trigger\" {...props} />;\n}\n\nexport type DropdownMenuContentProps = React.ComponentProps<typeof DropdownMenuPrimitive.Content>;\n\nfunction DropdownMenuContent({ className, sideOffset = 4, ...props }: DropdownMenuContentProps) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n data-slot=\"dropdown-menu-content\"\n sideOffset={sideOffset}\n className={cn(\n \"bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-(--menu-radius) border p-(--menu-pad) shadow-overlay\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport type DropdownMenuGroupProps = React.ComponentProps<typeof DropdownMenuPrimitive.Group>;\n\nfunction DropdownMenuGroup({ ...props }: DropdownMenuGroupProps) {\n return <DropdownMenuPrimitive.Group data-slot=\"dropdown-menu-group\" {...props} />;\n}\n\nexport type DropdownMenuItemVariant = \"default\" | \"destructive\";\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {\n /** Thụt lề trái để thẳng hàng với mục có ô đánh dấu. */\n inset?: boolean;\n /** \"destructive\" tô đỏ cho thao tác nguy hiểm. Mặc định \"default\". */\n variant?: DropdownMenuItemVariant;\n};\n\nfunction DropdownMenuItem({ className, inset, variant = \"default\", ...props }: DropdownMenuItemProps) {\n return (\n <DropdownMenuPrimitive.Item\n data-slot=\"dropdown-menu-item\"\n data-inset={inset}\n data-variant={variant}\n // `text-destructive-ink` chứ KHÔNG `text-destructive`: `--destructive` là màu NỀN (nút xoá),\n // ghim một giá trị cho cả hai theme nên làm CHỮ trên nền popover tối chỉ được 3,53:1 ✗ —\n // và tệ thêm khi focus vì nền chuyển sang `bg-destructive/20` (2,98:1 ✗). Bậc ink đạt cả\n // hai theme, cả hai nền: 7,15:1 / 6,18:1 (light, nghỉ / focus) · 6,42:1 / 5,42:1 (dark).\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-ink data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive-ink data-[variant=destructive]:*:[svg]:!text-destructive-ink [&_svg:not([class*='text-'])]:text-(--menu-icon-fg) relative flex cursor-default items-center gap-(--menu-item-gap) mt-1 first:mt-0 rounded-(--menu-item-radius) px-(--menu-item-px) py-(--menu-item-py) text-(length:--menu-item-text) text-(--menu-item-fg) leading-(--menu-item-leading) outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuCheckboxItemProps = React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>;\n\nfunction DropdownMenuCheckboxItem({ className, children, checked, ...props }: DropdownMenuCheckboxItemProps) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n data-slot=\"dropdown-menu-checkbox-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm py-(--menu-item-py) pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nexport type DropdownMenuRadioGroupProps = React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>;\n\nfunction DropdownMenuRadioGroup({ ...props }: DropdownMenuRadioGroupProps) {\n return <DropdownMenuPrimitive.RadioGroup data-slot=\"dropdown-menu-radio-group\" {...props} />;\n}\n\nexport type DropdownMenuRadioItemProps = React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>;\n\nfunction DropdownMenuRadioItem({ className, children, ...props }: DropdownMenuRadioItemProps) {\n return (\n <DropdownMenuPrimitive.RadioItem\n data-slot=\"dropdown-menu-radio-item\"\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm py-(--menu-item-py) pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n <span className=\"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CircleIcon className=\"size-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nexport type DropdownMenuLabelProps = React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n /**\n * `\"default\"` — nhãn thường (chữ 14px đậm vừa). `\"section\"` (3.20.0) — nhãn MỤC chữ HOA nhỏ, màu\n * `--muted-foreground`, đặt đầu một nhóm mục (\"Vai trò của bạn\"); cỡ/độ đậm/giãn chữ theo token\n * `--menu-section-*` (green: `.acct-h` của bản mẫu v4), đệm ngang theo `--menu-item-px` để thẳng mép chữ mục.\n */\n variant?: \"default\" | \"section\";\n};\n\nfunction DropdownMenuLabel({ className, inset, variant = \"default\", ...props }: DropdownMenuLabelProps) {\n return (\n <DropdownMenuPrimitive.Label\n data-slot=\"dropdown-menu-label\"\n data-inset={inset}\n data-variant={variant}\n className={cn(\n variant === \"section\"\n ? \"px-(--menu-item-px) pt-2 pb-1 text-(length:--menu-section-text) leading-normal font-(--menu-section-weight) tracking-(--menu-section-tracking) uppercase text-muted-foreground\"\n : \"px-2 py-1.5 text-sm font-medium\",\n \"data-[inset]:pl-8\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuSeparatorProps = React.ComponentProps<typeof DropdownMenuPrimitive.Separator>;\n\nfunction DropdownMenuSeparator({ className, ...props }: DropdownMenuSeparatorProps) {\n return (\n <DropdownMenuPrimitive.Separator\n data-slot=\"dropdown-menu-separator\"\n className={cn(\"bg-border mx-(--menu-separator-mx) my-(--menu-separator-my) h-px\", className)}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuShortcutProps = React.ComponentProps<\"span\">;\n\nfunction DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps) {\n return (\n <span\n data-slot=\"dropdown-menu-shortcut\"\n className={cn(\"text-muted-foreground ml-auto text-xs tracking-widest\", className)}\n {...props}\n />\n );\n}\n\nexport type DropdownMenuSubProps = React.ComponentProps<typeof DropdownMenuPrimitive.Sub>;\n\nfunction DropdownMenuSub({ ...props }: DropdownMenuSubProps) {\n return <DropdownMenuPrimitive.Sub data-slot=\"dropdown-menu-sub\" {...props} />;\n}\n\nexport type DropdownMenuSubTriggerProps = React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n};\n\nfunction DropdownMenuSubTrigger({ className, inset, children, ...props }: DropdownMenuSubTriggerProps) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n data-slot=\"dropdown-menu-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 mt-1 first:mt-0 rounded-sm px-2 py-(--menu-item-py) text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto size-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\n/*\n * ─ VÌ SAO `SubContent` PHẢI BỌC `Portal` ─\n *\n * Không bọc thì Radix render nó (kèm lớp bọc định vị `position: fixed`) làm CON của\n * `DropdownMenuContent`, mà `DropdownMenuContent` có `overflow-x-hidden overflow-y-auto`. `position: fixed`\n * bình thường thoát được `overflow` — TRỪ KHI có tổ tiên tạo containing block cho nó, và\n * `DropdownMenuContent` tạo đúng thứ đó: các lớp `data-[state=open]:animate-in` / `zoom-in-95` /\n * `slide-in-from-*` animate `transform`, với `animation-fill-mode: both` nên transform CÒN LẠI\n * sau khi hiệu ứng chạy xong (`scale(1)` vẫn là transform, không phải `none`).\n *\n * Hệ quả: submenu mở sang BÊN CẠNH menu cha, tức hoàn toàn nằm ngoài hộp của cha theo chiều\n * ngang, và bị `overflow-x-hidden` cắt sạch. Người dùng thấy mục có mũi tên ▸ mà bấm/rê vào\n * không ra gì — không lỗi, không cảnh báo.\n *\n * Đây là hồi quy đã biết của shadcn/ui: nó xuất hiện đúng lúc `DropdownMenuContent` được thêm\n * `max-h-… overflow-y-auto`. Bọc `Portal` đưa submenu ra thẳng `document.body`, thoát cả\n * `overflow` lẫn containing block.\n *\n * ⚠ Đừng \"sửa\" bằng cách bỏ `overflow-y-auto` ở `DropdownMenuContent`: lớp đó có việc của nó (menu\n * dài hơn màn hình thì phải cuộn được).\n */\nexport type DropdownMenuSubContentProps = React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>;\n\nfunction DropdownMenuSubContent({ className, ...props }: DropdownMenuSubContentProps) {\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.SubContent\n data-slot=\"dropdown-menu-sub-content\"\n className={cn(\n \"bg-popover text-popover-foreground 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-overlay\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n );\n}\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger\n};\n"],"mappings":";AAkBS,cAuEL,YAvEK;AAhBT,YAAY,2BAA2B;AACvC,SAAS,WAAW,kBAAkB,kBAAkB;AAExD,SAAS,UAAU;AAYnB,SAAS,aAAa,EAAE,GAAG,MAAM,GAAsB;AACrD,SAAO,oBAAC,sBAAsB,MAAtB,EAA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KAAtB,EAA0B,aAAU,qBAAqB,GAAG,OAAO;AAC7E;AAMA,SAAS,uBAAuB,EAAE,WAAW,OAAO,UAAU,GAAG,MAAM,GAAgC;AACrG,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,QACD,oBAAC,oBAAiB,WAAU,kBAAiB;AAAA;AAAA;AAAA,EAC/C;AAEJ;AAyBA,SAAS,uBAAuB,EAAE,WAAW,GAAG,MAAM,GAAgC;AACpF,SACE,oBAAC,sBAAsB,QAAtB,EACC;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;","names":[]}
|
|
@@ -9,17 +9,24 @@ type ItemSeparatorProps = SeparatorProps;
|
|
|
9
9
|
declare function ItemGroup({ className, children, ...props }: ItemGroupProps): React.JSX.Element;
|
|
10
10
|
declare function ItemSeparator({ className, ...props }: ItemSeparatorProps): React.JSX.Element;
|
|
11
11
|
declare const itemVariants: (props?: ({
|
|
12
|
-
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
12
|
+
variant?: "default" | "outline" | "muted" | "flush" | null | undefined;
|
|
13
13
|
size?: "default" | "sm" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface ItemProps extends React.ComponentProps<"div">, VariantProps<typeof itemVariants> {
|
|
16
16
|
/** Render ra chính phần tử con (Radix Slot) — dùng khi cần <a> hoặc <button>. */
|
|
17
17
|
asChild?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Canh dọc (3.19.0). Bỏ trống = như cũ (giữa; ô media lên đầu khi có mô tả). `"start"` canh mọi thứ lên đầu dòng;
|
|
20
|
+
* `"center"` giữ ô media ở GIỮA kể cả khi có mô tả.
|
|
21
|
+
*/
|
|
22
|
+
align?: "start" | "center";
|
|
18
23
|
}
|
|
19
|
-
declare function Item({ className, variant, size, asChild, ...props }: ItemProps): React.JSX.Element;
|
|
24
|
+
declare function Item({ className, variant, size, align, asChild, ...props }: ItemProps): React.JSX.Element;
|
|
20
25
|
declare const itemMediaVariants: (props?: ({
|
|
21
26
|
variant?: "image" | "default" | "icon" | null | undefined;
|
|
27
|
+
tone?: "neutral" | "primary" | "destructive" | "warning" | "success" | "info" | "severe" | null | undefined;
|
|
22
28
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
29
|
+
type ItemMediaTone = "neutral" | "primary" | "success" | "warning" | "severe" | "destructive" | "info";
|
|
23
30
|
interface ItemMediaProps extends React.ComponentProps<"div">, VariantProps<typeof itemMediaVariants> {
|
|
24
31
|
}
|
|
25
32
|
type ItemContentProps = React.ComponentProps<"div">;
|
|
@@ -28,7 +35,7 @@ type ItemDescriptionProps = React.ComponentProps<"p">;
|
|
|
28
35
|
type ItemActionsProps = React.ComponentProps<"div">;
|
|
29
36
|
type ItemHeaderProps = React.ComponentProps<"div">;
|
|
30
37
|
type ItemFooterProps = React.ComponentProps<"div">;
|
|
31
|
-
declare function ItemMedia({ className, variant, ...props }: ItemMediaProps): React.JSX.Element;
|
|
38
|
+
declare function ItemMedia({ className, variant, tone, ...props }: ItemMediaProps): React.JSX.Element;
|
|
32
39
|
declare function ItemContent({ className, ...props }: ItemContentProps): React.JSX.Element;
|
|
33
40
|
declare function ItemTitle({ className, ...props }: ItemTitleProps): React.JSX.Element;
|
|
34
41
|
declare function ItemDescription({ className, ...props }: ItemDescriptionProps): React.JSX.Element;
|
|
@@ -36,4 +43,4 @@ declare function ItemActions({ className, ...props }: ItemActionsProps): React.J
|
|
|
36
43
|
declare function ItemHeader({ className, ...props }: ItemHeaderProps): React.JSX.Element;
|
|
37
44
|
declare function ItemFooter({ className, ...props }: ItemFooterProps): React.JSX.Element;
|
|
38
45
|
|
|
39
|
-
export { Item, ItemActions, type ItemActionsProps, ItemContent, type ItemContentProps, ItemDescription, type ItemDescriptionProps, ItemFooter, type ItemFooterProps, ItemGroup, type ItemGroupProps, ItemHeader, type ItemHeaderProps, ItemMedia, type ItemMediaProps, type ItemProps, ItemSeparator, type ItemSeparatorProps, ItemTitle, type ItemTitleProps, itemMediaVariants, itemVariants };
|
|
46
|
+
export { Item, ItemActions, type ItemActionsProps, ItemContent, type ItemContentProps, ItemDescription, type ItemDescriptionProps, ItemFooter, type ItemFooterProps, ItemGroup, type ItemGroupProps, ItemHeader, type ItemHeaderProps, ItemMedia, type ItemMediaProps, type ItemMediaTone, type ItemProps, ItemSeparator, type ItemSeparatorProps, ItemTitle, type ItemTitleProps, itemMediaVariants, itemVariants };
|
|
@@ -27,20 +27,30 @@ const itemVariants = cva(
|
|
|
27
27
|
variant: {
|
|
28
28
|
default: "bg-transparent",
|
|
29
29
|
outline: "border-border",
|
|
30
|
-
muted: "bg-muted/50"
|
|
30
|
+
muted: "bg-muted/50",
|
|
31
|
+
/*
|
|
32
|
+
* Dòng PHẲNG (3.19.0, bản mẫu Imagtor v4 `.al-i`): không đệm ngang, không bo góc, vạch `--border` giữa các
|
|
33
|
+
* dòng (dòng cuối không vạch) — danh sách nằm thẳng mép thân thẻ. Tiêu đề 13px/570, mô tả 11,5px.
|
|
34
|
+
*/
|
|
35
|
+
/* v4 `.al-i`: vạch TRÊN (lớp) + vạch DƯỚI (inline) — hai dòng kề nhau giáp hai vạch, dòng đầu/cuối có vạch. */
|
|
36
|
+
flush: "rounded-none border-x-0 border-y-border"
|
|
31
37
|
},
|
|
32
38
|
size: {
|
|
33
39
|
default: "p-4 gap-4",
|
|
34
40
|
sm: "py-(--list-item-py) px-4 gap-2.5"
|
|
35
41
|
}
|
|
36
42
|
},
|
|
43
|
+
compoundVariants: [
|
|
44
|
+
{ variant: "flush", size: "default", class: "px-0" },
|
|
45
|
+
{ variant: "flush", size: "sm", class: "px-0 py-(--item-flush-py) gap-[11px]" }
|
|
46
|
+
],
|
|
37
47
|
defaultVariants: {
|
|
38
48
|
variant: "default",
|
|
39
49
|
size: "default"
|
|
40
50
|
}
|
|
41
51
|
}
|
|
42
52
|
);
|
|
43
|
-
function Item({ className, variant = "default", size = "default", asChild = false, ...props }) {
|
|
53
|
+
function Item({ className, variant = "default", size = "default", align, asChild = false, ...props }) {
|
|
44
54
|
const Comp = asChild ? Slot : "div";
|
|
45
55
|
return /* @__PURE__ */ jsx(
|
|
46
56
|
Comp,
|
|
@@ -48,7 +58,13 @@ function Item({ className, variant = "default", size = "default", asChild = fals
|
|
|
48
58
|
"data-slot": "item",
|
|
49
59
|
"data-variant": variant,
|
|
50
60
|
"data-size": size,
|
|
51
|
-
|
|
61
|
+
"data-align": align,
|
|
62
|
+
className: cn(
|
|
63
|
+
itemVariants({ variant, size }),
|
|
64
|
+
align === "start" && "items-start",
|
|
65
|
+
align === "center" && "[&>[data-slot=item-media]]:!translate-y-0 [&>[data-slot=item-media]]:!self-center",
|
|
66
|
+
className
|
|
67
|
+
),
|
|
52
68
|
...props
|
|
53
69
|
}
|
|
54
70
|
);
|
|
@@ -59,22 +75,50 @@ const itemMediaVariants = cva(
|
|
|
59
75
|
variants: {
|
|
60
76
|
variant: {
|
|
61
77
|
default: "bg-transparent",
|
|
62
|
-
icon: "size-8 border rounded-sm
|
|
78
|
+
icon: "size-8 border rounded-sm text-xs font-semibold tabular-nums [&_svg:not([class*='size-'])]:size-4 group-data-[variant=flush]/item:size-[30px] group-data-[variant=flush]/item:rounded-[10px] group-data-[variant=flush]/item:group-has-[[data-slot=item-description]]/item:translate-y-0 group-data-[variant=flush]/item:mt-px",
|
|
63
79
|
image: "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover"
|
|
80
|
+
},
|
|
81
|
+
tone: {
|
|
82
|
+
neutral: "",
|
|
83
|
+
primary: "",
|
|
84
|
+
success: "",
|
|
85
|
+
warning: "",
|
|
86
|
+
severe: "",
|
|
87
|
+
destructive: "",
|
|
88
|
+
info: ""
|
|
64
89
|
}
|
|
65
90
|
},
|
|
91
|
+
/*
|
|
92
|
+
* Tone của ô icon (3.19.0, bản mẫu v4 `.al-ic`) — CÙNG cặp nền/chữ với `STATUS_TONES` (đã đo AA trên tint của
|
|
93
|
+
* chính nó); chỉ có nghĩa với `variant="icon"`. Ô chứa được icon HOẶC chữ ngắn (một con số).
|
|
94
|
+
*/
|
|
95
|
+
compoundVariants: [
|
|
96
|
+
{ variant: "icon", tone: "neutral", class: "bg-muted" },
|
|
97
|
+
{
|
|
98
|
+
variant: "icon",
|
|
99
|
+
tone: "primary",
|
|
100
|
+
class: "border-transparent bg-primary/20 text-brand-600 dark:text-brand-100"
|
|
101
|
+
},
|
|
102
|
+
{ variant: "icon", tone: "success", class: "border-transparent bg-success/15 text-success-ink" },
|
|
103
|
+
{ variant: "icon", tone: "warning", class: "border-transparent bg-warning/20 text-warning-ink" },
|
|
104
|
+
{ variant: "icon", tone: "severe", class: "border-transparent bg-severe/15 text-severe-ink" },
|
|
105
|
+
{ variant: "icon", tone: "destructive", class: "border-transparent bg-destructive/15 text-destructive-ink" },
|
|
106
|
+
{ variant: "icon", tone: "info", class: "border-transparent bg-info/15 text-info-ink" }
|
|
107
|
+
],
|
|
66
108
|
defaultVariants: {
|
|
67
|
-
variant: "default"
|
|
109
|
+
variant: "default",
|
|
110
|
+
tone: "neutral"
|
|
68
111
|
}
|
|
69
112
|
}
|
|
70
113
|
);
|
|
71
|
-
function ItemMedia({ className, variant = "default", ...props }) {
|
|
114
|
+
function ItemMedia({ className, variant = "default", tone = "neutral", ...props }) {
|
|
72
115
|
return /* @__PURE__ */ jsx(
|
|
73
116
|
"div",
|
|
74
117
|
{
|
|
75
118
|
"data-slot": "item-media",
|
|
76
119
|
"data-variant": variant,
|
|
77
|
-
|
|
120
|
+
"data-tone": variant === "icon" ? tone : void 0,
|
|
121
|
+
className: cn(itemMediaVariants({ variant, tone }), className),
|
|
78
122
|
...props
|
|
79
123
|
}
|
|
80
124
|
);
|
|
@@ -84,7 +128,10 @@ function ItemContent({ className, ...props }) {
|
|
|
84
128
|
"div",
|
|
85
129
|
{
|
|
86
130
|
"data-slot": "item-content",
|
|
87
|
-
className: cn(
|
|
131
|
+
className: cn(
|
|
132
|
+
"flex flex-1 flex-col gap-1 group-data-[variant=flush]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none",
|
|
133
|
+
className
|
|
134
|
+
),
|
|
88
135
|
...props
|
|
89
136
|
}
|
|
90
137
|
);
|
|
@@ -94,7 +141,11 @@ function ItemTitle({ className, ...props }) {
|
|
|
94
141
|
"div",
|
|
95
142
|
{
|
|
96
143
|
"data-slot": "item-title",
|
|
97
|
-
className: cn(
|
|
144
|
+
className: cn(
|
|
145
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium",
|
|
146
|
+
"group-data-[variant=flush]/item:text-[13px] group-data-[variant=flush]/item:font-[570] group-data-[variant=flush]/item:leading-[1.4]",
|
|
147
|
+
className
|
|
148
|
+
),
|
|
98
149
|
...props
|
|
99
150
|
}
|
|
100
151
|
);
|
|
@@ -106,6 +157,7 @@ function ItemDescription({ className, ...props }) {
|
|
|
106
157
|
"data-slot": "item-description",
|
|
107
158
|
className: cn(
|
|
108
159
|
"text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance",
|
|
160
|
+
"group-data-[variant=flush]/item:text-[11.5px]",
|
|
109
161
|
"[&>a:hover]:text-link-ink-hover [&>a]:underline [&>a]:underline-offset-4",
|
|
110
162
|
className
|
|
111
163
|
),
|
|
@@ -114,7 +166,18 @@ function ItemDescription({ className, ...props }) {
|
|
|
114
166
|
);
|
|
115
167
|
}
|
|
116
168
|
function ItemActions({ className, ...props }) {
|
|
117
|
-
return /* @__PURE__ */ jsx(
|
|
169
|
+
return /* @__PURE__ */ jsx(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
"data-slot": "item-actions",
|
|
173
|
+
className: cn(
|
|
174
|
+
"flex items-center gap-2",
|
|
175
|
+
"group-data-[variant=flush]/item:ml-auto group-data-[variant=flush]/item:pt-0.5 group-data-[variant=flush]/item:text-[11px] group-data-[variant=flush]/item:leading-normal group-data-[variant=flush]/item:tabular-nums",
|
|
176
|
+
className
|
|
177
|
+
),
|
|
178
|
+
...props
|
|
179
|
+
}
|
|
180
|
+
);
|
|
118
181
|
}
|
|
119
182
|
function ItemHeader({ className, ...props }) {
|
|
120
183
|
return /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/item.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { Children, cloneElement, Fragment, isValidElement, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn.js\";\nimport { Separator, type SeparatorProps } from \"./separator.js\";\n\nexport type ItemGroupProps = React.ComponentProps<\"div\">;\nexport type ItemSeparatorProps = SeparatorProps;\n\n/**\n * Gắn `role=\"listitem\"` cho mọi `Item` là con của `ItemGroup` (đi xuyên `Fragment`), vì `ItemGroup` là\n * `role=\"list\"` — danh sách không có `listitem` là không hợp lệ (axe: aria-required-children).\n *\n * Vì sao `cloneElement` chứ không context: `item.tsx` là file TĨNH dùng được trong Server Component;\n * context buộc nó thành client. Cái giá: chỉ thấy `Item` viết TRỰC TIẾP trong cây con (qua mảng và\n * `Fragment`) — `Item` nằm trong một component khác của app thì app tự truyền `role=\"listitem\"`.\n *\n * Không gắn khi: app đã truyền `role` (kể cả `role={undefined}` thì không — chỉ kiểm có khoá), hoặc\n * `asChild` — `Item asChild` thường là một `<a>`, đè `listitem` lên đó là XOÁ vai trò liên kết.\n */\nfunction withListItemRole(children: ReactNode): ReactNode {\n return Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode; role?: string; asChild?: boolean }>(child)) return child;\n if (child.type === Fragment) return cloneElement(child, undefined, withListItemRole(child.props.children));\n if (child.type === Item && !(\"role\" in child.props) && !child.props.asChild) {\n return cloneElement(child, { role: \"listitem\" });\n }\n return child;\n });\n}\n\nfunction ItemGroup({ className, children, ...props }: ItemGroupProps) {\n return (\n <div role=\"list\" data-slot=\"item-group\" className={cn(\"group/item-group flex flex-col\", className)} {...props}>\n {withListItemRole(children)}\n </div>\n );\n}\n\nfunction ItemSeparator({ className, ...props }: ItemSeparatorProps) {\n return <Separator data-slot=\"item-separator\" orientation=\"horizontal\" className={cn(\"my-0\", className)} {...props} />;\n}\n\nconst itemVariants = cva(\n \"group/item flex items-center border border-transparent text-sm rounded-md transition-colors duration-150 ease-out [a&]:hover:bg-accent/50 [a&]:transition-colors flex-wrap outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline: \"border-border\",\n muted: \"bg-muted/50\"\n },\n size: {\n default: \"p-4 gap-4\",\n sm: \"py-(--list-item-py) px-4 gap-2.5\"\n }\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n);\n\nexport interface ItemProps extends React.ComponentProps<\"div\">, VariantProps<typeof itemVariants> {\n /** Render ra chính phần tử con (Radix Slot) — dùng khi cần <a> hoặc <button>. */\n asChild?: boolean;\n}\n\nfunction Item({ className, variant = \"default\", size = \"default\", asChild = false, ...props }: ItemProps) {\n const Comp = asChild ? Slot : \"div\";\n return (\n <Comp\n data-slot=\"item\"\n data-variant={variant}\n data-size={size}\n className={cn(itemVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\n\nconst itemMediaVariants = cva(\n \"flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n icon: \"size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4\",\n image: \"size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover\"\n }\n },\n defaultVariants: {\n variant: \"default\"\n }\n }\n);\n\nexport interface ItemMediaProps extends React.ComponentProps<\"div\">, VariantProps<typeof itemMediaVariants> {}\nexport type ItemContentProps = React.ComponentProps<\"div\">;\nexport type ItemTitleProps = React.ComponentProps<\"div\">;\nexport type ItemDescriptionProps = React.ComponentProps<\"p\">;\nexport type ItemActionsProps = React.ComponentProps<\"div\">;\nexport type ItemHeaderProps = React.ComponentProps<\"div\">;\nexport type ItemFooterProps = React.ComponentProps<\"div\">;\n\nfunction ItemMedia({ className, variant = \"default\", ...props }: ItemMediaProps) {\n return (\n <div\n data-slot=\"item-media\"\n data-variant={variant}\n className={cn(itemMediaVariants({ variant, className }))}\n {...props}\n />\n );\n}\n\nfunction ItemContent({ className, ...props }: ItemContentProps) {\n return (\n <div\n data-slot=\"item-content\"\n className={cn(\"flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none\", className)}\n {...props}\n />\n );\n}\n\nfunction ItemTitle({ className, ...props }: ItemTitleProps) {\n return (\n <div\n data-slot=\"item-title\"\n className={cn(\"flex w-fit items-center gap-2 text-sm leading-snug font-medium\", className)}\n {...props}\n />\n );\n}\n\nfunction ItemDescription({ className, ...props }: ItemDescriptionProps) {\n return (\n <p\n data-slot=\"item-description\"\n className={cn(\n \"text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance\",\n \"[&>a:hover]:text-link-ink-hover [&>a]:underline [&>a]:underline-offset-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ItemActions({ className, ...props }: ItemActionsProps) {\n return <div data-slot=\"item-actions\" className={cn(\"flex items-center gap-2\", className)} {...props} />;\n}\n\nfunction ItemHeader({ className, ...props }: ItemHeaderProps) {\n return (\n <div\n data-slot=\"item-header\"\n className={cn(\"flex basis-full items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n}\n\nfunction ItemFooter({ className, ...props }: ItemFooterProps) {\n return (\n <div\n data-slot=\"item-footer\"\n className={cn(\"flex basis-full items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Item,\n ItemActions,\n ItemContent,\n ItemDescription,\n ItemFooter,\n ItemGroup,\n ItemHeader,\n ItemMedia,\n ItemSeparator,\n ItemTitle,\n itemMediaVariants,\n itemVariants\n};\n"],"mappings":"AAkCI;AAlCJ,SAAS,YAAY;AACrB,SAAS,WAA8B;AAEvC,SAAS,UAAU,cAAc,UAAU,sBAAsC;AACjF,SAAS,UAAU;AACnB,SAAS,iBAAsC;AAgB/C,SAAS,iBAAiB,UAAgC;AACxD,SAAO,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,QAAI,CAAC,eAA2E,KAAK,EAAG,QAAO;AAC/F,QAAI,MAAM,SAAS,SAAU,QAAO,aAAa,OAAO,QAAW,iBAAiB,MAAM,MAAM,QAAQ,CAAC;AACzG,QAAI,MAAM,SAAS,QAAQ,EAAE,UAAU,MAAM,UAAU,CAAC,MAAM,MAAM,SAAS;AAC3E,aAAO,aAAa,OAAO,EAAE,MAAM,WAAW,CAAC;AAAA,IACjD;AACA,WAAO;AAAA,EACT,CAAC;AACH;AAEA,SAAS,UAAU,EAAE,WAAW,UAAU,GAAG,MAAM,GAAmB;AACpE,SACE,oBAAC,SAAI,MAAK,QAAO,aAAU,cAAa,WAAW,GAAG,kCAAkC,SAAS,GAAI,GAAG,OACrG,2BAAiB,QAAQ,GAC5B;AAEJ;AAEA,SAAS,cAAc,EAAE,WAAW,GAAG,MAAM,GAAuB;AAClE,SAAO,oBAAC,aAAU,aAAU,kBAAiB,aAAY,cAAa,WAAW,GAAG,QAAQ,SAAS,GAAI,GAAG,OAAO;AACrH;AAEA,MAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,MACT;AAAA,MACA,MAAM;AAAA,QACJ,SA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BAAgB,EAAE,WAAW,GAAG,MAAM,GAAyB;AACtE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,MAAM,GAAqB;AAC9D,SAAO,oBAAC,SAAI,aAAU,gBAAe,WAAW,GAAG,2BAA2B,SAAS,GAAI,GAAG,OAAO;AACvG;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,sDAAsD,SAAS;AAAA,MAC5E,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,sDAAsD,SAAS;AAAA,MAC5E,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/item.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { Children, cloneElement, Fragment, isValidElement, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn.js\";\nimport { Separator, type SeparatorProps } from \"./separator.js\";\n\nexport type ItemGroupProps = React.ComponentProps<\"div\">;\nexport type ItemSeparatorProps = SeparatorProps;\n\n/**\n * Gắn `role=\"listitem\"` cho mọi `Item` là con của `ItemGroup` (đi xuyên `Fragment`), vì `ItemGroup` là\n * `role=\"list\"` — danh sách không có `listitem` là không hợp lệ (axe: aria-required-children).\n *\n * Vì sao `cloneElement` chứ không context: `item.tsx` là file TĨNH dùng được trong Server Component;\n * context buộc nó thành client. Cái giá: chỉ thấy `Item` viết TRỰC TIẾP trong cây con (qua mảng và\n * `Fragment`) — `Item` nằm trong một component khác của app thì app tự truyền `role=\"listitem\"`.\n *\n * Không gắn khi: app đã truyền `role` (kể cả `role={undefined}` thì không — chỉ kiểm có khoá), hoặc\n * `asChild` — `Item asChild` thường là một `<a>`, đè `listitem` lên đó là XOÁ vai trò liên kết.\n */\nfunction withListItemRole(children: ReactNode): ReactNode {\n return Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode; role?: string; asChild?: boolean }>(child)) return child;\n if (child.type === Fragment) return cloneElement(child, undefined, withListItemRole(child.props.children));\n if (child.type === Item && !(\"role\" in child.props) && !child.props.asChild) {\n return cloneElement(child, { role: \"listitem\" });\n }\n return child;\n });\n}\n\nfunction ItemGroup({ className, children, ...props }: ItemGroupProps) {\n return (\n <div role=\"list\" data-slot=\"item-group\" className={cn(\"group/item-group flex flex-col\", className)} {...props}>\n {withListItemRole(children)}\n </div>\n );\n}\n\nfunction ItemSeparator({ className, ...props }: ItemSeparatorProps) {\n return <Separator data-slot=\"item-separator\" orientation=\"horizontal\" className={cn(\"my-0\", className)} {...props} />;\n}\n\nconst itemVariants = cva(\n \"group/item flex items-center border border-transparent text-sm rounded-md transition-colors duration-150 ease-out [a&]:hover:bg-accent/50 [a&]:transition-colors flex-wrap outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline: \"border-border\",\n muted: \"bg-muted/50\",\n /*\n * Dòng PHẲNG (3.19.0, bản mẫu Imagtor v4 `.al-i`): không đệm ngang, không bo góc, vạch `--border` giữa các\n * dòng (dòng cuối không vạch) — danh sách nằm thẳng mép thân thẻ. Tiêu đề 13px/570, mô tả 11,5px.\n */\n /* v4 `.al-i`: vạch TRÊN (lớp) + vạch DƯỚI (inline) — hai dòng kề nhau giáp hai vạch, dòng đầu/cuối có vạch. */\n flush: \"rounded-none border-x-0 border-y-border\"\n },\n size: {\n default: \"p-4 gap-4\",\n sm: \"py-(--list-item-py) px-4 gap-2.5\"\n }\n },\n compoundVariants: [\n { variant: \"flush\", size: \"default\", class: \"px-0\" },\n { variant: \"flush\", size: \"sm\", class: \"px-0 py-(--item-flush-py) gap-[11px]\" }\n ],\n defaultVariants: {\n variant: \"default\",\n size: \"default\"\n }\n }\n);\n\nexport interface ItemProps extends React.ComponentProps<\"div\">, VariantProps<typeof itemVariants> {\n /** Render ra chính phần tử con (Radix Slot) — dùng khi cần <a> hoặc <button>. */\n asChild?: boolean;\n /**\n * Canh dọc (3.19.0). Bỏ trống = như cũ (giữa; ô media lên đầu khi có mô tả). `\"start\"` canh mọi thứ lên đầu dòng;\n * `\"center\"` giữ ô media ở GIỮA kể cả khi có mô tả.\n */\n align?: \"start\" | \"center\";\n}\n\nfunction Item({ className, variant = \"default\", size = \"default\", align, asChild = false, ...props }: ItemProps) {\n const Comp = asChild ? Slot : \"div\";\n return (\n <Comp\n data-slot=\"item\"\n data-variant={variant}\n data-size={size}\n data-align={align}\n className={cn(\n itemVariants({ variant, size }),\n align === \"start\" && \"items-start\",\n align === \"center\" && \"[&>[data-slot=item-media]]:!translate-y-0 [&>[data-slot=item-media]]:!self-center\",\n className\n )}\n {...props}\n />\n );\n}\n\nconst itemMediaVariants = cva(\n \"flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n icon: \"size-8 border rounded-sm text-xs font-semibold tabular-nums [&_svg:not([class*='size-'])]:size-4 group-data-[variant=flush]/item:size-[30px] group-data-[variant=flush]/item:rounded-[10px] group-data-[variant=flush]/item:group-has-[[data-slot=item-description]]/item:translate-y-0 group-data-[variant=flush]/item:mt-px\",\n image: \"size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover\"\n },\n tone: {\n neutral: \"\",\n primary: \"\",\n success: \"\",\n warning: \"\",\n severe: \"\",\n destructive: \"\",\n info: \"\"\n }\n },\n /*\n * Tone của ô icon (3.19.0, bản mẫu v4 `.al-ic`) — CÙNG cặp nền/chữ với `STATUS_TONES` (đã đo AA trên tint của\n * chính nó); chỉ có nghĩa với `variant=\"icon\"`. Ô chứa được icon HOẶC chữ ngắn (một con số).\n */\n compoundVariants: [\n { variant: \"icon\", tone: \"neutral\", class: \"bg-muted\" },\n {\n variant: \"icon\",\n tone: \"primary\",\n class: \"border-transparent bg-primary/20 text-brand-600 dark:text-brand-100\"\n },\n { variant: \"icon\", tone: \"success\", class: \"border-transparent bg-success/15 text-success-ink\" },\n { variant: \"icon\", tone: \"warning\", class: \"border-transparent bg-warning/20 text-warning-ink\" },\n { variant: \"icon\", tone: \"severe\", class: \"border-transparent bg-severe/15 text-severe-ink\" },\n { variant: \"icon\", tone: \"destructive\", class: \"border-transparent bg-destructive/15 text-destructive-ink\" },\n { variant: \"icon\", tone: \"info\", class: \"border-transparent bg-info/15 text-info-ink\" }\n ],\n defaultVariants: {\n variant: \"default\",\n tone: \"neutral\"\n }\n }\n);\n\nexport type ItemMediaTone = \"neutral\" | \"primary\" | \"success\" | \"warning\" | \"severe\" | \"destructive\" | \"info\";\n\nexport interface ItemMediaProps extends React.ComponentProps<\"div\">, VariantProps<typeof itemMediaVariants> {}\nexport type ItemContentProps = React.ComponentProps<\"div\">;\nexport type ItemTitleProps = React.ComponentProps<\"div\">;\nexport type ItemDescriptionProps = React.ComponentProps<\"p\">;\nexport type ItemActionsProps = React.ComponentProps<\"div\">;\nexport type ItemHeaderProps = React.ComponentProps<\"div\">;\nexport type ItemFooterProps = React.ComponentProps<\"div\">;\n\nfunction ItemMedia({ className, variant = \"default\", tone = \"neutral\", ...props }: ItemMediaProps) {\n return (\n <div\n data-slot=\"item-media\"\n data-variant={variant}\n data-tone={variant === \"icon\" ? tone : undefined}\n className={cn(itemMediaVariants({ variant, tone }), className)}\n {...props}\n />\n );\n}\n\nfunction ItemContent({ className, ...props }: ItemContentProps) {\n return (\n <div\n data-slot=\"item-content\"\n className={cn(\n \"flex flex-1 flex-col gap-1 group-data-[variant=flush]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ItemTitle({ className, ...props }: ItemTitleProps) {\n return (\n <div\n data-slot=\"item-title\"\n className={cn(\n \"flex w-fit items-center gap-2 text-sm leading-snug font-medium\",\n \"group-data-[variant=flush]/item:text-[13px] group-data-[variant=flush]/item:font-[570] group-data-[variant=flush]/item:leading-[1.4]\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ItemDescription({ className, ...props }: ItemDescriptionProps) {\n return (\n <p\n data-slot=\"item-description\"\n className={cn(\n \"text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance\",\n \"group-data-[variant=flush]/item:text-[11.5px]\",\n \"[&>a:hover]:text-link-ink-hover [&>a]:underline [&>a]:underline-offset-4\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ItemActions({ className, ...props }: ItemActionsProps) {\n return (\n <div\n data-slot=\"item-actions\"\n className={cn(\n \"flex items-center gap-2\",\n \"group-data-[variant=flush]/item:ml-auto group-data-[variant=flush]/item:pt-0.5 group-data-[variant=flush]/item:text-[11px] group-data-[variant=flush]/item:leading-normal group-data-[variant=flush]/item:tabular-nums\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction ItemHeader({ className, ...props }: ItemHeaderProps) {\n return (\n <div\n data-slot=\"item-header\"\n className={cn(\"flex basis-full items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n}\n\nfunction ItemFooter({ className, ...props }: ItemFooterProps) {\n return (\n <div\n data-slot=\"item-footer\"\n className={cn(\"flex basis-full items-center justify-between gap-2\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Item,\n ItemActions,\n ItemContent,\n ItemDescription,\n ItemFooter,\n ItemGroup,\n ItemHeader,\n ItemMedia,\n ItemSeparator,\n ItemTitle,\n itemMediaVariants,\n it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AAoB;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,sDAAsD,SAAS;AAAA,MAC5E,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,MAAM,GAAoB;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,sDAAsD,SAAS;AAAA,MAC5E,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -101,10 +101,32 @@ declare const progressTrackVariants: (props?: ({
|
|
|
101
101
|
declare const progressBarVariants: (props?: ({
|
|
102
102
|
tone?: "default" | "destructive" | "warning" | "success" | null | undefined;
|
|
103
103
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
104
|
+
declare const progressSizeVariants: (props?: ({
|
|
105
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
106
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
107
|
+
declare const progressFillVariants: (props?: ({
|
|
108
|
+
fill?: "neutral" | "scale-0" | "scale-1" | "scale-2" | "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | null | undefined;
|
|
109
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
104
110
|
/** Tông của thanh — xem chú thích ở trên về việc vì sao `warning` phải kèm vạch chéo. */
|
|
105
111
|
type ProgressTone = NonNullable<VariantProps<typeof progressBarVariants>["tone"]>;
|
|
112
|
+
type ProgressSize = "sm" | "default" | "lg";
|
|
113
|
+
type ProgressLevel = 0 | 1 | 2;
|
|
114
|
+
type ProgressColor = "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | "neutral";
|
|
115
|
+
interface ProgressMarker {
|
|
116
|
+
/** Vị trí, cùng đơn vị với `value` (0…`max`). */
|
|
117
|
+
at: number;
|
|
118
|
+
label?: React.ReactNode;
|
|
119
|
+
/** Dòng phụ dưới nhãn. */
|
|
120
|
+
sub?: React.ReactNode;
|
|
121
|
+
/** Đã chạm mốc — nhãn tô bằng bậc chữ thương hiệu. */
|
|
122
|
+
reached?: boolean;
|
|
123
|
+
}
|
|
106
124
|
interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Root>, VariantProps<typeof progressBarVariants> {
|
|
125
|
+
size?: ProgressSize;
|
|
126
|
+
level?: ProgressLevel;
|
|
127
|
+
color?: ProgressColor;
|
|
128
|
+
markers?: readonly ProgressMarker[];
|
|
107
129
|
}
|
|
108
|
-
declare function Progress({ className, value, max, tone, ...props }: ProgressProps): React.JSX.Element;
|
|
130
|
+
declare function Progress({ className, value, max, tone, size, level, color, markers, ...props }: ProgressProps): React.JSX.Element;
|
|
109
131
|
|
|
110
|
-
export { Progress, type ProgressProps, type ProgressTone, progressBarVariants, progressTrackVariants };
|
|
132
|
+
export { Progress, type ProgressColor, type ProgressLevel, type ProgressMarker, type ProgressProps, type ProgressSize, type ProgressTone, progressBarVariants, progressFillVariants, progressSizeVariants, progressTrackVariants };
|