@sybilion/uilib 1.3.98 → 1.3.100
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/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.js +61 -14
- package/dist/esm/components/ui/AnalysesSelector/AnalysesSelector.styl.js +2 -2
- package/dist/esm/components/ui/AnalysesSelector/SelectInlineRenamer.js +102 -0
- package/dist/esm/components/ui/Button/Button.styl.js +1 -1
- package/dist/esm/components/ui/Chart/Chart.js +9 -5
- package/dist/esm/components/ui/Chart/chartForecastVisualization.constants.js +23 -0
- package/dist/esm/components/ui/Chart/components/BaseChartWrapper.js +12 -10
- package/dist/esm/components/ui/Chart/components/BaseChartWrapper.styl.js +2 -2
- package/dist/esm/components/ui/Chart/components/ConfidenceBands.js +9 -0
- package/dist/esm/components/ui/Chart/components/CustomChartLegend/CustomChartLegend.js +2 -2
- package/dist/esm/components/ui/Chart/components/ForecastBoundaries.js +32 -0
- package/dist/esm/components/ui/Chart/components/ForecastLine.js +24 -0
- package/dist/esm/components/ui/Chart/components/HistoricalLine.js +24 -0
- package/dist/esm/components/ui/Chart/hooks/useChartAnimation.js +17 -0
- package/dist/esm/components/ui/Chart/hooks/useChartColors.js +12 -0
- package/dist/esm/components/ui/Chart/hooks/useLegendState.js +30 -0
- package/dist/esm/components/ui/Chart/tools/formatters.js +19 -3
- package/dist/esm/components/ui/ChartAreaInteractive/ChartAreaInteractive.helpers.js +1 -10
- package/dist/esm/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.js +19 -7
- package/dist/esm/components/ui/Select/Select.js +3 -3
- package/dist/esm/components/widgets/DriverCard/DriverCard.js +6 -6
- package/dist/esm/components/widgets/DriverCard/DriverPerformanceChart.js +9 -5
- package/dist/esm/components/widgets/DriversComparisonChart/DriversComparisonChart.styl.js +1 -1
- package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.styl.js +1 -1
- package/dist/esm/index.js +10 -1
- package/dist/esm/types/src/components/ui/AnalysesSelector/AnalysesSelector.d.ts +1 -1
- package/dist/esm/types/src/components/ui/AnalysesSelector/AnalysesSelector.types.d.ts +7 -1
- package/dist/esm/types/src/components/ui/AnalysesSelector/SelectInlineRenamer.d.ts +12 -0
- package/dist/esm/types/src/components/ui/Chart/Chart.d.ts +11 -2
- package/dist/esm/types/src/components/ui/Chart/components/BaseChartWrapper.d.ts +7 -1
- package/dist/esm/types/src/components/ui/Chart/components/index.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chart/tools/formatters.d.ts +3 -1
- package/dist/esm/types/src/components/ui/ChartAreaInteractive/index.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Select/Select.d.ts +1 -1
- package/dist/esm/types/src/components/ui/Select/Select.types.d.ts +1 -0
- package/dist/esm/types/src/components/ui/SmartTextTruncate/SmartTextTruncate.types.d.ts +1 -3
- package/package.json +1 -1
- package/src/components/ui/AnalysesSelector/AnalysesSelector.styl +62 -1
- package/src/components/ui/AnalysesSelector/AnalysesSelector.styl.d.ts +8 -0
- package/src/components/ui/AnalysesSelector/AnalysesSelector.tsx +136 -27
- package/src/components/ui/AnalysesSelector/AnalysesSelector.types.ts +7 -2
- package/src/components/ui/AnalysesSelector/SelectInlineRenamer.tsx +191 -0
- package/src/components/ui/Button/Button.styl +5 -8
- package/src/components/ui/Chart/Chart.tsx +21 -1
- package/src/components/ui/Chart/components/BaseChartWrapper.styl +9 -0
- package/src/components/ui/Chart/components/BaseChartWrapper.styl.d.ts +2 -0
- package/src/components/ui/Chart/components/BaseChartWrapper.tsx +62 -14
- package/src/components/ui/Chart/components/CustomChartLegend/CustomChartLegend.tsx +2 -3
- package/src/components/ui/Chart/components/index.ts +5 -1
- package/src/components/ui/Chart/tools/formatters.ts +20 -2
- package/src/components/ui/ChartAreaInteractive/index.ts +15 -1
- package/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.test.tsx +17 -0
- package/src/components/ui/Chat/ChatMessage/AgentMessageContent.helpers.tsx +23 -7
- package/src/components/ui/Select/Select.tsx +13 -5
- package/src/components/ui/Select/Select.types.ts +1 -0
- package/src/components/ui/SmartTextTruncate/SmartTextTruncate.types.ts +1 -3
- package/src/components/widgets/DriverCard/DriverCard.tsx +7 -8
- package/src/components/widgets/DriversComparisonChart/DriversComparisonChart.styl +0 -1
- package/src/components/widgets/PerformanceChart/PerformanceChart.styl +1 -1
- package/src/docs/components/DocsSidebar/DocsSidebar.tsx +7 -2
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import cn from 'classnames';
|
|
2
1
|
import { useCallback, useMemo } from 'react';
|
|
3
2
|
|
|
4
3
|
import { AnalysesSelector } from '#uilib/components/ui/AnalysesSelector';
|
|
5
|
-
|
|
6
4
|
import S from './CustomChartLegend.styl';
|
|
5
|
+
import cn from 'classnames';
|
|
7
6
|
|
|
8
7
|
interface CustomChartLegendPayloadItem {
|
|
9
8
|
value: string;
|
|
@@ -138,7 +137,7 @@ export function CustomChartLegend({
|
|
|
138
137
|
selectedIds={selectedIds}
|
|
139
138
|
onItemToggle={handleItemToggle}
|
|
140
139
|
inlineMode
|
|
141
|
-
size="
|
|
140
|
+
size="xs"
|
|
142
141
|
variant="clear"
|
|
143
142
|
onFailedItemClick={onFailedAnalysisClick}
|
|
144
143
|
enableToggleHidden
|
|
@@ -5,7 +5,11 @@ export { ChartGrid } from './ChartGrid';
|
|
|
5
5
|
export { ChartLegendContent } from './ChartLegendContent';
|
|
6
6
|
export { ChartTooltipContent } from './ChartTooltipContent';
|
|
7
7
|
export { ForecastLine } from './ForecastLine';
|
|
8
|
-
export {
|
|
8
|
+
export {
|
|
9
|
+
formatCompactAxisNumber,
|
|
10
|
+
formatDate,
|
|
11
|
+
formatNumber,
|
|
12
|
+
} from '../tools/formatters';
|
|
9
13
|
export { HistoricalLine } from './HistoricalLine';
|
|
10
14
|
export { useChartAnimation } from '../hooks/useChartAnimation';
|
|
11
15
|
export { useChartColors } from '../hooks/useChartColors';
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Format number for display (with k/m abbreviations)
|
|
2
|
+
* Format number for display (with k/m/b abbreviations)
|
|
3
3
|
*/
|
|
4
4
|
export const formatNumber = (value: number): string => {
|
|
5
|
+
if (Math.abs(value) >= 1000000000) {
|
|
6
|
+
return (value / 1000000000).toFixed(1).replace(/\.0$/, '') + 'B';
|
|
7
|
+
}
|
|
5
8
|
if (Math.abs(value) >= 1000000) {
|
|
6
9
|
return (value / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
|
|
7
|
-
}
|
|
10
|
+
}
|
|
11
|
+
if (Math.abs(value) >= 1000) {
|
|
8
12
|
return (value / 1000).toFixed(1).replace(/\.0$/, '') + 'K';
|
|
9
13
|
}
|
|
10
14
|
return value.toFixed(0);
|
|
11
15
|
};
|
|
12
16
|
|
|
17
|
+
/** Shorter Y-axis style labels (integer B/M/K) for tight layouts. */
|
|
18
|
+
export const formatCompactAxisNumber = (value: number): string => {
|
|
19
|
+
if (Math.abs(value) >= 1000000000) {
|
|
20
|
+
return `${Math.round(value / 1000000000)}B`;
|
|
21
|
+
}
|
|
22
|
+
if (Math.abs(value) >= 1000000) {
|
|
23
|
+
return `${Math.round(value / 1000000)}M`;
|
|
24
|
+
}
|
|
25
|
+
if (Math.abs(value) >= 1000) {
|
|
26
|
+
return `${Math.round(value / 1000)}K`;
|
|
27
|
+
}
|
|
28
|
+
return value.toFixed(0);
|
|
29
|
+
};
|
|
30
|
+
|
|
13
31
|
/**
|
|
14
32
|
* Round a number based on its magnitude
|
|
15
33
|
* - 2 digits (10-99): round to nearest 10
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
export * from './ChartAreaInteractive';
|
|
2
|
-
export
|
|
2
|
+
export {
|
|
3
|
+
DRAG_TIME_RANGE_PREFIX,
|
|
4
|
+
encodeDragTimeRange,
|
|
5
|
+
filterDataForTimeRange,
|
|
6
|
+
findPinPositionForDate,
|
|
7
|
+
isAnalysisDone,
|
|
8
|
+
isAnalysisFailed,
|
|
9
|
+
isAnalysisNotFailed,
|
|
10
|
+
isTimeRangePreset,
|
|
11
|
+
longDateFormatter,
|
|
12
|
+
parseDragTimeRange,
|
|
13
|
+
shortDateFormatter,
|
|
14
|
+
type FilterDataForTimeRangeOptions,
|
|
15
|
+
type TimeRangePreset,
|
|
16
|
+
} from './ChartAreaInteractive.helpers';
|
|
3
17
|
export * from './ChartAreaInteractive.types';
|
|
4
18
|
export * from './ChartLines';
|
|
5
19
|
export type { OverlayMode } from './ChartAreaInteractive.types';
|
|
@@ -7,6 +7,23 @@ function renderFormatting(text: string) {
|
|
|
7
7
|
return render(<>{parts}</>);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
describe('applyFormatting emphasis', () => {
|
|
11
|
+
it('renders asterisk italic and bold in the same line', () => {
|
|
12
|
+
const { container } = renderFormatting(
|
|
13
|
+
'Use **bold** and *italic* in formatted text.',
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(container.querySelector('strong')?.textContent).toBe('bold');
|
|
17
|
+
expect(container.querySelector('em')?.textContent).toBe('italic');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('renders underscore italic', () => {
|
|
21
|
+
const { container } = renderFormatting('Use _italic_ emphasis.');
|
|
22
|
+
|
|
23
|
+
expect(container.querySelector('em')?.textContent).toBe('italic');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
10
27
|
describe('applyFormatting headers', () => {
|
|
11
28
|
it('renders bold inside markdown headers', () => {
|
|
12
29
|
const { container } = renderFormatting(
|
|
@@ -56,20 +56,36 @@ const injectBold = (content: string) => {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
/** `_italic_`
|
|
59
|
+
/** `*italic*` or `_italic_` — single `*` only (not `**` or `* ` bullets). */
|
|
60
60
|
const injectItalic = (content: string) => {
|
|
61
|
-
const
|
|
61
|
+
const patterns = [
|
|
62
|
+
/(?<![*\\])\*(?!\*)([^*\n]+?)\*(?!\*)/,
|
|
63
|
+
/(?<![A-Za-z0-9])_([^_\n]+?)_(?![A-Za-z0-9])/,
|
|
64
|
+
];
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
let match: RegExpMatchArray | null = null;
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
for (const pattern of patterns) {
|
|
69
|
+
const candidate = content.match(pattern);
|
|
70
|
+
if (
|
|
71
|
+
candidate &&
|
|
72
|
+
candidate.index !== undefined &&
|
|
73
|
+
(match === null || candidate.index < match.index!)
|
|
74
|
+
) {
|
|
75
|
+
match = candidate;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!match || match.index === undefined) return null;
|
|
80
|
+
|
|
81
|
+
if (isInsideHtmlListOrTable(content, match.index)) {
|
|
66
82
|
return null;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
85
|
return {
|
|
70
|
-
elem: <em>{
|
|
71
|
-
index:
|
|
72
|
-
length:
|
|
86
|
+
elem: <em>{match[1]}</em>,
|
|
87
|
+
index: match.index,
|
|
88
|
+
length: match[0].length,
|
|
73
89
|
};
|
|
74
90
|
};
|
|
75
91
|
|
|
@@ -45,6 +45,7 @@ function SelectTrigger({
|
|
|
45
45
|
darker = false,
|
|
46
46
|
children,
|
|
47
47
|
hideChevron = false,
|
|
48
|
+
asChild = false,
|
|
48
49
|
...props
|
|
49
50
|
}: SelectTriggerProps) {
|
|
50
51
|
return (
|
|
@@ -53,13 +54,20 @@ function SelectTrigger({
|
|
|
53
54
|
data-size={size}
|
|
54
55
|
data-variant={variant}
|
|
55
56
|
className={cn(S.selectTrigger, darker && S.darker, className)}
|
|
57
|
+
asChild={asChild}
|
|
56
58
|
{...props}
|
|
57
59
|
>
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
{asChild ? (
|
|
61
|
+
children
|
|
62
|
+
) : (
|
|
63
|
+
<>
|
|
64
|
+
{children}
|
|
65
|
+
{!hideChevron && (
|
|
66
|
+
<SelectPrimitive.Icon asChild>
|
|
67
|
+
<ChevronDownIcon className={S.selectIcon} />
|
|
68
|
+
</SelectPrimitive.Icon>
|
|
69
|
+
)}
|
|
70
|
+
</>
|
|
63
71
|
)}
|
|
64
72
|
</SelectPrimitive.Trigger>
|
|
65
73
|
);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Card, CardContent } from '@sybilion/uilib';
|
|
3
2
|
import { CoffeeIcon, TrendDownIcon, TrendUpIcon } from '@phosphor-icons/react';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/Tooltip';
|
|
4
5
|
|
|
5
6
|
import { Badge } from '../../ui/Badge';
|
|
6
|
-
import {
|
|
7
|
+
import type { DriverData } from '../DriverMap/driverMapGeography';
|
|
8
|
+
import { DriverPerformanceChart } from './DriverPerformanceChart';
|
|
7
9
|
import { LabelWithId } from '../../ui/LabelWithId';
|
|
10
|
+
import S from './DriverCard.styl';
|
|
8
11
|
import { Skeleton } from '../../ui/Skeleton';
|
|
9
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/Tooltip';
|
|
10
12
|
import { getCategoryIcon } from '../DriverMap/driverCategoryIcon';
|
|
11
|
-
import type { DriverData } from '../DriverMap/driverMapGeography';
|
|
12
|
-
import S from './DriverCard.styl';
|
|
13
|
-
import { DriverPerformanceChart } from './DriverPerformanceChart';
|
|
14
13
|
|
|
15
14
|
export interface DriverCardProps {
|
|
16
15
|
selectedDriver: DriverData | null;
|
|
@@ -114,7 +113,7 @@ export function DriverCard({
|
|
|
114
113
|
|
|
115
114
|
if (isLoading) {
|
|
116
115
|
return (
|
|
117
|
-
<Card className={S.root}>
|
|
116
|
+
<Card className={S.root} radiusSize="xl">
|
|
118
117
|
<CardContent noScroll>
|
|
119
118
|
<div className={S.skeletonContainer}>
|
|
120
119
|
<Skeleton className={`${S.skeletonItem} ${S.hs} ${S.w75}`} />
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SidebarMenuSubButton,
|
|
14
14
|
SidebarMenuSubItem,
|
|
15
15
|
} from '#uilib/components/ui/Sidebar/Sidebar';
|
|
16
|
+
import { SmartTextTruncate } from '#uilib/components/ui/SmartTextTruncate';
|
|
16
17
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
17
18
|
|
|
18
19
|
import { DOC_REGISTRY, DOC_SECTION_ORDER } from '../../registry';
|
|
@@ -134,7 +135,9 @@ export function DocsSidebar() {
|
|
|
134
135
|
}}
|
|
135
136
|
isActive={sectionHasActive}
|
|
136
137
|
>
|
|
137
|
-
<span>
|
|
138
|
+
<span>
|
|
139
|
+
<SmartTextTruncate>{section}</SmartTextTruncate>
|
|
140
|
+
</span>
|
|
138
141
|
{isFiltering ? null : renderSectionChevron(isExpanded)}
|
|
139
142
|
</SidebarMenuButton>
|
|
140
143
|
{isExpanded ? (
|
|
@@ -149,7 +152,9 @@ export function DocsSidebar() {
|
|
|
149
152
|
isActive={isActive}
|
|
150
153
|
size="md"
|
|
151
154
|
>
|
|
152
|
-
<Link to={to}>
|
|
155
|
+
<Link to={to}>
|
|
156
|
+
<SmartTextTruncate>{e.title}</SmartTextTruncate>
|
|
157
|
+
</Link>
|
|
153
158
|
</SidebarMenuSubButton>
|
|
154
159
|
</SidebarMenuSubItem>
|
|
155
160
|
);
|