@vectara/vectara-ui 19.0.0 → 19.1.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.
Files changed (54) hide show
  1. package/lib/components/chart/BarChart.d.ts +20 -0
  2. package/lib/components/chart/BarChart.js +28 -0
  3. package/lib/components/chart/ComposedChart.d.ts +21 -0
  4. package/lib/components/chart/ComposedChart.js +29 -0
  5. package/lib/components/chart/LineChart.d.ts +22 -0
  6. package/lib/components/chart/LineChart.js +42 -0
  7. package/lib/components/chart/PieChart.d.ts +15 -0
  8. package/lib/components/chart/PieChart.js +36 -0
  9. package/lib/components/chart/ScatterChart.d.ts +18 -0
  10. package/lib/components/chart/ScatterChart.js +34 -0
  11. package/lib/components/chart/Sparkline.d.ts +13 -0
  12. package/lib/components/chart/Sparkline.js +23 -0
  13. package/lib/components/chart/TreeMap.d.ts +13 -0
  14. package/lib/components/chart/TreeMap.js +51 -0
  15. package/lib/components/chart/_index.scss +19 -0
  16. package/lib/components/chart/chartTheme.d.ts +21 -0
  17. package/lib/components/chart/chartTheme.js +13 -0
  18. package/lib/components/chart/palette.d.ts +5 -0
  19. package/lib/components/chart/palette.js +29 -0
  20. package/lib/components/context/Theme.d.ts +8 -0
  21. package/lib/components/context/Theme.js +40 -3
  22. package/lib/components/index.d.ts +10 -2
  23. package/lib/components/index.js +9 -1
  24. package/lib/styles/index.css +22 -0
  25. package/package.json +4 -3
  26. package/src/docs/Docs.tsx +10 -0
  27. package/src/docs/pages/barChart/Basic.tsx +21 -0
  28. package/src/docs/pages/barChart/Horizontal.tsx +20 -0
  29. package/src/docs/pages/barChart/Stacked.tsx +23 -0
  30. package/src/docs/pages/barChart/index.tsx +29 -0
  31. package/src/docs/pages/colorPalette/ChartColors.tsx +68 -0
  32. package/src/docs/pages/colorPalette/index.tsx +7 -0
  33. package/src/docs/pages/composedChart/Basic.tsx +25 -0
  34. package/src/docs/pages/composedChart/index.tsx +15 -0
  35. package/src/docs/pages/lineChart/Area.tsx +25 -0
  36. package/src/docs/pages/lineChart/Basic.tsx +23 -0
  37. package/src/docs/pages/lineChart/Curved.tsx +25 -0
  38. package/src/docs/pages/lineChart/StackedArea.tsx +27 -0
  39. package/src/docs/pages/lineChart/index.tsx +36 -0
  40. package/src/docs/pages/pieChart/Basic.tsx +13 -0
  41. package/src/docs/pages/pieChart/Donut.tsx +12 -0
  42. package/src/docs/pages/pieChart/ManyValues.tsx +51 -0
  43. package/src/docs/pages/pieChart/Unlabeled.tsx +15 -0
  44. package/src/docs/pages/pieChart/index.tsx +36 -0
  45. package/src/docs/pages/scatterChart/Basic.tsx +31 -0
  46. package/src/docs/pages/scatterChart/Dense.tsx +144 -0
  47. package/src/docs/pages/scatterChart/index.tsx +22 -0
  48. package/src/docs/pages/sparkline/Basic.tsx +7 -0
  49. package/src/docs/pages/sparkline/Inline.tsx +21 -0
  50. package/src/docs/pages/sparkline/index.tsx +22 -0
  51. package/src/docs/pages/treeMap/Basic.tsx +14 -0
  52. package/src/docs/pages/treeMap/Nested.tsx +88 -0
  53. package/src/docs/pages/treeMap/index.tsx +22 -0
  54. package/src/docs/pages.tsx +11 -0
@@ -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 };
@@ -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.0.0",
3
+ "version": "19.1.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,15 @@
1
+ import { Basic } from "./Basic";
2
+
3
+ const BasicSource = require("!!raw-loader!./Basic");
4
+
5
+ export const composedChart = {
6
+ name: "Composed chart",
7
+ path: "/composed-chart",
8
+ examples: [
9
+ {
10
+ name: "Basic",
11
+ component: <Basic />,
12
+ source: BasicSource.default.toString()
13
+ }
14
+ ]
15
+ };
@@ -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,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,36 @@
1
+ import { Basic } from "./Basic";
2
+ import { Curved } from "./Curved";
3
+ import { Area } from "./Area";
4
+ import { StackedArea } from "./StackedArea";
5
+
6
+ const BasicSource = require("!!raw-loader!./Basic");
7
+ const CurvedSource = require("!!raw-loader!./Curved");
8
+ const AreaSource = require("!!raw-loader!./Area");
9
+ const StackedAreaSource = require("!!raw-loader!./StackedArea");
10
+
11
+ export const lineChart = {
12
+ name: "Line chart",
13
+ path: "/line-chart",
14
+ examples: [
15
+ {
16
+ name: "Basic",
17
+ component: <Basic />,
18
+ source: BasicSource.default.toString()
19
+ },
20
+ {
21
+ name: "Curved",
22
+ component: <Curved />,
23
+ source: CurvedSource.default.toString()
24
+ },
25
+ {
26
+ name: "Area",
27
+ component: <Area />,
28
+ source: AreaSource.default.toString()
29
+ },
30
+ {
31
+ name: "Stacked area",
32
+ component: <StackedArea />,
33
+ source: StackedAreaSource.default.toString()
34
+ }
35
+ ]
36
+ };
@@ -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
+ };
@@ -0,0 +1,51 @@
1
+ import { VuiPieChart, VuiSpacer, VuiText, VuiTextColor } from "../../../lib";
2
+
3
+ // 24 categories exceed what a pie can show well. The palette shifts lightness on each wrap so the
4
+ // repeated hues stay distinct, but the wedges are still too thin to compare. Prefer grouping the long
5
+ // tail into an "Other" slice, or switch to a sorted bar chart.
6
+ const data = [
7
+ { label: "Category 1", value: 100 },
8
+ { label: "Category 2", value: 97 },
9
+ { label: "Category 3", value: 94 },
10
+ { label: "Category 4", value: 91 },
11
+ { label: "Category 5", value: 88 },
12
+ { label: "Category 6", value: 85 },
13
+ { label: "Category 7", value: 82 },
14
+ { label: "Category 8", value: 79 },
15
+ { label: "Category 9", value: 76 },
16
+ { label: "Category 10", value: 73 },
17
+ { label: "Category 11", value: 70 },
18
+ { label: "Category 12", value: 67 },
19
+ { label: "Category 13", value: 64 },
20
+ { label: "Category 14", value: 61 },
21
+ { label: "Category 15", value: 58 },
22
+ { label: "Category 16", value: 55 },
23
+ { label: "Category 17", value: 52 },
24
+ { label: "Category 18", value: 49 },
25
+ { label: "Category 19", value: 46 },
26
+ { label: "Category 20", value: 43 },
27
+ { label: "Category 21", value: 40 },
28
+ { label: "Category 22", value: 37 },
29
+ { label: "Category 23", value: 34 },
30
+ { label: "Category 24", value: 31 }
31
+ ];
32
+
33
+ export const ManyValues = () => {
34
+ return (
35
+ <>
36
+ <VuiText size="xs">
37
+ <p>
38
+ <VuiTextColor color="subdued">
39
+ The colors no longer repeat exactly. Each wraps past the eighth slice shifts lightness, but the wedges are
40
+ still too thin to compare. Avoid pies with this many categories. Group the long tail into an "Other" slice,
41
+ or switch to a sorted bar chart.
42
+ </VuiTextColor>
43
+ </p>
44
+ </VuiText>
45
+
46
+ <VuiSpacer size="s" />
47
+
48
+ <VuiPieChart data={data} categoryKey="label" valueKey="value" showLabels={false} height={420} />
49
+ </>
50
+ );
51
+ };
@@ -0,0 +1,15 @@
1
+ import { VuiPieChart } from "../../../lib";
2
+
3
+ // With many slices, outside labels overlap, so hide them and rely on the legend and tooltip.
4
+ const data = [
5
+ { region: "North America", revenue: 4200 },
6
+ { region: "Europe", revenue: 3100 },
7
+ { region: "Asia Pacific", revenue: 2400 },
8
+ { region: "Latin America", revenue: 1200 },
9
+ { region: "Middle East", revenue: 760 },
10
+ { region: "Africa", revenue: 480 }
11
+ ];
12
+
13
+ export const Unlabeled = () => {
14
+ return <VuiPieChart data={data} categoryKey="region" valueKey="revenue" showLabels={false} />;
15
+ };
@@ -0,0 +1,36 @@
1
+ import { Basic } from "./Basic";
2
+ import { Donut } from "./Donut";
3
+ import { Unlabeled } from "./Unlabeled";
4
+ import { ManyValues } from "./ManyValues";
5
+
6
+ const BasicSource = require("!!raw-loader!./Basic");
7
+ const DonutSource = require("!!raw-loader!./Donut");
8
+ const UnlabeledSource = require("!!raw-loader!./Unlabeled");
9
+ const ManyValuesSource = require("!!raw-loader!./ManyValues");
10
+
11
+ export const pieChart = {
12
+ name: "Pie chart",
13
+ path: "/pie-chart",
14
+ examples: [
15
+ {
16
+ name: "Basic",
17
+ component: <Basic />,
18
+ source: BasicSource.default.toString()
19
+ },
20
+ {
21
+ name: "Donut",
22
+ component: <Donut />,
23
+ source: DonutSource.default.toString()
24
+ },
25
+ {
26
+ name: "Unlabeled",
27
+ component: <Unlabeled />,
28
+ source: UnlabeledSource.default.toString()
29
+ },
30
+ {
31
+ name: "Many values",
32
+ component: <ManyValues />,
33
+ source: ManyValuesSource.default.toString()
34
+ }
35
+ ]
36
+ };
@@ -0,0 +1,31 @@
1
+ import { VuiScatterChart } from "../../../lib";
2
+
3
+ // Each point pairs a model's response latency (x, ms) with its relevance score (y).
4
+ const modelA = [
5
+ { x: 120, y: 0.78 },
6
+ { x: 150, y: 0.81 },
7
+ { x: 180, y: 0.85 },
8
+ { x: 210, y: 0.88 },
9
+ { x: 240, y: 0.9 },
10
+ { x: 300, y: 0.92 }
11
+ ];
12
+
13
+ const modelB = [
14
+ { x: 90, y: 0.72 },
15
+ { x: 130, y: 0.75 },
16
+ { x: 170, y: 0.79 },
17
+ { x: 220, y: 0.83 },
18
+ { x: 260, y: 0.86 },
19
+ { x: 320, y: 0.89 }
20
+ ];
21
+
22
+ export const Basic = () => {
23
+ return (
24
+ <VuiScatterChart
25
+ series={[
26
+ { name: "Model A", data: modelA },
27
+ { name: "Model B", data: modelB }
28
+ ]}
29
+ />
30
+ );
31
+ };