token.js 900 B

1234567891011121314151617181920
  1. import { FastColor } from '@ant-design/fast-color';
  2. import { initComponentToken } from '../../input/style/token';
  3. export const prepareComponentToken = token => {
  4. var _a;
  5. const handleVisible = (_a = token.handleVisible) !== null && _a !== void 0 ? _a : 'auto';
  6. const handleWidth = token.controlHeightSM - token.lineWidth * 2;
  7. return Object.assign(Object.assign({}, initComponentToken(token)), {
  8. controlWidth: 90,
  9. handleWidth,
  10. handleFontSize: token.fontSize / 2,
  11. handleVisible,
  12. handleActiveBg: token.colorFillAlter,
  13. handleBg: token.colorBgContainer,
  14. filledHandleBg: new FastColor(token.colorFillSecondary).onBackground(token.colorBgContainer).toHexString(),
  15. handleHoverColor: token.colorPrimary,
  16. handleBorderColor: token.colorBorder,
  17. handleOpacity: handleVisible === true ? 1 : 0,
  18. handleVisibleWidth: handleVisible === true ? handleWidth : 0
  19. });
  20. };