@wordpress/interface 9.38.0 → 10.0.2-next.v.202608281122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/build/components/action-item/index.cjs +18 -42
- package/build/components/action-item/index.cjs.map +3 -3
- package/build/components/complementary-area/index.cjs +5 -4
- package/build/components/complementary-area/index.cjs.map +4 -4
- package/build/components/complementary-area-header/index.cjs +1 -1
- package/build/components/complementary-area-header/index.cjs.map +1 -1
- package/build/components/complementary-area-more-menu-item/index.cjs +53 -25
- package/build/components/complementary-area-more-menu-item/index.cjs.map +3 -3
- package/build/components/complementary-area-toggle/index.cjs +1 -1
- package/build/components/complementary-area-toggle/index.cjs.map +1 -1
- package/build/components/interface-skeleton/index.cjs +1 -1
- package/build/components/interface-skeleton/index.cjs.map +1 -1
- package/build/components/pinned-items/index.cjs +1 -1
- package/build/components/pinned-items/index.cjs.map +1 -1
- package/build-module/components/action-item/index.mjs +19 -43
- package/build-module/components/action-item/index.mjs.map +3 -3
- package/build-module/components/complementary-area/index.mjs +8 -4
- package/build-module/components/complementary-area/index.mjs.map +3 -3
- package/build-module/components/complementary-area-header/index.mjs +1 -1
- package/build-module/components/complementary-area-header/index.mjs.map +1 -1
- package/build-module/components/complementary-area-more-menu-item/index.mjs +48 -25
- package/build-module/components/complementary-area-more-menu-item/index.mjs.map +3 -3
- package/build-module/components/complementary-area-toggle/index.mjs +1 -1
- package/build-module/components/complementary-area-toggle/index.mjs.map +1 -1
- package/build-module/components/interface-skeleton/index.mjs +1 -1
- package/build-module/components/interface-skeleton/index.mjs.map +1 -1
- package/build-module/components/pinned-items/index.mjs +1 -1
- package/build-module/components/pinned-items/index.mjs.map +1 -1
- package/package.json +14 -15
- package/src/components/action-item/README.md +17 -10
- package/src/components/action-item/index.jsx +64 -0
- package/src/components/complementary-area/{index.js → index.jsx} +8 -4
- package/src/components/complementary-area-more-menu-item/index.jsx +70 -0
- package/src/components/action-item/index.js +0 -82
- package/src/components/complementary-area-more-menu-item/index.js +0 -43
- /package/src/components/complementary-area-header/{index.js → index.jsx} +0 -0
- /package/src/components/complementary-area-toggle/{index.js → index.jsx} +0 -0
- /package/src/components/fullscreen-mode/test/{index.js → index.jsx} +0 -0
- /package/src/components/interface-skeleton/{index.js → index.jsx} +0 -0
- /package/src/components/pinned-items/{index.js → index.jsx} +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { MenuGroup, Button, Slot, Fill } from '@wordpress/components';
|
|
2
|
-
import { Children } from '@wordpress/element';
|
|
3
|
-
|
|
4
|
-
const noop = () => {};
|
|
5
|
-
|
|
6
|
-
function ActionItemSlot( {
|
|
7
|
-
name,
|
|
8
|
-
as: Component = MenuGroup,
|
|
9
|
-
fillProps = {},
|
|
10
|
-
bubblesVirtually,
|
|
11
|
-
...props
|
|
12
|
-
} ) {
|
|
13
|
-
return (
|
|
14
|
-
<Slot
|
|
15
|
-
name={ name }
|
|
16
|
-
bubblesVirtually={ bubblesVirtually }
|
|
17
|
-
fillProps={ fillProps }
|
|
18
|
-
>
|
|
19
|
-
{ ( fills ) => {
|
|
20
|
-
if ( ! Children.toArray( fills ).length ) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Special handling exists for backward compatibility.
|
|
25
|
-
// It ensures that menu items created by plugin authors aren't
|
|
26
|
-
// duplicated with automatically injected menu items coming
|
|
27
|
-
// from pinnable plugin sidebars.
|
|
28
|
-
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
29
|
-
const initializedByPlugins = [];
|
|
30
|
-
Children.forEach(
|
|
31
|
-
fills,
|
|
32
|
-
( {
|
|
33
|
-
props: { __unstableExplicitMenuItem, __unstableTarget },
|
|
34
|
-
} ) => {
|
|
35
|
-
if ( __unstableTarget && __unstableExplicitMenuItem ) {
|
|
36
|
-
initializedByPlugins.push( __unstableTarget );
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
const children = Children.map( fills, ( child ) => {
|
|
41
|
-
if (
|
|
42
|
-
! child.props.__unstableExplicitMenuItem &&
|
|
43
|
-
initializedByPlugins.includes(
|
|
44
|
-
child.props.__unstableTarget
|
|
45
|
-
)
|
|
46
|
-
) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return child;
|
|
50
|
-
} );
|
|
51
|
-
|
|
52
|
-
return <Component { ...props }>{ children }</Component>;
|
|
53
|
-
} }
|
|
54
|
-
</Slot>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function ActionItem( { name, as: Component = Button, onClick, ...props } ) {
|
|
59
|
-
return (
|
|
60
|
-
<Fill name={ name }>
|
|
61
|
-
{ ( { onClick: fpOnClick } ) => {
|
|
62
|
-
return (
|
|
63
|
-
<Component
|
|
64
|
-
onClick={
|
|
65
|
-
onClick || fpOnClick
|
|
66
|
-
? ( ...args ) => {
|
|
67
|
-
( onClick || noop )( ...args );
|
|
68
|
-
( fpOnClick || noop )( ...args );
|
|
69
|
-
}
|
|
70
|
-
: undefined
|
|
71
|
-
}
|
|
72
|
-
{ ...props }
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
} }
|
|
76
|
-
</Fill>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
ActionItem.Slot = ActionItemSlot;
|
|
81
|
-
|
|
82
|
-
export default ActionItem;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { check } from '@wordpress/icons';
|
|
2
|
-
import { MenuItem } from '@wordpress/components';
|
|
3
|
-
import ComplementaryAreaToggle from '../complementary-area-toggle';
|
|
4
|
-
import ActionItem from '../action-item';
|
|
5
|
-
|
|
6
|
-
const PluginsMenuItem = ( {
|
|
7
|
-
// Menu item is marked with unstable prop for backward compatibility.
|
|
8
|
-
// They are removed so they don't leak to DOM elements.
|
|
9
|
-
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
10
|
-
__unstableExplicitMenuItem,
|
|
11
|
-
__unstableTarget,
|
|
12
|
-
...restProps
|
|
13
|
-
} ) => <MenuItem { ...restProps } />;
|
|
14
|
-
|
|
15
|
-
export default function ComplementaryAreaMoreMenuItem( {
|
|
16
|
-
scope,
|
|
17
|
-
target,
|
|
18
|
-
__unstableExplicitMenuItem,
|
|
19
|
-
...props
|
|
20
|
-
} ) {
|
|
21
|
-
return (
|
|
22
|
-
<ComplementaryAreaToggle
|
|
23
|
-
as={ ( toggleProps ) => {
|
|
24
|
-
return (
|
|
25
|
-
<ActionItem
|
|
26
|
-
__unstableExplicitMenuItem={
|
|
27
|
-
__unstableExplicitMenuItem
|
|
28
|
-
}
|
|
29
|
-
__unstableTarget={ `${ scope }/${ target }` }
|
|
30
|
-
as={ PluginsMenuItem }
|
|
31
|
-
name={ `${ scope }/plugin-more-menu` }
|
|
32
|
-
{ ...toggleProps }
|
|
33
|
-
/>
|
|
34
|
-
);
|
|
35
|
-
} }
|
|
36
|
-
role="menuitemcheckbox"
|
|
37
|
-
selectedIcon={ check }
|
|
38
|
-
name={ target }
|
|
39
|
-
scope={ scope }
|
|
40
|
-
{ ...props }
|
|
41
|
-
/>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|