@wordpress/components 33.1.1-next.v.202605131032.0 → 34.0.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 (435) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/build/autocomplete/index.cjs +5 -4
  3. package/build/autocomplete/index.cjs.map +3 -3
  4. package/build/border-control/border-control-dropdown/component.cjs +33 -33
  5. package/build/border-control/border-control-dropdown/component.cjs.map +3 -3
  6. package/build/box-control/index.cjs +0 -6
  7. package/build/box-control/index.cjs.map +2 -2
  8. package/build/box-control/utils.cjs +0 -38
  9. package/build/box-control/utils.cjs.map +3 -3
  10. package/build/custom-gradient-picker/gradient-bar/index.cjs.map +2 -2
  11. package/build/disabled/index.cjs +1 -1
  12. package/build/disabled/index.cjs.map +2 -2
  13. package/build/draggable/index.cjs +101 -7
  14. package/build/draggable/index.cjs.map +3 -3
  15. package/build/form-token-field/index.cjs +41 -7
  16. package/build/form-token-field/index.cjs.map +2 -2
  17. package/build/higher-order/with-notices/index.cjs +3 -15
  18. package/build/higher-order/with-notices/index.cjs.map +2 -2
  19. package/build/index.cjs +0 -17
  20. package/build/index.cjs.map +2 -2
  21. package/build/input-control/input-base.cjs +31 -34
  22. package/build/input-control/input-base.cjs.map +2 -2
  23. package/build/notice/index.cjs +33 -35
  24. package/build/notice/index.cjs.map +2 -2
  25. package/build/popover/index.cjs +12 -0
  26. package/build/popover/index.cjs.map +2 -2
  27. package/build/responsive-wrapper/index.cjs +4 -3
  28. package/build/responsive-wrapper/index.cjs.map +2 -2
  29. package/build/tabs/styles.cjs +5 -5
  30. package/build/tabs/styles.cjs.map +2 -2
  31. package/build/tooltip/index.cjs +2 -1
  32. package/build/tooltip/index.cjs.map +2 -2
  33. package/build-module/autocomplete/index.mjs +6 -5
  34. package/build-module/autocomplete/index.mjs.map +2 -2
  35. package/build-module/border-control/border-control-dropdown/component.mjs +34 -34
  36. package/build-module/border-control/border-control-dropdown/component.mjs.map +2 -2
  37. package/build-module/box-control/index.mjs +0 -2
  38. package/build-module/box-control/index.mjs.map +2 -2
  39. package/build-module/box-control/utils.mjs +0 -27
  40. package/build-module/box-control/utils.mjs.map +2 -2
  41. package/build-module/custom-gradient-picker/gradient-bar/index.mjs.map +2 -2
  42. package/build-module/disabled/index.mjs +1 -1
  43. package/build-module/disabled/index.mjs.map +2 -2
  44. package/build-module/draggable/index.mjs +101 -7
  45. package/build-module/draggable/index.mjs.map +3 -3
  46. package/build-module/form-token-field/index.mjs +41 -7
  47. package/build-module/form-token-field/index.mjs.map +2 -2
  48. package/build-module/higher-order/with-notices/index.mjs +4 -16
  49. package/build-module/higher-order/with-notices/index.mjs.map +2 -2
  50. package/build-module/index.mjs +87 -99
  51. package/build-module/index.mjs.map +2 -2
  52. package/build-module/input-control/input-base.mjs +31 -34
  53. package/build-module/input-control/input-base.mjs.map +2 -2
  54. package/build-module/notice/index.mjs +34 -36
  55. package/build-module/notice/index.mjs.map +2 -2
  56. package/build-module/popover/index.mjs +12 -0
  57. package/build-module/popover/index.mjs.map +2 -2
  58. package/build-module/responsive-wrapper/index.mjs +4 -3
  59. package/build-module/responsive-wrapper/index.mjs.map +2 -2
  60. package/build-module/tabs/styles.mjs +5 -5
  61. package/build-module/tabs/styles.mjs.map +2 -2
  62. package/build-module/tooltip/index.mjs +2 -1
  63. package/build-module/tooltip/index.mjs.map +2 -2
  64. package/build-style/style-rtl.css +64 -66
  65. package/build-style/style.css +64 -66
  66. package/build-types/autocomplete/index.d.ts.map +1 -1
  67. package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
  68. package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
  69. package/build-types/border-box-control/border-box-control/hook.d.ts +24 -10
  70. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  71. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +26 -12
  72. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  73. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +24 -10
  74. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  75. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +25 -11
  76. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  77. package/build-types/border-control/border-control/hook.d.ts +24 -10
  78. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  79. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  80. package/build-types/border-control/border-control-dropdown/hook.d.ts +23 -9
  81. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  82. package/build-types/box-control/index.d.ts +0 -1
  83. package/build-types/box-control/index.d.ts.map +1 -1
  84. package/build-types/box-control/styles/box-control-styles.d.ts +3 -4
  85. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  86. package/build-types/box-control/utils.d.ts +0 -13
  87. package/build-types/box-control/utils.d.ts.map +1 -1
  88. package/build-types/button/stories/e2e/index.story.d.ts +1 -0
  89. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  90. package/build-types/card/card/hook.d.ts +25 -11
  91. package/build-types/card/card/hook.d.ts.map +1 -1
  92. package/build-types/card/card-body/hook.d.ts +25 -11
  93. package/build-types/card/card-body/hook.d.ts.map +1 -1
  94. package/build-types/card/card-divider/hook.d.ts +26 -12
  95. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  96. package/build-types/card/card-footer/hook.d.ts +25 -11
  97. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  98. package/build-types/card/card-header/hook.d.ts +25 -11
  99. package/build-types/card/card-header/hook.d.ts.map +1 -1
  100. package/build-types/card/card-media/hook.d.ts +25 -11
  101. package/build-types/card/card-media/hook.d.ts.map +1 -1
  102. package/build-types/color-picker/styles.d.ts +3 -4
  103. package/build-types/color-picker/styles.d.ts.map +1 -1
  104. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  105. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  106. package/build-types/custom-select-control-v2/styles.d.ts +4 -12
  107. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  108. package/build-types/date-time/time-picker/styles.d.ts +4 -4
  109. package/build-types/draggable/index.d.ts.map +1 -1
  110. package/build-types/draggable/stories/index.story.d.ts +4 -5
  111. package/build-types/draggable/stories/index.story.d.ts.map +1 -1
  112. package/build-types/draggable/types.d.ts +4 -0
  113. package/build-types/draggable/types.d.ts.map +1 -1
  114. package/build-types/elevation/hook.d.ts +25 -11
  115. package/build-types/elevation/hook.d.ts.map +1 -1
  116. package/build-types/flex/flex/hook.d.ts +25 -11
  117. package/build-types/flex/flex/hook.d.ts.map +1 -1
  118. package/build-types/flex/flex-block/hook.d.ts +25 -11
  119. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  120. package/build-types/flex/flex-item/hook.d.ts +25 -11
  121. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  122. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  123. package/build-types/form-token-field/index.d.ts.map +1 -1
  124. package/build-types/grid/hook.d.ts +25 -11
  125. package/build-types/grid/hook.d.ts.map +1 -1
  126. package/build-types/h-stack/hook.d.ts +25 -11
  127. package/build-types/h-stack/hook.d.ts.map +1 -1
  128. package/build-types/heading/hook.d.ts +25 -11
  129. package/build-types/heading/hook.d.ts.map +1 -1
  130. package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -3
  131. package/build-types/higher-order/with-filters/index.d.ts +1 -6
  132. package/build-types/higher-order/with-filters/index.d.ts.map +1 -1
  133. package/build-types/higher-order/with-notices/index.d.ts +2 -4
  134. package/build-types/higher-order/with-notices/index.d.ts.map +1 -1
  135. package/build-types/icon/stories/index.story.d.ts +0 -6
  136. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  137. package/build-types/index.d.ts +1 -6
  138. package/build-types/index.d.ts.map +1 -1
  139. package/build-types/input-control/reducer/reducer.d.ts +1 -1
  140. package/build-types/item-group/item/hook.d.ts +25 -11
  141. package/build-types/item-group/item/hook.d.ts.map +1 -1
  142. package/build-types/item-group/item-group/hook.d.ts +25 -11
  143. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  144. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  145. package/build-types/menu/styles.d.ts +7 -21
  146. package/build-types/menu/styles.d.ts.map +1 -1
  147. package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
  148. package/build-types/navigator/navigator-back-button/hook.d.ts +26 -12
  149. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  150. package/build-types/navigator/navigator-button/hook.d.ts +26 -12
  151. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  152. package/build-types/notice/index.d.ts.map +1 -1
  153. package/build-types/notice/types.d.ts +1 -2
  154. package/build-types/notice/types.d.ts.map +1 -1
  155. package/build-types/number-control/index.d.ts +1 -1
  156. package/build-types/number-control/index.d.ts.map +1 -1
  157. package/build-types/number-control/stories/index.story.d.ts +1 -1
  158. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  159. package/build-types/popover/index.d.ts.map +1 -1
  160. package/build-types/popover/types.d.ts +2 -2
  161. package/build-types/popover/types.d.ts.map +1 -1
  162. package/build-types/range-control/index.d.ts +2 -3
  163. package/build-types/range-control/index.d.ts.map +1 -1
  164. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  165. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  166. package/build-types/range-control/types.d.ts +1 -5
  167. package/build-types/range-control/types.d.ts.map +1 -1
  168. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  169. package/build-types/scrollable/hook.d.ts +25 -11
  170. package/build-types/scrollable/hook.d.ts.map +1 -1
  171. package/build-types/snackbar/index.d.ts +2 -2
  172. package/build-types/snackbar/types.d.ts +2 -2
  173. package/build-types/snackbar/types.d.ts.map +1 -1
  174. package/build-types/spacer/hook.d.ts +25 -11
  175. package/build-types/spacer/hook.d.ts.map +1 -1
  176. package/build-types/surface/hook.d.ts +25 -11
  177. package/build-types/surface/hook.d.ts.map +1 -1
  178. package/build-types/tab-panel/stories/index.story.d.ts +0 -6
  179. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  180. package/build-types/tabs/stories/index.story.d.ts +0 -6
  181. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  182. package/build-types/tabs/styles.d.ts +3 -9
  183. package/build-types/tabs/styles.d.ts.map +1 -1
  184. package/build-types/text/hook.d.ts +25 -11
  185. package/build-types/text/hook.d.ts.map +1 -1
  186. package/build-types/tools-panel/tools-panel/hook.d.ts +25 -11
  187. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  188. package/build-types/tools-panel/tools-panel-header/hook.d.ts +25 -11
  189. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  190. package/build-types/tools-panel/tools-panel-item/hook.d.ts +25 -11
  191. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  192. package/build-types/tooltip/index.d.ts.map +1 -1
  193. package/build-types/truncate/hook.d.ts +25 -11
  194. package/build-types/truncate/hook.d.ts.map +1 -1
  195. package/build-types/unit-control/index.d.ts +1 -1
  196. package/build-types/unit-control/index.d.ts.map +1 -1
  197. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  198. package/build-types/utils/get-node-text.d.ts.map +1 -1
  199. package/build-types/v-stack/hook.d.ts +25 -11
  200. package/build-types/v-stack/hook.d.ts.map +1 -1
  201. package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
  202. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  203. package/build-types/validated-form-controls/components/range-control.d.ts +2 -3
  204. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  205. package/build-types/validated-form-controls/control-with-error.d.ts +4 -1
  206. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  207. package/package.json +27 -25
  208. package/src/autocomplete/README.md +1 -1
  209. package/src/autocomplete/index.tsx +25 -7
  210. package/src/badge/stories/e2e/index.story.tsx +21 -0
  211. package/src/border-control/border-control-dropdown/component.tsx +36 -37
  212. package/src/box-control/index.tsx +0 -1
  213. package/src/box-control/utils.ts +0 -43
  214. package/src/button/stories/e2e/index.story.tsx +11 -0
  215. package/src/composite/stories/index.story.tsx +0 -1
  216. package/src/custom-gradient-picker/gradient-bar/index.tsx +1 -1
  217. package/src/disabled/index.tsx +1 -1
  218. package/src/draggable/index.tsx +32 -10
  219. package/src/draggable/stories/index.story.tsx +11 -6
  220. package/src/draggable/style.module.scss +29 -0
  221. package/src/draggable/types.ts +4 -0
  222. package/src/form-file-upload/README.md +1 -1
  223. package/src/form-token-field/index.tsx +84 -8
  224. package/src/form-token-field/test/index.tsx +189 -0
  225. package/src/h-stack/hook.tsx +1 -1
  226. package/src/higher-order/with-notices/index.tsx +4 -21
  227. package/src/higher-order/with-notices/test/index.tsx +0 -18
  228. package/src/icon/stories/index.story.tsx +2 -14
  229. package/src/index.ts +0 -6
  230. package/src/input-control/input-base.tsx +2 -2
  231. package/src/menu/README.md +7 -7
  232. package/src/menu/stories/index.story.tsx +0 -1
  233. package/src/menu/test/index.tsx +9 -4
  234. package/src/modal/style.scss +2 -1
  235. package/src/notice/README.md +1 -2
  236. package/src/notice/index.tsx +57 -64
  237. package/src/notice/style.scss +49 -41
  238. package/src/notice/test/__snapshots__/index.tsx.snap +23 -23
  239. package/src/notice/test/index.tsx +5 -5
  240. package/src/notice/types.ts +1 -2
  241. package/src/popover/index.tsx +29 -1
  242. package/src/popover/test/index.tsx +138 -1
  243. package/src/popover/types.ts +2 -4
  244. package/src/range-control/stories/index.story.tsx +0 -1
  245. package/src/range-control/types.ts +1 -5
  246. package/src/responsive-wrapper/index.tsx +7 -3
  247. package/src/snackbar/README.md +1 -1
  248. package/src/snackbar/types.ts +2 -2
  249. package/src/style.scss +0 -1
  250. package/src/tab-panel/stories/index.story.tsx +2 -13
  251. package/src/tab-panel/style.scss +36 -14
  252. package/src/tabs/README.md +1 -1
  253. package/src/tabs/stories/index.story.tsx +2 -14
  254. package/src/tabs/styles.ts +3 -8
  255. package/src/tabs/tablist.tsx +1 -1
  256. package/src/tooltip/index.tsx +7 -1
  257. package/src/tree-grid/test/cell.tsx +0 -1
  258. package/src/tree-grid/test/roving-tab-index-item.tsx +0 -1
  259. package/src/tree-select/README.md +1 -1
  260. package/src/utils/get-node-text.ts +7 -1
  261. package/src/validated-form-controls/control-with-error.tsx +6 -1
  262. package/build/navigation/back-button/index.cjs +0 -86
  263. package/build/navigation/back-button/index.cjs.map +0 -7
  264. package/build/navigation/constants.cjs +0 -34
  265. package/build/navigation/constants.cjs.map +0 -7
  266. package/build/navigation/context.cjs +0 -58
  267. package/build/navigation/context.cjs.map +0 -7
  268. package/build/navigation/group/context.cjs +0 -38
  269. package/build/navigation/group/context.cjs.map +0 -7
  270. package/build/navigation/group/index.cjs +0 -88
  271. package/build/navigation/group/index.cjs.map +0 -7
  272. package/build/navigation/index.cjs +0 -113
  273. package/build/navigation/index.cjs.map +0 -7
  274. package/build/navigation/item/base-content.cjs +0 -44
  275. package/build/navigation/item/base-content.cjs.map +0 -7
  276. package/build/navigation/item/base.cjs +0 -66
  277. package/build/navigation/item/base.cjs.map +0 -7
  278. package/build/navigation/item/index.cjs +0 -119
  279. package/build/navigation/item/index.cjs.map +0 -7
  280. package/build/navigation/item/use-navigation-tree-item.cjs +0 -64
  281. package/build/navigation/item/use-navigation-tree-item.cjs.map +0 -7
  282. package/build/navigation/menu/context.cjs +0 -39
  283. package/build/navigation/menu/context.cjs.map +0 -7
  284. package/build/navigation/menu/index.cjs +0 -114
  285. package/build/navigation/menu/index.cjs.map +0 -7
  286. package/build/navigation/menu/menu-title-search.cjs +0 -111
  287. package/build/navigation/menu/menu-title-search.cjs.map +0 -7
  288. package/build/navigation/menu/menu-title.cjs +0 -104
  289. package/build/navigation/menu/menu-title.cjs.map +0 -7
  290. package/build/navigation/menu/search-no-results-found.cjs +0 -48
  291. package/build/navigation/menu/search-no-results-found.cjs.map +0 -7
  292. package/build/navigation/menu/use-navigation-tree-menu.cjs +0 -51
  293. package/build/navigation/menu/use-navigation-tree-menu.cjs.map +0 -7
  294. package/build/navigation/styles/navigation-styles.cjs +0 -170
  295. package/build/navigation/styles/navigation-styles.cjs.map +0 -7
  296. package/build/navigation/types.cjs +0 -19
  297. package/build/navigation/types.cjs.map +0 -7
  298. package/build/navigation/use-create-navigation-tree.cjs +0 -103
  299. package/build/navigation/use-create-navigation-tree.cjs.map +0 -7
  300. package/build/navigation/use-navigation-tree-nodes.cjs +0 -60
  301. package/build/navigation/use-navigation-tree-nodes.cjs.map +0 -7
  302. package/build/navigation/utils.cjs +0 -45
  303. package/build/navigation/utils.cjs.map +0 -7
  304. package/build-module/navigation/back-button/index.mjs +0 -51
  305. package/build-module/navigation/back-button/index.mjs.map +0 -7
  306. package/build-module/navigation/constants.mjs +0 -8
  307. package/build-module/navigation/constants.mjs.map +0 -7
  308. package/build-module/navigation/context.mjs +0 -32
  309. package/build-module/navigation/context.mjs.map +0 -7
  310. package/build-module/navigation/group/context.mjs +0 -12
  311. package/build-module/navigation/group/context.mjs.map +0 -7
  312. package/build-module/navigation/group/index.mjs +0 -53
  313. package/build-module/navigation/group/index.mjs.map +0 -7
  314. package/build-module/navigation/index.mjs +0 -78
  315. package/build-module/navigation/index.mjs.map +0 -7
  316. package/build-module/navigation/item/base-content.mjs +0 -23
  317. package/build-module/navigation/item/base-content.mjs.map +0 -7
  318. package/build-module/navigation/item/base.mjs +0 -35
  319. package/build-module/navigation/item/base.mjs.map +0 -7
  320. package/build-module/navigation/item/index.mjs +0 -84
  321. package/build-module/navigation/item/index.mjs.map +0 -7
  322. package/build-module/navigation/item/use-navigation-tree-item.mjs +0 -39
  323. package/build-module/navigation/item/use-navigation-tree-item.mjs.map +0 -7
  324. package/build-module/navigation/menu/context.mjs +0 -13
  325. package/build-module/navigation/menu/context.mjs.map +0 -7
  326. package/build-module/navigation/menu/index.mjs +0 -79
  327. package/build-module/navigation/menu/index.mjs.map +0 -7
  328. package/build-module/navigation/menu/menu-title-search.mjs +0 -80
  329. package/build-module/navigation/menu/menu-title-search.mjs.map +0 -7
  330. package/build-module/navigation/menu/menu-title.mjs +0 -73
  331. package/build-module/navigation/menu/menu-title.mjs.map +0 -7
  332. package/build-module/navigation/menu/search-no-results-found.mjs +0 -27
  333. package/build-module/navigation/menu/search-no-results-found.mjs.map +0 -7
  334. package/build-module/navigation/menu/use-navigation-tree-menu.mjs +0 -26
  335. package/build-module/navigation/menu/use-navigation-tree-menu.mjs.map +0 -7
  336. package/build-module/navigation/styles/navigation-styles.mjs +0 -124
  337. package/build-module/navigation/styles/navigation-styles.mjs.map +0 -7
  338. package/build-module/navigation/types.mjs +0 -1
  339. package/build-module/navigation/types.mjs.map +0 -7
  340. package/build-module/navigation/use-create-navigation-tree.mjs +0 -78
  341. package/build-module/navigation/use-create-navigation-tree.mjs.map +0 -7
  342. package/build-module/navigation/use-navigation-tree-nodes.mjs +0 -35
  343. package/build-module/navigation/use-navigation-tree-nodes.mjs.map +0 -7
  344. package/build-module/navigation/utils.mjs +0 -9
  345. package/build-module/navigation/utils.mjs.map +0 -7
  346. package/build-types/navigation/back-button/index.d.ts +0 -7
  347. package/build-types/navigation/back-button/index.d.ts.map +0 -1
  348. package/build-types/navigation/constants.d.ts +0 -3
  349. package/build-types/navigation/constants.d.ts.map +0 -1
  350. package/build-types/navigation/context.d.ts +0 -4
  351. package/build-types/navigation/context.d.ts.map +0 -1
  352. package/build-types/navigation/group/context.d.ts +0 -7
  353. package/build-types/navigation/group/context.d.ts.map +0 -1
  354. package/build-types/navigation/group/index.d.ts +0 -7
  355. package/build-types/navigation/group/index.d.ts.map +0 -1
  356. package/build-types/navigation/index.d.ts +0 -46
  357. package/build-types/navigation/index.d.ts.map +0 -1
  358. package/build-types/navigation/item/base-content.d.ts +0 -3
  359. package/build-types/navigation/item/base-content.d.ts.map +0 -1
  360. package/build-types/navigation/item/base.d.ts +0 -3
  361. package/build-types/navigation/item/base.d.ts.map +0 -1
  362. package/build-types/navigation/item/index.d.ts +0 -7
  363. package/build-types/navigation/item/index.d.ts.map +0 -1
  364. package/build-types/navigation/item/use-navigation-tree-item.d.ts +0 -3
  365. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +0 -1
  366. package/build-types/navigation/menu/context.d.ts +0 -7
  367. package/build-types/navigation/menu/context.d.ts.map +0 -1
  368. package/build-types/navigation/menu/index.d.ts +0 -7
  369. package/build-types/navigation/menu/index.d.ts.map +0 -1
  370. package/build-types/navigation/menu/menu-title-search.d.ts +0 -3
  371. package/build-types/navigation/menu/menu-title-search.d.ts.map +0 -1
  372. package/build-types/navigation/menu/menu-title.d.ts +0 -3
  373. package/build-types/navigation/menu/menu-title.d.ts.map +0 -1
  374. package/build-types/navigation/menu/search-no-results-found.d.ts +0 -3
  375. package/build-types/navigation/menu/search-no-results-found.d.ts.map +0 -1
  376. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +0 -3
  377. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +0 -1
  378. package/build-types/navigation/stories/index.story.d.ts +0 -23
  379. package/build-types/navigation/stories/index.story.d.ts.map +0 -1
  380. package/build-types/navigation/stories/utils/controlled-state.d.ts +0 -7
  381. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +0 -1
  382. package/build-types/navigation/stories/utils/default.d.ts +0 -10
  383. package/build-types/navigation/stories/utils/default.d.ts.map +0 -1
  384. package/build-types/navigation/stories/utils/group.d.ts +0 -10
  385. package/build-types/navigation/stories/utils/group.d.ts.map +0 -1
  386. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +0 -10
  387. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +0 -1
  388. package/build-types/navigation/stories/utils/more-examples.d.ts +0 -10
  389. package/build-types/navigation/stories/utils/more-examples.d.ts.map +0 -1
  390. package/build-types/navigation/stories/utils/search.d.ts +0 -10
  391. package/build-types/navigation/stories/utils/search.d.ts.map +0 -1
  392. package/build-types/navigation/styles/navigation-styles.d.ts +0 -55
  393. package/build-types/navigation/styles/navigation-styles.d.ts.map +0 -1
  394. package/build-types/navigation/test/index.d.ts +0 -2
  395. package/build-types/navigation/test/index.d.ts.map +0 -1
  396. package/build-types/navigation/types.d.ts +0 -266
  397. package/build-types/navigation/types.d.ts.map +0 -1
  398. package/build-types/navigation/use-create-navigation-tree.d.ts +0 -15
  399. package/build-types/navigation/use-create-navigation-tree.d.ts.map +0 -1
  400. package/build-types/navigation/use-navigation-tree-nodes.d.ts +0 -10
  401. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +0 -1
  402. package/build-types/navigation/utils.d.ts +0 -3
  403. package/build-types/navigation/utils.d.ts.map +0 -1
  404. package/src/draggable/style.scss +0 -21
  405. package/src/navigation/README.md +0 -267
  406. package/src/navigation/back-button/index.tsx +0 -73
  407. package/src/navigation/constants.tsx +0 -2
  408. package/src/navigation/context.tsx +0 -40
  409. package/src/navigation/group/context.tsx +0 -16
  410. package/src/navigation/group/index.tsx +0 -73
  411. package/src/navigation/index.tsx +0 -152
  412. package/src/navigation/item/base-content.tsx +0 -31
  413. package/src/navigation/item/base.tsx +0 -42
  414. package/src/navigation/item/index.tsx +0 -112
  415. package/src/navigation/item/use-navigation-tree-item.tsx +0 -47
  416. package/src/navigation/menu/context.tsx +0 -20
  417. package/src/navigation/menu/index.tsx +0 -105
  418. package/src/navigation/menu/menu-title-search.tsx +0 -99
  419. package/src/navigation/menu/menu-title.tsx +0 -100
  420. package/src/navigation/menu/search-no-results-found.tsx +0 -34
  421. package/src/navigation/menu/use-navigation-tree-menu.tsx +0 -29
  422. package/src/navigation/stories/index.story.tsx +0 -62
  423. package/src/navigation/stories/style.css +0 -25
  424. package/src/navigation/stories/utils/controlled-state.tsx +0 -149
  425. package/src/navigation/stories/utils/default.tsx +0 -92
  426. package/src/navigation/stories/utils/group.tsx +0 -61
  427. package/src/navigation/stories/utils/hide-if-empty.tsx +0 -66
  428. package/src/navigation/stories/utils/more-examples.tsx +0 -162
  429. package/src/navigation/stories/utils/search.tsx +0 -91
  430. package/src/navigation/styles/navigation-styles.tsx +0 -197
  431. package/src/navigation/test/index.tsx +0 -347
  432. package/src/navigation/types.ts +0 -325
  433. package/src/navigation/use-create-navigation-tree.tsx +0 -110
  434. package/src/navigation/use-navigation-tree-nodes.tsx +0 -31
  435. package/src/navigation/utils.tsx +0 -11
@@ -8,16 +8,28 @@ import type { DragEvent } from 'react';
8
8
  */
9
9
  import { throttle } from '@wordpress/compose';
10
10
  import { useEffect, useRef } from '@wordpress/element';
11
+ import { getWpCompatOverlaySlot } from '@wordpress/ui';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
15
16
  import type { DraggableProps } from './types';
16
-
17
- const dragImageClass = 'components-draggable__invisible-drag-image';
18
- const cloneWrapperClass = 'components-draggable__clone';
19
- const clonePadding = 0;
17
+ import styles from './style.module.scss';
18
+
19
+ // Legacy class names preserved alongside the CSS-module hashed ones for
20
+ // backwards compatibility. `filter(Boolean)` strips `undefined` from Jest's
21
+ // CSS-module mock.
22
+ const dragImageClasses = [
23
+ styles[ 'invisible-drag-image' ],
24
+ 'components-draggable__invisible-drag-image',
25
+ ].filter( Boolean );
26
+ const cloneWrapperClasses = [
27
+ styles.clone,
28
+ 'components-draggable__clone',
29
+ ].filter( Boolean );
30
+ // Global class — shared with external code (e.g. block-editor keyboard drag).
20
31
  const bodyClass = 'is-dragging-components-draggable';
32
+ const clonePadding = 0;
21
33
 
22
34
  /**
23
35
  * `Draggable` is a Component that provides a way to set up a cross-browser
@@ -99,6 +111,10 @@ export function Draggable( {
99
111
  */
100
112
  function start( event: DragEvent ) {
101
113
  const { ownerDocument } = event.target as HTMLElement;
114
+ // Only use the slot when it lives in the same document as the
115
+ // dragged element, so coordinate resolution stays in one space.
116
+ const slot = getWpCompatOverlaySlot();
117
+ const compatSlot = slot?.ownerDocument === ownerDocument ? slot : null;
102
118
 
103
119
  event.dataTransfer.setData(
104
120
  transferDataType,
@@ -116,12 +132,18 @@ export function Draggable( {
116
132
  // right after. event.dataTransfer.setDragImage is not supported yet in
117
133
  // IE, we need to check for its existence first.
118
134
  if ( 'function' === typeof event.dataTransfer.setDragImage ) {
119
- dragImage.classList.add( dragImageClass );
135
+ dragImage.classList.add( ...dragImageClasses );
136
+ // Invisible — stays at the document body, no slot needed.
120
137
  ownerDocument.body.appendChild( dragImage );
121
138
  event.dataTransfer.setDragImage( dragImage, 0, 0 );
122
139
  }
123
140
 
124
- cloneWrapper.classList.add( cloneWrapperClass );
141
+ cloneWrapper.classList.add( ...cloneWrapperClasses );
142
+
143
+ const inSlotClass = styles[ 'is-in-compat-slot' ];
144
+ if ( compatSlot && inSlotClass ) {
145
+ cloneWrapper.classList.add( inSlotClass );
146
+ }
125
147
 
126
148
  if ( cloneClassname ) {
127
149
  cloneWrapper.classList.add( cloneClassname );
@@ -141,8 +163,7 @@ export function Draggable( {
141
163
  clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;
142
164
  cloneWrapper.appendChild( clonedDragComponent );
143
165
 
144
- // Inject the cloneWrapper into the DOM.
145
- ownerDocument.body.appendChild( cloneWrapper );
166
+ ( compatSlot ?? ownerDocument.body ).appendChild( cloneWrapper );
146
167
  } else {
147
168
  const element = ownerDocument.getElementById(
148
169
  elementId
@@ -173,8 +194,9 @@ export function Draggable( {
173
194
 
174
195
  cloneWrapper.appendChild( clone );
175
196
 
176
- // Inject the cloneWrapper into the DOM.
177
- if ( appendToOwnerDocument ) {
197
+ if ( compatSlot ) {
198
+ compatSlot.appendChild( cloneWrapper );
199
+ } else if ( appendToOwnerDocument ) {
178
200
  ownerDocument.body.appendChild( cloneWrapper );
179
201
  } else {
180
202
  elementWrapper?.appendChild( cloneWrapper );
@@ -32,7 +32,13 @@ const meta: Meta< typeof Draggable > = {
32
32
  },
33
33
  parameters: {
34
34
  controls: { expanded: true },
35
- docs: { source: { code: '' } },
35
+ docs: {
36
+ source: { code: '' },
37
+ // Render in its own iframe — Storybook's docs-page wrappers
38
+ // create transform-based containing blocks that break the
39
+ // clone's `position: fixed` resolution.
40
+ story: { inline: false, height: '250px' },
41
+ },
36
42
  componentStatus: {
37
43
  status: 'use-with-caution',
38
44
  whereUsed: 'global',
@@ -115,11 +121,10 @@ export const Default: StoryFn< typeof Draggable > = DefaultTemplate.bind( {} );
115
121
  Default.args = {};
116
122
 
117
123
  /**
118
- * `appendToOwnerDocument` is used to append the element being dragged to the body of the owner document.
119
- *
120
- * This is useful when the element being dragged should not receive styles from its parent.
121
- * For example, when the element's parent sets a `z-index` value that would cause the dragged
122
- * element to be rendered behind other elements.
124
+ * `appendToOwnerDocument` appends the dragged element's clone to the owner
125
+ * document's body instead of the element's parent, which is useful when an
126
+ * ancestor's stacking context (e.g. its `z-index`) would otherwise place the
127
+ * clone behind other content.
123
128
  */
124
129
  export const AppendElementToOwnerDocument: StoryFn< typeof Draggable > =
125
130
  DefaultTemplate.bind( {} );
@@ -0,0 +1,29 @@
1
+ @use "@wordpress/base-styles/z-index" as *;
2
+
3
+ .invisible-drag-image {
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. */
6
+ left: -1000px;
7
+ height: 50px;
8
+ width: 50px;
9
+ }
10
+
11
+ .clone {
12
+ position: fixed;
13
+ padding: 0; // Matches the `clonePadding` JS constant.
14
+ background: transparent;
15
+ pointer-events: none;
16
+ }
17
+
18
+ // Fallback for clones placed outside the compat overlay slot — the
19
+ // slot's stacking context handles ordering inside it.
20
+ .clone:not(.is-in-compat-slot) {
21
+ z-index: z-index(".components-draggable__clone");
22
+ }
23
+
24
+ // Global selector — external code (e.g. block-editor keyboard drag)
25
+ // toggles the same body class.
26
+ :global(body.is-dragging-components-draggable) {
27
+ cursor: move; /* Fallback for IE/Edge < 14 */
28
+ cursor: grabbing !important;
29
+ }
@@ -21,6 +21,10 @@ export type DraggableProps = {
21
21
  * Whether to append the cloned element to the `ownerDocument` body.
22
22
  * By default, elements sourced by id are appended to the element's wrapper.
23
23
  *
24
+ * Has no effect when the `@wordpress/ui` compat overlay slot is in use in
25
+ * the same document — the clone goes into the slot instead. Cross-document
26
+ * drags fall back to this prop's regular semantics.
27
+ *
24
28
  * @default false
25
29
  */
26
30
  appendToOwnerDocument?: boolean;
@@ -65,7 +65,7 @@ Whether to allow multiple selection of files or not.
65
65
 
66
66
  ### `onChange`
67
67
 
68
- - Type: `ChangeEventHandler<HTMLInputElement> | undefined`
68
+ - Type: `ChangeEventHandler<HTMLInputElement, HTMLInputElement> | undefined`
69
69
  - Required: Yes
70
70
 
71
71
  Callback function passed directly to the `input` file element.
@@ -253,7 +253,9 @@ export function FormTokenField( props: FormTokenFieldProps ) {
253
253
  break;
254
254
  case 'Space':
255
255
  if ( tokenizeOnSpace ) {
256
- preventDefault = addCurrentToken();
256
+ preventDefault = addCurrentToken( {
257
+ preventDefaultOnFailedValidation: false,
258
+ } );
257
259
  }
258
260
  break;
259
261
  case 'Escape':
@@ -320,7 +322,65 @@ export function FormTokenField( props: FormTokenFieldProps ) {
320
322
  const tokenValue = items[ items.length - 1 ] || '';
321
323
 
322
324
  if ( items.length > 1 ) {
323
- addNewTokens( items.slice( 0, -1 ) );
325
+ const tokensToProcess = items.slice( 0, -1 );
326
+
327
+ // Pre-check: would any segment be rejected by
328
+ // `__experimentalValidateInput`? Empties and duplicates of the
329
+ // current selection are intentional skips, not failures.
330
+ const willFailValidation = ( segment: string ) => {
331
+ const transformed = saveTransform( segment );
332
+ return (
333
+ !! transformed &&
334
+ ! valueContainsToken( transformed ) &&
335
+ ! __experimentalValidateInput( transformed )
336
+ );
337
+ };
338
+ const hasFailures = tokensToProcess.some( willFailValidation );
339
+
340
+ // When there are failures, also commit the trailing in-progress
341
+ // segment so the user is left with only the items that need
342
+ // fixing, instead of mixing the trailing segment with the failed
343
+ // ones (which would block tokenization on Enter or comma).
344
+ const addedTokens = addNewTokens(
345
+ hasFailures ? items : tokensToProcess
346
+ );
347
+
348
+ if ( hasFailures ) {
349
+ // Derive rejected segments from `addedTokens` so this stays
350
+ // in sync with `addNewTokens`'s filter chain.
351
+ const rejected = items.filter( ( token ) => {
352
+ const transformed = saveTransform( token );
353
+ if ( ! transformed ) {
354
+ return false;
355
+ }
356
+ if ( addedTokens.has( transformed ) ) {
357
+ return false;
358
+ }
359
+ if ( valueContainsToken( transformed ) ) {
360
+ return false;
361
+ }
362
+ return ! __experimentalValidateInput( transformed );
363
+ } );
364
+
365
+ // Reuse the separator the user actually used (the last one
366
+ // in `text`) so we don't rewrite their input: comma-separated
367
+ // paste under `tokenizeOnSpace` stays comma-separated, and
368
+ // typed space under `tokenizeOnSpace` stays a space. Falls
369
+ // back to the mode-appropriate separator only when no
370
+ // separator characters are present in `text`.
371
+ const usedSeparators = text.match( /[ ,\t]/g );
372
+ const separatorChar =
373
+ usedSeparators?.[ usedSeparators.length - 1 ] ??
374
+ ( tokenizeOnSpace ? ' ' : ',' );
375
+ // Preserve a trailing separator when the input ended with
376
+ // one, so the user can keep typing past a failed-validation
377
+ // space without their separator disappearing.
378
+ const trailing = tokenValue === '' ? separatorChar : '';
379
+ const remaining = rejected.join( separatorChar ) + trailing;
380
+ setIncompleteTokenValue( remaining );
381
+ onInputChange( remaining );
382
+ return;
383
+ }
324
384
  }
325
385
  setIncompleteTokenValue( tokenValue );
326
386
  onInputChange( tokenValue );
@@ -417,7 +477,9 @@ export function FormTokenField( props: FormTokenFieldProps ) {
417
477
  addNewToken( incompleteTokenValue );
418
478
  }
419
479
 
420
- return true; // PreventDefault.
480
+ // Comma is always a separator (typed in onKeyPress, never as input).
481
+ // Pasted commas go through onInputChangeHandler, which validates.
482
+ return true;
421
483
  }
422
484
 
423
485
  function moveInputToIndex( index: number ) {
@@ -454,7 +516,9 @@ export function FormTokenField( props: FormTokenFieldProps ) {
454
516
  }
455
517
  }
456
518
 
457
- function addCurrentToken() {
519
+ function addCurrentToken( {
520
+ preventDefaultOnFailedValidation = true,
521
+ } = {} ) {
458
522
  let preventDefault = false;
459
523
  const selectedSuggestion = getSelectedSuggestion();
460
524
 
@@ -462,20 +526,22 @@ export function FormTokenField( props: FormTokenFieldProps ) {
462
526
  addNewToken( selectedSuggestion );
463
527
  preventDefault = true;
464
528
  } else if ( inputHasValidValue() ) {
465
- addNewToken( incompleteTokenValue );
466
- preventDefault = true;
529
+ const passedValidation = addNewToken( incompleteTokenValue );
530
+ preventDefault =
531
+ passedValidation || preventDefaultOnFailedValidation;
467
532
  }
468
533
 
469
534
  return preventDefault;
470
535
  }
471
536
 
472
- function addNewTokens( tokens: string[] ) {
537
+ function addNewTokens( tokens: string[] ): Set< string > {
473
538
  const tokensToAdd = [
474
539
  ...new Set(
475
540
  tokens
476
541
  .map( saveTransform )
477
542
  .filter( Boolean )
478
543
  .filter( ( token ) => ! valueContainsToken( token ) )
544
+ .filter( ( token ) => __experimentalValidateInput( token ) )
479
545
  ),
480
546
  ];
481
547
 
@@ -484,12 +550,20 @@ export function FormTokenField( props: FormTokenFieldProps ) {
484
550
  newValue.splice( getIndexOfInput(), 0, ...tokensToAdd );
485
551
  onChange( newValue );
486
552
  }
553
+
554
+ return new Set( tokensToAdd );
487
555
  }
488
556
 
557
+ /**
558
+ * Validates and adds `token`. Returns `true` if validation passed,
559
+ * `false` if it was rejected by `__experimentalValidateInput`. A `true`
560
+ * return does not guarantee the token was added: `addNewTokens` may
561
+ * still drop it as a duplicate or after `saveTransform` returns empty.
562
+ */
489
563
  function addNewToken( token: string ) {
490
564
  if ( ! __experimentalValidateInput( token ) ) {
491
565
  speak( messages.__experimentalInvalid, 'assertive' );
492
- return;
566
+ return false;
493
567
  }
494
568
  addNewTokens( [ token ] );
495
569
  speak( messages.added, 'assertive' );
@@ -502,6 +576,8 @@ export function FormTokenField( props: FormTokenFieldProps ) {
502
576
  if ( isActive && ! tokenizeOnBlur ) {
503
577
  focus();
504
578
  }
579
+
580
+ return true;
505
581
  }
506
582
 
507
583
  function deleteToken( token: string | TokenItem ) {
@@ -1929,6 +1929,195 @@ describe( 'FormTokenField', () => {
1929
1929
  expect( onChangeSpy ).toHaveBeenCalledTimes( 2 );
1930
1930
  expectTokensToBeInTheDocument( [ 'cherry', 'Cranberry' ] );
1931
1931
  } );
1932
+
1933
+ it( 'should still preventDefault on Enter when validation rejects the value', async () => {
1934
+ const user = userEvent.setup();
1935
+
1936
+ const onChangeSpy = jest.fn();
1937
+ const onSubmitSpy = jest.fn( ( e: React.FormEvent ) =>
1938
+ e.preventDefault()
1939
+ );
1940
+ const startsWithCapitalLetter = ( tokenText: string ) =>
1941
+ /^[A-Z]/.test( tokenText );
1942
+
1943
+ render(
1944
+ <form onSubmit={ onSubmitSpy }>
1945
+ <FormTokenFieldWithState
1946
+ onChange={ onChangeSpy }
1947
+ __experimentalValidateInput={ startsWithCapitalLetter }
1948
+ />
1949
+ </form>
1950
+ );
1951
+
1952
+ const input = screen.getByRole( 'combobox' );
1953
+
1954
+ // Type 'hello' — lowercase, fails validation.
1955
+ // Press Enter — should NOT submit the parent form.
1956
+ await user.type( input, 'hello[Enter]' );
1957
+ expect( onChangeSpy ).not.toHaveBeenCalled();
1958
+ expect( onSubmitSpy ).not.toHaveBeenCalled();
1959
+ expect( input ).toHaveValue( 'hello' );
1960
+ } );
1961
+
1962
+ it( 'should not preventDefault on space when validation fails and `tokenizeOnSpace` is true', async () => {
1963
+ const user = userEvent.setup();
1964
+
1965
+ const onChangeSpy = jest.fn();
1966
+ const startsWithCapitalLetter = ( tokenText: string ) =>
1967
+ /^[A-Z]/.test( tokenText );
1968
+
1969
+ render(
1970
+ <FormTokenFieldWithState
1971
+ onChange={ onChangeSpy }
1972
+ tokenizeOnSpace
1973
+ __experimentalValidateInput={ startsWithCapitalLetter }
1974
+ />
1975
+ );
1976
+
1977
+ const input = screen.getByRole( 'combobox' );
1978
+
1979
+ // Type 'hello ', lowercase, fails validation.
1980
+ // The space should be typed into the input (not prevented), and
1981
+ // the trailing space should be preserved by the rejoin so the
1982
+ // user can keep typing past the failed-validation space.
1983
+ await user.type( input, 'hello ' );
1984
+ expect( onChangeSpy ).not.toHaveBeenCalled();
1985
+ expect( input ).toHaveValue( 'hello ' );
1986
+
1987
+ // User can keep typing past the failed-validation space.
1988
+ await user.type( input, 'w' );
1989
+ expect( input ).toHaveValue( 'hello w' );
1990
+
1991
+ // Clear and type 'Hello ', capital letter, passes validation.
1992
+ // The space should be prevented, and a token should be created.
1993
+ await user.clear( input );
1994
+ await user.type( input, 'Hello ' );
1995
+ expect( onChangeSpy ).toHaveBeenCalledTimes( 1 );
1996
+ expect( onChangeSpy ).toHaveBeenCalledWith( [ 'Hello' ] );
1997
+ expectTokensToBeInTheDocument( [ 'Hello' ] );
1998
+ } );
1999
+
2000
+ it( 'should filter out invalid tokens when pasting with separators', async () => {
2001
+ const user = userEvent.setup();
2002
+
2003
+ const onChangeSpy = jest.fn();
2004
+ const startsWithCapitalLetter = ( tokenText: string ) =>
2005
+ /^[A-Z]/.test( tokenText );
2006
+
2007
+ render(
2008
+ <FormTokenFieldWithState
2009
+ onChange={ onChangeSpy }
2010
+ __experimentalValidateInput={ startsWithCapitalLetter }
2011
+ />
2012
+ );
2013
+
2014
+ const input = screen.getByRole( 'combobox' );
2015
+
2016
+ // Paste values separated by comma, only valid ones should be added.
2017
+ // Uses paste (not type) because comma keystrokes go through
2018
+ // handleCommaKey, while pasted text goes through
2019
+ // onInputChangeHandler which splits by separator.
2020
+ await user.click( input );
2021
+ await user.paste( 'Apple,banana,Cherry,' );
2022
+ expect( onChangeSpy ).toHaveBeenCalledWith( [ 'Apple', 'Cherry' ] );
2023
+ expectTokensToBeInTheDocument( [ 'Apple', 'Cherry' ] );
2024
+ expectTokensNotToBeInTheDocument( [ 'banana' ] );
2025
+ expect( input ).toHaveValue( 'banana,' );
2026
+ } );
2027
+
2028
+ it( 'should leave all segments in the input when none pass validation on paste', async () => {
2029
+ const user = userEvent.setup();
2030
+
2031
+ const onChangeSpy = jest.fn();
2032
+ const startsWithCapitalLetter = ( tokenText: string ) =>
2033
+ /^[A-Z]/.test( tokenText );
2034
+
2035
+ render(
2036
+ <FormTokenFieldWithState
2037
+ onChange={ onChangeSpy }
2038
+ __experimentalValidateInput={ startsWithCapitalLetter }
2039
+ />
2040
+ );
2041
+
2042
+ const input = screen.getByRole( 'combobox' );
2043
+
2044
+ await user.click( input );
2045
+ await user.paste( 'apple,banana,cherry,' );
2046
+
2047
+ expect( onChangeSpy ).not.toHaveBeenCalled();
2048
+ expect( input ).toHaveValue( 'apple,banana,cherry,' );
2049
+ } );
2050
+
2051
+ it( 'should commit a trailing valid segment and leave only failed segments in the input when pasting without a trailing separator', async () => {
2052
+ const user = userEvent.setup();
2053
+
2054
+ const onChangeSpy = jest.fn();
2055
+ const startsWithCapitalLetter = ( tokenText: string ) =>
2056
+ /^[A-Z]/.test( tokenText );
2057
+
2058
+ render(
2059
+ <FormTokenFieldWithState
2060
+ onChange={ onChangeSpy }
2061
+ __experimentalValidateInput={ startsWithCapitalLetter }
2062
+ />
2063
+ );
2064
+
2065
+ const input = screen.getByRole( 'combobox' );
2066
+
2067
+ await user.click( input );
2068
+ await user.paste( 'Apple,banana,Cherry' );
2069
+
2070
+ expect( onChangeSpy ).toHaveBeenCalledWith( [ 'Apple', 'Cherry' ] );
2071
+ expectTokensToBeInTheDocument( [ 'Apple', 'Cherry' ] );
2072
+ expect( input ).toHaveValue( 'banana' );
2073
+ } );
2074
+
2075
+ it( 'should not leave a duplicate of an existing token in the input when pasting comma-separated values', async () => {
2076
+ const user = userEvent.setup();
2077
+
2078
+ const onChangeSpy = jest.fn();
2079
+
2080
+ render(
2081
+ <FormTokenFieldWithState
2082
+ onChange={ onChangeSpy }
2083
+ initialValue={ [ 'Apple' ] }
2084
+ />
2085
+ );
2086
+
2087
+ const input = screen.getByRole( 'combobox' );
2088
+
2089
+ await user.click( input );
2090
+ await user.paste( 'Apple,Cherry,' );
2091
+
2092
+ expect( onChangeSpy ).toHaveBeenCalledWith( [ 'Apple', 'Cherry' ] );
2093
+ expectTokensToBeInTheDocument( [ 'Apple', 'Cherry' ] );
2094
+ expect( input ).toHaveValue( '' );
2095
+ } );
2096
+
2097
+ it( 'should not leave a duplicate of an existing token in the input when pasting comma-separated values with `__experimentalValidateInput`', async () => {
2098
+ const user = userEvent.setup();
2099
+
2100
+ const onChangeSpy = jest.fn();
2101
+ const startsWithCapitalLetter = ( tokenText: string ) =>
2102
+ /^[A-Z]/.test( tokenText );
2103
+
2104
+ render(
2105
+ <FormTokenFieldWithState
2106
+ onChange={ onChangeSpy }
2107
+ initialValue={ [ 'Apple' ] }
2108
+ __experimentalValidateInput={ startsWithCapitalLetter }
2109
+ />
2110
+ );
2111
+
2112
+ const input = screen.getByRole( 'combobox' );
2113
+
2114
+ await user.click( input );
2115
+ await user.paste( 'Apple,Cherry,' );
2116
+
2117
+ expect( onChangeSpy ).toHaveBeenCalledWith( [ 'Apple', 'Cherry' ] );
2118
+ expectTokensToBeInTheDocument( [ 'Apple', 'Cherry' ] );
2119
+ expect( input ).toHaveValue( '' );
2120
+ } );
1932
2121
  } );
1933
2122
 
1934
2123
  describe( 'maxLength', () => {
@@ -29,7 +29,7 @@ export function useHStack( props: WordPressComponentProps< Props, 'div' > ) {
29
29
  const _isSpacer = hasConnectNamespace( child, [ 'Spacer' ] );
30
30
 
31
31
  if ( _isSpacer ) {
32
- const childElement = child as ReactElement;
32
+ const childElement = child as ReactElement< typeof FlexItem >;
33
33
  const _key = childElement.key || `hstack-${ index }`;
34
34
 
35
35
  return <FlexItem isBlock key={ _key } { ...childElement.props } />;
@@ -6,7 +6,7 @@ import { v4 as uuid } from 'uuid';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { forwardRef, useState, useMemo } from '@wordpress/element';
9
+ import { useState, useMemo } from '@wordpress/element';
10
10
  import { createHigherOrderComponent } from '@wordpress/compose';
11
11
 
12
12
  /**
@@ -45,10 +45,7 @@ import type { WithNoticeProps } from './types';
45
45
  * @return Wrapped component.
46
46
  */
47
47
  export default createHigherOrderComponent( ( OriginalComponent ) => {
48
- function Component(
49
- props: { [ key: string ]: any },
50
- ref: React.ForwardedRef< any >
51
- ) {
48
+ return function Component( props: { [ key: string ]: any } ) {
52
49
  const [ noticeList, setNoticeList ] = useState<
53
50
  WithNoticeProps[ 'noticeList' ]
54
51
  >( [] );
@@ -97,20 +94,6 @@ export default createHigherOrderComponent( ( OriginalComponent ) => {
97
94
  ),
98
95
  };
99
96
 
100
- return isForwardRef ? (
101
- <OriginalComponent { ...propsOut } ref={ ref } />
102
- ) : (
103
- <OriginalComponent { ...propsOut } />
104
- );
105
- }
106
-
107
- let isForwardRef: boolean;
108
- // @ts-expect-error - `render` will only be present when OriginalComponent was wrapped with forwardRef().
109
- const { render } = OriginalComponent;
110
- // Returns a forwardRef if OriginalComponent appears to be a forwardRef.
111
- if ( typeof render === 'function' ) {
112
- isForwardRef = true;
113
- return forwardRef( Component );
114
- }
115
- return Component;
97
+ return <OriginalComponent { ...propsOut } />;
98
+ };
116
99
  }, 'withNotices' );
@@ -33,14 +33,6 @@ function noticesFrom( list: string[] ) {
33
33
  return list.map( ( item ) => ( { id: item, content: item } ) );
34
34
  }
35
35
 
36
- function isComponentLike( object: any ) {
37
- return typeof object === 'function';
38
- }
39
-
40
- function isForwardRefLike( { render: renderMethod }: any ) {
41
- return typeof renderMethod === 'function';
42
- }
43
-
44
36
  const content = 'Base content';
45
37
 
46
38
  const BaseComponent = ( {
@@ -80,16 +72,6 @@ const TestNoticeOperations = withNotices(
80
72
  } )
81
73
  );
82
74
 
83
- describe( 'withNotices return type', () => {
84
- it( 'should be a component given a component', () => {
85
- expect( isComponentLike( TestComponent ) ).toBe( true );
86
- } );
87
-
88
- it( 'should be a forwardRef given a forwardRef', () => {
89
- expect( isForwardRefLike( TestNoticeOperations ) ).toBe( true );
90
- } );
91
- } );
92
-
93
75
  describe( 'withNotices operations', () => {
94
76
  function setup( props: any = {} ) {
95
77
  const handle = createRef< any >();
@@ -1,31 +1,19 @@
1
- /**
2
- * External dependencies
3
- */
4
1
  import type { Meta, StoryFn } from '@storybook/react-vite';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
2
  import { SVG, Path } from '@wordpress/primitives';
10
3
  import { wordpress } from '@wordpress/icons';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
4
  import Icon from '..';
16
5
  import { VStack } from '../../v-stack';
17
6
 
18
7
  const meta: Meta< typeof Icon > = {
19
- tags: [ 'manifest' ],
20
8
  title: 'Components/Icon',
21
9
  component: Icon,
22
10
  parameters: {
23
11
  controls: { expanded: true },
24
12
  docs: { canvas: { sourceState: 'shown' } },
25
13
  componentStatus: {
26
- status: 'recommended',
14
+ status: 'use-with-caution',
27
15
  whereUsed: 'global',
28
- notes: 'Prefer this component over the `Icon` component from `@wordpress/icons`.',
16
+ notes: 'When rendering SVGs, use `Icon` from `@wordpress/ui` instead.',
29
17
  },
30
18
  },
31
19
  };
package/src/index.ts CHANGED
@@ -45,7 +45,6 @@ export {
45
45
  /** @deprecated Import `BoxControl` instead. */
46
46
  default as __experimentalBoxControl,
47
47
  default as BoxControl,
48
- applyValueToSides as __experimentalApplyValueToSides,
49
48
  } from './box-control';
50
49
  export { default as Button } from './button';
51
50
  export { default as ButtonGroup } from './button-group';
@@ -118,11 +117,6 @@ export { default as MenuItemsChoice } from './menu-items-choice';
118
117
  export { default as Modal } from './modal';
119
118
  export { default as ScrollLock } from './scroll-lock';
120
119
  export { NavigableMenu, TabbableContainer } from './navigable-container';
121
- export { default as __experimentalNavigation } from './navigation';
122
- export { default as __experimentalNavigationBackButton } from './navigation/back-button';
123
- export { default as __experimentalNavigationGroup } from './navigation/group';
124
- export { default as __experimentalNavigationItem } from './navigation/item';
125
- export { default as __experimentalNavigationMenu } from './navigation/menu';
126
120
  export {
127
121
  /** @deprecated Import `Navigator` instead. */
128
122
  NavigatorProvider as __experimentalNavigatorProvider,