@wordpress/components
Version:
UI components for WordPress.
50 lines (41 loc) • 1.01 kB
text/typescript
/**
* External dependencies
*/
import { css } from '@emotion/react';
import styled from '@emotion/styled';
/**
* Internal dependencies
*/
import InputControl from '../../input-control';
import { COLORS } from '../../utils';
import Button from '../../button';
import { space } from '../../utils/space';
const htmlArrowStyles = ( { hideHTMLArrows }: { hideHTMLArrows: boolean } ) => {
if ( ! hideHTMLArrows ) {
return ``;
}
return css`
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
-webkit-appearance: none ;
margin: 0 ;
}
input[type='number'] {
-moz-appearance: textfield;
}
`;
};
export const Input = styled( InputControl )`
${ htmlArrowStyles };
`;
export const SpinButton = styled( Button )`
&&&&& {
color: ${ COLORS.theme.accent };
}
`;
const smallSpinButtons = css`
width: ${ space( 5 ) };
min-width: ${ space( 5 ) };
height: ${ space( 5 ) };
`;
export const styles = { smallSpinButtons };