@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,45 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ChartControlBarProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* ChartControlBar - three-layer chart control bar with metric, entity, and dimension toggles.
|
|
5
|
+
*
|
|
6
|
+
* Renders a composited control bar with grey track backgrounds (layer 1),
|
|
7
|
+
* FusedShape SVG connectors (layer 2), and interactive TabGroup controls (layer 3).
|
|
8
|
+
* Supports filter trays that slide down from active tabs with autocomplete inputs.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { ChartControlBar } from '@mt-gloss/ui';
|
|
13
|
+
*
|
|
14
|
+
* <ChartControlBar
|
|
15
|
+
* vizState={vizState}
|
|
16
|
+
* onTypeChange={setType}
|
|
17
|
+
* onQuantChange={setQuant}
|
|
18
|
+
* onEntityTypeChange={setEntityType}
|
|
19
|
+
* onEntitySelect={handleEntitySelect}
|
|
20
|
+
* onItemSelect={handleItemSelect}
|
|
21
|
+
* onTimeFrameChange={setTimeFrame}
|
|
22
|
+
* userType="sales-agency"
|
|
23
|
+
* entityFilterOptions={entityOptions}
|
|
24
|
+
* itemFilterOptions={itemOptions}
|
|
25
|
+
* datePickerSlot={<DatePicker />}
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const ChartControlBar: React.MemoExoticComponent<({ vizState, onTypeChange, onQuantChange, onEntityTypeChange, onEntitySelect, onItemSelect, onTimeFrameChange, userType, entityFilterOptions, itemFilterOptions, datePickerSlot, metricTabs, entityTabs, dimensionTabs, showDimensionGroup, }: ChartControlBarProps & {
|
|
30
|
+
datePickerSlot?: ReactNode;
|
|
31
|
+
metricTabs?: {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
mono?: boolean;
|
|
35
|
+
}[];
|
|
36
|
+
entityTabs?: {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
}[];
|
|
40
|
+
dimensionTabs?: {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
}[];
|
|
44
|
+
showDimensionGroup?: boolean;
|
|
45
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FilterOption } from './types';
|
|
3
|
+
interface FilterInputProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
onSelect?: (option: FilterOption) => void;
|
|
7
|
+
onSubmit?: (value: string) => void;
|
|
8
|
+
onClear: () => void;
|
|
9
|
+
activeValue?: string | null;
|
|
10
|
+
fading?: boolean;
|
|
11
|
+
options?: FilterOption[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* FilterInput - search input with autocomplete dropdown for chart control bar filters.
|
|
15
|
+
*
|
|
16
|
+
* Supports filled state (showing active value with clear button) and empty state
|
|
17
|
+
* (search input with blinking caret and dropdown suggestions).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { FilterInput } from '@mt-gloss/ui';
|
|
22
|
+
*
|
|
23
|
+
* <FilterInput
|
|
24
|
+
* value={search}
|
|
25
|
+
* onChange={setSearch}
|
|
26
|
+
* onSubmit={handleSubmit}
|
|
27
|
+
* onClear={handleClear}
|
|
28
|
+
* activeValue={filterValue}
|
|
29
|
+
* options={filterOptions}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const FilterInput: React.MemoExoticComponent<({ value, onChange, onSelect, onSubmit, onClear, activeValue, fading, options, }: FilterInputProps) => import("react/jsx-runtime").JSX.Element>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface FusedShapeProps {
|
|
3
|
+
pillLeft: number;
|
|
4
|
+
pillWidth: number;
|
|
5
|
+
pillTop: number;
|
|
6
|
+
pillHeight: number;
|
|
7
|
+
filterLeft: number;
|
|
8
|
+
filterWidth: number;
|
|
9
|
+
filterTop: number;
|
|
10
|
+
filterHeight: number;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* FusedShape - SVG connector shape between a tab pill and its filter tray.
|
|
15
|
+
*
|
|
16
|
+
* Renders absolutely-positioned div elements that form a visual connection
|
|
17
|
+
* between an active tab (pill) and its associated filter input (tray below).
|
|
18
|
+
* Uses inverted corner masks for smooth rounded connections.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { FusedShape } from '@mt-gloss/ui';
|
|
23
|
+
*
|
|
24
|
+
* <FusedShape
|
|
25
|
+
* pillLeft={100} pillWidth={80} pillTop={0} pillHeight={32}
|
|
26
|
+
* filterLeft={80} filterWidth={200} filterTop={40} filterHeight={32}
|
|
27
|
+
* visible={isFilterOpen}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const FusedShape: React.MemoExoticComponent<({ pillLeft, pillWidth, pillTop, pillHeight, filterLeft, filterWidth, filterTop, filterHeight, visible, }: FusedShapeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as React, MutableRefObject, ReactNode } from 'react';
|
|
2
|
+
interface TabDef {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
mono?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface GroupDef {
|
|
8
|
+
id: string;
|
|
9
|
+
tabs: TabDef[];
|
|
10
|
+
}
|
|
11
|
+
interface Row1ControlsProps {
|
|
12
|
+
selections: {
|
|
13
|
+
metric: string;
|
|
14
|
+
entity: string;
|
|
15
|
+
dimension: string;
|
|
16
|
+
};
|
|
17
|
+
metricGroup: GroupDef;
|
|
18
|
+
entityGroup: GroupDef;
|
|
19
|
+
dimensionGroup: GroupDef;
|
|
20
|
+
onSelect: (groupId: string, tabId: string) => void;
|
|
21
|
+
onEntityToggle: () => void;
|
|
22
|
+
onDimensionToggle: () => void;
|
|
23
|
+
metricGroupRef: MutableRefObject<HTMLDivElement | null>;
|
|
24
|
+
entityGroupRef: MutableRefObject<HTMLDivElement | null>;
|
|
25
|
+
dimensionGroupRef: MutableRefObject<HTMLDivElement | null>;
|
|
26
|
+
entityTabRefs: MutableRefObject<Record<string, HTMLElement>>;
|
|
27
|
+
dimensionTabRefs: MutableRefObject<Record<string, HTMLElement>>;
|
|
28
|
+
showItemFilter: boolean;
|
|
29
|
+
showEntityFilter: boolean;
|
|
30
|
+
showDimensionGroup?: boolean;
|
|
31
|
+
datePickerSlot?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Row1Controls - top row of the chart control bar containing metric, entity, and dimension tab groups.
|
|
35
|
+
*
|
|
36
|
+
* Renders three TabGroup instances with ref forwarding for geometry measurement.
|
|
37
|
+
* Includes an optional datePickerSlot pushed to the far right via auto margin.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* import { Row1Controls } from '@mt-gloss/ui';
|
|
42
|
+
*
|
|
43
|
+
* <Row1Controls
|
|
44
|
+
* selections={{ metric: '$', entity: 'orders', dimension: 'customers' }}
|
|
45
|
+
* metricGroup={metricGroup}
|
|
46
|
+
* entityGroup={entityGroup}
|
|
47
|
+
* dimensionGroup={dimensionGroup}
|
|
48
|
+
* onSelect={handleSelect}
|
|
49
|
+
* onEntityToggle={handleEntityToggle}
|
|
50
|
+
* onDimensionToggle={handleDimensionToggle}
|
|
51
|
+
* metricGroupRef={metricGroupRef}
|
|
52
|
+
* entityGroupRef={entityGroupRef}
|
|
53
|
+
* dimensionGroupRef={dimensionGroupRef}
|
|
54
|
+
* entityTabRefs={entityTabRefs}
|
|
55
|
+
* dimensionTabRefs={dimensionTabRefs}
|
|
56
|
+
* showItemFilter={showItemFilter}
|
|
57
|
+
* showEntityFilter={showEntityFilter}
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare const Row1Controls: React.MemoExoticComponent<({ selections, metricGroup, entityGroup, dimensionGroup, onSelect, onEntityToggle, onDimensionToggle, metricGroupRef, entityGroupRef, dimensionGroupRef, entityTabRefs, dimensionTabRefs, showItemFilter, showEntityFilter, showDimensionGroup, datePickerSlot, }: Row1ControlsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FilterOption } from './types';
|
|
3
|
+
interface Row2FilterTrayProps {
|
|
4
|
+
showRow2: boolean;
|
|
5
|
+
showItemFilter: boolean;
|
|
6
|
+
showEntityFilter: boolean;
|
|
7
|
+
itemFilterLayout: {
|
|
8
|
+
left: number;
|
|
9
|
+
width: number;
|
|
10
|
+
};
|
|
11
|
+
entityFilterLayout: {
|
|
12
|
+
left: number;
|
|
13
|
+
width: number;
|
|
14
|
+
};
|
|
15
|
+
itemSearch: string;
|
|
16
|
+
setItemSearch: (v: string) => void;
|
|
17
|
+
onItemSubmit: (v: string) => void;
|
|
18
|
+
onItemSelect?: (option: FilterOption) => void;
|
|
19
|
+
onItemClear: () => void;
|
|
20
|
+
itemFilterValue: string | null;
|
|
21
|
+
itemOptions?: FilterOption[];
|
|
22
|
+
entitySearch: string;
|
|
23
|
+
setEntitySearch: (v: string) => void;
|
|
24
|
+
onEntitySubmit: (v: string) => void;
|
|
25
|
+
onEntitySelect?: (option: FilterOption) => void;
|
|
26
|
+
onEntityClear: () => void;
|
|
27
|
+
entityFilterValue: string | null;
|
|
28
|
+
entityFading: boolean;
|
|
29
|
+
entityOptions?: FilterOption[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Row2FilterTray - animated filter tray that slides down from the control bar.
|
|
33
|
+
*
|
|
34
|
+
* Renders two absolutely-positioned FilterInput instances (item and entity)
|
|
35
|
+
* with slide and fade transitions driven by visibility flags.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* import { Row2FilterTray } from '@mt-gloss/ui';
|
|
40
|
+
*
|
|
41
|
+
* <Row2FilterTray
|
|
42
|
+
* showRow2={showRow2}
|
|
43
|
+
* showItemFilter={showItemFilter}
|
|
44
|
+
* showEntityFilter={showEntityFilter}
|
|
45
|
+
* itemFilterLayout={{ left: 100, width: 200 }}
|
|
46
|
+
* entityFilterLayout={{ left: 300, width: 200 }}
|
|
47
|
+
* itemSearch={itemSearch}
|
|
48
|
+
* setItemSearch={setItemSearch}
|
|
49
|
+
* onItemSubmit={handleItemSubmit}
|
|
50
|
+
* onItemClear={handleItemClear}
|
|
51
|
+
* itemFilterValue={itemFilterValue}
|
|
52
|
+
* entitySearch={entitySearch}
|
|
53
|
+
* setEntitySearch={setEntitySearch}
|
|
54
|
+
* onEntitySubmit={handleEntitySubmit}
|
|
55
|
+
* onEntityClear={handleEntityClear}
|
|
56
|
+
* entityFilterValue={entityFilterValue}
|
|
57
|
+
* entityFading={entityFading}
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare const Row2FilterTray: React.MemoExoticComponent<({ showRow2, showItemFilter, showEntityFilter, itemFilterLayout, entityFilterLayout, itemSearch, setItemSearch, onItemSubmit, onItemSelect, onItemClear, itemFilterValue, itemOptions, entitySearch, setEntitySearch, onEntitySubmit, onEntitySelect, onEntityClear, entityFilterValue, entityFading, entityOptions, }: Row2FilterTrayProps) => import("react/jsx-runtime").JSX.Element>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ChartControlBar } from './ChartControlBar';
|
|
2
|
+
export { Row1Controls } from './Row1Controls';
|
|
3
|
+
export { Row2FilterTray } from './Row2FilterTray';
|
|
4
|
+
export { FusedShape } from './FusedShape';
|
|
5
|
+
export { FilterInput } from './FilterInput';
|
|
6
|
+
export { useFilterLayout } from './useFilterLayout';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export { defaultControlBarState, filteredState, compactState } from './fixtures/controlBarStates';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TabGroupProps } from '../TabGroup/types';
|
|
2
|
+
/** A selectable filter option for entity/item dropdowns. */
|
|
3
|
+
export interface FilterOption {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
group?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The chart visualization state passed as props. */
|
|
10
|
+
export interface VizState {
|
|
11
|
+
type: string;
|
|
12
|
+
quant: '$' | '#';
|
|
13
|
+
entity: {
|
|
14
|
+
type: string | null;
|
|
15
|
+
id: string | null;
|
|
16
|
+
name: string | null;
|
|
17
|
+
};
|
|
18
|
+
byItem: {
|
|
19
|
+
id: string | null;
|
|
20
|
+
name: string | null;
|
|
21
|
+
};
|
|
22
|
+
timeFrame: string;
|
|
23
|
+
}
|
|
24
|
+
/** Props for the presentational ChartControlBar component. */
|
|
25
|
+
export interface ChartControlBarProps {
|
|
26
|
+
vizState: VizState;
|
|
27
|
+
onTypeChange: (type: string) => void;
|
|
28
|
+
onQuantChange: (quant: '$' | '#') => void;
|
|
29
|
+
onEntityTypeChange: (entityType: string) => void;
|
|
30
|
+
onEntitySelect: (id: string | null, name: string | null) => void;
|
|
31
|
+
onItemSelect: (id: string | null, name: string | null) => void;
|
|
32
|
+
onTimeFrameChange: (timeFrame: string) => void;
|
|
33
|
+
userType: string;
|
|
34
|
+
entityFilterOptions: FilterOption[];
|
|
35
|
+
itemFilterOptions: FilterOption[];
|
|
36
|
+
}
|
|
37
|
+
export type { TabGroupProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
interface Rect {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
}
|
|
10
|
+
interface PillRect {
|
|
11
|
+
left: number;
|
|
12
|
+
width: number;
|
|
13
|
+
top: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}
|
|
16
|
+
interface FilterRect {
|
|
17
|
+
left: number;
|
|
18
|
+
width: number;
|
|
19
|
+
top: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}
|
|
22
|
+
export interface Geometry {
|
|
23
|
+
itemPill: PillRect;
|
|
24
|
+
itemFilter: FilterRect;
|
|
25
|
+
entityPill: PillRect;
|
|
26
|
+
entityFilter: FilterRect;
|
|
27
|
+
tracks: Rect[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* useFilterLayout - measures tab group and tab pill geometry for FusedShape connectors.
|
|
31
|
+
*
|
|
32
|
+
* Uses ResizeObserver and window resize to track geometry changes.
|
|
33
|
+
* Returns pill positions, filter tray positions, and track rectangles.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* import { useFilterLayout } from '@mt-gloss/ui';
|
|
38
|
+
*
|
|
39
|
+
* const geo = useFilterLayout(
|
|
40
|
+
* rootRef, metricGroupRef, entityGroupRef, dimensionGroupRef,
|
|
41
|
+
* entityTabRefs, dimensionTabRefs,
|
|
42
|
+
* selections, showRow2, itemFilterValue, entityFilterValue,
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function useFilterLayout(rootRef: RefObject<HTMLDivElement | null>, metricGroupRef: RefObject<HTMLDivElement | null>, entityGroupRef: RefObject<HTMLDivElement | null>, dimensionGroupRef: RefObject<HTMLDivElement | null>, entityTabRefs: RefObject<Record<string, HTMLElement>>, dimensionTabRefs: RefObject<Record<string, HTMLElement>>, selections: {
|
|
47
|
+
metric: string;
|
|
48
|
+
entity: string;
|
|
49
|
+
dimension: string;
|
|
50
|
+
}, showRow2: boolean, itemFilterValue: string | null, entityFilterValue: string | null): Geometry;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FilterChipProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* FilterChip - removable MUI Chip wrapper for displaying active filters.
|
|
5
|
+
*
|
|
6
|
+
* Wraps MUI's Chip component with CSS variable-based theming for consistent
|
|
7
|
+
* styling across the dashboard. Supports filled/outlined variants and custom colors.
|
|
8
|
+
*
|
|
9
|
+
* The `field` and `value` props are consumer metadata for filter identification --
|
|
10
|
+
* the component does not use them internally but they are part of the type contract
|
|
11
|
+
* for filter management systems.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { FilterChip } from '@mt-gloss/ui';
|
|
16
|
+
*
|
|
17
|
+
* <FilterChip
|
|
18
|
+
* id="status-1"
|
|
19
|
+
* label="Status: Open"
|
|
20
|
+
* field="status"
|
|
21
|
+
* value="open"
|
|
22
|
+
* onRemove={(id) => removeFilter(id)}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const FilterChip: React.MemoExoticComponent<({ id, label, onRemove, color, variant, size, }: FilterChipProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FilterChipProps } from '../types';
|
|
2
|
+
/** Entity filter chip example. */
|
|
3
|
+
export declare const entityChip: FilterChipProps;
|
|
4
|
+
/** Status filter chip example. */
|
|
5
|
+
export declare const statusChip: FilterChipProps;
|
|
6
|
+
/** Date range filter chip example. */
|
|
7
|
+
export declare const dateChip: FilterChipProps;
|
|
8
|
+
/** Manufacturer filter chip example. */
|
|
9
|
+
export declare const manufacturerChip: FilterChipProps;
|
|
10
|
+
/** All fixture chips as an array. */
|
|
11
|
+
export declare const allChips: FilterChipProps[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GlossUI FilterChip type contracts.
|
|
3
|
+
*
|
|
4
|
+
* Removable filter chip props for active filter display.
|
|
5
|
+
* No context, BFF, or dashboard-specific imports.
|
|
6
|
+
*/
|
|
7
|
+
/** Props for the presentational FilterChip component. */
|
|
8
|
+
export interface FilterChipProps {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
field: string;
|
|
12
|
+
value: string;
|
|
13
|
+
onRemove: (id: string) => void;
|
|
14
|
+
color?: string;
|
|
15
|
+
variant?: 'filled' | 'outlined';
|
|
16
|
+
size?: 'small' | 'medium';
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CardShellProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* CardShell - Shared card wrapper with hover states, 180ms leave timeout,
|
|
4
|
+
* and perspective container.
|
|
5
|
+
*
|
|
6
|
+
* GlossUI version: accepts `gutterContent` as a ReactNode slot instead of
|
|
7
|
+
* importing GutterActions directly. This keeps CardShell free of dashboard-
|
|
8
|
+
* specific UI dependencies.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { CardShell, MetricCard } from '@mt-gloss/ui';
|
|
13
|
+
*
|
|
14
|
+
* <CardShell colSpan={1}>
|
|
15
|
+
* <MetricCard variant="standard" label="Revenue" value={125430} />
|
|
16
|
+
* </CardShell>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const CardShell: {
|
|
20
|
+
({ children, colSpan, isStale, isRetrying, beta, disabled, style, onGraph, onDetails, onCustomize, onRemove, onWhatsThis, onExpand, onShrink, onMove, onReplace, onNavigate, onRetry, onRefresh, isGraphActive, isTableActive, isGraphCard, canExpand, cardRef: externalCardRef, }: CardShellProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
displayName: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface GutterActionsProps {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
menuOpen: boolean;
|
|
4
|
+
onMenuToggle: (open: boolean) => void;
|
|
5
|
+
onGraph?: () => void;
|
|
6
|
+
onDetails?: () => void;
|
|
7
|
+
onCustomize?: () => void;
|
|
8
|
+
onRemove?: () => void;
|
|
9
|
+
onWhatsThis?: () => void;
|
|
10
|
+
onExpand?: () => void;
|
|
11
|
+
onShrink?: () => void;
|
|
12
|
+
onMove?: () => void;
|
|
13
|
+
onReplace?: () => void;
|
|
14
|
+
onNavigate?: () => void;
|
|
15
|
+
onRetry?: () => void;
|
|
16
|
+
onRefresh?: () => void;
|
|
17
|
+
onQuickSettings?: () => void;
|
|
18
|
+
onFlipBack?: () => void;
|
|
19
|
+
isFlipped?: boolean;
|
|
20
|
+
onViewAsStack?: () => void;
|
|
21
|
+
onUnstack?: () => void;
|
|
22
|
+
canExpand?: boolean;
|
|
23
|
+
isGraphCard?: boolean;
|
|
24
|
+
colSpan?: 1 | 2;
|
|
25
|
+
isGraphActive?: boolean;
|
|
26
|
+
isTableActive?: boolean;
|
|
27
|
+
/** Label for graph pill button (injected, no registry dependency). */
|
|
28
|
+
graphLabel?: string;
|
|
29
|
+
/** Label for details pill button (injected, no registry dependency). */
|
|
30
|
+
detailsLabel?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* GutterActions - Pill + overflow menu interaction system.
|
|
34
|
+
*
|
|
35
|
+
* Pure presentational version: no context, BFF, or dispatch-actions dependencies.
|
|
36
|
+
* Action labels are injected via graphLabel/detailsLabel props.
|
|
37
|
+
*
|
|
38
|
+
* Two-phase reveal animation via useSlideOutReveal hook (slideDirection: 'down').
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* import { GutterActions } from '@mt-gloss/ui';
|
|
43
|
+
*
|
|
44
|
+
* <GutterActions
|
|
45
|
+
* visible={isHovered}
|
|
46
|
+
* menuOpen={menuOpen}
|
|
47
|
+
* onMenuToggle={setMenuOpen}
|
|
48
|
+
* onGraph={() => {}}
|
|
49
|
+
* onDetails={() => {}}
|
|
50
|
+
* />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const GutterActions: {
|
|
54
|
+
({ 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, }: GutterActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MetricCardProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* MetricCard -- Unified display component handling 9 variants via props.
|
|
4
|
+
*
|
|
5
|
+
* All variants share a Zone A/B/C layout:
|
|
6
|
+
* Zone A (Label): Fixed 28px height, 10.5px uppercase
|
|
7
|
+
* Zone B (Value): flex:1, dynamic font size based on formatted string length
|
|
8
|
+
* Zone C (Subtitle + Trend): flex row, min-height 18px
|
|
9
|
+
*
|
|
10
|
+
* Renders as a fragment -- CardShell provides the outer container with padding,
|
|
11
|
+
* flex column, and hover states.
|
|
12
|
+
*
|
|
13
|
+
* Props use a discriminated union keyed on `variant`. Each variant carries its
|
|
14
|
+
* own required extra fields (e.g. sparklineData for sparkline, segments for segmented).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { MetricCard } from '@mt-gloss/ui';
|
|
19
|
+
*
|
|
20
|
+
* <MetricCard
|
|
21
|
+
* variant="standard"
|
|
22
|
+
* label="Total Revenue"
|
|
23
|
+
* value={125430}
|
|
24
|
+
* valueFormat={{ prefix: '$', abbreviated: true }}
|
|
25
|
+
* trend={{ value: 12.5, direction: 'up' }}
|
|
26
|
+
* subtitle="MTD"
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const MetricCard: {
|
|
31
|
+
(props: MetricCardProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TrendData } from './types';
|
|
2
|
+
export interface StackedValueEntry {
|
|
3
|
+
timeframe: string;
|
|
4
|
+
value: number | null;
|
|
5
|
+
trend?: TrendData | null;
|
|
6
|
+
}
|
|
7
|
+
export interface StackedGroupCardProps {
|
|
8
|
+
title: string;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
values?: StackedValueEntry[];
|
|
12
|
+
timeframes?: string[];
|
|
13
|
+
sparklineData?: Record<string, number[]>;
|
|
14
|
+
accentColor?: string;
|
|
15
|
+
pinnedTimeframe?: string;
|
|
16
|
+
onPinTimeframe?: (timeframe: string) => void;
|
|
17
|
+
/** When true, value cells blur and sparkline animates to flat during data refresh. */
|
|
18
|
+
isStale?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* StackedGroupCard -- Renders 3 mini metric values horizontally within a 2-col card.
|
|
22
|
+
*
|
|
23
|
+
* Pure presentational version: no context or BFF dependencies.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { StackedGroupCard } from '@mt-gloss/ui';
|
|
28
|
+
*
|
|
29
|
+
* <StackedGroupCard
|
|
30
|
+
* title="Revenue"
|
|
31
|
+
* prefix="$"
|
|
32
|
+
* values={[
|
|
33
|
+
* { timeframe: 'MTD', value: 42000 },
|
|
34
|
+
* { timeframe: 'QTD', value: 125000 },
|
|
35
|
+
* { timeframe: 'YTD', value: 480000 },
|
|
36
|
+
* ]}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const StackedGroupCard: {
|
|
41
|
+
({ title, prefix, suffix, values, timeframes, sparklineData, accentColor, pinnedTimeframe, onPinTimeframe, isStale, }: StackedGroupCardProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
displayName: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TrendDirection } from './utils/formatTrend';
|
|
2
|
+
interface TrendIndicatorProps {
|
|
3
|
+
value: number | null | undefined;
|
|
4
|
+
direction?: TrendDirection;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* TrendIndicator - Renders a colored pill with solid triangle arrow and formatted percentage.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { TrendIndicator } from '@mt-gloss/ui';
|
|
12
|
+
*
|
|
13
|
+
* <TrendIndicator value={12.5} direction="up" />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const TrendIndicator: {
|
|
17
|
+
({ value, direction }: TrendIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SparklineVariant } from '../types';
|
|
2
|
+
/** Sparkline card fixture -- Daily Orders with 14-day trend line. */
|
|
3
|
+
export declare const sparklineFixture: SparklineVariant;
|
|
4
|
+
/** Sparkline card with upward trend. */
|
|
5
|
+
export declare const sparklineUpFixture: SparklineVariant;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StandardVariant } from '../types';
|
|
2
|
+
/** Standard metric card fixture -- Total Revenue with trend. */
|
|
3
|
+
export declare const standardFixture: StandardVariant;
|
|
4
|
+
/** Standard card with negative trend. */
|
|
5
|
+
export declare const standardNegativeFixture: StandardVariant;
|
|
6
|
+
/** Standard card with flat trend. */
|
|
7
|
+
export declare const standardFlatFixture: StandardVariant;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MetricCardProps, SparklineVariant } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Transient state fixtures -- test loading, error, empty, and stale states
|
|
4
|
+
* across different card variants.
|
|
5
|
+
*/
|
|
6
|
+
/** Loading state: minimal props, isLoading true. */
|
|
7
|
+
export declare const loadingFixture: MetricCardProps;
|
|
8
|
+
/** Error state: isError true, value present from last successful fetch. */
|
|
9
|
+
export declare const errorFixture: MetricCardProps;
|
|
10
|
+
/** Empty state: isEmpty true, value null (no data available). */
|
|
11
|
+
export declare const emptyFixture: MetricCardProps;
|
|
12
|
+
/** Stale state: complete card data with isStale true (triggers blur transition). */
|
|
13
|
+
export declare const staleFixture: MetricCardProps;
|
|
14
|
+
/** Stale sparkline: tests flatten animation on background viz. */
|
|
15
|
+
export declare const staleSparklineFixture: SparklineVariant;
|
|
16
|
+
/** Stale donut: tests progress arc collapse to 0. */
|
|
17
|
+
export declare const staleDonutFixture: MetricCardProps;
|
|
18
|
+
/** All state fixtures as an array for iteration in explorer. */
|
|
19
|
+
export declare const allStateFixtures: MetricCardProps[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { MetricCard } from './MetricCard';
|
|
2
|
+
export { CardShell } from './CardShell';
|
|
3
|
+
export { TrendIndicator } from './TrendIndicator';
|
|
4
|
+
export { GutterActions } from './GutterActions';
|
|
5
|
+
export { StackedGroupCard } from './StackedGroupCard';
|
|
6
|
+
export { useSlideOutReveal } from './useSlideOutReveal';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export type { GutterActionsProps } from './GutterActions';
|
|
9
|
+
export type { StackedGroupCardProps, StackedValueEntry } from './StackedGroupCard';
|
|
10
|
+
export type { SlideOutRevealConfig, SlideOutRevealReturn } from './useSlideOutReveal';
|
|
11
|
+
export { SparklineBg } from './visualizations/SparklineBg';
|
|
12
|
+
export { BarsBg } from './visualizations/BarsBg';
|
|
13
|
+
export { DonutChart } from './visualizations/DonutChart';
|
|
14
|
+
export { ObjectArrow } from './visualizations/ObjectArrow';
|
|
15
|
+
export { formatValue } from './utils/formatValue';
|
|
16
|
+
export { formatTrend } from './utils/formatTrend';
|
|
17
|
+
export { allVariantFixtures } from './fixtures/allVariants';
|
|
18
|
+
export { loadingFixture, errorFixture, emptyFixture, staleFixture, staleSparklineFixture, staleDonutFixture, allStateFixtures, } from './fixtures/states';
|
|
19
|
+
export { sparklineFixture, sparklineUpFixture } from './fixtures/sparklineCard';
|
|
20
|
+
export { standardFixture, standardNegativeFixture, standardFlatFixture } from './fixtures/standardCard';
|