@mt-gloss/ui 0.1.142 → 0.1.143

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.
@@ -1,10 +1,12 @@
1
+ export declare const TIMEFRAME_PRESETS: readonly ["today", "7d", "30d", "60d", "90d", "mtd", "qtd", "ytd"];
2
+ export type TimeframePreset = (typeof TIMEFRAME_PRESETS)[number];
1
3
  /**
2
4
  * Normalizes a buffer value for a given key before writing to bufferByCard.
3
5
  * Called inside the SET_BUFFER_VALUE reducer case (coordinator.ts).
4
6
  * Unknown keys pass through unchanged (forward-compat).
5
7
  *
6
- * Post-M003-S002-CFG discriminated union (D-14):
7
- * timeframe → 30 (default), slots → []
8
+ * Post-M003-S002-CFG discriminated union (D-14), updated by quick-260601-gyl:
9
+ * timeframe → '30d' (default, preset-id string), slots → []
8
10
  *
9
11
  * @param key buffer-value key — 'timeframe' | 'slots' | any forward-compat string
10
12
  * @param value unknown
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { PanelShellProps } from '../PanelHost';
3
3
  import { SettingsDimension } from '../../../primitives/dashboard/SettingsTabStrip';
4
+ import { TimeframePreset } from '../coordinator/settingsBufferSchemas';
4
5
  export interface SettingsShellProps extends PanelShellProps {
5
6
  /** Span of the source card (1|2|3). Plumbed by V2FeedbackSurface HOF. */
6
7
  cardSpan?: 1 | 2 | 3;
@@ -45,10 +46,21 @@ export interface SettingsShellProps extends PanelShellProps {
45
46
  * via D-10 COMMIT_BUFFER → usePreferences('metricConfig').
46
47
  */
47
48
  initialValues?: Partial<{
48
- timeframe: number;
49
+ /**
50
+ * quick-260601-gyl: timeframe is now a preset-id STRING (was a days-number).
51
+ * Seeded by reptime from instanceConfig.timeframe (with presetIdFromDays
52
+ * back-compat for legacy numeric values). Default '30d'.
53
+ */
54
+ timeframe: TimeframePreset | string;
49
55
  /** GAP-03 (sprint 2026-05-15): persisted slot order. Max 3, empty array valid. */
50
56
  slots: ReadonlyArray<string>;
51
57
  }>;
58
+ /**
59
+ * quick-260601-gyl: per-card pinned default preset (the orange star), read by
60
+ * reptime from instanceConfig.pinnedTimeframe. Defaults to '30d' in the bar when
61
+ * unset. Pinning a preset selects it AND persists it as the card's default.
62
+ */
63
+ pinnedTimeframe?: string;
52
64
  /**
53
65
  * M003-S005-SLT D-08 — Card's natural slot identifier list (registry data,
54
66
  * NOT user-persisted). SlotsControls renders ghost pills for naturalSlots
@@ -61,4 +73,4 @@ export interface SettingsShellProps extends PanelShellProps {
61
73
  */
62
74
  naturalSlots?: ReadonlyArray<string>;
63
75
  }
64
- export declare function SettingsShell({ isOpen, cardSpan, cardLabel, cardValue, previewSlot, dimensions, initialTab, initialValues, naturalSlots, }: SettingsShellProps): import("react/jsx-runtime").JSX.Element;
76
+ export declare function SettingsShell({ isOpen, cardSpan, cardLabel, cardValue, previewSlot, dimensions, initialTab, initialValues, pinnedTimeframe, naturalSlots, }: SettingsShellProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,80 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * TimeframeQuickBar — the controls-only slice of the HybridDatePicker Quick Bar.
4
+ *
5
+ * Renders the "Today" chip + the rolling (7D/30D/60D/90D) and period (MTD/QTD/YTD)
6
+ * ExpandableChip dropdowns, WITHOUT any MUI Popover wrapper, calendar grid, or
7
+ * markets/events tab. Both the live top-bar HybridDatePicker and the metric
8
+ * Settings → Timeframe tab consume this component.
9
+ *
10
+ * Extracted in quick-260601-gyl (RESEARCH Finding 4, approach (b): extract a
11
+ * standalone component rather than thread a mode prop through HybridDatePicker's
12
+ * compare/calendar machine).
13
+ *
14
+ * IMPORTANT (memory feedback_compiler_uppercase_jsx_helper_trap): this is a real
15
+ * PascalCase component rendered as `<TimeframeQuickBar />` — NEVER invoke it as a
16
+ * function (`timeframeQuickBar(props)`). React Compiler over-memoizes uppercase
17
+ * JSX-returning helpers invoked as functions and corrupts the calling fiber's hook
18
+ * list.
19
+ *
20
+ * @example
21
+ * ```tsx
22
+ * // Live picker (hover-to-open, keeps the calendar/events entry buttons):
23
+ * <TimeframeQuickBar
24
+ * selectedPreset={selectedPreset}
25
+ * onSelect={handlePresetSelect}
26
+ * pinnedPreset={preferences.pinnedPreset}
27
+ * onPin={handlePin}
28
+ * openGroup={activeHoverGroup}
29
+ * onOpenChange={handleChipGroupHover}
30
+ * calendarEntry={<>{calendarBtn}{eventsBtn}</>}
31
+ * />
32
+ *
33
+ * // Settings panel (click-to-open, no calendar/events):
34
+ * <TimeframeQuickBar
35
+ * selectedPreset={timeframeValue}
36
+ * onSelect={handlePresetSelect}
37
+ * pinnedPreset={pinnedTimeframe ?? '30d'}
38
+ * onPin={handlePin}
39
+ * openGroup={openGroup}
40
+ * onOpenChange={(g, open) => setOpenGroup(open ? g : null)}
41
+ * disableHover
42
+ * showCalendarEntry={false}
43
+ * />
44
+ * ```
45
+ */
46
+ export interface TimeframeQuickBarProps {
47
+ /** Currently selected preset id (e.g. 'today' | '30d' | 'mtd'). */
48
+ selectedPreset: string;
49
+ /** Called when a preset is selected from any control. */
50
+ onSelect: (presetId: string) => void;
51
+ /** Pinned/default preset id (drives the chip label when nothing in-group is selected). */
52
+ pinnedPreset?: string;
53
+ /** Called when a preset's star is toggled. Pin-also-selects is the caller's responsibility. */
54
+ onPin?: (presetId: string) => void;
55
+ /** Controlled open group: 'rolling' | 'period' | null. Maps to each ExpandableChip's isOpen. */
56
+ openGroup: string | null;
57
+ /** Called when an ExpandableChip's open state changes (groupId, isOpen). */
58
+ onOpenChange: (groupId: string, isOpen: boolean) => void;
59
+ /**
60
+ * When true the dropdowns only toggle on chip click (no hover-to-open). Defaults
61
+ * false so the live picker keeps hover behaviour. The Settings panel passes true.
62
+ */
63
+ disableHover?: boolean;
64
+ /**
65
+ * When true (default) the calendar/events entry slot renders after a divider. The
66
+ * Settings panel passes false (controls-only — no calendar grid, no markets tab).
67
+ */
68
+ showCalendarEntry?: boolean;
69
+ /**
70
+ * The calendar/events entry buttons rendered after the divider when
71
+ * showCalendarEntry is true. HybridDatePicker passes its own tab-switch
72
+ * IconButtons here so the live picker stays byte-behavior-identical; the
73
+ * standalone bar owns no tab state of its own.
74
+ */
75
+ calendarEntry?: React.ReactNode;
76
+ }
77
+ export declare function TimeframeQuickBar({ selectedPreset, onSelect, pinnedPreset, onPin, openGroup, onOpenChange, disableHover, showCalendarEntry, calendarEntry, }: TimeframeQuickBarProps): React.ReactElement;
78
+ export declare namespace TimeframeQuickBar {
79
+ var displayName: string;
80
+ }
@@ -7,6 +7,8 @@ export { HybridDatePicker } from './HybridDatePicker';
7
7
  export { TimeFrame } from './TimeFrame';
8
8
  export { MiniCalendar } from './MiniCalendar';
9
9
  export { ExpandableChip } from './ExpandableChip';
10
+ export { TimeframeQuickBar } from './TimeframeQuickBar';
11
+ export type { TimeframeQuickBarProps } from './TimeframeQuickBar';
10
12
  export { MarketPresetRow } from './MarketPresetRow';
11
13
  export { SimpleSelector } from './SimpleSelector';
12
14
  export type { SimpleSelectorProps } from './SimpleSelector';
@@ -147,6 +147,13 @@ export interface ExpandableChipProps {
147
147
  isOpen?: boolean;
148
148
  /** Called when open state changes */
149
149
  onOpenChange?: (groupId: string, isOpen: boolean) => void;
150
+ /**
151
+ * When true, mouse-enter/leave no longer call onOpenChange — the dropdown only
152
+ * toggles via chip click (click-to-open). Defaults false so the live top-bar
153
+ * HybridDatePicker keeps hover-to-open. quick-260601-gyl: the Settings-panel
154
+ * Quick Bar passes true.
155
+ */
156
+ disableHover?: boolean;
150
157
  }
151
158
  /** Market preset data for MarketPresetRow */
152
159
  export interface MarketPresetData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mt-gloss/ui",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"