1
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
}
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [string, string];
|
||||
export default _default;
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
import { genCompactItemStyle } from '../../style/compact-item';
|
||||
import { genStyleHooks } from '../../theme/internal';
|
||||
import { genCssVar } from '../../theme/util/genStyleUtils';
|
||||
const genSpaceAddonStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
borderRadius,
|
||||
paddingSM,
|
||||
colorBorder,
|
||||
paddingXS,
|
||||
fontSizeLG,
|
||||
fontSizeSM,
|
||||
borderRadiusLG,
|
||||
borderRadiusSM,
|
||||
colorBgContainerDisabled,
|
||||
lineWidth,
|
||||
antCls
|
||||
} = token;
|
||||
const [varName, varRef] = genCssVar(antCls, 'space');
|
||||
return {
|
||||
[componentCls]: [
|
||||
// ==========================================================
|
||||
// == Base ==
|
||||
// ==========================================================
|
||||
{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: 0,
|
||||
whiteSpace: 'nowrap',
|
||||
paddingInline: paddingSM,
|
||||
margin: 0,
|
||||
borderWidth: lineWidth,
|
||||
borderStyle: 'solid',
|
||||
borderRadius,
|
||||
'&:hover': {
|
||||
zIndex: 0
|
||||
},
|
||||
[`&${componentCls}-disabled`]: {
|
||||
color: token.colorTextDisabled
|
||||
},
|
||||
'&-large': {
|
||||
fontSize: fontSizeLG,
|
||||
borderRadius: borderRadiusLG
|
||||
},
|
||||
'&-small': {
|
||||
paddingInline: paddingXS,
|
||||
borderRadius: borderRadiusSM,
|
||||
fontSize: fontSizeSM
|
||||
},
|
||||
'&-compact-last-item': {
|
||||
borderEndStartRadius: 0,
|
||||
borderStartStartRadius: 0
|
||||
},
|
||||
'&-compact-first-item': {
|
||||
borderEndEndRadius: 0,
|
||||
borderStartEndRadius: 0
|
||||
},
|
||||
'&-compact-item:not(:first-child):not(:last-child)': {
|
||||
borderRadius: 0
|
||||
},
|
||||
'&-compact-item:not(:last-child)': {
|
||||
borderInlineEndWidth: 0
|
||||
},
|
||||
'&-compact-item:not(:first-child)': {
|
||||
borderInlineStartWidth: 0
|
||||
}
|
||||
},
|
||||
// ==========================================================
|
||||
// == Variants ==
|
||||
// ==========================================================
|
||||
{
|
||||
[varName('addon-border-color')]: colorBorder,
|
||||
[varName('addon-background')]: colorBgContainerDisabled,
|
||||
// Filled
|
||||
[varName('addon-border-color-outlined')]: colorBorder,
|
||||
[varName('addon-background-filled')]: colorBgContainerDisabled,
|
||||
borderColor: varRef('addon-border-color'),
|
||||
background: varRef('addon-background'),
|
||||
// ======================= Outlined =======================
|
||||
'&-variant-outlined': {
|
||||
[varName('addon-border-color')]: varRef('addon-border-color-outlined')
|
||||
},
|
||||
// ======================== Filled ========================
|
||||
'&-variant-filled': {
|
||||
[varName('addon-border-color')]: 'transparent',
|
||||
[varName('addon-background')]: varRef('addon-background-filled'),
|
||||
// Disabled
|
||||
[`&${componentCls}-disabled`]: {
|
||||
[varName('addon-border-color')]: colorBorder,
|
||||
[varName('addon-background')]: colorBgContainerDisabled
|
||||
}
|
||||
},
|
||||
// ====================== Borderless ======================
|
||||
'&-variant-borderless': {
|
||||
border: 'none',
|
||||
background: 'transparent'
|
||||
},
|
||||
// ====================== Underlined ======================
|
||||
'&-variant-underlined': {
|
||||
border: 'none',
|
||||
background: 'transparent'
|
||||
}
|
||||
},
|
||||
// ==========================================================
|
||||
// == Status ==
|
||||
// ==========================================================
|
||||
{
|
||||
'&-status-error': {
|
||||
[varName('addon-border-color-outlined')]: token.colorError,
|
||||
[varName('addon-background-filled')]: token.colorErrorBg,
|
||||
color: token.colorError
|
||||
},
|
||||
'&-status-warning': {
|
||||
[varName('addon-border-color-outlined')]: token.colorWarning,
|
||||
[varName('addon-background-filled')]: token.colorWarningBg,
|
||||
color: token.colorWarning
|
||||
}
|
||||
}]
|
||||
};
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
export default genStyleHooks(['Space', 'Addon'], token => [genSpaceAddonStyle(token), genCompactItemStyle(token, {
|
||||
focus: false
|
||||
})]);
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
}
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [string, string];
|
||||
export default _default;
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { genStyleHooks } from '../../theme/internal';
|
||||
const genSpaceCompactStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
display: 'inline-flex',
|
||||
'&-block': {
|
||||
display: 'flex',
|
||||
width: '100%'
|
||||
},
|
||||
'&-vertical': {
|
||||
flexDirection: 'column'
|
||||
},
|
||||
'&-rtl': {
|
||||
direction: 'rtl'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
export default genStyleHooks(['Space', 'Compact'], genSpaceCompactStyle, () => ({}), {
|
||||
// Space component don't apply extra font style
|
||||
// https://github.com/ant-design/ant-design/issues/40315
|
||||
resetStyle: false
|
||||
});
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import type { GetDefaultToken } from '../../theme/internal';
|
||||
/** Component only token. Which will handle additional calculation of alias token */
|
||||
export interface ComponentToken {
|
||||
}
|
||||
export declare const prepareComponentToken: GetDefaultToken<'Space'>;
|
||||
declare const _default: (prefixCls: string, rootCls?: string) => readonly [string, string];
|
||||
export default _default;
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
||||
const genSpaceStyle = token => {
|
||||
const {
|
||||
componentCls,
|
||||
antCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
display: 'inline-flex',
|
||||
'&-rtl': {
|
||||
direction: 'rtl'
|
||||
},
|
||||
'&-vertical': {
|
||||
flexDirection: 'column'
|
||||
},
|
||||
'&-align': {
|
||||
flexDirection: 'column',
|
||||
'&-center': {
|
||||
alignItems: 'center'
|
||||
},
|
||||
'&-start': {
|
||||
alignItems: 'flex-start'
|
||||
},
|
||||
'&-end': {
|
||||
alignItems: 'flex-end'
|
||||
},
|
||||
'&-baseline': {
|
||||
alignItems: 'baseline'
|
||||
}
|
||||
},
|
||||
[`${componentCls}-item:empty`]: {
|
||||
display: 'none'
|
||||
},
|
||||
// https://github.com/ant-design/ant-design/issues/47875
|
||||
[`${componentCls}-item > ${antCls}-badge-not-a-wrapper:only-child`]: {
|
||||
display: 'block'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
const genSpaceGapStyle = token => {
|
||||
const {
|
||||
componentCls
|
||||
} = token;
|
||||
return {
|
||||
[componentCls]: {
|
||||
'&-gap-row-small': {
|
||||
rowGap: token.spaceGapSmallSize
|
||||
},
|
||||
'&-gap-row-medium, &-gap-row-middle': {
|
||||
rowGap: token.spaceGapMiddleSize
|
||||
},
|
||||
'&-gap-row-large': {
|
||||
rowGap: token.spaceGapLargeSize
|
||||
},
|
||||
'&-gap-col-small': {
|
||||
columnGap: token.spaceGapSmallSize
|
||||
},
|
||||
'&-gap-col-medium, &-gap-col-middle': {
|
||||
columnGap: token.spaceGapMiddleSize
|
||||
},
|
||||
'&-gap-col-large': {
|
||||
columnGap: token.spaceGapLargeSize
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
// ============================== Export ==============================
|
||||
export const prepareComponentToken = () => ({});
|
||||
export default genStyleHooks('Space', token => {
|
||||
const spaceToken = mergeToken(token, {
|
||||
spaceGapSmallSize: token.paddingXS,
|
||||
spaceGapMiddleSize: token.padding,
|
||||
spaceGapLargeSize: token.paddingLG
|
||||
});
|
||||
return [genSpaceStyle(spaceToken), genSpaceGapStyle(spaceToken)];
|
||||
}, () => ({}), {
|
||||
// Space component don't apply extra font style
|
||||
// https://github.com/ant-design/ant-design/issues/40315
|
||||
resetStyle: false
|
||||
});
|
||||
Reference in New Issue
Block a user