@chayns-components/core
Version:
A set of beautiful React components for developing your own applications with chayns.
137 lines (129 loc) • 4.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StyledSliderButtonWrapper = exports.StyledSliderButtonPopupContentItem = exports.StyledSliderButtonPopupContent = exports.StyledSliderButtonItem = exports.StyledSliderButtonButtonsWrapper = exports.StyledSliderButton = exports.StyledMotionSliderButtonThumb = void 0;
var _react = require("motion/react");
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const StyledSliderButton = exports.StyledSliderButton = _styledComponents.default.div`
opacity: ${({
$isDisabled
}) => $isDisabled ? 0.5 : 1};
width: 100%;
touch-action: none;
position: relative;
`;
const StyledSliderButtonWrapper = exports.StyledSliderButtonWrapper = _styledComponents.default.div`
align-items: center;
border-radius: ${({
$isRounded
}) => $isRounded ? 32 : 3}px;
border: none;
color: white;
cursor: pointer;
display: inline-flex;
line-height: 1.15;
height: 32px;
position: relative;
user-select: none;
transition: opacity 0.3s ease;
width: ${({
$width
}) => $width}px;
max-width: 100%;
overflow-x: ${({
$isDisabled
}) => $isDisabled ? 'hidden' : 'scroll'};
overflow-y: hidden;
// Chrome
&::-webkit-scrollbar {
display: none;
}
// IE and Edge
-ms-overflow-style: none;
// Firefox
scrollbar-width: none;
`;
const StyledSliderButtonItem = exports.StyledSliderButtonItem = _styledComponents.default.div`
font-size: 110%;
font-family: 'Roboto Medium', serif;
padding: 7px 12px;
min-width: ${({
$width
}) => $width}px;
max-width: ${({
$width
}) => $width}px;
display: flex;
white-space: nowrap;
justify-content: center;
color: ${({
$isSecondary,
theme
}) => $isSecondary ? theme.text : theme.buttonColor ?? 'white'};
`;
const StyledSliderButtonPopupContent = exports.StyledSliderButtonPopupContent = _styledComponents.default.div`
display: flex;
flex-direction: column;
`;
const StyledSliderButtonPopupContentItem = exports.StyledSliderButtonPopupContentItem = _styledComponents.default.div`
font-size: 110%;
font-family: 'Roboto Medium', serif;
cursor: pointer;
background-color: ${({
$isSelected,
theme
}) => $isSelected ? theme['secondary-102'] : undefined};
padding: 4px 12px;
&:focus-visible {
${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss};
}
`;
const StyledSliderButtonButtonsWrapper = exports.StyledSliderButtonButtonsWrapper = _styledComponents.default.div`
position: absolute;
z-index: ${({
$isInvisible
}) => $isInvisible ? '2' : '4'};
opacity: ${({
$isInvisible
}) => $isInvisible ? 0 : 1};
display: flex;
cursor: pointer;
align-items: center;
pointer-events: ${({
$isInvisible
}) => $isInvisible ? 'auto' : 'none'};
`;
const StyledMotionSliderButtonThumb = exports.StyledMotionSliderButtonThumb = (0, _styledComponents.default)(_react.motion.div)`
font-size: 110%;
font-family: 'Roboto Medium', serif;
opacity: 1;
width: ${({
$width
}) => $width - 8}px;
position: absolute;
border-radius: ${({
$isRounded
}) => $isRounded ? 24 : 3}px;
top: 4px;
left: 4px;
white-space: nowrap;
z-index: 3;
height: 24px;
padding: 7px 12px;
display: flex;
color: white;
justify-content: center;
align-items: center;
cursor: pointer;
${({
$shouldShowKeyboardHighlighting
}) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
&:focus-visible {
${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
}
`}
`;
//# sourceMappingURL=SliderButton.styles.js.map