@underpin/ui 0.0.0 → 2.1.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/LICENSE +21 -0
- package/README.md +44 -1
- package/components/autocomplete.d.ts +25 -0
- package/components/autocomplete.js +71 -0
- package/components/autocomplete.js.map +1 -0
- package/components/avatar.d.ts +5 -0
- package/components/avatar.js +26 -0
- package/components/avatar.js.map +1 -0
- package/components/badge.d.ts +36 -0
- package/components/badge.js +140 -0
- package/components/badge.js.map +1 -0
- package/components/bar-list.d.ts +133 -0
- package/components/bar-list.js +204 -0
- package/components/bar-list.js.map +1 -0
- package/components/breakdown-card.d.ts +30 -0
- package/components/breakdown-card.js +43 -0
- package/components/breakdown-card.js.map +1 -0
- package/components/bulk-action-bar.d.ts +21 -0
- package/components/bulk-action-bar.js +38 -0
- package/components/bulk-action-bar.js.map +1 -0
- package/components/button-group.d.ts +21 -0
- package/components/button-group.js +32 -0
- package/components/button-group.js.map +1 -0
- package/components/button.d.ts +39 -0
- package/components/button.js +145 -0
- package/components/button.js.map +1 -0
- package/components/calendar.d.ts +27 -0
- package/components/calendar.js +95 -0
- package/components/calendar.js.map +1 -0
- package/components/callout.d.ts +26 -0
- package/components/callout.js +71 -0
- package/components/callout.js.map +1 -0
- package/components/card.d.ts +55 -0
- package/components/card.js +96 -0
- package/components/card.js.map +1 -0
- package/components/chart.d.ts +32 -0
- package/components/chart.js +43 -0
- package/components/chart.js.map +1 -0
- package/components/checkbox.d.ts +15 -0
- package/components/checkbox.js +42 -0
- package/components/checkbox.js.map +1 -0
- package/components/code-block.d.ts +21 -0
- package/components/code-block.js +35 -0
- package/components/code-block.js.map +1 -0
- package/components/collapse.d.ts +14 -0
- package/components/collapse.js +25 -0
- package/components/collapse.js.map +1 -0
- package/components/combobox.d.ts +71 -0
- package/components/combobox.js +155 -0
- package/components/combobox.js.map +1 -0
- package/components/copy-button.d.ts +29 -0
- package/components/copy-button.js +100 -0
- package/components/copy-button.js.map +1 -0
- package/components/copy-input.d.ts +15 -0
- package/components/copy-input.js +51 -0
- package/components/copy-input.js.map +1 -0
- package/components/data-table.d.ts +120 -0
- package/components/data-table.js +336 -0
- package/components/data-table.js.map +1 -0
- package/components/date-picker-trigger.d.ts +12 -0
- package/components/date-picker-trigger.js +30 -0
- package/components/date-picker-trigger.js.map +1 -0
- package/components/date-picker.d.ts +36 -0
- package/components/date-picker.js +70 -0
- package/components/date-picker.js.map +1 -0
- package/components/detail-row.d.ts +51 -0
- package/components/detail-row.js +77 -0
- package/components/detail-row.js.map +1 -0
- package/components/dialog.d.ts +121 -0
- package/components/dialog.js +327 -0
- package/components/dialog.js.map +1 -0
- package/components/disabled-reason.d.ts +31 -0
- package/components/disabled-reason.js +67 -0
- package/components/disabled-reason.js.map +1 -0
- package/components/empty-state.d.ts +41 -0
- package/components/empty-state.js +84 -0
- package/components/empty-state.js.map +1 -0
- package/components/entity-avatar.d.ts +54 -0
- package/components/entity-avatar.js +68 -0
- package/components/entity-avatar.js.map +1 -0
- package/components/form-section.d.ts +22 -0
- package/components/form-section.js +38 -0
- package/components/form-section.js.map +1 -0
- package/components/form.d.ts +199 -0
- package/components/form.js +456 -0
- package/components/form.js.map +1 -0
- package/components/formatted-number.d.ts +21 -0
- package/components/formatted-number.js +13 -0
- package/components/formatted-number.js.map +1 -0
- package/components/heading.d.ts +23 -0
- package/components/heading.js +44 -0
- package/components/heading.js.map +1 -0
- package/components/icon-swap.d.ts +15 -0
- package/components/icon-swap.js +29 -0
- package/components/icon-swap.js.map +1 -0
- package/components/inline-action.d.ts +21 -0
- package/components/inline-action.js +36 -0
- package/components/inline-action.js.map +1 -0
- package/components/input.d.ts +51 -0
- package/components/input.js +52 -0
- package/components/input.js.map +1 -0
- package/components/kbd.d.ts +17 -0
- package/components/kbd.js +34 -0
- package/components/kbd.js.map +1 -0
- package/components/label.d.ts +10 -0
- package/components/label.js +20 -0
- package/components/label.js.map +1 -0
- package/components/menu.d.ts +77 -0
- package/components/menu.js +189 -0
- package/components/menu.js.map +1 -0
- package/components/nav-button.d.ts +34 -0
- package/components/nav-button.js +71 -0
- package/components/nav-button.js.map +1 -0
- package/components/nav.d.ts +39 -0
- package/components/nav.js +68 -0
- package/components/nav.js.map +1 -0
- package/components/number-input.d.ts +16 -0
- package/components/number-input.js +25 -0
- package/components/number-input.js.map +1 -0
- package/components/page.d.ts +14 -0
- package/components/page.js +23 -0
- package/components/page.js.map +1 -0
- package/components/pagination.d.ts +73 -0
- package/components/pagination.js +212 -0
- package/components/pagination.js.map +1 -0
- package/components/ping.d.ts +38 -0
- package/components/ping.js +50 -0
- package/components/ping.js.map +1 -0
- package/components/popover.d.ts +5 -0
- package/components/popover.js +25 -0
- package/components/popover.js.map +1 -0
- package/components/radio-group.d.ts +35 -0
- package/components/radio-group.js +81 -0
- package/components/radio-group.js.map +1 -0
- package/components/relative-time.d.ts +25 -0
- package/components/relative-time.js +51 -0
- package/components/relative-time.js.map +1 -0
- package/components/saved-mark.d.ts +15 -0
- package/components/saved-mark.js +45 -0
- package/components/saved-mark.js.map +1 -0
- package/components/search-input.d.ts +13 -0
- package/components/search-input.js +44 -0
- package/components/search-input.js.map +1 -0
- package/components/section-header.d.ts +83 -0
- package/components/section-header.js +170 -0
- package/components/section-header.js.map +1 -0
- package/components/segmented-control.d.ts +24 -0
- package/components/segmented-control.js +70 -0
- package/components/segmented-control.js.map +1 -0
- package/components/select.d.ts +28 -0
- package/components/select.js +129 -0
- package/components/select.js.map +1 -0
- package/components/shortcut-keys.d.ts +14 -0
- package/components/shortcut-keys.js +32 -0
- package/components/shortcut-keys.js.map +1 -0
- package/components/shortcuts-dialog.d.ts +10 -0
- package/components/shortcuts-dialog.js +92 -0
- package/components/shortcuts-dialog.js.map +1 -0
- package/components/skeleton.d.ts +8 -0
- package/components/skeleton.js +23 -0
- package/components/skeleton.js.map +1 -0
- package/components/sparkline.d.ts +25 -0
- package/components/sparkline.js +70 -0
- package/components/sparkline.js.map +1 -0
- package/components/stack.d.ts +21 -0
- package/components/stack.js +45 -0
- package/components/stack.js.map +1 -0
- package/components/stat-strip.d.ts +43 -0
- package/components/stat-strip.js +151 -0
- package/components/stat-strip.js.map +1 -0
- package/components/steps.d.ts +19 -0
- package/components/steps.js +25 -0
- package/components/steps.js.map +1 -0
- package/components/switch.d.ts +16 -0
- package/components/switch.js +29 -0
- package/components/switch.js.map +1 -0
- package/components/table-toolbar.d.ts +55 -0
- package/components/table-toolbar.js +119 -0
- package/components/table-toolbar.js.map +1 -0
- package/components/table.d.ts +276 -0
- package/components/table.js +572 -0
- package/components/table.js.map +1 -0
- package/components/tabs.d.ts +36 -0
- package/components/tabs.js +120 -0
- package/components/tabs.js.map +1 -0
- package/components/text-link.d.ts +16 -0
- package/components/text-link.js +32 -0
- package/components/text-link.js.map +1 -0
- package/components/textarea.d.ts +10 -0
- package/components/textarea.js +23 -0
- package/components/textarea.js.map +1 -0
- package/components/theme.d.ts +28 -0
- package/components/theme.js +158 -0
- package/components/theme.js.map +1 -0
- package/components/time-series-chart.d.ts +122 -0
- package/components/time-series-chart.js +722 -0
- package/components/time-series-chart.js.map +1 -0
- package/components/toaster.d.ts +3 -0
- package/components/toaster.js +44 -0
- package/components/toaster.js.map +1 -0
- package/components/tooltip.d.ts +64 -0
- package/components/tooltip.js +126 -0
- package/components/tooltip.js.map +1 -0
- package/components/view-picker.d.ts +20 -0
- package/components/view-picker.js +24 -0
- package/components/view-picker.js.map +1 -0
- package/fonts/inter-OFL.txt +93 -0
- package/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/fonts/inter-cyrillic.woff2 +0 -0
- package/fonts/inter-greek-ext.woff2 +0 -0
- package/fonts/inter-greek.woff2 +0 -0
- package/fonts/inter-latin-ext.woff2 +0 -0
- package/fonts/inter-latin.woff2 +0 -0
- package/fonts/inter-vietnamese.woff2 +0 -0
- package/fonts.css +83 -0
- package/lib/animation.d.ts +14 -0
- package/lib/animation.js +20 -0
- package/lib/animation.js.map +1 -0
- package/lib/aria.d.ts +5 -0
- package/lib/aria.js +12 -0
- package/lib/aria.js.map +1 -0
- package/lib/chart-curve.d.ts +13 -0
- package/lib/chart-curve.js +79 -0
- package/lib/chart-curve.js.map +1 -0
- package/lib/classes.d.ts +134 -0
- package/lib/classes.js +152 -0
- package/lib/classes.js.map +1 -0
- package/lib/color.d.ts +25 -0
- package/lib/color.js +149 -0
- package/lib/color.js.map +1 -0
- package/lib/data-table-state.d.ts +87 -0
- package/lib/data-table-state.js +92 -0
- package/lib/data-table-state.js.map +1 -0
- package/lib/day.d.ts +9 -0
- package/lib/day.js +20 -0
- package/lib/day.js.map +1 -0
- package/lib/design-tokens.d.ts +56 -0
- package/lib/design-tokens.js +196 -0
- package/lib/design-tokens.js.map +1 -0
- package/lib/icon.d.ts +17 -0
- package/lib/icon.js +34 -0
- package/lib/icon.js.map +1 -0
- package/lib/icons.d.ts +29 -0
- package/lib/icons.js +34 -0
- package/lib/icons.js.map +1 -0
- package/lib/interactive.d.ts +21 -0
- package/lib/interactive.js +31 -0
- package/lib/interactive.js.map +1 -0
- package/lib/load-more.d.ts +14 -0
- package/lib/load-more.js +27 -0
- package/lib/load-more.js.map +1 -0
- package/lib/media.d.ts +58 -0
- package/lib/media.js +116 -0
- package/lib/media.js.map +1 -0
- package/lib/segmented.d.ts +57 -0
- package/lib/segmented.js +83 -0
- package/lib/segmented.js.map +1 -0
- package/lib/shortcuts.d.ts +94 -0
- package/lib/shortcuts.js +271 -0
- package/lib/shortcuts.js.map +1 -0
- package/lib/slot.d.ts +9 -0
- package/lib/slot.js +18 -0
- package/lib/slot.js.map +1 -0
- package/lib/time-series.d.ts +100 -0
- package/lib/time-series.js +144 -0
- package/lib/time-series.js.map +1 -0
- package/lib/tone.d.ts +6 -0
- package/lib/tone.js +0 -0
- package/lib/variants.d.ts +12 -0
- package/lib/variants.js +14 -0
- package/lib/variants.js.map +1 -0
- package/package.json +122 -3
- package/styles.css +630 -0
- package/tokens.d.ts +104 -0
- package/tokens.js +108 -0
- package/tokens.js.map +1 -0
- package/publish.log +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CancelIcon, PlusCircleIcon } from "../lib/icons.js";
|
|
3
|
+
import { interactiveVariants } from "../lib/interactive.js";
|
|
4
|
+
import { cn } from "../lib/variants.js";
|
|
5
|
+
import { Menu, MenuCheckboxItem, MenuContent, MenuItem, MenuSeparator, MenuTrigger } from "./menu.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/table-toolbar.tsx
|
|
8
|
+
const FACET_TRIGGER_CLASSES = cn(interactiveVariants(), "inline-flex h-control items-center gap-1.5 rounded-md border pr-3 pl-2.5 font-medium text-control text-ink", "hover:bg-fill-subtle data-popup-open:bg-fill-subtle [&_svg]:size-3.5", "border-dashed border-edge", "data-active:border-solid data-active:bg-surface data-active:pr-1.5 data-active:shadow-control");
|
|
9
|
+
const CHIP_PART_CLASSES = cn(interactiveVariants(), "inline-flex items-center px-2 outline-offset-[-2px] hover:bg-fill-subtle data-popup-open:bg-fill-subtle");
|
|
10
|
+
function ChipPart({ menu, label, className, children }) {
|
|
11
|
+
if (!menu) return /* @__PURE__ */ jsx("span", {
|
|
12
|
+
className: cn("inline-flex items-center px-2", className),
|
|
13
|
+
children
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
16
|
+
className: cn(CHIP_PART_CLASSES, className),
|
|
17
|
+
children
|
|
18
|
+
}), /* @__PURE__ */ jsx(MenuContent, {
|
|
19
|
+
label,
|
|
20
|
+
align: "start",
|
|
21
|
+
children: menu
|
|
22
|
+
})] });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The row above a table: the search, then the filters, which wrap onto a second row, then the
|
|
26
|
+
* pickers at the end. Page actions ("New site") belong in the page header, never here.
|
|
27
|
+
*/
|
|
28
|
+
function TableToolbar({ search, children, end, className, ...props }) {
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: cn("flex flex-wrap items-center gap-2", className),
|
|
31
|
+
...props,
|
|
32
|
+
children: [
|
|
33
|
+
search && /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: "w-50 max-sm:w-full *:w-full",
|
|
35
|
+
children: search
|
|
36
|
+
}),
|
|
37
|
+
children,
|
|
38
|
+
end && /* @__PURE__ */ jsx("div", {
|
|
39
|
+
className: "ml-auto flex items-center gap-2",
|
|
40
|
+
children: end
|
|
41
|
+
})
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A column filter in the toolbar, 32px like a button. Off, it is a dashed button with a plus;
|
|
47
|
+
* on, it shows the chosen value, or how many are chosen, after a divider. Its menu ticks values
|
|
48
|
+
* on and off and clears the filter. A filter with a relation (is not, contains) is a
|
|
49
|
+
* `TableFilterChip`.
|
|
50
|
+
*/
|
|
51
|
+
function TableFacetFilter({ label, options, value, onValueChange, formatSelected = (count) => `${count} selected`, clearLabel = "Clear filter" }) {
|
|
52
|
+
const chosen = options.filter((option) => value.includes(option.value));
|
|
53
|
+
const summary = chosen.length === 1 ? chosen[0]?.label : formatSelected(chosen.length);
|
|
54
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsxs(MenuTrigger, {
|
|
55
|
+
"data-active": chosen.length > 0 ? "" : void 0,
|
|
56
|
+
className: FACET_TRIGGER_CLASSES,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(PlusCircleIcon, { className: "text-ink-secondary" }),
|
|
59
|
+
label,
|
|
60
|
+
chosen.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
61
|
+
"aria-hidden": true,
|
|
62
|
+
className: "h-4 w-px bg-edge"
|
|
63
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: "inline-flex h-5 items-center rounded-sm bg-fill px-1.5 text-xs",
|
|
65
|
+
children: summary
|
|
66
|
+
})] })
|
|
67
|
+
]
|
|
68
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
69
|
+
label,
|
|
70
|
+
align: "start",
|
|
71
|
+
children: [options.map((option) => /* @__PURE__ */ jsx(MenuCheckboxItem, {
|
|
72
|
+
checked: value.includes(option.value),
|
|
73
|
+
onCheckedChange: (checked) => onValueChange(checked ? [...value, option.value] : value.filter((chosenValue) => chosenValue !== option.value)),
|
|
74
|
+
children: option.label
|
|
75
|
+
}, option.value)), chosen.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(MenuItem, {
|
|
76
|
+
onClick: () => onValueChange([]),
|
|
77
|
+
children: clearLabel
|
|
78
|
+
})] })]
|
|
79
|
+
})] });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* One filter added from the Filter menu: the field, the relation and the value, each opening its
|
|
83
|
+
* own menu, then a cross that removes it. Chips follow the filter buttons and wrap.
|
|
84
|
+
*/
|
|
85
|
+
function TableFilterChip({ field, operator, value, fieldMenu, operatorMenu, valueMenu, onRemove, removeLabel = "Remove filter", className }) {
|
|
86
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
87
|
+
className: cn("inline-flex h-control items-stretch divide-x divide-edge-subtle overflow-clip rounded-md border bg-surface text-control shadow-control", className),
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ jsx(ChipPart, {
|
|
90
|
+
menu: fieldMenu,
|
|
91
|
+
label: "Field",
|
|
92
|
+
className: "pl-2.5 text-ink-secondary",
|
|
93
|
+
children: field
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx(ChipPart, {
|
|
96
|
+
menu: operatorMenu,
|
|
97
|
+
label: "Relation",
|
|
98
|
+
className: "text-ink-muted",
|
|
99
|
+
children: operator
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(ChipPart, {
|
|
102
|
+
menu: valueMenu,
|
|
103
|
+
label: "Value",
|
|
104
|
+
className: "font-medium text-ink",
|
|
105
|
+
children: value
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsx("button", {
|
|
108
|
+
type: "button",
|
|
109
|
+
"aria-label": removeLabel,
|
|
110
|
+
className: cn(CHIP_PART_CLASSES, "w-7 justify-center px-0 text-ink-muted hover:text-ink"),
|
|
111
|
+
onClick: onRemove,
|
|
112
|
+
children: /* @__PURE__ */ jsx(CancelIcon, { className: "size-3" })
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export { TableFacetFilter, TableFilterChip, TableToolbar };
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=table-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-toolbar.js","names":[],"sources":["../../src/components/table-toolbar.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ComponentProps, ReactNode } from \"react\"\nimport { CancelIcon, PlusCircleIcon } from \"../lib/icons\"\nimport { interactiveVariants } from \"../lib/interactive\"\nimport { cn } from \"../lib/variants\"\nimport { Menu, MenuCheckboxItem, MenuContent, MenuItem, MenuSeparator, MenuTrigger } from \"./menu\"\n\nexport interface TableFacetOption {\n value: string\n label: ReactNode\n}\n\nconst FACET_TRIGGER_CLASSES = cn(\n interactiveVariants(),\n \"inline-flex h-control items-center gap-1.5 rounded-md border pr-3 pl-2.5 font-medium text-control text-ink\",\n \"hover:bg-fill-subtle data-popup-open:bg-fill-subtle [&_svg]:size-3.5\",\n // Empty, it is a dashed outline with no lift; with a value it is a raised surface.\n \"border-dashed border-edge\",\n \"data-active:border-solid data-active:bg-surface data-active:pr-1.5 data-active:shadow-control\",\n)\n\nconst CHIP_PART_CLASSES = cn(\n interactiveVariants(),\n \"inline-flex items-center px-2 outline-offset-[-2px] hover:bg-fill-subtle data-popup-open:bg-fill-subtle\",\n)\n\ninterface ChipPartProps {\n /** The menu that changes this part: `MenuItem`s. Left out, the part is plain text. */\n menu?: ReactNode\n /** Names the part's menu for a screen reader. */\n label: string\n className?: string\n children: ReactNode\n}\n\nfunction ChipPart({ menu, label, className, children }: ChipPartProps) {\n if (!menu) {\n return <span className={cn(\"inline-flex items-center px-2\", className)}>{children}</span>\n }\n\n return (\n <Menu>\n <MenuTrigger className={cn(CHIP_PART_CLASSES, className)}>{children}</MenuTrigger>\n <MenuContent label={label} align=\"start\">\n {menu}\n </MenuContent>\n </Menu>\n )\n}\n\ninterface TableToolbarProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n /** A `SearchInput`, 200px wide; on a phone it fills its own row. */\n search?: ReactNode\n /** The filters: a `TableFacetFilter` per common field, the Filter button, its chips. */\n children?: ReactNode\n /** The sort picker (only for an order no column shows) and the column picker. */\n end?: ReactNode\n}\n\n/**\n * The row above a table: the search, then the filters, which wrap onto a second row, then the\n * pickers at the end. Page actions (\"New site\") belong in the page header, never here.\n */\nexport function TableToolbar({ search, children, end, className, ...props }: TableToolbarProps) {\n return (\n <div className={cn(\"flex flex-wrap items-center gap-2\", className)} {...props}>\n {search && <div className=\"w-50 max-sm:w-full *:w-full\">{search}</div>}\n {children}\n {end && <div className=\"ml-auto flex items-center gap-2\">{end}</div>}\n </div>\n )\n}\n\ninterface TableFacetFilterProps {\n /** The field: \"Category\", \"Status\". */\n label: string\n options: TableFacetOption[]\n /** The chosen values, empty while the filter is off. */\n value: string[]\n onValueChange: (value: string[]) => void\n /** What the trigger shows for several values. */\n formatSelected?: (count: number) => string\n clearLabel?: string\n}\n\n/**\n * A column filter in the toolbar, 32px like a button. Off, it is a dashed button with a plus;\n * on, it shows the chosen value, or how many are chosen, after a divider. Its menu ticks values\n * on and off and clears the filter. A filter with a relation (is not, contains) is a\n * `TableFilterChip`.\n */\nexport function TableFacetFilter({\n label,\n options,\n value,\n onValueChange,\n formatSelected = count => `${count} selected`,\n clearLabel = \"Clear filter\",\n}: TableFacetFilterProps) {\n const chosen = options.filter(option => value.includes(option.value))\n const summary = chosen.length === 1 ? chosen[0]?.label : formatSelected(chosen.length)\n\n return (\n <Menu>\n <MenuTrigger\n data-active={chosen.length > 0 ? \"\" : undefined}\n className={FACET_TRIGGER_CLASSES}\n >\n <PlusCircleIcon className=\"text-ink-secondary\" />\n {label}\n {chosen.length > 0 && (\n <>\n <span aria-hidden className=\"h-4 w-px bg-edge\" />\n <span className=\"inline-flex h-5 items-center rounded-sm bg-fill px-1.5 text-xs\">\n {summary}\n </span>\n </>\n )}\n </MenuTrigger>\n <MenuContent label={label} align=\"start\">\n {options.map(option => (\n <MenuCheckboxItem\n key={option.value}\n checked={value.includes(option.value)}\n onCheckedChange={checked =>\n onValueChange(\n checked\n ? [...value, option.value]\n : value.filter(chosenValue => chosenValue !== option.value),\n )\n }\n >\n {option.label}\n </MenuCheckboxItem>\n ))}\n {chosen.length > 0 && (\n <>\n <MenuSeparator />\n <MenuItem onClick={() => onValueChange([])}>{clearLabel}</MenuItem>\n </>\n )}\n </MenuContent>\n </Menu>\n )\n}\n\ninterface TableFilterChipProps {\n field: ReactNode\n /** The relation: \"is\", \"is not\", \"contains\", \"before\". */\n operator: ReactNode\n value: ReactNode\n /** The items of each part's menu. A part with none is plain text. */\n fieldMenu?: ReactNode\n operatorMenu?: ReactNode\n valueMenu?: ReactNode\n onRemove: () => void\n removeLabel?: string\n className?: string\n}\n\n/**\n * One filter added from the Filter menu: the field, the relation and the value, each opening its\n * own menu, then a cross that removes it. Chips follow the filter buttons and wrap.\n */\nexport function TableFilterChip({\n field,\n operator,\n value,\n fieldMenu,\n operatorMenu,\n valueMenu,\n onRemove,\n removeLabel = \"Remove filter\",\n className,\n}: TableFilterChipProps) {\n return (\n <span\n className={cn(\n \"inline-flex h-control items-stretch divide-x divide-edge-subtle overflow-clip rounded-md border bg-surface text-control shadow-control\",\n className,\n )}\n >\n <ChipPart menu={fieldMenu} label=\"Field\" className=\"pl-2.5 text-ink-secondary\">\n {field}\n </ChipPart>\n <ChipPart menu={operatorMenu} label=\"Relation\" className=\"text-ink-muted\">\n {operator}\n </ChipPart>\n <ChipPart menu={valueMenu} label=\"Value\" className=\"font-medium text-ink\">\n {value}\n </ChipPart>\n <button\n type=\"button\"\n aria-label={removeLabel}\n className={cn(CHIP_PART_CLASSES, \"w-7 justify-center px-0 text-ink-muted hover:text-ink\")}\n onClick={onRemove}\n >\n <CancelIcon className=\"size-3\" />\n </button>\n </span>\n )\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { VariantProps } from "../lib/variants.js";
|
|
2
|
+
import { Checkbox } from "./checkbox.js";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
|
+
/**
|
|
6
|
+
* Which columns give way as the table's box narrows: a `medium` column hides below the `@2xl`
|
|
7
|
+
* container width (672px), a `low` one below `@4xl` (896px) and a `lowest` one below `@6xl`
|
|
8
|
+
* (1152px), for a table with more columns than a laptop's content column holds. A column with
|
|
9
|
+
* none always shows.
|
|
10
|
+
*/
|
|
11
|
+
export type TableColumnPriority = "medium" | "low" | "lowest";
|
|
12
|
+
export interface TableColumn {
|
|
13
|
+
/** The column's grid track: `minmax(0,1fr)` for the name, a fixed `6rem` for a figure. */
|
|
14
|
+
width: string;
|
|
15
|
+
priority?: TableColumnPriority;
|
|
16
|
+
/** Where a skeleton row puts its stand-in. */
|
|
17
|
+
align?: "start" | "end";
|
|
18
|
+
/** Whether a skeleton row draws a stand-in here. Off for a checkbox or actions column. */
|
|
19
|
+
skeleton?: boolean;
|
|
20
|
+
}
|
|
21
|
+
type TableLayout = "table" | "list";
|
|
22
|
+
interface TableColumnScopeValue {
|
|
23
|
+
align?: "start" | "end";
|
|
24
|
+
priority?: TableColumnPriority;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The classes that hide a cell of a column with a priority, on its head and on every cell, so
|
|
28
|
+
* the column drops out whole. `Table` drops its track from the grid at the same widths.
|
|
29
|
+
*/
|
|
30
|
+
export declare const tableColumnPriorityClasses: Record<TableColumnPriority, string>;
|
|
31
|
+
declare const tableVariants: import("tailwind-variants").TVReturnType<{
|
|
32
|
+
variant: {
|
|
33
|
+
card: {
|
|
34
|
+
container: string;
|
|
35
|
+
};
|
|
36
|
+
flush: {};
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
container: string;
|
|
40
|
+
table: string[];
|
|
41
|
+
}, undefined, undefined, undefined, undefined>;
|
|
42
|
+
declare const tableRowVariants: import("tailwind-variants").TVReturnType<{
|
|
43
|
+
size: {
|
|
44
|
+
/** 32px, for a feed or a dense list. */
|
|
45
|
+
compact: string;
|
|
46
|
+
/** 44px, a one-line row. */
|
|
47
|
+
default: string;
|
|
48
|
+
/** 52px, for a two-line name cell. */
|
|
49
|
+
identity: string;
|
|
50
|
+
};
|
|
51
|
+
}, undefined, string[], undefined, undefined, undefined>;
|
|
52
|
+
declare const tableCellVariants: import("tailwind-variants").TVReturnType<{
|
|
53
|
+
align: {
|
|
54
|
+
start: string;
|
|
55
|
+
end: string;
|
|
56
|
+
};
|
|
57
|
+
priority: Record<TableColumnPriority, string>;
|
|
58
|
+
}, undefined, string[], undefined, undefined, undefined>;
|
|
59
|
+
type TableCellVariantProps = VariantProps<typeof tableCellVariants>;
|
|
60
|
+
export interface TableProps extends Omit<ComponentProps<"table">, "children">, VariantProps<typeof tableVariants> {
|
|
61
|
+
/** Every column in order, the same list the head and the cells of each row follow. */
|
|
62
|
+
columns: TableColumn[];
|
|
63
|
+
/**
|
|
64
|
+
* `list` draws the same rows with no column names, for a list of records (members, API keys):
|
|
65
|
+
* the rows are list items rather than table rows.
|
|
66
|
+
*/
|
|
67
|
+
layout?: TableLayout;
|
|
68
|
+
/** The band under the rows: `Pagination` or `PaginationInfinite`. */
|
|
69
|
+
footer?: ReactNode;
|
|
70
|
+
/** Classes for the box around the table: the card, or the bare wrapper of a flush table. */
|
|
71
|
+
containerClassName?: string;
|
|
72
|
+
children?: ReactNode;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A table on a CSS grid. The root sets one grid template from `columns`, and the header and
|
|
76
|
+
* every row take it as a subgrid, so the columns line up however the rows are grouped. A row
|
|
77
|
+
* stays a positioned box, which a real table row is not in Safari, so a stretched link can
|
|
78
|
+
* fill it (`TableRowLink`). Columns with a `priority` drop out as the table's own box narrows.
|
|
79
|
+
* Set `--table-sticky-top` on it when a sticky header must clear a bar pinned above it.
|
|
80
|
+
*/
|
|
81
|
+
export declare function Table({ columns, layout, variant, footer, className, containerClassName, style, children, ...props }: TableProps): import("react").JSX.Element;
|
|
82
|
+
interface TableHeaderProps extends ComponentProps<"thead"> {
|
|
83
|
+
/** Keeps the column names in view while the rows scroll under them. */
|
|
84
|
+
sticky?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The row of column names: 40px, on the surface, with one line under it in the card's edge
|
|
88
|
+
* colour. The first row draws no line of its own, so the two never stack. A list has none, and
|
|
89
|
+
* renders nothing for one.
|
|
90
|
+
*/
|
|
91
|
+
export declare function TableHeader({ sticky, className, children, ...props }: TableHeaderProps): import("react").JSX.Element | null;
|
|
92
|
+
/**
|
|
93
|
+
* The rows. A table cut into runs (days, workspaces) takes one body per run, each opening with
|
|
94
|
+
* its `TableGroupHeader`, so the heading sticks while its own rows are in view.
|
|
95
|
+
*/
|
|
96
|
+
export declare function TableBody({ className, ...props }: ComponentProps<"tbody">): import("react").JSX.Element;
|
|
97
|
+
export interface TableRowProps extends ComponentProps<"tr">, VariantProps<typeof tableRowVariants> {
|
|
98
|
+
selected?: boolean;
|
|
99
|
+
/** Dims the row's cells, for a record that is archived or blocked. */
|
|
100
|
+
inactive?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* One record. A row whose name is a `TableRowLink` opens it from anywhere on the row and takes
|
|
104
|
+
* the hover fill; a row without one keeps its background under the pointer.
|
|
105
|
+
*/
|
|
106
|
+
export declare function TableRow({ size, selected, inactive, className, ...props }: TableRowProps): import("react").JSX.Element;
|
|
107
|
+
export interface TableHeadProps extends Omit<ComponentProps<"th">, "align">, TableCellVariantProps {
|
|
108
|
+
/** The order the table is in by this column. Left out for a column that does not sort. */
|
|
109
|
+
sort?: "ascending" | "descending" | "none";
|
|
110
|
+
/** Turns the name into a button that sorts by the column. */
|
|
111
|
+
onSort?: () => void;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A column name, in the control weight. A sortable column is a button, with the arrow of its
|
|
115
|
+
* order while the table is sorted by it; unsorted, it looks like any other name.
|
|
116
|
+
*/
|
|
117
|
+
export declare function TableHead({ align, priority, sort, onSort, className, children, ...props }: TableHeadProps): import("react").JSX.Element;
|
|
118
|
+
export interface TableCellProps extends Omit<ComponentProps<"td">, "align">, TableCellVariantProps {}
|
|
119
|
+
/**
|
|
120
|
+
* One cell, the Text type: a line of ink that ends in an ellipsis. Every other cell type is
|
|
121
|
+
* built on it. Give it the `align` and `priority` of its column's head.
|
|
122
|
+
*/
|
|
123
|
+
export declare function TableCell({ align, priority, className, children, ...props }: TableCellProps): import("react").JSX.Element;
|
|
124
|
+
interface TableColumnScopeProps extends TableColumnScopeValue {
|
|
125
|
+
children?: ReactNode;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Hands the cells inside it their column's `align` and `priority`, for a cell rendered by code
|
|
129
|
+
* that knows nothing of its column (a `DataTable` column's `cell`). A cell's own props win.
|
|
130
|
+
*/
|
|
131
|
+
export declare function TableColumnScope({ align, priority, children }: TableColumnScopeProps): import("react").JSX.Element;
|
|
132
|
+
/**
|
|
133
|
+
* The record's name as a link that covers the whole row: its box stretches over the row, and
|
|
134
|
+
* the focus ring is drawn round the row. The checkbox, the menu and any other link in the row
|
|
135
|
+
* sit above it (`relative z-10`, as the checkbox and actions cells do), so each keeps its own
|
|
136
|
+
* click. Pass `render` for a router's link.
|
|
137
|
+
*/
|
|
138
|
+
export declare function TableRowLink({ render, className, ...props }: useRender.ComponentProps<"a">): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
139
|
+
interface TableIdentityCellProps extends Omit<TableCellProps, "title"> {
|
|
140
|
+
/** A favicon, an avatar or a letter tile, sized 28px (`size-7`) by the caller. */
|
|
141
|
+
leading?: ReactNode;
|
|
142
|
+
/** The record's name, usually a `TableRowLink`. */
|
|
143
|
+
title: ReactNode;
|
|
144
|
+
/** One muted line under the name: a domain, an email. */
|
|
145
|
+
detail?: ReactNode;
|
|
146
|
+
/** A flag or a badge after the name. */
|
|
147
|
+
extras?: ReactNode;
|
|
148
|
+
}
|
|
149
|
+
/** The name column: the leading mark, the name in the control weight and a muted line. */
|
|
150
|
+
export declare function TableIdentityCell({ leading, title, detail, extras, className, ...props }: TableIdentityCellProps): import("react").JSX.Element;
|
|
151
|
+
/**
|
|
152
|
+
* A figure, Number or Money: end-aligned in tabular figures. The caller formats the value, a
|
|
153
|
+
* sum of money with its currency.
|
|
154
|
+
*/
|
|
155
|
+
export declare function TableNumberCell({ align, className, ...props }: TableCellProps): import("react").JSX.Element;
|
|
156
|
+
/** A date, muted: pass a `RelativeTime`, which keeps the exact moment for its tooltip. */
|
|
157
|
+
export declare function TableDateCell({ className, ...props }: TableCellProps): import("react").JSX.Element;
|
|
158
|
+
/** A status: pass one `Badge`. */
|
|
159
|
+
export declare function TableBadgeCell(props: TableCellProps): import("react").JSX.Element;
|
|
160
|
+
interface TableTagsCellProps extends Omit<TableCellProps, "children"> {
|
|
161
|
+
/** One `Badge` per tag. */
|
|
162
|
+
tags: ReactNode[];
|
|
163
|
+
/** How many show before the rest fold into "+N". */
|
|
164
|
+
max?: number;
|
|
165
|
+
}
|
|
166
|
+
/** Tags: the first two, then a count of the rest. */
|
|
167
|
+
export declare function TableTagsCell({ tags, max, className, ...props }: TableTagsCellProps): import("react").JSX.Element;
|
|
168
|
+
interface TableSparklineCellProps extends Omit<TableCellProps, "children"> {
|
|
169
|
+
data: number[];
|
|
170
|
+
}
|
|
171
|
+
/** A trend: a `Sparkline` across the cell, 32px tall. */
|
|
172
|
+
export declare function TableSparklineCell({ data, ...props }: TableSparklineCellProps): import("react").JSX.Element;
|
|
173
|
+
declare const METER_TONES: {
|
|
174
|
+
neutral: {
|
|
175
|
+
bar: string;
|
|
176
|
+
ring: string;
|
|
177
|
+
};
|
|
178
|
+
brand: {
|
|
179
|
+
bar: string;
|
|
180
|
+
ring: string;
|
|
181
|
+
};
|
|
182
|
+
warning: {
|
|
183
|
+
bar: string;
|
|
184
|
+
ring: string;
|
|
185
|
+
};
|
|
186
|
+
danger: {
|
|
187
|
+
bar: string;
|
|
188
|
+
ring: string;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
interface TableMeterCellProps extends Omit<TableCellProps, "children"> {
|
|
192
|
+
value: number;
|
|
193
|
+
max: number;
|
|
194
|
+
/** The usage as text, formatted by the caller: "8,240 of 10,000". */
|
|
195
|
+
label?: ReactNode;
|
|
196
|
+
/**
|
|
197
|
+
* The meter's colour, for a meter whose state the app knows better than the share does (a
|
|
198
|
+
* usage lock, a failed job). Left out, it is ink and turns warning past 90%.
|
|
199
|
+
*/
|
|
200
|
+
tone?: keyof typeof METER_TONES;
|
|
201
|
+
/**
|
|
202
|
+
* `bar` puts a 48px bar before a muted figure. `ring` puts a 14px ring before the figure in the
|
|
203
|
+
* cell's own text, for a narrow column whose figure needs the room ("35.5k of 657.2k rows").
|
|
204
|
+
*/
|
|
205
|
+
layout?: "bar" | "ring";
|
|
206
|
+
}
|
|
207
|
+
/** Usage against a limit: a bar or a ring, then the figure. It turns warning past 90%. */
|
|
208
|
+
export declare function TableMeterCell({ value, max, label, tone, layout, className, ...props }: TableMeterCellProps): import("react").JSX.Element;
|
|
209
|
+
interface TableCountryCellProps extends Omit<TableCellProps, "children"> {
|
|
210
|
+
/** The country's flag. */
|
|
211
|
+
flag: ReactNode;
|
|
212
|
+
name: ReactNode;
|
|
213
|
+
}
|
|
214
|
+
/** A country: its flag and its name. */
|
|
215
|
+
export declare function TableCountryCell({ flag, name, ...props }: TableCountryCellProps): import("react").JSX.Element;
|
|
216
|
+
interface TableMonoCellProps extends Omit<TableCellProps, "children"> {
|
|
217
|
+
value: string;
|
|
218
|
+
/** Adds a copy button after the value. */
|
|
219
|
+
copy?: boolean;
|
|
220
|
+
}
|
|
221
|
+
/** A machine string (a key, an id) in mono, with a copy button that sits above the row link. */
|
|
222
|
+
export declare function TableMonoCell({ value, copy, className, ...props }: TableMonoCellProps): import("react").JSX.Element;
|
|
223
|
+
interface TablePersonCellProps extends Omit<TableCellProps, "children"> {
|
|
224
|
+
/** An avatar, sized 20px (`size-5`) by the caller. */
|
|
225
|
+
avatar?: ReactNode;
|
|
226
|
+
name: ReactNode;
|
|
227
|
+
}
|
|
228
|
+
/** A person on one line: a 20px avatar and the name. */
|
|
229
|
+
export declare function TablePersonCell({ avatar, name, ...props }: TablePersonCellProps): import("react").JSX.Element;
|
|
230
|
+
/**
|
|
231
|
+
* The row's menu, end-aligned above the row link. It shows on hover, on keyboard focus, while
|
|
232
|
+
* open, and always on a touch screen, which has no hover to give.
|
|
233
|
+
*/
|
|
234
|
+
export declare function TableActionsCell({ align, className, children, ...props }: TableCellProps): import("react").JSX.Element;
|
|
235
|
+
interface TableCheckboxCellProps extends Omit<TableCellProps, "children" | "onChange">, Pick<ComponentProps<typeof Checkbox>, "checked" | "indeterminate" | "disabled" | "onCheckedChange"> {
|
|
236
|
+
/** Names the checkbox: "Select openalternative.com", "Select all". */
|
|
237
|
+
label: string;
|
|
238
|
+
/** Renders a head cell for the header row: the select-all box. Ignored in a list. */
|
|
239
|
+
header?: boolean;
|
|
240
|
+
}
|
|
241
|
+
/** Selects the row, or every row on the page in the header. */
|
|
242
|
+
export declare function TableCheckboxCell({ label, header: headerProp, checked, indeterminate, disabled, onCheckedChange, className, ...props }: TableCheckboxCellProps): import("react").JSX.Element;
|
|
243
|
+
interface TableGroupHeaderProps extends ComponentProps<"tr"> {}
|
|
244
|
+
/**
|
|
245
|
+
* A heading row for the run of rows under it: a day of a feed, a workspace of a list. It sticks
|
|
246
|
+
* under the header while its own body is in view, and the next one pushes it out. Opaque, so the
|
|
247
|
+
* rows slide under it.
|
|
248
|
+
*/
|
|
249
|
+
export declare function TableGroupHeader({ className, children, ...props }: TableGroupHeaderProps): import("react").JSX.Element;
|
|
250
|
+
interface TableSkeletonRowProps extends VariantProps<typeof tableRowVariants> {
|
|
251
|
+
/** The row's place in the stack, which picks the width of its first line. */
|
|
252
|
+
index?: number;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* A loading row the size of the rows it stands in for, one stand-in per column of the table.
|
|
256
|
+
* Put five in the body on a first load; while a later page loads, keep the old rows and dim them.
|
|
257
|
+
*/
|
|
258
|
+
export declare function TableSkeletonRow({ size, index }: TableSkeletonRowProps): import("react").JSX.Element;
|
|
259
|
+
interface TableMessageProps {
|
|
260
|
+
/**
|
|
261
|
+
* `empty`: nothing exists yet, with the create action. `filtered`: nothing matches, with a way
|
|
262
|
+
* to clear the filters. `error`: the load failed, with a retry.
|
|
263
|
+
*/
|
|
264
|
+
kind: "empty" | "filtered" | "error";
|
|
265
|
+
/** Required for `empty`; `filtered` and `error` draw a filter and an alert by default. */
|
|
266
|
+
icon?: ReactNode;
|
|
267
|
+
title: ReactNode;
|
|
268
|
+
description?: ReactNode;
|
|
269
|
+
action?: ReactNode;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Stands in for the rows: the small empty state across every column, under the header, which
|
|
273
|
+
* keeps its line. Put it inside `TableBody`.
|
|
274
|
+
*/
|
|
275
|
+
export declare function TableMessage({ kind, icon, title, description, action }: TableMessageProps): import("react").JSX.Element;
|
|
276
|
+
export {};
|