@acronis-platform/ui-react 4.1.0 → 5.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 (79) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +191 -85
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  3. package/dist/components/ui/bar-chart/bar-chart.js +288 -225
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/card-widget-carousel/card-widget-carousel.js +85 -0
  6. package/dist/components/ui/card-widget-carousel/card-widget-carousel.js.map +1 -0
  7. package/dist/components/ui/card-widget-carousel/card-widget.js +82 -0
  8. package/dist/components/ui/card-widget-carousel/card-widget.js.map +1 -0
  9. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  10. package/dist/components/ui/chart/chart-format.js +25 -22
  11. package/dist/components/ui/chart/chart-format.js.map +1 -1
  12. package/dist/components/ui/chart/chart-palette.js +9 -8
  13. package/dist/components/ui/chart/chart-palette.js.map +1 -1
  14. package/dist/components/ui/chart/chart.js +127 -89
  15. package/dist/components/ui/chart/chart.js.map +1 -1
  16. package/dist/components/ui/funnel-chart/funnel-chart.js +189 -113
  17. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  18. package/dist/components/ui/input-select/input-select.js +18 -9
  19. package/dist/components/ui/input-select/input-select.js.map +1 -1
  20. package/dist/components/ui/line-chart/line-chart.js +194 -86
  21. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  22. package/dist/components/ui/radar-chart/radar-chart.js +76 -66
  23. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  24. package/dist/components/ui/scatter-chart/scatter-chart.js +5 -2
  25. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  26. package/dist/components/ui/separator/separator.js +52 -10
  27. package/dist/components/ui/separator/separator.js.map +1 -1
  28. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js +144 -121
  29. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
  30. package/dist/components/ui/tree-item/tree-item.js +67 -0
  31. package/dist/components/ui/tree-item/tree-item.js.map +1 -0
  32. package/dist/components/ui/treemap/treemap.js +73 -66
  33. package/dist/components/ui/treemap/treemap.js.map +1 -1
  34. package/dist/index.js +109 -107
  35. package/dist/llms/area-chart.md +2 -1
  36. package/dist/llms/bar-chart.md +132 -33
  37. package/dist/llms/card-widget-carousel.md +252 -0
  38. package/dist/llms/category-bar.md +2 -2
  39. package/dist/llms/funnel-chart.md +269 -101
  40. package/dist/llms/input-select.md +175 -1
  41. package/dist/llms/line-chart.md +2 -1
  42. package/dist/llms/metric.md +10 -5
  43. package/dist/llms/radar-chart.md +15 -5
  44. package/dist/llms/scatter-chart.md +2 -1
  45. package/dist/llms/separator.md +27 -8
  46. package/dist/llms/sidebar-secondary.md +235 -4
  47. package/dist/llms/tree-item.md +359 -0
  48. package/dist/llms/treemap.md +47 -36
  49. package/dist/llms.txt +5 -4
  50. package/dist/react.js +109 -107
  51. package/dist/src/components/ui/area-chart/area-chart.d.ts +10 -0
  52. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +75 -10
  53. package/dist/src/components/ui/bar-chart/bar-chart.docs.d.ts +146 -0
  54. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  55. package/dist/src/components/ui/card-widget-carousel/card-widget-carousel.d.ts +9 -0
  56. package/dist/src/components/ui/card-widget-carousel/card-widget.d.ts +43 -0
  57. package/dist/src/components/ui/card-widget-carousel/index.d.ts +2 -0
  58. package/dist/src/components/ui/chart/chart-format.d.ts +9 -1
  59. package/dist/src/components/ui/chart/chart-palette.d.ts +38 -10
  60. package/dist/src/components/ui/chart/chart.d.ts +8 -1
  61. package/dist/src/components/ui/chart/index.d.ts +2 -2
  62. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +92 -26
  63. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
  64. package/dist/src/components/ui/input-select/input-select.d.ts +34 -2
  65. package/dist/src/components/ui/line-chart/line-chart.d.ts +11 -1
  66. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +42 -9
  67. package/dist/src/components/ui/separator/separator.d.ts +9 -1
  68. package/dist/src/components/ui/sidebar-secondary/sidebar-secondary.d.ts +23 -3
  69. package/dist/src/components/ui/tree-item/index.d.ts +1 -0
  70. package/dist/src/components/ui/tree-item/tree-item.d.ts +64 -0
  71. package/dist/src/components/ui/treemap/treemap.d.ts +16 -5
  72. package/dist/src/index.d.ts +2 -1
  73. package/dist/ui-react.css +1 -1
  74. package/package.json +1 -1
  75. package/dist/components/ui/meter/meter.js +0 -79
  76. package/dist/components/ui/meter/meter.js.map +0 -1
  77. package/dist/llms/meter.md +0 -177
  78. package/dist/src/components/ui/meter/index.d.ts +0 -1
  79. package/dist/src/components/ui/meter/meter.d.ts +0 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acronis-platform/ui-react",
3
- "version": "4.1.0",
3
+ "version": "5.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/acronis/uikit.git",
@@ -1,79 +0,0 @@
1
- "use client";
2
- import { cn as e } from "../../../lib/utils.js";
3
- import { Tooltip as t, TooltipContent as n, TooltipTrigger as r } from "../tooltip/tooltip.js";
4
- import * as i from "react";
5
- import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
- import { Meter as c } from "@base-ui/react/meter";
7
- //#region src/components/ui/meter/meter.tsx
8
- var l = (e) => e.toLocaleString(), u = i.forwardRef(({ className: u, label: d, value: f, max: p = 100, color: m, valueFormatter: h = l, showTooltip: g = !0, tooltip: _, defaultOpen: v, ...y }, b) => {
9
- let x = p > 0 ? Math.round(f / p * 100) : 0, S = p > 0 ? p : 1, C = /* @__PURE__ */ s(c.Root, {
10
- value: f,
11
- max: S,
12
- "aria-valuemax": p,
13
- "aria-valuetext": `${h(f)} of ${h(p)} (${x}%)`,
14
- tabIndex: g ? 0 : void 0,
15
- className: e("flex w-full flex-col gap-1.5", u),
16
- ...y,
17
- children: [/* @__PURE__ */ s("div", {
18
- className: "flex items-baseline justify-between gap-2 text-sm leading-none",
19
- children: [/* @__PURE__ */ o(c.Label, {
20
- className: "truncate text-muted-foreground",
21
- children: d
22
- }), /* @__PURE__ */ s("span", {
23
- className: "shrink-0 tabular-nums",
24
- children: [/* @__PURE__ */ o("span", {
25
- className: "font-semibold text-foreground",
26
- children: h(f)
27
- }), /* @__PURE__ */ s("span", {
28
- className: "text-muted-foreground",
29
- children: [
30
- " · ",
31
- x,
32
- "%"
33
- ]
34
- })]
35
- })]
36
- }), /* @__PURE__ */ o(c.Track, {
37
- className: "h-2 w-full overflow-hidden rounded-full bg-input",
38
- children: /* @__PURE__ */ o(c.Indicator, {
39
- className: "rounded-full",
40
- style: { backgroundColor: m }
41
- })
42
- })]
43
- });
44
- return g ? /* @__PURE__ */ s(t, {
45
- defaultOpen: v,
46
- children: [/* @__PURE__ */ o(r, {
47
- ref: b,
48
- render: C
49
- }), /* @__PURE__ */ o(n, {
50
- className: e("border border-border bg-background text-foreground shadow-md", !_ && "flex items-center gap-2"),
51
- children: _ ?? /* @__PURE__ */ s(a, { children: [
52
- /* @__PURE__ */ o("span", {
53
- className: "size-2.5 shrink-0 rounded-full",
54
- style: { backgroundColor: m }
55
- }),
56
- /* @__PURE__ */ o("span", {
57
- className: "font-semibold",
58
- children: d
59
- }),
60
- /* @__PURE__ */ s("span", {
61
- className: "text-muted-foreground",
62
- children: [
63
- h(f),
64
- " of ",
65
- h(p),
66
- " · ",
67
- x,
68
- "%"
69
- ]
70
- })
71
- ] })
72
- })]
73
- }) : i.cloneElement(C, { ref: b });
74
- });
75
- u.displayName = "Meter";
76
- //#endregion
77
- export { u as Meter };
78
-
79
- //# sourceMappingURL=meter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meter.js","names":[],"sources":["../../../../src/components/ui/meter/meter.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Meter as MeterPrimitive } from '@base-ui/react/meter';\n\nimport { cn } from '@/lib/utils';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip';\n\n// A meter: a labelled bar showing a scalar value within a known range (a\n// fractional value / share), as opposed to `Progress` which tracks a task over\n// time — hence Base UI's Meter primitive (`role=\"meter\"`, mirroring the HTML\n// `<meter>` element). One row — label + `value · %` over a proportional track\n// bar — designed to be stacked into a ranked breakdown (a \"bar list\"). No new\n// tokens: the track reuses the shared `bg-input`, and the fill color is\n// caller-supplied per row (an existing `--ui-*` token); there is no chart\n// palette tier yet.\n\nconst defaultFormat = (value: number) => value.toLocaleString();\n\nexport interface MeterProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof MeterPrimitive.Root>,\n 'value' | 'color'\n > {\n /** Row label shown on the left. */\n label: string;\n /** The value this meter represents. */\n value: number;\n /** Upper bound of the range — the whole the value is a share of. */\n max?: number;\n /** Fill color for the bar — an existing semantic `--ui-*` token (or any CSS color). */\n color: string;\n /** Format the numeric value (label + tooltip). Defaults to `toLocaleString()`. */\n valueFormatter?: (value: number) => string;\n /** Show the hover tooltip (`label · value of max · %`). */\n showTooltip?: boolean;\n /**\n * Custom tooltip content — replaces the default (dot + label + `value of max\n * · %`) inside the same chart-style card. Ignored when `showTooltip` is false.\n */\n tooltip?: React.ReactNode;\n /** Render with the tooltip initially open (Base UI `defaultOpen`). */\n defaultOpen?: boolean;\n}\n\nconst Meter = React.forwardRef<HTMLDivElement, MeterProps>(\n (\n {\n className,\n label,\n value,\n max = 100,\n color,\n valueFormatter = defaultFormat,\n showTooltip = true,\n tooltip,\n defaultOpen,\n ...props\n },\n ref\n ) => {\n const pct = max > 0 ? Math.round((value / max) * 100) : 0;\n // Base UI derives the indicator width from value/max; a non-positive max\n // would divide by zero and leave the fill unspecified, so floor it at 1\n // (value is 0 for a degenerate row → a 0% fill that matches `pct`).\n const safeMax = max > 0 ? max : 1;\n\n const root = (\n <MeterPrimitive.Root\n value={value}\n max={safeMax}\n // Base UI derives aria-valuemax from the (clamped) max prop; override it\n // back to the real max so the numeric ARIA triad agrees with the\n // aria-valuetext / visible text on a degenerate max<=0 row.\n aria-valuemax={max}\n aria-valuetext={`${valueFormatter(value)} of ${valueFormatter(max)} (${pct}%)`}\n // When wrapped in a Tooltip the meter div is the trigger; make it\n // focusable so keyboard users can open the tooltip (hover-only\n // otherwise). Without a tooltip there's nothing to reveal on focus.\n tabIndex={showTooltip ? 0 : undefined}\n className={cn('flex w-full flex-col gap-1.5', className)}\n {...props}\n >\n <div className=\"flex items-baseline justify-between gap-2 text-sm leading-none\">\n <MeterPrimitive.Label className=\"truncate text-muted-foreground\">\n {label}\n </MeterPrimitive.Label>\n <span className=\"shrink-0 tabular-nums\">\n <span className=\"font-semibold text-foreground\">\n {valueFormatter(value)}\n </span>\n <span className=\"text-muted-foreground\"> · {pct}%</span>\n </span>\n </div>\n <MeterPrimitive.Track className=\"h-2 w-full overflow-hidden rounded-full bg-input\">\n {/* Base UI sizes the indicator from value/max; we only theme it. */}\n <MeterPrimitive.Indicator\n className=\"rounded-full\"\n style={{ backgroundColor: color }}\n />\n </MeterPrimitive.Track>\n </MeterPrimitive.Root>\n );\n\n if (!showTooltip) {\n return React.cloneElement(root, { ref });\n }\n\n return (\n <Tooltip defaultOpen={defaultOpen}>\n <TooltipTrigger\n // Base UI's Trigger ref is typed to its default <button>; the trigger\n // is the meter root (a div), so the runtime ref is that div.\n ref={ref as React.Ref<HTMLButtonElement>}\n render={root}\n />\n {/* Match the chart tooltip look (light card: border + surface + shadow),\n not the default dark bubble — this is a data-viz widget. The consumer\n can replace the inner content via `tooltip`. */}\n <TooltipContent\n className={cn(\n 'border border-border bg-background text-foreground shadow-md',\n !tooltip && 'flex items-center gap-2'\n )}\n >\n {tooltip ?? (\n <>\n <span\n className=\"size-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: color }}\n />\n <span className=\"font-semibold\">{label}</span>\n <span className=\"text-muted-foreground\">\n {valueFormatter(value)} of {valueFormatter(max)} · {pct}%\n </span>\n </>\n )}\n </TooltipContent>\n </Tooltip>\n );\n }\n);\nMeter.displayName = 'Meter';\n\nexport { Meter };\n"],"mappings":";;;;;;;AAiBA,IAAM,KAAiB,MAAkB,EAAM,eAAe,GA4BxD,IAAQ,EAAM,YAEhB,EACE,cACA,UACA,UACA,SAAM,KACN,UACA,oBAAiB,GACjB,iBAAc,IACd,YACA,gBACA,GAAG,KAEL,MACG;CACH,IAAM,IAAM,IAAM,IAAI,KAAK,MAAO,IAAQ,IAAO,GAAG,IAAI,GAIlD,IAAU,IAAM,IAAI,IAAM,GAE1B,IACJ,kBAAC,EAAe,MAAhB;EACS;EACP,KAAK;EAIL,iBAAe;EACf,kBAAgB,GAAG,EAAe,CAAK,EAAE,MAAM,EAAe,CAAG,EAAE,IAAI,EAAI;EAI3E,UAAU,IAAc,IAAI,KAAA;EAC5B,WAAW,EAAG,gCAAgC,CAAS;EACvD,GAAI;EAbN,UAAA,CAeE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,EAAe,OAAhB;IAAsB,WAAU;IAC7B,UAAA;GACmB,CAAA,GACtB,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,kBAAC,QAAD;KAAM,WAAU;KACb,UAAA,EAAe,CAAK;IACjB,CAAA,GACN,kBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA;MAAwC;MAAI;MAAI;KAAO;IACnD,CAAA,CAAA;GACH,CAAA,CAAA;EACL,CAAA,GAAA,kBAAC,EAAe,OAAhB;GAAsB,WAAU;GAE9B,UAAA,kBAAC,EAAe,WAAhB;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,EAAM;GACjC,CAAA;EACmB,CAAA,CACH;;CAOvB,OAJK,IAKH,kBAAC,GAAD;EAAsB;EAAtB,UAAA,CACE,kBAAC,GAAD;GAGO;GACL,QAAQ;EACT,CAAA,GAID,kBAAC,GAAD;GACE,WAAW,EACT,gEACA,CAAC,KAAW,yBACd;GAEC,UAAA,KACC,kBAAA,GAAA,EAAA,UAAA;IACE,kBAAC,QAAD;KACE,WAAU;KACV,OAAO,EAAE,iBAAiB,EAAM;IACjC,CAAA;IACD,kBAAC,QAAD;KAAM,WAAU;KAAiB,UAAA;IAAY,CAAA;IAC7C,kBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA;MACG,EAAe,CAAK;MAAE;MAAK,EAAe,CAAG;MAAE;MAAI;MAAI;KACpD;;GACN,EAAA,CAAA;EAEU,CAAA,CACT;MAjCF,EAAM,aAAa,GAAM,EAAE,OAAI,CAAC;AAmC3C,CACF;AACA,EAAM,cAAc"}
@@ -1,177 +0,0 @@
1
- # Meter
2
-
3
- > A labelled bar showing a scalar value within a known range — a fractional value / share (`role="meter"`, mirroring the HTML `<meter>` element), as opposed to `Progress` which tracks a task over time. One row: label + `value · %` over a proportional track bar, with a hover tooltip; designed to be stacked into a ranked breakdown (a "bar list"). Design-pending v1 (no `--ui-chart-*` palette; the fill color is caller-supplied per row).
4
-
5
- **Status:** draft · **Category:** data-display · **Since:** v0.58.0
6
-
7
- ## Import
8
-
9
- ```tsx
10
- import { Meter } from '@acronis-platform/ui-react'
11
- ```
12
-
13
- ## Quick example
14
-
15
- ```tsx
16
- <Meter
17
- label="Critical"
18
- value={6}
19
- max={29}
20
- color="var(--ui-background-status-strong-danger)"
21
- />
22
- ```
23
-
24
- A labelled proportional bar for a value within a known range — a fractional
25
- value / share. Built on Base UI's `Meter` (`role="meter"`, like the HTML
26
- `<meter>` element), as opposed to `Progress` / `ProgressCircle`, which track a
27
- task over time. One row: label + `value · %` over a track bar, with a hover
28
- tooltip; stack several to build a ranked breakdown (a "bar list").
29
-
30
- > **Design-pending v1.** No chart token tier yet, so the fill color is
31
- > **caller-supplied** per row via `color` (a dedicated `--ui-chart-*` data-viz
32
- > palette is a pending upstream design deliverable). The tooltip uses the
33
- > chart-tooltip look (light card). Code Connect deferred.
34
-
35
- ## When to use
36
-
37
- - One row of a **breakdown** — a category's value and its share of a total,
38
- with a proportional bar (severity split, top browsers, storage by type).
39
- - Stacked and sorted, as a ranked bar-list.
40
-
41
- ## When not to use
42
-
43
- - Task progress over time (uploads, loading) — use
44
- [`Progress`](/components/progress) / `ProgressCircle`.
45
- - Many categories compared without a part-to-whole reading — a bar chart.
46
-
47
- ## Example
48
-
49
- ```tsx
50
- import { Meter } from '@acronis-platform/ui-react';
51
-
52
- <Meter
53
- label="Critical"
54
- value={6}
55
- max={29}
56
- color="var(--ui-background-status-strong-danger)"
57
- />;
58
- ```
59
-
60
- Stack several sharing one `max` (the total), sorted by value, for a ranked
61
- breakdown:
62
-
63
- ```tsx
64
- const rows = [
65
- {
66
- label: 'High',
67
- value: 9,
68
- color: 'var(--ui-background-status-strong-warning)',
69
- },
70
- {
71
- label: 'Medium',
72
- value: 8,
73
- color: 'var(--ui-background-status-strong-info)',
74
- },
75
- {
76
- label: 'Critical',
77
- value: 6,
78
- color: 'var(--ui-background-status-strong-danger)',
79
- },
80
- ];
81
- const total = rows.reduce((sum, r) => sum + r.value, 0);
82
-
83
- <div className="flex flex-col gap-4">
84
- {rows
85
- .sort((a, b) => b.value - a.value)
86
- .map((r) => (
87
- <Meter
88
- key={r.label}
89
- label={r.label}
90
- value={r.value}
91
- max={total}
92
- color={r.color}
93
- />
94
- ))}
95
- </div>;
96
- ```
97
-
98
- The fill color references an existing semantic `--ui-*` token; the status tokens
99
- are chromatic across brands, so they read consistently until the real data-viz
100
- palette lands.
101
-
102
- ## Props
103
-
104
- | Prop | Type | Default | Required | Description |
105
- |------|------|---------|----------|-------------|
106
- | `label` | `string` | — | yes | Row label shown on the left. |
107
- | `value` | `number` | — | yes | The value this meter represents. |
108
- | `max` | `number` | `100` | no | Upper bound of the range — the whole the value is a share of. |
109
- | `color` | `string` | — | yes | Fill color for the bar — an existing semantic `--ui-*` token (or any CSS color). Caller-supplied; there is no chart palette tier yet. |
110
- | `valueFormatter` | `(value: number) => string` | `toLocaleString` | no | Format the numeric value in the label + tooltip. |
111
- | `showTooltip` | `boolean` | `true` | no | Show the hover tooltip (`label · value of max · %`). |
112
- | `tooltip` | `ReactNode` | — | no | Custom tooltip content — replaces the default (dot + label + `value of max · %`) inside the same chart-style card. Ignored when `showTooltip` is false. |
113
- | `defaultOpen` | `boolean` | — | no | Render with the tooltip initially open (Base UI `defaultOpen`). |
114
-
115
- ## Behavior
116
-
117
- `Meter` is a labelled proportional bar for a value within a range (Base UI
118
- `Meter`, `role="meter"`).
119
-
120
- ```gherkin
121
- Scenario: Render a value's share
122
- Given a label, value, and max
123
- Then the fill spans value / max of the track (Base UI sizes the indicator)
124
- And the row shows the formatted value and `· <pct>%` on the right
125
- And the fill uses the caller-supplied color
126
- ```
127
-
128
- ```gherkin
129
- Scenario: Accessible value
130
- Given value and max
131
- Then the meter exposes role="meter" with aria-valuenow / aria-valuemin (0) /
132
- aria-valuemax (max), an accessible name from the label, and an
133
- aria-valuetext of "value of max (pct%)"
134
- ```
135
-
136
- ```gherkin
137
- Scenario: Tooltip on hover
138
- Given showTooltip is true (the default)
139
- When the user hovers or focuses the meter
140
- Then a chart-style tooltip card (light surface + border + shadow) shows a color
141
- dot, the label, and "value of max · pct%"
142
- And with showTooltip false, no tooltip is wired
143
- ```
144
-
145
- ```gherkin
146
- Scenario: Zero or empty range
147
- Given max is 0 (or value is 0)
148
- Then the share reads 0% and the fill is empty, without dividing by zero
149
- ```
150
-
151
- ```gherkin
152
- Scenario: Stacked into a ranked breakdown
153
- Given several meters sharing one max (the total), sorted by value
154
- Then they read as a ranked bar-list of shares
155
- ```
156
-
157
- ## Accessibility
158
-
159
- - Built on Base UI `Meter`, so the root carries `role="meter"` with
160
- `aria-valuenow` / `aria-valuemin` (0) / `aria-valuemax` (the `max`), an
161
- accessible name wired from `Meter.Label` (`aria-labelledby`), and an
162
- `aria-valuetext` giving the human-readable "value of max (pct%)".
163
- - `role="meter"` (not `progressbar`) is deliberate — a meter is a scalar value
164
- within a known range, not task progress over time. Screen readers announce it
165
- as a gauge/measurement.
166
- - The percentage and value are real text in the row, so the meaning is in the
167
- accessible tree, not only the bar. **Don't rely on the fill color alone** to
168
- distinguish stacked meters — pair each with its label (already shown).
169
- - The tooltip repeats the value/share; it's supplementary. When it's shown the
170
- meter root is focusable (`tabIndex={0}`), so keyboard users reach it on focus,
171
- not just hover. The bar's color is caller-supplied, so pick a token with enough
172
- contrast on the surface.
173
-
174
- ## Contrast
175
-
176
- The label, value, track, and tooltip resolve semantic `--ui-*` tokens that meet
177
- contrast in both themes. The fill color is the caller's responsibility.
@@ -1 +0,0 @@
1
- export { Meter, type MeterProps } from './meter';
@@ -1,25 +0,0 @@
1
- import { Meter as MeterPrimitive } from '@base-ui/react/meter';
2
- import * as React from 'react';
3
- export interface MeterProps extends Omit<React.ComponentPropsWithoutRef<typeof MeterPrimitive.Root>, 'value' | 'color'> {
4
- /** Row label shown on the left. */
5
- label: string;
6
- /** The value this meter represents. */
7
- value: number;
8
- /** Upper bound of the range — the whole the value is a share of. */
9
- max?: number;
10
- /** Fill color for the bar — an existing semantic `--ui-*` token (or any CSS color). */
11
- color: string;
12
- /** Format the numeric value (label + tooltip). Defaults to `toLocaleString()`. */
13
- valueFormatter?: (value: number) => string;
14
- /** Show the hover tooltip (`label · value of max · %`). */
15
- showTooltip?: boolean;
16
- /**
17
- * Custom tooltip content — replaces the default (dot + label + `value of max
18
- * · %`) inside the same chart-style card. Ignored when `showTooltip` is false.
19
- */
20
- tooltip?: React.ReactNode;
21
- /** Render with the tooltip initially open (Base UI `defaultOpen`). */
22
- defaultOpen?: boolean;
23
- }
24
- declare const Meter: React.ForwardRefExoticComponent<MeterProps & React.RefAttributes<HTMLDivElement>>;
25
- export { Meter };