@sincpro/web-ui 2.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/dist/components/activity/Activity.d.ts +13 -14
- package/dist/components/activity/Activity.js +1 -1
- package/dist/components/activity/Messages.d.ts +5 -5
- package/dist/components/activity/Messages.js +8 -8
- package/dist/components/form/Form.js +6 -6
- package/dist/components/form/index.js +2 -2
- package/dist/components/frame/FrameView.d.ts +5 -5
- package/dist/components/frame/FrameView.js +4 -4
- package/dist/components/listing/GroupingLevels.d.ts +22 -22
- package/dist/components/listing/GroupingLevels.js +9 -9
- package/dist/components/listing/Listing.d.ts +11 -11
- package/dist/components/listing/Listing.js +11 -11
- package/dist/components/listing/ListingBar.js +11 -11
- package/dist/components/listing/Row.d.ts +19 -19
- package/dist/components/listing/Row.js +25 -25
- package/dist/components/listing/SortMenu.d.ts +36 -36
- package/dist/components/listing/SortMenu.js +6 -6
- package/dist/components/listing/grouping.d.ts +16 -16
- package/dist/components/listing/grouping.js +6 -6
- package/dist/components/listing/index.js +1 -1
- package/dist/components/listing/modelColumns.d.ts +25 -25
- package/dist/components/listing/modelColumns.js +24 -24
- package/dist/components/listing/pages.js +4 -4
- package/dist/components/listing/set.d.ts +18 -18
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/record/RecordSkeleton.js +7 -7
- package/dist/components/search/CriteriaBuilder.d.ts +22 -22
- package/dist/components/search/CriteriaBuilder.js +31 -31
- package/dist/components/search/CriteriaChips.d.ts +9 -9
- package/dist/components/search/CriteriaChips.js +12 -12
- package/dist/components/search/FilterBuilder.d.ts +67 -67
- package/dist/components/search/FilterBuilder.js +104 -104
- package/dist/components/search/JoinWord.d.ts +1 -1
- package/dist/components/search/JoinWord.js +14 -14
- package/dist/components/search/JsonEditor.d.ts +8 -8
- package/dist/components/search/JsonEditor.js +16 -16
- package/dist/components/search/SearchBar.d.ts +34 -34
- package/dist/components/search/SearchBar.js +110 -110
- package/dist/components/search/criteria.d.ts +61 -61
- package/dist/components/search/criteria.js +39 -39
- package/dist/components/search/datePeriods.d.ts +47 -48
- package/dist/components/search/datePeriods.js +29 -29
- package/dist/components/search/dateRanges.d.ts +27 -27
- package/dist/components/search/dateRanges.js +16 -16
- package/dist/components/search/index.js +13 -13
- package/dist/components/search/model.d.ts +28 -28
- package/dist/components/search/model.js +21 -21
- package/dist/components/search/query.d.ts +71 -71
- package/dist/components/search/query.js +119 -119
- package/dist/components/shell/AppFrame.js +3 -3
- package/dist/components/shell/index.js +1 -1
- package/dist/foundations/calendar.d.ts +27 -27
- package/dist/foundations/calendar.js +72 -72
- package/dist/foundations/chart.d.ts +57 -57
- package/dist/foundations/chart.js +27 -27
- package/dist/foundations/copy.d.ts +96 -94
- package/dist/foundations/copy.es.js +1 -0
- package/dist/foundations/copy.js +1 -0
- package/dist/foundations/grouping.d.ts +175 -175
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +21 -21
- package/dist/foundations/pivot.d.ts +133 -131
- package/dist/foundations/pivot.js +54 -54
- package/dist/foundations/pivotSheet.d.ts +36 -36
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/slots.d.ts +38 -38
- package/dist/foundations/slots.js +18 -18
- package/dist/foundations/sticky.d.ts +28 -28
- package/dist/foundations/sticky.js +59 -59
- package/dist/foundations/xlsx.d.ts +47 -47
- package/dist/foundations/xlsx.js +0 -0
- package/dist/primitives/block/Line.d.ts +4 -4
- package/dist/primitives/block/Line.js +28 -28
- package/dist/primitives/block/index.js +2 -2
- package/dist/primitives/cell/index.js +2 -2
- package/dist/primitives/choice/index.js +3 -3
- package/dist/primitives/date/Calendar.d.ts +7 -1
- package/dist/primitives/date/Calendar.js +13 -3
- package/dist/primitives/date/DatePicker.d.ts +4 -1
- package/dist/primitives/date/DatePicker.js +2 -2
- package/dist/primitives/date/index.js +3 -3
- package/dist/primitives/disclosure/index.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +3 -3
- package/dist/primitives/notice/Callout.d.ts +30 -30
- package/dist/primitives/notice/Callout.js +6 -6
- package/dist/primitives/overlay/index.js +3 -3
- package/dist/primitives/picker/Picker.d.ts +6 -0
- package/dist/primitives/picker/Picker.js +27 -4
- package/dist/primitives/picker/index.js +2 -2
- package/dist/primitives/table/DataTable.d.ts +32 -32
- package/dist/primitives/table/DataTable.js +24 -24
- package/dist/primitives/table/EditableTable.d.ts +10 -10
- package/dist/primitives/table/EditableTable.js +9 -9
- package/dist/primitives/table/ReportTable.js +7 -7
- package/dist/primitives/table/SheetTable.d.ts +13 -13
- package/dist/primitives/table/SheetTable.js +14 -14
- package/dist/primitives/table/Table.js +8 -8
- package/dist/primitives/tabs/Tabs.d.ts +46 -46
- package/dist/primitives/tabs/Tabs.js +7 -7
- package/dist/primitives/tag/index.js +2 -2
- package/dist/primitives/toolbar/index.js +1 -1
- package/dist/primitives/value/Copyable.d.ts +22 -22
- package/dist/primitives/value/Copyable.js +9 -9
- package/dist/tokens.css +17 -17
- package/dist/views/list/List.d.ts +36 -36
- package/dist/views/list/List.js +19 -19
- package/dist/views/list/ListView.js +74 -74
- package/dist/views/list/columns.d.ts +10 -10
- package/dist/views/list/columns.js +10 -10
- package/dist/views/list/derive.d.ts +30 -30
- package/dist/views/list/derive.js +49 -49
- package/dist/views/list/index.js +2 -2
- package/dist/views/list/presentations.js +3 -3
- package/dist/views/list/types.d.ts +109 -109
- package/dist/views/record/Record.d.ts +14 -14
- package/dist/views/record/Record.js +24 -24
- package/dist/views/record/index.js +1 -1
- package/package.json +1 -1
|
@@ -31,16 +31,16 @@ note, height, rowLabel, band, onBandToggle, caption, onCommit, editable, onAddRo
|
|
|
31
31
|
height?: number | "auto";
|
|
32
32
|
rowLabel?: (row: number) => string;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* This row is not a row: it is the header of the pile that begins here.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* Grouping without losing virtualisation is this — **a band is one more
|
|
37
|
+
* row, of another kind**. The alternative was one sheet per pile, and that is
|
|
38
|
+
* N grids with N headers and N scrolls for a single set.
|
|
39
39
|
*
|
|
40
|
-
* `depth`
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
40
|
+
* `depth` is how deep the pile is. The sheet cannot take a
|
|
41
|
+
* tree —it is virtualised by index, and an index is a position in a
|
|
42
|
+
* sequence—, so the hierarchy is told by each band's indentation and not by the
|
|
43
|
+
* nesting of the markup.
|
|
44
44
|
*/
|
|
45
45
|
band?: (row: number) => {
|
|
46
46
|
field?: string;
|
|
@@ -49,12 +49,12 @@ note, height, rowLabel, band, onBandToggle, caption, onCommit, editable, onAddRo
|
|
|
49
49
|
open: boolean;
|
|
50
50
|
depth?: number;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* What the pile adds up IN EACH COLUMN, at that column's position.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
54
|
+
* A band that puts its total in a corner forces you to look for which column
|
|
55
|
+
* the number belongs to. Aligned under its column there is nothing to look for:
|
|
56
|
+
* the grid already says what it means, which is what a
|
|
57
|
+
* grid is for. `null` in a column that does not add up — which is most of them.
|
|
58
58
|
*/
|
|
59
59
|
total?: (column: SheetColumn, columnIndex: number) => string | number | null;
|
|
60
60
|
} | undefined;
|
|
@@ -29,11 +29,11 @@ tone,
|
|
|
29
29
|
note, height = 420, rowLabel, band, onBandToggle, caption, onCommit, editable, onAddRow, }) {
|
|
30
30
|
const copy = useUiCopy();
|
|
31
31
|
const labelOf = rowLabel ?? ((i) => (i + 1).toLocaleString(copy.locale));
|
|
32
|
-
/* `"auto"`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/* `"auto"` is for a set that already came CUT —a page of eighty— and
|
|
33
|
+
in effect stops virtualising: with no scroll of its own, the visible window is the
|
|
34
|
+
whole box and every row is drawn. For raw data —where there are
|
|
35
|
+
a million— a height must be declared, and then only the ~30 in
|
|
36
|
+
view are drawn. When the box is a scroll container is decided by `useScrollBox`. */
|
|
37
37
|
const caja = useScrollBox(height === "auto" ? {} : { height });
|
|
38
38
|
const v = useVirtualizer({
|
|
39
39
|
count: rows,
|
|
@@ -173,16 +173,16 @@ note, height = 420, rowLabel, band, onBandToggle, caption, onCommit, editable, o
|
|
|
173
173
|
}, children: [_jsxs("div", { className: "sticky z-20 flex border-b border-line-strong bg-ground", style: stickyTop, role: "row", children: [_jsx("div", { className: "sticky left-0 z-30 shrink-0 border-r border-line bg-ground", style: { width: ROW_LABEL_WIDTH } }), columns.map((c) => (_jsxs("div", { role: "columnheader", style: { width: c.width ?? WIDTH }, className: `flex shrink-0 flex-col justify-center gap-0.5 border-r border-line px-2.5 py-1.5 ${c.numeric === true ? "items-end" : "items-start"}`, children: [_jsx("span", { className: "max-w-full truncate text-meta font-medium text-ink", title: c.header, children: c.header }), c.type === undefined ? null : (_jsx("span", { className: "max-w-full truncate font-mono text-micro text-muted", children: c.type }))] }, c.id))), _jsx("div", { className: "flex-1" })] }), _jsx("div", { style: { height: v.getTotalSize(), position: "relative" }, children: items.map((item) => {
|
|
174
174
|
const montón = band?.(item.index);
|
|
175
175
|
if (montón !== undefined) {
|
|
176
|
-
/*
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
/* The band sticks to the LEFT like the row number:
|
|
177
|
+
with forty columns, a label that goes away with the horizontal
|
|
178
|
+
scroll stops saying which pile you are in just when
|
|
179
|
+
you are furthest from it. */
|
|
180
180
|
return (
|
|
181
|
-
/*
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
/* The band RESPECTS the grid: label in the fixed column on
|
|
182
|
+
the left, and then one cell per column —empty, unless
|
|
183
|
+
that column adds something up—. It used to be a loose label that
|
|
184
|
+
ignored the columns, and then a total sat in a
|
|
185
|
+
corner without saying which column it was. */
|
|
186
186
|
_jsxs("div", { role: "row", "aria-rowindex": item.index + 1, className: "absolute top-0 left-0 flex w-full border-b border-line-strong bg-ground", style: { height: item.size, transform: `translateY(${item.start}px)` }, children: [_jsx("div", { role: "gridcell", className: "sticky left-0 z-10 shrink-0 border-r border-line bg-ground", style: { height: "100%", width: ROW_LABEL_WIDTH }, children: onBandToggle === undefined ? null : (_jsx("button", { type: "button", onClick: () => onBandToggle(item.index), "aria-expanded": montón.open, "aria-label": fillCopy(montón.open ? copy.report.close : copy.report.open, {
|
|
187
187
|
name: montón.label,
|
|
188
188
|
}), className: "flex h-full w-full min-w-0 items-center gap-1.5 px-2.5 text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary", style: montón.depth === undefined || montón.depth === 0
|
|
@@ -47,10 +47,10 @@ export function Table({ children,
|
|
|
47
47
|
height, rowCount, }) {
|
|
48
48
|
const caja = useScrollBox(height === undefined ? {} : { height });
|
|
49
49
|
return (
|
|
50
|
-
/*
|
|
51
|
-
`useScrollBox`:
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/* When this box is a scroll container and when it is not is decided by
|
|
51
|
+
`useScrollBox`: the whole dilemma lives there, and so does its explanation. The
|
|
52
|
+
three tables of the system solved it with three copies of the same
|
|
53
|
+
measurement. */
|
|
54
54
|
_jsx("div", { ref: caja.ref, tabIndex: caja.tabIndex, className: `min-w-0 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${caja.className}`, style: caja.style, children: _jsx("table", { "aria-rowcount": rowCount, className: "w-full border-separate border-spacing-0 px-1 text-left", children: children }) }));
|
|
55
55
|
}
|
|
56
56
|
/** The text of a column header, shared by every table of the family. Ink and semibold, not
|
|
@@ -58,10 +58,10 @@ height, rowCount, }) {
|
|
|
58
58
|
export const HEADER_TEXT = "text-meta font-semibold whitespace-nowrap text-ink";
|
|
59
59
|
export function THead({ children, rowIndex, }) {
|
|
60
60
|
return (
|
|
61
|
-
/*
|
|
62
|
-
|
|
63
|
-
`Table`
|
|
64
|
-
|
|
61
|
+
/* It sticks BELOW whatever is already stuck —the application bar and the
|
|
62
|
+
list's— and not at `top: 0`, which tucked it behind both. Without a height on
|
|
63
|
+
`Table` the page is what scrolls, and there the difference is exactly
|
|
64
|
+
what made the column names disappear. See `system/sticky.tsx`. */
|
|
65
65
|
_jsx("thead", { className: "sticky z-10 bg-ground", style: stickyTop, children: _jsx("tr", { "aria-rowindex": rowIndex, children: children }) }));
|
|
66
66
|
}
|
|
67
67
|
/** A column. If it gets a `sortKey`, it can be sorted.
|
|
@@ -2,78 +2,78 @@ import type { Tone } from "../../foundations/types.js";
|
|
|
2
2
|
import type { LucideIcon } from "lucide-react";
|
|
3
3
|
import { type ReactNode } from "react";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A STRIP OF TABS. The same across the whole system.
|
|
6
6
|
*
|
|
7
|
-
* Context:
|
|
8
|
-
* `Aspects`,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Context: this lived inside the record's header and was called
|
|
8
|
+
* `Aspects`, so the activity —which needs exactly the same— could not
|
|
9
|
+
* use it: a context does not import from another context. The result was a second-hand
|
|
10
|
+
* strip of tabs, with the active one marked differently, on the same
|
|
11
|
+
* screen as the good one.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* It is a primitive because it does not know what it is separating: a record's
|
|
14
|
+
* faces, the two sources of a history, or whatever comes.
|
|
15
15
|
*
|
|
16
|
-
* ──
|
|
16
|
+
* ── Why the active one is a folder TAB ──────────────────────────────
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* And not an underline. An underline says «this is chosen»; a tab that sticks out
|
|
19
|
+
* of the border and covers the line says «this is OPEN and what is below is its
|
|
20
|
+
* content», which is the real relationship. The difference matters when there are three and
|
|
21
|
+
* the content below does not change shape when switching from one to another.
|
|
22
22
|
*
|
|
23
|
-
* ──
|
|
23
|
+
* ── The counter muted at zero ───────────────────────────────────────
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* A zero is drawn, and muted. Hiding it forces you to open the tab to
|
|
26
|
+
* find out it is empty; painting it like the others makes it look as if it has
|
|
27
|
+
* something. «There are none» is information and it is said.
|
|
28
28
|
*
|
|
29
|
-
* ──
|
|
29
|
+
* ── The counter and the NOTIFICATION are two things ─────────────────
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* The counter says HOW MANY things are behind, and is neutral: «pagos 0» is an
|
|
32
|
+
* answer as valid as «pagos 5». The notification says that something in there
|
|
33
|
+
* ASKS you to look —it failed, changed, arrived— and that is why it has colour and why a
|
|
34
|
+
* zero is not drawn: there is nothing to ask.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Confusing them looks like this: a tab with «3» beside it and nobody knows whether it is three
|
|
37
|
+
* things or three problems. They are two marks because they are two questions.
|
|
38
38
|
*/
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* SOMETHING IN THIS TAB ASKS FOR ATTENTION.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* It is not a count: a count says how many things there are and this says there is something to
|
|
43
|
+
* look at. That is why it has colour, why it is not drawn at zero, and why it can
|
|
44
|
+
* live alongside the counter — «pagos 4 ⬤» is four things, one of them
|
|
45
|
+
* rejected.
|
|
46
46
|
*/
|
|
47
47
|
export type TabNotice = {
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* What asks for attention, in the product's voice: «3 sin leer», «la
|
|
50
50
|
* factura no se pudo enviar».
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
52
|
+
* Required, and for the same reason as in `StatusDot`: a coloured dot without
|
|
53
|
+
* its word beside it forces learning a legend that is written nowhere,
|
|
54
|
+
* and tells nothing to someone who cannot tell red from green. Here
|
|
55
|
+
* the mark speeds up scanning and the word informs — it is read on hover
|
|
56
|
+
* and a screen reader reads it.
|
|
57
57
|
*/
|
|
58
58
|
label: string;
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
/** How many things ask for it. Without this it is a dot, which is what is used when
|
|
60
|
+
* something new arrived and counting it adds nothing. A `0` draws nothing: there is
|
|
61
|
+
* nothing to ask. */
|
|
62
62
|
count?: number;
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
63
|
+
/** Of what kind: `bad` something failed, `warn` something warns, `accent` or `info` something
|
|
64
|
+
* arrived. Without this, `bad` — which is the case this exists for. */
|
|
65
65
|
tone?: Tone;
|
|
66
66
|
};
|
|
67
67
|
export type TabItem = {
|
|
68
68
|
id: string;
|
|
69
69
|
label: string;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
70
|
+
/** The tab's mark. With three or more, the icon is what is recognised without
|
|
71
|
+
* reading — and in a narrow strip it is the only thing that survives truncation. */
|
|
72
72
|
icon?: LucideIcon;
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
73
|
+
/** How many things are behind. `undefined` = not counted; `0` is drawn
|
|
74
|
+
* muted, which is different from not counting. */
|
|
75
75
|
count?: number;
|
|
76
|
-
/**
|
|
76
|
+
/** That something in here asks you to look. Apart from the counter: see `TabNotice`. */
|
|
77
77
|
notice?: TabNotice;
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
@@ -104,6 +104,6 @@ export declare function Tabs({ tabs, current, onSelect, label, }: {
|
|
|
104
104
|
tabs: readonly TabItem[];
|
|
105
105
|
current: string;
|
|
106
106
|
onSelect?: (id: string) => void;
|
|
107
|
-
/**
|
|
107
|
+
/** The strip's accessible label. Without this, «las caras del registro». */
|
|
108
108
|
label?: string;
|
|
109
109
|
}): import("react").JSX.Element;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
4
|
import { createContext, useContext, useId, useRef, } from "react";
|
|
5
|
-
/*
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/* The notification's colour. Static and in a table because Tailwind cannot
|
|
6
|
+
compose a class with a variable piece: `bg-${tone}/12` does not exist in the
|
|
7
|
+
stylesheet. */
|
|
8
8
|
const NOTICE_TONE = {
|
|
9
9
|
neutral: "bg-ink/8 text-muted",
|
|
10
10
|
info: "bg-info/12 text-info",
|
|
@@ -90,8 +90,8 @@ export function Tabs({ tabs, current, onSelect, label, }) {
|
|
|
90
90
|
return (_jsx("div", { ref: strip, role: "tablist", "aria-label": label ?? copy.record.faces, onKeyDown: onKeyDown, className: "flex min-w-0 flex-wrap items-end gap-1", children: tabs.map((a) => {
|
|
91
91
|
const Icon = a.icon;
|
|
92
92
|
const empty = a.count === 0;
|
|
93
|
-
/*
|
|
94
|
-
|
|
93
|
+
/* A zero asks for nothing, so it is not drawn. That is the difference from the
|
|
94
|
+
counter, where «0» is an answer. */
|
|
95
95
|
const notice = a.notice?.count === 0 ? undefined : a.notice;
|
|
96
96
|
const isSelected = a.id === current;
|
|
97
97
|
return (_jsx("button", { type: "button", role: "tab", "data-tab": a.id, "aria-selected": isSelected, tabIndex: isSelected ? 0 : -1, ...(base === null
|
|
@@ -103,8 +103,8 @@ export function Tabs({ tabs, current, onSelect, label, }) {
|
|
|
103
103
|
: isSelected
|
|
104
104
|
? "bg-ink/8 text-ink"
|
|
105
105
|
: "bg-ink/8 text-muted"}`, children: a.count.toLocaleString(copy.locale) })), notice === undefined ? null : (_jsx("span", { className: "sr-only", children: ` · ${notice.label}` })), notice === undefined ? null : notice.count === undefined ? (
|
|
106
|
-
/*
|
|
107
|
-
`title`
|
|
106
|
+
/* Without a number, a dot. The word is not drawn but it is there: in the
|
|
107
|
+
`title` and in the tab's accessible name. */
|
|
108
108
|
_jsx("span", { className: `size-1.5 shrink-0 rounded-pill ${NOTICE_DOT[notice.tone ?? "bad"]}`, "aria-hidden": true })) : (_jsx("span", { className: `rounded-pill px-1.5 text-micro font-medium tabular-nums ${NOTICE_TONE[notice.tone ?? "bad"]}`, "aria-hidden": true, children: notice.count.toLocaleString(copy.locale) }))] }) }, a.id));
|
|
109
109
|
}) }));
|
|
110
110
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Saying a state without writing a sentence: the capsule and the dot. */
|
|
2
2
|
export { StatusDot, Tag } from "./Tag.js";
|
|
3
|
-
/*
|
|
4
|
-
|
|
3
|
+
/* The strip of chips: the same in the bar, in the dropdown and anywhere
|
|
4
|
+
a list of short words is drawn. */
|
|
5
5
|
export { Tags } from "./Tags.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* THE TOOLBAR — a group of controls walked with the arrow keys. */
|
|
2
2
|
export { Toolbar, ToolbarSeparator } from "./Toolbar.js";
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* A VALUE THAT GETS COPIED.
|
|
4
4
|
*
|
|
5
|
-
* Context:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Context: half the values in this product exist to be pasted somewhere
|
|
6
|
+
* else —a tax ID, an invoice CUF, a bank reference, a 26-character
|
|
7
|
+
* authorisation code—. Selecting them by hand fails precisely with the ones
|
|
8
|
+
* where it matters most not to make a mistake: they are long, monospaced and get cut off.
|
|
9
9
|
*
|
|
10
|
-
* ──
|
|
10
|
+
* ── It confirms, and that is why the state lives here ───────────────
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Copying has no visible effect: the clipboard is off the screen. A
|
|
13
|
+
* button that does not answer gets pressed three times «just in case». That is why the icon
|
|
14
|
+
* turns into a tick for two seconds — the minimum to believe it without staying
|
|
15
|
+
* to watch.
|
|
16
16
|
*
|
|
17
|
-
* ──
|
|
17
|
+
* ── And it can fail ─────────────────────────────────────────────────
|
|
18
18
|
*
|
|
19
|
-
* `navigator.clipboard`
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* `navigator.clipboard` does not exist outside a secure context, and in some
|
|
20
|
+
* browsers it demands a permission that can be denied. That is handled: if it fails, the
|
|
21
|
+
* button says so instead of pretending it copied. A false confirmation is worse than
|
|
22
|
+
* none, because someone pastes what they had before and never finds out.
|
|
23
23
|
*/
|
|
24
24
|
export type CopyableProps = {
|
|
25
|
-
/**
|
|
25
|
+
/** What is copied. Always text: the clipboard has no types. */
|
|
26
26
|
value: string;
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
/** How it looks, if it is not the value as is. A fingerprint is shown cut off and
|
|
28
|
+
* copied whole, which is precisely why the two things are different
|
|
29
|
+
* props. */
|
|
30
30
|
children?: ReactNode;
|
|
31
|
-
/**
|
|
31
|
+
/** The value is a machine's: id, hash, key. Without this, normal typography. */
|
|
32
32
|
mono?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
33
|
+
/** Only the button, without the value beside it. For a cell or a header where
|
|
34
|
+
* the value is already drawn. */
|
|
35
35
|
bare?: boolean;
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
@@ -3,8 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
4
|
import { Check, Copy } from "lucide-react";
|
|
5
5
|
import { useEffect, useRef, useState } from "react";
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
6
|
+
/** How long the tick lasts. Two seconds: enough to see it without the button
|
|
7
|
+
* staying in a state that is no longer true. */
|
|
8
8
|
const CONFIRMED_FOR = 2000;
|
|
9
9
|
/**
|
|
10
10
|
* The button alone, for a value that is only known when it is pressed — what a field shows
|
|
@@ -15,8 +15,8 @@ export function CopyButton({ value, label, }) {
|
|
|
15
15
|
const copy = useUiCopy();
|
|
16
16
|
const [state, setState] = useState("idle");
|
|
17
17
|
const timer = useRef(null);
|
|
18
|
-
/*
|
|
19
|
-
|
|
18
|
+
/* Cleared on unmount: without this, copying and closing the panel before the two
|
|
19
|
+
seconds leaves a `setState` pointing at a component that no longer exists. */
|
|
20
20
|
useEffect(() => () => {
|
|
21
21
|
if (timer.current !== null)
|
|
22
22
|
clearTimeout(timer.current);
|
|
@@ -36,8 +36,8 @@ export function CopyButton({ value, label, }) {
|
|
|
36
36
|
setState("done");
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
39
|
-
/*
|
|
40
|
-
|
|
39
|
+
/* Without a clipboard —insecure context, permission denied— it SAYS so. Pretending
|
|
40
|
+
it copied makes someone paste what they had before without knowing. */
|
|
41
41
|
setState("failed");
|
|
42
42
|
}
|
|
43
43
|
timer.current = setTimeout(() => setState("idle"), CONFIRMED_FOR);
|
|
@@ -64,8 +64,8 @@ export function Copyable({ value, children, mono = false, bare = false }) {
|
|
|
64
64
|
if (bare)
|
|
65
65
|
return button;
|
|
66
66
|
return (
|
|
67
|
-
/*
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/* The button appears with the pointer and ALWAYS takes up space: if it appeared out of
|
|
68
|
+
nowhere, the value would shift on hover, and text that moves
|
|
69
|
+
when you go to select it is worse than having no button. */
|
|
70
70
|
_jsxs("span", { className: "group/copy inline-flex min-w-0 items-center gap-1", children: [_jsx("span", { className: `min-w-0 truncate ${mono ? "font-mono" : ""}`, children: children ?? value }), _jsx("span", { className: "opacity-0 transition-opacity duration-(--duration-instant) group-hover/copy:opacity-100 focus-within:opacity-100", children: button })] }));
|
|
71
71
|
}
|
package/dist/tokens.css
CHANGED
|
@@ -461,19 +461,19 @@
|
|
|
461
461
|
`ListingBar`. */
|
|
462
462
|
--container-search: 30rem;
|
|
463
463
|
|
|
464
|
-
/*
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
—
|
|
473
|
-
|
|
474
|
-
`--container-trail`
|
|
475
|
-
|
|
476
|
-
|
|
464
|
+
/* What a crumb ASKS for before being clipped, and what the whole trail asks for.
|
|
465
|
+
Both are requests and not widths: a narrower line drops them, and a
|
|
466
|
+
wider one lets them grow.
|
|
467
|
+
|
|
468
|
+
Both are needed because they are two different problems. A name in this
|
|
469
|
+
product reaches fifty characters, so ONE crumb can eat the whole
|
|
470
|
+
line even if the trail has three: `--container-crumb` is what
|
|
471
|
+
each one asks for before ending in «…», and there the last one rules
|
|
472
|
+
—where I am— which is never clipped entirely.
|
|
473
|
+
|
|
474
|
+
`--container-trail` is what the COMPLETE trail asks for in the band's
|
|
475
|
+
line. Without it, «de dónde vengo» takes the room from what hangs off the
|
|
476
|
+
record and the centre stops being in the centre. */
|
|
477
477
|
--container-crumb: 12rem;
|
|
478
478
|
--container-trail: 20rem;
|
|
479
479
|
|
|
@@ -987,10 +987,10 @@
|
|
|
987
987
|
color: var(--color-ink);
|
|
988
988
|
font-family: var(--font-sans);
|
|
989
989
|
-webkit-font-smoothing: antialiased;
|
|
990
|
-
/*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
*
|
|
990
|
+
/* Horizontal only. Removing `overflow: hidden` entirely uncovered something that
|
|
991
|
+
* overflows sideways —a panel hidden off-screen, measured for
|
|
992
|
+
* a width that is no longer its own— and without this brake one could scroll to
|
|
993
|
+
* the right to see it. The height stays free: that is what was being fixed. */
|
|
994
994
|
overflow-x: hidden;
|
|
995
995
|
}
|
|
996
996
|
|