Skip to content

Commit

Permalink
Update components radius (#64368)
Browse files Browse the repository at this point in the history
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
5 people authored Aug 16, 2024
1 parent 70d2020 commit a00448a
Show file tree
Hide file tree
Showing 33 changed files with 78 additions and 55 deletions.
2 changes: 1 addition & 1 deletion packages/base-styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $radius-x-small: 1px; // Applied to elements like buttons nested within primit
$radius-small: 2px; // Applied to most primitives.
$radius-medium: 4px; // Applied to containers with smaller padding.
$radius-large: 8px; // Applied to containers with larger padding.
$radius-full: 9999px; // For lozenges.
$radius-full: 9999px; // For pills.
$radius-round: 50%; // For circles and ovals.

/**
Expand Down
26 changes: 26 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@
- `TimePicker`: add `hideLabelFromVision` prop ([#64267](https://github.com/WordPress/gutenberg/pull/64267)).
- `FocalPointPicker`: Default to new 40px size ([#64456](https://github.com/WordPress/gutenberg/pull/64456)).
- `DropdownMenuV2`: adopt elevation scale ([#64432](https://github.com/WordPress/gutenberg/pull/64432)).
- `AlignmentMatrixControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `AnglePickerControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `BorderControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `ButtonGroup`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Button`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `CircularOptionPicker`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `ColorIndicator`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `ColorPalette`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `CustomGradientPicker`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `DropZone`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `DropdownMenuV2`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `FocalPointPicker`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Guide`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Modal`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Placeholder`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Popover`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `ProgressBar`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `RadioControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Snackbar`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `TabPanel`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Text`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `ToggleGroupControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `ToolbarGroup`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Toolbar`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `Tooltip`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
- `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)).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { css } from '@emotion/react';
/**
* Internal dependencies
*/
import { COLORS } from '../../utils';
import { COLORS, CONFIG } from '../../utils';
import type {
AlignmentMatrixControlProps,
AlignmentMatrixControlCellProps,
} from '../types';

export const rootBase = () => {
return css`
border-radius: 2px;
border-radius: ${ CONFIG.radiusMedium };
box-sizing: border-box;
direction: ltr;
display: grid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const CIRCLE_SIZE = 32;
const INNER_CIRCLE_SIZE = 6;

export const CircleRoot = styled.div`
border-radius: 50%;
border-radius: ${ CONFIG.radiusRound };
border: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border };
box-sizing: border-box;
cursor: grab;
Expand All @@ -41,7 +41,7 @@ export const CircleIndicatorWrapper = styled.div`

export const CircleIndicator = styled.div`
background: ${ COLORS.theme.accent };
border-radius: 50%;
border-radius: ${ CONFIG.radiusRound };
box-sizing: border-box;
display: block;
left: 50%;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/border-control/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const colorIndicatorWrapper = (
const { style } = border || {};

return css`
border-radius: 9999px;
border-radius: ${ CONFIG.radiusFull };
border: 2px solid transparent;
${ style ? colorIndicatorBorder( border ) : undefined }
width: ${ size === '__unstable-large' ? '24px' : '22px' };
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/button-group/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
}

&:first-child {
border-radius: $radius-block-ui 0 0 $radius-block-ui;
border-radius: $radius-small 0 0 $radius-small;
}

&:last-child {
border-radius: 0 $radius-block-ui $radius-block-ui 0;
border-radius: 0 $radius-small $radius-small 0;
}

// The focused button should be elevated so the focus ring isn't cropped,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
align-items: center;
box-sizing: border-box;
padding: 6px 12px;
border-radius: $radius-block-ui;
border-radius: $radius-small;
color: $components-color-foreground;

&.is-next-40px-default-size {
Expand Down Expand Up @@ -249,7 +249,7 @@
height: auto;

&:focus {
border-radius: $radius-block-ui;
border-radius: $radius-small;
}

&:disabled,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/circular-option-picker/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ $color-palette-circle-spacing: 12px;
height: 100%;
width: 100%;
border: none;
border-radius: 50%;
border-radius: $radius-round;
background: transparent;
box-shadow: inset 0 0 0 ($color-palette-circle-size * 0.5);
transition: 100ms box-shadow ease;
Expand All @@ -93,7 +93,7 @@ $color-palette-circle-spacing: 12px;
position: absolute;
left: 2px;
top: 2px;
border-radius: 50%;
border-radius: $radius-round;
z-index: z-index(".components-circular-option-picker__option.is-pressed + svg");
pointer-events: none;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/color-indicator/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
width: $grid-unit-50 * 0.5;
height: $grid-unit-50 * 0.5;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
border-radius: 50%;
border-radius: $radius-round;
display: inline-block;
padding: 0;
background: $white linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/color-palette/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $border-as-box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);
cursor: pointer;
// Show a thin outline in Windows high contrast mode.
outline: 1px solid transparent;
border-radius: $radius-block-ui $radius-block-ui 0 0;
border-radius: $radius-medium $radius-medium 0 0;
box-shadow: $border-as-box-shadow;

&:focus {
Expand Down Expand Up @@ -46,7 +46,7 @@ $border-as-box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2);

.components-color-palette__custom-color-text-wrapper {
padding: $grid-unit-15 $grid-unit-20;
border-radius: 0 0 $radius-block-ui $radius-block-ui;
border-radius: 0 0 $radius-medium $radius-medium;
position: relative;
font-size: $default-font-size;

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/custom-gradient-picker/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 16px handles inside, that leaves 32px padding, half of which is 1å6.

.components-custom-gradient-picker__gradient-bar {
border-radius: $radius-block-ui;
border-radius: $radius-small;
width: 100%;
height: $grid-unit-60;
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/drop-zone/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
z-index: z-index(".components-drop-zone");
visibility: hidden;
opacity: 0;
border-radius: $radius-block-ui;
border-radius: $radius-small;

&.is-active {
opacity: 1;
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/dropdown-menu-v2/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const DropdownMenu = styled( Ariakit.Menu )<
padding: ${ CONTENT_WRAPPER_PADDING };
background-color: ${ COLORS.ui.background };
border-radius: 4px;
border-radius: ${ CONFIG.radiusMedium };
${ ( props ) => css`
box-shadow: ${ props.variant === 'toolbar'
? TOOLBAR_VARIANT_BOX_SHADOW
Expand Down Expand Up @@ -150,7 +150,7 @@ const baseItem = css`
line-height: 20px;
color: ${ COLORS.gray[ 900 ] };
border-radius: ${ CONFIG.radiusBlockUi };
border-radius: ${ CONFIG.radiusSmall };
padding-block: ${ ITEM_PADDING_BLOCK };
padding-inline: ${ ITEM_PADDING_INLINE };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const MediaWrapper = styled.div`

export const MediaContainer = styled.div`
align-items: center;
border-radius: ${ CONFIG.radiusBlockUi };
border-radius: ${ CONFIG.radiusSmall };
cursor: pointer;
display: inline-flex;
justify-content: center;
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/guide/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
.components-modal__content {
padding: 0;
margin-top: 0;
border-radius: $radius-block-ui;

&::before {
content: none;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/item-group/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const separated = css`
}
`;

const borderRadius = CONFIG.controlBorderRadius;
const borderRadius = CONFIG.radiusSmall;

export const spacedAround = css`
border-radius: ${ borderRadius };
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/modal/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
width: 100%;
background: $white;
box-shadow: $shadow-modal;
border-radius: $grid-unit-05 $grid-unit-05 0 0;
border-radius: $radius-large $radius-large 0 0;
overflow: hidden;
// Have the content element fill the vertical space yet not overflow.
display: flex;
Expand All @@ -32,7 +32,7 @@

// Show a centered modal on bigger screens.
@include break-small() {
border-radius: $grid-unit-05;
border-radius: $radius-large;
margin: auto;
width: auto;
min-width: $modal-min-width;
Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/palette-edit/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const IndicatorStyled = styled( ColorIndicator )`
export const NameInputControl = styled( InputControl )`
${ InputControlContainer } {
background: ${ COLORS.gray[ 100 ] };
border-radius: ${ CONFIG.controlBorderRadius };
border-radius: ${ CONFIG.radiusXSmall };
${ Input }${ Input }${ Input }${ Input } {
height: ${ space( 8 ) };
}
Expand Down Expand Up @@ -85,17 +85,17 @@ export const PaletteItem = styled( View )`
outline-offset: 0;
}
border-top-left-radius: ${ CONFIG.controlBorderRadius };
border-top-right-radius: ${ CONFIG.controlBorderRadius };
border-top-left-radius: ${ CONFIG.radiusSmall };
border-top-right-radius: ${ CONFIG.radiusSmall };
& + & {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
&:last-child {
border-bottom-left-radius: ${ CONFIG.controlBorderRadius };
border-bottom-right-radius: ${ CONFIG.controlBorderRadius };
border-bottom-left-radius: ${ CONFIG.radiusSmall };
border-bottom-right-radius: ${ CONFIG.radiusSmall };
border-bottom-color: ${ CONFIG.surfaceBorderColor };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/placeholder/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


// Block UI appearance.
border-radius: $radius-block-ui;
border-radius: $radius-medium;
background-color: $white;
box-shadow: inset 0 0 0 $border-width $gray-900;
outline: 1px solid transparent; // Shown for Windows 10 High Contrast mode.
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/popover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900;
.components-popover__content {
background: $white;
box-shadow: $shadow-popover-border-default, $shadow-popover;
border-radius: $radius-block-ui;
border-radius: $radius-medium;
box-sizing: border-box;
width: min-content;

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/progress-bar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const Track = styled.div`
${ COLORS.theme.foreground },
transparent 90%
);
border-radius: ${ CONFIG.radiusBlockUi };
border-radius: ${ CONFIG.radiusFull };
// Windows high contrast mode.
outline: 2px solid transparent;
Expand All @@ -58,7 +58,7 @@ export const Indicator = styled.div< {
position: absolute;
top: 0;
height: 100%;
border-radius: ${ CONFIG.radiusBlockUi };
border-radius: ${ CONFIG.radiusFull };
/* Text color at 90% opacity */
background-color: color-mix(
in srgb,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/radio-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

&::before {
content: "";
border-radius: 50%;
border-radius: $radius-round;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/snackbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
font-size: $default-font-size;
background: rgba($black, 0.85); // Emulates #1e1e1e closely.
backdrop-filter: blur($grid-unit-20) saturate(180%);
border-radius: $radius-block-ui;
border-radius: $radius-medium;
box-shadow: $shadow-popover;
color: $white;
padding: $grid-unit-15 ($grid-unit-05 * 5);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tab-panel/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

// Draw the indicator.
box-shadow: 0 0 0 0 transparent;
border-radius: $radius-block-ui;
border-radius: $radius-small;

// Animation
transition: all 0.1s linear;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/text/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const muted = css`
export const highlighterText = css`
mark {
background: ${ COLORS.alert.yellow };
border-radius: 2px;
border-radius: ${ CONFIG.radiusSmall };
box-shadow:
0 0 0 1px rgba( 0, 0, 0, 0.05 ) inset,
0 -1px 0 rgba( 0, 0, 0, 0.1 ) inset;
Expand Down
Loading

0 comments on commit a00448a

Please sign in to comment.