1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import sliderClasses from "./sliderClasses.js";
|
7 | import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
8 | const useValueLabelClasses = props => {
|
9 | const {
|
10 | open
|
11 | } = props;
|
12 | const utilityClasses = {
|
13 | offset: clsx(open && sliderClasses.valueLabelOpen),
|
14 | circle: sliderClasses.valueLabelCircle,
|
15 | label: sliderClasses.valueLabelLabel
|
16 | };
|
17 | return utilityClasses;
|
18 | };
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | export default function SliderValueLabel(props) {
|
24 | const {
|
25 | children,
|
26 | className,
|
27 | value
|
28 | } = props;
|
29 | const classes = useValueLabelClasses(props);
|
30 | if (!children) {
|
31 | return null;
|
32 | }
|
33 | return React.cloneElement(children, {
|
34 | className: clsx(children.props.className)
|
35 | }, _jsxs(React.Fragment, {
|
36 | children: [children.props.children, _jsx("span", {
|
37 | className: clsx(classes.offset, className),
|
38 | "aria-hidden": true,
|
39 | children: _jsx("span", {
|
40 | className: classes.circle,
|
41 | children: _jsx("span", {
|
42 | className: classes.label,
|
43 | children: value
|
44 | })
|
45 | })
|
46 | })]
|
47 | }));
|
48 | }
|
49 | process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes = {
|
50 | children: PropTypes.element.isRequired,
|
51 | className: PropTypes.string,
|
52 | value: PropTypes.node
|
53 | } : void 0; |
\ | No newline at end of file |