@wordpress/components 21.0.0 → 21.0.2
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 +12 -0
- package/build/autocomplete/autocompleter-ui.js +3 -3
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +9 -10
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +1 -2
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +9 -10
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/styles.js +7 -7
- package/build/border-box-control/styles.js.map +1 -1
- package/build/box-control/linked-button.js +3 -3
- package/build/box-control/linked-button.js.map +1 -1
- package/build/dropdown/index.js +11 -4
- package/build/dropdown/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +2 -1
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/use-navigation-tree-menu.js +2 -1
- package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build/popover/index.js +39 -10
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +8 -2
- package/build/popover/utils.js.map +1 -1
- package/build/tooltip/index.js +8 -6
- package/build/tooltip/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +4 -4
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +10 -11
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -2
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +10 -11
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/styles.js +7 -7
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/box-control/linked-button.js +3 -3
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/dropdown/index.js +10 -4
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +2 -1
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -1
- package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build-module/popover/index.js +39 -10
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +8 -2
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/tooltip/index.js +9 -7
- package/build-module/tooltip/index.js.map +1 -1
- package/build-style/style-rtl.css +2 -3
- package/build-style/style.css +2 -3
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +32 -14
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +2 -2
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/autocomplete/autocompleter-ui.js +6 -3
- package/src/border-box-control/border-box-control/component.tsx +28 -19
- package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -2
- package/src/border-box-control/border-box-control-split-controls/component.tsx +25 -17
- package/src/border-box-control/stories/index.js +1 -0
- package/src/border-box-control/styles.ts +2 -1
- package/src/box-control/linked-button.js +3 -3
- package/src/box-control/test/index.js +5 -5
- package/src/button/style.scss +4 -3
- package/src/dropdown/index.js +15 -3
- package/src/modal/style.scss +3 -4
- package/src/navigation/menu/menu-title-search.js +2 -0
- package/src/navigation/menu/use-navigation-tree-menu.js +2 -0
- package/src/panel/README.md +1 -1
- package/src/popover/README.md +48 -3
- package/src/popover/index.tsx +41 -9
- package/src/popover/stories/index.tsx +1 -0
- package/src/popover/test/index.js +7 -5
- package/src/popover/types.ts +39 -20
- package/src/popover/utils.ts +16 -4
- package/src/tooltip/index.js +10 -6
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/popover/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAkB7B,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/popover/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAkB7B,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,OAAO,CAoBxC,CAAC;AAEF,eAAe,IAAI,CAAC;AAyBpB,eAAO,MAAM,OAAO,EAAE,cAAc,CAAE,OAAO,OAAO,CAiCnD,CAAC;AAYF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAE,OAAO,OAAO,CA0BzD,CAAC;AAsBF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAE,OAAO,OAAO,CA8CzD,CAAC;AAMF,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAE,OAAO,OAAO,CAgDjE,CAAC"}
|
|
@@ -18,6 +18,9 @@ export declare type PopoverAnchorRefTopBottom = {
|
|
|
18
18
|
top: Element;
|
|
19
19
|
bottom: Element;
|
|
20
20
|
};
|
|
21
|
+
export declare type VirtualElement = Pick<Element, 'getBoundingClientRect'> & {
|
|
22
|
+
ownerDocument?: Document;
|
|
23
|
+
};
|
|
21
24
|
export declare type PopoverProps = {
|
|
22
25
|
/**
|
|
23
26
|
* The name of the Slot in which the popover should be rendered. It should
|
|
@@ -27,16 +30,14 @@ export declare type PopoverProps = {
|
|
|
27
30
|
*/
|
|
28
31
|
__unstableSlotName?: string;
|
|
29
32
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
* reference to an `element`, an object with a `top` and a `bottom` properties
|
|
37
|
-
* (both pointing to elements), or a `range`.
|
|
33
|
+
* The element that should be used by the popover as its anchor. It can either
|
|
34
|
+
* be an `Element` or, alternatively, a `VirtualElement` — ie. an object with
|
|
35
|
+
* the `getBoundingClientRect()` and the `ownerDocument` properties defined.
|
|
36
|
+
*
|
|
37
|
+
* **The anchor element should be stored in local state** rather than a
|
|
38
|
+
* plain React ref to ensure reactive updating when it changes.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
anchor?: Element | VirtualElement | null;
|
|
40
41
|
/**
|
|
41
42
|
* Whether the popover should animate when opening.
|
|
42
43
|
*
|
|
@@ -81,11 +82,6 @@ export declare type PopoverProps = {
|
|
|
81
82
|
* When not provided, the `onClose` callback will be called instead.
|
|
82
83
|
*/
|
|
83
84
|
onFocusOutside?: (event: SyntheticEvent) => void;
|
|
84
|
-
/**
|
|
85
|
-
* A function returning the same value as the one expected by the `anchorRect`
|
|
86
|
-
* prop, used to specify a dynamic popover position.
|
|
87
|
-
*/
|
|
88
|
-
getAnchorRect?: (fallbackReferenceElement: Element | null) => DomRectWithOwnerDocument;
|
|
89
85
|
/**
|
|
90
86
|
* Used to customize the header text shown when the popover is toggled to
|
|
91
87
|
* fullscreen on mobile viewports (see the `expandOnMobile` prop).
|
|
@@ -150,6 +146,28 @@ export declare type PopoverProps = {
|
|
|
150
146
|
* @deprecated
|
|
151
147
|
*/
|
|
152
148
|
__unstableShift?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* An object extending a `DOMRect` with an additional optional `ownerDocument`
|
|
151
|
+
* property, used to specify a fixed popover position.
|
|
152
|
+
*
|
|
153
|
+
* @deprecated
|
|
154
|
+
*/
|
|
155
|
+
anchorRect?: DomRectWithOwnerDocument;
|
|
156
|
+
/**
|
|
157
|
+
* Used to specify a fixed popover position. It can be an `Element`, a React
|
|
158
|
+
* reference to an `element`, an object with a `top` and a `bottom` properties
|
|
159
|
+
* (both pointing to elements), or a `range`.
|
|
160
|
+
*
|
|
161
|
+
* @deprecated
|
|
162
|
+
*/
|
|
163
|
+
anchorRef?: Element | PopoverAnchorRefReference | PopoverAnchorRefTopBottom | Range;
|
|
164
|
+
/**
|
|
165
|
+
* A function returning the same value as the one expected by the `anchorRect`
|
|
166
|
+
* prop, used to specify a dynamic popover position.
|
|
167
|
+
*
|
|
168
|
+
* @deprecated
|
|
169
|
+
*/
|
|
170
|
+
getAnchorRect?: (fallbackReferenceElement: Element | null) => DomRectWithOwnerDocument;
|
|
153
171
|
/**
|
|
154
172
|
* _Note: this prop is deprecated and has no effect on the component._
|
|
155
173
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/popover/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,aAAK,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACjD,aAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACjD,aAAK,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,aAAK,wBAAwB,GAAG,OAAO,GAAG;IACzC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B,CAAC;IACtC;;;;;;OAMG;IACH,SAAS,CAAC,EACP,OAAO,GACP,yBAAyB,GACzB,yBAAyB,GACzB,KAAK,CAAC;IACT;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CACf,wBAAwB,EAAE,OAAO,GAAG,IAAI,KACpC,wBAAwB,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC"}
|
|
@@ -35,11 +35,11 @@ export declare const getFrameOffset: (document?: Document | undefined) => {
|
|
|
35
35
|
x: number;
|
|
36
36
|
y: number;
|
|
37
37
|
} | undefined;
|
|
38
|
-
export declare const getReferenceOwnerDocument: ({ anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement, fallbackDocument, }: Pick<PopoverProps, "anchorRef" | "anchorRect" | "getAnchorRect"> & {
|
|
38
|
+
export declare const getReferenceOwnerDocument: ({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement, fallbackDocument, }: Pick<PopoverProps, "anchor" | "anchorRef" | "anchorRect" | "getAnchorRect"> & {
|
|
39
39
|
fallbackReferenceElement: Element | null;
|
|
40
40
|
fallbackDocument: Document;
|
|
41
41
|
}) => Document;
|
|
42
|
-
export declare const getReferenceElement: ({ anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement, }: Pick<PopoverProps, "anchorRef" | "anchorRect" | "getAnchorRect"> & {
|
|
42
|
+
export declare const getReferenceElement: ({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement, }: Pick<PopoverProps, "anchor" | "anchorRef" | "anchorRect" | "getAnchorRect"> & {
|
|
43
43
|
fallbackReferenceElement: Element | null;
|
|
44
44
|
}) => ReferenceType | null;
|
|
45
45
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/popover/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,M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GAAG,IAAI;sBACtB,QAAQ;MACtB,QAmCJ,CAAC;AAEF,eAAO,MAAM,mBAAmB;8BAUL,OAAO,GAAG,IAAI;MACpC,aAAa,GAAG,IA+DpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,4BAFU,MAAM,CAEiB;;AAmFjC,0CAyKC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.2",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"@emotion/utils": "^1.0.0",
|
|
39
39
|
"@floating-ui/react-dom": "^1.0.0",
|
|
40
40
|
"@use-gesture/react": "^10.2.6",
|
|
41
|
-
"@wordpress/a11y": "^3.17.
|
|
42
|
-
"@wordpress/compose": "^5.15.
|
|
43
|
-
"@wordpress/date": "^4.17.
|
|
44
|
-
"@wordpress/deprecated": "^3.17.
|
|
45
|
-
"@wordpress/dom": "^3.17.
|
|
46
|
-
"@wordpress/element": "^4.15.
|
|
47
|
-
"@wordpress/escape-html": "^2.17.
|
|
48
|
-
"@wordpress/hooks": "^3.17.
|
|
49
|
-
"@wordpress/i18n": "^4.17.
|
|
50
|
-
"@wordpress/icons": "^9.8.
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.17.
|
|
52
|
-
"@wordpress/keycodes": "^3.17.
|
|
53
|
-
"@wordpress/primitives": "^3.15.
|
|
54
|
-
"@wordpress/rich-text": "^5.15.
|
|
55
|
-
"@wordpress/warning": "^2.17.
|
|
41
|
+
"@wordpress/a11y": "^3.17.1",
|
|
42
|
+
"@wordpress/compose": "^5.15.2",
|
|
43
|
+
"@wordpress/date": "^4.17.1",
|
|
44
|
+
"@wordpress/deprecated": "^3.17.1",
|
|
45
|
+
"@wordpress/dom": "^3.17.2",
|
|
46
|
+
"@wordpress/element": "^4.15.1",
|
|
47
|
+
"@wordpress/escape-html": "^2.17.1",
|
|
48
|
+
"@wordpress/hooks": "^3.17.1",
|
|
49
|
+
"@wordpress/i18n": "^4.17.1",
|
|
50
|
+
"@wordpress/icons": "^9.8.1",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.17.1",
|
|
52
|
+
"@wordpress/keycodes": "^3.17.1",
|
|
53
|
+
"@wordpress/primitives": "^3.15.1",
|
|
54
|
+
"@wordpress/rich-text": "^5.15.2",
|
|
55
|
+
"@wordpress/warning": "^2.17.1",
|
|
56
56
|
"change-case": "^4.1.2",
|
|
57
57
|
"classnames": "^2.3.1",
|
|
58
58
|
"colord": "^2.7.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "f6021282457317c7e12dcc3a3f02c9ac28e16a30"
|
|
82
82
|
}
|
|
@@ -8,7 +8,7 @@ import { map } from 'lodash';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { useLayoutEffect } from '@wordpress/element';
|
|
11
|
-
import {
|
|
11
|
+
import { useAnchor } from '@wordpress/rich-text';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -35,7 +35,10 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
35
35
|
contentRef,
|
|
36
36
|
} ) {
|
|
37
37
|
const [ items ] = useItems( filterValue );
|
|
38
|
-
const
|
|
38
|
+
const popoverAnchor = useAnchor( {
|
|
39
|
+
editableContentElement: contentRef.current,
|
|
40
|
+
value,
|
|
41
|
+
} );
|
|
39
42
|
|
|
40
43
|
useLayoutEffect( () => {
|
|
41
44
|
onChangeOptions( items );
|
|
@@ -54,7 +57,7 @@ export function getAutoCompleterUI( autocompleter ) {
|
|
|
54
57
|
onClose={ onReset }
|
|
55
58
|
position="top right"
|
|
56
59
|
className="components-autocomplete__popover"
|
|
57
|
-
|
|
60
|
+
anchor={ popoverAnchor }
|
|
58
61
|
>
|
|
59
62
|
<div
|
|
60
63
|
id={ listBoxId }
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { ComponentProps } from 'react';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
5
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
11
6
|
import { useMergeRefs } from '@wordpress/compose';
|
|
12
7
|
|
|
13
8
|
/**
|
|
@@ -24,7 +19,10 @@ import { contextConnect, WordPressComponentProps } from '../../ui/context';
|
|
|
24
19
|
import { useBorderBoxControl } from './hook';
|
|
25
20
|
|
|
26
21
|
import type { BorderBoxControlProps } from '../types';
|
|
27
|
-
import type {
|
|
22
|
+
import type {
|
|
23
|
+
LabelProps,
|
|
24
|
+
BorderControlProps,
|
|
25
|
+
} from '../../border-control/types';
|
|
28
26
|
|
|
29
27
|
const BorderLabel = ( props: LabelProps ) => {
|
|
30
28
|
const { label, hideLabelFromVision } = props;
|
|
@@ -67,18 +65,29 @@ const BorderBoxControl = (
|
|
|
67
65
|
__next36pxDefaultSize = false,
|
|
68
66
|
...otherProps
|
|
69
67
|
} = useBorderBoxControl( props );
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
|
|
69
|
+
// Use internal state instead of a ref to make sure that the component
|
|
70
|
+
// re-renders when the popover's anchor updates.
|
|
71
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(
|
|
72
|
+
null
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
76
|
+
const popoverProps: BorderControlProps[ '__unstablePopoverProps' ] =
|
|
77
|
+
useMemo(
|
|
78
|
+
() =>
|
|
79
|
+
popoverPlacement
|
|
80
|
+
? {
|
|
81
|
+
placement: popoverPlacement,
|
|
82
|
+
offset: popoverOffset,
|
|
83
|
+
anchor: popoverAnchor,
|
|
84
|
+
shift: true,
|
|
85
|
+
}
|
|
86
|
+
: undefined,
|
|
87
|
+
[ popoverPlacement, popoverOffset, popoverAnchor ]
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );
|
|
82
91
|
|
|
83
92
|
return (
|
|
84
93
|
<View className={ className } { ...otherProps } ref={ mergedRef }>
|
|
@@ -28,10 +28,9 @@ const BorderBoxControlLinkedButton = (
|
|
|
28
28
|
<View className={ className }>
|
|
29
29
|
<Button
|
|
30
30
|
{ ...buttonProps }
|
|
31
|
-
variant={ isLinked ? 'primary' : 'secondary' }
|
|
32
31
|
isSmall
|
|
33
32
|
icon={ isLinked ? link : linkOff }
|
|
34
|
-
iconSize={
|
|
33
|
+
iconSize={ 24 }
|
|
35
34
|
aria-label={ label }
|
|
36
35
|
ref={ forwardedRef }
|
|
37
36
|
/>
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { ComponentProps } from 'react';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
8
4
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import {
|
|
5
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
10
6
|
import { useMergeRefs } from '@wordpress/compose';
|
|
11
7
|
|
|
12
8
|
/**
|
|
@@ -18,6 +14,7 @@ import { Grid } from '../../grid';
|
|
|
18
14
|
import { contextConnect, WordPressComponentProps } from '../../ui/context';
|
|
19
15
|
import { useBorderBoxControlSplitControls } from './hook';
|
|
20
16
|
|
|
17
|
+
import type { BorderControlProps } from '../../border-control/types';
|
|
21
18
|
import type { SplitControlsProps } from '../types';
|
|
22
19
|
|
|
23
20
|
const BorderBoxControlSplitControls = (
|
|
@@ -40,18 +37,27 @@ const BorderBoxControlSplitControls = (
|
|
|
40
37
|
__next36pxDefaultSize,
|
|
41
38
|
...otherProps
|
|
42
39
|
} = useBorderBoxControlSplitControls( props );
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
|
|
41
|
+
// Use internal state instead of a ref to make sure that the component
|
|
42
|
+
// re-renders when the popover's anchor updates.
|
|
43
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(
|
|
44
|
+
null
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
48
|
+
const popoverProps: BorderControlProps[ '__unstablePopoverProps' ] =
|
|
49
|
+
useMemo(
|
|
50
|
+
() =>
|
|
51
|
+
popoverPlacement
|
|
52
|
+
? {
|
|
53
|
+
placement: popoverPlacement,
|
|
54
|
+
offset: popoverOffset,
|
|
55
|
+
anchor: popoverAnchor,
|
|
56
|
+
shift: true,
|
|
57
|
+
}
|
|
58
|
+
: undefined,
|
|
59
|
+
[ popoverPlacement, popoverOffset, popoverAnchor ]
|
|
60
|
+
);
|
|
55
61
|
|
|
56
62
|
const sharedBorderControlProps = {
|
|
57
63
|
colors,
|
|
@@ -64,6 +70,8 @@ const BorderBoxControlSplitControls = (
|
|
|
64
70
|
__next36pxDefaultSize,
|
|
65
71
|
};
|
|
66
72
|
|
|
73
|
+
const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );
|
|
74
|
+
|
|
67
75
|
return (
|
|
68
76
|
<Grid { ...otherProps } ref={ mergedRef } gap={ 4 }>
|
|
69
77
|
<BorderBoxControlVisualizer
|
|
@@ -11,18 +11,18 @@ import Button from '../button';
|
|
|
11
11
|
import Tooltip from '../tooltip';
|
|
12
12
|
|
|
13
13
|
export default function LinkedButton( { isLinked, ...props } ) {
|
|
14
|
-
const label = isLinked ? __( 'Unlink
|
|
14
|
+
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
|
|
15
15
|
|
|
16
|
+
// TODO: Remove span after merging https://github.com/WordPress/gutenberg/pull/44198
|
|
16
17
|
return (
|
|
17
18
|
<Tooltip text={ label }>
|
|
18
19
|
<span>
|
|
19
20
|
<Button
|
|
20
21
|
{ ...props }
|
|
21
22
|
className="component-box-control__linked-button"
|
|
22
|
-
variant={ isLinked ? 'primary' : 'secondary' }
|
|
23
23
|
isSmall
|
|
24
24
|
icon={ isLinked ? link : linkOff }
|
|
25
|
-
iconSize={
|
|
25
|
+
iconSize={ 24 }
|
|
26
26
|
aria-label={ label }
|
|
27
27
|
/>
|
|
28
28
|
</span>
|
|
@@ -162,7 +162,7 @@ describe( 'BoxControl', () => {
|
|
|
162
162
|
} );
|
|
163
163
|
} );
|
|
164
164
|
|
|
165
|
-
describe( 'Unlinked
|
|
165
|
+
describe( 'Unlinked sides', () => {
|
|
166
166
|
it( 'should update a single side value when unlinked', async () => {
|
|
167
167
|
let state = {};
|
|
168
168
|
const setState = ( newState ) => ( state = newState );
|
|
@@ -174,7 +174,7 @@ describe( 'BoxControl', () => {
|
|
|
174
174
|
/>
|
|
175
175
|
);
|
|
176
176
|
const user = setupUser();
|
|
177
|
-
const unlink = screen.getByLabelText( /Unlink
|
|
177
|
+
const unlink = screen.getByLabelText( /Unlink sides/ );
|
|
178
178
|
|
|
179
179
|
await user.click( unlink );
|
|
180
180
|
|
|
@@ -207,7 +207,7 @@ describe( 'BoxControl', () => {
|
|
|
207
207
|
/>
|
|
208
208
|
);
|
|
209
209
|
const user = setupUser();
|
|
210
|
-
const unlink = screen.getByLabelText( /Unlink
|
|
210
|
+
const unlink = screen.getByLabelText( /Unlink sides/ );
|
|
211
211
|
|
|
212
212
|
await user.click( unlink );
|
|
213
213
|
|
|
@@ -240,7 +240,7 @@ describe( 'BoxControl', () => {
|
|
|
240
240
|
await user.selectOptions( allUnitSelect, [ 'em' ] );
|
|
241
241
|
|
|
242
242
|
// Unlink the controls.
|
|
243
|
-
await user.click( screen.getByLabelText( /Unlink
|
|
243
|
+
await user.click( screen.getByLabelText( /Unlink sides/ ) );
|
|
244
244
|
|
|
245
245
|
// Confirm that each individual control has the selected unit
|
|
246
246
|
const unlinkedSelects = screen.getAllByDisplayValue( 'em' );
|
|
@@ -257,7 +257,7 @@ describe( 'BoxControl', () => {
|
|
|
257
257
|
await user.selectOptions( allUnitSelect, [ 'vw' ] );
|
|
258
258
|
|
|
259
259
|
// Unlink the controls.
|
|
260
|
-
await user.click( screen.getByLabelText( /Unlink
|
|
260
|
+
await user.click( screen.getByLabelText( /Unlink sides/ ) );
|
|
261
261
|
|
|
262
262
|
// Confirm that each individual control has the selected unit
|
|
263
263
|
const unlinkedSelects = screen.getAllByDisplayValue( 'vw' );
|
package/src/button/style.scss
CHANGED
|
@@ -288,14 +288,15 @@
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
&.is-small {
|
|
291
|
-
height:
|
|
291
|
+
height: $icon-size;
|
|
292
292
|
line-height: 22px;
|
|
293
293
|
padding: 0 8px;
|
|
294
294
|
font-size: 11px;
|
|
295
295
|
|
|
296
296
|
&.has-icon:not(.has-text) {
|
|
297
|
-
padding: 0
|
|
298
|
-
width:
|
|
297
|
+
padding: 0;
|
|
298
|
+
width: $icon-size;
|
|
299
|
+
min-width: $icon-size;
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
|
package/src/dropdown/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { useRef, useEffect, useState } from '@wordpress/element';
|
|
11
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -42,6 +43,10 @@ export default function Dropdown( props ) {
|
|
|
42
43
|
onToggle,
|
|
43
44
|
style,
|
|
44
45
|
} = props;
|
|
46
|
+
// Use internal state instead of a ref to make sure that the component
|
|
47
|
+
// re-renders when the popover's anchor updates.
|
|
48
|
+
const [ fallbackPopoverAnchor, setFallbackPopoverAnchor ] =
|
|
49
|
+
useState( null );
|
|
45
50
|
const containerRef = useRef();
|
|
46
51
|
const [ isOpen, setIsOpen ] = useObservableState( false, onToggle );
|
|
47
52
|
|
|
@@ -83,7 +88,10 @@ export default function Dropdown( props ) {
|
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
const args = { isOpen, onToggle: toggle, onClose: close };
|
|
86
|
-
const
|
|
91
|
+
const popoverPropsHaveAnchor =
|
|
92
|
+
!! popoverProps?.anchor ||
|
|
93
|
+
// Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and
|
|
94
|
+
// be removed from `Popover` from WordPress 6.3
|
|
87
95
|
!! popoverProps?.anchorRef ||
|
|
88
96
|
!! popoverProps?.getAnchorRect ||
|
|
89
97
|
!! popoverProps?.anchorRect;
|
|
@@ -91,7 +99,7 @@ export default function Dropdown( props ) {
|
|
|
91
99
|
return (
|
|
92
100
|
<div
|
|
93
101
|
className={ classnames( 'components-dropdown', className ) }
|
|
94
|
-
ref={ containerRef }
|
|
102
|
+
ref={ useMergeRefs( [ setFallbackPopoverAnchor, containerRef ] ) }
|
|
95
103
|
// Some UAs focus the closest focusable parent when the toggle is
|
|
96
104
|
// clicked. Making this div focusable ensures such UAs will focus
|
|
97
105
|
// it and `closeIfFocusOutside` can tell if the toggle was clicked.
|
|
@@ -110,7 +118,11 @@ export default function Dropdown( props ) {
|
|
|
110
118
|
// This value is used to ensure that the dropdowns
|
|
111
119
|
// align with the editor header by default.
|
|
112
120
|
offset={ 13 }
|
|
113
|
-
|
|
121
|
+
anchor={
|
|
122
|
+
! popoverPropsHaveAnchor
|
|
123
|
+
? fallbackPopoverAnchor
|
|
124
|
+
: undefined
|
|
125
|
+
}
|
|
114
126
|
{ ...popoverProps }
|
|
115
127
|
className={ classnames(
|
|
116
128
|
'components-dropdown__content',
|
package/src/modal/style.scss
CHANGED
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
background-color: rgba($black, 0.35);
|
|
9
9
|
z-index: z-index(".components-modal__screen-overlay");
|
|
10
10
|
display: flex;
|
|
11
|
-
backdrop-filter: blur($grid-unit);
|
|
12
|
-
|
|
11
|
+
// backdrop-filter: blur($grid-unit);
|
|
13
12
|
// This animates the appearance of the white background.
|
|
14
13
|
@include edit-post__fade-in-animation();
|
|
15
14
|
}
|
|
@@ -31,8 +30,8 @@
|
|
|
31
30
|
margin: auto;
|
|
32
31
|
width: auto;
|
|
33
32
|
min-width: $modal-min-width;
|
|
34
|
-
max-width: calc(100% - #{
|
|
35
|
-
max-height: calc(100% - #{
|
|
33
|
+
max-width: calc(100% - #{$grid-unit-20 * 2});
|
|
34
|
+
max-height: calc(100% - #{$header-height * 2});
|
|
36
35
|
|
|
37
36
|
// Animate the modal frame/contents appearing on the page.
|
|
38
37
|
animation: components-modal__appear-animation 0.1s ease-out;
|
|
@@ -52,6 +52,8 @@ function MenuTitleSearch( {
|
|
|
52
52
|
count
|
|
53
53
|
);
|
|
54
54
|
debouncedSpeak( resultsFoundMessage );
|
|
55
|
+
// Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/44090
|
|
56
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
57
|
}, [ items, search ] );
|
|
56
58
|
|
|
57
59
|
const onClose = () => {
|
|
@@ -21,5 +21,7 @@ export const useNavigationTreeMenu = ( props ) => {
|
|
|
21
21
|
return () => {
|
|
22
22
|
removeMenu( key );
|
|
23
23
|
};
|
|
24
|
+
// Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/44090
|
|
25
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
26
|
}, [] );
|
|
25
27
|
};
|
package/src/panel/README.md
CHANGED
|
@@ -176,7 +176,7 @@ The class that will be added with `components-panel__row`. to the classes of the
|
|
|
176
176
|
|
|
177
177
|
PanelRow accepts a forwarded ref that will be added to the wrapper div. Usage:
|
|
178
178
|
|
|
179
|
-
`<PanelRow className="edit-post-post-schedule" ref={
|
|
179
|
+
`<PanelRow className="edit-post-post-schedule" ref={ panelRowRef }>`
|
|
180
180
|
|
|
181
181
|
---
|
|
182
182
|
|