@remit/ui 0.0.237 → 0.0.238

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.
@@ -7,7 +7,7 @@ import type { CategoryTone, FilterSheetCategory } from "./components/filter-shee
7
7
  * (`file:build/ts-enums`) and @remit/ui publishes standalone — so this is the
8
8
  * kit's one owner of the union, and every other surface narrows to it.
9
9
  */
10
- export type ThreadCategory = "uncategorized" | "personal" | "newsletter" | "marketing" | "automated" | "transactional" | "social";
10
+ export type ThreadCategory = "uncategorized" | "personal" | "newsletter" | "marketing" | "automated" | "transactional" | "social" | "coldOutreach";
11
11
  /** "all" (no category narrowing) plus every content-type category. */
12
12
  export type BriefCategoryFilter = ThreadCategory | "all";
13
13
  /** How one category reads: on a chip, on a row badge, as a brief section. */
@@ -22,7 +22,7 @@ export const CATEGORY_PRESENTATION = [
22
22
  category: "uncategorized",
23
23
  label: "Unclassified",
24
24
  tone: "neutral",
25
- section: 7,
25
+ section: 8,
26
26
  },
27
27
  {
28
28
  category: "transactional",
@@ -34,6 +34,12 @@ export const CATEGORY_PRESENTATION = [
34
34
  { category: "marketing", label: "Marketing", tone: "neutral", section: 4 },
35
35
  { category: "social", label: "Social", tone: "warning", section: 5 },
36
36
  { category: "automated", label: "Automated", tone: "neutral", section: 6 },
37
+ {
38
+ category: "coldOutreach",
39
+ label: "Cold outreach",
40
+ tone: "neutral",
41
+ section: 7,
42
+ },
37
43
  ];
38
44
  /** Every category in the brief's section order, which ends with Unclassified. */
39
45
  export const CATEGORY_SECTION_ORDER = [
@@ -115,6 +115,17 @@ export interface NavMailbox {
115
115
  /** Present when the last change to this folder failed: what went wrong, in words. */
116
116
  failure?: string;
117
117
  }
118
+ /**
119
+ * A label, shown once whatever the number of accounts: one entry that lists the
120
+ * label's folder in every account.
121
+ */
122
+ export interface NavLabel {
123
+ /** The nav id the entry links to and is selected by. */
124
+ id: string;
125
+ name: string;
126
+ /** The label's color name; a value the kit has no swatch for renders as Default. */
127
+ color: string;
128
+ }
118
129
  /** Per-account mailbox-load status, so the nav can show loading/error inline. */
119
130
  export type NavAccountStatus = "loading" | "error" | "ready";
120
131
  export interface NavAccount {
@@ -1,4 +1,4 @@
1
- import type { AppShellProps, NavLinkComponent } from "./app-shell-types.js";
1
+ import type { AppShellProps, NavLabel, NavLinkComponent } from "./app-shell-types.js";
2
2
  /**
3
3
  * Read a persisted open/closed flag. `fallback` applies only when nothing is
4
4
  * stored yet. Both the account section and the custom-folders section default
@@ -24,6 +24,11 @@ export interface NavSidebarProps extends Pick<AppShellProps, "accounts" | "selec
24
24
  * fall back to programmatic buttons (static stories / AppShell preview).
25
25
  */
26
26
  linkComponent?: NavLinkComponent;
27
+ /**
28
+ * The labels, listed under the daily brief. Each is one entry across every
29
+ * account.
30
+ */
31
+ labels?: NavLabel[];
27
32
  /**
28
33
  * Whether the calendar destination sits under the daily brief. Hidden by
29
34
  * default so a host with no calendar route behind it does not offer an entry
@@ -31,4 +36,4 @@ export interface NavSidebarProps extends Pick<AppShellProps, "accounts" | "selec
31
36
  */
32
37
  calendarNav?: "hidden" | "shown";
33
38
  }
34
- export declare function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant, linkComponent, calendarNav, }: NavSidebarProps): import("react").JSX.Element;
39
+ export declare function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant, linkComponent, labels, calendarNav, }: NavSidebarProps): import("react").JSX.Element;
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useRef, useState } from "react";
3
3
  import { Archive, BellOff, CalendarDays, ChevronDown, ChevronRight, CircleAlert, CirclePause, FileText, Folder, Inbox, Mails, OctagonAlert, Send, Sparkles, Star, Trash, } from "../icons.js";
4
4
  import { cn } from "../lib/cn.js";
5
+ import { isLabelColorValue, labelDotClass } from "../lib/label-color.js";
5
6
  import { useRovingFocus } from "../lib/roving-focus.js";
6
7
  import { ACCOUNT_SERVICE_OFF_LABEL } from "./account-service-status.js";
7
8
  /* ------------------------------------------------------------------ */
@@ -77,6 +78,12 @@ function roleIcon(role) {
77
78
  return _jsx(Trash, { className: "size-4" });
78
79
  }
79
80
  }
81
+ function labelIcon(color) {
82
+ const dotClass = isLabelColorValue(color)
83
+ ? labelDotClass[color]
84
+ : labelDotClass.Default;
85
+ return (_jsx("span", { className: "flex size-4 items-center justify-center", children: _jsx("span", { className: cn("size-2.5 rounded-full", dotClass) }) }));
86
+ }
80
87
  const hasRole = (mb) => mb.role != null;
81
88
  const FOLDER_COLLAPSE_THRESHOLD = 8;
82
89
  const FOLDER_OPEN_KEY = "remit.nav.folders.open.";
@@ -142,11 +149,11 @@ function AccountNav({ account, selectedNavId, onSelectNav, linkComponent, }) {
142
149
  ? "Show less"
143
150
  : `Show all (${folders.length})` }))] }))] }))] }))] }))] }));
144
151
  }
145
- export function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant = "desktop", linkComponent, calendarNav = "hidden", }) {
152
+ export function NavSidebar({ accounts, selectedNavId, briefUnseen, onSelectNav, variant = "desktop", linkComponent, labels = [], calendarNav = "hidden", }) {
146
153
  const containerRef = useRef(null);
147
154
  useRovingFocus({ containerRef, itemSelector: NAV_ITEM_SELECTOR });
148
155
  const isDrawer = variant === "drawer";
149
- const navBody = (_jsxs("nav", { ref: isDrawer ? containerRef : undefined, className: isDrawer ? "px-2 py-2" : "flex-1 overflow-y-auto px-2 py-2", "aria-label": "Mailboxes", children: [_jsx(NavItem, { navId: "brief", linkComponent: linkComponent, icon: _jsx(Sparkles, { className: "size-4" }), label: "Daily brief", ariaLabel: "Daily brief", count: briefUnseen, active: selectedNavId === "brief", onClick: () => onSelectNav?.("brief") }), calendarNav === "shown" && (_jsx(NavItem, { navId: "calendar", linkComponent: linkComponent, icon: _jsx(CalendarDays, { className: "size-4" }), label: "Calendar", ariaLabel: "Calendar", active: selectedNavId === "calendar", onClick: () => onSelectNav?.("calendar") })), _jsx(NavItem, { navId: "flagged", linkComponent: linkComponent, icon: _jsx(Star, { className: "size-4" }), label: "Starred", ariaLabel: "Starred", active: selectedNavId === "flagged", onClick: () => onSelectNav?.("flagged") }), accounts.length === 0 ? (_jsx("div", { className: "px-2 py-4 text-center text-sm text-fg-muted", children: "No accounts configured" })) : (accounts.map((account) => (_jsx(AccountNav, { account: account, selectedNavId: selectedNavId, onSelectNav: onSelectNav, linkComponent: linkComponent }, account.id))))] }));
156
+ const navBody = (_jsxs("nav", { ref: isDrawer ? containerRef : undefined, className: isDrawer ? "px-2 py-2" : "flex-1 overflow-y-auto px-2 py-2", "aria-label": "Mailboxes", children: [_jsx(NavItem, { navId: "brief", linkComponent: linkComponent, icon: _jsx(Sparkles, { className: "size-4" }), label: "Daily brief", ariaLabel: "Daily brief", count: briefUnseen, active: selectedNavId === "brief", onClick: () => onSelectNav?.("brief") }), labels.map((label) => (_jsx(NavItem, { navId: label.id, linkComponent: linkComponent, icon: labelIcon(label.color), label: label.name, ariaLabel: label.name, active: selectedNavId === label.id, onClick: () => onSelectNav?.(label.id) }, label.id))), calendarNav === "shown" && (_jsx(NavItem, { navId: "calendar", linkComponent: linkComponent, icon: _jsx(CalendarDays, { className: "size-4" }), label: "Calendar", ariaLabel: "Calendar", active: selectedNavId === "calendar", onClick: () => onSelectNav?.("calendar") })), _jsx(NavItem, { navId: "flagged", linkComponent: linkComponent, icon: _jsx(Star, { className: "size-4" }), label: "Starred", ariaLabel: "Starred", active: selectedNavId === "flagged", onClick: () => onSelectNav?.("flagged") }), accounts.length === 0 ? (_jsx("div", { className: "px-2 py-4 text-center text-sm text-fg-muted", children: "No accounts configured" })) : (accounts.map((account) => (_jsx(AccountNav, { account: account, selectedNavId: selectedNavId, onSelectNav: onSelectNav, linkComponent: linkComponent }, account.id))))] }));
150
157
  if (isDrawer)
151
158
  return navBody;
152
159
  return (_jsx("aside", { ref: containerRef, className: "flex h-full w-full flex-col bg-surface-sunken", children: navBody }));
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { NextUpCard, type NextUpCardProps, } from "./components/agenda-panels.js
11
11
  export { AppChrome, type AppChromeProps } from "./components/app-chrome.js";
12
12
  export { AppPasswordHint, type AppPasswordHintProps, } from "./components/app-password-hint.js";
13
13
  export { type AppShellLayoutContext, AppShellSlotted, type AppShellSlottedProps, useAppShellLayout, } from "./components/app-shell-slotted.js";
14
- export { type AppShellProps, type Density, INTELLIGENCE_MIN_WIDTH, type MessageListKeyboard, type MessageListSelection, type NarrowView, type NavAccount, type NavAccountStatus, type NavLinkComponent, type NavLinkRenderProps, type NavMailbox, type NavMailboxRole, type PaneLayout, READING_PANE_MIN_WIDTH, resolvePaneLayout, type ThreadData, type ThreadMessageData, type ThreadRowData, type ThreadSection, type TouchSeed, useContainerWidth, } from "./components/app-shell-types.js";
14
+ export { type AppShellProps, type Density, INTELLIGENCE_MIN_WIDTH, type MessageListKeyboard, type MessageListSelection, type NarrowView, type NavAccount, type NavAccountStatus, type NavLabel, type NavLinkComponent, type NavLinkRenderProps, type NavMailbox, type NavMailboxRole, type PaneLayout, READING_PANE_MIN_WIDTH, resolvePaneLayout, type ThreadData, type ThreadMessageData, type ThreadRowData, type ThreadSection, type TouchSeed, useContainerWidth, } from "./components/app-shell-types.js";
15
15
  export { AppBar, type AppId, type AppSwitcherProps, type AppSwitchItem, AppTabBar, } from "./components/app-switcher.js";
16
16
  export { AppTopBar, type AppTopBarProps } from "./components/app-top-bar.js";
17
17
  export { type AttachmentDownloadState, type AttachmentItem, type AttachmentKind, AttachmentList, type AttachmentListProps, } from "./components/attachment-list.js";
@@ -20,7 +20,7 @@
20
20
  * a hard dependency on the generated types (this file compiles before `make`
21
21
  * in fresh checkouts).
22
22
  */
23
- export type EmailRenderCategory = "uncategorized" | "personal" | "newsletter" | "marketing" | "automated" | "transactional" | "social";
23
+ export type EmailRenderCategory = "uncategorized" | "personal" | "newsletter" | "marketing" | "automated" | "transactional" | "social" | "coldOutreach";
24
24
  export interface EmailRenderTreatment {
25
25
  /** Designed mail: render framed + light-mode, preserve author colors. */
26
26
  framed: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/ui",
3
- "version": "0.0.237",
3
+ "version": "0.0.238",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",