@wordpress/components 28.7.0 → 28.8.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 (240) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/build/box-control/all-input-control.js +1 -2
  3. package/build/box-control/all-input-control.js.map +1 -1
  4. package/build/box-control/utils.js +1 -1
  5. package/build/box-control/utils.js.map +1 -1
  6. package/build/card/card/component.js +2 -2
  7. package/build/card/card/component.js.map +1 -1
  8. package/build/card/styles.js +18 -18
  9. package/build/card/styles.js.map +1 -1
  10. package/build/combobox-control/index.js +3 -1
  11. package/build/combobox-control/index.js.map +1 -1
  12. package/build/combobox-control/types.js.map +1 -1
  13. package/build/composite/context.js +1 -1
  14. package/build/composite/context.js.map +1 -1
  15. package/build/composite/group-label.js +1 -1
  16. package/build/composite/group-label.js.map +1 -1
  17. package/build/composite/group.js +1 -1
  18. package/build/composite/group.js.map +1 -1
  19. package/build/composite/hover.js +1 -1
  20. package/build/composite/hover.js.map +1 -1
  21. package/build/composite/index.js +17 -26
  22. package/build/composite/index.js.map +1 -1
  23. package/build/composite/item.js +1 -1
  24. package/build/composite/item.js.map +1 -1
  25. package/build/composite/legacy/index.js +59 -8
  26. package/build/composite/legacy/index.js.map +1 -1
  27. package/build/composite/row.js +1 -1
  28. package/build/composite/row.js.map +1 -1
  29. package/build/composite/typeahead.js +1 -1
  30. package/build/composite/typeahead.js.map +1 -1
  31. package/build/composite/types.js.map +1 -1
  32. package/build/custom-select-control-v2/styles.js +9 -9
  33. package/build/custom-select-control-v2/styles.js.map +1 -1
  34. package/build/date-time/date/index.js +1 -1
  35. package/build/date-time/date/index.js.map +1 -1
  36. package/build/date-time/date/styles.js +35 -24
  37. package/build/date-time/date/styles.js.map +1 -1
  38. package/build/date-time/date/use-lilius/index.js +163 -0
  39. package/build/date-time/date/use-lilius/index.js.map +1 -0
  40. package/build/dropdown-menu-v2/styles.js +17 -17
  41. package/build/dropdown-menu-v2/styles.js.map +1 -1
  42. package/build/index.js +7 -0
  43. package/build/index.js.map +1 -1
  44. package/build/modal/index.js +27 -12
  45. package/build/modal/index.js.map +1 -1
  46. package/build/modal/types.js.map +1 -1
  47. package/build/modal/use-modal-exit-animation.js +75 -0
  48. package/build/modal/use-modal-exit-animation.js.map +1 -0
  49. package/build/navigator/navigator-screen/component.js +5 -0
  50. package/build/navigator/navigator-screen/component.js.map +1 -1
  51. package/build/private-apis.js +0 -9
  52. package/build/private-apis.js.map +1 -1
  53. package/build/range-control/styles/range-control-styles.js +28 -28
  54. package/build/range-control/styles/range-control-styles.js.map +1 -1
  55. package/build/slot-fill/index.js +1 -0
  56. package/build/slot-fill/index.js.map +1 -1
  57. package/build/tabs/styles.js +3 -3
  58. package/build/tabs/styles.js.map +1 -1
  59. package/build/tabs/tablist.js +5 -4
  60. package/build/tabs/tablist.js.map +1 -1
  61. package/build/utils/config-values.js +4 -5
  62. package/build/utils/config-values.js.map +1 -1
  63. package/build/utils/element-rect.js +73 -105
  64. package/build/utils/element-rect.js.map +1 -1
  65. package/build-module/box-control/all-input-control.js +2 -2
  66. package/build-module/box-control/all-input-control.js.map +1 -1
  67. package/build-module/box-control/utils.js +1 -1
  68. package/build-module/box-control/utils.js.map +1 -1
  69. package/build-module/card/card/component.js +2 -2
  70. package/build-module/card/card/component.js.map +1 -1
  71. package/build-module/card/styles.js +18 -18
  72. package/build-module/card/styles.js.map +1 -1
  73. package/build-module/combobox-control/index.js +3 -1
  74. package/build-module/combobox-control/index.js.map +1 -1
  75. package/build-module/combobox-control/types.js.map +1 -1
  76. package/build-module/composite/context.js +1 -1
  77. package/build-module/composite/context.js.map +1 -1
  78. package/build-module/composite/group-label.js +1 -1
  79. package/build-module/composite/group-label.js.map +1 -1
  80. package/build-module/composite/group.js +1 -1
  81. package/build-module/composite/group.js.map +1 -1
  82. package/build-module/composite/hover.js +1 -1
  83. package/build-module/composite/hover.js.map +1 -1
  84. package/build-module/composite/index.js +17 -26
  85. package/build-module/composite/index.js.map +1 -1
  86. package/build-module/composite/item.js +1 -1
  87. package/build-module/composite/item.js.map +1 -1
  88. package/build-module/composite/legacy/index.js +56 -8
  89. package/build-module/composite/legacy/index.js.map +1 -1
  90. package/build-module/composite/row.js +1 -1
  91. package/build-module/composite/row.js.map +1 -1
  92. package/build-module/composite/typeahead.js +1 -1
  93. package/build-module/composite/typeahead.js.map +1 -1
  94. package/build-module/composite/types.js.map +1 -1
  95. package/build-module/custom-select-control-v2/styles.js +9 -9
  96. package/build-module/custom-select-control-v2/styles.js.map +1 -1
  97. package/build-module/date-time/date/index.js +1 -2
  98. package/build-module/date-time/date/index.js.map +1 -1
  99. package/build-module/date-time/date/styles.js +31 -24
  100. package/build-module/date-time/date/styles.js.map +1 -1
  101. package/build-module/date-time/date/use-lilius/index.js +158 -0
  102. package/build-module/date-time/date/use-lilius/index.js.map +1 -0
  103. package/build-module/dropdown-menu-v2/styles.js +17 -17
  104. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  105. package/build-module/index.js +1 -0
  106. package/build-module/index.js.map +1 -1
  107. package/build-module/modal/index.js +29 -12
  108. package/build-module/modal/index.js.map +1 -1
  109. package/build-module/modal/types.js.map +1 -1
  110. package/build-module/modal/use-modal-exit-animation.js +68 -0
  111. package/build-module/modal/use-modal-exit-animation.js.map +1 -0
  112. package/build-module/navigator/navigator-screen/component.js +4 -0
  113. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  114. package/build-module/private-apis.js +0 -9
  115. package/build-module/private-apis.js.map +1 -1
  116. package/build-module/range-control/styles/range-control-styles.js +28 -28
  117. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  118. package/build-module/slot-fill/index.js +1 -0
  119. package/build-module/slot-fill/index.js.map +1 -1
  120. package/build-module/tabs/styles.js +3 -3
  121. package/build-module/tabs/styles.js.map +1 -1
  122. package/build-module/tabs/tablist.js +5 -4
  123. package/build-module/tabs/tablist.js.map +1 -1
  124. package/build-module/utils/config-values.js +4 -5
  125. package/build-module/utils/config-values.js.map +1 -1
  126. package/build-module/utils/element-rect.js +74 -105
  127. package/build-module/utils/element-rect.js.map +1 -1
  128. package/build-style/style-rtl.css +51 -10
  129. package/build-style/style.css +51 -10
  130. package/build-types/box-control/all-input-control.d.ts.map +1 -1
  131. package/build-types/box-control/utils.d.ts +1 -1
  132. package/build-types/box-control/utils.d.ts.map +1 -1
  133. package/build-types/button-group/stories/index.story.d.ts +2 -2
  134. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  135. package/build-types/combobox-control/index.d.ts.map +1 -1
  136. package/build-types/combobox-control/stories/index.story.d.ts +4 -0
  137. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  138. package/build-types/combobox-control/types.d.ts +4 -0
  139. package/build-types/combobox-control/types.d.ts.map +1 -1
  140. package/build-types/composite/context.d.ts.map +1 -1
  141. package/build-types/composite/index.d.ts +36 -24
  142. package/build-types/composite/index.d.ts.map +1 -1
  143. package/build-types/composite/legacy/index.d.ts +25 -2
  144. package/build-types/composite/legacy/index.d.ts.map +1 -1
  145. package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
  146. package/build-types/composite/stories/index.story.d.ts +9 -9
  147. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  148. package/build-types/composite/types.d.ts +11 -10
  149. package/build-types/composite/types.d.ts.map +1 -1
  150. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  151. package/build-types/date-time/date/index.d.ts +0 -3
  152. package/build-types/date-time/date/index.d.ts.map +1 -1
  153. package/build-types/date-time/date/styles.d.ts.map +1 -1
  154. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  155. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  156. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  157. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  158. package/build-types/index.d.ts +1 -0
  159. package/build-types/index.d.ts.map +1 -1
  160. package/build-types/modal/index.d.ts.map +1 -1
  161. package/build-types/modal/stories/index.story.d.ts +3 -0
  162. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  163. package/build-types/modal/types.d.ts +6 -10
  164. package/build-types/modal/types.d.ts.map +1 -1
  165. package/build-types/modal/use-modal-exit-animation.d.ts +9 -0
  166. package/build-types/modal/use-modal-exit-animation.d.ts.map +1 -0
  167. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  168. package/build-types/private-apis.d.ts.map +1 -1
  169. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  170. package/build-types/slot-fill/index.d.ts +3 -0
  171. package/build-types/slot-fill/index.d.ts.map +1 -1
  172. package/build-types/tabs/styles.d.ts.map +1 -1
  173. package/build-types/tabs/tablist.d.ts.map +1 -1
  174. package/build-types/utils/config-values.d.ts +0 -1
  175. package/build-types/utils/element-rect.d.ts +32 -74
  176. package/build-types/utils/element-rect.d.ts.map +1 -1
  177. package/package.json +19 -20
  178. package/src/box-control/README.md +7 -0
  179. package/src/box-control/all-input-control.tsx +2 -3
  180. package/src/box-control/utils.ts +1 -1
  181. package/src/button-group/stories/index.story.tsx +10 -15
  182. package/src/card/card/component.tsx +1 -1
  183. package/src/card/styles.ts +1 -1
  184. package/src/card/test/__snapshots__/index.tsx.snap +54 -54
  185. package/src/combobox-control/README.md +7 -0
  186. package/src/combobox-control/index.tsx +2 -0
  187. package/src/combobox-control/test/index.tsx +40 -0
  188. package/src/combobox-control/types.ts +4 -0
  189. package/src/composite/README.md +5 -24
  190. package/src/composite/{context.ts → context.tsx} +1 -2
  191. package/src/composite/group-label.tsx +1 -1
  192. package/src/composite/group.tsx +1 -1
  193. package/src/composite/hover.tsx +1 -1
  194. package/src/composite/index.tsx +17 -28
  195. package/src/composite/item.tsx +1 -1
  196. package/src/composite/legacy/index.tsx +72 -11
  197. package/src/composite/legacy/stories/index.story.tsx +2 -1
  198. package/src/composite/legacy/test/index.tsx +57 -1
  199. package/src/composite/row.tsx +1 -1
  200. package/src/composite/stories/index.story.tsx +185 -169
  201. package/src/composite/typeahead.tsx +1 -1
  202. package/src/composite/types.ts +13 -15
  203. package/src/custom-select-control-v2/styles.ts +1 -0
  204. package/src/date-time/date/index.tsx +1 -1
  205. package/src/date-time/date/styles.ts +31 -11
  206. package/src/date-time/date/test/use-lilius.ts +417 -0
  207. package/src/date-time/date/use-lilius/index.ts +394 -0
  208. package/src/dropdown-menu-v2/styles.ts +1 -1
  209. package/src/form-toggle/style.scss +1 -0
  210. package/src/index.ts +1 -0
  211. package/src/modal/index.tsx +42 -19
  212. package/src/modal/stories/index.story.tsx +8 -14
  213. package/src/modal/style.scss +30 -8
  214. package/src/modal/types.ts +6 -18
  215. package/src/modal/use-modal-exit-animation.ts +99 -0
  216. package/src/navigator/navigator-screen/component.tsx +7 -0
  217. package/src/navigator/test/index.tsx +8 -0
  218. package/src/popover/style.scss +3 -2
  219. package/src/private-apis.ts +0 -9
  220. package/src/range-control/styles/range-control-styles.ts +1 -0
  221. package/src/resizable-box/style.scss +1 -1
  222. package/src/select-control/README.md +2 -2
  223. package/src/slot-fill/index.tsx +1 -0
  224. package/src/snackbar/style.scss +1 -1
  225. package/src/tabs/styles.ts +40 -11
  226. package/src/tabs/tablist.tsx +5 -4
  227. package/src/tooltip/style.scss +1 -0
  228. package/src/utils/config-values.js +4 -5
  229. package/src/utils/element-rect.ts +93 -130
  230. package/tsconfig.tsbuildinfo +1 -1
  231. package/build/composite/store.js +0 -54
  232. package/build/composite/store.js.map +0 -1
  233. package/build-module/composite/store.js +0 -46
  234. package/build-module/composite/store.js.map +0 -1
  235. package/build-types/composite/store.d.ts +0 -25
  236. package/build-types/composite/store.d.ts.map +0 -1
  237. package/build-types/composite/stories/utils.d.ts +0 -29
  238. package/build-types/composite/stories/utils.d.ts.map +0 -1
  239. package/src/composite/store.ts +0 -46
  240. package/src/composite/stories/utils.tsx +0 -76
@@ -1,15 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import type {
5
- AriaRole,
6
- CSSProperties,
7
- ReactNode,
8
- KeyboardEventHandler,
9
- KeyboardEvent,
10
- SyntheticEvent,
11
- } from 'react';
12
-
13
1
  /**
14
2
  * WordPress dependencies
15
3
  */
@@ -42,7 +30,7 @@ export type ModalProps = {
42
30
  /**
43
31
  * The children elements.
44
32
  */
45
- children: ReactNode;
33
+ children: React.ReactNode;
46
34
  /**
47
35
  * If this property is added, it will an additional class name to the modal
48
36
  * content `div`.
@@ -77,7 +65,7 @@ export type ModalProps = {
77
65
  *
78
66
  * @default null
79
67
  */
80
- headerActions?: ReactNode;
68
+ headerActions?: React.ReactNode;
81
69
 
82
70
  /**
83
71
  * If this property is added, an icon will be added before the title.
@@ -108,12 +96,12 @@ export type ModalProps = {
108
96
  /**
109
97
  * Handle the key down on the modal frame `div`.
110
98
  */
111
- onKeyDown?: KeyboardEventHandler< HTMLDivElement >;
99
+ onKeyDown?: React.KeyboardEventHandler< HTMLDivElement >;
112
100
  /**
113
101
  * This function is called to indicate that the modal should be closed.
114
102
  */
115
103
  onRequestClose: (
116
- event?: KeyboardEvent< HTMLDivElement > | SyntheticEvent
104
+ event?: React.KeyboardEvent< HTMLDivElement > | React.SyntheticEvent
117
105
  ) => void;
118
106
  /**
119
107
  * If this property is added, it will an additional class name to the modal
@@ -126,7 +114,7 @@ export type ModalProps = {
126
114
  *
127
115
  * @default 'dialog'
128
116
  */
129
- role?: AriaRole;
117
+ role?: React.AriaRole;
130
118
  /**
131
119
  * If this property is added, it will determine whether the modal requests
132
120
  * to close when a mouse click occurs outside of the modal content.
@@ -144,7 +132,7 @@ export type ModalProps = {
144
132
  /**
145
133
  * If this property is added, it will be added to the modal frame `div`.
146
134
  */
147
- style?: CSSProperties;
135
+ style?: React.CSSProperties;
148
136
  /**
149
137
  * This property is used as the modal header's title.
150
138
  *
@@ -0,0 +1,99 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useReducedMotion } from '@wordpress/compose';
5
+ import { useCallback, useRef, useState } from '@wordpress/element';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { CONFIG } from '../utils';
11
+ import warning from '@wordpress/warning';
12
+
13
+ // Animation duration (ms) extracted to JS in order to be used on a setTimeout.
14
+ const FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;
15
+ const FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(
16
+ CONFIG.transitionDuration
17
+ );
18
+
19
+ const EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';
20
+
21
+ export function useModalExitAnimation() {
22
+ const frameRef = useRef< HTMLDivElement >();
23
+ const [ isAnimatingOut, setIsAnimatingOut ] = useState( false );
24
+ const isReducedMotion = useReducedMotion();
25
+
26
+ const closeModal = useCallback(
27
+ () =>
28
+ new Promise< void >( ( closeModalResolve ) => {
29
+ // Grab a "stable" reference of the frame element, since
30
+ // the value held by the react ref might change at runtime.
31
+ const frameEl = frameRef.current;
32
+
33
+ if ( isReducedMotion ) {
34
+ closeModalResolve();
35
+ return;
36
+ }
37
+
38
+ if ( ! frameEl ) {
39
+ warning(
40
+ "wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element."
41
+ );
42
+ closeModalResolve();
43
+ return;
44
+ }
45
+
46
+ let handleAnimationEnd:
47
+ | undefined
48
+ | ( ( e: AnimationEvent ) => void );
49
+
50
+ const startAnimation = () =>
51
+ new Promise< void >( ( animationResolve ) => {
52
+ handleAnimationEnd = ( e: AnimationEvent ) => {
53
+ if ( e.animationName === EXIT_ANIMATION_NAME ) {
54
+ animationResolve();
55
+ }
56
+ };
57
+
58
+ frameEl.addEventListener(
59
+ 'animationend',
60
+ handleAnimationEnd
61
+ );
62
+ setIsAnimatingOut( true );
63
+ } );
64
+ const animationTimeout = () =>
65
+ new Promise< void >( ( timeoutResolve ) => {
66
+ setTimeout(
67
+ () => timeoutResolve(),
68
+ // Allow an extra 20% of the animation duration for the
69
+ // animationend event to fire, in case the animation frame is
70
+ // slightly delayes by some other events in the event loop.
71
+ FRAME_ANIMATION_DURATION_NUMBER * 1.2
72
+ );
73
+ } );
74
+
75
+ Promise.race( [ startAnimation(), animationTimeout() ] ).then(
76
+ () => {
77
+ if ( handleAnimationEnd ) {
78
+ frameEl.removeEventListener(
79
+ 'animationend',
80
+ handleAnimationEnd
81
+ );
82
+ }
83
+ setIsAnimatingOut( false );
84
+ closeModalResolve();
85
+ }
86
+ );
87
+ } ),
88
+ [ isReducedMotion ]
89
+ );
90
+
91
+ return {
92
+ overlayClassname: isAnimatingOut ? 'is-animating-out' : undefined,
93
+ frameRef,
94
+ frameStyle: {
95
+ '--modal-frame-animation-duration': `${ FRAME_ANIMATION_DURATION }`,
96
+ },
97
+ closeModal,
98
+ };
99
+ }
@@ -17,6 +17,7 @@ import {
17
17
  import { useMergeRefs } from '@wordpress/compose';
18
18
  import { isRTL as isRTLFn } from '@wordpress/i18n';
19
19
  import { escapeAttribute } from '@wordpress/escape-html';
20
+ import warning from '@wordpress/warning';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
@@ -33,6 +34,12 @@ function UnconnectedNavigatorScreen(
33
34
  props: WordPressComponentProps< NavigatorScreenProps, 'div', false >,
34
35
  forwardedRef: ForwardedRef< any >
35
36
  ) {
37
+ if ( ! /^\//.test( props.path ) ) {
38
+ warning(
39
+ 'wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.'
40
+ );
41
+ }
42
+
36
43
  const screenId = useId();
37
44
  const { children, className, path, ...otherProps } = useContextSystem(
38
45
  props,
@@ -642,6 +642,14 @@ describe( 'Navigator', () => {
642
642
  ).toHaveAttribute( 'id', INVALID_HTML_ATTRIBUTE.escaped );
643
643
  } );
644
644
 
645
+ it( 'should warn if the `path` prop does not follow the required format', () => {
646
+ render( <NavigatorScreen path="not-valid">Test</NavigatorScreen> );
647
+
648
+ expect( console ).toHaveWarnedWith(
649
+ 'wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.'
650
+ );
651
+ } );
652
+
645
653
  it( 'should match correctly paths with named arguments', async () => {
646
654
  const user = userEvent.setup();
647
655
 
@@ -22,14 +22,15 @@ $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900;
22
22
 
23
23
  .components-popover__content {
24
24
  background: $white;
25
- box-shadow: $shadow-popover-border-default, $elevation-x-small;
25
+ box-shadow: $shadow-popover-border-default, $elevation-medium;
26
26
  border-radius: $radius-medium;
27
27
  box-sizing: border-box;
28
28
  width: min-content;
29
29
 
30
- // Alternate treatment for popovers that put them at elevation zero with high contrast.
30
+ // Alternate treatment for popovers that put them at elevation zero with high contrast and smaller radius.
31
31
  .is-alternate & {
32
32
  box-shadow: $shadow-popover-border-default-alternate;
33
+ border-radius: $radius-small;
33
34
  }
34
35
 
35
36
  // A style that gives the popover no visible ui.
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Composite } from './composite';
5
- import { useCompositeStore } from './composite/store';
6
4
  import { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';
7
5
  import { createPrivateSlotFill } from './slot-fill';
8
6
  import { DropdownMenuV2 } from './dropdown-menu-v2';
@@ -14,13 +12,6 @@ import { lock } from './lock-unlock';
14
12
 
15
13
  export const privateApis = {};
16
14
  lock( privateApis, {
17
- CompositeV2: Composite,
18
- CompositeGroupV2: Composite.Group,
19
- CompositeItemV2: Composite.Item,
20
- CompositeRowV2: Composite.Row,
21
- CompositeTypeaheadV2: Composite.Typeahead,
22
- CompositeHoverV2: Composite.Hover,
23
- useCompositeStoreV2: useCompositeStore,
24
15
  __experimentalPopoverLegacyPositionToPlacement,
25
16
  createPrivateSlotFill,
26
17
  ComponentsContext,
@@ -239,6 +239,7 @@ export const Thumb = styled.span< ThumbProps >`
239
239
  position: absolute;
240
240
  user-select: none;
241
241
  width: 100%;
242
+ box-shadow: ${ CONFIG.elevationXSmall };
242
243
 
243
244
  ${ thumbColor };
244
245
  ${ thumbFocus };
@@ -35,7 +35,7 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
35
35
  top: calc(50% - #{ceil($resize-handler-size * 0.5)});
36
36
  right: calc(50% - #{ceil($resize-handler-size * 0.5)});
37
37
 
38
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent;
38
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $components-color-accent, $elevation-x-small;
39
39
  // Only visible in Windows High Contrast mode.
40
40
  outline: 2px solid transparent;
41
41
  }
@@ -103,7 +103,7 @@ Render a user interface to select multiple users from a list.
103
103
  ```jsx
104
104
  <SelectControl
105
105
  multiple
106
- label={ __( 'Select some users:' ) }
106
+ label={ __( 'User' ) }
107
107
  value={ this.state.users } // e.g: value = [ 'a', 'c' ]
108
108
  onChange={ ( users ) => {
109
109
  this.setState( { users } );
@@ -126,7 +126,7 @@ const [ item, setItem ] = useState( '' );
126
126
  // ...
127
127
 
128
128
  <SelectControl
129
- label={ __( 'Select an item:' ) }
129
+ label={ __( 'My dinosaur' ) }
130
130
  value={ item } // e.g: value = 'a'
131
131
  onChange={ ( selection ) => { setItem( selection ) } }
132
132
  __nextHasNoMarginBottom
@@ -71,6 +71,7 @@ export function Provider( {
71
71
  </SlotFillProvider>
72
72
  );
73
73
  }
74
+ Provider.displayName = 'SlotFillProvider';
74
75
 
75
76
  export function createSlotFill( key: SlotKey ) {
76
77
  const baseName = typeof key === 'symbol' ? key.description : key;
@@ -4,7 +4,7 @@
4
4
  background: rgba($black, 0.85); // Emulates #1e1e1e closely.
5
5
  backdrop-filter: blur($grid-unit-20) saturate(180%);
6
6
  border-radius: $radius-medium;
7
- box-shadow: $elevation-x-small;
7
+ box-shadow: $elevation-small;
8
8
  color: $white;
9
9
  padding: $grid-unit-15 ($grid-unit-05 * 5);
10
10
  width: 100%;
@@ -22,36 +22,65 @@ export const TabListWrapper = styled.div`
22
22
  text-align: start;
23
23
  }
24
24
 
25
- @media not ( prefers-reduced-motion: reduce ) {
25
+ @media not ( prefers-reduced-motion ) {
26
26
  &.is-animation-enabled::after {
27
- transition-property: left, top, width, height;
27
+ transition-property: transform;
28
28
  transition-duration: 0.2s;
29
29
  transition-timing-function: ease-out;
30
30
  }
31
31
  }
32
+ --direction-factor: 1;
33
+ --direction-origin-x: left;
34
+ --indicator-start: var( --indicator-left );
35
+ &:dir( rtl ) {
36
+ --direction-factor: -1;
37
+ --direction-origin-x: right;
38
+ --indicator-start: var( --indicator-right );
39
+ }
32
40
  &::after {
33
41
  content: '';
34
42
  position: absolute;
35
43
  pointer-events: none;
44
+ transform-origin: var( --direction-origin-x ) top;
36
45
 
37
46
  // Windows high contrast mode.
38
47
  outline: 2px solid transparent;
39
48
  outline-offset: -1px;
40
49
  }
41
- &:not( [aria-orientation='vertical'] )::after {
42
- bottom: 0;
43
- left: var( --indicator-left );
44
- width: var( --indicator-width );
45
- height: 0;
46
- border-bottom: var( --wp-admin-border-width-focus ) solid
47
- ${ COLORS.theme.accent };
50
+
51
+ /* Using a large value to avoid antialiasing rounding issues
52
+ when scaling in the transform, see: https://stackoverflow.com/a/52159123 */
53
+ --antialiasing-factor: 100;
54
+ &:not( [aria-orientation='vertical'] ) {
55
+ &::after {
56
+ bottom: 0;
57
+ height: 0;
58
+ width: calc( var( --antialiasing-factor ) * 1px );
59
+ transform: translateX(
60
+ calc(
61
+ var( --indicator-start ) * var( --direction-factor ) *
62
+ 1px
63
+ )
64
+ )
65
+ scaleX(
66
+ calc(
67
+ var( --indicator-width ) / var( --antialiasing-factor )
68
+ )
69
+ );
70
+ border-bottom: var( --wp-admin-border-width-focus ) solid
71
+ ${ COLORS.theme.accent };
72
+ }
48
73
  }
49
74
  &[aria-orientation='vertical']::after {
50
75
  z-index: -1;
76
+ top: 0;
51
77
  left: 0;
52
78
  width: 100%;
53
- top: var( --indicator-top );
54
- height: var( --indicator-height );
79
+ height: calc( var( --antialiasing-factor ) * 1px );
80
+ transform: translateY( calc( var( --indicator-top ) * 1px ) )
81
+ scaleY(
82
+ calc( var( --indicator-height ) / var( --antialiasing-factor ) )
83
+ );
55
84
  background-color: ${ COLORS.theme.gray[ 100 ] };
56
85
  }
57
86
  `;
@@ -78,10 +78,11 @@ export const TabList = forwardRef<
78
78
  onBlur={ onBlur }
79
79
  { ...otherProps }
80
80
  style={ {
81
- '--indicator-left': `${ indicatorPosition.left }px`,
82
- '--indicator-top': `${ indicatorPosition.top }px`,
83
- '--indicator-width': `${ indicatorPosition.width }px`,
84
- '--indicator-height': `${ indicatorPosition.height }px`,
81
+ '--indicator-top': indicatorPosition.top,
82
+ '--indicator-right': indicatorPosition.right,
83
+ '--indicator-left': indicatorPosition.left,
84
+ '--indicator-width': indicatorPosition.width,
85
+ '--indicator-height': indicatorPosition.height,
85
86
  ...otherProps.style,
86
87
  } }
87
88
  className={ clsx(
@@ -8,6 +8,7 @@
8
8
  font-size: 12px;
9
9
  padding: $grid-unit-05 $grid-unit-10;
10
10
  z-index: z-index(".components-tooltip");
11
+ box-shadow: $elevation-small;
11
12
  }
12
13
 
13
14
  .components-tooltip__shortcut {
@@ -68,15 +68,14 @@ export default Object.assign( {}, CONTROL_PROPS, TOGGLE_GROUP_CONTROL_PROPS, {
68
68
  fontWeight: 'normal',
69
69
  fontWeightHeading: '600',
70
70
  gridBase: '4px',
71
- cardBorderRadius: '2px',
72
71
  cardPaddingXSmall: `${ space( 2 ) }`,
73
72
  cardPaddingSmall: `${ space( 4 ) }`,
74
73
  cardPaddingMedium: `${ space( 4 ) } ${ space( 6 ) }`,
75
74
  cardPaddingLarge: `${ space( 6 ) } ${ space( 8 ) }`,
76
- elevationXSmall: `0 0.7px 1px rgba(0, 0, 0, 0.1), 0 1.2px 1.7px -0.2px rgba(0, 0, 0, 0.1), 0 2.3px 3.3px -0.5px rgba(0, 0, 0, 0.1)`,
77
- elevationSmall: `0 0.7px 1px 0 rgba(0, 0, 0, 0.12), 0 2.2px 3.7px -0.2px rgba(0, 0, 0, 0.12), 0 5.3px 7.3px -0.5px rgba(0, 0, 0, 0.12)`,
78
- elevationMedium: `0 0.7px 1px 0 rgba(0, 0, 0, 0.14), 0 4.2px 5.7px -0.2px rgba(0, 0, 0, 0.14), 0 7.3px 9.3px -0.5px rgba(0, 0, 0, 0.14)`,
79
- elevationLarge: `0 0.7px 1px rgba(0, 0, 0, 0.15), 0 2.7px 3.8px -0.2px rgba(0, 0, 0, 0.15), 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.15), 0.1px 11.5px 16.4px -0.5px rgba(0, 0, 0, 0.15)`,
75
+ elevationXSmall: `0 1px 1px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02), 0 3px 3px rgba(0, 0, 0, 0.02), 0 4px 4px rgba(0, 0, 0, 0.01)`,
76
+ elevationSmall: `0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04), 0 6px 6px rgba(0, 0, 0, 0.03), 0 8px 8px rgba(0, 0, 0, 0.02)`,
77
+ elevationMedium: `0 2px 3px rgba(0, 0, 0, 0.05), 0 4px 5px rgba(0, 0, 0, 0.04), 0 12px 12px rgba(0, 0, 0, 0.03), 0 16px 16px rgba(0, 0, 0, 0.02)`,
78
+ elevationLarge: `0 5px 15px rgba(0, 0, 0, 0.08), 0 15px 27px rgba(0, 0, 0, 0.07), 0 30px 36px rgba(0, 0, 0, 0.04), 0 50px 43px rgba(0, 0, 0, 0.02)`,
80
79
  surfaceBackgroundColor: COLORS.white,
81
80
  surfaceBackgroundSubtleColor: '#F3F3F3',
82
81
  surfaceBackgroundTintColor: '#F5F5F5',