@cosmicdrift/kumiko-renderer 0.415.0 → 0.417.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 (221) hide show
  1. package/dist/app/action-form-body.d.ts +2 -5
  2. package/dist/app/action-form-body.js +50 -22
  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 +83 -82
  7. package/dist/app/entity-list-screen.js +1 -1
  8. package/dist/app/extension-sections.d.ts +2 -0
  9. package/dist/app/header-actions-bar.d.ts +3 -1
  10. package/dist/app/header-actions-bar.js +12 -4
  11. package/dist/app/locked-screen-header.d.ts +2 -0
  12. package/dist/app/locked-screen-header.js +8 -1
  13. package/dist/app/projection-detail-body.js +29 -8
  14. package/dist/app/projection-detail-guidance.d.ts +2 -1
  15. package/dist/app/projection-detail-guidance.js +45 -30
  16. package/dist/app/projection-detail-header-model.d.ts +1 -1
  17. package/dist/app/projection-detail-header-model.js +14 -6
  18. package/dist/app/projection-detail-header-region.js +25 -9
  19. package/dist/app/projection-detail-header.d.ts +2 -0
  20. package/dist/app/projection-detail-header.js +31 -4
  21. package/dist/app/projection-detail-navigation.d.ts +4 -0
  22. package/dist/app/projection-detail-navigation.js +5 -1
  23. package/dist/app/projection-list-shim.js +1 -0
  24. package/dist/app/row-actions.d.ts +4 -0
  25. package/dist/app/row-actions.js +19 -3
  26. package/dist/app/screen-shared.d.ts +1 -0
  27. package/dist/app/screen-shared.js +23 -3
  28. package/dist/app/use-projection-detail-actions.d.ts +16 -1
  29. package/dist/app/use-projection-detail-actions.js +23 -3
  30. package/dist/app/use-projection-detail-data.d.ts +2 -0
  31. package/dist/app/use-projection-detail-data.js +53 -10
  32. package/dist/app/use-projection-list-data.js +1 -1
  33. package/dist/card-options.d.ts +2 -0
  34. package/dist/components/ai-assist-payload.d.ts +2 -0
  35. package/dist/components/ai-assist-payload.js +8 -0
  36. package/dist/components/choice-chip-class.d.ts +1 -0
  37. package/dist/components/choice-chip-class.js +9 -0
  38. package/dist/components/edit-mounts.d.ts +3 -2
  39. package/dist/components/edit-mounts.js +2 -2
  40. package/dist/components/grid-cell-for-field.js +1 -1
  41. package/dist/components/multi-select-chips.d.ts +10 -0
  42. package/dist/components/multi-select-chips.js +19 -0
  43. package/dist/components/narrow-description.d.ts +3 -0
  44. package/dist/components/narrow-description.js +12 -0
  45. package/dist/components/related-list-section.d.ts +5 -3
  46. package/dist/components/related-list-section.js +52 -35
  47. package/dist/components/related-photo-grid.d.ts +11 -0
  48. package/dist/components/related-photo-grid.js +54 -0
  49. package/dist/components/render-edit-action-button.d.ts +2 -2
  50. package/dist/components/render-edit-field-grid.d.ts +12 -3
  51. package/dist/components/render-edit-field-grid.js +60 -18
  52. package/dist/components/render-edit-fields-section.js +45 -11
  53. package/dist/components/render-edit-header-actions.d.ts +2 -1
  54. package/dist/components/render-edit-header-actions.js +18 -1
  55. package/dist/components/render-edit-layout.js +5 -3
  56. package/dist/components/render-edit-logic.js +1 -0
  57. package/dist/components/render-edit-section-kinds.js +59 -10
  58. package/dist/components/render-edit-titles.js +1 -1
  59. package/dist/components/render-edit-types.d.ts +22 -1
  60. package/dist/components/render-field-ai-assist.d.ts +13 -0
  61. package/dist/components/render-field-ai-assist.js +90 -0
  62. package/dist/components/render-field-choice-inputs.js +4 -0
  63. package/dist/components/render-field-control.d.ts +1 -1
  64. package/dist/components/render-field-control.js +19 -9
  65. package/dist/components/render-field-value-chips.d.ts +9 -0
  66. package/dist/components/render-field-value-chips.js +47 -0
  67. package/dist/components/render-field-write-only.js +12 -4
  68. package/dist/components/render-list-hint-columns.d.ts +2 -0
  69. package/dist/components/render-list-hint-columns.js +43 -5
  70. package/dist/components/render-list-reference-columns.js +2 -4
  71. package/dist/components/render-list-row-tone.d.ts +2 -0
  72. package/dist/components/render-list-row-tone.js +6 -0
  73. package/dist/components/render-list-table-props.d.ts +13 -2
  74. package/dist/components/render-list-table-props.js +9 -3
  75. package/dist/components/render-list-types.d.ts +4 -0
  76. package/dist/components/render-list.js +12 -4
  77. package/dist/components/use-render-edit-sections.js +5 -1
  78. package/dist/components/use-render-list-columns.js +3 -3
  79. package/dist/components/write-form-registry.d.ts +13 -0
  80. package/dist/components/write-form-registry.js +6 -0
  81. package/dist/components/write-form-section.d.ts +5 -1
  82. package/dist/components/write-form-section.js +55 -16
  83. package/dist/headless/form/form-controller.d.ts +1 -0
  84. package/dist/headless/form/form-controller.js +1 -1
  85. package/dist/headless/format/index.d.ts +1 -0
  86. package/dist/headless/format/index.js +21 -0
  87. package/dist/headless/format/phone.d.ts +1 -0
  88. package/dist/headless/format/phone.js +8 -0
  89. package/dist/headless/format/relative-time.d.ts +15 -0
  90. package/dist/headless/format/relative-time.js +63 -0
  91. package/dist/headless/format/safe-locale.d.ts +1 -0
  92. package/dist/headless/format/safe-locale.js +13 -0
  93. package/dist/headless/index.d.ts +2 -2
  94. package/dist/headless/index.js +2 -2
  95. package/dist/headless/view-model/edit.d.ts +3 -2
  96. package/dist/headless/view-model/edit.js +162 -36
  97. package/dist/headless/view-model/field-text.d.ts +9 -0
  98. package/dist/headless/view-model/field-text.js +19 -0
  99. package/dist/headless/view-model/index.d.ts +1 -0
  100. package/dist/headless/view-model/index.js +1 -0
  101. package/dist/headless/view-model/list.js +6 -0
  102. package/dist/headless/view-model/types.d.ts +76 -5
  103. package/dist/hooks/use-list-table.js +11 -6
  104. package/dist/i18n-defaults.js +9 -2
  105. package/dist/index.d.ts +1 -1
  106. package/dist/primitives-record-guidance.d.ts +32 -1
  107. package/dist/primitives-share-types.d.ts +82 -0
  108. package/dist/primitives-share-types.js +1 -0
  109. package/dist/primitives.d.ts +44 -86
  110. package/dist/web/app/bold-markup.d.ts +3 -0
  111. package/dist/web/app/bold-markup.js +14 -0
  112. package/dist/web/app/dashboard-body.js +8 -3
  113. package/dist/web/app/dashboard-list-panel.js +8 -4
  114. package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
  115. package/dist/web/app/dashboard-panel-columns.js +14 -0
  116. package/dist/web/app/dashboard-panels.js +31 -3
  117. package/dist/web/app/dashboard-shared.d.ts +3 -1
  118. package/dist/web/app/dashboard-shared.js +4 -4
  119. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
  120. package/dist/web/app/dashboard-stat-group-panel.js +24 -3
  121. package/dist/web/app/dashboard-text-panel.d.ts +1 -0
  122. package/dist/web/app/dashboard-text-panel.js +18 -11
  123. package/dist/web/app/relative-time.d.ts +0 -5
  124. package/dist/web/app/relative-time.js +11 -21
  125. package/dist/web/components/config-cascade.d.ts +2 -1
  126. package/dist/web/components/config-cascade.js +16 -4
  127. package/dist/web/drawn-icons.js +2 -1
  128. package/dist/web/layout/header-action-pinned.d.ts +4 -2
  129. package/dist/web/layout/header-action-pinned.js +13 -4
  130. package/dist/web/layout/header-overflow-menu.d.ts +2 -0
  131. package/dist/web/layout/header-overflow-menu.js +2 -0
  132. package/dist/web/layout/notification-bell.js +12 -3
  133. package/dist/web/layout/page-header-slot.d.ts +2 -0
  134. package/dist/web/layout/page-header-slot.js +4 -0
  135. package/dist/web/layout/screen-focus.js +4 -1
  136. package/dist/web/layout/shell-header.js +13 -5
  137. package/dist/web/primitives/banner.js +24 -8
  138. package/dist/web/primitives/card.js +5 -3
  139. package/dist/web/primitives/combobox.js +2 -2
  140. package/dist/web/primitives/data-table/actions-column.js +1 -1
  141. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  142. package/dist/web/primitives/data-table/card-body.js +37 -14
  143. package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
  144. package/dist/web/primitives/data-table/card-frame.js +3 -0
  145. package/dist/web/primitives/data-table/card-row.js +34 -10
  146. package/dist/web/primitives/data-table/card-sort-select.js +1 -1
  147. package/dist/web/primitives/data-table/card-view.js +1 -1
  148. package/dist/web/primitives/data-table/data-cell-props.d.ts +4 -1
  149. package/dist/web/primitives/data-table/data-cell-props.js +3 -0
  150. package/dist/web/primitives/data-table/density.d.ts +3 -1
  151. package/dist/web/primitives/data-table/density.js +11 -4
  152. package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
  153. package/dist/web/primitives/data-table/row-click-guard.js +19 -0
  154. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  155. package/dist/web/primitives/data-table/row-render-parts.js +3 -5
  156. package/dist/web/primitives/data-table/sort-options-select.js +2 -2
  157. package/dist/web/primitives/data-table/sortable-header.js +4 -4
  158. package/dist/web/primitives/data-table/table-body.js +3 -1
  159. package/dist/web/primitives/data-table/table-chrome.js +1 -3
  160. package/dist/web/primitives/data-table/table-content.js +6 -6
  161. package/dist/web/primitives/data-table/table-data-cell.js +31 -17
  162. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  163. package/dist/web/primitives/data-table/table-view.js +1 -1
  164. package/dist/web/primitives/data-table/toolbar.js +6 -7
  165. package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
  166. package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
  167. package/dist/web/primitives/data-table-cell.d.ts +17 -3
  168. package/dist/web/primitives/data-table-cell.js +130 -36
  169. package/dist/web/primitives/data-table.js +1 -1
  170. package/dist/web/primitives/default-form.d.ts +1 -1
  171. package/dist/web/primitives/default-form.js +15 -11
  172. package/dist/web/primitives/drawer.js +2 -3
  173. package/dist/web/primitives/facet-filter.d.ts +1 -1
  174. package/dist/web/primitives/facet-filter.js +2 -5
  175. package/dist/web/primitives/facet-search-filter.js +1 -1
  176. package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
  177. package/dist/web/primitives/facet-trigger-label.js +4 -7
  178. package/dist/web/primitives/field.js +15 -8
  179. package/dist/web/primitives/form-footer-parts.js +6 -3
  180. package/dist/web/primitives/form.js +6 -8
  181. package/dist/web/primitives/index.js +4 -0
  182. package/dist/web/primitives/inline-suffix.d.ts +2 -0
  183. package/dist/web/primitives/inline-suffix.js +5 -0
  184. package/dist/web/primitives/input-choice-kinds.js +12 -2
  185. package/dist/web/primitives/input-number-kinds.js +2 -2
  186. package/dist/web/primitives/input-text-kinds.js +1 -1
  187. package/dist/web/primitives/layout-elements.d.ts +4 -4
  188. package/dist/web/primitives/layout-elements.js +50 -13
  189. package/dist/web/primitives/layout.d.ts +1 -1
  190. package/dist/web/primitives/layout.js +1 -1
  191. package/dist/web/primitives/locale-number.d.ts +0 -1
  192. package/dist/web/primitives/locale-number.js +1 -13
  193. package/dist/web/primitives/money-input.js +10 -8
  194. package/dist/web/primitives/narrow-pinned-footer.js +7 -3
  195. package/dist/web/primitives/number-input.d.ts +2 -1
  196. package/dist/web/primitives/number-input.js +11 -5
  197. package/dist/web/primitives/page-header.d.ts +1 -1
  198. package/dist/web/primitives/page-header.js +8 -1
  199. package/dist/web/primitives/pager.js +12 -21
  200. package/dist/web/primitives/photo-grid.d.ts +3 -0
  201. package/dist/web/primitives/photo-grid.js +6 -0
  202. package/dist/web/primitives/record-steps.d.ts +1 -1
  203. package/dist/web/primitives/record-steps.js +7 -16
  204. package/dist/web/primitives/record-summary.d.ts +1 -1
  205. package/dist/web/primitives/record-summary.js +8 -3
  206. package/dist/web/primitives/row-actions.js +38 -24
  207. package/dist/web/primitives/step-list.d.ts +3 -0
  208. package/dist/web/primitives/step-list.js +11 -0
  209. package/dist/web/primitives/use-container-narrow.d.ts +12 -0
  210. package/dist/web/primitives/use-container-narrow.js +42 -0
  211. package/dist/web/ui/input.js +1 -1
  212. package/dist/web/ui/textarea.js +1 -1
  213. package/dist/web/widgets/dashboard-list-cards.js +6 -3
  214. package/dist/web/widgets/dashboard-list.d.ts +6 -1
  215. package/dist/web/widgets/dashboard-list.js +12 -7
  216. package/dist/web/widgets/drawer-panel-class.js +1 -1
  217. package/dist/web/widgets/progress-list.js +1 -1
  218. package/dist/web/widgets/stat-box-cell.js +1 -1
  219. package/package.json +5 -5
  220. package/src/changes.json +105 -0
  221. package/src/web/styles.css +3 -2
@@ -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,22 +8,21 @@ 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 { inlineSuffixStyle } from "./inline-suffix.js";
15
+ import { parseLocaleNumber } from "./locale-number.js";
14
16
  // Re-exported for backward compat — callers used to import this from here
15
17
  // before it moved to headless (shared with RenderField).
16
18
  export { currencyDecimals, parseLocaleNumber };
17
19
  // The border and focus ring live on the wrapper so the currency symbol can be
18
20
  // a flex sibling of the input: a symbol of any width ("€", "CHF", "R$") takes
19
21
  // its own space instead of overlapping the digits.
20
- const wrapperClass = "flex h-9 w-full items-center rounded-md border border-input bg-transparent text-sm shadow-sm " +
22
+ const wrapperClass = "flex min-h-[38px] w-full items-center rounded-[7px] border-[1.5px] border-input bg-transparent text-sm shadow-sm " +
21
23
  "transition-colors focus-within:ring-1 focus-within:ring-ring";
22
24
  const inputClass = "h-full min-w-0 flex-1 bg-transparent px-3 placeholder:text-muted-foreground " +
23
- "focus-visible:outline-none disabled:cursor-not-allowed " +
24
- // Right-aligns the value like a native type=number input so amounts align at the thousands
25
- // separators in list columns.
26
- "text-right tabular-nums";
25
+ "focus-visible:outline-none disabled:cursor-not-allowed text-left tabular-nums";
27
26
  export function MoneyInput({ id, name, value, onChange, currency, locale, disabled, required, hasError, ariaLabel, }) {
28
27
  const decimals = currencyDecimals(currency);
29
28
  const factor = 10 ** decimals;
@@ -74,8 +73,11 @@ export function MoneyInput({ id, name, value, onChange, currency, locale, disabl
74
73
  return;
75
74
  onChange(Math.round(parsed * factor));
76
75
  };
77
- const symbolEl = symbol !== "" ? (_jsx("span", { id: `${id}-currency`, "data-testid": `${id}-currency`, className: cn("shrink-0 select-none text-muted-foreground", symbolPosition === "prefix" ? "pl-3" : "pr-3"), children: symbol })) : null;
78
- return (_jsxs("div", { className: cn(wrapperClass, hasError === true && "border-destructive focus-within:ring-destructive", disabled === true && "cursor-not-allowed opacity-50"), children: [symbolPosition === "prefix" && symbolEl, _jsx("input", { ref: inputRef, id: id, name: name, type: "text", inputMode: "decimal", autoComplete: "off", disabled: disabled, "aria-required": required, "aria-invalid": hasError === true ? true : undefined, "aria-label": ariaLabel, "aria-describedby": symbol !== "" ? `${id}-currency` : undefined, value: focused ? draft : formatted, onFocus: handleFocus, onBlur: handleBlur, onChange: (e) => setDraft(e.target.value), className: cn(inputClass, symbolPosition === "prefix" ? "pl-2" : "pr-2") }), symbolPosition === "suffix" && symbolEl] }));
76
+ const shownText = focused ? draft : formatted;
77
+ const symbolEl = symbol !== "" ? (_jsx("span", { id: `${id}-currency`, "data-testid": `${id}-currency`, ...(symbolPosition === "suffix" && { style: inlineSuffixStyle(shownText) }), className: cn("select-none text-muted-foreground", symbolPosition === "prefix"
78
+ ? "shrink-0 pl-3"
79
+ : "pointer-events-none absolute top-1/2 -translate-y-1/2"), children: symbol })) : null;
80
+ return (_jsxs("div", { className: cn(wrapperClass, "relative", hasError === true && "border-destructive focus-within:ring-destructive", disabled === true && "cursor-not-allowed opacity-50"), children: [symbolPosition === "prefix" && symbolEl, _jsx("input", { ref: inputRef, id: id, name: name, type: "text", inputMode: "decimal", autoComplete: "off", disabled: disabled, "aria-required": required, "aria-invalid": hasError === true ? true : undefined, "aria-label": ariaLabel, "aria-describedby": symbol !== "" ? `${id}-currency` : undefined, value: shownText, onFocus: handleFocus, onBlur: handleBlur, onChange: (e) => setDraft(e.target.value), className: cn(inputClass, symbolPosition === "prefix" ? "pl-2" : "pr-8") }), symbolPosition === "suffix" && symbolEl] }));
79
81
  }
80
82
  // Shared with defaultCellRender (index.tsx) so both formatting paths stay
81
83
  // identical. Resolves the browser locale here; headless stays navigator-free.
@@ -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,6 +7,7 @@ export type NumberInputProps = {
7
7
  readonly locale?: string;
8
8
  readonly grouping?: boolean;
9
9
  readonly integer?: boolean;
10
+ readonly suffix?: string;
10
11
  readonly disabled?: boolean;
11
12
  readonly required?: boolean;
12
13
  readonly hasError?: boolean;
@@ -16,4 +17,4 @@ export type NumberInputProps = {
16
17
  readonly ariaDescribedBy?: string;
17
18
  readonly ariaLabel?: string;
18
19
  };
19
- export declare function NumberInput({ id, name, value, onChange, locale, grouping, integer, disabled, required, hasError, placeholder, testId, className, ariaDescribedBy, ariaLabel, }: NumberInputProps): ReactNode;
20
+ export declare function NumberInput({ id, name, value, onChange, locale, grouping, integer, suffix, disabled, required, hasError, placeholder, testId, className, ariaDescribedBy, ariaLabel, }: NumberInputProps): ReactNode;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // NumberInput — type=text with a focus-aware locale format, so a blurred
3
3
  // value shows thousands separators ("28.000") while editing shows the raw
4
4
  // locale string ("28000"). Not type=number: browsers reject formatted
@@ -7,10 +7,12 @@ 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
- export function NumberInput({ id, name, value, onChange, locale, grouping = true, integer = false, disabled, required, hasError, placeholder, testId, className, ariaDescribedBy, ariaLabel, }) {
13
+ import { inlineSuffixStyle } from "./inline-suffix.js";
14
+ import { formatLocaleNumber, parseLocaleNumber } from "./locale-number.js";
15
+ export function NumberInput({ id, name, value, onChange, locale, grouping = true, integer = false, suffix, disabled, required, hasError, placeholder, testId, className, ariaDescribedBy, ariaLabel, }) {
14
16
  const resolvedLocale = resolveSafeLocale(locale);
15
17
  const [focused, setFocused] = useState(false);
16
18
  const [draft, setDraft] = useState("");
@@ -39,8 +41,12 @@ export function NumberInput({ id, name, value, onChange, locale, grouping = true
39
41
  }
40
42
  onChange(parsed);
41
43
  };
42
- return (_jsx(UiInput, { ref: inputRef, type: "text", inputMode: integer ? "numeric" : "decimal", autoComplete: "off", id: id, name: name, disabled: disabled, "aria-required": required, "aria-invalid": hasError === true ? true : undefined, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "data-testid": testId, value: focused ? draft : format(grouping), onFocus: () => {
44
+ const shownText = focused ? draft : format(grouping);
45
+ const input = (_jsx(UiInput, { ref: inputRef, type: "text", inputMode: integer ? "numeric" : "decimal", autoComplete: "off", id: id, name: name, disabled: disabled, "aria-required": required, "aria-invalid": hasError === true ? true : undefined, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "data-testid": testId, value: shownText, onFocus: () => {
43
46
  setDraft(format(false));
44
47
  setFocused(true);
45
- }, onBlur: () => setFocused(false), onChange: (e) => handleChange(e.target.value), ...(placeholder !== undefined && { placeholder }), className: cn("text-left tabular-nums", className) }));
48
+ }, onBlur: () => setFocused(false), onChange: (e) => handleChange(e.target.value), ...(placeholder !== undefined && { placeholder }), className: cn("text-left tabular-nums", suffix !== undefined && "pr-8", className) }));
49
+ if (suffix === undefined)
50
+ return input;
51
+ return (_jsxs("div", { className: "relative", children: [input, _jsx("span", { style: inlineSuffixStyle(shownText), className: "pointer-events-none absolute top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground", children: suffix })] }));
46
52
  }
@@ -1,3 +1,3 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { PageHeaderProps } from "../../index.ts";
3
- export declare function DefaultPageHeader({ title, recordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }: PageHeaderProps): ReactNode;
3
+ export declare function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }: PageHeaderProps): ReactNode;
@@ -4,11 +4,12 @@ import { createPortal } from "react-dom";
4
4
  import { usePageHeaderSlot } from "../layout/page-header-slot.js";
5
5
  import { UNIFORM_BAR_CONTROLS_CLASSES } from "../layout/uniform-bar-controls.js";
6
6
  import { cn } from "../lib/cn.js";
7
- export function DefaultPageHeader({ title, recordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }) {
7
+ export function DefaultPageHeader({ title, recordTitle, narrowRecordTitle, status, actions, bodyTitle, overflowItems, hideBreadcrumb, breadcrumbScreenId, }) {
8
8
  const slot = usePageHeaderSlot();
9
9
  const setOverflowItems = slot?.setOverflowItems;
10
10
  const setTitle = slot?.setTitle;
11
11
  const setRecordTitle = slot?.setRecordTitle;
12
+ const setNarrowRecordTitle = slot?.setNarrowRecordTitle;
12
13
  const setBodyTitle = slot?.setBodyTitle;
13
14
  const setBreadcrumbHidden = slot?.setBreadcrumbHidden;
14
15
  const setBreadcrumbScreenId = slot?.setBreadcrumbScreenId;
@@ -37,6 +38,12 @@ export function DefaultPageHeader({ title, recordTitle, status, actions, bodyTit
37
38
  setRecordTitle(recordTitle);
38
39
  return () => setRecordTitle(undefined);
39
40
  }, [setRecordTitle, recordTitle]);
41
+ useEffect(() => {
42
+ if (setNarrowRecordTitle === undefined || narrowRecordTitle === undefined)
43
+ return;
44
+ setNarrowRecordTitle(narrowRecordTitle);
45
+ return () => setNarrowRecordTitle(undefined);
46
+ }, [setNarrowRecordTitle, narrowRecordTitle]);
40
47
  useEffect(() => {
41
48
  if (setTitle === undefined || title === undefined)
42
49
  return;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
2
+ import { ChevronDown, ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { useOptionalLocale, useTranslation } from "../../index.js";
5
5
  import { cn } from "../lib/cn.js";
@@ -52,8 +52,8 @@ export function InfiniteSentinel({ onReachEnd, loadingMore, hasMore, rowsCount,
52
52
  const showEndLabel = !hasMore && rowsCount >= END_LABEL_MIN_ROWS;
53
53
  return (_jsx("div", { ref: ref, "data-testid": testId, className: cn("flex items-center justify-center text-sm text-muted-foreground", showEndLabel || loadingMore ? "py-4" : ""), children: showEndLabel ? (_jsx("span", { "data-testid": testId !== undefined ? `${testId}-end` : undefined, children: t("kumiko.list.end-of-list") })) : loadingMore ? (_jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" })) : hasMore ? (_jsx("span", { "aria-hidden": "true", children: "\u00A0" })) : null }));
54
54
  }
55
- // Pager — left "X – Y of Z · N per page" (the page size is a select in text
56
- // style), right "‹ 1 2 3 ›" from sm; below sm only the arrows.
55
+ // Pager — left "X – Y of Z", right the page size select in text style and "‹ Page 1 of 3 ›" from sm; below sm
56
+ // only the arrows.
57
57
  // `pinned` renders the footer bar of a scrollBody table (fixed height, top
58
58
  // border); unpinned it sits as a plain row below the table.
59
59
  //
@@ -65,32 +65,23 @@ export function Pager({ page, limit, total, onPageChange, pageSizeOptions, onPag
65
65
  const locale = useOptionalLocale();
66
66
  const totalPages = Math.max(1, Math.ceil(total / limit));
67
67
  const safePage = Math.max(1, Math.min(page, totalPages));
68
- const from = (safePage - 1) * limit + 1;
68
+ const from = total === 0 ? 0 : (safePage - 1) * limit + 1;
69
69
  const to = Math.min(safePage * limit, total);
70
70
  return (_jsxs("div", { "data-testid": testId, className: plain === true
71
71
  ? "flex items-center justify-between px-4 pb-3 pt-1 text-[12.5px] tabular-nums text-muted-foreground"
72
72
  : pinned === true
73
73
  ? TABLE_FOOTER_BAR_CLASS
74
- : "mt-3 flex items-center gap-4 text-[12.5px] tabular-nums text-muted-foreground", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: [_jsx("div", { "data-testid": testId !== undefined ? `${testId}-status` : undefined, children: t("kumiko.pager.status", {
74
+ : "mt-3 flex items-center gap-4 text-[12.5px] tabular-nums text-muted-foreground", children: [_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: _jsx("div", { "data-testid": testId !== undefined ? `${testId}-status` : undefined, children: total === 0
75
+ ? t("kumiko.pager.statusEmpty")
76
+ : t("kumiko.pager.status", {
75
77
  from: from.toLocaleString(locale),
76
78
  to: to.toLocaleString(locale),
77
79
  total: total.toLocaleString(locale),
78
- }) }), pageSizeOptions !== undefined && onPageSizeChange !== undefined && (_jsxs("div", { className: "hidden items-center sm:flex", children: [_jsx("span", { "aria-hidden": "true", children: "\u00B7" }), _jsx("select", { "aria-label": t("kumiko.pager.pageSizeLabel"), "data-testid": testId !== undefined ? `${testId}-page-size` : undefined, value: limit, onChange: (e) => onPageSizeChange(Number(e.target.value)), className: "h-7 cursor-pointer appearance-none rounded-md border-0 bg-transparent px-1.5 text-[12.5px] text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: pageSizeOptions.map((size) => (_jsx("option", { value: size, children: t("kumiko.pager.pageSize", { size: size.toLocaleString(locale) }) }, size))) })] }))] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(PagerButton, { ariaLabel: t("kumiko.pager.previousPage"), disabled: safePage <= 1, onClick: () => onPageChange(safePage - 1), testId: testId !== undefined ? `${testId}-prev` : undefined, children: _jsx(ChevronLeft, { className: "size-3.5", "aria-hidden": "true" }) }), _jsx("div", { className: "hidden items-center gap-1 sm:flex", children: pageNumbersAround(safePage, totalPages).map((entry) => typeof entry !== "number" ? (_jsx("span", { "aria-hidden": "true", className: "px-1", children: "\u2026" }, `gap-${entry.gapBefore}`)) : (_jsx(PageNumberButton, { page: entry, current: entry === safePage, label: t("kumiko.pager.goToPage", { page: entry.toLocaleString() }), onClick: () => onPageChange(entry), testId: testId !== undefined ? `${testId}-page-${entry}` : undefined }, entry))) }), _jsx(PagerButton, { ariaLabel: t("kumiko.pager.nextPage"), disabled: safePage >= totalPages, onClick: () => onPageChange(safePage + 1), testId: testId !== undefined ? `${testId}-next` : undefined, children: _jsx(ChevronRight, { className: "size-3.5", "aria-hidden": "true" }) })] })] }));
79
- }
80
- // All pages up to 7, else first, last and the neighbours of the current page, gaps in between.
81
- function pageNumbersAround(current, totalPages) {
82
- if (totalPages <= 7)
83
- return Array.from({ length: totalPages }, (_, i) => i + 1);
84
- const wanted = new Set([1, current - 1, current, current + 1, totalPages]);
85
- const pages = [...wanted].filter((page) => page >= 1 && page <= totalPages).sort((a, b) => a - b);
86
- return pages.flatMap((page, index) => {
87
- const previous = pages[index - 1];
88
- return previous !== undefined && page - previous > 1 ? [{ gapBefore: page }, page] : [page];
89
- });
90
- }
91
- function PageNumberButton({ page, current, label, onClick, testId, }) {
92
- return (_jsx("button", { type: "button", onClick: onClick, "aria-label": label, "aria-current": current ? "page" : undefined, "data-testid": testId, className: cn("inline-flex h-6 min-w-6 items-center justify-center rounded px-1.5", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", current && "bg-primary text-primary-foreground hover:bg-primary"), children: page.toLocaleString() }));
80
+ }) }) }), _jsxs("div", { className: "flex items-center gap-1", children: [pageSizeOptions !== undefined && onPageSizeChange !== undefined && (_jsxs("div", { className: "relative mr-2 hidden items-center sm:flex", children: [_jsx("select", { "aria-label": t("kumiko.pager.pageSizeLabel"), "data-testid": testId !== undefined ? `${testId}-page-size` : undefined, value: limit, onChange: (e) => onPageSizeChange(Number(e.target.value)), className: "h-8 cursor-pointer appearance-none rounded-md border border-border-strong bg-card py-0 pl-2.5 pr-7 text-[12.5px] text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", children: pageSizeOptions.map((size) => (_jsx("option", { value: size, children: t("kumiko.pager.pageSize", { size: size.toLocaleString(locale) }) }, size))) }), _jsx(ChevronDown, { className: "pointer-events-none absolute right-2 size-3.5 text-muted-foreground", "aria-hidden": "true" })] })), _jsx(PagerButton, { ariaLabel: t("kumiko.pager.previousPage"), disabled: safePage <= 1, onClick: () => onPageChange(safePage - 1), testId: testId !== undefined ? `${testId}-prev` : undefined, children: _jsx(ChevronLeft, { className: "size-3.5", "aria-hidden": "true" }) }), _jsx("span", { "data-testid": testId !== undefined ? `${testId}-page-label` : undefined, className: "hidden px-1 sm:inline", children: t("kumiko.pager.pageOf", {
81
+ page: safePage.toLocaleString(locale),
82
+ total: totalPages.toLocaleString(locale),
83
+ }) }), _jsx(PagerButton, { ariaLabel: t("kumiko.pager.nextPage"), disabled: safePage >= totalPages, onClick: () => onPageChange(safePage + 1), testId: testId !== undefined ? `${testId}-next` : undefined, children: _jsx(ChevronRight, { className: "size-3.5", "aria-hidden": "true" }) })] })] }));
93
84
  }
94
85
  function PagerButton({ children, onClick, ariaLabel, disabled, testId, }) {
95
- return (_jsx("button", { type: "button", onClick: onClick, disabled: disabled, "aria-label": ariaLabel, "data-testid": testId, className: cn("inline-flex size-11 items-center justify-center rounded sm:size-6", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:text-foreground-disabled"), children: children }));
86
+ return (_jsx("button", { type: "button", onClick: onClick, disabled: disabled, "aria-label": ariaLabel, "data-testid": testId, className: cn("inline-flex size-8 items-center justify-center rounded-md border border-border-strong bg-card", "hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:pointer-events-none disabled:text-foreground-disabled"), children: children }));
96
87
  }
@@ -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,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from "../lib/cn.js";
3
+ import { FileThumbnail } from "./file-thumbnail.js";
4
+ export function DefaultPhotoGrid({ tiles, testId }) {
5
+ return (_jsx("ul", { "data-testid": testId, className: "m-0 grid list-none gap-3.5 p-0 [grid-template-columns:repeat(2,minmax(0,1fr))] md:[grid-template-columns:repeat(3,minmax(0,1fr))]", children: tiles.map((tile) => (_jsxs("li", { "data-testid": testId !== undefined ? `${testId}-tile-${tile.id}` : undefined, className: cn("flex flex-col overflow-hidden rounded-lg border border-border bg-card", tile.leadsOnNarrow === true && "max-sm:-order-1"), children: [_jsxs("div", { className: "relative", children: [_jsx(FileThumbnail, { fileId: tile.imageId ?? "", className: "aspect-[3/2] w-full object-cover md:aspect-[2/1]" }), tile.badge !== undefined && (_jsx("span", { "data-slot": "photo-badge", className: "absolute top-2 left-2 rounded-full bg-status-warn-surface px-2 py-0.5 text-xs font-medium text-status-warn", children: tile.badge }))] }), _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2 p-3", children: [tile.caption !== undefined && (_jsx("span", { className: "min-w-0 truncate text-[13px] text-foreground", children: tile.caption })), tile.actions !== undefined && (_jsx("div", { className: "ml-auto flex flex-wrap items-center gap-x-3 gap-y-1", children: tile.actions }))] })] }, tile.id))) }));
6
+ }
@@ -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, testId, }: RecordStepsProps): ReactNode;
@@ -4,14 +4,6 @@ import { cn } from "../lib/cn.js";
4
4
  import { InsideScreenFormColumnContext } from "./metric.js";
5
5
  import { ReasonBox, ReasonInfoButton } from "./reason-box.js";
6
6
  import { useIsBelowSmViewport } from "./use-narrow-viewport.js";
7
- const STEP_STRIPE_CLASS = {
8
- bad: "bg-status-bad",
9
- warn: "bg-status-warn",
10
- critical: "bg-status-critical",
11
- ok: "bg-status-ok",
12
- accent: "bg-primary",
13
- neutral: "bg-border-strong",
14
- };
15
7
  function StepTitle({ item }) {
16
8
  const narrow = useIsBelowSmViewport();
17
9
  return narrow ? (item.narrowTitle ?? item.title) : item.title;
@@ -23,19 +15,18 @@ function StepDetail({ item }) {
23
15
  return null;
24
16
  return _jsx("small", { className: "block text-xs text-muted-foreground", children: detail });
25
17
  }
26
- function StepRow({ item, reasonLabel }) {
18
+ function StepRow({ item, reasonLabel, moreActionsLabel, }) {
27
19
  const [reasonOpen, setReasonOpen] = useState(item.reasonOpen === true);
28
20
  const reasonBoxId = useId();
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 }) }))] }));
21
+ return (_jsxs("li", { "data-testid": `record-step-${item.id}`, "data-tone": item.tone, className: "grid min-h-16 grid-cols-[minmax(0,1fr)_auto] content-center gap-x-3 gap-y-1 px-4 py-2.5", children: [_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) }) }))] }), _jsx("div", { className: "col-start-1 row-start-2 min-w-0 sm:col-span-1", children: _jsx(StepDetail, { item: item }) }), item.actions !== undefined && (_jsx("div", { className: "flex shrink-0 items-center gap-3 max-sm:col-span-2 max-sm:row-start-3 max-sm:mt-1 [&_button]:h-9 [&_button_svg]:hidden max-sm:[&>*]:w-full max-sm:[&_button]:w-full sm:col-start-2 sm:row-span-2 sm:row-start-1 sm:self-center", children: item.actions })), item.moreActions !== undefined && (_jsxs("div", { "data-testid": `record-step-${item.id}-more-actions`, className: "col-span-2 row-start-4 mt-1 flex flex-wrap items-center gap-x-3 gap-y-2 border-t border-border-row pt-2.5 text-[12.5px]", children: [moreActionsLabel !== undefined && (_jsx("span", { className: "text-muted-foreground max-sm:w-full", "data-testid": `record-step-${item.id}-more-actions-label`, children: moreActionsLabel })), _jsx("div", { className: "flex flex-wrap items-center gap-2 text-[12.5px] [&_button]:h-9 [&_button]:rounded-md [&_button]:border [&_button]:border-border-strong [&_button]:bg-card [&_button]:px-3 [&_button]:text-[12.5px] [&_button]:font-medium [&_button]:text-foreground [&_button_svg]:text-primary", children: item.moreActions })] })), item.reason !== undefined && reasonOpen && (_jsx("div", { className: "col-span-2 row-start-5 max-sm:hidden", children: _jsx(ReasonBox, { id: reasonBoxId, testId: `record-step-${item.id}-reason`, ...(item.reasonTitle !== undefined && { title: item.reasonTitle }), children: item.reason }) }))] }));
31
22
  }
32
- function StepsHeader({ title, subtitle, count, testId, }) {
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 }))] }));
23
+ function StepsHeader({ title, subtitle }) {
24
+ return (_jsxs("header", { className: "flex flex-wrap items-baseline gap-x-3 gap-y-1 px-4 pt-2.5", children: [_jsx("h3", { className: "m-0 text-[11.5px] font-normal text-muted-foreground", children: title }), subtitle !== undefined && (_jsx("span", { className: "text-[13px] text-muted-foreground max-sm:hidden", children: subtitle }))] }));
34
25
  }
35
26
  function StepsMoreToggle({ testId, expanded, label, onToggle, }) {
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] }));
27
+ return (_jsx("button", { type: "button", "data-testid": `${testId ?? "record-steps"}-toggle`, "aria-expanded": expanded, className: "w-full border-t border-border-row px-4 py-3 text-left text-sm font-medium text-primary hover:underline max-sm:py-[9px] max-sm:text-xs max-sm:font-normal", onClick: onToggle, children: label }));
37
28
  }
38
- export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, items, count, testId, }) {
29
+ export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, narrowLimit, moreLabel, lessLabel, moreActionsLabel, items, testId, }) {
39
30
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
40
31
  const narrow = useIsBelowSmViewport();
41
32
  const [expanded, setExpanded] = useState(false);
@@ -46,5 +37,5 @@ export function DefaultRecordSteps({ title, subtitle, emptyLabel, reasonLabel, n
46
37
  : expanded
47
38
  ? lessLabel
48
39
  : 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) }))] }) }));
40
+ return (_jsx("section", { "data-testid": testId, className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsxs("div", { className: "rounded-[9px] border border-border bg-card", children: [_jsx(StepsHeader, { title: title, subtitle: subtitle }), 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
41
  }
@@ -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;
@@ -1,5 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
+ import { Icon } from "../icons.js";
3
4
  import { cn } from "../lib/cn.js";
4
5
  import { InsideScreenFormColumnContext } from "./metric.js";
5
6
  import { useIsBelowSmViewport } from "./use-narrow-viewport.js";
@@ -11,8 +12,12 @@ const SUMMARY_BORDER_CLASS = {
11
12
  accent: "border-primary",
12
13
  neutral: "border-border-strong",
13
14
  };
14
- export function DefaultRecordSummary({ text, narrowText, tone, testId, }) {
15
+ export function DefaultRecordSummary({ text, narrowText, tone, icon, testId, }) {
15
16
  const insideScreenFormColumn = useContext(InsideScreenFormColumnContext);
16
17
  const narrow = useIsBelowSmViewport();
17
- return (_jsx("div", { className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsx("p", { "data-testid": testId, "data-tone": tone, className: cn("m-0 rounded-lg border border-l-[3px] bg-card px-3.5 py-2.5 sm:px-[18px] sm:py-3.5 font-heading text-[15px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground", tone === undefined ? "border-l-primary" : SUMMARY_BORDER_CLASS[tone]), children: narrow && narrowText !== undefined ? narrowText : text }) }));
18
+ const shownText = narrow && narrowText !== undefined ? narrowText : text;
19
+ if (icon !== undefined) {
20
+ return (_jsx("div", { className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsxs("p", { "data-testid": testId, "data-tone": tone, className: "m-0 flex items-start gap-2.5 font-heading text-[15px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground", children: [_jsx(Icon, { name: icon, className: "mt-1 size-4 shrink-0 text-primary" }), _jsx("span", { children: shownText })] }) }));
21
+ }
22
+ return (_jsx("div", { className: cn("shrink-0", !insideScreenFormColumn && "px-6 py-2 max-sm:px-4"), children: _jsx("p", { "data-testid": testId, "data-tone": tone, className: cn("m-0 rounded-lg border border-l-[3px] bg-card px-3.5 py-2.5 sm:px-[18px] sm:py-3.5 font-heading text-[15px] leading-[1.5] sm:text-[17px] sm:leading-relaxed text-foreground", tone === undefined ? "border-l-primary" : SUMMARY_BORDER_CLASS[tone]), children: shownText }) }));
18
23
  }
@@ -11,6 +11,11 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
11
11
  import { useToast } from "./toast.js";
12
12
  import "../react-css-custom-properties.js";
13
13
  import { actionIconFor, SECONDARY_BUTTON_EXTRA_CLASSES } from "./button.js";
14
+ // RowAction carries no AI marker; the sparkles icon is the convention for an
15
+ // AI-prepared action (same as record guidance), so it selects the soft look.
16
+ function isSoftAiAction(action, icon) {
17
+ return action.style !== "danger" && icon === "sparkles";
18
+ }
14
19
  // The primary row action always remains a visible text button: `edit` when declared,
15
20
  // otherwise the first visible action ("Edit appears in every row, always, as text").
16
21
  function primaryRowAction(actions) {
@@ -91,9 +96,9 @@ function useRowActionTrigger(row) {
91
96
  }
92
97
  // An icon-only form without a resolvable icon would render an empty button.
93
98
  // `compact` is the narrow card layout, where "responsive" collapses to its icon.
94
- function effectiveRowActionDisplay(display, hasIcon, compact) {
99
+ function effectiveRowActionDisplay(display, hasIcon, compact, keepsLabel) {
95
100
  if (display === "responsive")
96
- return hasIcon && compact ? "icon" : "button";
101
+ return hasIcon && compact && !keepsLabel ? "icon" : "button";
97
102
  if (display === "icon" && !hasIcon)
98
103
  return "link";
99
104
  return display;
@@ -102,25 +107,30 @@ function RowActionButton({ row, action, iconOnly = false, asLink = false, compac
102
107
  const { busy, triggerNow } = useRowActionTrigger(row);
103
108
  const [confirmOpen, setConfirmOpen] = useState(false);
104
109
  const resolvedIcon = actionIconFor(action.icon);
105
- const resolvedDisplay = effectiveRowActionDisplay(action.display, resolvedIcon !== undefined, compact);
106
- // A card's small row action is always an outlined button, also when the author asked for a link.
107
- const display = small && resolvedDisplay === "link" ? "button" : resolvedDisplay;
110
+ const resolvedDisplay = effectiveRowActionDisplay(action.display, resolvedIcon !== undefined, compact, isSoftAiAction(action, resolvedIcon));
111
+ const display = resolvedDisplay;
112
+ if (display === "text") {
113
+ return (_jsx("span", { "data-testid": `row-${row.id}-action-${action.id}`, className: cn("px-2.5 text-muted-foreground", small ? "text-[13px]" : "text-sm"), children: action.label }));
114
+ }
108
115
  const isBorderedButton = display === "button";
116
+ const isSoftAiButton = isBorderedButton && isSoftAiAction(action, resolvedIcon);
109
117
  const showIconOnly = display === "icon" || (display === undefined && iconOnly && resolvedIcon !== undefined);
110
118
  const linkLike = display === "link" || (display === undefined && asLink);
111
- const variantClass = isBorderedButton
112
- ? action.style === "primary"
113
- ? "border border-transparent bg-primary text-primary-foreground hover:bg-primary/90"
119
+ const variantClass = isSoftAiButton
120
+ ? "border border-transparent bg-primary/10 text-primary hover:bg-primary/15"
121
+ : isBorderedButton
122
+ ? action.style === "primary"
123
+ ? "border border-transparent bg-primary text-primary-foreground hover:bg-primary/90"
124
+ : action.style === "danger"
125
+ ? "border border-destructive/40 bg-card text-destructive hover:bg-destructive/10"
126
+ : "border border-border-strong bg-card text-foreground hover:bg-accent"
114
127
  : action.style === "danger"
115
- ? "border border-destructive/40 bg-card text-destructive hover:bg-destructive/10"
116
- : "border border-border-strong bg-card text-foreground hover:bg-accent"
117
- : action.style === "danger"
118
- ? "text-destructive hover:bg-destructive/10"
119
- : linkLike
120
- ? "font-medium text-primary hover:bg-muted"
121
- : action.style === "primary"
122
- ? "text-primary hover:bg-primary/10"
123
- : "text-foreground hover:bg-accent";
128
+ ? "text-destructive hover:bg-destructive/10"
129
+ : linkLike
130
+ ? "font-medium text-primary hover:bg-muted"
131
+ : action.style === "primary"
132
+ ? "text-primary hover:bg-primary/10"
133
+ : "text-foreground hover:bg-accent";
124
134
  return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", "data-testid": `row-${row.id}-action-${action.id}`, disabled: busy, ...(showIconOnly && { "aria-label": action.label, title: action.label }), onClick: (e) => {
125
135
  e.stopPropagation();
126
136
  if (needsActionConfirm(action)) {
@@ -129,13 +139,17 @@ function RowActionButton({ row, action, iconOnly = false, asLink = false, compac
129
139
  else {
130
140
  void triggerNow(action);
131
141
  }
132
- }, className: cn("inline-flex items-center justify-center gap-1.5 text-sm", isBorderedButton
133
- ? small
134
- ? cn("rounded-md font-medium", COMPACT_TAP_CLASSES)
135
- : "h-8 rounded-md px-3 font-medium max-md:h-11"
136
- : linkLike
137
- ? "h-7 rounded-md px-2.5 max-md:h-11"
138
- : "h-8 rounded-sm max-md:h-11", showIconOnly ? "w-8 max-md:w-11" : !linkLike && !isBorderedButton && "px-2", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:opacity-50 disabled:pointer-events-none", variantClass), children: busy ? (_jsx(Loader2, { className: "size-3.5 animate-spin", "aria-hidden": "true" })) : resolvedIcon === undefined || (linkLike && !showIconOnly) ? (action.label) : showIconOnly ? (_jsx(Icon, { name: resolvedIcon, className: "size-4" })) : (_jsxs(_Fragment, { children: [_jsx(Icon, { name: resolvedIcon, className: "size-4" }), action.label] })) }), _jsx(DefaultDialog, { open: confirmOpen, onOpenChange: setConfirmOpen, title: action.label, ...(action.confirm !== undefined && { description: action.confirm }), confirmLabel: action.confirmLabel ?? action.label, ...(action.style === "danger" && { variant: "danger" }), onConfirm: () => triggerNow(action), testId: `row-${row.id}-action-${action.id}-dialog` })] }));
142
+ }, className: cn("inline-flex items-center justify-center gap-1.5 text-sm", isSoftAiButton
143
+ ? "h-[26px] rounded-md px-2.5 text-[12.5px] font-semibold"
144
+ : isBorderedButton
145
+ ? small
146
+ ? cn("rounded-md font-medium", COMPACT_TAP_CLASSES)
147
+ : "h-8 rounded-md px-3 font-medium max-md:h-11"
148
+ : linkLike
149
+ ? small
150
+ ? "h-8 rounded-md px-0 text-[13px] font-medium"
151
+ : "h-7 rounded-md px-2.5 max-md:h-11"
152
+ : "h-8 rounded-sm max-md:h-11", showIconOnly ? "w-8 max-md:w-11" : !linkLike && !isBorderedButton && "px-2", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:opacity-50 disabled:pointer-events-none", variantClass), children: busy ? (_jsx(Loader2, { className: "size-3.5 animate-spin", "aria-hidden": "true" })) : resolvedIcon === undefined || (linkLike && !showIconOnly) ? (action.label) : showIconOnly ? (_jsx(Icon, { name: resolvedIcon, className: "size-4" })) : (_jsxs(_Fragment, { children: [_jsx(Icon, { name: resolvedIcon, className: "size-4" }), action.label] })) }), _jsx(DefaultDialog, { open: confirmOpen, onOpenChange: setConfirmOpen, title: action.label, ...(action.confirm !== undefined && { description: action.confirm }), confirmLabel: action.confirmLabel ?? action.label, ...(action.style === "danger" && { variant: "danger" }), onConfirm: () => triggerNow(action), testId: `row-${row.id}-action-${action.id}-dialog` })] }));
139
153
  }
140
154
  // Kebab dropdown for >2 actions, one inline confirm dialog per item like
141
155
  // the inline-button path. Menu is controlled so it closes explicitly on
@@ -0,0 +1,3 @@
1
+ import type { ReactNode } from "react";
2
+ import type { StepListProps } from "../../index.ts";
3
+ export declare function DefaultStepList({ items, testId }: StepListProps): ReactNode;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { statusToneForOptionTone } from "../../status-tone.js";
3
+ import { StatusBadge } from "../widgets/status-badge.js";
4
+ export function DefaultStepList({ items, testId }) {
5
+ return (_jsx("ol", { "data-testid": testId, className: "m-0 flex list-none flex-col p-0", children: items.map((item, index) => {
6
+ const isLast = index === items.length - 1;
7
+ return (_jsxs("li", { "data-testid": testId !== undefined ? `${testId}-step-${item.id}` : undefined, className: "flex gap-3", children: [_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground", children: index + 1 }), !isLast && _jsx("span", { className: "my-1 w-px flex-1 bg-border" })] }), _jsxs("div", { className: isLast ? "flex flex-col gap-1" : "flex flex-col gap-1 pb-5", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: item.title }), item.status !== undefined && (_jsx(StatusBadge, { tone: (item.statusTone !== undefined
8
+ ? statusToneForOptionTone(item.statusTone)
9
+ : undefined) ?? "muted", children: item.status }))] }), item.description !== undefined && (_jsx("span", { className: "text-sm text-muted-foreground", children: item.description }))] })] }, item.id));
10
+ }) }));
11
+ }
@@ -0,0 +1,12 @@
1
+ import { type RefObject } from "react";
2
+ /** `narrow`: the referenced element is narrower than the card breakpoint. `docked`: the shell
3
+ * reports a docked assistant panel, which shrinks the content without changing the viewport (so
4
+ * a media query cannot see it) and not necessarily below the breakpoint. Both are false until
5
+ * measured and where ResizeObserver is missing. */
6
+ export declare function useContainerSqueeze<T extends HTMLElement>(): [
7
+ RefObject<T | null>,
8
+ {
9
+ readonly narrow: boolean;
10
+ readonly docked: boolean;
11
+ }
12
+ ];
@@ -0,0 +1,42 @@
1
+ import { useLayoutEffect, useRef, useState } from "react";
2
+ import { NARROW_VIEWPORT_BREAKPOINT_PX } from "./use-narrow-viewport.js";
3
+ // Set by the shell while the assistant panel is docked; the inset then gets that much right padding.
4
+ const DOCKED_PANEL_WIDTH_VAR = "--agent-panel-width";
5
+ function isPanelDocked(element) {
6
+ const width = Number.parseFloat(getComputedStyle(element).getPropertyValue(DOCKED_PANEL_WIDTH_VAR));
7
+ return Number.isFinite(width) && width > 0;
8
+ }
9
+ /** `narrow`: the referenced element is narrower than the card breakpoint. `docked`: the shell
10
+ * reports a docked assistant panel, which shrinks the content without changing the viewport (so
11
+ * a media query cannot see it) and not necessarily below the breakpoint. Both are false until
12
+ * measured and where ResizeObserver is missing. */
13
+ export function useContainerSqueeze() {
14
+ const ref = useRef(null);
15
+ const [narrow, setNarrow] = useState(false);
16
+ const [docked, setDocked] = useState(false);
17
+ useLayoutEffect(() => {
18
+ const element = ref.current;
19
+ // skip: no element or no observer support (SSR, bare test DOMs) keeps the viewport rules
20
+ if (element === null || typeof ResizeObserver === "undefined")
21
+ return;
22
+ const measure = () => {
23
+ const width = element.getBoundingClientRect().width;
24
+ setNarrow(width > 0 && width < NARROW_VIEWPORT_BREAKPOINT_PX);
25
+ setDocked(isPanelDocked(element));
26
+ };
27
+ measure();
28
+ const observer = new ResizeObserver(measure);
29
+ observer.observe(element);
30
+ // An overflowing table keeps its width when the panel docks, so only the variable change tells.
31
+ const styleObserver = new MutationObserver(measure);
32
+ styleObserver.observe(element.ownerDocument.documentElement, {
33
+ attributes: true,
34
+ attributeFilter: ["style"],
35
+ });
36
+ return () => {
37
+ observer.disconnect();
38
+ styleObserver.disconnect();
39
+ };
40
+ }, []);
41
+ return [ref, { narrow, docked }];
42
+ }
@@ -3,6 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { cn } from "../lib/cn.js";
5
5
  function Input({ className, type, ...props }) {
6
- return (_jsx("input", { type: type, "data-slot": "input", className: cn("h-9 w-full min-w-0 max-md:min-h-11 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className), ...props }));
6
+ return (_jsx("input", { type: type, "data-slot": "input", className: cn("h-[38px] w-full min-w-0 max-md:min-h-11 rounded-[7px] border-[1.5px] border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30", "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className), ...props }));
7
7
  }
8
8
  export { Input };
@@ -3,6 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { cn } from "../lib/cn.js";
5
5
  function Textarea({ className, ...props }) {
6
- return (_jsx("textarea", { "data-slot": "textarea", className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40", className), ...props }));
6
+ return (_jsx("textarea", { "data-slot": "textarea", className: cn("flex field-sizing-content min-h-16 w-full rounded-[7px] border-[1.5px] border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40", className), ...props }));
7
7
  }
8
8
  export { Textarea };