@mt-gloss/ui 0.0.2
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/README.md +33 -0
- package/index.css +1 -0
- package/index.d.ts +80 -0
- package/index.js +17560 -0
- package/lib/Accordion.d.ts +103 -0
- package/lib/AsyncLoader.d.ts +41 -0
- package/lib/Badge.d.ts +42 -0
- package/lib/Button.d.ts +73 -0
- package/lib/ButtonGroup.d.ts +72 -0
- package/lib/Card.d.ts +140 -0
- package/lib/Checkbox.d.ts +70 -0
- package/lib/CheckboxGroup.d.ts +162 -0
- package/lib/Chip.d.ts +68 -0
- package/lib/ColorPicker.d.ts +82 -0
- package/lib/DatePicker.d.ts +102 -0
- package/lib/DateRangePicker.d.ts +109 -0
- package/lib/Dropdown.d.ts +65 -0
- package/lib/FileUpload.d.ts +109 -0
- package/lib/Form.d.ts +119 -0
- package/lib/FormField.d.ts +69 -0
- package/lib/Input.d.ts +89 -0
- package/lib/InputGroup.d.ts +59 -0
- package/lib/Link.d.ts +69 -0
- package/lib/MaskedInput.d.ts +95 -0
- package/lib/Menu.d.ts +132 -0
- package/lib/NumberInput.d.ts +81 -0
- package/lib/Radio.d.ts +60 -0
- package/lib/RadioGroup.d.ts +163 -0
- package/lib/RangeSlider.d.ts +105 -0
- package/lib/Rating.d.ts +115 -0
- package/lib/SegmentedControl.d.ts +96 -0
- package/lib/Select.d.ts +205 -0
- package/lib/Slider.d.ts +111 -0
- package/lib/SplitButton.d.ts +84 -0
- package/lib/Textarea.d.ts +59 -0
- package/lib/TimePicker.d.ts +93 -0
- package/lib/Toggle.d.ts +68 -0
- package/lib/Tooltip.d.ts +89 -0
- package/lib/Transition.d.ts +107 -0
- package/lib/composed/AddressSelect.d.ts +132 -0
- package/lib/composed/PasswordInput.d.ts +75 -0
- package/lib/composed/PaymentMethodSelect.d.ts +96 -0
- package/lib/composed/PhoneInput.d.ts +71 -0
- package/lib/composed/SearchInput.d.ts +80 -0
- package/lib/composed/TagInput.d.ts +98 -0
- package/lib/composed/index.d.ts +12 -0
- package/lib/dashboard/ChartControlBar/ChartControlBar.d.ts +45 -0
- package/lib/dashboard/ChartControlBar/FilterInput.d.ts +34 -0
- package/lib/dashboard/ChartControlBar/FusedShape.d.ts +32 -0
- package/lib/dashboard/ChartControlBar/Row1Controls.d.ts +62 -0
- package/lib/dashboard/ChartControlBar/Row2FilterTray.d.ts +62 -0
- package/lib/dashboard/ChartControlBar/fixtures/controlBarStates.d.ts +4 -0
- package/lib/dashboard/ChartControlBar/index.d.ts +8 -0
- package/lib/dashboard/ChartControlBar/types.d.ts +37 -0
- package/lib/dashboard/ChartControlBar/useFilterLayout.d.ts +51 -0
- package/lib/dashboard/FilterChip/FilterChip.d.ts +26 -0
- package/lib/dashboard/FilterChip/fixtures/filterChips.d.ts +11 -0
- package/lib/dashboard/FilterChip/index.d.ts +3 -0
- package/lib/dashboard/FilterChip/types.d.ts +17 -0
- package/lib/dashboard/MetricCard/CardShell.d.ts +22 -0
- package/lib/dashboard/MetricCard/GutterActions.d.ts +56 -0
- package/lib/dashboard/MetricCard/MetricCard.d.ts +33 -0
- package/lib/dashboard/MetricCard/StackedGroupCard.d.ts +43 -0
- package/lib/dashboard/MetricCard/TrendIndicator.d.ts +20 -0
- package/lib/dashboard/MetricCard/fixtures/allVariants.d.ts +6 -0
- package/lib/dashboard/MetricCard/fixtures/sparklineCard.d.ts +5 -0
- package/lib/dashboard/MetricCard/fixtures/standardCard.d.ts +7 -0
- package/lib/dashboard/MetricCard/fixtures/states.d.ts +19 -0
- package/lib/dashboard/MetricCard/index.d.ts +20 -0
- package/lib/dashboard/MetricCard/types.d.ts +109 -0
- package/lib/dashboard/MetricCard/useSlideOutReveal.d.ts +42 -0
- package/lib/dashboard/MetricCard/utils/formatTrend.d.ts +2 -0
- package/lib/dashboard/MetricCard/utils/formatValue.d.ts +2 -0
- package/lib/dashboard/MetricCard/visualizations/BarsBg.d.ts +25 -0
- package/lib/dashboard/MetricCard/visualizations/DonutChart.d.ts +26 -0
- package/lib/dashboard/MetricCard/visualizations/ObjectArrow.d.ts +28 -0
- package/lib/dashboard/MetricCard/visualizations/SparklineBg.d.ts +24 -0
- package/lib/dashboard/MetricCardGrid/MetricCardGrid.d.ts +28 -0
- package/lib/dashboard/MetricCardGrid/fixtures/gridCards.d.ts +3 -0
- package/lib/dashboard/MetricCardGrid/fixtures/layouts.d.ts +7 -0
- package/lib/dashboard/MetricCardGrid/index.d.ts +4 -0
- package/lib/dashboard/MetricCardGrid/types.d.ts +28 -0
- package/lib/dashboard/Skeleton/Skeleton.d.ts +25 -0
- package/lib/dashboard/Skeleton/SkeletonCard.d.ts +20 -0
- package/lib/dashboard/Skeleton/SkeletonChart.d.ts +18 -0
- package/lib/dashboard/Skeleton/SkeletonTable.d.ts +18 -0
- package/lib/dashboard/Skeleton/fixtures/skeletonSamples.d.ts +7 -0
- package/lib/dashboard/Skeleton/index.d.ts +6 -0
- package/lib/dashboard/Skeleton/types.d.ts +55 -0
- package/lib/dashboard/TabGroup/TabGroup.d.ts +27 -0
- package/lib/dashboard/TabGroup/fixtures/tabGroups.d.ts +7 -0
- package/lib/dashboard/TabGroup/index.d.ts +3 -0
- package/lib/dashboard/TabGroup/types.d.ts +22 -0
- package/lib/dashboard/TabbedDataView/TabbedDataView.d.ts +29 -0
- package/lib/dashboard/TabbedDataView/fixtures/tabConfigs.d.ts +9 -0
- package/lib/dashboard/TabbedDataView/index.d.ts +3 -0
- package/lib/dashboard/TabbedDataView/types.d.ts +20 -0
- package/lib/dashboard/TimeFrame/ExpandableChip.d.ts +22 -0
- package/lib/dashboard/TimeFrame/HybridDatePicker.d.ts +24 -0
- package/lib/dashboard/TimeFrame/MarketPresetRow.d.ts +16 -0
- package/lib/dashboard/TimeFrame/MiniCalendar.d.ts +16 -0
- package/lib/dashboard/TimeFrame/TimeFrame.d.ts +21 -0
- package/lib/dashboard/TimeFrame/fixtures/timeFrameSamples.d.ts +17 -0
- package/lib/dashboard/TimeFrame/index.d.ts +14 -0
- package/lib/dashboard/TimeFrame/types.d.ts +202 -0
- package/lib/dashboard/TimeFrame/utils/dateHelpers.d.ts +1 -0
- package/lib/dashboard/TimeFrame/utils/presets.d.ts +1 -0
- package/lib/dashboard/TimeFrame/utils/smartDateFormat.d.ts +1 -0
- package/lib/dashboard/UnifiedBreakdownTable/UnifiedBreakdownTable.d.ts +24 -0
- package/lib/dashboard/UnifiedBreakdownTable/fixtures/columns.d.ts +5 -0
- package/lib/dashboard/UnifiedBreakdownTable/fixtures/itemRows.d.ts +15 -0
- package/lib/dashboard/UnifiedBreakdownTable/fixtures/orderRows.d.ts +15 -0
- package/lib/dashboard/UnifiedBreakdownTable/index.d.ts +7 -0
- package/lib/dashboard/UnifiedBreakdownTable/types.d.ts +61 -0
- package/lib/dashboard/UnifiedContextMenu/UnifiedContextMenu.d.ts +5 -0
- package/lib/dashboard/UnifiedContextMenu/fixtures/menuActions.d.ts +9 -0
- package/lib/dashboard/UnifiedContextMenu/index.d.ts +3 -0
- package/lib/dashboard/UnifiedContextMenu/types.d.ts +130 -0
- package/lib/dashboard/index.d.ts +10 -0
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/useArrowNavigation.d.ts +106 -0
- package/lib/hooks/useFocusReturn.d.ts +26 -0
- package/lib/hooks/useFocusTrap.d.ts +50 -0
- package/lib/patterns/feedback/DestructiveModal.d.ts +31 -0
- package/lib/patterns/feedback/index.d.ts +1 -0
- package/lib/patterns/forms/AddressGroup.d.ts +37 -0
- package/lib/patterns/forms/CreditCardForm.d.ts +41 -0
- package/lib/patterns/forms/LoginForm.d.ts +38 -0
- package/lib/patterns/forms/index.d.ts +3 -0
- package/lib/patterns/index.d.ts +14 -0
- package/lib/patterns/types.d.ts +63 -0
- package/lib/types/icon.d.ts +27 -0
- package/lib/utils/animations.d.ts +60 -0
- package/lib/utils/renderIcon.d.ts +21 -0
- package/package.json +59 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { HybridDatePickerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* HybridDatePicker - Advanced date picker with presets, calendar, and market events.
|
|
5
|
+
*
|
|
6
|
+
* GlossUI version: fully controlled via props. No localStorage reads/writes.
|
|
7
|
+
* Container provides preferences, markets, and compare state via callback props.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: Fixed jitter issue by removing smart viewport positioning (getBoundingClientRect).
|
|
10
|
+
* MUI Popover's native positioning handles overflow detection without layout thrashing.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <HybridDatePicker
|
|
15
|
+
* value={[startDate, endDate]}
|
|
16
|
+
* onChange={(payload) => setDateRange(payload)}
|
|
17
|
+
* enableCompare
|
|
18
|
+
* calendarSize="medium"
|
|
19
|
+
* preferences={prefs}
|
|
20
|
+
* onPreferenceChange={setPrefs}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const HybridDatePicker: React.FC<HybridDatePickerProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MarketPresetRowProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* MarketPresetRow - Market event row item with edit functionality.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <MarketPresetRow
|
|
9
|
+
* preset={{ id: 'atlanta', label: 'Atlanta Market', startDate, endDate, location: 'Atlanta, GA' }}
|
|
10
|
+
* isSelected={false}
|
|
11
|
+
* onSelect={(id) => setSelected(id)}
|
|
12
|
+
* onEdit={(preset) => openEditor(preset)}
|
|
13
|
+
* />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const MarketPresetRow: React.FC<MarketPresetRowProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MiniCalendarProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* MiniCalendar - Compact calendar for date range selection.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <MiniCalendar
|
|
9
|
+
* selectedStart={startDate}
|
|
10
|
+
* selectedEnd={endDate}
|
|
11
|
+
* onSelect={(start, end) => setRange(start, end)}
|
|
12
|
+
* size="medium"
|
|
13
|
+
* />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const MiniCalendar: React.FC<MiniCalendarProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimeFrameProps } from './types';
|
|
3
|
+
export { HybridDatePicker } from './HybridDatePicker';
|
|
4
|
+
export type { HybridDatePickerProps } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* TimeFrame - MUI DateRangePicker wrapper with shortcuts and compare mode.
|
|
7
|
+
*
|
|
8
|
+
* GlossUI version: fully controlled via props. No localStorage reads/writes.
|
|
9
|
+
* Container provides preferences and pinned state via callback props.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <TimeFrame
|
|
14
|
+
* value={[startDate, endDate]}
|
|
15
|
+
* onChange={(payload) => setDateRange(payload)}
|
|
16
|
+
* preferences={prefs}
|
|
17
|
+
* onPreferenceChange={setPrefs}
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const TimeFrame: React.FC<TimeFrameProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DateRangeValue, CompareValue, DatePreferences, MarketPreset, MarketEvent, PresetDefinition, MarketPresetData } from '../types';
|
|
2
|
+
/** A 30-day date range ending today */
|
|
3
|
+
export declare const sampleDateRange: DateRangeValue;
|
|
4
|
+
/** Compare ranges with 3 named periods */
|
|
5
|
+
export declare const sampleCompareRanges: CompareValue;
|
|
6
|
+
/** Default date preferences */
|
|
7
|
+
export declare const samplePreferences: DatePreferences;
|
|
8
|
+
/** Built-in market presets */
|
|
9
|
+
export declare const sampleMarkets: MarketPreset[];
|
|
10
|
+
/** Custom market events */
|
|
11
|
+
export declare const sampleCustomMarkets: MarketEvent[];
|
|
12
|
+
/** Sample data for MarketPresetRow demo */
|
|
13
|
+
export declare const sampleMarketPresetData: MarketPresetData[];
|
|
14
|
+
/** Sample presets for ExpandableChip demo */
|
|
15
|
+
export declare const samplePresets: PresetDefinition[];
|
|
16
|
+
/** Period presets for ExpandableChip demo */
|
|
17
|
+
export declare const samplePeriodPresets: PresetDefinition[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeFrame Family Barrel
|
|
3
|
+
*
|
|
4
|
+
* Exports all TimeFrame components, types, and utilities from glossui.
|
|
5
|
+
*/
|
|
6
|
+
export { HybridDatePicker } from './HybridDatePicker';
|
|
7
|
+
export { TimeFrame } from './TimeFrame';
|
|
8
|
+
export { MiniCalendar } from './MiniCalendar';
|
|
9
|
+
export { ExpandableChip } from './ExpandableChip';
|
|
10
|
+
export { MarketPresetRow } from './MarketPresetRow';
|
|
11
|
+
export type { HybridDatePickerProps, TimeFrameProps, MiniCalendarProps, ExpandableChipProps, MarketPresetRowProps, MarketPresetData, DateRangeValue, CompareValue, DateChangePayload, DatePreferences, ComparePreferences, MarketEvent, PresetDefinition, MarketPreset, DateRange, CalendarSize, RangeColor, MarketDateInfo, } from './types';
|
|
12
|
+
export { formatDateRange, formatMarketDates, isMarketActive, isSameDay, isInRange, generateMarketId } from './utils/dateHelpers';
|
|
13
|
+
export { getDateRangeForPreset, findPreset, getPresetLabel, normalizePresetId, toUppercasePresetId, getAllPresets, ROLLING_OPTIONS, PERIOD_OPTIONS, TODAY_PRESET, DEFAULT_MARKET_PRESETS, DEFAULT_PINNED, } from './utils/presets';
|
|
14
|
+
export { sampleDateRange, sampleCompareRanges, samplePreferences, sampleMarkets, sampleCustomMarkets, sampleMarketPresetData, samplePresets, samplePeriodPresets, } from './fixtures/timeFrameSamples';
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
/** Tuple representing a nullable date range [start, end] */
|
|
3
|
+
export type DateRangeValue = [Date | null, Date | null];
|
|
4
|
+
/** Compare mode value with up to 3 named ranges */
|
|
5
|
+
export interface CompareValue {
|
|
6
|
+
rangeA: DateRangeValue;
|
|
7
|
+
rangeB?: DateRangeValue;
|
|
8
|
+
rangeC?: DateRangeValue;
|
|
9
|
+
}
|
|
10
|
+
/** Union type for date picker onChange payload */
|
|
11
|
+
export type DateChangePayload = DateRangeValue | CompareValue;
|
|
12
|
+
/** A named date preset (e.g., MTD, 30D) */
|
|
13
|
+
export interface PresetDefinition {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
17
|
+
/** A market event preset with date range and location */
|
|
18
|
+
export interface MarketPreset extends PresetDefinition {
|
|
19
|
+
startDate: Date;
|
|
20
|
+
endDate: Date;
|
|
21
|
+
location: string;
|
|
22
|
+
}
|
|
23
|
+
/** Resolved date range from a preset */
|
|
24
|
+
export interface DateRange {
|
|
25
|
+
start: Date;
|
|
26
|
+
end: Date;
|
|
27
|
+
label?: string;
|
|
28
|
+
}
|
|
29
|
+
/** User date preferences (persisted by container, not glossui) */
|
|
30
|
+
export interface DatePreferences {
|
|
31
|
+
version: number;
|
|
32
|
+
lastPreset: string;
|
|
33
|
+
pinnedPreset: string;
|
|
34
|
+
compareEnabled: boolean;
|
|
35
|
+
rangeCount: number;
|
|
36
|
+
lastPresetB: string | null;
|
|
37
|
+
lastPresetC: string | null;
|
|
38
|
+
pinnedRolling?: string;
|
|
39
|
+
pinnedPeriod?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/** Compare mode preferences */
|
|
43
|
+
export interface ComparePreferences {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
rangeCount: number;
|
|
46
|
+
presetB: string | null;
|
|
47
|
+
presetC: string | null;
|
|
48
|
+
}
|
|
49
|
+
/** A market event (built-in or custom) */
|
|
50
|
+
export interface MarketEvent {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
startDate: Date;
|
|
54
|
+
endDate: Date;
|
|
55
|
+
location?: string;
|
|
56
|
+
isCustom?: boolean;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
/** Calendar display size */
|
|
60
|
+
export type CalendarSize = 'small' | 'medium' | 'large';
|
|
61
|
+
/** Color variant for range highlighting */
|
|
62
|
+
export type RangeColor = 'primary' | 'secondary' | 'tertiary';
|
|
63
|
+
/** Market date info for calendar dot rendering */
|
|
64
|
+
export interface MarketDateInfo {
|
|
65
|
+
startDate: Date;
|
|
66
|
+
endDate: Date;
|
|
67
|
+
label: string;
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
/** Props for HybridDatePicker -- the main date picker component */
|
|
71
|
+
export interface HybridDatePickerProps {
|
|
72
|
+
/** Current value: a single range tuple, compare value, or null */
|
|
73
|
+
value: [Date, Date] | CompareValue | null;
|
|
74
|
+
/** Called when the date selection changes */
|
|
75
|
+
onChange: (value: DateChangePayload) => void;
|
|
76
|
+
/** Enable compare mode toggle (default: false) */
|
|
77
|
+
enableCompare?: boolean;
|
|
78
|
+
/** Calendar display size (default: 'medium') */
|
|
79
|
+
calendarSize?: CalendarSize;
|
|
80
|
+
/** Show header bar (default: false) */
|
|
81
|
+
showHeader?: boolean;
|
|
82
|
+
/** Header bar title (default: 'Select Time Frame') */
|
|
83
|
+
headerTitle?: string;
|
|
84
|
+
/** Force popover open for testing (default: false) */
|
|
85
|
+
forceOpen?: boolean;
|
|
86
|
+
/** Called when popover closes */
|
|
87
|
+
onClose?: () => void;
|
|
88
|
+
/** MUI sx prop for container styling */
|
|
89
|
+
sx?: SxProps<Theme>;
|
|
90
|
+
/** Current user preferences */
|
|
91
|
+
preferences?: DatePreferences;
|
|
92
|
+
/** Called when preferences should be saved */
|
|
93
|
+
onPreferenceChange?: (prefs: DatePreferences) => void;
|
|
94
|
+
/** Built-in market presets */
|
|
95
|
+
markets?: MarketPreset[];
|
|
96
|
+
/** User-created custom markets */
|
|
97
|
+
customMarkets?: MarketEvent[];
|
|
98
|
+
/** Called when a custom market is saved */
|
|
99
|
+
onMarketSave?: (market: MarketEvent) => void;
|
|
100
|
+
/** Called when a custom market is deleted */
|
|
101
|
+
onMarketDelete?: (marketId: string) => void;
|
|
102
|
+
/** Whether compare mode is active */
|
|
103
|
+
compareEnabled?: boolean;
|
|
104
|
+
/** Called when compare mode is toggled */
|
|
105
|
+
onCompareToggle?: (enabled: boolean) => void;
|
|
106
|
+
}
|
|
107
|
+
/** Props for MiniCalendar -- compact calendar for date range selection */
|
|
108
|
+
export interface MiniCalendarProps {
|
|
109
|
+
/** Currently selected start date */
|
|
110
|
+
selectedStart: Date | null;
|
|
111
|
+
/** Currently selected end date */
|
|
112
|
+
selectedEnd: Date | null;
|
|
113
|
+
/** Called when dates are selected */
|
|
114
|
+
onSelect: (start: Date, end: Date | null) => void;
|
|
115
|
+
/** Market date info for dot indicators */
|
|
116
|
+
marketDates?: MarketDateInfo[];
|
|
117
|
+
/** Maximum selectable date */
|
|
118
|
+
maxDate?: Date;
|
|
119
|
+
/** Calendar size preset (default: 'medium') */
|
|
120
|
+
size?: CalendarSize;
|
|
121
|
+
/** Show market legend below calendar */
|
|
122
|
+
showMarketLegend?: boolean;
|
|
123
|
+
/** Show month/year dropdown selectors */
|
|
124
|
+
showMonthYearDropdowns?: boolean;
|
|
125
|
+
/** Date to focus/navigate to */
|
|
126
|
+
focusDate?: Date;
|
|
127
|
+
/** Color variant for range highlighting (default: 'primary') */
|
|
128
|
+
rangeColor?: RangeColor;
|
|
129
|
+
}
|
|
130
|
+
/** Props for ExpandableChip -- hover-expand preset group with pinning */
|
|
131
|
+
export interface ExpandableChipProps {
|
|
132
|
+
/** Unique group identifier */
|
|
133
|
+
groupId: string;
|
|
134
|
+
/** Available preset options */
|
|
135
|
+
options: PresetDefinition[];
|
|
136
|
+
/** Currently selected preset ID */
|
|
137
|
+
selectedId: string;
|
|
138
|
+
/** Default preset ID for this group */
|
|
139
|
+
defaultId: string;
|
|
140
|
+
/** Called when a preset is selected */
|
|
141
|
+
onSelect: (id: string) => void;
|
|
142
|
+
/** Currently pinned preset ID */
|
|
143
|
+
pinnedId: string;
|
|
144
|
+
/** Called when a preset is pinned */
|
|
145
|
+
onPin?: (id: string) => void;
|
|
146
|
+
/** Whether the dropdown is open (controlled) */
|
|
147
|
+
isOpen?: boolean;
|
|
148
|
+
/** Called when open state changes */
|
|
149
|
+
onOpenChange?: (groupId: string, isOpen: boolean) => void;
|
|
150
|
+
}
|
|
151
|
+
/** Market preset data for MarketPresetRow */
|
|
152
|
+
export interface MarketPresetData {
|
|
153
|
+
id: string;
|
|
154
|
+
label: string;
|
|
155
|
+
startDate: Date;
|
|
156
|
+
endDate: Date;
|
|
157
|
+
location?: string;
|
|
158
|
+
active?: boolean;
|
|
159
|
+
[key: string]: unknown;
|
|
160
|
+
}
|
|
161
|
+
/** Props for MarketPresetRow -- market event row item */
|
|
162
|
+
export interface MarketPresetRowProps {
|
|
163
|
+
/** Market preset data to display */
|
|
164
|
+
preset: MarketPresetData;
|
|
165
|
+
/** Whether this preset is currently selected */
|
|
166
|
+
isSelected: boolean;
|
|
167
|
+
/** Whether interaction is disabled */
|
|
168
|
+
disabled?: boolean;
|
|
169
|
+
/** Called when the preset is selected */
|
|
170
|
+
onSelect: (id: string) => void;
|
|
171
|
+
/** Called when edit is clicked */
|
|
172
|
+
onEdit?: (preset: MarketPresetData) => void;
|
|
173
|
+
}
|
|
174
|
+
/** Props for the TimeFrame wrapper component */
|
|
175
|
+
export interface TimeFrameProps {
|
|
176
|
+
/** Current value: a single range tuple or compare value */
|
|
177
|
+
value: DateRangeValue;
|
|
178
|
+
/** Called when the date selection changes */
|
|
179
|
+
onChange: (value: DateChangePayload) => void;
|
|
180
|
+
/** Called when preset selection changes */
|
|
181
|
+
onPresetChange?: (presetId: string) => void;
|
|
182
|
+
/** User preferences (controlled) */
|
|
183
|
+
preferences?: DatePreferences;
|
|
184
|
+
/** Called when preferences should be saved */
|
|
185
|
+
onPreferenceChange?: (prefs: DatePreferences) => void;
|
|
186
|
+
/** Calendar display size */
|
|
187
|
+
calendarSize?: CalendarSize;
|
|
188
|
+
/** Whether compare mode is active */
|
|
189
|
+
compareEnabled?: boolean;
|
|
190
|
+
/** Called when compare mode is toggled */
|
|
191
|
+
onCompareToggle?: (enabled: boolean) => void;
|
|
192
|
+
/** Built-in market presets */
|
|
193
|
+
markets?: MarketPreset[];
|
|
194
|
+
/** User-created custom markets */
|
|
195
|
+
customMarkets?: MarketEvent[];
|
|
196
|
+
/** Called when a custom market is saved */
|
|
197
|
+
onMarketSave?: (market: MarketEvent) => void;
|
|
198
|
+
/** Called when a custom market is deleted */
|
|
199
|
+
onMarketDelete?: (marketId: string) => void;
|
|
200
|
+
/** MUI sx prop for container styling */
|
|
201
|
+
sx?: SxProps<Theme>;
|
|
202
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { formatDateRange, formatMarketDates, isMarketActive, isSameDay, isInRange, generateMarketId } from '@mt-gloss/utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ROLLING_OPTIONS, PERIOD_OPTIONS, TODAY_PRESET, DEFAULT_MARKET_PRESETS, PRESET_ID_MAP, PRESET_ID_REVERSE_MAP, getDateRangeForPreset, findPreset, getPresetLabel, normalizePresetId, toUppercasePresetId, getAllPresets, DEFAULT_PINNED } from '@mt-gloss/utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { formatDateRangeSmart as formatDateRange, detectPreset, formatDateRangeWithPreset, getDateRangeDisplayInfo, formatShortYear, stripLeadingZeros, formatSingleDate, parseDateRange, isValidDateRangeFormat, getDurationDays, formatDuration, formatPreset, getPresetDateRange } from '@mt-gloss/utils';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UnifiedBreakdownTableProps } from './types';
|
|
2
|
+
declare function UnifiedBreakdownTableInner<TRow extends {
|
|
3
|
+
id: string | number;
|
|
4
|
+
}>(props: UnifiedBreakdownTableProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* UnifiedBreakdownTable - generic typed DataGridPro wrapper for breakdown data.
|
|
7
|
+
*
|
|
8
|
+
* Accepts a generic `TRow` type for type-safe row data. Uses an internal
|
|
9
|
+
* `toGridColDef` adapter to map public `ColumnDef<TRow>` to MUI `GridColDef`,
|
|
10
|
+
* isolating consumers from MUI DataGrid types.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { UnifiedBreakdownTable } from '@mt-gloss/ui';
|
|
15
|
+
* import type { ColumnDef } from '@mt-gloss/ui';
|
|
16
|
+
*
|
|
17
|
+
* const columns: ColumnDef<MyRow>[] = [...];
|
|
18
|
+
* <UnifiedBreakdownTable data={rows} columns={columns} pageSize={10} />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const UnifiedBreakdownTable: typeof UnifiedBreakdownTableInner & {
|
|
22
|
+
displayName?: string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sample item row data for table explorer / testing.
|
|
3
|
+
*/
|
|
4
|
+
export interface ItemRow {
|
|
5
|
+
id: string;
|
|
6
|
+
sku: string;
|
|
7
|
+
name: string;
|
|
8
|
+
category: string;
|
|
9
|
+
price: number;
|
|
10
|
+
quantity: number;
|
|
11
|
+
total: number;
|
|
12
|
+
manufacturerName: string;
|
|
13
|
+
lastDate: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const itemRows: ItemRow[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sample order row data for table explorer / testing.
|
|
3
|
+
*/
|
|
4
|
+
export interface OrderRow {
|
|
5
|
+
id: string;
|
|
6
|
+
orderNumber: string;
|
|
7
|
+
customerName: string;
|
|
8
|
+
manufacturerName: string;
|
|
9
|
+
salespersonName: string;
|
|
10
|
+
status: string;
|
|
11
|
+
total: number;
|
|
12
|
+
date: string;
|
|
13
|
+
skuCount: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const orderRows: OrderRow[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { UnifiedBreakdownTable } from './UnifiedBreakdownTable';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export { orderRows } from './fixtures/orderRows';
|
|
4
|
+
export type { OrderRow } from './fixtures/orderRows';
|
|
5
|
+
export { itemRows } from './fixtures/itemRows';
|
|
6
|
+
export type { ItemRow } from './fixtures/itemRows';
|
|
7
|
+
export { orderColumns, itemColumns } from './fixtures/columns';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Column definition for UnifiedBreakdownTable. Generic over row type for field safety. */
|
|
3
|
+
export interface ColumnDef<TRow> {
|
|
4
|
+
field: keyof TRow & string;
|
|
5
|
+
headerName: string;
|
|
6
|
+
width?: number;
|
|
7
|
+
minWidth?: number;
|
|
8
|
+
flex?: number;
|
|
9
|
+
align?: 'left' | 'right' | 'center';
|
|
10
|
+
headerAlign?: 'left' | 'right' | 'center';
|
|
11
|
+
cellClassName?: string;
|
|
12
|
+
headerClassName?: string;
|
|
13
|
+
renderCell?: (params: {
|
|
14
|
+
row: TRow;
|
|
15
|
+
value: TRow[keyof TRow];
|
|
16
|
+
}) => ReactNode;
|
|
17
|
+
renderHeader?: () => ReactNode;
|
|
18
|
+
valueGetter?: (params: {
|
|
19
|
+
row: TRow;
|
|
20
|
+
}) => unknown;
|
|
21
|
+
}
|
|
22
|
+
/** Controlled pagination configuration. */
|
|
23
|
+
export interface PaginationConfig {
|
|
24
|
+
page: number;
|
|
25
|
+
pageSize: number;
|
|
26
|
+
total: number;
|
|
27
|
+
onPageChange: (page: number, pageSize: number) => void;
|
|
28
|
+
}
|
|
29
|
+
/** Single sort directive. */
|
|
30
|
+
export interface SortModel {
|
|
31
|
+
field: string;
|
|
32
|
+
sort: 'asc' | 'desc';
|
|
33
|
+
}
|
|
34
|
+
/** Data for an active filter displayed as a removable chip. */
|
|
35
|
+
export interface FilterChipData {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string;
|
|
38
|
+
field: string;
|
|
39
|
+
value: string;
|
|
40
|
+
onRemove?: (id: string) => void;
|
|
41
|
+
}
|
|
42
|
+
/** Props for the presentational UnifiedBreakdownTable component. */
|
|
43
|
+
export interface UnifiedBreakdownTableProps<TRow extends {
|
|
44
|
+
id: string | number;
|
|
45
|
+
}> {
|
|
46
|
+
data: TRow[];
|
|
47
|
+
columns: ColumnDef<TRow>[];
|
|
48
|
+
isLoading?: boolean;
|
|
49
|
+
isError?: boolean;
|
|
50
|
+
isEmpty?: boolean;
|
|
51
|
+
sortModel?: SortModel[];
|
|
52
|
+
onSort?: (model: SortModel[]) => void;
|
|
53
|
+
pagination?: PaginationConfig;
|
|
54
|
+
activeFilters?: FilterChipData[];
|
|
55
|
+
onFilterRemove?: (filterId: string) => void;
|
|
56
|
+
rowHeight?: number;
|
|
57
|
+
headerHeight?: number;
|
|
58
|
+
onCellClick?: (row: TRow, field: keyof TRow & string, event: React.MouseEvent) => void;
|
|
59
|
+
onContextMenu?: (row: TRow, field: keyof TRow & string, anchorEl: HTMLElement) => void;
|
|
60
|
+
getRowId?: (row: TRow) => string;
|
|
61
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UnifiedContextMenuProps } from './types';
|
|
3
|
+
declare function UnifiedContextMenuInner({ anchorEl, open, onClose, actions, row, entityType, dispatch, onAddTab, onFilter, onUpdateViz, onActionClick, }: UnifiedContextMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const UnifiedContextMenu: React.MemoExoticComponent<typeof UnifiedContextMenuInner>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UnifiedMenuAction } from '../types';
|
|
2
|
+
export declare const entityNameActions: UnifiedMenuAction[];
|
|
3
|
+
export declare const orderIdActions: UnifiedMenuAction[];
|
|
4
|
+
export declare const numericActions: UnifiedMenuAction[];
|
|
5
|
+
export declare const allFixtures: {
|
|
6
|
+
entityName: UnifiedMenuAction[];
|
|
7
|
+
orderId: UnifiedMenuAction[];
|
|
8
|
+
numeric: UnifiedMenuAction[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { UnifiedContextMenu } from './UnifiedContextMenu';
|
|
2
|
+
export type { UnifiedContextMenuProps, UnifiedMenuAction, MenuActionContext, MenuFilterOptions, CellKind, MenuSection, EntityType, } from './types';
|
|
3
|
+
export { entityNameActions, orderIdActions, numericActions, allFixtures as contextMenuFixtures } from './fixtures/menuActions';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GlossUI UnifiedContextMenu Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared TypeScript interfaces for the unified context menu system.
|
|
5
|
+
* These types define the glossui component's API contract.
|
|
6
|
+
* Copied from app/components/UnifiedContextMenu/types.ts with
|
|
7
|
+
* the addition of the component props interface.
|
|
8
|
+
*/
|
|
9
|
+
export type EntityType = 'customer' | 'manufacturer' | 'salesperson';
|
|
10
|
+
/** Cell kinds that trigger context menus */
|
|
11
|
+
export type CellKind = 'entityName' | 'orderId' | 'itemName' | 'numeric';
|
|
12
|
+
/** Menu sections rendered in order with dividers between groups */
|
|
13
|
+
export type MenuSection = 'tab-actions' | 'graph-actions' | 'direct-nav' | 'related-nav';
|
|
14
|
+
/**
|
|
15
|
+
* A single menu action definition.
|
|
16
|
+
* Each action belongs to a section, supports multiple cell kinds,
|
|
17
|
+
* and can be filtered by role, status, entity type, table type, and field.
|
|
18
|
+
*/
|
|
19
|
+
export interface UnifiedMenuAction {
|
|
20
|
+
/** Unique action identifier */
|
|
21
|
+
id: string;
|
|
22
|
+
/** Display label */
|
|
23
|
+
label: string;
|
|
24
|
+
/** MUI icon name string (resolved via ICON_MAP in component) */
|
|
25
|
+
icon: string;
|
|
26
|
+
/** Which section this action belongs to */
|
|
27
|
+
section: MenuSection;
|
|
28
|
+
/** Action behavior type */
|
|
29
|
+
type: 'create-tab' | 'graph' | 'navigate' | 'filter' | 'dispatch';
|
|
30
|
+
/** Which cell kinds this action appears for */
|
|
31
|
+
cellKinds: CellKind[];
|
|
32
|
+
/** Restrict to specific user roles (sales-agency, manufacturer, buyer) */
|
|
33
|
+
roleVisibility?: string[];
|
|
34
|
+
/** Only show when order status matches one of these */
|
|
35
|
+
statusFilter?: string[];
|
|
36
|
+
/** When cellKind is 'entityName', restrict to these entity types */
|
|
37
|
+
entityTypes?: Array<'customer' | 'manufacturer' | 'salesperson'>;
|
|
38
|
+
/** Restrict to specific table types (e.g., 'items', 'leaderboard') */
|
|
39
|
+
tableTypes?: string[];
|
|
40
|
+
/** Restrict to specific field names within a cell kind (e.g., 'sold', 'revenue') */
|
|
41
|
+
fields?: string[];
|
|
42
|
+
/** Route key for navigation actions */
|
|
43
|
+
routeKey?: string;
|
|
44
|
+
/** Param key mapping entity ID to route param */
|
|
45
|
+
paramKey?: string;
|
|
46
|
+
/** Tab type for create-tab actions */
|
|
47
|
+
tabType?: string;
|
|
48
|
+
/** Filter key for filter/create-tab actions */
|
|
49
|
+
filterKey?: string;
|
|
50
|
+
/** Graph type for graph actions */
|
|
51
|
+
graphType?: string;
|
|
52
|
+
/** Quantity metric for graph actions (# or $) */
|
|
53
|
+
quant?: string;
|
|
54
|
+
/** Override timeframe for graph actions (QTD, YTD, SEASONAL) */
|
|
55
|
+
timeframeOverride?: string;
|
|
56
|
+
/** Dynamic disabled check based on row data */
|
|
57
|
+
disabled?: (row: Record<string, unknown>) => boolean;
|
|
58
|
+
/** Tooltip shown when action is disabled */
|
|
59
|
+
disabledTooltip?: string;
|
|
60
|
+
/** Subtitle/hint text (e.g., "Opens in RepTime") */
|
|
61
|
+
subtitle?: string;
|
|
62
|
+
/** Dynamic label function based on row and entity context */
|
|
63
|
+
labelFn?: (row: Record<string, unknown>, entityType?: string) => string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Context provided to menu action handlers.
|
|
67
|
+
* Contains all data needed to execute an action (create tab, graph, navigate).
|
|
68
|
+
*/
|
|
69
|
+
export interface MenuActionContext {
|
|
70
|
+
/** The data row that triggered the context menu */
|
|
71
|
+
row: Record<string, unknown>;
|
|
72
|
+
/** Entity type (singular: customer, manufacturer, salesperson) */
|
|
73
|
+
entityType?: string;
|
|
74
|
+
/** Entity ID from the row */
|
|
75
|
+
entityId?: string;
|
|
76
|
+
/** Entity display name from the row */
|
|
77
|
+
entityName?: string;
|
|
78
|
+
/** Current timeframe for the table/context */
|
|
79
|
+
timeFrame?: unknown;
|
|
80
|
+
/** Current user type (sales-agency, manufacturer, buyer) */
|
|
81
|
+
userType?: string;
|
|
82
|
+
/** Current table type */
|
|
83
|
+
tableType?: string;
|
|
84
|
+
/** Clicked field name */
|
|
85
|
+
field?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options passed to getMenuActions for filtering the action registry.
|
|
89
|
+
*/
|
|
90
|
+
export interface MenuFilterOptions {
|
|
91
|
+
/** Entity type (singular) */
|
|
92
|
+
entityType?: 'customer' | 'manufacturer' | 'salesperson';
|
|
93
|
+
/** User role */
|
|
94
|
+
userType?: string;
|
|
95
|
+
/** Current order status (for status-aware actions) */
|
|
96
|
+
orderStatus?: string;
|
|
97
|
+
/** Table type context (items, orders, leaderboard) */
|
|
98
|
+
tableType?: string;
|
|
99
|
+
/** Clicked field name (sold, revenue, orders, total) */
|
|
100
|
+
field?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Props for the glossui UnifiedContextMenu component.
|
|
104
|
+
* Receives pre-filtered actions from the container.
|
|
105
|
+
* Supports dual-mode: dispatch prop OR individual callbacks.
|
|
106
|
+
*/
|
|
107
|
+
export interface UnifiedContextMenuProps {
|
|
108
|
+
/** Anchor element for menu positioning */
|
|
109
|
+
anchorEl: HTMLElement | null;
|
|
110
|
+
/** Whether menu is open */
|
|
111
|
+
open: boolean;
|
|
112
|
+
/** Close handler */
|
|
113
|
+
onClose: () => void;
|
|
114
|
+
/** Pre-filtered actions from container */
|
|
115
|
+
actions: UnifiedMenuAction[];
|
|
116
|
+
/** The data row that triggered the menu */
|
|
117
|
+
row: Record<string, unknown>;
|
|
118
|
+
/** Entity type context */
|
|
119
|
+
entityType?: string;
|
|
120
|
+
/** Dashboard dispatch function (if available) */
|
|
121
|
+
dispatch?: (action: Record<string, unknown>) => void;
|
|
122
|
+
/** Callback for tab creation actions */
|
|
123
|
+
onAddTab?: (tab: Record<string, unknown>) => void;
|
|
124
|
+
/** Callback for filter actions */
|
|
125
|
+
onFilter?: (entityType: string, entityId: string, entityName: string) => void;
|
|
126
|
+
/** Callback for viz/graph update actions */
|
|
127
|
+
onUpdateViz?: (config: Record<string, unknown>) => void;
|
|
128
|
+
/** Generic action click handler (receives action + full context) */
|
|
129
|
+
onActionClick?: (action: UnifiedMenuAction, context: MenuActionContext) => void;
|
|
130
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './FilterChip';
|
|
2
|
+
export * from './TabGroup';
|
|
3
|
+
export * from './Skeleton';
|
|
4
|
+
export * from './MetricCard';
|
|
5
|
+
export * from './UnifiedBreakdownTable';
|
|
6
|
+
export * from './ChartControlBar';
|
|
7
|
+
export * from './UnifiedContextMenu';
|
|
8
|
+
export * from './TimeFrame';
|
|
9
|
+
export * from './MetricCardGrid';
|
|
10
|
+
export * from './TabbedDataView';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useFocusTrap, type UseFocusTrapOptions } from './useFocusTrap';
|
|
2
|
+
export { useFocusReturn, type UseFocusReturnOptions } from './useFocusReturn';
|
|
3
|
+
export { useArrowNavigation, type UseArrowNavigationOptions, type UseArrowNavigationReturn, } from './useArrowNavigation';
|