antd
Version:
An enterprise-class UI design language and React components implementation
74 lines (73 loc) • 2.2 kB
JavaScript
;
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _colorBlock = _interopRequireWildcard(require("./color-block"));
const genPickerStyle = token => {
const {
componentCls,
controlHeightLG,
borderRadiusSM,
colorPickerInsetShadow,
marginSM,
colorBgElevated,
colorFillSecondary,
lineWidthBold,
colorPickerHandlerSize,
colorPickerHandlerSizeSM,
colorPickerSliderHeight,
colorPickerPreviewSize
} = token;
return Object.assign({
[`${componentCls}-select`]: {
[`${componentCls}-palette`]: {
minHeight: controlHeightLG * 4,
overflow: 'hidden',
borderRadius: borderRadiusSM
},
[`${componentCls}-saturation`]: {
position: 'absolute',
borderRadius: 'inherit',
boxShadow: colorPickerInsetShadow,
inset: 0
},
marginBottom: marginSM
},
[`${componentCls}-handler`]: {
width: colorPickerHandlerSize,
height: colorPickerHandlerSize,
border: `${lineWidthBold}px solid ${colorBgElevated}`,
position: 'relative',
borderRadius: '50%',
cursor: 'pointer',
boxShadow: `${colorPickerInsetShadow}, 0 0 0 1px ${colorFillSecondary}`,
'&-sm': {
width: colorPickerHandlerSizeSM,
height: colorPickerHandlerSizeSM
}
},
[`${componentCls}-slider`]: {
borderRadius: colorPickerSliderHeight / 2,
[`${componentCls}-palette`]: {
height: colorPickerSliderHeight
},
[`${componentCls}-gradient`]: {
borderRadius: colorPickerSliderHeight / 2,
boxShadow: colorPickerInsetShadow
},
'&-alpha': (0, _colorBlock.getTransBg)(`${colorPickerSliderHeight}px`, token.colorFillSecondary),
marginBottom: marginSM
},
[`${componentCls}-slider-container`]: {
display: 'flex',
gap: marginSM,
[`${componentCls}-slider-group`]: {
flex: 1
}
}
}, (0, _colorBlock.default)(token, colorPickerPreviewSize));
};
var _default = genPickerStyle;
exports.default = _default;