@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.
Files changed (213) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/CONTRIBUTING.md +12 -12
  3. package/build/angle-picker-control/index.js +3 -1
  4. package/build/angle-picker-control/index.js.map +1 -1
  5. package/build/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
  6. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  7. package/build/base-control/index.js +1 -1
  8. package/build/base-control/index.js.map +1 -1
  9. package/build/color-edit/index.js +180 -199
  10. package/build/color-edit/index.js.map +1 -1
  11. package/build/color-edit/styles.js +112 -0
  12. package/build/color-edit/styles.js.map +1 -0
  13. package/build/color-list-picker/index.js +6 -1
  14. package/build/color-list-picker/index.js.map +1 -1
  15. package/build/color-palette/index.js +86 -21
  16. package/build/color-palette/index.js.map +1 -1
  17. package/build/color-palette/styles.js +31 -0
  18. package/build/color-palette/styles.js.map +1 -0
  19. package/build/color-picker/component.js +7 -18
  20. package/build/color-picker/component.js.map +1 -1
  21. package/build/color-picker/picker.js +3 -3
  22. package/build/color-picker/picker.js.map +1 -1
  23. package/build/duotone-picker/custom-duotone-bar.js +0 -1
  24. package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
  25. package/build/duotone-picker/duotone-picker.js +1 -0
  26. package/build/duotone-picker/duotone-picker.js.map +1 -1
  27. package/build/gradient-picker/index.js +69 -9
  28. package/build/gradient-picker/index.js.map +1 -1
  29. package/build/index.native.js +9 -0
  30. package/build/index.native.js.map +1 -1
  31. package/build/mobile/bottom-sheet/cell.native.js +4 -2
  32. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  33. package/build/mobile/bottom-sheet/link-cell.native.js +3 -2
  34. package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
  35. package/build/mobile/link-settings/image-link-destinations-screen.native.js +140 -0
  36. package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -0
  37. package/build/mobile/link-settings/index.native.js +3 -2
  38. package/build/mobile/link-settings/index.native.js.map +1 -1
  39. package/build/mobile/link-settings/link-settings-navigation.native.js +1 -0
  40. package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  41. package/build/mobile/link-settings/link-settings-screen.native.js +11 -5
  42. package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  43. package/build/mobile/picker/index.android.js +4 -2
  44. package/build/mobile/picker/index.android.js.map +1 -1
  45. package/build/modal/index.js +10 -3
  46. package/build/modal/index.js.map +1 -1
  47. package/build/navigation/group/index.js +1 -2
  48. package/build/navigation/group/index.js.map +1 -1
  49. package/build/navigation/menu/menu-title-search.js +8 -27
  50. package/build/navigation/menu/menu-title-search.js.map +1 -1
  51. package/build/navigation/menu/menu-title.js +2 -2
  52. package/build/navigation/menu/menu-title.js.map +1 -1
  53. package/build/navigation/styles/navigation-styles.js +34 -29
  54. package/build/navigation/styles/navigation-styles.js.map +1 -1
  55. package/build/popover/index.js +4 -2
  56. package/build/popover/index.js.map +1 -1
  57. package/build/range-control/styles/range-control-styles.js +33 -29
  58. package/build/range-control/styles/range-control-styles.js.map +1 -1
  59. package/build/search-control/index.js +37 -14
  60. package/build/search-control/index.js.map +1 -1
  61. package/build/text/styles.js +7 -7
  62. package/build/text/styles.js.map +1 -1
  63. package/build/tools-panel/styles.js +18 -23
  64. package/build/tools-panel/styles.js.map +1 -1
  65. package/build/tools-panel/tools-panel/component.js +10 -7
  66. package/build/tools-panel/tools-panel/component.js.map +1 -1
  67. package/build/tools-panel/tools-panel/hook.js +3 -1
  68. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  69. package/build/tools-panel/tools-panel-header/component.js +3 -0
  70. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  71. package/build/utils/hooks/index.js +8 -0
  72. package/build/utils/hooks/index.js.map +1 -1
  73. package/build/utils/hooks/use-combined-ref.js +28 -0
  74. package/build/utils/hooks/use-combined-ref.js.map +1 -0
  75. package/build-module/angle-picker-control/index.js +3 -1
  76. package/build-module/angle-picker-control/index.js.map +1 -1
  77. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
  78. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  79. package/build-module/base-control/index.js +1 -1
  80. package/build-module/base-control/index.js.map +1 -1
  81. package/build-module/color-edit/index.js +175 -201
  82. package/build-module/color-edit/index.js.map +1 -1
  83. package/build-module/color-edit/styles.js +90 -0
  84. package/build-module/color-edit/styles.js.map +1 -0
  85. package/build-module/color-list-picker/index.js +6 -1
  86. package/build-module/color-list-picker/index.js.map +1 -1
  87. package/build-module/color-palette/index.js +85 -22
  88. package/build-module/color-palette/index.js.map +1 -1
  89. package/build-module/color-palette/styles.js +27 -0
  90. package/build-module/color-palette/styles.js.map +1 -0
  91. package/build-module/color-picker/component.js +7 -16
  92. package/build-module/color-picker/component.js.map +1 -1
  93. package/build-module/color-picker/picker.js +4 -4
  94. package/build-module/color-picker/picker.js.map +1 -1
  95. package/build-module/duotone-picker/custom-duotone-bar.js +0 -1
  96. package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
  97. package/build-module/duotone-picker/duotone-picker.js +1 -0
  98. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  99. package/build-module/gradient-picker/index.js +67 -9
  100. package/build-module/gradient-picker/index.js.map +1 -1
  101. package/build-module/index.native.js +1 -0
  102. package/build-module/index.native.js.map +1 -1
  103. package/build-module/mobile/bottom-sheet/cell.native.js +4 -2
  104. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  105. package/build-module/mobile/bottom-sheet/link-cell.native.js +3 -2
  106. package/build-module/mobile/bottom-sheet/link-cell.native.js.map +1 -1
  107. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +121 -0
  108. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -0
  109. package/build-module/mobile/link-settings/index.native.js +3 -2
  110. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  111. package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -0
  112. package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  113. package/build-module/mobile/link-settings/link-settings-screen.native.js +11 -5
  114. package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  115. package/build-module/mobile/picker/index.android.js +4 -2
  116. package/build-module/mobile/picker/index.android.js.map +1 -1
  117. package/build-module/modal/index.js +10 -4
  118. package/build-module/modal/index.js.map +1 -1
  119. package/build-module/navigation/group/index.js +1 -2
  120. package/build-module/navigation/group/index.js.map +1 -1
  121. package/build-module/navigation/menu/menu-title-search.js +8 -24
  122. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  123. package/build-module/navigation/menu/menu-title.js +3 -3
  124. package/build-module/navigation/menu/menu-title.js.map +1 -1
  125. package/build-module/navigation/styles/navigation-styles.js +31 -27
  126. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  127. package/build-module/popover/index.js +4 -2
  128. package/build-module/popover/index.js.map +1 -1
  129. package/build-module/range-control/styles/range-control-styles.js +33 -29
  130. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  131. package/build-module/search-control/index.js +36 -15
  132. package/build-module/search-control/index.js.map +1 -1
  133. package/build-module/text/styles.js +7 -7
  134. package/build-module/text/styles.js.map +1 -1
  135. package/build-module/tools-panel/styles.js +16 -23
  136. package/build-module/tools-panel/styles.js.map +1 -1
  137. package/build-module/tools-panel/tools-panel/component.js +10 -6
  138. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  139. package/build-module/tools-panel/tools-panel/hook.js +2 -1
  140. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  141. package/build-module/tools-panel/tools-panel-header/component.js +3 -0
  142. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  143. package/build-module/utils/hooks/index.js +1 -0
  144. package/build-module/utils/hooks/index.js.map +1 -1
  145. package/build-module/utils/hooks/use-combined-ref.js +25 -0
  146. package/build-module/utils/hooks/use-combined-ref.js.map +1 -0
  147. package/build-style/style-rtl.css +39 -51
  148. package/build-style/style.css +39 -51
  149. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  150. package/build-types/tools-panel/styles.d.ts +1 -1
  151. package/build-types/tools-panel/styles.d.ts.map +1 -1
  152. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  153. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  154. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  155. package/build-types/utils/hooks/index.d.ts +1 -0
  156. package/build-types/utils/hooks/use-combined-ref.d.ts +8 -0
  157. package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -0
  158. package/package.json +6 -6
  159. package/src/angle-picker-control/index.js +3 -1
  160. package/src/angle-picker-control/styles/angle-picker-control-styles.js +2 -2
  161. package/src/base-control/index.js +1 -1
  162. package/src/circular-option-picker/style.scss +3 -5
  163. package/src/color-edit/index.js +248 -274
  164. package/src/color-edit/style.scss +4 -45
  165. package/src/color-edit/styles.js +97 -0
  166. package/src/color-list-picker/index.js +5 -0
  167. package/src/color-list-picker/style.scss +4 -0
  168. package/src/color-palette/index.js +90 -26
  169. package/src/color-palette/style.scss +18 -0
  170. package/src/color-palette/styles.js +19 -0
  171. package/src/color-palette/test/__snapshots__/index.js.snap +448 -414
  172. package/src/color-picker/component.tsx +6 -17
  173. package/src/color-picker/picker.tsx +6 -4
  174. package/src/color-picker/test/index.js +0 -15
  175. package/src/duotone-picker/custom-duotone-bar.js +0 -1
  176. package/src/duotone-picker/duotone-picker.js +1 -0
  177. package/src/gradient-picker/index.js +79 -11
  178. package/src/heading/test/__snapshots__/index.js.snap +1 -1
  179. package/src/index.native.js +1 -0
  180. package/src/mobile/bottom-sheet/cell.native.js +7 -2
  181. package/src/mobile/bottom-sheet/cellStyles.android.scss +5 -1
  182. package/src/mobile/bottom-sheet/cellStyles.ios.scss +5 -1
  183. package/src/mobile/bottom-sheet/link-cell.native.js +10 -3
  184. package/src/mobile/link-settings/image-link-destinations-screen.native.js +148 -0
  185. package/src/mobile/link-settings/index.native.js +3 -2
  186. package/src/mobile/link-settings/link-settings-navigation.native.js +1 -0
  187. package/src/mobile/link-settings/link-settings-screen.native.js +6 -2
  188. package/src/mobile/link-settings/style.native.scss +17 -0
  189. package/src/mobile/picker/index.android.js +2 -1
  190. package/src/modal/README.md +8 -0
  191. package/src/modal/index.js +60 -45
  192. package/src/modal/style.scss +5 -0
  193. package/src/navigation/group/index.js +1 -2
  194. package/src/navigation/menu/menu-title-search.js +11 -26
  195. package/src/navigation/menu/menu-title.js +4 -4
  196. package/src/navigation/styles/navigation-styles.js +29 -52
  197. package/src/popover/index.js +2 -2
  198. package/src/range-control/styles/range-control-styles.js +4 -1
  199. package/src/resizable-box/style.scss +5 -0
  200. package/src/search-control/index.js +47 -23
  201. package/src/style.scss +1 -0
  202. package/src/text/styles.js +1 -1
  203. package/src/text/test/__snapshots__/index.js.snap +2 -2
  204. package/src/tools-panel/stories/index.js +21 -19
  205. package/src/tools-panel/styles.ts +18 -26
  206. package/src/tools-panel/tools-panel/component.tsx +7 -4
  207. package/src/tools-panel/tools-panel/hook.ts +4 -1
  208. package/src/tools-panel/tools-panel-header/component.tsx +1 -0
  209. package/src/ui/control-label/test/__snapshots__/index.js.snap +3 -3
  210. package/src/ui/form-group/test/__snapshots__/index.js.snap +2 -2
  211. package/src/utils/hooks/index.js +1 -0
  212. package/src/utils/hooks/use-combined-ref.ts +29 -0
  213. package/tsconfig.tsbuildinfo +1 -1
@@ -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
- <div
115
- className={ classnames( 'components-modal__frame', className ) }
116
- style={ style }
117
- ref={ useMergeRefs( [
118
- constrainedTabbingRef,
119
- focusReturnRef,
120
- focusOnMountRef,
121
- ] ) }
122
- role={ role }
123
- aria-label={ contentLabel }
124
- aria-labelledby={ contentLabel ? null : headingId }
125
- aria-describedby={ aria.describedby }
126
- tabIndex="-1"
127
- { ...( shouldCloseOnClickOutside ? focusOutsideProps : {} ) }
128
- onKeyDown={ onKeyDown }
129
- >
130
- <div className={ 'components-modal__content' } role="document">
131
- <div className="components-modal__header">
132
- <div className="components-modal__header-heading-container">
133
- { icon && (
134
- <span
135
- className="components-modal__icon-container"
136
- aria-hidden
137
- >
138
- { icon }
139
- </span>
140
- ) }
141
- { title && (
142
- <h1
143
- id={ headingId }
144
- className="components-modal__header-heading"
145
- >
146
- { title }
147
- </h1>
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
- { isDismissible && (
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
- </div>
177
+ </StyleProvider>
163
178
  </div>,
164
179
  document.body
165
180
  );
@@ -37,6 +37,11 @@
37
37
  animation: components-modal__appear-animation 0.1s ease-out;
38
38
  animation-fill-mode: forwards;
39
39
  @include reduce-motion("animation");
40
+
41
+ &.is-full-screen {
42
+ width: 90vw;
43
+ min-height: 90vh;
44
+ }
40
45
  }
41
46
 
42
47
  @include break-large() {
@@ -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
- variant="caption"
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
- /* translators: placeholder for menu search box. %s: menu title */
79
- const placeholder = sprintf( __( 'Search in %s' ), title );
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
- <MenuTitleSearchUI className="components-navigation__menu-title-search">
83
- <Icon icon={ searchIcon } />
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-text-control__input"
84
+ className="components-navigation__menu-search-input"
92
85
  id={ inputId }
93
- onChange={ ( event ) => onSearch( event.target.value ) }
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
- <MenuTitleHeadingUI
54
+ <GroupTitleUI
55
55
  as="h2"
56
56
  className="components-navigation__menu-title-heading"
57
- variant="title.small"
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
- </MenuTitleHeadingUI>
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.div`
107
- padding: 0;
108
- position: relative;
109
-
110
- input {
111
- height: ${ space( 9 ) }; // 36px, same height as MenuTitle
112
- margin-bottom: ${ space( 2 ) };
113
- padding-left: ${ space( 8 ) }; // Leave room for the search icon
114
- padding-right: ${ space(
115
- 8
116
- ) }; // Leave room for the close search button
117
-
118
- &::-webkit-search-decoration,
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
- > svg {
127
- left: ${ space( 1 ) };
128
- position: absolute;
129
- top: 6px;
110
+ svg {
111
+ fill: white;
130
112
  }
131
113
 
132
- .components-button.is-small {
133
- height: 30px;
114
+ .components-button.has-icon {
134
115
  padding: 0;
135
- position: absolute;
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( Text )`
120
+ export const GroupTitleUI = styled( Heading )`
121
+ min-height: ${ space( 12 ) };
122
+ align-items: center;
149
123
  color: inherit;
150
- margin-top: ${ space( 2 ) };
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 ) } 0`
154
- : `${ space( 1 ) } 0 ${ space( 1 ) } ${ space( 4 ) }` };
155
- text-transform: uppercase;
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`
@@ -456,11 +456,11 @@ const Popover = (
456
456
  defaultView.cancelAnimationFrame( rafId );
457
457
 
458
458
  if ( anchorDocument && anchorDocument !== ownerDocument ) {
459
- anchorDocument.defaultView.removeEventListener(
459
+ anchorDocument.defaultView?.removeEventListener(
460
460
  'resize',
461
461
  refresh
462
462
  );
463
- anchorDocument.defaultView.removeEventListener(
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 { useRef } from '@wordpress/element';
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
- className,
22
- onChange,
23
- value,
24
- label,
25
- placeholder = __( 'Search' ),
26
- hideLabelFromVision = true,
27
- help,
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 = useRef();
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
- { !! value && (
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";
@@ -9,7 +9,7 @@ import { css } from '@emotion/react';
9
9
  import { COLORS, CONFIG } from '../utils';
10
10
 
11
11
  export const Text = css`
12
- color: ${ COLORS.black };
12
+ color: ${ COLORS.darkGray.primary };
13
13
  line-height: ${ CONFIG.fontLineHeightBase };
14
14
  margin: 0;
15
15
  `;
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports[`Text should render highlighted words with highlightCaseSensitive 1`] = `
4
4
  .emotion-0 {
5
- color: #000;
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: #000;
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
- <ToolsPanelItem
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
- </ToolsPanelItem>
55
- <ToolsPanelItem
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
- </ToolsPanelItem>
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
- <ToolsPanelItem
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
- </ToolsPanelItem>
115
- <ToolsPanelItem
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
- </ToolsPanelItem>
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
- <ToolsPanelItem
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
- </ToolsPanelItem>
180
- <ToolsPanelItem
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
- </ToolsPanelItem>
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: 270px;
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
  `;