@sincpro/web-ui 1.11.1 → 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 +35 -22
- package/dist/components/search/CriteriaBuilder.js +95 -85
- package/dist/components/search/CriteriaChips.d.ts +9 -9
- package/dist/components/search/CriteriaChips.js +13 -13
- package/dist/components/search/FilterBuilder.d.ts +72 -71
- package/dist/components/search/FilterBuilder.js +190 -145
- 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 +21 -18
- package/dist/components/search/SearchBar.d.ts +34 -34
- package/dist/components/search/SearchBar.js +113 -113
- package/dist/components/search/criteria.d.ts +86 -74
- package/dist/components/search/criteria.js +44 -43
- 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.d.ts +2 -2
- package/dist/components/search/index.js +14 -14
- 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 +104 -94
- package/dist/foundations/copy.es.js +6 -1
- package/dist/foundations/copy.js +6 -1
- 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
|
@@ -4,35 +4,34 @@ import { type CalloutProps } from "../../primitives/notice/Callout.js";
|
|
|
4
4
|
import type { LucideIcon } from "lucide-react";
|
|
5
5
|
import { type ReactNode } from "react";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Something the system noted.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* que uno termina yendo a buscar a otro lado.
|
|
9
|
+
* Deliberately NOT the product's event: what a story needs to draw one is what happened,
|
|
10
|
+
* when, who, and —when they exist— the three things one ends up going elsewhere to look for.
|
|
12
11
|
*
|
|
13
|
-
* by
|
|
14
|
-
* moved
|
|
15
|
-
* error
|
|
16
|
-
*
|
|
12
|
+
* by WHO. Absent = the system did it, which is also an answer.
|
|
13
|
+
* moved FROM WHAT TO WHAT. «borrador → confirmado» reads at a glance.
|
|
14
|
+
* error WHAT failed, whole and verbatim: whoever looks at this screen many
|
|
15
|
+
* times has no access to the logs.
|
|
17
16
|
*/
|
|
18
17
|
export type ActivityEvent = {
|
|
19
18
|
id: string;
|
|
20
|
-
/**
|
|
19
|
+
/** What happened, in one sentence and in the past tense. */
|
|
21
20
|
label: ReactNode;
|
|
22
21
|
at: Date | string | number;
|
|
23
22
|
tone?: Tone;
|
|
24
|
-
/**
|
|
23
|
+
/** Who did it. Absent = the system. */
|
|
25
24
|
by?: string;
|
|
26
|
-
/**
|
|
25
|
+
/** The change of state, when there was one. `from` absent = it was born like that. */
|
|
27
26
|
moved?: {
|
|
28
27
|
from?: string;
|
|
29
28
|
to: string;
|
|
30
29
|
};
|
|
31
|
-
/**
|
|
30
|
+
/** What one needs to know besides the title, when the title is not enough. */
|
|
32
31
|
detail?: ReactNode;
|
|
33
|
-
/**
|
|
32
|
+
/** What failed, verbatim. The FIRST line is shown and the rest opens. */
|
|
34
33
|
error?: string;
|
|
35
|
-
/**
|
|
34
|
+
/** The dot's icon, when the bolt does not say enough. */
|
|
36
35
|
icon?: LucideIcon;
|
|
37
36
|
};
|
|
38
37
|
/** A notice of the record, as the panel lists it: a `Callout` without its × label. */
|
|
@@ -90,7 +90,7 @@ function ErrorLine({ error }) {
|
|
|
90
90
|
return (_jsxs("div", { className: "min-w-0 rounded-control border border-line bg-surface px-2 py-1", children: [_jsx("p", { className: `min-w-0 font-mono text-micro text-ink ${open ? "break-words whitespace-pre-wrap" : "truncate"}`, children: open ? error : first }), !more ? null : (_jsx("button", { type: "button", onClick: () => setOpen(!open), className: "mt-0.5 cursor-pointer text-micro text-muted underline-offset-2 hover:text-ink hover:underline", children: open ? copy.activity.less : copy.activity.more }))] }));
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* AN EVENT: a row that opens, not a line.
|
|
94
94
|
*
|
|
95
95
|
* Closed it says what happened —in up to two lines, never cut to «se envió …»— and
|
|
96
96
|
* under it who and when, in the quiet size. That second line is what made the narrow
|
|
@@ -48,12 +48,12 @@ export type MessageKind = {
|
|
|
48
48
|
placeholder?: string;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* WRITE A NOTE, the way every list has.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* It is a function and not a constant because its words come from the copy, and a
|
|
54
|
+
* constant would freeze them with whatever there was when the module loaded —that is, the
|
|
55
|
+
* factory ones— even if another is installed afterwards. Without `copy`, the installed ones; a
|
|
56
|
+
* component passes it those of its branch.
|
|
57
57
|
*/
|
|
58
58
|
export declare function writeANote(copy?: UiCopy): MessageKind;
|
|
59
59
|
export type MessageComposerProps = {
|
|
@@ -6,12 +6,12 @@ import { TextArea } from "../../primitives/field/Field.js";
|
|
|
6
6
|
import { Send, Users, X } from "lucide-react";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* WRITE A NOTE, the way every list has.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* It is a function and not a constant because its words come from the copy, and a
|
|
12
|
+
* constant would freeze them with whatever there was when the module loaded —that is, the
|
|
13
|
+
* factory ones— even if another is installed afterwards. Without `copy`, the installed ones; a
|
|
14
|
+
* component passes it those of its branch.
|
|
15
15
|
*/
|
|
16
16
|
export function writeANote(copy = currentCopy()) {
|
|
17
17
|
return {
|
|
@@ -23,9 +23,9 @@ export function writeANote(copy = currentCopy()) {
|
|
|
23
23
|
}
|
|
24
24
|
export function MessageComposer({ kinds, onSend, sending = false, footer, }) {
|
|
25
25
|
const copy = useUiCopy();
|
|
26
|
-
/*
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
/* The default way is built in here and not in the signature: a parameter
|
|
27
|
+
default is evaluated on every render, yes, but written as a module
|
|
28
|
+
constant it would freeze the factory words. */
|
|
29
29
|
const ways = kinds ?? [writeANote(copy)];
|
|
30
30
|
const [writing, setWriting] = useState(undefined);
|
|
31
31
|
const [body, setBody] = useState("");
|
|
@@ -4,13 +4,13 @@ import { byDensity, useDensity } from "../../foundations/density.js";
|
|
|
4
4
|
import { Hint } from "../../primitives/hint/Hint.js";
|
|
5
5
|
import { Tag } from "../../primitives/tag/Tag.js";
|
|
6
6
|
/* ==================================================================== *
|
|
7
|
-
*
|
|
7
|
+
* THE COMPOSITION OF A FORM: the section and the footer.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* It lives in `contexts/form` and not beside the controls because it is not a control:
|
|
10
|
+
* it is what ARRANGES them. `TextInput` does not know a form exists —it is used
|
|
11
|
+
* the same inside a cell, a filter or a dialog— and a section does not
|
|
12
|
+
* know which fields will be put inside it. They are two layers and so they are two
|
|
13
|
+
* folders: `primitives/field` is WITH WHAT you write, this is HOW it is put together.
|
|
14
14
|
* ==================================================================== */
|
|
15
15
|
/** A group of fields with its name and its status.
|
|
16
16
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
1
|
+
/* FORM — what ARRANGES the fields: the sheet, the section and the footer. The
|
|
2
|
+
controls fields are written with live in `primitives/field`. */
|
|
3
3
|
export { FormActions, FormSection } from "./Form.js";
|
|
4
4
|
export { Sheet, SheetGroup, SheetGroups, } from "./Sheet.js";
|
|
@@ -21,12 +21,12 @@ export type FrameViewProps = {
|
|
|
21
21
|
search?: ReactNode;
|
|
22
22
|
pagination?: ReactNode;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* The grouping, with the same contract the list uses.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* What is grouped here are row INDEXES and not records: a frame is a
|
|
27
|
+
* matrix and its rows have no identity of their own —they are row 12 of the file—,
|
|
28
|
+
* so `T` is `number` and `of(row, level)` reads the matching cell. The
|
|
29
|
+
* contract does not change, which is exactly the proof that it is not restrictive.
|
|
30
30
|
*/
|
|
31
31
|
grouping?: Grouping<number>;
|
|
32
32
|
};
|
|
@@ -47,10 +47,10 @@ export function FrameView({ frame, identity, caption, present: presentProp, pres
|
|
|
47
47
|
const shown = useMemo(() => columns.visibleIds.length === frame.columns.length
|
|
48
48
|
? frame
|
|
49
49
|
: withColumns(frame, columns.visibleIds), [frame, columns.visibleIds]);
|
|
50
|
-
/*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/* The heaps flattened into a SEQUENCE: the sheet is virtualised by
|
|
51
|
+
index, so the hierarchy is told by each band's indentation and not by
|
|
52
|
+
nesting. It is the same flattening the list does, over indexes instead of
|
|
53
|
+
records. */
|
|
54
54
|
const bands = useMemo(() => {
|
|
55
55
|
const piles = pilesOf(Array.from({ length: shown.rows }, (_, index) => index), grouping);
|
|
56
56
|
if (piles === null)
|
|
@@ -2,38 +2,38 @@ import type { GroupingControl } from "./grouping.js";
|
|
|
2
2
|
import { type PathPick } from "../search/FieldPath.js";
|
|
3
3
|
import { type GroupableField, type GroupGrain } from "../../foundations/grouping.js";
|
|
4
4
|
/**
|
|
5
|
-
* «AGRUPAR POR»,
|
|
5
|
+
* «AGRUPAR POR», inside the cuts panel.
|
|
6
6
|
*
|
|
7
|
-
* Context:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Context: it goes in the SAME column where the filters and the favourites are, and not
|
|
8
|
+
* in a separate control. Filtering and grouping are the same question —«which part of
|
|
9
|
+
* this am I looking at»— and separating them forces you to open two things to build a
|
|
10
|
+
* cut, without being able to see both states at once.
|
|
11
11
|
*
|
|
12
|
-
* ──
|
|
12
|
+
* ── A date UNFOLDS, it is not chosen ───────────────────────────────
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
* «
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* An ordinary field is an option: you tick it and that is it. A date field is not, because
|
|
15
|
+
* «group by date» means nothing until you say with what cut — and the
|
|
16
|
+
* cuts are not exclusive: «by month and inside it by day» is a
|
|
17
|
+
* legitimate and frequent question. So a date opens and offers its grains as
|
|
18
|
+
* CHECKBOXES, which are ticked several at a time.
|
|
19
19
|
*
|
|
20
|
-
* ──
|
|
20
|
+
* ── And they sort themselves ───────────────────────────────────────
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
22
|
+
* Ticking «día» and then «mes» gives «mes › día», never the other way round. It is not
|
|
23
|
+
* a preference: a whole day lives inside a single month, so splitting first
|
|
24
|
+
* by day leaves a month level that splits nothing. The direction is set by the
|
|
25
|
+
* calendar and that is why the system sets it — see `normalizeLevels`.
|
|
26
26
|
*/
|
|
27
27
|
export type GroupingLevelsProps = {
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
28
|
+
/** Which fields it can be split by. With none nothing is drawn: an empty
|
|
29
|
+
* column in the panel is worse than a column that is not there. */
|
|
30
30
|
fields: readonly GroupableField[];
|
|
31
31
|
control: GroupingControl;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
32
|
+
/** What each grain is called, when the product says it in other words.
|
|
33
|
+
* Without this, the copy's words in the active language. */
|
|
34
34
|
grainLabel?: (grain: GroupGrain) => string;
|
|
35
|
-
/** «Agrupar por otro campo»:
|
|
36
|
-
*
|
|
35
|
+
/** «Agrupar por otro campo»: a `FieldPath` that walks relations («Cliente > País»).
|
|
36
|
+
* It returns the path; which level is set with it is decided by whoever orchestrates the screen. */
|
|
37
37
|
addPath?: PathPick;
|
|
38
38
|
};
|
|
39
39
|
export declare function GroupingLevels({ fields, control, grainLabel, addPath, }: GroupingLevelsProps): import("react").JSX.Element | null;
|
|
@@ -11,9 +11,9 @@ function fieldLabel(fields, field) {
|
|
|
11
11
|
}
|
|
12
12
|
export function GroupingLevels({ fields, control, grainLabel, addPath, }) {
|
|
13
13
|
const copy = useUiCopy();
|
|
14
|
-
/*
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/* Which dates are unfolded. The one that already has some grain
|
|
15
|
+
set starts unfolded: otherwise what is set is hidden behind a chevron and you have to
|
|
16
|
+
guess where. */
|
|
17
17
|
const [opened, setOpened] = useState(() => control.levels.filter((one) => one.grain !== undefined).map((one) => one.field));
|
|
18
18
|
if (fields.length === 0 && addPath === undefined)
|
|
19
19
|
return null;
|
|
@@ -23,12 +23,12 @@ export function GroupingLevels({ fields, control, grainLabel, addPath, }) {
|
|
|
23
23
|
const toggleOpen = (field) => setOpened((current) => current.includes(field) ? current.filter((one) => one !== field) : [...current, field]);
|
|
24
24
|
return (_jsxs("div", { className: "flex flex-col gap-0.5", children: [placed.length === 0 ? null : (_jsxs(_Fragment, { children: [_jsx("ol", { className: "flex flex-wrap gap-1 px-1 pb-1.5", children: placed.map((level, index) => (_jsx("li", { children: _jsxs("span", { className: "inline-flex items-center gap-1 rounded-pill border border-accent/40 bg-accent/18 py-0.5 pr-0.5 pl-1.5 text-micro text-ink", children: [_jsx("span", { className: "tabular-nums opacity-70", children: index + 1 }), _jsxs("span", { className: "max-w-32 truncate", children: [fieldLabel(fields, level.field), level.grain === undefined ? "" : ` · ${grain(level.grain)}`] }), _jsx("button", { type: "button", onClick: () => control.move(level.field, -1), disabled: index === 0, "aria-label": copy.grouping.up, title: copy.grouping.up, className: "rounded-pill p-0.5 hover:bg-primary/15 disabled:opacity-30 disabled:hover:bg-transparent", children: _jsx(ChevronUp, { className: "size-3", strokeWidth: 2.5 }) }), _jsx("button", { type: "button", onClick: () => control.move(level.field, 1), disabled: index === placed.length - 1, "aria-label": copy.grouping.down, title: copy.grouping.down, className: "rounded-pill p-0.5 hover:bg-primary/15 disabled:opacity-30 disabled:hover:bg-transparent", children: _jsx(ChevronDown, { className: "size-3", strokeWidth: 2.5 }) }), _jsx("button", { type: "button", onClick: () => control.remove(level.field, level.grain), "aria-label": copy.grouping.remove, title: copy.grouping.remove, className: "rounded-pill p-0.5 hover:bg-primary/15", children: _jsx(X, { className: "size-3", strokeWidth: 2.5 }) })] }) }, levelKey(level)))) }), _jsx("div", { className: "mb-1 h-px bg-line", role: "separator" })] })), fields.map((one) => {
|
|
25
25
|
const grains = one.grains;
|
|
26
|
-
/*
|
|
26
|
+
/* An ordinary field: a checkbox and nothing more. */
|
|
27
27
|
if (grains === undefined || grains.length === 0) {
|
|
28
28
|
const on = control.has(one.field);
|
|
29
29
|
return (_jsxs("button", { type: "button", onClick: () => control.toggle(one.field), "aria-pressed": on, className: `flex items-center gap-2 rounded-control px-1.5 py-1 text-left transition-colors duration-(--duration-instant) hover:bg-primary/8 ${on ? "bg-primary/6" : ""}`, children: [_jsx(Mark, { on: on }), _jsx("span", { className: `min-w-0 truncate text-meta ${on ? "font-medium text-ink" : "text-ink"}`, children: one.label })] }, one.field));
|
|
30
30
|
}
|
|
31
|
-
/*
|
|
31
|
+
/* A DATE: it unfolds and offers its cuts as checkboxes. */
|
|
32
32
|
const open = isOpen(one.field);
|
|
33
33
|
const puestos = placed.filter((level) => level.field === one.field);
|
|
34
34
|
return (_jsxs("div", { className: "flex flex-col", children: [_jsxs("button", { type: "button", onClick: () => toggleOpen(one.field), "aria-expanded": open, className: "flex items-center gap-1.5 rounded-control px-1.5 py-1 text-left transition-colors duration-(--duration-instant) hover:bg-primary/8", children: [_jsx(ChevronRight, { className: `size-(--size-icon-sm) shrink-0 text-muted transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true }), _jsx("span", { className: `min-w-0 flex-1 truncate text-meta ${puestos.length > 0 ? "font-medium text-ink" : "text-ink"}`, children: one.label }), puestos.length === 0 ? null : (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-accent/40 bg-accent/18 px-2 py-0.5 text-micro tabular-nums text-ink", children: puestos.length }))] }), !open ? null : (_jsx("div", { className: "flex flex-col pl-(--spacing-indent)", children: GRAIN_ORDER.filter((g) => grains.includes(g)).map((g) => {
|
|
@@ -39,10 +39,10 @@ export function GroupingLevels({ fields, control, grainLabel, addPath, }) {
|
|
|
39
39
|
? {}
|
|
40
40
|
: { followRelations: addPath.followRelations }), value: [], label: copy.fieldPath.addLevel, placeholder: copy.fieldPath.addLevel, onChange: addPath.onPick }) })), placed.length === 0 ? null : (_jsxs(_Fragment, { children: [_jsx("div", { className: "my-1 h-px bg-line", role: "separator" }), _jsx("button", { type: "button", onClick: () => control.clear(), className: "rounded-control px-2 py-1 text-left text-meta text-muted transition-colors duration-(--duration-instant) hover:bg-ink/4 hover:text-ink", children: copy.grouping.clear })] }))] }));
|
|
41
41
|
}
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
/** The tick mark. The column ALWAYS exists, ticked or not: without it,
|
|
43
|
+
* ticking shifts the text and the list jumps. When off, the ring is drawn, the same
|
|
44
|
+
* mark as the filters panel, so that both columns read as
|
|
45
|
+
* checkboxes and not as loose text with a gap on the left. */
|
|
46
46
|
function Mark({ on }) {
|
|
47
47
|
return (_jsx("span", { className: "flex size-(--size-icon-sm) shrink-0 items-center justify-center", children: on ? (_jsx("span", { className: "size-1.5 rounded-pill bg-primary" })) : (_jsx("span", { className: "size-3 rounded-pill border border-line-strong" })) }));
|
|
48
48
|
}
|
|
@@ -4,20 +4,20 @@ export declare function Listing({ bar, metrics, sticky, surface, children, }: {
|
|
|
4
4
|
/** The `ListingBar`: actions, title, search, pagination and views. */
|
|
5
5
|
bar?: ReactNode;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The bar stays at the top on scroll, below whatever is already stuck.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* It is opt-in and not the default because the background has to be that of what is
|
|
10
|
+
* BEHIND, and that depends on where it is placed: the list archetype lives
|
|
11
|
+
* on the page floor, but a `FrameView` —a record's «glance»— lives on the white
|
|
12
|
+
* PAPER, and there the floor-coloured band looks like a
|
|
13
|
+
* stain. It was discovered by comparing stories, not by reasoning.
|
|
14
14
|
*/
|
|
15
15
|
sticky?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* invisible—
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
/** What the list is placed on. It is used only for the background of the band that
|
|
17
|
+
* sticks: `chrome` paints the same blue the bar already paints —that is,
|
|
18
|
+
* invisible— and any other paints the FLOOR, which is what is behind a
|
|
19
|
+
* page list. Those living inside something white —a drawer, a preview—
|
|
20
|
+
* are compact, and in compact the bar does not stick. */
|
|
21
21
|
surface?: Surface;
|
|
22
22
|
/** The metrics that also narrow down. They go BELOW the bar and above the
|
|
23
23
|
* rows: they belong to the set I am looking at, not to the frame that frames
|
|
@@ -60,18 +60,18 @@ import { createPortal } from "react-dom";
|
|
|
60
60
|
* ==================================================================== */
|
|
61
61
|
export function Listing({ bar, metrics, sticky = false, surface, children, }) {
|
|
62
62
|
const d = useDensity();
|
|
63
|
-
/*
|
|
64
|
-
Context:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
/* The bar STICKS to the top and the rows go beneath it.
|
|
64
|
+
Context: with 187 rows, scrolling to see the last one left you without search,
|
|
65
|
+
without pager and without the presentation switcher — so cutting
|
|
66
|
+
after looking forced you to scroll up again. It sticks below whatever is already
|
|
67
|
+
stuck (the application bar) and pushes the stack down for the
|
|
68
|
+
table's header, which sticks below it. See `system/sticky.tsx`. */
|
|
69
69
|
const band = useStickyLayer();
|
|
70
|
-
/*
|
|
71
|
-
|
|
72
|
-
scroll.
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
/* In compact it does NOT stick, and not for lack of space: compact is a drawer
|
|
71
|
+
or a preview, that is a short box with its own header and its own
|
|
72
|
+
scroll. A band stuck there is painted over the drawer's white paper —it
|
|
73
|
+
looks like a stain— to solve a scroll that does not exist in five rows.
|
|
74
|
+
It is the same reason `ListingBar` does not draw the identity there either. */
|
|
75
75
|
const pegada = sticky && d === "comfortable";
|
|
76
76
|
/* With a sidebar the bar is the screen's header: it goes in the frame's full-width slot,
|
|
77
77
|
above the sidebar (see `shell/headerSlot.ts`), and the frame does the sticking. */
|
|
@@ -103,18 +103,18 @@ export function ListingBar({ actions, title, description, counters, selection, s
|
|
|
103
103
|
: fillCopy(copy.list.count, { count: count.toLocaleString(copy.locale) }) })));
|
|
104
104
|
return (_jsx(SurfaceProvider, { value: "canvas", children: _jsxs("div", { className: `flex min-w-0 flex-wrap items-center gap-y-1.5 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [title === undefined ? null : (_jsx("h2", { className: "min-w-0 shrink-0 truncate text-body font-semibold text-ink", children: title })), center === null ? null : (_jsx("div", { className: "flex min-w-0 flex-1 basis-(--container-name) items-center overflow-x-clip overflow-y-visible", children: center })), howMany, views === undefined ? null : (_jsx("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: views })), actions === undefined ? null : (_jsx("div", { className: `flex shrink-0 items-center gap-1.5 ${views === undefined ? "ml-auto" : ""}`, children: actions }))] }) }));
|
|
105
105
|
}
|
|
106
|
-
/*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
/* The search field goes in the CENTRE of the line, centred against the
|
|
107
|
+
line: it asks for `--container-search` and the two sides share what is left
|
|
108
|
+
in equal halves. Before, it took the rest, so a long trail on the
|
|
109
|
+
left pushed it —and two lists in a row drew their search box in two
|
|
110
|
+
different places—. See `primitives/block/Line.tsx`. */
|
|
111
111
|
const topRow = (_jsx(Line, { asks: "var(--container-crumb)", centerAsks: center === null ? "auto" : "var(--container-search)", gap: byDensity(d, "gap-x-4 gap-y-2", "gap-x-2 gap-y-1.5"), align: "items-start", start: crumbs,
|
|
112
|
-
/* `overflow-x-clip`
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
/* `overflow-x-clip` and NOT `overflow-hidden`: what has to be clipped is the
|
|
113
|
+
width —so the field does not paint over «1–80»—, and `hidden` on one axis
|
|
114
|
+
forces `auto` on the other, so it also clipped DOWNWARD. The
|
|
115
|
+
`SearchBar`'s filter panel hangs with `absolute top-full`, that is
|
|
116
|
+
just outside this box: pressing the funnel opened a panel nobody
|
|
117
|
+
saw. `clip` is the only value that leaves the other axis `visible`. */
|
|
118
118
|
center: center === null ? null : (_jsx("div", { className: "flex w-full min-w-0 items-center overflow-x-clip overflow-y-visible", children: center })), end: pagination }));
|
|
119
119
|
const bottomRow = actions === undefined && !withIdentity && views === undefined ? null : (
|
|
120
120
|
/* On a narrow list (a phone, a drawer) the name and its counters take the whole first
|
|
@@ -59,37 +59,37 @@ export declare function Row({ icon: Icon, avatar, name, onOpen, onPeek, click, o
|
|
|
59
59
|
children?: ReactNode;
|
|
60
60
|
}): import("react").JSX.Element;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* THE ROWS PRESENTATION'S HEADER.
|
|
63
63
|
*
|
|
64
|
-
* Context:
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
64
|
+
* Context: the table and the sheet say what each column is; the rows list
|
|
65
|
+
* said nothing. Eighty lines with «Ferretería Sur · 13 sept · Bs 12.480» on the
|
|
66
|
+
* right and a card at the end, and you had to deduce what each number was — or
|
|
67
|
+
* switch to the table to find out, which is changing presentation to read
|
|
68
|
+
* the same screen.
|
|
69
69
|
*
|
|
70
|
-
* **
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* **They are not columns: they are the row's ZONES, labelled.** A row has a
|
|
71
|
+
* name that stretches, a `meta` that is ONE already-formatted string, and a
|
|
72
|
+
* column of cards of fixed width. Labelling them as if they were three aligned
|
|
73
|
+
* columns would be lying about what is underneath: one row's `meta` may
|
|
74
|
+
* say three things and another's two.
|
|
75
75
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
76
|
+
* That is why it traces `Row`'s box —same padding, same gaps, same
|
|
77
|
+
* checkbox, icon and actions spacers— instead of declaring a width of its
|
|
78
|
+
* own. If `Row` changes its geometry, this follows it.
|
|
79
79
|
*/
|
|
80
80
|
export declare function RowHeader({ name, meta, tags, withSelection, withIcon, withAvatar, withActions, trail, }: {
|
|
81
81
|
name: string;
|
|
82
82
|
meta?: string;
|
|
83
83
|
tags?: string;
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
84
|
+
/** The spacers on the left. Whoever draws the rows puts them, because
|
|
85
|
+
* they are the only one who knows whether this list selects and whether its rows have an icon. */
|
|
86
86
|
withSelection?: boolean;
|
|
87
87
|
withIcon?: boolean;
|
|
88
88
|
/** The rows carry a face instead of an icon: a wider spacer, so the labels stay aligned. */
|
|
89
89
|
withAvatar?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* —
|
|
92
|
-
*
|
|
90
|
+
/** The actions zone on the right takes up its place even when invisible
|
|
91
|
+
* —so nothing shifts when the pointer passes—, so the cards' label
|
|
92
|
+
* ends up misaligned if the same is not reserved here. */
|
|
93
93
|
withActions?: boolean;
|
|
94
94
|
/** What the rows have at their end — the same flags `Row` gets — drawn invisible here so
|
|
95
95
|
* the header reserves exactly that width. Takes over from `withActions`. */
|
|
@@ -63,11 +63,11 @@ export function Row({ icon: Icon, avatar, name, onOpen, onPeek, click = "peek",
|
|
|
63
63
|
inset and rounded, so the hover is a mark and not a stripe. The inner
|
|
64
64
|
padding is shorter by exactly that inset, so the text does not move. */
|
|
65
65
|
className: `group/row flex min-w-0 items-center rounded-control transition-colors duration-(--duration-instant) ${interactive ? "cursor-pointer hover:bg-ink/4" : ""} ${byDensity(d, "gap-3 px-2 py-2", "gap-2 px-1.5 py-1")}`,
|
|
66
|
-
/* `onPeek`
|
|
67
|
-
natural
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
/* `onPeek` with `onOpen` as a fallback: whoever declares only `onOpen` —what is
|
|
67
|
+
natural if they never heard of the preview— must be able to open
|
|
68
|
+
just the same by clicking anywhere on the row, not only on the
|
|
69
|
+
name. With the preview turned off (`PeekLayer.tsx`) this is today the
|
|
70
|
+
case for everyone: a click on the row opens, plain and simple. */
|
|
71
71
|
onClick: click === "open" ? (onOpen ?? onPeek) : (onPeek ?? onOpen), role: "presentation", children: [onSelectedChange === undefined ? null : (_jsx("input", { type: "checkbox", checked: selected ?? false, "aria-label": fillCopy(copy.selection.named, { name }), onChange: (e) => onSelectedChange(e.target.checked), onClick: (e) => e.stopPropagation(), className: "size-3.5 shrink-0 cursor-pointer accent-primary" })), avatar !== undefined ? (_jsx(Avatar, { name: avatar.name, size: "sm", ...(avatar.src === undefined ? {} : { src: avatar.src }) })) : Icon === undefined ? null : (_jsx(Icon, { className: "size-(--size-icon-md) shrink-0 text-muted", strokeWidth: 1.75, "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: "min-w-0 grow basis-(--container-name)", children: _jsx(RecordLink, { ...((onOpen ?? onPeek) === undefined ? {} : { onClick: (onOpen ?? onPeek) }), title: name, children: name }) }), meta === undefined ? null : (
|
|
72
72
|
/* Wrapped or not, the metadata is still there —it is what saves
|
|
73
73
|
having to open a set to know whether it is a thousand rows or a
|
|
@@ -86,30 +86,30 @@ export function Row({ icon: Icon, avatar, name, onOpen, onPeek, click = "peek",
|
|
|
86
86
|
return (_jsxs("div", { "data-slot": "branch", className: "flex min-w-0 flex-col", children: [row, _jsx("div", { className: `flex min-w-0 flex-col gap-1 border-l border-line-strong ${byDensity(d, "mb-2 ml-8 pb-0.5 pl-3 pr-3", "mb-1.5 ml-6 pl-2.5 pr-2.5")}`, children: children })] }));
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* THE ROWS PRESENTATION'S HEADER.
|
|
90
90
|
*
|
|
91
|
-
* Context:
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
91
|
+
* Context: the table and the sheet say what each column is; the rows list
|
|
92
|
+
* said nothing. Eighty lines with «Ferretería Sur · 13 sept · Bs 12.480» on the
|
|
93
|
+
* right and a card at the end, and you had to deduce what each number was — or
|
|
94
|
+
* switch to the table to find out, which is changing presentation to read
|
|
95
|
+
* the same screen.
|
|
96
96
|
*
|
|
97
|
-
* **
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
97
|
+
* **They are not columns: they are the row's ZONES, labelled.** A row has a
|
|
98
|
+
* name that stretches, a `meta` that is ONE already-formatted string, and a
|
|
99
|
+
* column of cards of fixed width. Labelling them as if they were three aligned
|
|
100
|
+
* columns would be lying about what is underneath: one row's `meta` may
|
|
101
|
+
* say three things and another's two.
|
|
102
102
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
103
|
+
* That is why it traces `Row`'s box —same padding, same gaps, same
|
|
104
|
+
* checkbox, icon and actions spacers— instead of declaring a width of its
|
|
105
|
+
* own. If `Row` changes its geometry, this follows it.
|
|
106
106
|
*/
|
|
107
107
|
export function RowHeader({ name, meta, tags, withSelection = false, withIcon = false, withAvatar = false, withActions = false, trail, }) {
|
|
108
108
|
const d = useDensity();
|
|
109
109
|
const rotulo = `truncate ${HEADER_TEXT}`;
|
|
110
110
|
return (_jsxs("div", { "data-slot": "row-header",
|
|
111
|
-
/*
|
|
112
|
-
|
|
111
|
+
/* It sticks below the list's bar, like the table's header
|
|
112
|
+
and the sheet's. See `system/sticky.tsx`. */
|
|
113
113
|
className: `sticky z-10 flex min-w-0 items-center border-b border-line-strong bg-ground ${byDensity(d, "gap-3 px-3 py-2", "gap-2 px-2.5 py-1.5")}`, style: stickyTop, role: "presentation", children: [!withSelection ? null : _jsx("span", { className: "size-3.5 shrink-0", "aria-hidden": true }), withAvatar ? (_jsx("span", { className: "size-5 shrink-0", "aria-hidden": true })) : !withIcon ? null : (_jsx("span", { className: "size-(--size-icon-md) shrink-0", "aria-hidden": true })), _jsxs("div", { className: `flex min-w-0 shrink grow basis-(--container-name) flex-wrap items-center gap-y-0 ${byDensity(d, "gap-x-3", "gap-x-2")}`, children: [_jsx("span", { className: `min-w-0 grow basis-(--container-name) ${rotulo}`, children: name }), meta === undefined ? null : _jsx("span", { className: `min-w-0 ${rotulo}`, children: meta })] }), tags === undefined ? null : (_jsx("span", { className: "flex min-w-fit shrink basis-(--container-tags) items-center justify-end", children: _jsx("span", { className: rotulo, children: tags }) })), trail !== undefined ? (_jsx("span", { inert: true, "aria-hidden": true, className: "invisible flex shrink-0 items-center gap-1", children: _jsx(Trail, { name: "", openAs: "", ...(trail.actions === undefined ? {} : { actions: trail.actions }), ...(trail.copy === false ? { copy: false } : {}), ...(trail.peek === true ? { onPeek: () => { } } : {}), ...(trail.open === true ? { onOpen: () => { } } : {}) }) })) : !withActions ? null : (_jsx("span", { className: "size-(--size-control-sm) shrink-0", "aria-hidden": true }))] }));
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -129,10 +129,10 @@ export function GroupHeader({ field, label, count, detail, depth = 0, open = tru
|
|
|
129
129
|
const d = useDensity();
|
|
130
130
|
const copy = useUiCopy();
|
|
131
131
|
const content = (_jsxs(_Fragment, { children: [onToggle === undefined ? null : (_jsx(ChevronRight, { className: `size-(--size-icon-sm) shrink-0 text-muted transition-transform duration-(--duration-instant) ${open ? "rotate-90" : ""}`, strokeWidth: 2, "aria-hidden": true })), field === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro text-muted", children: field })), _jsx("span", { className: "truncate text-micro font-medium text-ink", children: label }), count === undefined ? null : (_jsx("span", { className: "inline-flex shrink-0 items-center rounded-pill border border-line-strong bg-ink/5 px-2 py-0.5 text-micro tabular-nums text-muted", children: count.toLocaleString(copy.locale) })), detail === undefined ? null : (_jsx("span", { className: "shrink-0 text-micro tabular-nums text-muted", children: detail }))] }));
|
|
132
|
-
/*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
/* The indentation goes in the left padding and not in a margin: the
|
|
133
|
+
header has a background and a bottom border, and a margin would cut them before the
|
|
134
|
+
list's edge — the band would stop reading as a stripe. The hover
|
|
135
|
+
does not replace that background: it is a mark set inside, rounded. */
|
|
136
136
|
const box = `flex min-w-0 items-center gap-2 border-b border-line bg-ground ${byDensity(d, "px-3 py-1.5", "px-2.5 py-1")}`;
|
|
137
137
|
const indent = depth === 0 ? undefined : { paddingLeft: `calc(var(--spacing-indent) * ${depth})` };
|
|
138
138
|
const mark = (_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-1 inset-y-0.5 rounded-control group-hover/head:bg-ink/4" }));
|