@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,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { cn } from "../../lib/cn.js";
|
|
@@ -26,21 +26,60 @@ const progressBarVariants = cva("h-full w-full flex-1 transition-transform durat
|
|
|
26
26
|
},
|
|
27
27
|
defaultVariants: { tone: "default" }
|
|
28
28
|
});
|
|
29
|
+
const progressSizeVariants = cva("", {
|
|
30
|
+
variants: {
|
|
31
|
+
size: {
|
|
32
|
+
sm: "h-1.5",
|
|
33
|
+
default: "h-2",
|
|
34
|
+
lg: "h-4"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: { size: "default" }
|
|
38
|
+
});
|
|
39
|
+
const progressFillVariants = cva("h-full w-full flex-1 transition-transform duration-150 ease-out", {
|
|
40
|
+
variants: {
|
|
41
|
+
fill: {
|
|
42
|
+
"scale-0": "bg-scale-0",
|
|
43
|
+
"scale-1": "bg-scale-1",
|
|
44
|
+
"scale-2": "bg-scale-2",
|
|
45
|
+
"chart-1": "bg-chart-1",
|
|
46
|
+
"chart-2": "bg-chart-2",
|
|
47
|
+
"chart-3": "bg-chart-3",
|
|
48
|
+
"chart-4": "bg-chart-4",
|
|
49
|
+
"chart-5": "bg-chart-5",
|
|
50
|
+
neutral: "bg-muted-foreground"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
29
54
|
const DEFAULT_MAX = 100;
|
|
30
55
|
function clampValue(value, max) {
|
|
31
56
|
if (typeof value !== "number" || !Number.isFinite(value)) return value;
|
|
32
57
|
return Math.min(Math.max(value, 0), max);
|
|
33
58
|
}
|
|
34
|
-
|
|
59
|
+
const LEVEL_FILL = { 0: "scale-0", 1: "scale-1", 2: "scale-2" };
|
|
60
|
+
function Progress({
|
|
61
|
+
className,
|
|
62
|
+
value,
|
|
63
|
+
max,
|
|
64
|
+
tone = "default",
|
|
65
|
+
size = "default",
|
|
66
|
+
level,
|
|
67
|
+
color,
|
|
68
|
+
markers,
|
|
69
|
+
...props
|
|
70
|
+
}) {
|
|
35
71
|
const validMax = typeof max === "number" && max > 0 ? max : DEFAULT_MAX;
|
|
36
72
|
const clamped = clampValue(value, validMax);
|
|
37
73
|
const percent = typeof clamped === "number" && Number.isFinite(clamped) ? clamped / validMax * 100 : 0;
|
|
38
|
-
|
|
74
|
+
const fill = level !== void 0 ? LEVEL_FILL[level] : color;
|
|
75
|
+
const root = /* @__PURE__ */ jsx(
|
|
39
76
|
ProgressPrimitive.Root,
|
|
40
77
|
{
|
|
41
78
|
"data-slot": "progress",
|
|
42
|
-
"data-tone": tone,
|
|
43
|
-
|
|
79
|
+
"data-tone": fill ? void 0 : tone,
|
|
80
|
+
"data-level": level,
|
|
81
|
+
"data-color": color,
|
|
82
|
+
className: cn(progressTrackVariants({ tone }), fill && "bg-muted", progressSizeVariants({ size }), className),
|
|
44
83
|
value: clamped,
|
|
45
84
|
max,
|
|
46
85
|
...props,
|
|
@@ -48,16 +87,52 @@ function Progress({ className, value, max, tone = "default", ...props }) {
|
|
|
48
87
|
ProgressPrimitive.Indicator,
|
|
49
88
|
{
|
|
50
89
|
"data-slot": "progress-indicator",
|
|
51
|
-
className: progressBarVariants({ tone }),
|
|
90
|
+
className: fill ? progressFillVariants({ fill }) : progressBarVariants({ tone }),
|
|
52
91
|
style: { transform: `translateX(-${100 - percent}%)` }
|
|
53
92
|
}
|
|
54
93
|
)
|
|
55
94
|
}
|
|
56
95
|
);
|
|
96
|
+
if (!markers?.length) return root;
|
|
97
|
+
const at = (m) => `${Math.min(Math.max(m.at, 0), validMax) / validMax * 100}%`;
|
|
98
|
+
const labelled = markers.some((m) => m.label !== void 0 || m.sub !== void 0);
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "progress-markers", className: "w-full", children: [
|
|
100
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
101
|
+
root,
|
|
102
|
+
markers.map((m, i) => /* @__PURE__ */ jsx(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
"data-slot": "progress-marker",
|
|
107
|
+
className: "pointer-events-none absolute -top-0.75 -bottom-0.75 w-0.5 -translate-x-1/2 rounded-full bg-foreground opacity-55",
|
|
108
|
+
style: { left: at(m) }
|
|
109
|
+
},
|
|
110
|
+
`${i}-${m.at}`
|
|
111
|
+
))
|
|
112
|
+
] }),
|
|
113
|
+
labelled ? /* @__PURE__ */ jsx("div", { className: "relative mt-1.75 h-8.5", children: markers.map((m, i) => /* @__PURE__ */ jsxs(
|
|
114
|
+
"span",
|
|
115
|
+
{
|
|
116
|
+
"data-reached": m.reached || void 0,
|
|
117
|
+
className: cn(
|
|
118
|
+
"absolute -translate-x-1/2 text-center text-[11.5px] font-[620] whitespace-nowrap tabular-nums text-muted-foreground",
|
|
119
|
+
m.reached && "text-link-ink"
|
|
120
|
+
),
|
|
121
|
+
style: { left: at(m) },
|
|
122
|
+
children: [
|
|
123
|
+
m.label,
|
|
124
|
+
m.sub !== void 0 ? /* @__PURE__ */ jsx("span", { className: "block text-[10.5px] font-[520] text-muted-foreground", children: m.sub }) : null
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
`${i}-${m.at}`
|
|
128
|
+
)) }) : null
|
|
129
|
+
] });
|
|
57
130
|
}
|
|
58
131
|
export {
|
|
59
132
|
Progress,
|
|
60
133
|
progressBarVariants,
|
|
134
|
+
progressFillVariants,
|
|
135
|
+
progressSizeVariants,
|
|
61
136
|
progressTrackVariants
|
|
62
137
|
};
|
|
63
138
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/progress.tsx"],"sourcesContent":["\"use client\";\n\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/**\n * Progress (Radix) — thanh tiến trình xác định (`value` 0…`max`, `max` mặc định 100).\n * Bỏ trống `value` để về trạng thái indeterminate của Radix (thanh đứng yên ở 0);\n * animation cho indeterminate là việc của app.\n *\n * ─ THANH VẼ THEO `value / max`, VÀ THANH VỚI `aria-*` NÓI CÙNG MỘT CON SỐ ─\n * Radix đọc `max` để dựng `aria-valuemax` và `aria-valuetext` (`round(value / max · 100)%`). Trước\n * `3.3.3` phần đã chạy lại vẽ bằng `100 - value` — bỏ qua `max` —, nên `max={30} value={24}` vẽ 24%\n * trong khi trình đọc màn hình đọc 80%: hai người nhìn cùng một control nhận hai con số.\n *\n * Nay cả hai đi từ MỘT giá trị: `value` được KẸP vào `[0, max]` rồi mới giao cho Radix (`max` không\n * phải số dương → 100, đúng luật Radix). Kẹp chứ không coi là indeterminate, vì ca vượt ngưỡng hay\n * gặp nhất là CÓ Ý: hạn mức dùng 120% phải là thanh ĐẦY, không phải thanh rỗng. Trước `3.3.3` ca đó\n * tình cờ đã đầy (`translateX(--20%)` là CSS vô hiệu) nhưng Radix coi `value` sai → không có\n * `aria-valuetext`, kèm lỗi console; nay thanh vẫn đầy VÀ trình đọc màn hình đọc \"100%\". Nói rõ là\n * đã vượt (bao nhiêu, làm gì tiếp) vẫn là việc của chữ cạnh thanh và `tone`, không của thanh.\n *\n * ─ ⛔ ĐỪNG ĐỔI TÔNG `default` SANG MÀU ĐẬM HƠN (chốt 2026-11-01) ─\n * 3.13.0 đổi thanh sang `gold-600` / rãnh `gold-100` để qua tương phản ở bảng mặc định; trên giao diện thật thanh nâu\n * sẫm nặng hơn mọi thứ quanh nó và bị trả về đây ở 3.13.1. Mức 1,73:1 (thanh ⇄ nền) / 1,55:1 (thanh ⇄ rãnh) ở bảng\n * MẶC ĐỊNH là ĐÃ CHẤP NHẬN — bỏ qua phép đo tương phản cho phần tô này. Cần rõ hơn thì chữ cạnh thanh, `tone`, hoặc\n * bảng tương phản cao (`data-contrast=\"high\"`, nơi các số đo bên dưới đạt). Xem CLAUDE.md, mục màu.\n *\n * ─ MÀU: `--primary-ink`, KHÔNG PHẢI `--primary` ─\n * Phần đã chạy là thông tin thị giác (WCAG 1.4.11, 3:1) và phải nổi trên CẢ nền trang lẫn phần\n * rãnh còn lại. `bg-primary` gold #E8B824 ở light chỉ **1,86:1** với nền trắng và **1,64:1** với\n * rãnh `bg-primary/20` — thanh 8px vàng nhạt trên nền trắng gần như không thấy. Bậc ink của\n * brand đạt cả hai phía ở cả hai theme:\n *\n * đã chạy ⇄ nền trang : 6,51:1 (light) · 12,67:1 (dark) ✓\n * đã chạy ⇄ rãnh `/20` : 4,85:1 (light) · 7,97:1 (dark) ✓\n * (tệ nhất khi rãnh nằm trên --muted: 4,54:1 · 6,52:1 ✓)\n *\n * ─ RÃNH: TINT `/20` GIỮ NGUYÊN, NHƯNG PHẢI CÓ VIỀN `--control-edge` ─\n * Bản trước chỉ có tint: rãnh ⇄ nền trang mới **1,34:1** (light) và **1,59–1,66:1** (dark), tức\n * KHÔNG nhìn thấy mốc 100% — ở `value` nhỏ không đọc được TỈ LỆ, ở `value=0` cả control biến mất.\n * Cách sửa hiển nhiên (đổi rãnh sang `bg-control-edge` như Slider/Switch) lại hỏng chỗ khác:\n * `--primary-ink` ⇄ `--control-edge` chỉ **1,70:1** (light) / **2,57:1** (dark), mà Progress\n * KHÔNG có núm nên ranh giới đã-chạy/chưa-chạy là thứ DUY NHẤT mang giá trị — mất nó là mất\n * thông tin. Với nền trang trắng không tồn tại cặp màu nào vừa ≥3:1 với nhau vừa ≥3:1 với nền\n * (chứng minh trong chú thích của `Slider`), nên hai ràng buộc phải tách ra hai lớp:\n *\n * khoanh vùng control → `border-control-edge` ⇄ nền trang : 3,83:1 (light) · 4,94:1 (dark) ✓\n * ⇄ --muted : 3,58:1 · 4,21:1 ✓\n * đọc tỉ lệ → đã chạy ⇄ rãnh `/20` : 4,85:1 · 7,97:1 ✓\n *\n * Đây đúng vai trò hợp đồng đặt cho `--control-edge` (styles.css §RANH GIỚI): \"khi nền control\n * trong suốt/nhạt thì VIỀN là thứ duy nhất khoanh vùng\".\n *\n * ─ TÔNG: BỐN GIÁ TRỊ, VÀ `warning` KHÔNG ĐƯỢC PHÉP CHỈ LÀ MỘT MÀU KHÁC ─\n * `tone` đổi CẢ phần đã chạy lẫn rãnh sang cùng một bậc ink, nên tỉ lệ đọc-được giữ nguyên cấu\n * trúc của bản mặc định. Đo trên ba bề mặt (`--background`, `--card`, `--muted`), tệ nhất mỗi cột.\n *\n * ⚠ Cột \"light\"/\"dark\" dưới đây là **bảng TƯƠNG PHẢN CAO** — đúng bảng mà cổng màu đo, và lý do\n * ghi ở đầu `scripts/a11y/tailwind.mjs`. Ở bảng mặc định (bản duyệt comitor-ds) `--primary-ink`\n * chính là `--primary` gold #E8B824, nên tông `default` chỉ được 1,73:1 với nền và 1,55:1 với\n * rãnh: đó là con số của BẢN DUYỆT, không phải lỗi của component — đổi nó là đổi bảng màu.\n *\n * tông đã chạy ⇄ nền trang đã chạy ⇄ rãnh cùng tông /20\n * default 6,09:1 (light) 10,80 (dark) 4,54:1 (light) 6,52:1 (dark) ✓\n * success 6,09:1 9,25 4,55:1 5,88:1 ✓\n * warning 6,09:1 10,52 4,54:1 6,47:1 ✓\n * destructive 6,68:1 5,82 4,85:1 4,25:1 ✓\n *\n * ⚠ NHƯNG `warning` KHÔNG phân biệt được với `default` BẰNG MÀU, và đó là số đo chứ không phải\n * cảm tính. Đo `--warning-ink` ⇄ `--primary-ink` trên cả BỐN bảng màu của gói:\n *\n * light (mặc định) #7A5800 ⇄ #E8B824 3,51:1 ✓\n * light (tương phản cao) #7A5800 ⇄ #7A5800 1,00:1 ✗ CÙNG MỘT HEX\n * dark (mặc định) #F2C94C ⇄ #F5D060 1,06:1 ✗\n * dark (tương phản cao) #FACC15 ⇄ #F5D060 1,03:1 ✗\n *\n * Ba trên bốn bảng màu cho ra hai thanh trông y hệt nhau. Đây KHÔNG sửa được ở tầng token: brand\n * của Comitor là gold, warning là yellow — cùng một sắc. Muốn tách hai bậc ink ra 3:1 thì một\n * trong hai phải rời khỏi vùng đọc-được: với nền trắng, chữ đạt 4,5:1 đòi độ chói ≤ 0,183, mà\n * cách `--gold-500` (0,111) đúng 3:1 thì phải ≤ 0,004 (gần như đen) hoặc ≥ 0,433 (quá sáng để\n * làm chữ). Hai ràng buộc không giao nhau — không có hex nào thoả cả hai.\n *\n * Nên tông `warning` nói bằng thứ KHÔNG PHẢI MÀU: `hazard-stripes` (khai ở styles.css) khoét\n * những rãnh chéo xuyên phần đã chạy để nền rãnh lộ ra. Ranh giới vạch ⇄ rãnh chính là cặp\n * \"đã chạy ⇄ rãnh\" đã đo ở bảng trên (4,54:1 light · 6,47:1 dark ✓), nên vạch KHÔNG thêm màu nào\n * và không cần đo thêm. Đây đúng là WCAG 1.4.1: tín hiệu không được chỉ nằm ở màu — bản vạch còn\n * đọc ra ở chế độ xám, chỗ mà mọi khác biệt sắc độ đều biến mất.\n *\n * ⚠ Vì vậy: KHÔNG được \"đơn giản hoá\" `warning` xuống còn mỗi `bg-warning-ink`. Bỏ vạch đi là\n * API đổi tông mà không đổi được gì ở ba trên bốn bảng màu — chỗ gọi tưởng đã cảnh báo, người\n * dùng không thấy gì. Cùng lý do đó, ĐỪNG thêm tông thứ năm nào nữa mà chưa đo lại bảng trên.\n *\n * Vạch chỉ là cách nói \"sắp chạm ngưỡng\" trên chính cái thanh; nó KHÔNG thay được một câu chữ.\n * Chỗ nào cần nói rõ ngưỡng là bao nhiêu và làm gì tiếp thì vẫn phải có `Alert`/`StatusPill` hoặc\n * một dòng `text-warning-ink` cạnh thanh.\n */\n\n/*\n * HAI `cva`, không phải hai bảng `Record`.\n *\n * Không phải chuyện phong cách: cổng màu (`scripts/check-contrast.mjs`) chỉ bóc chuỗi lớp từ ba\n * chỗ — thuộc tính `className`, `cva(base, { variants })`, và đối số TRỰC TIẾP của `cn()`. Class\n * nằm trong một `Record` rồi đi vào `cn()` qua biến là VÔ HÌNH với cổng: nó không báo lỗi, nó\n * lặng lẽ không đo — và miễn trừ của rãnh sẽ thành \"ruỗng\", đúng thứ cổng coi là nơi giấu lỗi.\n * Dạng `cva` cho cổng thấy cả base lẫn từng lá biến thể.\n */\nconst progressTrackVariants = cva(\"border-control-edge relative h-2 w-full overflow-hidden rounded-full border\", {\n variants: {\n tone: {\n default: \"bg-primary-ink/20\",\n success: \"bg-success-ink/20\",\n warning: \"bg-warning-ink/20\",\n destructive: \"bg-destructive-ink/20\"\n }\n },\n defaultVariants: { tone: \"default\" }\n});\n\nconst progressBarVariants = cva(\"h-full w-full flex-1 transition-transform duration-150 ease-out\", {\n variants: {\n tone: {\n default: \"bg-primary-ink\",\n success: \"bg-success-ink\",\n // `hazard-stripes` là PHẦN BẮT BUỘC của tông này, không phải trang trí — xem chú thích đầu file.\n warning: \"bg-warning-ink hazard-stripes\",\n destructive: \"bg-destructive-ink\"\n }\n },\n defaultVariants: { tone: \"default\" }\n});\n\n/** 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. */\nexport type ProgressTone = NonNullable<VariantProps<typeof progressBarVariants>[\"tone\"]>;\n\nexport interface ProgressProps\n extends React.ComponentProps<typeof ProgressPrimitive.Root>,\n VariantProps<typeof progressBarVariants> {}\n\n/** Mặc định của Radix — `max` không hợp lệ thì Radix cũng rơi về đúng số này cho `aria-*`. */\nconst DEFAULT_MAX = 100;\n\n/**\n * Kẹp `value` vào `[0, max]` — giá trị DUY NHẤT mà cả thanh lẫn Radix (`aria-*`) đọc (xem chú thích\n * đầu file). Không phải số hữu hạn (`null`, `undefined`, `NaN`) thì giữ nguyên: Radix coi là\n * indeterminate và thanh đứng ở 0.\n */\nfunction clampValue(value: number | null | undefined, max: number): number | null | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return value;\n return Math.min(Math.max(value, 0), max);\n}\n\nfunction Progress({ className, value, max, tone = \"default\", ...props }: ProgressProps) {\n const validMax = typeof max === \"number\" && max > 0 ? max : DEFAULT_MAX;\n const clamped = clampValue(value, validMax);\n const percent = typeof clamped === \"number\" && Number.isFinite(clamped) ? (clamped / validMax) * 100 : 0;\n\n return (\n <ProgressPrimitive.Root\n data-slot=\"progress\"\n data-tone={tone}\n className={cn(progressTrackVariants({ tone }), className)}\n value={clamped}\n max={max}\n {...props}\n >\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className={progressBarVariants({ tone })}\n style={{ transform: `translateX(-${100 - percent}%)` }}\n />\n </ProgressPrimitive.Root>\n );\n}\n\nexport { Progress, progressBarVariants, progressTrackVariants };\n"],"mappings":";AAwKM;AAtKN,YAAY,uBAAuB;AACnC,SAAS,WAA8B;AAEvC,SAAS,UAAU;AAwGnB,MAAM,wBAAwB,IAAI,+EAA+E;AAAA,EAC/G,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAED,MAAM,sBAAsB,IAAI,mEAAmE;AAAA,EACjG,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA;AAAA,MAET,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAUD,MAAM,cAAc;AAOpB,SAAS,WAAW,OAAkC,KAAwC;AAC5F,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,GAAG;AACzC;AAEA,SAAS,SAAS,EAAE,WAAW,OAAO,KAAK,OAAO,WAAW,GAAG,MAAM,GAAkB;AACtF,QAAM,WAAW,OAAO,QAAQ,YAAY,MAAM,IAAI,MAAM;AAC5D,QAAM,UAAU,WAAW,OAAO,QAAQ;AAC1C,QAAM,UAAU,OAAO,YAAY,YAAY,OAAO,SAAS,OAAO,IAAK,UAAU,WAAY,MAAM;AAEvG,SACE;AAAA,IAAC,kBAAkB;AAAA,IAAlB;AAAA,MACC,aAAU;AAAA,MACV,aAAW;AAAA,MACX,WAAW,GAAG,sBAAsB,EAAE,KAAK,CAAC,GAAG,SAAS;AAAA,MACxD,OAAO;AAAA,MACP;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,QAAC,kBAAkB;AAAA,QAAlB;AAAA,UACC,aAAU;AAAA,UACV,WAAW,oBAAoB,EAAE,KAAK,CAAC;AAAA,UACvC,OAAO,EAAE,WAAW,eAAe,MAAM,OAAO,KAAK;AAAA;AAAA,MACvD;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/progress.tsx"],"sourcesContent":["\"use client\";\n\nimport * as ProgressPrimitive from \"@radix-ui/react-progress\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/**\n * Progress (Radix) — thanh tiến trình xác định (`value` 0…`max`, `max` mặc định 100).\n * Bỏ trống `value` để về trạng thái indeterminate của Radix (thanh đứng yên ở 0);\n * animation cho indeterminate là việc của app.\n *\n * ─ THANH VẼ THEO `value / max`, VÀ THANH VỚI `aria-*` NÓI CÙNG MỘT CON SỐ ─\n * Radix đọc `max` để dựng `aria-valuemax` và `aria-valuetext` (`round(value / max · 100)%`). Trước\n * `3.3.3` phần đã chạy lại vẽ bằng `100 - value` — bỏ qua `max` —, nên `max={30} value={24}` vẽ 24%\n * trong khi trình đọc màn hình đọc 80%: hai người nhìn cùng một control nhận hai con số.\n *\n * Nay cả hai đi từ MỘT giá trị: `value` được KẸP vào `[0, max]` rồi mới giao cho Radix (`max` không\n * phải số dương → 100, đúng luật Radix). Kẹp chứ không coi là indeterminate, vì ca vượt ngưỡng hay\n * gặp nhất là CÓ Ý: hạn mức dùng 120% phải là thanh ĐẦY, không phải thanh rỗng. Trước `3.3.3` ca đó\n * tình cờ đã đầy (`translateX(--20%)` là CSS vô hiệu) nhưng Radix coi `value` sai → không có\n * `aria-valuetext`, kèm lỗi console; nay thanh vẫn đầy VÀ trình đọc màn hình đọc \"100%\". Nói rõ là\n * đã vượt (bao nhiêu, làm gì tiếp) vẫn là việc của chữ cạnh thanh và `tone`, không của thanh.\n *\n * ─ ⛔ ĐỪNG ĐỔI TÔNG `default` SANG MÀU ĐẬM HƠN (chốt 2026-11-01) ─\n * 3.13.0 đổi thanh sang `gold-600` / rãnh `gold-100` để qua tương phản ở bảng mặc định; trên giao diện thật thanh nâu\n * sẫm nặng hơn mọi thứ quanh nó và bị trả về đây ở 3.13.1. Mức 1,73:1 (thanh ⇄ nền) / 1,55:1 (thanh ⇄ rãnh) ở bảng\n * MẶC ĐỊNH là ĐÃ CHẤP NHẬN — bỏ qua phép đo tương phản cho phần tô này. Cần rõ hơn thì chữ cạnh thanh, `tone`, hoặc\n * bảng tương phản cao (`data-contrast=\"high\"`, nơi các số đo bên dưới đạt). Xem CLAUDE.md, mục màu.\n *\n * ─ MÀU: `--primary-ink`, KHÔNG PHẢI `--primary` ─\n * Phần đã chạy là thông tin thị giác (WCAG 1.4.11, 3:1) và phải nổi trên CẢ nền trang lẫn phần\n * rãnh còn lại. `bg-primary` gold #E8B824 ở light chỉ **1,86:1** với nền trắng và **1,64:1** với\n * rãnh `bg-primary/20` — thanh 8px vàng nhạt trên nền trắng gần như không thấy. Bậc ink của\n * brand đạt cả hai phía ở cả hai theme:\n *\n * đã chạy ⇄ nền trang : 6,51:1 (light) · 12,67:1 (dark) ✓\n * đã chạy ⇄ rãnh `/20` : 4,85:1 (light) · 7,97:1 (dark) ✓\n * (tệ nhất khi rãnh nằm trên --muted: 4,54:1 · 6,52:1 ✓)\n *\n * ─ RÃNH: TINT `/20` GIỮ NGUYÊN, NHƯNG PHẢI CÓ VIỀN `--control-edge` ─\n * Bản trước chỉ có tint: rãnh ⇄ nền trang mới **1,34:1** (light) và **1,59–1,66:1** (dark), tức\n * KHÔNG nhìn thấy mốc 100% — ở `value` nhỏ không đọc được TỈ LỆ, ở `value=0` cả control biến mất.\n * Cách sửa hiển nhiên (đổi rãnh sang `bg-control-edge` như Slider/Switch) lại hỏng chỗ khác:\n * `--primary-ink` ⇄ `--control-edge` chỉ **1,70:1** (light) / **2,57:1** (dark), mà Progress\n * KHÔNG có núm nên ranh giới đã-chạy/chưa-chạy là thứ DUY NHẤT mang giá trị — mất nó là mất\n * thông tin. Với nền trang trắng không tồn tại cặp màu nào vừa ≥3:1 với nhau vừa ≥3:1 với nền\n * (chứng minh trong chú thích của `Slider`), nên hai ràng buộc phải tách ra hai lớp:\n *\n * khoanh vùng control → `border-control-edge` ⇄ nền trang : 3,83:1 (light) · 4,94:1 (dark) ✓\n * ⇄ --muted : 3,58:1 · 4,21:1 ✓\n * đọc tỉ lệ → đã chạy ⇄ rãnh `/20` : 4,85:1 · 7,97:1 ✓\n *\n * Đây đúng vai trò hợp đồng đặt cho `--control-edge` (styles.css §RANH GIỚI): \"khi nền control\n * trong suốt/nhạt thì VIỀN là thứ duy nhất khoanh vùng\".\n *\n * ─ TÔNG: BỐN GIÁ TRỊ, VÀ `warning` KHÔNG ĐƯỢC PHÉP CHỈ LÀ MỘT MÀU KHÁC ─\n * `tone` đổi CẢ phần đã chạy lẫn rãnh sang cùng một bậc ink, nên tỉ lệ đọc-được giữ nguyên cấu\n * trúc của bản mặc định. Đo trên ba bề mặt (`--background`, `--card`, `--muted`), tệ nhất mỗi cột.\n *\n * ⚠ Cột \"light\"/\"dark\" dưới đây là **bảng TƯƠNG PHẢN CAO** — đúng bảng mà cổng màu đo, và lý do\n * ghi ở đầu `scripts/a11y/tailwind.mjs`. Ở bảng mặc định (bản duyệt comitor-ds) `--primary-ink`\n * chính là `--primary` gold #E8B824, nên tông `default` chỉ được 1,73:1 với nền và 1,55:1 với\n * rãnh: đó là con số của BẢN DUYỆT, không phải lỗi của component — đổi nó là đổi bảng màu.\n *\n * tông đã chạy ⇄ nền trang đã chạy ⇄ rãnh cùng tông /20\n * default 6,09:1 (light) 10,80 (dark) 4,54:1 (light) 6,52:1 (dark) ✓\n * success 6,09:1 9,25 4,55:1 5,88:1 ✓\n * warning 6,09:1 10,52 4,54:1 6,47:1 ✓\n * destructive 6,68:1 5,82 4,85:1 4,25:1 ✓\n *\n * ⚠ NHƯNG `warning` KHÔNG phân biệt được với `default` BẰNG MÀU, và đó là số đo chứ không phải\n * cảm tính. Đo `--warning-ink` ⇄ `--primary-ink` trên cả BỐN bảng màu của gói:\n *\n * light (mặc định) #7A5800 ⇄ #E8B824 3,51:1 ✓\n * light (tương phản cao) #7A5800 ⇄ #7A5800 1,00:1 ✗ CÙNG MỘT HEX\n * dark (mặc định) #F2C94C ⇄ #F5D060 1,06:1 ✗\n * dark (tương phản cao) #FACC15 ⇄ #F5D060 1,03:1 ✗\n *\n * Ba trên bốn bảng màu cho ra hai thanh trông y hệt nhau. Đây KHÔNG sửa được ở tầng token: brand\n * của Comitor là gold, warning là yellow — cùng một sắc. Muốn tách hai bậc ink ra 3:1 thì một\n * trong hai phải rời khỏi vùng đọc-được: với nền trắng, chữ đạt 4,5:1 đòi độ chói ≤ 0,183, mà\n * cách `--gold-500` (0,111) đúng 3:1 thì phải ≤ 0,004 (gần như đen) hoặc ≥ 0,433 (quá sáng để\n * làm chữ). Hai ràng buộc không giao nhau — không có hex nào thoả cả hai.\n *\n * Nên tông `warning` nói bằng thứ KHÔNG PHẢI MÀU: `hazard-stripes` (khai ở styles.css) khoét\n * những rãnh chéo xuyên phần đã chạy để nền rãnh lộ ra. Ranh giới vạch ⇄ rãnh chính là cặp\n * \"đã chạy ⇄ rãnh\" đã đo ở bảng trên (4,54:1 light · 6,47:1 dark ✓), nên vạch KHÔNG thêm màu nào\n * và không cần đo thêm. Đây đúng là WCAG 1.4.1: tín hiệu không được chỉ nằm ở màu — bản vạch còn\n * đọc ra ở chế độ xám, chỗ mà mọi khác biệt sắc độ đều biến mất.\n *\n * ⚠ Vì vậy: KHÔNG được \"đơn giản hoá\" `warning` xuống còn mỗi `bg-warning-ink`. Bỏ vạch đi là\n * API đổi tông mà không đổi được gì ở ba trên bốn bảng màu — chỗ gọi tưởng đã cảnh báo, người\n * dùng không thấy gì. Cùng lý do đó, ĐỪNG thêm tông thứ năm nào nữa mà chưa đo lại bảng trên.\n *\n * Vạch chỉ là cách nói \"sắp chạm ngưỡng\" trên chính cái thanh; nó KHÔNG thay được một câu chữ.\n * Chỗ nào cần nói rõ ngưỡng là bao nhiêu và làm gì tiếp thì vẫn phải có `Alert`/`StatusPill` hoặc\n * một dòng `text-warning-ink` cạnh thanh.\n */\n\n/*\n * HAI `cva`, không phải hai bảng `Record`.\n *\n * Không phải chuyện phong cách: cổng màu (`scripts/check-contrast.mjs`) chỉ bóc chuỗi lớp từ ba\n * chỗ — thuộc tính `className`, `cva(base, { variants })`, và đối số TRỰC TIẾP của `cn()`. Class\n * nằm trong một `Record` rồi đi vào `cn()` qua biến là VÔ HÌNH với cổng: nó không báo lỗi, nó\n * lặng lẽ không đo — và miễn trừ của rãnh sẽ thành \"ruỗng\", đúng thứ cổng coi là nơi giấu lỗi.\n * Dạng `cva` cho cổng thấy cả base lẫn từng lá biến thể.\n */\nconst progressTrackVariants = cva(\"border-control-edge relative h-2 w-full overflow-hidden rounded-full border\", {\n variants: {\n tone: {\n default: \"bg-primary-ink/20\",\n success: \"bg-success-ink/20\",\n warning: \"bg-warning-ink/20\",\n destructive: \"bg-destructive-ink/20\"\n }\n },\n defaultVariants: { tone: \"default\" }\n});\n\nconst progressBarVariants = cva(\"h-full w-full flex-1 transition-transform duration-150 ease-out\", {\n variants: {\n tone: {\n default: \"bg-primary-ink\",\n success: \"bg-success-ink\",\n // `hazard-stripes` là PHẦN BẮT BUỘC của tông này, không phải trang trí — xem chú thích đầu file.\n warning: \"bg-warning-ink hazard-stripes\",\n destructive: \"bg-destructive-ink\"\n }\n },\n defaultVariants: { tone: \"default\" }\n});\n\n/*\n * 3.19.0 — CỠ, THANG BA BẬC, MÀU PHÂN LOẠI, MỐC.\n *\n * `size`: `sm` 6px · `default` 8px (như cũ) · `lg` 16px (thanh ngày của bản mẫu Imagtor v4 `.track`).\n *\n * `level` (0 | 1 | 2) thay tông bằng THANG MỘT SẮC `--scale-*` — mức của CÙNG một đại lượng (chưa tới mốc 1 · qua mốc\n * 1 · qua mốc 2; v4 `.fill.b0/.b1/.b2`). `color` (`chart-1`…`chart-5` | `neutral`) tô theo THỰC THỂ (đội, khách…;\n * v4 `--o1…--o6`). Cả hai đặt rãnh lên `--muted` (v4 `--track`) và vẫn giữ viền `--control-edge` khoanh vùng control\n * như mọi tông. Thứ tự ưu tiên: `level` → `color` → `tone`.\n *\n * ⚠ Ở `level`/`color`, ranh giới đã chạy ⇄ rãnh KHÔNG được bảo đảm 3:1 như bốn tông (bậc 0 là tint nhạt cố ý) — giá trị\n * phải được nói bằng chữ cạnh thanh, hoặc bằng `markers`. Đừng dùng hai prop này cho thanh mà con số chỉ nằm trên thanh.\n *\n * `markers`: vạch dọc ngay trên thanh ở `at` (cùng đơn vị với `value`, theo `max`), nhãn tuỳ chọn bên dưới (11,5px,\n * dòng phụ 10,5px); `reached` tô nhãn bằng bậc chữ thương hiệu (`--link-ink`). Vạch là `--foreground` mờ 55% — phi văn\n * bản, nằm trên rãnh/phần đã chạy. Có `markers` thì `Progress` bọc thêm MỘT `<div>` ngoài Root; `className` vẫn vào\n * Root.\n */\nconst progressSizeVariants = cva(\"\", {\n variants: {\n size: {\n sm: \"h-1.5\",\n default: \"h-2\",\n lg: \"h-4\"\n }\n },\n defaultVariants: { size: \"default\" }\n});\n\nconst progressFillVariants = cva(\"h-full w-full flex-1 transition-transform duration-150 ease-out\", {\n variants: {\n fill: {\n \"scale-0\": \"bg-scale-0\",\n \"scale-1\": \"bg-scale-1\",\n \"scale-2\": \"bg-scale-2\",\n \"chart-1\": \"bg-chart-1\",\n \"chart-2\": \"bg-chart-2\",\n \"chart-3\": \"bg-chart-3\",\n \"chart-4\": \"bg-chart-4\",\n \"chart-5\": \"bg-chart-5\",\n neutral: \"bg-muted-foreground\"\n }\n }\n});\n\n/** 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. */\nexport type ProgressTone = NonNullable<VariantProps<typeof progressBarVariants>[\"tone\"]>;\nexport type ProgressSize = \"sm\" | \"default\" | \"lg\";\nexport type ProgressLevel = 0 | 1 | 2;\nexport type ProgressColor = \"chart-1\" | \"chart-2\" | \"chart-3\" | \"chart-4\" | \"chart-5\" | \"neutral\";\n\nexport interface ProgressMarker {\n /** Vị trí, cùng đơn vị với `value` (0…`max`). */\n at: number;\n label?: React.ReactNode;\n /** Dòng phụ dưới nhãn. */\n sub?: React.ReactNode;\n /** Đã chạm mốc — nhãn tô bằng bậc chữ thương hiệu. */\n reached?: boolean;\n}\n\nexport interface ProgressProps\n extends React.ComponentProps<typeof ProgressPrimitive.Root>,\n VariantProps<typeof progressBarVariants> {\n size?: ProgressSize;\n level?: ProgressLevel;\n color?: ProgressColor;\n markers?: readonly ProgressMarker[];\n}\n\n/** Mặc định của Radix — `max` không hợp lệ thì Radix cũng rơi về đúng số này cho `aria-*`. */\nconst DEFAULT_MAX = 100;\n\n/**\n * Kẹp `value` vào `[0, max]` — giá trị DUY NHẤT mà cả thanh lẫn Radix (`aria-*`) đọc (xem chú thích\n * đầu file). Không phải số hữu hạn (`null`, `undefined`, `NaN`) thì giữ nguyên: Radix coi là\n * indeterminate và thanh đứng ở 0.\n */\nfunction clampValue(value: number | null | undefined, max: number): number | null | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return value;\n return Math.min(Math.max(value, 0), max);\n}\n\nconst LEVEL_FILL = { 0: \"scale-0\", 1: \"scale-1\", 2: \"scale-2\" } as const;\n\nfunction Progress({\n className,\n value,\n max,\n tone = \"default\",\n size = \"default\",\n level,\n color,\n markers,\n ...props\n}: ProgressProps) {\n const validMax = typeof max === \"number\" && max > 0 ? max : DEFAULT_MAX;\n const clamped = clampValue(value, validMax);\n const percent = typeof clamped === \"number\" && Number.isFinite(clamped) ? (clamped / validMax) * 100 : 0;\n const fill = level !== undefined ? LEVEL_FILL[level] : color;\n\n const root = (\n <ProgressPrimitive.Root\n data-slot=\"progress\"\n data-tone={fill ? undefined : tone}\n data-level={level}\n data-color={color}\n className={cn(progressTrackVariants({ tone }), fill && \"bg-muted\", progressSizeVariants({ size }), className)}\n value={clamped}\n max={max}\n {...props}\n >\n <ProgressPrimitive.Indicator\n data-slot=\"progress-indicator\"\n className={fill ? progressFillVariants({ fill }) : progressBarVariants({ tone })}\n style={{ transform: `translateX(-${100 - percent}%)` }}\n />\n </ProgressPrimitive.Root>\n );\n\n if (!markers?.length) return root;\n const at = (m: ProgressMarker) => `${(Math.min(Math.max(m.at, 0), validMax) / validMax) * 100}%`;\n const labelled = markers.some((m) => m.label !== undefined || m.sub !== undefined);\n return (\n <div data-slot=\"progress-markers\" className=\"w-full\">\n <div className=\"relative\">\n {root}\n {markers.map((m, i) => (\n <span\n // biome-ignore lint/suspicious/noArrayIndexKey: hai mốc có thể trùng `at`; vị trí trong mảng là danh tính\n key={`${i}-${m.at}`}\n aria-hidden=\"true\"\n data-slot=\"progress-marker\"\n className=\"pointer-events-none absolute -top-0.75 -bottom-0.75 w-0.5 -translate-x-1/2 rounded-full bg-foreground opacity-55\"\n style={{ left: at(m) }}\n />\n ))}\n </div>\n {labelled ? (\n <div className=\"relative mt-1.75 h-8.5\">\n {markers.map((m, i) => (\n <span\n // biome-ignore lint/suspicious/noArrayIndexKey: hai mốc có thể trùng `at`; vị trí trong mảng là danh tính\n key={`${i}-${m.at}`}\n data-reached={m.reached || undefined}\n className={cn(\n \"absolute -translate-x-1/2 text-center text-[11.5px] font-[620] whitespace-nowrap tabular-nums text-muted-foreground\",\n m.reached && \"text-link-ink\"\n )}\n style={{ left: at(m) }}\n >\n {m.label}\n {m.sub !== undefined ? (\n <span className=\"block text-[10.5px] font-[520] text-muted-foreground\">{m.sub}</span>\n ) : null}\n </span>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport { Progress, progressBarVariants, progressFillVariants, progressSizeVariants, progressTrackVariants };\n"],"mappings":";AAsPM,cAaA,YAbA;AApPN,YAAY,uBAAuB;AACnC,SAAS,WAA8B;AAEvC,SAAS,UAAU;AAwGnB,MAAM,wBAAwB,IAAI,+EAA+E;AAAA,EAC/G,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAED,MAAM,sBAAsB,IAAI,mEAAmE;AAAA,EACjG,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS;AAAA;AAAA,MAET,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAoBD,MAAM,uBAAuB,IAAI,IAAI;AAAA,EACnC,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,IAAI;AAAA,IACN;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAED,MAAM,uBAAuB,IAAI,mEAAmE;AAAA,EAClG,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX,SAAS;AAAA,IACX;AAAA,EACF;AACF,CAAC;AA4BD,MAAM,cAAc;AAOpB,SAAS,WAAW,OAAkC,KAAwC;AAC5F,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,SAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,GAAG;AACzC;AAEA,MAAM,aAAa,EAAE,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU;AAE9D,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,WAAW,OAAO,QAAQ,YAAY,MAAM,IAAI,MAAM;AAC5D,QAAM,UAAU,WAAW,OAAO,QAAQ;AAC1C,QAAM,UAAU,OAAO,YAAY,YAAY,OAAO,SAAS,OAAO,IAAK,UAAU,WAAY,MAAM;AACvG,QAAM,OAAO,UAAU,SAAY,WAAW,KAAK,IAAI;AAEvD,QAAM,OACJ;AAAA,IAAC,kBAAkB;AAAA,IAAlB;AAAA,MACC,aAAU;AAAA,MACV,aAAW,OAAO,SAAY;AAAA,MAC9B,cAAY;AAAA,MACZ,cAAY;AAAA,MACZ,WAAW,GAAG,sBAAsB,EAAE,KAAK,CAAC,GAAG,QAAQ,YAAY,qBAAqB,EAAE,KAAK,CAAC,GAAG,SAAS;AAAA,MAC5G,OAAO;AAAA,MACP;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,QAAC,kBAAkB;AAAA,QAAlB;AAAA,UACC,aAAU;AAAA,UACV,WAAW,OAAO,qBAAqB,EAAE,KAAK,CAAC,IAAI,oBAAoB,EAAE,KAAK,CAAC;AAAA,UAC/E,OAAO,EAAE,WAAW,eAAe,MAAM,OAAO,KAAK;AAAA;AAAA,MACvD;AAAA;AAAA,EACF;AAGF,MAAI,CAAC,SAAS,OAAQ,QAAO;AAC7B,QAAM,KAAK,CAAC,MAAsB,GAAI,KAAK,IAAI,KAAK,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,IAAI,WAAY,GAAG;AAC7F,QAAM,WAAW,QAAQ,KAAK,CAAC,MAAM,EAAE,UAAU,UAAa,EAAE,QAAQ,MAAS;AACjF,SACE,qBAAC,SAAI,aAAU,oBAAmB,WAAU,UAC1C;AAAA,yBAAC,SAAI,WAAU,YACZ;AAAA;AAAA,MACA,QAAQ,IAAI,CAAC,GAAG,MACf;AAAA,QAAC;AAAA;AAAA,UAGC,eAAY;AAAA,UACZ,aAAU;AAAA,UACV,WAAU;AAAA,UACV,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE;AAAA;AAAA,QAJhB,GAAG,CAAC,IAAI,EAAE,EAAE;AAAA,MAKnB,CACD;AAAA,OACH;AAAA,IACC,WACC,oBAAC,SAAI,WAAU,0BACZ,kBAAQ,IAAI,CAAC,GAAG,MACf;AAAA,MAAC;AAAA;AAAA,QAGC,gBAAc,EAAE,WAAW;AAAA,QAC3B,WAAW;AAAA,UACT;AAAA,UACA,EAAE,WAAW;AAAA,QACf;AAAA,QACA,OAAO,EAAE,MAAM,GAAG,CAAC,EAAE;AAAA,QAEpB;AAAA,YAAE;AAAA,UACF,EAAE,QAAQ,SACT,oBAAC,UAAK,WAAU,wDAAwD,YAAE,KAAI,IAC5E;AAAA;AAAA;AAAA,MAXC,GAAG,CAAC,IAAI,EAAE,EAAE;AAAA,IAYnB,CACD,GACH,IACE;AAAA,KACN;AAEJ;","names":[]}
|
|
@@ -10,15 +10,29 @@ type TableProps = React.ComponentProps<"table"> & {
|
|
|
10
10
|
variant?: "default" | "striped";
|
|
11
11
|
/** Alias tiện dụng của `variant="striped"`. */
|
|
12
12
|
striped?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Mật độ (3.19.0). `"compact"` = bảng nằm trong thân thẻ: tiêu đề 10,5px không nền, KHÔNG khung viền (trừ khi truyền
|
|
15
|
+
* `bordered`); cỡ chữ, đệm và chiều cao dòng theo token `--table-compact-*` (bộ green: `.dt` của bản mẫu Imagtor v4 —
|
|
16
|
+
* chữ 13px, dòng 46px). Các phần con đọc qua `data-density` của `<table>`.
|
|
17
|
+
*/
|
|
18
|
+
density?: "default" | "compact";
|
|
19
|
+
/** Khung viền bo góc quanh bảng — mặc định có, trừ `density="compact"` (bảng nằm thẳng trong thân thẻ). */
|
|
20
|
+
bordered?: boolean;
|
|
13
21
|
};
|
|
14
22
|
type TableHeaderProps = React.ComponentProps<"thead">;
|
|
15
23
|
type TableBodyProps = React.ComponentProps<"tbody">;
|
|
16
24
|
type TableFooterProps = React.ComponentProps<"tfoot">;
|
|
17
25
|
type TableRowProps = React.ComponentProps<"tr">;
|
|
18
|
-
type TableHeadProps = React.ComponentProps<"th"
|
|
19
|
-
|
|
26
|
+
type TableHeadProps = React.ComponentProps<"th"> & {
|
|
27
|
+
/** Cột số (3.19.0): canh phải + chữ số đều bề ngang. */
|
|
28
|
+
numeric?: boolean;
|
|
29
|
+
};
|
|
30
|
+
type TableCellProps = React.ComponentProps<"td"> & {
|
|
31
|
+
/** Ô số (3.19.0): canh phải + chữ số đều bề ngang — đi cùng `TableHead numeric`. */
|
|
32
|
+
numeric?: boolean;
|
|
33
|
+
};
|
|
20
34
|
type TableCaptionProps = React.ComponentProps<"caption">;
|
|
21
|
-
declare function Table({ className, variant, striped, ...props }: TableProps): React.JSX.Element;
|
|
35
|
+
declare function Table({ className, variant, striped, density, bordered, ...props }: TableProps): React.JSX.Element;
|
|
22
36
|
declare function TableHeader({ className, ...props }: TableHeaderProps): React.JSX.Element;
|
|
23
37
|
declare function TableBody({ className, ...props }: TableBodyProps): React.JSX.Element;
|
|
24
38
|
declare function TableFooter({ className, ...props }: TableFooterProps): React.JSX.Element;
|
|
@@ -33,8 +47,8 @@ declare function TableFooter({ className, ...props }: TableFooterProps): React.J
|
|
|
33
47
|
* của `DataTable` (`bg-inherit`) cũng nhận nền đặc này, không trong mờ.
|
|
34
48
|
*/
|
|
35
49
|
declare function TableRow({ className, ...props }: TableRowProps): React.JSX.Element;
|
|
36
|
-
declare function TableHead({ className, ...props }: TableHeadProps): React.JSX.Element;
|
|
37
|
-
declare function TableCell({ className, ...props }: TableCellProps): React.JSX.Element;
|
|
50
|
+
declare function TableHead({ className, numeric, ...props }: TableHeadProps): React.JSX.Element;
|
|
51
|
+
declare function TableCell({ className, numeric, ...props }: TableCellProps): React.JSX.Element;
|
|
38
52
|
declare function TableCaption({ className, ...props }: TableCaptionProps): React.JSX.Element;
|
|
39
53
|
|
|
40
54
|
export { Table, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, TableRow, type TableRowProps };
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "../../lib/cn.js";
|
|
4
|
-
function Table({ className, variant = "default", striped, ...props }) {
|
|
4
|
+
function Table({ className, variant = "default", striped, density = "default", bordered, ...props }) {
|
|
5
|
+
const framed = bordered ?? density !== "compact";
|
|
5
6
|
const isStriped = striped || variant === "striped";
|
|
6
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
-
"
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"div",
|
|
8
9
|
{
|
|
9
|
-
"data-slot": "table",
|
|
10
|
-
className: cn(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
"data-slot": "table-container",
|
|
11
|
+
className: cn("w-full overflow-auto", framed && "rounded-xl border border-border"),
|
|
12
|
+
children: /* @__PURE__ */ jsx(
|
|
13
|
+
"table",
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "table",
|
|
16
|
+
"data-density": density,
|
|
17
|
+
className: cn(
|
|
18
|
+
"group/table w-full caption-bottom text-sm data-[density=compact]:text-(length:--table-compact-text)",
|
|
19
|
+
isStriped && "[&_tbody_tr:nth-child(even)]:bg-table-row-stripe [&_tbody_tr:nth-child(even):hover]:bg-table-row-hover",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
...props
|
|
23
|
+
}
|
|
24
|
+
)
|
|
16
25
|
}
|
|
17
|
-
)
|
|
26
|
+
);
|
|
18
27
|
}
|
|
19
28
|
function TableHeader({ className, ...props }) {
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"thead",
|
|
31
|
+
{
|
|
32
|
+
"data-slot": "table-header",
|
|
33
|
+
className: cn("bg-muted/60 border-b border-border group-data-[density=compact]/table:bg-transparent", className),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
21
37
|
}
|
|
22
38
|
function TableBody({ className, ...props }) {
|
|
23
39
|
return /* @__PURE__ */ jsx("tbody", { "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props });
|
|
@@ -45,26 +61,30 @@ function TableRow({ className, ...props }) {
|
|
|
45
61
|
}
|
|
46
62
|
);
|
|
47
63
|
}
|
|
48
|
-
function TableHead({ className, ...props }) {
|
|
64
|
+
function TableHead({ className, numeric = false, ...props }) {
|
|
49
65
|
return /* @__PURE__ */ jsx(
|
|
50
66
|
"th",
|
|
51
67
|
{
|
|
52
68
|
"data-slot": "table-head",
|
|
53
69
|
className: cn(
|
|
54
70
|
"h-(--table-head-h) px-4 text-left align-middle text-xs font-bold tracking-[0.08em] uppercase text-muted-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
71
|
+
"group-data-[density=compact]/table:h-auto group-data-[density=compact]/table:px-2.25 group-data-[density=compact]/table:py-(--table-compact-head-py) group-data-[density=compact]/table:text-[10.5px] group-data-[density=compact]/table:leading-normal group-data-[density=compact]/table:font-[650] group-data-[density=compact]/table:tracking-[0.06em]",
|
|
72
|
+
numeric && "text-right tabular-nums",
|
|
55
73
|
className
|
|
56
74
|
),
|
|
57
75
|
...props
|
|
58
76
|
}
|
|
59
77
|
);
|
|
60
78
|
}
|
|
61
|
-
function TableCell({ className, ...props }) {
|
|
79
|
+
function TableCell({ className, numeric = false, ...props }) {
|
|
62
80
|
return /* @__PURE__ */ jsx(
|
|
63
81
|
"td",
|
|
64
82
|
{
|
|
65
83
|
"data-slot": "table-cell",
|
|
66
84
|
className: cn(
|
|
67
85
|
"px-4 py-(--row-py) align-middle text-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
86
|
+
"group-data-[density=compact]/table:h-(--table-compact-row-h) group-data-[density=compact]/table:px-2.25 group-data-[density=compact]/table:py-(--table-compact-cell-py) group-data-[density=compact]/table:tabular-nums",
|
|
87
|
+
numeric && "text-right tabular-nums",
|
|
68
88
|
className
|
|
69
89
|
),
|
|
70
90
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ui/table.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/**\n * Table — bảng cơ bản, đã bọc sẵn khung cuộn ngang + viền bo `rounded-xl`.\n * `variant=\"striped\"` (hoặc `striped`) tô nền xen kẽ cho hàng chẵn.\n *\n * Đây là primitive tĩnh: sort / chọn dòng / ghim cột nằm ở composite `DataTable`.\n */\n\nexport type TableProps = React.ComponentProps<\"table\"> & {\n variant?: \"default\" | \"striped\";\n /** Alias tiện dụng của `variant=\"striped\"`. */\n striped?: boolean;\n};\nexport type TableHeaderProps = React.ComponentProps<\"thead\">;\nexport type TableBodyProps = React.ComponentProps<\"tbody\">;\nexport type TableFooterProps = React.ComponentProps<\"tfoot\">;\nexport type TableRowProps = React.ComponentProps<\"tr\">;\nexport type TableHeadProps = React.ComponentProps<\"th\"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/table.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport { cn } from \"../../lib/cn.js\";\n\n/**\n * Table — bảng cơ bản, đã bọc sẵn khung cuộn ngang + viền bo `rounded-xl`.\n * `variant=\"striped\"` (hoặc `striped`) tô nền xen kẽ cho hàng chẵn.\n *\n * Đây là primitive tĩnh: sort / chọn dòng / ghim cột nằm ở composite `DataTable`.\n */\n\nexport type TableProps = React.ComponentProps<\"table\"> & {\n variant?: \"default\" | \"striped\";\n /** Alias tiện dụng của `variant=\"striped\"`. */\n striped?: boolean;\n /**\n * Mật độ (3.19.0). `\"compact\"` = bảng nằm trong thân thẻ: tiêu đề 10,5px không nền, KHÔNG khung viền (trừ khi truyền\n * `bordered`); cỡ chữ, đệm và chiều cao dòng theo token `--table-compact-*` (bộ green: `.dt` của bản mẫu Imagtor v4 —\n * chữ 13px, dòng 46px). Các phần con đọc qua `data-density` của `<table>`.\n */\n density?: \"default\" | \"compact\";\n /** Khung viền bo góc quanh bảng — mặc định có, trừ `density=\"compact\"` (bảng nằm thẳng trong thân thẻ). */\n bordered?: boolean;\n};\nexport type TableHeaderProps = React.ComponentProps<\"thead\">;\nexport type TableBodyProps = React.ComponentProps<\"tbody\">;\nexport type TableFooterProps = React.ComponentProps<\"tfoot\">;\nexport type TableRowProps = React.ComponentProps<\"tr\">;\nexport type TableHeadProps = React.ComponentProps<\"th\"> & {\n /** Cột số (3.19.0): canh phải + chữ số đều bề ngang. */\n numeric?: boolean;\n};\nexport type TableCellProps = React.ComponentProps<\"td\"> & {\n /** Ô số (3.19.0): canh phải + chữ số đều bề ngang — đi cùng `TableHead numeric`. */\n numeric?: boolean;\n};\nexport type TableCaptionProps = React.ComponentProps<\"caption\">;\n\nfunction Table({ className, variant = \"default\", striped, density = \"default\", bordered, ...props }: TableProps) {\n const framed = bordered ?? density !== \"compact\";\n const isStriped = striped || variant === \"striped\";\n return (\n <div\n data-slot=\"table-container\"\n className={cn(\"w-full overflow-auto\", framed && \"rounded-xl border border-border\")}\n >\n <table\n data-slot=\"table\"\n data-density={density}\n className={cn(\n \"group/table w-full caption-bottom text-sm data-[density=compact]:text-(length:--table-compact-text)\",\n isStriped &&\n \"[&_tbody_tr:nth-child(even)]:bg-table-row-stripe [&_tbody_tr:nth-child(even):hover]:bg-table-row-hover\",\n className\n )}\n {...props}\n />\n </div>\n );\n}\n\nfunction TableHeader({ className, ...props }: TableHeaderProps) {\n return (\n <thead\n data-slot=\"table-header\"\n className={cn(\"bg-muted/60 border-b border-border group-data-[density=compact]/table:bg-transparent\", className)}\n {...props}\n />\n );\n}\n\nfunction TableBody({ className, ...props }: TableBodyProps) {\n return <tbody data-slot=\"table-body\" className={cn(\"[&_tr:last-child]:border-0\", className)} {...props} />;\n}\n\nfunction TableFooter({ className, ...props }: TableFooterProps) {\n return (\n <tfoot\n data-slot=\"table-footer\"\n className={cn(\"bg-muted/40 border-t border-border font-medium [&>tr]:last:border-b-0\", className)}\n {...props}\n />\n );\n}\n\n/**\n * TableRow — dòng bảng. Trạng thái ĐÃ CHỌN (`data-state=\"selected\"`) là nền `--accent` — đúng bậc tint\n * TRẠNG THÁI mà DataGrid tô cho dòng đã chọn (`data-grid-row.tsx`), để hai bảng của gói nói cùng một thứ.\n * Không có vạch viền: dấu mang thông tin là ô checkbox đã tích (DataTable `selectable`), tint chỉ để nhận\n * ra dòng — 1,07:1 với `--card`, cố ý nhạt để chữ trong dòng vẫn đọc tốt.\n *\n * Nền tô trên TỪNG Ô (`*:`) chứ không trên `<tr>`: sọc của `striped` khai ở cấp `<table>` với độ đặc tả\n * (0,2,2) và thắng mọi class trên `<tr>`, nên tô ở `<tr>` thì dòng chọn ở hàng CHẴN không hiện gì. Ô ghim\n * của `DataTable` (`bg-inherit`) cũng nhận nền đặc này, không trong mờ.\n */\nfunction TableRow({ className, ...props }: TableRowProps) {\n return (\n <tr\n data-slot=\"table-row\"\n className={cn(\n \"border-b border-border transition-colors hover:bg-table-row-hover data-[state=selected]:*:bg-accent\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction TableHead({ className, numeric = false, ...props }: TableHeadProps) {\n return (\n <th\n data-slot=\"table-head\"\n className={cn(\n \"h-(--table-head-h) px-4 text-left align-middle text-xs font-bold tracking-[0.08em] uppercase text-muted-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n \"group-data-[density=compact]/table:h-auto group-data-[density=compact]/table:px-2.25 group-data-[density=compact]/table:py-(--table-compact-head-py) group-data-[density=compact]/table:text-[10.5px] group-data-[density=compact]/table:leading-normal group-data-[density=compact]/table:font-[650] group-data-[density=compact]/table:tracking-[0.06em]\",\n numeric && \"text-right tabular-nums\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction TableCell({ className, numeric = false, ...props }: TableCellProps) {\n return (\n <td\n data-slot=\"table-cell\"\n className={cn(\n \"px-4 py-(--row-py) align-middle text-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n \"group-data-[density=compact]/table:h-(--table-compact-row-h) group-data-[density=compact]/table:px-2.25 group-data-[density=compact]/table:py-(--table-compact-cell-py) group-data-[density=compact]/table:tabular-nums\",\n numeric && \"text-right tabular-nums\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction TableCaption({ className, ...props }: TableCaptionProps) {\n return (\n <caption data-slot=\"table-caption\" className={cn(\"mt-4 text-sm text-muted-foreground\", className)} {...props} />\n );\n}\n\nexport { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };\n"],"mappings":";AA+CM;AA5CN,SAAS,UAAU;AAoCnB,SAAS,MAAM,EAAE,WAAW,UAAU,WAAW,SAAS,UAAU,WAAW,UAAU,GAAG,MAAM,GAAe;AAC/G,QAAM,SAAS,YAAY,YAAY;AACvC,QAAM,YAAY,WAAW,YAAY;AACzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,wBAAwB,UAAU,iCAAiC;AAAA,MAEjF;AAAA,QAAC;AAAA;AAAA,UACC,aAAU;AAAA,UACV,gBAAc;AAAA,UACd,WAAW;AAAA,YACT;AAAA,YACA,aACE;AAAA,YACF;AAAA,UACF;AAAA,UACC,GAAG;AAAA;AAAA,MACN;AAAA;AAAA,EACF;AAEJ;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,MAAM,GAAqB;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,wFAAwF,SAAS;AAAA,MAC9G,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,UAAU,EAAE,WAAW,GAAG,MAAM,GAAmB;AAC1D,SAAO,oBAAC,WAAM,aAAU,cAAa,WAAW,GAAG,8BAA8B,SAAS,GAAI,GAAG,OAAO;AAC1G;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,MAAM,GAAqB;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,yEAAyE,SAAS;AAAA,MAC/F,GAAG;AAAA;AAAA,EACN;AAEJ;AAYA,SAAS,SAAS,EAAE,WAAW,GAAG,MAAM,GAAkB;AACxD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,UAAU,EAAE,WAAW,UAAU,OAAO,GAAG,MAAM,GAAmB;AAC3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,UAAU,EAAE,WAAW,UAAU,OAAO,GAAG,MAAM,GAAmB;AAC3E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,WAAW;AAAA,QACX;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,MAAM,GAAsB;AAChE,SACE,oBAAC,aAAQ,aAAU,iBAAgB,WAAW,GAAG,sCAAsC,SAAS,GAAI,GAAG,OAAO;AAElH;","names":[]}
|
|
@@ -34,7 +34,10 @@ function DataGridRowHeightMenu({
|
|
|
34
34
|
{
|
|
35
35
|
"aria-label": msg.rowHeight.label,
|
|
36
36
|
size: "sm",
|
|
37
|
-
className: cn(
|
|
37
|
+
className: cn(
|
|
38
|
+
"w-auto gap-1.5 text-(length:--btn-sm-text) leading-(--btn-sm-leading) font-normal",
|
|
39
|
+
triggerClassName
|
|
40
|
+
),
|
|
38
41
|
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: msg.rowHeight.label, children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5", children: [
|
|
39
42
|
/* @__PURE__ */ jsx(selectedRowHeight.icon, { "aria-hidden": "true", className: "size-3.5 text-muted-foreground" }),
|
|
40
43
|
selectedRowHeight.label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data-grid/data-grid-row-height-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport type { Table } from \"@tanstack/react-table\";\nimport { AlignVerticalSpaceAroundIcon, ChevronsDownUpIcon, EqualIcon, MinusIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from \"../components/ui/select.js\";\nimport { cn } from \"../lib/cn.js\";\nimport { useResolvedDataGridMessages } from \"./data-grid-locale.js\";\nimport type { DataGridLocale, DataGridMessages } from \"./messages.js\";\n\n/*\n * Bốn mức chiều cao. PHẢI dựng theo bảng chuỗi chứ không đóng băng thành hằng ở đầu module —\n * nhãn (\"Short\" / \"Thấp\") đổi theo ngôn ngữ, còn `value` và icon thì không.\n */\nfunction buildRowHeights(msg: DataGridMessages) {\n // Tuple (không phải mảng) để `rowHeights[0]` có kiểu chắc chắn — bốn mức là cố định.\n return [\n { label: msg.rowHeight.short, value: \"short\" as const, icon: MinusIcon },\n { label: msg.rowHeight.medium, value: \"medium\" as const, icon: EqualIcon },\n { label: msg.rowHeight.tall, value: \"tall\" as const, icon: AlignVerticalSpaceAroundIcon },\n { label: msg.rowHeight.extraTall, value: \"extra-tall\" as const, icon: ChevronsDownUpIcon }\n ] as const;\n}\n\ninterface DataGridRowHeightMenuProps<TData> extends React.ComponentProps<typeof SelectContent> {\n table: Table<TData>;\n disabled?: boolean;\n /** className cho nút mở menu (mặc định cao 8 như các nút khác trên thanh công cụ) */\n triggerClassName?: string;\n /**\n * Ngôn ngữ của menu: `\"en\"` · `\"vi\"`, hoặc cả một bảng chuỗi tự soạn.\n *\n * ⚠ Thanh công cụ nằm NGOÀI `<DataGrid>`, nên `locale` truyền cho lưới không với tới đây. Bỏ\n * trống thì menu theo `DataGridLocaleProvider`, rồi ngôn ngữ của `ComitorLocaleProvider`, rồi\n * `\"en\"` — app đã đặt `ComitorLocaleProvider` ở root thì không cần làm gì. Prop thắng provider.\n */\n locale?: DataGridLocale | DataGridMessages;\n}\n\n/** Chọn chiều cao dòng của lưới (thấp/vừa/cao/rất cao) — đặt trên thanh công cụ. */\nexport function DataGridRowHeightMenu<TData>({\n table,\n disabled,\n triggerClassName,\n locale,\n ...props\n}: DataGridRowHeightMenuProps<TData>) {\n const msg = useResolvedDataGridMessages(locale);\n const rowHeights = React.useMemo(() => buildRowHeights(msg), [msg]);\n const rowHeight = table.options.meta?.rowHeight;\n const onRowHeightChange = table.options.meta?.onRowHeightChange;\n\n const selectedRowHeight = React.useMemo(\n () => rowHeights.find((option) => option.value === rowHeight) ?? rowHeights[0],\n [rowHeight, rowHeights]\n );\n\n return (\n <Select value={rowHeight} onValueChange={onRowHeightChange} disabled={disabled}>\n {/*\n * ⚠ Khác bản gốc (3.3.2): nút mở mang `text-xs` + `gap-1.5`, đúng bậc chữ của các nút khác\n * trên thanh công cụ (`Button size=\"sm\"` = `h-8 px-3 text-xs gap-1.5`). Bậc `sm` của\n * `SelectTrigger` chỉ hạ CHIỀU CAO (`data-[size=sm]:h-8`), chữ giữ `text-sm` — nên trước bản\n * này nút này là chữ 14px (dòng 20px, icon–chữ 8px) đứng giữa một hàng 12px (dòng 16px,\n * icon–chữ 6px). Đổi ở ĐÂY chứ không đổi bậc `sm` của `SelectTrigger`: đó là giao diện của\n * mọi `Select size=\"sm\"` trong app, và trong gói thì đây là chỗ DUY NHẤT dùng bậc đó.\n */}\n <SelectTrigger\n aria-label={msg.rowHeight.label}\n size=\"sm\"\n className={cn(\"w-auto gap-1.5 text-
|
|
1
|
+
{"version":3,"sources":["../../src/data-grid/data-grid-row-height-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport type { Table } from \"@tanstack/react-table\";\nimport { AlignVerticalSpaceAroundIcon, ChevronsDownUpIcon, EqualIcon, MinusIcon } from \"lucide-react\";\nimport * as React from \"react\";\nimport { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from \"../components/ui/select.js\";\nimport { cn } from \"../lib/cn.js\";\nimport { useResolvedDataGridMessages } from \"./data-grid-locale.js\";\nimport type { DataGridLocale, DataGridMessages } from \"./messages.js\";\n\n/*\n * Bốn mức chiều cao. PHẢI dựng theo bảng chuỗi chứ không đóng băng thành hằng ở đầu module —\n * nhãn (\"Short\" / \"Thấp\") đổi theo ngôn ngữ, còn `value` và icon thì không.\n */\nfunction buildRowHeights(msg: DataGridMessages) {\n // Tuple (không phải mảng) để `rowHeights[0]` có kiểu chắc chắn — bốn mức là cố định.\n return [\n { label: msg.rowHeight.short, value: \"short\" as const, icon: MinusIcon },\n { label: msg.rowHeight.medium, value: \"medium\" as const, icon: EqualIcon },\n { label: msg.rowHeight.tall, value: \"tall\" as const, icon: AlignVerticalSpaceAroundIcon },\n { label: msg.rowHeight.extraTall, value: \"extra-tall\" as const, icon: ChevronsDownUpIcon }\n ] as const;\n}\n\ninterface DataGridRowHeightMenuProps<TData> extends React.ComponentProps<typeof SelectContent> {\n table: Table<TData>;\n disabled?: boolean;\n /** className cho nút mở menu (mặc định cao 8 như các nút khác trên thanh công cụ) */\n triggerClassName?: string;\n /**\n * Ngôn ngữ của menu: `\"en\"` · `\"vi\"`, hoặc cả một bảng chuỗi tự soạn.\n *\n * ⚠ Thanh công cụ nằm NGOÀI `<DataGrid>`, nên `locale` truyền cho lưới không với tới đây. Bỏ\n * trống thì menu theo `DataGridLocaleProvider`, rồi ngôn ngữ của `ComitorLocaleProvider`, rồi\n * `\"en\"` — app đã đặt `ComitorLocaleProvider` ở root thì không cần làm gì. Prop thắng provider.\n */\n locale?: DataGridLocale | DataGridMessages;\n}\n\n/** Chọn chiều cao dòng của lưới (thấp/vừa/cao/rất cao) — đặt trên thanh công cụ. */\nexport function DataGridRowHeightMenu<TData>({\n table,\n disabled,\n triggerClassName,\n locale,\n ...props\n}: DataGridRowHeightMenuProps<TData>) {\n const msg = useResolvedDataGridMessages(locale);\n const rowHeights = React.useMemo(() => buildRowHeights(msg), [msg]);\n const rowHeight = table.options.meta?.rowHeight;\n const onRowHeightChange = table.options.meta?.onRowHeightChange;\n\n const selectedRowHeight = React.useMemo(\n () => rowHeights.find((option) => option.value === rowHeight) ?? rowHeights[0],\n [rowHeight, rowHeights]\n );\n\n return (\n <Select value={rowHeight} onValueChange={onRowHeightChange} disabled={disabled}>\n {/*\n * ⚠ Khác bản gốc (3.3.2): nút mở mang `text-xs` + `gap-1.5`, đúng bậc chữ của các nút khác\n * trên thanh công cụ (`Button size=\"sm\"` = `h-8 px-3 text-xs gap-1.5`). Bậc `sm` của\n * `SelectTrigger` chỉ hạ CHIỀU CAO (`data-[size=sm]:h-8`), chữ giữ `text-sm` — nên trước bản\n * này nút này là chữ 14px (dòng 20px, icon–chữ 8px) đứng giữa một hàng 12px (dòng 16px,\n * icon–chữ 6px). Đổi ở ĐÂY chứ không đổi bậc `sm` của `SelectTrigger`: đó là giao diện của\n * mọi `Select size=\"sm\"` trong app, và trong gói thì đây là chỗ DUY NHẤT dùng bậc đó.\n */}\n <SelectTrigger\n aria-label={msg.rowHeight.label}\n size=\"sm\"\n className={cn(\n \"w-auto gap-1.5 text-(length:--btn-sm-text) leading-(--btn-sm-leading) font-normal\",\n triggerClassName\n )}\n >\n <SelectValue placeholder={msg.rowHeight.label}>\n <span className=\"flex items-center gap-1.5\">\n <selectedRowHeight.icon aria-hidden=\"true\" className=\"size-3.5 text-muted-foreground\" />\n {selectedRowHeight.label}\n </span>\n </SelectValue>\n </SelectTrigger>\n <SelectContent {...props}>\n <SelectGroup>\n {rowHeights.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n <span className=\"flex items-center gap-2\">\n <option.icon aria-hidden=\"true\" className=\"size-4 text-muted-foreground\" />\n {option.label}\n </span>\n </SelectItem>\n ))}\n </SelectGroup>\n </SelectContent>\n </Select>\n );\n}\n"],"mappings":";AA4EU,SACE,KADF;AAzEV,SAAS,8BAA8B,oBAAoB,WAAW,iBAAiB;AACvF,YAAY,WAAW;AACvB,SAAS,QAAQ,eAAe,aAAa,YAAY,eAAe,mBAAmB;AAC3F,SAAS,UAAU;AACnB,SAAS,mCAAmC;AAO5C,SAAS,gBAAgB,KAAuB;AAE9C,SAAO;AAAA,IACL,EAAE,OAAO,IAAI,UAAU,OAAO,OAAO,SAAkB,MAAM,UAAU;AAAA,IACvE,EAAE,OAAO,IAAI,UAAU,QAAQ,OAAO,UAAmB,MAAM,UAAU;AAAA,IACzE,EAAE,OAAO,IAAI,UAAU,MAAM,OAAO,QAAiB,MAAM,6BAA6B;AAAA,IACxF,EAAE,OAAO,IAAI,UAAU,WAAW,OAAO,cAAuB,MAAM,mBAAmB;AAAA,EAC3F;AACF;AAkBO,SAAS,sBAA6B;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsC;AACpC,QAAM,MAAM,4BAA4B,MAAM;AAC9C,QAAM,aAAa,MAAM,QAAQ,MAAM,gBAAgB,GAAG,GAAG,CAAC,GAAG,CAAC;AAClE,QAAM,YAAY,MAAM,QAAQ,MAAM;AACtC,QAAM,oBAAoB,MAAM,QAAQ,MAAM;AAE9C,QAAM,oBAAoB,MAAM;AAAA,IAC9B,MAAM,WAAW,KAAK,CAAC,WAAW,OAAO,UAAU,SAAS,KAAK,WAAW,CAAC;AAAA,IAC7E,CAAC,WAAW,UAAU;AAAA,EACxB;AAEA,SACE,qBAAC,UAAO,OAAO,WAAW,eAAe,mBAAmB,UAS1D;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,cAAY,IAAI,UAAU;AAAA,QAC1B,MAAK;AAAA,QACL,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,QAEA,8BAAC,eAAY,aAAa,IAAI,UAAU,OACtC,+BAAC,UAAK,WAAU,6BACd;AAAA,8BAAC,kBAAkB,MAAlB,EAAuB,eAAY,QAAO,WAAU,kCAAiC;AAAA,UACrF,kBAAkB;AAAA,WACrB,GACF;AAAA;AAAA,IACF;AAAA,IACA,oBAAC,iBAAe,GAAG,OACjB,8BAAC,eACE,qBAAW,IAAI,CAAC,WACf,oBAAC,cAA8B,OAAO,OAAO,OAC3C,+BAAC,UAAK,WAAU,2BACd;AAAA,0BAAC,OAAO,MAAP,EAAY,eAAY,QAAO,WAAU,gCAA+B;AAAA,MACxE,OAAO;AAAA,OACV,KAJe,OAAO,KAKxB,CACD,GACH,GACF;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { DataTable, DataTableAlign, DataTableColumn, DataTableColumnToggle, Data
|
|
|
8
8
|
export { DEFAULT_DATA_TABLE_LABELS, DataTableLabels } from './components/composite/data-table-constants.js';
|
|
9
9
|
export { DatePicker, DatePickerProps, DateRangePicker, DateRangePickerProps } from './components/composite/date-picker.js';
|
|
10
10
|
export { DEFAULT_DATE_PICKER_LABELS, DEFAULT_DATE_PRESETS, DEFAULT_DATE_RANGE_PRESETS, DatePickerLabels, DatePreset, DateRangePreset, VI_DATE_FORMAT, dateFormatForLocale } from './components/composite/date-picker-constants.js';
|
|
11
|
+
export { DeltaBadge, DeltaBadgeProps } from './components/composite/delta-badge.js';
|
|
11
12
|
export { EmptyState, EmptyStateProps, IconComponent } from './components/composite/empty-state.js';
|
|
12
13
|
export { FilterChipItem, FilterChips, FilterChipsProps } from './components/composite/filter-chips.js';
|
|
13
14
|
export { FormField, FormFieldColSpan, FormFieldControlProps, FormFieldProps } from './components/composite/form-field.js';
|
|
@@ -15,6 +16,7 @@ export { SELECT_EMPTY_VALUE, fromSelectValue, toSelectValue } from './components
|
|
|
15
16
|
export { FormSection, FormSectionAccent, FormSectionProps } from './components/composite/form-section.js';
|
|
16
17
|
export { Gantt, GanttProps } from './components/composite/gantt.js';
|
|
17
18
|
export { GANTT_SCALES, GanttDependency, GanttDependencyDraft, GanttDependencyType, GanttItem, GanttItemChange, GanttLabels, GanttScale, GanttTone } from './components/composite/gantt-constants.js';
|
|
19
|
+
export { CalendarHeatmap, CalendarHeatmapCell, CalendarHeatmapProps, HeatLegend, HeatLegendProps, HeatLevel, HeatMatrix, HeatMatrixProps, HeatMatrixRow, heatLevelOf } from './components/composite/heat-scale.js';
|
|
18
20
|
export { IconAvatar, IconAvatarIcon, IconAvatarProps } from './components/composite/icon-avatar.js';
|
|
19
21
|
export { InlineEdit, InlineEditProps } from './components/composite/inline-edit.js';
|
|
20
22
|
export { KEY_SEQUENCE_TIMEOUT_MS, KeySequence, KeySequenceInput, advanceKeySequence, isEditableTarget, normalizeSequenceKey } from './components/composite/key-sequence.js';
|
|
@@ -23,19 +25,24 @@ export { KeyboardShortcutItem, KeyboardShortcutSection, KeyboardShortcutsDialog,
|
|
|
23
25
|
export { LetterAvatar, LetterAvatarProps, LetterAvatarSize, getAvatarToneClasses } from './components/composite/letter-avatar.js';
|
|
24
26
|
export { PageContainer, PageContainerProps, PageContainerWidth } from './components/composite/page-container.js';
|
|
25
27
|
export { PageHeader, PageHeaderBreadcrumbItem, PageHeaderLinkProps, PageHeaderProps } from './components/composite/page-header.js';
|
|
28
|
+
export { RankBarList, RankBarListProps, RankBarRow } from './components/composite/rank-bar-list.js';
|
|
29
|
+
export { RatingStars, RatingStarsProps } from './components/composite/rating-stars.js';
|
|
26
30
|
export { RelativeTime, RelativeTimeProps } from './components/composite/relative-time.js';
|
|
27
31
|
export { RouteTabItem, RouteTabs, RouteTabsLinkComponent, RouteTabsLinkProps, RouteTabsProps } from './components/composite/route-tabs.js';
|
|
28
32
|
export { SearchFilterBar, SearchFilterBarProps } from './components/composite/search-filter-bar.js';
|
|
29
33
|
export { DEFAULT_SEARCH_FILTER_BAR_LABELS, SearchFilterBarLabels } from './components/composite/search-filter-bar-constants.js';
|
|
30
|
-
export {
|
|
34
|
+
export { SegmentedControl, SegmentedControlItem, SegmentedControlProps } from './components/composite/segmented-control.js';
|
|
35
|
+
export { Metric, MetricProps, StatCard, StatCardDelta, StatCardDeltaDirection, StatCardGroup, StatCardGroupProps, StatCardProps, StatCardTone, StatCardVariant, statCardIconVariants } from './components/composite/stat-card.js';
|
|
31
36
|
export { STATUS_TONES, StatusConfig, StatusTone, StatusToneName, getStatusClasses, getStatusConfig, getStatusLabel, sortByStatusPriority } from './components/composite/status-config.js';
|
|
32
37
|
export { StatusPill, StatusPillProps, StatusPillVariant } from './components/composite/status-pill.js';
|
|
33
38
|
export { TablePagination, TablePaginationProps } from './components/composite/table-pagination.js';
|
|
34
39
|
export { DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_TABLE_PAGINATION_LABELS, TablePaginationLabels } from './components/composite/table-pagination-constants.js';
|
|
40
|
+
export { CategorySlot, CategorySwatch, CategorySwatchProps, SectionLabel, SectionLabelProps, Text, TextProps, TextTone, textVariants } from './components/composite/text.js';
|
|
35
41
|
export { getVietnameseInitials, truncate } from './components/composite/text-utils.js';
|
|
36
42
|
export { ToastOptions, ToastVariant, Toaster, ToasterProps, dismissToast, toast, toastPromise } from './components/composite/toast.js';
|
|
37
43
|
export { TreeView, TreeViewProps } from './components/composite/tree-view.js';
|
|
38
44
|
export { TreeViewColumn, TreeViewItem, TreeViewLabels, TreeViewMove, TreeViewRollup, computeTreeNumbering, computeTreeRollup, groupTreeChildren, moveTreeItems } from './components/composite/tree-view-constants.js';
|
|
45
|
+
export { UrgencyLevel, UrgencyText, UrgencyTextProps } from './components/composite/urgency-text.js';
|
|
39
46
|
export { UseKeySequencesOptions, useKeySequences } from './components/composite/use-key-sequences.js';
|
|
40
47
|
export { Accordion, AccordionContent, AccordionContentProps, AccordionItem, AccordionItemProps, AccordionProps, AccordionTrigger, AccordionTriggerProps } from './components/ui/accordion.js';
|
|
41
48
|
export { ActionBar, ActionBarClose, ActionBarCloseProps, ActionBarGroup, ActionBarItem, ActionBarItemProps, ActionBarProps, ActionBarSelection, ActionBarSelectionProps, ActionBarSeparator, ActionBarSeparatorProps } from './components/ui/action-bar.js';
|
|
@@ -72,7 +79,7 @@ export { HoverCard, HoverCardContent, HoverCardContentProps, HoverCardProps, Hov
|
|
|
72
79
|
export { Input, InputProps } from './components/ui/input.js';
|
|
73
80
|
export { InputGroup, InputGroupAddon, InputGroupAddonProps, InputGroupButton, InputGroupButtonProps, InputGroupInput, InputGroupInputProps, InputGroupProps, InputGroupText, InputGroupTextProps, InputGroupTextarea, InputGroupTextareaProps, inputGroupAddonVariants, inputGroupButtonVariants } from './components/ui/input-group.js';
|
|
74
81
|
export { InputOTP, InputOTPGroup, InputOTPGroupProps, InputOTPProps, InputOTPSeparator, InputOTPSeparatorProps, InputOTPSlot, InputOTPSlotProps } from './components/ui/input-otp.js';
|
|
75
|
-
export { Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemFooter, ItemFooterProps, ItemGroup, ItemGroupProps, ItemHeader, ItemHeaderProps, ItemMedia, ItemMediaProps, ItemProps, ItemSeparator, ItemSeparatorProps, ItemTitle, ItemTitleProps, itemMediaVariants, itemVariants } from './components/ui/item.js';
|
|
82
|
+
export { Item, ItemActions, ItemActionsProps, ItemContent, ItemContentProps, ItemDescription, ItemDescriptionProps, ItemFooter, ItemFooterProps, ItemGroup, ItemGroupProps, ItemHeader, ItemHeaderProps, ItemMedia, ItemMediaProps, ItemMediaTone, ItemProps, ItemSeparator, ItemSeparatorProps, ItemTitle, ItemTitleProps, itemMediaVariants, itemVariants } from './components/ui/item.js';
|
|
76
83
|
export { Kanban, KanbanBoard, KanbanBoardProps, KanbanColumn, KanbanColumnHandle, KanbanColumnHandleProps, KanbanColumnProps, KanbanItem, KanbanItemHandle, KanbanItemHandleProps, KanbanItemProps, KanbanOverlay, KanbanOverlayProps, KanbanProps } from './components/ui/kanban.js';
|
|
77
84
|
export { DEFAULT_KANBAN_LABELS, KanbanAnnouncementInfo, KanbanLabels } from './components/ui/kanban-constants.js';
|
|
78
85
|
export { Kbd, KbdGroup, KbdGroupProps, KbdProps } from './components/ui/kbd.js';
|
|
@@ -88,7 +95,7 @@ export { Pagination, PaginationContent, PaginationContentProps, PaginationEllips
|
|
|
88
95
|
export { PhoneInput, PhoneInputCountrySelect, PhoneInputCountrySelectProps, PhoneInputField, PhoneInputFieldProps, PhoneInputProps, usePhoneInput } from './components/ui/phone-input.js';
|
|
89
96
|
export { DEFAULT_PHONE_INPUT_LABELS, PhoneInputCountry, PhoneInputLabels } from './components/ui/phone-input-constants.js';
|
|
90
97
|
export { Popover, PopoverAnchor, PopoverAnchorProps, PopoverContent, PopoverContentProps, PopoverProps, PopoverTrigger, PopoverTriggerProps } from './components/ui/popover.js';
|
|
91
|
-
export { Progress, ProgressProps, ProgressTone, progressBarVariants, progressTrackVariants } from './components/ui/progress.js';
|
|
98
|
+
export { Progress, ProgressColor, ProgressLevel, ProgressMarker, ProgressProps, ProgressSize, ProgressTone, progressBarVariants, progressFillVariants, progressSizeVariants, progressTrackVariants } from './components/ui/progress.js';
|
|
92
99
|
export { RadioGroup, RadioGroupItem, RadioGroupItemProps, RadioGroupProps } from './components/ui/radio-group.js';
|
|
93
100
|
export { Rating, RatingItem, RatingItemProps, RatingProps, useRating } from './components/ui/rating.js';
|
|
94
101
|
export { ResizableHandle, ResizableHandleProps, ResizablePanel, ResizablePanelGroup, ResizablePanelGroupProps, ResizablePanelProps } from './components/ui/resizable.js';
|
|
@@ -122,7 +129,7 @@ export { ComitorLocaleProvider, ComitorLocaleProviderProps, useComitorLocale, us
|
|
|
122
129
|
export { COMITOR_MESSAGES, ComitorMessages, ComitorMessagesOverride, comitorMessagesEn, comitorMessagesVi, getComitorMessages, mergeComitorMessages } from './i18n/messages.js';
|
|
123
130
|
export { AVATAR_TONE_NAMES, AvatarToneColors, AvatarToneName, LEGACY_AVATAR_TONE_ALIASES, getAvatarToneIndex } from './lib/avatar-tone.js';
|
|
124
131
|
export { cn } from './lib/cn.js';
|
|
125
|
-
export { ThemeMode, ThemePaletteName, accent, accentForeground, accentInk, ash, brandNeutral, chart, getAvatarToneColors, gold, highContrast, layout, semantic, status, themePalettes, typography } from './tokens.js';
|
|
132
|
+
export { ThemeMode, ThemePaletteName, accent, accentForeground, accentInk, ash, brandNeutral, chart, getAvatarToneColors, gold, heatScale, highContrast, layout, semantic, status, themePalettes, typography } from './tokens.js';
|
|
126
133
|
export { CompareSliderLabels } from './i18n/namespaces/compare-slider.js';
|
|
127
134
|
export { DateRange } from 'react-day-picker';
|
|
128
135
|
export { matchesSearch, normalizeVi, removeVietnameseTones } from './lib/text-search.js';
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./components/composite/data-table.js";
|
|
|
8
8
|
export * from "./components/composite/data-table-constants.js";
|
|
9
9
|
export * from "./components/composite/date-picker.js";
|
|
10
10
|
export * from "./components/composite/date-picker-constants.js";
|
|
11
|
+
export * from "./components/composite/delta-badge.js";
|
|
11
12
|
export * from "./components/composite/empty-state.js";
|
|
12
13
|
export * from "./components/composite/filter-chips.js";
|
|
13
14
|
export * from "./components/composite/form-field.js";
|
|
@@ -15,6 +16,7 @@ export * from "./components/composite/form-field-constants.js";
|
|
|
15
16
|
export * from "./components/composite/form-section.js";
|
|
16
17
|
export * from "./components/composite/gantt.js";
|
|
17
18
|
export * from "./components/composite/gantt-constants.js";
|
|
19
|
+
export * from "./components/composite/heat-scale.js";
|
|
18
20
|
import { IconAvatar } from "./components/composite/icon-avatar.js";
|
|
19
21
|
export * from "./components/composite/inline-edit.js";
|
|
20
22
|
export * from "./components/composite/key-sequence.js";
|
|
@@ -23,15 +25,19 @@ export * from "./components/composite/keyboard-shortcuts-dialog.js";
|
|
|
23
25
|
import { getAvatarToneClasses, LetterAvatar } from "./components/composite/letter-avatar.js";
|
|
24
26
|
export * from "./components/composite/page-container.js";
|
|
25
27
|
export * from "./components/composite/page-header.js";
|
|
28
|
+
export * from "./components/composite/rank-bar-list.js";
|
|
29
|
+
export * from "./components/composite/rating-stars.js";
|
|
26
30
|
export * from "./components/composite/relative-time.js";
|
|
27
31
|
export * from "./components/composite/route-tabs.js";
|
|
28
32
|
export * from "./components/composite/search-filter-bar.js";
|
|
29
33
|
export * from "./components/composite/search-filter-bar-constants.js";
|
|
34
|
+
export * from "./components/composite/segmented-control.js";
|
|
30
35
|
export * from "./components/composite/stat-card.js";
|
|
31
36
|
export * from "./components/composite/status-config.js";
|
|
32
37
|
export * from "./components/composite/status-pill.js";
|
|
33
38
|
export * from "./components/composite/table-pagination.js";
|
|
34
39
|
export * from "./components/composite/table-pagination-constants.js";
|
|
40
|
+
export * from "./components/composite/text.js";
|
|
35
41
|
import {
|
|
36
42
|
getVietnameseInitials,
|
|
37
43
|
matchesSearch,
|
|
@@ -42,6 +48,7 @@ import {
|
|
|
42
48
|
export * from "./components/composite/toast.js";
|
|
43
49
|
export * from "./components/composite/tree-view.js";
|
|
44
50
|
export * from "./components/composite/tree-view-constants.js";
|
|
51
|
+
export * from "./components/composite/urgency-text.js";
|
|
45
52
|
export * from "./components/composite/use-key-sequences.js";
|
|
46
53
|
export * from "./components/ui/accordion.js";
|
|
47
54
|
export * from "./components/ui/action-bar.js";
|