@cosmicdrift/kumiko-renderer 0.410.0 → 0.412.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 (89) hide show
  1. package/dist/app/projection-detail-body.js +1 -0
  2. package/dist/app/projection-detail-header.js +4 -1
  3. package/dist/app/use-projection-detail-actions.d.ts +1 -0
  4. package/dist/app/use-projection-detail-actions.js +7 -2
  5. package/dist/components/render-edit-fields-section.js +2 -1
  6. package/dist/components/render-edit-form-actions.d.ts +1 -0
  7. package/dist/components/render-edit-form-actions.js +10 -5
  8. package/dist/components/render-edit-layout.js +7 -11
  9. package/dist/components/render-edit-logic.d.ts +3 -0
  10. package/dist/components/render-edit-logic.js +10 -0
  11. package/dist/components/render-edit-submit-result.d.ts +1 -1
  12. package/dist/components/render-edit-submit-result.js +2 -2
  13. package/dist/components/render-edit-submit.js +6 -3
  14. package/dist/components/render-edit-titles.d.ts +1 -2
  15. package/dist/components/render-edit-titles.js +1 -2
  16. package/dist/components/render-edit-wizard-navigation.d.ts +1 -1
  17. package/dist/components/render-edit-wizard-navigation.js +8 -4
  18. package/dist/components/render-edit-wizard-rail.d.ts +12 -0
  19. package/dist/components/render-edit-wizard-rail.js +74 -0
  20. package/dist/components/render-field.js +4 -4
  21. package/dist/components/use-render-edit-state.d.ts +1 -0
  22. package/dist/components/use-render-edit-state.js +3 -1
  23. package/dist/data-table-view-types.d.ts +2 -0
  24. package/dist/headless/view-model/edit.js +17 -6
  25. package/dist/headless/view-model/types.d.ts +12 -0
  26. package/dist/hooks/use-list-table.d.ts +1 -0
  27. package/dist/hooks/use-list-table.js +2 -1
  28. package/dist/i18n-defaults.js +18 -0
  29. package/dist/primitives.d.ts +23 -6
  30. package/dist/required-marker-context.d.ts +2 -0
  31. package/dist/required-marker-context.js +3 -0
  32. package/dist/web/index.d.ts +5 -3
  33. package/dist/web/index.js +2 -1
  34. package/dist/web/layout/avatar.d.ts +5 -2
  35. package/dist/web/layout/avatar.js +3 -2
  36. package/dist/web/presence/index.d.ts +8 -0
  37. package/dist/web/presence/index.js +4 -0
  38. package/dist/web/presence/presence-avatars.d.ts +9 -0
  39. package/dist/web/presence/presence-avatars.js +16 -0
  40. package/dist/web/presence/presence-notice.d.ts +13 -0
  41. package/dist/web/presence/presence-notice.js +32 -0
  42. package/dist/web/presence/presence-signal.d.ts +3 -0
  43. package/dist/web/presence/presence-signal.js +20 -0
  44. package/dist/web/presence/use-presence-list.d.ts +12 -0
  45. package/dist/web/presence/use-presence-list.js +34 -0
  46. package/dist/web/presence/use-presence.d.ts +16 -0
  47. package/dist/web/presence/use-presence.js +77 -0
  48. package/dist/web/primitives/banner.d.ts +1 -1
  49. package/dist/web/primitives/banner.js +51 -16
  50. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  51. package/dist/web/primitives/data-table/sortable-header.js +4 -3
  52. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  53. package/dist/web/primitives/field.js +3 -1
  54. package/dist/web/primitives/form.d.ts +3 -1
  55. package/dist/web/primitives/form.js +4 -2
  56. package/dist/web/primitives/layout-elements.d.ts +1 -1
  57. package/dist/web/primitives/layout-elements.js +5 -2
  58. package/dist/web/primitives/layout.d.ts +1 -0
  59. package/dist/web/primitives/layout.js +4 -0
  60. package/dist/web/primitives/metric.js +4 -2
  61. package/dist/web/widgets/choice-cards.d.ts +7 -1
  62. package/dist/web/widgets/choice-cards.js +16 -3
  63. package/dist/web/widgets/composer.d.ts +16 -0
  64. package/dist/web/widgets/composer.js +9 -0
  65. package/dist/web/widgets/detail-list.d.ts +6 -2
  66. package/dist/web/widgets/detail-list.js +7 -3
  67. package/dist/web/widgets/floating-panel.d.ts +16 -1
  68. package/dist/web/widgets/floating-panel.js +23 -7
  69. package/dist/web/widgets/form-fields.d.ts +2 -1
  70. package/dist/web/widgets/form-fields.js +2 -2
  71. package/dist/web/widgets/index.d.ts +4 -2
  72. package/dist/web/widgets/index.js +2 -0
  73. package/dist/web/widgets/mode-switch.d.ts +7 -1
  74. package/dist/web/widgets/mode-switch.js +12 -5
  75. package/dist/web/widgets/result-panel.d.ts +3 -1
  76. package/dist/web/widgets/result-panel.js +3 -2
  77. package/dist/web/widgets/section-nav-layout.d.ts +14 -0
  78. package/dist/web/widgets/section-nav-layout.js +9 -0
  79. package/dist/web/widgets/side-by-side-table.d.ts +3 -1
  80. package/dist/web/widgets/side-by-side-table.js +2 -2
  81. package/dist/web/widgets/step-bar.js +1 -1
  82. package/dist/web/widgets/step-list-row.d.ts +15 -4
  83. package/dist/web/widgets/step-list-row.js +47 -5
  84. package/dist/web/widgets/step-list-selection.d.ts +42 -0
  85. package/dist/web/widgets/step-list-selection.js +134 -0
  86. package/dist/web/widgets/step-list.d.ts +21 -2
  87. package/dist/web/widgets/step-list.js +99 -14
  88. package/package.json +5 -5
  89. package/src/changes.json +84 -0
@@ -116,15 +116,28 @@ export type BannerProps = {
116
116
  * "this is shown only once"), "primary" for a call-to-action notice (neutral
117
117
  * background, accent in the primary color; pair it with `title` and `actions`),
118
118
  * "hint" for a quiet aside on a muted background (e.g. per-entry results of
119
- * a submit, with an "Open" link in `actions`). */
120
- readonly variant?: "error" | "info" | "loading" | "warning" | "primary" | "hint";
119
+ * a submit, with an "Open" link in `actions`), "ok" for a completed state
120
+ * (e.g. "Done, nothing left to do here"). */
121
+ readonly variant?: "error" | "info" | "loading" | "warning" | "primary" | "hint" | "ok";
122
+ /** "compact" is one line: the title reads inline before the text. */
123
+ readonly density?: "default" | "compact";
124
+ /** Icon left of the text. */
125
+ readonly icon?: NavIconKey;
121
126
  /** Bold heading above `children`, inside the text column. */
122
127
  readonly title?: ReactNode;
123
128
  readonly titleTestId?: string;
124
- readonly children: ReactNode;
129
+ readonly children?: ReactNode;
130
+ /** Structured text after `children`; `strong` parts render emphasized.
131
+ * Use instead of markup in strings. */
132
+ readonly parts?: readonly {
133
+ readonly text: string;
134
+ readonly strong?: boolean;
135
+ }[];
125
136
  /** Optional—additional buttons or elements to the right of the text (for
126
137
  * example, "Neu laden"). Inline, not a separate block. */
127
138
  readonly actions?: ReactNode;
139
+ /** Where `actions` sit: `end` (default) right of the text, `below` under it. */
140
+ readonly actionsPlacement?: "end" | "below";
128
141
  /** Adds outer spacing around the banner for page states where it renders
129
142
  * alone in the main area (KumikoScreen "not-found", "loading", etc.). The
130
143
  * web implementation adds p-6 as margin around the banner. */
@@ -916,6 +929,9 @@ export type SectionProps = {
916
929
  /** Optional muted subtitle below the title, providing section context rather
917
930
  * than only a label (analogous to `FormProps.subtitle`). */
918
931
  readonly subtitle?: ReactNode;
932
+ /** Shows the subtitle only below the `lg` breakpoint: a wizard's step rail
933
+ * carries the same text from `lg` up. Native impls may ignore it. */
934
+ readonly subtitleBelowLgOnly?: boolean;
919
935
  readonly children: ReactNode;
920
936
  /** Rendered top-right in the title row — never a footer. A
921
937
  * title-less/subtitle-less Section still draws the row when `actions`
@@ -1004,12 +1020,13 @@ export type TextProps = {
1004
1020
  readonly children: ReactNode;
1005
1021
  readonly testId?: string;
1006
1022
  };
1007
- /** Heading with two roles: `page` is a page title (web: h1), while `section`
1008
- * is a group subheading (web: h2 with uppercase and muted styling). Native
1023
+ /** Heading with three roles: `page` is a page title (web: h1), `section`
1024
+ * is a group subheading (web: h2 with uppercase and muted styling) and `group`
1025
+ * is a plain 16px semibold sub-title (web: h2, normal case). Native
1009
1026
  * implementations map these to `<Text>` with the corresponding font weight
1010
1027
  * and size. */
1011
1028
  export type HeadingProps = {
1012
- readonly variant?: "page" | "section";
1029
+ readonly variant?: "page" | "section" | "group";
1013
1030
  readonly children: ReactNode;
1014
1031
  readonly testId?: string;
1015
1032
  };
@@ -0,0 +1,2 @@
1
+ /** True inside a form that shows no required asterisk (all fields required, or `layout.hideRequiredMarker`). */
2
+ export declare const HideRequiredMarkerContext: import("react").Context<boolean>;
@@ -0,0 +1,3 @@
1
+ import { createContext } from "react";
2
+ /** True inside a form that shows no required asterisk (all fields required, or `layout.hideRequiredMarker`). */
3
+ export const HideRequiredMarkerContext = createContext(false);
@@ -17,7 +17,7 @@ export type { NavIconKey } from "./icons.tsx";
17
17
  export { Icon } from "./icons.tsx";
18
18
  export type { AppLayoutProps } from "./layout/app-layout.tsx";
19
19
  export { AppLayout } from "./layout/app-layout.tsx";
20
- export type { AvatarProps, AvatarSize } from "./layout/avatar.tsx";
20
+ export type { AvatarProps, AvatarShape, AvatarSize } from "./layout/avatar.tsx";
21
21
  export { Avatar } from "./layout/avatar.tsx";
22
22
  export type { DefaultAppShellProps } from "./layout/default-app-shell.tsx";
23
23
  export { DefaultAppShell } from "./layout/default-app-shell.tsx";
@@ -60,6 +60,8 @@ export { postWithDownload } from "./lib/download.ts";
60
60
  export { downloadFileRef, FileDownloadFailedError, fetchFileRefBlob, fileNameFromContentDisposition, saveBlobAsFile, } from "./lib/file-ref-download.ts";
61
61
  export { buildFileUploadFormData } from "./lib/file-upload-form-data.ts";
62
62
  export { type FileRefTarget, FileUploadFailedError, uploadFileRef } from "./lib/upload-file-ref.ts";
63
+ export type { PresenceAvatarsProps, PresenceNoticeProps, UsePresenceListOptions, UsePresenceListResult, UsePresenceOptions, UsePresenceResult, } from "./presence/index.ts";
64
+ export { PresenceAvatars, PresenceNotice, usePresence, usePresenceList, } from "./presence/index.ts";
63
65
  export type { ActionMenuProps, MenuItemDef } from "./primitives/action-menu.tsx";
64
66
  export { ActionMenu } from "./primitives/action-menu.tsx";
65
67
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, } from "./primitives/dropdown-menu.tsx";
@@ -76,5 +78,5 @@ export { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "./ui/resiz
76
78
  export { SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from "./ui/sidebar.tsx";
77
79
  export type { KumikoBuild } from "./version/update-checker.tsx";
78
80
  export { readLoadedBuild } from "./version/update-checker.tsx";
79
- export type { AiTextAreaProps, AiTextEndAction, AiTextFieldProps, BooleanFieldProps, ComparisonMetric, DateFieldProps, DrawerProps, FeedRow, FileFieldProps, FloatingPanelGeometry, FloatingPanelProps, InfinityListProps, InfinityListSelection, MessageAttachment, MessageBody, MessageReaderProps, MessageReaderTab, MessageThreadProps, MobileTopBarProps, ModeSwitchVariant, NumberFieldProps, PdfMatchInfo, PdfPreviewProps, PdfPreviewSource, PhotoSlotSpec, PhotoSlotsProps, PlanCardActionSlot, PlanCardLinkSlot, PlanCardPrice, PlanCardProps, PlanGridProps, ProgressListRow, PublicShellProps, PublicShellVariant, QueryTableColumn, QueryTableProps, RangeFieldProps, ResultColumn, SelectFieldProps, SideBySideTableCell, SideBySideTableColumn, SideBySideTableRow, StatDelta, StatTone, StatusBadgeTone, StatusBarEntry, StatusTone, StepAction, StepListItem, StepListProps, StepSource, StepStatus, StepTag, TextareaFieldProps, TextFieldProps, ThreadMessage, TimeseriesHeight, TimeseriesPoint, TimeseriesReferenceLine, TimeseriesXAxis, TimeseriesYAxis, UploadZoneProps, } from "./widgets/index.ts";
80
- export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.ts";
81
+ export type { AiTextAreaProps, AiTextEndAction, AiTextFieldProps, BooleanFieldProps, ComparisonMetric, ComposerProps, DateFieldProps, DrawerProps, FeedRow, FileFieldProps, FloatingPanelGeometry, FloatingPanelPlacement, FloatingPanelProps, InfinityListProps, InfinityListSelection, MessageAttachment, MessageBody, MessageReaderProps, MessageReaderTab, MessageThreadProps, MobileTopBarProps, ModeSwitchVariant, NumberFieldProps, PdfMatchInfo, PdfPreviewProps, PdfPreviewSource, PhotoSlotSpec, PhotoSlotsProps, PlanCardActionSlot, PlanCardLinkSlot, PlanCardPrice, PlanCardProps, PlanGridProps, ProgressListRow, PublicShellProps, PublicShellVariant, QueryTableColumn, QueryTableProps, RangeFieldProps, ResultColumn, SectionNavLayoutProps, SelectFieldProps, SideBySideTableCell, SideBySideTableColumn, SideBySideTableRow, StatDelta, StatTone, StatusBadgeTone, StatusBarEntry, StatusTone, StepAction, StepListItem, StepListProps, StepListSelection, StepSelectability, StepSelectionAction, StepSource, StepStatus, StepTag, TextareaFieldProps, TextFieldProps, ThreadMessage, TimeseriesHeight, TimeseriesPoint, TimeseriesReferenceLine, TimeseriesXAxis, TimeseriesYAxis, UploadZoneProps, } from "./widgets/index.ts";
82
+ export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, Composer, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SectionNavLayout, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.ts";
package/dist/web/index.js CHANGED
@@ -40,6 +40,7 @@ export { postWithDownload } from "./lib/download.js";
40
40
  export { downloadFileRef, FileDownloadFailedError, fetchFileRefBlob, fileNameFromContentDisposition, saveBlobAsFile, } from "./lib/file-ref-download.js";
41
41
  export { buildFileUploadFormData } from "./lib/file-upload-form-data.js";
42
42
  export { FileUploadFailedError, uploadFileRef } from "./lib/upload-file-ref.js";
43
+ export { PresenceAvatars, PresenceNotice, usePresence, usePresenceList, } from "./presence/index.js";
43
44
  export { ActionMenu } from "./primitives/action-menu.js";
44
45
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, } from "./primitives/dropdown-menu.js";
45
46
  export { BareFormProvider, DefaultCard as Card, defaultPrimitives, FormScreenShell, ScreenWidthProvider, } from "./primitives/index.js";
@@ -52,4 +53,4 @@ export { applyTokensToCssVars, defaultTokens, lightTokens, useBrowserTokensApi,
52
53
  export { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "./ui/resizable.js";
53
54
  export { SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider } from "./ui/sidebar.js";
54
55
  export { readLoadedBuild } from "./version/update-checker.js";
55
- export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.js";
56
+ export { AiSurface, AiTextArea, AiTextField, AttachmentCard, AttachmentChip, BooleanField, ChoiceCards, ClampedText, CollapsibleSection, ComparisonTable, Composer, DateField, DetailList, Drawer, EmptyState, ErrorState, FeedList, FileField, FloatingPanel, InfinityList, LoadingState, MessageReader, MessageThread, MiniStat, MobileTopBar, ModeSwitch, MoneyField, NumberField, PdfPreview, PercentField, PhotoSlots, PlanCard, PlanGrid, ProgressBar, ProgressList, PublicShell, QueryTable, RangeField, ResultPanel, ResultTable, SectionCard, SectionNavLayout, SelectField, SenderFrame, SenderSheet, SideBySideTable, Sparkline, STATUS_TONE_TEXT, StatCard, StatusBadge, StatusBarChart, StepBar, StepList, smoothPath, TextareaField, TextField, TimeseriesChart, UploadZone, useDraft, } from "./widgets/index.js";
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
- export type AvatarSize = "sm" | "md" | "lg";
2
+ export type AvatarSize = "xs" | "sm" | "md" | "lg";
3
+ export type AvatarShape = "square" | "round";
3
4
  export type AvatarProps = {
4
5
  /** Stable identifier—the source for the background-color hash. Usually
5
6
  * `user.id`; for avatars based only on a label, the label string can also
@@ -8,6 +9,8 @@ export type AvatarProps = {
8
9
  /** Full name or email—the initials are extracted from this value. */
9
10
  readonly label: string;
10
11
  readonly size?: AvatarSize;
12
+ /** Default square; round suits inline presence markers. */
13
+ readonly shape?: AvatarShape;
11
14
  readonly testId?: string;
12
15
  };
13
- export declare function Avatar({ id, label, size, testId }: AvatarProps): ReactNode;
16
+ export declare function Avatar({ id, label, size, shape, testId, }: AvatarProps): ReactNode;
@@ -24,6 +24,7 @@ const COLOR_CLASSES = [
24
24
  "bg-fuchsia-600 text-fuchsia-50",
25
25
  ];
26
26
  const SIZE_CLASSES = {
27
+ xs: "size-[18px] text-[9px]",
27
28
  sm: "size-5 text-[10px]",
28
29
  md: "size-6 text-[11px]",
29
30
  lg: "size-8 text-xs",
@@ -54,8 +55,8 @@ function extractInitials(label) {
54
55
  }
55
56
  return trimmed.slice(0, 2).toUpperCase();
56
57
  }
57
- export function Avatar({ id, label, size = "md", testId }) {
58
+ export function Avatar({ id, label, size = "md", shape = "square", testId, }) {
58
59
  const colorClass = useMemo(() => pickColor(id), [id]);
59
60
  const initials = useMemo(() => extractInitials(label), [label]);
60
- return (_jsx("span", { "data-testid": testId, role: "img", "aria-label": label, className: cn("inline-flex items-center justify-center rounded font-semibold uppercase select-none", SIZE_CLASSES[size], colorClass), children: initials }));
61
+ return (_jsx("span", { "data-testid": testId, role: "img", "aria-label": label, className: cn("inline-flex shrink-0 items-center justify-center font-semibold uppercase select-none", shape === "round" ? "rounded-full" : "rounded", SIZE_CLASSES[size], colorClass), children: initials }));
61
62
  }
@@ -0,0 +1,8 @@
1
+ export type { PresenceAvatarsProps } from "./presence-avatars.tsx";
2
+ export { PresenceAvatars } from "./presence-avatars.tsx";
3
+ export type { PresenceNoticeProps } from "./presence-notice.tsx";
4
+ export { PresenceNotice } from "./presence-notice.tsx";
5
+ export type { UsePresenceOptions, UsePresenceResult } from "./use-presence.ts";
6
+ export { usePresence } from "./use-presence.ts";
7
+ export type { UsePresenceListOptions, UsePresenceListResult } from "./use-presence-list.ts";
8
+ export { usePresenceList } from "./use-presence-list.ts";
@@ -0,0 +1,4 @@
1
+ export { PresenceAvatars } from "./presence-avatars.js";
2
+ export { PresenceNotice } from "./presence-notice.js";
3
+ export { usePresence } from "./use-presence.js";
4
+ export { usePresenceList } from "./use-presence-list.js";
@@ -0,0 +1,9 @@
1
+ import type { PresenceEntry } from "@cosmicdrift/kumiko-types/presence-types";
2
+ import type { ReactNode } from "react";
3
+ export type PresenceAvatarsProps = {
4
+ readonly entries: readonly PresenceEntry[];
5
+ readonly max?: number;
6
+ readonly testId?: string;
7
+ };
8
+ /** Small round avatars of the people on a row, with "+n" for the rest; for list rows. */
9
+ export declare function PresenceAvatars({ entries, max, testId, }: PresenceAvatarsProps): ReactNode;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from "../../index.js";
3
+ import { Avatar } from "../layout/avatar.js";
4
+ const DEFAULT_MAX_AVATARS = 3;
5
+ /** Small round avatars of the people on a row, with "+n" for the rest; for list rows. */
6
+ export function PresenceAvatars({ entries, max = DEFAULT_MAX_AVATARS, testId, }) {
7
+ const t = useTranslation();
8
+ if (entries.length === 0)
9
+ return null;
10
+ const shown = entries.slice(0, max);
11
+ const hiddenCount = entries.length - shown.length;
12
+ const names = t("kumiko.widget.presence.avatarsLabel", {
13
+ names: entries.map((entry) => entry.displayName).join(", "),
14
+ });
15
+ return (_jsxs("span", { "data-testid": testId, role: "img", "aria-label": names, title: names, className: "inline-flex items-center -space-x-1", children: [shown.map((entry) => (_jsx(Avatar, { id: entry.userId, label: entry.displayName, size: "xs", shape: "round" }, entry.userId))), hiddenCount > 0 && (_jsxs("span", { className: "pl-1.5 text-[11px] text-muted-foreground", children: ["+", hiddenCount] }))] }));
16
+ }
@@ -0,0 +1,13 @@
1
+ import type { PresenceEntry } from "@cosmicdrift/kumiko-types/presence-types";
2
+ import { type ReactNode } from "react";
3
+ export type PresenceNoticeProps = {
4
+ readonly entries: readonly PresenceEntry[];
5
+ /** Replaces the default "is looking at this / is editing this" text of the first entry. */
6
+ readonly describe?: (entry: PresenceEntry) => ReactNode;
7
+ /** Fixed "now" in epoch ms; without it the notice follows the clock once a minute. */
8
+ readonly nowMs?: number;
9
+ readonly testId?: string;
10
+ };
11
+ /** One quiet line above a record: who else is on it and for how long. Renders nothing when
12
+ * nobody is. */
13
+ export declare function PresenceNotice({ entries, describe, nowMs, testId, }: PresenceNoticeProps): ReactNode;
@@ -0,0 +1,32 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { pluralKey } from "../../headless/plural-key.js";
4
+ import { useTranslation } from "../../index.js";
5
+ import { Avatar } from "../layout/avatar.js";
6
+ const MINUTE_MS = 60_000;
7
+ function useMinuteClock(fixedNowMs) {
8
+ const [nowMs, setNowMs] = useState(() => Date.now());
9
+ useEffect(() => {
10
+ if (fixedNowMs !== undefined)
11
+ return;
12
+ const timer = setInterval(() => setNowMs(Date.now()), MINUTE_MS);
13
+ return () => clearInterval(timer);
14
+ }, [fixedNowMs]);
15
+ return fixedNowMs ?? nowMs;
16
+ }
17
+ /** One quiet line above a record: who else is on it and for how long. Renders nothing when
18
+ * nobody is. */
19
+ export function PresenceNotice({ entries, describe, nowMs, testId, }) {
20
+ const t = useTranslation();
21
+ const now = useMinuteClock(nowMs);
22
+ const [first] = entries;
23
+ if (first === undefined)
24
+ return null;
25
+ const minutes = Math.floor((now - Date.parse(first.since)) / MINUTE_MS);
26
+ const since = minutes < 1
27
+ ? t("kumiko.widget.presence.sinceJustNow")
28
+ : t("kumiko.widget.presence.sinceMinutes", { count: minutes });
29
+ const text = describe ? describe(first) : t(`kumiko.widget.presence.${first.activity}`);
30
+ const moreCount = entries.length - 1;
31
+ return (_jsxs("div", { "data-testid": testId, role: "status", className: "flex items-center gap-2 rounded-md bg-muted/60 px-3 py-2 text-[13px] text-foreground", children: [_jsx(Avatar, { id: first.userId, label: first.displayName, size: "xs", shape: "round" }), _jsxs("span", { className: "min-w-0 flex-1 truncate", children: [_jsx("strong", { className: "font-semibold", children: first.displayName }), " ", text, moreCount > 0 && (_jsxs(_Fragment, { children: [" · ", t(pluralKey("kumiko.widget.presence.moreOthers", moreCount), { count: moreCount })] }))] }), _jsx("span", { className: "shrink-0 text-muted-foreground", children: since })] }));
32
+ }
@@ -0,0 +1,3 @@
1
+ import type { DispatcherError } from "../../headless/index.ts";
2
+ export declare function isPresenceSignalFor(data: unknown, entity: string, id?: string): boolean;
3
+ export declare function isPermanentPresenceFailure(error: DispatcherError): boolean;
@@ -0,0 +1,20 @@
1
+ // The live frame is addressed to one user and carries no row data, only which room changed.
2
+ // Narrowed from `unknown` because the shared LiveEvent type describes entity frames.
3
+ export function isPresenceSignalFor(data, entity, id) {
4
+ if (typeof data !== "object" || data === null)
5
+ return false;
6
+ const signal = data;
7
+ if (signal.entity !== entity)
8
+ return false;
9
+ return id === undefined || signal.id === id;
10
+ }
11
+ const HTTP_REQUEST_TIMEOUT = 408;
12
+ const HTTP_TOO_MANY_REQUESTS = 429;
13
+ // A 4xx (feature not mounted, entity not allowed, row not visible, role denied) will not
14
+ // change by asking again, so presence goes quiet instead of retrying forever.
15
+ export function isPermanentPresenceFailure(error) {
16
+ return (error.httpStatus >= 400 &&
17
+ error.httpStatus < 500 &&
18
+ error.httpStatus !== HTTP_REQUEST_TIMEOUT &&
19
+ error.httpStatus !== HTTP_TOO_MANY_REQUESTS);
20
+ }
@@ -0,0 +1,12 @@
1
+ import { type PresenceEntry } from "@cosmicdrift/kumiko-types/presence-types";
2
+ export type UsePresenceListOptions = {
3
+ readonly entity: string;
4
+ readonly ids: readonly string[];
5
+ readonly enabled?: boolean;
6
+ };
7
+ export type UsePresenceListResult = {
8
+ readonly byId: Readonly<Record<string, readonly PresenceEntry[]>>;
9
+ };
10
+ /** Who else is on each of the given rows, for badges in a list. Polls every 25 s and refetches on
11
+ * the live signal of that entity; goes quiet after a permanent failure such as an unmounted feature. */
12
+ export declare function usePresenceList({ entity, ids, enabled, }: UsePresenceListOptions): UsePresenceListResult;
@@ -0,0 +1,34 @@
1
+ import { PRESENCE_CHANGED_EVENT, PRESENCE_LIST_MAX_IDS, PRESENCE_LIST_REFETCH_INTERVAL_MS, PRESENCE_QUERIES, } from "@cosmicdrift/kumiko-types/presence-types";
2
+ import { useEffect, useState } from "react";
3
+ import { useQuery } from "../../hooks/use-query.js";
4
+ import { useLiveEvents } from "../../sse/live-events.js";
5
+ import { isPermanentPresenceFailure, isPresenceSignalFor } from "./presence-signal.js";
6
+ const NO_ENTRIES = {};
7
+ /** Who else is on each of the given rows, for badges in a list. Polls every 25 s and refetches on
8
+ * the live signal of that entity; goes quiet after a permanent failure such as an unmounted feature. */
9
+ export function usePresenceList({ entity, ids, enabled = true, }) {
10
+ const subscribe = useLiveEvents();
11
+ const [gaveUpOn, setGaveUpOn] = useState(null);
12
+ const gaveUp = gaveUpOn === entity;
13
+ const active = enabled && !gaveUp;
14
+ const pageIds = ids.slice(0, PRESENCE_LIST_MAX_IDS);
15
+ const query = useQuery(PRESENCE_QUERIES.list, { entity, ids: pageIds }, {
16
+ enabled: active && pageIds.length > 0,
17
+ ...(active && { refetchIntervalMs: PRESENCE_LIST_REFETCH_INTERVAL_MS }),
18
+ });
19
+ const { refetch, error } = query;
20
+ useEffect(() => {
21
+ if (error !== null && isPermanentPresenceFailure(error))
22
+ setGaveUpOn(entity);
23
+ }, [error, entity]);
24
+ useEffect(() => {
25
+ // skip: nothing to listen for while the list is off or has given up
26
+ if (!active)
27
+ return;
28
+ return subscribe(PRESENCE_CHANGED_EVENT, (event) => {
29
+ if (isPresenceSignalFor(event.data, entity))
30
+ void refetch();
31
+ });
32
+ }, [subscribe, active, entity, refetch]);
33
+ return { byId: gaveUp ? NO_ENTRIES : (query.data?.byId ?? NO_ENTRIES) };
34
+ }
@@ -0,0 +1,16 @@
1
+ import { type PresenceActivity, type PresenceEntry } from "@cosmicdrift/kumiko-types/presence-types";
2
+ export type UsePresenceOptions = {
3
+ readonly entity: string;
4
+ readonly id: string;
5
+ readonly activity: PresenceActivity;
6
+ /** Which part of the record the user is on, e.g. `field:title`. */
7
+ readonly focus?: string;
8
+ readonly enabled?: boolean;
9
+ };
10
+ export type UsePresenceResult = {
11
+ readonly others: readonly PresenceEntry[];
12
+ };
13
+ /** Announces the user on one record: a heartbeat right away and every 15 s, a leave when the
14
+ * record closes. Returns the other people on it. Silent when the presence feature is not
15
+ * mounted or the record is off limits: no error, no retries. */
16
+ export declare function usePresence({ entity, id, activity, focus, enabled, }: UsePresenceOptions): UsePresenceResult;
@@ -0,0 +1,77 @@
1
+ import { PRESENCE_CHANGED_EVENT, PRESENCE_HEARTBEAT_INTERVAL_MS, PRESENCE_WRITES, } from "@cosmicdrift/kumiko-types/presence-types";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { useDispatcher } from "../../context/dispatcher-context.js";
4
+ import { useLiveEvents } from "../../sse/live-events.js";
5
+ import { isPermanentPresenceFailure, isPresenceSignalFor } from "./presence-signal.js";
6
+ const NO_ENTRIES = [];
7
+ function stateKey(activity, focus) {
8
+ return `${activity}|${focus ?? ""}`;
9
+ }
10
+ /** Announces the user on one record: a heartbeat right away and every 15 s, a leave when the
11
+ * record closes. Returns the other people on it. Silent when the presence feature is not
12
+ * mounted or the record is off limits: no error, no retries. */
13
+ export function usePresence({ entity, id, activity, focus, enabled = true, }) {
14
+ const dispatcher = useDispatcher();
15
+ const subscribe = useLiveEvents();
16
+ const [others, setOthers] = useState(NO_ENTRIES);
17
+ const latest = useRef({ activity, focus });
18
+ latest.current = { activity, focus };
19
+ const lastSentKey = useRef("");
20
+ const beat = useRef(async () => { });
21
+ useEffect(() => {
22
+ setOthers(NO_ENTRIES);
23
+ // skip: presence is switched off for this record
24
+ if (!enabled)
25
+ return;
26
+ let stopped = false;
27
+ let timer;
28
+ const stop = () => {
29
+ stopped = true;
30
+ if (timer !== undefined)
31
+ clearInterval(timer);
32
+ setOthers(NO_ENTRIES);
33
+ };
34
+ const send = async () => {
35
+ // skip: the record closed or presence gave up after a permanent failure
36
+ if (stopped)
37
+ return;
38
+ const current = latest.current;
39
+ lastSentKey.current = stateKey(current.activity, current.focus);
40
+ const result = await dispatcher.write(PRESENCE_WRITES.heartbeat, {
41
+ entity,
42
+ id,
43
+ activity: current.activity,
44
+ ...(current.focus !== undefined && { focus: current.focus }),
45
+ });
46
+ // skip: the answer belongs to a record that is no longer open
47
+ if (stopped)
48
+ return;
49
+ if (result.isSuccess)
50
+ setOthers(result.data.others);
51
+ else if (isPermanentPresenceFailure(result.error))
52
+ stop();
53
+ };
54
+ beat.current = send;
55
+ void send();
56
+ timer = setInterval(() => void send(), PRESENCE_HEARTBEAT_INTERVAL_MS);
57
+ const unsubscribe = subscribe(PRESENCE_CHANGED_EVENT, (event) => {
58
+ if (isPresenceSignalFor(event.data, entity, id))
59
+ void send();
60
+ });
61
+ return () => {
62
+ const wasStopped = stopped;
63
+ stopped = true;
64
+ if (timer !== undefined)
65
+ clearInterval(timer);
66
+ unsubscribe();
67
+ beat.current = async () => { };
68
+ if (!wasStopped)
69
+ void dispatcher.write(PRESENCE_WRITES.leave, { entity, id });
70
+ };
71
+ }, [dispatcher, subscribe, entity, id, enabled]);
72
+ useEffect(() => {
73
+ if (stateKey(activity, focus) !== lastSentKey.current)
74
+ void beat.current();
75
+ }, [activity, focus]);
76
+ return { others };
77
+ }
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { BannerProps } from "../../index.ts";
3
3
  import "../react-css-custom-properties.ts";
4
- export declare function DefaultBanner({ variant, title, titleTestId, children, actions, padded, testId, id, }: BannerProps): ReactNode;
4
+ export declare function DefaultBanner({ variant, density, icon, title, titleTestId, children, parts, actions, actionsPlacement, padded, testId, id, }: BannerProps): ReactNode;
@@ -1,28 +1,63 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from "../icons.js";
2
3
  import { cn } from "../lib/cn.js";
3
4
  import "../react-css-custom-properties.js";
4
5
  import { fieldLabelId } from "./field.js";
5
- // ---- Banner (shadcn: Alert) ----
6
- export function DefaultBanner({ variant = "info", title, titleTestId, children, actions, padded, testId, id, }) {
6
+ const ICON_COLOR_CLASS = {
7
+ hint: "text-primary",
8
+ info: "text-primary",
9
+ primary: "text-primary",
10
+ ok: "text-status-ok",
11
+ warning: "text-status-warn",
12
+ error: "text-destructive",
13
+ loading: "text-muted-foreground",
14
+ };
15
+ function variantClass(variant, compact) {
16
+ switch (variant) {
17
+ case "error":
18
+ return "border-destructive/50 text-destructive bg-destructive/10 dark:border-destructive";
19
+ case "warning":
20
+ return "border-status-warn/30 bg-status-warn/10 text-status-warn";
21
+ case "ok":
22
+ return "border-status-ok/30 bg-status-ok-surface text-foreground";
23
+ case "primary":
24
+ return "border-l-4 border-l-primary bg-card text-card-foreground";
25
+ case "hint":
26
+ return compact
27
+ ? "border-border bg-card text-foreground"
28
+ : "border-transparent bg-muted text-foreground";
29
+ default:
30
+ return "bg-card text-card-foreground";
31
+ }
32
+ }
33
+ function BannerParts({ parts }) {
34
+ return parts?.map((part) => part.strong === true ? (_jsx("strong", { className: "font-semibold", children: part.text }, `strong:${part.text}`)) : (_jsx("span", { children: part.text }, `plain:${part.text}`)));
35
+ }
36
+ function BannerText({ compact, title, titleTestId, children, parts, actionsBelow, }) {
37
+ if (compact) {
38
+ return (_jsxs("div", { className: "min-w-0 grow", children: [title !== undefined && (_jsxs(_Fragment, { children: [_jsx("strong", { "data-testid": titleTestId, className: "font-semibold", children: title }), " "] })), children, _jsx(BannerParts, { parts: parts })] }));
39
+ }
40
+ return (_jsxs("div", { className: "flex-1", children: [title !== undefined && (_jsx("div", { "data-testid": titleTestId, className: "font-semibold", children: title })), children, _jsx(BannerParts, { parts: parts }), actionsBelow] }));
41
+ }
42
+ function bannerLayoutClass(variant, compact, actionsBelow) {
43
+ 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-4 py-3 text-sm",
44
+ // Viewport breakpoint like the form footer bar; actions drop below the text on phones.
45
+ !compact &&
46
+ !actionsBelow &&
47
+ variant === "primary" &&
48
+ "flex-col items-start sm:flex-row sm:items-center", actionsBelow && "items-start", variantClass(variant, compact));
49
+ }
50
+ export function DefaultBanner({ variant = "info", density = "default", icon, title, titleTestId, children, parts, actions, actionsPlacement = "end", padded, testId, id, }) {
7
51
  const isError = variant === "error";
8
- const isWarning = variant === "warning";
9
- const isPrimary = variant === "primary";
52
+ const compact = density === "compact";
53
+ // A compact banner is one line, so its actions always stay at the end.
54
+ const actionsBelow = actionsPlacement === "below" && !compact && actions !== undefined;
10
55
  // `id` is set when a <Field> wraps this Banner as its control (see
11
56
  // BannerProps.id). A <div> isn't labelable, so a <label htmlFor> pointing
12
57
  // at it is inert for screen readers — role="group" + aria-labelledby is
13
58
  // the actual mechanism, pointed at the label id Field emits (fieldLabelId).
14
59
  const bannerRole = id !== undefined ? "group" : isError ? "alert" : undefined;
15
- const banner = (_jsxs("div", { role: bannerRole, ...(id !== undefined && { "aria-labelledby": fieldLabelId(id) }), "data-testid": testId, "data-variant": variant, className: cn("relative w-full rounded-lg border px-4 py-3 text-sm flex items-center gap-3",
16
- // Viewport breakpoint like the form footer bar; actions drop below the text on phones.
17
- isPrimary && "flex-col items-start sm:flex-row sm:items-center", isError
18
- ? "border-destructive/50 text-destructive bg-destructive/10 dark:border-destructive"
19
- : isWarning
20
- ? "border-status-warn/30 bg-status-warn/10 text-status-warn"
21
- : isPrimary
22
- ? "border-l-4 border-l-primary bg-card text-card-foreground"
23
- : variant === "hint"
24
- ? "border-transparent bg-muted text-foreground"
25
- : "bg-card text-card-foreground"), children: [_jsxs("div", { className: "flex-1", children: [title !== undefined && (_jsx("div", { "data-testid": titleTestId, className: "font-semibold", children: title })), children] }), actions !== undefined && _jsx("div", { "data-slot": "actions", children: actions })] }));
60
+ 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, title: title, 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 }))] }));
26
61
  // Page state: the banner sits alone in main (which no longer has padding).
27
62
  // The wrapper adds 24px outer spacing so the banner does not stick
28
63
  // edge-to-edge to the sidebar/browser.
@@ -1,12 +1,14 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
2
  import type { DataTableSort } from "../../../index.ts";
3
- export declare function SortableHeader({ field, label, sortable, highlighted, numeric, fitContent, className, sort, onSortChange, style, columnField, trailing, }: {
3
+ export declare const COMPACT_HEADER_CLASS = "text-xs font-semibold";
4
+ export declare function SortableHeader({ field, label, sortable, highlighted, numeric, fitContent, compact, className, sort, onSortChange, style, columnField, trailing, }: {
4
5
  readonly field: string;
5
6
  readonly label: string;
6
7
  readonly sortable: boolean;
7
8
  readonly highlighted?: boolean;
8
9
  readonly numeric?: boolean;
9
10
  readonly fitContent?: boolean;
11
+ readonly compact?: boolean;
10
12
  readonly className?: string;
11
13
  readonly sort?: DataTableSort;
12
14
  readonly onSortChange?: (next: DataTableSort | null) => void;
@@ -3,6 +3,7 @@ import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
3
3
  import { cn } from "../../lib/cn.js";
4
4
  import { TableHead } from "../../ui/table.js";
5
5
  import { FIT_CONTENT_CELL_CLASS } from "../data-table-cell.js";
6
+ export const COMPACT_HEADER_CLASS = "text-xs font-semibold";
6
7
  // SortableHeader: renders the th header per column, with or without
7
8
  // click-sort. Three paths:
8
9
  // (a) sortable=false OR no onSortChange -> plain label, no cursor
@@ -12,7 +13,7 @@ import { FIT_CONTENT_CELL_CLASS } from "../data-table-cell.js";
12
13
  // (c) sortable=true in the schema but no onSortChange prop -> still
13
14
  // label-only, but data-sortable=true stays so tests that know the
14
15
  // schema view keep working.
15
- export function SortableHeader({ field, label, sortable, highlighted, numeric, fitContent, className, sort, onSortChange, style, columnField, trailing, }) {
16
+ export function SortableHeader({ field, label, sortable, highlighted, numeric, fitContent, compact, className, sort, onSortChange, style, columnField, trailing, }) {
16
17
  const active = sort?.field === field ? sort : undefined;
17
18
  const ariaSort = active?.dir === "asc" ? "ascending" : active?.dir === "desc" ? "descending" : "none";
18
19
  const cellExtras = {
@@ -20,13 +21,13 @@ export function SortableHeader({ field, label, sortable, highlighted, numeric, f
20
21
  ...(columnField !== undefined && { "data-column-field": columnField }),
21
22
  };
22
23
  if (!sortable || onSortChange === undefined) {
23
- return (_jsxs(TableHead, { "data-testid": `column-${field}`, "data-sortable": sortable === true ? true : undefined, "data-highlighted": highlighted === true ? "true" : undefined, className: cn("font-medium whitespace-normal text-muted-foreground", numeric === true && "text-right", fitContent === true && FIT_CONTENT_CELL_CLASS, highlighted === true && "bg-accent/40", trailing !== undefined && "group/header relative", className), ...cellExtras, children: [label, trailing] }));
24
+ return (_jsxs(TableHead, { "data-testid": `column-${field}`, "data-sortable": sortable === true ? true : undefined, "data-highlighted": highlighted === true ? "true" : undefined, className: cn("font-medium whitespace-normal text-muted-foreground", numeric === true && "text-right", fitContent === true && FIT_CONTENT_CELL_CLASS, highlighted === true && "bg-accent/40", trailing !== undefined && "group/header relative", compact === true && COMPACT_HEADER_CLASS, className), ...cellExtras, children: [label, trailing] }));
24
25
  }
25
26
  const Icon = active?.dir === "asc" ? ArrowUp : active?.dir === "desc" ? ArrowDown : ArrowUpDown;
26
27
  const next = nextSortState(active?.dir, field);
27
28
  return (_jsxs(TableHead, { "data-testid": `column-${field}`, "data-sortable": "true", "data-highlighted": highlighted === true ? "true" : undefined, "aria-sort": ariaSort, className: cn(active !== undefined
28
29
  ? "font-semibold text-foreground"
29
- : "font-medium text-muted-foreground", "whitespace-normal", numeric === true && "text-right", fitContent === true && FIT_CONTENT_CELL_CLASS, highlighted === true && "bg-accent/40", trailing !== undefined && "group/header relative", className), ...cellExtras, children: [_jsxs("button", { type: "button", onClick: () => onSortChange(next), className: cn("group/sort inline-flex h-8 items-center gap-1.5 rounded-sm px-2 -mx-2 text-sm [font-weight:inherit]", "hover:bg-accent hover:text-accent-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", active !== undefined && "text-foreground"), children: [_jsx("span", { children: label }), _jsx(Icon, { "data-sort-icon": active === undefined ? "idle" : "active", className: cn("size-3.5", active === undefined &&
30
+ : "font-medium text-muted-foreground", "whitespace-normal", numeric === true && "text-right", fitContent === true && FIT_CONTENT_CELL_CLASS, highlighted === true && "bg-accent/40", trailing !== undefined && "group/header relative", compact === true && COMPACT_HEADER_CLASS, className), ...cellExtras, children: [_jsxs("button", { type: "button", onClick: () => onSortChange(next), className: cn("group/sort inline-flex h-8 items-center gap-1.5 rounded-sm px-2 -mx-2 text-sm [font-weight:inherit]", "hover:bg-accent hover:text-accent-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", active !== undefined && "text-foreground", compact === true && "text-xs"), children: [_jsx("span", { children: label }), _jsx(Icon, { "data-sort-icon": active === undefined ? "idle" : "active", className: cn("size-3.5", active === undefined &&
30
31
  "opacity-0 group-hover/sort:opacity-40 group-focus-visible/sort:opacity-40"), "aria-hidden": "true" })] }), trailing] }));
31
32
  }
32
33
  // 3-state toggle: no sort -> asc -> desc -> no sort. Idiomatic for
@@ -10,7 +10,7 @@ import { EXPAND_COLUMN_KEY, SELECT_COLUMN_KEY } from "./use-column-pins.js";
10
10
  function renderColumnHeader(m, col) {
11
11
  const { sizing, sort, onSortChange } = m;
12
12
  const headerPin = m.pins.headerCell(col.field);
13
- return (_jsx(SortableHeader, { field: col.field, label: col.label, sortable: col.sortable === true, highlighted: col.highlighted === true, numeric: NUMERIC_COLUMN_TYPES.has(col.type), fitContent: col.fileDisplay !== undefined, className: cn(m.density.header, headerPin.className), style: headerPin.style, columnField: headerPin.columnField, trailing: sizing && _jsx(ColumnResizeHandle, { field: col.field, label: col.label, sizing: sizing }), ...(sort !== undefined && sort !== null && { sort }), ...(onSortChange !== undefined && { onSortChange }) }, col.field));
13
+ return (_jsx(SortableHeader, { field: col.field, label: col.label, sortable: col.sortable === true, highlighted: col.highlighted === true, numeric: NUMERIC_COLUMN_TYPES.has(col.type), fitContent: col.fileDisplay !== undefined, compact: m.compactHeader === true, className: cn(m.density.header, headerPin.className), style: headerPin.style, columnField: headerPin.columnField, trailing: sizing && _jsx(ColumnResizeHandle, { field: col.field, label: col.label, sizing: sizing }), ...(sort !== undefined && sort !== null && { sort }), ...(onSortChange !== undefined && { onSortChange }) }, col.field));
14
14
  }
15
15
  function renderExpandHeaderCell(m) {
16
16
  const expandHeaderPin = m.pins.headerCell(EXPAND_COLUMN_KEY);
@@ -3,6 +3,7 @@ import { Building, CalendarDays, Globe, Hash, KeyRound, Link, Lock, Mail, MapPin
3
3
  import { Fragment, useContext, } from "react";
4
4
  import { fieldIssueText } from "../../field-issue-text.js";
5
5
  import { useTranslation, } from "../../index.js";
6
+ import { HideRequiredMarkerContext } from "../../required-marker-context.js";
6
7
  import { cn } from "../lib/cn.js";
7
8
  import { Label as UiLabel } from "../ui/label.js";
8
9
  import { StatusBadge } from "../widgets/status-badge.js";
@@ -40,8 +41,9 @@ export function DefaultField(props) {
40
41
  }
41
42
  function DefaultFieldBody({ id, label, required, issues, labelAppendix, fieldAppendix, appendixPlacement, description, status, children, layout, accent, hideLabel, testId, changed, }) {
42
43
  const t = useTranslation();
44
+ const hideRequiredMarker = useContext(HideRequiredMarkerContext);
43
45
  const hasError = issues !== undefined && issues.length > 0;
44
- const labelEl = (_jsxs(UiLabel, { id: fieldLabelId(id), htmlFor: id, className: cn("min-w-0 gap-0 text-[13px]", hasError ? "text-destructive" : "text-foreground", hideLabel === true && "sr-only"), children: [_jsx("span", { className: layout === "inline" ? undefined : "truncate", title: typeof label === "string" ? label : undefined, children: label }), required === true && (_jsx("span", { "data-required": true, className: "ml-0.5 shrink-0 text-destructive", children: "*" }))] }));
46
+ const labelEl = (_jsxs(UiLabel, { id: fieldLabelId(id), htmlFor: id, className: cn("min-w-0 gap-0 text-[13px]", hasError ? "text-destructive" : "text-foreground", hideLabel === true && "sr-only"), children: [_jsx("span", { className: layout === "inline" ? undefined : "truncate", title: typeof label === "string" ? label : undefined, children: label }), required === true && !hideRequiredMarker && (_jsx("span", { "data-required": true, className: "ml-0.5 shrink-0 text-destructive", children: "*" }))] }));
45
47
  const errorsEl = hasError ? (_jsx("div", { id: fieldErrorId(id), role: "alert", "data-testid": testId !== undefined ? `${testId}-errors` : undefined, className: "text-xs text-destructive", children: issues.map((issue) => (_jsx("div", { children: fieldIssueText(t, issue) }, `${issue.path}:${issue.code}`))) })) : null;
46
48
  // Inline (boolean/checkbox): Control links, Label rechts — shadcn-Muster.
47
49
  if (layout === "inline") {
@@ -36,8 +36,10 @@ export declare function FormFooter({ actions, secondaryActions, testId, chromele
36
36
  readonly railed?: boolean;
37
37
  }): ReactNode;
38
38
  export declare const SECTION_NAV_MIN_ITEMS = 3;
39
- export declare function FormSectionNav({ items, }: {
39
+ export declare function FormSectionNav({ items, activeTone, }: {
40
40
  readonly items: readonly FormSectionNavItem[];
41
+ /** `foreground`: the active entry is bold in the text colour with a dark marker instead of the primary colour. */
42
+ readonly activeTone?: "primary" | "foreground";
41
43
  }): ReactNode;
42
44
  export type FormScreenShellWidth = FormWidth;
43
45
  export declare function FormScreenShell({ children, className, testId, maxWidth, fillHeight, }: {