@gears-frontx/ui-kit 0.4.0-alpha.4 → 0.4.0-alpha.5
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 +1 -1
- package/dist/accordion.js +7 -7
- package/dist/alert-dialog.js +21 -21
- package/dist/alert.js +19 -19
- package/dist/attachment.js +11 -11
- package/dist/avatar.js +33 -33
- package/dist/badge.js +48 -25
- package/dist/badge.js.map +1 -1
- package/dist/bubble.js +38 -38
- package/dist/button-group.js +8 -8
- package/dist/button.js +40 -34
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +30 -30
- package/dist/card.js +56 -33
- package/dist/card.js.map +1 -1
- package/dist/chart.js +89 -83
- package/dist/chart.js.map +1 -1
- package/dist/checkbox.js +12 -12
- package/dist/checkbox.js.map +1 -1
- package/dist/chunks/accordion.CXlSdkrc.css +1 -0
- package/dist/chunks/alert-dialog.C4aLtUC8.css +1 -0
- package/dist/chunks/alert.DsgRIXLn.css +1 -0
- package/dist/chunks/attachment.CZuZdlXC.css +1 -0
- package/dist/chunks/avatar.BMm-Z9l5.css +1 -0
- package/dist/chunks/badge.BCreEn3O.css +1 -0
- package/dist/chunks/bubble.Ccu0e3lY.css +1 -0
- package/dist/chunks/button-group.BB-_2uav.css +1 -0
- package/dist/chunks/button.DgUTlW0_.css +1 -0
- package/dist/chunks/calendar.Dtndav4F.css +1 -0
- package/dist/chunks/card.DdBl-usf.css +1 -0
- package/dist/chunks/checkbox.CrdIZhi1.css +1 -0
- package/dist/chunks/collapsible.BkLeBug_.css +1 -0
- package/dist/chunks/combobox.DZZ3tHP_.css +1 -0
- package/dist/chunks/command.BBW1Cy-M.css +1 -0
- package/dist/chunks/context-menu.D_HuTgqL.css +1 -0
- package/dist/chunks/data-table.DJJaM7bh.css +1 -0
- package/dist/chunks/dialog.Cpo8vChK.css +1 -0
- package/dist/chunks/drawer.D8l6-G8t.css +1 -0
- package/dist/chunks/dropdown-menu.TU3FHXbJ.css +1 -0
- package/dist/chunks/empty.DnAKlw2g.css +1 -0
- package/dist/chunks/field.CDoJmJUe.css +1 -0
- package/dist/chunks/hover-card.D00tbys5.css +1 -0
- package/dist/chunks/input-group.C7XgalVn.css +1 -0
- package/dist/chunks/input-otp.Dvxlngb4.css +1 -0
- package/dist/chunks/input.DORly3Cx.css +1 -0
- package/dist/chunks/{label.jrB9zD_G.css → label.s0Wrm1i-.css} +1 -1
- package/dist/chunks/{menubar.CxRNI9o4.css → menubar.CJcVQhPq.css} +1 -1
- package/dist/chunks/message.B9Rexp_f.css +1 -0
- package/dist/chunks/native-select.BosBdRAx.css +1 -0
- package/dist/chunks/navigation-menu.CuXMCPRN.css +1 -0
- package/dist/chunks/pagination.bFb5us_w.css +1 -0
- package/dist/chunks/popover.BYhwNKnZ.css +1 -0
- package/dist/chunks/progress.DjSEXfxh.css +1 -0
- package/dist/chunks/questionnaire.C-YTRjPE.css +1 -0
- package/dist/chunks/radio-group.CisvBT6g.css +1 -0
- package/dist/chunks/scroll-area.B0OVmDRX.css +1 -0
- package/dist/chunks/select.BFwI5rhI.css +1 -0
- package/dist/chunks/sheet.BWvXXyXk.css +1 -0
- package/dist/chunks/sidebar.DdEvMURX.css +1 -0
- package/dist/chunks/slider.inyNxx4y.css +1 -0
- package/dist/chunks/spinner.sH6x_1Uf.css +1 -0
- package/dist/chunks/status-dot.DWa2qGKe.css +1 -0
- package/dist/chunks/switch.D3_ZyuVP.css +1 -0
- package/dist/chunks/table.DR2nFT0x.css +1 -0
- package/dist/chunks/tabs.DFa0OYMo.css +1 -0
- package/dist/chunks/{textarea.ORRSI69B.css → textarea.DMphp0qh.css} +1 -1
- package/dist/chunks/toast.Dw-jW4YY.css +1 -0
- package/dist/chunks/toggle-group.BpWF6enM.css +1 -0
- package/dist/chunks/toggle.B82Id2zR.css +1 -0
- package/dist/chunks/tooltip.CFJyyz-O.css +1 -0
- package/dist/collapsible.js +7 -7
- package/dist/combobox.js +87 -87
- package/dist/command.js +28 -28
- package/dist/components/badge/badge.d.ts +5 -2
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +10 -4
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +9 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/dist/components/empty/empty.d.ts +11 -0
- package/dist/components/empty/empty.d.ts.map +1 -1
- package/dist/components/empty/public.d.ts +1 -1
- package/dist/components/empty/public.d.ts.map +1 -1
- package/dist/components/input-group/input-group.d.ts +5 -2
- package/dist/components/input-group/input-group.d.ts.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.d.ts +7 -2
- package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -1
- package/dist/components/pagination/pagination.d.ts +4 -6
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/popover/popover.d.ts +2 -2
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/spinner/spinner.d.ts +19 -3
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/status-dot/public.d.ts +2 -0
- package/dist/components/status-dot/public.d.ts.map +1 -0
- package/dist/components/status-dot/status-dot.d.ts +25 -0
- package/dist/components/status-dot/status-dot.d.ts.map +1 -0
- package/dist/components/table/table.d.ts +31 -5
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/tabs/tabs.d.ts +10 -2
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/toggle/toggle.d.ts +12 -2
- package/dist/components/toggle/toggle.d.ts.map +1 -1
- package/dist/components/toggle-group/toggle-group.d.ts +33 -4
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +5 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/context-menu.js +54 -54
- package/dist/data-table.js +41 -41
- package/dist/dialog.js +39 -39
- package/dist/docs/alert-dialog.md +1 -1
- package/dist/docs/avatar.md +3 -1
- package/dist/docs/badge.md +42 -14
- package/dist/docs/button.md +3 -2
- package/dist/docs/card.md +6 -0
- package/dist/docs/chart.md +20 -14
- package/dist/docs/checkbox.md +6 -0
- package/dist/docs/command.md +4 -0
- package/dist/docs/data-table.md +12 -7
- package/dist/docs/dialog.md +3 -2
- package/dist/docs/dropdown-menu.md +6 -0
- package/dist/docs/empty.md +44 -9
- package/dist/docs/input-group.md +23 -3
- package/dist/docs/navigation-menu.md +14 -5
- package/dist/docs/pagination.md +18 -15
- package/dist/docs/popover.md +6 -0
- package/dist/docs/progress.md +6 -0
- package/dist/docs/questionnaire.md +4 -2
- package/dist/docs/select.md +8 -4
- package/dist/docs/sheet.md +8 -7
- package/dist/docs/spinner.md +35 -5
- package/dist/docs/status-dot.md +77 -0
- package/dist/docs/table.md +69 -25
- package/dist/docs/tabs.md +22 -7
- package/dist/docs/toggle-group.md +68 -9
- package/dist/docs/toggle.md +7 -1
- package/dist/docs/tooltip.md +5 -9
- package/dist/drawer.js +53 -53
- package/dist/dropdown-menu.js +102 -89
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/empty.js +31 -21
- package/dist/empty.js.map +1 -1
- package/dist/field.js +24 -24
- package/dist/hover-card.js +14 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +266 -261
- package/dist/index.js.map +1 -1
- package/dist/input-group.js +73 -50
- package/dist/input-group.js.map +1 -1
- package/dist/input-otp.js +3 -3
- package/dist/input.js +19 -19
- package/dist/label.js +1 -1
- package/dist/menubar.js +18 -18
- package/dist/message.js +11 -11
- package/dist/native-select.js +20 -20
- package/dist/navigation-menu.js +83 -64
- package/dist/navigation-menu.js.map +1 -1
- package/dist/pagination.js +39 -52
- package/dist/pagination.js.map +1 -1
- package/dist/popover.js +33 -31
- package/dist/popover.js.map +1 -1
- package/dist/progress.js +15 -15
- package/dist/questionnaire.js +72 -72
- package/dist/radio-group.js +7 -7
- package/dist/scroll-area.js +8 -8
- package/dist/select.js +82 -80
- package/dist/select.js.map +1 -1
- package/dist/sheet.js +46 -46
- package/dist/sidebar.js +130 -130
- package/dist/slider.js +14 -14
- package/dist/spinner.js +45 -13
- package/dist/spinner.js.map +1 -1
- package/dist/status-dot.d.ts +1 -0
- package/dist/status-dot.js +76 -0
- package/dist/status-dot.js.map +1 -0
- package/dist/switch.js +14 -14
- package/dist/table.js +221 -43
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +44 -26
- package/dist/tabs.js.map +1 -1
- package/dist/textarea.js +5 -5
- package/dist/theme.css +222 -135
- package/dist/toast.js +26 -26
- package/dist/toggle-group.js +40 -25
- package/dist/toggle-group.js.map +1 -1
- package/dist/toggle.js +21 -11
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.js +37 -34
- package/dist/tooltip.js.map +1 -1
- package/llms.txt +26 -10
- package/package.json +1 -1
- package/dist/chunks/accordion.X_AK08Iv.css +0 -1
- package/dist/chunks/alert-dialog.B50f-Gsz.css +0 -1
- package/dist/chunks/alert.C5BedF7l.css +0 -1
- package/dist/chunks/attachment.GAZbWSyB.css +0 -1
- package/dist/chunks/avatar.DZUXl1ev.css +0 -1
- package/dist/chunks/badge.Bi22h20j.css +0 -1
- package/dist/chunks/bubble.DvN6QyQ1.css +0 -1
- package/dist/chunks/button-group.D0Ir-jbL.css +0 -1
- package/dist/chunks/button.DvAxXxKj.css +0 -1
- package/dist/chunks/calendar.Cnbv4EzY.css +0 -1
- package/dist/chunks/card.D3Ct_dza.css +0 -1
- package/dist/chunks/checkbox.CZfE_PkU.css +0 -1
- package/dist/chunks/collapsible.BQ-sU5sQ.css +0 -1
- package/dist/chunks/combobox.CtYpZAKB.css +0 -1
- package/dist/chunks/command.Km60IuqD.css +0 -1
- package/dist/chunks/context-menu.DwGCD0vN.css +0 -1
- package/dist/chunks/data-table.CtZdVSAU.css +0 -1
- package/dist/chunks/dialog.BxcZ12Gb.css +0 -1
- package/dist/chunks/drawer.BkS_qEHj.css +0 -1
- package/dist/chunks/dropdown-menu.C5TLD9JO.css +0 -1
- package/dist/chunks/empty.BlhsHrOz.css +0 -1
- package/dist/chunks/field.Ccqt897k.css +0 -1
- package/dist/chunks/hover-card.DmwvigMp.css +0 -1
- package/dist/chunks/input-group.CFIUP-Oh.css +0 -1
- package/dist/chunks/input-otp.XSpqyVij.css +0 -1
- package/dist/chunks/input.DvA_mTq8.css +0 -1
- package/dist/chunks/message.BhD5JDJK.css +0 -1
- package/dist/chunks/native-select.DF1QrNz4.css +0 -1
- package/dist/chunks/navigation-menu.C2JGHAKD.css +0 -1
- package/dist/chunks/pagination.DUiQuWla.css +0 -1
- package/dist/chunks/popover.fOvPrnsr.css +0 -1
- package/dist/chunks/progress.Bp13t8iw.css +0 -1
- package/dist/chunks/questionnaire.D-u_K3Co.css +0 -1
- package/dist/chunks/radio-group.CV3MBCsI.css +0 -1
- package/dist/chunks/scroll-area.C4kWMAsU.css +0 -1
- package/dist/chunks/select.iEwV-sfJ.css +0 -1
- package/dist/chunks/sheet.DALPg9vf.css +0 -1
- package/dist/chunks/sidebar.CGTQhfWG.css +0 -1
- package/dist/chunks/slider.B5nouD7J.css +0 -1
- package/dist/chunks/spinner.UKK4f1tu.css +0 -1
- package/dist/chunks/switch.CIW9Jr1x.css +0 -1
- package/dist/chunks/table.BpnQ6j85.css +0 -1
- package/dist/chunks/tabs.4MEFBvw-.css +0 -1
- package/dist/chunks/toast.uUtCEAiv.css +0 -1
- package/dist/chunks/toggle-group.Bd0cCCnV.css +0 -1
- package/dist/chunks/toggle.B9tvfl1n.css +0 -1
- package/dist/chunks/tooltip.apA3VWHJ.css +0 -1
package/dist/spinner.js
CHANGED
|
@@ -1,21 +1,53 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { cx as
|
|
3
|
-
import { LoaderCircleIcon as
|
|
4
|
-
import './chunks/spinner.
|
|
5
|
-
spinner:
|
|
1
|
+
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { cx as c } from "class-variance-authority";
|
|
3
|
+
import { LoaderCircleIcon as l } from "lucide-react";
|
|
4
|
+
import './chunks/spinner.sH6x_1Uf.css';const b = "_spinner_1q85o_6", v = "_block_1q85o_28", f = "_indicator_1q85o_44", x = "_label_1q85o_73", q = "_description_1q85o_85", i = {
|
|
5
|
+
spinner: b,
|
|
6
|
+
block: v,
|
|
7
|
+
indicator: f,
|
|
8
|
+
label: x,
|
|
9
|
+
description: q
|
|
6
10
|
};
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
function L({ className: a, label: n, description: s, compact: e, ...t }) {
|
|
12
|
+
if (!(r(n) || r(s)))
|
|
13
|
+
return /* @__PURE__ */ o(
|
|
14
|
+
l,
|
|
15
|
+
{
|
|
16
|
+
role: "status",
|
|
17
|
+
"aria-label": "Loading",
|
|
18
|
+
className: c(i.spinner, a),
|
|
19
|
+
...t,
|
|
20
|
+
"data-compact": e || void 0
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const d = Object.prototype.hasOwnProperty.call(t, "role"), { role: p, "aria-live": m, "aria-atomic": _, ...u } = t;
|
|
24
|
+
return /* @__PURE__ */ h(
|
|
25
|
+
"div",
|
|
10
26
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
className: i.block,
|
|
28
|
+
role: d ? p : "status",
|
|
29
|
+
"aria-live": m,
|
|
30
|
+
"aria-atomic": _,
|
|
31
|
+
"data-compact": e || void 0,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ o("span", { className: i.indicator, children: /* @__PURE__ */ o(
|
|
34
|
+
l,
|
|
35
|
+
{
|
|
36
|
+
className: c(i.spinner, a),
|
|
37
|
+
...u,
|
|
38
|
+
"aria-hidden": "true"
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
r(n) ? /* @__PURE__ */ o("span", { className: i.label, children: n }) : null,
|
|
42
|
+
r(s) ? /* @__PURE__ */ o("span", { className: i.description, children: s }) : null
|
|
43
|
+
]
|
|
15
44
|
}
|
|
16
45
|
);
|
|
17
46
|
}
|
|
47
|
+
function r(a) {
|
|
48
|
+
return a != null && a !== !1 && a !== "";
|
|
49
|
+
}
|
|
18
50
|
export {
|
|
19
|
-
|
|
51
|
+
L as Spinner
|
|
20
52
|
};
|
|
21
53
|
//# sourceMappingURL=spinner.js.map
|
package/dist/spinner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","sources":["../src/components/spinner/spinner.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { LoaderCircleIcon } from 'lucide-react';\nimport type { ComponentProps } from 'react';\n\nimport styles from './spinner.module.css';\n\n/*\n * Spinner has no Base UI primitive (registry/bases/base/ui/spinner.tsx\n * renders `Loader2Icon` styled `size-4 animate-spin` — lucide's legacy\n * alias for `loader-circle`, spelled canonically here) and no\n * variant axis — a pure styling translation, same shape as Skeleton (no\n * cva, just one class). `animate-spin` is reproduced as this module's own\n * `spin` keyframe (see spinner.module.css).\n *\n * `role=\"status\"` + `aria-label` also suppress lucide's default\n * `aria-hidden=\"true\"`: this icon IS the loading announcement, not decoration.\n */\nexport
|
|
1
|
+
{"version":3,"file":"spinner.js","sources":["../src/components/spinner/spinner.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { LoaderCircleIcon } from 'lucide-react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport styles from './spinner.module.css';\n\n/*\n * Spinner has no Base UI primitive (registry/bases/base/ui/spinner.tsx\n * renders `Loader2Icon` styled `size-4 animate-spin` — lucide's legacy\n * alias for `loader-circle`, spelled canonically here) and no\n * variant axis — a pure styling translation, same shape as Skeleton (no\n * cva, just one class). `animate-spin` is reproduced as this module's own\n * `spin` keyframe (see spinner.module.css).\n *\n * `role=\"status\"` + `aria-label` also suppress lucide's default\n * `aria-hidden=\"true\"`: this icon IS the loading announcement, not decoration.\n *\n * Two shapes, one component. Bare, it is that icon and nothing else, at\n * the kit's small icon step. Given a `label` or a `description`, it\n * becomes the drawn loading block: the glyph centred in an indicator box\n * with its text beneath. The wrapper is then the live region and the\n * glyph turns decorative, so the announcement is the text a reader can\n * also see, rather than a second hardcoded \"Loading\".\n *\n * Props stay the indicator `<svg>`'s at both shapes, `className`\n * included - the layout block the kit adds around it is the kit's, not a\n * second element to configure. A caller who needs to place the whole\n * block wraps it themselves.\n */\nexport interface SpinnerProps extends ComponentProps<'svg'> {\n /**\n * The state, written under the indicator in the drawn micro type. Its\n * presence is what turns the spinner into the composed block, and it\n * becomes the announcement in place of the default \"Loading\".\n */\n label?: ReactNode;\n /** A second line under the label: what is being waited on, or how long\n * it usually takes. Announced with the label. */\n description?: ReactNode;\n /**\n * The drawn tighter block: a 28 indicator around a 14 glyph instead of\n * 36 around 18. On a bare spinner it takes the glyph to that same 14.\n * @default false\n */\n compact?: boolean;\n}\n\nexport function Spinner({ className, label, description, compact, ...props }: SpinnerProps) {\n // Both `false` and `null` are ReactNodes that render nothing, and\n // `label={busy && 'Saving'}` passes one whenever `busy` is false. They\n // must land on the bare shape, not produce an empty live region.\n const hasText = isPresent(label) || isPresent(description);\n\n if (!hasText) {\n return (\n <LoaderCircleIcon\n role=\"status\"\n aria-label=\"Loading\"\n className={cx(styles.spinner, className)}\n {...props}\n data-compact={compact || undefined}\n />\n );\n }\n\n // The block is the live region now, so a consumer-passed `role` (and\n // `aria-live`/`aria-atomic`, if passed) must land here, not on the\n // glyph below - it lets a labelled Spinner nested in another live\n // region opt out with `role={undefined}` or `role=\"presentation\"` to\n // avoid a duplicate announcement, instead of always adding a second one.\n // An own-property check (not a destructuring default) so an explicit\n // `role={undefined}` is still honored as \"no role\", rather than falling\n // back to \"status\". `hasOwnProperty.call`, not `Object.hasOwn` - the root\n // tsconfig's host type-check runs packages/*/src against an ES2020 lib.\n const hasRole = Object.prototype.hasOwnProperty.call(props, 'role');\n const { role, 'aria-live': ariaLive, 'aria-atomic': ariaAtomic, ...svgProps } = props;\n\n return (\n <div\n className={styles.block}\n role={hasRole ? role : 'status'}\n aria-live={ariaLive}\n aria-atomic={ariaAtomic}\n data-compact={compact || undefined}\n >\n <span className={styles.indicator}>\n <LoaderCircleIcon\n className={cx(styles.spinner, className)}\n {...svgProps}\n // After `...svgProps`: the block above is the live region now, so\n // the glyph must be decorative whatever the caller passed.\n aria-hidden=\"true\"\n />\n </span>\n {isPresent(label) ? <span className={styles.label}>{label}</span> : null}\n {isPresent(description) ? <span className={styles.description}>{description}</span> : null}\n </div>\n );\n}\n\nfunction isPresent(node: ReactNode): boolean {\n return node !== undefined && node !== null && node !== false && node !== '';\n}\n"],"names":["Spinner","className","label","description","compact","props","isPresent","jsx","LoaderCircleIcon","cx","styles","hasRole","role","ariaLive","ariaAtomic","svgProps","jsxs","node"],"mappings":";;;;;;;;;;AA+CO,SAASA,EAAQ,EAAE,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,SAAAC,GAAS,GAAGC,KAAuB;AAM1F,MAAI,EAFYC,EAAUJ,CAAK,KAAKI,EAAUH,CAAW;AAGvD,WACE,gBAAAI;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAW;AAAA,QACX,WAAWC,EAAGC,EAAO,SAAST,CAAS;AAAA,QACtC,GAAGI;AAAA,QACJ,gBAAcD,KAAW;AAAA,MAAA;AAAA,IAAA;AAc/B,QAAMO,IAAU,OAAO,UAAU,eAAe,KAAKN,GAAO,MAAM,GAC5D,EAAE,MAAAO,GAAM,aAAaC,GAAU,eAAeC,GAAY,GAAGC,MAAaV;AAEhF,SACE,gBAAAW;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWN,EAAO;AAAA,MAClB,MAAMC,IAAUC,IAAO;AAAA,MACvB,aAAWC;AAAA,MACX,eAAaC;AAAA,MACb,gBAAcV,KAAW;AAAA,MAEzB,UAAA;AAAA,QAAA,gBAAAG,EAAC,QAAA,EAAK,WAAWG,EAAO,WACtB,UAAA,gBAAAH;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,WAAWC,EAAGC,EAAO,SAAST,CAAS;AAAA,YACtC,GAAGc;AAAA,YAGJ,eAAY;AAAA,UAAA;AAAA,QAAA,GAEhB;AAAA,QACCT,EAAUJ,CAAK,IAAI,gBAAAK,EAAC,UAAK,WAAWG,EAAO,OAAQ,UAAAR,EAAA,CAAM,IAAU;AAAA,QACnEI,EAAUH,CAAW,IAAI,gBAAAI,EAAC,UAAK,WAAWG,EAAO,aAAc,UAAAP,EAAA,CAAY,IAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG5F;AAEA,SAASG,EAAUW,GAA0B;AAC3C,SAA6BA,KAAS,QAAQA,MAAS,MAASA,MAAS;AAC3E;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/status-dot/public.js'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, Fragment as _, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps as m } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender as f } from "@base-ui/react/use-render";
|
|
5
|
+
import { cva as g } from "class-variance-authority";
|
|
6
|
+
import './chunks/status-dot.DWa2qGKe.css';const j = "_statusDot_7u3jo_13", v = "_dot_7u3jo_35", D = "_label_7u3jo_45", N = "_toneNeutral_7u3jo_49", p = "_toneSuccess_7u3jo_53", h = "_toneWarning_7u3jo_57", S = "_toneDanger_7u3jo_61", b = "_toneInfo_7u3jo_65", t = {
|
|
7
|
+
statusDot: j,
|
|
8
|
+
dot: v,
|
|
9
|
+
label: D,
|
|
10
|
+
toneNeutral: N,
|
|
11
|
+
toneSuccess: p,
|
|
12
|
+
toneWarning: h,
|
|
13
|
+
toneDanger: S,
|
|
14
|
+
toneInfo: b
|
|
15
|
+
}, I = g(t.statusDot, {
|
|
16
|
+
variants: {
|
|
17
|
+
tone: {
|
|
18
|
+
neutral: t.toneNeutral,
|
|
19
|
+
success: t.toneSuccess,
|
|
20
|
+
warning: t.toneWarning,
|
|
21
|
+
danger: t.toneDanger,
|
|
22
|
+
info: t.toneInfo
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
tone: "neutral"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
function V({
|
|
30
|
+
className: u,
|
|
31
|
+
tone: c,
|
|
32
|
+
label: n,
|
|
33
|
+
live: l = !1,
|
|
34
|
+
render: i,
|
|
35
|
+
...o
|
|
36
|
+
}) {
|
|
37
|
+
const a = c ?? "neutral", e = n != null && n !== !1 && n !== "", s = o["aria-label"] !== void 0 || o["aria-labelledby"] !== void 0;
|
|
38
|
+
return f({
|
|
39
|
+
defaultTagName: "span",
|
|
40
|
+
render: i,
|
|
41
|
+
// `data-tone`/`data-live` are layered on AFTER mergeProps, not passed
|
|
42
|
+
// through it: mergeProps types its own object literal as the closed
|
|
43
|
+
// DOM attribute set for the tag, which rejects a `data-*` key - the
|
|
44
|
+
// same shadow-proofing marker.tsx's `data-variant` needs.
|
|
45
|
+
props: {
|
|
46
|
+
...m(
|
|
47
|
+
{
|
|
48
|
+
className: I({ tone: a, className: u }),
|
|
49
|
+
/*
|
|
50
|
+
* A bare dot carries no text, so it announces as nothing: hide
|
|
51
|
+
* it from assistive tech unless the caller gave it a name of
|
|
52
|
+
* its own. `role="img"` is what makes that name reach the tree
|
|
53
|
+
* at all - an `aria-label` on a plain generic span is ignored
|
|
54
|
+
* by most screen readers. With a visible label neither is
|
|
55
|
+
* needed: the label IS the announcement. Both stay overridable
|
|
56
|
+
* - `props`, merged after, wins whenever the caller sets one.
|
|
57
|
+
*/
|
|
58
|
+
role: !e && s ? "img" : void 0,
|
|
59
|
+
"aria-hidden": !e && !s ? !0 : void 0,
|
|
60
|
+
children: /* @__PURE__ */ d(_, { children: [
|
|
61
|
+
/* @__PURE__ */ r("span", { className: t.dot }),
|
|
62
|
+
e ? /* @__PURE__ */ r("span", { className: t.label, children: n }) : null
|
|
63
|
+
] })
|
|
64
|
+
},
|
|
65
|
+
o
|
|
66
|
+
),
|
|
67
|
+
"data-tone": a,
|
|
68
|
+
"data-live": l || void 0
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
V as StatusDot,
|
|
74
|
+
I as statusDotVariants
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=status-dot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-dot.js","sources":["../src/components/status-dot/status-dot.tsx"],"sourcesContent":["'use client';\n\nimport { mergeProps } from '@base-ui/react/merge-props';\nimport { useRender } from '@base-ui/react/use-render';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport type { ReactNode } from 'react';\n\nimport styles from './status-dot.module.css';\n\n/*\n * An inline status indicator: a round dot plus an optional label, both in\n * the tone's own colour. No Base UI primitive, but it still gets\n * `render`-prop polymorphism from `useRender`/`mergeProps` - the same\n * utilities Badge and Marker use - for the case a consumer needs the dot\n * as something other than a `span`, e.g. an `<li>` in a status list. That\n * is layout, not action: the design spec still draws this as text plus a\n * decorative dot, \"never colour-only or styled as an action\" - Badge is\n * the part that turns into a link, and Marker the one that turns into a\n * row.\n *\n * The tone drives `color` alone; the dot paints itself from\n * `currentColor`, so dot and label can never disagree about the tone. Same\n * mechanism Badge's own dot already uses (see badge.module.css).\n */\nconst statusDotVariants = cva(styles.statusDot, {\n variants: {\n tone: {\n neutral: styles.toneNeutral,\n success: styles.toneSuccess,\n warning: styles.toneWarning,\n danger: styles.toneDanger,\n info: styles.toneInfo,\n },\n },\n defaultVariants: {\n tone: 'neutral',\n },\n});\n\nexport interface StatusDotProps\n extends Omit<useRender.ComponentProps<'span'>, 'children'>,\n VariantProps<typeof statusDotVariants> {\n /**\n * The text beside the dot. Omit it for a dot on its own - a table cell\n * or a dense row where the surrounding column already says what the\n * status means.\n */\n label?: ReactNode;\n /**\n * Marks a status that is still moving (a running job, a live\n * connection): the dot breathes on a 2s opacity cycle, and the root\n * carries `data-live` for a consumer to hook. Off under\n * `prefers-reduced-motion`.\n * @default false\n */\n live?: boolean;\n}\n\nexport function StatusDot({\n className,\n tone,\n label,\n live = false,\n render,\n ...props\n}: StatusDotProps) {\n // cva types `tone` as `| null` (an explicit `tone={null}` resets to the\n // default), which a default parameter absorbs only for `undefined`. cva\n // reads that null as \"emit no tone class\", while React would drop a null\n // `data-tone` - so the dot would come out with neither. Resolved once\n // here, the same fix marker.tsx and item.tsx already carry.\n const resolvedTone = tone ?? 'neutral';\n // `false`/`null`/`undefined` are all valid ReactNodes that render\n // nothing, and `label={busy && 'Running'}` passes one whenever `busy` is\n // false. Treating those as \"no label\" keeps the accessible-name branch\n // below honest instead of announcing an empty string.\n const hasLabel = label !== undefined && label !== null && label !== false && label !== '';\n const named = props['aria-label'] !== undefined || props['aria-labelledby'] !== undefined;\n return useRender({\n defaultTagName: 'span',\n render,\n // `data-tone`/`data-live` are layered on AFTER mergeProps, not passed\n // through it: mergeProps types its own object literal as the closed\n // DOM attribute set for the tag, which rejects a `data-*` key - the\n // same shadow-proofing marker.tsx's `data-variant` needs.\n props: {\n ...mergeProps<'span'>(\n {\n className: statusDotVariants({ tone: resolvedTone, className }),\n /*\n * A bare dot carries no text, so it announces as nothing: hide\n * it from assistive tech unless the caller gave it a name of\n * its own. `role=\"img\"` is what makes that name reach the tree\n * at all - an `aria-label` on a plain generic span is ignored\n * by most screen readers. With a visible label neither is\n * needed: the label IS the announcement. Both stay overridable\n * - `props`, merged after, wins whenever the caller sets one.\n */\n role: !hasLabel && named ? 'img' : undefined,\n 'aria-hidden': !hasLabel && !named ? true : undefined,\n children: (\n <>\n <span className={styles.dot} />\n {hasLabel ? <span className={styles.label}>{label}</span> : null}\n </>\n ),\n },\n props,\n ),\n 'data-tone': resolvedTone,\n 'data-live': live || undefined,\n },\n });\n}\n\nexport { statusDotVariants };\n"],"names":["statusDotVariants","cva","styles","StatusDot","className","tone","label","live","render","props","resolvedTone","hasLabel","named","useRender","mergeProps","jsxs","Fragment","jsx"],"mappings":";;;;;;;;;;;;;;GAwBMA,IAAoBC,EAAIC,EAAO,WAAW;AAAA,EAC9C,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,SAASA,EAAO;AAAA,MAChB,SAASA,EAAO;AAAA,MAChB,SAASA,EAAO;AAAA,MAChB,QAAQA,EAAO;AAAA,MACf,MAAMA,EAAO;AAAA,IAAA;AAAA,EACf;AAAA,EAEF,iBAAiB;AAAA,IACf,MAAM;AAAA,EAAA;AAEV,CAAC;AAqBM,SAASC,EAAU;AAAA,EACxB,WAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAC;AAAA,EACA,GAAGC;AACL,GAAmB;AAMjB,QAAMC,IAAeL,KAAQ,WAKvBM,IAAkCL,KAAU,QAAQA,MAAU,MAASA,MAAU,IACjFM,IAAQH,EAAM,YAAY,MAAM,UAAaA,EAAM,iBAAiB,MAAM;AAChF,SAAOI,EAAU;AAAA,IACf,gBAAgB;AAAA,IAChB,QAAAL;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA,MACL,GAAGM;AAAA,QACD;AAAA,UACE,WAAWd,EAAkB,EAAE,MAAMU,GAAc,WAAAN,GAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAU9D,MAAM,CAACO,KAAYC,IAAQ,QAAQ;AAAA,UACnC,eAAe,CAACD,KAAY,CAACC,IAAQ,KAAO;AAAA,UAC5C,UACE,gBAAAG,EAAAC,GAAA,EACE,UAAA;AAAA,YAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWf,EAAO,IAAA,CAAK;AAAA,YAC5BS,IAAW,gBAAAM,EAAC,QAAA,EAAK,WAAWf,EAAO,OAAQ,aAAM,IAAU;AAAA,UAAA,EAAA,CAC9D;AAAA,QAAA;AAAA,QAGJO;AAAA,MAAA;AAAA,MAEF,aAAaC;AAAA,MACb,aAAaH,KAAQ;AAAA,IAAA;AAAA,EACvB,CACD;AACH;"}
|
package/dist/switch.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Switch as
|
|
3
|
-
import { cva as
|
|
4
|
-
import './chunks/switch.
|
|
5
|
-
switch: "
|
|
6
|
-
sizeDefault:
|
|
7
|
-
sizeSm:
|
|
8
|
-
thumb:
|
|
9
|
-
},
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Switch as e } from "@base-ui/react/switch";
|
|
3
|
+
import { cva as m } from "class-variance-authority";
|
|
4
|
+
import './chunks/switch.D3_ZyuVP.css';const o = "_sizeDefault_1cp3e_10", u = "_sizeSm_1cp3e_10", h = "_thumb_1cp3e_87", t = {
|
|
5
|
+
switch: "_switch_1cp3e_6",
|
|
6
|
+
sizeDefault: o,
|
|
7
|
+
sizeSm: u,
|
|
8
|
+
thumb: h
|
|
9
|
+
}, r = m(t.switch, {
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
|
-
default:
|
|
13
|
-
sm:
|
|
12
|
+
default: t.sizeDefault,
|
|
13
|
+
sm: t.sizeSm
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
defaultVariants: {
|
|
17
17
|
size: "default"
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
function
|
|
21
|
-
return /* @__PURE__ */
|
|
20
|
+
function l({ className: i, size: c, ...a }) {
|
|
21
|
+
return /* @__PURE__ */ s(e.Root, { className: r({ size: c, className: i }), ...a, children: /* @__PURE__ */ s(e.Thumb, { className: t.thumb }) });
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
|
-
|
|
24
|
+
l as Switch
|
|
25
25
|
};
|
|
26
26
|
//# sourceMappingURL=switch.js.map
|
package/dist/table.js
CHANGED
|
@@ -1,63 +1,241 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as u, jsxs as P } from "react/jsx-runtime";
|
|
3
|
+
import { cx as f, cva as W } from "class-variance-authority";
|
|
4
|
+
import { useRef as g, useState as N, useEffect as w, useCallback as F } from "react";
|
|
5
|
+
import './chunks/table.DR2nFT0x.css';const O = "_tableContainer_1h458_8", z = "_table_1h458_8", L = "_tableRow_1h458_84", $ = "_tableBody_1h458_101", S = "_tableHead_1h458_69", X = "_columnResizer_1h458_229", A = "_tableCell_1h458_273", k = "_variantDefault_1h458_335", V = "_variantCollection_1h458_339", j = "_densityCompact_1h458_409", K = "_tableCaption_1h458_418", U = "_tableFooter_1h458_440", s = {
|
|
6
|
+
tableContainer: O,
|
|
7
|
+
table: z,
|
|
8
|
+
tableRow: L,
|
|
9
|
+
tableBody: $,
|
|
10
|
+
tableHead: S,
|
|
11
|
+
columnResizer: X,
|
|
12
|
+
tableCell: A,
|
|
13
|
+
variantDefault: k,
|
|
14
|
+
variantCollection: V,
|
|
15
|
+
densityCompact: j,
|
|
16
|
+
tableCaption: K,
|
|
17
|
+
tableFooter: U
|
|
18
|
+
}, x = 12, R = 8, Y = 72, q = 32;
|
|
19
|
+
function G(e) {
|
|
20
|
+
var t;
|
|
21
|
+
return Array.from(((t = e.parentElement) == null ? void 0 : t.children) ?? []).filter(
|
|
22
|
+
(n) => n instanceof HTMLTableCellElement
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function T(e, t) {
|
|
26
|
+
var n;
|
|
27
|
+
return t !== void 0 ? t : (n = e.textContent) != null && n.trim() ? Y : q;
|
|
28
|
+
}
|
|
29
|
+
function I(e) {
|
|
30
|
+
const t = G(e), n = e.closest("table");
|
|
31
|
+
if (n && n.style.tableLayout !== "fixed") {
|
|
32
|
+
for (const a of t)
|
|
33
|
+
a.style.width = `${Math.round(a.getBoundingClientRect().width)}px`;
|
|
34
|
+
n.style.tableLayout = "fixed", E(t);
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
}
|
|
38
|
+
function M(e) {
|
|
39
|
+
return Number.parseFloat(e.style.width) || 0;
|
|
40
|
+
}
|
|
41
|
+
function E(e) {
|
|
42
|
+
var n;
|
|
43
|
+
const t = (n = e[0]) == null ? void 0 : n.closest("table");
|
|
44
|
+
t && (t.style.width = `${e.reduce((a, i) => a + M(i), 0)}px`);
|
|
45
|
+
}
|
|
46
|
+
function H(e, t, n) {
|
|
47
|
+
const a = e[t];
|
|
48
|
+
if (!a)
|
|
49
|
+
return 0;
|
|
50
|
+
const i = T(a, n), d = a.closest("table");
|
|
51
|
+
if (t !== e.length - 1 || !d)
|
|
52
|
+
return i;
|
|
53
|
+
const c = Number.parseFloat(getComputedStyle(d).minWidth);
|
|
54
|
+
if (!Number.isFinite(c))
|
|
55
|
+
return i;
|
|
56
|
+
const C = e.slice(0, t).reduce((b, m) => b + M(m), 0);
|
|
57
|
+
return Math.max(i, Math.ceil(c - C));
|
|
58
|
+
}
|
|
59
|
+
function D(e, t, n, a, i, d, c) {
|
|
60
|
+
const C = e[t];
|
|
61
|
+
if (!C)
|
|
62
|
+
return n;
|
|
63
|
+
const b = a === null ? null : e[t + 1], m = a === null || !b ? Number.POSITIVE_INFINITY : n + a - c, p = Math.round(Math.min(Math.max(n + i, d), m));
|
|
64
|
+
return C.style.width = `${p}px`, b && a !== null && (b.style.width = `${n + a - p}px`), E(e), p;
|
|
65
|
+
}
|
|
66
|
+
function J({ minWidth: e }) {
|
|
67
|
+
const t = g(null), n = g(null), [a, i] = N(""), [d, c] = N(null);
|
|
68
|
+
w(() => {
|
|
69
|
+
var o, l, r;
|
|
70
|
+
i(((r = (l = (o = t.current) == null ? void 0 : o.closest("th")) == null ? void 0 : l.textContent) == null ? void 0 : r.trim()) ?? "");
|
|
71
|
+
}, []);
|
|
72
|
+
const C = (o) => {
|
|
73
|
+
document.body.style.cursor = o ? "col-resize" : "", document.body.style.userSelect = o ? "none" : "";
|
|
74
|
+
}, b = (o, l, r) => {
|
|
75
|
+
try {
|
|
76
|
+
r ? o.setPointerCapture(l) : o.hasPointerCapture(l) && o.releasePointerCapture(l);
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
}, m = F(() => {
|
|
80
|
+
const o = n.current;
|
|
81
|
+
if (!o)
|
|
82
|
+
return;
|
|
83
|
+
n.current = null, C(!1);
|
|
84
|
+
const l = t.current;
|
|
85
|
+
l && b(l, o.pointerId, !1);
|
|
86
|
+
}, []);
|
|
87
|
+
w(() => m, [m]);
|
|
88
|
+
const p = (o) => {
|
|
89
|
+
const l = o.currentTarget.closest("th");
|
|
90
|
+
if (!(l instanceof HTMLTableCellElement) || o.button !== 0)
|
|
91
|
+
return;
|
|
92
|
+
const r = I(l), h = r.indexOf(l), _ = r[h + 1] ?? null;
|
|
93
|
+
n.current = {
|
|
94
|
+
pointerId: o.pointerId,
|
|
95
|
+
startX: o.clientX,
|
|
96
|
+
cells: r,
|
|
97
|
+
index: h,
|
|
98
|
+
selfStart: l.getBoundingClientRect().width,
|
|
99
|
+
neighbourStart: _ ? _.getBoundingClientRect().width : null,
|
|
100
|
+
minSelf: H(r, h, e),
|
|
101
|
+
minNeighbour: _ ? T(_, void 0) : 0
|
|
102
|
+
}, b(o.currentTarget, o.pointerId, !0), C(!0), c(Math.round(n.current.selfStart));
|
|
103
|
+
}, v = (o) => {
|
|
104
|
+
const l = n.current;
|
|
105
|
+
!l || l.pointerId !== o.pointerId || c(
|
|
106
|
+
D(
|
|
107
|
+
l.cells,
|
|
108
|
+
l.index,
|
|
109
|
+
l.selfStart,
|
|
110
|
+
l.neighbourStart,
|
|
111
|
+
o.clientX - l.startX,
|
|
112
|
+
l.minSelf,
|
|
113
|
+
l.minNeighbour
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}, B = (o) => {
|
|
117
|
+
const l = o.key === "ArrowLeft" ? -x : o.key === "ArrowRight" ? x : 0;
|
|
118
|
+
if (l === 0)
|
|
119
|
+
return;
|
|
120
|
+
const r = o.currentTarget.closest("th");
|
|
121
|
+
if (!(r instanceof HTMLTableCellElement))
|
|
122
|
+
return;
|
|
123
|
+
o.preventDefault();
|
|
124
|
+
const h = I(r), _ = h.indexOf(r), y = h[_ + 1] ?? null;
|
|
125
|
+
c(
|
|
126
|
+
D(
|
|
127
|
+
h,
|
|
128
|
+
_,
|
|
129
|
+
r.getBoundingClientRect().width,
|
|
130
|
+
y ? y.getBoundingClientRect().width : null,
|
|
131
|
+
l,
|
|
132
|
+
H(h, _, e),
|
|
133
|
+
y ? T(y, void 0) : 0
|
|
134
|
+
)
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
return /* @__PURE__ */ u(
|
|
138
|
+
"span",
|
|
139
|
+
{
|
|
140
|
+
ref: t,
|
|
141
|
+
role: "separator",
|
|
142
|
+
"aria-orientation": "vertical",
|
|
143
|
+
"aria-label": `${a || "Column"} width${d === null ? "" : `, ${d} pixels`}`,
|
|
144
|
+
tabIndex: 0,
|
|
145
|
+
className: s.columnResizer,
|
|
146
|
+
style: { width: R, insetInlineEnd: -R / 2 },
|
|
147
|
+
onPointerDown: p,
|
|
148
|
+
onPointerMove: v,
|
|
149
|
+
onPointerUp: m,
|
|
150
|
+
onPointerCancel: m,
|
|
151
|
+
onKeyDown: B
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
const Q = W(s.table, {
|
|
156
|
+
variants: {
|
|
157
|
+
/*
|
|
158
|
+
* `collection` is the spec's own guide word for the dense arrangement:
|
|
159
|
+
* a fixed layout with a sticky header and tall, wrapping rows. The
|
|
160
|
+
* density axis below is orthogonal to it and still applies.
|
|
161
|
+
*/
|
|
162
|
+
variant: {
|
|
163
|
+
default: s.variantDefault,
|
|
164
|
+
collection: s.variantCollection
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
defaultVariants: {
|
|
168
|
+
variant: "default"
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
function nt({
|
|
172
|
+
className: e,
|
|
173
|
+
label: t,
|
|
174
|
+
density: n,
|
|
175
|
+
variant: a,
|
|
176
|
+
containerClassName: i,
|
|
177
|
+
containerStyle: d,
|
|
178
|
+
...c
|
|
179
|
+
}) {
|
|
180
|
+
return /* @__PURE__ */ u(
|
|
16
181
|
"div",
|
|
17
182
|
{
|
|
18
|
-
className:
|
|
183
|
+
className: f(s.tableContainer, i),
|
|
184
|
+
style: d,
|
|
19
185
|
tabIndex: 0,
|
|
20
|
-
role:
|
|
21
|
-
"aria-label":
|
|
22
|
-
children: /* @__PURE__ */
|
|
186
|
+
role: t === void 0 ? void 0 : "region",
|
|
187
|
+
"aria-label": t,
|
|
188
|
+
children: /* @__PURE__ */ u(
|
|
23
189
|
"table",
|
|
24
190
|
{
|
|
25
|
-
className:
|
|
26
|
-
|
|
191
|
+
className: Q({
|
|
192
|
+
variant: a,
|
|
193
|
+
className: f(n === "compact" && s.densityCompact, e)
|
|
194
|
+
}),
|
|
195
|
+
...c
|
|
27
196
|
}
|
|
28
197
|
)
|
|
29
198
|
}
|
|
30
199
|
);
|
|
31
200
|
}
|
|
32
|
-
function
|
|
33
|
-
return /* @__PURE__ */
|
|
201
|
+
function ot({ className: e, ...t }) {
|
|
202
|
+
return /* @__PURE__ */ u("thead", { className: f(s.tableHeader, e), ...t });
|
|
34
203
|
}
|
|
35
|
-
function
|
|
36
|
-
return /* @__PURE__ */
|
|
204
|
+
function lt({ className: e, ...t }) {
|
|
205
|
+
return /* @__PURE__ */ u("tbody", { className: f(s.tableBody, e), ...t });
|
|
37
206
|
}
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */
|
|
207
|
+
function at({ className: e, ...t }) {
|
|
208
|
+
return /* @__PURE__ */ u("tfoot", { className: f(s.tableFooter, e), ...t });
|
|
40
209
|
}
|
|
41
|
-
function
|
|
42
|
-
return /* @__PURE__ */
|
|
210
|
+
function rt({ className: e, ...t }) {
|
|
211
|
+
return /* @__PURE__ */ u("tr", { className: f(s.tableRow, e), ...t });
|
|
43
212
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
213
|
+
function it({
|
|
214
|
+
className: e,
|
|
215
|
+
resizable: t,
|
|
216
|
+
resizeMinWidth: n,
|
|
217
|
+
children: a,
|
|
218
|
+
...i
|
|
219
|
+
}) {
|
|
220
|
+
return /* @__PURE__ */ P("th", { className: f(s.tableHead, e), ...i, children: [
|
|
221
|
+
a,
|
|
222
|
+
t ? /* @__PURE__ */ u(J, { minWidth: n }) : null
|
|
223
|
+
] });
|
|
46
224
|
}
|
|
47
|
-
function
|
|
48
|
-
return /* @__PURE__ */
|
|
225
|
+
function st({ className: e, ...t }) {
|
|
226
|
+
return /* @__PURE__ */ u("td", { className: f(s.tableCell, e), ...t });
|
|
49
227
|
}
|
|
50
|
-
function
|
|
51
|
-
return /* @__PURE__ */
|
|
228
|
+
function ct({ className: e, ...t }) {
|
|
229
|
+
return /* @__PURE__ */ u("caption", { className: f(s.tableCaption, e), ...t });
|
|
52
230
|
}
|
|
53
231
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
232
|
+
nt as Table,
|
|
233
|
+
lt as TableBody,
|
|
234
|
+
ct as TableCaption,
|
|
235
|
+
st as TableCell,
|
|
236
|
+
at as TableFooter,
|
|
237
|
+
it as TableHead,
|
|
238
|
+
ot as TableHeader,
|
|
239
|
+
rt as TableRow
|
|
62
240
|
};
|
|
63
241
|
//# 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":["import { cx } from 'class-variance-authority';\nimport type { ComponentProps } from 'react';\n\nimport styles from './table.module.css';\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 * horizontal-scroll wrapper div around the <table>, rather than asking\n * every consumer to remember to add one. A consumer who also wants a\n * *vertical* scroll region (e.g. capping a long table's height) wraps\n * their own div with `overflow-y` around <Table> — it composes fine, since\n * the two wrappers scroll orthogonal axes (see table.md).\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 */\nexport interface TableProps extends ComponentProps<'table'> {\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\nexport function Table({ className, label, density, ...props }: TableProps) {\n return (\n <div\n className={styles.tableContainer}\n tabIndex={0}\n role={label === undefined ? undefined : 'region'}\n aria-label={label}\n >\n <table\n className={cx(styles.table, density === 'compact' && styles.densityCompact, className)}\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 type TableHeadProps = ComponentProps<'th'>;\n\nexport function TableHead({ className, ...props }: TableHeadProps) {\n return <th className={cx(styles.tableHead, className)} {...props} />;\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":["Table","className","label","density","props","jsx","styles","cx","TableHeader","TableBody","TableFooter","TableRow","TableHead","TableCell","TableCaption"],"mappings":";;;;;;;;;;;;;AAyDO,SAASA,EAAM,EAAE,WAAAC,GAAW,OAAAC,GAAO,SAAAC,GAAS,GAAGC,KAAqB;AACzE,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAO;AAAA,MAClB,UAAU;AAAA,MACV,MAAMJ,MAAU,SAAY,SAAY;AAAA,MACxC,cAAYA;AAAA,MAEZ,UAAA,gBAAAG;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWE,EAAGD,EAAO,OAAOH,MAAY,aAAaG,EAAO,gBAAgBL,CAAS;AAAA,UACpF,GAAGG;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;AAIO,SAASI,EAAY,EAAE,WAAAP,GAAW,GAAGG,KAA2B;AACrE,SAAO,gBAAAC,EAAC,WAAM,WAAWE,EAAGD,EAAO,aAAaL,CAAS,GAAI,GAAGG,GAAO;AACzE;AAIO,SAASK,EAAU,EAAE,WAAAR,GAAW,GAAGG,KAAyB;AACjE,SAAO,gBAAAC,EAAC,WAAM,WAAWE,EAAGD,EAAO,WAAWL,CAAS,GAAI,GAAGG,GAAO;AACvE;AAIO,SAASM,EAAY,EAAE,WAAAT,GAAW,GAAGG,KAA2B;AACrE,SAAO,gBAAAC,EAAC,WAAM,WAAWE,EAAGD,EAAO,aAAaL,CAAS,GAAI,GAAGG,GAAO;AACzE;AAIO,SAASO,EAAS,EAAE,WAAAV,GAAW,GAAGG,KAAwB;AAC/D,SAAO,gBAAAC,EAAC,QAAG,WAAWE,EAAGD,EAAO,UAAUL,CAAS,GAAI,GAAGG,GAAO;AACnE;AAIO,SAASQ,EAAU,EAAE,WAAAX,GAAW,GAAGG,KAAyB;AACjE,SAAO,gBAAAC,EAAC,QAAG,WAAWE,EAAGD,EAAO,WAAWL,CAAS,GAAI,GAAGG,GAAO;AACpE;AAIO,SAASS,EAAU,EAAE,WAAAZ,GAAW,GAAGG,KAAyB;AACjE,SAAO,gBAAAC,EAAC,QAAG,WAAWE,EAAGD,EAAO,WAAWL,CAAS,GAAI,GAAGG,GAAO;AACpE;AAWO,SAASU,EAAa,EAAE,WAAAb,GAAW,GAAGG,KAA4B;AACvE,SAAO,gBAAAC,EAAC,aAAQ,WAAWE,EAAGD,EAAO,cAAcL,CAAS,GAAI,GAAGG,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 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 collection header would scroll\n * away with the rows.\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\nexport function Table({\n className,\n label,\n density,\n variant,\n containerClassName,\n containerStyle,\n ...props\n}: TableProps) {\n return (\n <div\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(density === 'compact' && styles.densityCompact, className),\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","props","cx","TableHeader","TableBody","TableFooter","TableRow","TableHead","resizable","resizeMinWidth","children","jsxs","TableCell","TableCaption"],"mappings":";;;;;;;;;;;;;;;;;GAuBMA,IAAgB,IAEhBC,IAAe,GAEfC,IAAsB,IAEtBC,IAAyB;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,IAAsBC;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,EAA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