@viraui/react 2026.0.18 → 2026.0.20
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/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.js +2 -2
- package/dist/components/dialog/dialog-sheet.js +1 -1
- package/dist/components/glow/glow-tracker.d.ts +1 -1
- package/dist/components/glow/glow-tracker.js +35 -23
- package/dist/components/linear-progress/linear-progress.d.ts +7 -4
- package/dist/components/linear-progress/linear-progress.guide.json +2 -2
- package/dist/components/linear-progress/linear-progress.js +45 -39
- package/dist/components/meter/meter.d.ts +7 -4
- package/dist/components/meter/meter.guide.json +3 -3
- package/dist/components/meter/meter.js +44 -38
- package/dist/components/popover/popover-sheet.js +1 -1
- package/dist/components/select/select.js +3 -3
- package/dist/components/slider/slider.d.ts +7 -4
- package/dist/components/slider/slider.guide.json +2 -2
- package/dist/components/slider/slider.js +6 -5
- package/dist/components/tooltip/tooltip-content.js +1 -1
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldRoot } from '@base-ui/react/field';
|
|
2
1
|
import { AutocompleteRoot, Autocomplete as PrimitiveAutocomplete } from '@base-ui/react/autocomplete';
|
|
2
|
+
import { FieldRoot } from '@base-ui/react/field';
|
|
3
3
|
import { BasicInputProps } from '../basic-input';
|
|
4
4
|
import { AutocompleteGroup } from './autocomplete-group';
|
|
5
5
|
import { AutocompleteItemPart } from './autocomplete-item';
|
|
@@ -13,8 +13,8 @@ import { AutocompleteItemPart } from "./autocomplete-item.js";
|
|
|
13
13
|
import { Elevator } from "../elevator/elevator.js";
|
|
14
14
|
import { Surface } from "../surface/surface.js";
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
import { Field } from "@base-ui/react/field";
|
|
17
16
|
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
17
|
+
import { Field } from "@base-ui/react/field";
|
|
18
18
|
import { useId } from "react";
|
|
19
19
|
//#region src/components/autocomplete/autocomplete.tsx
|
|
20
20
|
var AutocompletePrimitiveRoot = Autocomplete.Root;
|
|
@@ -76,7 +76,7 @@ function AutocompleteRootComponent({ children, className, container, description
|
|
|
76
76
|
border: "all",
|
|
77
77
|
className: autocomplete_module_default.PopupChrome,
|
|
78
78
|
color: 1,
|
|
79
|
-
"data-vibrant":
|
|
79
|
+
"data-vibrant": true,
|
|
80
80
|
hPadding: "x-small",
|
|
81
81
|
overflow: "auto",
|
|
82
82
|
radius: "medium",
|
|
@@ -13,7 +13,7 @@ export declare const unwrapGlowAngle: (lastAngle: number | undefined, rawDegrees
|
|
|
13
13
|
export declare const registerGlow: (entry: GlowTrackerEntry) => void;
|
|
14
14
|
export declare const updateGlow: (entry: GlowTrackerEntry) => void;
|
|
15
15
|
export declare const unregisterGlow: (el: HTMLElement) => void;
|
|
16
|
-
/** Story / test helper:
|
|
16
|
+
/** Story / test helper: count of documents with an attached `pointermove` listener. */
|
|
17
17
|
export declare const getGlowListenerCount: () => number;
|
|
18
18
|
/** Story / test helper: registered glow root count. */
|
|
19
19
|
export declare const getGlowRegistrySize: () => number;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/components/glow/glow-tracker.ts
|
|
2
2
|
var entries = /* @__PURE__ */ new Map();
|
|
3
|
-
var
|
|
3
|
+
var listeningDocs = /* @__PURE__ */ new Set();
|
|
4
|
+
/** Latest pointer event per listening document (keyed at handler time — `currentTarget` is null after dispatch). */
|
|
5
|
+
var pendingByDoc = /* @__PURE__ */ new Map();
|
|
4
6
|
var rafId = null;
|
|
5
|
-
var pendingEvent = null;
|
|
6
7
|
var POINTER_QUERY = "(hover: hover) and (pointer: fine)";
|
|
7
8
|
var REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
8
9
|
var canTrackPointer = () => {
|
|
@@ -42,30 +43,40 @@ var paintEntry = (entry, event) => {
|
|
|
42
43
|
};
|
|
43
44
|
var flushPaint = () => {
|
|
44
45
|
rafId = null;
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
46
|
+
const pending = [...pendingByDoc.entries()];
|
|
47
|
+
pendingByDoc.clear();
|
|
48
|
+
for (const [doc, event] of pending) for (const entry of entries.values()) if (entry.el.ownerDocument === doc) paintEntry(entry, event);
|
|
49
|
+
};
|
|
50
|
+
/** Cross-realm safe: iframe `Document` fails `instanceof Document` from the module window. */
|
|
51
|
+
var asDocument = (value) => {
|
|
52
|
+
if (!value || !("nodeType" in value) || value.nodeType !== 9) return null;
|
|
53
|
+
return value;
|
|
49
54
|
};
|
|
50
55
|
var onPointerMove = (event) => {
|
|
51
|
-
|
|
56
|
+
const doc = asDocument(event.currentTarget);
|
|
57
|
+
if (!doc) return;
|
|
58
|
+
pendingByDoc.set(doc, event);
|
|
52
59
|
if (rafId !== null) return;
|
|
53
60
|
rafId = requestAnimationFrame(flushPaint);
|
|
54
61
|
};
|
|
55
|
-
var attachListener = () => {
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
var attachListener = (doc) => {
|
|
63
|
+
if (listeningDocs.has(doc) || !canTrackPointer()) return;
|
|
64
|
+
doc.addEventListener("pointermove", onPointerMove);
|
|
65
|
+
listeningDocs.add(doc);
|
|
59
66
|
};
|
|
60
|
-
var detachListener = () => {
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
var detachListener = (doc) => {
|
|
68
|
+
if (!listeningDocs.has(doc)) return;
|
|
69
|
+
for (const entry of entries.values()) if (entry.el.ownerDocument === doc) return;
|
|
70
|
+
doc.removeEventListener("pointermove", onPointerMove);
|
|
71
|
+
listeningDocs.delete(doc);
|
|
72
|
+
pendingByDoc.delete(doc);
|
|
73
|
+
if (listeningDocs.size === 0) {
|
|
74
|
+
if (rafId !== null) {
|
|
75
|
+
cancelAnimationFrame(rafId);
|
|
76
|
+
rafId = null;
|
|
77
|
+
}
|
|
78
|
+
pendingByDoc.clear();
|
|
67
79
|
}
|
|
68
|
-
pendingEvent = null;
|
|
69
80
|
};
|
|
70
81
|
var registerGlow = (entry) => {
|
|
71
82
|
const existing = entries.get(entry.el);
|
|
@@ -73,14 +84,15 @@ var registerGlow = (entry) => {
|
|
|
73
84
|
...entry,
|
|
74
85
|
...existing?.lastAngle !== void 0 && { lastAngle: existing.lastAngle }
|
|
75
86
|
});
|
|
76
|
-
attachListener();
|
|
87
|
+
attachListener(entry.el.ownerDocument);
|
|
77
88
|
};
|
|
78
89
|
var unregisterGlow = (el) => {
|
|
90
|
+
const doc = el.ownerDocument;
|
|
79
91
|
entries.delete(el);
|
|
80
|
-
detachListener();
|
|
92
|
+
detachListener(doc);
|
|
81
93
|
};
|
|
82
|
-
/** Story / test helper:
|
|
83
|
-
var getGlowListenerCount = () =>
|
|
94
|
+
/** Story / test helper: count of documents with an attached `pointermove` listener. */
|
|
95
|
+
var getGlowListenerCount = () => listeningDocs.size;
|
|
84
96
|
/** Story / test helper: registered glow root count. */
|
|
85
97
|
var getGlowRegistrySize = () => entries.size;
|
|
86
98
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProgressRoot } from '@base-ui/react/progress';
|
|
1
|
+
import { ProgressRoot, Progress as PrimitiveProgress } from '@base-ui/react/progress';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Public LinearProgress props.
|
|
@@ -22,10 +22,13 @@ export type LinearProgressProps = ProgressRoot.Props & {
|
|
|
22
22
|
*/
|
|
23
23
|
description?: React.ReactNode;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Shows the current value beside the label.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* Pass `true` for Base UI default formatting, or a function matching
|
|
28
|
+
* `Progress.Value` `children` to customize the printed label.
|
|
29
|
+
*
|
|
30
|
+
* @default Value UI is hidden.
|
|
28
31
|
*/
|
|
29
|
-
|
|
32
|
+
renderValue?: boolean | Exclude<React.ComponentProps<typeof PrimitiveProgress.Value>['children'], null | undefined>;
|
|
30
33
|
};
|
|
31
34
|
export declare const LinearProgress: React.FC<LinearProgressProps>;
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"label": {
|
|
35
35
|
"description": "Visible label rendered through `Progress.Label` with shared internal `FieldLabel`."
|
|
36
36
|
},
|
|
37
|
-
"
|
|
38
|
-
"description": "
|
|
37
|
+
"renderValue": {
|
|
38
|
+
"description": "Shows the current value beside the label. Pass `true` for Base UI default formatting, or a function matching `Progress.Value` `children` to customize the printed label."
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"css": {
|
|
@@ -7,46 +7,52 @@ import linear_progress_module_default from "./linear-progress.module.js";
|
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Progress } from "@base-ui/react/progress";
|
|
9
9
|
//#region src/components/linear-progress/linear-progress.tsx
|
|
10
|
-
var LinearProgress = ({ className, description, label,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
children: label
|
|
29
|
-
|
|
10
|
+
var LinearProgress = ({ className, description, label, renderValue, value, ref, ...progressRootProps }) => {
|
|
11
|
+
const showRenderedValue = renderValue === true || typeof renderValue === "function";
|
|
12
|
+
return /* @__PURE__ */ jsxs(Progress.Root, {
|
|
13
|
+
...progressRootProps,
|
|
14
|
+
ref,
|
|
15
|
+
className: clsx(linear_progress_module_default.LinearProgress, className),
|
|
16
|
+
value,
|
|
17
|
+
render: /* @__PURE__ */ jsx(Stack, {
|
|
18
|
+
direction: "column",
|
|
19
|
+
rowGap: "medium",
|
|
20
|
+
columnGap: "x-small"
|
|
21
|
+
}),
|
|
22
|
+
children: [
|
|
23
|
+
(label || showRenderedValue) && /* @__PURE__ */ jsxs(Stack, {
|
|
24
|
+
direction: "row",
|
|
25
|
+
columnGap: "small",
|
|
26
|
+
vAlign: "center",
|
|
27
|
+
hAlign: "space-between",
|
|
28
|
+
children: [label && /* @__PURE__ */ jsx(Progress.Label, {
|
|
29
|
+
render: /* @__PURE__ */ jsx(FieldLabel, {}),
|
|
30
|
+
children: label
|
|
31
|
+
}), showRenderedValue && /* @__PURE__ */ jsx(Text, {
|
|
32
|
+
size: "small",
|
|
33
|
+
tone: "muted",
|
|
34
|
+
family: "mono",
|
|
35
|
+
whiteSpace: "nowrap",
|
|
36
|
+
selection: false,
|
|
37
|
+
align: "center",
|
|
38
|
+
"data-shrink": "false",
|
|
39
|
+
render: /* @__PURE__ */ jsx(Progress.Value, {
|
|
40
|
+
render: /* @__PURE__ */ jsx("output", {}),
|
|
41
|
+
children: typeof renderValue === "function" ? renderValue : void 0
|
|
42
|
+
})
|
|
43
|
+
})]
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx(Progress.Track, {
|
|
46
|
+
className: linear_progress_module_default.Track,
|
|
47
|
+
children: /* @__PURE__ */ jsx(Progress.Indicator, { className: linear_progress_module_default.Indicator })
|
|
48
|
+
}),
|
|
49
|
+
description && /* @__PURE__ */ jsx(Text, {
|
|
30
50
|
size: "small",
|
|
31
51
|
tone: "muted",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
render: /* @__PURE__ */ jsx(Progress.Value, { render: /* @__PURE__ */ jsx("output", {}) })
|
|
38
|
-
})]
|
|
39
|
-
}),
|
|
40
|
-
/* @__PURE__ */ jsx(Progress.Track, {
|
|
41
|
-
className: linear_progress_module_default.Track,
|
|
42
|
-
children: /* @__PURE__ */ jsx(Progress.Indicator, { className: linear_progress_module_default.Indicator })
|
|
43
|
-
}),
|
|
44
|
-
description && /* @__PURE__ */ jsx(Text, {
|
|
45
|
-
size: "small",
|
|
46
|
-
tone: "muted",
|
|
47
|
-
children: description
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
});
|
|
52
|
+
children: description
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
51
57
|
//#endregion
|
|
52
58
|
export { LinearProgress };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MeterRoot } from '@base-ui/react';
|
|
1
|
+
import { Meter as PrimitiveMeter, MeterRoot } from '@base-ui/react';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
/**
|
|
4
4
|
* Public Meter props.
|
|
@@ -22,10 +22,13 @@ export type MeterProps = MeterRoot.Props & {
|
|
|
22
22
|
*/
|
|
23
23
|
description?: React.ReactNode;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Shows the current value beside the label.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* Pass `true` for Base UI default formatting, or a function matching
|
|
28
|
+
* `Meter.Value` `children` to customize the printed label.
|
|
29
|
+
*
|
|
30
|
+
* @default Value UI is hidden.
|
|
28
31
|
*/
|
|
29
|
-
|
|
32
|
+
renderValue?: boolean | Exclude<React.ComponentProps<typeof PrimitiveMeter.Value>['children'], null | undefined>;
|
|
30
33
|
};
|
|
31
34
|
export declare const Meter: React.FC<MeterProps>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"whenToUse": [
|
|
7
7
|
"Use for storage usage, battery level, capacity, or score within a known range.",
|
|
8
8
|
"Use with a label when the metric needs a visible name.",
|
|
9
|
-
"Use with `
|
|
9
|
+
"Use with `renderValue` when the formatted value should appear beside the label."
|
|
10
10
|
],
|
|
11
11
|
"whenNotToUse": [
|
|
12
12
|
"Use LinearProgress for in-progress tasks or indeterminate work.",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"label": {
|
|
34
34
|
"description": "Visible label rendered through `Meter.Label` with shared internal `FieldLabel`."
|
|
35
35
|
},
|
|
36
|
-
"
|
|
37
|
-
"description": "
|
|
36
|
+
"renderValue": {
|
|
37
|
+
"description": "Shows the current value beside the label. Pass `true` for Base UI default formatting, or a function matching `Meter.Value` `children` to customize the printed label."
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"css": {
|
|
@@ -7,45 +7,51 @@ import meter_module_default from "./meter.module.js";
|
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Meter } from "@base-ui/react";
|
|
9
9
|
//#region src/components/meter/meter.tsx
|
|
10
|
-
var Meter$1 = ({ className, description, label,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
children: label
|
|
28
|
-
|
|
10
|
+
var Meter$1 = ({ className, description, label, renderValue, value, ...otherProps }) => {
|
|
11
|
+
const showRenderedValue = renderValue === true || typeof renderValue === "function";
|
|
12
|
+
return /* @__PURE__ */ jsxs(Meter.Root, {
|
|
13
|
+
...otherProps,
|
|
14
|
+
className: clsx(meter_module_default.Meter, className),
|
|
15
|
+
value,
|
|
16
|
+
render: /* @__PURE__ */ jsx(Stack, {
|
|
17
|
+
direction: "column",
|
|
18
|
+
rowGap: "medium",
|
|
19
|
+
columnGap: "x-small"
|
|
20
|
+
}),
|
|
21
|
+
children: [
|
|
22
|
+
(label || showRenderedValue) && /* @__PURE__ */ jsxs(Stack, {
|
|
23
|
+
direction: "row",
|
|
24
|
+
columnGap: "small",
|
|
25
|
+
vAlign: "center",
|
|
26
|
+
hAlign: "space-between",
|
|
27
|
+
children: [label && /* @__PURE__ */ jsx(Meter.Label, {
|
|
28
|
+
render: /* @__PURE__ */ jsx(FieldLabel, {}),
|
|
29
|
+
children: label
|
|
30
|
+
}), showRenderedValue && /* @__PURE__ */ jsx(Text, {
|
|
31
|
+
size: "small",
|
|
32
|
+
tone: "muted",
|
|
33
|
+
family: "mono",
|
|
34
|
+
whiteSpace: "nowrap",
|
|
35
|
+
selection: false,
|
|
36
|
+
align: "center",
|
|
37
|
+
"data-shrink": "false",
|
|
38
|
+
render: /* @__PURE__ */ jsx(Meter.Value, {
|
|
39
|
+
render: /* @__PURE__ */ jsx("output", {}),
|
|
40
|
+
children: typeof renderValue === "function" ? renderValue : void 0
|
|
41
|
+
})
|
|
42
|
+
})]
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx(Meter.Track, {
|
|
45
|
+
className: meter_module_default.Track,
|
|
46
|
+
children: /* @__PURE__ */ jsx(Meter.Indicator, { className: meter_module_default.Indicator })
|
|
47
|
+
}),
|
|
48
|
+
description && /* @__PURE__ */ jsx(Text, {
|
|
29
49
|
size: "small",
|
|
30
50
|
tone: "muted",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
render: /* @__PURE__ */ jsx(Meter.Value, { render: /* @__PURE__ */ jsx("output", {}) })
|
|
37
|
-
})]
|
|
38
|
-
}),
|
|
39
|
-
/* @__PURE__ */ jsx(Meter.Track, {
|
|
40
|
-
className: meter_module_default.Track,
|
|
41
|
-
children: /* @__PURE__ */ jsx(Meter.Indicator, { className: meter_module_default.Indicator })
|
|
42
|
-
}),
|
|
43
|
-
description && /* @__PURE__ */ jsx(Text, {
|
|
44
|
-
size: "small",
|
|
45
|
-
tone: "muted",
|
|
46
|
-
children: description
|
|
47
|
-
})
|
|
48
|
-
]
|
|
49
|
-
});
|
|
51
|
+
children: description
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
50
56
|
//#endregion
|
|
51
57
|
export { Meter$1 as Meter };
|
|
@@ -27,7 +27,7 @@ var PopoverSheet = ({ unstyled, title, description, children, showCloseButton =
|
|
|
27
27
|
color: 1,
|
|
28
28
|
border: "all",
|
|
29
29
|
radius: "large",
|
|
30
|
-
"data-vibrant":
|
|
30
|
+
"data-vibrant": true,
|
|
31
31
|
render: /* @__PURE__ */ jsx(Stack, { rowGap: "medium" })
|
|
32
32
|
}),
|
|
33
33
|
children: /* @__PURE__ */ jsxs(Popover.Viewport, {
|
|
@@ -91,7 +91,7 @@ function SelectRootComponent({ alignListWithTrigger = true, children, className,
|
|
|
91
91
|
children: [
|
|
92
92
|
/* @__PURE__ */ jsx(Select.ScrollUpArrow, {
|
|
93
93
|
className: clsx(select_module_default.ScrollArrow, select_module_default.ScrollArrowUp),
|
|
94
|
-
"data-vibrant":
|
|
94
|
+
"data-vibrant": true,
|
|
95
95
|
render: /* @__PURE__ */ jsx(Stack, {
|
|
96
96
|
hAlign: "center",
|
|
97
97
|
vAlign: "center"
|
|
@@ -117,14 +117,14 @@ function SelectRootComponent({ alignListWithTrigger = true, children, className,
|
|
|
117
117
|
overflow: "auto",
|
|
118
118
|
radius: "medium",
|
|
119
119
|
vPadding: "x-small",
|
|
120
|
-
"data-vibrant":
|
|
120
|
+
"data-vibrant": true
|
|
121
121
|
}),
|
|
122
122
|
children
|
|
123
123
|
})
|
|
124
124
|
}),
|
|
125
125
|
/* @__PURE__ */ jsx(Select.ScrollDownArrow, {
|
|
126
126
|
className: clsx(select_module_default.ScrollArrow, select_module_default.ScrollArrowDown),
|
|
127
|
-
"data-vibrant":
|
|
127
|
+
"data-vibrant": true,
|
|
128
128
|
render: /* @__PURE__ */ jsx(Stack, {
|
|
129
129
|
hAlign: "center",
|
|
130
130
|
vAlign: "center"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldRoot } from '@base-ui/react/field';
|
|
2
|
-
import { SliderRoot } from '@base-ui/react/slider';
|
|
2
|
+
import { SliderRoot, Slider as PrimitiveSlider } from '@base-ui/react/slider';
|
|
3
3
|
import type * as React from 'react';
|
|
4
4
|
/**
|
|
5
5
|
* Public Slider props.
|
|
@@ -35,11 +35,14 @@ export type SliderProps = SliderRoot.Props & FieldRoot.Props & {
|
|
|
35
35
|
*/
|
|
36
36
|
required?: boolean;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Shows the current value beside the label.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
40
|
+
* Pass `true` for Base UI default formatting, or a function matching
|
|
41
|
+
* `Slider.Value` `children` to customize the printed label.
|
|
42
|
+
*
|
|
43
|
+
* @default Value UI is hidden.
|
|
41
44
|
*/
|
|
42
|
-
|
|
45
|
+
renderValue?: boolean | Exclude<React.ComponentProps<typeof PrimitiveSlider.Value>['children'], null | undefined>;
|
|
43
46
|
/**
|
|
44
47
|
* Accessible name for the thumb when `label` is omitted.
|
|
45
48
|
*
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"required": {
|
|
37
37
|
"description": "Marks the slider as required and shows a required indicator on the label."
|
|
38
38
|
},
|
|
39
|
-
"
|
|
40
|
-
"description": "
|
|
39
|
+
"renderValue": {
|
|
40
|
+
"description": "Shows the current value beside the label. Pass `true` for Base UI default formatting, or a function matching `Slider.Value` `children` to customize the printed label."
|
|
41
41
|
},
|
|
42
42
|
"thumbAriaLabel": {
|
|
43
43
|
"description": "Accessible name for the thumb when `label` is omitted. Pass a string to name the first thumb (single-thumb slider, or the minimum thumb on a range). Pass a two-element tuple to name each range thumb in order; on a single-thumb slider only the first tuple value is applied."
|
|
@@ -11,9 +11,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
import { Field } from "@base-ui/react/field";
|
|
12
12
|
import { Slider } from "@base-ui/react/slider";
|
|
13
13
|
//#region src/components/slider/slider.tsx
|
|
14
|
-
var Slider$1 = ({ className, defaultValue, description, dirty, disabled, error, invalid, label, name, orientation = "horizontal",
|
|
14
|
+
var Slider$1 = ({ className, defaultValue, description, dirty, disabled, error, invalid, label, name, orientation = "horizontal", renderValue, thumbAriaLabel, touched, validate, validationDebounceTime, validationMode, value, ref, ...sliderRootProps }) => {
|
|
15
15
|
const isRange = isRangeSlider(value, defaultValue);
|
|
16
16
|
const isVertical = orientation === "vertical";
|
|
17
|
+
const showRenderedValue = renderValue === true || typeof renderValue === "function";
|
|
17
18
|
return /* @__PURE__ */ jsxs(Field.Root, {
|
|
18
19
|
className: slider_module_default.Slider,
|
|
19
20
|
dirty,
|
|
@@ -44,17 +45,17 @@ var Slider$1 = ({ className, defaultValue, description, dirty, disabled, error,
|
|
|
44
45
|
vAlign: isVertical ? "stretch" : "center",
|
|
45
46
|
hAlign: isVertical ? "center" : "initial"
|
|
46
47
|
}),
|
|
47
|
-
children: [(label ||
|
|
48
|
+
children: [(label || showRenderedValue) && /* @__PURE__ */ jsxs(Stack, {
|
|
48
49
|
fillChildren: true,
|
|
49
50
|
className: slider_module_default.SliderHeader,
|
|
50
51
|
direction: isVertical ? "column" : "row",
|
|
51
52
|
columnGap: "small",
|
|
52
|
-
vAlign: "
|
|
53
|
+
vAlign: "center",
|
|
53
54
|
hAlign: isVertical ? "center" : "space-between",
|
|
54
55
|
children: [label && /* @__PURE__ */ jsx(Field.Label, {
|
|
55
56
|
className: slider_module_default.Label,
|
|
56
57
|
children: /* @__PURE__ */ jsx(FieldLabel, { children: label })
|
|
57
|
-
}),
|
|
58
|
+
}), showRenderedValue && /* @__PURE__ */ jsx(Text, {
|
|
58
59
|
className: slider_module_default.Value,
|
|
59
60
|
size: "small",
|
|
60
61
|
tone: "muted",
|
|
@@ -62,7 +63,7 @@ var Slider$1 = ({ className, defaultValue, description, dirty, disabled, error,
|
|
|
62
63
|
whiteSpace: "nowrap",
|
|
63
64
|
selection: false,
|
|
64
65
|
align: isVertical ? "center" : "end",
|
|
65
|
-
render: /* @__PURE__ */ jsx(Slider.Value, {})
|
|
66
|
+
render: /* @__PURE__ */ jsx(Slider.Value, { children: typeof renderValue === "function" ? renderValue : void 0 })
|
|
66
67
|
})]
|
|
67
68
|
}), /* @__PURE__ */ jsx(SliderControl, {
|
|
68
69
|
isRange,
|
|
@@ -17,7 +17,7 @@ var TooltipContent = ({ children, sideOffset = 8, container, ...positionerProps
|
|
|
17
17
|
color: 1,
|
|
18
18
|
border: "all",
|
|
19
19
|
radius: "medium",
|
|
20
|
-
"data-vibrant":
|
|
20
|
+
"data-vibrant": true
|
|
21
21
|
}),
|
|
22
22
|
children: /* @__PURE__ */ jsx(Tooltip.Viewport, {
|
|
23
23
|
className: tooltip_module_default.Viewport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viraui/react",
|
|
3
|
-
"version": "2026.0.
|
|
3
|
+
"version": "2026.0.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"unplugin-dts": "1.0.3",
|
|
36
36
|
"vite": "8.1.4",
|
|
37
37
|
"vite-plugin-static-copy": "4.1.1",
|
|
38
|
-
"@viraui/foundation": "2026.0.
|
|
39
|
-
"@viraui/icons": "2026.0.0",
|
|
38
|
+
"@viraui/foundation": "2026.0.20",
|
|
40
39
|
"@viraui/postcss-config": "2026.0.0",
|
|
41
|
-
"@viraui/tsconfig": "2026.0.0"
|
|
40
|
+
"@viraui/tsconfig": "2026.0.0",
|
|
41
|
+
"@viraui/icons": "2026.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@base-ui/react": ">=1.6.0",
|