mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
commit
7a3e697c11
@ -36,6 +36,13 @@ export const genCheckboxStyle: GenerateStyle<CheckboxToken> = (token) => {
|
||||
...resetComponent(token),
|
||||
|
||||
display: 'inline-flex',
|
||||
flexWrap: 'wrap',
|
||||
columnGap: token.marginXS,
|
||||
|
||||
// Group > Grid
|
||||
[`> ${token.antCls}-row`]: {
|
||||
flex: 1,
|
||||
},
|
||||
},
|
||||
|
||||
// Wrapper
|
||||
@ -56,7 +63,7 @@ export const genCheckboxStyle: GenerateStyle<CheckboxToken> = (token) => {
|
||||
|
||||
// Checkbox near checkbox
|
||||
[`& + ${wrapperCls}`]: {
|
||||
marginInlineStart: token.marginXS,
|
||||
marginInlineStart: 0,
|
||||
},
|
||||
|
||||
[`&${wrapperCls}-in-form-item`]: {
|
||||
|
@ -14748,7 +14748,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize large 1
|
||||
class="config-space-compact config-space-compact-block config-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-compact-item config-btn-compact-first-item"
|
||||
class="config-btn config-btn-default config-btn-lg config-btn-compact-item config-btn-compact-first-item"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -14756,7 +14756,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize large 1
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
|
||||
class="config-btn config-btn-default config-btn-lg config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -14834,7 +14834,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize small 1
|
||||
class="config-space-compact config-space-compact-block config-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-compact-item config-btn-compact-first-item"
|
||||
class="config-btn config-btn-default config-btn-sm config-btn-compact-item config-btn-compact-first-item"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -14842,7 +14842,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize small 1
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
|
||||
class="config-btn config-btn-default config-btn-sm config-btn-icon-only config-btn-compact-item config-btn-compact-last-item config-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
|
@ -5,6 +5,7 @@ import * as React from 'react';
|
||||
import type { DirectionType } from '../config-provider';
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
import SizeContext from '../config-provider/SizeContext';
|
||||
|
||||
import useStyle from './style';
|
||||
|
||||
@ -64,9 +65,10 @@ const CompactItem: React.FC<React.PropsWithChildren<SpaceCompactItemContextType>
|
||||
|
||||
const Compact: React.FC<SpaceCompactProps> = (props) => {
|
||||
const { getPrefixCls, direction: directionConfig } = React.useContext(ConfigContext);
|
||||
const sizeInContext = React.useContext(SizeContext);
|
||||
|
||||
const {
|
||||
size = 'middle',
|
||||
size = sizeInContext || 'middle',
|
||||
direction,
|
||||
block,
|
||||
prefixCls: customizePrefixCls,
|
||||
|
@ -7,6 +7,7 @@ import { render } from '../../../tests/utils';
|
||||
import AutoComplete from '../../auto-complete';
|
||||
import Button from '../../button';
|
||||
import Cascader from '../../cascader';
|
||||
import ConfigProvider from '../../config-provider';
|
||||
import DatePicker from '../../date-picker';
|
||||
import Drawer from '../../drawer';
|
||||
import Dropdown from '../../dropdown';
|
||||
@ -311,4 +312,29 @@ describe('Space.Compact', () => {
|
||||
?.classList.contains('ant-picker-compact-item'),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/41876
|
||||
it('Space.Compact should inherit the size from ConfigProvider if the componentSize is set', () => {
|
||||
const { container } = render(
|
||||
<ConfigProvider componentSize="large">
|
||||
<Space.Compact>
|
||||
<Select placeholder="Select" />
|
||||
</Space.Compact>
|
||||
</ConfigProvider>,
|
||||
);
|
||||
|
||||
expect(container.querySelectorAll('.ant-select-lg')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('The size property of Space.Compact should have an higher priority over the componentSize property of ConfigProvider', () => {
|
||||
const { container } = render(
|
||||
<ConfigProvider componentSize="large">
|
||||
<Space.Compact size="small">
|
||||
<Select placeholder="Select" />
|
||||
</Space.Compact>
|
||||
</ConfigProvider>,
|
||||
);
|
||||
|
||||
expect(container.querySelectorAll('.ant-select-sm')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
@ -138,7 +138,7 @@ const InternalTag: React.ForwardRefRenderFunction<HTMLSpanElement, TagProps> = (
|
||||
return wrapSSR(isNeedWave ? <Wave>{tagNode}</Wave> : tagNode);
|
||||
};
|
||||
|
||||
const Tag = React.forwardRef<unknown, TagProps>(InternalTag) as TagType;
|
||||
const Tag = React.forwardRef<HTMLSpanElement , TagProps>(InternalTag) as TagType;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Tag.displayName = 'Tag';
|
||||
|
Loading…
Reference in New Issue
Block a user