@stll/ui 0.75.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/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 -24
- package/dist/components/list.js +2 -49
- 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/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-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/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/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/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 +44 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
2
|
+
// src/components/select-classes.ts
|
|
3
|
+
/** The trigger's metric per control size, over the field trigger's box. */
|
|
4
|
+
const SELECT_TRIGGER_SIZE_CLASS_NAMES = {
|
|
5
|
+
[CONTROL_SIZE.sm]: "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] text-sm sm:min-h-7 sm:text-xs",
|
|
6
|
+
[CONTROL_SIZE.default]: void 0,
|
|
7
|
+
[CONTROL_SIZE.lg]: "min-h-10 sm:min-h-9"
|
|
8
|
+
};
|
|
9
|
+
/** The chosen value's line inside the trigger. */
|
|
10
|
+
const SELECT_VALUE_CLASS_NAME = "data-placeholder:text-muted-foreground flex-1 truncate";
|
|
11
|
+
/** The up-down chevrons at the trigger's end. */
|
|
12
|
+
const SELECT_TRIGGER_ICON_CLASS_NAME = "-me-1 size-4.5 opacity-80 sm:size-4";
|
|
13
|
+
export { SELECT_TRIGGER_ICON_CLASS_NAME, SELECT_TRIGGER_SIZE_CLASS_NAMES, SELECT_VALUE_CLASS_NAME };
|
|
@@ -5,6 +5,7 @@ import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
|
5
5
|
import { FIELD_TRIGGER_CLASS_NAME } from "../lib/field-trigger.js";
|
|
6
6
|
import { OVERLAY_LAYER_CLASS_NAMES } from "../lib/overlay-layer.js";
|
|
7
7
|
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { SELECT_TRIGGER_ICON_CLASS_NAME, SELECT_TRIGGER_SIZE_CLASS_NAMES, SELECT_VALUE_CLASS_NAME } from "./select-classes.js";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import * as React from "react";
|
|
10
11
|
import { Select as Select$1 } from "@base-ui/react/select";
|
|
@@ -37,18 +38,13 @@ const SelectTrigger = ({ className, align = "center", size = CONTROL_SIZE.defaul
|
|
|
37
38
|
...props,
|
|
38
39
|
children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
39
40
|
"data-slot": "select-icon",
|
|
40
|
-
children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, { className:
|
|
41
|
+
children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, { className: SELECT_TRIGGER_ICON_CLASS_NAME })
|
|
41
42
|
})]
|
|
42
43
|
});
|
|
43
|
-
const SELECT_TRIGGER_SIZE_CLASS_NAMES = {
|
|
44
|
-
[CONTROL_SIZE.sm]: "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] text-sm sm:min-h-7 sm:text-xs",
|
|
45
|
-
[CONTROL_SIZE.default]: void 0,
|
|
46
|
-
[CONTROL_SIZE.lg]: "min-h-10 sm:min-h-9"
|
|
47
|
-
};
|
|
48
44
|
const SelectValue = ({ className, children, placeholder, ...props }) => {
|
|
49
45
|
const displays = React.use(SelectItemDisplaysContext);
|
|
50
46
|
if (children !== void 0 || displays.size === 0) return /* @__PURE__ */ jsx(Select$1.Value, {
|
|
51
|
-
className: cn(
|
|
47
|
+
className: cn(SELECT_VALUE_CLASS_NAME, className),
|
|
52
48
|
"data-slot": "select-value",
|
|
53
49
|
placeholder,
|
|
54
50
|
...props,
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
declare const Skeleton: ({ className, ...props }: React.ComponentProps<"div">) => import("react").JSX.Element;
|
|
2
|
-
|
|
2
|
+
/** Phrasing content for a skeleton inside a paragraph or an inline control. */
|
|
3
|
+
declare const InlineSkeleton: ({ className, ...props }: React.ComponentProps<"span">) => import("react").JSX.Element;
|
|
4
|
+
export { InlineSkeleton, Skeleton };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
// src/components/skeleton.tsx
|
|
4
|
+
const SKELETON_CLASS_NAME = "animate-skeleton rounded-sm [--skeleton-highlight:--alpha(var(--color-white)/64%)] [background:linear-gradient(120deg,transparent_40%,var(--skeleton-highlight),transparent_60%)_var(--color-muted)_0_0/200%_100%_fixed] dark:[--skeleton-highlight:--alpha(var(--color-white)/4%)]";
|
|
4
5
|
const Skeleton = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
5
|
-
className: cn(
|
|
6
|
+
className: cn(SKELETON_CLASS_NAME, className),
|
|
6
7
|
"data-slot": "skeleton",
|
|
7
8
|
...props
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
+
/** Phrasing content for a skeleton inside a paragraph or an inline control. */
|
|
11
|
+
const InlineSkeleton = ({ className, ...props }) => /* @__PURE__ */ jsx("span", {
|
|
12
|
+
className: cn(SKELETON_CLASS_NAME, className),
|
|
13
|
+
"data-slot": "skeleton",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
export { InlineSkeleton, Skeleton };
|
|
@@ -2,6 +2,7 @@ import { BUTTON_CONTENT, Button } from "./button.js";
|
|
|
2
2
|
import { ComponentProps, ReactNode } from "react";
|
|
3
3
|
import { DropdownMenu as Menu } from "./menu.js";
|
|
4
4
|
import { Popover } from "./popover.js";
|
|
5
|
+
import { SplitButtonSize } from "./control-face.js";
|
|
5
6
|
type SplitButtonSharedProps = {
|
|
6
7
|
menuLabel: string;
|
|
7
8
|
primaryDescriptionId?: string;
|
|
@@ -10,7 +11,7 @@ type SplitButtonSharedProps = {
|
|
|
10
11
|
menu: ReactNode;
|
|
11
12
|
primaryDisabled?: boolean;
|
|
12
13
|
menuDisabled?: boolean;
|
|
13
|
-
size?:
|
|
14
|
+
size?: SplitButtonSize;
|
|
14
15
|
className?: string;
|
|
15
16
|
};
|
|
16
17
|
type SplitButtonPrimary = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ChevronDownIcon } from "../icons.js";
|
|
3
2
|
import { cn } from "../lib/utils.js";
|
|
4
3
|
import { BUTTON_CONTENT, Button } from "./button.js";
|
|
4
|
+
import { SPLIT_BUTTON_PRIMARY_CLASS, SPLIT_BUTTON_ROOT_CLASS, SPLIT_BUTTON_TRIGGER_CLASS, SplitButtonChevron } from "./control-face.js";
|
|
5
5
|
import { DropdownMenu as Menu, DropdownMenuTrigger as MenuTrigger } from "./menu.js";
|
|
6
6
|
import { Popover, PopoverTrigger } from "./popover.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -15,19 +15,19 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
const SplitButton = (props) => {
|
|
16
16
|
const { primaryLabel, menuLabel, primaryDescriptionId, menuDescriptionId, onPrimaryClick, children, menu, primaryDisabled, menuDisabled, size = "md", className } = props;
|
|
17
17
|
const triggerButton = /* @__PURE__ */ jsx(Button, {
|
|
18
|
-
className:
|
|
18
|
+
className: SPLIT_BUTTON_TRIGGER_CLASS[size],
|
|
19
19
|
size: "sm",
|
|
20
20
|
tooltip: menuLabel,
|
|
21
21
|
variant: "ghost"
|
|
22
22
|
});
|
|
23
23
|
const controls = /* @__PURE__ */ jsxs("div", {
|
|
24
|
-
className: cn(
|
|
24
|
+
className: cn(SPLIT_BUTTON_ROOT_CLASS, className),
|
|
25
25
|
"data-size": size,
|
|
26
26
|
"data-slot": "split-button",
|
|
27
27
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
28
28
|
"aria-describedby": primaryDescriptionId,
|
|
29
29
|
"aria-label": primaryLabel,
|
|
30
|
-
className:
|
|
30
|
+
className: SPLIT_BUTTON_PRIMARY_CLASS[size],
|
|
31
31
|
disabled: primaryDisabled,
|
|
32
32
|
onClick: onPrimaryClick,
|
|
33
33
|
size: "sm",
|
|
@@ -39,21 +39,13 @@ const SplitButton = (props) => {
|
|
|
39
39
|
"aria-label": menuLabel,
|
|
40
40
|
disabled: menuDisabled,
|
|
41
41
|
render: triggerButton,
|
|
42
|
-
children: /* @__PURE__ */ jsx(
|
|
43
|
-
"aria-hidden": "true",
|
|
44
|
-
className: "size-[0.65625rem]",
|
|
45
|
-
strokeWidth: 1.5
|
|
46
|
-
})
|
|
42
|
+
children: /* @__PURE__ */ jsx(SplitButtonChevron, {})
|
|
47
43
|
}) : /* @__PURE__ */ jsx(MenuTrigger, {
|
|
48
44
|
"aria-describedby": menuDescriptionId,
|
|
49
45
|
"aria-label": menuLabel,
|
|
50
46
|
disabled: menuDisabled,
|
|
51
47
|
render: triggerButton,
|
|
52
|
-
children: /* @__PURE__ */ jsx(
|
|
53
|
-
"aria-hidden": "true",
|
|
54
|
-
className: "size-[0.65625rem]",
|
|
55
|
-
strokeWidth: 1.5
|
|
56
|
-
})
|
|
48
|
+
children: /* @__PURE__ */ jsx(SplitButtonChevron, {})
|
|
57
49
|
})]
|
|
58
50
|
});
|
|
59
51
|
if (props.surface === "popover") return /* @__PURE__ */ jsxs(Popover, {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
3
|
-
|
|
4
|
-
* `default` is a setting's own control; `sm` sits in a dense row or a menu
|
|
5
|
-
* beside small type.
|
|
6
|
-
*/
|
|
7
|
-
type SwitchSize = "sm" | "default";
|
|
3
|
+
import { SwitchSize } from "./toggle-classes.js";
|
|
8
4
|
type SwitchProps = Switch$1.Root.Props & {
|
|
9
5
|
size?: SwitchSize | undefined;
|
|
10
6
|
};
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { SWITCH_ROOT_CLASS_NAME, SWITCH_ROOT_SIZE_CLASS_NAME } from "./toggle-classes.js";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { useId } from "react";
|
|
5
6
|
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
6
7
|
// src/components/switch.tsx
|
|
7
|
-
const SWITCH_ROOT_SIZE_CLASS_NAME = {
|
|
8
|
-
default: "h-5 w-9",
|
|
9
|
-
sm: "h-4 w-7"
|
|
10
|
-
};
|
|
11
8
|
const SWITCH_THUMB_SIZE_CLASS_NAME = {
|
|
12
9
|
default: "size-4 ltr:data-checked:translate-x-4.5 ltr:data-unchecked:translate-x-0.5 rtl:data-checked:-translate-x-4.5 rtl:data-unchecked:-translate-x-0.5",
|
|
13
10
|
sm: "size-3 ltr:data-checked:translate-x-3.5 ltr:data-unchecked:translate-x-0.5 rtl:data-checked:-translate-x-3.5 rtl:data-unchecked:-translate-x-0.5"
|
|
14
11
|
};
|
|
15
12
|
const Switch = ({ className, size = "default", ...props }) => /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
16
|
-
className: cn(
|
|
13
|
+
className: cn(SWITCH_ROOT_CLASS_NAME, SWITCH_ROOT_SIZE_CLASS_NAME[size], className),
|
|
17
14
|
"data-size": size,
|
|
18
15
|
"data-slot": "switch",
|
|
19
16
|
...props,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Where a column sets its content. `end` lines up figures and amounts;
|
|
4
|
+
* `start` is the default reading edge. A `numeric` head or cell sets to the
|
|
5
|
+
* end unless it names an alignment, so a figures column needs one prop.
|
|
6
|
+
*/
|
|
7
|
+
type TableAlign = "start" | "center" | "end";
|
|
8
|
+
/** A muted row or cell supports its neighbours. */
|
|
9
|
+
type TableTone = "default" | "muted";
|
|
10
|
+
declare const TABLE_ALIGN_CLASS: {
|
|
11
|
+
readonly center: "text-center";
|
|
12
|
+
readonly end: "text-end";
|
|
13
|
+
readonly start: "text-start";
|
|
14
|
+
};
|
|
15
|
+
declare const PROSE_CELL_CLASS = "in-data-[density=prose]:h-auto in-data-[density=prose]:border-e in-data-[density=prose]:border-b in-data-[density=prose]:px-3 in-data-[density=prose]:py-2 in-data-[density=prose]:align-top in-data-[density=prose]:leading-normal in-data-[density=prose]:last:border-e-0 in-data-[density=prose]:min-w-24 in-data-[density=prose]:first:min-w-36 in-data-[cell-text=wrap]:in-data-[density=prose]:wrap-anywhere in-data-[cell-text=wrap]:in-data-[density=prose]:whitespace-normal";
|
|
16
|
+
declare const resolveTableAlign: (align: TableAlign | undefined, numeric: boolean) => TableAlign | undefined;
|
|
17
|
+
type TableCellFaceProps = Omit<React.ComponentProps<"td">, "align"> & {
|
|
18
|
+
align?: TableAlign | undefined;
|
|
19
|
+
tone?: TableTone | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Figures set in tabular numerals and to the end of the cell (unless
|
|
22
|
+
* `align` says otherwise), so digits line up down the column.
|
|
23
|
+
*/
|
|
24
|
+
numeric?: boolean | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The cell holds one control that fills it edge to edge and pads itself (a
|
|
27
|
+
* button that opens the row's record), so the cell adds no padding and the
|
|
28
|
+
* control's hover band reaches the cell's borders.
|
|
29
|
+
*/
|
|
30
|
+
flush?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type TableCellStyleProps = Pick<TableCellFaceProps, "align" | "className" | "flush" | "numeric" | "tone">;
|
|
33
|
+
declare const tableCellClassName: ({ align, className, flush, numeric, tone }: TableCellStyleProps) => string;
|
|
34
|
+
declare const TableCellFace: ({ align, className, flush, numeric, tone, ...props }: TableCellFaceProps) => React.JSX.Element;
|
|
35
|
+
export { PROSE_CELL_CLASS, TABLE_ALIGN_CLASS, type TableAlign, TableCellFace, type TableCellFaceProps, type TableTone, resolveTableAlign, tableCellClassName };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/table-cell.tsx
|
|
4
|
+
const TABLE_ALIGN_CLASS = {
|
|
5
|
+
center: "text-center",
|
|
6
|
+
end: "text-end",
|
|
7
|
+
start: "text-start"
|
|
8
|
+
};
|
|
9
|
+
const PROSE_CELL_CLASS = "in-data-[density=prose]:h-auto in-data-[density=prose]:border-e in-data-[density=prose]:border-b in-data-[density=prose]:px-3 in-data-[density=prose]:py-2 in-data-[density=prose]:align-top in-data-[density=prose]:leading-normal in-data-[density=prose]:last:border-e-0 in-data-[density=prose]:min-w-24 in-data-[density=prose]:first:min-w-36 in-data-[cell-text=wrap]:in-data-[density=prose]:wrap-anywhere in-data-[cell-text=wrap]:in-data-[density=prose]:whitespace-normal";
|
|
10
|
+
const resolveTableAlign = (align, numeric) => align ?? (numeric ? "end" : void 0);
|
|
11
|
+
const tableCellClassName = ({ align, className, flush = false, numeric = false, tone = "default" }) => {
|
|
12
|
+
const resolvedAlign = resolveTableAlign(align, numeric);
|
|
13
|
+
return 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", PROSE_CELL_CLASS, "in-data-[density=prose]:[tr:last-child>&]:border-b-0", resolvedAlign !== void 0 && TABLE_ALIGN_CLASS[resolvedAlign], tone === "muted" && "text-muted-foreground", numeric && "tabular-nums", className);
|
|
14
|
+
};
|
|
15
|
+
const TableCellFace = ({ align, className, flush = false, numeric, tone, ...props }) => /* @__PURE__ */ jsx("td", {
|
|
16
|
+
className: tableCellClassName({
|
|
17
|
+
align,
|
|
18
|
+
className,
|
|
19
|
+
flush,
|
|
20
|
+
numeric,
|
|
21
|
+
tone
|
|
22
|
+
}),
|
|
23
|
+
"data-slot": "table-cell",
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
export { PROSE_CELL_CLASS, TABLE_ALIGN_CLASS, TableCellFace, resolveTableAlign, tableCellClassName };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { TableAlign, TableCellFace, TableTone } from "./table-cell.js";
|
|
3
|
+
/**
|
|
4
|
+
* How far cells pad their content from the column edges.
|
|
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
|
+
* `prose` is a table of sentences read across columns (an AI answer's
|
|
30
|
+
* comparison, a clause review): ruled columns and rows, cells padded and set
|
|
31
|
+
* at reading leading from their top, a quiet header in normal weight, and a
|
|
32
|
+
* first column wide enough to hold a few words per line. Its cells wrap or
|
|
33
|
+
* stay on one line as `cellText` says.
|
|
34
|
+
*/
|
|
35
|
+
type TableDensity = "default" | "compact" | "prose";
|
|
36
|
+
/**
|
|
37
|
+
* How a `prose` table sets long cell text: `wrap` breaks it over lines,
|
|
38
|
+
* `single-line` keeps every cell on one line and leaves the table wider than
|
|
39
|
+
* its box for the scroller around it.
|
|
40
|
+
*/
|
|
41
|
+
type TableCellText = "wrap" | "single-line";
|
|
42
|
+
type TableProps = React.ComponentProps<"table"> & {
|
|
43
|
+
cellText?: TableCellText;
|
|
44
|
+
density?: TableDensity;
|
|
45
|
+
inset?: TableInset;
|
|
46
|
+
scroll?: TableScroll;
|
|
47
|
+
};
|
|
48
|
+
declare const Table: ({ cellText, className, density, inset, scroll, ...props }: TableProps) => React.JSX.Element;
|
|
49
|
+
type TableHeaderProps = React.ComponentProps<"thead"> & {
|
|
50
|
+
/**
|
|
51
|
+
* `muted` lays the header row on a muted band, separating it from the rows
|
|
52
|
+
* of a long list.
|
|
53
|
+
*/
|
|
54
|
+
surface?: "plain" | "muted";
|
|
55
|
+
/**
|
|
56
|
+
* Keeps the header in view while the rows scroll under it, on a translucent
|
|
57
|
+
* muted band. The table must scroll with its parent (`scroll="parent"`).
|
|
58
|
+
*/
|
|
59
|
+
sticky?: boolean;
|
|
60
|
+
};
|
|
61
|
+
declare const TableHeader: ({ className, surface, sticky, ...props }: TableHeaderProps) => React.JSX.Element;
|
|
62
|
+
declare const TableBody: ({ className, ...props }: React.ComponentProps<"tbody">) => React.JSX.Element;
|
|
63
|
+
declare const TableFooter: ({ className, ...props }: React.ComponentProps<"tfoot">) => React.JSX.Element;
|
|
64
|
+
declare const TableRow: ({ className, tone, ...props }: React.ComponentProps<"tr"> & {
|
|
65
|
+
tone?: TableTone | undefined;
|
|
66
|
+
}) => React.JSX.Element;
|
|
67
|
+
type TableHeadProps = Omit<React.ComponentProps<"th">, "align"> & {
|
|
68
|
+
align?: TableAlign | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Heads a column of figures: tabular numerals, like its cells, set to the
|
|
71
|
+
* end unless `align` says otherwise.
|
|
72
|
+
*/
|
|
73
|
+
numeric?: boolean | undefined;
|
|
74
|
+
};
|
|
75
|
+
declare const TableHead: ({ className, align, numeric, ...props }: TableHeadProps) => React.JSX.Element;
|
|
76
|
+
declare const TableCaption: ({ className, ...props }: React.ComponentProps<"caption">) => React.JSX.Element;
|
|
77
|
+
type SortDirection = "asc" | "desc" | null;
|
|
78
|
+
/** A sortable head's `aria-sort` for its direction. */
|
|
79
|
+
declare const ariaSortOf: (direction: SortDirection) => "ascending" | "descending" | "none";
|
|
80
|
+
/** The arrow after a sorted head's label; nothing for an unsorted one. */
|
|
81
|
+
declare const SortDirectionIcon: ({ direction }: {
|
|
82
|
+
direction: SortDirection;
|
|
83
|
+
}) => React.JSX.Element | null;
|
|
84
|
+
/** A head's label and the control after it, on one line. */
|
|
85
|
+
declare const HEAD_CONTENT_CLASS = "inline-flex items-center gap-1";
|
|
86
|
+
/** The arrow's slot, held open so a label never moves as the sort flips. */
|
|
87
|
+
declare const SORT_ICON_SLOT_CLASS = "inline-flex w-3 shrink-0 justify-center";
|
|
88
|
+
/**
|
|
89
|
+
* A sortable head's button: a quiet button whose inline padding equals the
|
|
90
|
+
* head's, pulled back by a negative margin so the label lines up with the
|
|
91
|
+
* cells and the button never reaches past the table's edge. In an
|
|
92
|
+
* end-aligned (numeric) column the arrow sits before the label.
|
|
93
|
+
*/
|
|
94
|
+
declare const sortableHeadButtonClassName: (endAligned: boolean) => string;
|
|
95
|
+
/** A head's label before its page has loaded: the cut line it sits on. */
|
|
96
|
+
declare const TableHeadLabel: ({ children }: {
|
|
97
|
+
children: React.ReactNode;
|
|
98
|
+
}) => React.JSX.Element;
|
|
99
|
+
type SortableHeadFaceProps = Omit<TableHeadProps, "children" | "onClick"> & {
|
|
100
|
+
children: React.ReactNode;
|
|
101
|
+
sortDirection?: SortDirection;
|
|
102
|
+
/** Drawn next to the label, where the head's trailing control goes. */
|
|
103
|
+
trailing?: React.ReactNode;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* A sortable head before its page has loaded: the label in the sort button's
|
|
107
|
+
* face and the arrow in its slot, with no behaviour.
|
|
108
|
+
*/
|
|
109
|
+
declare const SortableHeadFace: ({ align, children, numeric, sortDirection, trailing, ...props }: SortableHeadFaceProps) => React.JSX.Element;
|
|
110
|
+
type TableSkeletonColumn = {
|
|
111
|
+
id: string;
|
|
112
|
+
className?: string | undefined;
|
|
113
|
+
align?: TableAlign | undefined;
|
|
114
|
+
} & ({
|
|
115
|
+
bar: string;
|
|
116
|
+
} | {
|
|
117
|
+
placeholder: React.ReactNode;
|
|
118
|
+
});
|
|
119
|
+
/** Rows that share the table's cell geometry and its caller's column order. */
|
|
120
|
+
declare const TableSkeletonRows: ({ columns, count, rowClassName }: {
|
|
121
|
+
columns: readonly TableSkeletonColumn[];
|
|
122
|
+
/** Rows to draw, clamped to the reserved placeholder keys. */
|
|
123
|
+
count?: number | undefined;
|
|
124
|
+
rowClassName?: string | undefined;
|
|
125
|
+
}) => React.JSX.Element[];
|
|
126
|
+
export { HEAD_CONTENT_CLASS, SORT_ICON_SLOT_CLASS, type SortDirection, SortDirectionIcon, SortableHeadFace, Table, type TableAlign, TableBody, TableCaption, TableCellFace, type TableCellText, type TableDensity, TableFooter, TableHead, TableHeadLabel, type TableHeadProps, TableHeader, type TableHeaderProps, type TableInset, type TableProps, TableRow, type TableScroll, TableSkeletonRows, type TableTone, ariaSortOf, sortableHeadButtonClassName };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ArrowDownIcon, ArrowUpIcon } from "../icons.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { buttonFaceClassName } from "./control-face.js";
|
|
4
|
+
import { InlineSkeleton } from "./skeleton.js";
|
|
5
|
+
import { PROSE_CELL_CLASS, TABLE_ALIGN_CLASS, TableCellFace, resolveTableAlign } from "./table-cell.js";
|
|
6
|
+
import { TRUNCATED_TEXT_LINES_CLASS } from "./truncated-text-face.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/table-shell.tsx
|
|
9
|
+
const Table = ({ cellText = "wrap", className, density = "default", inset = "default", scroll = "self", ...props }) => {
|
|
10
|
+
const table = /* @__PURE__ */ jsx("table", {
|
|
11
|
+
className: cn("w-full caption-bottom text-sm in-data-[slot=frame]:border-separate in-data-[slot=frame]:border-spacing-0", density === "prose" && "border-separate border-spacing-0", className),
|
|
12
|
+
"data-cell-text": cellText,
|
|
13
|
+
"data-density": density,
|
|
14
|
+
"data-inset": inset,
|
|
15
|
+
"data-slot": "table",
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
if (scroll === "parent") return table;
|
|
19
|
+
return /* @__PURE__ */ jsx("div", {
|
|
20
|
+
className: "relative w-full overflow-x-auto",
|
|
21
|
+
"data-slot": "table-container",
|
|
22
|
+
children: table
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const TableHeader = ({ className, surface = "plain", sticky = false, ...props }) => /* @__PURE__ */ jsx("thead", {
|
|
26
|
+
className: cn("[&_tr]:border-b in-data-[slot=frame]:**:[th]:h-9 in-data-[density=prose]:*:[tr]:hover:bg-transparent 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", sticky && "in-data-[density=prose]:bg-card in-data-[density=prose]:backdrop-blur-none", className),
|
|
27
|
+
"data-slot": "table-header",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
const TableBody = ({ className, ...props }) => /* @__PURE__ */ jsx("tbody", {
|
|
31
|
+
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),
|
|
32
|
+
"data-slot": "table-body",
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
const TableFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("tfoot", {
|
|
36
|
+
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),
|
|
37
|
+
"data-slot": "table-footer",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
const TableRow = ({ className, tone = "default", ...props }) => /* @__PURE__ */ jsx("tr", {
|
|
41
|
+
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),
|
|
42
|
+
"data-slot": "table-row",
|
|
43
|
+
...props
|
|
44
|
+
});
|
|
45
|
+
const TableHead = ({ className, align, numeric = false, ...props }) => /* @__PURE__ */ jsx("th", {
|
|
46
|
+
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", PROSE_CELL_CLASS, "in-data-[density=prose]:[thead_&]:bg-muted in-data-[density=prose]:font-normal", TABLE_ALIGN_CLASS[resolveTableAlign(align, numeric) ?? "start"], numeric && "tabular-nums", className),
|
|
47
|
+
"data-slot": "table-head",
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
const TableCaption = ({ className, ...props }) => /* @__PURE__ */ jsx("caption", {
|
|
51
|
+
className: cn("text-muted-foreground mt-4 text-sm in-data-[slot=frame]:my-4", className),
|
|
52
|
+
"data-slot": "table-caption",
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
/** A sortable head's `aria-sort` for its direction. */
|
|
56
|
+
const ariaSortOf = (direction) => {
|
|
57
|
+
if (direction === "asc") return "ascending";
|
|
58
|
+
if (direction === "desc") return "descending";
|
|
59
|
+
return "none";
|
|
60
|
+
};
|
|
61
|
+
/** The arrow after a sorted head's label; nothing for an unsorted one. */
|
|
62
|
+
const SortDirectionIcon = ({ direction }) => {
|
|
63
|
+
if (direction === "asc") return /* @__PURE__ */ jsx(ArrowUpIcon, { className: "size-3" });
|
|
64
|
+
if (direction === "desc") return /* @__PURE__ */ jsx(ArrowDownIcon, { className: "size-3" });
|
|
65
|
+
return null;
|
|
66
|
+
};
|
|
67
|
+
/** A head's label and the control after it, on one line. */
|
|
68
|
+
const HEAD_CONTENT_CLASS = "inline-flex items-center gap-1";
|
|
69
|
+
/** The arrow's slot, held open so a label never moves as the sort flips. */
|
|
70
|
+
const SORT_ICON_SLOT_CLASS = "inline-flex w-3 shrink-0 justify-center";
|
|
71
|
+
/**
|
|
72
|
+
* A sortable head's button: a quiet button whose inline padding equals the
|
|
73
|
+
* head's, pulled back by a negative margin so the label lines up with the
|
|
74
|
+
* cells and the button never reaches past the table's edge. In an
|
|
75
|
+
* end-aligned (numeric) column the arrow sits before the label.
|
|
76
|
+
*/
|
|
77
|
+
const sortableHeadButtonClassName = (endAligned) => cn("min-w-0 gap-1 px-2.5", endAligned ? "-me-2.5 flex-row-reverse" : "-ms-2.5");
|
|
78
|
+
/** A head's label before its page has loaded: the cut line it sits on. */
|
|
79
|
+
const TableHeadLabel = ({ children }) => /* @__PURE__ */ jsx("span", {
|
|
80
|
+
className: TRUNCATED_TEXT_LINES_CLASS[1],
|
|
81
|
+
"data-slot": "truncated-text",
|
|
82
|
+
children
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* A sortable head before its page has loaded: the label in the sort button's
|
|
86
|
+
* face and the arrow in its slot, with no behaviour.
|
|
87
|
+
*/
|
|
88
|
+
const SortableHeadFace = ({ align, children, numeric = false, sortDirection = null, trailing, ...props }) => /* @__PURE__ */ jsx(TableHead, {
|
|
89
|
+
align,
|
|
90
|
+
"aria-sort": ariaSortOf(sortDirection),
|
|
91
|
+
numeric,
|
|
92
|
+
...props,
|
|
93
|
+
onClick: void 0,
|
|
94
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
95
|
+
className: HEAD_CONTENT_CLASS,
|
|
96
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
97
|
+
"aria-hidden": "true",
|
|
98
|
+
className: cn(buttonFaceClassName({
|
|
99
|
+
size: "default",
|
|
100
|
+
variant: "muted"
|
|
101
|
+
}), sortableHeadButtonClassName(resolveTableAlign(align, numeric) === "end")),
|
|
102
|
+
children: [/* @__PURE__ */ jsx(TableHeadLabel, { children }), /* @__PURE__ */ jsx("span", {
|
|
103
|
+
className: SORT_ICON_SLOT_CLASS,
|
|
104
|
+
children: /* @__PURE__ */ jsx(SortDirectionIcon, { direction: sortDirection })
|
|
105
|
+
})]
|
|
106
|
+
}), trailing]
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
const SKELETON_ROW_KEYS = [
|
|
110
|
+
"a",
|
|
111
|
+
"b",
|
|
112
|
+
"c",
|
|
113
|
+
"d",
|
|
114
|
+
"e",
|
|
115
|
+
"f",
|
|
116
|
+
"g",
|
|
117
|
+
"h",
|
|
118
|
+
"i",
|
|
119
|
+
"j",
|
|
120
|
+
"k",
|
|
121
|
+
"l"
|
|
122
|
+
];
|
|
123
|
+
/** Rows that share the table's cell geometry and its caller's column order. */
|
|
124
|
+
const TableSkeletonRows = ({ columns, count = 5, rowClassName }) => SKELETON_ROW_KEYS.slice(0, Math.max(0, count)).map((rowKey) => /* @__PURE__ */ jsx(TableRow, {
|
|
125
|
+
"aria-hidden": "true",
|
|
126
|
+
className: rowClassName,
|
|
127
|
+
children: columns.map((column) => /* @__PURE__ */ jsx(TableCellFace, {
|
|
128
|
+
align: column.align,
|
|
129
|
+
className: column.className,
|
|
130
|
+
children: "bar" in column ? /* @__PURE__ */ jsx("span", {
|
|
131
|
+
className: "inline-flex h-8 items-center sm:h-7",
|
|
132
|
+
children: /* @__PURE__ */ jsx(InlineSkeleton, { className: cn("h-3.5 max-w-full", column.bar) })
|
|
133
|
+
}) : column.placeholder
|
|
134
|
+
}, column.id))
|
|
135
|
+
}, rowKey));
|
|
136
|
+
export { HEAD_CONTENT_CLASS, SORT_ICON_SLOT_CLASS, SortDirectionIcon, SortableHeadFace, Table, TableBody, TableCaption, TableCellFace, TableFooter, TableHead, TableHeadLabel, TableHeader, TableRow, TableSkeletonRows, ariaSortOf, sortableHeadButtonClassName };
|
|
@@ -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 };
|