@wordpress/components 19.0.0 → 19.0.1
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 +6 -0
- package/CONTRIBUTING.md +12 -12
- package/build/angle-picker-control/index.js +3 -1
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/base-control/index.js +1 -1
- package/build/base-control/index.js.map +1 -1
- package/build/color-edit/index.js +180 -199
- package/build/color-edit/index.js.map +1 -1
- package/build/color-edit/styles.js +112 -0
- package/build/color-edit/styles.js.map +1 -0
- package/build/color-list-picker/index.js +6 -1
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-palette/index.js +86 -21
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/styles.js +31 -0
- package/build/color-palette/styles.js.map +1 -0
- package/build/color-picker/component.js +7 -18
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/picker.js +3 -3
- package/build/color-picker/picker.js.map +1 -1
- package/build/duotone-picker/custom-duotone-bar.js +0 -1
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +1 -0
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/gradient-picker/index.js +69 -9
- package/build/gradient-picker/index.js.map +1 -1
- package/build/index.native.js +9 -0
- package/build/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +4 -2
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js +3 -2
- package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js +140 -0
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -0
- package/build/mobile/link-settings/index.native.js +3 -2
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js +1 -0
- package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +11 -5
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +4 -2
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/modal/index.js +10 -3
- package/build/modal/index.js.map +1 -1
- package/build/navigation/group/index.js +1 -2
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +8 -27
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/menu-title.js +2 -2
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +34 -29
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/popover/index.js +4 -2
- package/build/popover/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +33 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/search-control/index.js +37 -14
- package/build/search-control/index.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/tools-panel/styles.js +18 -23
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +10 -7
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +3 -1
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +3 -0
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/utils/hooks/index.js +8 -0
- package/build/utils/hooks/index.js.map +1 -1
- package/build/utils/hooks/use-combined-ref.js +28 -0
- package/build/utils/hooks/use-combined-ref.js.map +1 -0
- package/build-module/angle-picker-control/index.js +3 -1
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/base-control/index.js +1 -1
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/color-edit/index.js +175 -201
- package/build-module/color-edit/index.js.map +1 -1
- package/build-module/color-edit/styles.js +90 -0
- package/build-module/color-edit/styles.js.map +1 -0
- package/build-module/color-list-picker/index.js +6 -1
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +85 -22
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/styles.js +27 -0
- package/build-module/color-palette/styles.js.map +1 -0
- package/build-module/color-picker/component.js +7 -16
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/picker.js +4 -4
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js +0 -1
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +1 -0
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/gradient-picker/index.js +67 -9
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/index.native.js +1 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +4 -2
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-cell.native.js +3 -2
- package/build-module/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +121 -0
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -0
- package/build-module/mobile/link-settings/index.native.js +3 -2
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -0
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +11 -5
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +4 -2
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/modal/index.js +10 -4
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/group/index.js +1 -2
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +8 -24
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +3 -3
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +31 -27
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/popover/index.js +4 -2
- package/build-module/popover/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +33 -29
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/search-control/index.js +36 -15
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/tools-panel/styles.js +16 -23
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +10 -6
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +2 -1
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +3 -0
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/utils/hooks/index.js +1 -0
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-module/utils/hooks/use-combined-ref.js +25 -0
- package/build-module/utils/hooks/use-combined-ref.js.map +1 -0
- package/build-style/style-rtl.css +39 -51
- package/build-style/style.css +39 -51
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts +1 -1
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/utils/hooks/index.d.ts +1 -0
- package/build-types/utils/hooks/use-combined-ref.d.ts +8 -0
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/angle-picker-control/index.js +3 -1
- package/src/angle-picker-control/styles/angle-picker-control-styles.js +2 -2
- package/src/base-control/index.js +1 -1
- package/src/circular-option-picker/style.scss +3 -5
- package/src/color-edit/index.js +248 -274
- package/src/color-edit/style.scss +4 -45
- package/src/color-edit/styles.js +97 -0
- package/src/color-list-picker/index.js +5 -0
- package/src/color-list-picker/style.scss +4 -0
- package/src/color-palette/index.js +90 -26
- package/src/color-palette/style.scss +18 -0
- package/src/color-palette/styles.js +19 -0
- package/src/color-palette/test/__snapshots__/index.js.snap +448 -414
- package/src/color-picker/component.tsx +6 -17
- package/src/color-picker/picker.tsx +6 -4
- package/src/color-picker/test/index.js +0 -15
- package/src/duotone-picker/custom-duotone-bar.js +0 -1
- package/src/duotone-picker/duotone-picker.js +1 -0
- package/src/gradient-picker/index.js +79 -11
- package/src/heading/test/__snapshots__/index.js.snap +1 -1
- package/src/index.native.js +1 -0
- package/src/mobile/bottom-sheet/cell.native.js +7 -2
- package/src/mobile/bottom-sheet/cellStyles.android.scss +5 -1
- package/src/mobile/bottom-sheet/cellStyles.ios.scss +5 -1
- package/src/mobile/bottom-sheet/link-cell.native.js +10 -3
- package/src/mobile/link-settings/image-link-destinations-screen.native.js +148 -0
- package/src/mobile/link-settings/index.native.js +3 -2
- package/src/mobile/link-settings/link-settings-navigation.native.js +1 -0
- package/src/mobile/link-settings/link-settings-screen.native.js +6 -2
- package/src/mobile/link-settings/style.native.scss +17 -0
- package/src/mobile/picker/index.android.js +2 -1
- package/src/modal/README.md +8 -0
- package/src/modal/index.js +60 -45
- package/src/modal/style.scss +5 -0
- package/src/navigation/group/index.js +1 -2
- package/src/navigation/menu/menu-title-search.js +11 -26
- package/src/navigation/menu/menu-title.js +4 -4
- package/src/navigation/styles/navigation-styles.js +29 -52
- package/src/popover/index.js +2 -2
- package/src/range-control/styles/range-control-styles.js +4 -1
- package/src/resizable-box/style.scss +5 -0
- package/src/search-control/index.js +47 -23
- package/src/style.scss +1 -0
- package/src/text/styles.js +1 -1
- package/src/text/test/__snapshots__/index.js.snap +2 -2
- package/src/tools-panel/stories/index.js +21 -19
- package/src/tools-panel/styles.ts +18 -26
- package/src/tools-panel/tools-panel/component.tsx +7 -4
- package/src/tools-panel/tools-panel/hook.ts +4 -1
- package/src/tools-panel/tools-panel-header/component.tsx +1 -0
- package/src/ui/control-label/test/__snapshots__/index.js.snap +3 -3
- package/src/ui/form-group/test/__snapshots__/index.js.snap +2 -2
- package/src/utils/hooks/index.js +1 -0
- package/src/utils/hooks/use-combined-ref.ts +29 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/modal/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import { closeSmall } from '@wordpress/icons';
|
|
|
25
25
|
*/
|
|
26
26
|
import * as ariaHelper from './aria-helper';
|
|
27
27
|
import Button from '../button';
|
|
28
|
+
import StyleProvider from '../style-provider';
|
|
28
29
|
|
|
29
30
|
// Used to count the number of open modals.
|
|
30
31
|
let openModalCount = 0;
|
|
@@ -52,6 +53,7 @@ export default function Modal( {
|
|
|
52
53
|
className,
|
|
53
54
|
contentLabel,
|
|
54
55
|
onKeyDown,
|
|
56
|
+
isFullScreen = false,
|
|
55
57
|
} ) {
|
|
56
58
|
const ref = useRef();
|
|
57
59
|
const instanceId = useInstanceId( Modal );
|
|
@@ -111,55 +113,68 @@ export default function Modal( {
|
|
|
111
113
|
) }
|
|
112
114
|
onKeyDown={ handleEscapeKeyDown }
|
|
113
115
|
>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
116
|
+
<StyleProvider document={ document }>
|
|
117
|
+
<div
|
|
118
|
+
className={ classnames(
|
|
119
|
+
'components-modal__frame',
|
|
120
|
+
className,
|
|
121
|
+
{
|
|
122
|
+
'is-full-screen': isFullScreen,
|
|
123
|
+
}
|
|
124
|
+
) }
|
|
125
|
+
style={ style }
|
|
126
|
+
ref={ useMergeRefs( [
|
|
127
|
+
constrainedTabbingRef,
|
|
128
|
+
focusReturnRef,
|
|
129
|
+
focusOnMountRef,
|
|
130
|
+
] ) }
|
|
131
|
+
role={ role }
|
|
132
|
+
aria-label={ contentLabel }
|
|
133
|
+
aria-labelledby={ contentLabel ? null : headingId }
|
|
134
|
+
aria-describedby={ aria.describedby }
|
|
135
|
+
tabIndex="-1"
|
|
136
|
+
{ ...( shouldCloseOnClickOutside
|
|
137
|
+
? focusOutsideProps
|
|
138
|
+
: {} ) }
|
|
139
|
+
onKeyDown={ onKeyDown }
|
|
140
|
+
>
|
|
141
|
+
<div
|
|
142
|
+
className={ 'components-modal__content' }
|
|
143
|
+
role="document"
|
|
144
|
+
>
|
|
145
|
+
<div className="components-modal__header">
|
|
146
|
+
<div className="components-modal__header-heading-container">
|
|
147
|
+
{ icon && (
|
|
148
|
+
<span
|
|
149
|
+
className="components-modal__icon-container"
|
|
150
|
+
aria-hidden
|
|
151
|
+
>
|
|
152
|
+
{ icon }
|
|
153
|
+
</span>
|
|
154
|
+
) }
|
|
155
|
+
{ title && (
|
|
156
|
+
<h1
|
|
157
|
+
id={ headingId }
|
|
158
|
+
className="components-modal__header-heading"
|
|
159
|
+
>
|
|
160
|
+
{ title }
|
|
161
|
+
</h1>
|
|
162
|
+
) }
|
|
163
|
+
</div>
|
|
164
|
+
{ isDismissible && (
|
|
165
|
+
<Button
|
|
166
|
+
onClick={ onRequestClose }
|
|
167
|
+
icon={ closeSmall }
|
|
168
|
+
label={
|
|
169
|
+
closeButtonLabel || __( 'Close dialog' )
|
|
170
|
+
}
|
|
171
|
+
/>
|
|
148
172
|
) }
|
|
149
173
|
</div>
|
|
150
|
-
{
|
|
151
|
-
<Button
|
|
152
|
-
onClick={ onRequestClose }
|
|
153
|
-
icon={ closeSmall }
|
|
154
|
-
label={
|
|
155
|
-
closeButtonLabel || __( 'Close dialog' )
|
|
156
|
-
}
|
|
157
|
-
/>
|
|
158
|
-
) }
|
|
174
|
+
{ children }
|
|
159
175
|
</div>
|
|
160
|
-
{ children }
|
|
161
176
|
</div>
|
|
162
|
-
</
|
|
177
|
+
</StyleProvider>
|
|
163
178
|
</div>,
|
|
164
179
|
document.body
|
|
165
180
|
);
|
package/src/modal/style.scss
CHANGED
|
@@ -41,10 +41,9 @@ export default function NavigationGroup( { children, className, title } ) {
|
|
|
41
41
|
<li className={ classes }>
|
|
42
42
|
{ title && (
|
|
43
43
|
<GroupTitleUI
|
|
44
|
-
as="h3"
|
|
45
44
|
className="components-navigation__group-title"
|
|
46
45
|
id={ groupTitleId }
|
|
47
|
-
|
|
46
|
+
level={ 3 }
|
|
48
47
|
>
|
|
49
48
|
{ title }
|
|
50
49
|
</GroupTitleUI>
|
|
@@ -7,15 +7,12 @@ import { filter } from 'lodash';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useEffect, useRef } from '@wordpress/element';
|
|
10
|
-
import { Icon, closeSmall, search as searchIcon } from '@wordpress/icons';
|
|
11
10
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
12
11
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Internal dependencies
|
|
16
15
|
*/
|
|
17
|
-
import Button from '../../button';
|
|
18
|
-
import { VisuallyHidden } from '../../visually-hidden';
|
|
19
16
|
import withSpokenMessages from '../../higher-order/with-spoken-messages';
|
|
20
17
|
import { useNavigationMenuContext } from './context';
|
|
21
18
|
import { useNavigationContext } from '../context';
|
|
@@ -73,40 +70,28 @@ function MenuTitleSearch( {
|
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
const menuTitleId = `components-navigation__menu-title-${ menu }`;
|
|
77
73
|
const inputId = `components-navigation__menu-title-search-${ menu }`;
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const placeholder = sprintf(
|
|
75
|
+
/* translators: placeholder for menu search box. %s: menu title */
|
|
76
|
+
__( 'Search %s' ),
|
|
77
|
+
title?.toLowerCase()
|
|
78
|
+
).trim();
|
|
80
79
|
|
|
81
80
|
return (
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
<VisuallyHidden as="label" htmlFor={ inputId } id={ menuTitleId }>
|
|
86
|
-
{ placeholder }
|
|
87
|
-
</VisuallyHidden>
|
|
88
|
-
|
|
89
|
-
<input
|
|
81
|
+
<div className="components-navigation__menu-title-search">
|
|
82
|
+
<MenuTitleSearchUI
|
|
90
83
|
autoComplete="off"
|
|
91
|
-
className="components-
|
|
84
|
+
className="components-navigation__menu-search-input"
|
|
92
85
|
id={ inputId }
|
|
93
|
-
onChange={ (
|
|
86
|
+
onChange={ ( value ) => onSearch( value ) }
|
|
94
87
|
onKeyDown={ onKeyDown }
|
|
95
88
|
placeholder={ placeholder }
|
|
89
|
+
onClose={ onClose }
|
|
96
90
|
ref={ inputRef }
|
|
97
91
|
type="search"
|
|
98
92
|
value={ search }
|
|
99
93
|
/>
|
|
100
|
-
|
|
101
|
-
<Button
|
|
102
|
-
isSmall
|
|
103
|
-
variant="tertiary"
|
|
104
|
-
label={ __( 'Close search' ) }
|
|
105
|
-
onClick={ onClose }
|
|
106
|
-
>
|
|
107
|
-
<Icon icon={ closeSmall } />
|
|
108
|
-
</Button>
|
|
109
|
-
</MenuTitleSearchUI>
|
|
94
|
+
</div>
|
|
110
95
|
);
|
|
111
96
|
}
|
|
112
97
|
|
|
@@ -12,8 +12,8 @@ import { getAnimateClassName } from '../../animate';
|
|
|
12
12
|
import Button from '../../button';
|
|
13
13
|
import MenuTitleSearch from './menu-title-search';
|
|
14
14
|
import {
|
|
15
|
+
GroupTitleUI,
|
|
15
16
|
MenuTitleActionsUI,
|
|
16
|
-
MenuTitleHeadingUI,
|
|
17
17
|
MenuTitleUI,
|
|
18
18
|
} from '../styles/navigation-styles';
|
|
19
19
|
import { useNavigationMenuContext } from './context';
|
|
@@ -51,10 +51,10 @@ export default function NavigationMenuTitle( {
|
|
|
51
51
|
return (
|
|
52
52
|
<MenuTitleUI className="components-navigation__menu-title">
|
|
53
53
|
{ ! isSearching && (
|
|
54
|
-
<
|
|
54
|
+
<GroupTitleUI
|
|
55
55
|
as="h2"
|
|
56
56
|
className="components-navigation__menu-title-heading"
|
|
57
|
-
|
|
57
|
+
level={ 3 }
|
|
58
58
|
>
|
|
59
59
|
<span id={ menuTitleId }>{ title }</span>
|
|
60
60
|
|
|
@@ -75,7 +75,7 @@ export default function NavigationMenuTitle( {
|
|
|
75
75
|
) }
|
|
76
76
|
</MenuTitleActionsUI>
|
|
77
77
|
) }
|
|
78
|
-
</
|
|
78
|
+
</GroupTitleUI>
|
|
79
79
|
) }
|
|
80
80
|
|
|
81
81
|
{ isSearching && (
|
|
@@ -14,8 +14,10 @@ import { isRTL } from '@wordpress/i18n';
|
|
|
14
14
|
import { BASE, G2, UI } from '../../utils/colors-values';
|
|
15
15
|
import Button from '../../button';
|
|
16
16
|
import { Text } from '../../text';
|
|
17
|
+
import { Heading } from '../../heading';
|
|
17
18
|
import { reduceMotion, rtl } from '../../utils';
|
|
18
19
|
import { space } from '../../ui/utils/space';
|
|
20
|
+
import SearchControl from '../../search-control';
|
|
19
21
|
|
|
20
22
|
export const NavigationUI = styled.div`
|
|
21
23
|
width: 100%;
|
|
@@ -67,20 +69,6 @@ export const MenuTitleUI = styled.div`
|
|
|
67
69
|
width: 100%;
|
|
68
70
|
`;
|
|
69
71
|
|
|
70
|
-
export const MenuTitleHeadingUI = styled( Text )`
|
|
71
|
-
align-items: center;
|
|
72
|
-
color: inherit;
|
|
73
|
-
display: flex;
|
|
74
|
-
justify-content: space-between;
|
|
75
|
-
margin-bottom: ${ space( 2 ) };
|
|
76
|
-
padding: ${ () =>
|
|
77
|
-
isRTL()
|
|
78
|
-
? `${ space( 1 ) } ${ space( 4 ) } ${ space( 1 ) } ${ space( 3 ) }`
|
|
79
|
-
: `${ space( 1 ) } ${ space( 3 ) } ${ space( 1 ) } ${ space(
|
|
80
|
-
4
|
|
81
|
-
) }` };
|
|
82
|
-
`;
|
|
83
|
-
|
|
84
72
|
export const MenuTitleActionsUI = styled.span`
|
|
85
73
|
height: ${ space( 6 ) }; // 24px, same height as the buttons inside
|
|
86
74
|
|
|
@@ -103,56 +91,45 @@ export const MenuTitleActionsUI = styled.span`
|
|
|
103
91
|
}
|
|
104
92
|
`;
|
|
105
93
|
|
|
106
|
-
export const MenuTitleSearchUI = styled
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
&::-webkit-search-cancel-button,
|
|
120
|
-
&::-webkit-search-results-button,
|
|
121
|
-
&::-webkit-search-results-decoration {
|
|
122
|
-
-webkit-appearance: none;
|
|
94
|
+
export const MenuTitleSearchUI = styled( SearchControl )`
|
|
95
|
+
input[type='search'].components-search-control__input {
|
|
96
|
+
margin: 0;
|
|
97
|
+
background: #303030;
|
|
98
|
+
color: #fff;
|
|
99
|
+
|
|
100
|
+
&:focus {
|
|
101
|
+
background: #434343;
|
|
102
|
+
color: #fff;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&::placeholder {
|
|
106
|
+
color: rgba( 255, 255, 255, 0.6 );
|
|
123
107
|
}
|
|
124
108
|
}
|
|
125
109
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
position: absolute;
|
|
129
|
-
top: 6px;
|
|
110
|
+
svg {
|
|
111
|
+
fill: white;
|
|
130
112
|
}
|
|
131
113
|
|
|
132
|
-
.components-button.
|
|
133
|
-
height: 30px;
|
|
114
|
+
.components-button.has-icon {
|
|
134
115
|
padding: 0;
|
|
135
|
-
|
|
136
|
-
right: ${ space( 2 ) };
|
|
137
|
-
top: 3px;
|
|
138
|
-
|
|
139
|
-
&:active:not( :disabled ) {
|
|
140
|
-
background: none;
|
|
141
|
-
}
|
|
142
|
-
&:hover:not( :disabled ) {
|
|
143
|
-
box-shadow: none;
|
|
144
|
-
}
|
|
116
|
+
min-width: auto;
|
|
145
117
|
}
|
|
146
118
|
`;
|
|
147
119
|
|
|
148
|
-
export const GroupTitleUI = styled(
|
|
120
|
+
export const GroupTitleUI = styled( Heading )`
|
|
121
|
+
min-height: ${ space( 12 ) };
|
|
122
|
+
align-items: center;
|
|
149
123
|
color: inherit;
|
|
150
|
-
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
margin-bottom: ${ space( 2 ) };
|
|
151
127
|
padding: ${ () =>
|
|
152
128
|
isRTL()
|
|
153
|
-
? `${ space( 1 ) } ${ space( 4 ) } ${ space( 1 ) }
|
|
154
|
-
: `${ space( 1 ) }
|
|
155
|
-
|
|
129
|
+
? `${ space( 1 ) } ${ space( 4 ) } ${ space( 1 ) } ${ space( 2 ) }`
|
|
130
|
+
: `${ space( 1 ) } ${ space( 2 ) } ${ space( 1 ) } ${ space(
|
|
131
|
+
4
|
|
132
|
+
) }` };
|
|
156
133
|
`;
|
|
157
134
|
|
|
158
135
|
export const ItemBaseUI = styled.li`
|
package/src/popover/index.js
CHANGED
|
@@ -456,11 +456,11 @@ const Popover = (
|
|
|
456
456
|
defaultView.cancelAnimationFrame( rafId );
|
|
457
457
|
|
|
458
458
|
if ( anchorDocument && anchorDocument !== ownerDocument ) {
|
|
459
|
-
anchorDocument.defaultView
|
|
459
|
+
anchorDocument.defaultView?.removeEventListener(
|
|
460
460
|
'resize',
|
|
461
461
|
refresh
|
|
462
462
|
);
|
|
463
|
-
anchorDocument.defaultView
|
|
463
|
+
anchorDocument.defaultView?.removeEventListener(
|
|
464
464
|
'scroll',
|
|
465
465
|
refresh,
|
|
466
466
|
true
|
|
@@ -189,10 +189,13 @@ export const ThumbWrapper = styled.span`
|
|
|
189
189
|
user-select: none;
|
|
190
190
|
width: ${ thumbSize }px;
|
|
191
191
|
border-radius: 50%;
|
|
192
|
-
transform: translateX( 4.5px );
|
|
193
192
|
|
|
194
193
|
${ thumbColor };
|
|
195
194
|
${ rtl( { marginLeft: -10 } ) };
|
|
195
|
+
${ rtl(
|
|
196
|
+
{ transform: 'translateX( 4.5px )' },
|
|
197
|
+
{ transform: 'translateX( -4.5px )' }
|
|
198
|
+
) };
|
|
196
199
|
`;
|
|
197
200
|
|
|
198
201
|
const thumbFocus = ( { isFocused } ) => {
|
|
@@ -17,6 +17,11 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// Make the image inside the resize to get the full width
|
|
21
|
+
.components-resizable-box__container > img {
|
|
22
|
+
width: inherit;
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
// This is the "visible" resize handle - the circle part
|
|
21
26
|
.components-resizable-box__handle::after {
|
|
22
27
|
display: block;
|
|
@@ -9,27 +9,60 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { useInstanceId } from '@wordpress/compose';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { Icon, search, closeSmall } from '@wordpress/icons';
|
|
12
|
-
import {
|
|
12
|
+
import { forwardRef } from '@wordpress/element';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
import { Button } from '../';
|
|
18
18
|
import BaseControl from '../base-control';
|
|
19
|
+
import { useCombinedRef } from '../utils';
|
|
19
20
|
|
|
20
|
-
function SearchControl(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
function SearchControl(
|
|
22
|
+
{
|
|
23
|
+
className,
|
|
24
|
+
onChange,
|
|
25
|
+
onKeyDown,
|
|
26
|
+
value,
|
|
27
|
+
label,
|
|
28
|
+
placeholder = __( 'Search' ),
|
|
29
|
+
hideLabelFromVision = true,
|
|
30
|
+
help,
|
|
31
|
+
onClose,
|
|
32
|
+
},
|
|
33
|
+
ref
|
|
34
|
+
) {
|
|
29
35
|
const instanceId = useInstanceId( SearchControl );
|
|
30
|
-
const searchInput =
|
|
36
|
+
const searchInput = useCombinedRef( ref );
|
|
31
37
|
const id = `components-search-control-${ instanceId }`;
|
|
32
38
|
|
|
39
|
+
const renderRightButton = () => {
|
|
40
|
+
if ( onClose ) {
|
|
41
|
+
return (
|
|
42
|
+
<Button
|
|
43
|
+
icon={ closeSmall }
|
|
44
|
+
label={ __( 'Close search' ) }
|
|
45
|
+
onClick={ onClose }
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if ( !! value ) {
|
|
51
|
+
return (
|
|
52
|
+
<Button
|
|
53
|
+
icon={ closeSmall }
|
|
54
|
+
label={ __( 'Reset search' ) }
|
|
55
|
+
onClick={ () => {
|
|
56
|
+
onChange( '' );
|
|
57
|
+
searchInput.current.focus();
|
|
58
|
+
} }
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return <Icon icon={ search } />;
|
|
64
|
+
};
|
|
65
|
+
|
|
33
66
|
return (
|
|
34
67
|
<BaseControl
|
|
35
68
|
label={ label }
|
|
@@ -46,25 +79,16 @@ function SearchControl( {
|
|
|
46
79
|
type="search"
|
|
47
80
|
placeholder={ placeholder }
|
|
48
81
|
onChange={ ( event ) => onChange( event.target.value ) }
|
|
82
|
+
onKeyDown={ onKeyDown }
|
|
49
83
|
autoComplete="off"
|
|
50
84
|
value={ value || '' }
|
|
51
85
|
/>
|
|
52
86
|
<div className="components-search-control__icon">
|
|
53
|
-
{
|
|
54
|
-
<Button
|
|
55
|
-
icon={ closeSmall }
|
|
56
|
-
label={ __( 'Reset search' ) }
|
|
57
|
-
onClick={ () => {
|
|
58
|
-
onChange( '' );
|
|
59
|
-
searchInput.current.focus();
|
|
60
|
-
} }
|
|
61
|
-
/>
|
|
62
|
-
) }
|
|
63
|
-
{ ! value && <Icon icon={ search } /> }
|
|
87
|
+
{ renderRightButton() }
|
|
64
88
|
</div>
|
|
65
89
|
</div>
|
|
66
90
|
</BaseControl>
|
|
67
91
|
);
|
|
68
92
|
}
|
|
69
93
|
|
|
70
|
-
export default SearchControl;
|
|
94
|
+
export default forwardRef( SearchControl );
|
package/src/style.scss
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
@import "./color-indicator/style.scss";
|
|
9
9
|
@import "./combobox-control/style.scss";
|
|
10
10
|
@import "./color-list-picker/style.scss";
|
|
11
|
+
@import "./color-palette/style.scss";
|
|
11
12
|
@import "./custom-gradient-picker/style.scss";
|
|
12
13
|
@import "./custom-select-control/style.scss";
|
|
13
14
|
@import "./date-time/style.scss";
|
package/src/text/styles.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Text should render highlighted words with highlightCaseSensitive 1`] = `
|
|
4
4
|
.emotion-0 {
|
|
5
|
-
color: #
|
|
5
|
+
color: #1e1e1e;
|
|
6
6
|
line-height: 1.2;
|
|
7
7
|
margin: 0;
|
|
8
8
|
font-size: calc((13 / 13) * 13px);
|
|
@@ -30,7 +30,7 @@ exports[`Text should render highlighted words with highlightCaseSensitive 1`] =
|
|
|
30
30
|
|
|
31
31
|
exports[`Text snapshot tests should render correctly 1`] = `
|
|
32
32
|
.emotion-0 {
|
|
33
|
-
color: #
|
|
33
|
+
color: #1e1e1e;
|
|
34
34
|
line-height: 1.2;
|
|
35
35
|
margin: 0;
|
|
36
36
|
font-size: calc((13 / 13) * 13px);
|
|
@@ -39,8 +39,7 @@ export const _default = () => {
|
|
|
39
39
|
label="Tools Panel (default example)"
|
|
40
40
|
resetAll={ resetAll }
|
|
41
41
|
>
|
|
42
|
-
<
|
|
43
|
-
className="single-column"
|
|
42
|
+
<SingleColumnItem
|
|
44
43
|
hasValue={ () => !! width }
|
|
45
44
|
label="Width"
|
|
46
45
|
onDeselect={ () => setWidth( undefined ) }
|
|
@@ -51,9 +50,8 @@ export const _default = () => {
|
|
|
51
50
|
value={ width }
|
|
52
51
|
onChange={ ( next ) => setWidth( next ) }
|
|
53
52
|
/>
|
|
54
|
-
</
|
|
55
|
-
<
|
|
56
|
-
className="single-column"
|
|
53
|
+
</SingleColumnItem>
|
|
54
|
+
<SingleColumnItem
|
|
57
55
|
hasValue={ () => !! height }
|
|
58
56
|
label="Height"
|
|
59
57
|
onDeselect={ () => setHeight( undefined ) }
|
|
@@ -64,7 +62,7 @@ export const _default = () => {
|
|
|
64
62
|
value={ height }
|
|
65
63
|
onChange={ ( next ) => setHeight( next ) }
|
|
66
64
|
/>
|
|
67
|
-
</
|
|
65
|
+
</SingleColumnItem>
|
|
68
66
|
<ToolsPanelItem
|
|
69
67
|
hasValue={ () => !! minHeight }
|
|
70
68
|
label="Minimum height"
|
|
@@ -99,8 +97,7 @@ export const WithOptionalItemsPlusIcon = () => {
|
|
|
99
97
|
label="Tools Panel (optional items only)"
|
|
100
98
|
resetAll={ resetAll }
|
|
101
99
|
>
|
|
102
|
-
<
|
|
103
|
-
className="single-column"
|
|
100
|
+
<SingleColumnItem
|
|
104
101
|
hasValue={ () => !! width }
|
|
105
102
|
label="Width"
|
|
106
103
|
onDeselect={ () => setWidth( undefined ) }
|
|
@@ -111,9 +108,8 @@ export const WithOptionalItemsPlusIcon = () => {
|
|
|
111
108
|
value={ width }
|
|
112
109
|
onChange={ ( next ) => setWidth( next ) }
|
|
113
110
|
/>
|
|
114
|
-
</
|
|
115
|
-
<
|
|
116
|
-
className="single-column"
|
|
111
|
+
</SingleColumnItem>
|
|
112
|
+
<SingleColumnItem
|
|
117
113
|
hasValue={ () => !! height }
|
|
118
114
|
label="Height"
|
|
119
115
|
onDeselect={ () => setHeight( undefined ) }
|
|
@@ -124,7 +120,7 @@ export const WithOptionalItemsPlusIcon = () => {
|
|
|
124
120
|
value={ height }
|
|
125
121
|
onChange={ ( next ) => setHeight( next ) }
|
|
126
122
|
/>
|
|
127
|
-
</
|
|
123
|
+
</SingleColumnItem>
|
|
128
124
|
</ToolsPanel>
|
|
129
125
|
</Panel>
|
|
130
126
|
</PanelWrapperView>
|
|
@@ -161,8 +157,7 @@ export const WithSlotFillItems = () => {
|
|
|
161
157
|
return (
|
|
162
158
|
<SlotFillProvider>
|
|
163
159
|
<ToolsPanelItems>
|
|
164
|
-
<
|
|
165
|
-
className="single-column"
|
|
160
|
+
<SingleColumnItem
|
|
166
161
|
hasValue={ () => !! width }
|
|
167
162
|
label="Injected Width"
|
|
168
163
|
onDeselect={ () => updateAttribute( 'width', undefined ) }
|
|
@@ -176,9 +171,8 @@ export const WithSlotFillItems = () => {
|
|
|
176
171
|
updateAttribute( 'width', next )
|
|
177
172
|
}
|
|
178
173
|
/>
|
|
179
|
-
</
|
|
180
|
-
<
|
|
181
|
-
className="single-column"
|
|
174
|
+
</SingleColumnItem>
|
|
175
|
+
<SingleColumnItem
|
|
182
176
|
hasValue={ () => !! height }
|
|
183
177
|
label="Injected Height"
|
|
184
178
|
onDeselect={ () => updateAttribute( 'height', undefined ) }
|
|
@@ -192,7 +186,7 @@ export const WithSlotFillItems = () => {
|
|
|
192
186
|
updateAttribute( 'height', next )
|
|
193
187
|
}
|
|
194
188
|
/>
|
|
195
|
-
</
|
|
189
|
+
</SingleColumnItem>
|
|
196
190
|
<ToolsPanelItem
|
|
197
191
|
hasValue={ () => true }
|
|
198
192
|
label="Item for alternate panel"
|
|
@@ -224,6 +218,14 @@ export const WithSlotFillItems = () => {
|
|
|
224
218
|
export { TypographyPanel } from './typography-panel';
|
|
225
219
|
|
|
226
220
|
const PanelWrapperView = styled.div`
|
|
227
|
-
max-width:
|
|
221
|
+
max-width: 280px;
|
|
228
222
|
font-size: 13px;
|
|
223
|
+
|
|
224
|
+
.components-dropdown-menu__menu {
|
|
225
|
+
max-width: 220px;
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
|
|
229
|
+
const SingleColumnItem = styled( ToolsPanelItem )`
|
|
230
|
+
grid-column: span 1;
|
|
229
231
|
`;
|