@wordpress/components 29.1.0 → 29.2.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 (220) hide show
  1. package/CHANGELOG.md +19 -6
  2. package/CONTRIBUTING.md +4 -4
  3. package/README.md +1 -1
  4. package/build/badge/index.js +26 -22
  5. package/build/badge/index.js.map +1 -1
  6. package/build/circular-option-picker/circular-option-picker-option.js +9 -7
  7. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  8. package/build/circular-option-picker/circular-option-picker.js +0 -1
  9. package/build/circular-option-picker/circular-option-picker.js.map +1 -1
  10. package/build/color-palette/index.js +1 -6
  11. package/build/color-palette/index.js.map +1 -1
  12. package/build/font-size-picker/index.native.js +1 -1
  13. package/build/font-size-picker/index.native.js.map +1 -1
  14. package/build/higher-order/with-focus-return/index.js +1 -1
  15. package/build/higher-order/with-focus-return/index.js.map +1 -1
  16. package/build/input-control/styles/input-control-styles.js +22 -22
  17. package/build/input-control/styles/input-control-styles.js.map +1 -1
  18. package/build/menu/checkbox-item.js +6 -6
  19. package/build/menu/checkbox-item.js.map +1 -1
  20. package/build/menu/context.js +2 -2
  21. package/build/menu/context.js.map +1 -1
  22. package/build/menu/group-label.js +4 -4
  23. package/build/menu/group-label.js.map +1 -1
  24. package/build/menu/group.js +4 -4
  25. package/build/menu/group.js.map +1 -1
  26. package/build/menu/index.js +87 -14
  27. package/build/menu/index.js.map +1 -1
  28. package/build/menu/item-help-text.js +4 -4
  29. package/build/menu/item-help-text.js.map +1 -1
  30. package/build/menu/item-label.js +4 -4
  31. package/build/menu/item-label.js.map +1 -1
  32. package/build/menu/item.js +6 -6
  33. package/build/menu/item.js.map +1 -1
  34. package/build/menu/popover.js +5 -5
  35. package/build/menu/popover.js.map +1 -1
  36. package/build/menu/radio-item.js +6 -6
  37. package/build/menu/radio-item.js.map +1 -1
  38. package/build/menu/separator.js +4 -4
  39. package/build/menu/separator.js.map +1 -1
  40. package/build/menu/styles.js +41 -41
  41. package/build/menu/styles.js.map +1 -1
  42. package/build/menu/submenu-trigger-item.js +5 -5
  43. package/build/menu/submenu-trigger-item.js.map +1 -1
  44. package/build/menu/trigger-button.js +3 -3
  45. package/build/menu/trigger-button.js.map +1 -1
  46. package/build/menu/types.js.map +1 -1
  47. package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
  48. package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
  49. package/build/mobile/utils/get-px-from-css-unit.native.js +3 -3
  50. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  51. package/build/notice/types.js.map +1 -1
  52. package/build/search-control/index.js +1 -1
  53. package/build/search-control/index.js.map +1 -1
  54. package/build/text/hook.js +8 -6
  55. package/build/text/hook.js.map +1 -1
  56. package/build/text/utils.js +1 -1
  57. package/build/text/utils.js.map +1 -1
  58. package/build-module/badge/index.js +28 -22
  59. package/build-module/badge/index.js.map +1 -1
  60. package/build-module/circular-option-picker/circular-option-picker-option.js +9 -7
  61. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  62. package/build-module/circular-option-picker/circular-option-picker.js +0 -1
  63. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  64. package/build-module/color-palette/index.js +1 -6
  65. package/build-module/color-palette/index.js.map +1 -1
  66. package/build-module/font-size-picker/index.native.js +1 -1
  67. package/build-module/font-size-picker/index.native.js.map +1 -1
  68. package/build-module/higher-order/with-focus-return/index.js +1 -1
  69. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  70. package/build-module/input-control/styles/input-control-styles.js +22 -22
  71. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  72. package/build-module/menu/checkbox-item.js +6 -6
  73. package/build-module/menu/checkbox-item.js.map +1 -1
  74. package/build-module/menu/context.js +1 -1
  75. package/build-module/menu/context.js.map +1 -1
  76. package/build-module/menu/group-label.js +4 -4
  77. package/build-module/menu/group-label.js.map +1 -1
  78. package/build-module/menu/group.js +4 -4
  79. package/build-module/menu/group.js.map +1 -1
  80. package/build-module/menu/index.js +99 -26
  81. package/build-module/menu/index.js.map +1 -1
  82. package/build-module/menu/item-help-text.js +4 -4
  83. package/build-module/menu/item-help-text.js.map +1 -1
  84. package/build-module/menu/item-label.js +4 -4
  85. package/build-module/menu/item-label.js.map +1 -1
  86. package/build-module/menu/item.js +6 -6
  87. package/build-module/menu/item.js.map +1 -1
  88. package/build-module/menu/popover.js +5 -5
  89. package/build-module/menu/popover.js.map +1 -1
  90. package/build-module/menu/radio-item.js +6 -6
  91. package/build-module/menu/radio-item.js.map +1 -1
  92. package/build-module/menu/separator.js +4 -4
  93. package/build-module/menu/separator.js.map +1 -1
  94. package/build-module/menu/styles.js +40 -40
  95. package/build-module/menu/styles.js.map +1 -1
  96. package/build-module/menu/submenu-trigger-item.js +6 -6
  97. package/build-module/menu/submenu-trigger-item.js.map +1 -1
  98. package/build-module/menu/trigger-button.js +3 -3
  99. package/build-module/menu/trigger-button.js.map +1 -1
  100. package/build-module/menu/types.js.map +1 -1
  101. package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
  102. package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
  103. package/build-module/mobile/utils/get-px-from-css-unit.native.js +3 -3
  104. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  105. package/build-module/notice/types.js.map +1 -1
  106. package/build-module/search-control/index.js +1 -1
  107. package/build-module/search-control/index.js.map +1 -1
  108. package/build-module/text/hook.js +8 -6
  109. package/build-module/text/hook.js.map +1 -1
  110. package/build-module/text/utils.js +1 -1
  111. package/build-module/text/utils.js.map +1 -1
  112. package/build-style/style-rtl.css +89 -170
  113. package/build-style/style.css +89 -170
  114. package/build-types/badge/index.d.ts.map +1 -1
  115. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  116. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  117. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  118. package/build-types/color-palette/index.d.ts.map +1 -1
  119. package/build-types/higher-order/with-focus-return/index.d.ts +1 -1
  120. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  121. package/build-types/menu/checkbox-item.d.ts +2 -2
  122. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  123. package/build-types/menu/context.d.ts +2 -2
  124. package/build-types/menu/context.d.ts.map +1 -1
  125. package/build-types/menu/group-label.d.ts +2 -2
  126. package/build-types/menu/group-label.d.ts.map +1 -1
  127. package/build-types/menu/group.d.ts +2 -2
  128. package/build-types/menu/group.d.ts.map +1 -1
  129. package/build-types/menu/index.d.ts +84 -12
  130. package/build-types/menu/index.d.ts.map +1 -1
  131. package/build-types/menu/item-help-text.d.ts +1 -1
  132. package/build-types/menu/item-help-text.d.ts.map +1 -1
  133. package/build-types/menu/item-label.d.ts +1 -1
  134. package/build-types/menu/item-label.d.ts.map +1 -1
  135. package/build-types/menu/item.d.ts +2 -2
  136. package/build-types/menu/item.d.ts.map +1 -1
  137. package/build-types/menu/popover.d.ts +2 -2
  138. package/build-types/menu/popover.d.ts.map +1 -1
  139. package/build-types/menu/radio-item.d.ts +2 -2
  140. package/build-types/menu/radio-item.d.ts.map +1 -1
  141. package/build-types/menu/separator.d.ts +2 -2
  142. package/build-types/menu/separator.d.ts.map +1 -1
  143. package/build-types/menu/styles.d.ts +15 -15
  144. package/build-types/menu/styles.d.ts.map +1 -1
  145. package/build-types/menu/submenu-trigger-item.d.ts +2 -2
  146. package/build-types/menu/submenu-trigger-item.d.ts.map +1 -1
  147. package/build-types/menu/trigger-button.d.ts +2 -2
  148. package/build-types/menu/trigger-button.d.ts.map +1 -1
  149. package/build-types/menu/types.d.ts +10 -10
  150. package/build-types/menu/types.d.ts.map +1 -1
  151. package/build-types/menu-group/stories/index.story.d.ts +1 -1
  152. package/build-types/notice/types.d.ts +1 -1
  153. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  154. package/build-types/tabs/stories/index.story.d.ts +0 -3
  155. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  156. package/build-types/text/hook.d.ts.map +1 -1
  157. package/build-types/text/utils.d.ts +1 -1
  158. package/package.json +19 -19
  159. package/src/animate/style.scss +16 -12
  160. package/src/badge/index.tsx +28 -27
  161. package/src/border-control/test/index.js +12 -4
  162. package/src/button/style.scss +15 -12
  163. package/src/checkbox-control/style.scss +4 -2
  164. package/src/circular-option-picker/README.md +1 -2
  165. package/src/circular-option-picker/circular-option-picker-option.tsx +17 -10
  166. package/src/circular-option-picker/circular-option-picker.tsx +0 -1
  167. package/src/circular-option-picker/stories/index.story.tsx +0 -1
  168. package/src/circular-option-picker/style.scss +10 -5
  169. package/src/color-palette/index.tsx +0 -7
  170. package/src/color-palette/test/index.tsx +2 -8
  171. package/src/combobox-control/test/index.tsx +1 -1
  172. package/src/drop-zone/style.scss +6 -9
  173. package/src/font-size-picker/index.native.js +1 -1
  174. package/src/form-toggle/style.scss +17 -10
  175. package/src/form-token-field/style.scss +9 -4
  176. package/src/higher-order/navigate-regions/style.scss +2 -2
  177. package/src/higher-order/with-focus-return/index.tsx +1 -1
  178. package/src/input-control/styles/input-control-styles.tsx +6 -0
  179. package/src/menu/README.md +421 -174
  180. package/src/menu/checkbox-item.tsx +12 -12
  181. package/src/menu/context.tsx +2 -4
  182. package/src/menu/docs-manifest.json +62 -0
  183. package/src/menu/group-label.tsx +7 -7
  184. package/src/menu/group.tsx +7 -11
  185. package/src/menu/index.tsx +101 -31
  186. package/src/menu/item-help-text.tsx +5 -7
  187. package/src/menu/item-label.tsx +5 -7
  188. package/src/menu/item.tsx +12 -12
  189. package/src/menu/popover.tsx +9 -9
  190. package/src/menu/radio-item.tsx +12 -12
  191. package/src/menu/separator.tsx +7 -7
  192. package/src/menu/stories/best-practices.mdx +38 -0
  193. package/src/menu/stories/index.story.tsx +8 -8
  194. package/src/menu/styles.ts +24 -24
  195. package/src/menu/submenu-trigger-item.tsx +9 -9
  196. package/src/menu/trigger-button.tsx +6 -6
  197. package/src/menu/types.ts +10 -10
  198. package/src/menu-group/stories/index.story.tsx +2 -2
  199. package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
  200. package/src/mobile/utils/get-px-from-css-unit.native.js +3 -3
  201. package/src/modal/style.scss +4 -2
  202. package/src/modal/test/index.tsx +5 -4
  203. package/src/notice/README.md +3 -3
  204. package/src/notice/types.ts +1 -1
  205. package/src/palette-edit/test/index.tsx +1 -1
  206. package/src/panel/style.scss +14 -6
  207. package/src/placeholder/style.scss +5 -3
  208. package/src/progress-bar/stories/index.story.tsx +1 -1
  209. package/src/resizable-box/style.scss +14 -9
  210. package/src/search-control/index.tsx +1 -1
  211. package/src/tab-panel/style.scss +6 -4
  212. package/src/tabs/stories/index.story.tsx +0 -131
  213. package/src/text/README.md +1 -1
  214. package/src/text/hook.ts +3 -2
  215. package/src/text/stories/index.story.tsx +2 -2
  216. package/src/text/test/index.tsx +1 -1
  217. package/src/text/utils.ts +1 -1
  218. package/src/text-highlight/test/index.tsx +3 -3
  219. package/src/toolbar/toolbar/style.scss +4 -3
  220. package/tsconfig.tsbuildinfo +1 -1
@@ -15,7 +15,7 @@ import type { FindAllArgs } from 'highlight-words-core';
15
15
  * @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
16
16
  * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
17
17
  * @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
18
- * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
18
+ * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `sanitize` function to pass to `highlight-words-core`.
19
19
  * @property {string[]} [searchWords=[]] Words to search for and highlight.
20
20
  * @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
21
21
  * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "29.1.0",
3
+ "version": "29.2.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -44,23 +44,23 @@
44
44
  "@types/gradient-parser": "0.1.3",
45
45
  "@types/highlight-words-core": "1.2.1",
46
46
  "@use-gesture/react": "^10.3.1",
47
- "@wordpress/a11y": "^4.15.0",
48
- "@wordpress/compose": "^7.15.0",
49
- "@wordpress/date": "^5.15.0",
50
- "@wordpress/deprecated": "^4.15.0",
51
- "@wordpress/dom": "^4.15.0",
52
- "@wordpress/element": "^6.15.0",
53
- "@wordpress/escape-html": "^3.15.0",
54
- "@wordpress/hooks": "^4.15.0",
55
- "@wordpress/html-entities": "^4.15.0",
56
- "@wordpress/i18n": "^5.15.0",
57
- "@wordpress/icons": "^10.15.0",
58
- "@wordpress/is-shallow-equal": "^5.15.0",
59
- "@wordpress/keycodes": "^4.15.0",
60
- "@wordpress/primitives": "^4.15.0",
61
- "@wordpress/private-apis": "^1.15.0",
62
- "@wordpress/rich-text": "^7.15.0",
63
- "@wordpress/warning": "^3.15.0",
47
+ "@wordpress/a11y": "^4.16.0",
48
+ "@wordpress/compose": "^7.16.0",
49
+ "@wordpress/date": "^5.16.0",
50
+ "@wordpress/deprecated": "^4.16.0",
51
+ "@wordpress/dom": "^4.16.0",
52
+ "@wordpress/element": "^6.16.0",
53
+ "@wordpress/escape-html": "^3.16.0",
54
+ "@wordpress/hooks": "^4.16.0",
55
+ "@wordpress/html-entities": "^4.16.0",
56
+ "@wordpress/i18n": "^5.16.0",
57
+ "@wordpress/icons": "^10.16.0",
58
+ "@wordpress/is-shallow-equal": "^5.16.0",
59
+ "@wordpress/keycodes": "^4.16.0",
60
+ "@wordpress/primitives": "^4.16.0",
61
+ "@wordpress/private-apis": "^1.16.0",
62
+ "@wordpress/rich-text": "^7.16.0",
63
+ "@wordpress/warning": "^3.16.0",
64
64
  "change-case": "^4.1.2",
65
65
  "clsx": "^2.1.1",
66
66
  "colord": "^2.7.0",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "75a65eb8ffc168a92042544052f46d080a71ea45"
88
+ "gitHead": "f48b9f56629e400891abb5ae491504de475237ff"
89
89
  }
@@ -1,7 +1,8 @@
1
1
  .components-animate__appear {
2
- animation: components-animate__appear-animation 0.1s cubic-bezier(0, 0, 0.2, 1) 0s;
3
- animation-fill-mode: forwards;
4
- @include reduce-motion("animation");
2
+ @media not (prefers-reduced-motion) {
3
+ animation: components-animate__appear-animation 0.1s cubic-bezier(0, 0, 0.2, 1) 0s;
4
+ animation-fill-mode: forwards;
5
+ }
5
6
 
6
7
  &.is-from-top,
7
8
  &.is-from-top.is-from-left {
@@ -29,16 +30,17 @@
29
30
  }
30
31
 
31
32
  .components-animate__slide-in {
32
- animation: components-animate__slide-in-animation 0.1s cubic-bezier(0, 0, 0.2, 1);
33
- animation-fill-mode: forwards;
34
- @include reduce-motion("animation");
33
+ @media not (prefers-reduced-motion) {
34
+ animation: components-animate__slide-in-animation 0.1s cubic-bezier(0, 0, 0.2, 1);
35
+ animation-fill-mode: forwards;
35
36
 
36
- &.is-from-left {
37
- transform: translateX(+100%);
38
- }
37
+ &.is-from-left {
38
+ transform: translateX(+100%);
39
+ }
39
40
 
40
- &.is-from-right {
41
- transform: translateX(-100%);
41
+ &.is-from-right {
42
+ transform: translateX(-100%);
43
+ }
42
44
  }
43
45
  }
44
46
 
@@ -49,7 +51,9 @@
49
51
  }
50
52
 
51
53
  .components-animate__loading {
52
- animation: components-animate__loading 1.6s ease-in-out infinite;
54
+ @media not (prefers-reduced-motion) {
55
+ animation: components-animate__loading 1.6s ease-in-out infinite;
56
+ }
53
57
  }
54
58
 
55
59
  @keyframes components-animate__loading {
@@ -15,45 +15,46 @@ import type { BadgeProps } from './types';
15
15
  import type { WordPressComponentProps } from '../context';
16
16
  import Icon from '../icon';
17
17
 
18
+ /**
19
+ * Returns an icon based on the badge context.
20
+ *
21
+ * @return The corresponding icon for the provided context.
22
+ */
23
+ function contextBasedIcon( intent: BadgeProps[ 'intent' ] = 'default' ) {
24
+ switch ( intent ) {
25
+ case 'info':
26
+ return info;
27
+ case 'success':
28
+ return published;
29
+ case 'warning':
30
+ return caution;
31
+ case 'error':
32
+ return error;
33
+ default:
34
+ return null;
35
+ }
36
+ }
37
+
18
38
  function Badge( {
19
39
  className,
20
40
  intent = 'default',
21
41
  children,
22
42
  ...props
23
43
  }: WordPressComponentProps< BadgeProps, 'span', false > ) {
24
- /**
25
- * Returns an icon based on the badge context.
26
- *
27
- * @return The corresponding icon for the provided context.
28
- */
29
- function contextBasedIcon() {
30
- switch ( intent ) {
31
- case 'info':
32
- return info;
33
- case 'success':
34
- return published;
35
- case 'warning':
36
- return caution;
37
- case 'error':
38
- return error;
39
- default:
40
- return null;
41
- }
42
- }
44
+ const icon = contextBasedIcon( intent );
45
+ const hasIcon = !! icon;
43
46
 
44
47
  return (
45
48
  <span
46
- className={ clsx(
47
- 'components-badge',
48
- `is-${ intent }`,
49
- intent !== 'default' && 'has-icon',
50
- className
51
- ) }
49
+ className={ clsx( 'components-badge', className, {
50
+ [ `is-${ intent }` ]: intent,
51
+ 'has-icon': hasIcon,
52
+ } ) }
52
53
  { ...props }
53
54
  >
54
- { intent !== 'default' && (
55
+ { hasIcon && (
55
56
  <Icon
56
- icon={ contextBasedIcon() }
57
+ icon={ icon }
57
58
  size={ 16 }
58
59
  fill="currentColor"
59
60
  className="components-badge__icon"
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { fireEvent, render, screen, waitFor } from '@testing-library/react';
4
+ import {
5
+ fireEvent,
6
+ render,
7
+ screen,
8
+ waitFor,
9
+ within,
10
+ } from '@testing-library/react';
5
11
  import userEvent from '@testing-library/user-event';
6
12
 
7
13
  /**
@@ -56,7 +62,7 @@ const getButton = ( name ) => {
56
62
  };
57
63
 
58
64
  const getColorOption = ( color ) => {
59
- return screen.getByRole( 'option', { name: `Color: ${ color }` } );
65
+ return screen.getByRole( 'option', { name: `${ color }` } );
60
66
  };
61
67
 
62
68
  const queryButton = ( name ) => {
@@ -131,9 +137,11 @@ describe( 'BorderControl', () => {
131
137
  await openPopover( user );
132
138
 
133
139
  const customColorPicker = getButton( /Custom color picker/ );
134
- const colorSwatchButtons = screen.getAllByRole( 'option', {
135
- name: /^Color:/,
140
+ const circularOptionPicker = screen.getByRole( 'listbox', {
141
+ name: 'Custom color picker.',
136
142
  } );
143
+ const colorSwatchButtons =
144
+ within( circularOptionPicker ).getAllByRole( 'option' );
137
145
  const styleLabel = screen.getByText( 'Style' );
138
146
  const solidButton = getButton( 'Solid' );
139
147
  const dashedButton = getButton( 'Dashed' );
@@ -15,8 +15,11 @@
15
15
  cursor: pointer;
16
16
  -webkit-appearance: none;
17
17
  background: none;
18
- transition: box-shadow 0.1s linear;
19
- @include reduce-motion("transition");
18
+
19
+ @media not (prefers-reduced-motion) {
20
+ transition: box-shadow 0.1s linear;
21
+ }
22
+
20
23
  height: $button-size;
21
24
  align-items: center;
22
25
  box-sizing: border-box;
@@ -245,10 +248,13 @@
245
248
  text-align: left;
246
249
  color: $components-color-accent;
247
250
  text-decoration: underline;
248
- transition-property: border, background, color;
249
- transition-duration: 0.05s;
250
- transition-timing-function: ease-in-out;
251
- @include reduce-motion("transition");
251
+
252
+ @media not (prefers-reduced-motion) {
253
+ transition-property: border, background, color;
254
+ transition-duration: 0.05s;
255
+ transition-timing-function: ease-in-out;
256
+ }
257
+
252
258
  height: auto;
253
259
 
254
260
  &:focus {
@@ -275,11 +281,8 @@
275
281
  &.is-secondary.is-busy,
276
282
  &.is-secondary.is-busy:disabled,
277
283
  &.is-secondary.is-busy[aria-disabled="true"] {
278
- animation: components-button__busy-animation 2500ms infinite linear;
279
- // This should be refactored to use the reduce-motion("animation") mixin
280
- // as soon as https://github.com/WordPress/gutenberg/issues/55566 is closed.
281
- @media (prefers-reduced-motion: reduce) {
282
- animation-duration: 0s;
284
+ @media not (prefers-reduced-motion) {
285
+ animation: components-button__busy-animation 2500ms infinite linear;
283
286
  }
284
287
  background-size: 100px 100%;
285
288
  /* stylelint-disable -- Disable reason: This function call looks nicer when each argument is on its own line. */
@@ -376,7 +379,7 @@
376
379
  fill: currentColor;
377
380
  outline: none;
378
381
 
379
- // Optimizate for high contrast modes.
382
+ // Optimize for high contrast modes.
380
383
  // See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
381
384
  @media (forced-colors: active) {
382
385
  fill: CanvasText;
@@ -32,8 +32,10 @@
32
32
  height: var(--checkbox-input-size);
33
33
 
34
34
  appearance: none;
35
- transition: 0.1s border-color ease-in-out;
36
- @include reduce-motion("transition");
35
+
36
+ @media not (prefers-reduced-motion) {
37
+ transition: 0.1s border-color ease-in-out;
38
+ }
37
39
 
38
40
  &:focus {
39
41
  @include button-style-outset__focus(var(--wp-admin-theme-color));
@@ -29,7 +29,6 @@ const Example = () => {
29
29
  style={ { backgroundColor: color, color } }
30
30
  isSelected={ index === currentColor }
31
31
  onClick={ () => setCurrentColor( index ) }
32
- aria-label={ name }
33
32
  />
34
33
  );
35
34
  } ) }
@@ -150,6 +149,6 @@ Inherits all of the [`Dropdown` props](/packages/components/src/dropdown/README.
150
149
 
151
150
  Props for the underlying `Button` component.
152
151
 
153
- Inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`, `target`, and `children`.
152
+ Inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`, `target`, and `children`.
154
153
 
155
154
  - Required: No
@@ -17,7 +17,6 @@ import { Icon, check } from '@wordpress/icons';
17
17
  import { CircularOptionPickerContext } from './circular-option-picker-context';
18
18
  import Button from '../button';
19
19
  import { Composite } from '../composite';
20
- import Tooltip from '../tooltip';
21
20
  import type { OptionProps } from './types';
22
21
 
23
22
  function UnforwardedOptionAsButton(
@@ -25,15 +24,17 @@ function UnforwardedOptionAsButton(
25
24
  id?: string;
26
25
  className?: string;
27
26
  isPressed?: boolean;
27
+ label?: string;
28
28
  },
29
29
  forwardedRef: ForwardedRef< any >
30
30
  ) {
31
- const { isPressed, ...additionalProps } = props;
31
+ const { isPressed, label, ...additionalProps } = props;
32
32
  return (
33
33
  <Button
34
34
  { ...additionalProps }
35
35
  aria-pressed={ isPressed }
36
36
  ref={ forwardedRef }
37
+ label={ label }
37
38
  />
38
39
  );
39
40
  }
@@ -45,10 +46,11 @@ function UnforwardedOptionAsOption(
45
46
  id: string;
46
47
  className?: string;
47
48
  isSelected?: boolean;
49
+ label?: string;
48
50
  },
49
51
  forwardedRef: ForwardedRef< any >
50
52
  ) {
51
- const { id, isSelected, ...additionalProps } = props;
53
+ const { id, isSelected, label, ...additionalProps } = props;
52
54
 
53
55
  const { setActiveId, activeId } = useContext( CircularOptionPickerContext );
54
56
 
@@ -69,6 +71,7 @@ function UnforwardedOptionAsOption(
69
71
  role="option"
70
72
  aria-selected={ !! isSelected }
71
73
  ref={ forwardedRef }
74
+ label={ label }
72
75
  />
73
76
  }
74
77
  id={ id }
@@ -100,9 +103,17 @@ export function Option( {
100
103
 
101
104
  const isListbox = setActiveId !== undefined;
102
105
  const optionControl = isListbox ? (
103
- <OptionAsOption { ...commonProps } isSelected={ isSelected } />
106
+ <OptionAsOption
107
+ { ...commonProps }
108
+ label={ tooltipText }
109
+ isSelected={ isSelected }
110
+ />
104
111
  ) : (
105
- <OptionAsButton { ...commonProps } isPressed={ isSelected } />
112
+ <OptionAsButton
113
+ { ...commonProps }
114
+ label={ tooltipText }
115
+ isPressed={ isSelected }
116
+ />
106
117
  );
107
118
 
108
119
  return (
@@ -112,11 +123,7 @@ export function Option( {
112
123
  'components-circular-option-picker__option-wrapper'
113
124
  ) }
114
125
  >
115
- { tooltipText ? (
116
- <Tooltip text={ tooltipText }>{ optionControl }</Tooltip>
117
- ) : (
118
- optionControl
119
- ) }
126
+ { optionControl }
120
127
  { isSelected && <Icon icon={ check } { ...selectedIconProps } /> }
121
128
  </div>
122
129
  );
@@ -51,7 +51,6 @@ import {
51
51
  * style={ { backgroundColor: color, color } }
52
52
  * isSelected={ index === currentColor }
53
53
  * onClick={ () => setCurrentColor( index ) }
54
- * aria-label={ name }
55
54
  * />
56
55
  * );
57
56
  * } ) }
@@ -87,7 +87,6 @@ const DefaultOptions = () => {
87
87
  onClick={ () => {
88
88
  setCurrentColor?.( color );
89
89
  } }
90
- aria-label={ name }
91
90
  />
92
91
  );
93
92
  } ) }
@@ -35,9 +35,11 @@ $color-palette-circle-spacing: 12px;
35
35
  width: $color-palette-circle-size;
36
36
  vertical-align: top;
37
37
  transform: scale(1);
38
- transition: 100ms transform ease;
39
- will-change: transform;
40
- @include reduce-motion("transition");
38
+
39
+ @media not (prefers-reduced-motion) {
40
+ transition: 100ms transform ease;
41
+ will-change: transform;
42
+ }
41
43
 
42
44
  &:hover {
43
45
  transform: scale(1.2);
@@ -73,8 +75,11 @@ $color-palette-circle-spacing: 12px;
73
75
  border-radius: $radius-round;
74
76
  background: transparent;
75
77
  box-shadow: inset 0 0 0 ($color-palette-circle-size * 0.5);
76
- transition: 100ms box-shadow ease;
77
- @include reduce-motion("transition");
78
+
79
+ @media not (prefers-reduced-motion) {
80
+ transition: 100ms box-shadow ease;
81
+ }
82
+
78
83
  cursor: pointer;
79
84
 
80
85
  &:hover {
@@ -79,13 +79,6 @@ function SinglePalette( {
79
79
  onClick={
80
80
  isSelected ? clearColor : () => onChange( color, index )
81
81
  }
82
- aria-label={
83
- name
84
- ? // translators: %s: The name of the color e.g: "vivid red".
85
- sprintf( __( 'Color: %s' ), name )
86
- : // translators: %s: color hex code e.g: "#f00".
87
- sprintf( __( 'Color code: %s' ), color )
88
- }
89
82
  />
90
83
  );
91
84
  } );
@@ -50,9 +50,7 @@ describe( 'ColorPalette', () => {
50
50
  />
51
51
  );
52
52
 
53
- expect(
54
- screen.getAllByRole( 'option', { name: /^Color:/ } )
55
- ).toHaveLength( 3 );
53
+ expect( screen.getAllByRole( 'option' ) ).toHaveLength( 3 );
56
54
  } );
57
55
 
58
56
  it( 'should call onClick on an active button with undefined', async () => {
@@ -67,9 +65,7 @@ describe( 'ColorPalette', () => {
67
65
  />
68
66
  );
69
67
 
70
- await user.click(
71
- screen.getByRole( 'option', { name: /^Color:/, selected: true } )
72
- );
68
+ await user.click( screen.getByRole( 'option', { selected: true } ) );
73
69
 
74
70
  expect( onChange ).toHaveBeenCalledTimes( 1 );
75
71
  expect( onChange ).toHaveBeenCalledWith( undefined );
@@ -91,7 +87,6 @@ describe( 'ColorPalette', () => {
91
87
  // (i.e. a button representing a color that is not the current color)
92
88
  await user.click(
93
89
  screen.getAllByRole( 'option', {
94
- name: /^Color:/,
95
90
  selected: false,
96
91
  } )[ 0 ]
97
92
  );
@@ -230,7 +225,6 @@ describe( 'ColorPalette', () => {
230
225
  // Click the first unpressed button
231
226
  await user.click(
232
227
  screen.getAllByRole( 'option', {
233
- name: /^Color:/,
234
228
  selected: false,
235
229
  } )[ 0 ]
236
230
  );
@@ -348,7 +348,7 @@ describe.each( [
348
348
  expect( option ).toHaveTextContent( matches[ optionIndex ].label );
349
349
  } );
350
350
 
351
- // Confirm that the corrent option is selected
351
+ // Confirm that the current option is selected
352
352
  await user.keyboard( '{Enter}' );
353
353
 
354
354
  expect( onChangeSpy ).toHaveBeenCalledTimes( 1 );
@@ -46,9 +46,8 @@
46
46
  .components-drop-zone__content {
47
47
  opacity: 1;
48
48
 
49
- transition: opacity 0.2s ease-in-out;
50
- @media (prefers-reduced-motion) {
51
- transition: none;
49
+ @media not (prefers-reduced-motion) {
50
+ transition: opacity 0.2s ease-in-out;
52
51
  }
53
52
  }
54
53
 
@@ -56,12 +55,10 @@
56
55
  opacity: 1;
57
56
  transform: scale(1);
58
57
 
59
- transition:
60
- opacity 0.1s ease-in-out 0.1s,
61
- transform 0.1s ease-in-out 0.1s;
62
-
63
- @media (prefers-reduced-motion) {
64
- transition: none;
58
+ @media not (prefers-reduced-motion) {
59
+ transition:
60
+ opacity 0.1s ease-in-out 0.1s,
61
+ transform 0.1s ease-in-out 0.1s;
65
62
  }
66
63
  }
67
64
  }
@@ -126,7 +126,7 @@ function FontSizePicker( {
126
126
  </View>
127
127
  </BottomSheet.Cell>
128
128
  { fontSizes.map( ( item, index ) => {
129
- // Only display a choice that we can currenly select.
129
+ // Only display a choice that we can currently select.
130
130
  if ( ! parseFloat( item.sizePx ) ) {
131
131
  return null;
132
132
  }
@@ -24,10 +24,13 @@ $transition-duration: 0.2s;
24
24
  width: $toggle-width;
25
25
  height: $toggle-height;
26
26
  border-radius: math.div($toggle-height, 2);
27
- transition:
28
- $transition-duration background-color ease,
29
- $transition-duration border-color ease;
30
- @include reduce-motion("transition");
27
+
28
+ @media not (prefers-reduced-motion) {
29
+ transition:
30
+ $transition-duration background-color ease,
31
+ $transition-duration border-color ease;
32
+ }
33
+
31
34
  overflow: hidden;
32
35
 
33
36
  // Windows High Contrast Mode
@@ -39,8 +42,9 @@ $transition-duration: 0.2s;
39
42
  // Expand the border to fake a solid in Windows High Contrast Mode.
40
43
  border-top: #{ $toggle-height } solid transparent;
41
44
 
42
- transition: $transition-duration opacity ease;
43
- @include reduce-motion("transition");
45
+ @media not (prefers-reduced-motion) {
46
+ transition: $transition-duration opacity ease;
47
+ }
44
48
 
45
49
  opacity: 0;
46
50
  }
@@ -55,10 +59,13 @@ $transition-duration: 0.2s;
55
59
  width: $toggle-thumb-size;
56
60
  height: $toggle-thumb-size;
57
61
  border-radius: $radius-round;
58
- transition:
59
- $transition-duration transform ease,
60
- $transition-duration background-color ease-out;
61
- @include reduce-motion("transition");
62
+
63
+ @media not (prefers-reduced-motion) {
64
+ transition:
65
+ $transition-duration transform ease,
66
+ $transition-duration background-color ease-out;
67
+ }
68
+
62
69
  background-color: $gray-900;
63
70
  box-shadow: $elevation-x-small;
64
71
 
@@ -124,8 +124,10 @@
124
124
  height: auto;
125
125
  background: $gray-300;
126
126
  min-width: unset;
127
- transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1);
128
- @include reduce-motion;
127
+
128
+ @media not (prefers-reduced-motion) {
129
+ transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1);
130
+ }
129
131
  }
130
132
 
131
133
  .components-form-token-field__token-text {
@@ -154,8 +156,11 @@
154
156
  min-width: 100%;
155
157
  max-height: $grid-unit-80 * 2;
156
158
  overflow-y: auto;
157
- transition: all 0.15s ease-in-out;
158
- @include reduce-motion("transition");
159
+
160
+ @media not (prefers-reduced-motion) {
161
+ transition: all 0.15s ease-in-out;
162
+ }
163
+
159
164
  list-style: none;
160
165
  box-shadow: inset 0 $border-width 0 0 $gray-600; // Matches the border color of the input.
161
166
  margin: 0;
@@ -8,7 +8,7 @@ $regionOutlineRatio: 2;
8
8
  [role="region"] {
9
9
  position: relative;
10
10
 
11
- // Handles the focus when we programatically send focus to this region
11
+ // Handles the focus when we programmatically send focus to this region
12
12
  &.interface-interface-skeleton__content:focus-visible::after {
13
13
  @include region-selection-focus;
14
14
  }
@@ -26,7 +26,7 @@ $regionOutlineRatio: 2;
26
26
  // the navigable regions should always have a computed size. For now, we can
27
27
  // fix some edge cases but these CSS rules should be later removed in favor of
28
28
  // a more abstracted approach to make the navigable regions focus style work
29
- // regardles of the CSS used on other components.
29
+ // regardless of the CSS used on other components.
30
30
 
31
31
  // Header top bar when Distraction free mode is on.
32
32
  &.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
@@ -32,7 +32,7 @@ type Props = {
32
32
  * describing the component and the
33
33
  * focus return characteristics.
34
34
  *
35
- * @return Higher Order Component with the focus restauration behaviour.
35
+ * @return Higher Order Component with the focus restoration behaviour.
36
36
  */
37
37
  export default createHigherOrderComponent(
38
38
  // @ts-expect-error TODO: Reconcile with intended `createHigherOrderComponent` types
@@ -287,6 +287,12 @@ export const Input = styled.input< InputProps >`
287
287
  &::-webkit-input-placeholder {
288
288
  line-height: normal;
289
289
  }
290
+
291
+ &[type='email'],
292
+ &[type='url'] {
293
+ /* rtl:ignore */
294
+ direction: ltr;
295
+ }
290
296
  }
291
297
  `;
292
298