@aplus-frontend/ui
Version:
67 lines (66 loc) • 1.62 kB
JavaScript
import { genComponentStyleHook as t } from "../../utils/cssinjs/index.mjs";
const c = (r) => {
const { componentCls: a, scrollBarTrackWidth: l, scrollBarBarWidth: o } = r;
return {
[a]: {
position: "relative",
"&--horizontal": {
width: "100%",
height: l
},
"&--vertical": {
width: l,
height: "100%"
},
[`${a}__track`]: {
position: "absolute",
width: "100%",
height: "100%",
top: 0,
insetInlineStart: 0,
cursor: "pointer",
backgroundColor: r.scrollBarTrackColor,
"&--disabled": {
pointerEvents: "none",
backgroundColor: r.scrollBarTrackDisabledColor
},
"&--hidden": {
pointerEvents: "none",
backgroundColor: "transparent"
}
},
[`${a}__bar`]: {
position: "absolute",
borderRadius: o,
backgroundColor: r.scrollBarBarColor,
cursor: "pointer",
"&--disabled": {
pointerEvents: "none",
boxShadow: "none"
},
"&--horizontal": {
height: o,
top: r.calc(l).div(2).sub(r.calc(o).div(2)).equal()
},
"&--vertical": {
width: o,
left: r.calc(l).div(2).sub(r.calc(o).div(2)).equal()
}
}
}
};
}, e = t(
"Scrollbar",
(r) => [c(r)],
{
scrollBarBarColor: "#c7c8cc",
scrollBarTrackColor: "#F2F2F2",
scrollBarTrackDisabledColor: "#FAFAFA",
scrollBarBarWidth: 8,
scrollBarTrackWidth: 10
}
);
export {
e as default,
c as genScrollbarStyle
};