@wordpress/components 28.2.0 → 28.3.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 (424) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/build/animation/index.js.map +1 -1
  3. package/build/autocomplete/autocompleter-ui.js +1 -0
  4. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  5. package/build/autocomplete/index.js.map +1 -1
  6. package/build/base-control/index.js +14 -7
  7. package/build/base-control/index.js.map +1 -1
  8. package/build/border-box-control/border-box-control-visualizer/component.js +0 -4
  9. package/build/border-box-control/border-box-control-visualizer/component.js.map +1 -1
  10. package/build/button/index.js +5 -3
  11. package/build/button/index.js.map +1 -1
  12. package/build/button/types.js.map +1 -1
  13. package/build/combobox-control/index.js +4 -1
  14. package/build/combobox-control/index.js.map +1 -1
  15. package/build/composite/current/index.js.map +1 -1
  16. package/build/custom-select-control-v2/custom-select.js +57 -33
  17. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  18. package/build/custom-select-control-v2/default-component/index.js +0 -1
  19. package/build/custom-select-control-v2/default-component/index.js.map +1 -1
  20. package/build/custom-select-control-v2/item.js +2 -0
  21. package/build/custom-select-control-v2/item.js.map +1 -1
  22. package/build/custom-select-control-v2/legacy-component/index.js +18 -6
  23. package/build/custom-select-control-v2/legacy-component/index.js.map +1 -1
  24. package/build/custom-select-control-v2/styles.js +90 -78
  25. package/build/custom-select-control-v2/styles.js.map +1 -1
  26. package/build/custom-select-control-v2/types.js.map +1 -1
  27. package/build/date-time/date-time/index.js +3 -1
  28. package/build/date-time/date-time/index.js.map +1 -1
  29. package/build/date-time/index.js +7 -0
  30. package/build/date-time/index.js.map +1 -1
  31. package/build/date-time/time/index.js +62 -145
  32. package/build/date-time/time/index.js.map +1 -1
  33. package/build/date-time/time-input/index.js +159 -0
  34. package/build/date-time/time-input/index.js.map +1 -0
  35. package/build/date-time/types.js.map +1 -1
  36. package/build/date-time/utils.js +64 -0
  37. package/build/date-time/utils.js.map +1 -1
  38. package/build/disclosure/index.js +0 -1
  39. package/build/disclosure/index.js.map +1 -1
  40. package/build/divider/component.js +0 -1
  41. package/build/divider/component.js.map +1 -1
  42. package/build/divider/types.js.map +1 -1
  43. package/build/dropdown-menu/index.js +1 -0
  44. package/build/dropdown-menu/index.js.map +1 -1
  45. package/build/dropdown-menu-v2/index.js +0 -1
  46. package/build/dropdown-menu-v2/index.js.map +1 -1
  47. package/build/dropdown-menu-v2/styles.js +15 -16
  48. package/build/dropdown-menu-v2/styles.js.map +1 -1
  49. package/build/dropdown-menu-v2/types.js.map +1 -1
  50. package/build/font-size-picker/font-size-picker-select.js +2 -2
  51. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  52. package/build/font-size-picker/index.js +1 -1
  53. package/build/font-size-picker/index.js.map +1 -1
  54. package/build/font-size-picker/utils.js +0 -4
  55. package/build/font-size-picker/utils.js.map +1 -1
  56. package/build/form-token-field/token.js +4 -1
  57. package/build/form-token-field/token.js.map +1 -1
  58. package/build/higher-order/with-spoken-messages/index.js +1 -2
  59. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  60. package/build/menu-items-choice/types.js.map +1 -1
  61. package/build/popover/index.js +0 -4
  62. package/build/popover/index.js.map +1 -1
  63. package/build/popover/utils.js +0 -1
  64. package/build/popover/utils.js.map +1 -1
  65. package/build/private-apis.js +2 -4
  66. package/build/private-apis.js.map +1 -1
  67. package/build/progress-bar/styles.js +19 -13
  68. package/build/progress-bar/styles.js.map +1 -1
  69. package/build/radio-group/context.js +0 -1
  70. package/build/radio-group/context.js.map +1 -1
  71. package/build/radio-group/index.js +0 -1
  72. package/build/radio-group/index.js.map +1 -1
  73. package/build/radio-group/radio.js +0 -1
  74. package/build/radio-group/radio.js.map +1 -1
  75. package/build/range-control/index.js +4 -1
  76. package/build/range-control/index.js.map +1 -1
  77. package/build/range-control/styles/range-control-styles.js +34 -28
  78. package/build/range-control/styles/range-control-styles.js.map +1 -1
  79. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  80. package/build/select-control/index.js +1 -2
  81. package/build/select-control/index.js.map +1 -1
  82. package/build/select-control/styles/select-control-styles.js +13 -8
  83. package/build/select-control/styles/select-control-styles.js.map +1 -1
  84. package/build/tab-panel/index.js +0 -1
  85. package/build/tab-panel/index.js.map +1 -1
  86. package/build/tabs/index.js +0 -1
  87. package/build/tabs/index.js.map +1 -1
  88. package/build/tabs/styles.js +3 -5
  89. package/build/tabs/styles.js.map +1 -1
  90. package/build/tabs/tablist.js +148 -37
  91. package/build/tabs/tablist.js.map +1 -1
  92. package/build/tabs/types.js.map +1 -1
  93. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +0 -2
  94. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  95. package/build/toggle-group-control/toggle-group-control/component.js +0 -2
  96. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  97. package/build/toggle-group-control/toggle-group-control-option-base/component.js +0 -4
  98. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  99. package/build/toolbar/toolbar/toolbar-container.js +0 -1
  100. package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
  101. package/build/toolbar/toolbar/types.js.map +1 -1
  102. package/build/toolbar/toolbar-button/index.js +27 -19
  103. package/build/toolbar/toolbar-button/index.js.map +1 -1
  104. package/build/toolbar/toolbar-button/types.js.map +1 -1
  105. package/build/toolbar/toolbar-context/index.js +0 -1
  106. package/build/toolbar/toolbar-context/index.js.map +1 -1
  107. package/build/toolbar/toolbar-item/index.js +1 -1
  108. package/build/toolbar/toolbar-item/index.js.map +1 -1
  109. package/build/tooltip/index.js +3 -2
  110. package/build/tooltip/index.js.map +1 -1
  111. package/build/tooltip/types.js.map +1 -1
  112. package/build/unit-control/index.js +3 -3
  113. package/build/unit-control/index.js.map +1 -1
  114. package/build/unit-control/styles/unit-control-styles.js +7 -7
  115. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  116. package/build/utils/hooks/use-update-effect.js +4 -1
  117. package/build/utils/hooks/use-update-effect.js.map +1 -1
  118. package/build-module/animation/index.js +0 -1
  119. package/build-module/animation/index.js.map +1 -1
  120. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  121. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  122. package/build-module/autocomplete/index.js.map +1 -1
  123. package/build-module/base-control/index.js +13 -6
  124. package/build-module/base-control/index.js.map +1 -1
  125. package/build-module/border-box-control/border-box-control-visualizer/component.js +0 -4
  126. package/build-module/border-box-control/border-box-control-visualizer/component.js.map +1 -1
  127. package/build-module/button/index.js +5 -3
  128. package/build-module/button/index.js.map +1 -1
  129. package/build-module/button/types.js.map +1 -1
  130. package/build-module/combobox-control/index.js +4 -1
  131. package/build-module/combobox-control/index.js.map +1 -1
  132. package/build-module/composite/current/index.js +0 -3
  133. package/build-module/composite/current/index.js.map +1 -1
  134. package/build-module/custom-select-control-v2/custom-select.js +58 -35
  135. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  136. package/build-module/custom-select-control-v2/default-component/index.js +0 -1
  137. package/build-module/custom-select-control-v2/default-component/index.js.map +1 -1
  138. package/build-module/custom-select-control-v2/item.js +2 -0
  139. package/build-module/custom-select-control-v2/item.js.map +1 -1
  140. package/build-module/custom-select-control-v2/legacy-component/index.js +18 -6
  141. package/build-module/custom-select-control-v2/legacy-component/index.js.map +1 -1
  142. package/build-module/custom-select-control-v2/styles.js +88 -76
  143. package/build-module/custom-select-control-v2/styles.js.map +1 -1
  144. package/build-module/custom-select-control-v2/types.js.map +1 -1
  145. package/build-module/date-time/date-time/index.js +4 -1
  146. package/build-module/date-time/date-time/index.js.map +1 -1
  147. package/build-module/date-time/index.js +2 -1
  148. package/build-module/date-time/index.js.map +1 -1
  149. package/build-module/date-time/time/index.js +65 -149
  150. package/build-module/date-time/time/index.js.map +1 -1
  151. package/build-module/date-time/time-input/index.js +151 -0
  152. package/build-module/date-time/time-input/index.js.map +1 -0
  153. package/build-module/date-time/types.js.map +1 -1
  154. package/build-module/date-time/utils.js +61 -0
  155. package/build-module/date-time/utils.js.map +1 -1
  156. package/build-module/disclosure/index.js +0 -1
  157. package/build-module/disclosure/index.js.map +1 -1
  158. package/build-module/divider/component.js +0 -1
  159. package/build-module/divider/component.js.map +1 -1
  160. package/build-module/divider/types.js.map +1 -1
  161. package/build-module/dropdown-menu/index.js +1 -0
  162. package/build-module/dropdown-menu/index.js.map +1 -1
  163. package/build-module/dropdown-menu-v2/index.js +0 -1
  164. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  165. package/build-module/dropdown-menu-v2/styles.js +14 -15
  166. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  167. package/build-module/dropdown-menu-v2/types.js.map +1 -1
  168. package/build-module/font-size-picker/font-size-picker-select.js +1 -1
  169. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  170. package/build-module/font-size-picker/index.js +1 -1
  171. package/build-module/font-size-picker/index.js.map +1 -1
  172. package/build-module/font-size-picker/utils.js +0 -4
  173. package/build-module/font-size-picker/utils.js.map +1 -1
  174. package/build-module/form-token-field/token.js +4 -1
  175. package/build-module/form-token-field/token.js.map +1 -1
  176. package/build-module/higher-order/with-spoken-messages/index.js +1 -2
  177. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  178. package/build-module/menu-items-choice/types.js.map +1 -1
  179. package/build-module/popover/index.js +0 -3
  180. package/build-module/popover/index.js.map +1 -1
  181. package/build-module/popover/utils.js +0 -1
  182. package/build-module/popover/utils.js.map +1 -1
  183. package/build-module/private-apis.js +2 -4
  184. package/build-module/private-apis.js.map +1 -1
  185. package/build-module/progress-bar/styles.js +21 -13
  186. package/build-module/progress-bar/styles.js.map +1 -1
  187. package/build-module/radio-group/context.js +0 -1
  188. package/build-module/radio-group/context.js.map +1 -1
  189. package/build-module/radio-group/index.js +0 -1
  190. package/build-module/radio-group/index.js.map +1 -1
  191. package/build-module/radio-group/radio.js +0 -1
  192. package/build-module/radio-group/radio.js.map +1 -1
  193. package/build-module/range-control/index.js +4 -1
  194. package/build-module/range-control/index.js.map +1 -1
  195. package/build-module/range-control/styles/range-control-styles.js +34 -28
  196. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  197. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  198. package/build-module/select-control/index.js +2 -3
  199. package/build-module/select-control/index.js.map +1 -1
  200. package/build-module/select-control/styles/select-control-styles.js +12 -7
  201. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  202. package/build-module/tab-panel/index.js +0 -1
  203. package/build-module/tab-panel/index.js.map +1 -1
  204. package/build-module/tabs/index.js +0 -1
  205. package/build-module/tabs/index.js.map +1 -1
  206. package/build-module/tabs/styles.js +3 -4
  207. package/build-module/tabs/styles.js.map +1 -1
  208. package/build-module/tabs/tablist.js +149 -38
  209. package/build-module/tabs/tablist.js.map +1 -1
  210. package/build-module/tabs/types.js.map +1 -1
  211. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +0 -1
  212. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  213. package/build-module/toggle-group-control/toggle-group-control/component.js +0 -1
  214. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  215. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +0 -2
  216. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  217. package/build-module/toolbar/toolbar/toolbar-container.js +0 -1
  218. package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
  219. package/build-module/toolbar/toolbar/types.js.map +1 -1
  220. package/build-module/toolbar/toolbar-button/index.js +27 -19
  221. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  222. package/build-module/toolbar/toolbar-button/types.js.map +1 -1
  223. package/build-module/toolbar/toolbar-context/index.js +0 -1
  224. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  225. package/build-module/toolbar/toolbar-item/index.js +1 -1
  226. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  227. package/build-module/tooltip/index.js +3 -2
  228. package/build-module/tooltip/index.js.map +1 -1
  229. package/build-module/tooltip/types.js.map +1 -1
  230. package/build-module/unit-control/index.js +3 -3
  231. package/build-module/unit-control/index.js.map +1 -1
  232. package/build-module/unit-control/styles/unit-control-styles.js +7 -7
  233. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  234. package/build-module/utils/hooks/use-update-effect.js +4 -1
  235. package/build-module/utils/hooks/use-update-effect.js.map +1 -1
  236. package/build-style/style-rtl.css +18 -0
  237. package/build-style/style.css +18 -0
  238. package/build-types/animation/index.d.ts.map +1 -1
  239. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  240. package/build-types/autocomplete/index.d.ts.map +1 -1
  241. package/build-types/base-control/index.d.ts +6 -20
  242. package/build-types/base-control/index.d.ts.map +1 -1
  243. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  244. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  245. package/build-types/button/deprecated.d.ts +4 -4
  246. package/build-types/button/index.d.ts.map +1 -1
  247. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  248. package/build-types/button/types.d.ts +27 -10
  249. package/build-types/button/types.d.ts.map +1 -1
  250. package/build-types/combobox-control/index.d.ts.map +1 -1
  251. package/build-types/composite/current/index.d.ts.map +1 -1
  252. package/build-types/custom-select-control-v2/custom-select.d.ts +2 -2
  253. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  254. package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
  255. package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
  256. package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
  257. package/build-types/custom-select-control-v2/stories/default.story.d.ts +6 -3
  258. package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
  259. package/build-types/custom-select-control-v2/styles.d.ts +18 -26
  260. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  261. package/build-types/custom-select-control-v2/types.d.ts +12 -2
  262. package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
  263. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  264. package/build-types/date-time/index.d.ts +2 -1
  265. package/build-types/date-time/index.d.ts.map +1 -1
  266. package/build-types/date-time/stories/time-input.story.d.ts +12 -0
  267. package/build-types/date-time/stories/time-input.story.d.ts.map +1 -0
  268. package/build-types/date-time/time/index.d.ts +1 -1
  269. package/build-types/date-time/time/index.d.ts.map +1 -1
  270. package/build-types/date-time/time-input/index.d.ts +5 -0
  271. package/build-types/date-time/time-input/index.d.ts.map +1 -0
  272. package/build-types/date-time/time-input/test/index.d.ts +2 -0
  273. package/build-types/date-time/time-input/test/index.d.ts.map +1 -0
  274. package/build-types/date-time/types.d.ts +54 -0
  275. package/build-types/date-time/types.d.ts.map +1 -1
  276. package/build-types/date-time/utils.d.ts +40 -0
  277. package/build-types/date-time/utils.d.ts.map +1 -1
  278. package/build-types/disclosure/index.d.ts.map +1 -1
  279. package/build-types/divider/component.d.ts.map +1 -1
  280. package/build-types/divider/types.d.ts.map +1 -1
  281. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  282. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
  283. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
  284. package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
  285. package/build-types/font-size-picker/styles.d.ts +1 -1
  286. package/build-types/font-size-picker/utils.d.ts.map +1 -1
  287. package/build-types/form-token-field/token.d.ts.map +1 -1
  288. package/build-types/higher-order/with-spoken-messages/index.d.ts +1 -2
  289. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  290. package/build-types/menu-items-choice/types.d.ts +1 -1
  291. package/build-types/menu-items-choice/types.d.ts.map +1 -1
  292. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  293. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  294. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  295. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  296. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
  297. package/build-types/popover/index.d.ts.map +1 -1
  298. package/build-types/popover/utils.d.ts.map +1 -1
  299. package/build-types/private-apis.d.ts.map +1 -1
  300. package/build-types/progress-bar/styles.d.ts.map +1 -1
  301. package/build-types/radio-group/context.d.ts.map +1 -1
  302. package/build-types/radio-group/index.d.ts.map +1 -1
  303. package/build-types/radio-group/radio.d.ts.map +1 -1
  304. package/build-types/range-control/index.d.ts.map +1 -1
  305. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  306. package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
  307. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  308. package/build-types/select-control/index.d.ts.map +1 -1
  309. package/build-types/select-control/styles/select-control-styles.d.ts +5 -0
  310. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  311. package/build-types/tab-panel/index.d.ts.map +1 -1
  312. package/build-types/tabs/index.d.ts.map +1 -1
  313. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  314. package/build-types/tabs/styles.d.ts.map +1 -1
  315. package/build-types/tabs/tablist.d.ts.map +1 -1
  316. package/build-types/tabs/types.d.ts.map +1 -1
  317. package/build-types/theme/stories/index.story.d.ts.map +1 -1
  318. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  319. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  320. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  321. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
  322. package/build-types/toolbar/toolbar/types.d.ts +6 -0
  323. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  324. package/build-types/toolbar/toolbar-button/index.d.ts +3 -96
  325. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  326. package/build-types/toolbar/toolbar-button/types.d.ts +18 -0
  327. package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -1
  328. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  329. package/build-types/toolbar/toolbar-item/index.d.ts +1 -3
  330. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  331. package/build-types/tooltip/index.d.ts.map +1 -1
  332. package/build-types/tooltip/types.d.ts +4 -0
  333. package/build-types/tooltip/types.d.ts.map +1 -1
  334. package/build-types/unit-control/index.d.ts.map +1 -1
  335. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  336. package/build-types/utils/hooks/use-update-effect.d.ts +1 -1
  337. package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
  338. package/package.json +19 -19
  339. package/src/animation/index.tsx +0 -1
  340. package/src/autocomplete/autocompleter-ui.tsx +1 -0
  341. package/src/autocomplete/index.tsx +0 -1
  342. package/src/base-control/index.tsx +16 -6
  343. package/src/base-control/stories/index.story.tsx +0 -1
  344. package/src/border-box-control/border-box-control-visualizer/component.tsx +0 -5
  345. package/src/button/README.md +13 -0
  346. package/src/button/index.tsx +6 -4
  347. package/src/button/stories/e2e/index.story.tsx +2 -1
  348. package/src/button/test/index.tsx +17 -2
  349. package/src/button/types.ts +27 -10
  350. package/src/combobox-control/index.tsx +2 -0
  351. package/src/composite/current/index.ts +0 -2
  352. package/src/custom-select-control/test/index.js +42 -6
  353. package/src/custom-select-control-v2/custom-select.tsx +57 -22
  354. package/src/custom-select-control-v2/default-component/index.tsx +0 -1
  355. package/src/custom-select-control-v2/item.tsx +5 -1
  356. package/src/custom-select-control-v2/legacy-component/index.tsx +28 -7
  357. package/src/custom-select-control-v2/legacy-component/test/index.tsx +44 -8
  358. package/src/custom-select-control-v2/styles.ts +153 -83
  359. package/src/custom-select-control-v2/test/index.tsx +35 -5
  360. package/src/custom-select-control-v2/types.ts +18 -6
  361. package/src/date-time/README.md +8 -0
  362. package/src/date-time/date-time/index.tsx +2 -1
  363. package/src/date-time/index.ts +2 -1
  364. package/src/date-time/stories/time-input.story.tsx +36 -0
  365. package/src/date-time/time/index.tsx +77 -194
  366. package/src/date-time/time/test/index.tsx +61 -0
  367. package/src/date-time/time-input/index.tsx +196 -0
  368. package/src/date-time/time-input/test/index.tsx +171 -0
  369. package/src/date-time/types.ts +63 -0
  370. package/src/date-time/utils.ts +69 -0
  371. package/src/dimension-control/test/__snapshots__/index.test.js.snap +116 -96
  372. package/src/disclosure/index.tsx +0 -1
  373. package/src/divider/component.tsx +0 -1
  374. package/src/divider/types.ts +0 -1
  375. package/src/dropdown-menu/index.tsx +1 -0
  376. package/src/dropdown-menu-v2/index.tsx +0 -1
  377. package/src/dropdown-menu-v2/styles.ts +0 -1
  378. package/src/dropdown-menu-v2/types.ts +0 -1
  379. package/src/font-size-picker/font-size-picker-select.tsx +1 -1
  380. package/src/font-size-picker/index.tsx +1 -1
  381. package/src/font-size-picker/test/index.tsx +6 -6
  382. package/src/font-size-picker/utils.ts +0 -5
  383. package/src/form-token-field/token.tsx +2 -0
  384. package/src/higher-order/navigate-regions/style.scss +25 -13
  385. package/src/higher-order/with-spoken-messages/index.tsx +1 -2
  386. package/src/menu-items-choice/types.ts +2 -1
  387. package/src/palette-edit/test/index.tsx +1 -0
  388. package/src/popover/index.tsx +0 -2
  389. package/src/popover/utils.ts +0 -1
  390. package/src/private-apis.ts +2 -5
  391. package/src/progress-bar/styles.ts +18 -9
  392. package/src/radio-group/context.tsx +0 -1
  393. package/src/radio-group/index.tsx +0 -1
  394. package/src/radio-group/radio.tsx +0 -1
  395. package/src/range-control/index.tsx +2 -0
  396. package/src/range-control/styles/range-control-styles.ts +6 -2
  397. package/src/resizable-box/resize-tooltip/utils.ts +1 -1
  398. package/src/select-control/index.tsx +3 -4
  399. package/src/select-control/styles/select-control-styles.ts +17 -6
  400. package/src/tab-panel/index.tsx +0 -1
  401. package/src/tabs/index.tsx +0 -1
  402. package/src/tabs/stories/index.story.tsx +25 -18
  403. package/src/tabs/styles.ts +18 -14
  404. package/src/tabs/tablist.tsx +187 -43
  405. package/src/tabs/types.ts +0 -1
  406. package/src/theme/stories/index.story.tsx +2 -0
  407. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +0 -1
  408. package/src/toggle-group-control/toggle-group-control/component.tsx +0 -2
  409. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +0 -2
  410. package/src/toolbar/toolbar/README.md +9 -0
  411. package/src/toolbar/toolbar/style.scss +7 -0
  412. package/src/toolbar/toolbar/toolbar-container.tsx +0 -1
  413. package/src/toolbar/toolbar/types.ts +6 -0
  414. package/src/toolbar/toolbar-button/index.tsx +30 -17
  415. package/src/toolbar/toolbar-button/types.ts +19 -0
  416. package/src/toolbar/toolbar-context/index.ts +0 -1
  417. package/src/toolbar/toolbar-item/index.tsx +1 -1
  418. package/src/tooltip/index.tsx +3 -2
  419. package/src/tooltip/test/index.tsx +18 -0
  420. package/src/tooltip/types.ts +4 -0
  421. package/src/unit-control/index.tsx +3 -2
  422. package/src/unit-control/styles/unit-control-styles.ts +10 -4
  423. package/src/utils/hooks/use-update-effect.js +8 -1
  424. package/tsconfig.tsbuildinfo +1 -1
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
5
4
  import * as Ariakit from '@ariakit/react';
6
5
 
7
6
  /**
@@ -10,8 +9,9 @@ import * as Ariakit from '@ariakit/react';
10
9
  import warning from '@wordpress/warning';
11
10
  import {
12
11
  forwardRef,
12
+ useCallback,
13
13
  useEffect,
14
- useLayoutEffect,
14
+ useInsertionEffect,
15
15
  useRef,
16
16
  useState,
17
17
  } from '@wordpress/element';
@@ -25,49 +25,111 @@ import { TabListWrapper } from './styles';
25
25
  import type { WordPressComponentProps } from '../context';
26
26
  import clsx from 'clsx';
27
27
 
28
- function useTrackElementOffset(
29
- targetElement?: HTMLElement | null,
30
- onUpdate?: () => void
31
- ) {
32
- const [ indicatorPosition, setIndicatorPosition ] = useState( {
33
- left: 0,
34
- top: 0,
35
- width: 0,
36
- height: 0,
37
- } );
28
+ // TODO: move these into a separate utility file, for use in other components
29
+ // such as ToggleGroupControl.
38
30
 
39
- // TODO: replace with useEventCallback or similar when officially available.
40
- const updateCallbackRef = useRef( onUpdate );
41
- useLayoutEffect( () => {
42
- updateCallbackRef.current = onUpdate;
31
+ /**
32
+ * Any function.
33
+ */
34
+ type AnyFunction = ( ...args: any ) => any;
35
+
36
+ /**
37
+ * Creates a stable callback function that has access to the latest state and
38
+ * can be used within event handlers and effect callbacks. Throws when used in
39
+ * the render phase.
40
+ *
41
+ * @example
42
+ *
43
+ * ```tsx
44
+ * function Component(props) {
45
+ * const onClick = useEvent(props.onClick);
46
+ * React.useEffect(() => {}, [onClick]);
47
+ * }
48
+ * ```
49
+ */
50
+ function useEvent< T extends AnyFunction >( callback?: T ) {
51
+ const ref = useRef< AnyFunction | undefined >( () => {
52
+ throw new Error( 'Cannot call an event handler while rendering.' );
43
53
  } );
54
+ useInsertionEffect( () => {
55
+ ref.current = callback;
56
+ } );
57
+ return useCallback< AnyFunction >(
58
+ ( ...args ) => ref.current?.( ...args ),
59
+ []
60
+ ) as T;
61
+ }
62
+
63
+ /**
64
+ * `useResizeObserver` options.
65
+ */
66
+ type UseResizeObserverOptions = {
67
+ /**
68
+ * Whether to trigger the callback when an element's ResizeObserver is
69
+ * first set up.
70
+ *
71
+ * @default true
72
+ */
73
+ fireOnObserve?: boolean;
74
+ };
44
75
 
45
- const observedElementRef = useRef< HTMLElement >();
76
+ /**
77
+ * Fires `onResize` when the target element is resized.
78
+ *
79
+ * **The element must not be stored in a ref**, else it won't be observed
80
+ * or updated. Instead, it should be stored in a React state or equivalent.
81
+ *
82
+ * It sets up a `ResizeObserver` that tracks the element under the hood. The
83
+ * target element can be changed dynamically, and the observer will be
84
+ * updated accordingly.
85
+ *
86
+ * By default, `onResize` is called when the observer is set up, in addition
87
+ * to when the element is resized. This behavior can be disabled with the
88
+ * `fireOnObserve` option.
89
+ *
90
+ * @example
91
+ *
92
+ * ```tsx
93
+ * const [ targetElement, setTargetElement ] = useState< HTMLElement | null >();
94
+ *
95
+ * useResizeObserver( targetElement, ( element ) => {
96
+ * console.log( 'Element resized:', element );
97
+ * } );
98
+ *
99
+ * <div ref={ setTargetElement } />;
100
+ * ```
101
+ */
102
+ function useResizeObserver(
103
+ /**
104
+ * The target element to observe. It can be changed dynamically.
105
+ */
106
+ targetElement: HTMLElement | undefined | null,
107
+
108
+ /**
109
+ * Callback to fire when the element is resized. It will also be
110
+ * called when the observer is set up, unless `fireOnObserve` is
111
+ * set to `false`.
112
+ */
113
+ onResize: ( element: HTMLElement ) => void,
114
+ { fireOnObserve = true }: UseResizeObserverOptions = {}
115
+ ) {
116
+ const onResizeEvent = useEvent( onResize );
117
+
118
+ const observedElementRef = useRef< HTMLElement | null >();
46
119
  const resizeObserverRef = useRef< ResizeObserver >();
120
+
47
121
  useEffect( () => {
48
122
  if ( targetElement === observedElementRef.current ) {
49
123
  return;
50
124
  }
51
125
 
52
- observedElementRef.current = targetElement ?? undefined;
53
-
54
- function updateIndicator( element: HTMLElement ) {
55
- setIndicatorPosition( {
56
- // Workaround to prevent unwanted scrollbars, see:
57
- // https://github.com/WordPress/gutenberg/pull/61979
58
- left: Math.max( element.offsetLeft - 1, 0 ),
59
- top: Math.max( element.offsetTop - 1, 0 ),
60
- width: parseFloat( getComputedStyle( element ).width ),
61
- height: parseFloat( getComputedStyle( element ).height ),
62
- } );
63
- updateCallbackRef.current?.();
64
- }
126
+ observedElementRef.current = targetElement;
65
127
 
66
128
  // Set up a ResizeObserver.
67
129
  if ( ! resizeObserverRef.current ) {
68
130
  resizeObserverRef.current = new ResizeObserver( () => {
69
131
  if ( observedElementRef.current ) {
70
- updateIndicator( observedElementRef.current );
132
+ onResizeEvent( observedElementRef.current );
71
133
  }
72
134
  } );
73
135
  }
@@ -75,7 +137,9 @@ function useTrackElementOffset(
75
137
 
76
138
  // Observe new element.
77
139
  if ( targetElement ) {
78
- updateIndicator( targetElement );
140
+ if ( fireOnObserve ) {
141
+ onResizeEvent( targetElement );
142
+ }
79
143
  resizeObserver.observe( targetElement );
80
144
  }
81
145
 
@@ -85,35 +149,115 @@ function useTrackElementOffset(
85
149
  resizeObserver.unobserve( observedElementRef.current );
86
150
  }
87
151
  };
88
- }, [ targetElement ] );
152
+ }, [ fireOnObserve, onResizeEvent, targetElement ] );
153
+ }
154
+
155
+ /**
156
+ * The position and dimensions of an element, relative to its offset parent.
157
+ */
158
+ type ElementOffsetRect = {
159
+ /**
160
+ * The distance from the left edge of the offset parent to the left edge of
161
+ * the element.
162
+ */
163
+ left: number;
164
+ /**
165
+ * The distance from the top edge of the offset parent to the top edge of
166
+ * the element.
167
+ */
168
+ top: number;
169
+ /**
170
+ * The width of the element.
171
+ */
172
+ width: number;
173
+ /**
174
+ * The height of the element.
175
+ */
176
+ height: number;
177
+ };
178
+
179
+ /**
180
+ * An `ElementOffsetRect` object with all values set to zero.
181
+ */
182
+ const NULL_ELEMENT_OFFSET_RECT = {
183
+ left: 0,
184
+ top: 0,
185
+ width: 0,
186
+ height: 0,
187
+ } satisfies ElementOffsetRect;
188
+
189
+ /**
190
+ * Returns the position and dimensions of an element, relative to its offset
191
+ * parent. This is useful in contexts where `getBoundingClientRect` is not
192
+ * suitable, such as when the element is transformed.
193
+ *
194
+ * **Note:** the `left` and `right` values are adjusted due to a limitation
195
+ * in the way the browser calculates the offset position of the element,
196
+ * which can cause unwanted scrollbars to appear. This adjustment makes the
197
+ * values potentially inaccurate within a range of 1 pixel.
198
+ */
199
+ function getElementOffsetRect( element: HTMLElement ): ElementOffsetRect {
200
+ return {
201
+ // The adjustments mentioned in the documentation above are necessary
202
+ // because `offsetLeft` and `offsetTop` are rounded to the nearest pixel,
203
+ // which can result in a position mismatch that causes unwanted overflow.
204
+ // For context, see: https://github.com/WordPress/gutenberg/pull/61979
205
+ left: Math.max( element.offsetLeft - 1, 0 ),
206
+ top: Math.max( element.offsetTop - 1, 0 ),
207
+ // This is a workaround to obtain these values with a sub-pixel precision,
208
+ // since `offsetWidth` and `offsetHeight` are rounded to the nearest pixel.
209
+ width: parseFloat( getComputedStyle( element ).width ),
210
+ height: parseFloat( getComputedStyle( element ).height ),
211
+ };
212
+ }
213
+
214
+ /**
215
+ * Tracks the position and dimensions of an element, relative to its offset
216
+ * parent. The element can be changed dynamically.
217
+ */
218
+ function useTrackElementOffsetRect(
219
+ targetElement: HTMLElement | undefined | null
220
+ ) {
221
+ const [ indicatorPosition, setIndicatorPosition ] =
222
+ useState< ElementOffsetRect >( NULL_ELEMENT_OFFSET_RECT );
223
+
224
+ useResizeObserver( targetElement, ( element ) =>
225
+ setIndicatorPosition( getElementOffsetRect( element ) )
226
+ );
89
227
 
90
228
  return indicatorPosition;
91
229
  }
92
230
 
231
+ /**
232
+ * Context object for the `onUpdate` callback of `useOnValueUpdate`.
233
+ */
93
234
  type ValueUpdateContext< T > = {
94
235
  previousValue: T;
95
236
  };
96
237
 
238
+ /**
239
+ * Calls the `onUpdate` callback when the `value` changes.
240
+ */
97
241
  function useOnValueUpdate< T >(
242
+ /**
243
+ * The value to watch for changes.
244
+ */
98
245
  value: T,
246
+ /**
247
+ * Callback to fire when the value changes.
248
+ */
99
249
  onUpdate: ( context: ValueUpdateContext< T > ) => void
100
250
  ) {
101
251
  const previousValueRef = useRef( value );
102
-
103
- // TODO: replace with useEventCallback or similar when officially available.
104
- const updateCallbackRef = useRef( onUpdate );
105
- useLayoutEffect( () => {
106
- updateCallbackRef.current = onUpdate;
107
- } );
108
-
252
+ const updateCallbackEvent = useEvent( onUpdate );
109
253
  useEffect( () => {
110
254
  if ( previousValueRef.current !== value ) {
111
- updateCallbackRef.current( {
255
+ updateCallbackEvent( {
112
256
  previousValue: previousValueRef.current,
113
257
  } );
114
258
  previousValueRef.current = value;
115
259
  }
116
- }, [ value ] );
260
+ }, [ updateCallbackEvent, value ] );
117
261
  }
118
262
 
119
263
  export const TabList = forwardRef<
@@ -123,7 +267,7 @@ export const TabList = forwardRef<
123
267
  const context = useTabsContext();
124
268
 
125
269
  const selectedId = context?.store.useState( 'selectedId' );
126
- const indicatorPosition = useTrackElementOffset(
270
+ const indicatorPosition = useTrackElementOffsetRect(
127
271
  context?.store.item( selectedId )?.element
128
272
  );
129
273
 
package/src/tabs/types.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
5
4
  import type * as Ariakit from '@ariakit/react';
6
5
 
7
6
  export type TabsContextProps =
@@ -59,9 +59,11 @@ export const ColorScheme: StoryFn< typeof Theme > = ( {
59
59
  } ) => {
60
60
  const { colors } = generateThemeVariables( { accent, background } );
61
61
  const { gray, ...otherColors } = colors;
62
+ /* eslint-disable @typescript-eslint/no-unused-vars */
62
63
  const contrastIssues = Object.entries(
63
64
  checkContrasts( { accent, background }, colors )
64
65
  ).filter( ( [ _, error ] ) => !! error );
66
+ /* eslint-enable @typescript-eslint/no-unused-vars */
65
67
 
66
68
  const Chip = ( { color, name }: { color: string; name: string } ) => (
67
69
  <HStack justify="flex-start">
@@ -2,7 +2,6 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { ForwardedRef } from 'react';
5
- // eslint-disable-next-line no-restricted-imports
6
5
  import * as Ariakit from '@ariakit/react';
7
6
 
8
7
  /**
@@ -2,14 +2,12 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { ForwardedRef } from 'react';
5
- // eslint-disable-next-line no-restricted-imports
6
5
  import { LayoutGroup } from 'framer-motion';
7
6
 
8
7
  /**
9
8
  * WordPress dependencies
10
9
  */
11
10
  import { useInstanceId } from '@wordpress/compose';
12
- import { __ } from '@wordpress/i18n';
13
11
  import { useMemo } from '@wordpress/element';
14
12
 
15
13
  /**
@@ -2,9 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { ForwardedRef } from 'react';
5
- // eslint-disable-next-line no-restricted-imports
6
5
  import * as Ariakit from '@ariakit/react';
7
- // eslint-disable-next-line no-restricted-imports
8
6
  import { motion } from 'framer-motion';
9
7
 
10
8
  /**
@@ -74,6 +74,15 @@ Leave undefined for the default style. Or `'unstyled'` which removes the border
74
74
  - Required: No
75
75
  - Default: `undefined`
76
76
 
77
+ #### `orientation`: `'horizontal' | 'vertical'`
78
+
79
+ Specifies the toolbar's orientation.
80
+
81
+ Leave undefined or 'horizontal' for horizontal orientation keyboard interactions, choose 'vertical' for the alternative.
82
+
83
+ - Required: No
84
+ - Default: `horizontal`
85
+
77
86
  ## Related components
78
87
 
79
88
  - Toolbar may contain [ToolbarGroup](/packages/components/src/toolbar-group/README.md), [ToolbarButton](/packages/components/src/toolbar-button/README.md) and [ToolbarItem](/packages/components/src/toolbar-Item/README.md) as children.
@@ -20,6 +20,13 @@
20
20
 
21
21
  .components-accessible-toolbar,
22
22
  .components-toolbar {
23
+
24
+ &[aria-orientation="vertical"] {
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ }
29
+
23
30
  .components-button {
24
31
  position: relative;
25
32
  height: $block-toolbar-height;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
5
4
  import * as Ariakit from '@ariakit/react';
6
5
  import type { ForwardedRef } from 'react';
7
6
 
@@ -22,4 +22,10 @@ export type ToolbarProps = {
22
22
  * @default undefined
23
23
  */
24
24
  variant?: 'unstyled' | undefined;
25
+ /**
26
+ * Orientation of the toolbar keyboard interactions.
27
+ *
28
+ * @default 'horizontal'
29
+ */
30
+ orientation?: 'horizontal' | 'vertical';
25
31
  };
@@ -16,22 +16,36 @@ import Button from '../../button';
16
16
  import ToolbarItem from '../toolbar-item';
17
17
  import ToolbarContext from '../toolbar-context';
18
18
  import ToolbarButtonContainer from './toolbar-button-container';
19
- import type { ToolbarButtonProps } from './types';
19
+ import type { ToolbarButtonOverriddenProps, ToolbarButtonProps } from './types';
20
20
  import type { WordPressComponentProps } from '../../context';
21
21
 
22
+ function useDeprecatedProps( {
23
+ isDisabled,
24
+ ...otherProps
25
+ }: React.ComponentProps< typeof ToolbarButton > ) {
26
+ return {
27
+ disabled: isDisabled,
28
+ ...otherProps,
29
+ };
30
+ }
31
+
22
32
  function UnforwardedToolbarButton(
23
- {
33
+ props: Omit<
34
+ WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,
35
+ 'accessibleWhenDisabled' // By default, ToolbarButton will be focusable when disabled.
36
+ > &
37
+ ToolbarButtonOverriddenProps,
38
+ ref: ForwardedRef< any >
39
+ ) {
40
+ const {
24
41
  children,
25
42
  className,
26
43
  containerClassName,
27
44
  extraProps,
28
45
  isActive,
29
- isDisabled,
30
46
  title,
31
- ...props
32
- }: WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,
33
- ref: ForwardedRef< any >
34
- ) {
47
+ ...restProps
48
+ } = useDeprecatedProps( props );
35
49
  const accessibleToolbarState = useContext( ToolbarContext );
36
50
 
37
51
  if ( ! accessibleToolbarState ) {
@@ -39,10 +53,10 @@ function UnforwardedToolbarButton(
39
53
  <ToolbarButtonContainer className={ containerClassName }>
40
54
  <Button
41
55
  ref={ ref }
42
- icon={ props.icon }
56
+ icon={ restProps.icon }
43
57
  label={ title }
44
- shortcut={ props.shortcut }
45
- data-subscript={ props.subscript }
58
+ shortcut={ restProps.shortcut }
59
+ data-subscript={ restProps.subscript }
46
60
  onClick={ (
47
61
  event: ReactMouseEvent<
48
62
  HTMLButtonElement & HTMLAnchorElement,
@@ -50,9 +64,9 @@ function UnforwardedToolbarButton(
50
64
  >
51
65
  ) => {
52
66
  event.stopPropagation();
53
- // TODO: Possible bug; maybe use onClick instead of props.onClick.
54
- if ( props.onClick ) {
55
- props.onClick( event );
67
+ // TODO: Possible bug; maybe use onClick instead of restProps.onClick.
68
+ if ( restProps.onClick ) {
69
+ restProps.onClick( event );
56
70
  }
57
71
  } }
58
72
  className={ clsx(
@@ -60,10 +74,10 @@ function UnforwardedToolbarButton(
60
74
  className
61
75
  ) }
62
76
  isPressed={ isActive }
63
- disabled={ isDisabled }
77
+ accessibleWhenDisabled
64
78
  data-toolbar-item
65
79
  { ...extraProps }
66
- { ...props }
80
+ { ...restProps }
67
81
  >
68
82
  { children }
69
83
  </Button>
@@ -78,14 +92,13 @@ function UnforwardedToolbarButton(
78
92
  <ToolbarItem
79
93
  className={ clsx( 'components-toolbar-button', className ) }
80
94
  { ...extraProps }
81
- { ...props }
95
+ { ...restProps }
82
96
  ref={ ref }
83
97
  >
84
98
  { ( toolbarItemProps ) => (
85
99
  <Button
86
100
  label={ title }
87
101
  isPressed={ isActive }
88
- disabled={ isDisabled }
89
102
  { ...toolbarItemProps }
90
103
  >
91
104
  { children }
@@ -22,6 +22,9 @@ export type ToolbarButtonProps = {
22
22
  isActive?: boolean;
23
23
  /**
24
24
  * Indicates if the button is disabled.
25
+ *
26
+ * @deprecated Use `disabled` instead.
27
+ * @ignore
25
28
  */
26
29
  isDisabled?: boolean;
27
30
  /**
@@ -34,6 +37,22 @@ export type ToolbarButtonProps = {
34
37
  title?: string;
35
38
  };
36
39
 
40
+ export type ToolbarButtonOverriddenProps = {
41
+ /**
42
+ * Whether to keep the button focusable when disabled.
43
+ *
44
+ * In most cases, it is recommended to set this to `true`. Disabling a control without maintaining focusability
45
+ * can cause accessibility issues, by hiding their presence from screen reader users,
46
+ * or by preventing focus from returning to a trigger element.
47
+ *
48
+ * Learn more about the [focusability of disabled controls](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols)
49
+ * in the WAI-ARIA Authoring Practices Guide.
50
+ *
51
+ * @default true
52
+ */
53
+ accessibleWhenDisabled?: boolean;
54
+ };
55
+
37
56
  export type ToolbarButtonContainerProps = {
38
57
  /**
39
58
  * Children to be rendered inside the button container.
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
5
4
  import type * as Ariakit from '@ariakit/react';
6
5
 
7
6
  /**
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
5
4
  import * as Ariakit from '@ariakit/react';
6
5
  import type { ForwardedRef } from 'react';
7
6
 
@@ -50,6 +49,7 @@ function ToolbarItem(
50
49
 
51
50
  return (
52
51
  <Ariakit.ToolbarItem
52
+ accessibleWhenDisabled
53
53
  { ...allProps }
54
54
  store={ accessibleToolbarStore }
55
55
  render={ render }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- // eslint-disable-next-line no-restricted-imports
5
4
  import * as Ariakit from '@ariakit/react';
5
+ import clsx from 'clsx';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -45,6 +45,7 @@ function UnforwardedTooltip(
45
45
  ) {
46
46
  const {
47
47
  children,
48
+ className,
48
49
  delay = TOOLTIP_DELAY,
49
50
  hideOnClick = true,
50
51
  placement,
@@ -113,7 +114,7 @@ function UnforwardedTooltip(
113
114
  { isOnlyChild && ( text || shortcut ) && (
114
115
  <Ariakit.Tooltip
115
116
  { ...restProps }
116
- className="components-tooltip"
117
+ className={ clsx( 'components-tooltip', className ) }
117
118
  unmountOnHide
118
119
  gutter={ 4 }
119
120
  id={ describedById }
@@ -105,6 +105,24 @@ describe( 'Tooltip', () => {
105
105
  screen.getByRole( 'button', { name: 'Anchor' } )
106
106
  ).not.toHaveAttribute( 'data-foo' );
107
107
  } );
108
+
109
+ it( 'should add default and custom class names to the tooltip', async () => {
110
+ render( <Tooltip { ...props } className="foo" /> );
111
+
112
+ // Hover over the anchor, tooltip should show
113
+ await hover(
114
+ screen.getByRole( 'button', { name: 'Tooltip anchor' } )
115
+ );
116
+
117
+ // Check default and custom classnames
118
+ await waitFor( () =>
119
+ expect(
120
+ screen.getByRole( 'tooltip', {
121
+ name: 'tooltip text',
122
+ } )
123
+ ).toHaveClass( 'components-tooltip', 'foo' )
124
+ );
125
+ } );
108
126
  } );
109
127
 
110
128
  describe( 'keyboard focus', () => {
@@ -16,6 +16,10 @@ export type TooltipProps = {
16
16
  * **Note**: Accepts only one child element.
17
17
  */
18
18
  children: React.ReactElement;
19
+ /**
20
+ * Custom class name for the tooltip.
21
+ */
22
+ className?: string;
19
23
  /**
20
24
  * Option to hide the tooltip when the anchor is clicked.
21
25
  *
@@ -167,11 +167,12 @@ function UnforwardedUnitControl(
167
167
  if ( ! disableUnits && isUnitSelectTabbable && units.length ) {
168
168
  handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {
169
169
  props.onKeyDown?.( event );
170
- // Unless the meta key was pressed (to avoid interfering with
171
- // shortcuts, e.g. pastes), moves focus to the unit select if a key
170
+ // Unless the meta or ctrl key was pressed (to avoid interfering with
171
+ // shortcuts, e.g. pastes), move focus to the unit select if a key
172
172
  // matches the first character of a unit.
173
173
  if (
174
174
  ! event.metaKey &&
175
+ ! event.ctrlKey &&
175
176
  reFirstCharacterOfUnits.test( event.key )
176
177
  ) {
177
178
  refInputSuffix.current?.focus();