@sybilion/uilib 1.3.93 → 1.3.96
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/assets/globals.css +98 -0
- package/dist/esm/components/ui/Badge/Badge.styl.js +1 -1
- package/dist/esm/components/ui/BarChart/BarChart.js +32 -0
- package/dist/esm/components/ui/BarChart/BarChart.styl.js +7 -0
- package/dist/esm/components/ui/Button/Button.js +1 -1
- package/dist/esm/components/ui/Button/Button.styl.js +1 -1
- package/dist/esm/components/ui/Card/Card.styl.js +1 -1
- package/dist/esm/components/ui/Chart/Chart.helpers.js +15 -3
- package/dist/esm/components/ui/Chart/chartSeriesPalette.js +17 -0
- package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.js +2 -2
- package/dist/esm/components/ui/Checkbox/Checkbox.styl.js +1 -1
- package/dist/esm/components/ui/Chip/Chip.js +12 -0
- package/dist/esm/components/ui/Chip/Chip.styl.js +7 -0
- package/dist/esm/components/ui/DonutChart/DonutChart.js +35 -0
- package/dist/esm/components/ui/DonutChart/DonutChart.styl.js +7 -0
- package/dist/esm/components/ui/Input/Input.styl.js +1 -1
- package/dist/esm/components/ui/Kicker/Kicker.js +9 -0
- package/dist/esm/components/ui/Kicker/Kicker.styl.js +7 -0
- package/dist/esm/components/ui/LabeledInput/LabeledInput.styl.js +1 -1
- package/dist/esm/components/ui/PullQuote/PullQuote.js +9 -0
- package/dist/esm/components/ui/PullQuote/PullQuote.styl.js +7 -0
- package/dist/esm/components/ui/Select/Select.styl.js +1 -1
- package/dist/esm/components/ui/Sidebar/Sidebar.styl.js +1 -1
- package/dist/esm/components/ui/SignalCard/SignalCard.js +17 -0
- package/dist/esm/components/ui/SignalCard/SignalCard.styl.js +7 -0
- package/dist/esm/components/ui/Switch/Switch.styl.js +1 -1
- package/dist/esm/components/ui/Table/Table.js +4 -4
- package/dist/esm/components/ui/Table/Table.styl.js +2 -2
- package/dist/esm/components/ui/Tooltip/Tooltip.styl.js +1 -1
- package/dist/esm/components/widgets/PerformanceChart/PerformanceChart.styl.js +2 -2
- package/dist/esm/components/widgets/PerformanceChart/PerformanceTable.js +5 -5
- package/dist/esm/index.js +6 -0
- package/dist/esm/types/src/components/ui/BarChart/BarChart.d.ts +3 -0
- package/dist/esm/types/src/components/ui/BarChart/BarChart.types.d.ts +28 -0
- package/dist/esm/types/src/components/ui/BarChart/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Chart/chartSeriesPalette.d.ts +6 -0
- package/dist/esm/types/src/components/ui/Chip/Chip.d.ts +3 -0
- package/dist/esm/types/src/components/ui/Chip/Chip.types.d.ts +13 -0
- package/dist/esm/types/src/components/ui/Chip/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/DonutChart/DonutChart.d.ts +3 -0
- package/dist/esm/types/src/components/ui/DonutChart/DonutChart.types.d.ts +25 -0
- package/dist/esm/types/src/components/ui/DonutChart/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Kicker/Kicker.d.ts +3 -0
- package/dist/esm/types/src/components/ui/Kicker/Kicker.types.d.ts +5 -0
- package/dist/esm/types/src/components/ui/Kicker/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/PullQuote/PullQuote.d.ts +3 -0
- package/dist/esm/types/src/components/ui/PullQuote/PullQuote.types.d.ts +7 -0
- package/dist/esm/types/src/components/ui/PullQuote/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Select/Select.types.d.ts +1 -1
- package/dist/esm/types/src/components/ui/SignalCard/SignalCard.d.ts +3 -0
- package/dist/esm/types/src/components/ui/SignalCard/SignalCard.types.d.ts +23 -0
- package/dist/esm/types/src/components/ui/SignalCard/index.d.ts +2 -0
- package/dist/esm/types/src/components/ui/Table/Table.d.ts +2 -5
- package/dist/esm/types/src/components/ui/Table/Table.types.d.ts +4 -1
- package/dist/esm/types/src/components/ui/Table/index.d.ts +1 -1
- package/dist/esm/types/src/docs/components/DocsGuidance/DocsGuidance.d.ts +14 -0
- package/dist/esm/types/src/docs/pages/BarChartPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/ChipPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/ColorsPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/DonutChartPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/IconsPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/KickerPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/MotionPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/PullQuotePage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/RadiiShadowsPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/SignalCardPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/SpacingPage.d.ts +1 -0
- package/dist/esm/types/src/docs/pages/TypographyPage.d.ts +1 -0
- package/dist/esm/types/src/docs/registry.d.ts +1 -1
- package/dist/esm/types/src/index.d.ts +6 -0
- package/dist/esm/types/tests/charts.test.d.ts +1 -0
- package/dist/esm/types/tests/chip.test.d.ts +1 -0
- package/dist/esm/types/tests/componentsSmoke.test.d.ts +1 -0
- package/dist/esm/types/tests/docsRegistry.test.d.ts +1 -0
- package/dist/esm/types/tests/iconsPageFilter.test.d.ts +1 -0
- package/dist/esm/types/tests/mocks/homecodeUiMock.d.ts +32 -1
- package/dist/esm/types/tests/mocks/lightweightChartsMock.d.ts +29 -0
- package/dist/esm/types/tests/pullQuoteKicker.test.d.ts +1 -0
- package/dist/esm/types/tests/signalCard.test.d.ts +1 -0
- package/dist/esm/types/tests/tokenSync.test.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/ui/Badge/Badge.styl +4 -4
- package/src/components/ui/BarChart/BarChart.styl +2 -0
- package/src/components/ui/BarChart/BarChart.styl.d.ts +7 -0
- package/src/components/ui/BarChart/BarChart.tsx +142 -0
- package/src/components/ui/BarChart/BarChart.types.ts +36 -0
- package/src/components/ui/BarChart/index.ts +2 -0
- package/src/components/ui/Button/Button.styl +30 -28
- package/src/components/ui/Button/Button.tsx +2 -1
- package/src/components/ui/Card/Card.styl +4 -3
- package/src/components/ui/Chart/Chart.helpers.ts +17 -3
- package/src/components/ui/Chart/chartSeriesPalette.ts +16 -0
- package/src/components/ui/Chat/ChatSheet/ChatSelector.tsx +2 -2
- package/src/components/ui/Checkbox/Checkbox.styl +1 -1
- package/src/components/ui/Chip/Chip.styl +78 -0
- package/src/components/ui/Chip/Chip.styl.d.ts +16 -0
- package/src/components/ui/Chip/Chip.tsx +35 -0
- package/src/components/ui/Chip/Chip.types.ts +23 -0
- package/src/components/ui/Chip/index.ts +2 -0
- package/src/components/ui/DonutChart/DonutChart.styl +16 -0
- package/src/components/ui/DonutChart/DonutChart.styl.d.ts +10 -0
- package/src/components/ui/DonutChart/DonutChart.tsx +112 -0
- package/src/components/ui/DonutChart/DonutChart.types.ts +30 -0
- package/src/components/ui/DonutChart/index.ts +2 -0
- package/src/components/ui/Input/Input.styl +2 -2
- package/src/components/ui/Kicker/Kicker.styl +10 -0
- package/src/components/ui/Kicker/Kicker.styl.d.ts +7 -0
- package/src/components/ui/Kicker/Kicker.tsx +15 -0
- package/src/components/ui/Kicker/Kicker.types.ts +6 -0
- package/src/components/ui/Kicker/index.ts +2 -0
- package/src/components/ui/LabeledInput/LabeledInput.styl +4 -1
- package/src/components/ui/PullQuote/PullQuote.styl +32 -0
- package/src/components/ui/PullQuote/PullQuote.styl.d.ts +10 -0
- package/src/components/ui/PullQuote/PullQuote.tsx +31 -0
- package/src/components/ui/PullQuote/PullQuote.types.ts +8 -0
- package/src/components/ui/PullQuote/index.ts +2 -0
- package/src/components/ui/Select/Select.styl +21 -14
- package/src/components/ui/Select/Select.types.ts +1 -1
- package/src/components/ui/Sidebar/Sidebar.styl +1 -0
- package/src/components/ui/SignalCard/SignalCard.styl +104 -0
- package/src/components/ui/SignalCard/SignalCard.styl.d.ts +20 -0
- package/src/components/ui/SignalCard/SignalCard.tsx +87 -0
- package/src/components/ui/SignalCard/SignalCard.types.ts +24 -0
- package/src/components/ui/SignalCard/index.ts +2 -0
- package/src/components/ui/Switch/Switch.styl +7 -7
- package/src/components/ui/Table/Table.styl +37 -19
- package/src/components/ui/Table/Table.styl.d.ts +0 -1
- package/src/components/ui/Table/Table.tsx +5 -3
- package/src/components/ui/Table/Table.types.ts +8 -4
- package/src/components/ui/Table/index.ts +1 -1
- package/src/components/ui/Tooltip/Tooltip.styl +2 -2
- package/src/components/widgets/PerformanceChart/PerformanceChart.styl +3 -0
- package/src/components/widgets/PerformanceChart/PerformanceChart.styl.d.ts +1 -0
- package/src/components/widgets/PerformanceChart/PerformanceTable.tsx +8 -8
- package/src/contexts/chatPersistence.test.ts +13 -2
- package/src/docs/components/DocsGuidance/DocsGuidance.styl +33 -0
- package/src/docs/components/DocsGuidance/DocsGuidance.styl.d.ts +11 -0
- package/src/docs/components/DocsGuidance/DocsGuidance.tsx +57 -0
- package/src/docs/pages/AnalysesSelectorPage.tsx +16 -0
- package/src/docs/pages/AnalysisLineIconPage.tsx +12 -0
- package/src/docs/pages/AvatarPage.tsx +15 -0
- package/src/docs/pages/BadgePage.tsx +16 -0
- package/src/docs/pages/BarChartPage.tsx +109 -0
- package/src/docs/pages/BreadcrumbPage.tsx +15 -0
- package/src/docs/pages/ButtonPage.tsx +17 -0
- package/src/docs/pages/CardPage.tsx +190 -17
- package/src/docs/pages/ChartAreaInteractivePage.tsx +24 -7
- package/src/docs/pages/ChartPage.tsx +14 -0
- package/src/docs/pages/ChatAttachmentsDropzonePage.tsx +15 -0
- package/src/docs/pages/ChatComposerPrefillPage.tsx +15 -0
- package/src/docs/pages/ChatPage.tsx +15 -0
- package/src/docs/pages/ChatSheetPage.tsx +14 -0
- package/src/docs/pages/ChatSlashCommandsPage.tsx +15 -0
- package/src/docs/pages/ChatUserCsvAttachmentPage.tsx +14 -0
- package/src/docs/pages/CheckboxPage.tsx +37 -4
- package/src/docs/pages/ChipPage.tsx +160 -0
- package/src/docs/pages/ColorsPage.styl +27 -0
- package/src/docs/pages/ColorsPage.styl.d.ts +12 -0
- package/src/docs/pages/ColorsPage.tsx +102 -0
- package/src/docs/pages/ConfirmPage.tsx +15 -0
- package/src/docs/pages/DialogPage.tsx +15 -0
- package/src/docs/pages/DonutChartPage.tsx +80 -0
- package/src/docs/pages/DrawerPage.tsx +17 -0
- package/src/docs/pages/DriverMapPage.tsx +17 -0
- package/src/docs/pages/DriversComparisonChartPage.tsx +17 -0
- package/src/docs/pages/DropZonePage.tsx +16 -0
- package/src/docs/pages/DropdownMenuPage.tsx +16 -0
- package/src/docs/pages/FileChipPage.tsx +17 -0
- package/src/docs/pages/FlickeringGridPage.tsx +15 -0
- package/src/docs/pages/FoldablePage.tsx +16 -0
- package/src/docs/pages/GridLayoutPage.tsx +16 -0
- package/src/docs/pages/IconsPage.styl +74 -0
- package/src/docs/pages/IconsPage.styl.d.ts +17 -0
- package/src/docs/pages/IconsPage.tsx +125 -0
- package/src/docs/pages/ImagePage.tsx +16 -0
- package/src/docs/pages/ImageWithFallbackPage.tsx +15 -0
- package/src/docs/pages/IncludeHiddenInYScalePage.tsx +14 -0
- package/src/docs/pages/InputPage.tsx +134 -19
- package/src/docs/pages/InteractiveContentPage.tsx +15 -0
- package/src/docs/pages/KickerPage.tsx +62 -0
- package/src/docs/pages/LabelPage.tsx +15 -0
- package/src/docs/pages/LabelWithIdPage.tsx +11 -0
- package/src/docs/pages/LabeledInputPage.tsx +12 -0
- package/src/docs/pages/LegacyPlatformLinkPage.tsx +15 -0
- package/src/docs/pages/LightweightChartPage.styl +0 -1
- package/src/docs/pages/LightweightChartPage.tsx +17 -0
- package/src/docs/pages/LogoPage.tsx +15 -0
- package/src/docs/pages/MobileAdaptiveSelectorPage.tsx +15 -0
- package/src/docs/pages/MotionPage.styl +71 -0
- package/src/docs/pages/MotionPage.styl.d.ts +17 -0
- package/src/docs/pages/MotionPage.tsx +176 -0
- package/src/docs/pages/NavUserHeaderPage.tsx +15 -0
- package/src/docs/pages/NumberControlPage.tsx +15 -0
- package/src/docs/pages/PageColumnsPage.tsx +15 -0
- package/src/docs/pages/PageFooterPage.tsx +15 -0
- package/src/docs/pages/PagePage.tsx +15 -0
- package/src/docs/pages/PageTabsPage.tsx +18 -0
- package/src/docs/pages/PerformanceChartPage.tsx +15 -0
- package/src/docs/pages/ProgressPage.tsx +66 -3
- package/src/docs/pages/PullQuotePage.tsx +59 -0
- package/src/docs/pages/RadiiShadowsPage.styl +47 -0
- package/src/docs/pages/RadiiShadowsPage.styl.d.ts +14 -0
- package/src/docs/pages/RadiiShadowsPage.tsx +109 -0
- package/src/docs/pages/RegionCoordsPage.tsx +12 -0
- package/src/docs/pages/RenamerPage.tsx +15 -0
- package/src/docs/pages/SelectPage.tsx +160 -6
- package/src/docs/pages/SeparatorPage.tsx +12 -0
- package/src/docs/pages/SheetPage.tsx +15 -0
- package/src/docs/pages/SidebarDatasetsItemsGroupedPage.tsx +12 -0
- package/src/docs/pages/SidebarPage.tsx +15 -0
- package/src/docs/pages/SignalCardPage.tsx +126 -0
- package/src/docs/pages/SkeletonPage.tsx +16 -0
- package/src/docs/pages/SliderPage.tsx +70 -4
- package/src/docs/pages/SmartTextTruncatePage.styl +13 -0
- package/src/docs/pages/SmartTextTruncatePage.styl.d.ts +8 -0
- package/src/docs/pages/SmartTextTruncatePage.tsx +17 -4
- package/src/docs/pages/SpacingPage.styl +31 -0
- package/src/docs/pages/SpacingPage.styl.d.ts +12 -0
- package/src/docs/pages/SpacingPage.tsx +50 -0
- package/src/docs/pages/SparklinePage.tsx +15 -0
- package/src/docs/pages/StandaloneAppLayoutPage/StandaloneAppLayoutPage.tsx +16 -0
- package/src/docs/pages/SwitchPage.tsx +147 -8
- package/src/docs/pages/SybilionAuthLayoutPage.tsx +15 -0
- package/src/docs/pages/TablePage.tsx +134 -22
- package/src/docs/pages/TabsPage.tsx +20 -0
- package/src/docs/pages/TextShimmerPage.tsx +12 -0
- package/src/docs/pages/TextWithDeferTooltipPage.tsx +15 -0
- package/src/docs/pages/TimeRangeControlsPage.tsx +15 -0
- package/src/docs/pages/ToggleGroupPage.tsx +15 -0
- package/src/docs/pages/TogglePage.tsx +13 -0
- package/src/docs/pages/TooltipPage.tsx +17 -0
- package/src/docs/pages/TypographyPage.styl +42 -0
- package/src/docs/pages/TypographyPage.styl.d.ts +12 -0
- package/src/docs/pages/TypographyPage.tsx +226 -0
- package/src/docs/pages/VimeoEmbedPage.tsx +12 -0
- package/src/docs/pages/WorldMapPage.tsx +12 -0
- package/src/docs/registry.ts +79 -0
- package/src/index.ts +6 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub for the ESM-only `lightweight-charts` package, which jest's CJS
|
|
3
|
+
* resolver cannot load. Provides the runtime values uilib imports; tests
|
|
4
|
+
* import these modules but never mount a lightweight chart.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ColorType: {
|
|
7
|
+
Solid: string;
|
|
8
|
+
VerticalGradient: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const LineStyle: {
|
|
11
|
+
Solid: number;
|
|
12
|
+
Dotted: number;
|
|
13
|
+
Dashed: number;
|
|
14
|
+
LargeDashed: number;
|
|
15
|
+
SparseDotted: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const LineType: {
|
|
18
|
+
Simple: number;
|
|
19
|
+
WithSteps: number;
|
|
20
|
+
Curved: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const LineSeries: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const customSeriesDefaultOptions: {
|
|
26
|
+
lastValueVisible: boolean;
|
|
27
|
+
priceLineVisible: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function createChart(): never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
width fit-content
|
|
6
6
|
flex-shrink 0
|
|
7
7
|
white-space nowrap
|
|
8
|
-
gap
|
|
9
|
-
padding
|
|
10
|
-
border-radius
|
|
8
|
+
gap var(--spacing-xs)
|
|
9
|
+
padding 5px 10px
|
|
10
|
+
border-radius var(--radius-pill)
|
|
11
11
|
border-color transparent
|
|
12
|
-
font-size
|
|
12
|
+
font-size 11px
|
|
13
13
|
line-height 1rem
|
|
14
14
|
font-family var(--font-family-body)
|
|
15
15
|
font-weight 400
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { ChartConfig } from '#uilib/components/ui/Chart';
|
|
5
|
+
import {
|
|
6
|
+
ChartContainer,
|
|
7
|
+
ChartLegend,
|
|
8
|
+
ChartLegendContent,
|
|
9
|
+
ChartTooltip,
|
|
10
|
+
ChartTooltipContent,
|
|
11
|
+
} from '#uilib/components/ui/Chart';
|
|
12
|
+
import { getChartSeriesColor } from '#uilib/components/ui/Chart/chartSeriesPalette';
|
|
13
|
+
import {
|
|
14
|
+
Bar,
|
|
15
|
+
CartesianGrid,
|
|
16
|
+
BarChart as RechartsBarChart,
|
|
17
|
+
XAxis,
|
|
18
|
+
YAxis,
|
|
19
|
+
} from 'recharts';
|
|
20
|
+
|
|
21
|
+
import S from './BarChart.styl';
|
|
22
|
+
import { BarChartProps, BarChartSeries } from './BarChart.types';
|
|
23
|
+
|
|
24
|
+
const STACK_ID = 'stack';
|
|
25
|
+
|
|
26
|
+
function buildChartConfig(series: BarChartSeries[]): ChartConfig {
|
|
27
|
+
const config: ChartConfig = {};
|
|
28
|
+
|
|
29
|
+
series.forEach((item, index) => {
|
|
30
|
+
config[item.key] = {
|
|
31
|
+
label: item.label ?? item.key,
|
|
32
|
+
color: item.color ?? getChartSeriesColor(index),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return config;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const BarChart = forwardRef<HTMLDivElement, BarChartProps>(
|
|
40
|
+
(
|
|
41
|
+
{
|
|
42
|
+
className,
|
|
43
|
+
data,
|
|
44
|
+
categoryKey,
|
|
45
|
+
series,
|
|
46
|
+
orientation = 'vertical',
|
|
47
|
+
mode = 'grouped',
|
|
48
|
+
showLegend = true,
|
|
49
|
+
showTooltip = true,
|
|
50
|
+
showGrid = true,
|
|
51
|
+
valueFormatter,
|
|
52
|
+
height,
|
|
53
|
+
...props
|
|
54
|
+
},
|
|
55
|
+
ref,
|
|
56
|
+
) => {
|
|
57
|
+
const config = useMemo(() => buildChartConfig(series), [series]);
|
|
58
|
+
|
|
59
|
+
const isHorizontal = orientation === 'horizontal';
|
|
60
|
+
const stackId = mode === 'stacked' ? STACK_ID : undefined;
|
|
61
|
+
const barRadius: [number, number, number, number] | number =
|
|
62
|
+
mode === 'stacked' ? 0 : isHorizontal ? [0, 3, 3, 0] : [3, 3, 0, 0];
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div ref={ref} className={cn(S.root, className)} {...props}>
|
|
66
|
+
<ChartContainer
|
|
67
|
+
config={config}
|
|
68
|
+
style={height ? { height: `${height}px` } : undefined}
|
|
69
|
+
>
|
|
70
|
+
<RechartsBarChart
|
|
71
|
+
data={data}
|
|
72
|
+
layout={isHorizontal ? 'vertical' : 'horizontal'}
|
|
73
|
+
accessibilityLayer
|
|
74
|
+
>
|
|
75
|
+
{showGrid && (
|
|
76
|
+
<CartesianGrid
|
|
77
|
+
stroke="var(--border)"
|
|
78
|
+
strokeWidth={0.6}
|
|
79
|
+
vertical={isHorizontal}
|
|
80
|
+
horizontal={!isHorizontal}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{isHorizontal ? (
|
|
84
|
+
<>
|
|
85
|
+
<XAxis
|
|
86
|
+
type="number"
|
|
87
|
+
tickLine={false}
|
|
88
|
+
axisLine={{ stroke: 'var(--border)', strokeWidth: 1 }}
|
|
89
|
+
tickFormatter={valueFormatter}
|
|
90
|
+
/>
|
|
91
|
+
<YAxis
|
|
92
|
+
type="category"
|
|
93
|
+
dataKey={categoryKey}
|
|
94
|
+
tickLine={false}
|
|
95
|
+
axisLine={{ stroke: 'var(--border)', strokeWidth: 1 }}
|
|
96
|
+
width={80}
|
|
97
|
+
/>
|
|
98
|
+
</>
|
|
99
|
+
) : (
|
|
100
|
+
<>
|
|
101
|
+
<XAxis
|
|
102
|
+
type="category"
|
|
103
|
+
dataKey={categoryKey}
|
|
104
|
+
tickLine={false}
|
|
105
|
+
axisLine={{ stroke: 'var(--border)', strokeWidth: 1 }}
|
|
106
|
+
/>
|
|
107
|
+
<YAxis
|
|
108
|
+
type="number"
|
|
109
|
+
tickLine={false}
|
|
110
|
+
axisLine={{ stroke: 'var(--border)', strokeWidth: 1 }}
|
|
111
|
+
width={48}
|
|
112
|
+
tickFormatter={valueFormatter}
|
|
113
|
+
/>
|
|
114
|
+
</>
|
|
115
|
+
)}
|
|
116
|
+
{showTooltip && (
|
|
117
|
+
<ChartTooltip
|
|
118
|
+
cursor={{ fill: 'var(--muted)' }}
|
|
119
|
+
content={<ChartTooltipContent indicator="dot" />}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
{series.map(item => (
|
|
123
|
+
<Bar
|
|
124
|
+
key={item.key}
|
|
125
|
+
dataKey={item.key}
|
|
126
|
+
fill={`var(--color-${item.key})`}
|
|
127
|
+
stackId={stackId}
|
|
128
|
+
radius={barRadius}
|
|
129
|
+
maxBarSize={48}
|
|
130
|
+
/>
|
|
131
|
+
))}
|
|
132
|
+
{showLegend && <ChartLegend content={<ChartLegendContent />} />}
|
|
133
|
+
</RechartsBarChart>
|
|
134
|
+
</ChartContainer>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
BarChart.displayName = 'BarChart';
|
|
141
|
+
|
|
142
|
+
export { BarChart };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export type BarChartDatum = Record<string, string | number | null | undefined>;
|
|
4
|
+
|
|
5
|
+
export interface BarChartSeries {
|
|
6
|
+
/** Data key of the series in each datum. */
|
|
7
|
+
key: string;
|
|
8
|
+
/** Human-readable label; falls back to the key. */
|
|
9
|
+
label?: ReactNode;
|
|
10
|
+
/** CSS colour; falls back to the built-in series palette. */
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Direction the bars grow in: vertical bars rise up, horizontal bars extend right. */
|
|
15
|
+
export type BarChartOrientation = 'vertical' | 'horizontal';
|
|
16
|
+
|
|
17
|
+
export type BarChartMode = 'grouped' | 'stacked';
|
|
18
|
+
|
|
19
|
+
export interface BarChartProps extends Omit<
|
|
20
|
+
HTMLAttributes<HTMLDivElement>,
|
|
21
|
+
'children'
|
|
22
|
+
> {
|
|
23
|
+
data: BarChartDatum[];
|
|
24
|
+
/** Data key holding the category label (x axis for vertical bars). */
|
|
25
|
+
categoryKey: string;
|
|
26
|
+
series: BarChartSeries[];
|
|
27
|
+
orientation?: BarChartOrientation;
|
|
28
|
+
mode?: BarChartMode;
|
|
29
|
+
showLegend?: boolean;
|
|
30
|
+
showTooltip?: boolean;
|
|
31
|
+
showGrid?: boolean;
|
|
32
|
+
/** Formats numeric axis tick values. */
|
|
33
|
+
valueFormatter?: (value: number) => string;
|
|
34
|
+
/** Fixed chart height in px; defaults to a 16:9 responsive box. */
|
|
35
|
+
height?: number;
|
|
36
|
+
}
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
display inline-flex
|
|
4
4
|
align-items center
|
|
5
5
|
justify-content center
|
|
6
|
-
gap
|
|
6
|
+
gap 10px
|
|
7
7
|
flex-shrink 0
|
|
8
8
|
white-space nowrap
|
|
9
|
-
border-radius
|
|
9
|
+
border-radius var(--radius-button)
|
|
10
10
|
font-family 'Manrope', sans-serif
|
|
11
|
-
font-size
|
|
11
|
+
font-size 15px
|
|
12
12
|
font-weight 500
|
|
13
|
-
line-height
|
|
13
|
+
line-height 1
|
|
14
14
|
outline none
|
|
15
15
|
cursor pointer
|
|
16
|
-
transition all
|
|
16
|
+
transition all var(--dur-base) var(--ease-standard)
|
|
17
17
|
border 0
|
|
18
18
|
|
|
19
19
|
&:disabled
|
|
@@ -99,33 +99,35 @@
|
|
|
99
99
|
|
|
100
100
|
// Size styles
|
|
101
101
|
.sizeMd
|
|
102
|
-
|
|
103
|
-
padding 14px 16px
|
|
104
|
-
|
|
105
|
-
&:has(> svg)
|
|
106
|
-
padding-left 14px
|
|
107
|
-
padding-right 14px
|
|
102
|
+
padding var(--p-3) var(--p-5)
|
|
108
103
|
|
|
109
104
|
.sizeSm
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
border-radius 14px
|
|
114
|
-
|
|
115
|
-
&:has(> svg)
|
|
116
|
-
padding-left 10px
|
|
117
|
-
padding-right 10px
|
|
105
|
+
padding var(--p-2) 14px
|
|
106
|
+
font-size 13px
|
|
107
|
+
border-radius var(--radius-3)
|
|
118
108
|
|
|
119
109
|
.sizeLg
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
border-radius
|
|
123
|
-
|
|
124
|
-
&:has(> svg)
|
|
125
|
-
padding-left 16px
|
|
126
|
-
padding-right 16px
|
|
110
|
+
padding var(--p-4) var(--p-6)
|
|
111
|
+
font-size var(--text-base)
|
|
112
|
+
border-radius var(--radius-4)
|
|
127
113
|
|
|
114
|
+
// Icon buttons: square, sized per size variant, same radius as the size variant
|
|
128
115
|
.sizeIcon
|
|
129
|
-
width 36px
|
|
130
|
-
height 36px
|
|
131
116
|
padding 0
|
|
117
|
+
width 48px
|
|
118
|
+
height 48px
|
|
119
|
+
|
|
120
|
+
&.sizeSm
|
|
121
|
+
width 36px
|
|
122
|
+
height 36px
|
|
123
|
+
padding 0
|
|
124
|
+
|
|
125
|
+
&.sizeMd
|
|
126
|
+
width 48px
|
|
127
|
+
height 48px
|
|
128
|
+
padding 0
|
|
129
|
+
|
|
130
|
+
&.sizeLg
|
|
131
|
+
width 56px
|
|
132
|
+
height 56px
|
|
133
|
+
padding 0
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
flex-direction column
|
|
6
6
|
gap var(--p-4)
|
|
7
7
|
max-height 100%
|
|
8
|
-
border-radius
|
|
9
|
-
|
|
8
|
+
border-radius var(--radius-card)
|
|
9
|
+
border 1px solid var(--border)
|
|
10
|
+
box-shadow var(--shadow-1)
|
|
10
11
|
background-color var(--card)
|
|
11
12
|
color var(--card-foreground)
|
|
12
13
|
position relative
|
|
@@ -106,4 +107,4 @@
|
|
|
106
107
|
overflow hidden
|
|
107
108
|
|
|
108
109
|
&:global(.border-t)
|
|
109
|
-
padding-top
|
|
110
|
+
padding-top var(--p-6)
|
|
@@ -42,15 +42,29 @@ export function normalizeTooltipPayload(
|
|
|
42
42
|
return result.length ? result : undefined;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
46
|
+
return typeof value === 'object' && value !== null;
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
export function getPayloadConfigFromPayload(
|
|
46
50
|
config: ChartConfig,
|
|
47
51
|
payload: unknown,
|
|
48
52
|
key: string,
|
|
49
53
|
) {
|
|
50
|
-
if (
|
|
54
|
+
if (!isRecord(payload)) {
|
|
51
55
|
return config[key];
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
//
|
|
55
|
-
|
|
58
|
+
// When the item (or its inner datum) carries a string at `key` — e.g. a
|
|
59
|
+
// Pie slice with nameKey="key" — that string names the config entry.
|
|
60
|
+
const inner = isRecord(payload.payload) ? payload.payload : undefined;
|
|
61
|
+
|
|
62
|
+
let configLabelKey = key;
|
|
63
|
+
if (typeof payload[key] === 'string') {
|
|
64
|
+
configLabelKey = String(payload[key]);
|
|
65
|
+
} else if (inner && typeof inner[key] === 'string') {
|
|
66
|
+
configLabelKey = String(inner[key]);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
56
70
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Categorical series palette for charts.
|
|
3
|
+
* Uses --sb-* ramp tokens so colours follow the active theme.
|
|
4
|
+
*/
|
|
5
|
+
export const CHART_SERIES_PALETTE: readonly string[] = [
|
|
6
|
+
'var(--sb-cyan-500)',
|
|
7
|
+
'var(--sb-purple-500)',
|
|
8
|
+
'var(--sb-green-600)',
|
|
9
|
+
'var(--sb-yellow-500)',
|
|
10
|
+
'var(--sb-red-500)',
|
|
11
|
+
'var(--sb-slate-400)',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export function getChartSeriesColor(index: number): string {
|
|
15
|
+
return CHART_SERIES_PALETTE[index % CHART_SERIES_PALETTE.length];
|
|
16
|
+
}
|
|
@@ -29,7 +29,7 @@ export interface ChatSelectorProps
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const deleteIconSize = (s: NonNullable<SelectTriggerProps['size']>) =>
|
|
32
|
-
s === 'sm' ? 16 : s === 'md' ? 18 : 20;
|
|
32
|
+
s === 'xs' ? 14 : s === 'sm' ? 16 : s === 'md' ? 18 : 20;
|
|
33
33
|
|
|
34
34
|
export function ChatSelector({
|
|
35
35
|
id,
|
|
@@ -117,7 +117,7 @@ export function ChatSelector({
|
|
|
117
117
|
<Button
|
|
118
118
|
type="button"
|
|
119
119
|
variant="ghost"
|
|
120
|
-
size={size}
|
|
120
|
+
size={size === 'xs' ? 'sm' : size}
|
|
121
121
|
className={S.deleteBtn}
|
|
122
122
|
aria-label="Delete chat"
|
|
123
123
|
onClick={handleDeleteChat}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
.root
|
|
2
|
+
display inline-flex
|
|
3
|
+
align-items center
|
|
4
|
+
width fit-content
|
|
5
|
+
flex-shrink 0
|
|
6
|
+
white-space nowrap
|
|
7
|
+
gap 6px
|
|
8
|
+
padding 5px 10px
|
|
9
|
+
border-radius var(--radius-pill)
|
|
10
|
+
font-family var(--font-family-body)
|
|
11
|
+
font-size 11px
|
|
12
|
+
line-height 1rem
|
|
13
|
+
font-weight 400
|
|
14
|
+
letter-spacing var(--tracking-body)
|
|
15
|
+
transition background-color var(--dur-base) var(--ease-standard), color var(--dur-base) var(--ease-standard), border-color var(--dur-base) var(--ease-standard)
|
|
16
|
+
|
|
17
|
+
.dot
|
|
18
|
+
width 6px
|
|
19
|
+
height 6px
|
|
20
|
+
border-radius 50%
|
|
21
|
+
background var(--sb-cyan-400)
|
|
22
|
+
flex none
|
|
23
|
+
|
|
24
|
+
.arrow
|
|
25
|
+
width 10px
|
|
26
|
+
height 10px
|
|
27
|
+
flex none
|
|
28
|
+
pointer-events none
|
|
29
|
+
|
|
30
|
+
// Neutral variant — slate wash with status dot
|
|
31
|
+
&.variant-neutral
|
|
32
|
+
background var(--sb-slate-100)
|
|
33
|
+
color var(--sb-slate-800)
|
|
34
|
+
|
|
35
|
+
:global(.dark) &
|
|
36
|
+
background var(--sb-slate-800)
|
|
37
|
+
color var(--sb-slate-200)
|
|
38
|
+
|
|
39
|
+
// Line variant — hairline outline on surface
|
|
40
|
+
&.variant-line
|
|
41
|
+
background var(--background)
|
|
42
|
+
border 1px solid var(--border)
|
|
43
|
+
color var(--sb-slate-900)
|
|
44
|
+
|
|
45
|
+
:global(.dark) &
|
|
46
|
+
color var(--sb-slate-100)
|
|
47
|
+
|
|
48
|
+
// Active variant — accent outline
|
|
49
|
+
&.variant-active
|
|
50
|
+
background transparent
|
|
51
|
+
border 1px solid var(--sb-cyan-400)
|
|
52
|
+
color var(--sb-slate-900)
|
|
53
|
+
|
|
54
|
+
:global(.dark) &
|
|
55
|
+
color var(--sb-slate-100)
|
|
56
|
+
|
|
57
|
+
// Filled variant — inverse
|
|
58
|
+
&.variant-filled
|
|
59
|
+
background var(--sb-slate-900)
|
|
60
|
+
color var(--sb-slate-50)
|
|
61
|
+
|
|
62
|
+
:global(.dark) &
|
|
63
|
+
background var(--sb-slate-100)
|
|
64
|
+
color var(--sb-slate-900)
|
|
65
|
+
|
|
66
|
+
// Accent variant — cyan wash
|
|
67
|
+
&.variant-accent
|
|
68
|
+
background var(--sb-cyan-100)
|
|
69
|
+
color var(--sb-slate-900)
|
|
70
|
+
|
|
71
|
+
// Status variants — quantitative delta / impact only
|
|
72
|
+
&.variant-positive
|
|
73
|
+
background var(--status-positive-bg)
|
|
74
|
+
color var(--status-positive)
|
|
75
|
+
|
|
76
|
+
&.variant-negative
|
|
77
|
+
background var(--status-negative-bg)
|
|
78
|
+
color var(--status-negative)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'arrow': string;
|
|
5
|
+
'dot': string;
|
|
6
|
+
'root': string;
|
|
7
|
+
'variant-accent': string;
|
|
8
|
+
'variant-active': string;
|
|
9
|
+
'variant-filled': string;
|
|
10
|
+
'variant-line': string;
|
|
11
|
+
'variant-negative': string;
|
|
12
|
+
'variant-neutral': string;
|
|
13
|
+
'variant-positive': string;
|
|
14
|
+
}
|
|
15
|
+
export const cssExports: CssExports;
|
|
16
|
+
export default cssExports;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
import { TrendingDown, TrendingUp } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
import S from './Chip.styl';
|
|
6
|
+
import { ChipProps } from './Chip.types';
|
|
7
|
+
|
|
8
|
+
function Chip({
|
|
9
|
+
className,
|
|
10
|
+
variant = 'neutral',
|
|
11
|
+
dot,
|
|
12
|
+
trend,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: ChipProps) {
|
|
16
|
+
const showDot = dot ?? variant === 'neutral';
|
|
17
|
+
const TrendIcon =
|
|
18
|
+
trend === 'up' ? TrendingUp : trend === 'down' ? TrendingDown : null;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<span
|
|
22
|
+
data-slot="chip"
|
|
23
|
+
className={cn(S.root, S[`variant-${variant}`], className)}
|
|
24
|
+
{...props}
|
|
25
|
+
>
|
|
26
|
+
{showDot && <span className={S.dot} aria-hidden="true" />}
|
|
27
|
+
{TrendIcon && (
|
|
28
|
+
<TrendIcon className={S.arrow} strokeWidth={1.5} aria-hidden="true" />
|
|
29
|
+
)}
|
|
30
|
+
{children}
|
|
31
|
+
</span>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Chip };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ChipVariant =
|
|
4
|
+
| 'neutral'
|
|
5
|
+
| 'line'
|
|
6
|
+
| 'active'
|
|
7
|
+
| 'filled'
|
|
8
|
+
| 'accent'
|
|
9
|
+
| 'positive'
|
|
10
|
+
| 'negative';
|
|
11
|
+
|
|
12
|
+
export type ChipTrend = 'up' | 'down';
|
|
13
|
+
|
|
14
|
+
export interface ChipProps extends ComponentProps<'span'> {
|
|
15
|
+
variant?: ChipVariant;
|
|
16
|
+
/**
|
|
17
|
+
* Show the 6px status dot. Defaults to true for the neutral variant
|
|
18
|
+
* and false for all others.
|
|
19
|
+
*/
|
|
20
|
+
dot?: boolean;
|
|
21
|
+
/** Render a Lucide trend arrow before the label. */
|
|
22
|
+
trend?: ChipTrend;
|
|
23
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file is automatically generated.
|
|
2
|
+
// Please do not change this file!
|
|
3
|
+
interface CssExports {
|
|
4
|
+
'centerCaption': string;
|
|
5
|
+
'centerValue': string;
|
|
6
|
+
'chart': string;
|
|
7
|
+
'root': string;
|
|
8
|
+
}
|
|
9
|
+
export const cssExports: CssExports;
|
|
10
|
+
export default cssExports;
|