mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 09:21:22 +08:00
6bb18b361d
* feat: implement `panelRender` api and add demo * test: add test case * docs: update doc * fix: styles add overlayInnerStyle * fix: variable name * docs: reorder api * refactor: optimize code * test: update snapshot * test: update snapshots * refactor: remove memo * refactor: rename overlayInnerStyle to popupOverlayInner * fix: props error * docs: update demo
75 lines
2.0 KiB
TypeScript
75 lines
2.0 KiB
TypeScript
import type { CSSObject } from '@ant-design/cssinjs';
|
|
import type { GenerateStyle } from '../../theme/internal';
|
|
import { getTransBg } from './color-block';
|
|
import type { ColorPickerToken } from './index';
|
|
|
|
const genPickerStyle: GenerateStyle<ColorPickerToken, CSSObject> = (token) => {
|
|
const {
|
|
componentCls,
|
|
controlHeightLG,
|
|
borderRadiusSM,
|
|
colorPickerInsetShadow,
|
|
marginSM,
|
|
colorBgElevated,
|
|
colorFillSecondary,
|
|
lineWidthBold,
|
|
colorPickerHandlerSize,
|
|
colorPickerHandlerSizeSM,
|
|
colorPickerSliderHeight,
|
|
} = token;
|
|
|
|
return {
|
|
[`${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': getTransBg(`${colorPickerSliderHeight}px`, token.colorFillSecondary),
|
|
marginBottom: marginSM,
|
|
},
|
|
|
|
[`${componentCls}-slider-container`]: {
|
|
display: 'flex',
|
|
gap: marginSM,
|
|
[`${componentCls}-slider-group`]: {
|
|
flex: 1,
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
export default genPickerStyle;
|