@nadicodeai/ui 12.1.183 → 12.1.185
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/collection-filters.d.ts +6 -0
- package/dist/components/collection-filters.d.ts.map +1 -1
- package/dist/components/collection-page.d.ts +1 -1
- package/dist/components/collection-page.d.ts.map +1 -1
- package/dist/components/collection-page.js +3 -2
- 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 +10 -10
- package/package.json +6 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronRight } from "lucide-react";
|
|
4
3
|
import { createContext, useContext, useId } from "react";
|
|
5
4
|
import { ActionMenu } from "./action-menu.js";
|
|
6
5
|
import { Checkbox } from "./checkbox.js";
|
|
@@ -14,7 +13,6 @@ import { Skeleton, SkeletonRegion } from "./skeleton.js";
|
|
|
14
13
|
import { StatusBadge } from "./status-badge.js";
|
|
15
14
|
import { TableCard } from "./table-card.js";
|
|
16
15
|
import { TableValue } from "./table-value.js";
|
|
17
|
-
import { soleMenuButton } from "../internal/record-menu-items.js";
|
|
18
16
|
import { RowMessageActions, RowMessageLine } from "../internal/row-message.js";
|
|
19
17
|
import { CompactOnly, WideOnly } from "../internal/table-compact-line.js";
|
|
20
18
|
const CELL_START = 8;
|
|
@@ -28,26 +26,16 @@ const BUTTON_LABEL_INSET = 6;
|
|
|
28
26
|
const BUTTON_ICON_SLOT = 20;
|
|
29
27
|
const BUTTON_ICON_GAP = 3;
|
|
30
28
|
const EXTERNAL_ARROW = 14;
|
|
31
|
-
const CHEVRON = 16;
|
|
32
29
|
const WIDEST_LABEL_CHARACTER = 8;
|
|
33
30
|
function shownCommands(list, record) {
|
|
34
31
|
const menu = list.menu?.(record);
|
|
35
32
|
const commands = menu?.commands ?? [];
|
|
36
33
|
const own = list.command?.(record);
|
|
37
34
|
const ownButtons = own ? [own].flat() : [];
|
|
38
|
-
// A sole menu command is the row's button on a wide card and stays in the dots on a compact one.
|
|
39
|
-
const menuButton = own || list.layout === "line" ? undefined : soleMenuButton(commands);
|
|
40
35
|
const state = list.state?.(record) ?? null;
|
|
41
36
|
const dots = menu && commands.length > 0 ? menu : undefined;
|
|
42
37
|
const opens = Boolean(list.open?.href(record)) && !state;
|
|
43
|
-
return {
|
|
44
|
-
besideDots: menuButton ? [menuButton] : ownButtons,
|
|
45
|
-
underName: ownButtons,
|
|
46
|
-
menuButton,
|
|
47
|
-
state,
|
|
48
|
-
dots,
|
|
49
|
-
opens,
|
|
50
|
-
};
|
|
38
|
+
return { besideDots: ownButtons, underName: ownButtons, state, dots, opens };
|
|
51
39
|
}
|
|
52
40
|
function buttonRoom(command, size) {
|
|
53
41
|
const longerLabel = Math.max(command.label.length, command.pendingLabel?.length ?? 0);
|
|
@@ -57,19 +45,15 @@ function buttonRoom(command, size) {
|
|
|
57
45
|
longerLabel * WIDEST_LABEL_CHARACTER);
|
|
58
46
|
}
|
|
59
47
|
function commandsRoom(list, record) {
|
|
60
|
-
const { besideDots,
|
|
61
|
-
const wideDots = dots && !menuButton;
|
|
62
|
-
const chevron = opens && !wideDots;
|
|
48
|
+
const { besideDots, state, dots } = shownCommands(list, record);
|
|
63
49
|
const widths = [
|
|
64
50
|
...besideDots.map((command) => buttonRoom(command, "sm")),
|
|
65
51
|
...(state?.message.actions ?? []).map((action) => buttonRoom(action, "default")),
|
|
66
52
|
];
|
|
67
53
|
if (widths.length === 0)
|
|
68
54
|
return DOTS_ALONE_SIZE;
|
|
69
|
-
if (
|
|
55
|
+
if (dots)
|
|
70
56
|
widths.push(TOUCH_TARGET);
|
|
71
|
-
if (chevron)
|
|
72
|
-
widths.push(CHEVRON);
|
|
73
57
|
const room = CELL_START +
|
|
74
58
|
widths.reduce((sum, width) => sum + width, 0) +
|
|
75
59
|
COMMANDS_GAP * (widths.length - 1) +
|
|
@@ -158,12 +142,11 @@ function ChecklistCell({ row }) {
|
|
|
158
142
|
function CommandsCell({ row }) {
|
|
159
143
|
const list = useShownList();
|
|
160
144
|
const record = row.original;
|
|
161
|
-
const { besideDots,
|
|
145
|
+
const { besideDots, state, dots } = shownCommands(list, record);
|
|
162
146
|
const menu = dots ? (_jsx(ActionMenu, { commands: dots.commands, label: dots.label, record: list.name(record).name })) : null;
|
|
163
|
-
|
|
164
|
-
if (besideDots.length === 0 && !state && !menu && !chevron)
|
|
147
|
+
if (besideDots.length === 0 && !state && !menu)
|
|
165
148
|
return null;
|
|
166
|
-
return (_jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsxs(WideOnly, { children: [besideDots.length > 0 ? (_jsx("div", { className: "flex min-w-0 justify-end gap-2 *:max-w-full *:min-w-0 *:shrink [&>*>span:not([data-icon])]:truncate", children: besideDots.map((command) => (_jsx(PageCommandButton, { command: command, size: "sm", variant: "outline" }, command.label))) })) : null, state ? _jsx(RowMessageActions, { state: state }) : null] }), menu
|
|
149
|
+
return (_jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsxs(WideOnly, { children: [besideDots.length > 0 ? (_jsx("div", { className: "flex min-w-0 justify-end gap-2 *:max-w-full *:min-w-0 *:shrink [&>*>span:not([data-icon])]:truncate", children: besideDots.map((command) => (_jsx(PageCommandButton, { command: command, size: "sm", variant: "outline" }, command.label))) })) : null, state ? _jsx(RowMessageActions, { state: state }) : null] }), menu] }));
|
|
167
150
|
}
|
|
168
151
|
function LoadingRecords({ label }) {
|
|
169
152
|
return (_jsx("div", { "aria-busy": "true", "aria-label": label, className: "divide-y divide-border", role: "status", children: Array.from({ length: 3 }, (_, index) => (_jsxs("div", { className: "flex items-center gap-4 px-2 py-4", children: [_jsx(Skeleton, { className: "shrink-0", height: 32, width: 32 }), _jsxs("div", { className: "grid min-w-0 gap-2", children: [_jsx(Skeleton, { className: "max-w-full", height: 16, width: 160 }), _jsx(Skeleton, { className: "max-w-full", height: 16, width: 224 })] }), _jsx(Skeleton, { className: "ml-auto", height: 16, width: 92 })] }, index))) }));
|
|
@@ -293,7 +276,7 @@ function RecordRows(props) {
|
|
|
293
276
|
* @instead “For tabular data with sortable columns and shared row shape, use `Table` instead.” (https://vercel.com/geist/entity)
|
|
294
277
|
* “For a static key/value metadata block on a detail page, use `Description`.” (https://vercel.com/geist/entity)
|
|
295
278
|
* Ours: Geist's `Table` is a `DataTable`: this list has no visible headings and at most three facts, so a fourth fact is a table, and anything more than a few facts lives on the record's page. A screen gives `RecordList` the records and what each one says, never its own toolbar, table, rows or menus, and nothing else draws a record row. Its `Description` is `ObjectFacts`. Events in time are an `ActivityFeed`. Reusable things a person adds from a catalogue are a `LibraryShelf`. A descriptive row with prose is an `Item`.
|
|
296
|
-
* @behaviour One bordered card, a 1 px rule between records and none after the last. A row is 72 px, with 16 px above and below, and its columns stand left to right at the widths the list declares, so a person reads every list the same way: the `select` box (40 px, only when the list is picked from, an optional column), the identity (the rest: the one column without a size), the facts (each its `size`), the status (`status.size`), the time (`time.size`, tabular), the `checklist` ring (52 px, only when the record has steps to be ready) and the commands (as wide as the widest row's buttons, a failed action's next steps and the three dots
|
|
279
|
+
* @behaviour One bordered card, a 1 px rule between records and none after the last. A row is 72 px, with 16 px above and below, and its columns stand left to right at the widths the list declares, so a person reads every list the same way: the `select` box (40 px, only when the list is picked from, an optional column), the identity (the rest: the one column without a size), the facts (each its `size`), the status (`status.size`), the time (`time.size`, tabular), the `checklist` ring (52 px, only when the record has steps to be ready) and the commands (as wide as the widest row's buttons, a failed action's next steps and the three dots after them need, worked out from their labels, each label at most 8 px a character and a button holding the longer of its label and its pending label, the dots at their 44 px touch target; 64 px for the three dots alone; a row that draws a button or next steps is never narrower than a `commandsSize` the caller gives). A `checklist` puts the record's `ProgressChecklist` ring just before its commands, where Vercel ends a project's row with its Production Checklist; the ring opens its own drawer, never the row. Every row has its 32 px mark, its name (600) and, under it, one muted 14 px line; `name` and the mark are required; a record with nothing to say under its name leaves the line out and is the name alone, never a dash. Give every column a `size` in pixels; the name takes the rest. With `layout="line"`, as on Vercel's Projects page, the facts and the status share one muted line, joined by a middle dot, in a column as wide as the name's, and the row stays one line (mark, name over its line, that summary, the time, the ring, the three dots) on a card wide enough for its sized columns and 160 px each for the name and the summary, and on a narrower card the summary and the time move under the name as muted text joined by a middle dot that wraps, the status keeping its mark whole and breaking between its words only when it alone is wider than the line, in the same row, their labels read by assistive technology only. Rows of `columns` follow the same rule once the card is narrower than their columns: the facts and the time leave the row for that muted text, wrapping so every value stays readable, never a labelled list, and the status stands beside the name, which ends in an ellipsis before it, so the exception is never the part a phone's line cuts. `facts` takes at most three. A menu keeps every command in the three dots, one alone included, as Vercel's Environment Variables and Members rows do: a button stands on a row only where the list names it as `command`, the record's main job, on every row that can do it, so one list never mixes rows ending in a button with rows ending in dots. The commands never take the name's room: once the row is compact, its commands column holds only the three dots and the row's own buttons stand under the name, beside a failed action's next steps, outside the row's link, so pressing one never opens the record. Status is only for the exception, empty for the usual record, and its column stands only while a record in the list shows one, so the name and its line keep the room; a fact's column likewise stands only while a record in the list has its value; the commands column likewise stands only while a record has a command, a menu or a message, or the rows open, and it widens for a failed action's next steps only while a row shows one. Never the three dots before the button, a decorative icon for the record's mark, a status on every row, or a destructive button on every row: a destructive command stays in the three dots. A `line` row's summary joins only the facts the record has, so it never ends in a dot. A failed or refused action of the record shows as its catalogue message inside its own row, never a notice under the row: it replaces the detail line, with its next steps beside its commands, or under the message on a card too narrow for the row's columns. With `open` the whole row is one target and takes the `accent` hover, with no chevron, as Vercel's Deployments rows open theirs; a row that opens nothing never reacts to hover. Opening is the row's alone: the three dots never hold a command that only shows the record (*Details*, *View*, *Open*). With `editor` the record's row opens its form under its line. `empty` is required: `null` is the choice to draw nothing for a list with no records, and any other value is the state it draws. A note about the whole list is `footer.note`: one muted line, an optional *Learn more* after it at the left and one secondary action at the right, in a strip of its own under the count and the paging, as Vercel ends its deployments list ("Deployment retention is enabled. Learn more", *View recently deleted*). Colour is neutral, the name in ink and every other cell in the body grey, except the status badge and a failed action's message.
|
|
297
280
|
* “Pick the variant by what the user needs: no-results for a filtered list that returned zero rows, blank slate or informational for a resource the user hasn’t created, cleared for completed work, permission for role or tier denials, error for a failed load.” (https://vercel.com/geist/empty-state)
|
|
298
281
|
* Ours: `failed`, `noMatch` and `empty` are those variants, drawn inside the card.
|
|
299
282
|
* “The right column holds at most one or two controls. If the row needs more, move secondary actions into a `Dots Menu`.” (https://vercel.com/geist/entity)
|
|
@@ -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
|
+
}
|