diff --git a/components/button/button.tsx b/components/button/button.tsx index cdcc240687..0a589cad70 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -210,7 +210,7 @@ const InternalButton: React.ForwardRefRenderFunction< const sizeClassNameMap = { large: 'lg', small: 'sm', middle: undefined }; - const sizeFullname = useSize((ctxSize) => compactSize ?? groupSize ?? customizeSize ?? ctxSize); + const sizeFullname = useSize((ctxSize) => customizeSize ?? compactSize ?? groupSize ?? ctxSize); const sizeCls = sizeFullname ? sizeClassNameMap[sizeFullname] || '' : ''; diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 662b51bcd4..08ab5a23bf 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -229,7 +229,7 @@ const Cascader = React.forwardRef((props: CascaderProps, ref: React.Ref compactSize ?? customizeSize ?? ctx); + const mergedSize = useSize((ctx) => customizeSize ?? compactSize ?? ctx); // ===================== Disabled ===================== const disabled = React.useContext(DisabledContext); diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx index 7159b8adfd..7304cbb627 100644 --- a/components/date-picker/generatePicker/generateRangePicker.tsx +++ b/components/date-picker/generatePicker/generateRangePicker.tsx @@ -78,7 +78,7 @@ export default function generateRangePicker(generateConfig: GenerateCo } // ===================== Size ===================== - const mergedSize = useSize((ctx) => compactSize ?? customizeSize ?? ctx); + const mergedSize = useSize((ctx) => customizeSize ?? compactSize ?? ctx); // ===================== Disabled ===================== const disabled = React.useContext(DisabledContext); diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx index c6c085394c..6901ca14af 100644 --- a/components/date-picker/generatePicker/generateSinglePicker.tsx +++ b/components/date-picker/generatePicker/generateSinglePicker.tsx @@ -103,7 +103,7 @@ export default function generatePicker(generateConfig: GenerateConfig< } // ===================== Size ===================== - const mergedSize = useSize((ctx) => compactSize ?? customizeSize ?? ctx); + const mergedSize = useSize((ctx) => customizeSize ?? compactSize ?? ctx); // ===================== Disabled ===================== const disabled = React.useContext(DisabledContext); diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx index 83733028f4..ef5f8e784c 100644 --- a/components/input-number/index.tsx +++ b/components/input-number/index.tsx @@ -87,7 +87,7 @@ const InputNumber = React.forwardRef((props, } = React.useContext(FormItemInputContext); const mergedStatus = getMergedStatus(contextStatus, customStatus); - const mergedSize = useSize((ctx) => compactSize ?? customizeSize ?? ctx); + const mergedSize = useSize((ctx) => customizeSize ?? compactSize ?? ctx); const hasPrefix = prefix != null || hasFeedback; const hasAddon = !!(addonBefore || addonAfter); diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 4bbae04774..1517c93ff5 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -97,7 +97,7 @@ const Input = forwardRef((props, ref) => { const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction); // ===================== Size ===================== - const mergedSize = useSize((ctx) => compactSize ?? customSize ?? ctx); + const mergedSize = useSize((ctx) => customSize ?? compactSize ?? ctx); // ===================== Disabled ===================== const disabled = React.useContext(DisabledContext); diff --git a/components/input/Search.tsx b/components/input/Search.tsx index 61ddd99be6..1708308129 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -49,7 +49,7 @@ const Search = React.forwardRef((props, ref) => { const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls); const { compactSize } = useCompactItemContext(prefixCls, direction); - const size = useSize((ctx) => compactSize ?? customizeSize ?? ctx); + const size = useSize((ctx) => customizeSize ?? compactSize ?? ctx); const inputRef = React.useRef(null); diff --git a/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap index 6e59fb7707..27990aa93a 100644 --- a/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -5194,7 +5194,7 @@ exports[`renders components/input/demo/compact-style.tsx extend context correctl class="ant-space-compact" > compactSize ?? customizeSize ?? ctx); + const mergedSize = useSize((ctx) => customizeSize ?? compactSize ?? ctx); // ===================== Disabled ===================== const disabled = React.useContext(DisabledContext); diff --git a/components/space/Compact.tsx b/components/space/Compact.tsx index b1046365a6..c0e7cb2add 100644 --- a/components/space/Compact.tsx +++ b/components/space/Compact.tsx @@ -78,7 +78,7 @@ const Compact: React.FC = (props) => { ...restProps } = props; - const mergedSize = useSize((ctx) => size ?? ctx ?? 'middle'); + const mergedSize = useSize((ctx) => size ?? ctx); const prefixCls = getPrefixCls('space-compact', customizePrefixCls); const [wrapSSR, hashId] = useStyle(prefixCls); diff --git a/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap index 0b0ebc1972..5bacb84efe 100644 --- a/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/space/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -871,7 +871,7 @@ exports[`renders components/space/demo/compact.tsx extend context correctly 1`] class="ant-space-compact ant-space-compact-block" >