Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextareaControl: Update styles #64586

Merged
merged 9 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
- `UnitControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Popover`: allow `style` prop usage ([#64489](https://github.com/WordPress/gutenberg/pull/64489)).
- `ToolsPanel`: sets column-gap to 16px for ToolsPanel grid ([#64497](https://github.com/WordPress/gutenberg/pull/64497)).
- `TextareaControl`: Update styles ([#64586](https://github.com/WordPress/gutenberg/pull/64586)).

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ Default.args = {
__nextHasNoMarginBottom: true,
label: 'Text',
help: 'Enter some text',
placeholder: 'Placeholder',
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,86 @@
* External dependencies
*/
import styled from '@emotion/styled';
import { css } from '@emotion/react';

/**
* Internal dependencies
*/
import { inputControl } from '../../utils/input';
import { font } from '../../utils/font';
import { COLORS } from '../../utils/colors-values';
import { CONFIG } from '../../utils';
import { breakpoint } from '../../utils/breakpoint';

const inputStyleNeutral = css`
box-shadow: 0 0 0 transparent;
border-radius: ${ CONFIG.radiusSmall };
border: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border };

@media not ( prefers-reduced-motion ) {
transition: box-shadow 0.1s linear;
}
`;

const inputStyleFocus = css`
border-color: ${ COLORS.theme.accent };
box-shadow: 0 0 0
calc( ${ CONFIG.borderWidthFocus } - ${ CONFIG.borderWidth } )
${ COLORS.theme.accent };

// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
`;

export const StyledTextarea = styled.textarea`
width: 100%;
${ inputControl }
display: block;
font-family: ${ font( 'default.fontFamily' ) };
line-height: 20px;

// Vertical padding is to match the standard 40px control height when rows=1,
// in conjunction with the 20px line-height.
// "Standard" metrics are 10px 12px, but subtracts 1px each to account for the border width.
padding: 9px 11px;

${ inputStyleNeutral };

/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: ${ font( 'mobileTextMinFontSize' ) };

${ breakpoint( 'small' ) } {
font-size: ${ font( 'default.fontSize' ) };
}

&:focus {
${ inputStyleFocus }
}

// Use opacity to work in various editor styles.
&::-webkit-input-placeholder {
color: ${ COLORS.ui.darkGrayPlaceholder };
}

&::-moz-placeholder {
opacity: 1; // Necessary because Firefox reduces this from 1.
color: ${ COLORS.ui.darkGrayPlaceholder };
}

&:-ms-input-placeholder {
color: ${ COLORS.ui.darkGrayPlaceholder };
}

.is-dark-theme & {
&::-webkit-input-placeholder {
color: ${ COLORS.ui.lightGrayPlaceholder };
}

&::-moz-placeholder {
opacity: 1; // Necessary because Firefox reduces this from 1.
color: ${ COLORS.ui.lightGrayPlaceholder };
}

&:-ms-input-placeholder {
color: ${ COLORS.ui.lightGrayPlaceholder };
}
}
`;
30 changes: 0 additions & 30 deletions packages/components/src/utils/input/base.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/components/src/utils/input/index.js

This file was deleted.

63 changes: 0 additions & 63 deletions packages/components/src/utils/input/input-control.js

This file was deleted.

Loading