@tristan2828/ui-foundation 4.110.0 → 4.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,11 +33,11 @@
33
33
  - [A few equal things](#a-few-equal-things) · lines 1427–1511
34
34
  - [An overview page](#an-overview-page) · lines 1513–1576
35
35
  - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1577–1628
36
- - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1630–1698
37
- - [Picking at random](#picking-at-random) · lines 1700–1731
38
- - [Filling in what's missing](#filling-in-whats-missing) · lines 1733–1800
39
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1802–1827
40
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1829–1918
36
+ - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1630–1711
37
+ - [Picking at random](#picking-at-random) · lines 1713–1744
38
+ - [Filling in what's missing](#filling-in-whats-missing) · lines 1746–1813
39
+ - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1815–1840
40
+ - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1842–1931
41
41
 
42
42
  <!-- /index -->
43
43
 
@@ -789,7 +789,7 @@ the `ring` focus ring. A table that fits gets no tab stop and no region.
789
789
  where that reads as small text. The open record tab's name, the open tab
790
790
  of any line tab list (`TabsList variant="line"`, a page's sub-navigation
791
791
  under a section heading, 4.110) and a picked `ChoiceButtons` option wear
792
- it (each tab with a `bg-primary` line, 3px on a record's, the choice with
792
+ it (each tab with a 3px `bg-primary` line and a `bg-primary/12` tint, the choice with
793
793
  a `border-primary` and a `bg-primary/12` fill). The pill look
794
794
  (`TabsList`'s default) keeps its open tab in `--foreground` on the page
795
795
  colour. It's the
@@ -1649,9 +1649,13 @@ its short facts the last tab, Details. A mark goes left of the title.
1649
1649
  - **Tabs** (`tab` on a section): a line tab list under the strip and any
1650
1650
  sections with no tab, one tab per name in the order the sections first
1651
1651
  give it. The look is the record standard's 3B (4.101): 44px tabs in
1652
- 16px semibold (14px under 48rem), the selected one's name in the theme
1653
- colour (`--primary-text`, 4.105) with a 3px primary line under it, the
1654
- others muted; the list's own
1652
+ 16px semibold (14px under 48rem), the others muted. The selected one is
1653
+ plainly marked (4.111): its name bold in the theme colour
1654
+ (`--primary-text`, 4.105), a 3px primary line under it and a primary
1655
+ tint behind it (`bg-primary/12`, as a picked choice); every tab is as
1656
+ wide as its bold name, so choosing one moves none. A page's own line
1657
+ tabs (`TabsList variant="line"`) are marked the same way, semibold
1658
+ over medium. The list's own
1655
1659
  bottom border runs the column's width. A tab's count (`tabCounts`, by
1656
1660
  name: the records it holds) sits beside its name in a small muted
1657
1661
  pill; a tab with none shows no count. A list wider than the column
@@ -1676,6 +1680,15 @@ its short facts the last tab, Details. A mark goes left of the title.
1676
1680
  18rem column beside its sections once the tab is 42rem wide, under
1677
1681
  them below that. Short facts only, never free text: run-on text in a
1678
1682
  narrow box is what the standard took away.
1683
+ - **Several items in one fact** (4.111): linked records, a few tasks,
1684
+ each item marked so a long title that wraps doesn't run into the next.
1685
+ A `list` fact (`{ label: 'Related', kind: 'list', items: [{ name, to,
1686
+ icon }] }`) draws them; an app's own box of several things uses the
1687
+ same `FactList` and `FactListItem`. Each item leads with its kind's
1688
+ icon (the record standard's 4I) when the app gives one, a neutral
1689
+ bullet otherwise, in the muted colour; a wrapped line starts after the
1690
+ mark (a hanging indent), and items have a little room between them.
1691
+ Never a bare stack of links.
1679
1692
  - **The strip** (`KeyStats`) is as wide as its numbers (`width="content"`,
1680
1693
  the default since 4.98), not the page's width.
1681
1694
  - **A mark or avatar** (`leading`): left of the title, top-aligned,
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { StatusKind } from '../../lib/status-kinds.js';
3
3
  import type { EditInPlace } from './edit-in-place.js';
4
+ import type { IconComponent } from './icon-component.js';
4
5
  /** What a fact holds: one of the short kinds a rail can draw. */
5
6
  export type EntityViewFactValue =
6
7
  /** A status, drawn as its StatusMark; `word` is the status's own ("As needed"). */
@@ -41,6 +42,26 @@ export type EntityViewFactValue =
41
42
  name: string;
42
43
  to: string;
43
44
  short: true;
45
+ }
46
+ /**
47
+ * Several items (4.111): linked records, links out, or plain words, each
48
+ * marked by its kind's `icon` or a bullet (FactList), so long titles
49
+ * that wrap still read apart. An item with `to` links in the app, with
50
+ * `href` out of it (a new tab), with neither is its words. None is empty.
51
+ */
52
+ | {
53
+ kind: 'list';
54
+ items: readonly EntityViewFactListItem[];
55
+ };
56
+ /** One item of a `list` fact. */
57
+ export type EntityViewFactListItem = {
58
+ name: string;
59
+ /** A record in the app (`/discussions/3`). */
60
+ to?: string;
61
+ /** A page out of the app, opening in a new tab. */
62
+ href?: string;
63
+ /** Its kind's icon (the record standard's 4I); a bullet without one. */
64
+ icon?: IconComponent;
44
65
  };
45
66
  export type EntityViewFact = EntityViewFactValue & {
46
67
  label: string;
@@ -4,6 +4,7 @@ import { Link } from 'react-router';
4
4
  import { ExternalLinkIcon } from 'lucide-react';
5
5
  import { cn } from 'cn';
6
6
  import { Badge } from '../ui/badge.js';
7
+ import { FactList, FactListItem } from './fact-list.js';
7
8
  import { StatusMark } from './status-mark.js';
8
9
  const LINK_CLASS = 'rounded-sm font-medium text-link underline-offset-4 outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50';
9
10
  /** A fact as the view draws it: `null` when empty. */
@@ -25,6 +26,10 @@ export function factValue(fact) {
25
26
  return fact.to ? (_jsx(Link, { to: fact.to, className: cn(LINK_CLASS, 'tabular-nums'), children: fact.count })) : (_jsx("span", { className: "tabular-nums", children: fact.count }));
26
27
  case 'link':
27
28
  return (_jsxs("a", { href: fact.href, target: "_blank", rel: "noreferrer", className: cn(LINK_CLASS, 'inline-flex max-w-full items-center gap-1'), children: [_jsx("span", { className: "truncate", children: fact.name }), _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] }));
29
+ case 'list':
30
+ if (fact.items.length === 0)
31
+ return null;
32
+ return (_jsx(FactList, { children: fact.items.map((item, index) => (_jsx(FactListItem, { icon: item.icon, children: item.to ? (_jsx(Link, { to: item.to, className: LINK_CLASS, children: item.name })) : item.href ? (_jsxs("a", { href: item.href, target: "_blank", rel: "noreferrer", className: LINK_CLASS, children: [item.name, _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "ml-1 inline size-3.5 align-[-0.125em]" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] })) : (item.name) }, `${index}:${item.name}`))) }));
28
33
  case 'record':
29
34
  return (_jsx(Link, { to: fact.to, title: fact.name, className: cn(LINK_CLASS, 'inline-block max-w-full truncate align-bottom'), children: fact.name }));
30
35
  }
@@ -74,8 +74,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
74
74
  // switch. With no `tab` on any section, nothing changes.
75
75
  //
76
76
  // The tab bar (4.101, record standard 3B): bigger underline tabs (16px
77
- // semibold, 14px on a phone), a 3px primary line under the open one and
78
- // its name in the theme colour (`text-primary-text`, 4.105), each
77
+ // semibold, 14px on a phone), the open one plainly marked (4.111): a 3px
78
+ // primary line, a primary tint behind it (ui/tabs' line look) and its name
79
+ // bold in the theme colour (`text-primary-text`, 4.105), each
79
80
  // tab's count beside its name (`tabCounts`; none for zero). The bar sticks
80
81
  // to the top of whatever scrolls (the page, or a record dialog's body) as
81
82
  // the record scrolls under it, `tabsStickyTop` below the top, and once
@@ -337,7 +338,7 @@ function MainTabs({ tabs, label, railFields = 'beside', title, counts, stickyTop
337
338
  // padding, so the bar sits at the body's own top edge there.
338
339
  style: { top: stickyTop ?? 'var(--entity-view-sticky-top, 0px)' }, className: cn('sticky z-10 -mx-1 flex min-w-0 flex-col gap-1 bg-background px-1 pt-0 data-[stuck]:pt-2 data-[stuck]:shadow-[0_8px_12px_-10px_var(--color-foreground)]', aside !== undefined && FACTS_RAIL.barBeside), children: [stuck && title && (_jsx("p", { "data-slot": "entity-view-tab-bar-title", "aria-hidden": "true", className: "truncate type-label font-semibold text-foreground", children: title })), _jsx(TabsList, { variant: "line", activateOnFocus: true, "aria-label": label, className: "h-auto w-full max-w-full justify-start gap-0 overflow-x-auto overflow-y-hidden border-b border-border p-0 md:gap-1 [scrollbar-width:thin]", children: tabs.map((tab) => {
339
340
  const count = countOf(tab);
340
- return (_jsxs(TabsTrigger, { value: tab.slug, className: "h-11 flex-none gap-1.5 px-2.5 text-sm font-semibold text-muted-foreground group-data-horizontal/tabs:after:bottom-0 group-data-horizontal/tabs:after:h-[3px] after:bg-primary data-active:text-primary-text md:px-4 md:text-base dark:text-muted-foreground dark:data-active:text-primary-text", children: [tab.name, count > 0 && (_jsx("span", { "data-slot": "entity-view-tab-count", className: "rounded-full bg-muted px-1.5 text-xs leading-[1.0625rem] font-medium tabular-nums text-foreground", children: count }))] }, tab.slug));
341
+ return (_jsxs(TabsTrigger, { value: tab.slug, className: "h-11 flex-none gap-1.5 rounded-b-none px-2.5 text-sm font-semibold text-muted-foreground group-data-horizontal/tabs:after:bottom-0 group-data-horizontal/tabs:after:h-[3px] after:bg-primary data-active:font-bold! data-active:text-primary-text md:px-4 md:text-base dark:text-muted-foreground dark:data-active:text-primary-text", children: [_jsx("span", { "data-slot": "entity-view-tab-name", "data-text": tab.name, className: "inline-grid after:invisible after:col-start-1 after:row-start-1 after:h-0 after:font-bold after:content-[attr(data-text)]", children: _jsx("span", { className: "col-start-1 row-start-1", children: tab.name }) }), count > 0 && (_jsx("span", { "data-slot": "entity-view-tab-count", className: "rounded-full bg-muted px-1.5 text-xs leading-[1.0625rem] font-medium tabular-nums text-foreground", children: count }))] }, tab.slug));
341
342
  }) })] }), aside === undefined ? (panels) : (_jsxs("div", { "data-slot": "entity-view-with-facts", className: FACTS_RAIL.columns, children: [panels, aside] }))] }));
342
343
  }
343
344
  // The `tabs` layout's sections (1A): the main column's untabbed sections,
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { IconComponent } from './icon-component.js';
3
+ export type FactListProps = {
4
+ /** FactListItems. */
5
+ children: ReactNode;
6
+ /** The list's name, when nothing beside it (a fact's label) says what it lists. */
7
+ 'aria-label'?: string;
8
+ className?: string;
9
+ };
10
+ /** A list of items, each marked by its icon or a bullet, wrapped lines indented after the mark. */
11
+ export declare function FactList({ children, className, 'aria-label': ariaLabel }: FactListProps): import("react").JSX.Element;
12
+ export type FactListItemProps = {
13
+ children: ReactNode;
14
+ /** The item's kind, drawn before it in the muted colour; a neutral bullet without one. */
15
+ icon?: IconComponent;
16
+ className?: string;
17
+ };
18
+ /** One item of a FactList: its mark, then what it holds, wrapping under itself. */
19
+ export declare function FactListItem({ children, icon: Icon, className }: FactListItemProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from 'cn';
3
+ /** A list of items, each marked by its icon or a bullet, wrapped lines indented after the mark. */
4
+ export function FactList({ children, className, 'aria-label': ariaLabel }) {
5
+ return (_jsx("ul", { "data-slot": "fact-list", "aria-label": ariaLabel, className: cn('flex min-w-0 flex-col gap-1.5', className), children: children }));
6
+ }
7
+ /** One item of a FactList: its mark, then what it holds, wrapping under itself. */
8
+ export function FactListItem({ children, icon: Icon, className }) {
9
+ return (_jsxs("li", { "data-slot": "fact-list-item", className: cn('flex min-w-0 items-start gap-2', className), children: [_jsx("span", { "data-slot": "fact-list-mark", "aria-hidden": "true", className: "flex h-[1lh] w-4 shrink-0 items-center justify-center text-muted-foreground", children: Icon ? _jsx(Icon, { "aria-hidden": "true", className: "size-3.5" }) : _jsx("span", { className: "size-1.5 rounded-full bg-current" }) }), _jsx("div", { className: "min-w-0 flex-1 break-words", children: children })] }));
10
+ }
@@ -20,13 +20,14 @@ function TabsList({ className, variant = "default", ...props }) {
20
20
  return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }), className), ...props }));
21
21
  }
22
22
  function TabsTrigger({ className, ...props }) {
23
- return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/75 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:group-data-[variant=default]/tabs-list:data-active:text-foreground",
23
+ return (_jsx(TabsPrimitive.Tab, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/75 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:rounded-b-none group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-primary/12 dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-primary/12", "data-active:bg-background group-data-[variant=default]/tabs-list:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:group-data-[variant=default]/tabs-list:data-active:text-foreground",
24
24
  // The line look (a page's sub-navigation, a record's tabs): the open
25
- // tab's name and its line in the theme colour (4.110), the name in
26
- // --primary-text where the primary is too faint for small text. A
27
- // closed one is muted, as a record's are. (A closed pill is the text
25
+ // tab stands out (4.111): its name semibold in --primary-text (the
26
+ // primary where it's too faint for small text), a 3px primary line,
27
+ // and a primary tint behind it, as a picked ChoiceButtons option
28
+ // (bg-primary/12). A closed one is muted and medium weight. (A closed pill is the text
28
29
  // at 75%: shadcn's 60% measured 3.45 on Palm LCD's raised surface.)
29
- "group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground", "group-data-[variant=line]/tabs-list:data-active:text-primary-text dark:group-data-[variant=line]/tabs-list:data-active:text-primary-text", "after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className), ...props }));
30
+ "group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:font-semibold", "group-data-[variant=line]/tabs-list:data-active:text-primary-text dark:group-data-[variant=line]/tabs-list:data-active:text-primary-text", "after:absolute after:bg-primary after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:h-[3px] group-data-vertical/tabs:group-data-[variant=line]/tabs-list:after:w-[3px]", className), ...props }));
30
31
  }
31
32
  function TabsContent({ className, ...props }) {
32
33
  return (_jsx(TabsPrimitive.Panel, { "data-slot": "tabs-content", className: cn("flex-1 text-sm outline-none", className), ...props }));
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ export { EmptyText, type EmptyTextProps } from './components/app/empty-value.js'
28
28
  export { isEmptyValue } from './lib/empty-value.js';
29
29
  export { IconAction, type IconActionProps } from './components/app/icon-action.js';
30
30
  export { EntityView, type EntityViewEmptyFields, type EntityViewField, type EntityViewLayout, type EntityViewMobileOrder, type EntityViewPlacement, type EntityViewProps, type EntityViewRailFields, type EntityViewSection, } from './components/app/entity-view.js';
31
- export { type EntityViewFact, type EntityViewFactValue } from './components/app/entity-view-facts.js';
31
+ export { type EntityViewFact, type EntityViewFactListItem, type EntityViewFactValue } from './components/app/entity-view-facts.js';
32
32
  export { entityViewTabSlug } from './lib/entity-view-tab.js';
33
33
  export { usePrinting } from './components/app/print-context.js';
34
34
  export { RecordDialogRoute, RecordLink, type RecordDialogRouteProps, type RecordLinkProps, } from './components/app/record-dialog.js';
@@ -71,6 +71,7 @@ export { PillFilter, type PillFilterOption, type PillFilterProps } from './compo
71
71
  export { SecondaryFilters, type ActiveFilter, type SecondaryFiltersProps } from './components/app/secondary-filters.js';
72
72
  export { FilterBar, FilterSelect, type FilterBarProps, type FilterBarSearch, type FilterSelectOption, type FilterSelectProps, } from './components/app/filter-bar.js';
73
73
  export { FilterDate, type FilterDateProps } from './components/app/filter-date.js';
74
+ export { FactList, FactListItem, type FactListItemProps, type FactListProps } from './components/app/fact-list.js';
74
75
  export { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, type DateFilter, type DateFilterBounds, type DateFilterPreset, } from './lib/date-filter.js';
75
76
  export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, type SessionStageProps, type SessionStageTone, type SessionViewProps, } from './components/app/session-view.js';
76
77
  export { AllowReminders, type AllowRemindersProps } from './components/app/allow-reminders.js';
package/dist/index.js CHANGED
@@ -77,6 +77,7 @@ export { PillFilter } from './components/app/pill-filter.js';
77
77
  export { SecondaryFilters } from './components/app/secondary-filters.js';
78
78
  export { FilterBar, FilterSelect, } from './components/app/filter-bar.js';
79
79
  export { FilterDate } from './components/app/filter-date.js';
80
+ export { FactList, FactListItem } from './components/app/fact-list.js';
80
81
  export { DATE_FILTER_PRESETS, DATE_FILTER_PRESET_LABELS, dateFilterKeeps, dateFilterText, dateRangeValue, parseDateFilter, resolveDateFilter, } from './lib/date-filter.js';
81
82
  export { SessionStage, SessionView, sessionStageLit, sessionStageMain, sessionStageQuiet, } from './components/app/session-view.js';
82
83
  export { AllowReminders } from './components/app/allow-reminders.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.110.0",
3
+ "version": "4.111.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {