1 | import * as React from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import clsx from 'clsx';
|
4 | import sliderUnstyledClasses from './sliderUnstyledClasses';
|
5 | import { jsx as _jsx } from "react/jsx-runtime";
|
6 | import { jsxs as _jsxs } from "react/jsx-runtime";
|
7 |
|
8 | const useValueLabelClasses = props => {
|
9 | const {
|
10 | open
|
11 | } = props;
|
12 | const utilityClasses = {
|
13 | offset: clsx(open && sliderUnstyledClasses.valueLabelOpen),
|
14 | circle: sliderUnstyledClasses.valueLabelCircle,
|
15 | label: sliderUnstyledClasses.valueLabelLabel
|
16 | };
|
17 | return utilityClasses;
|
18 | };
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | function SliderValueLabelUnstyled(props) {
|
25 | const {
|
26 | children,
|
27 | className,
|
28 | value,
|
29 | theme
|
30 | } = props;
|
31 | const classes = useValueLabelClasses(props);
|
32 | return React.cloneElement(children, {
|
33 | className: clsx(children.props.className)
|
34 | }, _jsxs(React.Fragment, {
|
35 | children: [children.props.children, _jsx("span", {
|
36 | className: clsx(classes.offset, className),
|
37 | theme: theme,
|
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 |
|
50 | process.env.NODE_ENV !== "production" ? SliderValueLabelUnstyled.propTypes = {
|
51 | children: PropTypes.element.isRequired,
|
52 | className: PropTypes.string,
|
53 | theme: PropTypes.any,
|
54 | value: PropTypes.node
|
55 | } : void 0;
|
56 | export default SliderValueLabelUnstyled; |
\ | No newline at end of file |