@vectara/vectara-ui 19.0.0 → 19.2.0
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/lib/components/chart/BarChart.d.ts +23 -0
- package/lib/components/chart/BarChart.js +28 -0
- package/lib/components/chart/ComposedChart.d.ts +25 -0
- package/lib/components/chart/ComposedChart.js +40 -0
- package/lib/components/chart/LineChart.d.ts +25 -0
- package/lib/components/chart/LineChart.js +42 -0
- package/lib/components/chart/PieChart.d.ts +15 -0
- package/lib/components/chart/PieChart.js +36 -0
- package/lib/components/chart/ScatterChart.d.ts +18 -0
- package/lib/components/chart/ScatterChart.js +34 -0
- package/lib/components/chart/Sparkline.d.ts +13 -0
- package/lib/components/chart/Sparkline.js +23 -0
- package/lib/components/chart/TreeMap.d.ts +13 -0
- package/lib/components/chart/TreeMap.js +51 -0
- package/lib/components/chart/_index.scss +19 -0
- package/lib/components/chart/chartTheme.d.ts +21 -0
- package/lib/components/chart/chartTheme.js +13 -0
- package/lib/components/chart/palette.d.ts +5 -0
- package/lib/components/chart/palette.js +29 -0
- package/lib/components/context/Theme.d.ts +8 -0
- package/lib/components/context/Theme.js +40 -3
- package/lib/components/index.d.ts +10 -2
- package/lib/components/index.js +9 -1
- package/lib/styles/index.css +22 -0
- package/package.json +4 -3
- package/src/docs/Docs.tsx +10 -0
- package/src/docs/pages/barChart/Basic.tsx +21 -0
- package/src/docs/pages/barChart/Horizontal.tsx +20 -0
- package/src/docs/pages/barChart/Stacked.tsx +23 -0
- package/src/docs/pages/barChart/index.tsx +29 -0
- package/src/docs/pages/colorPalette/ChartColors.tsx +68 -0
- package/src/docs/pages/colorPalette/index.tsx +7 -0
- package/src/docs/pages/composedChart/Basic.tsx +25 -0
- package/src/docs/pages/composedChart/FormattedAxes.tsx +32 -0
- package/src/docs/pages/composedChart/index.tsx +22 -0
- package/src/docs/pages/lineChart/Area.tsx +25 -0
- package/src/docs/pages/lineChart/Basic.tsx +23 -0
- package/src/docs/pages/lineChart/Curved.tsx +25 -0
- package/src/docs/pages/lineChart/FormattedValues.tsx +25 -0
- package/src/docs/pages/lineChart/StackedArea.tsx +27 -0
- package/src/docs/pages/lineChart/Synced.tsx +48 -0
- package/src/docs/pages/lineChart/index.tsx +50 -0
- package/src/docs/pages/pieChart/Basic.tsx +13 -0
- package/src/docs/pages/pieChart/Donut.tsx +12 -0
- package/src/docs/pages/pieChart/ManyValues.tsx +51 -0
- package/src/docs/pages/pieChart/Unlabeled.tsx +15 -0
- package/src/docs/pages/pieChart/index.tsx +36 -0
- package/src/docs/pages/scatterChart/Basic.tsx +31 -0
- package/src/docs/pages/scatterChart/Dense.tsx +144 -0
- package/src/docs/pages/scatterChart/index.tsx +22 -0
- package/src/docs/pages/sparkline/Basic.tsx +7 -0
- package/src/docs/pages/sparkline/Inline.tsx +21 -0
- package/src/docs/pages/sparkline/index.tsx +22 -0
- package/src/docs/pages/treeMap/Basic.tsx +14 -0
- package/src/docs/pages/treeMap/Nested.tsx +88 -0
- package/src/docs/pages/treeMap/index.tsx +22 -0
- package/src/docs/pages.tsx +11 -0
package/lib/components/index.js
CHANGED
|
@@ -14,6 +14,14 @@ import { VuiButtonTertiary } from "./button/ButtonTertiary";
|
|
|
14
14
|
import { VuiIconButton } from "./button/IconButton";
|
|
15
15
|
import { VuiCallout } from "./callout/Callout";
|
|
16
16
|
import { VuiCard, VuiSimpleCard } from "./card";
|
|
17
|
+
import { VuiBarChart } from "./chart/BarChart";
|
|
18
|
+
import { VuiLineChart } from "./chart/LineChart";
|
|
19
|
+
import { VuiPieChart } from "./chart/PieChart";
|
|
20
|
+
import { VuiSparkline } from "./chart/Sparkline";
|
|
21
|
+
import { VuiTreeMap } from "./chart/TreeMap";
|
|
22
|
+
import { VuiScatterChart } from "./chart/ScatterChart";
|
|
23
|
+
import { VuiComposedChart } from "./chart/ComposedChart";
|
|
24
|
+
import { CHART_PALETTE } from "./chart/palette";
|
|
17
25
|
import { CALLOUT_COLOR, CALLOUT_SIZE } from "./callout/types";
|
|
18
26
|
import { VuiChat } from "./chat/Chat";
|
|
19
27
|
import { VuiChip } from "./chip/Chip";
|
|
@@ -99,4 +107,4 @@ import { VuiInfoTooltip } from "./tooltip/InfoTooltip";
|
|
|
99
107
|
import { VuiTopicButton } from "./topicButton/TopicButton";
|
|
100
108
|
import { copyToClipboard } from "../utils/copyToClipboard";
|
|
101
109
|
import { toRgb, toRgba } from "./context/Theme";
|
|
102
|
-
export { BADGE_COLOR, BUTTON_COLOR, BUTTON_SIZE, CALLOUT_COLOR, CALLOUT_SIZE, DURATION_BAR_COLOR, ICON_COLOR, ICON_SIZE, ICON_TYPE, PATCH_COLOR, PROGRESS_BAR_COLOR, SPACER_SIZE, SPINNER_COLOR, SKELETON_COLOR, SPINNER_SIZE, TAB_SIZE, TEXT_COLOR, TEXT_SIZE, TITLE_SIZE, addNotification, copyToClipboard, generateTokensProvider, toRgb, toRgba, VuiAccordion, VuiAccountButton, VuiAppContent, VuiAppHeader, VuiAppLayout, VuiAppSideNav, VuiAppSideNavLink, VuiAppSideNavGroup, VuiBadge, VuiButtonPrimary, VuiButtonSecondary, VuiButtonTertiary, VuiIconButton, VuiCallout, VuiCard, VuiChat, VuiCheckbox, VuiChip, VuiCode, VuiCodeEditor, VuiComposer, VuiComplexConfigurationButton, VuiContextProvider, VuiCopyButton, VuiDatePicker, VuiDateRangePicker, VuiDrawer, VuiDurationBar, VuiErrorBoundary, VuiFileDropTarget, VuiFlexContainer, VuiFlexItem, VuiFormGroup, VuiGrid, VuiGridItem, VuiHorizontalRule, VuiIcon, VuiImage, VuiImagePreview, VuiInfoList, VuiInfoListItem, VuiInfoMenu, VuiInfoTable, VuiInfoTooltip, VuiKvTable, VuiInProgress, VuiItemsInput, VuiLabel, VuiLink, VuiLinkInternal, VuiList, VuiMenu, VuiMenuItem, VuiMenuList, VuiMenuListButton, VuiModal, VuiNotifications, VuiNumberInput, VuiOptionsButton, VuiOptionsList, VuiOptionsListItem, VuiPagination, VuiPanel, VuiPasswordInput, VuiPatch, VuiPopover, VuiPortal, VuiProgressBar, VuiPrompt, VuiRadioButton, VuiScreenBlock, VuiSearchInput, VuiSearchResult, VuiSearchSelect, VuiSelect, VuiSetting, VuiSideList, VuiSideListButton, VuiSimpleCard, VuiSimpleGrid, VuiSpacer, VuiSpans, VuiSpinner, VuiStat, VuiStatList, VuiStatus, VuiSteps, VuiStepsVertical, VuiSummary, VuiSkeleton, VuiSummaryCitation, VuiSuperCheckboxGroup, VuiSuperRadioGroup, VuiTable, VuiTab, VuiTabbedRoutes, VuiTabs, VuiTabsNavigator, VuiText, VuiTextArea, VuiTextColor, VuiTextInput, VuiTimeline, VuiTimelineItem, VuiTitle, VuiToggle, VuiTooltip, VuiTopicButton };
|
|
110
|
+
export { BADGE_COLOR, BUTTON_COLOR, BUTTON_SIZE, CHART_PALETTE, CALLOUT_COLOR, CALLOUT_SIZE, DURATION_BAR_COLOR, ICON_COLOR, ICON_SIZE, ICON_TYPE, PATCH_COLOR, PROGRESS_BAR_COLOR, SPACER_SIZE, SPINNER_COLOR, SKELETON_COLOR, SPINNER_SIZE, TAB_SIZE, TEXT_COLOR, TEXT_SIZE, TITLE_SIZE, addNotification, copyToClipboard, generateTokensProvider, toRgb, toRgba, VuiAccordion, VuiAccountButton, VuiAppContent, VuiAppHeader, VuiAppLayout, VuiAppSideNav, VuiAppSideNavLink, VuiAppSideNavGroup, VuiBadge, VuiBarChart, VuiComposedChart, VuiLineChart, VuiPieChart, VuiScatterChart, VuiSparkline, VuiTreeMap, VuiButtonPrimary, VuiButtonSecondary, VuiButtonTertiary, VuiIconButton, VuiCallout, VuiCard, VuiChat, VuiCheckbox, VuiChip, VuiCode, VuiCodeEditor, VuiComposer, VuiComplexConfigurationButton, VuiContextProvider, VuiCopyButton, VuiDatePicker, VuiDateRangePicker, VuiDrawer, VuiDurationBar, VuiErrorBoundary, VuiFileDropTarget, VuiFlexContainer, VuiFlexItem, VuiFormGroup, VuiGrid, VuiGridItem, VuiHorizontalRule, VuiIcon, VuiImage, VuiImagePreview, VuiInfoList, VuiInfoListItem, VuiInfoMenu, VuiInfoTable, VuiInfoTooltip, VuiKvTable, VuiInProgress, VuiItemsInput, VuiLabel, VuiLink, VuiLinkInternal, VuiList, VuiMenu, VuiMenuItem, VuiMenuList, VuiMenuListButton, VuiModal, VuiNotifications, VuiNumberInput, VuiOptionsButton, VuiOptionsList, VuiOptionsListItem, VuiPagination, VuiPanel, VuiPasswordInput, VuiPatch, VuiPopover, VuiPortal, VuiProgressBar, VuiPrompt, VuiRadioButton, VuiScreenBlock, VuiSearchInput, VuiSearchResult, VuiSearchSelect, VuiSelect, VuiSetting, VuiSideList, VuiSideListButton, VuiSimpleCard, VuiSimpleGrid, VuiSpacer, VuiSpans, VuiSpinner, VuiStat, VuiStatList, VuiStatus, VuiSteps, VuiStepsVertical, VuiSummary, VuiSkeleton, VuiSummaryCitation, VuiSuperCheckboxGroup, VuiSuperRadioGroup, VuiTable, VuiTab, VuiTabbedRoutes, VuiTabs, VuiTabsNavigator, VuiText, VuiTextArea, VuiTextColor, VuiTextInput, VuiTimeline, VuiTimelineItem, VuiTitle, VuiToggle, VuiTooltip, VuiTopicButton };
|
package/lib/styles/index.css
CHANGED
|
@@ -1333,6 +1333,28 @@ fieldset {
|
|
|
1333
1333
|
padding: 24px;
|
|
1334
1334
|
}
|
|
1335
1335
|
|
|
1336
|
+
.vuiBarChart,
|
|
1337
|
+
.vuiLineChart,
|
|
1338
|
+
.vuiPieChart,
|
|
1339
|
+
.vuiScatterChart,
|
|
1340
|
+
.vuiComposedChart,
|
|
1341
|
+
.vuiTreeMap {
|
|
1342
|
+
width: 100%;
|
|
1343
|
+
}
|
|
1344
|
+
.vuiBarChart .recharts-legend-item,
|
|
1345
|
+
.vuiLineChart .recharts-legend-item,
|
|
1346
|
+
.vuiPieChart .recharts-legend-item,
|
|
1347
|
+
.vuiScatterChart .recharts-legend-item,
|
|
1348
|
+
.vuiComposedChart .recharts-legend-item,
|
|
1349
|
+
.vuiTreeMap .recharts-legend-item {
|
|
1350
|
+
margin-right: 16px !important;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.vuiSparkline {
|
|
1354
|
+
display: inline-block;
|
|
1355
|
+
line-height: 0;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1336
1358
|
.vuiChatTurn {
|
|
1337
1359
|
position: relative;
|
|
1338
1360
|
left: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectara/vectara-ui",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.0",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"description": "Vectara's design system, codified as a React and Sass component library",
|
|
6
6
|
"author": "Vectara",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"CHANGELOG.md"
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
|
-
"start": "PORT=2000 react-scripts start",
|
|
35
|
-
"buildDocs": "BUILD_PATH='./docs/public' PUBLIC_URL='.' react-scripts build",
|
|
34
|
+
"start": "REACT_APP_VUI_VERSION=$npm_package_version PORT=2000 react-scripts start",
|
|
35
|
+
"buildDocs": "REACT_APP_VUI_VERSION=$npm_package_version BUILD_PATH='./docs/public' PUBLIC_URL='.' react-scripts build",
|
|
36
36
|
"test": "react-scripts test",
|
|
37
37
|
"eject": "react-scripts eject",
|
|
38
38
|
"build": "npx tsc --project tsconfig.lib.json && npm run copyStyleUtils && npm run copyComponentStyles && npm run compileCss",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"react-icons": "^4.10.1",
|
|
63
63
|
"react-scripts": "^5.0.1",
|
|
64
64
|
"react-tooltip": "^5.30.0",
|
|
65
|
+
"recharts": "^3.8.1",
|
|
65
66
|
"sonner": "^2.0.6",
|
|
66
67
|
"web-vitals": "^2.1.4"
|
|
67
68
|
},
|
package/src/docs/Docs.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
VuiAppLayout,
|
|
11
11
|
VuiButtonSecondary,
|
|
12
12
|
VuiContextProvider,
|
|
13
|
+
VuiBadge,
|
|
13
14
|
LinkProps
|
|
14
15
|
} from "../lib";
|
|
15
16
|
import { HeaderLogo } from "./components/HeaderLogo";
|
|
@@ -18,6 +19,9 @@ import { Home } from "./Home";
|
|
|
18
19
|
import { Page } from "./Page";
|
|
19
20
|
import "./index.scss";
|
|
20
21
|
|
|
22
|
+
// Baked in at build time from package.json via the REACT_APP_VUI_VERSION env var.
|
|
23
|
+
const VUI_VERSION = process.env.REACT_APP_VUI_VERSION;
|
|
24
|
+
|
|
21
25
|
export const Docs = () => {
|
|
22
26
|
return (
|
|
23
27
|
<Router>
|
|
@@ -67,6 +71,12 @@ const DocsContent = () => {
|
|
|
67
71
|
</VuiTitle>
|
|
68
72
|
</VuiFlexItem>
|
|
69
73
|
|
|
74
|
+
{VUI_VERSION && (
|
|
75
|
+
<VuiFlexItem grow={false} shrink={false}>
|
|
76
|
+
<VuiBadge color="neutral">{`v${VUI_VERSION}`}</VuiBadge>
|
|
77
|
+
</VuiFlexItem>
|
|
78
|
+
)}
|
|
79
|
+
|
|
70
80
|
<VuiFlexItem grow={false} shrink={false}>
|
|
71
81
|
<VuiButtonSecondary size="s" color="neutral" href="/">
|
|
72
82
|
Home
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VuiBarChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ quarter: "Q1", queries: 4200, documents: 1800 },
|
|
5
|
+
{ quarter: "Q2", queries: 5100, documents: 2400 },
|
|
6
|
+
{ quarter: "Q3", queries: 6800, documents: 3100 },
|
|
7
|
+
{ quarter: "Q4", queries: 7400, documents: 3600 }
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const Basic = () => {
|
|
11
|
+
return (
|
|
12
|
+
<VuiBarChart
|
|
13
|
+
data={data}
|
|
14
|
+
categoryKey="quarter"
|
|
15
|
+
series={[
|
|
16
|
+
{ dataKey: "queries", name: "Queries" },
|
|
17
|
+
{ dataKey: "documents", name: "Documents" }
|
|
18
|
+
]}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VuiBarChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ source: "Documentation", count: 3200 },
|
|
5
|
+
{ source: "Blog", count: 2100 },
|
|
6
|
+
{ source: "Support tickets", count: 1450 },
|
|
7
|
+
{ source: "Forums", count: 980 },
|
|
8
|
+
{ source: "Release notes", count: 540 }
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const Horizontal = () => {
|
|
12
|
+
return (
|
|
13
|
+
<VuiBarChart
|
|
14
|
+
data={data}
|
|
15
|
+
categoryKey="source"
|
|
16
|
+
orientation="bars"
|
|
17
|
+
series={[{ dataKey: "count", name: "Indexed documents", color: "teal" }]}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VuiBarChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ team: "Search", shipped: 12, inProgress: 5, planned: 8 },
|
|
5
|
+
{ team: "Platform", shipped: 9, inProgress: 7, planned: 4 },
|
|
6
|
+
{ team: "Growth", shipped: 6, inProgress: 3, planned: 9 },
|
|
7
|
+
{ team: "Docs", shipped: 4, inProgress: 2, planned: 3 }
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const Stacked = () => {
|
|
11
|
+
return (
|
|
12
|
+
<VuiBarChart
|
|
13
|
+
data={data}
|
|
14
|
+
categoryKey="team"
|
|
15
|
+
stacked
|
|
16
|
+
series={[
|
|
17
|
+
{ dataKey: "shipped", name: "Shipped" },
|
|
18
|
+
{ dataKey: "inProgress", name: "In progress" },
|
|
19
|
+
{ dataKey: "planned", name: "Planned" }
|
|
20
|
+
]}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Basic } from "./Basic";
|
|
2
|
+
import { Stacked } from "./Stacked";
|
|
3
|
+
import { Horizontal } from "./Horizontal";
|
|
4
|
+
|
|
5
|
+
const BasicSource = require("!!raw-loader!./Basic");
|
|
6
|
+
const StackedSource = require("!!raw-loader!./Stacked");
|
|
7
|
+
const HorizontalSource = require("!!raw-loader!./Horizontal");
|
|
8
|
+
|
|
9
|
+
export const barChart = {
|
|
10
|
+
name: "Bar chart",
|
|
11
|
+
path: "/bar-chart",
|
|
12
|
+
examples: [
|
|
13
|
+
{
|
|
14
|
+
name: "Basic",
|
|
15
|
+
component: <Basic />,
|
|
16
|
+
source: BasicSource.default.toString()
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "Stacked",
|
|
20
|
+
component: <Stacked />,
|
|
21
|
+
source: StackedSource.default.toString()
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "Horizontal",
|
|
25
|
+
component: <Horizontal />,
|
|
26
|
+
source: HorizontalSource.default.toString()
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { VuiCopyButton, VuiFlexContainer, VuiFlexItem, VuiSpacer, VuiText, VuiTextColor } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
// Chart colors are an ordered palette for plotting data series, distinct from the categorical chip hues.
|
|
4
|
+
// Each entry differs from its neighbors in both hue and luminance, so series stay distinguishable under
|
|
5
|
+
// color vision deficiency and in grayscale. The palette is capped at eight — the practical limit for
|
|
6
|
+
// telling categories apart by color alone.
|
|
7
|
+
const chartColors = [
|
|
8
|
+
{ name: "Chart 1", variable: "--vui-chart-1", description: "Blue" },
|
|
9
|
+
{ name: "Chart 2", variable: "--vui-chart-2", description: "Orange" },
|
|
10
|
+
{ name: "Chart 3", variable: "--vui-chart-3", description: "Teal-green" },
|
|
11
|
+
{ name: "Chart 4", variable: "--vui-chart-4", description: "Mauve" },
|
|
12
|
+
{ name: "Chart 5", variable: "--vui-chart-5", description: "Sky" },
|
|
13
|
+
{ name: "Chart 6", variable: "--vui-chart-6", description: "Vermillion" },
|
|
14
|
+
{ name: "Chart 7", variable: "--vui-chart-7", description: "Gold" },
|
|
15
|
+
{ name: "Chart 8", variable: "--vui-chart-8", description: "Slate" }
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export const ChartColors = () => {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
<VuiText>
|
|
22
|
+
<p>
|
|
23
|
+
<VuiTextColor color="subdued">
|
|
24
|
+
An ordered palette for data visualization, assigned to series in sequence. Each color contrasts
|
|
25
|
+
with its neighbors in both hue and lightness, keeping series distinct for color-blind readers and
|
|
26
|
+
in grayscale. Use no more than eight; beyond that, group categories or add a non-color cue such as
|
|
27
|
+
a pattern or direct label.
|
|
28
|
+
</VuiTextColor>
|
|
29
|
+
</p>
|
|
30
|
+
</VuiText>
|
|
31
|
+
|
|
32
|
+
<VuiSpacer size="l" />
|
|
33
|
+
|
|
34
|
+
<VuiFlexContainer spacing="l" wrap>
|
|
35
|
+
{chartColors.map(({ name, variable, description }) => (
|
|
36
|
+
<VuiFlexItem grow={false} key={name}>
|
|
37
|
+
<div style={{ width: 160 }}>
|
|
38
|
+
{/* A solid swatch in the series color. */}
|
|
39
|
+
<div style={{ height: 64, borderRadius: 6, backgroundColor: `var(${variable})` }} />
|
|
40
|
+
|
|
41
|
+
<VuiSpacer size="s" />
|
|
42
|
+
|
|
43
|
+
<VuiText size="xs">
|
|
44
|
+
<p>
|
|
45
|
+
<strong>{name}</strong> <VuiTextColor color="subdued">{description}</VuiTextColor>
|
|
46
|
+
</p>
|
|
47
|
+
</VuiText>
|
|
48
|
+
|
|
49
|
+
<VuiFlexContainer alignItems="center" spacing="xs" justifyContent="spaceBetween">
|
|
50
|
+
<VuiFlexItem grow={false}>
|
|
51
|
+
<VuiText size="xs">
|
|
52
|
+
<p>
|
|
53
|
+
<code>{variable}</code>
|
|
54
|
+
</p>
|
|
55
|
+
</VuiText>
|
|
56
|
+
</VuiFlexItem>
|
|
57
|
+
|
|
58
|
+
<VuiFlexItem grow={false}>
|
|
59
|
+
<VuiCopyButton size="xs" value={`var(${variable})`} title={`Copy var(${variable})`} />
|
|
60
|
+
</VuiFlexItem>
|
|
61
|
+
</VuiFlexContainer>
|
|
62
|
+
</div>
|
|
63
|
+
</VuiFlexItem>
|
|
64
|
+
))}
|
|
65
|
+
</VuiFlexContainer>
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Usage } from "./Usage";
|
|
2
2
|
import { SemanticColors } from "./SemanticColors";
|
|
3
3
|
import { CategoricalColors } from "./CategoricalColors";
|
|
4
|
+
import { ChartColors } from "./ChartColors";
|
|
4
5
|
import { NeutralColors } from "./NeutralColors";
|
|
5
6
|
import { TextAndBorderColors } from "./TextAndBorderColors";
|
|
6
7
|
|
|
7
8
|
const UsageSource = require("!!raw-loader!./Usage");
|
|
8
9
|
const SemanticColorsSource = require("!!raw-loader!./SemanticColors");
|
|
9
10
|
const CategoricalColorsSource = require("!!raw-loader!./CategoricalColors");
|
|
11
|
+
const ChartColorsSource = require("!!raw-loader!./ChartColors");
|
|
10
12
|
const NeutralColorsSource = require("!!raw-loader!./NeutralColors");
|
|
11
13
|
const TextAndBorderColorsSource = require("!!raw-loader!./TextAndBorderColors");
|
|
12
14
|
|
|
@@ -29,6 +31,11 @@ export const colorPalette = {
|
|
|
29
31
|
component: <CategoricalColors />,
|
|
30
32
|
source: CategoricalColorsSource.default.toString()
|
|
31
33
|
},
|
|
34
|
+
{
|
|
35
|
+
name: "Chart colors",
|
|
36
|
+
component: <ChartColors />,
|
|
37
|
+
source: ChartColorsSource.default.toString()
|
|
38
|
+
},
|
|
32
39
|
{
|
|
33
40
|
name: "Neutral and special colors",
|
|
34
41
|
component: <NeutralColors />,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VuiComposedChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
// Query volume (bars, left axis) overlaid with p95 latency (line, right axis) — two metrics on
|
|
4
|
+
// different scales sharing one chart.
|
|
5
|
+
const data = [
|
|
6
|
+
{ month: "Jan", queries: 4200, latency: 180 },
|
|
7
|
+
{ month: "Feb", queries: 5100, latency: 172 },
|
|
8
|
+
{ month: "Mar", queries: 6800, latency: 165 },
|
|
9
|
+
{ month: "Apr", queries: 7400, latency: 158 },
|
|
10
|
+
{ month: "May", queries: 8200, latency: 150 },
|
|
11
|
+
{ month: "Jun", queries: 9100, latency: 142 }
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const Basic = () => {
|
|
15
|
+
return (
|
|
16
|
+
<VuiComposedChart
|
|
17
|
+
data={data}
|
|
18
|
+
categoryKey="month"
|
|
19
|
+
series={[
|
|
20
|
+
{ dataKey: "queries", name: "Queries", type: "bar", axis: "left" },
|
|
21
|
+
{ dataKey: "latency", name: "p95 latency (ms)", type: "line", axis: "right", curved: true }
|
|
22
|
+
]}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VuiComposedChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
// Request volume (bars, left axis) against p95 latency (line, right axis). The
|
|
4
|
+
// two axes measure different units, so each gets its own value formatter — and
|
|
5
|
+
// the shared tooltip formats each row by the axis its series belongs to.
|
|
6
|
+
const data = [
|
|
7
|
+
{ time: "10:00", requests: 4200, latency: 820 },
|
|
8
|
+
{ time: "10:05", requests: 5100, latency: 1240 },
|
|
9
|
+
{ time: "10:10", requests: 6800, latency: 980 },
|
|
10
|
+
{ time: "10:15", requests: 7400, latency: 2100 },
|
|
11
|
+
{ time: "10:20", requests: 8200, latency: 1560 },
|
|
12
|
+
{ time: "10:25", requests: 9100, latency: 1180 }
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const formatCount = (value: number) => (value >= 1000 ? `${(value / 1000).toFixed(1)}k` : `${value}`);
|
|
16
|
+
|
|
17
|
+
const formatMs = (ms: number) => (ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${ms}ms`);
|
|
18
|
+
|
|
19
|
+
export const FormattedAxes = () => {
|
|
20
|
+
return (
|
|
21
|
+
<VuiComposedChart
|
|
22
|
+
data={data}
|
|
23
|
+
categoryKey="time"
|
|
24
|
+
formatLeftValue={formatCount}
|
|
25
|
+
formatRightValue={formatMs}
|
|
26
|
+
series={[
|
|
27
|
+
{ dataKey: "requests", name: "Requests", type: "bar", axis: "left" },
|
|
28
|
+
{ dataKey: "latency", name: "p95 latency", type: "line", axis: "right", curved: true }
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Basic } from "./Basic";
|
|
2
|
+
import { FormattedAxes } from "./FormattedAxes";
|
|
3
|
+
|
|
4
|
+
const BasicSource = require("!!raw-loader!./Basic");
|
|
5
|
+
const FormattedAxesSource = require("!!raw-loader!./FormattedAxes");
|
|
6
|
+
|
|
7
|
+
export const composedChart = {
|
|
8
|
+
name: "Composed chart",
|
|
9
|
+
path: "/composed-chart",
|
|
10
|
+
examples: [
|
|
11
|
+
{
|
|
12
|
+
name: "Basic",
|
|
13
|
+
component: <Basic />,
|
|
14
|
+
source: BasicSource.default.toString()
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "Formatted axes",
|
|
18
|
+
component: <FormattedAxes />,
|
|
19
|
+
source: FormattedAxesSource.default.toString()
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VuiLineChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ month: "Jan", storage: 120, bandwidth: 80 },
|
|
5
|
+
{ month: "Feb", storage: 180, bandwidth: 110 },
|
|
6
|
+
{ month: "Mar", storage: 240, bandwidth: 140 },
|
|
7
|
+
{ month: "Apr", storage: 320, bandwidth: 200 },
|
|
8
|
+
{ month: "May", storage: 410, bandwidth: 260 },
|
|
9
|
+
{ month: "Jun", storage: 520, bandwidth: 300 }
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export const Area = () => {
|
|
13
|
+
return (
|
|
14
|
+
<VuiLineChart
|
|
15
|
+
data={data}
|
|
16
|
+
categoryKey="month"
|
|
17
|
+
variant="area"
|
|
18
|
+
curved
|
|
19
|
+
series={[
|
|
20
|
+
{ dataKey: "storage", name: "Storage (GB)" },
|
|
21
|
+
{ dataKey: "bandwidth", name: "Bandwidth (GB)" }
|
|
22
|
+
]}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VuiLineChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ month: "Jan", queries: 4200, documents: 1800 },
|
|
5
|
+
{ month: "Feb", queries: 4800, documents: 2100 },
|
|
6
|
+
{ month: "Mar", queries: 4500, documents: 2600 },
|
|
7
|
+
{ month: "Apr", queries: 6100, documents: 2900 },
|
|
8
|
+
{ month: "May", queries: 6800, documents: 3400 },
|
|
9
|
+
{ month: "Jun", queries: 7400, documents: 3600 }
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export const Basic = () => {
|
|
13
|
+
return (
|
|
14
|
+
<VuiLineChart
|
|
15
|
+
data={data}
|
|
16
|
+
categoryKey="month"
|
|
17
|
+
series={[
|
|
18
|
+
{ dataKey: "queries", name: "Queries" },
|
|
19
|
+
{ dataKey: "documents", name: "Documents" }
|
|
20
|
+
]}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VuiLineChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ day: "Mon", p50: 120, p95: 320 },
|
|
5
|
+
{ day: "Tue", p50: 132, p95: 410 },
|
|
6
|
+
{ day: "Wed", p50: 101, p95: 280 },
|
|
7
|
+
{ day: "Thu", p50: 148, p95: 460 },
|
|
8
|
+
{ day: "Fri", p50: 160, p95: 520 },
|
|
9
|
+
{ day: "Sat", p50: 90, p95: 240 },
|
|
10
|
+
{ day: "Sun", p50: 85, p95: 210 }
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const Curved = () => {
|
|
14
|
+
return (
|
|
15
|
+
<VuiLineChart
|
|
16
|
+
data={data}
|
|
17
|
+
categoryKey="day"
|
|
18
|
+
curved
|
|
19
|
+
series={[
|
|
20
|
+
{ dataKey: "p50", name: "p50 latency (ms)" },
|
|
21
|
+
{ dataKey: "p95", name: "p95 latency (ms)" }
|
|
22
|
+
]}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VuiLineChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ time: "10:00", latency: 820 },
|
|
5
|
+
{ time: "10:05", latency: 1240 },
|
|
6
|
+
{ time: "10:10", latency: 980 },
|
|
7
|
+
{ time: "10:15", latency: 2100 },
|
|
8
|
+
{ time: "10:20", latency: 1560 },
|
|
9
|
+
{ time: "10:25", latency: 1180 }
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
// formatValue formats both the value-axis ticks and the tooltip readout, so raw
|
|
13
|
+
// millisecond values render as human-readable durations.
|
|
14
|
+
const formatMs = (ms: number) => (ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${ms}ms`);
|
|
15
|
+
|
|
16
|
+
export const FormattedValues = () => {
|
|
17
|
+
return (
|
|
18
|
+
<VuiLineChart
|
|
19
|
+
data={data}
|
|
20
|
+
categoryKey="time"
|
|
21
|
+
formatValue={formatMs}
|
|
22
|
+
series={[{ dataKey: "latency", name: "Latency" }]}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VuiLineChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
// Search starts well above generation, then the two cross around March as generation overtakes it —
|
|
4
|
+
// in a stacked area, the bottom band thins while the top band thickens.
|
|
5
|
+
const data = [
|
|
6
|
+
{ month: "Jan", search: 5200, generation: 1000 },
|
|
7
|
+
{ month: "Feb", search: 4300, generation: 1800 },
|
|
8
|
+
{ month: "Mar", search: 3400, generation: 2700 },
|
|
9
|
+
{ month: "Apr", search: 2600, generation: 3600 },
|
|
10
|
+
{ month: "May", search: 1800, generation: 4500 },
|
|
11
|
+
{ month: "Jun", search: 1100, generation: 5400 }
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const StackedArea = () => {
|
|
15
|
+
return (
|
|
16
|
+
<VuiLineChart
|
|
17
|
+
data={data}
|
|
18
|
+
categoryKey="month"
|
|
19
|
+
variant="stacked-area"
|
|
20
|
+
curved
|
|
21
|
+
series={[
|
|
22
|
+
{ dataKey: "search", name: "Search" },
|
|
23
|
+
{ dataKey: "generation", name: "Generation" }
|
|
24
|
+
]}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { VuiBarChart, VuiLineChart, VuiSpacer } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
// The two charts cover the same timeline at different resolutions. Hovering
|
|
4
|
+
// either one highlights the matching timestamp on both. syncMethod "value"
|
|
5
|
+
// aligns by the x-axis value rather than by data index, which is what lets
|
|
6
|
+
// charts with differing point counts stay in step.
|
|
7
|
+
const latency = [
|
|
8
|
+
{ time: "10:00", p95: 320 },
|
|
9
|
+
{ time: "10:10", p95: 280 },
|
|
10
|
+
{ time: "10:20", p95: 460 },
|
|
11
|
+
{ time: "10:30", p95: 240 }
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const requests = [
|
|
15
|
+
{ time: "10:00", requests: 1200 },
|
|
16
|
+
{ time: "10:05", requests: 1800 },
|
|
17
|
+
{ time: "10:10", requests: 1500 },
|
|
18
|
+
{ time: "10:15", requests: 2100 },
|
|
19
|
+
{ time: "10:20", requests: 1900 },
|
|
20
|
+
{ time: "10:25", requests: 1700 },
|
|
21
|
+
{ time: "10:30", requests: 1400 }
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const SYNC_ID = "trafficDemo";
|
|
25
|
+
|
|
26
|
+
export const Synced = () => {
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<VuiLineChart
|
|
30
|
+
data={latency}
|
|
31
|
+
categoryKey="time"
|
|
32
|
+
syncId={SYNC_ID}
|
|
33
|
+
syncMethod="value"
|
|
34
|
+
height={200}
|
|
35
|
+
series={[{ dataKey: "p95", name: "p95 latency (ms)" }]}
|
|
36
|
+
/>
|
|
37
|
+
<VuiSpacer size="m" />
|
|
38
|
+
<VuiBarChart
|
|
39
|
+
data={requests}
|
|
40
|
+
categoryKey="time"
|
|
41
|
+
syncId={SYNC_ID}
|
|
42
|
+
syncMethod="value"
|
|
43
|
+
height={200}
|
|
44
|
+
series={[{ dataKey: "requests", name: "Requests" }]}
|
|
45
|
+
/>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Basic } from "./Basic";
|
|
2
|
+
import { Curved } from "./Curved";
|
|
3
|
+
import { Area } from "./Area";
|
|
4
|
+
import { StackedArea } from "./StackedArea";
|
|
5
|
+
import { FormattedValues } from "./FormattedValues";
|
|
6
|
+
import { Synced } from "./Synced";
|
|
7
|
+
|
|
8
|
+
const BasicSource = require("!!raw-loader!./Basic");
|
|
9
|
+
const CurvedSource = require("!!raw-loader!./Curved");
|
|
10
|
+
const AreaSource = require("!!raw-loader!./Area");
|
|
11
|
+
const StackedAreaSource = require("!!raw-loader!./StackedArea");
|
|
12
|
+
const FormattedValuesSource = require("!!raw-loader!./FormattedValues");
|
|
13
|
+
const SyncedSource = require("!!raw-loader!./Synced");
|
|
14
|
+
|
|
15
|
+
export const lineChart = {
|
|
16
|
+
name: "Line chart",
|
|
17
|
+
path: "/line-chart",
|
|
18
|
+
examples: [
|
|
19
|
+
{
|
|
20
|
+
name: "Basic",
|
|
21
|
+
component: <Basic />,
|
|
22
|
+
source: BasicSource.default.toString()
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "Curved",
|
|
26
|
+
component: <Curved />,
|
|
27
|
+
source: CurvedSource.default.toString()
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "Area",
|
|
31
|
+
component: <Area />,
|
|
32
|
+
source: AreaSource.default.toString()
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "Stacked area",
|
|
36
|
+
component: <StackedArea />,
|
|
37
|
+
source: StackedAreaSource.default.toString()
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "Formatted values",
|
|
41
|
+
component: <FormattedValues />,
|
|
42
|
+
source: FormattedValuesSource.default.toString()
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Synced",
|
|
46
|
+
component: <Synced />,
|
|
47
|
+
source: SyncedSource.default.toString()
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VuiPieChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ source: "Documentation", count: 3200 },
|
|
5
|
+
{ source: "Blog", count: 2100 },
|
|
6
|
+
{ source: "Support tickets", count: 1450 },
|
|
7
|
+
{ source: "Forums", count: 980 },
|
|
8
|
+
{ source: "Release notes", count: 540 }
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const Basic = () => {
|
|
12
|
+
return <VuiPieChart data={data} categoryKey="source" valueKey="count" />;
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VuiPieChart } from "../../../lib";
|
|
2
|
+
|
|
3
|
+
const data = [
|
|
4
|
+
{ plan: "Free", accounts: 5400 },
|
|
5
|
+
{ plan: "Pro", accounts: 2300 },
|
|
6
|
+
{ plan: "Scale", accounts: 820 },
|
|
7
|
+
{ plan: "Enterprise", accounts: 310 }
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const Donut = () => {
|
|
11
|
+
return <VuiPieChart data={data} categoryKey="plan" valueKey="accounts" donut />;
|
|
12
|
+
};
|