@braineet/ui
Version:
Braineet design system
42 lines • 2.58 kB
JavaScript
var _excluded = ["boxShadow", "active", "hover", "focus"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import styled, { css } from 'styled-components';
var activeStyle = css(["color:", ";background-color:", ";"], function (props) {
return props.theme.colors.brand90;
}, function (p) {
return p.theme.colors.brand10;
});
var padding = css(["padding:", ";"], function (p) {
return p.$hasIcon ? '4px 0.5rem 4px 4px' : '6px 8px';
});
var fillStyles = function fillStyles(props) {
var _props$theme$helpers$ = props.theme.helpers.getFills({
appearance: props.styleType || 'ghost',
color: props.color || 'black',
reverse: props.reverseColor
}),
shadow = _props$theme$helpers$.boxShadow,
active = _props$theme$helpers$.active,
hover = _props$theme$helpers$.hover,
focus = _props$theme$helpers$.focus,
defaultStyles = _objectWithoutPropertiesLoose(_props$theme$helpers$, _excluded);
return _extends({}, defaultStyles, {
'&[data-active-item]': hover,
'&:active,&[data-active]': hover,
'&:not([disabled]):hover': hover,
'&:not([disabled]):focus:focus-visible': focus,
'&:not([disabled]):active': active,
'&:not([disabled]):active:focus:focus-visible': active
});
};
export var OptionStyled = styled('div').withConfig({
displayName: "optionsc__OptionStyled",
componentId: "sc-1mwejcs-0"
})(["position:relative;display:flex;justify-content:space-between;cursor:default;min-height:32px;scroll-margin:0.5rem;align-items:center;gap:0.5rem;border-radius:0.25rem;outline:none !important;scroll-margin:0.5rem;scroll-margin-top:3.5rem;transition:background-color 0.1s ease-in-out;cursor:pointer;", " ", " &:hover,&[data-hovered-item]{background-color:", ";}&[data-active-item]{", "}&[aria-disabled='true']{opacity:0.5;cursor:default;}"], padding, fillStyles, function (p) {
return p.theme.colors.blackOpacity10;
}, activeStyle);
export var OptionLabel = styled('div').withConfig({
displayName: "optionsc__OptionLabel",
componentId: "sc-1mwejcs-1"
})(["display:flex;align-items:center;flex-grow:1;min-width:0;span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;}"]);