@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,109 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties, RefObject } from 'react';
|
|
2
|
+
/** Value formatting options. */
|
|
3
|
+
export interface ValueFormat {
|
|
4
|
+
prefix?: string;
|
|
5
|
+
suffix?: string;
|
|
6
|
+
abbreviated?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Trend indicator data for Zone C display. */
|
|
9
|
+
export interface TrendData {
|
|
10
|
+
value: number;
|
|
11
|
+
direction: 'up' | 'down' | 'flat';
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
/** A single segment entry for donut/segmented cards. */
|
|
15
|
+
export interface SegmentEntry {
|
|
16
|
+
value: number;
|
|
17
|
+
color: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Versus comparison data for side-by-side period cards. */
|
|
21
|
+
export interface VersusData {
|
|
22
|
+
current: number | string;
|
|
23
|
+
prior: number | string;
|
|
24
|
+
currentLabel?: string;
|
|
25
|
+
priorLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Base props shared by all MetricCard variants. */
|
|
28
|
+
export interface BaseMetricCardProps {
|
|
29
|
+
label: string;
|
|
30
|
+
value?: number | string | null;
|
|
31
|
+
valueFormat?: ValueFormat;
|
|
32
|
+
trend?: TrendData | null;
|
|
33
|
+
subtitle?: string;
|
|
34
|
+
colSpan?: 1 | 2;
|
|
35
|
+
isStale?: boolean;
|
|
36
|
+
isLoading?: boolean;
|
|
37
|
+
isError?: boolean;
|
|
38
|
+
isEmpty?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface StandardVariant extends BaseMetricCardProps {
|
|
41
|
+
variant: 'standard';
|
|
42
|
+
}
|
|
43
|
+
export interface SparklineVariant extends BaseMetricCardProps {
|
|
44
|
+
variant: 'sparkline';
|
|
45
|
+
sparklineData: number[];
|
|
46
|
+
accentColor?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface BarsVariant extends BaseMetricCardProps {
|
|
49
|
+
variant: 'bars';
|
|
50
|
+
barData: number[];
|
|
51
|
+
accentColor?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface DonutVariant extends BaseMetricCardProps {
|
|
54
|
+
variant: 'donut';
|
|
55
|
+
donutValue: number;
|
|
56
|
+
donutMax?: number;
|
|
57
|
+
accentColor?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface HighlightVariant extends BaseMetricCardProps {
|
|
60
|
+
variant: 'highlight';
|
|
61
|
+
highlightColor: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ArrowVariant extends BaseMetricCardProps {
|
|
64
|
+
variant: 'arrow';
|
|
65
|
+
arrowDirection: 'up' | 'down';
|
|
66
|
+
arrowShape?: 'chevron' | 'triple' | 'bars';
|
|
67
|
+
}
|
|
68
|
+
export interface ObjectArrowVariant extends BaseMetricCardProps {
|
|
69
|
+
variant: 'object-arrow';
|
|
70
|
+
objectArrowValue: number;
|
|
71
|
+
objectArrowMax: number;
|
|
72
|
+
}
|
|
73
|
+
export interface VersusVariant extends BaseMetricCardProps {
|
|
74
|
+
variant: 'versus';
|
|
75
|
+
versusData: VersusData;
|
|
76
|
+
}
|
|
77
|
+
export interface SegmentedVariant extends BaseMetricCardProps {
|
|
78
|
+
variant: 'segmented';
|
|
79
|
+
segments: SegmentEntry[];
|
|
80
|
+
}
|
|
81
|
+
/** Discriminated union of all MetricCard variant props. */
|
|
82
|
+
export type MetricCardProps = StandardVariant | SparklineVariant | BarsVariant | DonutVariant | HighlightVariant | ArrowVariant | ObjectArrowVariant | VersusVariant | SegmentedVariant;
|
|
83
|
+
/** Props for the CardShell wrapper component. */
|
|
84
|
+
export interface CardShellProps {
|
|
85
|
+
children: ReactNode;
|
|
86
|
+
colSpan?: 1 | 2;
|
|
87
|
+
isStale?: boolean;
|
|
88
|
+
isRetrying?: boolean;
|
|
89
|
+
beta?: boolean;
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
style?: CSSProperties;
|
|
92
|
+
onGraph?: () => void;
|
|
93
|
+
onDetails?: () => void;
|
|
94
|
+
onCustomize?: ((ref: RefObject<HTMLDivElement | null>) => void) | (() => void);
|
|
95
|
+
onRemove?: () => void;
|
|
96
|
+
onExpand?: () => void;
|
|
97
|
+
onShrink?: () => void;
|
|
98
|
+
onMove?: () => void;
|
|
99
|
+
onReplace?: () => void;
|
|
100
|
+
onNavigate?: () => void;
|
|
101
|
+
onRetry?: () => void;
|
|
102
|
+
onRefresh?: () => void;
|
|
103
|
+
onWhatsThis?: () => void;
|
|
104
|
+
isGraphActive?: boolean;
|
|
105
|
+
isTableActive?: boolean;
|
|
106
|
+
isGraphCard?: boolean;
|
|
107
|
+
canExpand?: boolean;
|
|
108
|
+
cardRef?: RefObject<HTMLDivElement | null>;
|
|
109
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
type SlideDirection = 'down' | 'left';
|
|
2
|
+
type AnimationPhase = 'hidden' | 'entering-behind' | 'entering-front' | 'visible' | 'exiting-front' | 'exiting-behind';
|
|
3
|
+
export interface SlideOutRevealConfig {
|
|
4
|
+
slideDirection?: SlideDirection;
|
|
5
|
+
behindDuration?: number;
|
|
6
|
+
frontDuration?: number;
|
|
7
|
+
easing?: string;
|
|
8
|
+
behindEasing?: string;
|
|
9
|
+
zBehind?: number;
|
|
10
|
+
zFront?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SlideOutRevealStyle {
|
|
13
|
+
transform: string;
|
|
14
|
+
zIndex: number;
|
|
15
|
+
transition: string;
|
|
16
|
+
pointerEvents: 'auto' | 'none';
|
|
17
|
+
}
|
|
18
|
+
export interface SlideOutRevealReturn {
|
|
19
|
+
phase: AnimationPhase;
|
|
20
|
+
handleTransitionEnd: () => void;
|
|
21
|
+
style: SlideOutRevealStyle;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* useSlideOutReveal -- 6-state slide-out animation hook.
|
|
25
|
+
*
|
|
26
|
+
* Two-phase reveal: element slides from behind a parent surface (z-index behind),
|
|
27
|
+
* then once it emerges, z-index switches to front and it settles at resting position.
|
|
28
|
+
* Exit is the reverse sequence.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { useSlideOutReveal } from '@mt-gloss/ui';
|
|
33
|
+
*
|
|
34
|
+
* const { phase, handleTransitionEnd, style } = useSlideOutReveal(isVisible, {
|
|
35
|
+
* slideDirection: 'down',
|
|
36
|
+
* zBehind: 1,
|
|
37
|
+
* zFront: 16,
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function useSlideOutReveal(visible: boolean, config?: SlideOutRevealConfig): SlideOutRevealReturn;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface BarsBgProps {
|
|
2
|
+
data?: number[];
|
|
3
|
+
color?: string;
|
|
4
|
+
/** When true, bars animate to flat via scaleY(0.05). */
|
|
5
|
+
isStale?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* BarsBg -- Full-width background bar chart SVG for bars variant cards.
|
|
9
|
+
*
|
|
10
|
+
* Renders vertical bars where the last bar is more prominent (14% opacity)
|
|
11
|
+
* and all others are subtle (6% opacity). Max bar height is 82% of viewBox.
|
|
12
|
+
* Positioned absolutely at the bottom of the card (z-index 1).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { BarsBg } from '@mt-gloss/ui';
|
|
17
|
+
*
|
|
18
|
+
* <BarsBg data={[65, 72, 58, 80, 91, 85]} color="#8b5cf6" />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const BarsBg: {
|
|
22
|
+
({ data, color, isStale }: BarsBgProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
displayName: string;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface DonutChartProps {
|
|
2
|
+
value?: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
colSpan?: number;
|
|
6
|
+
/** When true, progress arc animates to 0 (empty ring). */
|
|
7
|
+
isStale?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* DonutChart -- Circular SVG progress ring positioned inline left of value in Zone B.
|
|
11
|
+
*
|
|
12
|
+
* Renders a track circle at 6% opacity with a progress arc on top.
|
|
13
|
+
* Size adapts based on column span: 34px at span 1, 40px at span 2.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { DonutChart } from '@mt-gloss/ui';
|
|
18
|
+
*
|
|
19
|
+
* <DonutChart value={78} max={100} color="#10b981" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const DonutChart: {
|
|
23
|
+
({ value, max, color, colSpan, isStale }: DonutChartProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface ObjectArrowProps {
|
|
2
|
+
value?: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
trendValue?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
colSpan?: number;
|
|
7
|
+
/** When true, progress arc animates to 0 (empty ring). */
|
|
8
|
+
isStale?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* ObjectArrow -- Circular SVG progress ring with a center percentage label.
|
|
12
|
+
*
|
|
13
|
+
* Similar to DonutChart but larger, with a centered percentage text inside the ring.
|
|
14
|
+
* Color follows the trend direction (positive=#10b981, negative=#ef4444, neutral=#6b7280).
|
|
15
|
+
* Size adapts based on column span: 36px at span 1, 44px at span 2.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { ObjectArrow } from '@mt-gloss/ui';
|
|
20
|
+
*
|
|
21
|
+
* <ObjectArrow value={85} max={100} trendValue={5.2} color="#10b981" />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const ObjectArrow: {
|
|
25
|
+
({ value, max, trendValue, color, colSpan, isStale }: ObjectArrowProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface SparklineBgProps {
|
|
2
|
+
data?: number[];
|
|
3
|
+
color?: string;
|
|
4
|
+
/** When true, sparkline animates to flat via scaleY(0.05). */
|
|
5
|
+
isStale?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* SparklineBg -- Full-width background sparkline SVG for sparkline variant cards.
|
|
9
|
+
*
|
|
10
|
+
* Renders an area chart with gradient fill and a thin stroke line.
|
|
11
|
+
* Positioned absolutely at the bottom of the card (z-index 1).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { SparklineBg } from '@mt-gloss/ui';
|
|
16
|
+
*
|
|
17
|
+
* <SparklineBg data={[42, 38, 51, 47, 55]} color="#6366f1" />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const SparklineBg: {
|
|
21
|
+
({ data, color, isStale }: SparklineBgProps): import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MetricCardGridProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* MetricCardGrid - CSS grid layout with @dnd-kit drag-and-drop reordering.
|
|
5
|
+
*
|
|
6
|
+
* Renders cards in a paginated grid with sortable slots. Card rendering is fully
|
|
7
|
+
* delegated to the `renderCard` render prop. Empty slots can be customized via
|
|
8
|
+
* `renderEmptySlot`. The grid manages DnD interaction internally and reports
|
|
9
|
+
* order changes via `onReorder`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { MetricCardGrid } from '@mt-gloss/ui';
|
|
14
|
+
* import type { GridCardData, GridLayout } from '@mt-gloss/ui';
|
|
15
|
+
*
|
|
16
|
+
* const layout: GridLayout = { columns: 6, rowHeight: 120, gap: 15, maxRows: 3, currentPage: 0, totalPages: 1 };
|
|
17
|
+
*
|
|
18
|
+
* <MetricCardGrid
|
|
19
|
+
* cards={cards}
|
|
20
|
+
* cardOrder={cardOrder}
|
|
21
|
+
* layout={layout}
|
|
22
|
+
* onReorder={setCardOrder}
|
|
23
|
+
* onPageChange={setPage}
|
|
24
|
+
* renderCard={(card) => <MyCard data={card} />}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const MetricCardGrid: React.NamedExoticComponent<MetricCardGridProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GridLayout } from '../types';
|
|
2
|
+
/** Compact layout: 6 columns, 3 rows, fits ~18 single-span cards. */
|
|
3
|
+
export declare const compactLayout: GridLayout;
|
|
4
|
+
/** Standard layout: 9 columns, 3 rows, fits ~27 single-span cards. */
|
|
5
|
+
export declare const standardLayout: GridLayout;
|
|
6
|
+
/** Full-width layout: 12 columns, 3 rows, fits ~36 single-span cards. */
|
|
7
|
+
export declare const fullLayout: GridLayout;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Data for a single card slot in the grid. */
|
|
3
|
+
export interface GridCardData {
|
|
4
|
+
id: string;
|
|
5
|
+
colSpan: 1 | 2;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** Grid layout configuration. */
|
|
9
|
+
export interface GridLayout {
|
|
10
|
+
columns: number;
|
|
11
|
+
rowHeight: number;
|
|
12
|
+
gap: number;
|
|
13
|
+
maxRows: number;
|
|
14
|
+
currentPage: number;
|
|
15
|
+
totalPages: number;
|
|
16
|
+
}
|
|
17
|
+
/** Props for the presentational MetricCardGrid component. */
|
|
18
|
+
export interface MetricCardGridProps {
|
|
19
|
+
cards: GridCardData[];
|
|
20
|
+
cardOrder: string[];
|
|
21
|
+
layout: GridLayout;
|
|
22
|
+
onReorder: (newOrder: string[]) => void;
|
|
23
|
+
onPageChange: (page: number) => void;
|
|
24
|
+
onExpand?: (cardId: string) => void;
|
|
25
|
+
onShrink?: (cardId: string) => void;
|
|
26
|
+
renderCard: (card: GridCardData) => ReactNode;
|
|
27
|
+
renderEmptySlot?: (index: number) => ReactNode;
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SkeletonProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Skeleton - merged primitive skeleton with block, text, and circle variants.
|
|
4
|
+
*
|
|
5
|
+
* Uses a discriminated union on the `variant` prop. Renders shimmer-animated
|
|
6
|
+
* placeholder shapes for loading states. Pure functional component with no state.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { Skeleton } from '@mt-gloss/ui';
|
|
11
|
+
*
|
|
12
|
+
* // Block variant
|
|
13
|
+
* <Skeleton variant="block" width="100%" height={16} />
|
|
14
|
+
*
|
|
15
|
+
* // Text variant (3 lines)
|
|
16
|
+
* <Skeleton variant="text" lines={3} lineHeight={14} gap={8} />
|
|
17
|
+
*
|
|
18
|
+
* // Circle variant
|
|
19
|
+
* <Skeleton variant="circle" size={40} />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const Skeleton: {
|
|
23
|
+
(props: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SkeletonCardProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SkeletonCard - metric card skeleton matching the MetricCard layout.
|
|
4
|
+
*
|
|
5
|
+
* Supports value, trend, and target variants with corresponding skeleton shapes.
|
|
6
|
+
* The hero value block width scales with `colSpan`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { SkeletonCard } from '@mt-gloss/ui';
|
|
11
|
+
*
|
|
12
|
+
* <SkeletonCard variant="value" colSpan={1} />
|
|
13
|
+
* <SkeletonCard variant="trend" colSpan={2} />
|
|
14
|
+
* <SkeletonCard variant="target" colSpan={1} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const SkeletonCard: {
|
|
18
|
+
({ variant, colSpan, }: SkeletonCardProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SkeletonChartProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SkeletonChart - bar chart silhouette skeleton with varying-height bars.
|
|
4
|
+
*
|
|
5
|
+
* Renders a configurable number of bars (max 10) with static height percentages
|
|
6
|
+
* that create a natural varying-height silhouette.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { SkeletonChart } from '@mt-gloss/ui';
|
|
11
|
+
*
|
|
12
|
+
* <SkeletonChart bars={10} maxHeight={120} />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const SkeletonChart: {
|
|
16
|
+
({ bars, maxHeight, }: SkeletonChartProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SkeletonTableProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SkeletonTable - table skeleton with header row and configurable body rows.
|
|
4
|
+
*
|
|
5
|
+
* Renders a header block and body rows with optional checkbox column.
|
|
6
|
+
* Supports configurable row count, column count, and row height.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { SkeletonTable } from '@mt-gloss/ui';
|
|
11
|
+
*
|
|
12
|
+
* <SkeletonTable rows={5} columns={3} hasCheckbox={false} rowHeight={44} />
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const SkeletonTable: {
|
|
16
|
+
({ rows, columns, hasCheckbox, rowHeight, }: SkeletonTableProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SkeletonProps, SkeletonChartProps, SkeletonTableProps, SkeletonCardProps } from '../types';
|
|
2
|
+
export declare const blockSamples: SkeletonProps[];
|
|
3
|
+
export declare const textSamples: SkeletonProps[];
|
|
4
|
+
export declare const circleSamples: SkeletonProps[];
|
|
5
|
+
export declare const chartSamples: SkeletonChartProps[];
|
|
6
|
+
export declare const tableSamples: SkeletonTableProps[];
|
|
7
|
+
export declare const cardSamples: SkeletonCardProps[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Skeleton } from './Skeleton';
|
|
2
|
+
export { SkeletonChart } from './SkeletonChart';
|
|
3
|
+
export { SkeletonTable } from './SkeletonTable';
|
|
4
|
+
export { SkeletonCard } from './SkeletonCard';
|
|
5
|
+
export type { SkeletonProps, SkeletonChartProps, SkeletonTableProps, SkeletonCardProps, } from './types';
|
|
6
|
+
export { blockSamples, textSamples, circleSamples, chartSamples, tableSamples, cardSamples, } from './fixtures/skeletonSamples';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GlossUI Skeleton Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Unified type contracts for the Skeleton component family.
|
|
5
|
+
* Primitive Skeleton uses a discriminated union on `variant`.
|
|
6
|
+
* Composites (Chart, Table, Card) have independent prop interfaces.
|
|
7
|
+
*/
|
|
8
|
+
interface SkeletonBlockVariant {
|
|
9
|
+
variant: 'block';
|
|
10
|
+
/** Width in px (number) or CSS string */
|
|
11
|
+
width?: number | string;
|
|
12
|
+
/** Height in px (number) or CSS string */
|
|
13
|
+
height?: number | string;
|
|
14
|
+
/** Border radius in px (number) or CSS string */
|
|
15
|
+
borderRadius?: number | string;
|
|
16
|
+
}
|
|
17
|
+
interface SkeletonTextVariant {
|
|
18
|
+
variant: 'text';
|
|
19
|
+
/** Number of text lines */
|
|
20
|
+
lines?: number;
|
|
21
|
+
/** Height of each line in px */
|
|
22
|
+
lineHeight?: number;
|
|
23
|
+
/** Gap between lines in px */
|
|
24
|
+
gap?: number;
|
|
25
|
+
}
|
|
26
|
+
interface SkeletonCircleVariant {
|
|
27
|
+
variant: 'circle';
|
|
28
|
+
/** Circle diameter in px */
|
|
29
|
+
size?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Discriminated union for the merged Skeleton primitive */
|
|
32
|
+
export type SkeletonProps = SkeletonBlockVariant | SkeletonTextVariant | SkeletonCircleVariant;
|
|
33
|
+
export interface SkeletonChartProps {
|
|
34
|
+
/** Number of bars to render (max 10) */
|
|
35
|
+
bars?: number;
|
|
36
|
+
/** Maximum height in px */
|
|
37
|
+
maxHeight?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SkeletonTableProps {
|
|
40
|
+
/** Number of body rows */
|
|
41
|
+
rows?: number;
|
|
42
|
+
/** Number of columns */
|
|
43
|
+
columns?: number;
|
|
44
|
+
/** Show checkbox column */
|
|
45
|
+
hasCheckbox?: boolean;
|
|
46
|
+
/** Row height in px */
|
|
47
|
+
rowHeight?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface SkeletonCardProps {
|
|
50
|
+
/** Card variant: value (default), trend, or target */
|
|
51
|
+
variant?: 'value' | 'trend' | 'target';
|
|
52
|
+
/** Column span (1 = standard, 2+ = wide) */
|
|
53
|
+
colSpan?: number;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TabGroupProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TabGroup - pill-style segmented control with sliding active indicator.
|
|
5
|
+
*
|
|
6
|
+
* Renders a group of tabs as inline pill buttons with an animated sliding highlight
|
|
7
|
+
* that tracks the active tab. Supports hover ghost effect and ResizeObserver-based
|
|
8
|
+
* re-measurement. Fully controlled via `activeId` and `onSelect`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { TabGroup } from '@mt-gloss/ui';
|
|
13
|
+
* import type { GroupDef } from '@mt-gloss/ui';
|
|
14
|
+
*
|
|
15
|
+
* const group: GroupDef = {
|
|
16
|
+
* id: 'period',
|
|
17
|
+
* tabs: [
|
|
18
|
+
* { id: 'MTD', label: 'MTD' },
|
|
19
|
+
* { id: 'QTD', label: 'QTD' },
|
|
20
|
+
* { id: 'YTD', label: 'YTD' },
|
|
21
|
+
* ],
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* <TabGroup group={group} activeId="MTD" onSelect={(id) => setActive(id)} />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const TabGroup: React.MemoExoticComponent<({ group, activeId, onSelect, onToggle, groupRef, exposeTabRefs, connectorActive, }: TabGroupProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GroupDef } from '../types';
|
|
2
|
+
/** Metric toggle group: dollar vs count. */
|
|
3
|
+
export declare const metricTabGroup: GroupDef;
|
|
4
|
+
/** Entity breakdown group: order types by data dimension. */
|
|
5
|
+
export declare const entityTabGroup: GroupDef;
|
|
6
|
+
/** Time frame period group. */
|
|
7
|
+
export declare const timeFrameTabGroup: GroupDef;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
/** Single tab definition. */
|
|
3
|
+
export interface TabDef {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
mono?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** A group of related tabs with a unique group identifier. */
|
|
9
|
+
export interface GroupDef {
|
|
10
|
+
id: string;
|
|
11
|
+
tabs: TabDef[];
|
|
12
|
+
}
|
|
13
|
+
/** Props for the presentational TabGroup component. */
|
|
14
|
+
export interface TabGroupProps {
|
|
15
|
+
group: GroupDef;
|
|
16
|
+
activeId: string;
|
|
17
|
+
onSelect: (tabId: string) => void;
|
|
18
|
+
onToggle?: () => void;
|
|
19
|
+
groupRef?: MutableRefObject<HTMLDivElement | null>;
|
|
20
|
+
exposeTabRefs?: MutableRefObject<Record<string, HTMLElement>>;
|
|
21
|
+
connectorActive?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TabbedDataViewProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TabbedDataView - controlled MUI Tabs shell with render prop content delegation.
|
|
5
|
+
*
|
|
6
|
+
* Renders a scrollable tab bar from `TabConfig[]` with optional close buttons,
|
|
7
|
+
* add-tab action, and an actions slot. Tab content is fully delegated to the
|
|
8
|
+
* `renderTabContent` render prop. No internal data fetching or state management.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { TabbedDataView } from '@mt-gloss/ui';
|
|
13
|
+
* import type { TabConfig } from '@mt-gloss/ui';
|
|
14
|
+
*
|
|
15
|
+
* const tabs: TabConfig[] = [
|
|
16
|
+
* { id: 'all', type: 'orders', name: 'All Orders', closable: false },
|
|
17
|
+
* { id: 'open', type: 'orders', name: 'Open Orders', closable: true },
|
|
18
|
+
* ];
|
|
19
|
+
*
|
|
20
|
+
* <TabbedDataView
|
|
21
|
+
* tabs={tabs}
|
|
22
|
+
* activeTabId="all"
|
|
23
|
+
* onTabChange={setActiveTab}
|
|
24
|
+
* onTabClose={removeTab}
|
|
25
|
+
* renderTabContent={(tab) => <DataGrid tabType={tab.type} />}
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const TabbedDataView: React.NamedExoticComponent<TabbedDataViewProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TabConfig } from '../types';
|
|
2
|
+
/** Typical orders tab configuration. */
|
|
3
|
+
export declare const ordersTabs: TabConfig[];
|
|
4
|
+
/** Mixed tab types demonstrating variety. */
|
|
5
|
+
export declare const mixedTabs: TabConfig[];
|
|
6
|
+
/** Single tab for minimal rendering tests. */
|
|
7
|
+
export declare const singleTab: TabConfig[];
|
|
8
|
+
/** 10 tabs to demonstrate MUI scroll behavior. */
|
|
9
|
+
export declare const manyTabs: TabConfig[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Configuration for a single tab in the tab bar. */
|
|
3
|
+
export interface TabConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
name: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
closable?: boolean;
|
|
9
|
+
autoCreated?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Props for the presentational TabbedDataView shell component. */
|
|
12
|
+
export interface TabbedDataViewProps {
|
|
13
|
+
tabs: TabConfig[];
|
|
14
|
+
activeTabId: string;
|
|
15
|
+
onTabChange: (tabId: string) => void;
|
|
16
|
+
onTabClose: (tabId: string) => void;
|
|
17
|
+
onTabAdd?: () => void;
|
|
18
|
+
renderTabContent: (tab: TabConfig) => ReactNode;
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ExpandableChipProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* ExpandableChip - Hover-expand preset group with pinning functionality.
|
|
5
|
+
*
|
|
6
|
+
* Shows a chip with the pinned/default preset label. On hover, expands to show
|
|
7
|
+
* all options in a dropdown menu. Each option can be pinned as the default.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <ExpandableChip
|
|
12
|
+
* groupId="rolling"
|
|
13
|
+
* options={ROLLING_OPTIONS}
|
|
14
|
+
* selectedId="30d"
|
|
15
|
+
* defaultId="mtd"
|
|
16
|
+
* onSelect={(id) => setSelected(id)}
|
|
17
|
+
* pinnedId="mtd"
|
|
18
|
+
* onPin={(id) => setPinned(id)}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const ExpandableChip: React.FC<ExpandableChipProps>;
|