antd
Version:
An enterprise-class UI design language and React components implementation
118 lines (117 loc) • 4.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _cssinjs = require("@ant-design/cssinjs");
var _style = require("../../style");
var _genStyleUtils = require("../../theme/util/genStyleUtils");
const genGroupStyle = token => {
const {
componentCls,
antCls,
floatButtonSize,
padding
} = token;
const groupCls = `${componentCls}-group`;
const listCls = `${groupCls}-list`;
// Default: '--ant-float-btn-'
const getCssVar = (0, _genStyleUtils.genCssVar)(antCls, 'float-btn');
return {
[groupCls]: [
// ==============================================================
// == Variable ==
// ==============================================================
{
[getCssVar('list-transform-start')]: `translate(0,${(0, _cssinjs.unit)(floatButtonSize)})`,
[getCssVar('list-trigger-offset')]: `calc(${(0, _cssinjs.unit)(floatButtonSize)} + ${(0, _cssinjs.unit)(padding)})`
},
// ==============================================================
// == Template ==
// ==============================================================
{
...(0, _style.resetComponent)(token),
position: 'fixed',
zIndex: token.zIndexPopupBase,
insetInlineEnd: token.floatButtonInsetInlineEnd,
bottom: token.floatButtonInsetBlockEnd,
gap: padding,
'&-rtl': {
direction: 'rtl'
},
// =========================== Pure ===========================
[`&${componentCls}-pure`]: {
position: 'relative',
inset: 'auto'
},
// ========================== Button ==========================
[componentCls]: {
position: 'relative',
inset: 'auto'
}
},
// ==============================================================
// == List ==
// ==============================================================
{
// ======================== Individual ========================
// Not in group
[`&:not(${groupCls}-individual) ${listCls}`]: {
boxShadow: token.boxShadowSecondary
},
[`&${groupCls}-individual ${listCls}`]: {
gap: padding
},
// =========================== Menu ===========================
[`&-menu-mode ${listCls}`]: {
position: 'absolute'
},
// ========================== Motion ==========================
[listCls]: {
borderRadius: token.borderRadiusLG,
'&-motion': {
transition: `all ${token.motionDurationSlow}`,
'&-enter, &-appear': {
opacity: 0,
transform: getCssVar('list-transform-start', true),
'&-active': {
opacity: 1,
transform: `translate(0, 0)`
}
},
'&-leave': {
'&-active': {
opacity: 0,
transform: getCssVar('list-transform-start', true)
}
}
}
},
// ======================== Placements ========================
'&-top': {
[listCls]: {
bottom: getCssVar('list-trigger-offset', true)
}
},
'&-bottom': {
[listCls]: {
[getCssVar('list-transform-start')]: `translate(0, calc(${(0, _cssinjs.unit)(floatButtonSize)} * -1))`,
top: getCssVar('list-trigger-offset', true)
}
},
'&-left': {
[listCls]: {
[getCssVar('list-transform-start')]: `translate(${(0, _cssinjs.unit)(floatButtonSize)}, 0)`,
right: getCssVar('list-trigger-offset', true)
}
},
'&-right': {
[listCls]: {
[getCssVar('list-transform-start')]: `translate(calc(${(0, _cssinjs.unit)(floatButtonSize)} * -1), 0)`,
left: getCssVar('list-trigger-offset', true)
}
}
}]
};
};
var _default = exports.default = genGroupStyle;