@mt-gloss/ui 0.0.19 → 0.0.21

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.
@@ -11,6 +11,15 @@ export interface ThresholdRampProps {
11
11
  onChange: (stops: ThresholdStop[]) => void;
12
12
  min?: number;
13
13
  max?: number;
14
+ /**
15
+ * Snap granularity for both drag and keyboard interactions. Values are
16
+ * rounded to `Math.round(raw / step) * step`. Default `0.01` matches the
17
+ * historical 2-decimal behavior. Pass `1` for integer snap, `0.0001` for
18
+ * 4-decimal snap, etc. Matches the `step` prop on `<Slider>` / `<RangeSlider>`.
19
+ * Must be a positive finite number; invalid values fall back to 0.01 with
20
+ * a dev-mode warning.
21
+ */
22
+ step?: number;
14
23
  disabled?: boolean;
15
24
  }
16
25
  /**
@@ -18,7 +27,7 @@ export interface ThresholdRampProps {
18
27
  * Renders a token-driven gradient strip with draggable stop handles.
19
28
  * Generic — no reptime domain strings. D-01, D-10, D-11 compliant.
20
29
  */
21
- export declare function ThresholdRamp({ stops, onChange, min, max, disabled, }: ThresholdRampProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function ThresholdRamp({ stops, onChange, min, max, step, disabled, }: ThresholdRampProps): import("react/jsx-runtime").JSX.Element;
22
31
  export declare namespace ThresholdRamp {
23
32
  var displayName: string;
24
33
  }
@@ -6,9 +6,14 @@ import { QuickConfigPanelProps } from './types';
6
6
  * Provides header + pill-menu chrome (Save / Cancel buttons).
7
7
  *
8
8
  * D-01: Generic — no reptime/entityType/metricInfo domain knowledge.
9
- * D-03: Panel width uses CSS var `--gloss-slot-width` (MetricGroupContainer slot sizing reuse; 180px fallback).
10
9
  * D-19: NOT a modal — role is not "dialog"; no aria-modal; no focus trap.
11
10
  * AN-01: `will-change: transform` on root element; panel transitions use transform/opacity only.
11
+ *
12
+ * Positioning (WR-03): the panel is CONSUMER-POSITIONED — placement is driven
13
+ * by the parent grid (CSS-grid placement adjacent to the active card) or by
14
+ * a wrapper element the consumer supplies. `anchorRect` is retained as an
15
+ * opaque pass-through for diagnostics; this component does NOT compute
16
+ * translate(x, y) from it. Width is sized via `--gloss-slot-width` (180px
17
+ * fallback) from the MetricGroupContainer slot primitive.
12
18
  */
13
- export declare function QuickConfigPanel({ sections, onCommit, onCancel, anchorRect: _anchorRect, // accepted for position math by consumer — not used internally
14
- title, }: QuickConfigPanelProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function QuickConfigPanel({ sections, onCommit, onCancel, anchorRect: _anchorRect, title, }: QuickConfigPanelProps): import("react/jsx-runtime").JSX.Element;
@@ -15,8 +15,21 @@ export interface QuickConfigSection {
15
15
  /**
16
16
  * Props for QuickConfigPanel.
17
17
  * D-01: opaque — no reptime/entityType/metricInfo semantics.
18
- * D-03: anchorRect provides DOMRect for position math via MetricGroupContainer slot sizing.
19
18
  * D-19: Panel is NOT a modal — role is not "dialog".
19
+ *
20
+ * Positioning contract (WR-03 clarification):
21
+ * The panel is CONSUMER-POSITIONED. Placement is driven by the parent grid
22
+ * (e.g. MetricCardGrid uses CSS-grid placement adjacent to the active card)
23
+ * or by a wrapper element supplied by the consumer. This composite does
24
+ * NOT compute `translate(x, y)` from an anchor rect internally — the
25
+ * historical D-03 plan for internal anchor-rect math was superseded by the
26
+ * grid-placement approach adopted in Phase 13.
27
+ *
28
+ * `anchorRect` is retained as an opaque pass-through so consumers can
29
+ * forward a DOMRect for diagnostics / future position-math plugins, but
30
+ * the panel chrome ignores it. Width is sized from the
31
+ * `--gloss-slot-width` CSS var (MetricGroupContainer slot-primitive reuse,
32
+ * 180px fallback). Height is intrinsic.
20
33
  */
21
34
  export interface QuickConfigPanelProps {
22
35
  /** Sections to render in the panel body */
@@ -26,8 +39,9 @@ export interface QuickConfigPanelProps {
26
39
  /** Fired when the user clicks the Cancel pill */
27
40
  onCancel: () => void;
28
41
  /**
29
- * DOMRect of the anchor card used for extrude position math (D-03).
30
- * Panel does not crash when undefined; layout defaults apply.
42
+ * Opaque anchor-rect pass-through (see positioning contract above).
43
+ * Not consumed internally supplied for consumer instrumentation only.
44
+ * @deprecated for direct use — placement is consumer-managed via grid / wrapper styles.
31
45
  */
32
46
  anchorRect?: DOMRect;
33
47
  /**
@@ -38,6 +38,29 @@ export interface GutterActionsProps {
38
38
  onConfigSave?: () => void;
39
39
  /** Called when Cancel pill is clicked in config variant. */
40
40
  onConfigCancel?: () => void;
41
+ /**
42
+ * Cluster C (quick-260417-ago) — Singleton overflow-menu identifier.
43
+ *
44
+ * When provided, this GutterActions instance cooperates with
45
+ * `overflowMenuRegistry` so only one overflow menu across the whole
46
+ * dashboard may be open at a time. Opening menu N sets the registry's
47
+ * activeId to N; any OTHER instance sees active !== its own id and closes
48
+ * its menu automatically via onMenuToggle(false).
49
+ *
50
+ * If omitted, a useId() fallback is used so each instance still gets a
51
+ * unique registry key — the singleton behavior still works across cards.
52
+ */
53
+ menuId?: string;
54
+ /**
55
+ * Cluster D (quick-260417-ago) — Horizontal anchor offset in px from the
56
+ * card's left edge. When provided, overrides the pill's default
57
+ * `left: 50%` centered position; drives the per-slot gutter-slide
58
+ * choreography (180ms ease-out) for stack cards whose hovered slot moves
59
+ * horizontally.
60
+ *
61
+ * Undefined (default) preserves the pre-existing centered layout.
62
+ */
63
+ anchorX?: number;
41
64
  }
42
65
  /**
43
66
  * GutterActions - Pill + overflow menu interaction system.
@@ -61,6 +84,6 @@ export interface GutterActionsProps {
61
84
  * ```
62
85
  */
63
86
  export declare const GutterActions: {
64
- ({ visible, menuOpen, onMenuToggle, onGraph, onDetails, onCustomize, onRemove, onWhatsThis, onExpand, onShrink, onMove, onReplace, onNavigate, onRetry, onRefresh, onQuickSettings, onFlipBack, isFlipped, onViewAsStack, onUnstack, canExpand, isGraphCard, colSpan, isGraphActive, isTableActive, graphLabel, detailsLabel, variant, onConfigSave, onConfigCancel, }: GutterActionsProps): import("react/jsx-runtime").JSX.Element;
87
+ ({ visible, menuOpen, onMenuToggle, onGraph, onDetails, onCustomize, onRemove, onWhatsThis, onExpand, onShrink, onMove, onReplace, onNavigate, onRetry, onRefresh, onQuickSettings, onFlipBack, isFlipped, onViewAsStack, onUnstack, canExpand, isGraphCard, colSpan, isGraphActive, isTableActive, graphLabel, detailsLabel, variant, onConfigSave, onConfigCancel, menuId, anchorX, }: GutterActionsProps): import("react/jsx-runtime").JSX.Element;
65
88
  displayName: string;
66
89
  };
@@ -25,6 +25,25 @@ export interface StackedGroupCardProps {
25
25
  * Default: undefined (fall back to measured capacity; backward compatible).
26
26
  */
27
27
  colSpan?: 1 | 2 | 3;
28
+ /**
29
+ * Cluster D (quick-260417-ago, item 3) — fired when the pointer enters
30
+ * slot `idx` with its `timeframe`. Consumer uses this to drive the
31
+ * gutter-actions horizontal anchor (anchorX) and inject metric-scoped
32
+ * action handlers (e.g. Transmitted → open transmitted-orders tab).
33
+ * Optional; no-op if omitted (back-compat).
34
+ */
35
+ onSlotHoverStart?: (idx: number, timeframe: string) => void;
36
+ /** Cluster D — fired when the pointer leaves the currently hovered slot. */
37
+ onSlotHoverEnd?: () => void;
38
+ /**
39
+ * Cluster D (item 15) — sparkline edge behavior.
40
+ * 'padded' (default, back-compat): current behavior; SparklineBg sits
41
+ * within the CardShell's inner padding.
42
+ * 'bleed': SparklineBg is wrapped in a negative-margin container so it
43
+ * extends to the card's LEFT, TOP, and BOTTOM edges. Right edge keeps
44
+ * padding so trend text on the right does not collide with the stroke.
45
+ */
46
+ sparklineInset?: 'padded' | 'bleed';
28
47
  }
29
48
  /**
30
49
  * StackedGroupCard -- Renders 3 mini metric values horizontally within a 2-col card.
@@ -47,6 +66,6 @@ export interface StackedGroupCardProps {
47
66
  * ```
48
67
  */
49
68
  export declare const StackedGroupCard: {
50
- ({ title, prefix, suffix, values, timeframes, sparklineData, accentColor, pinnedTimeframe, onPinTimeframe, isStale, colSpan, }: StackedGroupCardProps): import("react/jsx-runtime").JSX.Element;
69
+ ({ title, prefix, suffix, values, timeframes, sparklineData, accentColor, pinnedTimeframe, onPinTimeframe, isStale, colSpan, onSlotHoverStart, onSlotHoverEnd, sparklineInset, }: StackedGroupCardProps): import("react/jsx-runtime").JSX.Element;
51
70
  displayName: string;
52
71
  };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * overflowMenuRegistry — Module-scoped singleton tracker for MetricCard overflow menus.
3
+ *
4
+ * quick-260417-ago Cluster C (item 14): only one overflow menu may be open at a time.
5
+ * When menu B opens, menu A receives a notification via its useSyncExternalStore
6
+ * subscription and closes itself.
7
+ *
8
+ * Uses a plain module-level `activeId` + Set<listener> — no new dep (Zustand is
9
+ * over-engineering for one state field; Context would require hoisting the
10
+ * provider higher than the card tree, which complicates flag-off paths).
11
+ *
12
+ * React 19's useSyncExternalStore consumes `subscribe` / `getSnapshot` and keeps
13
+ * components in sync without triggering tearing under concurrent rendering.
14
+ *
15
+ * Exports:
16
+ * - subscribe(fn): listen to activeId changes; returns unsubscribe
17
+ * - getActive(): current activeId (or null)
18
+ * - setActive(id | null): declare which menu is open; notifies all subscribers
19
+ * - resetForTests(): clears state between vitest runs
20
+ */
21
+ export declare function subscribe(listener: () => void): () => void;
22
+ export declare function getActive(): string | null;
23
+ export declare function setActive(next: string | null): void;
24
+ /** Test-only: resets internal state. Not exported from the public barrel. */
25
+ export declare function resetForTests(): void;
@@ -3,12 +3,18 @@ import { MetricCardGridProps } from './types';
3
3
  /**
4
4
  * Finds the best adjacent slot to extrude the QuickConfigPanel into.
5
5
  *
6
- * Priority: right → below → left → above.
7
- * Returns null if activeIndex is invalid or no candidates exist.
6
+ * Priority (for both extrude AND dim-cover): right → below → left → above.
7
+ *
8
+ * Two modes, distinguished by caller:
9
+ * 1. Extrude — first candidate whose index is `>= cardCount` (empty slot)
10
+ * 2. Dim-cover fallback — when every candidate is occupied (`< cardCount`),
11
+ * returns the FIRST candidate in priority order (right wins for LTR
12
+ * readability; falls through to below / left / above only when the edge
13
+ * of the grid excludes earlier candidates). WR-05: the dim-cover fallback
14
+ * intentionally shares the priority list above — future enhancement could
15
+ * pick the neighbor closest to the viewport center for symmetric behavior.
8
16
  *
9
- * When all neighbors are occupied (packed grid), returns the right neighbor
10
- * index for dim-cover fallback — the caller distinguishes empty vs occupied
11
- * by checking if extrudeIndex >= cardCount.
17
+ * Returns null if activeIndex is invalid or no candidates exist.
12
18
  *
13
19
  * @param activeIndex Index of the active card in the ordered visible-cards array (0-based)
14
20
  * @param cardCount Total number of cards in the visible page
@@ -34,8 +34,16 @@ export interface UseSortableZonesConfig<T extends {
34
34
  * Pure React hook (useState, useCallback). Does NOT import DndContext —
35
35
  * SortableZones.tsx connects the event handlers to DndContext callbacks.
36
36
  *
37
- * Uncontrolled by default: zones state is initialised from config.zones and
38
- * managed internally. Call onZoneChange to sync back to parent.
37
+ * State model: **hybrid controlled + uncontrolled**.
38
+ * - Internal state is seeded from `config.zones` at mount.
39
+ * - Drag handlers mutate internal state and call `onZoneChange` to sync up.
40
+ * - If the parent later passes a structurally different `config.zones`
41
+ * (different zoneKeys or item id orderings) while no drag is in flight,
42
+ * the hook re-syncs to the new prop. This lets parents drive zones from
43
+ * external events (e.g. store updates outside a drag) without being
44
+ * surprised by a "frozen at mount" internal snapshot.
45
+ * - Mid-drag prop updates are ignored so a stale controlled value cannot
46
+ * clobber the in-progress drag.
39
47
  *
40
48
  * Generic over T extends { id: string }. No reptime-specific types. D-06, D-04, D-11 compliant.
41
49
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mt-gloss/ui",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "restricted"