@nadicodeai/ui 12.1.183 → 12.1.184
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/catalog-row.d.ts +98 -21
- package/dist/components/catalog-row.d.ts.map +1 -1
- package/dist/components/catalog-row.js +72 -43
- package/dist/components/hover-card.d.ts +1 -1
- package/dist/components/hover-card.js +1 -1
- package/dist/components/record-identity.d.ts +1 -1
- package/dist/components/record-identity.d.ts.map +1 -1
- package/dist/components/record-identity.js +2 -5
- package/dist/components/record-list.d.ts +7 -7
- package/dist/components/record-list.d.ts.map +1 -1
- package/dist/components/record-list.js +7 -24
- package/dist/components/record-time.d.ts +2 -4
- package/dist/components/record-time.d.ts.map +1 -1
- package/dist/components/record-time.js +3 -29
- package/dist/components/settings-facts.d.ts +18 -3
- package/dist/components/settings-facts.d.ts.map +1 -1
- package/dist/components/settings-facts.js +13 -8
- package/dist/components/table-layouts.d.ts +8 -8
- package/dist/components/table-layouts.d.ts.map +1 -1
- package/dist/components/table-layouts.js +8 -8
- package/dist/internal/table-compact-line.d.ts +2 -5
- package/dist/internal/table-compact-line.d.ts.map +1 -1
- package/dist/internal/table-compact-line.js +4 -6
- package/dist/lib/format-record-time.d.ts +9 -0
- package/dist/lib/format-record-time.d.ts.map +1 -0
- package/dist/lib/format-record-time.js +32 -0
- package/dist/showcase/specimens/compositions.d.ts.map +1 -1
- package/dist/showcase/specimens/compositions.js +19 -4
- package/dist/showcase/usage.generated.js +9 -9
- package/package.json +6 -2
|
@@ -23,7 +23,7 @@ export type RecordTimeProps = {
|
|
|
23
23
|
mode?: "relative";
|
|
24
24
|
/**
|
|
25
25
|
* The sentence the time sits in, which says what happened:
|
|
26
|
-
* `(when) => t("skills.updated", { when })` gives "Updated
|
|
26
|
+
* `(when) => t("skills.updated", { when })` gives "Updated 3h ago".
|
|
27
27
|
*/
|
|
28
28
|
phrase: (when: string) => string;
|
|
29
29
|
}
|
|
@@ -31,8 +31,6 @@ export type RecordTimeProps = {
|
|
|
31
31
|
| {
|
|
32
32
|
mode: "clock";
|
|
33
33
|
});
|
|
34
|
-
/** "3 hours ago" within a week, then "12 Sep", with the year when it is not this year. */
|
|
35
|
-
export declare function formatRecordTime(at: Date, locale?: string, now?: number, timeZone?: string): string;
|
|
36
34
|
/**
|
|
37
35
|
* The moment the server drew the page, for every `RecordTime` below: the server writes each relative
|
|
38
36
|
* time against it and the hydrating page reads the same one, so the two agree whatever the clock did
|
|
@@ -57,7 +55,7 @@ export declare function recordDate(at: Date | number | string | null | undefined
|
|
|
57
55
|
* @behaviour "The hover card already shows absolute UTC and local time, so don’t duplicate that copy elsewhere on the row." (https://vercel.com/geist/relative-time-card)
|
|
58
56
|
* Ours: relative within a week, then the day and month, with the year only when it is another year; `mode="clock"` prints the time of day in the viewer's zone in tabular figures. Hovering either shows a card that opens above after 150 ms, 13 px from the time, with a stem: the relative reading first, then the exact date and time in UTC and in the viewer's zone, each behind a zone chip, the viewer's by its offset (*GMT+2*). A page rendered on a server passes the viewer's `timeZone` when it knows it, so the server and the browser write the same time; otherwise the server and the hydrating page write UTC and the page then rewrites it in the browser's zone. A relative time counts from the moment the server drew the page, which a `RecordTimeRenderedAt` above gives the server and the hydrating page alike, so a minute that turns before the page is live changes nothing, and the live page then counts from the browser's clock; a server with no such moment writes the day with its year (*Signed up Oct 14, 2026*), and the live page rewrites it. The product supplies any refresh after that. A time that names no moment draws `children`, a state such as *Pending*, or nothing. While `at` does name a moment, `children` (*Queued*) replaces the sentence and the card stays.
|
|
59
57
|
* @words "Pass `date` as a number (Unix ms or epoch)." "Don’t pre-format the value, and don’t replace `children` with a formatted string." "The component’s short formatter is the canonical form (`2m`, `5h`, `Yesterday`)." "Don’t append `ago` after the component." "The formatter already produces `2m ago` / `5h ago`, so `<RelativeTimeCard /> ago` reads as `2m ago ago`." "Use `children` only for non-time labels (`Just now`, `Pending`, `Queued`) where the formatter can’t describe the state." "Pair with a leading label when the row is ambiguous on its own: `Last deploy <RelativeTimeCard date={ts} />`." (https://vercel.com/geist/relative-time-card)
|
|
60
|
-
* Ours: `at` takes a Date, epoch milliseconds or an ISO string, never a display string such as *3 hours ago*. The reading is the
|
|
58
|
+
* Ours: `at` takes a Date, epoch milliseconds or an ISO string, never a display string such as *3 hours ago*. The reading is Geist's short form in the person's language (*now*, *2m ago*, *3h ago*, *yesterday*, *3d ago*, then *12 Sep*; *ora*, *3 h fa* in Italian). The product writes the sentence through `phrase` (*Updated {when}*, *Ran {when}*), so *ago* is never added after it, and a row says what happened because its list's headings are read only by assistive technology; the clock needs no words. The package formats every date with the person's `locale`.
|
|
61
59
|
* @access Ours: a `<time>` element with the machine-readable moment; assistive technology reads the exact local moment after the visible text.
|
|
62
60
|
*/
|
|
63
61
|
export declare function RecordTime(props: RecordTimeProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-time.d.ts","sourceRoot":"","sources":["../../src/components/record-time.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAa,gBAAgB,EAAoB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"record-time.d.ts","sourceRoot":"","sources":["../../src/components/record-time.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAa,gBAAgB,EAAoB,MAAM,yBAAyB,CAAC;AAIxF,MAAM,MAAM,eAAe,GAAG;IAC5B,0FAA0F;IAC1F,EAAE,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,kEAAkE;IAClE,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;IACvD,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kIAAkI;IAClI,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,CACA;IACE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAClC;AACH,gEAAgE;GAC9D;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CACpB,CAAC;AAIF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAEA;AAoDD,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAIrF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,sCA+EhD"}
|
|
@@ -3,33 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext, use } from "react";
|
|
4
4
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from "./hover-card.js";
|
|
5
5
|
import { useHydrated } from "../hooks/use-hydrated.js";
|
|
6
|
-
|
|
7
|
-
const WEEK = 7 * DAY;
|
|
8
|
-
const UNITS = [
|
|
9
|
-
["day", DAY],
|
|
10
|
-
["hour", 3_600_000],
|
|
11
|
-
["minute", 60_000],
|
|
12
|
-
];
|
|
13
|
-
/** "3 hours ago" within a week, then "12 Sep", with the year when it is not this year. */
|
|
14
|
-
export function formatRecordTime(at, locale, now = Date.now(), timeZone) {
|
|
15
|
-
const elapsed = now - at.getTime();
|
|
16
|
-
if (elapsed >= 0 && elapsed < WEEK) {
|
|
17
|
-
const relative = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
|
18
|
-
for (const [unit, size] of UNITS) {
|
|
19
|
-
if (elapsed >= size)
|
|
20
|
-
return relative.format(-Math.floor(elapsed / size), unit);
|
|
21
|
-
}
|
|
22
|
-
return relative.format(0, "minute");
|
|
23
|
-
}
|
|
24
|
-
const yearOf = new Intl.DateTimeFormat("en", { timeZone, year: "numeric" });
|
|
25
|
-
return recordDay(at, locale, timeZone, yearOf.format(at) !== yearOf.format(now));
|
|
26
|
-
}
|
|
27
|
-
function recordDay(at, locale, timeZone, withYear) {
|
|
28
|
-
const shown = { timeZone, day: "numeric", month: "short" };
|
|
29
|
-
if (withYear)
|
|
30
|
-
shown.year = "numeric";
|
|
31
|
-
return new Intl.DateTimeFormat(locale, shown).format(at);
|
|
32
|
-
}
|
|
6
|
+
import { formatRecordDay, formatRecordTime } from "../lib/format-record-time.js";
|
|
33
7
|
const RenderedAt = createContext(null);
|
|
34
8
|
/**
|
|
35
9
|
* The moment the server drew the page, for every `RecordTime` below: the server writes each relative
|
|
@@ -55,7 +29,7 @@ function useReadingTime(now, counted) {
|
|
|
55
29
|
}
|
|
56
30
|
function relativeWhen(at, locale, reading, timeZone) {
|
|
57
31
|
return reading === undefined
|
|
58
|
-
?
|
|
32
|
+
? formatRecordDay(at, locale, timeZone, true)
|
|
59
33
|
: formatRecordTime(at, locale, reading, timeZone);
|
|
60
34
|
}
|
|
61
35
|
function OpenedReading({ at, locale, now, timeZone, }) {
|
|
@@ -91,7 +65,7 @@ export function recordDate(at) {
|
|
|
91
65
|
* @behaviour "The hover card already shows absolute UTC and local time, so don’t duplicate that copy elsewhere on the row." (https://vercel.com/geist/relative-time-card)
|
|
92
66
|
* Ours: relative within a week, then the day and month, with the year only when it is another year; `mode="clock"` prints the time of day in the viewer's zone in tabular figures. Hovering either shows a card that opens above after 150 ms, 13 px from the time, with a stem: the relative reading first, then the exact date and time in UTC and in the viewer's zone, each behind a zone chip, the viewer's by its offset (*GMT+2*). A page rendered on a server passes the viewer's `timeZone` when it knows it, so the server and the browser write the same time; otherwise the server and the hydrating page write UTC and the page then rewrites it in the browser's zone. A relative time counts from the moment the server drew the page, which a `RecordTimeRenderedAt` above gives the server and the hydrating page alike, so a minute that turns before the page is live changes nothing, and the live page then counts from the browser's clock; a server with no such moment writes the day with its year (*Signed up Oct 14, 2026*), and the live page rewrites it. The product supplies any refresh after that. A time that names no moment draws `children`, a state such as *Pending*, or nothing. While `at` does name a moment, `children` (*Queued*) replaces the sentence and the card stays.
|
|
93
67
|
* @words "Pass `date` as a number (Unix ms or epoch)." "Don’t pre-format the value, and don’t replace `children` with a formatted string." "The component’s short formatter is the canonical form (`2m`, `5h`, `Yesterday`)." "Don’t append `ago` after the component." "The formatter already produces `2m ago` / `5h ago`, so `<RelativeTimeCard /> ago` reads as `2m ago ago`." "Use `children` only for non-time labels (`Just now`, `Pending`, `Queued`) where the formatter can’t describe the state." "Pair with a leading label when the row is ambiguous on its own: `Last deploy <RelativeTimeCard date={ts} />`." (https://vercel.com/geist/relative-time-card)
|
|
94
|
-
* Ours: `at` takes a Date, epoch milliseconds or an ISO string, never a display string such as *3 hours ago*. The reading is the
|
|
68
|
+
* Ours: `at` takes a Date, epoch milliseconds or an ISO string, never a display string such as *3 hours ago*. The reading is Geist's short form in the person's language (*now*, *2m ago*, *3h ago*, *yesterday*, *3d ago*, then *12 Sep*; *ora*, *3 h fa* in Italian). The product writes the sentence through `phrase` (*Updated {when}*, *Ran {when}*), so *ago* is never added after it, and a row says what happened because its list's headings are read only by assistive technology; the clock needs no words. The package formats every date with the person's `locale`.
|
|
95
69
|
* @access Ours: a `<time>` element with the machine-readable moment; assistive technology reads the exact local moment after the visible text.
|
|
96
70
|
*/
|
|
97
71
|
export function RecordTime(props) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef, type ReactNode } from "react";
|
|
2
|
+
import { type EmptyStateKind } from "./empty-state.js";
|
|
2
3
|
import { type CardActions } from "./page-actions.js";
|
|
3
4
|
import { Card, type CardSurface } from "./card.js";
|
|
4
5
|
export type SettingsFact = {
|
|
@@ -36,6 +37,14 @@ export type SettingsFactsSectionProps = SettingsFactsBase & ({
|
|
|
36
37
|
description: string;
|
|
37
38
|
/** The footer's left line, one muted sentence: a Learn more link, what the facts are for. */
|
|
38
39
|
footerHint: NonNullable<ReactNode>;
|
|
40
|
+
picture?: {
|
|
41
|
+
src: string;
|
|
42
|
+
alt: string;
|
|
43
|
+
};
|
|
44
|
+
/** The facts are still being read: each label stands over a placeholder line, never a dash. */
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
/** The read of the facts failed: its message and Try again stand in their place, inside the card. */
|
|
47
|
+
failed?: EmptyStateKind<"failed"> | undefined;
|
|
39
48
|
surface?: CardSurface;
|
|
40
49
|
/**
|
|
41
50
|
* The card's density. The default matches the settings sections it sits
|
|
@@ -46,6 +55,9 @@ export type SettingsFactsSectionProps = SettingsFactsBase & ({
|
|
|
46
55
|
presentation: "summary";
|
|
47
56
|
description?: string;
|
|
48
57
|
footerHint?: never;
|
|
58
|
+
picture?: never;
|
|
59
|
+
loading?: never;
|
|
60
|
+
failed?: never;
|
|
49
61
|
surface?: never;
|
|
50
62
|
size?: never;
|
|
51
63
|
});
|
|
@@ -64,8 +76,11 @@ export type SettingsFactsSectionProps = SettingsFactsBase & ({
|
|
|
64
76
|
* `SettingsSection`. Two places take a control, each for one job: `actions` at the header's end are the commands on the facts, the Edit that opens their editor, drawn as every card's header draws them (`CardActions`); `action` at the footer's right, beside its line, is the one action the card's state asks for, as a status card's fix (Update, Start) and every Vercel settings card's button stand there. Facts are plain pairs, the label above
|
|
65
77
|
* its value, in two equal columns from 640 px (`sm`) and one column below it. Every label stays when its value is missing,
|
|
66
78
|
* as *—*. A long value
|
|
67
|
-
* spans both columns. No fact gets a box of its own.
|
|
68
|
-
*
|
|
79
|
+
* spans both columns. No fact gets a box of its own. While the facts are read (`loading`) each label stands over a
|
|
80
|
+
* placeholder line, never a dash, and a read that `failed` puts its message and Try again in their place, inside the
|
|
81
|
+
* card. A `picture` stands beside the facts, as Vercel's deployment card keeps its screenshot, only where DESIGN.md
|
|
82
|
+
* admits a picture on a populated page. In a side column, `presentation="summary"` drops the card, the description and
|
|
83
|
+
* the footer line.
|
|
69
84
|
* @words "Title slot is Title Case noun (`Last Deployed`, `Build Duration`); content is sentence case unless the value is a literal identifier, ID, or timestamp that should be preserved verbatim." (https://vercel.com/geist/description)
|
|
70
85
|
* Ours: labels are nouns in sentence case, no colon: *VAT number*. Identifiers in
|
|
71
86
|
* mono with a copy button, dates in the person's locale. The footer line says what the facts are
|
|
@@ -75,6 +90,6 @@ export type SettingsFactsSectionProps = SettingsFactsBase & ({
|
|
|
75
90
|
* Ours: a `dl` of `dt` and `dd`, each value named by its label. The section is labelled by its heading, which also takes focus
|
|
76
91
|
* when an editor closes. A dash carries screen-reader text.
|
|
77
92
|
*/
|
|
78
|
-
export declare function SettingsFactsSection({ actions, action, presentation, description, facts, footerHint, missingValueLabel, headingId, headingLevel, title, surface, size, ...props }: SettingsFactsSectionProps): import("react").JSX.Element;
|
|
93
|
+
export declare function SettingsFactsSection({ actions, action, presentation, description, facts, footerHint, picture, loading, failed, missingValueLabel, headingId, headingLevel, title, surface, size, ...props }: SettingsFactsSectionProps): import("react").JSX.Element;
|
|
79
94
|
export {};
|
|
80
95
|
//# sourceMappingURL=settings-facts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-facts.d.ts","sourceRoot":"","sources":["../../src/components/settings-facts.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"settings-facts.d.ts","sourceRoot":"","sources":["../../src/components/settings-facts.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAG7E,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,KAAK,WAAW,EAAkB,MAAM,gBAAgB,CAAC;AAIlE,OAAO,EACL,IAAI,EAMJ,KAAK,WAAW,EACjB,MAAM,QAAQ,CAAC;AAEhB,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7F,iGAAiG;IACjG,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,+GAA+G;IAC/G,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GACvD,CACI;IACE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,UAAU,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qGAAqG;IACrG,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,wBAAwB,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;CACtD,GACD;IACE,YAAY,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,CACJ,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,MAAM,EACN,YAAqB,EACrB,WAAW,EACX,KAAK,EACL,UAAU,EACV,OAAO,EACP,OAAe,EACf,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,YAAgB,EAChB,KAAK,EACL,OAAmB,EACnB,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,yBAAyB,+BAsF3B"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
3
|
import { FooterStrip } from "../internal/footer-strip.js";
|
|
4
|
+
import { EmptyState } from "./empty-state.js";
|
|
4
5
|
import { ObjectFacts } from "./object-workspace.js";
|
|
5
6
|
import { CardActionsRow } from "./page-actions.js";
|
|
7
|
+
import { Skeleton, SkeletonRegion } from "./skeleton.js";
|
|
6
8
|
import { TableValue } from "./table-value.js";
|
|
7
9
|
import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle, } from "./card.js";
|
|
8
10
|
/**
|
|
@@ -20,8 +22,11 @@ import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle,
|
|
|
20
22
|
* `SettingsSection`. Two places take a control, each for one job: `actions` at the header's end are the commands on the facts, the Edit that opens their editor, drawn as every card's header draws them (`CardActions`); `action` at the footer's right, beside its line, is the one action the card's state asks for, as a status card's fix (Update, Start) and every Vercel settings card's button stand there. Facts are plain pairs, the label above
|
|
21
23
|
* its value, in two equal columns from 640 px (`sm`) and one column below it. Every label stays when its value is missing,
|
|
22
24
|
* as *—*. A long value
|
|
23
|
-
* spans both columns. No fact gets a box of its own.
|
|
24
|
-
*
|
|
25
|
+
* spans both columns. No fact gets a box of its own. While the facts are read (`loading`) each label stands over a
|
|
26
|
+
* placeholder line, never a dash, and a read that `failed` puts its message and Try again in their place, inside the
|
|
27
|
+
* card. A `picture` stands beside the facts, as Vercel's deployment card keeps its screenshot, only where DESIGN.md
|
|
28
|
+
* admits a picture on a populated page. In a side column, `presentation="summary"` drops the card, the description and
|
|
29
|
+
* the footer line.
|
|
25
30
|
* @words "Title slot is Title Case noun (`Last Deployed`, `Build Duration`); content is sentence case unless the value is a literal identifier, ID, or timestamp that should be preserved verbatim." (https://vercel.com/geist/description)
|
|
26
31
|
* Ours: labels are nouns in sentence case, no colon: *VAT number*. Identifiers in
|
|
27
32
|
* mono with a copy button, dates in the person's locale. The footer line says what the facts are
|
|
@@ -31,15 +36,15 @@ import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle,
|
|
|
31
36
|
* Ours: a `dl` of `dt` and `dd`, each value named by its label. The section is labelled by its heading, which also takes focus
|
|
32
37
|
* when an editor closes. A dash carries screen-reader text.
|
|
33
38
|
*/
|
|
34
|
-
export function SettingsFactsSection({ actions, action, presentation = "card", description, facts, footerHint, missingValueLabel, headingId, headingLevel = 2, title, surface = "resting", size = "default", ...props }) {
|
|
39
|
+
export function SettingsFactsSection({ actions, action, presentation = "card", description, facts, footerHint, picture, loading = false, failed, missingValueLabel, headingId, headingLevel = 2, title, surface = "resting", size = "default", ...props }) {
|
|
35
40
|
const termId = useId();
|
|
36
41
|
const Heading = headingLevel === 3 ? "h3" : "h2";
|
|
37
42
|
if (presentation === "summary") {
|
|
38
43
|
return (_jsxs("section", { ...props, "aria-labelledby": headingId, className: "grid min-w-0 gap-3", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsx(Heading, { id: headingId, tabIndex: -1, className: "text-sm font-medium", children: title }), actions ? _jsx(CardActionsRow, { ...actions }) : null] }), description ? _jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null, _jsx("dl", { className: "flex flex-wrap items-start gap-x-6 gap-y-3", children: facts.map((fact, index) => (_jsxs("div", { className: "grid gap-1", children: [_jsx("dt", { className: "text-xs text-muted-foreground", id: `${termId}-${index}`, children: fact.label }), _jsx("dd", { "aria-labelledby": `${termId}-${index}`, className: "text-sm", children: fact.value ?? _jsx(TableValue, { missingLabel: missingValueLabel, value: null }) })] }, fact.label))) }), action] }));
|
|
39
44
|
}
|
|
40
|
-
return (_jsxs(Card, { render: _jsx("section", {}), ...props, "aria-labelledby": headingId, surface: surface, size: size, className: "min-w-0", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: _jsx(Heading, { id: headingId, tabIndex: -1, children: title }) }), description ? _jsx(CardDescription, { children: description }) : null, actions ? (_jsx(CardAction, { children: _jsx(CardActionsRow, { ...actions }) })) : null] }),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
return (_jsxs(Card, { render: _jsx("section", {}), ...props, "aria-labelledby": headingId, surface: surface, size: size, className: "min-w-0", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: _jsx(Heading, { id: headingId, tabIndex: -1, children: title }) }), description ? _jsx(CardDescription, { children: description }) : null, actions ? (_jsx(CardAction, { children: _jsx(CardActionsRow, { ...actions }) })) : null] }), _jsxs(CardContent, { className: picture ? "grid gap-6 md:grid-cols-[minmax(0,10rem)_minmax(0,1fr)]" : undefined, children: [picture ? (_jsx("img", { alt: picture.alt, className: "hidden max-h-44 w-full self-center object-contain md:block", src: picture.src })) : null, failed ? (_jsx(EmptyState, { ...failed, scope: "card" })) : (_jsx(SkeletonRegion, { busy: loading, children: _jsx(ObjectFacts, { facts: facts.map((fact) => ({
|
|
46
|
+
label: fact.label,
|
|
47
|
+
block: fact.block,
|
|
48
|
+
value: loading ? (_jsx(Skeleton, { height: 20, width: 96 })) : fact.value === null || fact.value === undefined || fact.value === "" ? (_jsx(TableValue, { missingLabel: missingValueLabel, value: null })) : (fact.value),
|
|
49
|
+
})) }) }))] }), _jsx(FooterStrip, { hint: footerHint, hintSlot: "settings-facts-hint", children: action })] }));
|
|
45
50
|
}
|
|
@@ -6,7 +6,7 @@ export declare const tableCompactLayouts: {
|
|
|
6
6
|
readonly row: "@max-xl/table:[&>td]:border-b-0 @max-xl/table:[&>td]:after:hidden @max-xl/table:h-auto! @max-xl/table:[&>td]:pb-1!";
|
|
7
7
|
readonly details: "@xl/table:hidden";
|
|
8
8
|
readonly wideOnly: "hidden @xl/table:contents";
|
|
9
|
-
readonly table: "@max-xl/table:table-auto @max-xl/table:[&
|
|
9
|
+
readonly table: "@max-xl/table:table-auto @max-xl/table:[&_td]:whitespace-normal @max-xl/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
10
10
|
};
|
|
11
11
|
readonly standard: {
|
|
12
12
|
readonly width: 768;
|
|
@@ -15,7 +15,7 @@ export declare const tableCompactLayouts: {
|
|
|
15
15
|
readonly row: "@max-3xl/table:[&>td]:border-b-0 @max-3xl/table:[&>td]:after:hidden @max-3xl/table:h-auto! @max-3xl/table:[&>td]:pb-1!";
|
|
16
16
|
readonly details: "@3xl/table:hidden";
|
|
17
17
|
readonly wideOnly: "hidden @3xl/table:contents";
|
|
18
|
-
readonly table: "@max-3xl/table:table-auto @max-3xl/table:[&
|
|
18
|
+
readonly table: "@max-3xl/table:table-auto @max-3xl/table:[&_td]:whitespace-normal @max-3xl/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
19
19
|
};
|
|
20
20
|
readonly wide: {
|
|
21
21
|
readonly width: 1024;
|
|
@@ -24,7 +24,7 @@ export declare const tableCompactLayouts: {
|
|
|
24
24
|
readonly row: "@max-5xl/table:[&>td]:border-b-0 @max-5xl/table:[&>td]:after:hidden @max-5xl/table:h-auto! @max-5xl/table:[&>td]:pb-1!";
|
|
25
25
|
readonly details: "@5xl/table:hidden";
|
|
26
26
|
readonly wideOnly: "hidden @5xl/table:contents";
|
|
27
|
-
readonly table: "@max-5xl/table:table-auto @max-5xl/table:[&
|
|
27
|
+
readonly table: "@max-5xl/table:table-auto @max-5xl/table:[&_td]:whitespace-normal @max-5xl/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
28
28
|
};
|
|
29
29
|
readonly roomy: {
|
|
30
30
|
readonly width: 1088;
|
|
@@ -33,7 +33,7 @@ export declare const tableCompactLayouts: {
|
|
|
33
33
|
readonly row: "@max-[68rem]/table:[&>td]:border-b-0 @max-[68rem]/table:[&>td]:after:hidden @max-[68rem]/table:h-auto! @max-[68rem]/table:[&>td]:pb-1!";
|
|
34
34
|
readonly details: "@min-[68rem]/table:hidden";
|
|
35
35
|
readonly wideOnly: "hidden @min-[68rem]/table:contents";
|
|
36
|
-
readonly table: "@max-[68rem]/table:table-auto @max-[68rem]/table:[&
|
|
36
|
+
readonly table: "@max-[68rem]/table:table-auto @max-[68rem]/table:[&_td]:whitespace-normal @max-[68rem]/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
37
37
|
};
|
|
38
38
|
readonly spacious: {
|
|
39
39
|
readonly width: 1152;
|
|
@@ -42,7 +42,7 @@ export declare const tableCompactLayouts: {
|
|
|
42
42
|
readonly row: "@max-6xl/table:[&>td]:border-b-0 @max-6xl/table:[&>td]:after:hidden @max-6xl/table:h-auto! @max-6xl/table:[&>td]:pb-1!";
|
|
43
43
|
readonly details: "@6xl/table:hidden";
|
|
44
44
|
readonly wideOnly: "hidden @6xl/table:contents";
|
|
45
|
-
readonly table: "@max-6xl/table:table-auto @max-6xl/table:[&
|
|
45
|
+
readonly table: "@max-6xl/table:table-auto @max-6xl/table:[&_td]:whitespace-normal @max-6xl/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
46
46
|
};
|
|
47
47
|
readonly broad: {
|
|
48
48
|
readonly width: 1280;
|
|
@@ -51,7 +51,7 @@ export declare const tableCompactLayouts: {
|
|
|
51
51
|
readonly row: "@max-7xl/table:[&>td]:border-b-0 @max-7xl/table:[&>td]:after:hidden @max-7xl/table:h-auto! @max-7xl/table:[&>td]:pb-1!";
|
|
52
52
|
readonly details: "@7xl/table:hidden";
|
|
53
53
|
readonly wideOnly: "hidden @7xl/table:contents";
|
|
54
|
-
readonly table: "@max-7xl/table:table-auto @max-7xl/table:[&
|
|
54
|
+
readonly table: "@max-7xl/table:table-auto @max-7xl/table:[&_td]:whitespace-normal @max-7xl/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
55
55
|
};
|
|
56
56
|
readonly vast: {
|
|
57
57
|
readonly width: 1536;
|
|
@@ -60,7 +60,7 @@ export declare const tableCompactLayouts: {
|
|
|
60
60
|
readonly row: "@max-[96rem]/table:[&>td]:border-b-0 @max-[96rem]/table:[&>td]:after:hidden @max-[96rem]/table:h-auto! @max-[96rem]/table:[&>td]:pb-1!";
|
|
61
61
|
readonly details: "@min-[96rem]/table:hidden";
|
|
62
62
|
readonly wideOnly: "hidden @min-[96rem]/table:contents";
|
|
63
|
-
readonly table: "@max-[96rem]/table:table-auto @max-[96rem]/table:[&
|
|
63
|
+
readonly table: "@max-[96rem]/table:table-auto @max-[96rem]/table:[&_td]:whitespace-normal @max-[96rem]/table:[&_th:not(:first-child):not([data-identity])]:w-px";
|
|
64
64
|
};
|
|
65
65
|
readonly always: {
|
|
66
66
|
readonly width: number;
|
|
@@ -69,7 +69,7 @@ export declare const tableCompactLayouts: {
|
|
|
69
69
|
readonly row: "[&>td]:border-b-0 [&>td]:after:hidden h-auto! [&>td]:pb-1!";
|
|
70
70
|
readonly details: "";
|
|
71
71
|
readonly wideOnly: "hidden";
|
|
72
|
-
readonly table: "table-auto [&
|
|
72
|
+
readonly table: "table-auto [&_td]:whitespace-normal [&_th:not(:first-child):not([data-identity])]:w-px";
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
export type TableCompactLayout = keyof typeof tableCompactLayouts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-layouts.d.ts","sourceRoot":"","sources":["../../src/components/table-layouts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"table-layouts.d.ts","sourceRoot":"","sources":["../../src/components/table-layouts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFtB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAelE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,kBAAkB,CAG3F"}
|
|
@@ -6,7 +6,7 @@ export const tableCompactLayouts = {
|
|
|
6
6
|
row: "@max-xl/table:[&>td]:border-b-0 @max-xl/table:[&>td]:after:hidden @max-xl/table:h-auto! @max-xl/table:[&>td]:pb-1!",
|
|
7
7
|
details: "@xl/table:hidden",
|
|
8
8
|
wideOnly: "hidden @xl/table:contents",
|
|
9
|
-
table: "@max-xl/table:table-auto @max-xl/table:[&
|
|
9
|
+
table: "@max-xl/table:table-auto @max-xl/table:[&_td]:whitespace-normal @max-xl/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
10
10
|
},
|
|
11
11
|
standard: {
|
|
12
12
|
width: 768,
|
|
@@ -15,7 +15,7 @@ export const tableCompactLayouts = {
|
|
|
15
15
|
row: "@max-3xl/table:[&>td]:border-b-0 @max-3xl/table:[&>td]:after:hidden @max-3xl/table:h-auto! @max-3xl/table:[&>td]:pb-1!",
|
|
16
16
|
details: "@3xl/table:hidden",
|
|
17
17
|
wideOnly: "hidden @3xl/table:contents",
|
|
18
|
-
table: "@max-3xl/table:table-auto @max-3xl/table:[&
|
|
18
|
+
table: "@max-3xl/table:table-auto @max-3xl/table:[&_td]:whitespace-normal @max-3xl/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
19
19
|
},
|
|
20
20
|
wide: {
|
|
21
21
|
width: 1024,
|
|
@@ -24,7 +24,7 @@ export const tableCompactLayouts = {
|
|
|
24
24
|
row: "@max-5xl/table:[&>td]:border-b-0 @max-5xl/table:[&>td]:after:hidden @max-5xl/table:h-auto! @max-5xl/table:[&>td]:pb-1!",
|
|
25
25
|
details: "@5xl/table:hidden",
|
|
26
26
|
wideOnly: "hidden @5xl/table:contents",
|
|
27
|
-
table: "@max-5xl/table:table-auto @max-5xl/table:[&
|
|
27
|
+
table: "@max-5xl/table:table-auto @max-5xl/table:[&_td]:whitespace-normal @max-5xl/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
28
28
|
},
|
|
29
29
|
roomy: {
|
|
30
30
|
width: 1088,
|
|
@@ -33,7 +33,7 @@ export const tableCompactLayouts = {
|
|
|
33
33
|
row: "@max-[68rem]/table:[&>td]:border-b-0 @max-[68rem]/table:[&>td]:after:hidden @max-[68rem]/table:h-auto! @max-[68rem]/table:[&>td]:pb-1!",
|
|
34
34
|
details: "@min-[68rem]/table:hidden",
|
|
35
35
|
wideOnly: "hidden @min-[68rem]/table:contents",
|
|
36
|
-
table: "@max-[68rem]/table:table-auto @max-[68rem]/table:[&
|
|
36
|
+
table: "@max-[68rem]/table:table-auto @max-[68rem]/table:[&_td]:whitespace-normal @max-[68rem]/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
37
37
|
},
|
|
38
38
|
spacious: {
|
|
39
39
|
width: 1152,
|
|
@@ -42,7 +42,7 @@ export const tableCompactLayouts = {
|
|
|
42
42
|
row: "@max-6xl/table:[&>td]:border-b-0 @max-6xl/table:[&>td]:after:hidden @max-6xl/table:h-auto! @max-6xl/table:[&>td]:pb-1!",
|
|
43
43
|
details: "@6xl/table:hidden",
|
|
44
44
|
wideOnly: "hidden @6xl/table:contents",
|
|
45
|
-
table: "@max-6xl/table:table-auto @max-6xl/table:[&
|
|
45
|
+
table: "@max-6xl/table:table-auto @max-6xl/table:[&_td]:whitespace-normal @max-6xl/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
46
46
|
},
|
|
47
47
|
broad: {
|
|
48
48
|
width: 1280,
|
|
@@ -51,7 +51,7 @@ export const tableCompactLayouts = {
|
|
|
51
51
|
row: "@max-7xl/table:[&>td]:border-b-0 @max-7xl/table:[&>td]:after:hidden @max-7xl/table:h-auto! @max-7xl/table:[&>td]:pb-1!",
|
|
52
52
|
details: "@7xl/table:hidden",
|
|
53
53
|
wideOnly: "hidden @7xl/table:contents",
|
|
54
|
-
table: "@max-7xl/table:table-auto @max-7xl/table:[&
|
|
54
|
+
table: "@max-7xl/table:table-auto @max-7xl/table:[&_td]:whitespace-normal @max-7xl/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
55
55
|
},
|
|
56
56
|
vast: {
|
|
57
57
|
width: 1536,
|
|
@@ -60,7 +60,7 @@ export const tableCompactLayouts = {
|
|
|
60
60
|
row: "@max-[96rem]/table:[&>td]:border-b-0 @max-[96rem]/table:[&>td]:after:hidden @max-[96rem]/table:h-auto! @max-[96rem]/table:[&>td]:pb-1!",
|
|
61
61
|
details: "@min-[96rem]/table:hidden",
|
|
62
62
|
wideOnly: "hidden @min-[96rem]/table:contents",
|
|
63
|
-
table: "@max-[96rem]/table:table-auto @max-[96rem]/table:[&
|
|
63
|
+
table: "@max-[96rem]/table:table-auto @max-[96rem]/table:[&_td]:whitespace-normal @max-[96rem]/table:[&_th:not(:first-child):not([data-identity])]:w-px",
|
|
64
64
|
},
|
|
65
65
|
always: {
|
|
66
66
|
width: Number.POSITIVE_INFINITY,
|
|
@@ -69,7 +69,7 @@ export const tableCompactLayouts = {
|
|
|
69
69
|
row: "[&>td]:border-b-0 [&>td]:after:hidden h-auto! [&>td]:pb-1!",
|
|
70
70
|
details: "",
|
|
71
71
|
wideOnly: "hidden",
|
|
72
|
-
table: "table-auto [&
|
|
72
|
+
table: "table-auto [&_td]:whitespace-normal [&_th:not(:first-child):not([data-identity])]:w-px",
|
|
73
73
|
},
|
|
74
74
|
};
|
|
75
75
|
/** The least a column without a size needs, in pixels: below it the card lays out compact. */
|
|
@@ -9,12 +9,10 @@ export type TableDetailFact = {
|
|
|
9
9
|
/** The value stands beside the record's name instead, which ends in an ellipsis before it: a status. */
|
|
10
10
|
besideName?: boolean;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
export declare const detailFactsLine = "**:data-[slot=tag]:contents [&>span>:is(div,p,.block,.grid,.flex)]:inline";
|
|
12
|
+
export declare const detailFactsLine = "**:data-[slot=tag]:align-middle [&>span>:is(div,p,.block,.grid,.flex)]:inline";
|
|
14
13
|
export declare const detailFactsWrap = "[&_:not(.sr-only,[data-slot=badge],[data-slot=badge]_*)]:whitespace-normal";
|
|
15
|
-
export declare function DetailFacts({ facts
|
|
14
|
+
export declare function DetailFacts({ facts }: {
|
|
16
15
|
facts: readonly TableDetailFact[];
|
|
17
|
-
leadingSeparator?: boolean;
|
|
18
16
|
}): React.JSX.Element[];
|
|
19
17
|
type TableCompactLineValue = {
|
|
20
18
|
layout: TableCompactLayout;
|
|
@@ -23,7 +21,6 @@ type TableCompactLineValue = {
|
|
|
23
21
|
export declare function TableCompactLine({ children, ...value }: TableCompactLineValue & {
|
|
24
22
|
children: React.ReactNode;
|
|
25
23
|
}): React.JSX.Element;
|
|
26
|
-
/** The compact facts of the row this stands in, after a middle dot; nothing outside such a row or on a card wide enough for the columns. */
|
|
27
24
|
export declare function TableCompactFacts(): React.JSX.Element | null;
|
|
28
25
|
/** The compact facts that stand beside the name of the row this stands in, which no ellipsis cuts; nothing outside such a row or on a card wide enough for the columns. */
|
|
29
26
|
export declare function TableCompactNameFacts(): React.JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-compact-line.d.ts","sourceRoot":"","sources":["../../src/internal/table-compact-line.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAG1F,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,4HAA4H;IAC5H,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wGAAwG;IACxG,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"table-compact-line.d.ts","sourceRoot":"","sources":["../../src/internal/table-compact-line.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAG1F,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,4HAA4H;IAC5H,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wGAAwG;IACxG,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,kFACqD,CAAC;AAElF,eAAO,MAAM,eAAe,+EACkD,CAAC;AAE/E,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,uBAU3E;AAED,KAAK,qBAAqB,GAAG;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,CAAC;AAI/F,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAEvD;AAED,wBAAgB,iBAAiB,6BAkBhC;AAED,2KAA2K;AAC3K,wBAAgB,qBAAqB,6BAkBpC;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEzD,KAAK,uBAAuB,GAAG;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC;AAMlF;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,KAAK,EACL,QAAQ,GACT,EAAE,uBAAuB,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAGzD;AAwDD,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4BAenE;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4BAetE"}
|
|
@@ -3,17 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { tableCompactLayouts } from "../components/table-layouts.js";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
|
-
|
|
7
|
-
export const detailFactsLine = "**:data-[slot=tag]:contents [&>span>:is(div,p,.block,.grid,.flex)]:inline";
|
|
6
|
+
export const detailFactsLine = "**:data-[slot=tag]:align-middle [&>span>:is(div,p,.block,.grid,.flex)]:inline";
|
|
8
7
|
export const detailFactsWrap = "[&_:not(.sr-only,[data-slot=badge],[data-slot=badge]_*)]:whitespace-normal";
|
|
9
|
-
export function DetailFacts({ facts
|
|
10
|
-
return facts.map((fact, index) => (_jsxs(
|
|
8
|
+
export function DetailFacts({ facts }) {
|
|
9
|
+
return facts.map((fact, index) => (_jsxs(React.Fragment, { children: [index > 0 ? _jsx("span", { "aria-hidden": "true", children: " \u00B7 " }) : null, _jsxs("span", { className: "inline-block max-w-full", children: [_jsxs("span", { className: "sr-only", children: [fact.label, ": "] }), fact.value] })] }, fact.id)));
|
|
11
10
|
}
|
|
12
11
|
const TableCompactLineContext = React.createContext(null);
|
|
13
12
|
export function TableCompactLine({ children, ...value }) {
|
|
14
13
|
return _jsx(TableCompactLineContext, { value: value, children: children });
|
|
15
14
|
}
|
|
16
|
-
/** The compact facts of the row this stands in, after a middle dot; nothing outside such a row or on a card wide enough for the columns. */
|
|
17
15
|
export function TableCompactFacts() {
|
|
18
16
|
const line = React.useContext(TableCompactLineContext);
|
|
19
17
|
if (!line)
|
|
@@ -21,7 +19,7 @@ export function TableCompactFacts() {
|
|
|
21
19
|
const facts = line.facts.filter((fact) => !fact.besideName);
|
|
22
20
|
if (facts.length === 0)
|
|
23
21
|
return null;
|
|
24
|
-
return (_jsx("span", { className: cn(detailFactsLine, detailFactsWrap, tableCompactLayouts[line.layout].details), "data-slot": "table-detail-line", children: _jsx(DetailFacts, { facts: facts
|
|
22
|
+
return (_jsx("span", { className: cn("relative text-sm text-muted-foreground", detailFactsLine, detailFactsWrap, tableCompactLayouts[line.layout].details), "data-slot": "table-detail-line", children: _jsx(DetailFacts, { facts: facts }) }));
|
|
25
23
|
}
|
|
26
24
|
/** The compact facts that stand beside the name of the row this stands in, which no ellipsis cuts; nothing outside such a row or on a card wide enough for the columns. */
|
|
27
25
|
export function TableCompactNameFacts() {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one reading of when something happened to a record, for `RecordTime` and for a server that writes the time into
|
|
3
|
+
* its own text: Geist's short form in the person's language within a week ("now", "3h ago", "yesterday", "3 h fa"), then the
|
|
4
|
+
* day and month, with the year when it is not this year.
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatRecordTime(at: Date, locale?: string, now?: number, timeZone?: string): string;
|
|
7
|
+
/** The day and month a record's time falls on, with the year when asked: "12 Sep 2025". */
|
|
8
|
+
export declare function formatRecordDay(at: Date, locale: string | undefined, timeZone: string | undefined, withYear: boolean): string;
|
|
9
|
+
//# sourceMappingURL=format-record-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-record-time.d.ts","sourceRoot":"","sources":["../../src/lib/format-record-time.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,IAAI,EACR,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,SAAa,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,CAWR;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAC7B,EAAE,EAAE,IAAI,EACR,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,OAAO,GAChB,MAAM,CAIR"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const DAY = 86_400_000;
|
|
2
|
+
const WEEK = 7 * DAY;
|
|
3
|
+
const UNITS = [
|
|
4
|
+
["day", DAY],
|
|
5
|
+
["hour", 3_600_000],
|
|
6
|
+
["minute", 60_000],
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* The one reading of when something happened to a record, for `RecordTime` and for a server that writes the time into
|
|
10
|
+
* its own text: Geist's short form in the person's language within a week ("now", "3h ago", "yesterday", "3 h fa"), then the
|
|
11
|
+
* day and month, with the year when it is not this year.
|
|
12
|
+
*/
|
|
13
|
+
export function formatRecordTime(at, locale, now = Date.now(), timeZone) {
|
|
14
|
+
const elapsed = now - at.getTime();
|
|
15
|
+
if (elapsed >= 0 && elapsed < WEEK) {
|
|
16
|
+
const relative = new Intl.RelativeTimeFormat(locale, { numeric: "auto", style: "narrow" });
|
|
17
|
+
for (const [unit, size] of UNITS) {
|
|
18
|
+
if (elapsed >= size)
|
|
19
|
+
return relative.format(-Math.floor(elapsed / size), unit);
|
|
20
|
+
}
|
|
21
|
+
return relative.format(0, "second");
|
|
22
|
+
}
|
|
23
|
+
const yearOf = new Intl.DateTimeFormat("en", { timeZone, year: "numeric" });
|
|
24
|
+
return formatRecordDay(at, locale, timeZone, yearOf.format(at) !== yearOf.format(now));
|
|
25
|
+
}
|
|
26
|
+
/** The day and month a record's time falls on, with the year when asked: "12 Sep 2025". */
|
|
27
|
+
export function formatRecordDay(at, locale, timeZone, withYear) {
|
|
28
|
+
const shown = { timeZone, day: "numeric", month: "short" };
|
|
29
|
+
if (withYear)
|
|
30
|
+
shown.year = "numeric";
|
|
31
|
+
return new Intl.DateTimeFormat(locale, shown).format(at);
|
|
32
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compositions.d.ts","sourceRoot":"","sources":["../../../src/showcase/specimens/compositions.tsx"],"names":[],"mappings":"AAuIA,iBAAS,oBAAoB,gCA+B5B;AAMD,iBAAS,wBAAwB,gCAahC;AAED,iBAAS,qBAAqB,gCA0B7B;AAED,iBAAS,yBAAyB,gCAGjC;
|
|
1
|
+
{"version":3,"file":"compositions.d.ts","sourceRoot":"","sources":["../../../src/showcase/specimens/compositions.tsx"],"names":[],"mappings":"AAuIA,iBAAS,oBAAoB,gCA+B5B;AAMD,iBAAS,wBAAwB,gCAahC;AAED,iBAAS,qBAAqB,gCA0B7B;AAED,iBAAS,yBAAyB,gCAGjC;AAwBD,iBAAS,mBAAmB,gCAmC3B;AAED,iBAAS,sBAAsB,gCAyD9B;AAED,iBAAS,yBAAyB,gCAUjC;AAED,iBAAS,qBAAqB,gCAwC7B;AAED,iBAAS,kBAAkB,gCAiB1B;AAED,iBAAS,oBAAoB,gCAS5B;AAED,iBAAS,kBAAkB,gCA0B1B;AAED,iBAAS,kBAAkB,gCAuE1B;AAED,iBAAS,kBAAkB,gCAwB1B;AAED,iBAAS,oBAAoB,gCAkD5B;AAED,iBAAS,oBAAoB,gCAqC5B;AAED,iBAAS,mBAAmB,gCA2B3B;AAED,iBAAS,mBAAmB,gCAoB3B;AAwBD,iBAAS,uBAAuB,gCAkD/B;AA+BD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;CA6FE,CAAC"}
|
|
@@ -161,16 +161,20 @@ const SKILLS = [
|
|
|
161
161
|
detail: "Writes a quote from the price list and the customer's request.",
|
|
162
162
|
icon: "receipt",
|
|
163
163
|
category: "sales",
|
|
164
|
-
|
|
164
|
+
origin: { kind: "library" },
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
name: "Invoice reminders",
|
|
168
168
|
detail: "Reminds a customer of an invoice past its due date, politely, once a week.",
|
|
169
169
|
icon: "mail",
|
|
170
170
|
category: "finance",
|
|
171
|
-
|
|
171
|
+
origin: { kind: "company" },
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "Price list",
|
|
175
|
+
detail: "The shop's prices, kept up to date.",
|
|
176
|
+
origin: { kind: "learned", by: { name: "Giulia" } },
|
|
172
177
|
},
|
|
173
|
-
{ name: "Price list", detail: "The shop's prices, kept up to date.", source: "Added in Nadia" },
|
|
174
178
|
];
|
|
175
179
|
function CatalogRowsSpecimen() {
|
|
176
180
|
const art = useEmptyArt();
|
|
@@ -178,8 +182,19 @@ function CatalogRowsSpecimen() {
|
|
|
178
182
|
category: "Category",
|
|
179
183
|
allCategories: "All categories",
|
|
180
184
|
categoryName: (category) => category.charAt(0).toUpperCase() + category.slice(1),
|
|
181
|
-
source: "Source",
|
|
182
185
|
filter: FILTER_COPY,
|
|
186
|
+
origin: {
|
|
187
|
+
label: "Origin",
|
|
188
|
+
words: {
|
|
189
|
+
company: "Company skill",
|
|
190
|
+
library: "From the Library",
|
|
191
|
+
nadia: "Comes with Nadia",
|
|
192
|
+
added: "Added in Nadia",
|
|
193
|
+
hub: (hub) => `From ${hub}`,
|
|
194
|
+
learned: "Learned",
|
|
195
|
+
learnedBy: (agent) => `Learned by ${agent}`,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
183
198
|
});
|
|
184
199
|
return (_jsx(CollectionPage, { ...rows.list, ...(rows.filters ? { filters: rows.filters } : {}), empty: {
|
|
185
200
|
kind: "firstUse",
|