@acronis-platform/ui-react 0.56.1 → 0.57.1
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/dist/components/ui/avatar/avatar.js +7 -7
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +104 -0
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -0
- package/dist/components/ui/chart/chart.js +49 -49
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +1 -1
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/chip/chip.js +28 -28
- package/dist/components/ui/chip/chip.js.map +1 -1
- package/dist/components/ui/data-table/data-table.js +223 -155
- package/dist/components/ui/data-table/data-table.js.map +1 -1
- package/dist/components/ui/input-text/input-text.js +8 -8
- package/dist/components/ui/input-text/input-text.js.map +1 -1
- package/dist/components/ui/link/link.js +16 -16
- package/dist/components/ui/link/link.js.map +1 -1
- package/dist/components/ui/page-header/page-header.js +159 -49
- package/dist/components/ui/page-header/page-header.js.map +1 -1
- package/dist/components/ui/search/search.js +6 -6
- package/dist/components/ui/search/search.js.map +1 -1
- package/dist/components/ui/table/table.js +32 -32
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/toolbar/toolbar.js +214 -0
- package/dist/components/ui/toolbar/toolbar.js.map +1 -0
- package/dist/hooks/use-intersection-observer.js +26 -0
- package/dist/hooks/use-intersection-observer.js.map +1 -0
- package/dist/index.js +356 -343
- package/dist/index.js.map +1 -1
- package/dist/react.js +356 -343
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +28 -0
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/data-table/data-table.d.ts +107 -4
- package/dist/src/components/ui/data-table/data-table.docs.d.ts +88 -4
- package/dist/src/components/ui/data-table/index.d.ts +1 -1
- package/dist/src/components/ui/page-header/index.d.ts +1 -1
- package/dist/src/components/ui/page-header/page-header.d.ts +9 -3
- package/dist/src/components/ui/toolbar/index.d.ts +1 -0
- package/dist/src/components/ui/toolbar/toolbar.d.ts +23 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/use-intersection-observer.d.ts +26 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { TimesIcon as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
7
|
-
"inline-flex h-[var(--ui-
|
|
1
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import { TimesIcon as h } from "@acronis-platform/icons-react/stroke-mono";
|
|
4
|
+
import { cva as g } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
5
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
6
|
+
const f = g(
|
|
7
|
+
"inline-flex h-[var(--ui-chip-global-box-height)] min-w-[var(--ui-chip-global-box-width-min)] items-center justify-center gap-[var(--ui-chip-global-box-gap)] rounded-[var(--ui-chip-global-border-radius)] border-[length:var(--ui-chip-global-border-width)] border-solid border-[var(--ui-chip-global-border-color-idle)] bg-[var(--ui-chip-global-box-color-idle)] px-[var(--ui-chip-global-box-padding-x)] text-sm leading-6 hover:border-[var(--ui-chip-global-border-color-hover)] hover:bg-[var(--ui-chip-global-box-color-hover)] [&_svg]:size-[var(--ui-chip-global-icon-size)] [&_svg]:shrink-0 [&_svg]:text-[var(--ui-chip-global-icon-color)]",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
removable: "focus-within:outline-none focus-within:ring-[3px] focus-within:ring-[var(--ui-focus-primary)] active:border-[var(--ui-
|
|
12
|
-
selectable: "cursor-pointer focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] data-[selected=true]:border-[var(--ui-
|
|
11
|
+
removable: "text-[var(--ui-chip-removable-label-color)] focus-within:outline-none focus-within:ring-[3px] focus-within:ring-[var(--ui-focus-primary)] active:border-[var(--ui-chip-global-border-color-active)] active:bg-[var(--ui-chip-global-box-color-active)]",
|
|
12
|
+
selectable: "cursor-pointer text-[var(--ui-chip-selectable-label-color)] focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] data-[selected=true]:border-[var(--ui-chip-global-border-color-active)] data-[selected=true]:bg-[var(--ui-chip-global-box-color-active)]"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
defaultVariants: {
|
|
16
16
|
variant: "removable"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
), x =
|
|
19
|
+
), x = d.forwardRef(
|
|
20
20
|
({
|
|
21
|
-
className:
|
|
21
|
+
className: c,
|
|
22
22
|
variant: i = "removable",
|
|
23
|
-
icon:
|
|
23
|
+
icon: t,
|
|
24
24
|
selected: a,
|
|
25
|
-
onRemove:
|
|
26
|
-
removeLabel:
|
|
25
|
+
onRemove: b,
|
|
26
|
+
removeLabel: s = "Remove",
|
|
27
27
|
children: u,
|
|
28
28
|
onKeyDown: e,
|
|
29
|
-
...
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
return /* @__PURE__ */
|
|
29
|
+
...n
|
|
30
|
+
}, v) => {
|
|
31
|
+
const l = i === "selectable";
|
|
32
|
+
return /* @__PURE__ */ p(
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
|
-
ref:
|
|
36
|
-
className: f(
|
|
35
|
+
ref: v,
|
|
36
|
+
className: m(f({ variant: i }), c),
|
|
37
37
|
onKeyDown: (r) => {
|
|
38
|
-
|
|
38
|
+
l && (r.key === "Enter" || r.key === " ") && (r.preventDefault(), r.currentTarget.click()), e == null || e(r);
|
|
39
39
|
},
|
|
40
|
-
...
|
|
40
|
+
...l ? {
|
|
41
41
|
role: "button",
|
|
42
42
|
tabIndex: 0,
|
|
43
43
|
"aria-pressed": !!a,
|
|
44
44
|
"data-selected": a ? "true" : void 0
|
|
45
45
|
} : {},
|
|
46
|
-
...
|
|
46
|
+
...n,
|
|
47
47
|
children: [
|
|
48
|
-
|
|
48
|
+
t,
|
|
49
49
|
/* @__PURE__ */ o("span", { className: "min-w-0 truncate", children: u }),
|
|
50
50
|
i === "removable" && /* @__PURE__ */ o(
|
|
51
51
|
"button",
|
|
52
52
|
{
|
|
53
53
|
type: "button",
|
|
54
|
-
"aria-label":
|
|
55
|
-
onClick:
|
|
54
|
+
"aria-label": s,
|
|
55
|
+
onClick: b,
|
|
56
56
|
className: "-me-1 flex shrink-0 items-center justify-center rounded-full outline-none focus-visible:outline-none",
|
|
57
|
-
children: /* @__PURE__ */ o(
|
|
57
|
+
children: /* @__PURE__ */ o(h, {})
|
|
58
58
|
}
|
|
59
59
|
)
|
|
60
60
|
]
|
|
@@ -65,6 +65,6 @@ const g = m(
|
|
|
65
65
|
x.displayName = "Chip";
|
|
66
66
|
export {
|
|
67
67
|
x as Chip,
|
|
68
|
-
|
|
68
|
+
f as chipVariants
|
|
69
69
|
};
|
|
70
70
|
//# sourceMappingURL=chip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.js","sources":["../../../../src/components/ui/chip/chip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\n// A compact, interactive label. `variant` mirrors the Figma \"Chip\" `type`:\n// `removable` carries a trailing × (remove) button; `selectable` toggles a\n// selected state. The container fill/border/label/icon all wire to the dedicated\n// `--ui-
|
|
1
|
+
{"version":3,"file":"chip.js","sources":["../../../../src/components/ui/chip/chip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\n// A compact, interactive label. `variant` mirrors the Figma \"Chip\" `type`:\n// `removable` carries a trailing × (remove) button; `selectable` toggles a\n// selected state. The container fill/border/label/icon all wire to the dedicated\n// `--ui-chip-*` tier from @acronis-platform/tokens-pd; geometry (height, gap,\n// padding, min-width, radius, border width, icon size) is tokenized too.\n// The Figma `state` enum (idle / hover / active / focused) maps to interaction\n// states, not props: `hover:` → the hover tokens, `:focus`/`focus-visible` → the\n// 3px `--ui-focus-primary` ring, and the `active` look is the pressed state for\n// `removable` (`active:`) and the selected state for `selectable`\n// (`data-[selected]`, driven by the `selected` prop).\nconst chipVariants = cva(\n \"inline-flex h-[var(--ui-chip-global-box-height)] min-w-[var(--ui-chip-global-box-width-min)] items-center justify-center gap-[var(--ui-chip-global-box-gap)] rounded-[var(--ui-chip-global-border-radius)] border-[length:var(--ui-chip-global-border-width)] border-solid border-[var(--ui-chip-global-border-color-idle)] bg-[var(--ui-chip-global-box-color-idle)] px-[var(--ui-chip-global-box-padding-x)] text-sm leading-6 hover:border-[var(--ui-chip-global-border-color-hover)] hover:bg-[var(--ui-chip-global-box-color-hover)] [&_svg]:size-[var(--ui-chip-global-icon-size)] [&_svg]:shrink-0 [&_svg]:text-[var(--ui-chip-global-icon-color)]\",\n {\n variants: {\n variant: {\n removable:\n 'text-[var(--ui-chip-removable-label-color)] focus-within:outline-none focus-within:ring-[3px] focus-within:ring-[var(--ui-focus-primary)] active:border-[var(--ui-chip-global-border-color-active)] active:bg-[var(--ui-chip-global-box-color-active)]',\n selectable:\n 'cursor-pointer text-[var(--ui-chip-selectable-label-color)] focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] data-[selected=true]:border-[var(--ui-chip-global-border-color-active)] data-[selected=true]:bg-[var(--ui-chip-global-box-color-active)]',\n },\n },\n defaultVariants: {\n variant: 'removable',\n },\n }\n);\n\nexport interface ChipProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof chipVariants> {\n /** Optional leading icon, rendered at 16px before the label. */\n icon?: React.ReactNode;\n /**\n * `selectable` only — applies the selected (active) styling and exposes the\n * chip as a pressed toggle (`role=\"button\"` + `aria-pressed`).\n */\n selected?: boolean;\n /** `removable` only — called when the trailing remove (×) button is pressed. */\n onRemove?: () => void;\n /** Accessible label for the remove button (`removable`). */\n removeLabel?: string;\n}\n\nconst Chip = React.forwardRef<HTMLDivElement, ChipProps>(\n (\n {\n className,\n variant = 'removable',\n icon,\n selected,\n onRemove,\n removeLabel = 'Remove',\n children,\n onKeyDown,\n ...props\n },\n ref\n ) => {\n const selectable = variant === 'selectable';\n return (\n <div\n ref={ref}\n className={cn(chipVariants({ variant }), className)}\n onKeyDown={(event) => {\n // The selectable chip is a div with button semantics; mirror native\n // button activation so Enter/Space fire its click handler.\n if (selectable && (event.key === 'Enter' || event.key === ' ')) {\n event.preventDefault();\n event.currentTarget.click();\n }\n onKeyDown?.(event);\n }}\n {...(selectable\n ? {\n role: 'button',\n tabIndex: 0,\n 'aria-pressed': Boolean(selected),\n 'data-selected': selected ? 'true' : undefined,\n }\n : {})}\n {...props}\n >\n {icon}\n <span className=\"min-w-0 truncate\">{children}</span>\n {variant === 'removable' && (\n <button\n type=\"button\"\n aria-label={removeLabel}\n onClick={onRemove}\n className=\"-me-1 flex shrink-0 items-center justify-center rounded-full outline-none focus-visible:outline-none\"\n >\n <TimesIcon />\n </button>\n )}\n </div>\n );\n }\n);\nChip.displayName = 'Chip';\n\nexport { Chip, chipVariants };\n"],"names":["chipVariants","cva","Chip","React","className","variant","icon","selected","onRemove","removeLabel","children","onKeyDown","props","ref","selectable","jsxs","cn","event","jsx","TimesIcon"],"mappings":";;;;;AAgBA,MAAMA,IAAeC;AAAA,EACnB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,WACE;AAAA,QACF,YACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GAmBMC,IAAOC,EAAM;AAAA,EACjB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAaT,MAAY;AAC/B,WACE,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAF;AAAA,QACA,WAAWG,EAAGhB,EAAa,EAAE,SAAAK,EAAA,CAAS,GAAGD,CAAS;AAAA,QAClD,WAAW,CAACa,MAAU;AAGpB,UAAIH,MAAeG,EAAM,QAAQ,WAAWA,EAAM,QAAQ,SACxDA,EAAM,eAAA,GACNA,EAAM,cAAc,MAAA,IAEtBN,KAAA,QAAAA,EAAYM;AAAA,QACd;AAAA,QACC,GAAIH,IACD;AAAA,UACE,MAAM;AAAA,UACN,UAAU;AAAA,UACV,gBAAgB,EAAQP;AAAA,UACxB,iBAAiBA,IAAW,SAAS;AAAA,QAAA,IAEvC,CAAA;AAAA,QACH,GAAGK;AAAA,QAEH,UAAA;AAAA,UAAAN;AAAA,UACD,gBAAAY,EAAC,QAAA,EAAK,WAAU,oBAAoB,UAAAR,EAAA,CAAS;AAAA,UAC5CL,MAAY,eACX,gBAAAa;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAYT;AAAA,cACZ,SAASD;AAAA,cACT,WAAU;AAAA,cAEV,4BAACW,GAAA,CAAA,CAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACb;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACAjB,EAAK,cAAc;"}
|
|
@@ -1,130 +1,151 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as n, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useEffect as ve, Fragment as K } from "react";
|
|
3
|
+
import { useReactTable as Se, flexRender as k } from "../../../node_modules/.pnpm/@tanstack_react-table@8.21.3_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@tanstack/react-table/build/lib/index.js";
|
|
4
|
+
import { cn as h } from "../../../lib/utils.js";
|
|
5
|
+
import { useIntersectionObserver as ye } from "../../../hooks/use-intersection-observer.js";
|
|
6
|
+
import { Table as we, TableHeader as Re, TableRow as u, TableHead as xe, TableBody as ze, TableCell as g } from "../table/table.js";
|
|
7
|
+
import { getFilteredRowModel as Ne, getSortedRowModel as Ce, getPaginationRowModel as De, getExpandedRowModel as Ie, getCoreRowModel as Me } from "../../../node_modules/.pnpm/@tanstack_table-core@8.21.3/node_modules/@tanstack/table-core/build/lib/index.js";
|
|
8
|
+
function U(o) {
|
|
9
|
+
const l = o.getIsPinned();
|
|
9
10
|
if (l)
|
|
10
11
|
return {
|
|
11
12
|
position: "sticky",
|
|
12
|
-
left: l === "left" ?
|
|
13
|
-
right: l === "right" ?
|
|
13
|
+
left: l === "left" ? o.getStart("left") : void 0,
|
|
14
|
+
right: l === "right" ? o.getAfter("right") : void 0,
|
|
14
15
|
zIndex: 1,
|
|
15
16
|
// Derived from the same border token every other table divider uses (not a
|
|
16
17
|
// hardcoded color), so the separator theme-adapts automatically.
|
|
17
|
-
boxShadow: l === "left" ? "4px 0 4px -4px var(--ui-table-global-
|
|
18
|
+
boxShadow: l === "left" ? "4px 0 4px -4px var(--ui-table-global-row-border-color)" : "-4px 0 4px -4px var(--ui-table-global-row-border-color)"
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
if (l ||
|
|
22
|
-
return
|
|
21
|
+
function B(o, l) {
|
|
22
|
+
if (l || o.columnDef.size !== void 0)
|
|
23
|
+
return o.getSize();
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
if (!(!
|
|
27
|
-
return { ...
|
|
25
|
+
function Ee(o, l) {
|
|
26
|
+
const i = U(o.column), s = B(o.column, l);
|
|
27
|
+
if (!(!i && s === void 0))
|
|
28
|
+
return { ...i, width: s };
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
if (!(!
|
|
32
|
-
return { ...
|
|
30
|
+
function _e(o, l) {
|
|
31
|
+
const i = U(o.column), s = B(o.column, l);
|
|
32
|
+
if (!(!i && s === void 0))
|
|
33
|
+
return { ...i, width: s };
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
36
|
-
const p =
|
|
37
|
-
if (
|
|
38
|
-
|
|
35
|
+
const L = 20, H = Number.MAX_SAFE_INTEGER;
|
|
36
|
+
function Fe(o, l, { shiftKey: i, min: s, max: b }) {
|
|
37
|
+
const p = i ? 50 : 10;
|
|
38
|
+
if (o === "ArrowLeft")
|
|
39
|
+
return Math.min(b, Math.max(s, l - p));
|
|
40
|
+
if (o === "ArrowRight")
|
|
41
|
+
return Math.max(s, Math.min(b, l + p));
|
|
39
42
|
}
|
|
40
|
-
function
|
|
41
|
-
columns:
|
|
42
|
-
data: l,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
function He({
|
|
44
|
+
columns: o = [],
|
|
45
|
+
data: l = [],
|
|
46
|
+
table: i,
|
|
47
|
+
getRowCanExpand: s,
|
|
48
|
+
renderExpandedRow: b,
|
|
49
|
+
striped: p = !1,
|
|
50
|
+
bordered: O = !1,
|
|
51
|
+
highlightCurrentRow: w = !1,
|
|
52
|
+
skeleton: R = !1,
|
|
53
|
+
skeletonRows: j = 5,
|
|
54
|
+
enableColumnResizing: I = !1,
|
|
51
55
|
onColumnSizingChange: x,
|
|
52
|
-
columnVisibility:
|
|
53
|
-
onColumnVisibilityChange:
|
|
56
|
+
columnVisibility: X,
|
|
57
|
+
onColumnVisibilityChange: z,
|
|
58
|
+
manualSorting: M = !1,
|
|
59
|
+
sorting: E,
|
|
60
|
+
onSortingChange: N,
|
|
61
|
+
renderRow: _,
|
|
62
|
+
renderEmptyState: F,
|
|
63
|
+
paginationMode: A = "page",
|
|
64
|
+
onLoadMore: C,
|
|
65
|
+
loadMoreRootMargin: Z,
|
|
66
|
+
hasNextPage: T = !1,
|
|
67
|
+
isLoadingMore: P = !1
|
|
54
68
|
}) {
|
|
55
|
-
const [
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
69
|
+
const [G, W] = m([]), $ = E ?? G, [q, J] = m([]), [Q, Y] = m({}), ee = X ?? Q, [te, ne] = m({}), [oe, le] = m({}), [ie, re] = m({}), [ae, se] = m(), ce = (e) => {
|
|
70
|
+
re(e), x == null || x(e);
|
|
71
|
+
}, de = (e) => {
|
|
72
|
+
Y(e), z == null || z(e);
|
|
73
|
+
}, ue = (e) => {
|
|
74
|
+
E === void 0 && W(e), N == null || N(e);
|
|
75
|
+
}, me = Se({
|
|
60
76
|
data: l,
|
|
61
|
-
columns:
|
|
62
|
-
enableColumnResizing:
|
|
77
|
+
columns: o,
|
|
78
|
+
enableColumnResizing: I,
|
|
63
79
|
columnResizeMode: "onChange",
|
|
64
|
-
getCoreRowModel:
|
|
65
|
-
getExpandedRowModel:
|
|
66
|
-
getPaginationRowModel:
|
|
67
|
-
getRowCanExpand:
|
|
68
|
-
onExpandedChange:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
getCoreRowModel: Me(),
|
|
81
|
+
getExpandedRowModel: Ie(),
|
|
82
|
+
...A === "page" ? { getPaginationRowModel: De() } : {},
|
|
83
|
+
getRowCanExpand: s,
|
|
84
|
+
onExpandedChange: le,
|
|
85
|
+
manualSorting: M,
|
|
86
|
+
onSortingChange: ue,
|
|
87
|
+
...M ? {} : { getSortedRowModel: Ce() },
|
|
88
|
+
onColumnFiltersChange: J,
|
|
89
|
+
getFilteredRowModel: Ne(),
|
|
90
|
+
onColumnVisibilityChange: de,
|
|
91
|
+
onRowSelectionChange: ne,
|
|
92
|
+
onColumnSizingChange: ce,
|
|
76
93
|
state: {
|
|
77
|
-
sorting:
|
|
78
|
-
columnFilters:
|
|
79
|
-
columnVisibility:
|
|
80
|
-
rowSelection:
|
|
81
|
-
expanded:
|
|
82
|
-
columnSizing:
|
|
94
|
+
sorting: $,
|
|
95
|
+
columnFilters: q,
|
|
96
|
+
columnVisibility: ee,
|
|
97
|
+
rowSelection: te,
|
|
98
|
+
expanded: oe,
|
|
99
|
+
columnSizing: ie
|
|
83
100
|
}
|
|
84
|
-
}),
|
|
101
|
+
}), r = i ?? me, D = !i && A === "infinite", v = I && !i, ge = ye({
|
|
102
|
+
onIntersect: () => C == null ? void 0 : C(),
|
|
103
|
+
disabled: !D || !T || P,
|
|
104
|
+
rootMargin: Z
|
|
105
|
+
}), fe = (e, t) => {
|
|
85
106
|
if (e.ctrlKey || e.altKey || e.metaKey) return;
|
|
86
|
-
const
|
|
107
|
+
const a = Fe(e.key, t.column.getSize(), {
|
|
87
108
|
shiftKey: e.shiftKey,
|
|
88
|
-
min:
|
|
89
|
-
max:
|
|
109
|
+
min: t.column.columnDef.minSize ?? L,
|
|
110
|
+
max: t.column.columnDef.maxSize ?? H
|
|
90
111
|
});
|
|
91
|
-
|
|
112
|
+
a !== void 0 && (e.preventDefault(), r.setColumnSizing((c) => ({ ...c, [t.column.id]: a })));
|
|
92
113
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var
|
|
96
|
-
e.pin(((
|
|
114
|
+
ve(() => {
|
|
115
|
+
i || r.getAllLeafColumns().forEach((e) => {
|
|
116
|
+
var t;
|
|
117
|
+
e.pin(((t = e.columnDef.meta) == null ? void 0 : t.pin) ?? !1);
|
|
97
118
|
});
|
|
98
|
-
}, [
|
|
99
|
-
const
|
|
119
|
+
}, [r, o, i]);
|
|
120
|
+
const f = r.getRowModel().rows, be = O ? "[&_th:not(:last-child)]:border-e [&_td:not(:last-child)]:border-e [&_th]:border-[var(--ui-table-global-row-border-color)] [&_td]:border-[var(--ui-table-global-row-border-color)]" : void 0, pe = "bg-background";
|
|
100
121
|
return /* @__PURE__ */ n(
|
|
101
122
|
"div",
|
|
102
123
|
{
|
|
103
|
-
className:
|
|
104
|
-
"rounded-md border border-[var(--ui-table-global-
|
|
105
|
-
|
|
124
|
+
className: h(
|
|
125
|
+
"rounded-md border border-[var(--ui-table-global-row-border-color)]",
|
|
126
|
+
be
|
|
106
127
|
),
|
|
107
|
-
children: /* @__PURE__ */
|
|
108
|
-
|
|
128
|
+
children: /* @__PURE__ */ y(
|
|
129
|
+
we,
|
|
109
130
|
{
|
|
110
|
-
style:
|
|
131
|
+
style: v ? { width: r.getCenterTotalSize() } : void 0,
|
|
111
132
|
children: [
|
|
112
|
-
/* @__PURE__ */ n(
|
|
113
|
-
var
|
|
114
|
-
const
|
|
115
|
-
return /* @__PURE__ */
|
|
116
|
-
|
|
133
|
+
/* @__PURE__ */ n(Re, { children: r.getHeaderGroups().map((e) => /* @__PURE__ */ n(u, { children: e.headers.map((t) => {
|
|
134
|
+
var S;
|
|
135
|
+
const a = t.column.getIsPinned(), c = v && t.column.getCanResize();
|
|
136
|
+
return /* @__PURE__ */ y(
|
|
137
|
+
xe,
|
|
117
138
|
{
|
|
118
|
-
wrap: (
|
|
119
|
-
style:
|
|
120
|
-
className:
|
|
139
|
+
wrap: (S = t.column.columnDef.meta) == null ? void 0 : S.wrap,
|
|
140
|
+
style: Ee(t, v),
|
|
141
|
+
className: h(
|
|
121
142
|
c && "relative",
|
|
122
|
-
|
|
143
|
+
a && pe
|
|
123
144
|
),
|
|
124
145
|
children: [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
146
|
+
t.isPlaceholder ? null : k(
|
|
147
|
+
t.column.columnDef.header,
|
|
148
|
+
t.getContext()
|
|
128
149
|
),
|
|
129
150
|
c && /* @__PURE__ */ n(
|
|
130
151
|
"div",
|
|
@@ -132,73 +153,117 @@ function xe({
|
|
|
132
153
|
role: "separator",
|
|
133
154
|
"aria-orientation": "vertical",
|
|
134
155
|
"aria-label": "Resize column",
|
|
135
|
-
"aria-valuenow":
|
|
136
|
-
"aria-valuemin":
|
|
137
|
-
"aria-valuemax":
|
|
156
|
+
"aria-valuenow": t.column.getSize(),
|
|
157
|
+
"aria-valuemin": t.column.columnDef.minSize ?? L,
|
|
158
|
+
"aria-valuemax": t.column.columnDef.maxSize ?? H,
|
|
138
159
|
tabIndex: 0,
|
|
139
|
-
onMouseDown:
|
|
140
|
-
onTouchStart:
|
|
141
|
-
onKeyDown: (
|
|
142
|
-
className:
|
|
143
|
-
"absolute end-0 top-0 h-full w-1 cursor-(--ui-resizable-cursor) touch-none select-none bg-[var(--ui-table-global-
|
|
144
|
-
|
|
160
|
+
onMouseDown: t.getResizeHandler(),
|
|
161
|
+
onTouchStart: t.getResizeHandler(),
|
|
162
|
+
onKeyDown: (d) => fe(d, t),
|
|
163
|
+
className: h(
|
|
164
|
+
"absolute end-0 top-0 h-full w-1 cursor-(--ui-resizable-cursor) touch-none select-none bg-[var(--ui-table-global-row-border-color)] opacity-0 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-(--ui-focus-primary)",
|
|
165
|
+
t.column.getIsResizing() && "opacity-100"
|
|
145
166
|
)
|
|
146
167
|
}
|
|
147
168
|
)
|
|
148
169
|
]
|
|
149
170
|
},
|
|
150
|
-
|
|
171
|
+
t.id
|
|
151
172
|
);
|
|
152
173
|
}) }, e.id)) }),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
174
|
+
/* @__PURE__ */ y(ze, { children: [
|
|
175
|
+
R ? Array.from({ length: j }).map((e, t) => /* @__PURE__ */ n(
|
|
176
|
+
u,
|
|
177
|
+
{
|
|
178
|
+
className: "hover:bg-transparent",
|
|
179
|
+
children: r.getVisibleLeafColumns().map((a) => /* @__PURE__ */ n(g, { children: /* @__PURE__ */ n("div", { className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]" }) }, a.id))
|
|
180
|
+
},
|
|
181
|
+
`skeleton-${t}`
|
|
182
|
+
)) : f != null && f.length ? f.map((e, t) => {
|
|
183
|
+
if (_)
|
|
184
|
+
return /* @__PURE__ */ n(K, { children: _(e, t) }, e.id);
|
|
185
|
+
const a = e.getIsSelected(), c = w && ae === e.id, S = a || c ? "bg-[var(--ui-table-data-row-color-active)]" : p && t % 2 === 1 ? "bg-[var(--ui-background-surface-secondary)]" : "bg-background";
|
|
186
|
+
return /* @__PURE__ */ y(K, { children: [
|
|
187
|
+
/* @__PURE__ */ n(
|
|
188
|
+
u,
|
|
189
|
+
{
|
|
190
|
+
selected: a,
|
|
191
|
+
onClick: w ? () => se(e.id) : void 0,
|
|
192
|
+
className: h(
|
|
193
|
+
w && "cursor-pointer",
|
|
194
|
+
p && t % 2 === 1 && !a && !c && "bg-[var(--ui-background-surface-secondary)]",
|
|
195
|
+
c && !a && "bg-[var(--ui-table-data-row-color-active)]"
|
|
196
|
+
),
|
|
197
|
+
children: e.getVisibleCells().map((d) => {
|
|
198
|
+
var V;
|
|
199
|
+
const he = d.column.getIsPinned();
|
|
200
|
+
return /* @__PURE__ */ n(
|
|
201
|
+
g,
|
|
202
|
+
{
|
|
203
|
+
wrap: (V = d.column.columnDef.meta) == null ? void 0 : V.wrap,
|
|
204
|
+
style: _e(d, v),
|
|
205
|
+
className: h(he && S),
|
|
206
|
+
children: k(
|
|
207
|
+
d.column.columnDef.cell,
|
|
208
|
+
d.getContext()
|
|
209
|
+
)
|
|
210
|
+
},
|
|
211
|
+
d.id
|
|
212
|
+
);
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
b && e.getIsExpanded() && /* @__PURE__ */ n(u, { className: "hover:bg-transparent", children: /* @__PURE__ */ n(
|
|
217
|
+
g,
|
|
218
|
+
{
|
|
219
|
+
className: "h-auto py-3",
|
|
220
|
+
colSpan: e.getVisibleCells().length,
|
|
221
|
+
children: b(e)
|
|
222
|
+
}
|
|
223
|
+
) })
|
|
224
|
+
] }, e.id);
|
|
225
|
+
}) : F ? /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n(
|
|
226
|
+
g,
|
|
227
|
+
{
|
|
228
|
+
colSpan: r.getVisibleLeafColumns().length,
|
|
229
|
+
className: "h-24 text-center",
|
|
230
|
+
children: F({
|
|
231
|
+
hasFilters: r.getState().columnFilters.length > 0
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
) }) : /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n(
|
|
235
|
+
g,
|
|
236
|
+
{
|
|
237
|
+
colSpan: r.getVisibleLeafColumns().length,
|
|
238
|
+
className: "h-24 text-center text-[var(--ui-table-data-value-color-disabled)]",
|
|
239
|
+
children: "No results."
|
|
240
|
+
}
|
|
241
|
+
) }),
|
|
242
|
+
D && !R && f.length > 0 && T && /* @__PURE__ */ n(
|
|
243
|
+
u,
|
|
244
|
+
{
|
|
245
|
+
ref: ge,
|
|
246
|
+
"aria-hidden": !0,
|
|
247
|
+
className: "hover:bg-transparent",
|
|
248
|
+
children: /* @__PURE__ */ n(
|
|
249
|
+
g,
|
|
250
|
+
{
|
|
251
|
+
colSpan: r.getVisibleLeafColumns().length,
|
|
252
|
+
className: "h-1 p-0"
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
D && !R && f.length > 0 && P && /* @__PURE__ */ n(u, { className: "hover:bg-transparent", children: /* @__PURE__ */ n(g, { colSpan: r.getVisibleLeafColumns().length, children: /* @__PURE__ */ n(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
role: "status",
|
|
261
|
+
"aria-live": "polite",
|
|
262
|
+
className: "h-4 w-full animate-pulse rounded bg-[var(--ui-background-surface-secondary)]",
|
|
263
|
+
children: /* @__PURE__ */ n("span", { className: "sr-only", children: "Loading more rows…" })
|
|
264
|
+
}
|
|
265
|
+
) }) })
|
|
266
|
+
] })
|
|
202
267
|
]
|
|
203
268
|
}
|
|
204
269
|
)
|
|
@@ -206,7 +271,10 @@ function xe({
|
|
|
206
271
|
);
|
|
207
272
|
}
|
|
208
273
|
export {
|
|
209
|
-
|
|
210
|
-
|
|
274
|
+
He as DataTable,
|
|
275
|
+
_e as getCellStyle,
|
|
276
|
+
B as getColumnWidth,
|
|
277
|
+
U as getPinnedStyle,
|
|
278
|
+
Fe as getResizeKeyboardStep
|
|
211
279
|
};
|
|
212
280
|
//# sourceMappingURL=data-table.js.map
|