Skip to content

Commit 6fec45f

Browse files
committed
prefer __unstableInputWidth over a css override
1 parent da32f2d commit 6fec45f

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

packages/components/src/range-control/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737

3838
import type { RangeControlProps } from './types';
3939
import type { WordPressComponentProps } from '../ui/context';
40+
import { space } from '../ui/utils/space';
4041

4142
const noop = () => {};
4243

@@ -313,6 +314,9 @@ function UnforwardedRangeControl(
313314
? '__unstable-large'
314315
: 'default'
315316
}
317+
__unstableInputWidth={
318+
__next40pxDefaultSize ? space( 20 ) : space( 16 )
319+
}
316320
step={ step }
317321
// @ts-expect-error TODO: Investigate if the `null` value is necessary
318322
value={ inputSliderValue }

packages/components/src/range-control/styles/range-control-styles.ts

-17
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type {
2020
WrapperProps,
2121
RangeControlProps,
2222
} from '../types';
23-
import type { NumberControlProps } from '../../number-control/types';
2423

2524
const rangeHeightValue = 30;
2625
const railHeight = 4;
@@ -301,28 +300,12 @@ export const Tooltip = styled.span< TooltipProps >`
301300
) }
302301
`;
303302

304-
const inputNumberWidth = ( {
305-
size = 'default',
306-
}: {
307-
size: Exclude< Pick< NumberControlProps, 'size' >[ 'size' ], 'small' >;
308-
} ) => {
309-
const sizes = {
310-
default: space( 16 ),
311-
'__unstable-large': space( 20 ),
312-
};
313-
314-
return css`
315-
width: ${ sizes[ size ?? 'default' ] };
316-
`;
317-
};
318-
319303
// @todo: Refactor RangeControl with latest HStack configuration
320304
// @wordpress/components/ui/hstack.
321305
export const InputNumber = styled( NumberControl )`
322306
display: inline-block;
323307
font-size: 13px;
324308
margin-top: 0;
325-
${ inputNumberWidth };
326309
327310
input[type='number']& {
328311
${ rangeHeight };

0 commit comments

Comments
 (0)