Browse Source

chore: auto merge branches (#42231)

chore: sync master into feature
pull/42258/head
github-actions[bot] 2 years ago
committed by GitHub
parent
commit
7a3e697c11
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      components/checkbox/style/index.ts
  2. 8
      components/config-provider/__tests__/__snapshots__/components.test.tsx.snap
  3. 4
      components/space/Compact.tsx
  4. 26
      components/space/__tests__/space-compact.test.tsx
  5. 2
      components/tag/index.tsx

9
components/checkbox/style/index.ts

@ -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`]: {

8
components/config-provider/__tests__/__snapshots__/components.test.tsx.snap

@ -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

4
components/space/Compact.tsx

@ -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,

26
components/space/__tests__/space-compact.test.tsx

@ -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);
});
});

2
components/tag/index.tsx

@ -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…
Cancel
Save