@wordpress/components 40.0.0 → 40.1.1-next.v.202609031004.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 (291) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/border-box-control/border-box-control/component.cjs +37 -5
  3. package/build/border-box-control/border-box-control/component.cjs.map +3 -3
  4. package/build/border-box-control/border-box-control/hook.cjs +24 -3
  5. package/build/border-box-control/border-box-control/hook.cjs.map +3 -3
  6. package/build/border-box-control/border-box-control-linked-button/hook.cjs +2 -2
  7. package/build/border-box-control/border-box-control-linked-button/hook.cjs.map +2 -2
  8. package/build/border-box-control/border-box-control-split-controls/hook.cjs +2 -2
  9. package/build/border-box-control/border-box-control-split-controls/hook.cjs.map +2 -2
  10. package/build/border-box-control/border-box-control-visualizer/hook.cjs +2 -2
  11. package/build/border-box-control/border-box-control-visualizer/hook.cjs.map +2 -2
  12. package/build/color-palette/index.cjs +1 -1
  13. package/build/color-palette/index.cjs.map +2 -2
  14. package/build/context/context-system-provider.cjs +2 -5
  15. package/build/context/context-system-provider.cjs.map +3 -3
  16. package/build/context/use-context-system.cjs +7 -2
  17. package/build/context/use-context-system.cjs.map +2 -2
  18. package/build/icon/index.cjs +30 -12
  19. package/build/icon/index.cjs.map +2 -2
  20. package/build/item-group/item/hook.cjs +1 -1
  21. package/build/item-group/item/hook.cjs.map +2 -2
  22. package/build/item-group/item-group/hook.cjs +1 -1
  23. package/build/item-group/item-group/hook.cjs.map +2 -2
  24. package/build/resizable-box/index.cjs.map +1 -1
  25. package/build/snackbar/index.cjs +8 -5
  26. package/build/snackbar/index.cjs.map +2 -2
  27. package/build/tools-panel/tools-panel/hook.cjs +102 -106
  28. package/build/tools-panel/tools-panel/hook.cjs.map +2 -2
  29. package/build/tools-panel/tools-panel-item/hook.cjs +33 -33
  30. package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
  31. package/build-module/border-box-control/border-box-control/component.mjs +38 -6
  32. package/build-module/border-box-control/border-box-control/component.mjs.map +2 -2
  33. package/build-module/border-box-control/border-box-control/hook.mjs +14 -3
  34. package/build-module/border-box-control/border-box-control/hook.mjs.map +2 -2
  35. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs +2 -2
  36. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs.map +2 -2
  37. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs +2 -2
  38. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs.map +2 -2
  39. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs +2 -2
  40. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs.map +2 -2
  41. package/build-module/color-palette/index.mjs +1 -1
  42. package/build-module/color-palette/index.mjs.map +2 -2
  43. package/build-module/context/context-system-provider.mjs +2 -5
  44. package/build-module/context/context-system-provider.mjs.map +3 -3
  45. package/build-module/context/use-context-system.mjs +7 -2
  46. package/build-module/context/use-context-system.mjs.map +2 -2
  47. package/build-module/icon/index.mjs +30 -12
  48. package/build-module/icon/index.mjs.map +2 -2
  49. package/build-module/item-group/item/hook.mjs +1 -1
  50. package/build-module/item-group/item/hook.mjs.map +2 -2
  51. package/build-module/item-group/item-group/hook.mjs +1 -1
  52. package/build-module/item-group/item-group/hook.mjs.map +2 -2
  53. package/build-module/resizable-box/index.mjs.map +1 -1
  54. package/build-module/snackbar/index.mjs +8 -5
  55. package/build-module/snackbar/index.mjs.map +2 -2
  56. package/build-module/tools-panel/tools-panel/hook.mjs +103 -107
  57. package/build-module/tools-panel/tools-panel/hook.mjs.map +2 -2
  58. package/build-module/tools-panel/tools-panel-item/hook.mjs +35 -35
  59. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
  60. package/build-style/style-rtl.css +7 -35
  61. package/build-style/style.css +7 -35
  62. package/build-types/border-box-control/border-box-control/component.d.ts +4 -0
  63. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  64. package/build-types/border-box-control/border-box-control/hook.d.ts +4 -2
  65. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  66. package/build-types/border-box-control/types.d.ts +6 -2
  67. package/build-types/border-box-control/types.d.ts.map +1 -1
  68. package/build-types/composite/types.d.ts +1 -1
  69. package/build-types/context/context-system-provider.d.ts +8 -6
  70. package/build-types/context/context-system-provider.d.ts.map +1 -1
  71. package/build-types/context/use-context-system.d.ts.map +1 -1
  72. package/build-types/icon/index.d.ts.map +1 -1
  73. package/build-types/popover/types.d.ts +6 -2
  74. package/build-types/popover/types.d.ts.map +1 -1
  75. package/build-types/snackbar/index.d.ts.map +1 -1
  76. package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
  77. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  78. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  79. package/build-types/tools-panel/types.d.ts +52 -9
  80. package/build-types/tools-panel/types.d.ts.map +1 -1
  81. package/package.json +26 -25
  82. package/src/angle-picker-control/style.module.scss +1 -1
  83. package/src/autocomplete/test/get-autocomplete-match.ts +2 -1
  84. package/src/base-control/stories/index.story.tsx +2 -2
  85. package/src/border-box-control/border-box-control/README.md +5 -3
  86. package/src/border-box-control/border-box-control/component.tsx +83 -15
  87. package/src/border-box-control/border-box-control/hook.ts +19 -1
  88. package/src/border-box-control/stories/index.story.tsx +10 -0
  89. package/src/border-box-control/style.module.scss +34 -3
  90. package/src/border-box-control/test/{index.tsx → index.jsdom.test.tsx} +133 -0
  91. package/src/border-box-control/test/utils.ts +11 -0
  92. package/src/border-box-control/types.ts +6 -2
  93. package/src/border-control/test/{index.js → index.jsdom.test.tsx} +20 -13
  94. package/src/checkbox-control/style.scss +2 -2
  95. package/src/checkbox-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +8 -5
  96. package/src/color-palette/index.tsx +1 -1
  97. package/src/composite/README.md +1 -1
  98. package/src/composite/types.ts +1 -1
  99. package/src/context/{context-system-provider.js → context-system-provider.tsx} +19 -5
  100. package/src/context/stories/{ComponentsProvider.stories.jsx → ComponentsProvider.stories.tsx} +2 -2
  101. package/src/context/test/__snapshots__/{context-system-provider.js.snap → context-system-provider.jsdom.test.tsx.snap} +3 -3
  102. package/src/context/test/context-connect.tsx +1 -2
  103. package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx} +81 -43
  104. package/src/context/test/wordpress-component.tsx +1 -2
  105. package/src/context/use-context-system.js +13 -4
  106. package/src/custom-gradient-picker/test/serializer.ts +1 -0
  107. package/src/date-time/test/utils.test.ts +9 -0
  108. package/src/draggable/style.module.scss +1 -1
  109. package/src/dropdown/style.module.scss +2 -2
  110. package/src/font-size-picker/test/utils.ts +1 -0
  111. package/src/icon/index.tsx +28 -12
  112. package/src/icon/test/{index.tsx → index.jsdom.test.tsx} +66 -0
  113. package/src/input-control/test/{index.js → index.jsdom.test.tsx} +16 -10
  114. package/src/item-group/style.module.scss +1 -2
  115. package/src/navigator/test/router.ts +1 -0
  116. package/src/notice/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +5 -2
  117. package/src/popover/README.md +2 -2
  118. package/src/popover/test/{index.tsx → index.jsdom.test.tsx} +23 -0
  119. package/src/popover/types.ts +9 -3
  120. package/src/query-controls/test/terms.ts +1 -0
  121. package/src/resizable-box/index.tsx +1 -1
  122. package/src/slot-fill/test/{index.js → index.jsdom.test.tsx} +3 -3
  123. package/src/slot-fill/test/{slot.js → slot.jsdom.test.tsx} +17 -9
  124. package/src/snackbar/index.tsx +10 -6
  125. package/src/snackbar/test/{index.tsx → index.jsdom.test.tsx} +28 -2
  126. package/src/snackbar/test/list.jsdom.test.tsx +99 -0
  127. package/src/surface/style.module.scss +2 -2
  128. package/src/textarea-control/style.module.scss +1 -1
  129. package/src/tip/style.scss +1 -1
  130. package/src/toggle-group-control/toggle-group-control/style.module.scss +1 -1
  131. package/src/tools-panel/test/{index.tsx → index.jsdom.test.tsx} +528 -9
  132. package/src/tools-panel/tools-panel/hook.ts +195 -180
  133. package/src/tools-panel/tools-panel-item/README.md +42 -1
  134. package/src/tools-panel/tools-panel-item/hook.ts +97 -69
  135. package/src/tools-panel/types.ts +54 -9
  136. package/src/truncate/style.module.scss +0 -1
  137. package/src/unit-control/test/utils.ts +1 -0
  138. package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsdom.test.tsx} +17 -3
  139. package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsdom.test.tsx} +3 -1
  140. package/src/utils/hooks/test/{use-cx.js → use-cx.jsdom.test.tsx} +3 -1
  141. package/src/utils/test/colors.js +1 -0
  142. package/src/utils/test/{get-node-text.js → get-node-text.tsx} +1 -0
  143. package/src/utils/test/math.js +1 -0
  144. package/src/utils/test/rtl.js +1 -0
  145. package/src/utils/test/space.js +1 -0
  146. package/src/utils/test/strings.js +1 -0
  147. package/src/utils/test/unit-values.js +1 -0
  148. package/src/view/test/{index.js → index.jsdom.test.tsx} +5 -1
  149. package/src/snackbar/test/list.tsx +0 -39
  150. /package/src/alignment-matrix-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  151. /package/src/autocomplete/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  152. /package/src/badge/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  153. /package/src/base-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  154. /package/src/box-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  155. /package/src/button/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  156. /package/src/card/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  157. /package/src/card/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  158. /package/src/checkbox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  159. /package/src/circular-option-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  160. /package/src/color-indicator/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  161. /package/src/color-indicator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  162. /package/src/color-palette/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  163. /package/src/color-palette/test/{utils.ts → utils.jsdom.test.ts} +0 -0
  164. /package/src/color-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  165. /package/src/combobox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  166. /package/src/composite/legacy/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  167. /package/src/composite/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  168. /package/src/confirm-dialog/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  169. /package/src/content-editable-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  170. /package/src/custom-gradient-picker/gradient-bar/test/{utils.ts → utils.jsdom.test.ts} +0 -0
  171. /package/src/custom-gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  172. /package/src/custom-select-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  173. /package/src/custom-select-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  174. /package/src/custom-select-control-v2/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  175. /package/src/date-time/date-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  176. /package/src/date-time/date-picker/test/{use-lilius.ts → use-lilius.jsdom.test.ts} +0 -0
  177. /package/src/date-time/date-time/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  178. /package/src/date-time/time-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  179. /package/src/date-time/time-picker/time-input/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  180. /package/src/disabled/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  181. /package/src/divider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  182. /package/src/dropdown/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  183. /package/src/dropdown-menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  184. /package/src/duotone-picker/test/{custom-duotone-bar.tsx → custom-duotone-bar.jsdom.test.tsx} +0 -0
  185. /package/src/duotone-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  186. /package/src/elevation/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  187. /package/src/elevation/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  188. /package/src/external-link/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  189. /package/src/flex/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  190. /package/src/flex/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  191. /package/src/focal-point-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  192. /package/src/focal-point-picker/test/{media.tsx → media.jsdom.test.tsx} +0 -0
  193. /package/src/font-size-picker/test/{font-size-picker-select.tsx → font-size-picker-select.jsdom.test.tsx} +0 -0
  194. /package/src/font-size-picker/test/{font-size-picker-toggle-group.tsx → font-size-picker-toggle-group.jsdom.test.tsx} +0 -0
  195. /package/src/font-size-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  196. /package/src/form-file-upload/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  197. /package/src/form-toggle/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  198. /package/src/form-toggle/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  199. /package/src/form-token-field/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  200. /package/src/gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  201. /package/src/grid/test/{grid.tsx → grid.jsdom.test.tsx} +0 -0
  202. /package/src/guide/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  203. /package/src/h-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  204. /package/src/h-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  205. /package/src/heading/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  206. /package/src/heading/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  207. /package/src/higher-order/with-fallback-styles/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  208. /package/src/higher-order/with-filters/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  209. /package/src/higher-order/with-filters/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  210. /package/src/higher-order/with-focus-outside/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  211. /package/src/higher-order/with-focus-return/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  212. /package/src/higher-order/with-notices/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  213. /package/src/higher-order/with-spoken-messages/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  214. /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  215. /package/src/isolated-event-container/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  216. /package/src/item-group/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  217. /package/src/item-group/test/{index.js → index.jsdom.test.tsx} +0 -0
  218. /package/src/keyboard-shortcuts/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  219. /package/src/menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  220. /package/src/menu-group/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  221. /package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  222. /package/src/menu-item/test/{index.js → index.jsdom.test.tsx} +0 -0
  223. /package/src/modal/test/{aria-helper.ts → aria-helper.jsdom.test.ts} +0 -0
  224. /package/src/modal/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  225. /package/src/navigable-container/test/{navigable-menu.tsx → navigable-menu.jsdom.test.tsx} +0 -0
  226. /package/src/navigable-container/test/{tababble-container.tsx → tababble-container.jsdom.test.tsx} +0 -0
  227. /package/src/navigator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  228. /package/src/notice/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  229. /package/src/notice/test/{list.tsx → list.jsdom.test.tsx} +0 -0
  230. /package/src/number-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  231. /package/src/palette-edit/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  232. /package/src/panel/test/__snapshots__/{body.tsx.snap → body.jsdom.test.tsx.snap} +0 -0
  233. /package/src/panel/test/__snapshots__/{header.tsx.snap → header.jsdom.test.tsx.snap} +0 -0
  234. /package/src/panel/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  235. /package/src/panel/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
  236. /package/src/panel/test/{body.tsx → body.jsdom.test.tsx} +0 -0
  237. /package/src/panel/test/{header.tsx → header.jsdom.test.tsx} +0 -0
  238. /package/src/panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  239. /package/src/panel/test/{row.tsx → row.jsdom.test.tsx} +0 -0
  240. /package/src/placeholder/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  241. /package/src/progress-bar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  242. /package/src/radio-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  243. /package/src/range-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  244. /package/src/resizable-box/resize-tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  245. /package/src/resizable-box/resize-tooltip/test/{label.tsx → label.jsdom.test.tsx} +0 -0
  246. /package/src/sandbox/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  247. /package/src/scroll-lock/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  248. /package/src/scrollable/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  249. /package/src/search-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  250. /package/src/select-control/test/__snapshots__/{select-control.tsx.snap → select-control.jsdom.test.tsx.snap} +0 -0
  251. /package/src/select-control/test/{select-control.tsx → select-control.jsdom.test.tsx} +0 -0
  252. /package/src/shortcut/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  253. /package/src/shortcut/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  254. /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsdom.test.tsx.snap} +0 -0
  255. /package/src/spacer/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  256. /package/src/spacer/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  257. /package/src/style-provider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  258. /package/src/surface/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  259. /package/src/tab-panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  260. /package/src/tabs/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  261. /package/src/text/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  262. /package/src/text/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  263. /package/src/text-control/test/{text-control.tsx → text-control.jsdom.test.tsx} +0 -0
  264. /package/src/text-highlight/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  265. /package/src/toggle-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  266. /package/src/toggle-group-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  267. /package/src/toggle-group-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  268. /package/src/toolbar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  269. /package/src/toolbar/test/{toolbar-group.tsx → toolbar-group.jsdom.test.tsx} +0 -0
  270. /package/src/tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  271. /package/src/tree-grid/test/__snapshots__/{cell.tsx.snap → cell.jsdom.test.tsx.snap} +0 -0
  272. /package/src/tree-grid/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  273. /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.tsx.snap → roving-tab-index-item.jsdom.test.tsx.snap} +0 -0
  274. /package/src/tree-grid/test/__snapshots__/{roving-tab-index.tsx.snap → roving-tab-index.jsdom.test.tsx.snap} +0 -0
  275. /package/src/tree-grid/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
  276. /package/src/tree-grid/test/{cell.tsx → cell.jsdom.test.tsx} +0 -0
  277. /package/src/tree-grid/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  278. /package/src/tree-grid/test/{roving-tab-index-item.tsx → roving-tab-index-item.jsdom.test.tsx} +0 -0
  279. /package/src/tree-grid/test/{roving-tab-index.tsx → roving-tab-index.jsdom.test.tsx} +0 -0
  280. /package/src/tree-grid/test/{row.tsx → row.jsdom.test.tsx} +0 -0
  281. /package/src/truncate/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  282. /package/src/unit-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  283. /package/src/utils/test/{polymorphic-element.tsx → polymorphic-element.jsdom.test.tsx} +0 -0
  284. /package/src/v-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  285. /package/src/v-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  286. /package/src/validated-form-controls/test/{content-editable-control.tsx → content-editable-control.jsdom.test.tsx} +0 -0
  287. /package/src/validated-form-controls/test/{custom-select-control.tsx → custom-select-control.jsdom.test.tsx} +0 -0
  288. /package/src/validated-form-controls/test/{input-control.tsx → input-control.jsdom.test.tsx} +0 -0
  289. /package/src/validated-form-controls/test/{range-control.tsx → range-control.jsdom.test.tsx} +0 -0
  290. /package/src/validated-form-controls/test/{textarea-control.tsx → textarea-control.jsdom.test.tsx} +0 -0
  291. /package/src/view/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
@@ -1,18 +1,65 @@
1
1
  import { render, screen } from '@testing-library/react';
2
2
  import styled from '@emotion/styled';
3
+ import type {
4
+ ComponentPropsWithoutRef,
5
+ ForwardedRef,
6
+ ReactElement,
7
+ ReactNode,
8
+ } from 'react';
3
9
  import { cloneElement } from '@wordpress/element';
10
+ import warn from '@wordpress/warning';
4
11
  import { contextConnect } from '../context-connect';
5
12
  import { ContextSystemProvider } from '../context-system-provider';
6
13
  import { useContextSystem } from '../use-context-system';
7
14
 
15
+ jest.mock( '@wordpress/warning', () => jest.fn() );
16
+
8
17
  const View = styled.div``;
9
18
 
19
+ type TestComponentProps = ComponentPropsWithoutRef< 'div' > & {
20
+ quote?: ReactNode;
21
+ };
22
+
23
+ function TestComponent(
24
+ props: TestComponentProps,
25
+ ref: ForwardedRef< HTMLDivElement >
26
+ ) {
27
+ return <View { ...useContextSystem( props, 'Component' ) } ref={ ref } />;
28
+ }
29
+
30
+ function TestComponentWithQuote(
31
+ props: TestComponentProps,
32
+ ref: ForwardedRef< HTMLDivElement >
33
+ ) {
34
+ const { quote, ...otherProps } = useContextSystem( props, 'Component' );
35
+ return (
36
+ <View { ...otherProps } ref={ ref }>
37
+ { quote }
38
+ </View>
39
+ );
40
+ }
41
+
10
42
  describe( 'props', () => {
11
- test( 'should render correctly', () => {
12
- const Component = ( props, ref ) => (
13
- <View { ...useContextSystem( props, 'Component' ) } ref={ ref } />
43
+ test( 'should not warn when rerendered without a value', () => {
44
+ jest.mocked( warn ).mockClear();
45
+
46
+ const { rerender } = render(
47
+ <ContextSystemProvider>
48
+ <div />
49
+ </ContextSystemProvider>
14
50
  );
15
- const ConnectedComponent = contextConnect( Component, 'Component' );
51
+
52
+ rerender(
53
+ <ContextSystemProvider>
54
+ <div />
55
+ </ContextSystemProvider>
56
+ );
57
+
58
+ expect( warn ).not.toHaveBeenCalled();
59
+ } );
60
+
61
+ test( 'should render correctly', () => {
62
+ const ConnectedComponent = contextConnect( TestComponent, 'Component' );
16
63
  const { container } = render(
17
64
  <ContextSystemProvider>
18
65
  <ConnectedComponent />
@@ -23,19 +70,10 @@ describe( 'props', () => {
23
70
  } );
24
71
 
25
72
  test( 'should render context props', () => {
26
- const Component = ( props, ref ) => {
27
- const { quote, ...otherProps } = useContextSystem(
28
- props,
29
- 'Component'
30
- );
31
- return (
32
- <View { ...otherProps } ref={ ref }>
33
- { quote }
34
- </View>
35
- );
36
- };
37
-
38
- const ConnectedComponent = contextConnect( Component, 'Component' );
73
+ const ConnectedComponent = contextConnect(
74
+ TestComponentWithQuote,
75
+ 'Component'
76
+ );
39
77
 
40
78
  const contextValue = {
41
79
  Component: {
@@ -54,19 +92,10 @@ describe( 'props', () => {
54
92
  } );
55
93
 
56
94
  test( 'should render _override props', () => {
57
- const Component = ( props, ref ) => {
58
- const { quote, ...otherProps } = useContextSystem(
59
- props,
60
- 'Component'
61
- );
62
- return (
63
- <View { ...otherProps } ref={ ref }>
64
- { quote }
65
- </View>
66
- );
67
- };
68
-
69
- const ConnectedComponent = contextConnect( Component, 'Component' );
95
+ const ConnectedComponent = contextConnect(
96
+ TestComponentWithQuote,
97
+ 'Component'
98
+ );
70
99
 
71
100
  const contextValue = {
72
101
  Component: {
@@ -99,10 +128,7 @@ describe( 'props', () => {
99
128
 
100
129
  describe( 'children', () => {
101
130
  test( 'should pass through children', () => {
102
- const Component = ( props, ref ) => (
103
- <View { ...useContextSystem( props, 'Component' ) } ref={ ref } />
104
- );
105
- const ConnectedComponent = contextConnect( Component, 'Component' );
131
+ const ConnectedComponent = contextConnect( TestComponent, 'Component' );
106
132
 
107
133
  render(
108
134
  <ContextSystemProvider>
@@ -114,13 +140,11 @@ describe( 'children', () => {
114
140
  } );
115
141
 
116
142
  test( 'should not accept children via `context`', () => {
117
- const Component = ( props, ref ) => (
118
- <View { ...useContextSystem( props, 'Component' ) } ref={ ref } />
119
- );
120
- const ConnectedComponent = contextConnect( Component, 'Component' );
143
+ const ConnectedComponent = contextConnect( TestComponent, 'Component' );
121
144
 
122
145
  render(
123
146
  <ContextSystemProvider
147
+ // @ts-expect-error Verify that the unsupported `context` prop is ignored.
124
148
  context={ { Component: { children: 'Override' } } }
125
149
  >
126
150
  <ConnectedComponent />
@@ -132,13 +156,18 @@ describe( 'children', () => {
132
156
 
133
157
  // This matches the behavior for normal, non-context-connected components.
134
158
  test( 'should not override inherent children', () => {
135
- const Component = ( props, ref ) => (
159
+ const Component = (
160
+ props: TestComponentProps,
161
+ ref: ForwardedRef< HTMLDivElement >
162
+ ) => (
136
163
  <View { ...useContextSystem( props, 'Component' ) } ref={ ref }>
137
164
  Inherent
138
165
  </View>
139
166
  );
140
167
  const ConnectedComponent = contextConnect( Component, 'Component' );
141
- const NormalComponent = ( props ) => <div { ...props }>Inherent</div>;
168
+ const NormalComponent = (
169
+ props: ComponentPropsWithoutRef< 'div' >
170
+ ) => <div { ...props }>Inherent</div>;
142
171
 
143
172
  render(
144
173
  <ContextSystemProvider>
@@ -153,12 +182,21 @@ describe( 'children', () => {
153
182
  } );
154
183
 
155
184
  describe( 'when connected component does a `cloneElement()`', () => {
156
- // eslint-disable-next-line no-unused-vars
157
- const ComponentThatClones = ( { content, ...props }, _ref ) =>
158
- cloneElement(
185
+ type CloneComponentProps = {
186
+ content: ReactElement;
187
+ children?: ReactNode;
188
+ className?: string;
189
+ };
190
+ const ComponentThatClones = (
191
+ { content, ...props }: CloneComponentProps,
192
+ ref: ForwardedRef< HTMLElement >
193
+ ) => {
194
+ void ref;
195
+ return cloneElement(
159
196
  content,
160
197
  useContextSystem( props, 'ComponentThatClones' )
161
198
  );
199
+ };
162
200
  const ConnectedComponentThatClones = contextConnect(
163
201
  ComponentThatClones,
164
202
  'ComponentThatClones'
@@ -1,9 +1,9 @@
1
+ import { describe, it } from 'vitest';
1
2
  import type { ForwardedRef } from 'react';
2
3
  import { forwardRef } from '@wordpress/element';
3
4
  import type { WordPressComponentProps } from '../wordpress-component';
4
5
 
5
6
  // Static TypeScript checks
6
- /* eslint-disable jest/expect-expect */
7
7
  describe( 'WordPressComponentProps', () => {
8
8
  it( 'should not accept a ref', () => {
9
9
  const Foo = ( props: WordPressComponentProps< {}, 'div' > ) => (
@@ -24,4 +24,3 @@ describe( 'WordPressComponentProps', () => {
24
24
  <ForwardedFoo ref={ null } />;
25
25
  } );
26
26
  } );
27
- /* eslint-enable jest/expect-expect */
@@ -33,11 +33,20 @@ export function useContextSystem( props, namespace ) {
33
33
  ...getNamespace( namespace ),
34
34
  };
35
35
 
36
- const { _overrides: overrideProps, ...otherContextProps } = contextProps;
36
+ const { _overrides, ...otherContextProps } = contextProps;
37
+ /** @type {Record<string, unknown>} */
38
+ const overrideProps = /** @type {Record<string, unknown>} */ ( _overrides );
37
39
 
38
40
  const initialMergedProps = Object.entries( otherContextProps ).length
39
41
  ? Object.assign( {}, otherContextProps, props )
40
42
  : props;
43
+ /**
44
+ * @type {P & {
45
+ * children?: React.ReactNode,
46
+ * renderChildren?: (props: P) => React.ReactNode
47
+ * }}
48
+ */
49
+ const propsWithChildren = initialMergedProps;
41
50
 
42
51
  const cx = useCx();
43
52
 
@@ -48,9 +57,9 @@ export function useContextSystem( props, namespace ) {
48
57
 
49
58
  // Provides the ability to customize the render of the component.
50
59
  const rendered =
51
- typeof initialMergedProps.renderChildren === 'function'
52
- ? initialMergedProps.renderChildren( initialMergedProps )
53
- : initialMergedProps.children;
60
+ typeof propsWithChildren.renderChildren === 'function'
61
+ ? propsWithChildren.renderChildren( initialMergedProps )
62
+ : propsWithChildren.children;
54
63
 
55
64
  for ( const key in initialMergedProps ) {
56
65
  // @ts-expect-error A string key cannot index the merged props type.
@@ -1,3 +1,4 @@
1
+ import { describe, expect, test } from 'vitest';
1
2
  import {
2
3
  serializeGradientColor,
3
4
  serializeGradientPosition,
@@ -1,3 +1,12 @@
1
+ import {
2
+ afterAll,
3
+ afterEach,
4
+ beforeAll,
5
+ beforeEach,
6
+ describe,
7
+ expect,
8
+ it,
9
+ } from 'vitest';
1
10
  import timezoneMock from 'timezone-mock';
2
11
  import { getSettings, setSettings, type DateSettings } from '@wordpress/date';
3
12
  import { inputToDate, getDaysInMonth } from '../utils';
@@ -2,7 +2,7 @@
2
2
 
3
3
  .invisible-drag-image {
4
4
  position: fixed;
5
- /* stylelint-disable-next-line plugin/use-logical-properties-and-values -- Offscreen drag-image stand-in; flipping with writing direction has no benefit. */
5
+ /* stylelint-disable-next-line logical-css/require-logical-properties -- Offscreen drag-image stand-in; flipping with writing direction has no benefit. */
6
6
  left: -1000px;
7
7
  height: 50px;
8
8
  width: 50px;
@@ -2,7 +2,7 @@
2
2
 
3
3
  .content-wrapper {
4
4
  // Negative margin to reset (offset) the default padding on .components-popover__content.
5
- /* stylelint-disable plugin/use-logical-properties-and-values -- Preserve the previous physical offsets against Popover padding. */
5
+ /* stylelint-disable logical-css/require-logical-properties -- Preserve the previous physical offsets against Popover padding. */
6
6
  margin-left: -$grid-unit-10;
7
7
  margin-right: -$grid-unit-10;
8
8
 
@@ -13,7 +13,7 @@
13
13
  &:last-of-type {
14
14
  margin-bottom: -$grid-unit-10;
15
15
  }
16
- /* stylelint-enable plugin/use-logical-properties-and-values */
16
+ /* stylelint-enable logical-css/require-logical-properties */
17
17
  }
18
18
 
19
19
  .padding-small {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, test } from 'vitest';
1
2
  import { isSimpleCssValue } from '../utils';
2
3
 
3
4
  describe( 'isSimpleCssValue', () => {
@@ -1,4 +1,4 @@
1
- import type { ComponentType, HTMLProps, SVGProps } from 'react';
1
+ import type { ComponentType, CSSProperties, HTMLProps, SVGProps } from 'react';
2
2
  import {
3
3
  cloneElement,
4
4
  createElement,
@@ -19,6 +19,7 @@ type SizeProps = {
19
19
  size?: number;
20
20
  width?: number | string;
21
21
  height?: number | string;
22
+ style?: CSSProperties;
22
23
  };
23
24
 
24
25
  type AdditionalProps< T > = T extends ComponentType< infer U >
@@ -88,23 +89,38 @@ function Icon( {
88
89
  } );
89
90
  }
90
91
 
91
- if ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {
92
- const appliedProps = {
93
- ...icon.props,
94
- width: size,
95
- height: size,
96
- ...additionalProps,
97
- };
92
+ if ( isValidElement< SizeProps >( icon ) ) {
93
+ const { style: consumerStyle, ...restProps } =
94
+ additionalProps as SVGProps< SVGSVGElement >;
95
+ const mergedStyle =
96
+ icon.props.style || consumerStyle
97
+ ? { ...icon.props.style, ...consumerStyle }
98
+ : undefined;
99
+ const styleProps = mergedStyle ? { style: mergedStyle } : {};
98
100
 
99
- return <SVG { ...appliedProps } />;
100
- }
101
+ if ( icon.type === 'svg' || icon.type === SVG ) {
102
+ const appliedProps = {
103
+ ...icon.props,
104
+ width: size,
105
+ height: size,
106
+ ...restProps,
107
+ // Merge styles so the icon's intrinsic style (e.g. `fill: none` on
108
+ // stroke-based icons) is preserved unless the consumer overrides
109
+ // the same property explicitly.
110
+ ...styleProps,
111
+ };
112
+
113
+ return <SVG { ...appliedProps } />;
114
+ }
101
115
 
102
- if ( isValidElement< SizeProps >( icon ) ) {
103
116
  return cloneElement( icon, {
104
117
  size,
105
118
  width: size,
106
119
  height: size,
107
- ...additionalProps,
120
+ ...restProps,
121
+ // Merge styles so the icon's intrinsic style is preserved unless
122
+ // the consumer overrides the same property explicitly.
123
+ ...styleProps,
108
124
  } );
109
125
  }
110
126
 
@@ -95,4 +95,70 @@ describe( 'Icon', () => {
95
95
 
96
96
  expect( screen.getByTestId( testId ) ).toHaveClass( className );
97
97
  } );
98
+
99
+ it( "merges a consumer 'style' prop with the icon's intrinsic style", () => {
100
+ const strokeIcon = (
101
+ <SVG style={ { fill: 'none' } }>
102
+ <Path d="M5 4v3h5.5v12h3V7H19V4z" />
103
+ </SVG>
104
+ );
105
+ render(
106
+ <Icon
107
+ data-testid={ testId }
108
+ icon={ strokeIcon }
109
+ style={ { marginInlineStart: 4 } }
110
+ />
111
+ );
112
+ const icon = screen.getByTestId( testId );
113
+
114
+ // The icon's intrinsic `fill: none` survives…
115
+ expect( icon ).toHaveStyle( 'fill: none' );
116
+ // …alongside the consumer-supplied style.
117
+ expect( icon ).toHaveStyle( 'margin-inline-start: 4px' );
118
+ } );
119
+
120
+ it( "lets a consumer 'style' override the icon's intrinsic style", () => {
121
+ const strokeIcon = (
122
+ <SVG style={ { fill: 'none' } }>
123
+ <Path d="M5 4v3h5.5v12h3V7H19V4z" />
124
+ </SVG>
125
+ );
126
+ render(
127
+ <Icon
128
+ data-testid={ testId }
129
+ icon={ strokeIcon }
130
+ style={ { fill: 'red' } }
131
+ />
132
+ );
133
+
134
+ expect( screen.getByTestId( testId ) ).toHaveStyle( 'fill: red' );
135
+ } );
136
+
137
+ it( "merges a consumer 'style' with a non-svg element's intrinsic style", () => {
138
+ render(
139
+ <Icon
140
+ icon={
141
+ <span data-testid={ testId } style={ { fill: 'none' } } />
142
+ }
143
+ style={ { marginInlineStart: 4 } }
144
+ />
145
+ );
146
+ const icon = screen.getByTestId( testId );
147
+
148
+ expect( icon ).toHaveStyle( 'fill: none' );
149
+ expect( icon ).toHaveStyle( 'margin-inline-start: 4px' );
150
+ } );
151
+
152
+ it( "does not add a 'style' prop to a non-svg element without styles", () => {
153
+ let hasStyleProp = true;
154
+ const CustomIcon = ( props: Record< string, unknown > ) => {
155
+ hasStyleProp = 'style' in props;
156
+ return <span data-testid={ testId } />;
157
+ };
158
+
159
+ render( <Icon icon={ <CustomIcon /> } /> );
160
+
161
+ expect( screen.getByTestId( testId ) ).toBeVisible();
162
+ expect( hasStyleProp ).toBe( false );
163
+ } );
98
164
  } );
@@ -1,16 +1,17 @@
1
1
  import { render, screen } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
+ import type { KeyboardEvent } from 'react';
3
4
  import { useState } from '@wordpress/element';
4
5
  import BaseInputControl from '../';
5
6
  import InputControlPrefixWrapper from '../input-prefix-wrapper';
7
+ import type { InputControlProps } from '../types';
6
8
 
7
- const getInput = () => screen.getByTestId( 'input' );
9
+ const getInput = () => screen.getByTestId< HTMLInputElement >( 'input' );
8
10
 
9
11
  describe( 'InputControl', () => {
10
- const InputControl = ( props ) => {
12
+ const InputControl = ( props: InputControlProps ) => {
11
13
  return <BaseInputControl { ...props } data-testid="input" />;
12
14
  };
13
-
14
15
  describe( 'Basic rendering', () => {
15
16
  it( 'should render', () => {
16
17
  render( <InputControl /> );
@@ -85,14 +86,16 @@ describe( 'InputControl', () => {
85
86
  it( 'should work as a controlled component given normal, falsy or nullish values', async () => {
86
87
  const user = await userEvent.setup();
87
88
  const spy = jest.fn();
88
- const heldKeySet = new Set();
89
+ const heldKeySet = new Set< string >();
89
90
  const Example = () => {
90
- const [ state, setState ] = useState( 'one' );
91
- const onChange = ( value ) => {
91
+ const [ state, setState ] = useState< string | undefined >(
92
+ 'one'
93
+ );
94
+ const onChange = ( value: string | undefined ) => {
92
95
  setState( value );
93
96
  spy( value );
94
97
  };
95
- const onKeyDown = ( { key } ) => {
98
+ const onKeyDown = ( { key }: KeyboardEvent ) => {
96
99
  heldKeySet.add( key );
97
100
  if ( key === 'Escape' ) {
98
101
  if ( heldKeySet.has( 'Meta' ) ) {
@@ -104,7 +107,8 @@ describe( 'InputControl', () => {
104
107
  }
105
108
  }
106
109
  };
107
- const onKeyUp = ( { key } ) => heldKeySet.delete( key );
110
+ const onKeyUp = ( { key }: KeyboardEvent ) =>
111
+ heldKeySet.delete( key );
108
112
  return (
109
113
  <InputControl
110
114
  value={ state }
@@ -189,7 +193,8 @@ describe( 'InputControl', () => {
189
193
  let { value } = state;
190
194
  if (
191
195
  action.type === 'COMMIT' &&
192
- action.payload.event.type === 'blur'
196
+ action.payload.event?.type === 'blur' &&
197
+ value !== undefined
193
198
  ) {
194
199
  value = value.replace( /\bnow\b/, 'meow' );
195
200
  }
@@ -219,7 +224,8 @@ describe( 'InputControl', () => {
219
224
  <InputControl
220
225
  label="Test"
221
226
  prefix={ prefix }
222
- { ...{ size: '__unstable-large' } }
227
+ // @ts-expect-error Verify the legacy value that is omitted from the public type.
228
+ size="__unstable-large"
223
229
  />
224
230
  );
225
231
 
@@ -70,8 +70,7 @@ $padding-y-large: calc((calc(#{$control-height} * 1.2) - #{$base-font-height} -
70
70
  background: none;
71
71
  text-align: start;
72
72
 
73
- svg,
74
- path {
73
+ svg {
75
74
  fill: currentColor;
76
75
  }
77
76
 
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import { patternMatch, findParent } from '../utils/router';
2
3
 
3
4
  describe( 'patternMatch', () => {
@@ -48,15 +48,18 @@ exports[`Notice should match snapshot 1`] = `
48
48
  >
49
49
  <svg
50
50
  aria-hidden="true"
51
- fill="currentColor"
52
51
  focusable="false"
53
52
  height="24"
53
+ stroke="currentColor"
54
+ stroke-width="1.5"
55
+ style="fill: none;"
54
56
  viewBox="0 0 24 24"
55
57
  width="24"
56
58
  xmlns="http://www.w3.org/2000/svg"
57
59
  >
58
60
  <path
59
- d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
61
+ d="M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75"
62
+ vector-effect="non-scaling-stroke"
60
63
  />
61
64
  </svg>
62
65
  </button>
@@ -183,9 +183,9 @@ Used to show/hide the arrow that points at the popover's anchor.
183
183
  - Required: No
184
184
  - Default: `true`
185
185
 
186
- ### `offset`: `number`
186
+ ### `offset`: `number | { mainAxis?: number; crossAxis?: number }`
187
187
 
188
- The distance (in px) between the anchor and the popover.
188
+ The distance (in px) between the anchor and the popover. A number displaces the popover along its main axis; pass an object to also displace it along its cross axis.
189
189
 
190
190
  - Required: No
191
191
 
@@ -174,6 +174,29 @@ describe( 'Popover', () => {
174
174
  } );
175
175
  } );
176
176
 
177
+ describe( 'offset', () => {
178
+ it( 'should displace the popover along its cross axis when passed an offset object', async () => {
179
+ render(
180
+ <Popover
181
+ placement="right-start"
182
+ offset={ { mainAxis: 16, crossAxis: 24 } }
183
+ animate={ false }
184
+ flip={ false }
185
+ shift={ false }
186
+ data-testid="popover-element"
187
+ >
188
+ Hello
189
+ </Popover>
190
+ );
191
+ const popover = screen.getByTestId( 'popover-element' );
192
+
193
+ await waitFor( () => expect( popover ).toBeVisible() );
194
+ expect( popover ).toHaveStyle(
195
+ 'transform: translateX(16px) translateY(24px)'
196
+ );
197
+ } );
198
+ } );
199
+
177
200
  describe( 'style', () => {
178
201
  it( 'outputs inline styles added through the style prop in addition to built-in popover positioning styles', async () => {
179
202
  render(
@@ -105,9 +105,15 @@ export type PopoverProps = {
105
105
  */
106
106
  noArrow?: boolean;
107
107
  /**
108
- * The distance (in px) between the anchor and the popover.
109
- */
110
- offset?: number;
108
+ * The distance (in px) between the anchor and the popover. Pass an object to
109
+ * also displace the popover along its cross axis.
110
+ */
111
+ offset?:
112
+ | number
113
+ | {
114
+ mainAxis?: number;
115
+ crossAxis?: number;
116
+ };
111
117
  /**
112
118
  * A callback invoked when the popover should be closed.
113
119
  */
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import { buildTermsTree } from '../terms';
2
3
 
3
4
  describe( 'buildTermsTree()', () => {
@@ -102,7 +102,7 @@ function UnforwardedResizableBox(
102
102
  ) }
103
103
  // Add a focusable element within the drag handle. Unfortunately,
104
104
  // `re-resizable` does not make them properly focusable by default,
105
- // causing focus to move the the block wrapper which triggers block
105
+ // causing focus to move the block wrapper which triggers block
106
106
  // drag.
107
107
  handleComponent={ Object.fromEntries(
108
108
  Object.keys( HANDLE_CLASSES ).map( ( key ) => [
@@ -79,7 +79,7 @@ describe( 'createSlotFill', () => {
79
79
 
80
80
  test( 'should forward ref to the slot when using bubblesVirtually', () => {
81
81
  const TestSlotFill = createSlotFill( 'TestRefSlot' );
82
- const ref = createRef();
82
+ const ref = createRef< HTMLElement >();
83
83
 
84
84
  render(
85
85
  <SlotFillProvider>
@@ -91,12 +91,12 @@ describe( 'createSlotFill', () => {
91
91
  );
92
92
 
93
93
  expect( ref.current ).not.toBeNull();
94
- expect( ref.current.tagName ).toBe( 'DIV' );
94
+ expect( ref.current!.tagName ).toBe( 'DIV' );
95
95
  } );
96
96
 
97
97
  test( 'should forward ref without bubblesVirtually (ref stays null for fragment-based slot)', () => {
98
98
  const TestSlotFill = createSlotFill( 'TestRefSlotBase' );
99
- const ref = createRef();
99
+ const ref = createRef< HTMLElement >();
100
100
 
101
101
  render(
102
102
  <SlotFillProvider>