@sincpro/web-ui 2.11.0 → 2.13.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/README.md +77 -20
- package/dist/components/activity/Messages.d.ts +3 -23
- package/dist/components/activity/Messages.js +3 -17
- package/dist/components/activity/index.d.ts +2 -1
- package/dist/components/activity/index.js +2 -1
- package/dist/components/activity/messageKind.d.ts +23 -0
- package/dist/components/activity/messageKind.js +17 -0
- package/dist/components/assist/assist.d.ts +1 -1
- package/dist/components/assist/assist.js +1 -1
- package/dist/components/frame/model.js +1 -1
- package/dist/components/guide/index.d.ts +2 -1
- package/dist/components/guide/index.js +2 -1
- package/dist/components/guide/selector.d.ts +25 -0
- package/dist/components/guide/selector.js +14 -0
- package/dist/components/guide/target.d.ts +3 -25
- package/dist/components/guide/target.js +2 -14
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/listing/AxisLevels.d.ts +2 -5
- package/dist/components/listing/AxisLevels.js +5 -22
- package/dist/components/listing/BoardColumns.js +10 -6
- package/dist/components/listing/ColumnsMenu.d.ts +3 -7
- package/dist/components/listing/ColumnsMenu.js +4 -8
- package/dist/components/listing/Listing.js +3 -1
- package/dist/components/listing/ListingBar.d.ts +16 -94
- package/dist/components/listing/ListingBar.js +24 -2
- package/dist/components/listing/RecordCard.d.ts +41 -3
- package/dist/components/listing/RecordCard.js +63 -22
- package/dist/components/listing/Row.js +5 -2
- package/dist/components/listing/collapsed.d.ts +2 -0
- package/dist/components/listing/collapsed.js +8 -0
- package/dist/components/listing/columnSpecs.d.ts +34 -0
- package/dist/components/listing/columnSpecs.js +54 -0
- package/dist/components/listing/columns.d.ts +3 -21
- package/dist/components/listing/columns.js +2 -39
- package/dist/components/listing/index.d.ts +11 -7
- package/dist/components/listing/index.js +15 -8
- package/dist/components/listing/levels.d.ts +9 -0
- package/dist/components/listing/levels.js +27 -0
- package/dist/components/listing/pageSizes.d.ts +9 -0
- package/dist/components/listing/pageSizes.js +11 -0
- package/dist/components/listing/pages.d.ts +2 -9
- package/dist/components/listing/pages.js +5 -9
- package/dist/components/listing/set.d.ts +1 -1
- package/dist/components/listing/tree.d.ts +2 -1
- package/dist/components/listing/tree.js +4 -5
- package/dist/components/preview/FilePreview.d.ts +3 -3
- package/dist/components/preview/FilePreview.js +3 -15
- package/dist/components/preview/index.d.ts +2 -1
- package/dist/components/preview/index.js +2 -1
- package/dist/components/preview/previewKind.d.ts +3 -0
- package/dist/components/preview/previewKind.js +17 -0
- package/dist/components/receipt/Receipt.d.ts +51 -0
- package/dist/components/receipt/Receipt.js +23 -0
- package/dist/components/receipt/index.d.ts +1 -0
- package/dist/components/receipt/index.js +3 -0
- package/dist/components/search/CriteriaChips.js +5 -3
- package/dist/components/search/FilterBuilder.d.ts +5 -139
- package/dist/components/search/FilterBuilder.js +5 -579
- package/dist/components/search/JsonEditor.d.ts +2 -8
- package/dist/components/search/JsonEditor.js +5 -15
- package/dist/components/search/RuleValue.d.ts +2 -2
- package/dist/components/search/RuleValue.js +5 -4
- package/dist/components/search/datePeriods.js +1 -1
- package/dist/components/search/filterTree.d.ts +183 -0
- package/dist/components/search/filterTree.js +570 -0
- package/dist/components/search/formatJson.d.ts +8 -0
- package/dist/components/search/formatJson.js +17 -0
- package/dist/components/search/index.d.ts +5 -3
- package/dist/components/search/index.js +7 -3
- package/dist/components/search/query.js +1 -1
- package/dist/components/shell/KioskFrame.d.ts +35 -0
- package/dist/components/shell/KioskFrame.js +39 -0
- package/dist/components/shell/SearchEntry.js +1 -1
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +1 -0
- package/dist/foundations/calendar.js +1 -1
- package/dist/foundations/catalog.d.ts +7 -8
- package/dist/foundations/catalog.js +10 -35
- package/dist/foundations/chart.js +1 -1
- package/dist/foundations/clock.d.ts +3 -0
- package/dist/foundations/clock.js +41 -0
- package/dist/foundations/controlName.d.ts +12 -0
- package/dist/foundations/controlName.js +14 -0
- package/dist/foundations/copy.d.ts +3 -1130
- package/dist/foundations/copy.es.d.ts +1 -1
- package/dist/foundations/copy.es.js +26 -0
- package/dist/foundations/copy.js +13 -747
- package/dist/foundations/copyStore.d.ts +21 -0
- package/dist/foundations/copyStore.js +47 -0
- package/dist/foundations/density.d.ts +4 -8
- package/dist/foundations/density.js +2 -9
- package/dist/foundations/form.d.ts +2 -12
- package/dist/foundations/form.js +4 -14
- package/dist/foundations/idle.d.ts +1 -0
- package/dist/foundations/idle.js +34 -0
- package/dist/foundations/index.d.ts +21 -11
- package/dist/foundations/index.js +28 -11
- package/dist/foundations/keys.d.ts +8 -0
- package/dist/foundations/keys.js +6 -0
- package/dist/foundations/pickBy.d.ts +16 -0
- package/dist/foundations/pickBy.js +17 -0
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/pointer.d.ts +25 -0
- package/dist/foundations/pointer.js +28 -0
- package/dist/foundations/shortcut.d.ts +3 -9
- package/dist/foundations/shortcut.js +2 -7
- package/dist/foundations/sticky.d.ts +2 -6
- package/dist/foundations/sticky.js +5 -8
- package/dist/foundations/stickyStyle.d.ts +12 -0
- package/dist/foundations/stickyStyle.js +13 -0
- package/dist/foundations/surface.d.ts +2 -2
- package/dist/foundations/surface.js +4 -2
- package/dist/foundations/theme.d.ts +3 -13
- package/dist/foundations/theme.js +2 -15
- package/dist/foundations/themeChoice.d.ts +19 -0
- package/dist/foundations/themeChoice.js +22 -0
- package/dist/foundations/types.d.ts +3 -0
- package/dist/foundations/uiCopy.d.ts +1173 -0
- package/dist/foundations/uiCopy.js +775 -0
- package/dist/foundations/xlsx.d.ts +4 -10
- package/dist/foundations/xlsx.js +0 -0
- package/dist/foundations/xlsxDownload.d.ts +8 -0
- package/dist/foundations/xlsxDownload.js +28 -0
- package/dist/primitives/button/Button.d.ts +3 -15
- package/dist/primitives/button/Button.js +2 -65
- package/dist/primitives/button/classes.d.ts +21 -0
- package/dist/primitives/button/classes.js +65 -0
- package/dist/primitives/button/index.d.ts +2 -1
- package/dist/primitives/button/index.js +3 -1
- package/dist/primitives/choice/RadioGroup.d.ts +8 -1
- package/dist/primitives/choice/RadioGroup.js +9 -1
- package/dist/primitives/choice/options.d.ts +3 -0
- package/dist/primitives/field/Field.d.ts +2 -6
- package/dist/primitives/field/Field.js +4 -10
- package/dist/primitives/field/Keypad.d.ts +43 -0
- package/dist/primitives/field/Keypad.js +62 -0
- package/dist/primitives/field/Stepper.d.ts +28 -0
- package/dist/primitives/field/Stepper.js +52 -0
- package/dist/primitives/field/classes.d.ts +6 -0
- package/dist/primitives/field/classes.js +13 -0
- package/dist/primitives/field/clipboard.js +1 -1
- package/dist/primitives/field/index.d.ts +5 -1
- package/dist/primitives/field/index.js +9 -1
- package/dist/primitives/field/keypadKeys.d.ts +24 -0
- package/dist/primitives/field/keypadKeys.js +80 -0
- package/dist/primitives/hint/Hint.js +1 -1
- package/dist/primitives/menu/Menu.d.ts +2 -19
- package/dist/primitives/menu/Menu.js +4 -30
- package/dist/primitives/menu/classes.d.ts +18 -0
- package/dist/primitives/menu/classes.js +33 -0
- package/dist/primitives/menu/index.d.ts +2 -1
- package/dist/primitives/menu/index.js +3 -1
- package/dist/primitives/notice/Flag.js +1 -1
- package/dist/primitives/notice/Outcome.d.ts +28 -0
- package/dist/primitives/notice/Outcome.js +28 -0
- package/dist/primitives/notice/index.d.ts +1 -0
- package/dist/primitives/notice/index.js +2 -0
- package/dist/primitives/table/CellCopy.js +1 -1
- package/dist/primitives/table/EditableTable.d.ts +3 -37
- package/dist/primitives/table/EditableTable.js +2 -47
- package/dist/primitives/table/ReportTable.js +1 -1
- package/dist/primitives/table/RowActions.js +1 -1
- package/dist/primitives/table/Table.d.ts +2 -4
- package/dist/primitives/table/Table.js +13 -16
- package/dist/primitives/table/cellTone.d.ts +5 -0
- package/dist/primitives/table/cellTone.js +13 -0
- package/dist/primitives/table/editRules.d.ts +43 -0
- package/dist/primitives/table/editRules.js +53 -0
- package/dist/primitives/table/index.d.ts +4 -2
- package/dist/primitives/table/index.js +4 -2
- package/dist/primitives/tag/Count.d.ts +2 -3
- package/dist/primitives/tag/Count.js +4 -5
- package/dist/primitives/tag/Tags.d.ts +22 -1
- package/dist/primitives/tag/Tags.js +57 -14
- package/dist/primitives/tag/countText.d.ts +3 -0
- package/dist/primitives/tag/countText.js +7 -0
- package/dist/primitives/tag/index.d.ts +3 -2
- package/dist/primitives/tag/index.js +2 -1
- package/dist/primitives/value/DateValue.d.ts +2 -5
- package/dist/primitives/value/DateValue.js +6 -44
- package/dist/primitives/value/Elapsed.d.ts +16 -0
- package/dist/primitives/value/Elapsed.js +37 -0
- package/dist/primitives/value/Meter.d.ts +3 -8
- package/dist/primitives/value/Meter.js +2 -9
- package/dist/primitives/value/RichText.d.ts +2 -4
- package/dist/primitives/value/RichText.js +5 -20
- package/dist/primitives/value/Value.d.ts +10 -7
- package/dist/primitives/value/Value.js +7 -24
- package/dist/primitives/value/elapsedTime.d.ts +26 -0
- package/dist/primitives/value/elapsedTime.js +32 -0
- package/dist/primitives/value/format.d.ts +16 -0
- package/dist/primitives/value/format.js +81 -0
- package/dist/primitives/value/index.d.ts +9 -4
- package/dist/primitives/value/index.js +13 -4
- package/dist/primitives/value/meterLevel.d.ts +10 -0
- package/dist/primitives/value/meterLevel.js +12 -0
- package/dist/primitives/value/richTextPlain.d.ts +4 -0
- package/dist/primitives/value/richTextPlain.js +23 -0
- package/dist/tokens.css +87 -1
- package/dist/views/list/List.d.ts +11 -0
- package/dist/views/list/List.js +14 -3
- package/dist/views/list/ListView.d.ts +1 -1
- package/dist/views/list/ListView.js +26 -6
- package/dist/views/list/types.d.ts +7 -0
- package/dist/views/record/Record.js +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { formatCount, formatDistance, formatNumber, formatWith } from "./format.js";
|
|
1
2
|
import { type Rounding } from "./rounding.js";
|
|
2
3
|
import type { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Context: the mono/sans rule decides everything in here. The label goes in
|
|
6
|
+
* PROPORTIONAL —«orígenes», «mediana» are words, not data— and the value in
|
|
7
|
+
* tabular monospace, which is what makes four of these in a row keep their
|
|
8
|
+
* digits in a column.
|
|
9
|
+
*
|
|
10
|
+
* Formats follow the session locale, not a baked-in Spanish `Intl`.
|
|
11
|
+
*/
|
|
12
|
+
export { formatCount, formatDistance, formatNumber, formatWith };
|
|
6
13
|
/** A label with its number, for the glance at the top of a view. */
|
|
7
14
|
export declare function KeyValue({ label, value }: {
|
|
8
15
|
label: string;
|
|
9
16
|
value: ReactNode;
|
|
10
17
|
}): import("react").JSX.Element;
|
|
11
|
-
/** A number written with any `Intl.NumberFormatOptions` — a currency, a percentage, fixed
|
|
12
|
-
* decimals — in the session locale. The same options `NumberInput` takes, so a value reads
|
|
13
|
-
* the same in its form and in the cell or the figure that shows it elsewhere. */
|
|
14
|
-
export declare const formatWith: (value: number, options: Intl.NumberFormatOptions, locale?: string) => string;
|
|
15
18
|
/**
|
|
16
19
|
* A number with its unit: right aligned, with tabular figures.
|
|
17
20
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { formatCount, formatDistance, formatNumber, formatWith, } from "./format.js";
|
|
4
5
|
import { roundTo } from "./rounding.js";
|
|
5
6
|
/**
|
|
6
7
|
* Context: the mono/sans rule decides everything in here. The label goes in
|
|
@@ -10,39 +11,21 @@ import { roundTo } from "./rounding.js";
|
|
|
10
11
|
*
|
|
11
12
|
* Formats follow the session locale, not a baked-in Spanish `Intl`.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 });
|
|
18
|
-
}
|
|
19
|
-
/** Four decimals and not two for distances — they live near zero
|
|
20
|
-
* (`0.0696`, `0.0149`) and with two they turn into `0.07` and `0.01`, which is
|
|
21
|
-
* losing exactly the part that tells one column from another. */
|
|
22
|
-
function distanceFormat(locale) {
|
|
23
|
-
return new Intl.NumberFormat(locale, {
|
|
24
|
-
minimumFractionDigits: 4,
|
|
25
|
-
maximumFractionDigits: 4,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export const formatCount = (value, locale = currentCopyLocale()) => integerFormat(locale).format(value);
|
|
29
|
-
export const formatNumber = (value, locale = currentCopyLocale()) => decimalFormat(locale).format(value);
|
|
30
|
-
export const formatDistance = (value, locale = currentCopyLocale()) => distanceFormat(locale).format(value);
|
|
14
|
+
/* The formatters — `formatCount`, `formatNumber`, `formatDistance`, `formatWith` — are
|
|
15
|
+
`format.ts`, without the directive, so a server component writes a number the same way;
|
|
16
|
+
re-exported so every path that read them here keeps reading them. */
|
|
17
|
+
export { formatCount, formatDistance, formatNumber, formatWith };
|
|
31
18
|
/** A label with its number, for the glance at the top of a view. */
|
|
32
19
|
export function KeyValue({ label, value }) {
|
|
33
20
|
return (_jsxs("div", { className: "min-w-0", children: [_jsx("dt", { className: "text-micro text-muted", children: label }), _jsx("dd", { className: "mt-0.5 truncate text-lead tabular-nums text-ink", children: value })] }));
|
|
34
21
|
}
|
|
35
22
|
/** The three presets, as the options they are — so `signed` and a custom format share one
|
|
36
|
-
* path. Kept in step with `integerFormat`, `decimalFormat` and `distanceFormat`
|
|
23
|
+
* path. Kept in step with `integerFormat`, `decimalFormat` and `distanceFormat` (`format.ts`). */
|
|
37
24
|
const PRESET = {
|
|
38
25
|
integer: { maximumFractionDigits: 0 },
|
|
39
26
|
decimal: { maximumFractionDigits: 2 },
|
|
40
27
|
distance: { minimumFractionDigits: 4, maximumFractionDigits: 4 },
|
|
41
28
|
};
|
|
42
|
-
/** A number written with any `Intl.NumberFormatOptions` — a currency, a percentage, fixed
|
|
43
|
-
* decimals — in the session locale. The same options `NumberInput` takes, so a value reads
|
|
44
|
-
* the same in its form and in the cell or the figure that shows it elsewhere. */
|
|
45
|
-
export const formatWith = (value, options, locale = currentCopyLocale()) => new Intl.NumberFormat(locale, options).format(value);
|
|
46
29
|
/**
|
|
47
30
|
* A number with its unit: right aligned, with tabular figures.
|
|
48
31
|
*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Tone } from "../../foundations/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* HOW LONG IT HAS BEEN WAITING — the arithmetic of `Elapsed`, pure so a server, a test or a
|
|
4
|
+
* sort can use it: «the oldest ticket first» is the same subtraction.
|
|
5
|
+
*
|
|
6
|
+
* Context: a kitchen's ticket, a support case under an SLA, an order at the counter. What is
|
|
7
|
+
* read is not the hour it arrived but how long ago, and whether that is already too long — so
|
|
8
|
+
* the time carries a tone by two thresholds the domain sets (in minutes): `warnAfter` turns it
|
|
9
|
+
* amber, `badAfter` red. The colour is never alone: the figure is always written.
|
|
10
|
+
*/
|
|
11
|
+
/** When it started: a `Date`, an ISO string or epoch milliseconds — what a record carries. */
|
|
12
|
+
export type ElapsedSince = Date | string | number;
|
|
13
|
+
/** The two thresholds, in minutes. Without them the time has no tone: it only informs. */
|
|
14
|
+
export type ElapsedThresholds = {
|
|
15
|
+
warnAfter?: number;
|
|
16
|
+
badAfter?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function sinceMillis(since: ElapsedSince): number;
|
|
19
|
+
/** Milliseconds from `since` to `now`; never negative — a clock a little behind the server's
|
|
20
|
+
* must not write «-0:03». */
|
|
21
|
+
export declare function elapsedMillis(since: ElapsedSince, now: number): number;
|
|
22
|
+
/** «4:05» under an hour, «1:02:03» over it — the way a stopwatch reads, in figures that line up. */
|
|
23
|
+
export declare function formatElapsed(millis: number): string;
|
|
24
|
+
/** The tone of a wait: `bad` past `badAfter`, `warn` past `warnAfter`, `good` before them,
|
|
25
|
+
* and `undefined` when no threshold was given (it only informs). */
|
|
26
|
+
export declare function elapsedTone(millis: number, limits: ElapsedThresholds): Tone | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function sinceMillis(since) {
|
|
2
|
+
return since instanceof Date ? since.getTime() : new Date(since).getTime();
|
|
3
|
+
}
|
|
4
|
+
/** Milliseconds from `since` to `now`; never negative — a clock a little behind the server's
|
|
5
|
+
* must not write «-0:03». */
|
|
6
|
+
export function elapsedMillis(since, now) {
|
|
7
|
+
return Math.max(0, now - sinceMillis(since));
|
|
8
|
+
}
|
|
9
|
+
/** «4:05» under an hour, «1:02:03» over it — the way a stopwatch reads, in figures that line up. */
|
|
10
|
+
export function formatElapsed(millis) {
|
|
11
|
+
const total = Math.floor(millis / 1000);
|
|
12
|
+
const hours = Math.floor(total / 3600);
|
|
13
|
+
const minutes = Math.floor((total % 3600) / 60);
|
|
14
|
+
const seconds = total % 60;
|
|
15
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
16
|
+
return hours > 0
|
|
17
|
+
? `${hours}:${pad(minutes)}:${pad(seconds)}`
|
|
18
|
+
: `${minutes}:${pad(seconds)}`;
|
|
19
|
+
}
|
|
20
|
+
/** The tone of a wait: `bad` past `badAfter`, `warn` past `warnAfter`, `good` before them,
|
|
21
|
+
* and `undefined` when no threshold was given (it only informs). */
|
|
22
|
+
export function elapsedTone(millis, limits) {
|
|
23
|
+
const { warnAfter, badAfter } = limits;
|
|
24
|
+
if (warnAfter === undefined && badAfter === undefined)
|
|
25
|
+
return undefined;
|
|
26
|
+
const minutes = millis / 60_000;
|
|
27
|
+
if (badAfter !== undefined && minutes >= badAfter)
|
|
28
|
+
return "bad";
|
|
29
|
+
if (warnAfter !== undefined && minutes >= warnAfter)
|
|
30
|
+
return "warn";
|
|
31
|
+
return "good";
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type UiCopy } from "../../foundations/uiCopy.js";
|
|
2
|
+
export declare const formatCount: (value: number, locale?: string) => string;
|
|
3
|
+
export declare const formatNumber: (value: number, locale?: string) => string;
|
|
4
|
+
export declare const formatDistance: (value: number, locale?: string) => string;
|
|
5
|
+
/** A number written with any `Intl.NumberFormatOptions` — a currency, a percentage, fixed
|
|
6
|
+
* decimals — in the session locale. The same options `NumberInput` takes, so a value reads
|
|
7
|
+
* the same in its form and in the cell or the figure that shows it elsewhere. */
|
|
8
|
+
export declare const formatWith: (value: number, options: Intl.NumberFormatOptions, locale?: string) => string;
|
|
9
|
+
/** The day alone, in digits and in the locale's order. Exported for `DateValue`'s `date`
|
|
10
|
+
* format; not public. */
|
|
11
|
+
export declare function dateFormat(locale: string): Intl.DateTimeFormat;
|
|
12
|
+
/** Context: `copy` defaults to the installed words — what a caller outside a component has;
|
|
13
|
+
* a component passes its branch's (read with `useUiCopy`), so a provider reaches the
|
|
14
|
+
* sentence. */
|
|
15
|
+
export declare function formatRelative(when: Date, now?: Date, copy?: UiCopy): string;
|
|
16
|
+
export declare function formatDateTime(when: Date, locale?: string): string;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { currentCopy, currentCopyLocale, } from "../../foundations/uiCopy.js";
|
|
2
|
+
/**
|
|
3
|
+
* THE FORMATTERS a value is written with — a number (`Numeric`, `Cell`) and a date
|
|
4
|
+
* (`DateValue`) — in the installed locale unless one is passed.
|
|
5
|
+
*
|
|
6
|
+
* Context: they lived beside their components, which carry `"use client"`, and a React
|
|
7
|
+
* Server Components bundler turns every export of a client module into a client reference:
|
|
8
|
+
* `formatCount(1234)` called on the server returned a reference, not «1,234». Here, without
|
|
9
|
+
* the directive, they are functions anywhere. On the server they read the server's installed
|
|
10
|
+
* words (`installCopy`, called in the module of the root layout) — or the locale passed.
|
|
11
|
+
*/
|
|
12
|
+
/* ── Numbers ─────────────────────────────────────────────────────────── */
|
|
13
|
+
function integerFormat(locale) {
|
|
14
|
+
return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });
|
|
15
|
+
}
|
|
16
|
+
function decimalFormat(locale) {
|
|
17
|
+
return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 });
|
|
18
|
+
}
|
|
19
|
+
/** Four decimals and not two for distances — they live near zero
|
|
20
|
+
* (`0.0696`, `0.0149`) and with two they turn into `0.07` and `0.01`, which is
|
|
21
|
+
* losing exactly the part that tells one column from another. */
|
|
22
|
+
function distanceFormat(locale) {
|
|
23
|
+
return new Intl.NumberFormat(locale, {
|
|
24
|
+
minimumFractionDigits: 4,
|
|
25
|
+
maximumFractionDigits: 4,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export const formatCount = (value, locale = currentCopyLocale()) => integerFormat(locale).format(value);
|
|
29
|
+
export const formatNumber = (value, locale = currentCopyLocale()) => decimalFormat(locale).format(value);
|
|
30
|
+
export const formatDistance = (value, locale = currentCopyLocale()) => distanceFormat(locale).format(value);
|
|
31
|
+
/** A number written with any `Intl.NumberFormatOptions` — a currency, a percentage, fixed
|
|
32
|
+
* decimals — in the session locale. The same options `NumberInput` takes, so a value reads
|
|
33
|
+
* the same in its form and in the cell or the figure that shows it elsewhere. */
|
|
34
|
+
export const formatWith = (value, options, locale = currentCopyLocale()) => new Intl.NumberFormat(locale, options).format(value);
|
|
35
|
+
/* ── Dates — see `DateValue.tsx` for why the relative stops at a week ── */
|
|
36
|
+
function relativeFormat(locale) {
|
|
37
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
38
|
+
}
|
|
39
|
+
/** The day alone, in digits and in the locale's order. Exported for `DateValue`'s `date`
|
|
40
|
+
* format; not public. */
|
|
41
|
+
export function dateFormat(locale) {
|
|
42
|
+
return new Intl.DateTimeFormat(locale, {
|
|
43
|
+
day: "2-digit",
|
|
44
|
+
month: "2-digit",
|
|
45
|
+
year: "numeric",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function timeFormat(locale) {
|
|
49
|
+
return new Intl.DateTimeFormat(locale, {
|
|
50
|
+
hour: "2-digit",
|
|
51
|
+
minute: "2-digit",
|
|
52
|
+
hourCycle: "h23",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const MINUTE = 60_000;
|
|
56
|
+
const HOUR = 60 * MINUTE;
|
|
57
|
+
const DAY = 24 * HOUR;
|
|
58
|
+
/** The steps, from finest to coarsest. The first one that fits, wins. */
|
|
59
|
+
const STEPS = [
|
|
60
|
+
[MINUTE, "minute"],
|
|
61
|
+
[HOUR, "hour"],
|
|
62
|
+
[DAY, "day"],
|
|
63
|
+
];
|
|
64
|
+
/** Context: `copy` defaults to the installed words — what a caller outside a component has;
|
|
65
|
+
* a component passes its branch's (read with `useUiCopy`), so a provider reaches the
|
|
66
|
+
* sentence. */
|
|
67
|
+
export function formatRelative(when, now = new Date(), copy = currentCopy()) {
|
|
68
|
+
const locale = copy.locale;
|
|
69
|
+
const delta = when.getTime() - now.getTime();
|
|
70
|
+
const abs = Math.abs(delta);
|
|
71
|
+
if (abs < MINUTE)
|
|
72
|
+
return copy.time.justNow;
|
|
73
|
+
if (abs > 7 * DAY)
|
|
74
|
+
return dateFormat(locale).format(when);
|
|
75
|
+
const step = STEPS.find(([ms]) => abs < ms * 60) ?? STEPS[STEPS.length - 1];
|
|
76
|
+
const [ms, unit] = step;
|
|
77
|
+
return relativeFormat(locale).format(Math.round(delta / ms), unit);
|
|
78
|
+
}
|
|
79
|
+
export function formatDateTime(when, locale = currentCopyLocale()) {
|
|
80
|
+
return `${dateFormat(locale).format(when)} ${timeFormat(locale).format(when)}`;
|
|
81
|
+
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
export { Copyable, type CopyableProps, CopyButton, } from "./Copyable.js";
|
|
2
|
-
export { DateValue
|
|
2
|
+
export { DateValue } from "./DateValue.js";
|
|
3
|
+
export { formatCount, formatDateTime, formatDistance, formatNumber, formatRelative, formatWith, } from "./format.js";
|
|
3
4
|
export { Markdown, type MarkdownProps } from "./Markdown.js";
|
|
4
|
-
export { Meter, type
|
|
5
|
+
export { Meter, type MeterProps } from "./Meter.js";
|
|
6
|
+
export { type MeterLevel, meterLevel, type MeterThresholds, } from "./meterLevel.js";
|
|
5
7
|
export { Metric, type MetricProps, Metrics } from "./Metric.js";
|
|
6
8
|
export { Avatar, type AvatarSize, type PersonContact, UserChip, type UserChipProps, UserStack, } from "./Person.js";
|
|
7
9
|
export { ProgressBar, type ProgressBarProps, } from "./ProgressBar.js";
|
|
8
10
|
export { RelationCard, type RelationCardProps, type RelationSummary, RelationValue, type RelationValueProps, } from "./Relation.js";
|
|
9
|
-
export {
|
|
11
|
+
export { RichTextValue, sanitizeRichText } from "./RichText.js";
|
|
12
|
+
export { isRichTextEmpty, richTextPlain, } from "./richTextPlain.js";
|
|
10
13
|
export { type Rounding, type RoundingMethod, roundTo, } from "./rounding.js";
|
|
14
|
+
export { Elapsed, type ElapsedProps } from "./Elapsed.js";
|
|
15
|
+
export { elapsedMillis, type ElapsedSince, type ElapsedThresholds, elapsedTone, formatElapsed, sinceMillis, } from "./elapsedTime.js";
|
|
11
16
|
export { Totals, type TotalsCredit, type TotalsDeduction, type TotalsFact, type TotalsProps, type TotalsRow, } from "./Totals.js";
|
|
12
|
-
export { Cell,
|
|
17
|
+
export { Cell, KeyValue, Numeric } from "./Value.js";
|
|
13
18
|
export { YesNo, type YesNoLook } from "./YesNo.js";
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
/* Show a number or a datum so that it reads as such and not as text. */
|
|
2
2
|
export { Copyable, CopyButton, } from "./Copyable.js";
|
|
3
|
-
export { DateValue
|
|
3
|
+
export { DateValue } from "./DateValue.js";
|
|
4
|
+
/* The formatters, without `"use client"`: a server component writes a number or a date the
|
|
5
|
+
same way. */
|
|
6
|
+
export { formatCount, formatDateTime, formatDistance, formatNumber, formatRelative, formatWith, } from "./format.js";
|
|
4
7
|
export { Markdown } from "./Markdown.js";
|
|
5
|
-
export { Meter
|
|
8
|
+
export { Meter } from "./Meter.js";
|
|
9
|
+
export { meterLevel, } from "./meterLevel.js";
|
|
6
10
|
export { Metric, Metrics } from "./Metric.js";
|
|
7
11
|
export { Avatar, UserChip, UserStack, } from "./Person.js";
|
|
8
12
|
export { ProgressBar, } from "./ProgressBar.js";
|
|
9
13
|
export { RelationCard, RelationValue, } from "./Relation.js";
|
|
10
14
|
/* The HTML of a note, read — cleaned of anything that runs. */
|
|
11
|
-
export {
|
|
15
|
+
export { RichTextValue, sanitizeRichText } from "./RichText.js";
|
|
16
|
+
export { isRichTextEmpty, richTextPlain, } from "./richTextPlain.js";
|
|
12
17
|
export { roundTo, } from "./rounding.js";
|
|
18
|
+
/* HOW LONG IT HAS BEEN WAITING — a kitchen's ticket, a case under an SLA: live, in a tone by
|
|
19
|
+
two thresholds. The arithmetic is pure (`elapsedTime.ts`), so a sort or a server reads it. */
|
|
20
|
+
export { Elapsed } from "./Elapsed.js";
|
|
21
|
+
export { elapsedMillis, elapsedTone, formatElapsed, sinceMillis, } from "./elapsedTime.js";
|
|
13
22
|
export { Totals, } from "./Totals.js";
|
|
14
|
-
export { Cell,
|
|
23
|
+
export { Cell, KeyValue, Numeric } from "./Value.js";
|
|
15
24
|
export { YesNo } from "./YesNo.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type MeterLevel = "good" | "warn" | "danger";
|
|
2
|
+
/** Percentages of the range where the color changes. */
|
|
3
|
+
export type MeterThresholds = {
|
|
4
|
+
warn: number;
|
|
5
|
+
danger: number;
|
|
6
|
+
};
|
|
7
|
+
/** Exported for `Meter`'s default; not public. */
|
|
8
|
+
export declare const DEFAULT_THRESHOLDS: MeterThresholds;
|
|
9
|
+
/** The level of a percentage: under `warn` is good, up to `danger` is warn, above is danger. */
|
|
10
|
+
export declare function meterLevel(percentage: number, thresholds?: MeterThresholds): MeterLevel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* Without `"use client"`, apart from `Meter.tsx`: a server component that colours a figure by
|
|
2
|
+
how full it is reads the same thresholds. */
|
|
3
|
+
/** Exported for `Meter`'s default; not public. */
|
|
4
|
+
export const DEFAULT_THRESHOLDS = { warn: 70, danger: 90 };
|
|
5
|
+
/** The level of a percentage: under `warn` is good, up to `danger` is warn, above is danger. */
|
|
6
|
+
export function meterLevel(percentage, thresholds = DEFAULT_THRESHOLDS) {
|
|
7
|
+
if (percentage > thresholds.danger)
|
|
8
|
+
return "danger";
|
|
9
|
+
if (percentage >= thresholds.warn)
|
|
10
|
+
return "warn";
|
|
11
|
+
return "good";
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** The words of an HTML, without its tags: what is shown where it cannot be cleaned. */
|
|
2
|
+
export declare function richTextPlain(html: string): string;
|
|
3
|
+
/** Nothing written: no text and no image — «<p></p>» from an emptied editor counts as nothing. */
|
|
4
|
+
export declare function isRichTextEmpty(html: string | null | undefined): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* Without `"use client"`, apart from `RichText.tsx`: a server component that writes a note's
|
|
2
|
+
words in a summary — or asks whether it says anything — reads these. Cleaning the HTML
|
|
3
|
+
(`sanitizeRichText`) stays there: it needs a DOM. */
|
|
4
|
+
/** The words of an HTML, without its tags: what is shown where it cannot be cleaned. */
|
|
5
|
+
export function richTextPlain(html) {
|
|
6
|
+
return html
|
|
7
|
+
.replace(/<(?:br|\/p|\/li|\/h[1-6]|\/tr)\s*\/?>/gi, " ")
|
|
8
|
+
.replace(/<[^>]*>/g, "")
|
|
9
|
+
.replace(/ /g, " ")
|
|
10
|
+
.replace(/&/g, "&")
|
|
11
|
+
.replace(/</g, "<")
|
|
12
|
+
.replace(/>/g, ">")
|
|
13
|
+
.replace(/"/g, '"')
|
|
14
|
+
.replace(/'/g, "'")
|
|
15
|
+
.replace(/\s+/g, " ")
|
|
16
|
+
.trim();
|
|
17
|
+
}
|
|
18
|
+
/** Nothing written: no text and no image — «<p></p>» from an emptied editor counts as nothing. */
|
|
19
|
+
export function isRichTextEmpty(html) {
|
|
20
|
+
if (html === null || html === undefined)
|
|
21
|
+
return true;
|
|
22
|
+
return richTextPlain(html) === "" && !/<(?:img|hr|table)\b/i.test(html);
|
|
23
|
+
}
|
package/dist/tokens.css
CHANGED
|
@@ -599,6 +599,27 @@
|
|
|
599
599
|
/* One stage of a board by stages: a card with its name, a tag and a figure, without
|
|
600
600
|
wrapping the name into three lines. Five stages fit a desk; more scroll sideways. */
|
|
601
601
|
--container-lane: 18rem;
|
|
602
|
+
/* …and the widest it grows to when the stages fit the screen: lanes share the width
|
|
603
|
+
instead of leaving a blank on the right, but a lane of three cards stretched to 60rem
|
|
604
|
+
reads as a table with one column. */
|
|
605
|
+
--container-lane-max: 26rem;
|
|
606
|
+
/* The narrowest a tile of a grid gets (a product on a till, an item of a shop) — three
|
|
607
|
+
places, like the controls: a dense back-office grid, a till, a shop window. The grid
|
|
608
|
+
fits as many as the width takes (`--grid-tiles-*`). */
|
|
609
|
+
--container-tile-sm: 8.5rem;
|
|
610
|
+
--container-tile-md: 11rem;
|
|
611
|
+
--container-tile-lg: 15rem;
|
|
612
|
+
--grid-tiles-sm: repeat(auto-fill, minmax(min(100%, var(--container-tile-sm)), 1fr));
|
|
613
|
+
--grid-tiles-md: repeat(auto-fill, minmax(min(100%, var(--container-tile-md)), 1fr));
|
|
614
|
+
--grid-tiles-lg: repeat(auto-fill, minmax(min(100%, var(--container-tile-lg)), 1fr));
|
|
615
|
+
/* A kiosk's reduced height: the empty band above the flow, so every target sits below
|
|
616
|
+
~120 cm on a standing kiosk — within a seated person's reach (ADA 308). */
|
|
617
|
+
--size-kiosk-reach: 45dvh;
|
|
618
|
+
/* A printed ticket: the width of an 80 mm thermal roll's printable area (72 mm). */
|
|
619
|
+
--container-receipt: 72mm;
|
|
620
|
+
/* A tile's picture: 4:3, the shape a product photo is taken in and the one that keeps two
|
|
621
|
+
lines of name under it on a 11rem tile. */
|
|
622
|
+
--aspect-tile: 4 / 3;
|
|
602
623
|
/* The names column of a timeline (an employee with an avatar, a room, a machine): wide enough
|
|
603
624
|
for «Ammy Shalem Aranibar Zambrana» before it truncates. */
|
|
604
625
|
--container-timeline-label: 15rem;
|
|
@@ -705,6 +726,11 @@
|
|
|
705
726
|
--size-control-md: 36px;
|
|
706
727
|
--size-control-lg: 42px;
|
|
707
728
|
|
|
729
|
+
/* The least a pressable thing answers to, whatever it LOOKS like (`hit-target`): a chip's
|
|
730
|
+
«×» is drawn at 16px so a bar of ten filters stays one line, but it answers to 24px —
|
|
731
|
+
WCAG 2.2's minimum target (2.5.8) — and to 44px under a finger (TOUCH, below). */
|
|
732
|
+
--size-target: 24px;
|
|
733
|
+
|
|
708
734
|
--size-icon-sm: 12px;
|
|
709
735
|
--size-icon-md: 16px;
|
|
710
736
|
--size-icon-lg: 18px;
|
|
@@ -815,6 +841,13 @@
|
|
|
815
841
|
|
|
816
842
|
/* A box of content: a block, a card of a list, a metric. */
|
|
817
843
|
--radius-ui-card: var(--ui-card-radius, var(--radius-box));
|
|
844
|
+
/* A RECORD's card — one of many on a board or a grid: the control's corner, not the box's.
|
|
845
|
+
Twelve 12px boxes in a lane read as bubbles, not as records. It falls back to the card's
|
|
846
|
+
knob, so an application that re-skinned its cards re-skins these too. */
|
|
847
|
+
--radius-ui-record-card: var(
|
|
848
|
+
--ui-record-card-radius,
|
|
849
|
+
var(--ui-card-radius, var(--radius-control))
|
|
850
|
+
);
|
|
818
851
|
--color-ui-card: var(--ui-card-bg, var(--color-surface));
|
|
819
852
|
--color-ui-card-border: var(--ui-card-border, var(--color-line));
|
|
820
853
|
|
|
@@ -1553,12 +1586,65 @@
|
|
|
1553
1586
|
* a desktop browser narrowed to 400 px keeps the mouse sizes, a tablet in
|
|
1554
1587
|
* landscape gets the finger ones. Every component reads these tokens, so
|
|
1555
1588
|
* nothing else has to know about touch.
|
|
1589
|
+
*
|
|
1590
|
+
* ── The application can SAY it (`data-pointer`) ─────────────────────
|
|
1591
|
+
*
|
|
1592
|
+
* The browser answers for the PRIMARY pointer, and a till is a touch monitor
|
|
1593
|
+
* with a mouse plugged in: `pointer: coarse` is false there and the cashier
|
|
1594
|
+
* gets 30 px targets. So the application can decide instead, on `<html>` or
|
|
1595
|
+
* on any zone: `data-pointer="touch"` sizes for a finger whatever the device
|
|
1596
|
+
* says, `data-pointer="fine"` keeps the mouse sizes on a tablet that drives a
|
|
1597
|
+
* back office. Without it, the device decides, as before.
|
|
1598
|
+
*
|
|
1599
|
+
* What is not a size — a control that only shows on hover, a shortcut hint —
|
|
1600
|
+
* asks the same question with the `touch:` variant, so it follows the same
|
|
1601
|
+
* decision.
|
|
1556
1602
|
* ==================================================================== */
|
|
1557
1603
|
@media (pointer: coarse) {
|
|
1558
|
-
:root {
|
|
1604
|
+
:root:not([data-pointer="fine"]) {
|
|
1559
1605
|
--size-control-sm: 44px;
|
|
1560
1606
|
--size-control-md: 44px;
|
|
1561
1607
|
--size-control-lg: 48px;
|
|
1608
|
+
--size-target: 44px;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
[data-pointer="touch"] {
|
|
1612
|
+
--size-control-sm: 44px;
|
|
1613
|
+
--size-control-md: 44px;
|
|
1614
|
+
--size-control-lg: 48px;
|
|
1615
|
+
--size-target: 44px;
|
|
1616
|
+
}
|
|
1617
|
+
:root [data-pointer="fine"] {
|
|
1618
|
+
--size-control-sm: 30px;
|
|
1619
|
+
--size-control-md: 36px;
|
|
1620
|
+
--size-control-lg: 42px;
|
|
1621
|
+
--size-target: 24px;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
/* `touch:` — under a finger, by the device or by the application's word. */
|
|
1625
|
+
@custom-variant touch {
|
|
1626
|
+
@media (pointer: coarse) {
|
|
1627
|
+
&:not(:where([data-pointer="fine"], [data-pointer="fine"] *)) {
|
|
1628
|
+
@slot;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
&:where([data-pointer="touch"], [data-pointer="touch"] *) {
|
|
1632
|
+
@slot;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/* A pressable thing drawn smaller than a finger answers to `--size-target` around its
|
|
1637
|
+
centre: the drawing stays (a bar of chips stays one line), the target grows. */
|
|
1638
|
+
@utility hit-target {
|
|
1639
|
+
position: relative;
|
|
1640
|
+
&::after {
|
|
1641
|
+
content: "";
|
|
1642
|
+
position: absolute;
|
|
1643
|
+
top: 50%;
|
|
1644
|
+
left: 50%;
|
|
1645
|
+
width: max(100%, var(--size-target));
|
|
1646
|
+
height: max(100%, var(--size-target));
|
|
1647
|
+
transform: translate(-50%, -50%);
|
|
1562
1648
|
}
|
|
1563
1649
|
}
|
|
1564
1650
|
|
|
@@ -57,6 +57,15 @@ type BoardProps<T> = {
|
|
|
57
57
|
/** One column per stage, with drag (and Alt + ← / →) to move a card between them. */
|
|
58
58
|
stages?: BoardStages<T>;
|
|
59
59
|
};
|
|
60
|
+
/** The TILES: a grid of `RecordCard layout="tile"` — a till's products, a shop's items.
|
|
61
|
+
* Without `card`, the tile comes from what `List.Rows` says (name, meta, chips). */
|
|
62
|
+
type TilesProps<T> = {
|
|
63
|
+
/** `ways` carries the list's rule of what a press does — call `ways.press` from the tile. */
|
|
64
|
+
card?: (item: T, ways: CardWays) => ReactNode;
|
|
65
|
+
/** How wide a tile gets at least — `sm` a dense back office, `md` a till, `lg` a shop's
|
|
66
|
+
* storefront. The grid fits as many as the width takes. */
|
|
67
|
+
size?: "sm" | "md" | "lg";
|
|
68
|
+
};
|
|
60
69
|
/** The sheet. Without columns of its own, it comes from those `List.Table` declared — the
|
|
61
70
|
* one for RAW data does bring them, because there they come from the file and the code does not know
|
|
62
71
|
* which they are. */
|
|
@@ -155,9 +164,11 @@ export declare namespace List {
|
|
|
155
164
|
var Pagination: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"pagination">;
|
|
156
165
|
var Views: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"views">;
|
|
157
166
|
var Metrics: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"metrics">;
|
|
167
|
+
var Filters: ((props: NodeProps) => ReactNode) & import("../../foundations/slots.js").Slotted<"filters">;
|
|
158
168
|
var Rows: <T>(props: RowsProps<T>) => ReactNode;
|
|
159
169
|
var Table: <T extends object>(props: TableProps<T>) => ReactNode;
|
|
160
170
|
var Board: <T>(props: BoardProps<T>) => ReactNode;
|
|
171
|
+
var Tiles: <T>(props: TilesProps<T>) => ReactNode;
|
|
161
172
|
var Sheet: <T>(props: SheetProps<T>) => ReactNode;
|
|
162
173
|
var Report: ((props: ListReport) => ReactNode) & import("../../foundations/slots.js").Slotted<"report">;
|
|
163
174
|
var Pivot: <T>(props: ListPivot<T>) => ReactNode;
|
package/dist/views/list/List.js
CHANGED
|
@@ -23,11 +23,16 @@ const Views = slot("views", (_props) => null);
|
|
|
23
23
|
/** The metrics that also NARROW: «2 por confirmar». They go below the bar and
|
|
24
24
|
* above the rows, because they belong to the set and not to the frame. */
|
|
25
25
|
const Metrics = slot("metrics", (_props) => null);
|
|
26
|
+
/** The QUICK filters: the few cuts changed all day — a category, a state — always in sight
|
|
27
|
+
* under the bar instead of behind the search's panel. Usually a `Tags size="md"` with
|
|
28
|
+
* `selected` and `count`; under a finger they are the way a till or a shop narrows. */
|
|
29
|
+
const Filters = slot("filters", (_props) => null);
|
|
26
30
|
const Rows = slot("rows", (_props) => null);
|
|
27
31
|
/* Through `unknown`: `create` both receives and hands back a `T` (`onChange`, `draft`),
|
|
28
32
|
so `TableProps` is invariant in `T` and `TableProps<never>` no longer narrows to it. The
|
|
29
33
|
slot only carries the props; `List` reads them back typed against the list's `T`. */
|
|
30
34
|
const TableSlot = slot("table", (_props) => null);
|
|
35
|
+
const Tiles = slot("tiles", (_props) => null);
|
|
31
36
|
const Board = slot("board", (_props) => null);
|
|
32
37
|
const SheetSlot = slot("sheet", (_props) => null);
|
|
33
38
|
const Report = slot("report", (_props) => null);
|
|
@@ -42,6 +47,7 @@ const PRESENT_OF = {
|
|
|
42
47
|
rows: "rows",
|
|
43
48
|
table: "table",
|
|
44
49
|
board: "board",
|
|
50
|
+
tiles: "tiles",
|
|
45
51
|
sheet: "sheet",
|
|
46
52
|
report: "report",
|
|
47
53
|
pivot: "pivot",
|
|
@@ -54,6 +60,7 @@ const FACES = [
|
|
|
54
60
|
"rows",
|
|
55
61
|
"table",
|
|
56
62
|
"board",
|
|
63
|
+
"tiles",
|
|
57
64
|
"sheet",
|
|
58
65
|
"report",
|
|
59
66
|
"pivot",
|
|
@@ -99,9 +106,11 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
|
|
|
99
106
|
const pagination = propsOf(pick(bar, "pagination"))?.children;
|
|
100
107
|
const views = propsOf(pick(bar, "views"))?.children;
|
|
101
108
|
const metrics = propsOf(pick(top, "metrics"))?.children;
|
|
109
|
+
const filters = propsOf(pick(top, "filters"))?.children;
|
|
102
110
|
const rows = propsOf(pick(top, "rows"));
|
|
103
111
|
const table = propsOf(pick(top, "table"));
|
|
104
112
|
const board = propsOf(pick(top, "board"));
|
|
113
|
+
const tiles = propsOf(pick(top, "tiles"));
|
|
105
114
|
const sheet = propsOf(pick(top, "sheet"));
|
|
106
115
|
const report = propsOf(pick(top, "report"));
|
|
107
116
|
const pivot = propsOf(pick(top, "pivot"));
|
|
@@ -122,7 +131,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
|
|
|
122
131
|
});
|
|
123
132
|
/* The escape hatch: what the archetype did not foresee is drawn anyway, below.
|
|
124
133
|
Something showing up here is the sign that the archetype is missing a piece. */
|
|
125
|
-
const rest = loose(top, ["bar", "metrics", "present", ...FACES]);
|
|
134
|
+
const rest = loose(top, ["bar", "metrics", "filters", "present", ...FACES]);
|
|
126
135
|
return (_jsx(ListView, { items: items, keyOf: keyOf, row: rows === undefined
|
|
127
136
|
? () => ({ name: "" })
|
|
128
137
|
: readOnly
|
|
@@ -130,7 +139,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
|
|
|
130
139
|
const { actions: _actions, ...rest } = rows.row(item);
|
|
131
140
|
return rest;
|
|
132
141
|
}
|
|
133
|
-
: rows.row, ...(rows?.header === undefined ? {} : { rowHeader: rows.header }), ...(identity === undefined ? {} : { identity }), ...(crumbs === undefined ? {} : { crumbs }), ...(embedded === undefined ? {} : { embedded }), ...(surface === undefined ? {} : { surface }), ...(search === undefined ? {} : { search }), ...(actions === undefined ? {} : { actions }), ...(dock === undefined || readOnly ? {} : { dock }), ...(pagination === undefined ? {} : { pagination }), ...(views === undefined ? {} : { views }), ...(metrics === undefined ? {} : { metrics }), ...(table === undefined
|
|
142
|
+
: rows.row, ...(rows?.header === undefined ? {} : { rowHeader: rows.header }), ...(identity === undefined ? {} : { identity }), ...(crumbs === undefined ? {} : { crumbs }), ...(embedded === undefined ? {} : { embedded }), ...(surface === undefined ? {} : { surface }), ...(search === undefined ? {} : { search }), ...(actions === undefined ? {} : { actions }), ...(dock === undefined || readOnly ? {} : { dock }), ...(pagination === undefined ? {} : { pagination }), ...(views === undefined ? {} : { views }), ...(metrics === undefined ? {} : { metrics }), ...(filters === undefined ? {} : { filters }), ...(table === undefined
|
|
134
143
|
? {}
|
|
135
144
|
: {
|
|
136
145
|
/* Read-only: a cell that opens an editor is an action too. */
|
|
@@ -148,7 +157,7 @@ export function List({ items, keyOf, embedded, surface, group, selection: select
|
|
|
148
157
|
...(table.onVisibleColumnIdsChange === undefined
|
|
149
158
|
? {}
|
|
150
159
|
: { onVisibleColumnIdsChange: table.onVisibleColumnIdsChange }),
|
|
151
|
-
}), ...(board?.card === undefined ? {} : { card: board.card }), ...(board?.stages === undefined ? {} : { boardStages: board.stages }), ...(sheet?.columns === undefined || sheet.cell === undefined
|
|
160
|
+
}), ...(board?.card === undefined ? {} : { card: board.card }), ...(board?.stages === undefined ? {} : { boardStages: board.stages }), ...(tiles === undefined ? {} : { tiles }), ...(sheet?.columns === undefined || sheet.cell === undefined
|
|
152
161
|
? {}
|
|
153
162
|
: { sheet: sheet }), ...(report === undefined ? {} : { report }), ...(pivot === undefined ? {} : { pivot }), ...(chart === undefined ? {} : { chart }), ...(calendar === undefined ? {} : { calendar }), ...(gantt === undefined ? {} : { gantt }), ...(timeline === undefined ? {} : { timeline }), ...(faces.length === 0 ? {} : { faces }), ...(presents.length === 0 ? {} : { presents }), ...(present === undefined
|
|
154
163
|
? presents[0] === undefined
|
|
@@ -165,9 +174,11 @@ List.Dock = Dock;
|
|
|
165
174
|
List.Pagination = Pagination;
|
|
166
175
|
List.Views = Views;
|
|
167
176
|
List.Metrics = Metrics;
|
|
177
|
+
List.Filters = Filters;
|
|
168
178
|
List.Rows = Rows;
|
|
169
179
|
List.Table = TableSlot;
|
|
170
180
|
List.Board = Board;
|
|
181
|
+
List.Tiles = Tiles;
|
|
171
182
|
List.Sheet = SheetSlot;
|
|
172
183
|
List.Report = Report;
|
|
173
184
|
List.Pivot = Pivot;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ListViewProps } from "./types.js";
|
|
2
|
-
export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, search, pagination, views, actions: written, dock, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, openTargets, onOpenIn, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
|
|
2
|
+
export declare function ListView<T extends object>({ items, keyOf, identity, crumbs, embedded, surface: requestedSurface, metrics, filters, search, pagination, views, actions: written, dock, row, rowHeader, columns, visibleColumnIds, onVisibleColumnIdsChange, card, tiles, boardStages, calendar, gantt, timeline, sheet, report, pivot, chart, faces, present: requested, presents, onPresentChange, sort, onSortChange, sortable, totals, rowActions, create, group, selection, onOpen, onPeek, openTargets, onOpenIn, rowClick, onChoose, state, filtered, empty, children, }: ListViewProps<T>): import("react").JSX.Element;
|
|
3
3
|
/** What a list offers when it fails and can be retried. */
|
|
4
4
|
export declare function RetryAction({ onRetry }: {
|
|
5
5
|
onRetry: () => void;
|