@cosmicdrift/kumiko-renderer 0.415.0 → 0.416.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.
Files changed (117) hide show
  1. package/dist/app/action-form-body.d.ts +1 -1
  2. package/dist/app/action-form-body.js +43 -16
  3. package/dist/app/action-form-support.d.ts +4 -1
  4. package/dist/app/action-form-support.js +8 -4
  5. package/dist/app/client-actions.js +6 -4
  6. package/dist/app/config-edit-body.js +13 -4
  7. package/dist/app/extension-sections.d.ts +2 -0
  8. package/dist/app/projection-detail-body.js +8 -6
  9. package/dist/app/projection-detail-guidance.d.ts +1 -1
  10. package/dist/app/projection-detail-guidance.js +38 -26
  11. package/dist/app/projection-detail-header-model.d.ts +1 -1
  12. package/dist/app/projection-detail-header-model.js +10 -5
  13. package/dist/app/projection-detail-header.js +1 -1
  14. package/dist/app/projection-detail-navigation.d.ts +4 -0
  15. package/dist/app/projection-detail-navigation.js +5 -1
  16. package/dist/app/screen-shared.d.ts +1 -0
  17. package/dist/app/screen-shared.js +23 -3
  18. package/dist/app/use-projection-detail-actions.d.ts +13 -0
  19. package/dist/app/use-projection-detail-actions.js +14 -2
  20. package/dist/app/use-projection-detail-data.d.ts +2 -0
  21. package/dist/app/use-projection-detail-data.js +37 -10
  22. package/dist/components/ai-assist-payload.d.ts +2 -0
  23. package/dist/components/ai-assist-payload.js +8 -0
  24. package/dist/components/edit-mounts.d.ts +3 -2
  25. package/dist/components/edit-mounts.js +2 -2
  26. package/dist/components/multi-select-chips.d.ts +10 -0
  27. package/dist/components/multi-select-chips.js +18 -0
  28. package/dist/components/related-list-section.js +44 -32
  29. package/dist/components/related-photo-grid.d.ts +11 -0
  30. package/dist/components/related-photo-grid.js +40 -0
  31. package/dist/components/render-edit-action-button.d.ts +2 -2
  32. package/dist/components/render-edit-field-grid.js +3 -3
  33. package/dist/components/render-edit-header-actions.d.ts +2 -1
  34. package/dist/components/render-edit-header-actions.js +18 -1
  35. package/dist/components/render-edit-layout.js +2 -2
  36. package/dist/components/render-edit-logic.js +1 -0
  37. package/dist/components/render-edit-section-kinds.js +11 -0
  38. package/dist/components/render-edit-types.d.ts +11 -1
  39. package/dist/components/render-field-ai-assist.d.ts +13 -0
  40. package/dist/components/render-field-ai-assist.js +89 -0
  41. package/dist/components/render-field-choice-inputs.js +4 -0
  42. package/dist/components/render-field-control.d.ts +1 -1
  43. package/dist/components/render-field-control.js +18 -8
  44. package/dist/components/render-field-value-chips.d.ts +9 -0
  45. package/dist/components/render-field-value-chips.js +45 -0
  46. package/dist/components/render-field-write-only.js +12 -4
  47. package/dist/components/render-list-hint-columns.d.ts +1 -0
  48. package/dist/components/render-list-hint-columns.js +13 -0
  49. package/dist/components/use-render-edit-sections.js +5 -1
  50. package/dist/components/use-render-list-columns.js +3 -3
  51. package/dist/headless/format/index.d.ts +1 -0
  52. package/dist/headless/format/index.js +20 -0
  53. package/dist/headless/format/phone.d.ts +1 -0
  54. package/dist/headless/format/phone.js +8 -0
  55. package/dist/headless/format/relative-time.d.ts +13 -0
  56. package/dist/headless/format/relative-time.js +60 -0
  57. package/dist/headless/format/safe-locale.d.ts +1 -0
  58. package/dist/headless/format/safe-locale.js +13 -0
  59. package/dist/headless/index.d.ts +2 -2
  60. package/dist/headless/index.js +2 -2
  61. package/dist/headless/view-model/edit.d.ts +3 -2
  62. package/dist/headless/view-model/edit.js +78 -2
  63. package/dist/headless/view-model/field-text.d.ts +9 -0
  64. package/dist/headless/view-model/field-text.js +19 -0
  65. package/dist/headless/view-model/index.d.ts +1 -0
  66. package/dist/headless/view-model/index.js +1 -0
  67. package/dist/headless/view-model/types.d.ts +29 -3
  68. package/dist/i18n-defaults.js +2 -0
  69. package/dist/index.d.ts +1 -1
  70. package/dist/primitives-record-guidance.d.ts +28 -1
  71. package/dist/primitives.d.ts +10 -3
  72. package/dist/web/app/dashboard-body.js +3 -2
  73. package/dist/web/app/dashboard-list-panel.js +1 -0
  74. package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
  75. package/dist/web/app/dashboard-panel-columns.js +14 -0
  76. package/dist/web/app/dashboard-shared.js +1 -1
  77. package/dist/web/app/dashboard-stat-group-panel.js +9 -2
  78. package/dist/web/app/dashboard-text-panel.d.ts +1 -0
  79. package/dist/web/app/dashboard-text-panel.js +11 -9
  80. package/dist/web/app/relative-time.d.ts +0 -5
  81. package/dist/web/app/relative-time.js +1 -20
  82. package/dist/web/primitives/banner.js +11 -6
  83. package/dist/web/primitives/data-table/card-body.js +2 -2
  84. package/dist/web/primitives/data-table/card-row.js +7 -2
  85. package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -0
  86. package/dist/web/primitives/data-table/data-cell-props.js +2 -0
  87. package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
  88. package/dist/web/primitives/data-table/row-click-guard.js +19 -0
  89. package/dist/web/primitives/data-table/table-body.js +2 -1
  90. package/dist/web/primitives/data-table/table-content.js +6 -2
  91. package/dist/web/primitives/data-table-cell.d.ts +4 -1
  92. package/dist/web/primitives/data-table-cell.js +16 -2
  93. package/dist/web/primitives/default-form.js +6 -3
  94. package/dist/web/primitives/drawer.js +5 -1
  95. package/dist/web/primitives/form-footer-parts.js +4 -1
  96. package/dist/web/primitives/form.js +6 -8
  97. package/dist/web/primitives/index.js +4 -0
  98. package/dist/web/primitives/layout-elements.d.ts +1 -1
  99. package/dist/web/primitives/layout-elements.js +2 -2
  100. package/dist/web/primitives/locale-number.d.ts +0 -1
  101. package/dist/web/primitives/locale-number.js +1 -13
  102. package/dist/web/primitives/money-input.js +2 -1
  103. package/dist/web/primitives/narrow-pinned-footer.js +7 -3
  104. package/dist/web/primitives/number-input.js +2 -1
  105. package/dist/web/primitives/photo-grid.d.ts +3 -0
  106. package/dist/web/primitives/photo-grid.js +5 -0
  107. package/dist/web/primitives/record-steps.d.ts +1 -1
  108. package/dist/web/primitives/record-steps.js +4 -4
  109. package/dist/web/primitives/record-summary.d.ts +1 -1
  110. package/dist/web/primitives/record-summary.js +8 -3
  111. package/dist/web/primitives/step-list.d.ts +3 -0
  112. package/dist/web/primitives/step-list.js +11 -0
  113. package/dist/web/widgets/dashboard-list.d.ts +2 -0
  114. package/dist/web/widgets/dashboard-list.js +2 -2
  115. package/dist/web/widgets/drawer-panel-class.js +1 -1
  116. package/package.json +5 -5
  117. package/src/changes.json +54 -0
@@ -42,35 +42,40 @@ function BannerParts({ parts }) {
42
42
  return part.strong === true ? (_jsx("strong", { className: "font-semibold", children: part.text }, key)) : (_jsx("span", { children: part.text }, key));
43
43
  });
44
44
  }
45
- function BannerText({ compact, title: fullTitle, narrowTitle, narrowText, titleTestId, children: fullText, parts, actionsBelow, inline, }) {
45
+ function BannerText({ compact, title: fullTitle, narrowTitle, narrowText, titleTestId, children: fullText, parts, actionsBelow, inline, wrapsActions, }) {
46
46
  const narrow = useIsBelowSmViewport();
47
47
  const title = narrow && narrowTitle !== undefined ? narrowTitle : fullTitle;
48
48
  const showsNarrowText = narrow && narrowText !== undefined;
49
49
  const children = showsNarrowText ? narrowText : fullText;
50
50
  if (compact || inline) {
51
- return (_jsxs("div", { className: "min-w-0 grow", children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), _jsxs("span", { className: cn(inline && !showsNarrowText && "max-sm:hidden"), children: [children, !showsNarrowText && _jsx(BannerParts, { parts: parts })] })] }));
51
+ return (_jsxs("div", { className: cn("min-w-0 grow", wrapsActions && "max-sm:min-w-[10rem] max-sm:basis-0"), children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), _jsxs("span", { className: cn(inline && !showsNarrowText && "max-sm:hidden"), children: [children, !showsNarrowText && _jsx(BannerParts, { parts: parts })] })] }));
52
52
  }
53
- return (_jsxs("div", { className: "flex-1", children: [title !== undefined && (_jsx("div", { "data-testid": titleTestId, className: "font-semibold", children: title })), children, !showsNarrowText && _jsx(BannerParts, { parts: parts }), actionsBelow] }));
53
+ return (_jsxs("div", { className: "min-w-0 flex-1", children: [title !== undefined && (_jsx("div", { "data-testid": titleTestId, className: "font-semibold", children: title })), children, !showsNarrowText && _jsx(BannerParts, { parts: parts }), actionsBelow] }));
54
54
  }
55
- function bannerLayoutClass(variant, compact, actionsBelow) {
55
+ function bannerLayoutClass(variant, compact, actionsBelow, wrapsActions) {
56
56
  return cn("relative flex w-full items-center border", compact ? "gap-2 rounded-md px-2.5 py-2 text-[13px]" : "gap-3 rounded-lg px-3.5 py-2.5 text-sm",
57
57
  // Viewport breakpoint like the form footer bar; actions drop below the text on phones.
58
58
  !compact &&
59
59
  !actionsBelow &&
60
60
  variant === "primary" &&
61
- "flex-col items-start sm:flex-row sm:items-center", actionsBelow && "items-start", variantClass(variant, compact));
61
+ "flex-col items-start sm:flex-row sm:items-center", actionsBelow && "items-start", wrapsActions && "max-sm:flex-wrap", variantClass(variant, compact));
62
+ }
63
+ // On phones the actions leave the text line and wrap below it instead of squeezing the text.
64
+ function wrapsActionsOnPhone(variant, compact, actionsBelow, hasActions) {
65
+ return !compact && !actionsBelow && hasActions && variant !== "primary";
62
66
  }
63
67
  export function DefaultBanner({ variant = "info", density = "default", icon, title, narrowTitle, narrowText, titleTestId, children, parts, actions, actionsPlacement = "end", padded, inline = false, testId, id, }) {
64
68
  const isError = variant === "error";
65
69
  const compact = density === "compact";
66
70
  // A compact banner is one line, so its actions always stay at the end.
67
71
  const actionsBelow = actionsPlacement === "below" && !compact && actions !== undefined;
72
+ const wrapsActions = wrapsActionsOnPhone(variant, compact, actionsBelow, actions !== undefined);
68
73
  // `id` is set when a <Field> wraps this Banner as its control (see
69
74
  // BannerProps.id). A <div> isn't labelable, so a <label htmlFor> pointing
70
75
  // at it is inert for screen readers — role="group" + aria-labelledby is
71
76
  // the actual mechanism, pointed at the label id Field emits (fieldLabelId).
72
77
  const bannerRole = id !== undefined ? "group" : isError ? "alert" : undefined;
73
- const banner = (_jsxs("div", { role: bannerRole, ...(id !== undefined && { "aria-labelledby": fieldLabelId(id) }), "data-testid": testId, "data-variant": variant, "data-density": density, className: bannerLayoutClass(variant, compact, actionsBelow), children: [icon !== undefined && (_jsx(Icon, { name: icon, className: cn("size-3.5 shrink-0", ICON_COLOR_CLASS[variant]) })), _jsx(BannerText, { compact: compact, inline: inline, title: title, narrowTitle: narrowTitle, narrowText: narrowText, titleTestId: titleTestId, parts: parts, actionsBelow: actionsBelow ? (_jsx("div", { "data-slot": "actions", className: "mt-3 flex flex-wrap gap-2", children: actions })) : undefined, children: children }), !actionsBelow && actions !== undefined && (_jsx("div", { "data-slot": "actions", className: cn(compact && "shrink-0"), children: actions }))] }));
78
+ const banner = (_jsxs("div", { role: bannerRole, ...(id !== undefined && { "aria-labelledby": fieldLabelId(id) }), "data-testid": testId, "data-variant": variant, "data-density": density, className: bannerLayoutClass(variant, compact, actionsBelow, wrapsActions), children: [icon !== undefined && (_jsx(Icon, { name: icon, className: cn("size-3.5 shrink-0", ICON_COLOR_CLASS[variant]) })), _jsx(BannerText, { compact: compact, inline: inline, wrapsActions: wrapsActions, title: title, narrowTitle: narrowTitle, narrowText: narrowText, titleTestId: titleTestId, parts: parts, actionsBelow: actionsBelow ? (_jsx("div", { "data-slot": "actions", className: "mt-3 flex flex-wrap gap-2", children: actions })) : undefined, children: children }), !actionsBelow && actions !== undefined && (_jsx("div", { "data-slot": "actions", className: cn(compact && "shrink-0", wrapsActions && "max-sm:flex max-sm:w-full max-sm:flex-wrap max-sm:gap-2"), children: actions }))] }));
74
79
  // Page state: the banner sits alone in main (which no longer has padding).
75
80
  // The wrapper adds 24px outer spacing so the banner does not stick
76
81
  // edge-to-edge to the sidebar/browser.
@@ -56,10 +56,10 @@ export function renderCardLinks(m, row, linkColumns) {
56
56
  return (_jsx("div", { "data-testid": `card-links-${row.id}`, className: "flex flex-wrap items-center gap-x-3 text-[13px] leading-5", children: linkColumns.map((col) => (_jsx("span", { "data-testid": cellTestIdOf(m, row, col.field), children: cardCell(m, row, col, { linksAllowed: true }) }, col.field))) }));
57
57
  }
58
58
  function renderMetaCell(m, row, col) {
59
- return (_jsx("div", { "data-testid": cellTestIdOf(m, row, col.field), className: "min-w-0 truncate leading-5", onPointerEnter: showFullTextOnHover, children: isBadgeColumn(col) ? (_jsx("span", { className: "inline-flex align-middle", children: cardCell(m, row, col) })) : (cardCell(m, row, col)) }, col.field));
59
+ return (_jsx("div", { "data-testid": cellTestIdOf(m, row, col.field), className: "min-w-0 max-w-full truncate leading-5", onPointerEnter: showFullTextOnHover, children: isBadgeColumn(col) ? (_jsx("span", { className: "inline-flex align-middle", children: cardCell(m, row, col) })) : (cardCell(m, row, col)) }, col.field));
60
60
  }
61
61
  function renderCardMeta(m, row, metaColumns) {
62
- return (_jsx("div", { className: "min-w-0", children: _jsx("div", { "data-testid": `card-meta-${row.id}`, className: "flex min-w-0 flex-col text-[13px] leading-5 tabular-nums text-foreground-secondary", children: cardMetaLines(metaColumns).map((line) => line[0]?.narrowInline === true ? (_jsx("div", { "data-testid": `card-vals-${row.id}-${line[0].field}`, className: "mt-1 flex h-5 min-w-0 max-w-full items-center gap-3 text-[12.5px]", children: line.map((col) => renderMetaCell(m, row, col)) }, line.map((col) => col.field).join("|"))) : (_jsx("div", { className: "flex h-5 min-w-0 max-w-full items-center", children: line.map((col) => renderMetaCell(m, row, col)) }, line.map((col) => col.field).join("|")))) }) }));
62
+ return (_jsx("div", { className: "min-w-0", children: _jsx("div", { "data-testid": `card-meta-${row.id}`, className: "flex min-w-0 flex-col text-[13px] leading-5 tabular-nums text-foreground-secondary", children: cardMetaLines(metaColumns).map((line) => line[0]?.narrowInline === true ? (_jsx("div", { "data-testid": `card-vals-${row.id}-${line[0].field}`, className: "mt-1 flex min-w-0 max-w-full flex-wrap items-center gap-x-3 gap-y-0.5 text-[12.5px] leading-5", children: line.map((col) => renderMetaCell(m, row, col)) }, line.map((col) => col.field).join("|"))) : (_jsx("div", { className: "flex h-5 min-w-0 max-w-full items-center", children: line.map((col) => renderMetaCell(m, row, col)) }, line.map((col) => col.field).join("|")))) }) }));
63
63
  }
64
64
  function renderCardLead(m, row, lead) {
65
65
  if (lead === undefined || isEmptyCellValue(row.values[lead.field]))
@@ -5,6 +5,7 @@ import { cardToneClass } from "../data-table-cell.js";
5
5
  import { RowActionsCell } from "../row-actions.js";
6
6
  import { renderCardBody, renderCardLinks, splitLinkColumns } from "./card-body.js";
7
7
  import { CARD_SURFACE_CLASS, hasSeparateCardRows } from "./card-frame.js";
8
+ import { rowClickHandler } from "./row-click-guard.js";
8
9
  import { renderExpandToggle, renderExpansion } from "./row-render-parts.js";
9
10
  // The card's <li> opens the row on click; controls inside must not reach it.
10
11
  function renderStopPropagation(className, testId, children) {
@@ -14,7 +15,11 @@ function renderCardMenu(m, row, menuActions) {
14
15
  return renderStopPropagation("shrink-0", undefined, _jsx(RowActionsCell, { row: row, actions: menuActions, mode: m.rowActionMode, rowIsLink: m.onRowClick !== undefined, compact: true }));
15
16
  }
16
17
  function renderCardOpenButton(openRow, body) {
17
- return (_jsx("button", { type: "button", className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 bg-transparent p-0 text-left", onKeyDown: (e) => {
18
+ return (_jsx("button", { type: "button", className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 bg-transparent p-0 text-left", onClick: (e) => {
19
+ // The card's click guard skips clicks on buttons, so this one opens the row itself.
20
+ e.stopPropagation();
21
+ openRow();
22
+ }, onKeyDown: (e) => {
18
23
  if (e.key !== "Enter")
19
24
  return;
20
25
  e.preventDefault();
@@ -59,7 +64,7 @@ export function renderCard(m, row, roles) {
59
64
  const toned = toneClass !== "";
60
65
  const rowItem = (_jsxs("li", { "data-testid": m.rowTestId(row), "data-tone": rowTone?.(row), className: cn(cardRowBaseClass(m), toneClass,
61
66
  // A toned card already pads past its inner 4px stripe (see cardToneClass); a later pl-* would override it.
62
- !toned && cardLeftPadding(m.expansion !== undefined || m.selection.active), hasMenu ? "pr-2" : "pr-4", m.density.card), ...(openRow !== undefined && { onClick: openRow }), children: [m.selection.cardCheckbox(row), renderExpandToggle(m, row), linkColumns.length > 0 || hasButtons ? (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [main, linkColumns.length > 0 && renderCardLinks(m, row, linkColumns), hasButtons && renderCardButtons(m, row, buttonActions)] })) : (main), hasMenu && renderCardMenu(m, row, menuActions)] }, row.id));
67
+ !toned && cardLeftPadding(m.expansion !== undefined || m.selection.active), hasMenu ? "pr-2" : "pr-4", m.density.card), ...(openRow !== undefined && { onClick: rowClickHandler(openRow) }), children: [m.selection.cardCheckbox(row), renderExpandToggle(m, row), linkColumns.length > 0 || hasButtons ? (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [main, linkColumns.length > 0 && renderCardLinks(m, row, linkColumns), hasButtons && renderCardButtons(m, row, buttonActions)] })) : (main), hasMenu && renderCardMenu(m, row, menuActions)] }, row.id));
63
68
  if (m.expansion === undefined)
64
69
  return rowItem;
65
70
  // The expansion is a sibling <li>, outside the row's click target, so
@@ -8,5 +8,7 @@ export declare function columnCellPresentationProps(col: ListColumnViewModel): {
8
8
  display?: import("../../../headless/index.ts").ListColumnCellDisplay | undefined;
9
9
  badgeToneField?: string | undefined;
10
10
  badgeDot?: false | undefined;
11
+ pillField?: string | undefined;
12
+ pillToneField?: string | undefined;
11
13
  emptyPlaceholder?: false | undefined;
12
14
  };
@@ -8,6 +8,8 @@ export function columnCellPresentationProps(col) {
8
8
  ...(col.display !== undefined && { display: col.display }),
9
9
  ...(col.badgeToneField !== undefined && { badgeToneField: col.badgeToneField }),
10
10
  ...(col.badgeDot !== undefined && { badgeDot: col.badgeDot }),
11
+ ...(col.pillField !== undefined && { pillField: col.pillField }),
12
+ ...(col.pillToneField !== undefined && { pillToneField: col.pillToneField }),
11
13
  ...(col.emptyPlaceholder !== undefined && { emptyPlaceholder: col.emptyPlaceholder }),
12
14
  };
13
15
  }
@@ -0,0 +1,2 @@
1
+ import type { MouseEvent } from "react";
2
+ export declare function rowClickHandler(openRow: (() => void) | undefined): ((event: MouseEvent<HTMLElement>) => void) | undefined;
@@ -0,0 +1,19 @@
1
+ const INTERACTIVE_SELECTOR = "a[href], button, input, select, textarea, label, [role='button'], [role='link'], [role='switch'], [role='checkbox'], [role='menuitem'], [contenteditable='true']";
2
+ // React bubbles synthetic events through portals, so a click inside a drawer
3
+ // rendered from a custom cell reaches the row even though its DOM is elsewhere.
4
+ export function rowClickHandler(openRow) {
5
+ if (openRow === undefined)
6
+ return undefined;
7
+ return (event) => {
8
+ const { target, currentTarget } = event;
9
+ if (!(target instanceof Element) || !currentTarget.contains(target))
10
+ return;
11
+ const interactive = target.closest(INTERACTIVE_SELECTOR);
12
+ if (interactive !== null &&
13
+ interactive !== currentTarget &&
14
+ currentTarget.contains(interactive)) {
15
+ return;
16
+ }
17
+ openRow();
18
+ };
19
+ }
@@ -6,6 +6,7 @@ import { HintReasonRowScope, hintReasonOf } from "../hint-reason-row.js";
6
6
  import { RowActionsCell } from "../row-actions.js";
7
7
  import { ActionsBodyCell } from "./actions-column.js";
8
8
  import { bandClassName, bandReactKey, bandTestId } from "./group-band.js";
9
+ import { rowClickHandler } from "./row-click-guard.js";
9
10
  import { renderBand, renderExpandToggle, renderExpansion } from "./row-render-parts.js";
10
11
  import { EXPAND_TOGGLE_CELL_CLASS } from "./table-chrome.js";
11
12
  import { renderDataCell } from "./table-data-cell.js";
@@ -26,7 +27,7 @@ function renderDataRow(m, row) {
26
27
  const opensOnClick = openRow !== undefined;
27
28
  const keyboard = m.keyboardRow(row.id, openRow);
28
29
  const reasonHint = m.columns.find((col) => col.hint !== undefined && hintReasonOf(col.hint, row.values) !== undefined)?.hint;
29
- const rowElements = (_jsxs(_Fragment, { children: [_jsxs(TableRow, { "data-testid": m.rowTestId(row), "data-tone": rowTone?.(row), onClick: openRow, className: cn(rowToneClass(rowTone?.(row)), opensOnClick && "cursor-pointer", "[&:has(+[data-reason-row])]:border-b-0", m.fillsHeight && "h-10 border-border-row hover:bg-muted", density.row, keyboard.className), ...keyboard.props, children: [m.selection.bodyCell(row, m.pins.bodyCell(SELECT_COLUMN_KEY)), m.expansion !== undefined && renderExpandCell(m, row), m.columns.map((col, colIndex) => renderDataCell(m, row, col, colIndex, opensOnClick)), m.hasTableActions && tableActions !== undefined && renderActionsCell(m, row, tableActions)] }), renderExpansion(m, row, "row", m.fullColSpan)] }));
30
+ const rowElements = (_jsxs(_Fragment, { children: [_jsxs(TableRow, { "data-testid": m.rowTestId(row), "data-tone": rowTone?.(row), onClick: rowClickHandler(openRow), className: cn(rowToneClass(rowTone?.(row)), opensOnClick && "cursor-pointer", "[&:has(+[data-reason-row])]:border-b-0", m.fillsHeight && "h-10 border-border-row hover:bg-muted", density.row, keyboard.className), ...keyboard.props, children: [m.selection.bodyCell(row, m.pins.bodyCell(SELECT_COLUMN_KEY)), m.expansion !== undefined && renderExpandCell(m, row), m.columns.map((col, colIndex) => renderDataCell(m, row, col, colIndex, opensOnClick)), m.hasTableActions && tableActions !== undefined && renderActionsCell(m, row, tableActions)] }), renderExpansion(m, row, "row", m.fullColSpan)] }));
30
31
  return (_jsx(HintReasonRowScope, { hint: reasonHint, row: row.values, renderBoxRow: (box) => (_jsx(TableRow, { "data-testid": `${m.rowTestId(row)}-reason`, "data-reason-row": "true", children: _jsx(TableCell, { colSpan: m.fullColSpan, children: box }) })), children: rowElements }, row.id));
31
32
  }
32
33
  export function renderTableBody(m) {
@@ -38,8 +38,12 @@ export function renderTableContent(m) {
38
38
  // scroll surface so it stays put at any row count; the infinite sentinel
39
39
  // stays INSIDE, or it would never intersect the scrollport.
40
40
  const content = m.fillsHeight ? (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : "render-list-scroll", className: cn("min-h-0 flex-1 overflow-auto bg-card", !framed && "border-t border-border"), children: [tableContent, sentinelElement] })) : (_jsxs(_Fragment, { children: [tableContent, sentinelElement] }));
41
- const footer = pagerElement ??
42
- (m.fillsHeight ? (_jsx(DataTableFooter, { count: serverGroups?.totalCount ?? m.rows.length, ...(itemNoun !== undefined && { itemNoun }), testId: testId !== undefined ? `${testId}-footer` : "render-list-footer" })) : undefined);
41
+ // A rendered empty state stands alone: a "0 entries" count or pager under it only repeats it.
42
+ const hasEmptyState = m.isEmpty && m.emptyState !== undefined;
43
+ const footer = hasEmptyState
44
+ ? undefined
45
+ : (pagerElement ??
46
+ (m.fillsHeight ? (_jsx(DataTableFooter, { count: serverGroups?.totalCount ?? m.rows.length, ...(itemNoun !== undefined && { itemNoun }), testId: testId !== undefined ? `${testId}-footer` : "render-list-footer" })) : undefined));
43
47
  // Frame card: content and footer share one bordered card. A fill-height card is as tall as
44
48
  // its rows and shrinks into the scroll container; the 24px sides match the toolbar's inset.
45
49
  return (_jsxs(_Fragment, { children: [m.selection.bar, framed ? (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-frame` : "render-list-frame", className: cn(CARD_SURFACE_CLASS, "overflow-hidden", m.fillsHeight && "mx-6 mb-6 flex min-h-0 flex-col"), children: [content, footer] })) : (_jsxs(_Fragment, { children: [content, footer] }))] }));
@@ -45,11 +45,14 @@ type DataTableCellProps = {
45
45
  readonly display?: ListColumnCellDisplay;
46
46
  readonly badgeToneField?: string;
47
47
  readonly badgeDot?: false;
48
+ readonly pillField?: string;
49
+ readonly pillToneField?: string;
48
50
  readonly emptyPlaceholder?: false;
49
51
  readonly onOpenRow?: () => void;
50
52
  };
51
53
  /** `display: "button"` draws a cell link as a small outline button. */
52
54
  export declare const LINK_BUTTON_CLASS: string;
55
+ export declare const LINK_BUTTON_PRIMARY_CLASS: string;
53
56
  /** Badge tones by the list-wide ListBadgeTone words. */
54
57
  export declare const LIST_BADGE_TONE: Readonly<Record<string, StatusBadgeTone>>;
55
58
  export declare function cellLinkProp(col: {
@@ -71,5 +74,5 @@ export declare function CellTextLink({ link, children, className, }: {
71
74
  readonly children: ReactNode;
72
75
  readonly className?: string;
73
76
  }): ReactNode;
74
- export declare function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping, fileDisplay, compactFile, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }: DataTableCellProps): ReactNode;
77
+ export declare function DataTableCell(props: DataTableCellProps): ReactNode;
75
78
  export {};
@@ -5,7 +5,7 @@ import { Check } from "lucide-react";
5
5
  import { Fragment } from "react";
6
6
  import { rendererWarn } from "../../dev-console.js";
7
7
  import { fileIdsOf } from "../../file-ids-of.js";
8
- import { applyFormatSpec, EMPTY_VALUE_PLACEHOLDER, isSafeHref } from "../../headless/index.js";
8
+ import { applyFormatSpec, EMPTY_VALUE_PLACEHOLDER, isSafeHref, telHref, } from "../../headless/index.js";
9
9
  import { statusToneForOptionTone, statusToneForValue, useColumnRenderer, useOptionalPrimitives, } from "../../index.js";
10
10
  import { isSelectOptionTone } from "../../status-tone.js";
11
11
  import { Badge } from "../ui/badge.js";
@@ -240,6 +240,7 @@ function EmptyCell({ placeholder }) {
240
240
  }
241
241
  /** `display: "button"` draws a cell link as a small outline button. */
242
242
  export const LINK_BUTTON_CLASS = buttonVariants({ variant: "outline", size: "sm" });
243
+ export const LINK_BUTTON_PRIMARY_CLASS = buttonVariants({ variant: "default", size: "sm" });
243
244
  /** Badge tones by the list-wide ListBadgeTone words. */
244
245
  export const LIST_BADGE_TONE = {
245
246
  positive: "ok",
@@ -380,7 +381,16 @@ function renderFileCell({ value, fileDisplay, compactFile, translate, }) {
380
381
  // "X" via useColumnRenderer and renders `<X value row column/>`.
381
382
  // Not registered -> one-time warning + default fallback.
382
383
  // 4. Otherwise -> defaultCellRender (type-based string renderer).
383
- export function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }) {
384
+ export function DataTableCell(props) {
385
+ const { pillField, pillToneField, row } = props;
386
+ const pillText = pillField === undefined ? undefined : row[pillField];
387
+ if (typeof pillText !== "string" || pillText === "")
388
+ return _jsx(DataTableCellBody, { ...props });
389
+ const toneKey = pillToneField === undefined ? undefined : row[pillToneField];
390
+ const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
391
+ return (_jsxs("span", { className: "inline-flex items-center gap-2", children: [_jsx(DataTableCellBody, { ...props }), _jsx(StatusBadge, { tone: tone, dot: false, children: pillText })] }));
392
+ }
393
+ function DataTableCellBody({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }) {
384
394
  const componentRef = isComponentRendererRef(renderer);
385
395
  const ResolvedComponent = useColumnRenderer(componentRef?.name);
386
396
  const RegisteredStatusBadge = useOptionalPrimitives()?.StatusBadge;
@@ -427,6 +437,10 @@ export function DataTableCell({ value, row, field, type, renderer, optionLabels,
427
437
  }
428
438
  if (isFormatSpecRenderer(renderer)) {
429
439
  const text = applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
440
+ const phoneHref = renderer.format === "phone" ? telHref(text) : undefined;
441
+ if (phoneHref !== undefined) {
442
+ return (_jsx(CellTextLink, { link: { href: phoneHref, onPress: () => window.location.assign(phoneHref) }, children: text }));
443
+ }
430
444
  const tones = enumOptionTones(renderer);
431
445
  if (tones !== undefined && typeof value === "string") {
432
446
  return selectPill(value, { [value]: text }, tones, locale, RegisteredStatusBadge);
@@ -20,9 +20,12 @@ function FormSummaryBox({ summary, testId }) {
20
20
  function DrawerFormLayout({ onSubmit, focusFirstErrorKey, subtitle, actions, secondaryActions, summary, testId, children, }) {
21
21
  return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: "flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-6 py-5", children: [_jsx(FormSummaryBox, { summary: summary, testId: testId }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-[13px] text-foreground-secondary", children: subtitle })), _jsx(InsideFormContext.Provider, { value: true, children: _jsx(ScreenFormContext.Provider, { value: true, children: _jsx(InsideDrawerProvider, { value: false, children: _jsx(DrawerBodyContext.Provider, { value: true, children: _jsx("div", { className: "flex flex-col gap-5", children: children }) }) }) }) })] }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex h-16 shrink-0 items-center justify-end gap-2 border-t border-border px-6", children: [secondaryActions, actions] }))] }));
22
22
  }
23
+ function EmbeddedFormLayout({ onSubmit, focusFirstErrorKey, actions, secondaryActions, unsavedCount, testId, children, }) {
24
+ const t = useTranslation();
25
+ return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex w-full flex-col gap-6", children: [_jsx(FormSections, { chromeless: true, stickyActions: undefined, fillHeight: false, screenForm: true, children: children }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex flex-wrap items-center gap-2", children: [actions, secondaryActions, unsavedCount !== undefined && unsavedCount > 0 && (_jsxs("span", { "data-testid": testId !== undefined ? `${testId}-unsaved` : undefined, className: "flex items-center gap-2 text-[13px] text-foreground-secondary", children: [_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-status-active", "aria-hidden": "true" }), unsavedStatusText(t, unsavedCount)] }))] }))] }));
26
+ }
23
27
  export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, subtitle, actions, secondaryActions, testId, width, stickyActions, headerRegion, titleAction, fillHeight, chromeless, screenForm, unsavedCount, sectionNav, sideRail, summary, }) {
24
28
  const insideDrawer = useInsideDrawer();
25
- const t = useTranslation();
26
29
  const isEmbeddedForm = useContext(EmbeddedFormContext);
27
30
  const contextWidth = useContext(ScreenWidthContext);
28
31
  // Embedded (AuthCard etc.): bare <form>, stacked fields with gap; the
@@ -37,7 +40,7 @@ export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, sub
37
40
  return (_jsx(DrawerFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, subtitle: subtitle, actions: actions, secondaryActions: secondaryActions, summary: summary, testId: testId, children: children }));
38
41
  }
39
42
  if (isEmbeddedForm) {
40
- return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex w-full flex-col gap-6", children: [_jsx(FormSections, { chromeless: true, stickyActions: undefined, fillHeight: false, screenForm: true, children: children }), (actions !== undefined || secondaryActions !== undefined) && (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-footer` : undefined, className: "flex flex-wrap items-center gap-2", children: [actions, secondaryActions, unsavedCount !== undefined && unsavedCount > 0 && (_jsxs("span", { "data-testid": testId !== undefined ? `${testId}-unsaved` : undefined, className: "flex items-center gap-2 text-[13px] text-foreground-secondary", children: [_jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-status-active", "aria-hidden": "true" }), unsavedStatusText(t, unsavedCount)] }))] }))] }));
43
+ return (_jsx(EmbeddedFormLayout, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, actions: actions, secondaryActions: secondaryActions, unsavedCount: unsavedCount, testId: testId, children: children }));
41
44
  }
42
45
  const isScreenForm = screenForm === true && fillHeight === true && chromeless !== true;
43
46
  const screenFormWidth = width ?? contextWidth;
@@ -49,7 +52,7 @@ export function DefaultForm({ onSubmit, focusFirstErrorKey, children, title, sub
49
52
  const showsSectionNav = sectionNav !== undefined && sectionNav.length >= SECTION_NAV_MIN_ITEMS;
50
53
  return (_jsxs(FormRoot, { onSubmit: onSubmit, focusFirstErrorKey: focusFirstErrorKey, testId: testId, className: "flex h-full min-h-0 w-full flex-col", children: [_jsxs("div", { className: "flex min-h-0 flex-1 flex-col lg:flex-row", children: [sideRail, _jsx("div", { "data-testid": testId !== undefined ? `${testId}-scroll` : undefined, className: cn("min-h-0 flex-1 overflow-y-auto", screenPaddingClassName), children: _jsxs("div", { className: "flex gap-18", children: [_jsxs("div", { className: cn("flex w-full min-w-0 flex-col gap-9", screenFormWidth !== undefined
51
54
  ? screenFormColumnWidthClassName[screenFormWidth]
52
- : "max-w-[640px]"), children: [_jsx(InsideScreenFormColumnContext.Provider, { value: true, children: headerRegion }), _jsx(FormTitleBlock, { title: title, subtitle: subtitle, titleAction: titleAction, testId: testId, bordered: false, fillHeight: false }), _jsx(FormSummaryBox, { summary: summary, testId: testId }), sections] }), showsSectionNav && _jsx(FormSectionNav, { items: sectionNav })] }) })] }), footer] }));
55
+ : "max-w-[640px]"), children: [headerRegion !== undefined && (_jsx("div", { className: "flex flex-col gap-9", children: _jsx(InsideScreenFormColumnContext.Provider, { value: true, children: headerRegion }) })), _jsx(FormTitleBlock, { title: title, subtitle: subtitle, titleAction: titleAction, testId: testId, bordered: false, fillHeight: false }), _jsx(FormSummaryBox, { summary: summary, testId: testId }), sections] }), showsSectionNav && _jsx(FormSectionNav, { items: sectionNav })] }) })] }), footer] }));
53
56
  }
54
57
  // Pinned footer (fillHeight + stickyActions): the footer is a full-bleed
55
58
  // sibling BELOW the padded shell, so the shell's bottom inset does not float
@@ -8,10 +8,14 @@ import { XIcon } from "lucide-react";
8
8
  import { useTranslation } from "../../index.js";
9
9
  import { SheetTitle } from "../ui/sheet.js";
10
10
  import { Drawer } from "../widgets/drawer.js";
11
+ import { useIsNarrowViewport } from "./use-narrow-viewport.js";
11
12
  const DRAWER_WIDTH_PX = 480;
12
13
  const DRAWER_DIM_PERCENT = 32;
13
14
  const PANEL_CLASS = "bg-card border-border-strong shadow-[-12px_0_32px_rgb(0_0_0/0.14)]";
14
15
  export function DefaultDrawer({ open, onOpenChange, title, subtitle, children, testId, }) {
15
16
  const t = useTranslation();
16
- return (_jsxs(Drawer, { open: open, onOpenChange: onOpenChange, testId: testId, variant: "flush", side: "right", width: DRAWER_WIDTH_PX, backdrop: { dimPercent: DRAWER_DIM_PERCENT }, showCloseButton: false, panelClassName: PANEL_CLASS, fillBody: true, children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-header` : undefined, className: "flex min-h-14 shrink-0 items-center gap-3 border-b border-border py-2 pr-3 pl-6", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(SheetTitle, { className: "text-base font-semibold", children: title ?? "" }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-sm text-muted-foreground", children: subtitle }))] }), _jsx("button", { type: "button", "aria-label": t("kumiko.dialog.close"), onClick: () => onOpenChange(false), className: "flex size-8 items-center justify-center rounded-md text-foreground-secondary hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden", children: _jsx(XIcon, { className: "size-4" }) })] }), _jsx("div", { "data-testid": testId !== undefined ? `${testId}-body` : undefined, onSubmit: (e) => e.stopPropagation(), className: "flex min-h-0 flex-1 flex-col", children: children })] }));
17
+ // On a phone the panel is a bottom sheet (up to 90% of the height, page visible above it)
18
+ // instead of a full-screen takeover.
19
+ const narrow = useIsNarrowViewport();
20
+ return (_jsxs(Drawer, { open: open, onOpenChange: onOpenChange, testId: testId, variant: "flush", side: narrow ? "bottom" : "right", width: DRAWER_WIDTH_PX, backdrop: { dimPercent: DRAWER_DIM_PERCENT }, showCloseButton: false, panelClassName: narrow ? undefined : PANEL_CLASS, fillBody: true, children: [_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-header` : undefined, className: "flex min-h-14 shrink-0 items-center gap-3 border-b border-border py-2 pr-3 pl-6", children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(SheetTitle, { className: "text-base font-semibold", children: title ?? "" }), subtitle !== undefined && (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-subtitle` : undefined, className: "text-sm text-muted-foreground", children: subtitle }))] }), _jsx("button", { type: "button", "aria-label": t("kumiko.dialog.close"), onClick: () => onOpenChange(false), className: "flex size-8 items-center justify-center rounded-md text-foreground-secondary hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden", children: _jsx(XIcon, { className: "size-4" }) })] }), _jsx("div", { "data-testid": testId !== undefined ? `${testId}-body` : undefined, onSubmit: (e) => e.stopPropagation(), className: "flex min-h-0 flex-1 flex-col", children: children })] }));
17
21
  }
@@ -36,7 +36,10 @@ export function renderSecondaryActionsGroup(model) {
36
36
  return (_jsx("div", { "data-testid": testId !== undefined ? `${testId}-actions-secondary` : undefined, className: cn(
37
37
  // min-h-11: link-variant buttons (Copy link) are h-auto and would fall
38
38
  // below the 24px touch-target minimum on narrow viewports.
39
- "flex flex-wrap items-center gap-2 max-sm:[&_button]:min-h-11 max-sm:[&_button]:px-2 max-sm:[&_button]:text-xs", pinned && hasNonPrimaryOverflow && "mr-auto"), children: renderedSecondary }));
39
+ "flex flex-wrap items-center gap-2 max-sm:[&_button]:min-h-11 max-sm:[&_button]:px-2 max-sm:[&_button]:text-xs", pinned && hasNonPrimaryOverflow && "mr-auto",
40
+ // An align: "start" action (marked data-footer-align) rides the group's inner mr-auto to the
41
+ // left edge, so the group has to span the free width of the pinned row.
42
+ pinned && "has-[[data-footer-align=start]]:flex-1"), children: renderedSecondary }));
40
43
  }
41
44
  export function renderPrimaryActionsGroup(model) {
42
45
  const { testId, pinned, stickyActions, fixedFooterStyle, renderedActions } = model;
@@ -128,15 +128,13 @@ function isPrimaryStickyAction(node) {
128
128
  const props = node.props;
129
129
  return props.type === "submit" || props[STICKY_PRIMARY_ACTION_PROP] === true;
130
130
  }
131
- // `actions` from render-edit.tsx arrives as a single `<>…</>` Fragment
132
- // element (not spread children) — Children.toArray only flattens fragments
133
- // nested inside an already-flattened children list, not a Fragment passed
134
- // as the whole value, so the Fragment's own children are unwrapped first.
131
+ // `actions` from render-edit.tsx arrives as a Fragment whose children are Fragments again
132
+ // (one per action group); Children.toArray keeps nested Fragments as single elements, so they
133
+ // are unwrapped recursively or the footer would see one opaque node and fold it into "…".
135
134
  function flattenActionNodes(node) {
136
- if (isValidElement(node) && node.type === Fragment) {
137
- return Children.toArray(node.props.children);
138
- }
139
- return Children.toArray(node);
135
+ return Children.toArray(node).flatMap((child) => isValidElement(child) && child.type === Fragment
136
+ ? flattenActionNodes(child.props.children)
137
+ : [child]);
140
138
  }
141
139
  function splitStickyActions(stickyActions, actions, secondaryActions) {
142
140
  // Only split when sticky: the non-sticky (regular, non-wizard) footer must
@@ -15,12 +15,14 @@ import { DefaultLightbox } from "./lightbox.js";
15
15
  import { DefaultMetric, DefaultMetricBand } from "./metric.js";
16
16
  import { DefaultModal } from "./modal.js";
17
17
  import { DefaultPageHeader } from "./page-header.js";
18
+ import { DefaultPhotoGrid } from "./photo-grid.js";
18
19
  import { PromoPanel } from "./promo-panel.js";
19
20
  import { DefaultRecordBreadcrumb } from "./record-breadcrumb.js";
20
21
  import { DefaultRecordSteps } from "./record-steps.js";
21
22
  import { DefaultRecordSummary } from "./record-summary.js";
22
23
  import { CopyButton, ShareButton } from "./share-actions.js";
23
24
  import { DefaultStatusBadge } from "./status-badge.js";
25
+ import { DefaultStepList } from "./step-list.js";
24
26
  import { StickyActionBar } from "./sticky-action-bar.js";
25
27
  import { DefaultTabs } from "./tabs.js";
26
28
  import "../react-css-custom-properties.js";
@@ -72,6 +74,8 @@ export const defaultPrimitives = {
72
74
  Metric: DefaultMetric,
73
75
  MetricBand: DefaultMetricBand,
74
76
  RecordBreadcrumb: DefaultRecordBreadcrumb,
77
+ PhotoGrid: DefaultPhotoGrid,
78
+ StepList: DefaultStepList,
75
79
  RecordSummary: DefaultRecordSummary,
76
80
  RecordSteps: DefaultRecordSteps,
77
81
  PageHeader: DefaultPageHeader,
@@ -3,7 +3,7 @@ import type { FillContainerProps, GridCellProps, GridProps, HeadingProps, LinkPr
3
3
  import "../react-css-custom-properties.ts";
4
4
  export declare function DefaultSection({ id, title, subtitle, subtitleBelowLgOnly, children, actions, variant, layout, testId, icon, }: SectionProps): ReactNode;
5
5
  export declare function DefaultFillContainer({ children, testId, grow, className, }: FillContainerProps): ReactNode;
6
- export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, }: GridProps): ReactNode;
6
+ export declare function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, }: GridProps): ReactNode;
7
7
  export declare function DefaultGridCell({ span, width, children }: GridCellProps): ReactNode;
8
8
  export declare function DefaultText({ variant, decorative, children, testId, }: TextProps): ReactNode;
9
9
  export declare function isPlainPrimaryClick(event: MouseEvent): boolean;
@@ -67,7 +67,7 @@ const FIELD_CELL_WIDTH_CLASS = {
67
67
  // switch (1.15rem) gets (h-9 input − switch) / 2 margin to sit on the input line.
68
68
  toggle: "w-auto min-w-40 shrink-0 self-start [&_[data-slot=switch]]:my-[0.55rem]",
69
69
  };
70
- export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, }) {
70
+ export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ariaLabelledBy, tight, }) {
71
71
  const insideDrawerBody = useContext(DrawerBodyContext);
72
72
  const groupProps = ariaLabelledBy !== undefined
73
73
  ? { role: "group", "aria-labelledby": ariaLabelledBy }
@@ -89,7 +89,7 @@ export function DefaultGrid({ columns, children, testId, maxRows, flow, list, ar
89
89
  // self-sized tiles) instead of N equal-width, container-stretched tracks.
90
90
  // maxRows/scrolling don't apply — the row just wraps.
91
91
  if (columns === "auto") {
92
- return (_jsx("div", { ...groupProps, "data-testid": testId, className: "flex flex-wrap items-center gap-4", children: children }));
92
+ return (_jsx("div", { ...groupProps, "data-testid": testId, className: cn("flex flex-wrap items-center", tight === true ? "gap-2" : "gap-4"), children: children }));
93
93
  }
94
94
  // Responsive: mobile (< sm = 640px) stays single-column, from sm on the
95
95
  // author-declared column count applies. The inline style writes a CSS
@@ -1,4 +1,3 @@
1
- export declare function resolveSafeLocale(locale: string | undefined): string;
2
1
  export declare function formatLocaleNumber(value: number, locale: string, options: {
3
2
  readonly grouping: boolean;
4
3
  }): string;
@@ -1,18 +1,6 @@
1
1
  // Shared locale handling for the text-based numeric inputs (MoneyInput,
2
2
  // NumberInput).
3
- const FALLBACK_LOCALE = "en-US";
4
- // An invalid tag makes every Intl constructor and toLocaleString throw a
5
- // RangeError; without an ErrorBoundary that would take down the page on
6
- // focus/blur. Canonicalizing once up front keeps all call sites safe.
7
- export function resolveSafeLocale(locale) {
8
- const candidate = locale ?? (typeof navigator !== "undefined" ? navigator.language : undefined) ?? "";
9
- try {
10
- return Intl.getCanonicalLocales(candidate)[0] ?? FALLBACK_LOCALE;
11
- }
12
- catch {
13
- return FALLBACK_LOCALE;
14
- }
15
- }
3
+ import { resolveSafeLocale } from "../../headless/format/safe-locale.js";
16
4
  // 20 is the Intl maximum: the display must never round a stored value.
17
5
  const MAX_FRACTION_DIGITS = 20;
18
6
  export function formatLocaleNumber(value, locale, options) {
@@ -8,9 +8,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  // decimal separators such as commas. `inputMode="decimal"` still provides a mobile numeric
9
9
  // keypad.
10
10
  import { useLayoutEffect, useMemo, useRef, useState } from "react";
11
+ import { resolveSafeLocale } from "../../headless/format/safe-locale.js";
11
12
  import { currencyDecimals, formatMoney as formatMoneyForLocale } from "../../headless/index.js";
12
13
  import { cn } from "../lib/cn.js";
13
- import { parseLocaleNumber, resolveSafeLocale } from "./locale-number.js";
14
+ import { parseLocaleNumber } from "./locale-number.js";
14
15
  // Re-exported for backward compat — callers used to import this from here
15
16
  // before it moved to headless (shared with RenderField).
16
17
  export { currencyDecimals, parseLocaleNumber };
@@ -22,6 +22,9 @@ function isIconizableBackNode(node) {
22
22
  function isExplicitPrimaryNode(node) {
23
23
  return asFooterElement(node)?.props[FOOTER_ACTION_ROLE_PROP] === "primary";
24
24
  }
25
+ function isInlineNode(node) {
26
+ return asFooterElement(node)?.props[FOOTER_ACTION_ROLE_PROP] === "inline";
27
+ }
25
28
  function isSubmitNode(node) {
26
29
  return asFooterElement(node)?.props.type === "submit";
27
30
  }
@@ -42,7 +45,8 @@ function splitNarrowFooterNodes(nodes) {
42
45
  return {
43
46
  back,
44
47
  primary,
45
- overflow: nodes.filter((node) => node !== back && node !== primary),
48
+ inline: nodes.filter((node) => node !== primary && isInlineNode(node)),
49
+ overflow: nodes.filter((node) => node !== back && node !== primary && !isInlineNode(node)),
46
50
  };
47
51
  }
48
52
  function BackIconButton({ node }) {
@@ -139,7 +143,7 @@ function OverflowPopover({ nodes, holder, label, unsavedCount, testId, hasEnable
139
143
  * everything else in a "…" popover (hidden while none of it is enabled), the primary
140
144
  * action filling the rest. */
141
145
  export function NarrowPinnedFooter({ nodes, overflowLabel, unsavedCount, unsavedStatus, testId, keyboardInset, }) {
142
- const { back, primary, overflow } = splitNarrowFooterNodes(nodes);
146
+ const { back, primary, inline, overflow } = splitNarrowFooterNodes(nodes);
143
147
  const backElement = asFooterElement(back);
144
148
  const [holder] = useState(() => typeof document === "undefined" ? null : createOverflowHolder());
145
149
  const hasEnabledAction = useContainsEnabledAction(holder);
@@ -149,5 +153,5 @@ export function NarrowPinnedFooter({ nodes, overflowLabel, unsavedCount, unsaved
149
153
  // iOS ignores interactive-widget=resizes-content, so the in-flow footer would stay behind the keyboard.
150
154
  style: keyboardInset > 0
151
155
  ? { transform: `translateY(-${keyboardInset}px)`, position: "relative", zIndex: 10 }
152
- : undefined, children: [backElement !== undefined && _jsx(BackIconButton, { node: backElement }), overflow.length > 0 && (_jsx(OverflowPopover, { nodes: overflow, holder: holder, label: overflowLabel, unsavedCount: unsavedCount, testId: testId, hasEnabledAction: hasEnabledAction })), primary !== undefined && (_jsx(PrimaryButton, { node: primary, unsavedStatus: isDirty && !overflowTriggerVisible ? unsavedStatus : undefined, indicatorTestId: testId !== undefined ? `${testId}-primary-badge` : undefined }))] }));
156
+ : undefined, children: [backElement !== undefined && _jsx(BackIconButton, { node: backElement }), overflow.length > 0 && (_jsx(OverflowPopover, { nodes: overflow, holder: holder, label: overflowLabel, unsavedCount: unsavedCount, testId: testId, hasEnabledAction: hasEnabledAction })), inline.map((node) => (_jsx("div", { className: "min-w-0 flex-1 [&>button]:w-full", children: node }, asFooterElement(node)?.key))), primary !== undefined && (_jsx(PrimaryButton, { node: primary, unsavedStatus: isDirty && !overflowTriggerVisible ? unsavedStatus : undefined, indicatorTestId: testId !== undefined ? `${testId}-primary-badge` : undefined }))] }));
153
157
  }
@@ -7,9 +7,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  // see the typed value; blur only normalizes the display. A draft that does
8
8
  // not parse clears the value, so the parent never holds a stale prefix.
9
9
  import { useLayoutEffect, useRef, useState } from "react";
10
+ import { resolveSafeLocale } from "../../headless/format/safe-locale.js";
10
11
  import { cn } from "../lib/cn.js";
11
12
  import { Input as UiInput } from "../ui/input.js";
12
- import { formatLocaleNumber, parseLocaleNumber, resolveSafeLocale } from "./locale-number.js";
13
+ import { formatLocaleNumber, parseLocaleNumber } from "./locale-number.js";
13
14
  export function NumberInput({ id, name, value, onChange, locale, grouping = true, integer = false, disabled, required, hasError, placeholder, testId, className, ariaDescribedBy, ariaLabel, }) {
14
15
  const resolvedLocale = resolveSafeLocale(locale);
15
16
  const [focused, setFocused] = useState(false);
@@ -0,0 +1,3 @@
1
+ import type { ReactNode } from "react";
2
+ import type { PhotoGridProps } from "../../index.ts";
3
+ export declare function DefaultPhotoGrid({ tiles, testId }: PhotoGridProps): ReactNode;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FileThumbnail } from "./file-thumbnail.js";
3
+ export function DefaultPhotoGrid({ tiles, testId }) {
4
+ return (_jsx("ul", { "data-testid": testId, className: "m-0 grid list-none grid-cols-2 gap-3 p-0 sm:grid-cols-3 lg:grid-cols-4", children: tiles.map((tile) => (_jsxs("li", { "data-testid": testId !== undefined ? `${testId}-tile-${tile.id}` : undefined, className: "flex flex-col gap-2 rounded-lg border bg-card p-2", children: [_jsx(FileThumbnail, { fileId: tile.imageId ?? "", className: "aspect-[4/3] w-full" }), tile.caption !== undefined && (_jsx("span", { className: "truncate text-sm text-muted-foreground", children: tile.caption })), tile.actions !== undefined && _jsx("div", { className: "flex flex-wrap gap-2", children: tile.actions })] }, tile.id))) }));
5
+ }
@@ -1,3 +1,3 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { RecordStepsProps } from "../../index.ts";
3
- export declare function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, items, count, testId, }: RecordStepsProps): ReactNode;
3
+ export declare function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, moreActionsLabel, items, count, testId, }: RecordStepsProps): ReactNode;
@@ -23,11 +23,11 @@ function StepDetail({ item }) {
23
23
  return null;
24
24
  return _jsx("small", { className: "block text-xs text-muted-foreground", children: detail });
25
25
  }
26
- function StepRow({ item, reasonLabel }) {
26
+ function StepRow({ item, reasonLabel, moreActionsLabel, }) {
27
27
  const [reasonOpen, setReasonOpen] = useState(item.reasonOpen === true);
28
28
  const reasonBoxId = useId();
29
29
  const narrow = useIsBelowSmViewport();
30
- return (_jsxs("li", { "data-testid": `record-step-${item.id}`, "data-tone": item.tone, className: "relative grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 py-3 pl-5 pr-4 max-sm:py-[9px] max-sm:pl-3.5 max-sm:pr-0", children: [_jsx("span", { "aria-hidden": "true", className: cn("absolute inset-y-2.5 left-0 w-1 rounded-[2px] max-sm:inset-y-[9px]", STEP_STRIPE_CLASS[item.tone ?? "neutral"]) }), _jsxs("div", { className: "col-start-1 row-start-1 flex min-w-0 items-start gap-2", children: [_jsx("span", { className: "font-medium text-foreground max-sm:text-[13.5px]", "data-slot": "step-what", children: _jsx(StepTitle, { item: item }) }), item.reason !== undefined && (_jsx("span", { className: "flex max-sm:hidden", children: _jsx(ReasonInfoButton, { label: reasonLabel, open: reasonOpen, controls: reasonBoxId, onToggle: () => setReasonOpen((open) => !open) }) }))] }), _jsxs("div", { className: "col-start-2 row-start-1 flex shrink-0 items-center gap-3 max-sm:row-span-2 max-sm:self-center max-sm:[&_button]:h-8 max-sm:[&_button]:text-[13px]", children: [item.moreActions !== undefined && !narrow && (_jsx("div", { className: "text-[12.5px] text-muted-foreground [&_a]:text-[12.5px] [&_a]:text-muted-foreground [&_button]:text-[12.5px] [&_button]:text-muted-foreground", children: item.moreActions })), item.actions] }), _jsx("div", { className: "col-start-1 row-start-2 min-w-0 sm:col-span-2", children: _jsx(StepDetail, { item: item }) }), item.moreActions !== undefined && narrow && (_jsx("div", { "data-testid": `record-step-${item.id}-more-actions`, className: "col-span-2 row-start-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground [&_a]:text-xs [&_a]:text-muted-foreground [&_button]:text-xs [&_button]:text-muted-foreground", children: item.moreActions })), item.reason !== undefined && reasonOpen && (_jsx("div", { className: "col-span-2 row-start-3 max-sm:hidden", children: _jsx(ReasonBox, { id: reasonBoxId, testId: `record-step-${item.id}-reason`, ...(item.reasonTitle !== undefined && { title: item.reasonTitle }), children: item.reason }) }))] }));
30
+ return (_jsxs("li", { "data-testid": `record-step-${item.id}`, "data-tone": item.tone, className: "relative grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1 py-3 pl-5 pr-4 max-sm:py-[9px] max-sm:pl-3.5 max-sm:pr-0", children: [_jsx("span", { "aria-hidden": "true", className: cn("absolute inset-y-2.5 left-0 w-1 rounded-[2px] max-sm:inset-y-[9px]", STEP_STRIPE_CLASS[item.tone ?? "neutral"]) }), _jsxs("div", { className: "col-start-1 row-start-1 flex min-w-0 items-start gap-2", children: [_jsx("span", { className: "font-medium text-foreground max-sm:text-[13.5px]", "data-slot": "step-what", children: _jsx(StepTitle, { item: item }) }), item.reason !== undefined && (_jsx("span", { className: "flex max-sm:hidden", children: _jsx(ReasonInfoButton, { label: reasonLabel, open: reasonOpen, controls: reasonBoxId, onToggle: () => setReasonOpen((open) => !open) }) }))] }), _jsxs("div", { className: "col-start-2 row-start-1 flex shrink-0 items-center gap-3 max-sm:row-span-2 max-sm:self-center max-sm:[&_button]:h-8 max-sm:[&_button]:text-[13px]", children: [item.moreActions !== undefined && !narrow && (_jsxs("div", { className: "flex items-center gap-3 text-[12.5px] text-muted-foreground [&_a]:text-[12.5px] [&_a]:text-muted-foreground [&_button]:text-[12.5px] [&_button]:text-muted-foreground", children: [moreActionsLabel !== undefined && (_jsx("span", { "data-testid": `record-step-${item.id}-more-actions-label`, children: moreActionsLabel })), item.moreActions] })), item.actions] }), _jsx("div", { className: "col-start-1 row-start-2 min-w-0 sm:col-span-2", children: _jsx(StepDetail, { item: item }) }), item.moreActions !== undefined && narrow && (_jsxs("div", { "data-testid": `record-step-${item.id}-more-actions`, className: "col-span-2 row-start-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground [&_a]:text-xs [&_a]:text-muted-foreground [&_button]:text-xs [&_button]:text-muted-foreground", children: [moreActionsLabel !== undefined && _jsx("span", { children: moreActionsLabel }), item.moreActions] })), item.reason !== undefined && reasonOpen && (_jsx("div", { className: "col-span-2 row-start-3 max-sm:hidden", children: _jsx(ReasonBox, { id: reasonBoxId, testId: `record-step-${item.id}-reason`, ...(item.reasonTitle !== undefined && { title: item.reasonTitle }), children: item.reason }) }))] }));
31
31
  }
32
32
  function StepsHeader({ title, subtitle, count, testId, }) {
33
33
  return (_jsxs("header", { className: "flex flex-wrap items-baseline gap-x-3 gap-y-1 px-4 py-3 max-sm:px-0 max-sm:pt-1", children: [_jsx("h3", { className: "m-0 text-sm font-semibold text-foreground", children: title }), subtitle !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground max-sm:hidden", children: subtitle })), count !== undefined && (_jsx("span", { "data-testid": `${testId ?? "record-steps"}-count`, className: "ml-auto text-xs text-muted-foreground sm:hidden", children: count }))] }));
@@ -35,7 +35,7 @@ function StepsHeader({ title, subtitle, count, testId, }) {
35
35
  function StepsMoreToggle({ testId, expanded, label, onToggle, }) {
36
36
  return (_jsxs("button", { type: "button", "data-testid": `${testId ?? "record-steps"}-toggle`, "aria-expanded": expanded, className: "relative w-full border-t px-4 py-3 text-left text-sm font-medium text-primary hover:underline max-sm:border-border-row max-sm:py-[9px] max-sm:pl-3.5 max-sm:pr-0 max-sm:text-xs max-sm:font-normal", onClick: onToggle, children: [_jsx("span", { "aria-hidden": "true", className: "absolute inset-y-[9px] left-0 w-1 rounded-[2px] bg-border-strong sm:hidden" }), label] }));
37
37
  }
38
- export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, items, count, testId, }) {
38
+ export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, moreActionsLabel, items, count, testId, }) {
39
39
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
40
40
  const narrow = useIsBelowSmViewport();
41
41
  const [expanded, setExpanded] = useState(false);
@@ -46,5 +46,5 @@ export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, n
46
46
  : expanded
47
47
  ? lessLabel
48
48
  : moreLabel(items.length - visible.length);
49
- return (_jsx("section", { "data-testid": testId, className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsxs("div", { className: "sm:rounded-md sm:border sm:bg-card", children: [_jsx(StepsHeader, { title: title, subtitle: subtitle, count: count, testId: testId }), items.length === 0 ? (_jsx("p", { className: "m-0 px-4 py-3 text-sm text-muted-foreground", children: emptyLabel })) : (_jsx("ul", { className: "m-0 flex list-none flex-col divide-y divide-border-row p-0", children: visible.map((item) => (_jsx(StepRow, { item: item, reasonLabel: reasonLabel }, item.id))) })), limited && toggleLabel !== undefined && (_jsx(StepsMoreToggle, { testId: testId, expanded: expanded, label: toggleLabel, onToggle: () => setExpanded((open) => !open) }))] }) }));
49
+ return (_jsx("section", { "data-testid": testId, className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsxs("div", { className: "sm:rounded-md sm:border sm:bg-card", children: [_jsx(StepsHeader, { title: title, subtitle: subtitle, count: count, testId: testId }), items.length === 0 ? (_jsx("p", { className: "m-0 px-4 py-3 text-sm text-muted-foreground", children: emptyLabel })) : (_jsx("ul", { className: "m-0 flex list-none flex-col divide-y divide-border-row p-0", children: visible.map((item) => (_jsx(StepRow, { item: item, reasonLabel: reasonLabel, moreActionsLabel: moreActionsLabel }, item.id))) })), limited && toggleLabel !== undefined && (_jsx(StepsMoreToggle, { testId: testId, expanded: expanded, label: toggleLabel, onToggle: () => setExpanded((open) => !open) }))] }) }));
50
50
  }
@@ -1,3 +1,3 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { RecordSummaryProps } from "../../index.ts";
3
- export declare function DefaultRecordSummary({ text, narrowText, tone, testId, }: RecordSummaryProps): ReactNode;
3
+ export declare function DefaultRecordSummary({ text, narrowText, tone, icon, testId, }: RecordSummaryProps): ReactNode;