@sincpro/web-ui 2.13.0 → 2.14.1
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/README.md +16 -6
- package/dist/components/gallery/Gallery.d.ts +29 -0
- package/dist/components/gallery/Gallery.js +78 -0
- package/dist/components/gallery/Lightbox.d.ts +28 -0
- package/dist/components/gallery/Lightbox.js +59 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/listing/ColumnsMenu.js +4 -2
- package/dist/components/listing/columns.d.ts +3 -0
- package/dist/components/listing/columns.js +4 -0
- package/dist/components/plans/PlanCard.d.ts +43 -0
- package/dist/components/plans/PlanCard.js +35 -0
- package/dist/components/plans/index.d.ts +1 -0
- package/dist/components/plans/index.js +2 -0
- package/dist/components/search/CriteriaChips.d.ts +14 -1
- package/dist/components/search/CriteriaChips.js +131 -14
- package/dist/components/search/JoinWord.js +8 -14
- package/dist/components/search/SearchBar.d.ts +10 -1
- package/dist/components/search/SearchBar.js +715 -176
- package/dist/components/search/WordChoice.d.ts +19 -0
- package/dist/components/search/WordChoice.js +8 -0
- package/dist/components/search/criteria.d.ts +47 -4
- package/dist/components/search/criteria.js +75 -2
- package/dist/components/search/index.d.ts +2 -2
- package/dist/components/search/index.js +2 -2
- package/dist/components/search/query.d.ts +24 -0
- package/dist/components/search/query.js +29 -0
- package/dist/components/shell/AppFrame.d.ts +4 -0
- package/dist/components/shell/AppFrame.js +4 -1
- package/dist/components/shell/Inbox.d.ts +53 -0
- package/dist/components/shell/Inbox.js +55 -0
- package/dist/components/shell/SearchEntry.js +2 -3
- package/dist/components/shell/TopBar.d.ts +4 -2
- package/dist/components/shell/TopBar.js +3 -3
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +3 -0
- package/dist/foundations/copy.es.js +60 -1
- package/dist/foundations/form.d.ts +7 -0
- package/dist/foundations/form.js +1 -0
- package/dist/foundations/uiCopy.d.ts +85 -2
- package/dist/foundations/uiCopy.js +60 -1
- package/dist/primitives/choice/RadioGroup.d.ts +1 -1
- package/dist/primitives/choice/RadioGroup.js +29 -0
- package/dist/primitives/choice/Rating.d.ts +32 -0
- package/dist/primitives/choice/Rating.js +75 -0
- package/dist/primitives/choice/Slider.d.ts +19 -0
- package/dist/primitives/choice/Slider.js +27 -2
- package/dist/primitives/choice/index.d.ts +2 -1
- package/dist/primitives/choice/index.js +4 -1
- package/dist/primitives/choice/options.d.ts +4 -0
- package/dist/primitives/field/Field.js +1 -0
- package/dist/primitives/hint/Kbd.d.ts +23 -0
- package/dist/primitives/hint/Kbd.js +23 -0
- package/dist/primitives/hint/index.d.ts +1 -0
- package/dist/primitives/hint/index.js +2 -0
- package/dist/primitives/menu/ContextMenu.d.ts +29 -0
- package/dist/primitives/menu/ContextMenu.js +74 -0
- package/dist/primitives/menu/Menu.d.ts +4 -1
- package/dist/primitives/menu/Menu.js +2 -2
- package/dist/primitives/menu/index.d.ts +1 -0
- package/dist/primitives/menu/index.js +2 -0
- package/dist/primitives/notice/Banner.d.ts +27 -0
- package/dist/primitives/notice/Banner.js +21 -0
- package/dist/primitives/notice/Callout.d.ts +4 -4
- package/dist/primitives/notice/Callout.js +8 -19
- package/dist/primitives/notice/Notice.d.ts +38 -10
- package/dist/primitives/notice/Notice.js +48 -9
- package/dist/primitives/notice/index.d.ts +3 -1
- package/dist/primitives/notice/index.js +3 -0
- package/dist/primitives/notice/tones.d.ts +8 -0
- package/dist/primitives/notice/tones.js +22 -0
- package/dist/primitives/table/DataTable.js +2 -1
- package/dist/primitives/table/index.d.ts +1 -0
- package/dist/primitives/table/index.js +1 -0
- package/dist/primitives/table/levels.d.ts +13 -0
- package/dist/primitives/table/levels.js +11 -0
- package/dist/primitives/value/Price.d.ts +31 -0
- package/dist/primitives/value/Price.js +32 -0
- package/dist/primitives/value/QrCode.d.ts +32 -0
- package/dist/primitives/value/QrCode.js +53 -0
- package/dist/primitives/value/index.d.ts +3 -0
- package/dist/primitives/value/index.js +6 -0
- package/dist/primitives/value/priceFormat.d.ts +12 -0
- package/dist/primitives/value/priceFormat.js +22 -0
- package/dist/tokens.css +39 -0
- package/dist/views/list/ListView.js +24 -4
- package/dist/views/list/derive.js +3 -2
- package/dist/views/list/types.d.ts +8 -0
- package/package.json +3 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
declare const SIZE: {
|
|
3
|
+
readonly sm: "size-28";
|
|
4
|
+
readonly md: "size-44";
|
|
5
|
+
readonly lg: "size-64";
|
|
6
|
+
};
|
|
7
|
+
export type QrCodeProps = {
|
|
8
|
+
/** What the code carries: a payment's string, an invoice's URL, a record's link. */
|
|
9
|
+
value: string;
|
|
10
|
+
/** What it is, said: «QR para pagar Bs 46,00». It is the image's name — a code is not
|
|
11
|
+
* readable by a person, so the words are the only way to know what it does. */
|
|
12
|
+
label: string;
|
|
13
|
+
size?: keyof typeof SIZE;
|
|
14
|
+
/** How much of it may be covered or worn and still read: `M` (15 %) by default; `H` (30 %)
|
|
15
|
+
* for a printed code that will be folded or scratched. */
|
|
16
|
+
level?: "L" | "M" | "Q" | "H";
|
|
17
|
+
/** A line under it: the amount, «Vence en 10 min». */
|
|
18
|
+
caption?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A QR code — a payment by QR at a till or a portal, an invoice's verification link, a record
|
|
22
|
+
* to open on a phone.
|
|
23
|
+
*
|
|
24
|
+
* Context: QR is how much of Bolivia pays, so a till, a kiosk and an invoice draw one. The
|
|
25
|
+
* encoder (`uqr`, no dependencies) is reached with `import()` when a code is drawn: a screen
|
|
26
|
+
* without one never fetches it. The code is drawn here, as one SVG path in the system's two
|
|
27
|
+
* QR colours — black on white in BOTH themes, because a scanner reads dark on light — with its
|
|
28
|
+
* quiet zone, so it scans on a dark page. Until the encoder arrives (and on the server) a
|
|
29
|
+
* silent square holds its place. It is an image named by `label`: the words say what it does.
|
|
30
|
+
*/
|
|
31
|
+
export declare function QrCode({ value, label, size, level, caption }: QrCodeProps): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
const SIZE = {
|
|
5
|
+
/* A receipt's corner, an invoice's footer. */
|
|
6
|
+
sm: "size-28",
|
|
7
|
+
/* A payment on a till's screen, a portal's «pagar con QR». */
|
|
8
|
+
md: "size-44",
|
|
9
|
+
/* A customer display, a kiosk: read from a step away. */
|
|
10
|
+
lg: "size-64",
|
|
11
|
+
};
|
|
12
|
+
/** The four modules of white around the code that a scanner needs to find it. */
|
|
13
|
+
const QUIET = 4;
|
|
14
|
+
/** One path for every dark module, in the code's own units. */
|
|
15
|
+
function modulesPath(data) {
|
|
16
|
+
let d = "";
|
|
17
|
+
data.forEach((row, y) => {
|
|
18
|
+
row.forEach((dark, x) => {
|
|
19
|
+
if (dark)
|
|
20
|
+
d += `M${x + QUIET} ${y + QUIET}h1v1h-1z`;
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return d;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A QR code — a payment by QR at a till or a portal, an invoice's verification link, a record
|
|
27
|
+
* to open on a phone.
|
|
28
|
+
*
|
|
29
|
+
* Context: QR is how much of Bolivia pays, so a till, a kiosk and an invoice draw one. The
|
|
30
|
+
* encoder (`uqr`, no dependencies) is reached with `import()` when a code is drawn: a screen
|
|
31
|
+
* without one never fetches it. The code is drawn here, as one SVG path in the system's two
|
|
32
|
+
* QR colours — black on white in BOTH themes, because a scanner reads dark on light — with its
|
|
33
|
+
* quiet zone, so it scans on a dark page. Until the encoder arrives (and on the server) a
|
|
34
|
+
* silent square holds its place. It is an image named by `label`: the words say what it does.
|
|
35
|
+
*/
|
|
36
|
+
export function QrCode({ value, label, size = "md", level = "M", caption }) {
|
|
37
|
+
const [code, setCode] = useState(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
let live = true;
|
|
40
|
+
void import("uqr").then(({ encode }) => {
|
|
41
|
+
if (!live)
|
|
42
|
+
return;
|
|
43
|
+
const { data, size: side } = encode(value, { ecc: level, border: 0 });
|
|
44
|
+
setCode({ value, level, path: modulesPath(data), side });
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
live = false;
|
|
48
|
+
};
|
|
49
|
+
}, [value, level]);
|
|
50
|
+
const ready = code !== null && code.value === value && code.level === level;
|
|
51
|
+
const box = code === null ? 0 : code.side + QUIET * 2;
|
|
52
|
+
return (_jsxs("figure", { "data-ui": "qr", "data-size": size, className: "inline-flex flex-col items-center gap-2", children: [_jsx("div", { role: "img", "aria-label": label, className: `overflow-hidden rounded-control ${SIZE[size]} ${ready ? "bg-qr-paper" : "animate-reveal-late bg-ink/5"}`, children: ready ? (_jsx("svg", { viewBox: `0 0 ${box} ${box}`, className: "size-full", shapeRendering: "crispEdges", "aria-hidden": true, children: _jsx("path", { d: code.path, className: "fill-qr-ink" }) })) : null }), caption === undefined ? null : (_jsx("figcaption", { className: "text-meta text-ink tabular-nums", children: caption }))] }));
|
|
53
|
+
}
|
|
@@ -6,7 +6,10 @@ export { Meter, type MeterProps } from "./Meter.js";
|
|
|
6
6
|
export { type MeterLevel, meterLevel, type MeterThresholds, } from "./meterLevel.js";
|
|
7
7
|
export { Metric, type MetricProps, Metrics } from "./Metric.js";
|
|
8
8
|
export { Avatar, type AvatarSize, type PersonContact, UserChip, type UserChipProps, UserStack, } from "./Person.js";
|
|
9
|
+
export { Price, type PriceProps } from "./Price.js";
|
|
10
|
+
export { discountPercent, formatPrice } from "./priceFormat.js";
|
|
9
11
|
export { ProgressBar, type ProgressBarProps, } from "./ProgressBar.js";
|
|
12
|
+
export { QrCode, type QrCodeProps } from "./QrCode.js";
|
|
10
13
|
export { RelationCard, type RelationCardProps, type RelationSummary, RelationValue, type RelationValueProps, } from "./Relation.js";
|
|
11
14
|
export { RichTextValue, sanitizeRichText } from "./RichText.js";
|
|
12
15
|
export { isRichTextEmpty, richTextPlain, } from "./richTextPlain.js";
|
|
@@ -9,7 +9,13 @@ export { Meter } from "./Meter.js";
|
|
|
9
9
|
export { meterLevel, } from "./meterLevel.js";
|
|
10
10
|
export { Metric, Metrics } from "./Metric.js";
|
|
11
11
|
export { Avatar, UserChip, UserStack, } from "./Person.js";
|
|
12
|
+
/* A price as a shelf says it: the one to pay, the one before struck through, how much less. */
|
|
13
|
+
export { Price } from "./Price.js";
|
|
14
|
+
export { discountPercent, formatPrice } from "./priceFormat.js";
|
|
15
|
+
/* A QR — a payment, an invoice's link — black on white in both themes; the encoder loads
|
|
16
|
+
when one is drawn. */
|
|
12
17
|
export { ProgressBar, } from "./ProgressBar.js";
|
|
18
|
+
export { QrCode } from "./QrCode.js";
|
|
13
19
|
export { RelationCard, RelationValue, } from "./Relation.js";
|
|
14
20
|
/* The HTML of a note, read — cleaned of anything that runs. */
|
|
15
21
|
export { RichTextValue, sanitizeRichText } from "./RichText.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** How much less the price is than the one before, as a whole percentage — `undefined` when
|
|
2
|
+
* it is not less (a «before» equal or lower is not a discount, and is not drawn as one).
|
|
3
|
+
*
|
|
4
|
+
* Context: rounded DOWN, never to the nearest: 80 for 99 is 19.2 % — «−20 %» would promise
|
|
5
|
+
* more than the shelf gives, and a price is a promise. */
|
|
6
|
+
export declare function discountPercent(value: number, compareAt: number | undefined): number | undefined;
|
|
7
|
+
/** A price written in the session's locale: with its currency when there is one («Bs 80,00»),
|
|
8
|
+
* with two decimals when there is none. `format` overrides either. */
|
|
9
|
+
export declare function formatPrice(value: number, { currency, format }?: {
|
|
10
|
+
currency?: string;
|
|
11
|
+
format?: Intl.NumberFormatOptions;
|
|
12
|
+
}, locale?: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { currentCopyLocale } from "../../foundations/uiCopy.js";
|
|
2
|
+
import { formatWith } from "./format.js";
|
|
3
|
+
/** How much less the price is than the one before, as a whole percentage — `undefined` when
|
|
4
|
+
* it is not less (a «before» equal or lower is not a discount, and is not drawn as one).
|
|
5
|
+
*
|
|
6
|
+
* Context: rounded DOWN, never to the nearest: 80 for 99 is 19.2 % — «−20 %» would promise
|
|
7
|
+
* more than the shelf gives, and a price is a promise. */
|
|
8
|
+
export function discountPercent(value, compareAt) {
|
|
9
|
+
if (compareAt === undefined || !(compareAt > 0) || !(value < compareAt) || value < 0) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const off = Math.floor(((compareAt - value) / compareAt) * 100);
|
|
13
|
+
return off > 0 ? off : undefined;
|
|
14
|
+
}
|
|
15
|
+
/** A price written in the session's locale: with its currency when there is one («Bs 80,00»),
|
|
16
|
+
* with two decimals when there is none. `format` overrides either. */
|
|
17
|
+
export function formatPrice(value, { currency, format } = {}, locale = currentCopyLocale()) {
|
|
18
|
+
const options = currency === undefined
|
|
19
|
+
? { minimumFractionDigits: 2, maximumFractionDigits: 2, ...format }
|
|
20
|
+
: { style: "currency", currency, ...format };
|
|
21
|
+
return formatWith(value, options, locale);
|
|
22
|
+
}
|
package/dist/tokens.css
CHANGED
|
@@ -268,6 +268,11 @@
|
|
|
268
268
|
obvious `bg-ink/30` is a LIGHT veil in the dark theme (ink flips), which
|
|
269
269
|
would lighten what it is meant to dim. */
|
|
270
270
|
--color-scrim: #1a1714; /* 16.96:1 on the ground — a veil, never text */
|
|
271
|
+
/* A QR is black on white in BOTH themes — not ink on paper: a phone's scanner reads dark
|
|
272
|
+
modules on a light ground, and the dark theme's light ink on a dark surface is a QR half
|
|
273
|
+
the scanners refuse. The dark blocks repeat the SAME two values. */
|
|
274
|
+
--color-qr-ink: #000000; /* a QR's modules · white on top 21.00:1 */
|
|
275
|
+
--color-qr-paper: #ffffff; /* a QR's paper and its quiet zone */
|
|
271
276
|
|
|
272
277
|
/* ---------------------------------------------------------------- *
|
|
273
278
|
* THE TWO FAMILIES — and the rule that decides which one goes.
|
|
@@ -502,6 +507,15 @@
|
|
|
502
507
|
`ListingBar`. */
|
|
503
508
|
--container-search: 30rem;
|
|
504
509
|
|
|
510
|
+
/* How wide the bar's suggestions grow: a «campo : comparación valor» row and its hint, at a
|
|
511
|
+
reading width. Hung from the field's start and as wide as the field below this; a field
|
|
512
|
+
as wide as the page no longer stretches two short rows across it. */
|
|
513
|
+
--container-suggestions: 36rem;
|
|
514
|
+
|
|
515
|
+
/* How wide the notifications open from the bar (`Inbox`): a title and two lines of detail
|
|
516
|
+
at a reading width — and never wider than a phone's screen, where it would hang off it. */
|
|
517
|
+
--container-inbox: min(24rem, calc(100vw - 1rem));
|
|
518
|
+
|
|
505
519
|
/* How wide the cuts panel may grow: filters, grouping and favourites side by side — three
|
|
506
520
|
columns of a facet each — and never wider than the screen, so on a phone the columns
|
|
507
521
|
stack and it reads as a popover. It is the SCREEN that decides, not the field: a list's
|
|
@@ -612,6 +626,11 @@
|
|
|
612
626
|
--grid-tiles-sm: repeat(auto-fill, minmax(min(100%, var(--container-tile-sm)), 1fr));
|
|
613
627
|
--grid-tiles-md: repeat(auto-fill, minmax(min(100%, var(--container-tile-md)), 1fr));
|
|
614
628
|
--grid-tiles-lg: repeat(auto-fill, minmax(min(100%, var(--container-tile-lg)), 1fr));
|
|
629
|
+
/* A plan card is read whole — name, price, what it includes — so it never gets narrower than
|
|
630
|
+
a short list's width; the plans FILL the row (auto-fit), three side by side on a desk and
|
|
631
|
+
stacked on a phone. See `Plans`. */
|
|
632
|
+
--container-plan: 16rem;
|
|
633
|
+
--grid-plans: repeat(auto-fit, minmax(min(100%, var(--container-plan)), 1fr));
|
|
615
634
|
/* A kiosk's reduced height: the empty band above the flow, so every target sits below
|
|
616
635
|
~120 cm on a standing kiosk — within a seated person's reach (ADA 308). */
|
|
617
636
|
--size-kiosk-reach: 45dvh;
|
|
@@ -779,6 +798,11 @@
|
|
|
779
798
|
answers in 150ms showed a skeleton for one frame — a flash that says «something broke»
|
|
780
799
|
more than «loading». It waits 200ms invisible, then fades in. */
|
|
781
800
|
--animate-reveal-late: reveal var(--duration-quick) var(--ease-out) 200ms both;
|
|
801
|
+
|
|
802
|
+
/* A chip that lands in the search bar ARRIVES: it grows in from a little smaller while it
|
|
803
|
+
takes its opacity. Something set by Enter — the dropdown closes, the text clears — has to
|
|
804
|
+
be seen landing, or the eye looks for where the question went. Behind `motion-safe:`. */
|
|
805
|
+
--animate-chip-in: chip-in var(--duration-quick) var(--ease-out) both;
|
|
782
806
|
}
|
|
783
807
|
|
|
784
808
|
/* ==================================================================== *
|
|
@@ -891,6 +915,15 @@
|
|
|
891
915
|
--shadow-guide-veil: 0 0 0 100vmax currentColor;
|
|
892
916
|
}
|
|
893
917
|
|
|
918
|
+
/* From a third and not from nothing: the chip is THERE from its first frame — read, found by
|
|
919
|
+
whoever looks for it — and the motion only says it just arrived. */
|
|
920
|
+
@keyframes chip-in {
|
|
921
|
+
from {
|
|
922
|
+
opacity: 0.35;
|
|
923
|
+
scale: 0.92;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
|
|
894
927
|
@keyframes reveal {
|
|
895
928
|
from {
|
|
896
929
|
opacity: 0;
|
|
@@ -1042,6 +1075,8 @@
|
|
|
1042
1075
|
--color-chrome-warn: #e3b341; /* 9.75:1 */
|
|
1043
1076
|
--color-chrome-bad: #ff8a7a; /* 8.28:1 */
|
|
1044
1077
|
--color-scrim: #000000; /* 1.16:1 on the ground — a veil, never text */
|
|
1078
|
+
--color-qr-ink: #000000; /* a QR's modules · white on top 21.00:1 */
|
|
1079
|
+
--color-qr-paper: #ffffff; /* a QR's paper and its quiet zone */
|
|
1045
1080
|
--shadow-raised: 0 1px 2px -1px rgba(0, 0, 0, 0.5);
|
|
1046
1081
|
--shadow-float: 0 8px 24px -12px rgba(0, 0, 0, 0.75);
|
|
1047
1082
|
--shadow-window:
|
|
@@ -1113,6 +1148,8 @@
|
|
|
1113
1148
|
--color-chrome-warn: #e3b341; /* 9.75:1 */
|
|
1114
1149
|
--color-chrome-bad: #ff8a7a; /* 8.28:1 */
|
|
1115
1150
|
--color-scrim: #000000; /* 1.16:1 on the ground — a veil, never text */
|
|
1151
|
+
--color-qr-ink: #000000; /* a QR's modules · white on top 21.00:1 */
|
|
1152
|
+
--color-qr-paper: #ffffff; /* a QR's paper and its quiet zone */
|
|
1116
1153
|
--shadow-raised: 0 1px 2px -1px rgba(0, 0, 0, 0.5);
|
|
1117
1154
|
--shadow-float: 0 8px 24px -12px rgba(0, 0, 0, 0.75);
|
|
1118
1155
|
--shadow-window: 0 2px 6px -2px rgba(0, 0, 0, 0.55), 0 18px 40px -20px rgba(0, 0, 0, 0.85);
|
|
@@ -1180,6 +1217,8 @@
|
|
|
1180
1217
|
--color-chrome-warn: #e3b341; /* 8.80:1 */
|
|
1181
1218
|
--color-chrome-bad: #ff8a7a; /* 7.48:1 */
|
|
1182
1219
|
--color-scrim: #1a1714; /* 16.96:1 on the ground — a veil, never text */
|
|
1220
|
+
--color-qr-ink: #000000; /* a QR's modules · white on top 21.00:1 */
|
|
1221
|
+
--color-qr-paper: #ffffff; /* a QR's paper and its quiet zone */
|
|
1183
1222
|
--shadow-raised: 0 1px 2px -1px rgba(26, 23, 20, 0.1);
|
|
1184
1223
|
--shadow-float: 0 8px 24px -12px rgba(26, 23, 20, 0.35);
|
|
1185
1224
|
--shadow-window:
|
|
@@ -21,6 +21,7 @@ import { bySurface, useSurface } from "../../foundations/surface.js";
|
|
|
21
21
|
import { useViewStyle } from "../../foundations/viewStyle.js";
|
|
22
22
|
import { Button } from "../../primitives/button/Button.js";
|
|
23
23
|
import { Empty, Failed, Skeleton } from "../../primitives/notice/Notice.js";
|
|
24
|
+
import { levelNameOf } from "../../primitives/table/levels.js";
|
|
24
25
|
import { PivotTable } from "../../primitives/table/PivotTable.js";
|
|
25
26
|
import { ReportTable } from "../../primitives/table/ReportTable.js";
|
|
26
27
|
import { Metric, Metrics } from "../../primitives/value/Metric.js";
|
|
@@ -249,7 +250,15 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
249
250
|
the counters and the metrics (what the set is made of). */
|
|
250
251
|
const statParts = [filters, counterStats, metrics].filter((part) => part !== undefined && part !== null);
|
|
251
252
|
const stats = statParts.length === 0 ? undefined : statParts.length === 1 ? (statParts[0]) : (_jsx("div", { className: "flex min-w-0 flex-col gap-2", children: statParts.map((part, at) => (_jsx(Fragment, { children: part }, at))) }));
|
|
252
|
-
|
|
253
|
+
/* A trail of ONE crumb that says the title — the module's root list — is the title said twice
|
|
254
|
+
in the traditional bar: «Facturas» small on the search's row and «Facturas» as the heading
|
|
255
|
+
below (UX-AUDIT §1, finding 3). The modern bar keeps it: there the crumb IS the heading. */
|
|
256
|
+
const soleCrumbIsTitle = viewStyle !== "modern" && crumbs?.length === 1 && crumbs[0]?.label === identity?.title;
|
|
257
|
+
const bar = !barHasControls ? undefined : (_jsx(ListingBar, { surface: surface, look: viewStyle, ...(embedded ? { inline: true, count: items.length } : {}), ...(embedded ||
|
|
258
|
+
crumbs === undefined ||
|
|
259
|
+
crumbs.length === 0 ||
|
|
260
|
+
density === "compact" ||
|
|
261
|
+
soleCrumbIsTitle
|
|
253
262
|
? {}
|
|
254
263
|
: {
|
|
255
264
|
crumbs: (_jsx(Breadcrumb, { crumbs: crumbs, size: viewStyle === "modern" ? "lg" : "md", ...(surface === undefined ? {} : { surface }) })),
|
|
@@ -356,7 +365,7 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
356
365
|
return list.map((pile) => {
|
|
357
366
|
const key = pathKey(pile.path);
|
|
358
367
|
const open = isOpen(pile);
|
|
359
|
-
return (_jsxs(Fragment, { children: [_jsx(GroupHeader, { field: pile.field, label: pile.label, count: pile.count, ...(pile.detail === undefined ? {} : { detail: pile.detail }), depth: pile.depth, open: open, ...(group?.onToggle === undefined
|
|
368
|
+
return (_jsxs(Fragment, { children: [_jsx(GroupHeader, { field: levelNameOf(pile.field, columns), label: pile.label, count: pile.count, ...(pile.detail === undefined ? {} : { detail: pile.detail }), depth: pile.depth, open: open, ...(group?.onToggle === undefined
|
|
360
369
|
? {}
|
|
361
370
|
: { onToggle: () => group.onToggle?.(key) }) }), !open
|
|
362
371
|
? null
|
|
@@ -491,9 +500,20 @@ export function ListView({ items, keyOf, identity, crumbs, embedded = false, sur
|
|
|
491
500
|
? {}
|
|
492
501
|
: {
|
|
493
502
|
metrics: _jsx("div", { className: "px-3.5", children: stats }),
|
|
494
|
-
}), children: [loading ? _jsx(Skeleton, { label: copy.failed.loading
|
|
503
|
+
}), children: [loading ? (_jsx(Skeleton, { label: copy.failed.loading, shape: present === "tiles"
|
|
504
|
+
? "tiles"
|
|
505
|
+
: present === "board"
|
|
506
|
+
? "board"
|
|
507
|
+
: present === "table" || present === "sheet"
|
|
508
|
+
? "table"
|
|
509
|
+
: "rows" })) : null, isEmpty ? (filtered ? (_jsx(Empty, { ...empty?.whenFiltered, sentence: empty?.whenFiltered?.sentence ?? copy.list.emptyFiltered })) : (_jsx(Empty, { ...(empty === undefined
|
|
495
510
|
? {}
|
|
496
|
-
: {
|
|
511
|
+
: {
|
|
512
|
+
action: empty.action,
|
|
513
|
+
title: empty.title,
|
|
514
|
+
icon: empty.icon,
|
|
515
|
+
illustration: empty.illustration,
|
|
516
|
+
}), sentence: empty?.sentence ?? copy.list.empty }))) : null, _jsxs("div", { className: "relative min-w-0", children: [refreshing ? (
|
|
497
517
|
/* Over the top edge of the rows, not above them: the rows do not move. */
|
|
498
518
|
_jsx("div", { className: "pointer-events-none absolute inset-x-0 top-0 z-20", children: _jsx(ProgressBar, { label: copy.list.refreshing, width: "w-full" }) })) : null, loading || isEmpty ? null : body] })] }), error === null ? null : (_jsx("div", { className: "px-3 pt-(--spacing-block)", children: _jsx(Failed, { heading: copy.failed.list, sentence: error }) })), floating, children] }));
|
|
499
519
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { levelKey, pathKey, pileCount, pileItems, pileLabel, } from "../../foundations/grouping.js";
|
|
2
2
|
import { aggregateFormat, aggregateOf, aggregateText, pileAggregate, } from "../../primitives/table/DataTable.js";
|
|
3
|
+
import { levelNameOf } from "../../primitives/table/levels.js";
|
|
3
4
|
/**
|
|
4
5
|
* Context: what a list DERIVES from its set, as pure functions — the table's group levels,
|
|
5
6
|
* the sheet drawn from the declared columns, the sheet's flattened band/row sequence and
|
|
@@ -103,7 +104,7 @@ export function sheetRowsOf(piles, isOpen, columns) {
|
|
|
103
104
|
const open = isOpen(pile);
|
|
104
105
|
out.push({
|
|
105
106
|
band: {
|
|
106
|
-
field: pile.field,
|
|
107
|
+
field: levelNameOf(pile.field, columns),
|
|
107
108
|
label: pile.label,
|
|
108
109
|
count: pile.count,
|
|
109
110
|
open,
|
|
@@ -158,7 +159,7 @@ export function reportRowsOf(piles, columns, row, totalLabel) {
|
|
|
158
159
|
/* A pile is named by the HEADER of the column that answers for its field — the word the
|
|
159
160
|
person reads in the table — not by the field's id: «stage · pedido» showed the
|
|
160
161
|
model's name for it. */
|
|
161
|
-
const fieldName = (field) =>
|
|
162
|
+
const fieldName = (field) => levelNameOf(field, columns);
|
|
162
163
|
/* Every pile is a GROUP — it opens and closes, and it says what it adds up to under each
|
|
163
164
|
column, the number the table's pile row says (`pileAggregate`). A `section` was tried for
|
|
164
165
|
the first level and it drew no amounts: a section is a title over what comes below
|
|
@@ -113,12 +113,20 @@ export type ListCrumb = {
|
|
|
113
113
|
export type ListEmpty = {
|
|
114
114
|
sentence: string;
|
|
115
115
|
action?: ReactNode;
|
|
116
|
+
/** The empty that IS the screen — a title, and an icon or the application's illustration
|
|
117
|
+
* (`Empty`'s). Without them it is the quiet sentence. */
|
|
118
|
+
title?: string;
|
|
119
|
+
icon?: LucideIcon;
|
|
120
|
+
illustration?: ReactNode;
|
|
116
121
|
/** Empty because of a filter is ANOTHER situation: content is not missing,
|
|
117
122
|
* there is an extra narrowing. Telling «importá tus facturas» to someone who has 180
|
|
118
123
|
* and mistyped a name is answering a different question. */
|
|
119
124
|
whenFiltered?: {
|
|
120
125
|
sentence: string;
|
|
121
126
|
action?: ReactNode;
|
|
127
|
+
title?: string;
|
|
128
|
+
icon?: LucideIcon;
|
|
129
|
+
illustration?: ReactNode;
|
|
122
130
|
};
|
|
123
131
|
};
|
|
124
132
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/web-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "An enterprise web design system for business software — ERPs, back offices, management tools — in React and Tailwind: tokens, primitives, components and the two views every management screen is made of.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
"streamdown": "^2.7.1",
|
|
76
76
|
"tailwind-variants": "^4.0.0",
|
|
77
77
|
"tailwindcss-react-aria-components": "^2.2.0",
|
|
78
|
-
"temporal-polyfill": "^1.0.6"
|
|
78
|
+
"temporal-polyfill": "^1.0.6",
|
|
79
|
+
"uqr": "^0.1.3"
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|
|
81
82
|
"@eslint/js": "^10.0.1",
|