@wordpress/block-editor 14.10.1 → 14.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/components/background-image-control/index.js +0 -1
  3. package/build/components/background-image-control/index.js.map +1 -1
  4. package/build/components/block-actions/index.js +0 -3
  5. package/build/components/block-actions/index.js.map +1 -1
  6. package/build/components/block-inspector/index.js +6 -11
  7. package/build/components/block-inspector/index.js.map +1 -1
  8. package/build/components/block-list/use-block-props/use-focus-handler.js +1 -1
  9. package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  10. package/build/components/block-rename/modal.js +36 -11
  11. package/build/components/block-rename/modal.js.map +1 -1
  12. package/build/components/block-rename/rename-control.js +2 -43
  13. package/build/components/block-rename/rename-control.js.map +1 -1
  14. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -3
  15. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  16. package/build/components/block-styles/preview.native.js +1 -1
  17. package/build/components/block-styles/preview.native.js.map +1 -1
  18. package/build/components/block-switcher/block-transformations-menu.js +7 -7
  19. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  20. package/build/components/block-switcher/block-variation-transformations.js +2 -2
  21. package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
  22. package/build/components/block-switcher/index.js +1 -1
  23. package/build/components/block-switcher/index.js.map +1 -1
  24. package/build/components/block-switcher/use-transformed-patterns.js +1 -1
  25. package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
  26. package/build/components/block-toolbar/index.native.js +2 -2
  27. package/build/components/block-toolbar/index.native.js.map +1 -1
  28. package/build/components/date-format-picker/index.js +1 -1
  29. package/build/components/date-format-picker/index.js.map +1 -1
  30. package/build/components/global-styles/filters-panel.js +2 -2
  31. package/build/components/global-styles/filters-panel.js.map +1 -1
  32. package/build/components/global-styles/image-settings-panel.js +2 -2
  33. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  34. package/build/components/global-styles/use-global-styles-output.js +3 -3
  35. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  36. package/build/components/iframe/get-compatibility-styles.js +1 -1
  37. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  38. package/build/components/iframe/index.js +1 -1
  39. package/build/components/iframe/index.js.map +1 -1
  40. package/build/components/image-size-control/index.js +2 -1
  41. package/build/components/image-size-control/index.js.map +1 -1
  42. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  43. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  44. package/build/components/inserter/reusable-blocks-tab.native.js +1 -1
  45. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  46. package/build/components/line-height-control/index.native.js +1 -1
  47. package/build/components/line-height-control/index.native.js.map +1 -1
  48. package/build/components/link-control/index.js +1 -1
  49. package/build/components/link-control/index.js.map +1 -1
  50. package/build/components/link-control/use-search-handler.js +1 -1
  51. package/build/components/link-control/use-search-handler.js.map +1 -1
  52. package/build/components/list-view/block-select-button.js +5 -2
  53. package/build/components/list-view/block-select-button.js.map +1 -1
  54. package/build/components/media-placeholder/index.js +1 -0
  55. package/build/components/media-placeholder/index.js.map +1 -1
  56. package/build/components/observe-typing/index.js +1 -1
  57. package/build/components/observe-typing/index.js.map +1 -1
  58. package/build/components/provider/index.js +0 -2
  59. package/build/components/provider/index.js.map +1 -1
  60. package/build/components/provider/use-block-sync.js +2 -2
  61. package/build/components/provider/use-block-sync.js.map +1 -1
  62. package/build/components/rich-text/event-listeners/input-rules.js +3 -3
  63. package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
  64. package/build/components/rich-text/native/use-format-types.js +1 -1
  65. package/build/components/rich-text/native/use-format-types.js.map +1 -1
  66. package/build/components/rich-text/use-format-types.js +1 -1
  67. package/build/components/rich-text/use-format-types.js.map +1 -1
  68. package/build/components/tabbed-sidebar/index.js +39 -0
  69. package/build/components/tabbed-sidebar/index.js.map +1 -1
  70. package/build/components/typewriter/index.js +1 -1
  71. package/build/components/typewriter/index.js.map +1 -1
  72. package/build/components/url-popover/image-url-input-ui.js +3 -3
  73. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  74. package/build/components/use-block-commands/index.js +1 -1
  75. package/build/components/use-block-commands/index.js.map +1 -1
  76. package/build/components/use-moving-animation/index.js +1 -1
  77. package/build/components/use-moving-animation/index.js.map +1 -1
  78. package/build/store/actions.js +1 -1
  79. package/build/store/actions.js.map +1 -1
  80. package/build/store/selectors.js +5 -5
  81. package/build/store/selectors.js.map +1 -1
  82. package/build/utils/transform-styles/index.js +1 -1
  83. package/build/utils/transform-styles/index.js.map +1 -1
  84. package/build/utils/use-notify-copy.js +19 -11
  85. package/build/utils/use-notify-copy.js.map +1 -1
  86. package/build-module/components/background-image-control/index.js +0 -1
  87. package/build-module/components/background-image-control/index.js.map +1 -1
  88. package/build-module/components/block-actions/index.js +0 -3
  89. package/build-module/components/block-actions/index.js.map +1 -1
  90. package/build-module/components/block-inspector/index.js +6 -11
  91. package/build-module/components/block-inspector/index.js.map +1 -1
  92. package/build-module/components/block-list/use-block-props/use-focus-handler.js +1 -1
  93. package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
  94. package/build-module/components/block-rename/modal.js +36 -11
  95. package/build-module/components/block-rename/modal.js.map +1 -1
  96. package/build-module/components/block-rename/rename-control.js +2 -43
  97. package/build-module/components/block-rename/rename-control.js.map +1 -1
  98. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -3
  99. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  100. package/build-module/components/block-styles/preview.native.js +1 -1
  101. package/build-module/components/block-styles/preview.native.js.map +1 -1
  102. package/build-module/components/block-switcher/block-transformations-menu.js +7 -7
  103. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  104. package/build-module/components/block-switcher/block-variation-transformations.js +2 -2
  105. package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
  106. package/build-module/components/block-switcher/index.js +1 -1
  107. package/build-module/components/block-switcher/index.js.map +1 -1
  108. package/build-module/components/block-switcher/use-transformed-patterns.js +1 -1
  109. package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
  110. package/build-module/components/block-toolbar/index.native.js +2 -2
  111. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  112. package/build-module/components/date-format-picker/index.js +1 -1
  113. package/build-module/components/date-format-picker/index.js.map +1 -1
  114. package/build-module/components/global-styles/filters-panel.js +2 -2
  115. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  116. package/build-module/components/global-styles/image-settings-panel.js +2 -2
  117. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  118. package/build-module/components/global-styles/use-global-styles-output.js +3 -3
  119. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  120. package/build-module/components/iframe/get-compatibility-styles.js +1 -1
  121. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  122. package/build-module/components/iframe/index.js +1 -1
  123. package/build-module/components/iframe/index.js.map +1 -1
  124. package/build-module/components/image-size-control/index.js +3 -2
  125. package/build-module/components/image-size-control/index.js.map +1 -1
  126. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  127. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  128. package/build-module/components/inserter/reusable-blocks-tab.native.js +1 -1
  129. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  130. package/build-module/components/line-height-control/index.native.js +1 -1
  131. package/build-module/components/line-height-control/index.native.js.map +1 -1
  132. package/build-module/components/link-control/index.js +1 -1
  133. package/build-module/components/link-control/index.js.map +1 -1
  134. package/build-module/components/link-control/use-search-handler.js +1 -1
  135. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  136. package/build-module/components/list-view/block-select-button.js +6 -3
  137. package/build-module/components/list-view/block-select-button.js.map +1 -1
  138. package/build-module/components/media-placeholder/index.js +1 -0
  139. package/build-module/components/media-placeholder/index.js.map +1 -1
  140. package/build-module/components/observe-typing/index.js +1 -1
  141. package/build-module/components/observe-typing/index.js.map +1 -1
  142. package/build-module/components/provider/index.js +0 -1
  143. package/build-module/components/provider/index.js.map +1 -1
  144. package/build-module/components/provider/use-block-sync.js +2 -2
  145. package/build-module/components/provider/use-block-sync.js.map +1 -1
  146. package/build-module/components/rich-text/event-listeners/input-rules.js +3 -3
  147. package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
  148. package/build-module/components/rich-text/native/use-format-types.js +1 -1
  149. package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
  150. package/build-module/components/rich-text/use-format-types.js +1 -1
  151. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  152. package/build-module/components/tabbed-sidebar/index.js +39 -0
  153. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  154. package/build-module/components/typewriter/index.js +1 -1
  155. package/build-module/components/typewriter/index.js.map +1 -1
  156. package/build-module/components/url-popover/image-url-input-ui.js +3 -3
  157. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  158. package/build-module/components/use-block-commands/index.js +1 -1
  159. package/build-module/components/use-block-commands/index.js.map +1 -1
  160. package/build-module/components/use-moving-animation/index.js +1 -1
  161. package/build-module/components/use-moving-animation/index.js.map +1 -1
  162. package/build-module/store/actions.js +1 -1
  163. package/build-module/store/actions.js.map +1 -1
  164. package/build-module/store/selectors.js +5 -5
  165. package/build-module/store/selectors.js.map +1 -1
  166. package/build-module/utils/transform-styles/index.js +1 -1
  167. package/build-module/utils/transform-styles/index.js.map +1 -1
  168. package/build-module/utils/use-notify-copy.js +19 -11
  169. package/build-module/utils/use-notify-copy.js.map +1 -1
  170. package/build-style/content-rtl.css +0 -9
  171. package/build-style/content.css +0 -9
  172. package/build-style/style-rtl.css +18 -21
  173. package/build-style/style.css +18 -21
  174. package/package.json +34 -33
  175. package/src/components/background-image-control/index.js +0 -1
  176. package/src/components/block-actions/index.js +0 -3
  177. package/src/components/block-icon/content.scss +1 -1
  178. package/src/components/{block-card → block-icon}/stories/index.story.js +16 -26
  179. package/src/components/block-icon/style.scss +1 -1
  180. package/src/components/block-inspector/index.js +7 -10
  181. package/src/components/block-list/use-block-props/use-focus-handler.js +1 -1
  182. package/src/components/block-preview/style.scss +1 -1
  183. package/src/components/block-rename/modal.js +40 -12
  184. package/src/components/block-rename/rename-control.js +1 -53
  185. package/src/components/block-settings-menu/block-settings-dropdown.js +16 -2
  186. package/src/components/block-styles/preview.native.js +1 -1
  187. package/src/components/block-switcher/block-transformations-menu.js +9 -9
  188. package/src/components/block-switcher/block-variation-transformations.js +2 -2
  189. package/src/components/block-switcher/index.js +1 -1
  190. package/src/components/block-switcher/use-transformed-patterns.js +1 -1
  191. package/src/components/block-toolbar/index.native.js +2 -2
  192. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  193. package/src/components/colors-gradients/style.scss +1 -0
  194. package/src/components/colors-gradients/test/control.js +2 -2
  195. package/src/components/date-format-picker/index.js +1 -1
  196. package/src/components/duotone-control/style.scss +2 -2
  197. package/src/components/global-styles/filters-panel.js +4 -2
  198. package/src/components/global-styles/image-settings-panel.js +2 -2
  199. package/src/components/global-styles/test/typography-utils.js +1 -1
  200. package/src/components/global-styles/use-global-styles-output.js +3 -3
  201. package/src/components/iframe/get-compatibility-styles.js +1 -1
  202. package/src/components/iframe/index.js +1 -1
  203. package/src/components/image-size-control/index.js +6 -2
  204. package/src/components/inner-blocks/README.md +1 -1
  205. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  206. package/src/components/inserter/reusable-blocks-tab.native.js +1 -1
  207. package/src/components/line-height-control/index.native.js +1 -1
  208. package/src/components/link-control/README.md +2 -2
  209. package/src/components/link-control/index.js +1 -1
  210. package/src/components/link-control/test/index.js +3 -3
  211. package/src/components/link-control/use-search-handler.js +1 -1
  212. package/src/components/list-view/README.md +1 -1
  213. package/src/components/list-view/block-select-button.js +5 -5
  214. package/src/components/list-view/style.scss +3 -7
  215. package/src/components/media-placeholder/content.scss +0 -8
  216. package/src/components/media-placeholder/index.js +1 -0
  217. package/src/components/media-placeholder/style.scss +7 -0
  218. package/src/components/observe-typing/index.js +1 -1
  219. package/src/components/provider/index.js +0 -1
  220. package/src/components/provider/use-block-sync.js +2 -2
  221. package/src/components/resolution-tool/stories/index.story.js +52 -2
  222. package/src/components/rich-text/README.md +1 -1
  223. package/src/components/rich-text/event-listeners/input-rules.js +3 -3
  224. package/src/components/rich-text/native/use-format-types.js +1 -1
  225. package/src/components/rich-text/use-format-types.js +1 -1
  226. package/src/components/tabbed-sidebar/README.md +24 -13
  227. package/src/components/tabbed-sidebar/index.js +38 -0
  228. package/src/components/tabbed-sidebar/stories/index.story.js +104 -0
  229. package/src/components/typewriter/index.js +1 -1
  230. package/src/components/unit-control/README.md +1 -1
  231. package/src/components/unit-control/stories/index.story.js +124 -0
  232. package/src/components/url-popover/image-url-input-ui.js +3 -3
  233. package/src/components/use-block-commands/index.js +1 -1
  234. package/src/components/use-moving-animation/index.js +1 -1
  235. package/src/components/use-settings/README.md +1 -1
  236. package/src/components/warning/content.scss +1 -1
  237. package/src/components/writing-flow/test/index.js +1 -1
  238. package/src/hooks/color.scss +0 -7
  239. package/src/store/actions.js +1 -1
  240. package/src/store/selectors.js +5 -5
  241. package/src/store/test/private-selectors.js +1 -1
  242. package/src/store/test/selectors.js +3 -3
  243. package/src/style.scss +1 -0
  244. package/src/utils/test/sorting.js +1 -1
  245. package/src/utils/transform-styles/index.js +1 -1
  246. package/src/utils/use-notify-copy.js +51 -43
  247. package/tsconfig.json +1 -0
@@ -9,6 +9,7 @@ import clsx from 'clsx';
9
9
  import {
10
10
  __experimentalHStack as HStack,
11
11
  __experimentalTruncate as Truncate,
12
+ privateApis as componentsPrivateApis,
12
13
  } from '@wordpress/components';
13
14
  import { forwardRef } from '@wordpress/element';
14
15
  import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
@@ -25,6 +26,8 @@ import ListViewExpander from './expander';
25
26
  import { useBlockLock } from '../block-lock';
26
27
  import useListViewImages from './use-list-view-images';
27
28
  import { store as blockEditorStore } from '../../store';
29
+ import { unlock } from '../../lock-unlock';
30
+ const { Badge } = unlock( componentsPrivateApis );
28
31
 
29
32
  function ListViewBlockSelectButton(
30
33
  {
@@ -117,12 +120,9 @@ function ListViewBlockSelectButton(
117
120
  </span>
118
121
  { blockInformation?.anchor && (
119
122
  <span className="block-editor-list-view-block-select-button__anchor-wrapper">
120
- <Truncate
121
- className="block-editor-list-view-block-select-button__anchor"
122
- ellipsizeMode="auto"
123
- >
123
+ <Badge className="block-editor-list-view-block-select-button__anchor">
124
124
  { blockInformation.anchor }
125
- </Truncate>
125
+ </Badge>
126
126
  </span>
127
127
  ) }
128
128
  { isSticky && (
@@ -44,7 +44,7 @@
44
44
 
45
45
  svg {
46
46
  fill: currentColor;
47
- // Optimizate for high contrast modes.
47
+ // Optimize for high contrast modes.
48
48
  // See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
49
49
  @media (forced-colors: active) {
50
50
  fill: CanvasText;
@@ -408,15 +408,11 @@
408
408
  position: absolute;
409
409
  right: 0;
410
410
  transform: translateY(-50%);
411
- background: rgba($black, 0.1);
412
- border-radius: $radius-x-small;
413
- padding: 2px 6px;
414
- max-width: 100%;
415
- box-sizing: border-box;
416
411
  }
417
412
 
418
413
  &.is-selected .block-editor-list-view-block-select-button__anchor {
419
414
  background: rgba($black, 0.3);
415
+ color: $white;
420
416
  }
421
417
 
422
418
  .block-editor-list-view-block-select-button__lock,
@@ -484,7 +480,7 @@ $block-navigation-max-indent: 8;
484
480
  .block-editor-list-view-leaf[aria-level="#{ $i + 1 }"]
485
481
  .block-editor-list-view__expander {
486
482
  @if $i - 1 >= 0 {
487
- margin-left: ($grid-unit-30 * $i); // Effectivly centers the expander below the parent's icon.
483
+ margin-left: ($grid-unit-30 * $i); // Effectively centers the expander below the parent's icon.
488
484
  } @else {
489
485
  margin-left: 0;
490
486
  }
@@ -1,11 +1,3 @@
1
- .block-editor-media-placeholder__url-input-form {
2
- min-width: 260px;
3
-
4
- @include break-small() {
5
- width: 300px;
6
- }
7
- }
8
-
9
1
  .block-editor-media-placeholder__cancel-button.is-link {
10
2
  margin: 1em;
11
3
  display: block;
@@ -47,6 +47,7 @@ const InsertFromURLPopover = ( {
47
47
  <InputControl
48
48
  __next40pxDefaultSize
49
49
  label={ __( 'URL' ) }
50
+ type="url"
50
51
  hideLabelFromVision
51
52
  placeholder={ __( 'Paste or type URL' ) }
52
53
  onChange={ onChange }
@@ -0,0 +1,7 @@
1
+ .block-editor-media-placeholder__url-input-form {
2
+ min-width: 260px;
3
+
4
+ @include break-small() {
5
+ width: 300px;
6
+ }
7
+ }
@@ -111,7 +111,7 @@ export function useMouseMoveTypingReset() {
111
111
  * Sets and removes the `isTyping` flag based on user actions:
112
112
  *
113
113
  * - Sets the flag if the user types within the given element.
114
- * - Removes the flag when the user selects some text, focusses a non-text
114
+ * - Removes the flag when the user selects some text, focuses a non-text
115
115
  * field, presses ESC or TAB, or moves the mouse in the document.
116
116
  */
117
117
  export function useTypingObserver() {
@@ -4,7 +4,6 @@
4
4
  import { useDispatch } from '@wordpress/data';
5
5
  import { useEffect, useMemo } from '@wordpress/element';
6
6
  import { SlotFillProvider } from '@wordpress/components';
7
- //eslint-disable-next-line import/no-extraneous-dependencies -- Experimental package, not published.
8
7
  import {
9
8
  MediaUploadProvider,
10
9
  store as uploadStore,
@@ -33,7 +33,7 @@ const noop = () => {};
33
33
  * the template part in the block editor back to the entity and vice-versa.
34
34
  *
35
35
  * Here are some of its basic functions:
36
- * - Initalizes the block-editor store for the given clientID to the blocks
36
+ * - Initializes the block-editor store for the given clientID to the blocks
37
37
  * given via props.
38
38
  * - Adds incoming changes (like undo) to the block-editor store.
39
39
  * - Adds outgoing changes (like editing content) to the controlling entity,
@@ -49,7 +49,7 @@ const noop = () => {};
49
49
  * root controller rather than an inner block
50
50
  * controller.
51
51
  * @param {Object[]} props.value The control value for the blocks. This value
52
- * is used to initalize the block-editor store
52
+ * is used to initialize the block-editor store
53
53
  * and for resetting the blocks to incoming
54
54
  * changes like undo.
55
55
  * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.
@@ -16,9 +16,59 @@ export default {
16
16
  title: 'BlockEditor/ResolutionControl',
17
17
  component: ResolutionTool,
18
18
  tags: [ 'status-private' ],
19
+ parameters: {
20
+ docs: {
21
+ canvas: { sourceState: 'shown' },
22
+ description: {
23
+ component:
24
+ 'A control for selecting image resolution with preset size options.',
25
+ },
26
+ },
27
+ },
19
28
  argTypes: {
20
- panelId: { control: false },
21
- onChange: { action: 'changed' },
29
+ value: {
30
+ control: { type: null },
31
+ description: 'Currently selected resolution value.',
32
+ table: { type: { summary: 'string' } },
33
+ },
34
+ onChange: {
35
+ action: 'onChange',
36
+ control: { type: null },
37
+ description: 'Handles change in resolution selection.',
38
+ table: {
39
+ type: { summary: 'function' },
40
+ },
41
+ },
42
+ options: {
43
+ control: 'object',
44
+ description: 'Array of resolution options to display.',
45
+ table: {
46
+ type: { summary: 'array' },
47
+ },
48
+ },
49
+ defaultValue: {
50
+ control: 'radio',
51
+ options: [ 'thumbnail', 'medium', 'large', 'full' ],
52
+ description: 'Default resolution value.',
53
+ table: {
54
+ type: { summary: 'string' },
55
+ },
56
+ },
57
+ isShownByDefault: {
58
+ control: 'boolean',
59
+ description:
60
+ 'Whether the control is shown by default in the panel.',
61
+ table: {
62
+ type: { summary: 'boolean' },
63
+ },
64
+ },
65
+ panelId: {
66
+ control: { type: null },
67
+ description: 'ID of the parent tools panel.',
68
+ table: {
69
+ type: { summary: 'string' },
70
+ },
71
+ },
22
72
  },
23
73
  };
24
74
 
@@ -52,7 +52,7 @@ _Optional._ By default, all registered formats are allowed. This setting can be
52
52
  tagName="h2"
53
53
  identifier="content"
54
54
  value={ attributes.content }
55
- allowedFormats={ [ 'core/bold', 'core/italic' ] } // Allow the content to be made bold or italic, but do not allow othe formatting options
55
+ allowedFormats={ [ 'core/bold', 'core/italic' ] } // Allow the content to be made bold or italic, but do not allow other formatting options
56
56
  onChange={ ( content ) => setAttributes( { content } ) }
57
57
  placeholder={ __( 'Heading...' ) }
58
58
  />
@@ -112,12 +112,12 @@ export default ( props ) => ( element ) => {
112
112
 
113
113
  const value = getValue();
114
114
  const transformed = formatTypes.reduce(
115
- ( accumlator, { __unstableInputRule } ) => {
115
+ ( accumulator, { __unstableInputRule } ) => {
116
116
  if ( __unstableInputRule ) {
117
- accumlator = __unstableInputRule( accumlator );
117
+ accumulator = __unstableInputRule( accumulator );
118
118
  }
119
119
 
120
- return accumlator;
120
+ return accumulator;
121
121
  },
122
122
  preventEventDiscovery( value )
123
123
  );
@@ -35,7 +35,7 @@ const interactiveContentTags = new Set( [
35
35
  * @param {Object} $0 Options
36
36
  * @param {string} $0.clientId Block client ID.
37
37
  * @param {string} $0.identifier Block attribute.
38
- * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formattings or not.
38
+ * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formatting or not.
39
39
  * @param {Array} $0.allowedFormats Allowed formats
40
40
  */
41
41
  export function useFormatTypes( {
@@ -59,7 +59,7 @@ function getPrefixedSelectKeys( selected, prefix ) {
59
59
  * @param {Object} $0 Options
60
60
  * @param {string} $0.clientId Block client ID.
61
61
  * @param {string} $0.identifier Block attribute.
62
- * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formattings or not.
62
+ * @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formatting or not.
63
63
  * @param {Array} $0.allowedFormats Allowed formats
64
64
  */
65
65
  export function useFormatTypes( {
@@ -1,21 +1,19 @@
1
- # Tabbed Panel
1
+ # TabbedSidebar
2
2
 
3
- The `TabbedPanel` component is used to create the secondary panels in the editor.
3
+ The `TabbedSidebar` component is used to create secondary panels in the editor with tabbed navigation.
4
4
 
5
5
  ## Development guidelines
6
6
 
7
- This acts as a wrapper for the `Tabs` component, but adding conventions that can be shared between all secondary panels, for example:
7
+ This acts as a wrapper for the `Tabs` component, adding conventions that can be shared between all secondary panels, including:
8
8
 
9
9
  - A close button
10
10
  - Tabs that fill the panel
11
- - Custom scollbars
11
+ - Custom scrollbars
12
12
 
13
13
  ### Usage
14
14
 
15
- Renders a block alignment toolbar with alignments options.
16
-
17
15
  ```jsx
18
- import { TabbedSidebar } from '@wordpress/components';
16
+ import { TabbedSidebar } from '@wordpress/block-editor';
19
17
 
20
18
  const MyTabbedSidebar = () => (
21
19
  <TabbedSidebar
@@ -23,7 +21,7 @@ const MyTabbedSidebar = () => (
23
21
  {
24
22
  name: 'slug-1',
25
23
  title: _x( 'Title 1', 'context' ),
26
- panel: <PanelContents>,
24
+ panel: <PanelContents />,
27
25
  panelRef: useRef('an-optional-ref'),
28
26
  },
29
27
  {
@@ -35,6 +33,8 @@ const MyTabbedSidebar = () => (
35
33
  onClose={ onClickCloseButton }
36
34
  onSelect={ onSelectTab }
37
35
  defaultTabId="slug-1"
36
+ selectedTab="slug-1"
37
+ closeButtonLabel="Close sidebar"
38
38
  ref={ tabsRef }
39
39
  />
40
40
  );
@@ -47,30 +47,41 @@ const MyTabbedSidebar = () => (
47
47
  - **Type:** `String`
48
48
  - **Default:** `undefined`
49
49
 
50
- This is passed to the `Tabs` component so it can handle the tab to select by default when it component renders.
50
+ The ID of the tab to be selected by default when the component renders.
51
51
 
52
52
  ### `onClose`
53
53
 
54
54
  - **Type:** `Function`
55
55
 
56
- The function that is called when the close button is clicked.
56
+ Function called when the close button is clicked.
57
57
 
58
58
  ### `onSelect`
59
59
 
60
60
  - **Type:** `Function`
61
61
 
62
- This is passed to the `Tabs` component - it will be called when a tab has been selected. It is passed the selected tab's ID as an argument.
62
+ Function called when a tab is selected. Receives the selected tab's ID as an argument.
63
63
 
64
64
  ### `selectedTab`
65
65
 
66
66
  - **Type:** `String`
67
67
  - **Default:** `undefined`
68
68
 
69
- This is passed to the `Tabs` component - it will display this tab as selected.
69
+ The ID of the currently selected tab.
70
70
 
71
71
  ### `tabs`
72
72
 
73
73
  - **Type:** `Array`
74
74
  - **Default:** `undefined`
75
75
 
76
- An array of tabs which will be rendered as `TabList` and `TabPanel` components.
76
+ Array of tab objects. Each tab should have:
77
+
78
+ - `name` (string): Unique identifier for the tab
79
+ - `title` (string): Display title for the tab
80
+ - `panel` (React.Node): Content to display in the tab panel
81
+ - `panelRef` (React.Ref, optional): Reference to the tab panel element
82
+
83
+ #### `closeButtonLabel`
84
+
85
+ - **Type:** `String`
86
+
87
+ Accessibility label for the close button.
@@ -15,6 +15,44 @@ import { unlock } from '../../lock-unlock';
15
15
 
16
16
  const { Tabs } = unlock( componentsPrivateApis );
17
17
 
18
+ /**
19
+ * A component that creates a tabbed sidebar with a close button.
20
+ *
21
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/tabbed-sidebar/README.md
22
+ *
23
+ * @example
24
+ * ```jsx
25
+ * function MyTabbedSidebar() {
26
+ * return (
27
+ * <TabbedSidebar
28
+ * tabs={ [
29
+ * {
30
+ * name: 'tab1',
31
+ * title: 'Settings',
32
+ * panel: <PanelContents />,
33
+ * }
34
+ * ] }
35
+ * onClose={ () => {} }
36
+ * onSelect={ () => {} }
37
+ * defaultTabId="tab1"
38
+ * selectedTab="tab1"
39
+ * closeButtonLabel="Close sidebar"
40
+ * />
41
+ * );
42
+ * }
43
+ * ```
44
+ *
45
+ * @param {Object} props Component props.
46
+ * @param {string} [props.defaultTabId] The ID of the tab to be selected by default when the component renders.
47
+ * @param {Function} props.onClose Function called when the close button is clicked.
48
+ * @param {Function} props.onSelect Function called when a tab is selected. Receives the selected tab's ID as an argument.
49
+ * @param {string} props.selectedTab The ID of the currently selected tab.
50
+ * @param {Array} props.tabs Array of tab objects. Each tab should have: name (string), title (string),
51
+ * panel (React.Node), and optionally panelRef (React.Ref).
52
+ * @param {string} props.closeButtonLabel Accessibility label for the close button.
53
+ * @param {Object} ref Forward ref to the tabs list element.
54
+ * @return {Element} The tabbed sidebar component.
55
+ */
18
56
  function TabbedSidebar(
19
57
  { defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel },
20
58
  ref
@@ -0,0 +1,104 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useState } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import TabbedSidebar from '../';
10
+
11
+ const meta = {
12
+ title: 'BlockEditor/TabbedSidebar',
13
+ component: TabbedSidebar,
14
+ tags: [ 'status-private' ],
15
+ parameters: {
16
+ docs: {
17
+ canvas: { sourceState: 'shown' },
18
+ description: {
19
+ component:
20
+ 'A component that creates a tabbed sidebar with a close button.',
21
+ },
22
+ },
23
+ },
24
+ argTypes: {
25
+ defaultTabId: {
26
+ control: { type: null },
27
+ table: {
28
+ type: { summary: 'string' },
29
+ },
30
+ description:
31
+ 'The ID of the tab to be selected by default when the component renders.',
32
+ },
33
+ onClose: {
34
+ action: 'onClose',
35
+ control: { type: null },
36
+ table: {
37
+ type: { summary: 'function' },
38
+ },
39
+ description: 'Function called when the close button is clicked.',
40
+ },
41
+ onSelect: {
42
+ action: 'onSelect',
43
+ control: { type: null },
44
+ table: {
45
+ type: { summary: 'function' },
46
+ },
47
+ description:
48
+ "Function called when a tab is selected. Receives the selected tab's ID as an argument.",
49
+ },
50
+ selectedTab: {
51
+ control: { type: null },
52
+ table: {
53
+ type: { summary: 'string' },
54
+ },
55
+ description: 'The ID of the currently selected tab.',
56
+ },
57
+ tabs: {
58
+ control: { type: 'array' },
59
+ table: {
60
+ type: { summary: 'array' },
61
+ },
62
+ description:
63
+ 'Array of tab objects. Each tab should have: name (string), title (string), panel (React.Node), and optionally panelRef (React.Ref).',
64
+ },
65
+ closeButtonLabel: {
66
+ control: { type: 'text' },
67
+ table: {
68
+ type: { summary: 'string' },
69
+ },
70
+ description: 'Accessibility label for the close button.',
71
+ },
72
+ },
73
+ };
74
+
75
+ export default meta;
76
+
77
+ const DEMO_TABS = [
78
+ { name: 'tab1', title: 'Settings' },
79
+ { name: 'tab2', title: 'Styles' },
80
+ { name: 'tab3', title: 'Advanced' },
81
+ ];
82
+
83
+ export const Default = {
84
+ render: function Template( { onSelect, onClose, ...args } ) {
85
+ const [ selectedTab, setSelectedTab ] = useState();
86
+
87
+ return (
88
+ <TabbedSidebar
89
+ { ...args }
90
+ selectedTab={ selectedTab }
91
+ onSelect={ ( ...changeArgs ) => {
92
+ onSelect( ...changeArgs );
93
+ setSelectedTab( ...changeArgs );
94
+ } }
95
+ onClose={ onClose }
96
+ />
97
+ );
98
+ },
99
+ args: {
100
+ tabs: DEMO_TABS,
101
+ defaultTabId: 'tab1',
102
+ closeButtonLabel: 'Close Sidebar',
103
+ },
104
+ };
@@ -193,7 +193,7 @@ export function useTypewriter() {
193
193
  }
194
194
 
195
195
  /**
196
- * Checks if the current situation is elegible for scroll:
196
+ * Checks if the current situation is eligible for scroll:
197
197
  * - There should be one and only one block selected.
198
198
  * - The component must contain the selection.
199
199
  * - The active element must be contenteditable.
@@ -34,7 +34,7 @@ const Example = () => {
34
34
 
35
35
  ### Props
36
36
 
37
- #### disabledUnits
37
+ #### disableUnits
38
38
 
39
39
  If true, the unit `<select>` is hidden.
40
40
 
@@ -0,0 +1,124 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useState } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import UnitControl from '../';
10
+
11
+ const meta = {
12
+ title: 'BlockEditor/UnitControl',
13
+ component: UnitControl,
14
+ parameters: {
15
+ docs: {
16
+ canvas: { sourceState: 'shown' },
17
+ description: {
18
+ component:
19
+ 'UnitControl allows the user to set a numeric quantity as well as a unit.',
20
+ },
21
+ },
22
+ },
23
+ argTypes: {
24
+ onChange: {
25
+ action: 'onChange',
26
+ description: 'Callback function when the value changes.',
27
+ table: {
28
+ type: { summary: 'function' },
29
+ },
30
+ },
31
+ onUnitChange: {
32
+ action: 'onUnitChange',
33
+ description: 'Callback function when the unit changes.',
34
+ table: {
35
+ type: { summary: 'function' },
36
+ },
37
+ },
38
+ labelPosition: {
39
+ control: 'radio',
40
+ options: [ 'top', 'side', 'bottom', 'edge' ],
41
+ description: 'The position of the label.',
42
+ table: {
43
+ type: { summary: 'string' },
44
+ },
45
+ },
46
+ label: {
47
+ control: 'text',
48
+ description: 'The label for the control.',
49
+ table: {
50
+ type: { summary: 'string' },
51
+ },
52
+ },
53
+ value: {
54
+ control: { type: null },
55
+ description: 'The value of the control.',
56
+ table: {
57
+ type: { summary: 'string' },
58
+ },
59
+ },
60
+ size: {
61
+ control: 'radio',
62
+ options: [ 'default', 'small' ],
63
+ description: 'The size of the control.',
64
+ table: {
65
+ type: { summary: 'string' },
66
+ defaultValue: { summary: 'default' },
67
+ },
68
+ },
69
+ disabled: {
70
+ control: 'boolean',
71
+ description: 'Whether the control is disabled.',
72
+ table: {
73
+ type: { summary: 'boolean' },
74
+ defaultValue: { summary: false },
75
+ },
76
+ },
77
+ disableUnits: {
78
+ control: 'boolean',
79
+ description: 'If true, the unit select is hidden.',
80
+ table: {
81
+ type: { summary: 'boolean' },
82
+ defaultValue: { summary: false },
83
+ },
84
+ },
85
+ isPressEnterToChange: {
86
+ control: 'boolean',
87
+ description:
88
+ 'If true, the ENTER key press is required to trigger onChange. Change is also triggered on blur.',
89
+ table: {
90
+ type: { summary: 'boolean' },
91
+ defaultValue: { summary: false },
92
+ },
93
+ },
94
+ isUnitSelectTabbable: {
95
+ control: 'boolean',
96
+ description: 'Determines if the unit select is tabbable.',
97
+ table: {
98
+ type: { summary: 'boolean' },
99
+ defaultValue: { summary: true },
100
+ },
101
+ },
102
+ },
103
+ };
104
+
105
+ export default meta;
106
+
107
+ export const Default = {
108
+ render: function Template( { onChange, ...args } ) {
109
+ const [ value, setValue ] = useState();
110
+ return (
111
+ <UnitControl
112
+ { ...args }
113
+ value={ value }
114
+ onChange={ ( ...changeArgs ) => {
115
+ onChange( ...changeArgs );
116
+ setValue( ...changeArgs );
117
+ } }
118
+ />
119
+ );
120
+ },
121
+ args: {
122
+ label: 'Label',
123
+ },
124
+ };
@@ -265,14 +265,14 @@ const ImageURLInputUI = ( {
265
265
  <div className="block-editor-url-popover__expand-on-click">
266
266
  <Icon icon={ fullscreen } />
267
267
  <div className="text">
268
- <p>{ __( 'Expand on click' ) }</p>
268
+ <p>{ __( 'Enlarge on click' ) }</p>
269
269
  <p className="description">
270
270
  { __( 'Scales the image with a lightbox effect' ) }
271
271
  </p>
272
272
  </div>
273
273
  <Button
274
274
  icon={ linkOff }
275
- label={ __( 'Disable expand on click' ) }
275
+ label={ __( 'Disable enlarge on click' ) }
276
276
  onClick={ () => {
277
277
  onSetLightbox?.( false );
278
278
  } }
@@ -372,7 +372,7 @@ const ImageURLInputUI = ( {
372
372
  stopEditLink();
373
373
  } }
374
374
  >
375
- { __( 'Expand on click' ) }
375
+ { __( 'Enlarge on click' ) }
376
376
  </MenuItem>
377
377
  ) }
378
378
  </NavigableMenu>
@@ -89,7 +89,7 @@ const getTransformCommands = () =>
89
89
  }
90
90
  }
91
91
 
92
- // Simple block tranformation based on the `Block Transforms` API.
92
+ // Simple block transformation based on the `Block Transforms` API.
93
93
  function onBlockTransform( name ) {
94
94
  const newBlocks = switchToBlockType( blocks, name );
95
95
  replaceBlocks( clientIds, newBlocks );
@@ -96,7 +96,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
96
96
  // motion, if the user is typing (insertion by Enter), or if the block
97
97
  // count exceeds the threshold (insertion caused all the blocks that
98
98
  // follow to animate).
99
- // To do: consider enableing the _moving_ animation even for large
99
+ // To do: consider enabling the _moving_ animation even for large
100
100
  // posts, while only disabling the _insertion_ animation?
101
101
  const disableAnimation =
102
102
  window.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||