Skip to content
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
4 changes: 4 additions & 0 deletions packages/base-styles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- The `input-control` mixin now uses the `--wpds-typography-font-family-body` design token for its font family, so reassigning `$default-font` no longer changes it. To keep a custom font, declare `font-family` after including the mixin ([#87490](https://github.com/WordPress/gutenberg/pull/87490)).

### Internal

- Remove the unused `.components-popover.more-menu__content` z-index entry ([#87622](https://github.com/WordPress/gutenberg/pull/87622)).
Expand Down
2 changes: 1 addition & 1 deletion packages/base-styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
}

@mixin input-control() {
font-family: variables.$default-font;
font-family: wpds.var("--wpds-typography-font-family-body");
padding: 6px 8px;
/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: variables.$mobile-text-min-font-size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

.components-flex__item {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
justify-content: center;
overflow: hidden;
font-size: var(--wpds-typography-font-size-md);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
color: $black;
font-weight: 400;

Expand Down Expand Up @@ -467,7 +467,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
border-radius: $grid-unit-30 * 0.5;
background: var(--wp-admin-theme-color);
color: $white;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 12px;
font-weight: 500;
}
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $block-inserter-tabs-height: 44px;
background: none;
border: none;
padding: 0;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
line-height: 0;

Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/warning/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
align-items: center;
display: flex;
flex-wrap: wrap;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
padding: 1em;

// Block UI appearance.
Expand All @@ -16,7 +16,7 @@

.block-editor-warning__message {
line-height: $default-line-height;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
color: $gray-900;
margin: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
width: fit-content;
z-index: 2;
background: $black;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
border-radius: $radius-medium;
color: $gray-100;
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/more/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
font-size: var(--wpds-typography-font-size-md);
text-transform: uppercase;
font-weight: var(--wpds-typography-font-weight-emphasis);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
color: $gray-700;
display: inline-flex;
white-space: nowrap;
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ $color-control-label-height: 20px;
align-items: center;
min-width: $grid-unit-10 * 12;
font-size: var(--wpds-typography-font-size-md);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);

.wp-block-navigation.is-selected & {
display: none;
Expand Down Expand Up @@ -395,7 +395,7 @@ $color-control-label-height: 20px;
.wp-block-navigation-placeholder__actions {
display: flex;
font-size: var(--wpds-typography-font-size-md);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
gap: $grid-unit-15 * 0.5;
align-items: center;

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/nextpage/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
position: relative;
text-transform: uppercase;
font-weight: var(--wpds-typography-font-weight-emphasis);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
color: $gray-700;
border-radius: 4px;
background: $white;
Expand Down
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Enhancements

- `ComboboxControl`, `DropdownMenu`, `DropZone`, `FormTokenField`, `Placeholder`, `RadioControl`, `ResizableBox`, `Snackbar`, `TextareaControl`, `TextControl`, `ToolbarButton`, and `Tooltip`: Use the `--wpds-typography-font-family-body` token for their font family ([#87490](https://github.com/WordPress/gutenberg/pull/87490)).
- `Tooltip`: Show a light background and dark text when rendered in a dark theme, instead of always using fixed dark colors. Tooltips use the root theme by default ([#87817](https://github.com/WordPress/gutenberg/pull/87817)).
- `CustomSelectControl` and `Menu`: Use the WPDS surface stroke tokens for the popover border and the menu border and separator. The `CustomSelectControl` popover border and the `Menu` separator are lighter ([#87840](https://github.com/WordPress/gutenberg/pull/87840)).
- `Snackbar`: Use the `--wpds-shadow-outer-sm` token, which adapts its strength to the `ThemeProvider` background ([#87818](https://github.com/WordPress/gutenberg/pull/87818)).
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 @@ -82,6 +82,6 @@
}

.components-drop-zone__content-text {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
}
2 changes: 1 addition & 1 deletion packages/components/src/dropdown-menu/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

.components-dropdown-menu__menu {
width: 100%;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
line-height: $default-line-height;

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/placeholder/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
.components-placeholder__instructions,
.components-placeholder__label,
.components-placeholder__fieldset {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
// Global Styles can affect this so we are resetting.
letter-spacing: initial;
Expand Down Expand Up @@ -69,7 +69,7 @@
justify-content: flex-start;

p {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
}
}
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 @@ -7,7 +7,7 @@
margin: 0;
padding: 0;

font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
background: $components-color-foreground;
border-radius: $radius-small;
box-sizing: border-box;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 12px;
color: $components-color-foreground-inverted;
padding: $grid-unit-05 $grid-unit-10;
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 @@ -5,7 +5,7 @@
@use "../utils/theme-variables" as *;

.components-snackbar {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
background: rgba($black, 0.85); // Emulates #1e1e1e closely.
backdrop-filter: blur($grid-unit-20) saturate(180%);
Expand Down
4 changes: 1 addition & 3 deletions packages/components/src/toolbar/toolbar-button/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "@wordpress/base-styles/variables" as *;

.components-toolbar__control.components-button {
position: relative;

Expand All @@ -10,7 +8,7 @@

&[data-subscript]::after {
content: attr(data-subscript);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
font-weight: var(--wpds-typography-font-weight-emphasis);
line-height: 12px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tooltip/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Temporary hack: swap the foreground and background tokens to invert the
// theme. See https://github.com/WordPress/gutenberg/issues/87834.
background: var(--wpds-color-foreground-content-neutral);
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
border-radius: var(--wpds-border-radius-md);
color: var(--wpds-color-background-surface-neutral);
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/components/welcome-guide/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}

&__heading {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 24px;
line-height: 1.4;
margin: $grid-unit-20 0 $grid-unit-20 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/welcome-guide/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

&__heading {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 24px;
line-height: 1.4;
margin: $grid-unit-20 0 $grid-unit-20 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-widgets/src/blocks/widget-area/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $panel-title-height: 48px;
margin-right: auto;

.components-panel__body > .components-panel__body-title {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
margin: 0;
height: $panel-title-height;
// Create a stacking context and make sure it's higher is than the content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

&__heading {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 24px;
line-height: 1.4;
margin: $grid-unit-20 0 $grid-unit-20 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
@use "@wordpress/base-styles/variables" as *;

.edit-widgets-block-editor {
position: relative;

// This is the default font that is going to be used in the content of the areas (blocks).
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);

// Block list needs to stretch to full screen height so blocks can
// be deselected when clicking outside widget areas.
Expand All @@ -27,7 +25,7 @@
// These rules enhance the specificity to reduce that inheritance.
// This is copied from edit-post/src/components/style.scss but without the padding.
& .components-button {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);

&.is-tertiary,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
}

&__heading {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 24px;
line-height: 1.4;
margin: $grid-unit-20 0 $grid-unit-20 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/visual-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
// These rules enhance the specificity to reduce that inheritance.
// This is duplicated in edit-site.
& .components-button {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
padding: 6px 12px;

Expand Down
4 changes: 2 additions & 2 deletions packages/widgets/src/blocks/legacy-widget/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

.wp-block-legacy-widget__edit-form-title {
color: $black;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 14px;
font-weight: var(--wpds-typography-font-weight-emphasis);
margin: 0 0 $grid-unit-15 0;
Expand Down Expand Up @@ -125,7 +125,7 @@
&,
& h3,
& p {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
}

Expand Down
3 changes: 1 addition & 2 deletions packages/widgets/src/blocks/widget-group/editor.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
@use "@wordpress/base-styles/colors" as *;
@use "@wordpress/base-styles/variables" as *;

.wp-block-widget-group {
.widget-title {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: 18px;
font-weight: var(--wpds-typography-font-weight-emphasis);
}
Expand Down
4 changes: 1 addition & 3 deletions storybook/global-basic.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@use "@wordpress/base-styles/variables" as *;

body {
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
}
3 changes: 1 addition & 2 deletions storybook/stories/playground/fullpage/reset.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@use "@wordpress/base-styles/mixins" as *;
@use "@wordpress/base-styles/variables" as *;

:root {
@include reset;
Expand All @@ -9,7 +8,7 @@ html,
body {
margin: 0;
padding: 0;
font-family: $default-font;
font-family: var(--wpds-typography-font-family-body);
font-size: var(--wpds-typography-font-size-md);
}

Expand Down
13 changes: 8 additions & 5 deletions tools/stylelint/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const CSS_BASELINE_2024_FUNCTIONS = [ 'round', 'rem', 'mod' ];

// Sass treats hyphens and underscores in identifiers as equivalent.
const FONT_FAMILY_VARIABLE =
/\$font[-_]family[-_](body|headings|mono)(?![\w-])/;
/\$(?:font[-_]family[-_](body|headings|mono)|default[-_]font)(?![\w-])/;

const FONT_FAMILY_VARIABLE_REPLACEMENTS = {
body: 'var(--wpds-typography-font-family-body)',
Expand Down Expand Up @@ -94,10 +94,13 @@ module.exports = {
: 'Highlight';
return `Avoid the \`${ selectedItem }\` system color. Chromium does not map it to the forced colors palette (https://issues.chromium.org/issues/40857613). Use \`${ replacement }\` instead.`;
}
const [ , fontFamily ] =
value.match( FONT_FAMILY_VARIABLE ) ?? [];
if ( fontFamily ) {
return `Avoid using the \`$font-family-${ fontFamily }\` Sass variable. Use \`${ FONT_FAMILY_VARIABLE_REPLACEMENTS[ fontFamily ] }\` instead.`;
const fontFamilyMatch = value.match( FONT_FAMILY_VARIABLE );
if ( fontFamilyMatch ) {
const fontFamily = fontFamilyMatch[ 1 ];
const variable = fontFamily
? `$font-family-${ fontFamily }`
: '$default-font';
return `Avoid using the \`${ variable }\` Sass variable. Use \`${ FONT_FAMILY_VARIABLE_REPLACEMENTS[ fontFamily ?? 'body' ] }\` instead.`;
}
const fontSizeMatch = value.match( FONT_SIZE_VARIABLE );
if ( fontSizeMatch ) {
Expand Down
Loading