@redis-ui/components 51.0.0 → 51.1.1

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.
@@ -0,0 +1,48 @@
1
+ const require_Gauge_style = require("./Gauge.style.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ let react = require("react");
4
+ //#region src/Gauge/Gauge.tsx
5
+ var RADIUS = 40;
6
+ var CIRCUMFERENCE = 2 * Math.PI * RADIUS;
7
+ var TRACK_LENGTH = CIRCUMFERENCE * .75;
8
+ var START_ROTATION = 135;
9
+ var Gauge = ({ value, maxValue = 100, variant = "success", size = "M", label, ...restProps }) => {
10
+ const percentage = (0, react.useMemo)(() => maxValue > 0 ? Number(Math.min(100, Math.max(0, value / maxValue * 100)).toFixed(1)) : 0, [value, maxValue]);
11
+ const arcLength = TRACK_LENGTH * percentage / 100;
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Gauge_style.Gauge, {
13
+ $size: size,
14
+ ...restProps,
15
+ role: "meter",
16
+ "aria-valuenow": percentage,
17
+ "aria-valuemin": 0,
18
+ "aria-valuemax": 100,
19
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Gauge_style.Svg, {
20
+ viewBox: "0 0 100 100",
21
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gauge_style.Track, {
22
+ $variant: variant,
23
+ $size: size,
24
+ cx: "50",
25
+ cy: "50",
26
+ r: RADIUS,
27
+ strokeDasharray: `${TRACK_LENGTH} ${CIRCUMFERENCE}`,
28
+ transform: `rotate(${START_ROTATION} 50 50)`
29
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gauge_style.Arc, {
30
+ $variant: variant,
31
+ $size: size,
32
+ cx: "50",
33
+ cy: "50",
34
+ r: RADIUS,
35
+ strokeDasharray: `${arcLength} ${CIRCUMFERENCE}`,
36
+ transform: `rotate(${START_ROTATION} 50 50)`
37
+ })]
38
+ }), label != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gauge_style.Label, {
39
+ $variant: variant,
40
+ $size: size,
41
+ component: "span",
42
+ variant: "semiBold",
43
+ children: label
44
+ })]
45
+ });
46
+ };
47
+ //#endregion
48
+ exports.Gauge = Gauge;
@@ -0,0 +1,2 @@
1
+ import { GaugeProps } from './Gauge.types';
2
+ export declare const Gauge: ({ value, maxValue, variant, size, label, ...restProps }: GaugeProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { Arc, Gauge as Gauge$1, Label, Svg, Track } from "./Gauge.style.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ //#region src/Gauge/Gauge.tsx
5
+ var RADIUS = 40;
6
+ var CIRCUMFERENCE = 2 * Math.PI * RADIUS;
7
+ var TRACK_LENGTH = CIRCUMFERENCE * .75;
8
+ var START_ROTATION = 135;
9
+ var Gauge = ({ value, maxValue = 100, variant = "success", size = "M", label, ...restProps }) => {
10
+ const percentage = useMemo(() => maxValue > 0 ? Number(Math.min(100, Math.max(0, value / maxValue * 100)).toFixed(1)) : 0, [value, maxValue]);
11
+ const arcLength = TRACK_LENGTH * percentage / 100;
12
+ return /* @__PURE__ */ jsxs(Gauge$1, {
13
+ $size: size,
14
+ ...restProps,
15
+ role: "meter",
16
+ "aria-valuenow": percentage,
17
+ "aria-valuemin": 0,
18
+ "aria-valuemax": 100,
19
+ children: [/* @__PURE__ */ jsxs(Svg, {
20
+ viewBox: "0 0 100 100",
21
+ children: [/* @__PURE__ */ jsx(Track, {
22
+ $variant: variant,
23
+ $size: size,
24
+ cx: "50",
25
+ cy: "50",
26
+ r: RADIUS,
27
+ strokeDasharray: `${TRACK_LENGTH} ${CIRCUMFERENCE}`,
28
+ transform: `rotate(${START_ROTATION} 50 50)`
29
+ }), /* @__PURE__ */ jsx(Arc, {
30
+ $variant: variant,
31
+ $size: size,
32
+ cx: "50",
33
+ cy: "50",
34
+ r: RADIUS,
35
+ strokeDasharray: `${arcLength} ${CIRCUMFERENCE}`,
36
+ transform: `rotate(${START_ROTATION} 50 50)`
37
+ })]
38
+ }), label != null && /* @__PURE__ */ jsx(Label, {
39
+ $variant: variant,
40
+ $size: size,
41
+ component: "span",
42
+ variant: "semiBold",
43
+ children: label
44
+ })]
45
+ });
46
+ };
47
+ //#endregion
48
+ export { Gauge };
@@ -0,0 +1,54 @@
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_Typography = require("../Typography/Typography.cjs");
3
+ let styled_components = require("styled-components");
4
+ styled_components = require_runtime.__toESM(styled_components, 1);
5
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
6
+ //#region src/Gauge/Gauge.style.ts
7
+ var Gauge = styled_components.default.div.withConfig({
8
+ displayName: "Gaugestyle__Gauge",
9
+ componentId: "RedisUI__sc-165b3be-0"
10
+ })([
11
+ "position:relative;display:inline-flex;width:",
12
+ ";height:",
13
+ ";"
14
+ ], ({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].diameter, ({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].diameter);
15
+ var Svg = styled_components.default.svg.withConfig({
16
+ displayName: "Gaugestyle__Svg",
17
+ componentId: "RedisUI__sc-165b3be-1"
18
+ })(["width:100%;height:100%;"]);
19
+ var ring = styled_components.css`
20
+ fill: none;
21
+ stroke-linecap: round;
22
+ stroke-width: ${({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].strokeWidth};
23
+ `;
24
+ var Track = styled_components.default.circle.withConfig({
25
+ displayName: "Gaugestyle__Track",
26
+ componentId: "RedisUI__sc-165b3be-2"
27
+ })([
28
+ "",
29
+ ";stroke:",
30
+ ";"
31
+ ], ring, ({ $variant }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.variant[$variant].trackColor);
32
+ var Arc = styled_components.default.circle.withConfig({
33
+ displayName: "Gaugestyle__Arc",
34
+ componentId: "RedisUI__sc-165b3be-3"
35
+ })([
36
+ "",
37
+ ";stroke:",
38
+ ";transition:stroke-dasharray 660ms cubic-bezier(0.65,0,0.35,1);@media (prefers-reduced-motion:reduce){transition:none;}"
39
+ ], ring, ({ $variant }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.variant[$variant].arcColor);
40
+ var Label = (0, styled_components.default)(require_Typography.default.Body).withConfig({
41
+ displayName: "Gaugestyle__Label",
42
+ componentId: "RedisUI__sc-165b3be-4"
43
+ })([
44
+ "position:absolute;inset:0 ",
45
+ "%;display:flex;align-items:center;justify-content:center;overflow:hidden;color:",
46
+ ";font-size:",
47
+ ";text-align:center;line-height:1;"
48
+ ], ({ $size }) => 14 + Number((0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].strokeWidth) / 2, ({ $variant }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.variant[$variant].textColor, ({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].fontSize);
49
+ //#endregion
50
+ exports.Arc = Arc;
51
+ exports.Gauge = Gauge;
52
+ exports.Label = Label;
53
+ exports.Svg = Svg;
54
+ exports.Track = Track;
@@ -0,0 +1,17 @@
1
+ import { GaugeSize, GaugeVariant } from './Gauge.types';
2
+ export declare const Gauge: import("styled-components").StyledComponent<"div", any, {
3
+ $size: GaugeSize;
4
+ }, never>;
5
+ export declare const Svg: import("styled-components").StyledComponent<"svg", any, {}, never>;
6
+ export declare const Track: import("styled-components").StyledComponent<"circle", any, {
7
+ $variant: GaugeVariant;
8
+ $size: GaugeSize;
9
+ }, never>;
10
+ export declare const Arc: import("styled-components").StyledComponent<"circle", any, {
11
+ $variant: GaugeVariant;
12
+ $size: GaugeSize;
13
+ }, never>;
14
+ export declare const Label: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").TypographyBodyProps & import("react").RefAttributes<HTMLElement>>, any, {
15
+ $variant: GaugeVariant;
16
+ $size: GaugeSize;
17
+ }, never>;
@@ -0,0 +1,48 @@
1
+ import Typography from "../Typography/Typography.js";
2
+ import _styled, { css } from "styled-components";
3
+ import { useTheme } from "@redis-ui/styles";
4
+ //#region src/Gauge/Gauge.style.ts
5
+ var Gauge = _styled.div.withConfig({
6
+ displayName: "Gaugestyle__Gauge",
7
+ componentId: "RedisUI__sc-165b3be-0"
8
+ })([
9
+ "position:relative;display:inline-flex;width:",
10
+ ";height:",
11
+ ";"
12
+ ], ({ $size }) => useTheme().components.gauge.size[$size].diameter, ({ $size }) => useTheme().components.gauge.size[$size].diameter);
13
+ var Svg = _styled.svg.withConfig({
14
+ displayName: "Gaugestyle__Svg",
15
+ componentId: "RedisUI__sc-165b3be-1"
16
+ })(["width:100%;height:100%;"]);
17
+ var ring = css`
18
+ fill: none;
19
+ stroke-linecap: round;
20
+ stroke-width: ${({ $size }) => useTheme().components.gauge.size[$size].strokeWidth};
21
+ `;
22
+ var Track = _styled.circle.withConfig({
23
+ displayName: "Gaugestyle__Track",
24
+ componentId: "RedisUI__sc-165b3be-2"
25
+ })([
26
+ "",
27
+ ";stroke:",
28
+ ";"
29
+ ], ring, ({ $variant }) => useTheme().components.gauge.variant[$variant].trackColor);
30
+ var Arc = _styled.circle.withConfig({
31
+ displayName: "Gaugestyle__Arc",
32
+ componentId: "RedisUI__sc-165b3be-3"
33
+ })([
34
+ "",
35
+ ";stroke:",
36
+ ";transition:stroke-dasharray 660ms cubic-bezier(0.65,0,0.35,1);@media (prefers-reduced-motion:reduce){transition:none;}"
37
+ ], ring, ({ $variant }) => useTheme().components.gauge.variant[$variant].arcColor);
38
+ var Label = _styled(Typography.Body).withConfig({
39
+ displayName: "Gaugestyle__Label",
40
+ componentId: "RedisUI__sc-165b3be-4"
41
+ })([
42
+ "position:absolute;inset:0 ",
43
+ "%;display:flex;align-items:center;justify-content:center;overflow:hidden;color:",
44
+ ";font-size:",
45
+ ";text-align:center;line-height:1;"
46
+ ], ({ $size }) => 14 + Number(useTheme().components.gauge.size[$size].strokeWidth) / 2, ({ $variant }) => useTheme().components.gauge.variant[$variant].textColor, ({ $size }) => useTheme().components.gauge.size[$size].fontSize);
47
+ //#endregion
48
+ export { Arc, Gauge, Label, Svg, Track };
@@ -0,0 +1,15 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export type GaugeVariant = 'success' | 'attention' | 'danger';
3
+ export type GaugeSize = 'S' | 'M' | 'L';
4
+ export interface GaugeProps extends HTMLAttributes<HTMLDivElement> {
5
+ /** Arc fill magnitude; clamped to [0, maxValue]. */
6
+ value: number;
7
+ /** Upper bound used to compute the fill percentage. Default 100. */
8
+ maxValue?: number;
9
+ /** Semantic color state. Default 'success'. */
10
+ variant?: GaugeVariant;
11
+ /** Default 'M'. */
12
+ size?: GaugeSize;
13
+ /** Freeform content rendered in the center of the gauge, e.g. "<2ms". */
14
+ label?: ReactNode;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Gauge } from './Gauge';
2
+ export type { GaugeProps, GaugeVariant, GaugeSize } from './Gauge.types';
@@ -0,0 +1 @@
1
+ export { Gauge } from './Gauge';
package/dist/index.cjs CHANGED
@@ -73,6 +73,7 @@ const require_CountryFlag = require("./CountryFlag/CountryFlag.cjs");
73
73
  const require_Drawer = require("./Drawer/Drawer.cjs");
74
74
  const require_TreeView = require("./TreeView/TreeView.cjs");
75
75
  const require_Filters = require("./Filters/Filters.cjs");
76
+ const require_Gauge = require("./Gauge/Gauge.cjs");
76
77
  const require_HighlightedIcon_style = require("./HighlightedIcon/HighlightedIcon.style.cjs");
77
78
  const require_HighlightedIcon = require("./HighlightedIcon/HighlightedIcon.cjs");
78
79
  const require_KeyValueList = require("./KeyValueList/KeyValueList.cjs");
@@ -180,6 +181,7 @@ exports.FlexGroup = require_FlexGroup.FlexGroup;
180
181
  exports.FlexItem = require_FlexItem.FlexItem;
181
182
  exports.FlexSplit = require_FlexSplit.FlexSplit;
182
183
  exports.FormField = require_FormField.default;
184
+ exports.Gauge = require_Gauge.Gauge;
183
185
  exports.Grid = require_Grid.Grid;
184
186
  exports.HighlightedIcon = require_HighlightedIcon.default;
185
187
  Object.defineProperty(exports, "HighlightedIconStyles", {
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './ChipList';
14
14
  export * from './CountryFlag';
15
15
  export * from './Drawer';
16
16
  export * from './Filters';
17
+ export * from './Gauge';
17
18
  export * from './Helpers';
18
19
  export * from './HighlightedIcon';
19
20
  export * from './Inputs';
package/dist/index.js CHANGED
@@ -73,6 +73,7 @@ import CountryFlag from "./CountryFlag/CountryFlag.js";
73
73
  import Drawer from "./Drawer/Drawer.js";
74
74
  import TreeView from "./TreeView/TreeView.js";
75
75
  import Filters from "./Filters/Filters.js";
76
+ import { Gauge } from "./Gauge/Gauge.js";
76
77
  import { HighlightedIcon_style_exports } from "./HighlightedIcon/HighlightedIcon.style.js";
77
78
  import HighlightedIcon from "./HighlightedIcon/HighlightedIcon.js";
78
79
  import { KeyValueList } from "./KeyValueList/KeyValueList.js";
@@ -112,4 +113,4 @@ import { ProgressBar } from "./ProgressBar/ProgressBar.js";
112
113
  import { ProfileIcon_style_exports } from "./ProfileIcon/ProfileIcon.style.js";
113
114
  import ProfileIcon from "./ProfileIcon/ProfileIcon.js";
114
115
  import Slider from "./Slider/Slider.js";
115
- export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Grid, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, combineHandlers, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
116
+ export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, combineHandlers, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "51.0.0",
4
+ "version": "51.1.1",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -111,6 +111,7 @@ Always check the relevant component reference before using a component. The refe
111
111
  - [Link](./references/Link.md)
112
112
  - [Loader](./references/Loader.md)
113
113
  - [ProgressBar](./references/ProgressBar.md)
114
+ - [Gauge](./references/Gauge.md)
114
115
  - [Typography](./references/Typography.md)
115
116
  - [MoreInfoIcon](./references/MoreInfoIcon.md)
116
117
  - [HighlightedIcon](./references/HighlightedIcon.md)
@@ -0,0 +1,91 @@
1
+ # Gauge
2
+
3
+ A compact radial (arc) gauge with a freeform center label and semantic color variants. The arc fills proportionally to `value`; the color is chosen independently via `variant`, so the consumer decides which threshold a value maps to.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Gauge } from '@redis-ui/components';
9
+ ```
10
+
11
+ ## Props
12
+
13
+ | Prop | Type | Default | Description |
14
+ |------|------|---------|-------------|
15
+ | value | `number` | required | Arc fill magnitude; clamped to `[0, maxValue]` |
16
+ | maxValue | `number` | `100` | Upper bound used to compute the fill percentage (`(value / maxValue) * 100`) |
17
+ | variant | `'success' \| 'attention' \| 'danger'` | `'success'` | Semantic color state |
18
+ | size | `'S' \| 'M' \| 'L'` | `'M'` | Gauge size |
19
+ | label | `ReactNode` | - | Freeform content rendered in the center, e.g. `<2ms`. Omit to render just the arc |
20
+
21
+ > `Gauge` also accepts standard `HTMLAttributes<HTMLDivElement>` (e.g. `className`, `style`, `id`), which are spread onto the root element. The meter semantics are managed internally: `Gauge` always renders `role="meter"` on a fixed percentage scale — `aria-valuemin` is always `0` and `aria-valuemax` is always `100`, regardless of `maxValue`, and `aria-valuenow` is the fill percentage derived from `value`/`maxValue` rather than the raw `value`. Only these four attributes are fixed — a caller-supplied `role`, `aria-valuenow`, `aria-valuemin`, or `aria-valuemax` is ignored so the accessible value cannot drift from the rendered arc. Other attributes, including `aria-valuetext`, still pass through to the root element.
22
+
23
+ ## Examples
24
+
25
+ ### Playground
26
+
27
+ ```tsx
28
+ import { Gauge } from '@redis-ui/components';
29
+
30
+ <Gauge value={65} variant="success" size="M" label="<2ms" />
31
+ ```
32
+
33
+ ### Variants
34
+
35
+ > Use the `variant` prop to apply a semantic color scheme. The arc fill (`value`) and the color (`variant`) are independent — the consumer decides which threshold a value belongs to.
36
+
37
+ ```tsx
38
+ import { Gauge } from '@redis-ui/components';
39
+
40
+ <>
41
+ <Gauge variant="success" value={20} label="<2ms" />
42
+ <Gauge variant="attention" value={55} label="8ms" />
43
+ <Gauge variant="danger" value={90} label="20ms" />
44
+ </>
45
+ ```
46
+
47
+ ### Sizes
48
+
49
+ > Named sizes are driven by theme tokens.
50
+
51
+ ```tsx
52
+ import { Gauge } from '@redis-ui/components';
53
+
54
+ <>
55
+ <Gauge size="S" value={65} label="<2ms" />
56
+ <Gauge size="M" value={65} label="<2ms" />
57
+ <Gauge size="L" value={65} label="<2ms" />
58
+ </>
59
+ ```
60
+
61
+ ### FillLevels
62
+
63
+ > The arc fills proportionally to `value` (clamped to `[0, maxValue]`).
64
+
65
+ ```tsx
66
+ import { Gauge } from '@redis-ui/components';
67
+
68
+ <>
69
+ <Gauge value={0} label="0" />
70
+ <Gauge value={50} label="50" />
71
+ <Gauge value={100} label="100" />
72
+ </>
73
+ ```
74
+
75
+ ### WithoutLabel
76
+
77
+ > The center `label` is freeform. Omit it to render just the arc.
78
+
79
+ ```tsx
80
+ import { Gauge } from '@redis-ui/components';
81
+
82
+ <Gauge value={65} variant="success" />
83
+ ```
84
+
85
+ ## Notes
86
+
87
+ - The fill percentage is `(value / maxValue) * 100`, clamped to `[0, 100]` and rounded to one decimal place. A `maxValue` of `0` or less yields a `0%` fill.
88
+ - The arc fill (`value`) and the color (`variant`) are independent — pick the `variant` that matches the threshold the value falls into.
89
+ - The center `label` is freeform and optional; omit it to render just the arc.
90
+ - The gauge is exposed as `role="meter"` on a fixed percentage scale. `aria-valuenow` is the fill percentage — i.e. `value / maxValue * 100`, so it reflects both props — while the bounds stay fixed: `aria-valuemin` is always `0` and `aria-valuemax` is always `100`, never `maxValue`. With `value={130} maxValue={200}` the meter reports `aria-valuenow="65"`, not `130`. Pass `aria-valuetext` when a screen reader should announce the underlying quantity (e.g. `"130 of 200 GB"`) instead of the bare percentage.
91
+ - `role` and those three `aria-value*` attributes are fixed and cannot be overridden. Other attributes, including `aria-valuetext`, pass through to the root element.