@wordpress/components 26.0.4 → 27.1.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 (382) hide show
  1. package/.stylelintrc.js +2 -2
  2. package/CHANGELOG.md +45 -0
  3. package/CONTRIBUTING.md +72 -0
  4. package/build/autocomplete/index.js +3 -8
  5. package/build/autocomplete/index.js.map +1 -1
  6. package/build/base-control/index.native.js.map +1 -1
  7. package/build/border-box-control/border-box-control/component.js.map +1 -1
  8. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  9. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  10. package/build/button/index.js +2 -2
  11. package/build/button/index.js.map +1 -1
  12. package/build/button/index.native.js.map +1 -1
  13. package/build/color-picker/component.js +10 -1
  14. package/build/color-picker/component.js.map +1 -1
  15. package/build/color-picker/styles.js +8 -9
  16. package/build/color-picker/styles.js.map +1 -1
  17. package/build/combobox-control/index.js +4 -9
  18. package/build/combobox-control/index.js.map +1 -1
  19. package/build/confirm-dialog/component.js.map +1 -1
  20. package/build/custom-select-control/index.js +2 -15
  21. package/build/custom-select-control/index.js.map +1 -1
  22. package/build/custom-select-control-v2/custom-select-item.js +32 -0
  23. package/build/custom-select-control-v2/custom-select-item.js.map +1 -0
  24. package/build/custom-select-control-v2/custom-select.js +91 -0
  25. package/build/custom-select-control-v2/custom-select.js.map +1 -0
  26. package/build/custom-select-control-v2/default-component/index.js +41 -0
  27. package/build/custom-select-control-v2/default-component/index.js.map +1 -0
  28. package/build/custom-select-control-v2/index.js +13 -82
  29. package/build/custom-select-control-v2/index.js.map +1 -1
  30. package/build/custom-select-control-v2/legacy-component/index.js +123 -0
  31. package/build/custom-select-control-v2/legacy-component/index.js.map +1 -0
  32. package/build/custom-select-control-v2/styles.js +73 -50
  33. package/build/custom-select-control-v2/styles.js.map +1 -1
  34. package/build/custom-select-control-v2/types.js.map +1 -1
  35. package/build/draggable/index.native.js +2 -2
  36. package/build/draggable/index.native.js.map +1 -1
  37. package/build/dropdown-menu/index.native.js.map +1 -1
  38. package/build/flex/flex/hook.js +1 -1
  39. package/build/flex/flex/hook.js.map +1 -1
  40. package/build/font-size-picker/font-size-picker-select.js +0 -1
  41. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  42. package/build/font-size-picker/index.native.js.map +1 -1
  43. package/build/form-token-field/index.js +3 -8
  44. package/build/form-token-field/index.js.map +1 -1
  45. package/build/form-token-field/suggestions-list.js +5 -12
  46. package/build/form-token-field/suggestions-list.js.map +1 -1
  47. package/build/h-stack/hook.js +6 -1
  48. package/build/h-stack/hook.js.map +1 -1
  49. package/build/mobile/bottom-sheet/button.native.js.map +1 -1
  50. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  51. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  52. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  53. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  54. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  55. package/build/mobile/gradient/index.native.js.map +1 -1
  56. package/build/mobile/image/index.native.js +4 -13
  57. package/build/mobile/image/index.native.js.map +1 -1
  58. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
  59. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -1
  60. package/build/mobile/media-edit/index.native.js.map +1 -1
  61. package/build/modal/index.js +2 -10
  62. package/build/modal/index.js.map +1 -1
  63. package/build/palette-edit/index.js.map +1 -1
  64. package/build/progress-bar/styles.js +5 -5
  65. package/build/progress-bar/styles.js.map +1 -1
  66. package/build/query-controls/index.native.js.map +1 -1
  67. package/build/range-control/index.js.map +1 -1
  68. package/build/search-control/index.native.js.map +1 -1
  69. package/build/snackbar/index.js +3 -2
  70. package/build/snackbar/index.js.map +1 -1
  71. package/build/snackbar/list.js +2 -1
  72. package/build/snackbar/list.js.map +1 -1
  73. package/build/snackbar/types.js.map +1 -1
  74. package/build/tabs/index.js +7 -7
  75. package/build/tabs/index.js.map +1 -1
  76. package/build/tabs/types.js.map +1 -1
  77. package/build/utils/hooks/index.js +0 -7
  78. package/build/utils/hooks/index.js.map +1 -1
  79. package/build/utils/with-ignore-ime-events.js +34 -0
  80. package/build/utils/with-ignore-ime-events.js.map +1 -0
  81. package/build-module/autocomplete/index.js +3 -8
  82. package/build-module/autocomplete/index.js.map +1 -1
  83. package/build-module/base-control/index.native.js.map +1 -1
  84. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  85. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  86. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  87. package/build-module/button/index.js +2 -2
  88. package/build-module/button/index.js.map +1 -1
  89. package/build-module/button/index.native.js.map +1 -1
  90. package/build-module/color-picker/component.js +11 -2
  91. package/build-module/color-picker/component.js.map +1 -1
  92. package/build-module/color-picker/styles.js +8 -9
  93. package/build-module/color-picker/styles.js.map +1 -1
  94. package/build-module/combobox-control/index.js +4 -9
  95. package/build-module/combobox-control/index.js.map +1 -1
  96. package/build-module/confirm-dialog/component.js.map +1 -1
  97. package/build-module/custom-select-control/index.js +2 -15
  98. package/build-module/custom-select-control/index.js.map +1 -1
  99. package/build-module/custom-select-control-v2/custom-select-item.js +26 -0
  100. package/build-module/custom-select-control-v2/custom-select-item.js.map +1 -0
  101. package/build-module/custom-select-control-v2/custom-select.js +82 -0
  102. package/build-module/custom-select-control-v2/custom-select.js.map +1 -0
  103. package/build-module/custom-select-control-v2/default-component/index.js +30 -0
  104. package/build-module/custom-select-control-v2/default-component/index.js.map +1 -0
  105. package/build-module/custom-select-control-v2/index.js +2 -74
  106. package/build-module/custom-select-control-v2/index.js.map +1 -1
  107. package/build-module/custom-select-control-v2/legacy-component/index.js +111 -0
  108. package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -0
  109. package/build-module/custom-select-control-v2/styles.js +73 -42
  110. package/build-module/custom-select-control-v2/styles.js.map +1 -1
  111. package/build-module/custom-select-control-v2/types.js.map +1 -1
  112. package/build-module/draggable/index.native.js +2 -2
  113. package/build-module/draggable/index.native.js.map +1 -1
  114. package/build-module/dropdown-menu/index.native.js.map +1 -1
  115. package/build-module/flex/flex/hook.js +1 -1
  116. package/build-module/flex/flex/hook.js.map +1 -1
  117. package/build-module/font-size-picker/font-size-picker-select.js +0 -1
  118. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  119. package/build-module/font-size-picker/index.native.js.map +1 -1
  120. package/build-module/form-token-field/index.js +3 -8
  121. package/build-module/form-token-field/index.js.map +1 -1
  122. package/build-module/form-token-field/suggestions-list.js +5 -12
  123. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  124. package/build-module/h-stack/hook.js +6 -1
  125. package/build-module/h-stack/hook.js.map +1 -1
  126. package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
  127. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  128. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  129. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  130. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  131. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  132. package/build-module/mobile/gradient/index.native.js.map +1 -1
  133. package/build-module/mobile/image/index.native.js +6 -15
  134. package/build-module/mobile/image/index.native.js.map +1 -1
  135. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
  136. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -1
  137. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  138. package/build-module/modal/index.js +3 -10
  139. package/build-module/modal/index.js.map +1 -1
  140. package/build-module/palette-edit/index.js.map +1 -1
  141. package/build-module/progress-bar/styles.js +5 -5
  142. package/build-module/progress-bar/styles.js.map +1 -1
  143. package/build-module/query-controls/index.native.js.map +1 -1
  144. package/build-module/range-control/index.js.map +1 -1
  145. package/build-module/search-control/index.native.js.map +1 -1
  146. package/build-module/snackbar/index.js +3 -2
  147. package/build-module/snackbar/index.js.map +1 -1
  148. package/build-module/snackbar/list.js +2 -1
  149. package/build-module/snackbar/list.js.map +1 -1
  150. package/build-module/snackbar/types.js.map +1 -1
  151. package/build-module/tabs/index.js +7 -7
  152. package/build-module/tabs/index.js.map +1 -1
  153. package/build-module/tabs/types.js.map +1 -1
  154. package/build-module/utils/hooks/index.js +0 -1
  155. package/build-module/utils/hooks/index.js.map +1 -1
  156. package/build-module/utils/with-ignore-ime-events.js +28 -0
  157. package/build-module/utils/with-ignore-ime-events.js.map +1 -0
  158. package/build-style/style-rtl.css +10 -2
  159. package/build-style/style.css +10 -2
  160. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  161. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  162. package/build-types/animate/stories/index.story.d.ts +7 -7
  163. package/build-types/autocomplete/index.d.ts.map +1 -1
  164. package/build-types/base-control/stories/index.story.d.ts +1 -1
  165. package/build-types/border-box-control/stories/index.story.d.ts +1 -1
  166. package/build-types/border-control/stories/index.story.d.ts +6 -6
  167. package/build-types/box-control/stories/index.story.d.ts +6 -6
  168. package/build-types/button/stories/e2e/index.story.d.ts +1 -1
  169. package/build-types/button/stories/index.story.d.ts +7 -7
  170. package/build-types/card/stories/index.story.d.ts +2 -2
  171. package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
  172. package/build-types/color-palette/stories/index.story.d.ts +3 -3
  173. package/build-types/color-picker/component.d.ts.map +1 -1
  174. package/build-types/color-picker/stories/index.story.d.ts +1 -1
  175. package/build-types/color-picker/styles.d.ts.map +1 -1
  176. package/build-types/combobox-control/index.d.ts.map +1 -1
  177. package/build-types/combobox-control/stories/index.story.d.ts +2 -2
  178. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  179. package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
  180. package/build-types/custom-select-control/index.d.ts.map +1 -1
  181. package/build-types/custom-select-control-v2/custom-select-item.d.ts +9 -0
  182. package/build-types/custom-select-control-v2/custom-select-item.d.ts.map +1 -0
  183. package/build-types/custom-select-control-v2/custom-select.d.ts +6 -0
  184. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -0
  185. package/build-types/custom-select-control-v2/default-component/index.d.ts +6 -0
  186. package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -0
  187. package/build-types/custom-select-control-v2/index.d.ts +5 -6
  188. package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
  189. package/build-types/custom-select-control-v2/legacy-component/index.d.ts +5 -0
  190. package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -0
  191. package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts +2 -0
  192. package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts.map +1 -0
  193. package/build-types/custom-select-control-v2/stories/default.story.d.ts +30 -0
  194. package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -0
  195. package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +12 -0
  196. package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -0
  197. package/build-types/custom-select-control-v2/styles.d.ts +31 -6
  198. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  199. package/build-types/custom-select-control-v2/types.d.ts +136 -14
  200. package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
  201. package/build-types/dimension-control/stories/index.story.d.ts +2 -2
  202. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  203. package/build-types/dropdown/stories/index.story.d.ts +3 -3
  204. package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
  205. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
  206. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
  207. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
  208. package/build-types/flex/flex/hook.d.ts +2 -3
  209. package/build-types/flex/flex/hook.d.ts.map +1 -1
  210. package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
  211. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  212. package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
  213. package/build-types/form-token-field/index.d.ts.map +1 -1
  214. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  215. package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
  216. package/build-types/guide/stories/index.story.d.ts +1 -1
  217. package/build-types/h-stack/hook.d.ts +2 -4
  218. package/build-types/h-stack/hook.d.ts.map +1 -1
  219. package/build-types/icon/stories/index.story.d.ts +4 -4
  220. package/build-types/input-control/stories/index.story.d.ts +6 -6
  221. package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
  222. package/build-types/menu-group/stories/index.story.d.ts +1 -1
  223. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  224. package/build-types/modal/index.d.ts.map +1 -1
  225. package/build-types/navigation/stories/index.story.d.ts +6 -6
  226. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
  227. package/build-types/notice/stories/index.story.d.ts +4 -4
  228. package/build-types/number-control/stories/index.story.d.ts +1 -1
  229. package/build-types/palette-edit/stories/index.story.d.ts +2 -2
  230. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  231. package/build-types/query-controls/stories/index.story.d.ts +1 -1
  232. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  233. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  234. package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
  235. package/build-types/sandbox/stories/index.story.d.ts +1 -1
  236. package/build-types/search-control/stories/index.story.d.ts +2 -2
  237. package/build-types/select-control/stories/index.story.d.ts +2 -2
  238. package/build-types/shortcut/stories/index.story.d.ts +1 -1
  239. package/build-types/snackbar/index.d.ts +5 -2
  240. package/build-types/snackbar/index.d.ts.map +1 -1
  241. package/build-types/snackbar/list.d.ts.map +1 -1
  242. package/build-types/snackbar/test/index.d.ts +2 -0
  243. package/build-types/snackbar/test/index.d.ts.map +1 -0
  244. package/build-types/snackbar/test/list.d.ts +2 -0
  245. package/build-types/snackbar/test/list.d.ts.map +1 -0
  246. package/build-types/snackbar/types.d.ts +18 -2
  247. package/build-types/snackbar/types.d.ts.map +1 -1
  248. package/build-types/tab-panel/stories/index.story.d.ts +4 -4
  249. package/build-types/tabs/index.d.ts +1 -1
  250. package/build-types/tabs/stories/index.story.d.ts +9 -9
  251. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  252. package/build-types/tabs/types.d.ts +1 -1
  253. package/build-types/text/stories/index.story.d.ts +3 -3
  254. package/build-types/theme/stories/index.story.d.ts +1 -1
  255. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  256. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  257. package/build-types/toolbar/stories/index.story.d.ts +3 -3
  258. package/build-types/tooltip/stories/index.story.d.ts +1 -1
  259. package/build-types/tree-grid/stories/index.story.d.ts +1 -1
  260. package/build-types/tree-select/stories/index.story.d.ts +1 -1
  261. package/build-types/utils/hooks/index.d.ts +0 -1
  262. package/build-types/utils/with-ignore-ime-events.d.ts +15 -0
  263. package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -0
  264. package/build-types/v-stack/hook.d.ts +2 -4
  265. package/build-types/v-stack/hook.d.ts.map +1 -1
  266. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  267. package/package.json +19 -20
  268. package/src/alignment-matrix-control/test/index.tsx +3 -1
  269. package/src/autocomplete/index.tsx +3 -10
  270. package/src/base-control/index.native.js +1 -1
  271. package/src/base-control/test/index.tsx +1 -1
  272. package/src/border-box-control/border-box-control/component.tsx +1 -1
  273. package/src/border-box-control/border-box-control-split-controls/component.tsx +4 -4
  274. package/src/border-control/border-control-dropdown/component.tsx +1 -1
  275. package/src/button/index.native.js +1 -1
  276. package/src/button/index.tsx +1 -1
  277. package/src/button/style.scss +1 -3
  278. package/src/circular-option-picker/test/index.tsx +6 -5
  279. package/src/color-picker/component.tsx +22 -11
  280. package/src/color-picker/styles.ts +1 -15
  281. package/src/combobox-control/index.tsx +33 -41
  282. package/src/combobox-control/test/index.tsx +1 -1
  283. package/src/composite/legacy/test/index.tsx +18 -2
  284. package/src/confirm-dialog/component.tsx +1 -1
  285. package/src/confirm-dialog/test/index.tsx +5 -21
  286. package/src/custom-select-control/README.md +0 -10
  287. package/src/custom-select-control/index.js +3 -22
  288. package/src/custom-select-control/stories/index.story.js +0 -1
  289. package/src/custom-select-control/test/index.js +17 -17
  290. package/src/custom-select-control-v2/README.md +97 -7
  291. package/src/custom-select-control-v2/custom-select-item.tsx +29 -0
  292. package/src/custom-select-control-v2/custom-select.tsx +122 -0
  293. package/src/custom-select-control-v2/default-component/index.tsx +27 -0
  294. package/src/custom-select-control-v2/index.tsx +2 -102
  295. package/src/custom-select-control-v2/legacy-component/index.tsx +133 -0
  296. package/src/custom-select-control-v2/legacy-component/test/index.tsx +457 -0
  297. package/src/custom-select-control-v2/stories/{index.story.tsx → default.story.tsx} +27 -33
  298. package/src/custom-select-control-v2/stories/legacy.story.tsx +87 -0
  299. package/src/custom-select-control-v2/styles.ts +82 -38
  300. package/src/custom-select-control-v2/test/index.tsx +207 -17
  301. package/src/custom-select-control-v2/types.ts +147 -20
  302. package/src/disabled/test/index.tsx +1 -1
  303. package/src/draggable/index.native.js +2 -2
  304. package/src/draggable/test/index.native.js +6 -2
  305. package/src/dropdown-menu/index.native.js +2 -2
  306. package/src/dropdown-menu-v2/stories/index.story.tsx +1 -0
  307. package/src/dropdown-menu-v2/test/index.tsx +4 -1
  308. package/src/flex/flex/hook.ts +1 -1
  309. package/src/font-size-picker/font-size-picker-select.tsx +0 -1
  310. package/src/font-size-picker/index.native.js +2 -2
  311. package/src/form-token-field/index.tsx +4 -11
  312. package/src/form-token-field/suggestions-list.tsx +5 -17
  313. package/src/h-stack/hook.tsx +2 -1
  314. package/src/h-stack/test/index.tsx +10 -0
  315. package/src/item-group/test/index.js +2 -2
  316. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +10 -15
  317. package/src/mobile/bottom-sheet/button.native.js +1 -5
  318. package/src/mobile/bottom-sheet/index.native.js +2 -2
  319. package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
  320. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -2
  321. package/src/mobile/bottom-sheet-select-control/index.native.js +1 -1
  322. package/src/mobile/bottom-sheet-text-control/index.native.js +1 -1
  323. package/src/mobile/gradient/index.native.js +1 -1
  324. package/src/mobile/image/index.native.js +8 -23
  325. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js +1 -1
  326. package/src/mobile/media-edit/index.native.js +1 -1
  327. package/src/modal/index.tsx +2 -12
  328. package/src/modal/style.scss +1 -0
  329. package/src/modal/test/index.tsx +1 -1
  330. package/src/navigation/stories/utils/hide-if-empty.tsx +2 -6
  331. package/src/palette-edit/index.tsx +2 -2
  332. package/src/popover/test/index.tsx +1 -4
  333. package/src/progress-bar/stories/index.story.tsx +1 -0
  334. package/src/progress-bar/styles.ts +2 -2
  335. package/src/query-controls/index.native.js +2 -2
  336. package/src/radio-group/stories/index.story.tsx +1 -0
  337. package/src/range-control/index.tsx +3 -3
  338. package/src/range-control/test/index.tsx +2 -2
  339. package/src/search-control/index.native.js +1 -1
  340. package/src/snackbar/index.tsx +5 -2
  341. package/src/snackbar/list.tsx +6 -1
  342. package/src/snackbar/stories/list.story.tsx +0 -3
  343. package/src/snackbar/test/index.tsx +267 -0
  344. package/src/snackbar/test/list.tsx +46 -0
  345. package/src/snackbar/types.ts +31 -3
  346. package/src/tab-panel/test/index.tsx +8 -1
  347. package/src/tabs/README.md +18 -18
  348. package/src/tabs/index.tsx +7 -7
  349. package/src/tabs/stories/index.story.tsx +2 -1
  350. package/src/tabs/test/index.tsx +66 -36
  351. package/src/tabs/types.ts +1 -1
  352. package/src/theme/stories/index.story.tsx +1 -0
  353. package/src/toggle-group-control/test/index.tsx +5 -1
  354. package/src/toolbar/toolbar-group/style.scss +1 -0
  355. package/src/tools-panel/stories/index.story.tsx +8 -8
  356. package/src/tools-panel/test/index.tsx +10 -28
  357. package/src/tooltip/style.scss +2 -1
  358. package/src/tooltip/test/index.native.js +3 -3
  359. package/src/tooltip/test/index.tsx +5 -0
  360. package/src/tree-grid/test/index.tsx +1 -1
  361. package/src/utils/hooks/index.js +0 -1
  362. package/src/utils/with-ignore-ime-events.ts +32 -0
  363. package/src/v-stack/test/index.tsx +10 -0
  364. package/tsconfig.json +0 -1
  365. package/tsconfig.tsbuildinfo +1 -1
  366. package/build/custom-select-control/styles.js +0 -27
  367. package/build/custom-select-control/styles.js.map +0 -1
  368. package/build/utils/hooks/use-latest-ref.js +0 -33
  369. package/build/utils/hooks/use-latest-ref.js.map +0 -1
  370. package/build-module/custom-select-control/styles.js +0 -18
  371. package/build-module/custom-select-control/styles.js.map +0 -1
  372. package/build-module/utils/hooks/use-latest-ref.js +0 -27
  373. package/build-module/utils/hooks/use-latest-ref.js.map +0 -1
  374. package/build-types/custom-select-control/styles.d.ts +0 -11
  375. package/build-types/custom-select-control/styles.d.ts.map +0 -1
  376. package/build-types/custom-select-control-v2/stories/index.story.d.ts +0 -20
  377. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +0 -1
  378. package/build-types/utils/hooks/use-latest-ref.d.ts +0 -15
  379. package/build-types/utils/hooks/use-latest-ref.d.ts.map +0 -1
  380. package/src/custom-select-control/styles.ts +0 -28
  381. package/src/utils/hooks/test/use-latest-ref.js +0 -119
  382. package/src/utils/hooks/use-latest-ref.ts +0 -29
@@ -182,10 +182,7 @@ describe( 'Popover', () => {
182
182
  describe( 'focus behavior', () => {
183
183
  it( 'should focus the popover container when opened', async () => {
184
184
  render(
185
- <Popover
186
- focusOnMount={ true }
187
- data-testid="popover-element"
188
- >
185
+ <Popover focusOnMount data-testid="popover-element">
189
186
  Popover content
190
187
  </Popover>
191
188
  );
@@ -14,6 +14,7 @@ const meta: Meta< typeof ProgressBar > = {
14
14
  argTypes: {
15
15
  value: { control: { type: 'number', min: 0, max: 100, step: 1 } },
16
16
  },
17
+ tags: [ 'status-private' ],
17
18
  parameters: {
18
19
  badges: [ 'private' ],
19
20
  controls: {
@@ -30,7 +30,7 @@ export const Track = styled.div`
30
30
  /* Text color at 10% opacity */
31
31
  background-color: color-mix(
32
32
  in srgb,
33
- var( --wp-components-color-foreground, ${ COLORS.gray[ 900 ] } ),
33
+ ${ COLORS.theme.foreground },
34
34
  transparent 90%
35
35
  );
36
36
  border-radius: ${ CONFIG.radiusBlockUi };
@@ -52,7 +52,7 @@ export const Indicator = styled.div< {
52
52
  /* Text color at 90% opacity */
53
53
  background-color: color-mix(
54
54
  in srgb,
55
- var( --wp-components-color-foreground, ${ COLORS.gray[ 900 ] } ),
55
+ ${ COLORS.theme.foreground },
56
56
  transparent 10%
57
57
  );
58
58
 
@@ -69,7 +69,7 @@ const QueryControls = memo(
69
69
  value={ `${ orderBy }/${ order }` }
70
70
  options={ options }
71
71
  onChange={ onChange }
72
- hideCancelButton={ true }
72
+ hideCancelButton
73
73
  />
74
74
  ) }
75
75
  { onCategoryChange && (
@@ -79,7 +79,7 @@ const QueryControls = memo(
79
79
  noOptionLabel={ _x( 'All', 'categories' ) }
80
80
  selectedCategoryId={ selectedCategoryId }
81
81
  onChange={ onCategoryChange }
82
- hideCancelButton={ true }
82
+ hideCancelButton
83
83
  />
84
84
  ) }
85
85
  { onNumberOfItemsChange && (
@@ -16,6 +16,7 @@ import { useState } from '@wordpress/element';
16
16
 
17
17
  const meta: Meta< typeof RadioGroup > = {
18
18
  title: 'Components (Deprecated)/RadioGroup',
19
+ id: 'components-radiogroup',
19
20
  component: RadioGroup,
20
21
  // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
21
22
  subcomponents: { Radio },
@@ -253,7 +253,7 @@ function UnforwardedRangeControl(
253
253
  value={ inputSliderValue ?? undefined }
254
254
  />
255
255
  <RangeRail
256
- aria-hidden={ true }
256
+ aria-hidden
257
257
  disabled={ disabled }
258
258
  marks={ marks }
259
259
  max={ max }
@@ -263,7 +263,7 @@ function UnforwardedRangeControl(
263
263
  value={ rangeFillValue }
264
264
  />
265
265
  <Track
266
- aria-hidden={ true }
266
+ aria-hidden
267
267
  className="components-range-control__track"
268
268
  disabled={ disabled }
269
269
  style={ { width: fillValueOffset } }
@@ -275,7 +275,7 @@ function UnforwardedRangeControl(
275
275
  disabled={ disabled }
276
276
  >
277
277
  <Thumb
278
- aria-hidden={ true }
278
+ aria-hidden
279
279
  isFocused={ isThumbFocused }
280
280
  disabled={ disabled }
281
281
  />
@@ -297,7 +297,7 @@ describe( 'RangeControl', () => {
297
297
  render(
298
298
  <RangeControl
299
299
  initialPosition={ 10 }
300
- allowReset={ true }
300
+ allowReset
301
301
  onChange={ spy }
302
302
  resetFallbackValue={ 33 }
303
303
  />
@@ -320,7 +320,7 @@ describe( 'RangeControl', () => {
320
320
  initialPosition={ undefined }
321
321
  min={ 0 }
322
322
  max={ 100 }
323
- allowReset={ true }
323
+ allowReset
324
324
  resetFallbackValue={ undefined }
325
325
  />
326
326
  );
@@ -235,7 +235,7 @@ function SearchControl( {
235
235
  <Text
236
236
  onPress={ onCancel }
237
237
  style={ cancelButtonTextStyle }
238
- accessible={ true }
238
+ accessible
239
239
  accessibilityRole={ 'button' }
240
240
  accessibilityLabel={ __( 'Cancel search' ) }
241
241
  accessibilityHint={ __( 'Cancel search' ) }
@@ -138,9 +138,12 @@ function UnforwardedSnackbar(
138
138
  className={ classes }
139
139
  onClick={ ! explicitDismiss ? dismissMe : undefined }
140
140
  tabIndex={ 0 }
141
- role={ ! explicitDismiss ? 'button' : '' }
141
+ role={ ! explicitDismiss ? 'button' : undefined }
142
142
  onKeyPress={ ! explicitDismiss ? dismissMe : undefined }
143
- aria-label={ ! explicitDismiss ? __( 'Dismiss this notice' ) : '' }
143
+ aria-label={
144
+ ! explicitDismiss ? __( 'Dismiss this notice' ) : undefined
145
+ }
146
+ data-testid="snackbar"
144
147
  >
145
148
  <div className={ snackbarContentClassnames }>
146
149
  { icon && (
@@ -73,7 +73,12 @@ export function SnackbarList( {
73
73
  ( notice: SnackbarListProps[ 'notices' ][ number ] ) => () =>
74
74
  onRemove?.( notice.id );
75
75
  return (
76
- <div className={ className } tabIndex={ -1 } ref={ listRef }>
76
+ <div
77
+ className={ className }
78
+ tabIndex={ -1 }
79
+ ref={ listRef }
80
+ data-testid="snackbar-list"
81
+ >
77
82
  { children }
78
83
  <AnimatePresence>
79
84
  { notices.map( ( notice ) => {
@@ -70,7 +70,6 @@ Default.args = {
70
70
  },
71
71
  ],
72
72
  content: 'Post published.',
73
- isDismissible: true,
74
73
  explicitDismiss: false,
75
74
  },
76
75
  {
@@ -83,7 +82,6 @@ Default.args = {
83
82
  },
84
83
  ],
85
84
  content: 'Post updated.',
86
- isDismissible: true,
87
85
  explicitDismiss: false,
88
86
  },
89
87
  {
@@ -91,7 +89,6 @@ Default.args = {
91
89
  spokenMessage: 'All content copied.',
92
90
  actions: [],
93
91
  content: 'All content copied.',
94
- isDismissible: true,
95
92
  explicitDismiss: false,
96
93
  },
97
94
  ],
@@ -0,0 +1,267 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen, within } from '@testing-library/react';
5
+ import { click } from '@ariakit/test';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { speak } from '@wordpress/a11y';
11
+ import { SVG, Path } from '@wordpress/primitives';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import Snackbar from '../index';
17
+
18
+ jest.mock( '@wordpress/a11y', () => ( { speak: jest.fn() } ) );
19
+ const mockedSpeak = jest.mocked( speak );
20
+
21
+ describe( 'Snackbar', () => {
22
+ const testId = 'snackbar';
23
+
24
+ beforeEach( () => {
25
+ mockedSpeak.mockReset();
26
+ } );
27
+
28
+ it( 'should render correctly', () => {
29
+ render( <Snackbar>Message</Snackbar> );
30
+
31
+ const snackbar = screen.getByTestId( testId );
32
+
33
+ expect( snackbar ).toBeVisible();
34
+ expect( snackbar ).toHaveTextContent( 'Message' );
35
+ } );
36
+
37
+ it( 'should render with an additional className', () => {
38
+ render( <Snackbar className="gutenberg">Message</Snackbar> );
39
+
40
+ expect( screen.getByTestId( testId ) ).toHaveClass( 'gutenberg' );
41
+ } );
42
+
43
+ it( 'should render with an icon', () => {
44
+ const testIcon = (
45
+ <SVG data-testid="icon">
46
+ <Path />
47
+ </SVG>
48
+ );
49
+
50
+ render( <Snackbar icon={ testIcon }>Message</Snackbar> );
51
+
52
+ const snackbar = screen.getByTestId( testId );
53
+ const icon = within( snackbar ).getByTestId( 'icon' );
54
+
55
+ expect( icon ).toBeVisible();
56
+ } );
57
+
58
+ it( 'should be dismissible by clicking the snackbar', async () => {
59
+ const onRemove = jest.fn();
60
+ const onDismiss = jest.fn();
61
+
62
+ render(
63
+ <Snackbar onRemove={ onRemove } onDismiss={ onDismiss }>
64
+ Message
65
+ </Snackbar>
66
+ );
67
+
68
+ const snackbar = screen.getByTestId( testId );
69
+
70
+ expect( snackbar ).toHaveAttribute( 'role', 'button' );
71
+ expect( snackbar ).toHaveAttribute(
72
+ 'aria-label',
73
+ 'Dismiss this notice'
74
+ );
75
+
76
+ await click( snackbar );
77
+
78
+ expect( onRemove ).toHaveBeenCalledTimes( 1 );
79
+ expect( onDismiss ).toHaveBeenCalledTimes( 1 );
80
+ } );
81
+
82
+ it( 'should not be dismissible by clicking the snackbar when the `explicitDismiss` prop is set to `true`', async () => {
83
+ const onRemove = jest.fn();
84
+ const onDismiss = jest.fn();
85
+
86
+ render(
87
+ <Snackbar
88
+ explicitDismiss
89
+ onRemove={ onRemove }
90
+ onDismiss={ onDismiss }
91
+ >
92
+ Message
93
+ </Snackbar>
94
+ );
95
+
96
+ const snackbar = screen.getByTestId( testId );
97
+
98
+ expect( snackbar ).not.toHaveAttribute( 'role', 'button' );
99
+ expect( snackbar ).not.toHaveAttribute(
100
+ 'aria-label',
101
+ 'Dismiss this notice'
102
+ );
103
+ expect( snackbar ).toHaveClass(
104
+ 'components-snackbar-explicit-dismiss'
105
+ );
106
+
107
+ await click( snackbar );
108
+
109
+ expect( onRemove ).not.toHaveBeenCalled();
110
+ expect( onDismiss ).not.toHaveBeenCalled();
111
+ } );
112
+
113
+ it( 'should be dismissible by clicking the close button when the `explicitDismiss` prop is set to `true`', async () => {
114
+ const onRemove = jest.fn();
115
+ const onDismiss = jest.fn();
116
+
117
+ render(
118
+ <Snackbar
119
+ explicitDismiss
120
+ onRemove={ onRemove }
121
+ onDismiss={ onDismiss }
122
+ >
123
+ Message
124
+ </Snackbar>
125
+ );
126
+
127
+ const snackbar = screen.getByTestId( testId );
128
+ const closeButton = within( snackbar ).getByRole( 'button', {
129
+ name: 'Dismiss this notice',
130
+ } );
131
+
132
+ await click( closeButton );
133
+
134
+ expect( onRemove ).toHaveBeenCalledTimes( 1 );
135
+ expect( onDismiss ).toHaveBeenCalledTimes( 1 );
136
+ } );
137
+
138
+ describe( 'actions', () => {
139
+ it( 'should render only the first action with a warning when multiple actions are passed', () => {
140
+ render(
141
+ <Snackbar
142
+ actions={ [
143
+ { label: 'One', url: 'https://example.com' },
144
+ { label: 'Two', url: 'https://example.com' },
145
+ { label: 'Three', url: 'https://example.com' },
146
+ ] }
147
+ >
148
+ Message
149
+ </Snackbar>
150
+ );
151
+
152
+ expect( console ).toHaveWarnedWith(
153
+ 'Snackbar can only have one action. Use Notice if your message requires many actions.'
154
+ );
155
+
156
+ const snackbar = screen.getByTestId( testId );
157
+ const action = within( snackbar ).getByRole( 'link' );
158
+
159
+ expect( action ).toBeVisible();
160
+ expect( action ).toHaveTextContent( 'One' );
161
+ } );
162
+
163
+ it( 'should be rendered as a link when the `url` prop is set', () => {
164
+ render(
165
+ <Snackbar
166
+ actions={ [
167
+ { label: 'View post', url: 'https://example.com' },
168
+ ] }
169
+ >
170
+ Post updated.
171
+ </Snackbar>
172
+ );
173
+
174
+ const snackbar = screen.getByTestId( testId );
175
+ const link = within( snackbar ).getByRole( 'link', {
176
+ name: 'View post',
177
+ } );
178
+
179
+ expect( link ).toHaveAttribute( 'href', 'https://example.com' );
180
+ } );
181
+
182
+ it( 'should be rendered as a button and call `onClick` when the `onClick` prop is set', async () => {
183
+ const onClick = jest.fn();
184
+
185
+ render(
186
+ <Snackbar actions={ [ { label: 'View post', onClick } ] }>
187
+ Post updated.
188
+ </Snackbar>
189
+ );
190
+
191
+ const snackbar = screen.getByTestId( testId );
192
+ const button = within( snackbar ).getByRole( 'button', {
193
+ name: 'View post',
194
+ } );
195
+
196
+ await click( button );
197
+
198
+ expect( onClick ).toHaveBeenCalledTimes( 1 );
199
+ } );
200
+
201
+ it( 'should be rendered as a link when the `url` prop and the `onClick` are set', () => {
202
+ render(
203
+ <Snackbar
204
+ actions={ [
205
+ {
206
+ label: 'View post',
207
+ url: 'https://example.com',
208
+ onClick: () => {},
209
+ },
210
+ ] }
211
+ >
212
+ Post updated.
213
+ </Snackbar>
214
+ );
215
+
216
+ const snackbar = screen.getByTestId( testId );
217
+ const link = within( snackbar ).getByRole( 'link', {
218
+ name: 'View post',
219
+ } );
220
+ expect( link ).toBeVisible();
221
+ } );
222
+ } );
223
+
224
+ describe( 'useSpokenMessage', () => {
225
+ it( 'should speak the given message', () => {
226
+ render( <Snackbar>FYI</Snackbar> );
227
+
228
+ expect( speak ).toHaveBeenCalledWith( 'FYI', 'polite' );
229
+ } );
230
+
231
+ it( 'should speak the given message by explicit politeness', () => {
232
+ render( <Snackbar politeness="assertive">Uh oh!</Snackbar> );
233
+
234
+ expect( speak ).toHaveBeenCalledWith( 'Uh oh!', 'assertive' );
235
+ } );
236
+
237
+ it( 'should coerce a message to a string', () => {
238
+ // This test assumes that `@wordpress/a11y` is capable of handling
239
+ // markup strings appropriately.
240
+ render(
241
+ <Snackbar>
242
+ With <em>emphasis</em> this time.
243
+ </Snackbar>
244
+ );
245
+
246
+ expect( speak ).toHaveBeenCalledWith(
247
+ 'With <em>emphasis</em> this time.',
248
+ 'polite'
249
+ );
250
+ } );
251
+
252
+ it( 'should not re-speak an effectively equivalent element message', () => {
253
+ const { rerender } = render(
254
+ <Snackbar>
255
+ With <em>emphasis</em> this time.
256
+ </Snackbar>
257
+ );
258
+ rerender(
259
+ <Snackbar>
260
+ With <em>emphasis</em> this time.
261
+ </Snackbar>
262
+ );
263
+
264
+ expect( speak ).toHaveBeenCalledTimes( 1 );
265
+ } );
266
+ } );
267
+ } );
@@ -0,0 +1,46 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+ import { click } from '@ariakit/test';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import SnackbarList from '../list';
11
+
12
+ window.scrollTo = jest.fn();
13
+
14
+ describe( 'SnackbarList', () => {
15
+ afterEach( () => {
16
+ jest.resetAllMocks();
17
+ } );
18
+
19
+ it( 'should get focus after a snackbar is dismissed', async () => {
20
+ render(
21
+ <SnackbarList
22
+ notices={ [
23
+ {
24
+ id: 'ID_1',
25
+ content: 'Post published.',
26
+ explicitDismiss: true,
27
+ },
28
+ {
29
+ id: 'ID_2',
30
+ content: 'Post updated.',
31
+ explicitDismiss: true,
32
+ },
33
+ ] }
34
+ onRemove={ () => {} }
35
+ />
36
+ );
37
+
38
+ await click(
39
+ screen.getAllByRole( 'button', {
40
+ name: 'Dismiss this notice',
41
+ } )[ 0 ]
42
+ );
43
+
44
+ expect( screen.getByTestId( 'snackbar-list' ) ).toHaveFocus();
45
+ } );
46
+ } );
@@ -6,7 +6,11 @@ import type { MutableRefObject, ReactNode } from 'react';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import type { NoticeProps, NoticeChildren } from '../notice/types';
9
+ import type {
10
+ NoticeProps,
11
+ NoticeChildren,
12
+ NoticeAction,
13
+ } from '../notice/types';
10
14
 
11
15
  type SnackbarOnlyProps = {
12
16
  /**
@@ -28,8 +32,32 @@ type SnackbarOnlyProps = {
28
32
  listRef?: MutableRefObject< HTMLDivElement | null >;
29
33
  };
30
34
 
31
- export type SnackbarProps = Omit< NoticeProps, '__unstableHTML' > &
32
- SnackbarOnlyProps;
35
+ export type SnackbarProps = Pick<
36
+ NoticeProps,
37
+ | 'className'
38
+ | 'children'
39
+ | 'spokenMessage'
40
+ | 'onRemove'
41
+ | 'politeness'
42
+ | 'onDismiss'
43
+ > &
44
+ SnackbarOnlyProps & {
45
+ /**
46
+ * An array of action objects. Each member object should contain:
47
+ *
48
+ * - `label`: `string` containing the text of the button/link
49
+ * - `url`: `string` OR `onClick`: `( event: SyntheticEvent ) => void` to specify
50
+ * what the action does.
51
+ *
52
+ * The default appearance of an action button is inferred based on whether
53
+ * `url` or `onClick` are provided, rendering the button as a link if
54
+ * appropriate. If both props are provided, `url` takes precedence, and the
55
+ * action button will render as an anchor tag.
56
+ *
57
+ * @default []
58
+ */
59
+ actions?: Pick< NoticeAction, 'label' | 'url' | 'onClick' >[];
60
+ };
33
61
 
34
62
  export type SnackbarListProps = {
35
63
  notices: Array<
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { render, screen, waitFor } from '@testing-library/react';
5
- import { press, hover, click } from '@ariakit/test';
5
+ import { press, hover, click, sleep } from '@ariakit/test';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -155,6 +155,7 @@ describe.each( [
155
155
  // Tab to focus the tablist. Make sure alpha is focused, and that the
156
156
  // corresponding tooltip is shown.
157
157
  expect( screen.queryByText( 'Alpha' ) ).not.toBeInTheDocument();
158
+ await sleep();
158
159
  await press.Tab();
159
160
  expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
160
161
  expect( screen.getByText( 'Alpha' ) ).toBeInTheDocument();
@@ -626,6 +627,7 @@ describe.each( [
626
627
  // Tab to focus the tablist. Make sure alpha is focused.
627
628
  expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
628
629
  expect( await getSelectedTab() ).not.toHaveFocus();
630
+ await sleep();
629
631
  await press.Tab();
630
632
  expect( await getSelectedTab() ).toHaveFocus();
631
633
 
@@ -663,6 +665,7 @@ describe.each( [
663
665
  // Tab to focus the tablist. Make sure Alpha is focused.
664
666
  expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
665
667
  expect( await getSelectedTab() ).not.toHaveFocus();
668
+ await sleep();
666
669
  await press.Tab();
667
670
  expect( await getSelectedTab() ).toHaveFocus();
668
671
 
@@ -700,6 +703,7 @@ describe.each( [
700
703
  // Tab to focus the tablist. Make sure alpha is focused.
701
704
  expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
702
705
  expect( await getSelectedTab() ).not.toHaveFocus();
706
+ await sleep();
703
707
  await press.Tab();
704
708
  expect( await getSelectedTab() ).toHaveFocus();
705
709
 
@@ -795,6 +799,7 @@ describe.each( [
795
799
  // Tab to focus the tablist. Make sure Alpha is focused.
796
800
  expect( await getSelectedTab() ).toHaveTextContent( 'Alpha' );
797
801
  expect( await getSelectedTab() ).not.toHaveFocus();
802
+ await sleep();
798
803
  await press.Tab();
799
804
  expect( await getSelectedTab() ).toHaveFocus();
800
805
  expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
@@ -836,6 +841,7 @@ describe.each( [
836
841
 
837
842
  // Tab should initially focus the first tab in the tablist, which
838
843
  // is Alpha.
844
+ await sleep();
839
845
  await press.Tab();
840
846
  expect(
841
847
  await screen.findByRole( 'tab', { name: 'Alpha' } )
@@ -843,6 +849,7 @@ describe.each( [
843
849
 
844
850
  // Because all other tabs should have `tabindex=-1`, pressing Tab
845
851
  // should NOT move the focus to the next tab, which is Beta.
852
+ await sleep();
846
853
  await press.Tab();
847
854
  expect(
848
855
  await screen.findByRole( 'tab', { name: 'Beta' } )