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

[pull] trunk from WordPress:trunk #153

Merged
merged 6 commits into from
Jan 10, 2025
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
23 changes: 0 additions & 23 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,6 @@
const glob = require( 'glob' ).sync;
const { join } = require( 'path' );

/**
* Internal dependencies
*/
const { version } = require( './package' );

/**
* Regular expression string matching a SemVer string with equal major/minor to
* the current package version. Used in identifying deprecations.
*
* @type {string}
*/
const majorMinorRegExp =
version.replace( /\.\d+$/, '' ).replace( /[\\^$.*+?()[\]{}|]/g, '\\$&' ) +
'(\\.\\d+)?';

/**
* The list of patterns matching files used only for development purposes.
*
Expand Down Expand Up @@ -92,14 +77,6 @@ const restrictedSyntax = [
'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]',
message: 'Path access on WordPress dependencies is not allowed.',
},
{
selector:
'CallExpression[callee.name="deprecated"] Property[key.name="version"][value.value=/' +
majorMinorRegExp +
'/]',
message:
'Deprecated functions must be removed before releasing this version.',
},
{
selector:
'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function ImageSizeControl( {
value={ scale }
label={ sprintf(
/* translators: Percentage value. */
__( '%1$d%%' ),
__( '%d%%' ),
scale
) }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import clsx from 'clsx';
import {
__experimentalHStack as HStack,
__experimentalTruncate as Truncate,
privateApis as componentsPrivateApis,
} from '@wordpress/components';
import { forwardRef } from '@wordpress/element';
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
Expand All @@ -25,6 +26,8 @@ import ListViewExpander from './expander';
import { useBlockLock } from '../block-lock';
import useListViewImages from './use-list-view-images';
import { store as blockEditorStore } from '../../store';
import { unlock } from '../../lock-unlock';
const { Badge } = unlock( componentsPrivateApis );

function ListViewBlockSelectButton(
{
Expand Down Expand Up @@ -117,12 +120,9 @@ function ListViewBlockSelectButton(
</span>
{ blockInformation?.anchor && (
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
<Truncate
className="block-editor-list-view-block-select-button__anchor"
ellipsizeMode="auto"
>
<Badge className="block-editor-list-view-block-select-button__anchor">
{ blockInformation.anchor }
</Truncate>
</Badge>
</span>
) }
{ isSticky && (
Expand Down
6 changes: 1 addition & 5 deletions packages/block-editor/src/components/list-view/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,11 @@
position: absolute;
right: 0;
transform: translateY(-50%);
background: rgba($black, 0.1);
border-radius: $radius-x-small;
padding: 2px 6px;
max-width: 100%;
box-sizing: border-box;
}

&.is-selected .block-editor-list-view-block-select-button__anchor {
background: rgba($black, 0.3);
color: $white;
}

.block-editor-list-view-block-select-button__lock,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function WidthPanel( { selectedWidth, setAttributes } ) {
value={ widthValue }
label={ sprintf(
/* translators: Percentage value. */
__( '%1$d%%' ),
__( '%d%%' ),
widthValue
) }
/>
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/navigation/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,28 @@ function ColorTools( {
label: __( 'Text' ),
onColorChange: setTextColor,
resetAllFilter: () => setTextColor(),
clearable: true,
},
{
colorValue: backgroundColor.color,
label: __( 'Background' ),
onColorChange: setBackgroundColor,
resetAllFilter: () => setBackgroundColor(),
clearable: true,
},
{
colorValue: overlayTextColor.color,
label: __( 'Submenu & overlay text' ),
onColorChange: setOverlayTextColor,
resetAllFilter: () => setOverlayTextColor(),
clearable: true,
},
{
colorValue: overlayBackgroundColor.color,
label: __( 'Submenu & overlay background' ),
onColorChange: setOverlayBackgroundColor,
resetAllFilter: () => setOverlayBackgroundColor(),
clearable: true,
},
] }
panelId={ clientId }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export default function SearchEdit( {
value={ widthValue }
label={ sprintf(
/* translators: Percentage value. */
__( '%1$d%%' ),
__( '%d%%' ),
widthValue
) }
/>
Expand Down
55 changes: 28 additions & 27 deletions packages/components/src/badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,46 @@ import type { BadgeProps } from './types';
import type { WordPressComponentProps } from '../context';
import Icon from '../icon';

/**
* Returns an icon based on the badge context.
*
* @return The corresponding icon for the provided context.
*/
function contextBasedIcon( intent: BadgeProps[ 'intent' ] = 'default' ) {
switch ( intent ) {
case 'info':
return info;
case 'success':
return published;
case 'warning':
return caution;
case 'error':
return error;
default:
return null;
}
}

function Badge( {
className,
intent = 'default',
children,
...props
}: WordPressComponentProps< BadgeProps, 'span', false > ) {
/**
* Returns an icon based on the badge context.
*
* @return The corresponding icon for the provided context.
*/
function contextBasedIcon() {
switch ( intent ) {
case 'info':
return info;
case 'success':
return published;
case 'warning':
return caution;
case 'error':
return error;
default:
return null;
}
}
const icon = contextBasedIcon( intent );
const hasIcon = !! icon;

return (
<span
className={ clsx(
'components-badge',
`is-${ intent }`,
intent !== 'default' && 'has-icon',
className
) }
className={ clsx( 'components-badge', className, {
[ `is-${ intent }` ]: intent,
'has-icon': hasIcon,
} ) }
{ ...props }
>
{ intent !== 'default' && (
{ hasIcon && (
<Icon
icon={ contextBasedIcon() }
icon={ icon }
size={ 16 }
fill="currentColor"
className="components-badge__icon"
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
// This ensure the radius work properly.
overflow: hidden;

@media (prefers-reduced-motion: no-preference) {
@media not (prefers-reduced-motion) {
transition: border-radius, box-shadow 0.4s;
}

Expand Down
2 changes: 1 addition & 1 deletion storybook/package-styles/block-editor-ltr.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/block-editor/build-style/style";
@import "../../packages/block-editor/build-style/style.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/block-editor-rtl.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/block-editor/build-style/style-rtl";
@import "../../packages/block-editor/build-style/style-rtl.css";
6 changes: 3 additions & 3 deletions storybook/package-styles/block-library-ltr.lazy.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import "../../packages/block-library/build-style/style";
@import "../../packages/block-library/build-style/theme";
@import "../../packages/block-library/build-style/editor";
@import "../../packages/block-library/build-style/style.css";
@import "../../packages/block-library/build-style/theme.css";
@import "../../packages/block-library/build-style/editor.css";
6 changes: 3 additions & 3 deletions storybook/package-styles/block-library-rtl.lazy.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import "../../packages/block-library/build-style/style-rtl";
@import "../../packages/block-library/build-style/theme-rtl";
@import "../../packages/block-library/build-style/editor-rtl";
@import "../../packages/block-library/build-style/style-rtl.css";
@import "../../packages/block-library/build-style/theme-rtl.css";
@import "../../packages/block-library/build-style/editor-rtl.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/components-ltr.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/components/build-style/style";
@import "../../packages/components/build-style/style.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/components-rtl.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/components/build-style/style-rtl";
@import "../../packages/components/build-style/style-rtl.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/dataviews-ltr.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/dataviews/build-style/style";
@import "../../packages/dataviews/build-style/style.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/dataviews-rtl.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/dataviews/build-style/style-rtl";
@import "../../packages/dataviews/build-style/style-rtl.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/edit-site-ltr.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/edit-site/build-style/style";
@import "../../packages/edit-site/build-style/style.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/edit-site-rtl.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/edit-site/build-style/style-rtl";
@import "../../packages/edit-site/build-style/style-rtl.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/format-library-ltr.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/format-library/build-style/style";
@import "../../packages/format-library/build-style/style.css";
2 changes: 1 addition & 1 deletion storybook/package-styles/format-library-rtl.lazy.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "../../packages/format-library/build-style/style-rtl";
@import "../../packages/format-library/build-style/style-rtl.css";
Loading