@wordpress/components 29.1.1 → 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
@@ -20,10 +20,10 @@ import Button from '../../button';
20
20
  import Modal from '../../modal';
21
21
  import { createSlotFill, Provider as SlotFillProvider } from '../../slot-fill';
22
22
  import { ContextSystemProvider } from '../../context';
23
- import type { MenuProps } from '../types';
23
+ import type { Props } from '../types';
24
24
 
25
25
  const meta: Meta< typeof Menu > = {
26
- id: 'components-experimental-menu',
26
+ id: 'components-menu',
27
27
  title: 'Components (Experimental)/Actions/Menu',
28
28
  component: Menu,
29
29
  subcomponents: {
@@ -183,7 +183,7 @@ export const WithSubmenu: StoryObj< typeof Menu > = {
183
183
  };
184
184
 
185
185
  export const WithCheckboxes: StoryObj< typeof Menu > = {
186
- render: function WithCheckboxes( props: MenuProps ) {
186
+ render: function WithCheckboxes( props: Props ) {
187
187
  const [ isAChecked, setAChecked ] = useState( false );
188
188
  const [ isBChecked, setBChecked ] = useState( true );
189
189
  const [ multipleCheckboxesValue, setMultipleCheckboxesValue ] =
@@ -333,7 +333,7 @@ export const WithCheckboxes: StoryObj< typeof Menu > = {
333
333
  };
334
334
 
335
335
  export const WithRadios: StoryObj< typeof Menu > = {
336
- render: function WithRadios( props: MenuProps ) {
336
+ render: function WithRadios( props: Props ) {
337
337
  const [ radioValue, setRadioValue ] = useState( 'two' );
338
338
  const onRadioChange: React.ComponentProps<
339
339
  typeof Menu.RadioItem
@@ -411,7 +411,7 @@ const modalOnTopOfMenuPopover = css`
411
411
  `;
412
412
 
413
413
  export const WithModals: StoryObj< typeof Menu > = {
414
- render: function WithModals( props: MenuProps ) {
414
+ render: function WithModals( props: Props ) {
415
415
  const [ isOuterModalOpen, setOuterModalOpen ] = useState( false );
416
416
  const [ isInnerModalOpen, setInnerModalOpen ] = useState( false );
417
417
 
@@ -527,7 +527,7 @@ const Fill = ( { children }: { children: React.ReactNode } ) => {
527
527
  };
528
528
 
529
529
  export const WithSlotFill: StoryObj< typeof Menu > = {
530
- render: ( props: MenuProps ) => {
530
+ render: ( props: Props ) => {
531
531
  return (
532
532
  <SlotFillProvider>
533
533
  <Menu { ...props }>
@@ -579,7 +579,7 @@ const toolbarVariantContextValue = {
579
579
  };
580
580
 
581
581
  export const ToolbarVariant: StoryObj< typeof Menu > = {
582
- render: ( props: MenuProps ) => (
582
+ render: ( props: Props ) => (
583
583
  // TODO: add toolbar
584
584
  <ContextSystemProvider value={ toolbarVariantContextValue }>
585
585
  <Menu { ...props }>
@@ -619,7 +619,7 @@ export const ToolbarVariant: StoryObj< typeof Menu > = {
619
619
  };
620
620
 
621
621
  export const InsideModal: StoryObj< typeof Menu > = {
622
- render: function InsideModal( props: MenuProps ) {
622
+ render: function InsideModal( props: Props ) {
623
623
  const [ isModalOpen, setModalOpen ] = useState( false );
624
624
  return (
625
625
  <>
@@ -12,7 +12,7 @@ import { COLORS, font, rtl, CONFIG } from '../utils';
12
12
  import { space } from '../utils/space';
13
13
  import Icon from '../icon';
14
14
  import { Truncate } from '../truncate';
15
- import type { MenuContext } from './types';
15
+ import type { ContextProps } from './types';
16
16
 
17
17
  const ANIMATION_PARAMS = {
18
18
  SCALE_AMOUNT_OUTER: 0.82,
@@ -42,8 +42,8 @@ const TOOLBAR_VARIANT_BOX_SHADOW = `0 0 0 ${ CONFIG.borderWidth } ${ TOOLBAR_VAR
42
42
 
43
43
  const GRID_TEMPLATE_COLS = 'minmax( 0, max-content ) 1fr';
44
44
 
45
- export const MenuPopoverOuterWrapper = styled.div<
46
- Pick< MenuContext, 'variant' >
45
+ export const PopoverOuterWrapper = styled.div<
46
+ Pick< ContextProps, 'variant' >
47
47
  >`
48
48
  position: relative;
49
49
 
@@ -95,7 +95,7 @@ export const MenuPopoverOuterWrapper = styled.div<
95
95
  }
96
96
  `;
97
97
 
98
- export const MenuPopoverInnerWrapper = styled.div`
98
+ export const PopoverInnerWrapper = styled.div`
99
99
  position: relative;
100
100
  /* Same as popover component */
101
101
  /* TODO: is there a way to read the sass variable? */
@@ -219,7 +219,7 @@ const baseItem = css`
219
219
  }
220
220
 
221
221
  /* When the item is the trigger of an open submenu */
222
- ${ MenuPopoverInnerWrapper }:not(:focus) &:not(:focus)[aria-expanded="true"] {
222
+ ${ PopoverInnerWrapper }:not(:focus) &:not(:focus)[aria-expanded="true"] {
223
223
  background-color: ${ LIGHT_BACKGROUND_COLOR };
224
224
  color: ${ COLORS.theme.foreground };
225
225
  }
@@ -229,15 +229,15 @@ const baseItem = css`
229
229
  }
230
230
  `;
231
231
 
232
- export const MenuItem = styled( Ariakit.MenuItem )`
232
+ export const Item = styled( Ariakit.MenuItem )`
233
233
  ${ baseItem };
234
234
  `;
235
235
 
236
- export const MenuCheckboxItem = styled( Ariakit.MenuItemCheckbox )`
236
+ export const CheckboxItem = styled( Ariakit.MenuItemCheckbox )`
237
237
  ${ baseItem };
238
238
  `;
239
239
 
240
- export const MenuRadioItem = styled( Ariakit.MenuItemRadio )`
240
+ export const RadioItem = styled( Ariakit.MenuItemRadio )`
241
241
  ${ baseItem };
242
242
  `;
243
243
 
@@ -249,14 +249,14 @@ export const ItemPrefixWrapper = styled.span`
249
249
  * Even when the item is not checked, occupy the same screen space to avoid
250
250
  * the space collapside when no items are checked.
251
251
  */
252
- ${ MenuCheckboxItem } > &,
253
- ${ MenuRadioItem } > & {
252
+ ${ CheckboxItem } > &,
253
+ ${ RadioItem } > & {
254
254
  /* Same width as the check icons */
255
255
  min-width: ${ space( 6 ) };
256
256
  }
257
257
 
258
- ${ MenuCheckboxItem } > &,
259
- ${ MenuRadioItem } > &,
258
+ ${ CheckboxItem } > &,
259
+ ${ RadioItem } > &,
260
260
  &:not( :empty ) {
261
261
  margin-inline-end: ${ space( 2 ) };
262
262
  }
@@ -278,7 +278,7 @@ export const ItemPrefixWrapper = styled.span`
278
278
  }
279
279
  `;
280
280
 
281
- export const MenuItemContentWrapper = styled.div`
281
+ export const ItemContentWrapper = styled.div`
282
282
  /*
283
283
  * Always occupy the second column, since the first column
284
284
  * is taken by the prefix wrapper (when displayed).
@@ -293,7 +293,7 @@ export const MenuItemContentWrapper = styled.div`
293
293
  pointer-events: none;
294
294
  `;
295
295
 
296
- export const MenuItemChildrenWrapper = styled.div`
296
+ export const ItemChildrenWrapper = styled.div`
297
297
  flex: 1;
298
298
 
299
299
  display: inline-flex;
@@ -317,19 +317,19 @@ export const ItemSuffixWrapper = styled.span`
317
317
  * When the parent menu item is active, except when it's a non-focused/hovered
318
318
  * submenu trigger (in that case, color should not be inherited)
319
319
  */
320
- [data-active-item]:not( [data-focus-visible] ) *:not(${ MenuPopoverInnerWrapper }) &,
320
+ [data-active-item]:not( [data-focus-visible] ) *:not(${ PopoverInnerWrapper }) &,
321
321
  /* When the parent menu item is disabled */
322
- [aria-disabled='true'] *:not(${ MenuPopoverInnerWrapper }) & {
322
+ [aria-disabled='true'] *:not(${ PopoverInnerWrapper }) & {
323
323
  color: inherit;
324
324
  }
325
325
  `;
326
326
 
327
- export const MenuGroup = styled( Ariakit.MenuGroup )`
327
+ export const Group = styled( Ariakit.MenuGroup )`
328
328
  /* Ignore this element when calculating the layout. Useful for subgrid */
329
329
  display: contents;
330
330
  `;
331
331
 
332
- export const MenuGroupLabel = styled( Ariakit.MenuGroupLabel )`
332
+ export const GroupLabel = styled( Ariakit.MenuGroupLabel )`
333
333
  /* Occupy the width of all grid columns (ie. full width) */
334
334
  grid-column: 1 / -1;
335
335
 
@@ -338,8 +338,8 @@ export const MenuGroupLabel = styled( Ariakit.MenuGroupLabel )`
338
338
  padding-inline: ${ ITEM_PADDING_INLINE };
339
339
  `;
340
340
 
341
- export const MenuSeparator = styled( Ariakit.MenuSeparator )<
342
- Pick< MenuContext, 'variant' >
341
+ export const Separator = styled( Ariakit.MenuSeparator )<
342
+ Pick< ContextProps, 'variant' >
343
343
  >`
344
344
  /* Occupy the width of all grid columns (ie. full width) */
345
345
  grid-column: 1 / -1;
@@ -370,22 +370,22 @@ export const SubmenuChevronIcon = styled( Icon )`
370
370
  ) };
371
371
  `;
372
372
 
373
- export const MenuItemLabel = styled( Truncate )`
373
+ export const ItemLabel = styled( Truncate )`
374
374
  font-size: ${ font( 'default.fontSize' ) };
375
375
  line-height: 20px;
376
376
  color: inherit;
377
377
  `;
378
378
 
379
- export const MenuItemHelpText = styled( Truncate )`
379
+ export const ItemHelpText = styled( Truncate )`
380
380
  font-size: ${ font( 'helpText.fontSize' ) };
381
381
  line-height: 16px;
382
382
  color: ${ LIGHTER_TEXT_COLOR };
383
383
  overflow-wrap: anywhere;
384
384
 
385
385
  [data-active-item]:not( [data-focus-visible] )
386
- *:not( ${ MenuPopoverInnerWrapper } )
386
+ *:not( ${ PopoverInnerWrapper } )
387
387
  &,
388
- [aria-disabled='true'] *:not( ${ MenuPopoverInnerWrapper } ) & {
388
+ [aria-disabled='true'] *:not( ${ PopoverInnerWrapper } ) & {
389
389
  color: inherit;
390
390
  }
391
391
  `;
@@ -13,16 +13,16 @@ import { chevronRightSmall } from '@wordpress/icons';
13
13
  * Internal dependencies
14
14
  */
15
15
  import type { WordPressComponentProps } from '../context';
16
- import type { MenuItemProps } from './types';
17
- import { MenuContext } from './context';
18
- import { MenuItem } from './item';
16
+ import type { ItemProps } from './types';
17
+ import { Context } from './context';
18
+ import { Item } from './item';
19
19
  import * as Styled from './styles';
20
20
 
21
- export const MenuSubmenuTriggerItem = forwardRef<
21
+ export const SubmenuTriggerItem = forwardRef<
22
22
  HTMLDivElement,
23
- WordPressComponentProps< MenuItemProps, 'div', false >
24
- >( function MenuSubmenuTriggerItem( { suffix, ...otherProps }, ref ) {
25
- const menuContext = useContext( MenuContext );
23
+ WordPressComponentProps< ItemProps, 'div', false >
24
+ >( function SubmenuTriggerItem( { suffix, ...otherProps }, ref ) {
25
+ const menuContext = useContext( Context );
26
26
 
27
27
  if ( ! menuContext?.store.parent ) {
28
28
  throw new Error(
@@ -36,10 +36,10 @@ export const MenuSubmenuTriggerItem = forwardRef<
36
36
  accessibleWhenDisabled
37
37
  store={ menuContext.store }
38
38
  render={
39
- <MenuItem
39
+ <Item
40
40
  { ...otherProps }
41
41
  // The menu item needs to register and be part of the parent menu.
42
- // Without specifying the store explicitly, the `MenuItem` component
42
+ // Without specifying the store explicitly, the `Item` component
43
43
  // would otherwise read the store via context and pick up the one from
44
44
  // the sub-menu `Menu` component.
45
45
  store={ menuContext.store.parent }
@@ -12,14 +12,14 @@ import { forwardRef, useContext } from '@wordpress/element';
12
12
  * Internal dependencies
13
13
  */
14
14
  import type { WordPressComponentProps } from '../context';
15
- import type { MenuTriggerButtonProps } from './types';
16
- import { MenuContext } from './context';
15
+ import type { TriggerButtonProps } from './types';
16
+ import { Context } from './context';
17
17
 
18
- export const MenuTriggerButton = forwardRef<
18
+ export const TriggerButton = forwardRef<
19
19
  HTMLDivElement,
20
- WordPressComponentProps< MenuTriggerButtonProps, 'button', false >
21
- >( function MenuTriggerButton( { children, disabled = false, ...props }, ref ) {
22
- const menuContext = useContext( MenuContext );
20
+ WordPressComponentProps< TriggerButtonProps, 'button', false >
21
+ >( function TriggerButton( { children, disabled = false, ...props }, ref ) {
22
+ const menuContext = useContext( Context );
23
23
 
24
24
  if ( ! menuContext?.store ) {
25
25
  throw new Error(
package/src/menu/types.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type * as Ariakit from '@ariakit/react';
5
5
 
6
- export interface MenuContext {
6
+ export interface ContextProps {
7
7
  /**
8
8
  * The ariakit store shared across all Menu subcomponents.
9
9
  */
@@ -14,7 +14,7 @@ export interface MenuContext {
14
14
  variant?: 'toolbar';
15
15
  }
16
16
 
17
- export interface MenuProps {
17
+ export interface Props {
18
18
  /**
19
19
  * The elements, which should include one instance of the `Menu.TriggerButton`
20
20
  * component and one instance of the `Menu.Popover` component.
@@ -50,7 +50,7 @@ export interface MenuProps {
50
50
  placement?: Ariakit.MenuProviderProps[ 'placement' ];
51
51
  }
52
52
 
53
- export interface MenuPopoverProps {
53
+ export interface PopoverProps {
54
54
  /**
55
55
  * The contents of the menu popover, which should include instances of the
56
56
  * `Menu.Item`, `Menu.CheckboxItem`, `Menu.RadioItem`, `Menu.Group`, and
@@ -98,7 +98,7 @@ export interface MenuPopoverProps {
98
98
  hideOnEscape?: Ariakit.MenuProps[ 'hideOnEscape' ];
99
99
  }
100
100
 
101
- export interface MenuTriggerButtonProps {
101
+ export interface TriggerButtonProps {
102
102
  /**
103
103
  * The contents of the menu trigger button.
104
104
  */
@@ -139,7 +139,7 @@ export interface MenuTriggerButtonProps {
139
139
  accessibleWhenDisabled?: Ariakit.MenuButtonProps[ 'accessibleWhenDisabled' ];
140
140
  }
141
141
 
142
- export interface MenuGroupProps {
142
+ export interface GroupProps {
143
143
  /**
144
144
  * The contents of the menu group, which should include one instance of the
145
145
  * `Menu.GroupLabel` component and one or more instances of `Menu.Item`,
@@ -148,7 +148,7 @@ export interface MenuGroupProps {
148
148
  children: Ariakit.MenuGroupProps[ 'children' ];
149
149
  }
150
150
 
151
- export interface MenuGroupLabelProps {
151
+ export interface GroupLabelProps {
152
152
  /**
153
153
  * The contents of the menu group label, which should provide an accessible
154
154
  * label for the menu group.
@@ -156,7 +156,7 @@ export interface MenuGroupLabelProps {
156
156
  children: Ariakit.MenuGroupLabelProps[ 'children' ];
157
157
  }
158
158
 
159
- export interface MenuItemProps {
159
+ export interface ItemProps {
160
160
  /**
161
161
  * The contents of the menu item, which could include one instance of the
162
162
  * `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
@@ -203,7 +203,7 @@ export interface MenuItemProps {
203
203
  store?: Ariakit.MenuItemProps[ 'store' ];
204
204
  }
205
205
 
206
- export interface MenuCheckboxItemProps {
206
+ export interface CheckboxItemProps {
207
207
  /**
208
208
  * The contents of the menu item, which could include one instance of the
209
209
  * `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
@@ -267,7 +267,7 @@ export interface MenuCheckboxItemProps {
267
267
  onChange?: Ariakit.MenuItemCheckboxProps[ 'onChange' ];
268
268
  }
269
269
 
270
- export interface MenuRadioItemProps {
270
+ export interface RadioItemProps {
271
271
  /**
272
272
  * The contents of the menu item, which could include one instance of the
273
273
  * `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
@@ -330,4 +330,4 @@ export interface MenuRadioItemProps {
330
330
  onChange?: Ariakit.MenuItemRadioProps[ 'onChange' ];
331
331
  }
332
332
 
333
- export interface MenuSeparatorProps {}
333
+ export interface SeparatorProps {}
@@ -76,8 +76,8 @@ const MultiGroupsTemplate: StoryFn< typeof MenuGroup > = ( args ) => {
76
76
  * When other menu items exist above or below a MenuGroup, the group
77
77
  * should have a divider line between it and the adjacent item.
78
78
  */
79
- export const WithSeperator = MultiGroupsTemplate.bind( {} );
80
- WithSeperator.args = {
79
+ export const WithSeparator = MultiGroupsTemplate.bind( {} );
80
+ WithSeparator.args = {
81
81
  ...Default.args,
82
82
  hideSeparator: false,
83
83
  label: 'Editor',
@@ -8,7 +8,7 @@ import { View, TouchableWithoutFeedback } from 'react-native';
8
8
  */
9
9
  import styles from './styles.scss';
10
10
 
11
- // Action button component is used by both Back and Apply Button componenets.
11
+ // Action button component is used by both Back and Apply Button components.
12
12
  function ActionButton( {
13
13
  onPress,
14
14
  accessibilityLabel,
@@ -71,7 +71,7 @@ function getFunctionUnitValue( functionUnitValue, options ) {
71
71
  * Take a css function such as min, max, calc, clamp and returns parsedUnit
72
72
  *
73
73
  * How this works for the nested function is that it first replaces the inner function call.
74
- * Then it tackles the outer onces.
74
+ * Then it tackles the outer ones.
75
75
  * So for example: min( max(25px, 35px), 40px )
76
76
  * in the first pass we would replace max(25px, 35px) with 35px.
77
77
  * then we would try to evaluate min( 35px, 40px )
@@ -101,7 +101,7 @@ function parseUnitFunction( cssUnit ) {
101
101
  /**
102
102
  * Return true if we think this is a math expression.
103
103
  *
104
- * @param {string} cssUnit the cssUnit value being evaluted.
104
+ * @param {string} cssUnit the cssUnit value being evaluated.
105
105
  * @return {boolean} Whether the cssUnit is a math expression.
106
106
  */
107
107
  function isMathExpression( cssUnit ) {
@@ -115,7 +115,7 @@ function isMathExpression( cssUnit ) {
115
115
  /**
116
116
  * Evaluates the math expression and return a px value.
117
117
  *
118
- * @param {string} cssUnit the cssUnit value being evaluted.
118
+ * @param {string} cssUnit the cssUnit value being evaluated.
119
119
  * @return {string} return a converfted value to px.
120
120
  */
121
121
  function evalMathExpression( cssUnit ) {
@@ -33,10 +33,12 @@
33
33
  display: flex;
34
34
  // Animate the modal frame/contents appearing on the page.
35
35
  animation-name: components-modal__appear-animation;
36
- animation-duration: var(--modal-frame-animation-duration);
37
36
  animation-fill-mode: forwards;
38
37
  animation-timing-function: cubic-bezier(0.29, 0, 0, 1);
39
- @include reduce-motion("animation");
38
+
39
+ @media not (prefers-reduced-motion) {
40
+ animation-duration: var(--modal-frame-animation-duration);
41
+ }
40
42
 
41
43
  .components-modal__screen-overlay.is-animating-out & {
42
44
  animation-name: components-modal__disappear-animation;
@@ -398,7 +398,8 @@ describe( 'Modal', () => {
398
398
  const [ isAShown, setIsAShown ] = useState( false );
399
399
  const [ isA1Shown, setIsA1Shown ] = useState( false );
400
400
  const [ isBShown, setIsBShown ] = useState( false );
401
- const [ isClassOverriden, setIsClassOverriden ] = useState( false );
401
+ const [ isClassOverridden, setIsClassOverridden ] =
402
+ useState( false );
402
403
  useEffect( () => {
403
404
  const toggles: ( e: KeyboardEvent ) => void = ( {
404
405
  key,
@@ -414,7 +415,7 @@ describe( 'Modal', () => {
414
415
  return setIsBShown( ( v ) => ! v );
415
416
  }
416
417
  if ( key === 'c' ) {
417
- return setIsClassOverriden( ( v ) => ! v );
418
+ return setIsClassOverridden( ( v ) => ! v );
418
419
  }
419
420
  };
420
421
  document.addEventListener( 'keydown', toggles );
@@ -426,7 +427,7 @@ describe( 'Modal', () => {
426
427
  { isAShown && (
427
428
  <Modal
428
429
  bodyOpenClassName={
429
- isClassOverriden ? overrideClass : 'is-A-open'
430
+ isClassOverridden ? overrideClass : 'is-A-open'
430
431
  }
431
432
  onRequestClose={ () => setIsAShown( false ) }
432
433
  >
@@ -446,7 +447,7 @@ describe( 'Modal', () => {
446
447
  { isBShown && (
447
448
  <Modal
448
449
  bodyOpenClassName={
449
- isClassOverriden ? overrideClass : 'is-B-open'
450
+ isClassOverridden ? overrideClass : 'is-B-open'
450
451
  }
451
452
  onRequestClose={ () => setIsBShown( false ) }
452
453
  >
@@ -134,9 +134,9 @@ Whether the notice should be dismissible or not
134
134
 
135
135
  #### `onDismiss` : `() => void`
136
136
 
137
- A deprecated alternative to `onRemove`. This prop is kept for compatibilty reasons but should be avoided.
137
+ A deprecated alternative to `onRemove`. This prop is kept for compatibility reasons but should be avoided.
138
138
 
139
- - Requiered: No
139
+ - Required: No
140
140
  - Default: `noop`
141
141
 
142
142
  #### `actions`: `Array<NoticeAction>`.
@@ -154,4 +154,4 @@ The default appearance of an action button is inferred based on whether `url` or
154
154
  ## Related components
155
155
 
156
156
  - To create a more prominent message that requires action, use a Modal.
157
- - For low priority, non-interruptive messsages, use Snackbar.
157
+ - For low priority, non-interruptive messages, use Snackbar.
@@ -83,7 +83,7 @@ export type NoticeProps = {
83
83
  isDismissible?: boolean;
84
84
  /**
85
85
  * A deprecated alternative to `onRemove`. This prop is kept for
86
- * compatibilty reasons but should be avoided.
86
+ * compatibility reasons but should be avoided.
87
87
  *
88
88
  * @default noop
89
89
  */
@@ -416,7 +416,7 @@ describe( 'PaletteEdit', () => {
416
416
  />
417
417
  );
418
418
 
419
- await click( screen.getByLabelText( 'Color: Primary' ) );
419
+ await click( screen.getByLabelText( 'Primary' ) );
420
420
  const hexInput = screen.getByRole( 'textbox', {
421
421
  name: 'Hex color',
422
422
  } );
@@ -62,9 +62,12 @@
62
62
  font-size: inherit;
63
63
  margin-top: 0;
64
64
  margin-bottom: 0;
65
- transition: 0.1s background ease-in-out;
66
- @include reduce-motion("transition");
65
+
66
+ @media not (prefers-reduced-motion) {
67
+ transition: 0.1s background ease-in-out;
68
+ }
67
69
  }
70
+
68
71
  .components-panel__body.is-opened > .components-panel__body-title {
69
72
  margin: -1 * $grid-unit-20;
70
73
  margin-bottom: 5px;
@@ -87,8 +90,11 @@
87
90
  color: $gray-900;
88
91
  border: none;
89
92
  box-shadow: none;
90
- transition: 0.1s background ease-in-out;
91
- @include reduce-motion("transition");
93
+
94
+ @media not (prefers-reduced-motion) {
95
+ transition: 0.1s background ease-in-out;
96
+ }
97
+
92
98
  height: auto;
93
99
 
94
100
  &:focus {
@@ -103,8 +109,10 @@
103
109
  transform: translateY(-50%);
104
110
  color: $gray-900;
105
111
  fill: currentColor;
106
- transition: 0.1s color ease-in-out;
107
- @include reduce-motion("transition");
112
+
113
+ @media not (prefers-reduced-motion) {
114
+ transition: 0.1s color ease-in-out;
115
+ }
108
116
  }
109
117
 
110
118
  // mirror the arrow horizontally in RTL languages
@@ -48,7 +48,7 @@
48
48
  .block-editor-block-icon {
49
49
  margin-right: $grid-unit-05;
50
50
  fill: currentColor;
51
- // Optimizate for high contrast modes.
51
+ // Optimize for high contrast modes.
52
52
  // See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
53
53
  @media (forced-colors: active) {
54
54
  fill: CanvasText;
@@ -173,8 +173,10 @@
173
173
  .components-button {
174
174
  opacity: 0;
175
175
  pointer-events: none;
176
- transition: opacity 0.1s linear;
177
- @include reduce-motion("transition");
176
+
177
+ @media not (prefers-reduced-motion) {
178
+ transition: opacity 0.1s linear;
179
+ }
178
180
  }
179
181
 
180
182
  .is-selected > & {
@@ -43,7 +43,7 @@ const withCustomWidthCustomCSS = `
43
43
  * You can override the default `width` by passing a custom CSS class via the
44
44
  * `className` prop.
45
45
  *
46
- * This example shows a progress bar with an overriden `width` of `100%` which
46
+ * This example shows a progress bar with an overridden `width` of `100%` which
47
47
  * makes it fit all available horizontal space of the parent element. The CSS
48
48
  * class looks like this:
49
49
  *
@@ -60,9 +60,12 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
60
60
  position: absolute;
61
61
  top: calc(50% - 1px);
62
62
  right: calc(50% - 1px);
63
- transition: transform 0.1s ease-in;
64
- @include reduce-motion("transition");
65
- will-change: transform;
63
+
64
+ @media not (prefers-reduced-motion) {
65
+ transition: transform 0.1s ease-in;
66
+ will-change: transform;
67
+ }
68
+
66
69
  opacity: 0;
67
70
  }
68
71
 
@@ -102,18 +105,20 @@ $resize-handler-container-size: $resize-handler-size + ($grid-unit-05 * 2); // M
102
105
  .components-resizable-box__side-handle.components-resizable-box__handle-bottom:hover::before,
103
106
  .components-resizable-box__side-handle.components-resizable-box__handle-top:active::before,
104
107
  .components-resizable-box__side-handle.components-resizable-box__handle-bottom:active::before {
105
- animation: components-resizable-box__top-bottom-animation 0.1s ease-out 0s;
106
- animation-fill-mode: forwards;
107
- @include reduce-motion("animation");
108
+ @media not (prefers-reduced-motion) {
109
+ animation: components-resizable-box__top-bottom-animation 0.1s ease-out 0s;
110
+ animation-fill-mode: forwards;
111
+ }
108
112
  }
109
113
 
110
114
  .components-resizable-box__side-handle.components-resizable-box__handle-left:hover::before,
111
115
  .components-resizable-box__side-handle.components-resizable-box__handle-right:hover::before,
112
116
  .components-resizable-box__side-handle.components-resizable-box__handle-left:active::before,
113
117
  .components-resizable-box__side-handle.components-resizable-box__handle-right:active::before {
114
- animation: components-resizable-box__left-right-animation 0.1s ease-out 0s;
115
- animation-fill-mode: forwards;
116
- @include reduce-motion("animation");
118
+ @media not (prefers-reduced-motion) {
119
+ animation: components-resizable-box__left-right-animation 0.1s ease-out 0s;
120
+ animation-fill-mode: forwards;
121
+ }
117
122
  }
118
123
 
119
124
  /* This CSS is shown only to Safari, which has a bug with table-caption making it jumpy.
@@ -86,7 +86,7 @@ function UnforwardedSearchControl(
86
86
  () => ( {
87
87
  BaseControl: {
88
88
  // Overrides the underlying BaseControl `__nextHasNoMarginBottom` via the context system
89
- // to provide backwards compatibile margin for SearchControl.
89
+ // to provide backwards compatible margin for SearchControl.
90
90
  // (In a standard InputControl, the BaseControl `__nextHasNoMarginBottom` is always set to true.)
91
91
  _overrides: { __nextHasNoMarginBottom },
92
92
  __associatedWPComponentName: 'SearchControl',
@@ -40,8 +40,9 @@
40
40
  border-radius: 0;
41
41
 
42
42
  // Animation
43
- transition: all 0.1s linear;
44
- @include reduce-motion("transition");
43
+ @media not (prefers-reduced-motion) {
44
+ transition: all 0.1s linear;
45
+ }
45
46
  }
46
47
 
47
48
  // Active.
@@ -68,8 +69,9 @@
68
69
  border-radius: $radius-small;
69
70
 
70
71
  // Animation
71
- transition: all 0.1s linear;
72
- @include reduce-motion("transition");
72
+ @media not (prefers-reduced-motion) {
73
+ transition: all 0.1s linear;
74
+ }
73
75
  }
74
76
 
75
77
  &:focus-visible::before {