@mt-gloss/ui 0.1.106 → 0.1.107

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.
package/index.js CHANGED
@@ -5,8 +5,8 @@ import * as B from "react";
5
5
  import F, { useRef as P, useEffect as A, useState as I, useCallback as N, useId as Je, forwardRef as et, useMemo as re, useLayoutEffect as Ie, createContext as tt, useContext as at } from "react";
6
6
  import { motion as G, useMotionValue as nt, AnimatePresence as rt, useDragControls as st } from "framer-motion";
7
7
  import { createPortal as Ee } from "react-dom";
8
- import { u as it } from "./COMMITS-kaUvc5jL.js";
9
- import { C as Jo, c as el, b as tl, P as al, S as nl, e as rl, i as sl, r as il, a as ol, d as ll } from "./COMMITS-kaUvc5jL.js";
8
+ import { u as it } from "./COMMITS-DG0Q_9DU.js";
9
+ import { C as Jo, c as el, b as tl, P as al, S as nl, e as rl, i as sl, r as il, a as ol, d as ll } from "./COMMITS-DG0Q_9DU.js";
10
10
  import { B as ot, a as X, b as ce, U as fe } from "./UIContext-DP6JGCto.js";
11
11
  import { c as dl, u as ul } from "./UIContext-DP6JGCto.js";
12
12
  import { DEFAULT_MARKET_PRESETS as pl, DEFAULT_PINNED as gl, PERIOD_OPTIONS as hl, ROLLING_OPTIONS as fl, TODAY_PRESET as bl, findPreset as vl, formatDateRange as yl, formatMarketDates as wl, formatTrend as _l, formatValue as Cl, generateMarketId as Nl, getAllPresets as Sl, getDateRangeForPreset as kl, getPresetLabel as Dl, isInRange as xl, isMarketActive as Rl, isSameDay as Tl, normalizePresetId as Ml, toUppercasePresetId as Pl } from "@mt-gloss/utils";
@@ -9,5 +9,19 @@ export interface PanelChromeProps {
9
9
  isOpen?: boolean;
10
10
  /** P2 — optional footer slot. Notification-center keeps null (no footer). */
11
11
  footer?: ReactNode;
12
+ /**
13
+ * GAP-01 (sprint 2026-05-15): optional title rendered left-aligned in the
14
+ * header, on the same line as the close button. Spike §6.1 shows
15
+ * "Configure metric" over the stage gradient.
16
+ */
17
+ title?: string;
18
+ /**
19
+ * GAP-01 (sprint 2026-05-15): visual variant. 'merged-stage' fuses the
20
+ * header with the stage gradient region (title left + outlined close right),
21
+ * drops bottom rounding so the panel exits the toolbar bounds, and lets the
22
+ * body grow with content (no inner scroll). 'default' preserves the
23
+ * P3a fixed-3-row chrome used by notification-center / catalog / etc.
24
+ */
25
+ variant?: 'default' | 'merged-stage';
12
26
  }
13
- export declare function PanelChrome({ children, onClose, footer }: PanelChromeProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare function PanelChrome({ children, onClose, footer, title, variant }: PanelChromeProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,10 @@
4
4
  * Unknown keys pass through unchanged (forward-compat).
5
5
  *
6
6
  * Fallback values per spike §6.1.4:
7
- * threshold → 80, timeframe → 30, accent → null
7
+ * threshold → 80, timeframe → 30, accent → null, slots → []
8
8
  *
9
9
  * @param key buffer-value key (e.g. 'threshold', 'timeframe', 'accent', 'slots')
10
- * @param value unknown — usually number (sliders) or string (color hex)
10
+ * @param value unknown — number (sliders), string (color hex), or string[] (slots)
11
11
  * @returns normalized value (clamped, parsed, or passthrough)
12
12
  */
13
13
  export declare function normalizeBufferValue(key: string, value: unknown): unknown;
@@ -20,8 +20,8 @@ export { CatalogFooter, CatalogStateContext, useCatalogState, } from './shells/i
20
20
  export type { CatalogFooterMode, CatalogState, CatalogFooterProps, } from './shells/internals/CatalogFooter';
21
21
  export { PageMgmtFooter, PageMgmtStateContext, usePageMgmtState, } from './shells/internals/PageMgmtFooter';
22
22
  export type { PageMgmtState, PageMgmtFooterProps, } from './shells/internals/PageMgmtFooter';
23
- export type { CatalogTile } from './shells/internals/catalog-mocks';
24
- export { MOCK_LENSES, MOCK_DEFAULT_LENS, MOCK_TILES_BY_LENS, } from './shells/internals/catalog-mocks';
23
+ export type { CatalogTile, CatalogTileSubStat, CatalogLensMeta, CatalogLensTiles, } from './shells/internals/catalog-mocks';
24
+ export { MOCK_LENSES, MOCK_DEFAULT_LENS, MOCK_LENS_META, MOCK_TILES_BY_LENS, } from './shells/internals/catalog-mocks';
25
25
  export type { PageEntry } from './shells/internals/page-mgmt-mocks';
26
26
  export { MOCK_PAGES } from './shells/internals/page-mgmt-mocks';
27
27
  export { PANEL_IDS } from './coordinator/PANEL_IDS';
@@ -1,13 +1,15 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { PanelShellProps } from '../PanelHost';
3
- import { CatalogTile } from './internals/catalog-mocks';
3
+ import { CatalogLensMeta, CatalogLensTiles } from './internals/catalog-mocks';
4
4
  export interface CatalogAddShellProps extends PanelShellProps {
5
5
  /** Available lenses; defaults to MOCK_LENSES (spike §6.2.5). */
6
6
  lenses?: readonly string[];
7
- /** Initial active lens; defaults to MOCK_DEFAULT_LENS ('Order flow'). */
7
+ /** Initial active lens; defaults to MOCK_DEFAULT_LENS. */
8
8
  defaultLens?: string;
9
9
  /** Tile catalog keyed by lens; defaults to MOCK_TILES_BY_LENS. */
10
- tilesByLens?: Readonly<Record<string, readonly CatalogTile[]>>;
10
+ tilesByLens?: Readonly<Record<string, CatalogLensTiles>>;
11
+ /** Per-lens H2 + helper + beta-chip metadata. */
12
+ lensMeta?: Readonly<Record<string, CatalogLensMeta>>;
11
13
  /**
12
14
  * Optional footer slot rendered as a SIBLING of the body, INSIDE the shell's
13
15
  * CatalogStateContext.Provider. PanelSlot passes <CatalogFooter/> here so it
@@ -16,4 +18,4 @@ export interface CatalogAddShellProps extends PanelShellProps {
16
18
  */
17
19
  footerSlot?: ReactNode;
18
20
  }
19
- export declare function CatalogAddShell({ isOpen, lenses, defaultLens, tilesByLens, footerSlot, }: CatalogAddShellProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function CatalogAddShell({ isOpen, lenses, defaultLens, tilesByLens, lensMeta, footerSlot, }: CatalogAddShellProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { PanelShellProps } from '../PanelHost';
3
- import { CatalogTile } from './internals/catalog-mocks';
3
+ import { CatalogLensTiles } from './internals/catalog-mocks';
4
4
  export interface CatalogReplaceShellProps extends PanelShellProps {
5
5
  /** Label of the card being replaced; rendered as 'replacing {label}' subtitle. */
6
6
  replacingLabel?: string;
7
7
  lenses?: readonly string[];
8
8
  defaultLens?: string;
9
- tilesByLens?: Readonly<Record<string, readonly CatalogTile[]>>;
9
+ tilesByLens?: Readonly<Record<string, CatalogLensTiles>>;
10
10
  /** See CatalogAddShellProps.footerSlot — sibling slot inside Provider. */
11
11
  footerSlot?: ReactNode;
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { PanelShellProps } from '../PanelHost';
2
+ import { PanelShellProps } from './../PanelHost';
3
3
  import { PageEntry } from './internals/page-mgmt-mocks';
4
4
  export interface PageMgmtShellProps extends PanelShellProps {
5
5
  /** Initial page list; defaults to MOCK_PAGES (§6.4.3 verbatim). */
@@ -1,15 +1,58 @@
1
+ import { default as React } from 'react';
1
2
  import { PanelShellProps } from '../PanelHost';
2
3
  import { SettingsDimension } from '../../../primitives/dashboard/SettingsTabStrip';
4
+ import { AccentSwatch } from './settings';
3
5
  export interface SettingsShellProps extends PanelShellProps {
4
6
  /** Span of the source card (1|2|3). Plumbed by V2FeedbackSurface HOF. */
5
7
  cardSpan?: 1 | 2 | 3;
6
- /** Visible label on the clone card. Defaults to 'Metric'. */
8
+ /**
9
+ * Legacy fallback label on the clone card when `previewSlot` is not provided.
10
+ * GAP-02 (sprint 2026-05-15) replaced this with `previewSlot` for 1:1 clones;
11
+ * kept for backward compatibility with consumers that haven't migrated.
12
+ * @deprecated prefer `previewSlot`
13
+ */
7
14
  cardLabel?: string;
8
- /** Visible value on the clone card. Defaults to '—'. */
15
+ /**
16
+ * Legacy fallback value on the clone card when `previewSlot` is not provided.
17
+ * @deprecated prefer `previewSlot`
18
+ */
9
19
  cardValue?: string;
20
+ /**
21
+ * GAP-02 (sprint 2026-05-15): render-as-children path for the Stage 3D clone.
22
+ * When provided, this ReactNode is rendered inside <CloneCard>{...}</CloneCard>
23
+ * instead of the legacy cardLabel/cardValue placeholder. Consumer is expected
24
+ * to produce a static (pointer-events: none) preview of the source card with
25
+ * buffer-merged config so the clone is a 1:1 representation of the live card.
26
+ */
27
+ previewSlot?: React.ReactNode;
10
28
  /** Phase 16 D-02: dimensions to render as tabs. Reptime computes via useCardDimensions(cardType, colSpan). */
11
29
  dimensions?: ReadonlyArray<SettingsDimension>;
12
30
  /** Phase 16: initial active tab. Defaults to dimensions[0]. */
13
31
  initialTab?: SettingsDimension;
32
+ /**
33
+ * Phase 16 P8 spot-fix — persisted baseline for this card.
34
+ *
35
+ * Consumer (reptime V2FeedbackSurface) computes this from
36
+ * `usePreferences('metricConfig')[cardId]` at OPEN time so that:
37
+ * - Re-opening the panel after Apply shows the saved value (not React default).
38
+ * - Reset (CLEAR_BUFFER) reverts to the saved value (CC-19 semantics with persistence).
39
+ *
40
+ * Display precedence per dimension:
41
+ * 1. live buffer (`state.bufferByCard[cardId].changes[dim]`) — user mid-edit
42
+ * 2. `initialValues[dim]` — last-applied baseline from localStorage
43
+ * 3. React-default per spike §6.1.4 (threshold=80, timeframe=30, accent=null, slots=['Orders','Quota','Unassigned'])
44
+ *
45
+ * Spike §6.1 documents the prototype's defaults (30/80). Production persists
46
+ * via D-10 COMMIT_BUFFER → usePreferences('metricConfig'); the seed-on-open
47
+ * round-trip closes the loop — without it the Apply'd value vanishes from the
48
+ * UI even though localStorage holds it.
49
+ */
50
+ initialValues?: Partial<{
51
+ threshold: number;
52
+ timeframe: number;
53
+ accent: AccentSwatch;
54
+ /** GAP-03 (sprint 2026-05-15): persisted slot order. Max 3, empty array valid. */
55
+ slots: ReadonlyArray<string>;
56
+ }>;
14
57
  }
15
- export declare function SettingsShell({ isOpen, cardSpan, cardLabel, cardValue, dimensions, initialTab, }: SettingsShellProps): import("react/jsx-runtime").JSX.Element;
58
+ export declare function SettingsShell({ isOpen, cardSpan, cardLabel, cardValue, previewSlot, dimensions, initialTab, initialValues, }: SettingsShellProps): import("react/jsx-runtime").JSX.Element;
@@ -15,5 +15,5 @@ export { MOCK_PAGES } from './internals/page-mgmt-mocks';
15
15
  export type { PageEntry } from './internals/page-mgmt-mocks';
16
16
  export { CatalogFooter, CatalogStateContext, useCatalogState } from './internals/CatalogFooter';
17
17
  export type { CatalogFooterMode, CatalogState, CatalogFooterProps } from './internals/CatalogFooter';
18
- export type { CatalogTile } from './internals/catalog-mocks';
19
- export { MOCK_LENSES, MOCK_DEFAULT_LENS, MOCK_TILES_BY_LENS } from './internals/catalog-mocks';
18
+ export type { CatalogTile, CatalogTileSubStat, CatalogLensMeta, CatalogLensTiles, } from './internals/catalog-mocks';
19
+ export { MOCK_LENSES, MOCK_DEFAULT_LENS, MOCK_LENS_META, MOCK_TILES_BY_LENS, } from './internals/catalog-mocks';
@@ -1,6 +1,19 @@
1
+ import { CatalogLensMeta } from './catalog-mocks';
1
2
  export interface CatalogLensPickerProps {
2
3
  lenses: readonly string[];
3
4
  activeLens: string;
4
5
  onLensChange: (lens: string) => void;
6
+ /**
7
+ * GAP-06 — `pills` matches the prior-modal contract (default for CatalogAdd);
8
+ * `segmented` preserves the W2 segmented-chip + overflow contract for
9
+ * back-compat (CatalogReplace and any legacy tests still default to this
10
+ * when they pass `variant='segmented'` explicitly).
11
+ */
12
+ variant?: 'pills' | 'segmented';
13
+ /**
14
+ * Per-lens metadata (beta chip, etc.); defaults to MOCK_LENS_META so the
15
+ * shell can omit the prop when using mocks.
16
+ */
17
+ lensMeta?: Readonly<Record<string, CatalogLensMeta>>;
5
18
  }
6
- export declare function CatalogLensPicker({ lenses, activeLens, onLensChange }: CatalogLensPickerProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function CatalogLensPicker({ lenses, activeLens, onLensChange, variant, lensMeta, }: CatalogLensPickerProps): import("react/jsx-runtime").JSX.Element;
@@ -12,6 +12,9 @@ export interface CatalogTileGridProps {
12
12
  *
13
13
  * The regex captures the leading numeric/currency/percent token; the remainder
14
14
  * is the label. If the segment has no number, the whole text falls into <small>.
15
+ *
16
+ * Kept for back-compat with W2 tests + the `stack: true` legacy tile model.
17
+ * GAP-06 — new tiles prefer `subStats` (structured) over `·`-split strings.
15
18
  */
16
19
  export declare function renderStackValue(val: string): import("react/jsx-runtime").JSX.Element[];
17
20
  export declare function CatalogTileGrid({ tiles, selectedTileId, onSelectTile }: CatalogTileGridProps): import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,13 @@ import { PageEntry } from './page-mgmt-mocks';
2
2
  export interface PageMgmtState {
3
3
  pages: PageEntry[];
4
4
  setPages: (updater: (prev: PageEntry[]) => PageEntry[]) => void;
5
+ /** GAP-05 (sprint 2026-05-15) — rename via kebab menu. Mock-state operation. */
6
+ renamePage?: (id: string, name: string) => void;
7
+ /** GAP-05 — duplicate via kebab menu. Mock-state operation; real BFF wiring
8
+ * in P5+ via HOF (PagesContext.duplicatePage already exists in reptime). */
9
+ duplicatePage?: (id: string) => void;
10
+ /** GAP-05 — delete via kebab menu. Mock-state operation. */
11
+ deletePage?: (id: string) => void;
5
12
  }
6
13
  export declare const PageMgmtStateContext: import('react').Context<PageMgmtState | null>;
7
14
  export declare function usePageMgmtState(): PageMgmtState | null;
@@ -1,8 +1,11 @@
1
1
  import { PageEntry } from './page-mgmt-mocks';
2
2
  export interface PageMgmtRowProps {
3
3
  page: PageEntry;
4
+ /** @deprecated GAP-05 wires rename via window.prompt() through context. */
4
5
  onRename?: (id: string) => void;
6
+ /** @deprecated GAP-05 wires kebab menu directly via context. */
5
7
  onKebab?: (id: string) => void;
8
+ /** Drag-to-reorder hook seam — DEBT.md tracks dnd-kit wiring. */
6
9
  onDragStart?: (id: string) => void;
7
10
  }
8
11
  export declare function PageMgmtRow({ page, onRename, onKebab, onDragStart }: PageMgmtRowProps): import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,72 @@
1
1
  /**
2
- * Catalog panel mock data — Phase 11.5 P4 W2.
2
+ * Catalog panel mock data — Phase 11.5 P4 W2 + GAP-06 (sprint 2026-05-15).
3
3
  *
4
4
  * Module-level constants; no fetch, no PII. Spike-verbatim §6.2.5 lens list +
5
- * §6.2.7 tile model. Tiles per lens are illustrative (≥4 each; ≥1 stack under
6
- * 'Order flow' to exercise `.span-2` + renderStackValue per §6.2.8).
5
+ * §6.2.7 tile model.
7
6
  *
8
- * Real BFF binding will replace this seam in a future plan (P-N).
7
+ * GAP-06 (sprint 2026-05-15) data shape widened to support spike-grade
8
+ * catalog rendering (SCREENSHOT-07/-08 visual contract):
9
+ *
10
+ * - Lens names replaced with spike-correct vocabulary (Overbought / What's
11
+ * selling / On track vs plan / Orders on time / Vendor performance /
12
+ * Assortment mix / Customer retention BETA).
13
+ * - `lensMeta` keyed by lens name carries `headline` (active-lens H2),
14
+ * `helper` (sub-paragraph), `beta` flag.
15
+ * - Tiles per lens split into `primary` (rendered in main grid; at most one
16
+ * `startHere: true` per lens; small orange `isNew` dot opt-in) and
17
+ * `secondary` (rendered under "MORE IN THIS LENS" subsection).
18
+ * - `value` semantics: a single string for 1×1 tiles, OR `subStats` array
19
+ * for multi-up tiles (3-up MTD/QTD/YTD, 5-up MTD/QTD/YTD/LYTD/7D). When
20
+ * `subStats` is present, the renderer ignores `value` and stacks the
21
+ * segments. Span is implicit: 0 stats = 1×1, 3 = 1×3, 5 = 1×5.
22
+ * - `accent` color hint for sparkline/donut tiles (HEX); CSS reads via
23
+ * inline style. `donut` flag enables the donut variant.
24
+ *
25
+ * Real BFF binding will replace this seam in a future plan (P5+); the
26
+ * `CatalogAddWithCards` HOF in V2FeedbackSurface will inject live-card
27
+ * snapshot values per Q4 (B_representative_static + mock fallback).
9
28
  */
29
+ /** Multi-up segment for stack tiles (3-up MTD/QTD/YTD, 5-up MTD/QTD/YTD/LYTD/7D). */
30
+ export interface CatalogTileSubStat {
31
+ label: string;
32
+ value: string;
33
+ }
10
34
  export interface CatalogTile {
11
35
  id: string;
12
36
  label: string;
37
+ /** Single-value display; ignored when `subStats` is present. */
13
38
  value: string;
39
+ /** Sub-statistics for multi-up tiles (3-up or 5-up). When present, overrides `value`. */
40
+ subStats?: readonly CatalogTileSubStat[];
41
+ /** @deprecated GAP-06 — `stack` is inferred from `subStats.length > 0`. Kept for back-compat with W2 tests. */
14
42
  stack?: boolean;
15
43
  desc: string;
16
- variants?: string[];
44
+ /** Span variant chips ("1×1", "1×3", "1×5"); rendered top-right of tile. */
45
+ variants?: readonly string[];
46
+ /** Small orange "new" dot, top-right. */
47
+ isNew?: boolean;
48
+ /** GAP-06 — primary tile flagged as the recommended starting metric for this lens. */
49
+ startHere?: boolean;
50
+ /** Donut + value combo variant (vs flat number). */
51
+ donut?: boolean;
52
+ /** Accent HEX for donut/sparkline tiles. */
53
+ accent?: string;
54
+ }
55
+ export interface CatalogLensMeta {
56
+ /** H2 question shown beneath the pill row when this lens is active. */
57
+ headline: string;
58
+ /** Sub-paragraph helper sentence. */
59
+ helper: string;
60
+ /** Renders BETA chip next to the pill label. */
61
+ beta?: boolean;
17
62
  }
18
63
  export declare const MOCK_LENSES: readonly string[];
19
- export declare const MOCK_DEFAULT_LENS = "Order flow";
20
- export declare const MOCK_TILES_BY_LENS: Readonly<Record<string, readonly CatalogTile[]>>;
64
+ export declare const MOCK_DEFAULT_LENS = "Overbought";
65
+ export declare const MOCK_LENS_META: Readonly<Record<string, CatalogLensMeta>>;
66
+ /** Primary vs secondary tile groups for a lens. */
67
+ export interface CatalogLensTiles {
68
+ primary: readonly CatalogTile[];
69
+ /** Rendered under "MORE IN THIS LENS" subsection (§6.2.7 extension). */
70
+ secondary?: readonly CatalogTile[];
71
+ }
72
+ export declare const MOCK_TILES_BY_LENS: Readonly<Record<string, CatalogLensTiles>>;
@@ -1,2 +1,6 @@
1
1
  import { default as React } from 'react';
2
- export declare function SlotsControls(): React.ReactElement;
2
+ export interface SlotsControlsProps {
3
+ value: ReadonlyArray<string>;
4
+ onChange: (next: ReadonlyArray<string>) => void;
5
+ }
6
+ export declare function SlotsControls({ value, onChange }: SlotsControlsProps): React.ReactElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mt-gloss/ui",
3
- "version": "0.1.106",
3
+ "version": "0.1.107",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "restricted"