@stll/ui 0.74.0 → 0.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button-classes.d.ts +45 -0
- package/dist/components/button-classes.js +49 -0
- package/dist/components/button.d.ts +1 -3
- package/dist/components/button.js +8 -43
- package/dist/components/checkbox.js +1 -1
- package/dist/components/composer-tokens.d.ts +9 -1
- package/dist/components/composer-tokens.js +9 -1
- package/dist/components/composer.d.ts +2 -2
- package/dist/components/composer.js +4 -4
- package/dist/components/control-face.d.ts +132 -0
- package/dist/components/control-face.js +168 -0
- package/dist/components/court-badge.d.ts +4 -2
- package/dist/components/court-badge.js +5 -3
- package/dist/components/document-mark.shared.d.ts +149 -0
- package/dist/components/document-mark.shared.js +62 -0
- package/dist/components/frame.d.ts +5 -1
- package/dist/components/frame.js +2 -2
- package/dist/components/input-otp-face.d.ts +4 -0
- package/dist/components/input-otp-face.js +15 -0
- package/dist/components/input-otp.d.ts +1 -1
- package/dist/components/input-otp.js +3 -8
- package/dist/components/input.native.js +2 -7
- package/dist/components/label-classes.d.ts +20 -0
- package/dist/components/label-classes.js +21 -0
- package/dist/components/label.d.ts +2 -20
- package/dist/components/label.js +2 -19
- package/dist/components/landing-shell.d.ts +64 -0
- package/dist/components/landing-shell.js +189 -0
- package/dist/components/landing.d.ts +2 -39
- package/dist/components/landing.js +2 -66
- package/dist/components/list-shell.d.ts +39 -0
- package/dist/components/list-shell.js +99 -0
- package/dist/components/list.d.ts +3 -17
- package/dist/components/list.js +2 -42
- package/dist/components/segmented-icon-toggle.d.ts +4 -1
- package/dist/components/segmented-icon-toggle.js +5 -4
- package/dist/components/select-classes.d.ts +10 -0
- package/dist/components/select-classes.js +13 -0
- package/dist/components/select.js +3 -7
- package/dist/components/separator.native.js +2 -1
- package/dist/components/sheet.native.js +4 -3
- package/dist/components/skeleton.d.ts +3 -1
- package/dist/components/skeleton.js +9 -2
- package/dist/components/split-button.d.ts +2 -1
- package/dist/components/split-button.js +6 -14
- package/dist/components/switch.d.ts +1 -5
- package/dist/components/switch.js +2 -5
- package/dist/components/table-cell.d.ts +35 -0
- package/dist/components/table-cell.js +26 -0
- package/dist/components/table-chart.js +28 -18
- package/dist/components/table-shell.d.ts +126 -0
- package/dist/components/table-shell.js +136 -0
- package/dist/components/table.d.ts +4 -88
- package/dist/components/table.js +21 -70
- package/dist/components/tabs-classes.d.ts +8 -0
- package/dist/components/tabs-classes.js +10 -0
- package/dist/components/tabs.js +4 -3
- package/dist/components/toggle-classes.d.ts +13 -0
- package/dist/components/toggle-classes.js +10 -0
- package/dist/components/toggle-group-classes.d.ts +12 -0
- package/dist/components/toggle-group-classes.js +13 -0
- package/dist/components/toggle-group.js +3 -2
- package/dist/components/tooltip.d.ts +6 -1
- package/dist/components/tooltip.js +2 -1
- package/dist/components/truncated-text-face.d.ts +33 -0
- package/dist/components/truncated-text-face.js +30 -0
- package/dist/components/truncated-text.d.ts +1 -6
- package/dist/components/truncated-text.js +1 -15
- package/dist/components/view-toolbar-classes.d.ts +13 -0
- package/dist/components/view-toolbar-classes.js +15 -0
- package/dist/components/view-toolbar-shell.d.ts +24 -0
- package/dist/components/view-toolbar-shell.js +43 -0
- package/dist/components/view-toolbar.d.ts +2 -15
- package/dist/components/view-toolbar.js +8 -26
- package/dist/components/workspace-shell.d.ts +7 -1
- package/dist/components/workspace-shell.js +21 -3
- package/dist/data-table/table.js +2 -1
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +2 -2
- package/dist/index.d.ts +15 -9
- package/dist/index.js +11 -8
- package/dist/inspector/pane-width.d.ts +1 -1
- package/dist/inspector/pane-width.js +2 -2
- package/dist/inspector/use-pane-width.d.ts +7 -9
- package/dist/inspector/use-pane-width.js +42 -27
- package/dist/kanban/card-shell.js +1 -1
- package/dist/kanban/column-bands.d.ts +0 -8
- package/dist/kanban/column-bands.js +1 -18
- package/dist/kanban/column-header-shell.d.ts +39 -0
- package/dist/kanban/column-header-shell.js +48 -0
- package/dist/kanban/column-header.js +9 -12
- package/dist/kanban/index.d.ts +2 -2
- package/dist/kanban/index.js +3 -3
- package/dist/kanban/layout-tokens.d.ts +18 -1
- package/dist/kanban/layout-tokens.js +18 -1
- package/dist/kanban/sticky-lane.d.ts +2 -7
- package/dist/kanban/sticky-lane.js +1 -6
- package/dist/kanban/subgroup-board.js +2 -2
- package/package.json +52 -4
|
@@ -1,98 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { SortDirection, Table, TableBody, TableCaption, TableCellText, TableDensity, TableFooter, TableHead, TableHeadProps, TableHeader, TableHeaderProps, TableInset, TableProps, TableRow, TableScroll } from "./table-shell.js";
|
|
2
3
|
import { TABLE_FIRST_LINE, TableFirstLine } from "./table-layout.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* `card` pads 16px, the inset of a card's header and body, so a table set
|
|
7
|
-
* directly inside a bordered card lines its columns up with the card's title.
|
|
8
|
-
*/
|
|
9
|
-
type TableInset = "default" | "card";
|
|
10
|
-
/**
|
|
11
|
-
* Who scrolls a table wider or taller than its box. `self` wraps it in its own
|
|
12
|
-
* horizontal scroller. `parent` renders the bare table for a page that already
|
|
13
|
-
* scrolls it (a `ScrollArea`, a scrolling pane): a scroller of its own would
|
|
14
|
-
* become the reference box of a sticky header and stop it from sticking.
|
|
15
|
-
*/
|
|
16
|
-
type TableScroll = "self" | "parent";
|
|
17
|
-
/**
|
|
18
|
-
* How tightly a table sets its cells.
|
|
19
|
-
*
|
|
20
|
-
* `default` is a data table: padded cells on one line, rows that light up
|
|
21
|
-
* under the pointer. `compact` is a small reading table inside a card or a
|
|
22
|
-
* review (a term set against a standard, a presence matrix): cells sit at
|
|
23
|
-
* text leading with no side padding, headings keep a trailing gap so a
|
|
24
|
-
* right-aligned heading never touches the next column, values wrap, and rows
|
|
25
|
-
* do not highlight because nothing in them is a row-wide target. A row
|
|
26
|
-
* header (`<TableHead scope="row">`) in a compact body reads as the row's
|
|
27
|
-
* first cell rather than as a column heading.
|
|
28
|
-
*/
|
|
29
|
-
type TableDensity = "default" | "compact";
|
|
30
|
-
type TableProps = React.ComponentProps<"table"> & {
|
|
31
|
-
density?: TableDensity;
|
|
32
|
-
inset?: TableInset;
|
|
33
|
-
scroll?: TableScroll;
|
|
34
|
-
};
|
|
35
|
-
declare const Table: ({ className, density, inset, scroll, ...props }: TableProps) => React.JSX.Element;
|
|
36
|
-
type TableHeaderProps = React.ComponentProps<"thead"> & {
|
|
37
|
-
/**
|
|
38
|
-
* `muted` lays the header row on a muted band, separating it from the rows
|
|
39
|
-
* of a long list.
|
|
40
|
-
*/
|
|
41
|
-
surface?: "plain" | "muted";
|
|
42
|
-
/**
|
|
43
|
-
* Keeps the header in view while the rows scroll under it, on a translucent
|
|
44
|
-
* muted band. The table must scroll with its parent (`scroll="parent"`).
|
|
45
|
-
*/
|
|
46
|
-
sticky?: boolean;
|
|
47
|
-
};
|
|
48
|
-
declare const TableHeader: ({ className, surface, sticky, ...props }: TableHeaderProps) => React.JSX.Element;
|
|
49
|
-
declare const TableBody: ({ className, ...props }: React.ComponentProps<"tbody">) => React.JSX.Element;
|
|
50
|
-
declare const TableFooter: ({ className, ...props }: React.ComponentProps<"tfoot">) => React.JSX.Element;
|
|
51
|
-
/**
|
|
52
|
-
* `muted` greys out a row or a cell whose value no longer counts (a voided
|
|
53
|
-
* payment) or that only supports its neighbours (a secondary column).
|
|
54
|
-
*/
|
|
55
|
-
type TableTone = "default" | "muted";
|
|
56
|
-
declare const TableRow: ({ className, tone, ...props }: React.ComponentProps<"tr"> & {
|
|
57
|
-
tone?: TableTone | undefined;
|
|
58
|
-
}) => React.JSX.Element;
|
|
59
|
-
/**
|
|
60
|
-
* Where a column sets its content. `end` lines up figures and amounts;
|
|
61
|
-
* `start` is the default reading edge. A `numeric` head or cell sets to the
|
|
62
|
-
* end unless it names an alignment, so a figures column needs one prop.
|
|
63
|
-
*/
|
|
64
|
-
type TableAlign = "start" | "center" | "end";
|
|
65
|
-
type TableHeadProps = Omit<React.ComponentProps<"th">, "align"> & {
|
|
66
|
-
align?: TableAlign | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Heads a column of figures: tabular numerals, like its cells, set to the
|
|
69
|
-
* end unless `align` says otherwise.
|
|
70
|
-
*/
|
|
71
|
-
numeric?: boolean | undefined;
|
|
72
|
-
};
|
|
73
|
-
declare const TableHead: ({ className, align, numeric, ...props }: TableHeadProps) => React.JSX.Element;
|
|
74
|
-
type TableCellProps = Omit<React.ComponentProps<"td">, "align"> & {
|
|
75
|
-
align?: TableAlign | undefined;
|
|
76
|
-
tone?: TableTone | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Figures set in tabular numerals and to the end of the cell (unless
|
|
79
|
-
* `align` says otherwise), so digits line up down the column.
|
|
80
|
-
*/
|
|
81
|
-
numeric?: boolean | undefined;
|
|
4
|
+
import { TableAlign, TableCellFaceProps, TableTone } from "./table-cell.js";
|
|
5
|
+
type TableCellProps = TableCellFaceProps & {
|
|
82
6
|
/**
|
|
83
7
|
* Cuts text that overflows the cell with an ellipsis; the caller bounds the
|
|
84
8
|
* cell's width (`max-w-xs`).
|
|
85
9
|
*/
|
|
86
10
|
truncate?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* The cell holds one control that fills it edge to edge and pads itself (a
|
|
89
|
-
* button that opens the row's record), so the cell adds no padding and the
|
|
90
|
-
* control's hover band reaches the cell's borders.
|
|
91
|
-
*/
|
|
92
|
-
flush?: boolean;
|
|
93
11
|
};
|
|
94
12
|
declare const TableCell: ({ className, align, tone, numeric, truncate, flush, children, ...props }: TableCellProps) => React.JSX.Element;
|
|
95
|
-
type SortDirection = "asc" | "desc" | null;
|
|
96
13
|
type SortableHeadProps = Omit<TableHeadProps, "onClick"> & {
|
|
97
14
|
sortDirection?: SortDirection;
|
|
98
15
|
onSort: () => void;
|
|
@@ -107,5 +24,4 @@ type SortableHeadProps = Omit<TableHeadProps, "onClick"> & {
|
|
|
107
24
|
* the label flush with the figures.
|
|
108
25
|
*/
|
|
109
26
|
declare const SortableHead: ({ children, sortDirection, onSort, trailing, className, align, numeric, ...props }: SortableHeadProps) => React.JSX.Element;
|
|
110
|
-
|
|
111
|
-
export { type SortDirection, SortableHead, TABLE_FIRST_LINE, Table, type TableAlign, TableBody, TableCaption, TableCell, type TableCellProps, type TableDensity, type TableFirstLine, TableFooter, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableInset, type TableProps, TableRow, type TableScroll, type TableTone };
|
|
27
|
+
export { type SortDirection, SortableHead, TABLE_FIRST_LINE, Table, type TableAlign, TableBody, TableCaption, TableCell, type TableCellProps, type TableCellText, type TableDensity, type TableFirstLine, TableFooter, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableInset, type TableProps, TableRow, type TableScroll, type TableTone };
|
package/dist/components/table.js
CHANGED
|
@@ -1,68 +1,30 @@
|
|
|
1
|
-
import { ArrowDownIcon, ArrowUpIcon } from "../icons.js";
|
|
2
1
|
import { cn } from "../lib/utils.js";
|
|
3
2
|
import { Button } from "./button.js";
|
|
3
|
+
import { TableCellFace, resolveTableAlign, tableCellClassName } from "./table-cell.js";
|
|
4
|
+
import { HEAD_CONTENT_CLASS, SORT_ICON_SLOT_CLASS, SortDirectionIcon, Table, TableBody, TableCaption, TableFooter, TableHead, TableHeader, TableRow, ariaSortOf, sortableHeadButtonClassName } from "./table-shell.js";
|
|
4
5
|
import { TruncatedText } from "./truncated-text.js";
|
|
5
6
|
import { TABLE_FIRST_LINE } from "./table-layout.js";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
// src/components/table.tsx
|
|
8
|
-
const
|
|
9
|
-
const table = /* @__PURE__ */ jsx("table", {
|
|
10
|
-
className: cn("w-full caption-bottom text-sm in-data-[slot=frame]:border-separate in-data-[slot=frame]:border-spacing-0", className),
|
|
11
|
-
"data-density": density,
|
|
12
|
-
"data-inset": inset,
|
|
13
|
-
"data-slot": "table",
|
|
14
|
-
...props
|
|
15
|
-
});
|
|
16
|
-
if (scroll === "parent") return table;
|
|
17
|
-
return /* @__PURE__ */ jsx("div", {
|
|
18
|
-
className: "relative w-full overflow-x-auto",
|
|
19
|
-
"data-slot": "table-container",
|
|
20
|
-
children: table
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
const TableHeader = ({ className, surface = "plain", sticky = false, ...props }) => /* @__PURE__ */ jsx("thead", {
|
|
24
|
-
className: cn("[&_tr]:border-b in-data-[slot=frame]:**:[th]:h-9 in-data-[slot=frame]:*:[tr]:border-none in-data-[slot=frame]:*:[tr]:hover:bg-transparent", surface === "muted" && "bg-muted/50", sticky && "bg-muted/80 sticky top-0 z-10 backdrop-blur", className),
|
|
25
|
-
"data-slot": "table-header",
|
|
26
|
-
...props
|
|
27
|
-
});
|
|
28
|
-
const TableBody = ({ className, ...props }) => /* @__PURE__ */ jsx("tbody", {
|
|
29
|
-
className: cn("in-data-[slot=frame]:*:[tr]:*:[td]:bg-background in-data-[slot=frame]:*:[tr]:data-[state=selected]:*:[td]:bg-muted/72 relative before:pointer-events-none before:absolute before:inset-px before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] not-in-data-[slot=frame]:before:hidden in-data-[slot=frame]:rounded-xl in-data-[slot=frame]:shadow-xs/5 dark:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_tr:last-child]:border-0 in-data-[slot=frame]:*:[tr]:border-0 in-data-[slot=frame]:*:[tr]:*:[td]:border-b in-data-[slot=frame]:*:[tr]:*:[td]:bg-clip-padding in-data-[slot=frame]:*:[tr]:first:*:[td]:first:rounded-ss-xl in-data-[slot=frame]:*:[tr]:*:[td]:first:border-s in-data-[slot=frame]:*:[tr]:first:*:[td]:border-t in-data-[slot=frame]:*:[tr]:last:*:[td]:last:rounded-ee-xl in-data-[slot=frame]:*:[tr]:*:[td]:last:border-e in-data-[slot=frame]:*:[tr]:first:*:[td]:last:rounded-se-xl in-data-[slot=frame]:*:[tr]:last:*:[td]:first:rounded-es-xl in-data-[slot=frame]:*:[tr]:hover:*:[td]:bg-transparent", className),
|
|
30
|
-
"data-slot": "table-body",
|
|
31
|
-
...props
|
|
32
|
-
});
|
|
33
|
-
const TableFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("tfoot", {
|
|
34
|
-
className: cn("bg-muted/72 border-t font-medium in-data-[slot=frame]:border-none in-data-[slot=frame]:bg-transparent in-data-[slot=frame]:*:[tr]:hover:bg-transparent [&>tr]:last:border-b-0", className),
|
|
35
|
-
"data-slot": "table-footer",
|
|
36
|
-
...props
|
|
37
|
-
});
|
|
38
|
-
const TableRow = ({ className, tone = "default", ...props }) => /* @__PURE__ */ jsx("tr", {
|
|
39
|
-
className: cn("hover:bg-muted/72 data-[state=selected]:bg-muted/72 border-b in-data-[density=compact]:hover:bg-transparent in-data-[slot=frame]:hover:bg-transparent in-data-[slot=frame]:data-[state=selected]:bg-transparent", tone === "muted" && "text-muted-foreground", className),
|
|
40
|
-
"data-slot": "table-row",
|
|
41
|
-
...props
|
|
42
|
-
});
|
|
43
|
-
const TABLE_ALIGN_CLASS = {
|
|
44
|
-
center: "text-center",
|
|
45
|
-
end: "text-end",
|
|
46
|
-
start: "text-start"
|
|
47
|
-
};
|
|
48
|
-
const resolveTableAlign = (align, numeric) => align ?? (numeric ? "end" : void 0);
|
|
49
|
-
const TableHead = ({ className, align, numeric = false, ...props }) => /* @__PURE__ */ jsx("th", {
|
|
50
|
-
className: cn("text-muted-foreground h-10 px-2.5 align-middle leading-none font-medium whitespace-nowrap in-data-[inset=card]:px-4 has-[[role=checkbox]]:w-px has-[[role=checkbox]]:pe-0", "in-data-[density=compact]:h-auto in-data-[density=compact]:px-0 in-data-[density=compact]:py-1 in-data-[density=compact]:pe-3 in-data-[density=compact]:text-xs", "in-data-[density=compact]:[tbody_&]:py-1.5 in-data-[density=compact]:[tbody_&]:text-sm in-data-[density=compact]:[tbody_&]:leading-6 in-data-[density=compact]:[tbody_&]:font-normal in-data-[density=compact]:[tbody_&]:whitespace-normal in-data-[density=compact]:[tbody_&]:text-inherit", TABLE_ALIGN_CLASS[resolveTableAlign(align, numeric) ?? "start"], numeric && "tabular-nums", className),
|
|
51
|
-
"data-slot": "table-head",
|
|
52
|
-
...props
|
|
53
|
-
});
|
|
54
|
-
const TableCell = ({ className, align, tone = "default", numeric = false, truncate = false, flush = false, children, ...props }) => {
|
|
55
|
-
const resolvedAlign = resolveTableAlign(align, numeric);
|
|
56
|
-
const cellClassName = cn("align-middle leading-none whitespace-nowrap has-[[role=checkbox]]:pe-0", flush ? "p-0" : "p-2.5 in-data-[density=compact]:px-0 in-data-[density=compact]:py-1.5 in-data-[inset=card]:px-4 in-data-[slot=frame]:first:p-[calc(--spacing(2.5)-1px)] in-data-[slot=frame]:last:p-[calc(--spacing(2.5)-1px)]", "in-data-[density=compact]:leading-6 in-data-[density=compact]:whitespace-normal", resolvedAlign !== void 0 && TABLE_ALIGN_CLASS[resolvedAlign], tone === "muted" && "text-muted-foreground", numeric && "tabular-nums", className);
|
|
9
|
+
const TableCell = ({ className, align, tone, numeric, truncate = false, flush = false, children, ...props }) => {
|
|
57
10
|
if (truncate) return /* @__PURE__ */ jsx(TruncatedText, {
|
|
58
|
-
className: cn("table-cell",
|
|
11
|
+
className: cn("table-cell", tableCellClassName({
|
|
12
|
+
align,
|
|
13
|
+
className,
|
|
14
|
+
flush,
|
|
15
|
+
numeric,
|
|
16
|
+
tone
|
|
17
|
+
})),
|
|
59
18
|
"data-slot": "table-cell",
|
|
60
19
|
render: /* @__PURE__ */ jsx("td", { ...props }),
|
|
61
20
|
children
|
|
62
21
|
});
|
|
63
|
-
return /* @__PURE__ */ jsx(
|
|
64
|
-
|
|
65
|
-
|
|
22
|
+
return /* @__PURE__ */ jsx(TableCellFace, {
|
|
23
|
+
align,
|
|
24
|
+
className,
|
|
25
|
+
flush,
|
|
26
|
+
numeric,
|
|
27
|
+
tone,
|
|
66
28
|
...props,
|
|
67
29
|
children
|
|
68
30
|
});
|
|
@@ -76,38 +38,27 @@ const TableCell = ({ className, align, tone = "default", numeric = false, trunca
|
|
|
76
38
|
*/
|
|
77
39
|
const SortableHead = ({ children, sortDirection = null, onSort, trailing, className, align, numeric = false, ...props }) => {
|
|
78
40
|
const endAligned = resolveTableAlign(align, numeric) === "end";
|
|
79
|
-
let ariaSort = "none";
|
|
80
|
-
if (sortDirection === "asc") ariaSort = "ascending";
|
|
81
|
-
else if (sortDirection === "desc") ariaSort = "descending";
|
|
82
|
-
let sortIcon = null;
|
|
83
|
-
if (sortDirection === "asc") sortIcon = /* @__PURE__ */ jsx(ArrowUpIcon, { className: "size-3" });
|
|
84
|
-
else if (sortDirection === "desc") sortIcon = /* @__PURE__ */ jsx(ArrowDownIcon, { className: "size-3" });
|
|
85
41
|
return /* @__PURE__ */ jsx(TableHead, {
|
|
86
42
|
align,
|
|
87
|
-
"aria-sort":
|
|
43
|
+
"aria-sort": ariaSortOf(sortDirection),
|
|
88
44
|
className,
|
|
89
45
|
numeric,
|
|
90
46
|
...props,
|
|
91
47
|
onClick: void 0,
|
|
92
48
|
children: /* @__PURE__ */ jsxs("span", {
|
|
93
|
-
className:
|
|
49
|
+
className: HEAD_CONTENT_CLASS,
|
|
94
50
|
children: [/* @__PURE__ */ jsxs(Button, {
|
|
95
|
-
className:
|
|
51
|
+
className: sortableHeadButtonClassName(endAligned),
|
|
96
52
|
onClick: onSort,
|
|
97
53
|
type: "button",
|
|
98
54
|
variant: "muted",
|
|
99
55
|
children: [/* @__PURE__ */ jsx(TruncatedText, { children }), /* @__PURE__ */ jsx("span", {
|
|
100
56
|
"aria-hidden": true,
|
|
101
|
-
className:
|
|
102
|
-
children:
|
|
57
|
+
className: SORT_ICON_SLOT_CLASS,
|
|
58
|
+
children: /* @__PURE__ */ jsx(SortDirectionIcon, { direction: sortDirection })
|
|
103
59
|
})]
|
|
104
60
|
}), trailing]
|
|
105
61
|
})
|
|
106
62
|
});
|
|
107
63
|
};
|
|
108
|
-
const TableCaption = ({ className, ...props }) => /* @__PURE__ */ jsx("caption", {
|
|
109
|
-
className: cn("text-muted-foreground mt-4 text-sm in-data-[slot=frame]:my-4", className),
|
|
110
|
-
"data-slot": "table-caption",
|
|
111
|
-
...props
|
|
112
|
-
});
|
|
113
64
|
export { SortableHead, TABLE_FIRST_LINE, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The strip's layout, for every variant. */
|
|
2
|
+
export declare const TABS_LIST_BASE_CLASS = "text-muted-foreground relative z-0 flex w-fit max-w-full items-center justify-center-safe gap-x-0.5";
|
|
3
|
+
/** The `default` strip's well. */
|
|
4
|
+
export declare const TABS_LIST_DEFAULT_CLASS = "bg-muted text-foreground-label rounded-lg p-0.5";
|
|
5
|
+
/** One tab's box, type and states. */
|
|
6
|
+
export declare const TABS_TAB_CLASS = "hover:text-foreground focus-visible:ring-ring data-active:text-foreground relative flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] text-base font-medium whitespace-nowrap outline-none select-none focus-visible:ring-2 focus-visible:ring-inset data-disabled:pointer-events-none data-disabled:opacity-64 data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start sm:h-8 sm:text-sm [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4";
|
|
7
|
+
/** The `default` strip's raised chip under the active tab. */
|
|
8
|
+
export declare const TABS_INDICATOR_DEFAULT_CLASS = "bg-background dark:bg-input -z-1 rounded-md shadow-sm/5";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/components/tabs-classes.ts
|
|
2
|
+
/** The strip's layout, for every variant. */
|
|
3
|
+
const TABS_LIST_BASE_CLASS = "text-muted-foreground relative z-0 flex w-fit max-w-full items-center justify-center-safe gap-x-0.5";
|
|
4
|
+
/** The `default` strip's well. */
|
|
5
|
+
const TABS_LIST_DEFAULT_CLASS = "bg-muted text-foreground-label rounded-lg p-0.5";
|
|
6
|
+
/** One tab's box, type and states. */
|
|
7
|
+
const TABS_TAB_CLASS = "hover:text-foreground focus-visible:ring-ring data-active:text-foreground relative flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] text-base font-medium whitespace-nowrap outline-none select-none focus-visible:ring-2 focus-visible:ring-inset data-disabled:pointer-events-none data-disabled:opacity-64 data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start sm:h-8 sm:text-sm [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4";
|
|
8
|
+
/** The `default` strip's raised chip under the active tab. */
|
|
9
|
+
const TABS_INDICATOR_DEFAULT_CLASS = "bg-background dark:bg-input -z-1 rounded-md shadow-sm/5";
|
|
10
|
+
export { TABS_INDICATOR_DEFAULT_CLASS, TABS_LIST_BASE_CLASS, TABS_LIST_DEFAULT_CLASS, TABS_TAB_CLASS };
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { hasTabOrderChanged, revealActiveTab } from "../lib/tab-order.js";
|
|
3
3
|
import { cn, composeRefs } from "../lib/utils.js";
|
|
4
|
+
import { TABS_INDICATOR_DEFAULT_CLASS, TABS_LIST_BASE_CLASS, TABS_LIST_DEFAULT_CLASS, TABS_TAB_CLASS } from "./tabs-classes.js";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
7
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
@@ -33,18 +34,18 @@ const TabsList = ({ variant = "default", className, children, ref, ...props }) =
|
|
|
33
34
|
};
|
|
34
35
|
}, []);
|
|
35
36
|
return /* @__PURE__ */ jsxs(Tabs$1.List, {
|
|
36
|
-
className: cn(
|
|
37
|
+
className: cn(TABS_LIST_BASE_CLASS, "scrollbar-none overflow-auto data-[orientation=horizontal]:overflow-y-hidden data-[orientation=horizontal]:overscroll-x-contain data-[orientation=vertical]:overflow-x-hidden data-[orientation=vertical]:overscroll-y-contain [&::-webkit-scrollbar]:hidden", "data-[orientation=vertical]:flex-col", variant === "default" ? TABS_LIST_DEFAULT_CLASS : "*:data-[slot=tabs-tab]:hover:bg-accent data-[orientation=horizontal]:py-1 data-[orientation=vertical]:px-1", className),
|
|
37
38
|
"data-slot": "tabs-list",
|
|
38
39
|
ref: composeRefs(listRef, ref),
|
|
39
40
|
...props,
|
|
40
41
|
children: [children, /* @__PURE__ */ jsx(Tabs$1.Indicator, {
|
|
41
|
-
className: cn("absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) -translate-y-(--active-tab-bottom) transition-[width,translate] duration-200 ease-in-out", variant === "underline" ? "bg-primary z-10 data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:-translate-x-px" :
|
|
42
|
+
className: cn("absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) -translate-y-(--active-tab-bottom) transition-[width,translate] duration-200 ease-in-out", variant === "underline" ? "bg-primary z-10 data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:-translate-x-px" : TABS_INDICATOR_DEFAULT_CLASS),
|
|
42
43
|
"data-slot": "tab-indicator"
|
|
43
44
|
})]
|
|
44
45
|
});
|
|
45
46
|
};
|
|
46
47
|
const TabsTab = ({ className, ...props }) => /* @__PURE__ */ jsx(Tabs$1.Tab, {
|
|
47
|
-
className: cn(
|
|
48
|
+
className: cn(TABS_TAB_CLASS, className),
|
|
48
49
|
"data-slot": "tabs-tab",
|
|
49
50
|
...props
|
|
50
51
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The checkbox's box: its size, border, focus ring and states. */
|
|
2
|
+
export declare const CHECKBOX_CLASS_NAME = "border-input bg-background ring-ring focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-sm border shadow-xs/5 outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-sm)-1px)] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 data-disabled:opacity-64 sm:size-4 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none";
|
|
3
|
+
/**
|
|
4
|
+
* `default` is a setting's own control; `sm` sits in a dense row or a menu
|
|
5
|
+
* beside small type.
|
|
6
|
+
*/
|
|
7
|
+
export type SwitchSize = "sm" | "default";
|
|
8
|
+
/** The switch's track: its shape, colours and focus ring. */
|
|
9
|
+
export declare const SWITCH_ROOT_CLASS_NAME = "focus-visible:ring-ring focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input relative inline-flex shrink-0 items-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-offset-1 data-disabled:opacity-64";
|
|
10
|
+
export declare const SWITCH_ROOT_SIZE_CLASS_NAME: {
|
|
11
|
+
readonly default: "h-5 w-9";
|
|
12
|
+
readonly sm: "h-4 w-7";
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/components/toggle-classes.ts
|
|
2
|
+
/** The checkbox's box: its size, border, focus ring and states. */
|
|
3
|
+
const CHECKBOX_CLASS_NAME = "border-input bg-background ring-ring focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-sm border shadow-xs/5 outline-none not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-sm)-1px)] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 data-disabled:opacity-64 sm:size-4 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none";
|
|
4
|
+
/** The switch's track: its shape, colours and focus ring. */
|
|
5
|
+
const SWITCH_ROOT_CLASS_NAME = "focus-visible:ring-ring focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input relative inline-flex shrink-0 items-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-offset-1 data-disabled:opacity-64";
|
|
6
|
+
const SWITCH_ROOT_SIZE_CLASS_NAME = {
|
|
7
|
+
default: "h-5 w-9",
|
|
8
|
+
sm: "h-4 w-7"
|
|
9
|
+
};
|
|
10
|
+
export { CHECKBOX_CLASS_NAME, SWITCH_ROOT_CLASS_NAME, SWITCH_ROOT_SIZE_CLASS_NAME };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The group's tray around its items. */
|
|
2
|
+
export declare const TOGGLE_GROUP_CLASS_NAME = "border-border/70 bg-muted/30 inline-flex w-fit shrink-0 items-center gap-0.5 rounded-lg border p-0.5 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch";
|
|
3
|
+
/** The chosen item: lifted onto the background, distinct from hover. */
|
|
4
|
+
export declare const TOGGLE_GROUP_ITEM_CLASS_NAME = "data-pressed:bg-background data-pressed:text-foreground";
|
|
5
|
+
/** A segmented icon toggle's sizes (./segmented-icon-toggle.tsx). */
|
|
6
|
+
export type SegmentedIconToggleSize = "compact" | "touch";
|
|
7
|
+
/** The segmented toggle's tray, over the group's. */
|
|
8
|
+
export declare const segmentedIconToggleClassName: (size: SegmentedIconToggleSize) => string;
|
|
9
|
+
/** One icon item of the segmented toggle, over an `icon-xs` muted button. */
|
|
10
|
+
export declare const segmentedIconToggleItemClassName: (size: SegmentedIconToggleSize) => string;
|
|
11
|
+
/** The glyph inside a segmented toggle's item. */
|
|
12
|
+
export declare const SEGMENTED_ICON_TOGGLE_ICON_CLASS_NAME = "size-3.5";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
// src/components/toggle-group-classes.ts
|
|
3
|
+
/** The group's tray around its items. */
|
|
4
|
+
const TOGGLE_GROUP_CLASS_NAME = "border-border/70 bg-muted/30 inline-flex w-fit shrink-0 items-center gap-0.5 rounded-lg border p-0.5 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch";
|
|
5
|
+
/** The chosen item: lifted onto the background, distinct from hover. */
|
|
6
|
+
const TOGGLE_GROUP_ITEM_CLASS_NAME = "data-pressed:bg-background data-pressed:text-foreground";
|
|
7
|
+
/** The segmented toggle's tray, over the group's. */
|
|
8
|
+
const segmentedIconToggleClassName = (size) => cn("rounded-md", size === "touch" ? "h-7 [@media(any-pointer:coarse)]:h-12" : "h-7");
|
|
9
|
+
/** One icon item of the segmented toggle, over an `icon-xs` muted button. */
|
|
10
|
+
const segmentedIconToggleItemClassName = (size) => cn("h-6 w-7 rounded-sm sm:h-6", size === "touch" && "[@media(any-pointer:coarse)]:h-11 [@media(any-pointer:coarse)]:w-11");
|
|
11
|
+
/** The glyph inside a segmented toggle's item. */
|
|
12
|
+
const SEGMENTED_ICON_TOGGLE_ICON_CLASS_NAME = "size-3.5";
|
|
13
|
+
export { SEGMENTED_ICON_TOGGLE_ICON_CLASS_NAME, TOGGLE_GROUP_CLASS_NAME, TOGGLE_GROUP_ITEM_CLASS_NAME, segmentedIconToggleClassName, segmentedIconToggleItemClassName };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { Toggle } from "./toggle.js";
|
|
4
|
+
import { TOGGLE_GROUP_CLASS_NAME, TOGGLE_GROUP_ITEM_CLASS_NAME } from "./toggle-group-classes.js";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { createContext, useContext } from "react";
|
|
6
7
|
import { ToggleGroup as ToggleGroup$1 } from "@base-ui/react/toggle-group";
|
|
@@ -21,7 +22,7 @@ const ToggleGroupSizeContext = createContext("xs");
|
|
|
21
22
|
const ToggleGroup = ({ className, size = "xs", ...props }) => /* @__PURE__ */ jsx(ToggleGroupSizeContext, {
|
|
22
23
|
value: size,
|
|
23
24
|
children: /* @__PURE__ */ jsx(ToggleGroup$1, {
|
|
24
|
-
className: cn(
|
|
25
|
+
className: cn(TOGGLE_GROUP_CLASS_NAME, className),
|
|
25
26
|
"data-slot": "toggle-group",
|
|
26
27
|
...props
|
|
27
28
|
})
|
|
@@ -34,7 +35,7 @@ const ToggleGroup = ({ className, size = "xs", ...props }) => /* @__PURE__ */ js
|
|
|
34
35
|
const ToggleGroupItem = ({ className, size, variant = "muted", ...props }) => {
|
|
35
36
|
const groupSize = useContext(ToggleGroupSizeContext);
|
|
36
37
|
return /* @__PURE__ */ jsx(Toggle, {
|
|
37
|
-
className: cn(
|
|
38
|
+
className: cn(TOGGLE_GROUP_ITEM_CLASS_NAME, className),
|
|
38
39
|
"data-slot": "toggle-group-item",
|
|
39
40
|
size: size ?? groupSize,
|
|
40
41
|
variant,
|
|
@@ -27,12 +27,17 @@ declare const TooltipTrigger: (props: Tooltip$1.Trigger.Props) => import("react"
|
|
|
27
27
|
declare const TooltipFactTrigger: ({ children }: {
|
|
28
28
|
children: ReactNode;
|
|
29
29
|
}) => import("react").JSX.Element;
|
|
30
|
-
declare const TooltipPopup: ({ className, align, sideOffset, side, children, shortcut, ...props }: Tooltip$1.Popup.Props & {
|
|
30
|
+
declare const TooltipPopup: ({ anchor, className, align, sideOffset, side, children, shortcut, ...props }: Tooltip$1.Popup.Props & {
|
|
31
31
|
/**
|
|
32
32
|
* The keys that do the same as the trigger, shown after the label and
|
|
33
33
|
* spelled for the reader's platform (`["mod", "K"]`).
|
|
34
34
|
*/
|
|
35
35
|
shortcut?: KbdKeys | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* The element the popup sits beside, when that is a part of the trigger
|
|
38
|
+
* rather than all of it (a wide row whose tooltip explains one detail).
|
|
39
|
+
*/
|
|
40
|
+
anchor?: Tooltip$1.Positioner.Props["anchor"] | undefined;
|
|
36
41
|
align?: Tooltip$1.Positioner.Props["align"];
|
|
37
42
|
side?: Tooltip$1.Positioner.Props["side"];
|
|
38
43
|
sideOffset?: Tooltip$1.Positioner.Props["sideOffset"];
|
|
@@ -41,7 +41,8 @@ const TooltipFactTrigger = ({ children }) => /* @__PURE__ */ jsx(Tooltip$1.Trigg
|
|
|
41
41
|
type: "button",
|
|
42
42
|
children
|
|
43
43
|
});
|
|
44
|
-
const TooltipPopup = ({ className, align = "center", sideOffset = 4, side = "top", children, shortcut, ...props }) => /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
44
|
+
const TooltipPopup = ({ anchor, className, align = "center", sideOffset = 4, side = "top", children, shortcut, ...props }) => /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
45
|
+
...anchor === void 0 ? {} : { anchor },
|
|
45
46
|
align,
|
|
46
47
|
className: cn(CONTENT_SIZED_POSITIONER_CLASS_NAME, "transition-[top,left,right,bottom,transform] data-instant:transition-none", OVERLAY_LAYER_CLASS_NAMES.popup),
|
|
47
48
|
collisionPadding: 8,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* How many lines the text may take before it is cut; `"none"` lets it take
|
|
4
|
+
* as many as it needs, for text that is cut only in some states (collapsed,
|
|
5
|
+
* compact) and shown whole in the others.
|
|
6
|
+
*/
|
|
7
|
+
type TruncatedTextLines = 1 | 2 | 3 | 4 | 5 | 6 | 8 | "none";
|
|
8
|
+
/**
|
|
9
|
+
* `max-w-full` caps the text at its container even where the container does
|
|
10
|
+
* not stretch it (a flex column with `items-start`, an inline-block): without
|
|
11
|
+
* it a nowrap line sizes to its whole text and runs past the container.
|
|
12
|
+
*/
|
|
13
|
+
declare const TRUNCATED_TEXT_LINES_CLASS: {
|
|
14
|
+
readonly 1: "block min-w-0 max-w-full truncate";
|
|
15
|
+
readonly 2: "line-clamp-2 min-w-0 max-w-full wrap-anywhere";
|
|
16
|
+
readonly 3: "line-clamp-3 min-w-0 max-w-full wrap-anywhere";
|
|
17
|
+
readonly 4: "line-clamp-4 min-w-0 max-w-full wrap-anywhere";
|
|
18
|
+
readonly 5: "line-clamp-5 min-w-0 max-w-full wrap-anywhere";
|
|
19
|
+
readonly 6: "line-clamp-6 min-w-0 max-w-full wrap-anywhere";
|
|
20
|
+
readonly 8: "line-clamp-8 min-w-0 max-w-full wrap-anywhere";
|
|
21
|
+
readonly none: "min-w-0 max-w-full";
|
|
22
|
+
};
|
|
23
|
+
type TruncatedTextFaceProps = ComponentProps<"span"> & {
|
|
24
|
+
lines?: TruncatedTextLines;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Cut text's face: the box `TruncatedText` draws, without the hint that shows
|
|
28
|
+
* the whole text, for a loading view drawn before the page mounts. It imports
|
|
29
|
+
* no tooltip or popover, so a view the server paints before the providers
|
|
30
|
+
* mount can draw one, and the text that replaces it lands in the same box.
|
|
31
|
+
*/
|
|
32
|
+
declare const TruncatedTextFace: ({ className, lines, ...props }: TruncatedTextFaceProps) => import("react").JSX.Element;
|
|
33
|
+
export { TRUNCATED_TEXT_LINES_CLASS, TruncatedTextFace, type TruncatedTextFaceProps, type TruncatedTextLines };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/truncated-text-face.tsx
|
|
4
|
+
/**
|
|
5
|
+
* `max-w-full` caps the text at its container even where the container does
|
|
6
|
+
* not stretch it (a flex column with `items-start`, an inline-block): without
|
|
7
|
+
* it a nowrap line sizes to its whole text and runs past the container.
|
|
8
|
+
*/
|
|
9
|
+
const TRUNCATED_TEXT_LINES_CLASS = {
|
|
10
|
+
1: "block min-w-0 max-w-full truncate",
|
|
11
|
+
2: "line-clamp-2 min-w-0 max-w-full wrap-anywhere",
|
|
12
|
+
3: "line-clamp-3 min-w-0 max-w-full wrap-anywhere",
|
|
13
|
+
4: "line-clamp-4 min-w-0 max-w-full wrap-anywhere",
|
|
14
|
+
5: "line-clamp-5 min-w-0 max-w-full wrap-anywhere",
|
|
15
|
+
6: "line-clamp-6 min-w-0 max-w-full wrap-anywhere",
|
|
16
|
+
8: "line-clamp-8 min-w-0 max-w-full wrap-anywhere",
|
|
17
|
+
none: "min-w-0 max-w-full"
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Cut text's face: the box `TruncatedText` draws, without the hint that shows
|
|
21
|
+
* the whole text, for a loading view drawn before the page mounts. It imports
|
|
22
|
+
* no tooltip or popover, so a view the server paints before the providers
|
|
23
|
+
* mount can draw one, and the text that replaces it lands in the same box.
|
|
24
|
+
*/
|
|
25
|
+
const TruncatedTextFace = ({ className, lines = 1, ...props }) => /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: cn(TRUNCATED_TEXT_LINES_CLASS[lines], className),
|
|
27
|
+
"data-slot": "truncated-text",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
export { TRUNCATED_TEXT_LINES_CLASS, TruncatedTextFace };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TooltipContent as TooltipPopup } from "./tooltip.js";
|
|
3
|
+
import { TruncatedTextLines } from "./truncated-text-face.js";
|
|
3
4
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
5
|
/**
|
|
5
6
|
* Text that ends in an ellipsis when it does not fit, and shows the whole of
|
|
@@ -15,12 +16,6 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
15
16
|
* button or other control: the tap belongs to that control.
|
|
16
17
|
*/
|
|
17
18
|
declare const TruncatedText: ({ children, className, hint, lines, render, side, tooltip, ...props }: TruncatedTextProps) => React.JSX.Element;
|
|
18
|
-
/**
|
|
19
|
-
* How many lines the text may take before it is cut; `"none"` lets it take
|
|
20
|
-
* as many as it needs, for text that is cut only in some states (collapsed,
|
|
21
|
-
* compact) and shown whole in the others.
|
|
22
|
-
*/
|
|
23
|
-
type TruncatedTextLines = 1 | 2 | 3 | 4 | 5 | 6 | 8 | "none";
|
|
24
19
|
type TruncatedTextProps = useRender.ComponentProps<"span"> & {
|
|
25
20
|
/**
|
|
26
21
|
* Whether cut text shows its whole self on hover, focus or tap. Pass false
|
|
@@ -3,6 +3,7 @@ import { containedEventHandler } from "../hooks/use-contained-handler.js";
|
|
|
3
3
|
import { cn } from "../lib/utils.js";
|
|
4
4
|
import { Popover, PopoverContent as PopoverPopup } from "./popover.js";
|
|
5
5
|
import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "./tooltip.js";
|
|
6
|
+
import { TRUNCATED_TEXT_LINES_CLASS } from "./truncated-text-face.js";
|
|
6
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import * as React from "react";
|
|
8
9
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
@@ -93,21 +94,6 @@ function recordPointerType(event) {
|
|
|
93
94
|
function forgetPointerType(event) {
|
|
94
95
|
LAST_POINTER_TYPE.delete(event.currentTarget);
|
|
95
96
|
}
|
|
96
|
-
/**
|
|
97
|
-
* `max-w-full` caps the text at its container even where the container does
|
|
98
|
-
* not stretch it (a flex column with `items-start`, an inline-block): without
|
|
99
|
-
* it a nowrap line sizes to its whole text and runs past the container.
|
|
100
|
-
*/
|
|
101
|
-
const TRUNCATED_TEXT_LINES_CLASS = {
|
|
102
|
-
1: "block min-w-0 max-w-full truncate",
|
|
103
|
-
2: "line-clamp-2 min-w-0 max-w-full wrap-anywhere",
|
|
104
|
-
3: "line-clamp-3 min-w-0 max-w-full wrap-anywhere",
|
|
105
|
-
4: "line-clamp-4 min-w-0 max-w-full wrap-anywhere",
|
|
106
|
-
5: "line-clamp-5 min-w-0 max-w-full wrap-anywhere",
|
|
107
|
-
6: "line-clamp-6 min-w-0 max-w-full wrap-anywhere",
|
|
108
|
-
8: "line-clamp-8 min-w-0 max-w-full wrap-anywhere",
|
|
109
|
-
none: "min-w-0 max-w-full"
|
|
110
|
-
};
|
|
111
97
|
/** Whether the element's text is cut by its box, in either direction. */
|
|
112
98
|
function isTextOverflowing(element) {
|
|
113
99
|
if (element === null) return false;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The bare "add a filter" button, a glyph alone. */
|
|
2
|
+
export declare const VIEW_FILTER_BUTTON: {
|
|
3
|
+
readonly size: "icon-xs";
|
|
4
|
+
readonly variant: "ghost";
|
|
5
|
+
};
|
|
6
|
+
/** The glyph on the "add a filter" button. */
|
|
7
|
+
export declare const VIEW_FILTER_ICON_CLASS_NAME = "size-3.5";
|
|
8
|
+
/** A filter's chip: its field, the operator and the value. */
|
|
9
|
+
export declare const VIEW_FILTER_CHIP: {
|
|
10
|
+
readonly className: "gap-1.5 font-normal";
|
|
11
|
+
readonly size: "xs";
|
|
12
|
+
readonly variant: "secondary";
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/components/view-toolbar-classes.ts
|
|
2
|
+
/** The bare "add a filter" button, a glyph alone. */
|
|
3
|
+
const VIEW_FILTER_BUTTON = {
|
|
4
|
+
size: "icon-xs",
|
|
5
|
+
variant: "ghost"
|
|
6
|
+
};
|
|
7
|
+
/** The glyph on the "add a filter" button. */
|
|
8
|
+
const VIEW_FILTER_ICON_CLASS_NAME = "size-3.5";
|
|
9
|
+
/** A filter's chip: its field, the operator and the value. */
|
|
10
|
+
const VIEW_FILTER_CHIP = {
|
|
11
|
+
className: "gap-1.5 font-normal",
|
|
12
|
+
size: "xs",
|
|
13
|
+
variant: "secondary"
|
|
14
|
+
};
|
|
15
|
+
export { VIEW_FILTER_BUTTON, VIEW_FILTER_CHIP, VIEW_FILTER_ICON_CLASS_NAME };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The one row that holds a view switcher and its toolbar. It never wraps: at
|
|
4
|
+
* any width the tabs and the controls share a single line, the tabs taking the
|
|
5
|
+
* free space and scrolling, the toolbar keeping its place at the end.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ViewChromeBar: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Shared view controls, placed at the end of a `ViewChromeBar`. They stay on
|
|
10
|
+
* one line and scroll horizontally once they outgrow half the row on a phone,
|
|
11
|
+
* or two thirds of it from `md` up, so the tabs beside them always keep room
|
|
12
|
+
* for a whole tab and scroll, and a control past the edge is scrolled to rather
|
|
13
|
+
* than clipped.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ViewToolbarChrome: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
16
|
+
/** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
|
|
17
|
+
export declare const ViewFilterButtonFace: () => import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* The face of a `ViewFilterChip` (./view-toolbar.tsx), for a loading view:
|
|
20
|
+
* the chip's box around what the caller draws of its content.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ViewFilterChipFace: ({ children }: {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FilterIcon } from "../icons.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { ButtonFace } from "./control-face.js";
|
|
4
|
+
import { VIEW_FILTER_BUTTON, VIEW_FILTER_CHIP, VIEW_FILTER_ICON_CLASS_NAME } from "./view-toolbar-classes.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/components/view-toolbar-shell.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The one row that holds a view switcher and its toolbar. It never wraps: at
|
|
9
|
+
* any width the tabs and the controls share a single line, the tabs taking the
|
|
10
|
+
* free space and scrolling, the toolbar keeping its place at the end.
|
|
11
|
+
*/
|
|
12
|
+
const ViewChromeBar = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
13
|
+
className: cn("flex min-w-0 flex-nowrap items-center border-b", className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Shared view controls, placed at the end of a `ViewChromeBar`. They stay on
|
|
18
|
+
* one line and scroll horizontally once they outgrow half the row on a phone,
|
|
19
|
+
* or two thirds of it from `md` up, so the tabs beside them always keep room
|
|
20
|
+
* for a whole tab and scroll, and a control past the edge is scrolled to rather
|
|
21
|
+
* than clipped.
|
|
22
|
+
*/
|
|
23
|
+
const ViewToolbarChrome = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: cn("ms-auto flex max-w-1/2 min-w-0 shrink-0 [scrollbar-width:none] flex-nowrap items-center gap-1 overflow-x-auto px-2 py-1 [-ms-overflow-style:none] md:max-w-2/3 [&::-webkit-scrollbar]:hidden", className),
|
|
25
|
+
...props
|
|
26
|
+
});
|
|
27
|
+
/** The face of `ViewFilterButton` (./view-toolbar.tsx), for a loading view. */
|
|
28
|
+
const ViewFilterButtonFace = () => /* @__PURE__ */ jsx(ButtonFace, {
|
|
29
|
+
size: VIEW_FILTER_BUTTON.size,
|
|
30
|
+
variant: VIEW_FILTER_BUTTON.variant,
|
|
31
|
+
children: /* @__PURE__ */ jsx(FilterIcon, { className: VIEW_FILTER_ICON_CLASS_NAME })
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* The face of a `ViewFilterChip` (./view-toolbar.tsx), for a loading view:
|
|
35
|
+
* the chip's box around what the caller draws of its content.
|
|
36
|
+
*/
|
|
37
|
+
const ViewFilterChipFace = ({ children }) => /* @__PURE__ */ jsx(ButtonFace, {
|
|
38
|
+
className: VIEW_FILTER_CHIP.className,
|
|
39
|
+
size: VIEW_FILTER_CHIP.size,
|
|
40
|
+
variant: VIEW_FILTER_CHIP.variant,
|
|
41
|
+
children
|
|
42
|
+
});
|
|
43
|
+
export { ViewChromeBar, ViewFilterButtonFace, ViewFilterChipFace, ViewToolbarChrome };
|