2022-10-25 17:04:36 +08:00
|
|
|
import type { DerivativeFunc } from '@ant-design/cssinjs';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2022-12-09 17:52:34 +08:00
|
|
|
import type { MapToken, SeedToken } from '../../interface';
|
2022-10-25 17:04:36 +08:00
|
|
|
import defaultAlgorithm from '../default';
|
2024-04-08 14:04:08 +08:00
|
|
|
import genControlHeight from '../shared/genControlHeight';
|
2022-12-09 17:52:34 +08:00
|
|
|
import genFontMapToken from '../shared/genFontMapToken';
|
2024-04-08 14:04:08 +08:00
|
|
|
import genCompactSizeMapToken from './genCompactSizeMapToken';
|
2022-10-25 17:04:36 +08:00
|
|
|
|
|
|
|
const derivative: DerivativeFunc<SeedToken, MapToken> = (token, mapToken) => {
|
|
|
|
const mergedMapToken = mapToken ?? defaultAlgorithm(token);
|
|
|
|
|
2022-12-09 17:52:34 +08:00
|
|
|
const fontSize = mergedMapToken.fontSizeSM; // Smaller size font-size as base
|
2022-11-01 15:06:38 +08:00
|
|
|
const controlHeight = mergedMapToken.controlHeight - 4;
|
|
|
|
|
2022-10-25 17:04:36 +08:00
|
|
|
return {
|
|
|
|
...mergedMapToken,
|
2022-11-01 15:06:38 +08:00
|
|
|
...genCompactSizeMapToken(mapToken ?? token),
|
|
|
|
|
|
|
|
// font
|
2022-12-09 17:52:34 +08:00
|
|
|
...genFontMapToken(fontSize),
|
2022-11-01 15:06:38 +08:00
|
|
|
|
|
|
|
// controlHeight
|
|
|
|
controlHeight,
|
|
|
|
...genControlHeight({ ...mergedMapToken, controlHeight }),
|
2022-10-25 17:04:36 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default derivative;
|