@gears-frontx/ui-kit 0.4.2 → 0.4.4
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 +10 -6
- package/dist/alert.js +35 -24
- package/dist/alert.js.map +1 -1
- package/dist/attachment.js +117 -76
- package/dist/attachment.js.map +1 -1
- package/dist/avatar.js +43 -43
- package/dist/badge.js +14 -14
- package/dist/card.js +81 -44
- package/dist/card.js.map +1 -1
- package/dist/chart.js +50 -50
- package/dist/chunks/alert.Csv2-ccF.css +1 -0
- package/dist/chunks/attachment.BRyIQq3F.css +1 -0
- package/dist/chunks/avatar.7EUG65-M.css +1 -0
- package/dist/chunks/badge.BwUxa9PB.css +1 -0
- package/dist/chunks/card.DSiUMxGK.css +1 -0
- package/dist/chunks/chart.B9cGEno8.css +1 -0
- package/dist/chunks/code-block.r7Cm0ncj.css +1 -0
- package/dist/chunks/description-list.Cx-vFGJL.css +1 -0
- package/dist/chunks/dialog.CIR9bQoU.css +1 -0
- package/dist/chunks/dropdown-menu.DT1_JLqL.css +1 -0
- package/dist/chunks/empty.DWqLrSfF.css +1 -0
- package/dist/chunks/heading.DQxQs5po.css +1 -0
- package/dist/chunks/item.BQ70Khqj.css +1 -0
- package/dist/chunks/link.BOE4f-aB.css +1 -0
- package/dist/chunks/message-scroller.CBjPcz8Y.css +1 -0
- package/dist/chunks/pagination.BAAl9D_S.css +1 -0
- package/dist/chunks/{select.BFwI5rhI.css → select.C3sLDoZI.css} +1 -1
- package/dist/chunks/sheet.BkZyzAbA.css +1 -0
- package/dist/chunks/sidebar.Dw_e0Jqw.css +1 -0
- package/dist/chunks/slider.DY1XDCPw.css +1 -0
- package/dist/chunks/status-dot.39NKkKQF.css +1 -0
- package/dist/chunks/tabs.BqhiMRUP.css +1 -0
- package/dist/chunks/text.7frjnkUr.css +1 -0
- package/dist/chunks/visually-hidden.Bd2oAR5D.css +1 -0
- package/dist/code-block.d.ts +1 -0
- package/dist/code-block.js +152 -0
- package/dist/code-block.js.map +1 -0
- package/dist/command.js +63 -48
- package/dist/command.js.map +1 -1
- package/dist/components/alert/alert.d.ts +3 -2
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/attachment/attachment.d.ts +10 -3
- package/dist/components/attachment/attachment.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +6 -4
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/code-block/code-block.d.ts +57 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/public.d.ts +2 -0
- package/dist/components/code-block/public.d.ts.map +1 -0
- package/dist/components/command/command.d.ts +1 -1
- package/dist/components/command/command.d.ts.map +1 -1
- package/dist/components/description-list/description-list.d.ts +21 -0
- package/dist/components/description-list/description-list.d.ts.map +1 -0
- package/dist/components/description-list/public.d.ts +2 -0
- package/dist/components/description-list/public.d.ts.map +1 -0
- package/dist/components/empty/empty.d.ts +3 -2
- package/dist/components/empty/empty.d.ts.map +1 -1
- package/dist/components/heading/heading.d.ts +10 -0
- package/dist/components/heading/heading.d.ts.map +1 -0
- package/dist/components/heading/public.d.ts +2 -0
- package/dist/components/heading/public.d.ts.map +1 -0
- package/dist/components/input-otp/input-otp.d.ts +1 -1
- package/dist/components/input-otp/input-otp.d.ts.map +1 -1
- package/dist/components/item/item.d.ts +15 -6
- package/dist/components/item/item.d.ts.map +1 -1
- package/dist/components/link/link.d.ts +18 -0
- package/dist/components/link/link.d.ts.map +1 -0
- package/dist/components/link/public.d.ts +2 -0
- package/dist/components/link/public.d.ts.map +1 -0
- package/dist/components/sidebar/sidebar.d.ts +13 -3
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/slider/slider.d.ts +1 -1
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/text/public.d.ts +2 -0
- package/dist/components/text/public.d.ts.map +1 -0
- package/dist/components/text/text.d.ts +11 -0
- package/dist/components/text/text.d.ts.map +1 -0
- package/dist/components/visually-hidden/public.d.ts +2 -0
- package/dist/components/visually-hidden/public.d.ts.map +1 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +4 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/dist/data-grid/pagination.js +35 -35
- package/dist/description-list.d.ts +1 -0
- package/dist/description-list.js +78 -0
- package/dist/description-list.js.map +1 -0
- package/dist/dialog.js +38 -38
- package/dist/docs/alert.md +8 -2
- package/dist/docs/attachment.md +20 -8
- package/dist/docs/avatar.md +8 -2
- package/dist/docs/badge.md +12 -11
- package/dist/docs/button.md +16 -4
- package/dist/docs/calendar.md +6 -0
- package/dist/docs/card.md +38 -6
- package/dist/docs/carousel.md +4 -2
- package/dist/docs/chart.md +23 -0
- package/dist/docs/code-block.md +114 -0
- package/dist/docs/data-grid.md +2 -0
- package/dist/docs/description-list.md +53 -0
- package/dist/docs/drawer.md +1 -1
- package/dist/docs/empty.md +9 -3
- package/dist/docs/heading.md +60 -0
- package/dist/docs/item.md +70 -3
- package/dist/docs/link.md +48 -0
- package/dist/docs/message-scroller.md +5 -0
- package/dist/docs/questionnaire.md +1 -1
- package/dist/docs/sheet.md +20 -3
- package/dist/docs/sidebar.md +27 -0
- package/dist/docs/status-dot.md +2 -2
- package/dist/docs/switch.md +10 -4
- package/dist/docs/text.md +51 -0
- package/dist/docs/visually-hidden.md +44 -0
- package/dist/dropdown-menu.js +56 -56
- package/dist/empty.js +47 -36
- package/dist/empty.js.map +1 -1
- package/dist/heading.d.ts +1 -0
- package/dist/heading.js +36 -0
- package/dist/heading.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +427 -401
- package/dist/index.js.map +1 -1
- package/dist/input-otp.js +34 -20
- package/dist/input-otp.js.map +1 -1
- package/dist/item.js +119 -71
- package/dist/item.js.map +1 -1
- package/dist/link.d.ts +1 -0
- package/dist/link.js +55 -0
- package/dist/link.js.map +1 -0
- package/dist/message-scroller.js +24 -24
- package/dist/select.js +45 -45
- package/dist/sheet.js +41 -41
- package/dist/sidebar.js +207 -193
- package/dist/sidebar.js.map +1 -1
- package/dist/slider.js +34 -21
- package/dist/slider.js.map +1 -1
- package/dist/status-dot.js +25 -25
- package/dist/table.js +172 -157
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +14 -14
- package/dist/text.d.ts +1 -0
- package/dist/text.js +53 -0
- package/dist/text.js.map +1 -0
- package/dist/theme.css +29 -6
- package/dist/utilities.css +25 -2
- package/dist/visually-hidden.d.ts +1 -0
- package/dist/visually-hidden.js +18 -0
- package/dist/visually-hidden.js.map +1 -0
- package/llms.txt +72 -15
- package/package.json +1 -4
- package/dist/chunks/alert.DsgRIXLn.css +0 -1
- package/dist/chunks/attachment.CZuZdlXC.css +0 -1
- package/dist/chunks/avatar.BMm-Z9l5.css +0 -1
- package/dist/chunks/badge.BCreEn3O.css +0 -1
- package/dist/chunks/card.DdBl-usf.css +0 -1
- package/dist/chunks/chart.CeyctrXQ.css +0 -1
- package/dist/chunks/dialog.Cpo8vChK.css +0 -1
- package/dist/chunks/dropdown-menu.TU3FHXbJ.css +0 -1
- package/dist/chunks/empty.DnAKlw2g.css +0 -1
- package/dist/chunks/item.BkcgydVc.css +0 -1
- package/dist/chunks/message-scroller.CbLooS7Q.css +0 -1
- package/dist/chunks/pagination.Cn8tIWMX.css +0 -1
- package/dist/chunks/sheet.BWvXXyXk.css +0 -1
- package/dist/chunks/sidebar.DdEvMURX.css +0 -1
- package/dist/chunks/slider.inyNxx4y.css +0 -1
- package/dist/chunks/status-dot.DWa2qGKe.css +0 -1
- package/dist/chunks/tabs.DFa0OYMo.css +0 -1
package/dist/table.js
CHANGED
|
@@ -1,160 +1,175 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { cx as
|
|
4
|
-
import { useRef as
|
|
5
|
-
import './chunks/table.CMm41tvy.css';const
|
|
6
|
-
tableContainer:
|
|
7
|
-
table:
|
|
8
|
-
stickyHeader:
|
|
9
|
-
tableHeader:
|
|
10
|
-
tableHead:
|
|
11
|
-
tableRow:
|
|
12
|
-
tableBody:
|
|
13
|
-
columnResizer:
|
|
14
|
-
tableCell:
|
|
15
|
-
variantDefault:
|
|
16
|
-
variantCollection:
|
|
17
|
-
densityCompact:
|
|
18
|
-
tableCaption:
|
|
19
|
-
tableFooter:
|
|
20
|
-
},
|
|
21
|
-
function
|
|
2
|
+
import { jsx as m, jsxs as X } from "react/jsx-runtime";
|
|
3
|
+
import { cx as y, cva as A } from "class-variance-authority";
|
|
4
|
+
import { useRef as I, useState as w, useCallback as v, useEffect as B } from "react";
|
|
5
|
+
import './chunks/table.CMm41tvy.css';const V = "_tableContainer_pfb4y_8", j = "_table_pfb4y_8", K = "_stickyHeader_pfb4y_79", U = "_tableHeader_pfb4y_91", Y = "_tableHead_pfb4y_70", q = "_tableRow_pfb4y_59", G = "_tableBody_pfb4y_147", J = "_columnResizer_pfb4y_279", Q = "_tableCell_pfb4y_127", Z = "_variantDefault_pfb4y_387", tt = "_variantCollection_pfb4y_94", et = "_densityCompact_pfb4y_461", nt = "_tableCaption_pfb4y_470", lt = "_tableFooter_pfb4y_492", c = {
|
|
6
|
+
tableContainer: V,
|
|
7
|
+
table: j,
|
|
8
|
+
stickyHeader: K,
|
|
9
|
+
tableHeader: U,
|
|
10
|
+
tableHead: Y,
|
|
11
|
+
tableRow: q,
|
|
12
|
+
tableBody: G,
|
|
13
|
+
columnResizer: J,
|
|
14
|
+
tableCell: Q,
|
|
15
|
+
variantDefault: Z,
|
|
16
|
+
variantCollection: tt,
|
|
17
|
+
densityCompact: et,
|
|
18
|
+
tableCaption: nt,
|
|
19
|
+
tableFooter: lt
|
|
20
|
+
}, D = 12, E = 8, at = 72, ot = 32;
|
|
21
|
+
function P(e) {
|
|
22
22
|
var t;
|
|
23
23
|
return Array.from(((t = e.parentElement) == null ? void 0 : t.children) ?? []).filter(
|
|
24
|
-
(
|
|
24
|
+
(a) => a instanceof HTMLTableCellElement
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
var
|
|
29
|
-
return t !== void 0 ? t : (
|
|
27
|
+
function N(e, t) {
|
|
28
|
+
var a;
|
|
29
|
+
return t !== void 0 ? t : (a = e.textContent) != null && a.trim() ? at : ot;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const t =
|
|
33
|
-
if (
|
|
34
|
-
for (const
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
function F(e) {
|
|
32
|
+
const t = P(e), a = e.closest("table");
|
|
33
|
+
if (a && a.style.tableLayout !== "fixed") {
|
|
34
|
+
for (const o of t)
|
|
35
|
+
o.style.width = `${Math.round(o.getBoundingClientRect().width)}px`;
|
|
36
|
+
a.style.tableLayout = "fixed", W(t);
|
|
37
37
|
}
|
|
38
38
|
return t;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function H(e) {
|
|
41
41
|
return Number.parseFloat(e.style.width) || 0;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
var
|
|
45
|
-
const t = (
|
|
46
|
-
t && (t.style.width = `${e.reduce((
|
|
43
|
+
function W(e) {
|
|
44
|
+
var a;
|
|
45
|
+
const t = (a = e[0]) == null ? void 0 : a.closest("table");
|
|
46
|
+
t && (t.style.width = `${e.reduce((o, s) => o + H(s), 0)}px`);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
48
|
+
function x(e, t, a, o = H) {
|
|
49
|
+
const s = e[t];
|
|
50
|
+
if (!s)
|
|
51
51
|
return 0;
|
|
52
|
-
const
|
|
53
|
-
if (t !== e.length - 1 || !
|
|
54
|
-
return
|
|
55
|
-
const
|
|
56
|
-
if (!Number.isFinite(
|
|
57
|
-
return
|
|
58
|
-
const
|
|
59
|
-
return Math.max(
|
|
60
|
-
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
63
|
-
if (!
|
|
64
|
-
return
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
function
|
|
69
|
-
const t =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
const u = N(s, a), f = s.closest("table");
|
|
53
|
+
if (t !== e.length - 1 || !f)
|
|
54
|
+
return u;
|
|
55
|
+
const r = Number.parseFloat(getComputedStyle(f).minWidth);
|
|
56
|
+
if (!Number.isFinite(r))
|
|
57
|
+
return u;
|
|
58
|
+
const p = e.slice(0, t).reduce((_, h) => _ + o(h), 0);
|
|
59
|
+
return Math.max(u, Math.ceil(r - p));
|
|
60
|
+
}
|
|
61
|
+
function O(e, t, a, o, s, u, f) {
|
|
62
|
+
const r = e[t];
|
|
63
|
+
if (!r)
|
|
64
|
+
return a;
|
|
65
|
+
const p = o === null ? null : e[t + 1], _ = o === null || !p ? Number.POSITIVE_INFINITY : a + o - f, h = Math.round(Math.min(Math.max(a + s, u), _));
|
|
66
|
+
return r.style.width = `${h}px`, p && o !== null && (p.style.width = `${a + o - h}px`), W(e), h;
|
|
67
|
+
}
|
|
68
|
+
function rt({ minWidth: e }) {
|
|
69
|
+
const t = I(null), a = I(null), [o, s] = w(""), [u, f] = w(null), [r, p] = w(null), _ = v(() => {
|
|
70
|
+
var d, C;
|
|
71
|
+
const n = (d = t.current) == null ? void 0 : d.closest("th");
|
|
72
|
+
if (!(n instanceof HTMLTableCellElement))
|
|
73
|
+
return;
|
|
74
|
+
const l = P(n), i = Math.round(n.getBoundingClientRect().width), b = (g) => H(g) || g.getBoundingClientRect().width;
|
|
75
|
+
p({
|
|
76
|
+
now: i,
|
|
77
|
+
min: Math.round(x(l, l.indexOf(n), e, b)),
|
|
78
|
+
max: Math.round(((C = n.closest("table")) == null ? void 0 : C.getBoundingClientRect().width) ?? 0)
|
|
79
|
+
}), a.current || f((g) => g === null ? null : i);
|
|
80
|
+
}, [e]);
|
|
81
|
+
B(() => {
|
|
82
|
+
var n, l, i;
|
|
83
|
+
s(((i = (l = (n = t.current) == null ? void 0 : n.closest("th")) == null ? void 0 : l.textContent) == null ? void 0 : i.trim()) ?? ""), _();
|
|
84
|
+
}, [_]);
|
|
85
|
+
const h = u ?? (r == null ? void 0 : r.now) ?? 0, z = Math.min((r == null ? void 0 : r.min) ?? 0, h), L = Math.max((r == null ? void 0 : r.max) ?? 0, h), R = (n) => {
|
|
86
|
+
document.body.style.cursor = n ? "col-resize" : "", document.body.style.userSelect = n ? "none" : "";
|
|
87
|
+
}, M = (n, l, i) => {
|
|
77
88
|
try {
|
|
78
|
-
|
|
89
|
+
i ? n.setPointerCapture(l) : n.hasPointerCapture(l) && n.releasePointerCapture(l);
|
|
79
90
|
} catch {
|
|
80
91
|
}
|
|
81
|
-
},
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
92
|
+
}, T = v(() => {
|
|
93
|
+
const n = a.current;
|
|
94
|
+
if (!n)
|
|
84
95
|
return;
|
|
85
|
-
|
|
96
|
+
a.current = null, R(!1);
|
|
86
97
|
const l = t.current;
|
|
87
|
-
l &&
|
|
98
|
+
l && M(l, n.pointerId, !1);
|
|
88
99
|
}, []);
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const l =
|
|
92
|
-
if (!(l instanceof HTMLTableCellElement) ||
|
|
100
|
+
B(() => T, [T]);
|
|
101
|
+
const k = (n) => {
|
|
102
|
+
const l = n.currentTarget.closest("th");
|
|
103
|
+
if (!(l instanceof HTMLTableCellElement) || n.button !== 0)
|
|
93
104
|
return;
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
pointerId:
|
|
97
|
-
startX:
|
|
98
|
-
cells:
|
|
99
|
-
index:
|
|
105
|
+
const i = F(l), b = i.indexOf(l), d = i[b + 1] ?? null;
|
|
106
|
+
a.current = {
|
|
107
|
+
pointerId: n.pointerId,
|
|
108
|
+
startX: n.clientX,
|
|
109
|
+
cells: i,
|
|
110
|
+
index: b,
|
|
100
111
|
selfStart: l.getBoundingClientRect().width,
|
|
101
|
-
neighbourStart:
|
|
102
|
-
minSelf:
|
|
103
|
-
minNeighbour:
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
const l =
|
|
107
|
-
!l || l.pointerId !==
|
|
108
|
-
|
|
112
|
+
neighbourStart: d ? d.getBoundingClientRect().width : null,
|
|
113
|
+
minSelf: x(i, b, e),
|
|
114
|
+
minNeighbour: d ? N(d, void 0) : 0
|
|
115
|
+
}, M(n.currentTarget, n.pointerId, !0), R(!0), f(Math.round(a.current.selfStart));
|
|
116
|
+
}, $ = (n) => {
|
|
117
|
+
const l = a.current;
|
|
118
|
+
!l || l.pointerId !== n.pointerId || f(
|
|
119
|
+
O(
|
|
109
120
|
l.cells,
|
|
110
121
|
l.index,
|
|
111
122
|
l.selfStart,
|
|
112
123
|
l.neighbourStart,
|
|
113
|
-
|
|
124
|
+
n.clientX - l.startX,
|
|
114
125
|
l.minSelf,
|
|
115
126
|
l.minNeighbour
|
|
116
127
|
)
|
|
117
128
|
);
|
|
118
|
-
},
|
|
119
|
-
const l =
|
|
129
|
+
}, S = (n) => {
|
|
130
|
+
const l = n.key === "ArrowLeft" ? -D : n.key === "ArrowRight" ? D : 0;
|
|
120
131
|
if (l === 0)
|
|
121
132
|
return;
|
|
122
|
-
const
|
|
123
|
-
if (!(
|
|
133
|
+
const i = n.currentTarget.closest("th");
|
|
134
|
+
if (!(i instanceof HTMLTableCellElement))
|
|
124
135
|
return;
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
n.preventDefault();
|
|
137
|
+
const b = F(i), d = b.indexOf(i), C = b[d + 1] ?? null;
|
|
138
|
+
f(
|
|
139
|
+
O(
|
|
140
|
+
b,
|
|
141
|
+
d,
|
|
142
|
+
i.getBoundingClientRect().width,
|
|
132
143
|
C ? C.getBoundingClientRect().width : null,
|
|
133
144
|
l,
|
|
134
|
-
|
|
135
|
-
C ?
|
|
145
|
+
x(b, d, e),
|
|
146
|
+
C ? N(C, void 0) : 0
|
|
136
147
|
)
|
|
137
148
|
);
|
|
138
149
|
};
|
|
139
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ m(
|
|
140
151
|
"span",
|
|
141
152
|
{
|
|
142
153
|
ref: t,
|
|
143
154
|
role: "separator",
|
|
144
155
|
"aria-orientation": "vertical",
|
|
145
|
-
"aria-label": `${
|
|
156
|
+
"aria-label": `${o || "Column"} width${u === null ? "" : `, ${u} pixels`}`,
|
|
157
|
+
"aria-valuenow": h,
|
|
158
|
+
"aria-valuemin": z,
|
|
159
|
+
"aria-valuemax": L,
|
|
160
|
+
onFocus: _,
|
|
146
161
|
tabIndex: 0,
|
|
147
|
-
className:
|
|
148
|
-
style: { width:
|
|
149
|
-
onPointerDown:
|
|
150
|
-
onPointerMove:
|
|
151
|
-
onPointerUp:
|
|
152
|
-
onPointerCancel:
|
|
153
|
-
onKeyDown:
|
|
162
|
+
className: c.columnResizer,
|
|
163
|
+
style: { width: E, insetInlineEnd: -E / 2 },
|
|
164
|
+
onPointerDown: k,
|
|
165
|
+
onPointerMove: $,
|
|
166
|
+
onPointerUp: T,
|
|
167
|
+
onPointerCancel: T,
|
|
168
|
+
onKeyDown: S
|
|
154
169
|
}
|
|
155
170
|
);
|
|
156
171
|
}
|
|
157
|
-
const
|
|
172
|
+
const it = A(c.table, {
|
|
158
173
|
variants: {
|
|
159
174
|
/*
|
|
160
175
|
* `collection` is the spec's own guide word for the dense arrangement:
|
|
@@ -162,89 +177,89 @@ const tt = W(i.table, {
|
|
|
162
177
|
* density axis below is orthogonal to it and still applies.
|
|
163
178
|
*/
|
|
164
179
|
variant: {
|
|
165
|
-
default:
|
|
166
|
-
collection:
|
|
180
|
+
default: c.variantDefault,
|
|
181
|
+
collection: c.variantCollection
|
|
167
182
|
}
|
|
168
183
|
},
|
|
169
184
|
defaultVariants: {
|
|
170
185
|
variant: "default"
|
|
171
186
|
}
|
|
172
187
|
});
|
|
173
|
-
function
|
|
188
|
+
function ft({
|
|
174
189
|
className: e,
|
|
175
190
|
label: t,
|
|
176
|
-
density:
|
|
177
|
-
variant:
|
|
191
|
+
density: a,
|
|
192
|
+
variant: o,
|
|
178
193
|
containerClassName: s,
|
|
179
|
-
containerStyle:
|
|
180
|
-
containerRef:
|
|
181
|
-
stickyHeader:
|
|
182
|
-
...
|
|
194
|
+
containerStyle: u,
|
|
195
|
+
containerRef: f,
|
|
196
|
+
stickyHeader: r,
|
|
197
|
+
...p
|
|
183
198
|
}) {
|
|
184
|
-
return /* @__PURE__ */
|
|
199
|
+
return /* @__PURE__ */ m(
|
|
185
200
|
"div",
|
|
186
201
|
{
|
|
187
|
-
ref:
|
|
188
|
-
className:
|
|
189
|
-
style:
|
|
202
|
+
ref: f,
|
|
203
|
+
className: y(c.tableContainer, s),
|
|
204
|
+
style: u,
|
|
190
205
|
tabIndex: 0,
|
|
191
206
|
role: t === void 0 ? void 0 : "region",
|
|
192
207
|
"aria-label": t,
|
|
193
|
-
children: /* @__PURE__ */
|
|
208
|
+
children: /* @__PURE__ */ m(
|
|
194
209
|
"table",
|
|
195
210
|
{
|
|
196
|
-
className:
|
|
197
|
-
variant:
|
|
198
|
-
className:
|
|
199
|
-
|
|
200
|
-
|
|
211
|
+
className: it({
|
|
212
|
+
variant: o,
|
|
213
|
+
className: y(
|
|
214
|
+
a === "compact" && c.densityCompact,
|
|
215
|
+
r && c.stickyHeader,
|
|
201
216
|
e
|
|
202
217
|
)
|
|
203
218
|
}),
|
|
204
|
-
...
|
|
219
|
+
...p
|
|
205
220
|
}
|
|
206
221
|
)
|
|
207
222
|
}
|
|
208
223
|
);
|
|
209
224
|
}
|
|
210
|
-
function
|
|
211
|
-
return /* @__PURE__ */
|
|
225
|
+
function dt({ className: e, ...t }) {
|
|
226
|
+
return /* @__PURE__ */ m("thead", { className: y(c.tableHeader, e), ...t });
|
|
212
227
|
}
|
|
213
|
-
function
|
|
214
|
-
return /* @__PURE__ */
|
|
228
|
+
function bt({ className: e, ...t }) {
|
|
229
|
+
return /* @__PURE__ */ m("tbody", { className: y(c.tableBody, e), ...t });
|
|
215
230
|
}
|
|
216
|
-
function
|
|
217
|
-
return /* @__PURE__ */
|
|
231
|
+
function mt({ className: e, ...t }) {
|
|
232
|
+
return /* @__PURE__ */ m("tfoot", { className: y(c.tableFooter, e), ...t });
|
|
218
233
|
}
|
|
219
|
-
function
|
|
220
|
-
return /* @__PURE__ */
|
|
234
|
+
function pt({ className: e, ...t }) {
|
|
235
|
+
return /* @__PURE__ */ m("tr", { className: y(c.tableRow, e), ...t });
|
|
221
236
|
}
|
|
222
|
-
function
|
|
237
|
+
function ht({
|
|
223
238
|
className: e,
|
|
224
239
|
resizable: t,
|
|
225
|
-
resizeMinWidth:
|
|
226
|
-
children:
|
|
240
|
+
resizeMinWidth: a,
|
|
241
|
+
children: o,
|
|
227
242
|
...s
|
|
228
243
|
}) {
|
|
229
|
-
return /* @__PURE__ */
|
|
230
|
-
|
|
231
|
-
t ? /* @__PURE__ */
|
|
244
|
+
return /* @__PURE__ */ X("th", { className: y(c.tableHead, e), ...s, children: [
|
|
245
|
+
o,
|
|
246
|
+
t ? /* @__PURE__ */ m(rt, { minWidth: a }) : null
|
|
232
247
|
] });
|
|
233
248
|
}
|
|
234
|
-
function
|
|
235
|
-
return /* @__PURE__ */
|
|
249
|
+
function yt({ className: e, ...t }) {
|
|
250
|
+
return /* @__PURE__ */ m("td", { className: y(c.tableCell, e), ...t });
|
|
236
251
|
}
|
|
237
|
-
function
|
|
238
|
-
return /* @__PURE__ */
|
|
252
|
+
function _t({ className: e, ...t }) {
|
|
253
|
+
return /* @__PURE__ */ m("caption", { className: y(c.tableCaption, e), ...t });
|
|
239
254
|
}
|
|
240
255
|
export {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
ft as Table,
|
|
257
|
+
bt as TableBody,
|
|
258
|
+
_t as TableCaption,
|
|
259
|
+
yt as TableCell,
|
|
260
|
+
mt as TableFooter,
|
|
261
|
+
ht as TableHead,
|
|
262
|
+
dt as TableHeader,
|
|
263
|
+
pt as TableRow
|
|
249
264
|
};
|
|
250
265
|
//# sourceMappingURL=table.js.map
|
package/dist/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sources":["../src/components/table/table.tsx"],"sourcesContent":["'use client';\n\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport {\n type ComponentProps,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type Ref,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport styles from './table.module.css';\n\n/*\n * Resize behaviour constants. These are not style values: they decide how\n * the drag RESPONDS, not how anything looks, so they live here rather than\n * as unexplained numbers in the stylesheet. All four are the design spec's\n * own.\n */\n/** How far one arrow-key press moves the boundary. */\nconst KEYBOARD_STEP = 12;\n/** The grab area straddling the column's trailing edge, half on each side. */\nconst HANDLE_WIDTH = 8;\n/** A column carrying text needs room for a word. */\nconst MIN_WIDTH_WITH_TEXT = 72;\n/** One carrying only a control (a checkbox, a row action) does not. */\nconst MIN_WIDTH_WITHOUT_TEXT = 32;\n\nfunction headerCellsOf(cell: HTMLTableCellElement): HTMLTableCellElement[] {\n return Array.from(cell.parentElement?.children ?? []).filter(\n (child): child is HTMLTableCellElement => child instanceof HTMLTableCellElement,\n );\n}\n\nfunction minWidthOf(cell: HTMLTableCellElement, override: number | undefined): number {\n if (override !== undefined) {\n return override;\n }\n return cell.textContent?.trim() ? MIN_WIDTH_WITH_TEXT : MIN_WIDTH_WITHOUT_TEXT;\n}\n\n/*\n * The first drag freezes every column at the width it currently renders and\n * switches the table to a fixed layout. Without that the browser keeps\n * re-deriving every column from its content, so widening one column silently\n * reflows the rest and the drag does not hold.\n */\nfunction freezeColumns(cell: HTMLTableCellElement): HTMLTableCellElement[] {\n const cells = headerCellsOf(cell);\n const table = cell.closest('table');\n if (table && table.style.tableLayout !== 'fixed') {\n for (const column of cells) {\n column.style.width = `${Math.round(column.getBoundingClientRect().width)}px`;\n }\n table.style.tableLayout = 'fixed';\n pinTableWidth(cells);\n }\n return cells;\n}\n\nfunction frozenWidthOf(cell: HTMLTableCellElement): number {\n return Number.parseFloat(cell.style.width) || 0;\n}\n\n/*\n * A fixed layout still stretches its columns to the table's own width, and\n * `.table` is `width: 100%`: left alone, whatever a column gives up is handed\n * straight back to the others, which is why the last column could never be\n * narrowed. Pinning the table to the sum of its frozen columns makes the\n * columns the only thing deciding its width, so it can end up narrower than\n * its container or wider than it (the wrapper then scrolls).\n */\nfunction pinTableWidth(cells: HTMLTableCellElement[]): void {\n const table = cells[0]?.closest('table');\n if (table) {\n table.style.width = `${cells.reduce((sum, column) => sum + frozenWidthOf(column), 0)}px`;\n }\n}\n\n/*\n * The floor a dragged column resizes against. Only the last column can\n * change the table's width, so only the last one also has to respect a\n * `min-width` on the table (the collection view's 960px): below that the\n * browser would widen the table back and spread the difference over every\n * column, and the width the handle announced would no longer be the one on\n * screen.\n */\nfunction minSelfOf(\n cells: HTMLTableCellElement[],\n index: number,\n override: number | undefined,\n): number {\n const self = cells[index];\n if (!self) {\n return 0;\n }\n const own = minWidthOf(self, override);\n const table = self.closest('table');\n if (index !== cells.length - 1 || !table) {\n return own;\n }\n const tableFloor = Number.parseFloat(getComputedStyle(table).minWidth);\n if (!Number.isFinite(tableFloor)) {\n return own;\n }\n const others = cells.slice(0, index).reduce((sum, column) => sum + frozenWidthOf(column), 0);\n return Math.max(own, Math.ceil(tableFloor - others));\n}\n\n/*\n * A column resizes against its TRAILING neighbour: the pair's combined width\n * is what stays constant, so dragging an inner boundary never changes the\n * table's own width. The last column has no neighbour to trade with, and\n * there the table's pinned width (see pinTableWidth) follows it in both\n * directions.\n */\nfunction applyWidths(\n cells: HTMLTableCellElement[],\n index: number,\n selfStart: number,\n neighbourStart: number | null,\n delta: number,\n minSelf: number,\n minNeighbour: number,\n): number {\n const self = cells[index];\n if (!self) {\n return selfStart;\n }\n const neighbour = neighbourStart === null ? null : cells[index + 1];\n const ceiling =\n neighbourStart === null || !neighbour\n ? Number.POSITIVE_INFINITY\n : selfStart + neighbourStart - minNeighbour;\n const next = Math.round(Math.min(Math.max(selfStart + delta, minSelf), ceiling));\n self.style.width = `${next}px`;\n if (neighbour && neighbourStart !== null) {\n neighbour.style.width = `${selfStart + neighbourStart - next}px`;\n }\n pinTableWidth(cells);\n return next;\n}\n\ninterface DragState {\n pointerId: number;\n startX: number;\n cells: HTMLTableCellElement[];\n index: number;\n selfStart: number;\n neighbourStart: number | null;\n minSelf: number;\n minNeighbour: number;\n}\n\ninterface TableColumnResizerProps {\n minWidth?: number;\n}\n\n/*\n * The trailing-edge resize handle. Rendered inside its own <th>, which is\n * what it measures and resizes; the geometry it needs from JS (the grab\n * width and its half-overhang) comes from HANDLE_WIDTH above, and the\n * hairline it draws is the stylesheet's.\n */\nfunction TableColumnResizer({ minWidth }: TableColumnResizerProps) {\n const handleRef = useRef<HTMLSpanElement>(null);\n const dragRef = useRef<DragState | null>(null);\n const [columnName, setColumnName] = useState('');\n const [width, setWidth] = useState<number | null>(null);\n\n useEffect(() => {\n setColumnName(handleRef.current?.closest('th')?.textContent?.trim() ?? '');\n }, []);\n\n /*\n * The cursor and the text selection are locked for the DURATION of the\n * drag, not for the pointer's position: without it, dragging past the\n * handle turns the pointer back into a caret and starts selecting the\n * header labels it crosses.\n */\n const lockPage = (locked: boolean) => {\n document.body.style.cursor = locked ? 'col-resize' : '';\n document.body.style.userSelect = locked ? 'none' : '';\n };\n\n /*\n * Pointer capture is what keeps the drag alive once the pointer leaves\n * the 8px handle, but it is not what the drag depends on: a pointer id\n * the platform does not consider active throws, and the drag still has to\n * work. Both calls are therefore best-effort, and the drag's own state is\n * the ref above.\n */\n const capturePointer = (handle: HTMLSpanElement, pointerId: number, capture: boolean) => {\n try {\n if (capture) {\n handle.setPointerCapture(pointerId);\n } else if (handle.hasPointerCapture(pointerId)) {\n handle.releasePointerCapture(pointerId);\n }\n } catch {\n // No capture to take or give back; the drag is unaffected either way.\n }\n };\n\n /*\n * Only a drag this handle started may release the lock: the unmount\n * cleanup and a stray pointerup both land here, and clearing the body\n * styles unconditionally would wipe a cursor something else on the page\n * had set.\n */\n const endDrag = useCallback(() => {\n const drag = dragRef.current;\n if (!drag) {\n return;\n }\n dragRef.current = null;\n lockPage(false);\n const handle = handleRef.current;\n if (handle) {\n capturePointer(handle, drag.pointerId, false);\n }\n }, []);\n\n // Releases the lock if the header unmounts mid-drag: the page would\n // otherwise keep the resize cursor and the suppressed selection forever.\n useEffect(() => endDrag, [endDrag]);\n\n const onPointerDown = (event: ReactPointerEvent<HTMLSpanElement>) => {\n const cell = event.currentTarget.closest('th');\n if (!(cell instanceof HTMLTableCellElement) || event.button !== 0) {\n return;\n }\n const cells = freezeColumns(cell);\n const index = cells.indexOf(cell);\n const neighbour = cells[index + 1] ?? null;\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n cells,\n index,\n selfStart: cell.getBoundingClientRect().width,\n neighbourStart: neighbour ? neighbour.getBoundingClientRect().width : null,\n minSelf: minSelfOf(cells, index, minWidth),\n minNeighbour: neighbour ? minWidthOf(neighbour, undefined) : 0,\n };\n capturePointer(event.currentTarget, event.pointerId, true);\n lockPage(true);\n setWidth(Math.round(dragRef.current.selfStart));\n };\n\n const onPointerMove = (event: ReactPointerEvent<HTMLSpanElement>) => {\n const drag = dragRef.current;\n if (!drag || drag.pointerId !== event.pointerId) {\n return;\n }\n setWidth(\n applyWidths(\n drag.cells,\n drag.index,\n drag.selfStart,\n drag.neighbourStart,\n event.clientX - drag.startX,\n drag.minSelf,\n drag.minNeighbour,\n ),\n );\n };\n\n const onKeyDown = (event: ReactKeyboardEvent<HTMLSpanElement>) => {\n const step =\n event.key === 'ArrowLeft' ? -KEYBOARD_STEP : event.key === 'ArrowRight' ? KEYBOARD_STEP : 0;\n if (step === 0) {\n return;\n }\n const cell = event.currentTarget.closest('th');\n if (!(cell instanceof HTMLTableCellElement)) {\n return;\n }\n event.preventDefault();\n const cells = freezeColumns(cell);\n const index = cells.indexOf(cell);\n const neighbour = cells[index + 1] ?? null;\n setWidth(\n applyWidths(\n cells,\n index,\n cell.getBoundingClientRect().width,\n neighbour ? neighbour.getBoundingClientRect().width : null,\n step,\n minSelfOf(cells, index, minWidth),\n neighbour ? minWidthOf(neighbour, undefined) : 0,\n ),\n );\n };\n\n return (\n <span\n ref={handleRef}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={`${columnName || 'Column'} width${width === null ? '' : `, ${width} pixels`}`}\n tabIndex={0}\n className={styles.columnResizer}\n style={{ width: HANDLE_WIDTH, insetInlineEnd: -HANDLE_WIDTH / 2 }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={onKeyDown}\n />\n );\n}\n\n/*\n * Table has no Base UI primitive (registry/base-vega ships plain native\n * elements with data-slot markers, this kit drops data-slot everywhere —\n * see card.tsx) — pure styling translation over native `<table>` markup,\n * per design-notes.md: a composite data-table (sorting, filtering,\n * pagination, virtualisation, column defs) is deliberately out of scope\n * here. This is styled markup, nothing more.\n *\n * Table renders two elements, matching the source exactly: its own\n * scroll wrapper div around the <table>, rather than asking every consumer\n * to remember to add one. That wrapper is also the one to cap the table's\n * height with (`containerClassName` / `containerStyle`), not a div of the\n * consumer's own around <Table>: a sticky header sticks to its NEAREST\n * scrolling ancestor, and since the wrapper already scrolls horizontally it\n * is that ancestor. An outer div would scroll while the wrapper, having no\n * height of its own, never did, and the sticky header would scroll away\n * with the rows. `containerRef` reaches the same element for a caller that\n * measures it or drives its scroll.\n *\n * That wrapper is `tabIndex={0}`, a deliberate addition over the source,\n * which has none. A horizontally-overflowing region with no scrollbar\n * dragging alternative is otherwise unreachable from the keyboard (WCAG\n * 2.1.1) — a mouse/touch user can drag or swipe it, a keyboard-only user\n * cannot Tab to it and press the arrow keys, since a plain `div` isn't in\n * the tab order by default. This is unconditional rather than toggled on\n * only when the table actually overflows: detecting that needs a\n * ResizeObserver, which is exactly the behavior layer this \"primitive\n * markup\" component intentionally does not have. The trade-off is a table\n * that never overflows still gets one extra, functionless tab stop — minor\n * next to the alternative of a table that does overflow being silently\n * unreachable.\n *\n * A focus stop should announce something: `label` names the wrapper\n * (`role=\"region\"` + `aria-label` — a bare div's aria-label is ignored\n * without a role, which is also why wrapping the Table yourself and\n * labelling that wrapper doesn't work: the name lands on a non-focusable\n * element while the focusable one stays nameless). Without `label` the\n * wrapper stays roleless and nameless as before — prefer passing it\n * whenever the surrounding page doesn't already make the table's purpose\n * obvious the moment focus lands.\n */\nconst tableVariants = cva(styles.table, {\n variants: {\n /*\n * `collection` is the spec's own guide word for the dense arrangement:\n * a fixed layout with a sticky header and tall, wrapping rows. The\n * density axis below is orthogonal to it and still applies.\n */\n variant: {\n default: styles.variantDefault,\n collection: styles.variantCollection,\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport interface TableProps extends ComponentProps<'table'>, VariantProps<typeof tableVariants> {\n /**\n * Accessible name for the focusable scroll wrapper around the table\n * (`role=\"region\"` + `aria-label`). Announced when keyboard focus lands\n * on the wrapper; without it the stop announces nothing.\n */\n label?: string;\n /**\n * Cell metrics only — `compact` tightens row padding for operational\n * views (the mockups' Data Table density axis). Not a data-table\n * feature: no virtualization, no row model, purely the cells' padding.\n */\n density?: 'default' | 'compact';\n /**\n * className for the scroll wrapper around the table, merged after the\n * kit class. Give it a `max-height` to scroll the table vertically inside\n * the wrapper, which is what keeps a sticky header in place.\n */\n containerClassName?: string;\n /** Inline style for the same scroll wrapper, e.g. `{ maxHeight: 320 }`. */\n containerStyle?: CSSProperties;\n /**\n * Ref to the scroll wrapper `div`, for a caller that measures it or drives\n * its scroll position (`ref` itself lands on the `<table>`, as for every\n * other prop). Both a ref object and a callback ref work.\n */\n containerRef?: Ref<HTMLDivElement>;\n /**\n * Pins the header cells to the top of the scroll wrapper on an opaque\n * fill, so the rows scroll under them. Needs a bounded wrapper height\n * (`containerClassName` / `containerStyle`) to have anything to scroll\n * within. Independent of `variant`: it carries no layout, row height or\n * minimum width, only the pinning, and switches the table to separated\n * borders so the rule under the header stays with it.\n * @default false\n */\n stickyHeader?: boolean;\n}\n\nexport function Table({\n className,\n label,\n density,\n variant,\n containerClassName,\n containerStyle,\n containerRef,\n stickyHeader,\n ...props\n}: TableProps) {\n return (\n <div\n ref={containerRef}\n className={cx(styles.tableContainer, containerClassName)}\n style={containerStyle}\n tabIndex={0}\n role={label === undefined ? undefined : 'region'}\n aria-label={label}\n >\n <table\n className={tableVariants({\n variant,\n className: cx(\n density === 'compact' && styles.densityCompact,\n stickyHeader && styles.stickyHeader,\n className,\n ),\n })}\n {...props}\n />\n </div>\n );\n}\n\nexport type TableHeaderProps = ComponentProps<'thead'>;\n\nexport function TableHeader({ className, ...props }: TableHeaderProps) {\n return <thead className={cx(styles.tableHeader, className)} {...props} />;\n}\n\nexport type TableBodyProps = ComponentProps<'tbody'>;\n\nexport function TableBody({ className, ...props }: TableBodyProps) {\n return <tbody className={cx(styles.tableBody, className)} {...props} />;\n}\n\nexport type TableFooterProps = ComponentProps<'tfoot'>;\n\nexport function TableFooter({ className, ...props }: TableFooterProps) {\n return <tfoot className={cx(styles.tableFooter, className)} {...props} />;\n}\n\nexport type TableRowProps = ComponentProps<'tr'>;\n\nexport function TableRow({ className, ...props }: TableRowProps) {\n return <tr className={cx(styles.tableRow, className)} {...props} />;\n}\n\nexport interface TableHeadProps extends ComponentProps<'th'> {\n /**\n * Renders a draggable, keyboard-resizable handle on the column's trailing\n * edge. Off by default: the spec's own default is on, but turning it on\n * here would make every column of every shipped table draggable without\n * the caller asking for it.\n */\n resizable?: boolean;\n /**\n * Pixel floor for this column while resizing, overriding the 72 / 32\n * defaults (72 for a column carrying text, 32 for one that does not).\n */\n resizeMinWidth?: number;\n}\n\nexport function TableHead({\n className,\n resizable,\n resizeMinWidth,\n children,\n ...props\n}: TableHeadProps) {\n return (\n <th className={cx(styles.tableHead, className)} {...props}>\n {children}\n {resizable ? <TableColumnResizer minWidth={resizeMinWidth} /> : null}\n </th>\n );\n}\n\nexport type TableCellProps = ComponentProps<'td'>;\n\nexport function TableCell({ className, ...props }: TableCellProps) {\n return <td className={cx(styles.tableCell, className)} {...props} />;\n}\n\n/**\n * A table's accessible name/description, kept as a real semantic caption\n * regardless of where it's drawn — `.table`'s `caption-side: bottom` (see\n * table.module.css) only moves it visually below the rows; a `<caption>`\n * contributes to the table's accessibility tree the same way at either\n * position.\n */\nexport type TableCaptionProps = ComponentProps<'caption'>;\n\nexport function TableCaption({ className, ...props }: TableCaptionProps) {\n return <caption className={cx(styles.tableCaption, className)} {...props} />;\n}\n"],"names":["KEYBOARD_STEP","HANDLE_WIDTH","MIN_WIDTH_WITH_TEXT","MIN_WIDTH_WITHOUT_TEXT","headerCellsOf","cell","_a","child","minWidthOf","override","freezeColumns","cells","table","column","pinTableWidth","frozenWidthOf","sum","minSelfOf","index","self","own","tableFloor","others","applyWidths","selfStart","neighbourStart","delta","minSelf","minNeighbour","neighbour","ceiling","next","TableColumnResizer","minWidth","handleRef","useRef","dragRef","columnName","setColumnName","useState","width","setWidth","useEffect","_c","_b","lockPage","locked","capturePointer","handle","pointerId","capture","endDrag","useCallback","drag","onPointerDown","event","onPointerMove","onKeyDown","step","jsx","styles","tableVariants","cva","Table","className","label","density","variant","containerClassName","containerStyle","containerRef","stickyHeader","props","cx","TableHeader","TableBody","TableFooter","TableRow","TableHead","resizable","resizeMinWidth","children","jsxs","TableCell","TableCaption"],"mappings":";;;;;;;;;;;;;;;;;;;GAwBMA,IAAgB,IAEhBC,IAAe,GAEfC,IAAsB,IAEtBC,IAAyB;AAE/B,SAASC,EAAcC,GAAoD;;AACzE,SAAO,MAAM,OAAKC,IAAAD,EAAK,kBAAL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IO,SAASI,GAAY,EAAE,WAAAZ,GAAW,GAAGQ,KAA2B;AACrE,SAAO,gBAAAb,EAAC,WAAM,WAAWc,EAAGb,EAAO,aAAaI,CAAS,GAAI,GAAGQ,GAAO;AACzE;AAIO,SAASK,GAAS,EAAE,WAAAb,GAAW,GAAGQ,KAAwB;AAC/D,SAAO,gBAAAb,EAAC,QAAG,WAAWc,EAAGb,EAAO,UAAUI,CAAS,GAAI,GAAGQ,GAAO;AACnE;AAiBO,SAASM,GAAU;AAAA,EACxB,WAAAd;AAAA,EACA,WAAAe;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGT;AACL,GAAmB;AACjB,SACE,gBAAAU,EAAC,QAAG,WAAWT,EAAGb,EAAO,WAAWI,CAAS,GAAI,GAAGQ,GACjD,UAAA;AAAA,IAAAS;AAAA,IACAF,IAAY,gBAAApB,EAAC3B,GAAA,EAAmB,UAAUgD,GAAgB,IAAK;AAAA,EAAA,GAClE;AAEJ;AAIO,SAASG,GAAU,EAAE,WAAAnB,GAAW,GAAGQ,KAAyB;AACjE,SAAO,gBAAAb,EAAC,QAAG,WAAWc,EAAGb,EAAO,WAAWI,CAAS,GAAI,GAAGQ,GAAO;AACpE;AAWO,SAASY,GAAa,EAAE,WAAApB,GAAW,GAAGQ,KAA4B;AACvE,SAAO,gBAAAb,EAAC,aAAQ,WAAWc,EAAGb,EAAO,cAAcI,CAAS,GAAI,GAAGQ,GAAO;AAC5E;"}
|
|
1
|
+
{"version":3,"file":"table.js","sources":["../src/components/table/table.tsx"],"sourcesContent":["'use client';\n\nimport { cva, cx, type VariantProps } from 'class-variance-authority';\nimport {\n type ComponentProps,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type Ref,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport styles from './table.module.css';\n\n/*\n * Resize behaviour constants. These are not style values: they decide how\n * the drag RESPONDS, not how anything looks, so they live here rather than\n * as unexplained numbers in the stylesheet. All four are the design spec's\n * own.\n */\n/** How far one arrow-key press moves the boundary. */\nconst KEYBOARD_STEP = 12;\n/** The grab area straddling the column's trailing edge, half on each side. */\nconst HANDLE_WIDTH = 8;\n/** A column carrying text needs room for a word. */\nconst MIN_WIDTH_WITH_TEXT = 72;\n/** One carrying only a control (a checkbox, a row action) does not. */\nconst MIN_WIDTH_WITHOUT_TEXT = 32;\n\nfunction headerCellsOf(cell: HTMLTableCellElement): HTMLTableCellElement[] {\n return Array.from(cell.parentElement?.children ?? []).filter(\n (child): child is HTMLTableCellElement => child instanceof HTMLTableCellElement,\n );\n}\n\nfunction minWidthOf(cell: HTMLTableCellElement, override: number | undefined): number {\n if (override !== undefined) {\n return override;\n }\n return cell.textContent?.trim() ? MIN_WIDTH_WITH_TEXT : MIN_WIDTH_WITHOUT_TEXT;\n}\n\n/*\n * The first drag freezes every column at the width it currently renders and\n * switches the table to a fixed layout. Without that the browser keeps\n * re-deriving every column from its content, so widening one column silently\n * reflows the rest and the drag does not hold.\n */\nfunction freezeColumns(cell: HTMLTableCellElement): HTMLTableCellElement[] {\n const cells = headerCellsOf(cell);\n const table = cell.closest('table');\n if (table && table.style.tableLayout !== 'fixed') {\n for (const column of cells) {\n column.style.width = `${Math.round(column.getBoundingClientRect().width)}px`;\n }\n table.style.tableLayout = 'fixed';\n pinTableWidth(cells);\n }\n return cells;\n}\n\nfunction frozenWidthOf(cell: HTMLTableCellElement): number {\n return Number.parseFloat(cell.style.width) || 0;\n}\n\n/*\n * A fixed layout still stretches its columns to the table's own width, and\n * `.table` is `width: 100%`: left alone, whatever a column gives up is handed\n * straight back to the others, which is why the last column could never be\n * narrowed. Pinning the table to the sum of its frozen columns makes the\n * columns the only thing deciding its width, so it can end up narrower than\n * its container or wider than it (the wrapper then scrolls).\n */\nfunction pinTableWidth(cells: HTMLTableCellElement[]): void {\n const table = cells[0]?.closest('table');\n if (table) {\n table.style.width = `${cells.reduce((sum, column) => sum + frozenWidthOf(column), 0)}px`;\n }\n}\n\n/*\n * The floor a dragged column resizes against. Only the last column can\n * change the table's width, so only the last one also has to respect a\n * `min-width` on the table (the collection view's 960px): below that the\n * browser would widen the table back and spread the difference over every\n * column, and the width the handle announced would no longer be the one on\n * screen.\n */\nfunction minSelfOf(\n cells: HTMLTableCellElement[],\n index: number,\n override: number | undefined,\n widthOf: (cell: HTMLTableCellElement) => number = frozenWidthOf,\n): number {\n const self = cells[index];\n if (!self) {\n return 0;\n }\n const own = minWidthOf(self, override);\n const table = self.closest('table');\n if (index !== cells.length - 1 || !table) {\n return own;\n }\n const tableFloor = Number.parseFloat(getComputedStyle(table).minWidth);\n if (!Number.isFinite(tableFloor)) {\n return own;\n }\n const others = cells.slice(0, index).reduce((sum, column) => sum + widthOf(column), 0);\n return Math.max(own, Math.ceil(tableFloor - others));\n}\n\n/*\n * A column resizes against its TRAILING neighbour: the pair's combined width\n * is what stays constant, so dragging an inner boundary never changes the\n * table's own width. The last column has no neighbour to trade with, and\n * there the table's pinned width (see pinTableWidth) follows it in both\n * directions.\n */\nfunction applyWidths(\n cells: HTMLTableCellElement[],\n index: number,\n selfStart: number,\n neighbourStart: number | null,\n delta: number,\n minSelf: number,\n minNeighbour: number,\n): number {\n const self = cells[index];\n if (!self) {\n return selfStart;\n }\n const neighbour = neighbourStart === null ? null : cells[index + 1];\n const ceiling =\n neighbourStart === null || !neighbour\n ? Number.POSITIVE_INFINITY\n : selfStart + neighbourStart - minNeighbour;\n const next = Math.round(Math.min(Math.max(selfStart + delta, minSelf), ceiling));\n self.style.width = `${next}px`;\n if (neighbour && neighbourStart !== null) {\n neighbour.style.width = `${selfStart + neighbourStart - next}px`;\n }\n pinTableWidth(cells);\n return next;\n}\n\ninterface DragState {\n pointerId: number;\n startX: number;\n cells: HTMLTableCellElement[];\n index: number;\n selfStart: number;\n neighbourStart: number | null;\n minSelf: number;\n minNeighbour: number;\n}\n\ninterface TableColumnResizerProps {\n minWidth?: number;\n}\n\n/*\n * The trailing-edge resize handle. Rendered inside its own <th>, which is\n * what it measures and resizes; the geometry it needs from JS (the grab\n * width and its half-overhang) comes from HANDLE_WIDTH above, and the\n * hairline it draws is the stylesheet's.\n */\nfunction TableColumnResizer({ minWidth }: TableColumnResizerProps) {\n const handleRef = useRef<HTMLSpanElement>(null);\n const dragRef = useRef<DragState | null>(null);\n const [columnName, setColumnName] = useState('');\n const [width, setWidth] = useState<number | null>(null);\n // The column's width and its bounds as the handle reports them: a\n // focusable separator is a widget, and assistive technology reads its\n // value from aria-valuenow (axe `aria-required-attr` without it). Read at\n // mount and again whenever the handle takes focus, since dragging a\n // neighbour's handle changes this column too; `width` above takes over\n // while this handle resizes. The floor is the one the resize clamps to.\n const [bounds, setBounds] = useState<{ now: number; min: number; max: number } | null>(null);\n\n const measure = useCallback(() => {\n const cell = handleRef.current?.closest('th');\n if (!(cell instanceof HTMLTableCellElement)) {\n return;\n }\n const cells = headerCellsOf(cell);\n const now = Math.round(cell.getBoundingClientRect().width);\n // Before the first resize no column has an inline width yet, so the\n // floor reads each other column's rendered width, as the drag will once\n // it freezes them.\n const renderedWidthOf = (column: HTMLTableCellElement) =>\n frozenWidthOf(column) || column.getBoundingClientRect().width;\n setBounds({\n now,\n min: Math.round(minSelfOf(cells, cells.indexOf(cell), minWidth, renderedWidthOf)),\n max: Math.round(cell.closest('table')?.getBoundingClientRect().width ?? 0),\n });\n // A width already announced follows the column (a neighbour's drag may\n // have changed it); a focus that starts a drag keeps the drag's own.\n if (!dragRef.current) {\n setWidth((announced) => (announced === null ? null : now));\n }\n }, [minWidth]);\n\n useEffect(() => {\n setColumnName(handleRef.current?.closest('th')?.textContent?.trim() ?? '');\n measure();\n }, [measure]);\n\n // Kept inside [min, max]: a column the layout squeezed below its floor\n // reports its real width, and the minimum is lowered to it rather than\n // announced above the value.\n const valueNow = width ?? bounds?.now ?? 0;\n const valueMin = Math.min(bounds?.min ?? 0, valueNow);\n const valueMax = Math.max(bounds?.max ?? 0, valueNow);\n\n /*\n * The cursor and the text selection are locked for the DURATION of the\n * drag, not for the pointer's position: without it, dragging past the\n * handle turns the pointer back into a caret and starts selecting the\n * header labels it crosses.\n */\n const lockPage = (locked: boolean) => {\n document.body.style.cursor = locked ? 'col-resize' : '';\n document.body.style.userSelect = locked ? 'none' : '';\n };\n\n /*\n * Pointer capture is what keeps the drag alive once the pointer leaves\n * the 8px handle, but it is not what the drag depends on: a pointer id\n * the platform does not consider active throws, and the drag still has to\n * work. Both calls are therefore best-effort, and the drag's own state is\n * the ref above.\n */\n const capturePointer = (handle: HTMLSpanElement, pointerId: number, capture: boolean) => {\n try {\n if (capture) {\n handle.setPointerCapture(pointerId);\n } else if (handle.hasPointerCapture(pointerId)) {\n handle.releasePointerCapture(pointerId);\n }\n } catch {\n // No capture to take or give back; the drag is unaffected either way.\n }\n };\n\n /*\n * Only a drag this handle started may release the lock: the unmount\n * cleanup and a stray pointerup both land here, and clearing the body\n * styles unconditionally would wipe a cursor something else on the page\n * had set.\n */\n const endDrag = useCallback(() => {\n const drag = dragRef.current;\n if (!drag) {\n return;\n }\n dragRef.current = null;\n lockPage(false);\n const handle = handleRef.current;\n if (handle) {\n capturePointer(handle, drag.pointerId, false);\n }\n }, []);\n\n // Releases the lock if the header unmounts mid-drag: the page would\n // otherwise keep the resize cursor and the suppressed selection forever.\n useEffect(() => endDrag, [endDrag]);\n\n const onPointerDown = (event: ReactPointerEvent<HTMLSpanElement>) => {\n const cell = event.currentTarget.closest('th');\n if (!(cell instanceof HTMLTableCellElement) || event.button !== 0) {\n return;\n }\n const cells = freezeColumns(cell);\n const index = cells.indexOf(cell);\n const neighbour = cells[index + 1] ?? null;\n dragRef.current = {\n pointerId: event.pointerId,\n startX: event.clientX,\n cells,\n index,\n selfStart: cell.getBoundingClientRect().width,\n neighbourStart: neighbour ? neighbour.getBoundingClientRect().width : null,\n minSelf: minSelfOf(cells, index, minWidth),\n minNeighbour: neighbour ? minWidthOf(neighbour, undefined) : 0,\n };\n capturePointer(event.currentTarget, event.pointerId, true);\n lockPage(true);\n setWidth(Math.round(dragRef.current.selfStart));\n };\n\n const onPointerMove = (event: ReactPointerEvent<HTMLSpanElement>) => {\n const drag = dragRef.current;\n if (!drag || drag.pointerId !== event.pointerId) {\n return;\n }\n setWidth(\n applyWidths(\n drag.cells,\n drag.index,\n drag.selfStart,\n drag.neighbourStart,\n event.clientX - drag.startX,\n drag.minSelf,\n drag.minNeighbour,\n ),\n );\n };\n\n const onKeyDown = (event: ReactKeyboardEvent<HTMLSpanElement>) => {\n const step =\n event.key === 'ArrowLeft' ? -KEYBOARD_STEP : event.key === 'ArrowRight' ? KEYBOARD_STEP : 0;\n if (step === 0) {\n return;\n }\n const cell = event.currentTarget.closest('th');\n if (!(cell instanceof HTMLTableCellElement)) {\n return;\n }\n event.preventDefault();\n const cells = freezeColumns(cell);\n const index = cells.indexOf(cell);\n const neighbour = cells[index + 1] ?? null;\n setWidth(\n applyWidths(\n cells,\n index,\n cell.getBoundingClientRect().width,\n neighbour ? neighbour.getBoundingClientRect().width : null,\n step,\n minSelfOf(cells, index, minWidth),\n neighbour ? minWidthOf(neighbour, undefined) : 0,\n ),\n );\n };\n\n return (\n <span\n ref={handleRef}\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={`${columnName || 'Column'} width${width === null ? '' : `, ${width} pixels`}`}\n aria-valuenow={valueNow}\n aria-valuemin={valueMin}\n aria-valuemax={valueMax}\n onFocus={measure}\n tabIndex={0}\n className={styles.columnResizer}\n style={{ width: HANDLE_WIDTH, insetInlineEnd: -HANDLE_WIDTH / 2 }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={endDrag}\n onPointerCancel={endDrag}\n onKeyDown={onKeyDown}\n />\n );\n}\n\n/*\n * Table has no Base UI primitive (registry/base-vega ships plain native\n * elements with data-slot markers, this kit drops data-slot everywhere —\n * see card.tsx) — pure styling translation over native `<table>` markup,\n * per design-notes.md: a composite data-table (sorting, filtering,\n * pagination, virtualisation, column defs) is deliberately out of scope\n * here. This is styled markup, nothing more.\n *\n * Table renders two elements, matching the source exactly: its own\n * scroll wrapper div around the <table>, rather than asking every consumer\n * to remember to add one. That wrapper is also the one to cap the table's\n * height with (`containerClassName` / `containerStyle`), not a div of the\n * consumer's own around <Table>: a sticky header sticks to its NEAREST\n * scrolling ancestor, and since the wrapper already scrolls horizontally it\n * is that ancestor. An outer div would scroll while the wrapper, having no\n * height of its own, never did, and the sticky header would scroll away\n * with the rows. `containerRef` reaches the same element for a caller that\n * measures it or drives its scroll.\n *\n * That wrapper is `tabIndex={0}`, a deliberate addition over the source,\n * which has none. A horizontally-overflowing region with no scrollbar\n * dragging alternative is otherwise unreachable from the keyboard (WCAG\n * 2.1.1) — a mouse/touch user can drag or swipe it, a keyboard-only user\n * cannot Tab to it and press the arrow keys, since a plain `div` isn't in\n * the tab order by default. This is unconditional rather than toggled on\n * only when the table actually overflows: detecting that needs a\n * ResizeObserver, which is exactly the behavior layer this \"primitive\n * markup\" component intentionally does not have. The trade-off is a table\n * that never overflows still gets one extra, functionless tab stop — minor\n * next to the alternative of a table that does overflow being silently\n * unreachable.\n *\n * A focus stop should announce something: `label` names the wrapper\n * (`role=\"region\"` + `aria-label` — a bare div's aria-label is ignored\n * without a role, which is also why wrapping the Table yourself and\n * labelling that wrapper doesn't work: the name lands on a non-focusable\n * element while the focusable one stays nameless). Without `label` the\n * wrapper stays roleless and nameless as before — prefer passing it\n * whenever the surrounding page doesn't already make the table's purpose\n * obvious the moment focus lands.\n */\nconst tableVariants = cva(styles.table, {\n variants: {\n /*\n * `collection` is the spec's own guide word for the dense arrangement:\n * a fixed layout with a sticky header and tall, wrapping rows. The\n * density axis below is orthogonal to it and still applies.\n */\n variant: {\n default: styles.variantDefault,\n collection: styles.variantCollection,\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n});\n\nexport interface TableProps extends ComponentProps<'table'>, VariantProps<typeof tableVariants> {\n /**\n * Accessible name for the focusable scroll wrapper around the table\n * (`role=\"region\"` + `aria-label`). Announced when keyboard focus lands\n * on the wrapper; without it the stop announces nothing.\n */\n label?: string;\n /**\n * Cell metrics only — `compact` tightens row padding for operational\n * views (the mockups' Data Table density axis). Not a data-table\n * feature: no virtualization, no row model, purely the cells' padding.\n */\n density?: 'default' | 'compact';\n /**\n * className for the scroll wrapper around the table, merged after the\n * kit class. Give it a `max-height` to scroll the table vertically inside\n * the wrapper, which is what keeps a sticky header in place.\n */\n containerClassName?: string;\n /** Inline style for the same scroll wrapper, e.g. `{ maxHeight: 320 }`. */\n containerStyle?: CSSProperties;\n /**\n * Ref to the scroll wrapper `div`, for a caller that measures it or drives\n * its scroll position (`ref` itself lands on the `<table>`, as for every\n * other prop). Both a ref object and a callback ref work.\n */\n containerRef?: Ref<HTMLDivElement>;\n /**\n * Pins the header cells to the top of the scroll wrapper on an opaque\n * fill, so the rows scroll under them. Needs a bounded wrapper height\n * (`containerClassName` / `containerStyle`) to have anything to scroll\n * within. Independent of `variant`: it carries no layout, row height or\n * minimum width, only the pinning, and switches the table to separated\n * borders so the rule under the header stays with it.\n * @default false\n */\n stickyHeader?: boolean;\n}\n\nexport function Table({\n className,\n label,\n density,\n variant,\n containerClassName,\n containerStyle,\n containerRef,\n stickyHeader,\n ...props\n}: TableProps) {\n return (\n <div\n ref={containerRef}\n className={cx(styles.tableContainer, containerClassName)}\n style={containerStyle}\n tabIndex={0}\n role={label === undefined ? undefined : 'region'}\n aria-label={label}\n >\n <table\n className={tableVariants({\n variant,\n className: cx(\n density === 'compact' && styles.densityCompact,\n stickyHeader && styles.stickyHeader,\n className,\n ),\n })}\n {...props}\n />\n </div>\n );\n}\n\nexport type TableHeaderProps = ComponentProps<'thead'>;\n\nexport function TableHeader({ className, ...props }: TableHeaderProps) {\n return <thead className={cx(styles.tableHeader, className)} {...props} />;\n}\n\nexport type TableBodyProps = ComponentProps<'tbody'>;\n\nexport function TableBody({ className, ...props }: TableBodyProps) {\n return <tbody className={cx(styles.tableBody, className)} {...props} />;\n}\n\nexport type TableFooterProps = ComponentProps<'tfoot'>;\n\nexport function TableFooter({ className, ...props }: TableFooterProps) {\n return <tfoot className={cx(styles.tableFooter, className)} {...props} />;\n}\n\nexport type TableRowProps = ComponentProps<'tr'>;\n\nexport function TableRow({ className, ...props }: TableRowProps) {\n return <tr className={cx(styles.tableRow, className)} {...props} />;\n}\n\nexport interface TableHeadProps extends ComponentProps<'th'> {\n /**\n * Renders a draggable, keyboard-resizable handle on the column's trailing\n * edge. Off by default: the spec's own default is on, but turning it on\n * here would make every column of every shipped table draggable without\n * the caller asking for it.\n */\n resizable?: boolean;\n /**\n * Pixel floor for this column while resizing, overriding the 72 / 32\n * defaults (72 for a column carrying text, 32 for one that does not).\n */\n resizeMinWidth?: number;\n}\n\nexport function TableHead({\n className,\n resizable,\n resizeMinWidth,\n children,\n ...props\n}: TableHeadProps) {\n return (\n <th className={cx(styles.tableHead, className)} {...props}>\n {children}\n {resizable ? <TableColumnResizer minWidth={resizeMinWidth} /> : null}\n </th>\n );\n}\n\nexport type TableCellProps = ComponentProps<'td'>;\n\nexport function TableCell({ className, ...props }: TableCellProps) {\n return <td className={cx(styles.tableCell, className)} {...props} />;\n}\n\n/**\n * A table's accessible name/description, kept as a real semantic caption\n * regardless of where it's drawn — `.table`'s `caption-side: bottom` (see\n * table.module.css) only moves it visually below the rows; a `<caption>`\n * contributes to the table's accessibility tree the same way at either\n * position.\n */\nexport type TableCaptionProps = ComponentProps<'caption'>;\n\nexport function TableCaption({ className, ...props }: TableCaptionProps) {\n return <caption className={cx(styles.tableCaption, className)} {...props} />;\n}\n"],"names":["KEYBOARD_STEP","HANDLE_WIDTH","MIN_WIDTH_WITH_TEXT","MIN_WIDTH_WITHOUT_TEXT","headerCellsOf","cell","_a","child","minWidthOf","override","freezeColumns","cells","table","column","pinTableWidth","frozenWidthOf","sum","minSelfOf","index","widthOf","self","own","tableFloor","others","applyWidths","selfStart","neighbourStart","delta","minSelf","minNeighbour","neighbour","ceiling","next","TableColumnResizer","minWidth","handleRef","useRef","dragRef","columnName","setColumnName","useState","width","setWidth","bounds","setBounds","measure","useCallback","now","renderedWidthOf","_b","announced","useEffect","_c","valueNow","valueMin","valueMax","lockPage","locked","capturePointer","handle","pointerId","capture","endDrag","drag","onPointerDown","event","onPointerMove","onKeyDown","step","jsx","styles","tableVariants","cva","Table","className","label","density","variant","containerClassName","containerStyle","containerRef","stickyHeader","props","cx","TableHeader","TableBody","TableFooter","TableRow","TableHead","resizable","resizeMinWidth","children","jsxs","TableCell","TableCaption"],"mappings":";;;;;;;;;;;;;;;;;;;GAwBMA,IAAgB,IAEhBC,IAAe,GAEfC,KAAsB,IAEtBC,KAAyB;AAE/B,SAASC,EAAcC,GAAoD;;AACzE,SAAO,MAAM,OAAKC,IAAAD,EAAK,kBAAL,gBAAAC,EAAoB,aAAY,CAAA,CAAE,EAAE;AAAA,IACpD,CAACC,MAAyCA,aAAiB;AAAA,EAAA;AAE/D;AAEA,SAASC,EAAWH,GAA4BI,GAAsC;;AACpF,SAAIA,MAAa,SACRA,KAEFH,IAAAD,EAAK,gBAAL,QAAAC,EAAkB,SAASJ,KAAsBC;AAC1D;AAQA,SAASO,EAAcL,GAAoD;AACzE,QAAMM,IAAQP,EAAcC,CAAI,GAC1BO,IAAQP,EAAK,QAAQ,OAAO;AAClC,MAAIO,KAASA,EAAM,MAAM,gBAAgB,SAAS;AAChD,eAAWC,KAAUF;AACnB,MAAAE,EAAO,MAAM,QAAQ,GAAG,KAAK,MAAMA,EAAO,sBAAA,EAAwB,KAAK,CAAC;AAE1E,IAAAD,EAAM,MAAM,cAAc,SAC1BE,EAAcH,CAAK;AAAA,EACrB;AACA,SAAOA;AACT;AAEA,SAASI,EAAcV,GAAoC;AACzD,SAAO,OAAO,WAAWA,EAAK,MAAM,KAAK,KAAK;AAChD;AAUA,SAASS,EAAcH,GAAqC;;AAC1D,QAAMC,KAAQN,IAAAK,EAAM,CAAC,MAAP,gBAAAL,EAAU,QAAQ;AAChC,EAAIM,MACFA,EAAM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xs as _ } from "react/jsx-runtime";
|
|
2
2
|
import { Tabs as n } from "@base-ui/react/tabs";
|
|
3
3
|
import { cx as r, cva as l } from "class-variance-authority";
|
|
4
|
-
import './chunks/tabs.
|
|
4
|
+
import './chunks/tabs.BqhiMRUP.css';const u = "_tabs_4zxq0_32", f = "_list_4zxq0_31", z = "_trigger_4zxq0_25", m = "_content_4zxq0_32", d = "_sizeSm_4zxq0_92", v = "_sizeDefault_4zxq0_98", x = "_variantDefault_4zxq0_116", b = "_variantLine_4zxq0_131", g = "_indicator_4zxq0_284", t = {
|
|
5
5
|
tabs: u,
|
|
6
6
|
list: f,
|
|
7
|
-
trigger:
|
|
8
|
-
content:
|
|
9
|
-
sizeSm:
|
|
10
|
-
sizeDefault:
|
|
11
|
-
variantDefault:
|
|
12
|
-
variantLine:
|
|
13
|
-
indicator:
|
|
7
|
+
trigger: z,
|
|
8
|
+
content: m,
|
|
9
|
+
sizeSm: d,
|
|
10
|
+
sizeDefault: v,
|
|
11
|
+
variantDefault: x,
|
|
12
|
+
variantLine: b,
|
|
13
|
+
indicator: g
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function N({ className: a, ...i }) {
|
|
16
16
|
return /* @__PURE__ */ s(n.Root, { className: r(t.tabs, a), ...i });
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const q = l(t.list, {
|
|
19
19
|
variants: {
|
|
20
20
|
variant: {
|
|
21
21
|
default: t.variantDefault,
|
|
@@ -31,8 +31,8 @@ const D = l(t.list, {
|
|
|
31
31
|
size: "default"
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
function
|
|
35
|
-
return /* @__PURE__ */ _(n.List, { className:
|
|
34
|
+
function p({ className: a, variant: i, size: e, children: o, ...c }) {
|
|
35
|
+
return /* @__PURE__ */ _(n.List, { className: q({ variant: i, size: e, className: a }), ...c, children: [
|
|
36
36
|
o,
|
|
37
37
|
/* @__PURE__ */ s(n.Indicator, { className: t.indicator })
|
|
38
38
|
] });
|
|
@@ -51,9 +51,9 @@ function j({ className: a, animate: i = !0, ...e }) {
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
N as Tabs,
|
|
55
55
|
j as TabsContent,
|
|
56
|
-
|
|
56
|
+
p as TabsList,
|
|
57
57
|
S as TabsTrigger
|
|
58
58
|
};
|
|
59
59
|
//# sourceMappingURL=tabs.js.map
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/text/public.js'
|