2024-03-28 14:05:58 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
|
|
|
import type { InputToken } from './token';
|
|
|
|
import { initComponentToken, initInputToken } from './token';
|
|
|
|
|
|
|
|
// =============================== OTP ================================
|
|
|
|
const genOTPStyle: GenerateStyle<InputToken> = (token) => {
|
|
|
|
const { componentCls, paddingXS } = token;
|
|
|
|
|
|
|
|
return {
|
2024-08-05 22:30:55 +08:00
|
|
|
[componentCls]: {
|
2024-03-28 14:05:58 +08:00
|
|
|
display: 'inline-flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
flexWrap: 'nowrap',
|
|
|
|
columnGap: paddingXS,
|
|
|
|
|
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-input`]: {
|
|
|
|
textAlign: 'center',
|
|
|
|
paddingInline: token.paddingXXS,
|
|
|
|
},
|
|
|
|
|
|
|
|
// ================= Size =================
|
|
|
|
[`&${componentCls}-sm ${componentCls}-input`]: {
|
|
|
|
paddingInline: token.calc(token.paddingXXS).div(2).equal(),
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-lg ${componentCls}-input`]: {
|
|
|
|
paddingInline: token.paddingXS,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
|
|
|
export default genStyleHooks(
|
|
|
|
['Input', 'OTP'],
|
|
|
|
(token) => {
|
|
|
|
const inputToken = mergeToken<InputToken>(token, initInputToken(token));
|
|
|
|
|
|
|
|
return [genOTPStyle(inputToken)];
|
|
|
|
},
|
|
|
|
initComponentToken,
|
|
|
|
);
|