@wordpress/components 25.1.0 → 25.1.2

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 (1049) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/README.md +1 -1
  3. package/build/alignment-matrix-control/cell.js +4 -5
  4. package/build/alignment-matrix-control/cell.js.map +1 -1
  5. package/build/alignment-matrix-control/icon.js +2 -4
  6. package/build/alignment-matrix-control/icon.js.map +1 -1
  7. package/build/alignment-matrix-control/index.js +6 -7
  8. package/build/alignment-matrix-control/index.js.map +1 -1
  9. package/build/angle-picker-control/angle-circle.js +4 -7
  10. package/build/angle-picker-control/angle-circle.js.map +1 -1
  11. package/build/angle-picker-control/index.js +2 -4
  12. package/build/angle-picker-control/index.js.map +1 -1
  13. package/build/autocomplete/autocompleter-ui.js +28 -1
  14. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  15. package/build/autocomplete/index.js +0 -20
  16. package/build/autocomplete/index.js.map +1 -1
  17. package/build/base-control/index.js +2 -4
  18. package/build/base-control/index.js.map +1 -1
  19. package/build/border-box-control/border-box-control/component.js +4 -6
  20. package/build/border-box-control/border-box-control/component.js.map +1 -1
  21. package/build/border-box-control/border-box-control-linked-button/component.js +2 -4
  22. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  23. package/build/border-box-control/border-box-control-split-controls/component.js +15 -13
  24. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  25. package/build/border-box-control/border-box-control-visualizer/component.js +2 -6
  26. package/build/border-box-control/border-box-control-visualizer/component.js.map +1 -1
  27. package/build/border-control/border-control/component.js +4 -6
  28. package/build/border-control/border-control/component.js.map +1 -1
  29. package/build/border-control/border-control-dropdown/component.js +4 -6
  30. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  31. package/build/border-control/border-control-style-picker/component.js +2 -4
  32. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  33. package/build/box-control/all-input-control.js +2 -4
  34. package/build/box-control/all-input-control.js.map +1 -1
  35. package/build/box-control/axial-input-controls.js +2 -4
  36. package/build/box-control/axial-input-controls.js.map +1 -1
  37. package/build/box-control/icon.js +4 -7
  38. package/build/box-control/icon.js.map +1 -1
  39. package/build/box-control/index.js +7 -6
  40. package/build/box-control/index.js.map +1 -1
  41. package/build/box-control/input-controls.js +2 -4
  42. package/build/box-control/input-controls.js.map +1 -1
  43. package/build/box-control/linked-button.js +2 -4
  44. package/build/box-control/linked-button.js.map +1 -1
  45. package/build/box-control/unit-control.js +6 -6
  46. package/build/box-control/unit-control.js.map +1 -1
  47. package/build/button/deprecated.js +2 -4
  48. package/build/button/deprecated.js.map +1 -1
  49. package/build/button/index.js +20 -7
  50. package/build/button/index.js.map +1 -1
  51. package/build/button-group/index.js +4 -5
  52. package/build/button-group/index.js.map +1 -1
  53. package/build/card/card/component.js +2 -4
  54. package/build/card/card/component.js.map +1 -1
  55. package/build/card/card-body/component.js +4 -8
  56. package/build/card/card-body/component.js.map +1 -1
  57. package/build/card/card-divider/component.js +2 -6
  58. package/build/card/card-divider/component.js.map +1 -1
  59. package/build/card/card-footer/component.js +2 -6
  60. package/build/card/card-footer/component.js.map +1 -1
  61. package/build/card/card-header/component.js +2 -6
  62. package/build/card/card-header/component.js.map +1 -1
  63. package/build/card/card-media/component.js +2 -6
  64. package/build/card/card-media/component.js.map +1 -1
  65. package/build/checkbox-control/index.js +4 -5
  66. package/build/checkbox-control/index.js.map +1 -1
  67. package/build/circular-option-picker/index.js +19 -16
  68. package/build/circular-option-picker/index.js.map +1 -1
  69. package/build/clipboard-button/index.js +9 -20
  70. package/build/clipboard-button/index.js.map +1 -1
  71. package/build/clipboard-button/types.js +6 -0
  72. package/build/clipboard-button/types.js.map +1 -0
  73. package/build/color-control/index.native.js +4 -5
  74. package/build/color-control/index.native.js.map +1 -1
  75. package/build/color-indicator/index.js +4 -5
  76. package/build/color-indicator/index.js.map +1 -1
  77. package/build/color-palette/index.js +11 -11
  78. package/build/color-palette/index.js.map +1 -1
  79. package/build/color-picker/color-input.js +6 -3
  80. package/build/color-picker/color-input.js.map +1 -1
  81. package/build/color-picker/component.js +4 -5
  82. package/build/color-picker/component.js.map +1 -1
  83. package/build/color-picker/legacy-adapter.js +2 -1
  84. package/build/color-picker/legacy-adapter.js.map +1 -1
  85. package/build/confirm-dialog/component.js +13 -6
  86. package/build/confirm-dialog/component.js.map +1 -1
  87. package/build/custom-gradient-picker/gradient-bar/control-points.js +8 -8
  88. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  89. package/build/custom-select-control/index.js +34 -32
  90. package/build/custom-select-control/index.js.map +1 -1
  91. package/build/dashicon/index.js +4 -7
  92. package/build/dashicon/index.js.map +1 -1
  93. package/build/dashicon/index.native.js +4 -7
  94. package/build/dashicon/index.native.js.map +1 -1
  95. package/build/disabled/index.js +4 -7
  96. package/build/disabled/index.js.map +1 -1
  97. package/build/divider/component.js +4 -8
  98. package/build/divider/component.js.map +1 -1
  99. package/build/drop-zone/index.js +2 -4
  100. package/build/drop-zone/index.js.map +1 -1
  101. package/build/dropdown/dropdown-content-wrapper.js +2 -6
  102. package/build/dropdown/dropdown-content-wrapper.js.map +1 -1
  103. package/build/dropdown/index.js +29 -24
  104. package/build/dropdown/index.js.map +1 -1
  105. package/build/dropdown-menu/index.js +98 -93
  106. package/build/dropdown-menu/index.js.map +1 -1
  107. package/build/dropdown-menu/index.native.js +2 -4
  108. package/build/dropdown-menu/index.native.js.map +1 -1
  109. package/build/dropdown-menu-v2/index.js +14 -12
  110. package/build/dropdown-menu-v2/index.js.map +1 -1
  111. package/build/dropdown-menu-v2/styles.js +16 -16
  112. package/build/dropdown-menu-v2/styles.js.map +1 -1
  113. package/build/elevation/component.js +2 -6
  114. package/build/elevation/component.js.map +1 -1
  115. package/build/external-link/index.js +2 -4
  116. package/build/external-link/index.js.map +1 -1
  117. package/build/flex/flex/component.js +2 -6
  118. package/build/flex/flex/component.js.map +1 -1
  119. package/build/flex/flex-block/component.js +2 -6
  120. package/build/flex/flex-block/component.js.map +1 -1
  121. package/build/flex/flex-item/component.js +2 -6
  122. package/build/flex/flex-item/component.js.map +1 -1
  123. package/build/focal-point-picker/controls.js +4 -7
  124. package/build/focal-point-picker/controls.js.map +1 -1
  125. package/build/focal-point-picker/focal-point.js +2 -4
  126. package/build/focal-point-picker/focal-point.js.map +1 -1
  127. package/build/focal-point-picker/grid.js +2 -6
  128. package/build/focal-point-picker/grid.js.map +1 -1
  129. package/build/focal-point-picker/index.js +4 -6
  130. package/build/focal-point-picker/index.js.map +1 -1
  131. package/build/focal-point-picker/index.native.js +2 -4
  132. package/build/focal-point-picker/index.native.js.map +1 -1
  133. package/build/focal-point-picker/media.js +7 -10
  134. package/build/focal-point-picker/media.js.map +1 -1
  135. package/build/focal-point-picker/tooltip/index.native.js +2 -4
  136. package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
  137. package/build/focusable-iframe/index.js +4 -5
  138. package/build/focusable-iframe/index.js.map +1 -1
  139. package/build/font-size-picker/index.js +5 -3
  140. package/build/font-size-picker/index.js.map +1 -1
  141. package/build/font-size-picker/styles.js +19 -26
  142. package/build/font-size-picker/styles.js.map +1 -1
  143. package/build/footer-message-control/index.native.js +2 -1
  144. package/build/footer-message-control/index.native.js.map +1 -1
  145. package/build/form-file-upload/index.js +4 -5
  146. package/build/form-file-upload/index.js.map +1 -1
  147. package/build/form-toggle/index.js +4 -5
  148. package/build/form-toggle/index.js.map +1 -1
  149. package/build/form-token-field/index.js +4 -5
  150. package/build/form-token-field/index.js.map +1 -1
  151. package/build/form-token-field/token-input.js +4 -6
  152. package/build/form-token-field/token-input.js.map +1 -1
  153. package/build/gradient-picker/index.js +14 -12
  154. package/build/gradient-picker/index.js.map +1 -1
  155. package/build/grid/component.js +2 -4
  156. package/build/grid/component.js.map +1 -1
  157. package/build/guide/page.js +2 -1
  158. package/build/guide/page.js.map +1 -1
  159. package/build/h-stack/component.js +2 -6
  160. package/build/h-stack/component.js.map +1 -1
  161. package/build/h-stack/hook.js +4 -7
  162. package/build/h-stack/hook.js.map +1 -1
  163. package/build/heading/component.js +2 -6
  164. package/build/heading/component.js.map +1 -1
  165. package/build/higher-order/navigate-regions/index.js +3 -1
  166. package/build/higher-order/navigate-regions/index.js.map +1 -1
  167. package/build/higher-order/with-constrained-tabbing/index.js +2 -1
  168. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  169. package/build/higher-order/with-fallback-styles/index.js +3 -3
  170. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  171. package/build/higher-order/with-filters/index.js +2 -1
  172. package/build/higher-order/with-filters/index.js.map +1 -1
  173. package/build/higher-order/with-focus-outside/index.js +5 -7
  174. package/build/higher-order/with-focus-outside/index.js.map +1 -1
  175. package/build/higher-order/with-focus-outside/index.native.js +5 -7
  176. package/build/higher-order/with-focus-outside/index.native.js.map +1 -1
  177. package/build/higher-order/with-focus-return/index.js +2 -1
  178. package/build/higher-order/with-focus-return/index.js.map +1 -1
  179. package/build/higher-order/with-notices/index.js +3 -4
  180. package/build/higher-order/with-notices/index.js.map +1 -1
  181. package/build/higher-order/with-spoken-messages/index.js +2 -6
  182. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  183. package/build/icon/index.js +6 -6
  184. package/build/icon/index.js.map +1 -1
  185. package/build/input-control/index.js +5 -5
  186. package/build/input-control/index.js.map +1 -1
  187. package/build/input-control/input-base.js +3 -4
  188. package/build/input-control/input-base.js.map +1 -1
  189. package/build/input-control/input-field.js +3 -6
  190. package/build/input-control/input-field.js.map +1 -1
  191. package/build/input-control/input-prefix-wrapper.js +4 -8
  192. package/build/input-control/input-prefix-wrapper.js.map +1 -1
  193. package/build/input-control/input-suffix-wrapper.js +4 -8
  194. package/build/input-control/input-suffix-wrapper.js.map +1 -1
  195. package/build/input-control/label.js +4 -7
  196. package/build/input-control/label.js.map +1 -1
  197. package/build/input-control/styles/input-control-styles.js +2 -4
  198. package/build/input-control/styles/input-control-styles.js.map +1 -1
  199. package/build/isolated-event-container/index.js +2 -4
  200. package/build/isolated-event-container/index.js.map +1 -1
  201. package/build/item-group/item/component.js +2 -6
  202. package/build/item-group/item/component.js.map +1 -1
  203. package/build/item-group/item-group/component.js +2 -6
  204. package/build/item-group/item-group/component.js.map +1 -1
  205. package/build/item-group/styles.js +10 -10
  206. package/build/item-group/styles.js.map +1 -1
  207. package/build/menu-item/index.js +4 -5
  208. package/build/menu-item/index.js.map +1 -1
  209. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -6
  210. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  211. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +2 -1
  212. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  213. package/build/mobile/bottom-sheet/cell.native.js +5 -6
  214. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  215. package/build/mobile/bottom-sheet/color-cell.native.js +2 -4
  216. package/build/mobile/bottom-sheet/color-cell.native.js.map +1 -1
  217. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +4 -5
  218. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  219. package/build/mobile/bottom-sheet/footer-message-cell.native.js +2 -4
  220. package/build/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
  221. package/build/mobile/bottom-sheet/index.native.js +8 -8
  222. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  223. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +4 -7
  224. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  225. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -4
  226. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  227. package/build/mobile/bottom-sheet/picker-cell.native.js +4 -5
  228. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  229. package/build/mobile/bottom-sheet/radio-cell.native.js +2 -4
  230. package/build/mobile/bottom-sheet/radio-cell.native.js.map +1 -1
  231. package/build/mobile/bottom-sheet/range-cell.native.js +2 -4
  232. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  233. package/build/mobile/bottom-sheet/ripple.native.js +4 -6
  234. package/build/mobile/bottom-sheet/ripple.native.js.map +1 -1
  235. package/build/mobile/bottom-sheet/switch-cell.native.js +2 -4
  236. package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  237. package/build/mobile/color-settings/index.native.js +5 -5
  238. package/build/mobile/color-settings/index.native.js.map +1 -1
  239. package/build/mobile/cycle-select-control/index.native.js +4 -5
  240. package/build/mobile/cycle-select-control/index.native.js.map +1 -1
  241. package/build/mobile/focal-point-settings-panel/index.native.js +5 -5
  242. package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  243. package/build/mobile/global-styles-context/index.native.js +2 -6
  244. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  245. package/build/mobile/gradient/index.native.js +4 -5
  246. package/build/mobile/gradient/index.native.js.map +1 -1
  247. package/build/mobile/image/image-editing-button.native.js +4 -5
  248. package/build/mobile/image/image-editing-button.native.js.map +1 -1
  249. package/build/mobile/image/index.native.js +15 -15
  250. package/build/mobile/image/index.native.js.map +1 -1
  251. package/build/mobile/keyboard-avoiding-view/index.ios.js +2 -4
  252. package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  253. package/build/mobile/keyboard-aware-flat-list/index.android.js +4 -5
  254. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  255. package/build/mobile/keyboard-aware-flat-list/index.ios.js +2 -1
  256. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  257. package/build/mobile/link-picker/link-picker-results.native.js +4 -6
  258. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  259. package/build/mobile/link-settings/link-settings-navigation.native.js +4 -5
  260. package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  261. package/build/mobile/link-settings/link-settings-screen.native.js +2 -4
  262. package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  263. package/build/mobile/picker/index.ios.js +4 -6
  264. package/build/mobile/picker/index.ios.js.map +1 -1
  265. package/build/mobile/segmented-control/index.native.js +4 -5
  266. package/build/mobile/segmented-control/index.native.js.map +1 -1
  267. package/build/modal/index.js +4 -6
  268. package/build/modal/index.js.map +1 -1
  269. package/build/navigable-container/container.js +6 -9
  270. package/build/navigable-container/container.js.map +1 -1
  271. package/build/navigable-container/menu.js +4 -5
  272. package/build/navigable-container/menu.js.map +1 -1
  273. package/build/navigable-container/tabbable.js +4 -5
  274. package/build/navigable-container/tabbable.js.map +1 -1
  275. package/build/navigation/item/base.js +4 -5
  276. package/build/navigation/item/base.js.map +1 -1
  277. package/build/navigation/item/index.js +3 -4
  278. package/build/navigation/item/index.js.map +1 -1
  279. package/build/navigator/navigator-back-button/component.js +4 -7
  280. package/build/navigator/navigator-back-button/component.js.map +1 -1
  281. package/build/navigator/navigator-button/component.js +4 -7
  282. package/build/navigator/navigator-button/component.js.map +1 -1
  283. package/build/navigator/navigator-provider/component.js +4 -5
  284. package/build/navigator/navigator-provider/component.js.map +1 -1
  285. package/build/navigator/navigator-screen/component.js +9 -10
  286. package/build/navigator/navigator-screen/component.js.map +1 -1
  287. package/build/navigator/navigator-to-parent-button/component.js +4 -7
  288. package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
  289. package/build/notice/list.js +2 -4
  290. package/build/notice/list.js.map +1 -1
  291. package/build/notice/list.native.js +2 -4
  292. package/build/notice/list.native.js.map +1 -1
  293. package/build/number-control/index.js +12 -10
  294. package/build/number-control/index.js.map +1 -1
  295. package/build/number-control/styles/number-control-styles.js +9 -15
  296. package/build/number-control/styles/number-control-styles.js.map +1 -1
  297. package/build/palette-edit/index.js +11 -12
  298. package/build/palette-edit/index.js.map +1 -1
  299. package/build/panel/body.js +8 -8
  300. package/build/panel/body.js.map +1 -1
  301. package/build/placeholder/index.js +2 -4
  302. package/build/placeholder/index.js.map +1 -1
  303. package/build/popover/index.js +11 -12
  304. package/build/popover/index.js.map +1 -1
  305. package/build/popover/utils.js +15 -1
  306. package/build/popover/utils.js.map +1 -1
  307. package/build/query-controls/category-select.js +4 -6
  308. package/build/query-controls/category-select.js.map +1 -1
  309. package/build/radio-control/index.js +4 -5
  310. package/build/radio-control/index.js.map +1 -1
  311. package/build/radio-control/index.native.js +4 -5
  312. package/build/radio-control/index.native.js.map +1 -1
  313. package/build/radio-group/index.js +5 -5
  314. package/build/radio-group/index.js.map +1 -1
  315. package/build/radio-group/radio/index.js +5 -5
  316. package/build/radio-group/radio/index.js.map +1 -1
  317. package/build/range-control/index.js +2 -4
  318. package/build/range-control/index.js.map +1 -1
  319. package/build/range-control/index.native.js +4 -5
  320. package/build/range-control/index.native.js.map +1 -1
  321. package/build/range-control/input-range.js +2 -6
  322. package/build/range-control/input-range.js.map +1 -1
  323. package/build/range-control/mark.js +2 -4
  324. package/build/range-control/mark.js.map +1 -1
  325. package/build/range-control/rail.js +6 -7
  326. package/build/range-control/rail.js.map +1 -1
  327. package/build/range-control/tooltip.js +2 -4
  328. package/build/range-control/tooltip.js.map +1 -1
  329. package/build/resizable-box/index.js +5 -5
  330. package/build/resizable-box/index.js.map +1 -1
  331. package/build/resizable-box/resize-tooltip/index.js +4 -5
  332. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  333. package/build/resizable-box/resize-tooltip/label.js +4 -7
  334. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  335. package/build/scrollable/component.js +2 -6
  336. package/build/scrollable/component.js.map +1 -1
  337. package/build/search-control/index.js +2 -4
  338. package/build/search-control/index.js.map +1 -1
  339. package/build/select-control/index.js +4 -5
  340. package/build/select-control/index.js.map +1 -1
  341. package/build/select-control/index.native.js +4 -5
  342. package/build/select-control/index.native.js.map +1 -1
  343. package/build/slot-fill/bubbles-virtually/slot.js +4 -5
  344. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  345. package/build/slot-fill/index.js +17 -13
  346. package/build/slot-fill/index.js.map +1 -1
  347. package/build/slot-fill/index.native.js +10 -9
  348. package/build/slot-fill/index.native.js.map +1 -1
  349. package/build/slot-fill/slot.js +2 -4
  350. package/build/slot-fill/slot.js.map +1 -1
  351. package/build/snackbar/list.js +2 -4
  352. package/build/snackbar/list.js.map +1 -1
  353. package/build/spacer/component.js +2 -6
  354. package/build/spacer/component.js.map +1 -1
  355. package/build/spinner/index.js +4 -6
  356. package/build/spinner/index.js.map +1 -1
  357. package/build/surface/component.js +2 -6
  358. package/build/surface/component.js.map +1 -1
  359. package/build/tab-panel/index.js +4 -5
  360. package/build/tab-panel/index.js.map +1 -1
  361. package/build/text/component.js +4 -6
  362. package/build/text/component.js.map +1 -1
  363. package/build/text-control/index.js +4 -5
  364. package/build/text-control/index.js.map +1 -1
  365. package/build/text-control/index.native.js +4 -5
  366. package/build/text-control/index.native.js.map +1 -1
  367. package/build/textarea-control/index.js +4 -5
  368. package/build/textarea-control/index.js.map +1 -1
  369. package/build/theme/index.js +4 -7
  370. package/build/theme/index.js.map +1 -1
  371. package/build/toggle-control/index.native.js +4 -5
  372. package/build/toggle-control/index.native.js.map +1 -1
  373. package/build/toggle-group-control/toggle-group-control/as-button-group.js +4 -6
  374. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  375. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +4 -6
  376. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  377. package/build/toggle-group-control/toggle-group-control/component.js +2 -4
  378. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  379. package/build/toggle-group-control/toggle-group-control-option/component.js +2 -6
  380. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  381. package/build/toggle-group-control/toggle-group-control-option-base/component.js +6 -7
  382. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  383. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +2 -4
  384. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  385. package/build/toolbar/toolbar/index.js +9 -13
  386. package/build/toolbar/toolbar/index.js.map +1 -1
  387. package/build/toolbar/toolbar/toolbar-container.js +9 -13
  388. package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
  389. package/build/toolbar/toolbar-button/index.js +13 -11
  390. package/build/toolbar/toolbar-button/index.js.map +1 -1
  391. package/build/toolbar/toolbar-context/index.js.map +1 -1
  392. package/build/toolbar/toolbar-dropdown-menu/index.js +8 -10
  393. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  394. package/build/toolbar/toolbar-group/index.js +11 -10
  395. package/build/toolbar/toolbar-group/index.js.map +1 -1
  396. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +6 -6
  397. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  398. package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js +4 -5
  399. package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
  400. package/build/toolbar/toolbar-group/toolbar-group-container.js +4 -7
  401. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  402. package/build/toolbar/toolbar-item/index.js +13 -11
  403. package/build/toolbar/toolbar-item/index.js.map +1 -1
  404. package/build/toolbar/toolbar-item/types.js +6 -0
  405. package/build/toolbar/toolbar-item/types.js.map +1 -0
  406. package/build/tools-panel/tools-panel/component.js +2 -4
  407. package/build/tools-panel/tools-panel/component.js.map +1 -1
  408. package/build/tools-panel/tools-panel-header/component.js +2 -4
  409. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  410. package/build/tools-panel/tools-panel-item/component.js +4 -8
  411. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  412. package/build/tooltip/index.js +4 -5
  413. package/build/tooltip/index.js.map +1 -1
  414. package/build/tooltip/index.native.js +2 -1
  415. package/build/tooltip/index.native.js.map +1 -1
  416. package/build/tree-grid/cell.js +2 -4
  417. package/build/tree-grid/cell.js.map +1 -1
  418. package/build/tree-grid/index.js +2 -4
  419. package/build/tree-grid/index.js.map +1 -1
  420. package/build/tree-grid/item.js +4 -5
  421. package/build/tree-grid/item.js.map +1 -1
  422. package/build/tree-grid/roving-tab-index-item.js +2 -1
  423. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  424. package/build/tree-grid/row.js +2 -6
  425. package/build/tree-grid/row.js.map +1 -1
  426. package/build/tree-select/index.js +4 -7
  427. package/build/tree-select/index.js.map +1 -1
  428. package/build/truncate/component.js +4 -6
  429. package/build/truncate/component.js.map +1 -1
  430. package/build/ui/control-group/component.js +8 -12
  431. package/build/ui/control-group/component.js.map +1 -1
  432. package/build/ui/control-label/component.js +4 -8
  433. package/build/ui/control-label/component.js.map +1 -1
  434. package/build/ui/form-group/form-group-content.js +4 -5
  435. package/build/ui/form-group/form-group-content.js.map +1 -1
  436. package/build/ui/form-group/form-group-label.js +2 -1
  437. package/build/ui/form-group/form-group-label.js.map +1 -1
  438. package/build/ui/form-group/form-group.js +8 -8
  439. package/build/ui/form-group/form-group.js.map +1 -1
  440. package/build/ui/shortcut/component.js +4 -7
  441. package/build/ui/shortcut/component.js.map +1 -1
  442. package/build/ui/spinner/component.js +2 -6
  443. package/build/ui/spinner/component.js.map +1 -1
  444. package/build/ui/tooltip/component.js +3 -4
  445. package/build/ui/tooltip/component.js.map +1 -1
  446. package/build/ui/tooltip/content.js +5 -8
  447. package/build/ui/tooltip/content.js.map +1 -1
  448. package/build/unit-control/index.js +31 -94
  449. package/build/unit-control/index.js.map +1 -1
  450. package/build/unit-control/index.native.js +7 -7
  451. package/build/unit-control/index.native.js.map +1 -1
  452. package/build/unit-control/unit-select-control.js +15 -7
  453. package/build/unit-control/unit-select-control.js.map +1 -1
  454. package/build/v-stack/component.js +2 -6
  455. package/build/v-stack/component.js.map +1 -1
  456. package/build/visually-hidden/component.js +4 -8
  457. package/build/visually-hidden/component.js.map +1 -1
  458. package/build/z-stack/component.js +7 -9
  459. package/build/z-stack/component.js.map +1 -1
  460. package/build/z-stack/styles.js +23 -42
  461. package/build/z-stack/styles.js.map +1 -1
  462. package/build-module/alignment-matrix-control/cell.js +4 -4
  463. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  464. package/build-module/alignment-matrix-control/icon.js +2 -3
  465. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  466. package/build-module/alignment-matrix-control/index.js +6 -6
  467. package/build-module/alignment-matrix-control/index.js.map +1 -1
  468. package/build-module/angle-picker-control/angle-circle.js +4 -4
  469. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  470. package/build-module/angle-picker-control/index.js +2 -3
  471. package/build-module/angle-picker-control/index.js.map +1 -1
  472. package/build-module/autocomplete/autocompleter-ui.js +27 -2
  473. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  474. package/build-module/autocomplete/index.js +1 -19
  475. package/build-module/autocomplete/index.js.map +1 -1
  476. package/build-module/base-control/index.js +2 -3
  477. package/build-module/base-control/index.js.map +1 -1
  478. package/build-module/border-box-control/border-box-control/component.js +4 -5
  479. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  480. package/build-module/border-box-control/border-box-control-linked-button/component.js +2 -3
  481. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  482. package/build-module/border-box-control/border-box-control-split-controls/component.js +15 -12
  483. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  484. package/build-module/border-box-control/border-box-control-visualizer/component.js +2 -3
  485. package/build-module/border-box-control/border-box-control-visualizer/component.js.map +1 -1
  486. package/build-module/border-control/border-control/component.js +4 -5
  487. package/build-module/border-control/border-control/component.js.map +1 -1
  488. package/build-module/border-control/border-control-dropdown/component.js +4 -5
  489. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  490. package/build-module/border-control/border-control-style-picker/component.js +2 -3
  491. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  492. package/build-module/box-control/all-input-control.js +2 -3
  493. package/build-module/box-control/all-input-control.js.map +1 -1
  494. package/build-module/box-control/axial-input-controls.js +2 -3
  495. package/build-module/box-control/axial-input-controls.js.map +1 -1
  496. package/build-module/box-control/icon.js +4 -4
  497. package/build-module/box-control/icon.js.map +1 -1
  498. package/build-module/box-control/index.js +7 -5
  499. package/build-module/box-control/index.js.map +1 -1
  500. package/build-module/box-control/input-controls.js +2 -3
  501. package/build-module/box-control/input-controls.js.map +1 -1
  502. package/build-module/box-control/linked-button.js +2 -3
  503. package/build-module/box-control/linked-button.js.map +1 -1
  504. package/build-module/box-control/unit-control.js +6 -5
  505. package/build-module/box-control/unit-control.js.map +1 -1
  506. package/build-module/button/deprecated.js +2 -3
  507. package/build-module/button/deprecated.js.map +1 -1
  508. package/build-module/button/index.js +20 -6
  509. package/build-module/button/index.js.map +1 -1
  510. package/build-module/button-group/index.js +4 -4
  511. package/build-module/button-group/index.js.map +1 -1
  512. package/build-module/card/card/component.js +2 -3
  513. package/build-module/card/card/component.js.map +1 -1
  514. package/build-module/card/card-body/component.js +4 -5
  515. package/build-module/card/card-body/component.js.map +1 -1
  516. package/build-module/card/card-divider/component.js +2 -3
  517. package/build-module/card/card-divider/component.js.map +1 -1
  518. package/build-module/card/card-footer/component.js +2 -3
  519. package/build-module/card/card-footer/component.js.map +1 -1
  520. package/build-module/card/card-header/component.js +2 -3
  521. package/build-module/card/card-header/component.js.map +1 -1
  522. package/build-module/card/card-media/component.js +2 -3
  523. package/build-module/card/card-media/component.js.map +1 -1
  524. package/build-module/checkbox-control/index.js +4 -4
  525. package/build-module/checkbox-control/index.js.map +1 -1
  526. package/build-module/circular-option-picker/index.js +19 -15
  527. package/build-module/circular-option-picker/index.js.map +1 -1
  528. package/build-module/clipboard-button/index.js +9 -20
  529. package/build-module/clipboard-button/index.js.map +1 -1
  530. package/build-module/clipboard-button/types.js +2 -0
  531. package/build-module/clipboard-button/types.js.map +1 -0
  532. package/build-module/color-control/index.native.js +4 -4
  533. package/build-module/color-control/index.native.js.map +1 -1
  534. package/build-module/color-indicator/index.js +4 -4
  535. package/build-module/color-indicator/index.js.map +1 -1
  536. package/build-module/color-palette/index.js +11 -10
  537. package/build-module/color-palette/index.js.map +1 -1
  538. package/build-module/color-picker/color-input.js +6 -3
  539. package/build-module/color-picker/color-input.js.map +1 -1
  540. package/build-module/color-picker/component.js +4 -4
  541. package/build-module/color-picker/component.js.map +1 -1
  542. package/build-module/color-picker/legacy-adapter.js +2 -1
  543. package/build-module/color-picker/legacy-adapter.js.map +1 -1
  544. package/build-module/confirm-dialog/component.js +14 -6
  545. package/build-module/confirm-dialog/component.js.map +1 -1
  546. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +8 -7
  547. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  548. package/build-module/custom-select-control/index.js +34 -31
  549. package/build-module/custom-select-control/index.js.map +1 -1
  550. package/build-module/dashicon/index.js +4 -4
  551. package/build-module/dashicon/index.js.map +1 -1
  552. package/build-module/dashicon/index.native.js +4 -4
  553. package/build-module/dashicon/index.native.js.map +1 -1
  554. package/build-module/disabled/index.js +4 -4
  555. package/build-module/disabled/index.js.map +1 -1
  556. package/build-module/divider/component.js +4 -5
  557. package/build-module/divider/component.js.map +1 -1
  558. package/build-module/drop-zone/index.js +2 -3
  559. package/build-module/drop-zone/index.js.map +1 -1
  560. package/build-module/dropdown/dropdown-content-wrapper.js +2 -3
  561. package/build-module/dropdown/dropdown-content-wrapper.js.map +1 -1
  562. package/build-module/dropdown/index.js +29 -24
  563. package/build-module/dropdown/index.js.map +1 -1
  564. package/build-module/dropdown-menu/index.js +95 -91
  565. package/build-module/dropdown-menu/index.js.map +1 -1
  566. package/build-module/dropdown-menu/index.native.js +2 -3
  567. package/build-module/dropdown-menu/index.native.js.map +1 -1
  568. package/build-module/dropdown-menu-v2/index.js +14 -11
  569. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  570. package/build-module/dropdown-menu-v2/styles.js +16 -16
  571. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  572. package/build-module/elevation/component.js +2 -3
  573. package/build-module/elevation/component.js.map +1 -1
  574. package/build-module/external-link/index.js +2 -3
  575. package/build-module/external-link/index.js.map +1 -1
  576. package/build-module/flex/flex/component.js +2 -3
  577. package/build-module/flex/flex/component.js.map +1 -1
  578. package/build-module/flex/flex-block/component.js +2 -3
  579. package/build-module/flex/flex-block/component.js.map +1 -1
  580. package/build-module/flex/flex-item/component.js +2 -3
  581. package/build-module/flex/flex-item/component.js.map +1 -1
  582. package/build-module/focal-point-picker/controls.js +4 -4
  583. package/build-module/focal-point-picker/controls.js.map +1 -1
  584. package/build-module/focal-point-picker/focal-point.js +2 -3
  585. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  586. package/build-module/focal-point-picker/grid.js +2 -3
  587. package/build-module/focal-point-picker/grid.js.map +1 -1
  588. package/build-module/focal-point-picker/index.js +4 -5
  589. package/build-module/focal-point-picker/index.js.map +1 -1
  590. package/build-module/focal-point-picker/index.native.js +2 -3
  591. package/build-module/focal-point-picker/index.native.js.map +1 -1
  592. package/build-module/focal-point-picker/media.js +7 -7
  593. package/build-module/focal-point-picker/media.js.map +1 -1
  594. package/build-module/focal-point-picker/tooltip/index.native.js +2 -3
  595. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  596. package/build-module/focusable-iframe/index.js +4 -4
  597. package/build-module/focusable-iframe/index.js.map +1 -1
  598. package/build-module/font-size-picker/index.js +5 -4
  599. package/build-module/font-size-picker/index.js.map +1 -1
  600. package/build-module/font-size-picker/styles.js +17 -23
  601. package/build-module/font-size-picker/styles.js.map +1 -1
  602. package/build-module/footer-message-control/index.native.js +2 -1
  603. package/build-module/footer-message-control/index.native.js.map +1 -1
  604. package/build-module/form-file-upload/index.js +4 -4
  605. package/build-module/form-file-upload/index.js.map +1 -1
  606. package/build-module/form-toggle/index.js +4 -4
  607. package/build-module/form-toggle/index.js.map +1 -1
  608. package/build-module/form-token-field/index.js +4 -4
  609. package/build-module/form-token-field/index.js.map +1 -1
  610. package/build-module/form-token-field/token-input.js +4 -5
  611. package/build-module/form-token-field/token-input.js.map +1 -1
  612. package/build-module/gradient-picker/index.js +14 -11
  613. package/build-module/gradient-picker/index.js.map +1 -1
  614. package/build-module/grid/component.js +2 -3
  615. package/build-module/grid/component.js.map +1 -1
  616. package/build-module/guide/page.js +2 -1
  617. package/build-module/guide/page.js.map +1 -1
  618. package/build-module/h-stack/component.js +2 -3
  619. package/build-module/h-stack/component.js.map +1 -1
  620. package/build-module/h-stack/hook.js +4 -4
  621. package/build-module/h-stack/hook.js.map +1 -1
  622. package/build-module/heading/component.js +2 -3
  623. package/build-module/heading/component.js.map +1 -1
  624. package/build-module/higher-order/navigate-regions/index.js +3 -1
  625. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  626. package/build-module/higher-order/with-constrained-tabbing/index.js +2 -1
  627. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  628. package/build-module/higher-order/with-fallback-styles/index.js +3 -2
  629. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  630. package/build-module/higher-order/with-filters/index.js +2 -1
  631. package/build-module/higher-order/with-filters/index.js.map +1 -1
  632. package/build-module/higher-order/with-focus-outside/index.js +5 -4
  633. package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
  634. package/build-module/higher-order/with-focus-outside/index.native.js +5 -4
  635. package/build-module/higher-order/with-focus-outside/index.native.js.map +1 -1
  636. package/build-module/higher-order/with-focus-return/index.js +2 -1
  637. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  638. package/build-module/higher-order/with-notices/index.js +3 -3
  639. package/build-module/higher-order/with-notices/index.js.map +1 -1
  640. package/build-module/higher-order/with-spoken-messages/index.js +2 -3
  641. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  642. package/build-module/icon/index.js +6 -6
  643. package/build-module/icon/index.js.map +1 -1
  644. package/build-module/input-control/index.js +5 -4
  645. package/build-module/input-control/index.js.map +1 -1
  646. package/build-module/input-control/input-base.js +3 -3
  647. package/build-module/input-control/input-base.js.map +1 -1
  648. package/build-module/input-control/input-field.js +3 -3
  649. package/build-module/input-control/input-field.js.map +1 -1
  650. package/build-module/input-control/input-prefix-wrapper.js +4 -5
  651. package/build-module/input-control/input-prefix-wrapper.js.map +1 -1
  652. package/build-module/input-control/input-suffix-wrapper.js +4 -5
  653. package/build-module/input-control/input-suffix-wrapper.js.map +1 -1
  654. package/build-module/input-control/label.js +4 -4
  655. package/build-module/input-control/label.js.map +1 -1
  656. package/build-module/input-control/styles/input-control-styles.js +2 -3
  657. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  658. package/build-module/isolated-event-container/index.js +2 -3
  659. package/build-module/isolated-event-container/index.js.map +1 -1
  660. package/build-module/item-group/item/component.js +2 -3
  661. package/build-module/item-group/item/component.js.map +1 -1
  662. package/build-module/item-group/item-group/component.js +2 -3
  663. package/build-module/item-group/item-group/component.js.map +1 -1
  664. package/build-module/item-group/styles.js +10 -10
  665. package/build-module/item-group/styles.js.map +1 -1
  666. package/build-module/menu-item/index.js +4 -4
  667. package/build-module/menu-item/index.js.map +1 -1
  668. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -5
  669. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  670. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +2 -1
  671. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  672. package/build-module/mobile/bottom-sheet/cell.native.js +5 -5
  673. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  674. package/build-module/mobile/bottom-sheet/color-cell.native.js +2 -3
  675. package/build-module/mobile/bottom-sheet/color-cell.native.js.map +1 -1
  676. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +4 -4
  677. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  678. package/build-module/mobile/bottom-sheet/footer-message-cell.native.js +2 -3
  679. package/build-module/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
  680. package/build-module/mobile/bottom-sheet/index.native.js +8 -7
  681. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  682. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +4 -4
  683. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  684. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -3
  685. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  686. package/build-module/mobile/bottom-sheet/picker-cell.native.js +4 -4
  687. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  688. package/build-module/mobile/bottom-sheet/radio-cell.native.js +2 -3
  689. package/build-module/mobile/bottom-sheet/radio-cell.native.js.map +1 -1
  690. package/build-module/mobile/bottom-sheet/range-cell.native.js +2 -3
  691. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  692. package/build-module/mobile/bottom-sheet/ripple.native.js +4 -5
  693. package/build-module/mobile/bottom-sheet/ripple.native.js.map +1 -1
  694. package/build-module/mobile/bottom-sheet/switch-cell.native.js +2 -3
  695. package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  696. package/build-module/mobile/color-settings/index.native.js +5 -4
  697. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  698. package/build-module/mobile/cycle-select-control/index.native.js +4 -4
  699. package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
  700. package/build-module/mobile/focal-point-settings-panel/index.native.js +5 -4
  701. package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  702. package/build-module/mobile/global-styles-context/index.native.js +2 -3
  703. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  704. package/build-module/mobile/gradient/index.native.js +4 -4
  705. package/build-module/mobile/gradient/index.native.js.map +1 -1
  706. package/build-module/mobile/image/image-editing-button.native.js +4 -4
  707. package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
  708. package/build-module/mobile/image/index.native.js +15 -14
  709. package/build-module/mobile/image/index.native.js.map +1 -1
  710. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +2 -3
  711. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  712. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +4 -4
  713. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  714. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +2 -1
  715. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  716. package/build-module/mobile/link-picker/link-picker-results.native.js +4 -5
  717. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  718. package/build-module/mobile/link-settings/link-settings-navigation.native.js +4 -4
  719. package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  720. package/build-module/mobile/link-settings/link-settings-screen.native.js +2 -3
  721. package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
  722. package/build-module/mobile/picker/index.ios.js +4 -5
  723. package/build-module/mobile/picker/index.ios.js.map +1 -1
  724. package/build-module/mobile/segmented-control/index.native.js +4 -4
  725. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  726. package/build-module/modal/index.js +4 -5
  727. package/build-module/modal/index.js.map +1 -1
  728. package/build-module/navigable-container/container.js +6 -6
  729. package/build-module/navigable-container/container.js.map +1 -1
  730. package/build-module/navigable-container/menu.js +4 -4
  731. package/build-module/navigable-container/menu.js.map +1 -1
  732. package/build-module/navigable-container/tabbable.js +4 -4
  733. package/build-module/navigable-container/tabbable.js.map +1 -1
  734. package/build-module/navigation/item/base.js +4 -4
  735. package/build-module/navigation/item/base.js.map +1 -1
  736. package/build-module/navigation/item/index.js +3 -3
  737. package/build-module/navigation/item/index.js.map +1 -1
  738. package/build-module/navigator/navigator-back-button/component.js +4 -4
  739. package/build-module/navigator/navigator-back-button/component.js.map +1 -1
  740. package/build-module/navigator/navigator-button/component.js +4 -4
  741. package/build-module/navigator/navigator-button/component.js.map +1 -1
  742. package/build-module/navigator/navigator-provider/component.js +4 -4
  743. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  744. package/build-module/navigator/navigator-screen/component.js +9 -7
  745. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  746. package/build-module/navigator/navigator-to-parent-button/component.js +4 -4
  747. package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
  748. package/build-module/notice/list.js +2 -3
  749. package/build-module/notice/list.js.map +1 -1
  750. package/build-module/notice/list.native.js +2 -3
  751. package/build-module/notice/list.native.js.map +1 -1
  752. package/build-module/number-control/index.js +12 -10
  753. package/build-module/number-control/index.js.map +1 -1
  754. package/build-module/number-control/styles/number-control-styles.js +7 -14
  755. package/build-module/number-control/styles/number-control-styles.js.map +1 -1
  756. package/build-module/palette-edit/index.js +11 -11
  757. package/build-module/palette-edit/index.js.map +1 -1
  758. package/build-module/panel/body.js +8 -7
  759. package/build-module/panel/body.js.map +1 -1
  760. package/build-module/placeholder/index.js +2 -3
  761. package/build-module/placeholder/index.js.map +1 -1
  762. package/build-module/popover/index.js +12 -12
  763. package/build-module/popover/index.js.map +1 -1
  764. package/build-module/popover/utils.js +11 -0
  765. package/build-module/popover/utils.js.map +1 -1
  766. package/build-module/query-controls/category-select.js +4 -5
  767. package/build-module/query-controls/category-select.js.map +1 -1
  768. package/build-module/radio-control/index.js +4 -4
  769. package/build-module/radio-control/index.js.map +1 -1
  770. package/build-module/radio-control/index.native.js +4 -4
  771. package/build-module/radio-control/index.native.js.map +1 -1
  772. package/build-module/radio-group/index.js +5 -4
  773. package/build-module/radio-group/index.js.map +1 -1
  774. package/build-module/radio-group/radio/index.js +5 -4
  775. package/build-module/radio-group/radio/index.js.map +1 -1
  776. package/build-module/range-control/index.js +2 -3
  777. package/build-module/range-control/index.js.map +1 -1
  778. package/build-module/range-control/index.native.js +4 -4
  779. package/build-module/range-control/index.native.js.map +1 -1
  780. package/build-module/range-control/input-range.js +2 -3
  781. package/build-module/range-control/input-range.js.map +1 -1
  782. package/build-module/range-control/mark.js +2 -3
  783. package/build-module/range-control/mark.js.map +1 -1
  784. package/build-module/range-control/rail.js +6 -6
  785. package/build-module/range-control/rail.js.map +1 -1
  786. package/build-module/range-control/tooltip.js +2 -3
  787. package/build-module/range-control/tooltip.js.map +1 -1
  788. package/build-module/resizable-box/index.js +5 -4
  789. package/build-module/resizable-box/index.js.map +1 -1
  790. package/build-module/resizable-box/resize-tooltip/index.js +4 -4
  791. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  792. package/build-module/resizable-box/resize-tooltip/label.js +4 -4
  793. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  794. package/build-module/scrollable/component.js +2 -3
  795. package/build-module/scrollable/component.js.map +1 -1
  796. package/build-module/search-control/index.js +2 -3
  797. package/build-module/search-control/index.js.map +1 -1
  798. package/build-module/select-control/index.js +4 -4
  799. package/build-module/select-control/index.js.map +1 -1
  800. package/build-module/select-control/index.native.js +4 -4
  801. package/build-module/select-control/index.native.js.map +1 -1
  802. package/build-module/slot-fill/bubbles-virtually/slot.js +4 -4
  803. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  804. package/build-module/slot-fill/index.js +17 -12
  805. package/build-module/slot-fill/index.js.map +1 -1
  806. package/build-module/slot-fill/index.native.js +10 -8
  807. package/build-module/slot-fill/index.native.js.map +1 -1
  808. package/build-module/slot-fill/slot.js +2 -3
  809. package/build-module/slot-fill/slot.js.map +1 -1
  810. package/build-module/snackbar/list.js +2 -3
  811. package/build-module/snackbar/list.js.map +1 -1
  812. package/build-module/spacer/component.js +2 -3
  813. package/build-module/spacer/component.js.map +1 -1
  814. package/build-module/spinner/index.js +4 -5
  815. package/build-module/spinner/index.js.map +1 -1
  816. package/build-module/surface/component.js +2 -3
  817. package/build-module/surface/component.js.map +1 -1
  818. package/build-module/tab-panel/index.js +4 -4
  819. package/build-module/tab-panel/index.js.map +1 -1
  820. package/build-module/text/component.js +4 -5
  821. package/build-module/text/component.js.map +1 -1
  822. package/build-module/text-control/index.js +4 -4
  823. package/build-module/text-control/index.js.map +1 -1
  824. package/build-module/text-control/index.native.js +4 -4
  825. package/build-module/text-control/index.native.js.map +1 -1
  826. package/build-module/textarea-control/index.js +4 -4
  827. package/build-module/textarea-control/index.js.map +1 -1
  828. package/build-module/theme/index.js +4 -4
  829. package/build-module/theme/index.js.map +1 -1
  830. package/build-module/toggle-control/index.native.js +4 -4
  831. package/build-module/toggle-control/index.native.js.map +1 -1
  832. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +4 -5
  833. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  834. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +4 -5
  835. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  836. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -3
  837. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  838. package/build-module/toggle-group-control/toggle-group-control-option/component.js +2 -3
  839. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  840. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +6 -6
  841. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  842. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +2 -3
  843. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  844. package/build-module/toolbar/toolbar/index.js +10 -13
  845. package/build-module/toolbar/toolbar/index.js.map +1 -1
  846. package/build-module/toolbar/toolbar/toolbar-container.js +9 -12
  847. package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
  848. package/build-module/toolbar/toolbar-button/index.js +13 -10
  849. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  850. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  851. package/build-module/toolbar/toolbar-dropdown-menu/index.js +8 -9
  852. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  853. package/build-module/toolbar/toolbar-group/index.js +11 -9
  854. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  855. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +6 -5
  856. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  857. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js +4 -4
  858. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
  859. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +4 -4
  860. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  861. package/build-module/toolbar/toolbar-item/index.js +13 -10
  862. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  863. package/build-module/toolbar/toolbar-item/types.js +2 -0
  864. package/build-module/toolbar/toolbar-item/types.js.map +1 -0
  865. package/build-module/tools-panel/tools-panel/component.js +2 -3
  866. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  867. package/build-module/tools-panel/tools-panel-header/component.js +2 -3
  868. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  869. package/build-module/tools-panel/tools-panel-item/component.js +4 -5
  870. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  871. package/build-module/tooltip/index.js +4 -4
  872. package/build-module/tooltip/index.js.map +1 -1
  873. package/build-module/tooltip/index.native.js +2 -1
  874. package/build-module/tooltip/index.native.js.map +1 -1
  875. package/build-module/tree-grid/cell.js +2 -3
  876. package/build-module/tree-grid/cell.js.map +1 -1
  877. package/build-module/tree-grid/index.js +2 -3
  878. package/build-module/tree-grid/index.js.map +1 -1
  879. package/build-module/tree-grid/item.js +4 -4
  880. package/build-module/tree-grid/item.js.map +1 -1
  881. package/build-module/tree-grid/roving-tab-index-item.js +2 -1
  882. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  883. package/build-module/tree-grid/row.js +2 -3
  884. package/build-module/tree-grid/row.js.map +1 -1
  885. package/build-module/tree-select/index.js +4 -4
  886. package/build-module/tree-select/index.js.map +1 -1
  887. package/build-module/truncate/component.js +4 -5
  888. package/build-module/truncate/component.js.map +1 -1
  889. package/build-module/ui/control-group/component.js +8 -9
  890. package/build-module/ui/control-group/component.js.map +1 -1
  891. package/build-module/ui/control-label/component.js +4 -5
  892. package/build-module/ui/control-label/component.js.map +1 -1
  893. package/build-module/ui/form-group/form-group-content.js +4 -4
  894. package/build-module/ui/form-group/form-group-content.js.map +1 -1
  895. package/build-module/ui/form-group/form-group-label.js +2 -1
  896. package/build-module/ui/form-group/form-group-label.js.map +1 -1
  897. package/build-module/ui/form-group/form-group.js +8 -7
  898. package/build-module/ui/form-group/form-group.js.map +1 -1
  899. package/build-module/ui/shortcut/component.js +4 -4
  900. package/build-module/ui/shortcut/component.js.map +1 -1
  901. package/build-module/ui/spinner/component.js +2 -3
  902. package/build-module/ui/spinner/component.js.map +1 -1
  903. package/build-module/ui/tooltip/component.js +3 -3
  904. package/build-module/ui/tooltip/component.js.map +1 -1
  905. package/build-module/ui/tooltip/content.js +5 -5
  906. package/build-module/ui/tooltip/content.js.map +1 -1
  907. package/build-module/unit-control/index.js +31 -88
  908. package/build-module/unit-control/index.js.map +1 -1
  909. package/build-module/unit-control/index.native.js +7 -6
  910. package/build-module/unit-control/index.native.js.map +1 -1
  911. package/build-module/unit-control/unit-select-control.js +19 -6
  912. package/build-module/unit-control/unit-select-control.js.map +1 -1
  913. package/build-module/v-stack/component.js +2 -3
  914. package/build-module/v-stack/component.js.map +1 -1
  915. package/build-module/visually-hidden/component.js +4 -5
  916. package/build-module/visually-hidden/component.js.map +1 -1
  917. package/build-module/z-stack/component.js +7 -6
  918. package/build-module/z-stack/component.js.map +1 -1
  919. package/build-module/z-stack/styles.js +22 -44
  920. package/build-module/z-stack/styles.js.map +1 -1
  921. package/build-style/style-rtl.css +16 -21
  922. package/build-style/style.css +16 -21
  923. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  924. package/build-types/autocomplete/index.d.ts.map +1 -1
  925. package/build-types/button/deprecated.d.ts +6 -6
  926. package/build-types/button/index.d.ts.map +1 -1
  927. package/build-types/button/stories/e2e/index.d.ts +1 -0
  928. package/build-types/button/stories/e2e/index.d.ts.map +1 -1
  929. package/build-types/button/types.d.ts +16 -9
  930. package/build-types/button/types.d.ts.map +1 -1
  931. package/build-types/circular-option-picker/types.d.ts +2 -2
  932. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  933. package/build-types/clipboard-button/index.d.ts +4 -15
  934. package/build-types/clipboard-button/index.d.ts.map +1 -1
  935. package/build-types/clipboard-button/types.d.ts +11 -0
  936. package/build-types/clipboard-button/types.d.ts.map +1 -0
  937. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  938. package/build-types/dropdown/index.d.ts +1 -1
  939. package/build-types/dropdown/index.d.ts.map +1 -1
  940. package/build-types/dropdown/types.d.ts +7 -0
  941. package/build-types/dropdown/types.d.ts.map +1 -1
  942. package/build-types/dropdown-menu/index.d.ts +1 -1
  943. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  944. package/build-types/dropdown-menu/stories/index.d.ts +4 -3
  945. package/build-types/dropdown-menu/stories/index.d.ts.map +1 -1
  946. package/build-types/dropdown-menu/types.d.ts +7 -0
  947. package/build-types/dropdown-menu/types.d.ts.map +1 -1
  948. package/build-types/dropdown-menu-v2/styles.d.ts +4 -4
  949. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
  950. package/build-types/dropdown-menu-v2/types.d.ts +2 -2
  951. package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
  952. package/build-types/font-size-picker/index.d.ts.map +1 -1
  953. package/build-types/font-size-picker/styles.d.ts +0 -6
  954. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  955. package/build-types/item-group/styles.d.ts.map +1 -1
  956. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  957. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  958. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  959. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  960. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
  961. package/build-types/number-control/index.d.ts.map +1 -1
  962. package/build-types/number-control/styles/number-control-styles.d.ts +5 -3
  963. package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
  964. package/build-types/popover/index.d.ts.map +1 -1
  965. package/build-types/popover/stories/index.d.ts +0 -1
  966. package/build-types/popover/stories/index.d.ts.map +1 -1
  967. package/build-types/popover/utils.d.ts +10 -0
  968. package/build-types/popover/utils.d.ts.map +1 -1
  969. package/build-types/select-control/index.d.ts.map +1 -1
  970. package/build-types/select-control/types.d.ts +6 -0
  971. package/build-types/select-control/types.d.ts.map +1 -1
  972. package/build-types/toolbar/stories/index.d.ts.map +1 -1
  973. package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
  974. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
  975. package/build-types/toolbar/toolbar-button/index.d.ts +6 -6
  976. package/build-types/toolbar/toolbar-context/index.d.ts +2 -2
  977. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  978. package/build-types/toolbar/toolbar-item/index.d.ts +4 -6
  979. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  980. package/build-types/toolbar/toolbar-item/types.d.ts +17 -0
  981. package/build-types/toolbar/toolbar-item/types.d.ts.map +1 -0
  982. package/build-types/unit-control/index.d.ts +3 -6
  983. package/build-types/unit-control/index.d.ts.map +1 -1
  984. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  985. package/build-types/unit-control/unit-select-control.d.ts +7 -6
  986. package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
  987. package/build-types/z-stack/component.d.ts.map +1 -1
  988. package/build-types/z-stack/stories/index.d.ts.map +1 -1
  989. package/build-types/z-stack/styles.d.ts +5 -4
  990. package/build-types/z-stack/styles.d.ts.map +1 -1
  991. package/package.json +21 -20
  992. package/src/autocomplete/autocompleter-ui.tsx +44 -2
  993. package/src/autocomplete/index.tsx +2 -32
  994. package/src/box-control/test/index.tsx +28 -60
  995. package/src/button/README.md +15 -0
  996. package/src/button/index.tsx +11 -4
  997. package/src/button/stories/e2e/index.tsx +22 -0
  998. package/src/button/style.scss +18 -25
  999. package/src/button/test/index.tsx +13 -0
  1000. package/src/button/types.ts +17 -9
  1001. package/src/circular-option-picker/types.ts +2 -5
  1002. package/src/clipboard-button/{index.js → index.tsx} +11 -17
  1003. package/src/clipboard-button/types.ts +11 -0
  1004. package/src/confirm-dialog/component.tsx +12 -2
  1005. package/src/confirm-dialog/stories/index.js +8 -15
  1006. package/src/confirm-dialog/test/index.js +42 -0
  1007. package/src/dropdown/index.tsx +20 -10
  1008. package/src/dropdown/types.ts +8 -0
  1009. package/src/dropdown-menu/index.tsx +101 -85
  1010. package/src/dropdown-menu/stories/index.tsx +1 -1
  1011. package/src/dropdown-menu/types.ts +8 -0
  1012. package/src/dropdown-menu-v2/index.tsx +2 -2
  1013. package/src/dropdown-menu-v2/styles.ts +7 -5
  1014. package/src/dropdown-menu-v2/types.ts +2 -2
  1015. package/src/font-size-picker/index.tsx +9 -5
  1016. package/src/font-size-picker/styles.ts +0 -10
  1017. package/src/item-group/styles.ts +13 -5
  1018. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +16 -29
  1019. package/src/mobile/bottom-sheet/cell.native.js +1 -1
  1020. package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +46 -0
  1021. package/src/mobile/html-text-input/test/index.native.js +2 -2
  1022. package/src/mobile/image/index.native.js +1 -1
  1023. package/src/mobile/link-settings/test/link-settings-navigation.native.js +5 -16
  1024. package/src/modal/style.scss +2 -2
  1025. package/src/number-control/index.tsx +6 -3
  1026. package/src/number-control/styles/number-control-styles.ts +8 -16
  1027. package/src/popover/index.tsx +3 -2
  1028. package/src/popover/stories/index.tsx +0 -13
  1029. package/src/popover/test/index.tsx +22 -1
  1030. package/src/popover/utils.ts +12 -0
  1031. package/src/search-control/README.md +7 -1
  1032. package/src/select-control/index.tsx +1 -0
  1033. package/src/select-control/types.ts +6 -0
  1034. package/src/toolbar/stories/index.tsx +0 -3
  1035. package/src/toolbar/toolbar/index.tsx +3 -6
  1036. package/src/toolbar/toolbar/toolbar-container.tsx +5 -9
  1037. package/src/toolbar/toolbar-context/index.ts +2 -4
  1038. package/src/toolbar/toolbar-dropdown-menu/index.js +0 -1
  1039. package/src/toolbar/toolbar-item/index.tsx +13 -15
  1040. package/src/toolbar/toolbar-item/types.ts +27 -0
  1041. package/src/tooltip/test/index.native.js +1 -3
  1042. package/src/unit-control/index.tsx +29 -95
  1043. package/src/unit-control/stories/index.tsx +0 -4
  1044. package/src/unit-control/test/index.tsx +151 -223
  1045. package/src/unit-control/unit-select-control.tsx +20 -10
  1046. package/src/z-stack/component.tsx +4 -2
  1047. package/src/z-stack/stories/index.tsx +6 -13
  1048. package/src/z-stack/styles.ts +23 -24
  1049. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/angle-picker-control/angle-circle.tsx"],"names":["useEffect","useRef","__experimentalUseDragging","useDragging","CircleRoot","CircleIndicatorWrapper","CircleIndicator","AngleCircle","value","onChange","props","angleCircleRef","angleCircleCenter","previousCursorValue","setAngleCircleCenter","current","rect","getBoundingClientRect","x","width","y","height","changeAngleToPosition","event","undefined","preventDefault","target","focus","centerX","centerY","getAngle","clientX","clientY","startDrag","isDragging","onDragStart","onDragMove","onDragEnd","document","body","style","cursor","transform","pointX","pointY","angleInRadians","Math","atan2","angleInDeg","round","PI"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,yBAAyB,IAAIC,WAAtC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SACCC,UADD,EAECC,sBAFD,EAGCC,eAHD,QAIO,sCAJP;;AAeA,SAASC,WAAT,CAAsB;AACrBC,EAAAA,KADqB;AAErBC,EAAAA,QAFqB;AAGrB,KAAGC;AAHkB,CAAtB,EAIwD;AACvD,QAAMC,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KAAL,CAAY3B,CAAZ,EAAeF,CAAf,CAAvB;AACA,QAAM8B,UAAU,GAAGF,IAAI,CAACG,KAAL,CAAYJ,cAAc,IAAK,MAAMC,IAAI,CAACI,EAAhB,CAA1B,IAAmD,EAAtE;;AACA,MAAKF,UAAU,GAAG,CAAlB,EAAsB;AACrB,WAAO,MAAMA,UAAb;AACA;;AACD,SAAOA,UAAP;AACA;;AAED,eAAezC,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCircleRoot,\n\tCircleIndicatorWrapper,\n\tCircleIndicator,\n} from './styles/angle-picker-control-styles';\n\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { AngleCircleProps } from './types';\n\ntype UseDraggingArgumentType = Parameters< typeof useDragging >[ 0 ];\ntype UseDraggingCallbackEvent =\n\t| Parameters< UseDraggingArgumentType[ 'onDragStart' ] >[ 0 ]\n\t| Parameters< UseDraggingArgumentType[ 'onDragMove' ] >[ 0 ]\n\t| Parameters< UseDraggingArgumentType[ 'onDragEnd' ] >[ 0 ];\n\nfunction AngleCircle( {\n\tvalue,\n\tonChange,\n\t...props\n}: WordPressComponentProps< AngleCircleProps, 'div' > ) {\n\tconst angleCircleRef = useRef< HTMLDivElement | null >( null );\n\tconst angleCircleCenter = useRef< { x: number; y: number } | undefined >();\n\tconst previousCursorValue = useRef< CSSStyleDeclaration[ 'cursor' ] >();\n\n\tconst setAngleCircleCenter = () => {\n\t\tif ( angleCircleRef.current === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rect = angleCircleRef.current.getBoundingClientRect();\n\t\tangleCircleCenter.current = {\n\t\t\tx: rect.x + rect.width / 2,\n\t\t\ty: rect.y + rect.height / 2,\n\t\t};\n\t};\n\n\tconst changeAngleToPosition = ( event: UseDraggingCallbackEvent ) => {\n\t\tif ( event === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Prevent (drag) mouse events from selecting and accidentally\n\t\t// triggering actions from other elements.\n\t\tevent.preventDefault();\n\t\t// Input control needs to lose focus and by preventDefault above, it doesn't.\n\t\t( event.target as HTMLDivElement | null )?.focus();\n\n\t\tif (\n\t\t\tangleCircleCenter.current !== undefined &&\n\t\t\tonChange !== undefined\n\t\t) {\n\t\t\tconst { x: centerX, y: centerY } = angleCircleCenter.current;\n\t\t\tonChange(\n\t\t\t\tgetAngle( centerX, centerY, event.clientX, event.clientY )\n\t\t\t);\n\t\t}\n\t};\n\n\tconst { startDrag, isDragging } = useDragging( {\n\t\tonDragStart: ( event ) => {\n\t\t\tsetAngleCircleCenter();\n\t\t\tchangeAngleToPosition( event );\n\t\t},\n\t\tonDragMove: changeAngleToPosition,\n\t\tonDragEnd: changeAngleToPosition,\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isDragging ) {\n\t\t\tif ( previousCursorValue.current === undefined ) {\n\t\t\t\tpreviousCursorValue.current = document.body.style.cursor;\n\t\t\t}\n\t\t\tdocument.body.style.cursor = 'grabbing';\n\t\t} else {\n\t\t\tdocument.body.style.cursor = previousCursorValue.current || '';\n\t\t\tpreviousCursorValue.current = undefined;\n\t\t}\n\t}, [ isDragging ] );\n\n\treturn (\n\t\t<CircleRoot\n\t\t\tref={ angleCircleRef }\n\t\t\tonMouseDown={ startDrag }\n\t\t\tclassName=\"components-angle-picker-control__angle-circle\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<CircleIndicatorWrapper\n\t\t\t\tstyle={\n\t\t\t\t\tvalue ? { transform: `rotate(${ value }deg)` } : undefined\n\t\t\t\t}\n\t\t\t\tclassName=\"components-angle-picker-control__angle-circle-indicator-wrapper\"\n\t\t\t\ttabIndex={ -1 }\n\t\t\t>\n\t\t\t\t<CircleIndicator className=\"components-angle-picker-control__angle-circle-indicator\" />\n\t\t\t</CircleIndicatorWrapper>\n\t\t</CircleRoot>\n\t);\n}\n\nfunction getAngle(\n\tcenterX: number,\n\tcenterY: number,\n\tpointX: number,\n\tpointY: number\n) {\n\tconst y = pointY - centerY;\n\tconst x = pointX - centerX;\n\n\tconst angleInRadians = Math.atan2( y, x );\n\tconst angleInDeg = Math.round( angleInRadians * ( 180 / Math.PI ) ) + 90;\n\tif ( angleInDeg < 0 ) {\n\t\treturn 360 + angleInDeg;\n\t}\n\treturn angleInDeg;\n}\n\nexport default AngleCircle;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/angle-picker-control/angle-circle.tsx"],"names":["useEffect","useRef","__experimentalUseDragging","useDragging","CircleRoot","CircleIndicatorWrapper","CircleIndicator","AngleCircle","value","onChange","props","angleCircleRef","angleCircleCenter","previousCursorValue","setAngleCircleCenter","current","rect","getBoundingClientRect","x","width","y","height","changeAngleToPosition","event","undefined","preventDefault","target","focus","centerX","centerY","getAngle","clientX","clientY","startDrag","isDragging","onDragStart","onDragMove","onDragEnd","document","body","style","cursor","transform","pointX","pointY","angleInRadians","Math","atan2","angleInDeg","round","PI"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,yBAAyB,IAAIC,WAAtC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SACCC,UADD,EAECC,sBAFD,EAGCC,eAHD,QAIO,sCAJP;;AAeA,SAASC,WAAT,CAAsB;AACrBC,EAAAA,KADqB;AAErBC,EAAAA,QAFqB;AAGrB,KAAGC;AAHkB,CAAtB,EAIwD;AACvD,QAAMC,cAAc,GAAGV,MAAM,CAA2B,IAA3B,CAA7B;AACA,QAAMW,iBAAiB,GAAGX,MAAM,EAAhC;AACA,QAAMY,mBAAmB,GAAGZ,MAAM,EAAlC;;AAEA,QAAMa,oBAAoB,GAAG,MAAM;AAClC,QAAKH,cAAc,CAACI,OAAf,KAA2B,IAAhC,EAAuC;AACtC;AACA;;AAED,UAAMC,IAAI,GAAGL,cAAc,CAACI,OAAf,CAAuBE,qBAAvB,EAAb;AAC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ordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCircleRoot,\n\tCircleIndicatorWrapper,\n\tCircleIndicator,\n} from './styles/angle-picker-control-styles';\n\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { AngleCircleProps } from './types';\n\ntype UseDraggingArgumentType = Parameters< typeof useDragging >[ 0 ];\ntype UseDraggingCallbackEvent =\n\t| Parameters< UseDraggingArgumentType[ 'onDragStart' ] >[ 0 ]\n\t| Parameters< UseDraggingArgumentType[ 'onDragMove' ] >[ 0 ]\n\t| Parameters< UseDraggingArgumentType[ 'onDragEnd' ] >[ 0 ];\n\nfunction AngleCircle( {\n\tvalue,\n\tonChange,\n\t...props\n}: WordPressComponentProps< AngleCircleProps, 'div' > ) {\n\tconst angleCircleRef = useRef< HTMLDivElement | null >( null );\n\tconst angleCircleCenter = useRef< { x: number; y: number } | undefined >();\n\tconst previousCursorValue = useRef< CSSStyleDeclaration[ 'cursor' ] >();\n\n\tconst setAngleCircleCenter = () => {\n\t\tif ( angleCircleRef.current === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rect = angleCircleRef.current.getBoundingClientRect();\n\t\tangleCircleCenter.current = {\n\t\t\tx: rect.x + rect.width / 2,\n\t\t\ty: rect.y + rect.height / 2,\n\t\t};\n\t};\n\n\tconst changeAngleToPosition = ( event: UseDraggingCallbackEvent ) => {\n\t\tif ( event === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Prevent (drag) mouse events from selecting and accidentally\n\t\t// triggering actions from other elements.\n\t\tevent.preventDefault();\n\t\t// Input control needs to lose focus and by preventDefault above, it doesn't.\n\t\t( event.target as HTMLDivElement | null )?.focus();\n\n\t\tif (\n\t\t\tangleCircleCenter.current !== undefined &&\n\t\t\tonChange !== undefined\n\t\t) {\n\t\t\tconst { x: centerX, y: centerY } = angleCircleCenter.current;\n\t\t\tonChange(\n\t\t\t\tgetAngle( centerX, centerY, event.clientX, event.clientY )\n\t\t\t);\n\t\t}\n\t};\n\n\tconst { startDrag, isDragging } = useDragging( {\n\t\tonDragStart: ( event ) => {\n\t\t\tsetAngleCircleCenter();\n\t\t\tchangeAngleToPosition( event );\n\t\t},\n\t\tonDragMove: changeAngleToPosition,\n\t\tonDragEnd: changeAngleToPosition,\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isDragging ) {\n\t\t\tif ( previousCursorValue.current === undefined ) {\n\t\t\t\tpreviousCursorValue.current = document.body.style.cursor;\n\t\t\t}\n\t\t\tdocument.body.style.cursor = 'grabbing';\n\t\t} else {\n\t\t\tdocument.body.style.cursor = previousCursorValue.current || '';\n\t\t\tpreviousCursorValue.current = undefined;\n\t\t}\n\t}, [ isDragging ] );\n\n\treturn (\n\t\t<CircleRoot\n\t\t\tref={ angleCircleRef }\n\t\t\tonMouseDown={ startDrag }\n\t\t\tclassName=\"components-angle-picker-control__angle-circle\"\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<CircleIndicatorWrapper\n\t\t\t\tstyle={\n\t\t\t\t\tvalue ? { transform: `rotate(${ value }deg)` } : undefined\n\t\t\t\t}\n\t\t\t\tclassName=\"components-angle-picker-control__angle-circle-indicator-wrapper\"\n\t\t\t\ttabIndex={ -1 }\n\t\t\t>\n\t\t\t\t<CircleIndicator className=\"components-angle-picker-control__angle-circle-indicator\" />\n\t\t\t</CircleIndicatorWrapper>\n\t\t</CircleRoot>\n\t);\n}\n\nfunction getAngle(\n\tcenterX: number,\n\tcenterY: number,\n\tpointX: number,\n\tpointY: number\n) {\n\tconst y = pointY - centerY;\n\tconst x = pointX - centerX;\n\n\tconst angleInRadians = Math.atan2( y, x );\n\tconst angleInDeg = Math.round( angleInRadians * ( 180 / Math.PI ) ) + 90;\n\tif ( angleInDeg < 0 ) {\n\t\treturn 360 + angleInDeg;\n\t}\n\treturn angleInDeg;\n}\n\nexport default AngleCircle;\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
@@ -52,12 +51,12 @@ function UnforwardedAnglePickerControl(props, ref) {
52
51
  const classes = classnames('components-angle-picker-control', className);
53
52
  const unitText = createElement(UnitText, null, "\xB0");
54
53
  const [prefixedUnitText, suffixedUnitText] = isRTL() ? [unitText, null] : [null, unitText];
55
- return createElement(Root, _extends({}, restProps, {
54
+ return createElement(Root, { ...restProps,
56
55
  ref: ref,
57
56
  __nextHasNoMarginBottom: __nextHasNoMarginBottom,
58
57
  className: classes,
59
58
  gap: 2
60
- }), createElement(FlexBlock, null, createElement(NumberControl, {
59
+ }, createElement(FlexBlock, null, createElement(NumberControl, {
61
60
  label: label,
62
61
  className: "components-angle-picker-control__input-field",
63
62
  max: 360,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/angle-picker-control/index.tsx"],"names":["classnames","deprecated","forwardRef","isRTL","__","FlexBlock","Spacer","NumberControl","AngleCircle","Root","UnitText","UnforwardedAnglePickerControl","props","ref","__nextHasNoMarginBottom","className","label","onChange","value","restProps","since","version","hint","handleOnNumberChange","unprocessedValue","undefined","inputValue","parseInt","classes","unitText","prefixedUnitText","suffixedUnitText","AnglePickerControl"],"mappings":";;;AAAA;AACA;AACA;AAEA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,IAAT,EAAeC,QAAf,QAA+B,sCAA/B;;AAKA,SAASC,6BAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;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AGO,oBALZ;AAMC,IAAA,IAAI,EAAC,kBANN;AAOC,IAAA,IAAI,EAAC,GAPN;AAQC,IAAA,KAAK,EAAGL,KART;AASC,IAAA,YAAY,EAAC,MATd;AAUC,IAAA,MAAM,EAAGY,gBAVV;AAWC,IAAA,MAAM,EAAGC;AAXV,IADD,CAPD,EAsBC,cAAC,MAAD;AAAQ,IAAA,YAAY,EAAC,GAArB;AAAyB,IAAA,SAAS,EAAC;AAAnC,KACC,cAAC,WAAD;AACC,mBAAY,MADb;AAEC,IAAA,KAAK,EAAGb,KAFT;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IADD,CAtBD,CADD;AAgCA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMe,kBAAkB,GAAG9B,UAAU,CAAES,6BAAF,CAArC;AAEP,eAAeqB,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { FlexBlock } from '../flex';\nimport { Spacer } from '../spacer';\nimport NumberControl from '../number-control';\nimport AngleCircle from './angle-circle';\nimport { Root, UnitText } from './styles/angle-picker-control-styles';\n\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { AnglePickerControlProps } from './types';\n\nfunction UnforwardedAnglePickerControl(\n\tprops: WordPressComponentProps< AnglePickerControlProps, 'div' >,\n\tref: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tclassName,\n\t\tlabel = __( 'Angle' ),\n\t\tonChange,\n\t\tvalue,\n\t\t...restProps\n\t} = props;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.components.AnglePickerControl',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst handleOnNumberChange = ( unprocessedValue: string | undefined ) => {\n\t\tif ( onChange === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== undefined && unprocessedValue !== ''\n\t\t\t\t? parseInt( unprocessedValue, 10 )\n\t\t\t\t: 0;\n\t\tonChange( inputValue );\n\t};\n\n\tconst classes = classnames( 'components-angle-picker-control', className );\n\n\tconst unitText = <UnitText>°</UnitText>;\n\tconst [ prefixedUnitText, suffixedUnitText ] = isRTL()\n\t\t? [ unitText, null ]\n\t\t: [ null, unitText ];\n\n\treturn (\n\t\t<Root\n\t\t\t{ ...restProps }\n\t\t\tref={ ref }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tclassName=\"components-angle-picker-control__input-field\"\n\t\t\t\t\tmax={ 360 }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ handleOnNumberChange }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tstep=\"1\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tspinControls=\"none\"\n\t\t\t\t\tprefix={ prefixedUnitText }\n\t\t\t\t\tsuffix={ suffixedUnitText }\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t\t<Spacer marginBottom=\"1\" marginTop=\"auto\">\n\t\t\t\t<AngleCircle\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</Spacer>\n\t\t</Root>\n\t);\n}\n\n/**\n * `AnglePickerControl` is a React component to render a UI that allows users to\n * pick an angle. Users can choose an angle in a visual UI with the mouse by\n * dragging an angle indicator inside a circle or by directly inserting the\n * desired angle in a text field.\n *\n * ```jsx\n * import { useState } from '@wordpress/element';\n * import { AnglePickerControl } from '@wordpress/components';\n *\n * function Example() {\n * const [ angle, setAngle ] = useState( 0 );\n * return (\n * <AnglePickerControl\n * value={ angle }\n * onChange={ setAngle }\n * __nextHasNoMarginBottom\n * </>\n * );\n * }\n * ```\n */\nexport const AnglePickerControl = forwardRef( UnforwardedAnglePickerControl );\n\nexport default AnglePickerControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/angle-picker-control/index.tsx"],"names":["classnames","deprecated","forwardRef","isRTL","__","FlexBlock","Spacer","NumberControl","AngleCircle","Root","UnitText","UnforwardedAnglePickerControl","props","ref","__nextHasNoMarginBottom","className","label","onChange","value","restProps","since","version","hint","handleOnNumberChange","unprocessedValue","undefined","inputValue","parseInt","classes","unitText","prefixedUnitText","suffixedUnitText","AnglePickerControl"],"mappings":";;AAAA;AACA;AACA;AAEA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,IAAT,EAAeC,QAAf,QAA+B,sCAA/B;;AAKA,SAASC,6BAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBAAuB,GAAG,KADrB;AAELC,IAAAA,SAFK;AAGLC,IAAAA,KAAK,GAAGZ,EAAE,CAAE,OAAF,CAHL;AAIL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A,YAAY,EAAC,MATd;AAUC,IAAA,MAAM,EAAGY,gBAVV;AAWC,IAAA,MAAM,EAAGC;AAXV,IADD,CAPD,EAsBC,cAAC,MAAD;AAAQ,IAAA,YAAY,EAAC,GAArB;AAAyB,IAAA,SAAS,EAAC;AAAnC,KACC,cAAC,WAAD;AACC,mBAAY,MADb;AAEC,IAAA,KAAK,EAAGb,KAFT;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IADD,CAtBD,CADD;AAgCA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMe,kBAAkB,GAAG9B,UAAU,CAAES,6BAAF,CAArC;AAEP,eAAeqB,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { FlexBlock } from '../flex';\nimport { Spacer } from '../spacer';\nimport NumberControl from '../number-control';\nimport AngleCircle from './angle-circle';\nimport { Root, UnitText } from './styles/angle-picker-control-styles';\n\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { AnglePickerControlProps } from './types';\n\nfunction UnforwardedAnglePickerControl(\n\tprops: WordPressComponentProps< AnglePickerControlProps, 'div' >,\n\tref: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tclassName,\n\t\tlabel = __( 'Angle' ),\n\t\tonChange,\n\t\tvalue,\n\t\t...restProps\n\t} = props;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.components.AnglePickerControl',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst handleOnNumberChange = ( unprocessedValue: string | undefined ) => {\n\t\tif ( onChange === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== undefined && unprocessedValue !== ''\n\t\t\t\t? parseInt( unprocessedValue, 10 )\n\t\t\t\t: 0;\n\t\tonChange( inputValue );\n\t};\n\n\tconst classes = classnames( 'components-angle-picker-control', className );\n\n\tconst unitText = <UnitText>°</UnitText>;\n\tconst [ prefixedUnitText, suffixedUnitText ] = isRTL()\n\t\t? [ unitText, null ]\n\t\t: [ null, unitText ];\n\n\treturn (\n\t\t<Root\n\t\t\t{ ...restProps }\n\t\t\tref={ ref }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tclassName=\"components-angle-picker-control__input-field\"\n\t\t\t\t\tmax={ 360 }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ handleOnNumberChange }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tstep=\"1\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tspinControls=\"none\"\n\t\t\t\t\tprefix={ prefixedUnitText }\n\t\t\t\t\tsuffix={ suffixedUnitText }\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t\t<Spacer marginBottom=\"1\" marginTop=\"auto\">\n\t\t\t\t<AngleCircle\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</Spacer>\n\t\t</Root>\n\t);\n}\n\n/**\n * `AnglePickerControl` is a React component to render a UI that allows users to\n * pick an angle. Users can choose an angle in a visual UI with the mouse by\n * dragging an angle indicator inside a circle or by directly inserting the\n * desired angle in a text field.\n *\n * ```jsx\n * import { useState } from '@wordpress/element';\n * import { AnglePickerControl } from '@wordpress/components';\n *\n * function Example() {\n * const [ angle, setAngle ] = useState( 0 );\n * return (\n * <AnglePickerControl\n * value={ angle }\n * onChange={ setAngle }\n * __nextHasNoMarginBottom\n * </>\n * );\n * }\n * ```\n */\nexport const AnglePickerControl = forwardRef( UnforwardedAnglePickerControl );\n\nexport default AnglePickerControl;\n"]}
@@ -10,7 +10,9 @@ import classnames from 'classnames';
10
10
 
11
11
  import { useLayoutEffect, useRef, useEffect, useState } from '@wordpress/element';
12
12
  import { useAnchor } from '@wordpress/rich-text';
13
- import { useMergeRefs, useRefEffect } from '@wordpress/compose';
13
+ import { useDebounce, useMergeRefs, useRefEffect } from '@wordpress/compose';
14
+ import { speak } from '@wordpress/a11y';
15
+ import { __, _n, sprintf } from '@wordpress/i18n';
14
16
  /**
15
17
  * Internal dependencies
16
18
  */
@@ -50,8 +52,31 @@ export function getAutoCompleterUI(autocompleter) {
50
52
  setNeedsA11yCompat(node.ownerDocument !== contentRef.current.ownerDocument);
51
53
  }, [contentRef])]);
52
54
  useOnClickOutside(popoverRef, reset);
55
+ const debouncedSpeak = useDebounce(speak, 500);
56
+
57
+ function announce(options) {
58
+ if (!debouncedSpeak) {
59
+ return;
60
+ }
61
+
62
+ if (!!options.length) {
63
+ if (filterValue) {
64
+ debouncedSpeak(sprintf(
65
+ /* translators: %d: number of results. */
66
+ _n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
67
+ } else {
68
+ debouncedSpeak(sprintf(
69
+ /* translators: %d: number of results. */
70
+ _n('Initial %d result loaded. Type to filter all available results. Use up and down arrow keys to navigate.', 'Initial %d results loaded. Type to filter all available results. Use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
71
+ }
72
+ } else {
73
+ debouncedSpeak(__('No results.'), 'assertive');
74
+ }
75
+ }
76
+
53
77
  useLayoutEffect(() => {
54
- onChangeOptions(items); // Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
78
+ onChangeOptions(items);
79
+ announce(items); // Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
55
80
  // See https://github.com/WordPress/gutenberg/pull/41820
56
81
  // eslint-disable-next-line react-hooks/exhaustive-deps
57
82
  }, [items]);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/autocomplete/autocompleter-ui.tsx"],"names":["classnames","useLayoutEffect","useRef","useEffect","useState","useAnchor","useMergeRefs","useRefEffect","getDefaultUseItems","Button","Popover","VisuallyHidden","createPortal","getAutoCompleterUI","autocompleter","useItems","AutocompleterUI","filterValue","instanceId","listBoxId","className","selectedIndex","onChangeOptions","onSelect","onReset","reset","contentRef","items","popoverAnchor","editableContentElement","current","needsA11yCompat","setNeedsA11yCompat","popoverRef","popoverRefs","node","ownerDocument","useOnClickOutside","length","ListBox","Component","map","option","index","key","isDisabled","label","body","ref","handler","listener","event","contains","target","document","addEventListener","removeEventListener"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,MAFD,EAGCC,SAHD,EAICC,QAJD,QAKO,oBALP;AAMA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,YAAT,EAAuBC,YAAvB,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,WAA7B;AAGA,OAAO,SAASC,kBAAT,CAA6BC,aAA7B,EAA0D;AAChE,QAAMC,QAAQ,GAAGD,aAAa,CAACC,QAAd,GACdD,aAAa,CAACC,QADA,GAEdP,kBAAkB,CAAEM,aAAF,CAFrB;;AAIA,WAASE,eAAT,CAA0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B,QAAZ,CAAsBD,KAAK,CAACE,MAA5B,CAFD,EAGE;AACD;AACA;;AACDJ,MAAAA,OAAO,CAAEE,KAAF,CAAP;AACA,KATD;;AAUAG,IAAAA,QAAQ,CAACC,gBAAT,CAA2B,WAA3B,EAAwCL,QAAxC;AACAI,IAAAA,QAAQ,CAACC,gBAAT,CAA2B,YAA3B,EAAyCL,QAAzC;AACA,WAAO,MAAM;AACZI,MAAAA,QAAQ,CAACE,mBAAT,CAA8B,WAA9B,EAA2CN,QAA3C;AACAI,MAAAA,QAAQ,CAACE,mBAAT,CAA8B,YAA9B,EAA4CN,QAA5C;AACA,KAHD,CAbgB,CAiBhB;AACA;AACA;AACA,GApBQ,EAoBN,CAAED,OAAF,CApBM,CAAT;AAqBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseLayoutEffect,\n\tuseRef,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { useAnchor } from '@wordpress/rich-text';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport getDefaultUseItems from './get-default-use-items';\nimport Button from '../button';\nimport Popover from '../popover';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { createPortal } from 'react-dom';\nimport type { AutocompleterUIProps, WPCompleter } from './types';\n\nexport function getAutoCompleterUI( autocompleter: WPCompleter ) {\n\tconst useItems = autocompleter.useItems\n\t\t? autocompleter.useItems\n\t\t: getDefaultUseItems( autocompleter );\n\n\tfunction AutocompleterUI( {\n\t\tfilterValue,\n\t\tinstanceId,\n\t\tlistBoxId,\n\t\tclassName,\n\t\tselectedIndex,\n\t\tonChangeOptions,\n\t\tonSelect,\n\t\tonReset,\n\t\treset,\n\t\tcontentRef,\n\t}: AutocompleterUIProps ) {\n\t\tconst [ items ] = useItems( filterValue );\n\t\tconst popoverAnchor = useAnchor( {\n\t\t\teditableContentElement: contentRef.current,\n\t\t} );\n\n\t\tconst [ needsA11yCompat, setNeedsA11yCompat ] = useState( false );\n\t\tconst popoverRef = useRef< HTMLElement >( null );\n\t\tconst popoverRefs = useMergeRefs( [\n\t\t\tpopoverRef,\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tif ( ! contentRef.current ) return;\n\n\t\t\t\t\t// If the popover is rendered in a different document than\n\t\t\t\t\t// the content, we need to duplicate the options list in the\n\t\t\t\t\t// content document so that it's available to the screen\n\t\t\t\t\t// readers, which check the DOM ID based aira-* attributes.\n\t\t\t\t\tsetNeedsA11yCompat(\n\t\t\t\t\t\tnode.ownerDocument !== contentRef.current.ownerDocument\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t[ contentRef ]\n\t\t\t),\n\t\t] );\n\n\t\tuseOnClickOutside( popoverRef, reset );\n\n\t\tuseLayoutEffect( () => {\n\t\t\tonChangeOptions( items );\n\t\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [ items ] );\n\n\t\tif ( items.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ListBox = ( {\n\t\t\tComponent = 'div',\n\t\t}: {\n\t\t\tComponent?: React.ElementType;\n\t\t} ) => (\n\t\t\t<Component\n\t\t\t\tid={ listBoxId }\n\t\t\t\trole=\"listbox\"\n\t\t\t\tclassName=\"components-autocomplete__results\"\n\t\t\t>\n\t\t\t\t{ items.map( ( option, index ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ option.key }\n\t\t\t\t\t\tid={ `components-autocomplete-item-${ instanceId }-${ option.key }` }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected={ index === selectedIndex }\n\t\t\t\t\t\tdisabled={ option.isDisabled }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-autocomplete__result',\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-selected': index === selectedIndex,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => onSelect( option ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t</Button>\n\t\t\t\t) ) }\n\t\t\t</Component>\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Popover\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tonClose={ onReset }\n\t\t\t\t\tplacement=\"top-start\"\n\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tref={ popoverRefs }\n\t\t\t\t>\n\t\t\t\t\t<ListBox />\n\t\t\t\t</Popover>\n\t\t\t\t{ contentRef.current &&\n\t\t\t\t\tneedsA11yCompat &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<ListBox Component={ VisuallyHidden } />,\n\t\t\t\t\t\tcontentRef.current.ownerDocument.body\n\t\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn AutocompleterUI;\n}\n\nfunction useOnClickOutside(\n\tref: React.RefObject< HTMLElement >,\n\thandler: AutocompleterUIProps[ 'reset' ]\n) {\n\tuseEffect( () => {\n\t\tconst listener = ( event: MouseEvent | TouchEvent ) => {\n\t\t\t// Do nothing if clicking ref's element or descendent elements, or if the ref is not referencing an element\n\t\t\tif (\n\t\t\t\t! ref.current ||\n\t\t\t\tref.current.contains( event.target as Node )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thandler( event );\n\t\t};\n\t\tdocument.addEventListener( 'mousedown', listener );\n\t\tdocument.addEventListener( 'touchstart', listener );\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', listener );\n\t\t\tdocument.removeEventListener( 'touchstart', listener );\n\t\t};\n\t\t// Disable reason: `ref` is a ref object and should not be included in a\n\t\t// hook's dependency list.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ handler ] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/autocomplete/autocompleter-ui.tsx"],"names":["classnames","useLayoutEffect","useRef","useEffect","useState","useAnchor","useDebounce","useMergeRefs","useRefEffect","speak","__","_n","sprintf","getDefaultUseItems","Button","Popover","VisuallyHidden","createPortal","getAutoCompleterUI","autocompleter","useItems","AutocompleterUI","filterValue","instanceId","listBoxId","className","selectedIndex","onChangeOptions","onSelect","onReset","reset","contentRef","items","popoverAnchor","editableContentElement","current","needsA11yCompat","setNeedsA11yCompat","popoverRef","popoverRefs","node","ownerDocument","useOnClickOutside","debouncedSpeak","announce","options","length","ListBox","Component","map","option","index","key","isDisabled","label","body","ref","handler","listener","event","contains","target","document","addEventListener","removeEventListener"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,MAFD,EAGCC,SAHD,EAICC,QAJD,QAKO,oBALP;AAMA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,WAAT,EAAsBC,YAAtB,EAAoCC,YAApC,QAAwD,oBAAxD;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,WAA7B;AAGA,OAAO,SAASC,kBAAT,CAA6BC,aAA7B,EAA0D;AAChE,QAAMC,QAAQ,GAAGD,aAAa,CAACC,QAAd,GACdD,aAAa,CAACC,QADA,GAEdP,kBAAkB,CAAEM,aAAF,CAFrB;;AAIA,WAASE,eAAT,CAA0B;AACzBC,IAAAA,WADyB;A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AAF;AAbzB,OAeGA,MAAM,CAACI,KAfV,CADC,CALH,CALD;;AAgCA,WACC,8BACC,cAAC,OAAD;AACC,MAAA,YAAY,EAAG,KADhB;AAEC,MAAA,OAAO,EAAGzB,OAFX;AAGC,MAAA,SAAS,EAAC,WAHX;AAIC,MAAA,SAAS,EAAC,kCAJX;AAKC,MAAA,MAAM,EAAGI,aALV;AAMC,MAAA,GAAG,EAAGM;AANP,OAQC,cAAC,OAAD,OARD,CADD,EAWGR,UAAU,CAACI,OAAX,IACDC,eADC,IAEDnB,YAAY,CACX,cAAC,OAAD;AAAS,MAAA,SAAS,EAAGD;AAArB,MADW,EAEXe,UAAU,CAACI,OAAX,CAAmBM,aAAnB,CAAiCc,IAFtB,CAbd,CADD;AAoBA;;AAED,SAAOlC,eAAP;AACA;;AAED,SAASqB,iBAAT,CACCc,GADD,EAECC,OAFD,EAGE;AACDtD,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMuD,QAAQ,GAAKC,KAAF,IAAsC;AACtD;AACA,UACC,CAAEH,GAAG,CAACrB,OAAN,IACAqB,GAAG,CAACrB,OAAJ,CAAYyB,QAAZ,CAAsBD,KAAK,CAACE,MAA5B,CAFD,EAGE;AACD;AACA;;AACDJ,MAAAA,OAAO,CAAEE,KAAF,CAAP;AACA,KATD;;AAUAG,IAAAA,QAAQ,CAACC,gBAAT,CAA2B,WAA3B,EAAwCL,QAAxC;AACAI,IAAAA,QAAQ,CAACC,gBAAT,CAA2B,YAA3B,EAAyCL,QAAzC;AACA,WAAO,MAAM;AACZI,MAAAA,QAAQ,CAACE,mBAAT,CAA8B,WAA9B,EAA2CN,QAA3C;AACAI,MAAAA,QAAQ,CAACE,mBAAT,CAA8B,YAA9B,EAA4CN,QAA5C;AACA,KAHD,CAbgB,CAiBhB;AACA;AACA;AACA,GApBQ,EAoBN,CAAED,OAAF,CApBM,CAAT;AAqBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseLayoutEffect,\n\tuseRef,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\nimport { useAnchor } from '@wordpress/rich-text';\nimport { useDebounce, useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { __, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getDefaultUseItems from './get-default-use-items';\nimport Button from '../button';\nimport Popover from '../popover';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { createPortal } from 'react-dom';\nimport type { AutocompleterUIProps, KeyedOption, WPCompleter } from './types';\n\nexport function getAutoCompleterUI( autocompleter: WPCompleter ) {\n\tconst useItems = autocompleter.useItems\n\t\t? autocompleter.useItems\n\t\t: getDefaultUseItems( autocompleter );\n\n\tfunction AutocompleterUI( {\n\t\tfilterValue,\n\t\tinstanceId,\n\t\tlistBoxId,\n\t\tclassName,\n\t\tselectedIndex,\n\t\tonChangeOptions,\n\t\tonSelect,\n\t\tonReset,\n\t\treset,\n\t\tcontentRef,\n\t}: AutocompleterUIProps ) {\n\t\tconst [ items ] = useItems( filterValue );\n\t\tconst popoverAnchor = useAnchor( {\n\t\t\teditableContentElement: contentRef.current,\n\t\t} );\n\n\t\tconst [ needsA11yCompat, setNeedsA11yCompat ] = useState( false );\n\t\tconst popoverRef = useRef< HTMLElement >( null );\n\t\tconst popoverRefs = useMergeRefs( [\n\t\t\tpopoverRef,\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tif ( ! contentRef.current ) return;\n\n\t\t\t\t\t// If the popover is rendered in a different document than\n\t\t\t\t\t// the content, we need to duplicate the options list in the\n\t\t\t\t\t// content document so that it's available to the screen\n\t\t\t\t\t// readers, which check the DOM ID based aira-* attributes.\n\t\t\t\t\tsetNeedsA11yCompat(\n\t\t\t\t\t\tnode.ownerDocument !== contentRef.current.ownerDocument\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t[ contentRef ]\n\t\t\t),\n\t\t] );\n\n\t\tuseOnClickOutside( popoverRef, reset );\n\n\t\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\t\tfunction announce( options: Array< KeyedOption > ) {\n\t\t\tif ( ! debouncedSpeak ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( !! options.length ) {\n\t\t\t\tif ( filterValue ) {\n\t\t\t\t\tdebouncedSpeak(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\toptions.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\toptions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tdebouncedSpeak(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'Initial %d result loaded. Type to filter all available results. Use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\t'Initial %d results loaded. Type to filter all available results. Use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t\toptions.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\toptions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'assertive'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdebouncedSpeak( __( 'No results.' ), 'assertive' );\n\t\t\t}\n\t\t}\n\n\t\tuseLayoutEffect( () => {\n\t\t\tonChangeOptions( items );\n\t\t\tannounce( items );\n\t\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [ items ] );\n\n\t\tif ( items.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ListBox = ( {\n\t\t\tComponent = 'div',\n\t\t}: {\n\t\t\tComponent?: React.ElementType;\n\t\t} ) => (\n\t\t\t<Component\n\t\t\t\tid={ listBoxId }\n\t\t\t\trole=\"listbox\"\n\t\t\t\tclassName=\"components-autocomplete__results\"\n\t\t\t>\n\t\t\t\t{ items.map( ( option, index ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ option.key }\n\t\t\t\t\t\tid={ `components-autocomplete-item-${ instanceId }-${ option.key }` }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected={ index === selectedIndex }\n\t\t\t\t\t\tdisabled={ option.isDisabled }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-autocomplete__result',\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-selected': index === selectedIndex,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => onSelect( option ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t</Button>\n\t\t\t\t) ) }\n\t\t\t</Component>\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Popover\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tonClose={ onReset }\n\t\t\t\t\tplacement=\"top-start\"\n\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tref={ popoverRefs }\n\t\t\t\t>\n\t\t\t\t\t<ListBox />\n\t\t\t\t</Popover>\n\t\t\t\t{ contentRef.current &&\n\t\t\t\t\tneedsA11yCompat &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<ListBox Component={ VisuallyHidden } />,\n\t\t\t\t\t\tcontentRef.current.ownerDocument.body\n\t\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn AutocompleterUI;\n}\n\nfunction useOnClickOutside(\n\tref: React.RefObject< HTMLElement >,\n\thandler: AutocompleterUIProps[ 'reset' ]\n) {\n\tuseEffect( () => {\n\t\tconst listener = ( event: MouseEvent | TouchEvent ) => {\n\t\t\t// Do nothing if clicking ref's element or descendent elements, or if the ref is not referencing an element\n\t\t\tif (\n\t\t\t\t! ref.current ||\n\t\t\t\tref.current.contains( event.target as Node )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thandler( event );\n\t\t};\n\t\tdocument.addEventListener( 'mousedown', listener );\n\t\tdocument.addEventListener( 'touchstart', listener );\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', listener );\n\t\t\tdocument.removeEventListener( 'touchstart', listener );\n\t\t};\n\t\t// Disable reason: `ref` is a ref object and should not be included in a\n\t\t// hook's dependency list.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ handler ] );\n}\n"]}
@@ -9,10 +9,8 @@ import removeAccents from 'remove-accents';
9
9
  */
10
10
 
11
11
  import { renderToString, useEffect, useState, useRef, useMemo } from '@wordpress/element';
12
- import { __, _n, sprintf } from '@wordpress/i18n';
13
- import { useInstanceId, useDebounce, useMergeRefs, useRefEffect } from '@wordpress/compose';
12
+ import { useInstanceId, useMergeRefs, useRefEffect } from '@wordpress/compose';
14
13
  import { create, slice, insert, isCollapsed, getTextContent } from '@wordpress/rich-text';
15
- import { speak } from '@wordpress/a11y';
16
14
  /**
17
15
  * Internal dependencies
18
16
  */
@@ -27,7 +25,6 @@ export function useAutocomplete({
27
25
  completers,
28
26
  contentRef
29
27
  }) {
30
- const debouncedSpeak = useDebounce(speak, 500);
31
28
  const instanceId = useInstanceId(useAutocomplete);
32
29
  const [selectedIndex, setSelectedIndex] = useState(0);
33
30
  const [filteredOptions, setFilteredOptions] = useState(EMPTY_FILTERED_OPTIONS);
@@ -92,20 +89,6 @@ export function useAutocomplete({
92
89
  setAutocompleter(null);
93
90
  setAutocompleterUI(null);
94
91
  }
95
-
96
- function announce(options) {
97
- if (!debouncedSpeak) {
98
- return;
99
- }
100
-
101
- if (!!options.length) {
102
- debouncedSpeak(sprintf(
103
- /* translators: %d: number of results. */
104
- _n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
105
- } else {
106
- debouncedSpeak(__('No results.'), 'assertive');
107
- }
108
- }
109
92
  /**
110
93
  * Load options for an autocompleter.
111
94
  *
@@ -116,7 +99,6 @@ export function useAutocomplete({
116
99
  function onChangeOptions(options) {
117
100
  setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
118
101
  setFilteredOptions(options);
119
- announce(options);
120
102
  }
121
103
 
122
104
  function handleKeyDown(event) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/autocomplete/index.tsx"],"names":["removeAccents","renderToString","useEffect","useState","useRef","useMemo","__","_n","sprintf","useInstanceId","useDebounce","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","getAutoCompleterUI","escapeRegExp","EMPTY_FILTERED_OPTIONS","useAutocomplete","record","onChange","onReplace","completers","contentRef","debouncedSpeak","instanceId","selectedIndex","setSelectedIndex","filteredOptions","setFilteredOptions","filterValue","setFilterValue","autocompleter","setAutocompleter","AutocompleterUI","setAutocompleterUI","backspacing","insertCompletion","replacement","end","start","triggerPrefix","length","toInsert","html","select","option","getOptionCompletion","isDisabled","completion","value","isCompletionObject","obj","action","undefined","completionObject","reset","announce","options","onChangeOptions","handleKeyDown","event","current","key","defaultPrevented","isComposing","keyCode","preventDefault","textContent","completer","find","allowContext","index","lastIndexOf","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","textAfterSelection","test","safeTrigger","text","match","RegExp","query","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","useLastDifferentValue","history","Set","add","size","delete","Array","from","useAutocompleteProps","ref","onKeyDownRef","previousRecord","mergedRefs","element","_onKeyDown","addEventListener","removeEventListener","didUserInput","children","Autocomplete","isSelected","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,SAFD,EAGCC,QAHD,EAICC,MAJD,EAKCC,OALD,QAMO,oBANP;AAOA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,aADD,EAECC,WAFD,EAGCC,YAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SACCC,MADD,EAECC,KAFD,EAGCC,MAHD,EAICC,WAJD,EAKCC,cALD,QAMO,sBANP;AAOA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAYA,MAAMC,sBAAqC,GAAG,EAA9C;AAEA,OAAO,SAASC,eAAT,CAA0B;AAChCC,EAAAA,MADgC;AAEhCC,EAAAA,QAFgC;AAGhCC,EAAAA,SAHgC;AAIhCC,EAAAA,UAJgC;AAKhCC,EAAAA;AALgC,CAA1B,EAMmB;AACzB,QAAMC,cAAc,GAAGlB,WAAW,CAAEQ,KAAF,EAAS,GAAT,CAAlC;AACA,QAAMW,UAAU,GAAGpB,aAAa,CAAEa,eAAF,CAAhC;AACA,QAAM,CAAEQ,aAAF,EAAiBC,gBAAjB,IAAsC5B,QAAQ,CAAE,CAAF,CAApD;AAEA,QAAM,CAAE6B,eAAF,EAAmBC,kBAAnB,IAA0C9B,QAAQ,CAErDkB,sBAFqD,CAAxD;AAGA,QAAM,CAAEa,WAAF,EAAeC,cAAf,IACLhC,QAAQ,CAA2C,EAA3C,CADT;AAEA,QAAM,CAAEiC,aAAF,EAAiBC,gBAAjB,IAAsClC,QAAQ,CACnD,IADmD,CAApD;AAGA,QAAM,CAAEmC,eAAF,EAAmBC,kBAAnB,IAA0Cp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AAO;AACNH,IAAAA,GAAG,EAAEG,UADC;AAENM,IAAAA,QAAQ,EAAEnB,OAFJ;AAGN,yBAAqBJ,SAAS,GAAG,MAAH,GAAYrC,SAHpC;AAIN,iBAAaqC,SAJP;AAKN,6BAAyBC;AALnB,GAAP;AAOA;AAED,eAAe,SAASuB,YAAT,CAAuB;AACrCD,EAAAA,QADqC;AAErCE,EAAAA,UAFqC;AAGrC,KAAG1D;AAHkC,CAAvB,EAIQ;AACtB,QAAM;AAAEqC,IAAAA,OAAF;AAAW,OAAGsB;AAAd,MAAwBnG,eAAe,CAAEwC,OAAF,CAA7C;AACA,SACC,8BACGwD,QAAQ,CAAEG,KAAF,CADX,EAEGD,UAAU,IAAIrB,OAFjB,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseInstanceId,\n\tuseDebounce,\n\tuseMergeRefs,\n\tuseRefEffect,\n} from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n} from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport type {\n\tAutocompleteProps,\n\tAutocompleterUIProps,\n\tInsertOption,\n\tKeyedOption,\n\tOptionCompletion,\n\tReplaceOption,\n\tUseAutocompleteProps,\n\tWPCompleter,\n} from './types';\n\nconst EMPTY_FILTERED_OPTIONS: KeyedOption[] = [];\n\nexport function useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n}: UseAutocompleteProps ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst instanceId = useInstanceId( useAutocomplete );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\n\tconst [ filteredOptions, setFilteredOptions ] = useState<\n\t\tArray< KeyedOption >\n\t>( EMPTY_FILTERED_OPTIONS );\n\tconst [ filterValue, setFilterValue ] =\n\t\tuseState< AutocompleterUIProps[ 'filterValue' ] >( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState< WPCompleter | null >(\n\t\tnull\n\t);\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState<\n\t\t( ( props: AutocompleterUIProps ) => JSX.Element | null ) | null\n\t>( null );\n\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement: React.ReactNode ) {\n\t\tif ( autocompleter === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t}\n\n\tfunction select( option: KeyedOption ) {\n\t\tconst { getOptionCompletion } = autocompleter || {};\n\n\t\tif ( option.isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( getOptionCompletion ) {\n\t\t\tconst completion = getOptionCompletion( option.value, filterValue );\n\n\t\t\tconst isCompletionObject = (\n\t\t\t\tobj: OptionCompletion\n\t\t\t): obj is InsertOption | ReplaceOption => {\n\t\t\t\treturn (\n\t\t\t\t\tobj !== null &&\n\t\t\t\t\ttypeof obj === 'object' &&\n\t\t\t\t\t'action' in obj &&\n\t\t\t\t\tobj.action !== undefined &&\n\t\t\t\t\t'value' in obj &&\n\t\t\t\t\tobj.value !== undefined\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst completionObject = isCompletionObject( completion )\n\t\t\t\t? completion\n\t\t\t\t: ( {\n\t\t\t\t\t\taction: 'insert-at-caret',\n\t\t\t\t\t\tvalue: completion,\n\t\t\t\t } as InsertOption );\n\n\t\t\tif ( 'replace' === completionObject.action ) {\n\t\t\t\tonReplace( [ completionObject.value ] );\n\t\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t\t// state (below) on an unmounted component.\n\t\t\t\treturn;\n\t\t\t} else if ( 'insert-at-caret' === completionObject.action ) {\n\t\t\t\tinsertCompletion( completionObject.value );\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\treset();\n\t}\n\n\tfunction reset() {\n\t\tsetSelectedIndex( 0 );\n\t\tsetFilteredOptions( EMPTY_FILTERED_OPTIONS );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\tfunction announce( options: Array< KeyedOption > ) {\n\t\tif ( ! debouncedSpeak ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( !! options.length ) {\n\t\t\tdebouncedSpeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\toptions.length\n\t\t\t\t\t),\n\t\t\t\t\toptions.length\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t} else {\n\t\t\tdebouncedSpeak( __( 'No results.' ), 'assertive' );\n\t\t}\n\t}\n\n\t/**\n\t * Load options for an autocompleter.\n\t *\n\t * @param {Array} options\n\t */\n\tfunction onChangeOptions( options: Array< KeyedOption > ) {\n\t\tsetSelectedIndex(\n\t\t\toptions.length === filteredOptions.length ? selectedIndex : 0\n\t\t);\n\t\tsetFilteredOptions( options );\n\t\tannounce( options );\n\t}\n\n\tfunction handleKeyDown( event: KeyboardEvent ) {\n\t\tbackspacing.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tevent.defaultPrevented ||\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex === 0\n\t\t\t\t\t\t? filteredOptions.length\n\t\t\t\t\t\t: selectedIndex ) - 1\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowDown':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex + 1 ) % filteredOptions.length\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'Escape':\n\t\t\t\tsetAutocompleter( null );\n\t\t\t\tsetAutocompleterUI( null );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\treset();\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t\treturn '';\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst completer = completers?.find(\n\t\t\t( { triggerPrefix, allowContext } ) => {\n\t\t\t\tconst index = textContent.lastIndexOf( triggerPrefix );\n\n\t\t\t\tif ( index === -1 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textWithoutTrigger = textContent.slice(\n\t\t\t\t\tindex + triggerPrefix.length\n\t\t\t\t);\n\n\t\t\t\tconst tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n\t\t\t\t// This is a final barrier to prevent the effect from completing with\n\t\t\t\t// an extremely long string, which causes the editor to slow-down\n\t\t\t\t// significantly. This could happen, for example, if `matchingWhileBackspacing`\n\t\t\t\t// is true and one of the \"words\" end up being too long. If that's the case,\n\t\t\t\t// it will be caught by this guard.\n\t\t\t\tif ( tooDistantFromTrigger ) return false;\n\n\t\t\t\tconst mismatch = filteredOptions.length === 0;\n\t\t\t\tconst wordsFromTrigger = textWithoutTrigger.split( /\\s/ );\n\t\t\t\t// We need to allow the effect to run when not backspacing and if there\n\t\t\t\t// was a mismatch. i.e when typing a trigger + the match string or when\n\t\t\t\t// clicking in an existing trigger word on the page. We do that if we\n\t\t\t\t// detect that we have one word from trigger in the current textual context.\n\t\t\t\t//\n\t\t\t\t// Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n\t\t\t\t// allow the effect to run. It will run until there's a mismatch.\n\t\t\t\tconst hasOneTriggerWord = wordsFromTrigger.length === 1;\n\t\t\t\t// This is used to allow the effect to run when backspacing and if\n\t\t\t\t// \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n\t\t\t\t// word\" any word up to the limit of 3 from the trigger character.\n\t\t\t\t// Anything beyond that is ignored if there's a mismatch. This allows\n\t\t\t\t// us to \"escape\" a mismatch when backspacing, but still imposing some\n\t\t\t\t// sane limits.\n\t\t\t\t//\n\t\t\t\t// Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n\t\t\t\t// if the user presses backspace here, it will show the completion popup again.\n\t\t\t\tconst matchingWhileBackspacing =\n\t\t\t\t\tbackspacing.current &&\n\t\t\t\t\ttextWithoutTrigger.split( /\\s/ ).length <= 3;\n\n\t\t\t\tif (\n\t\t\t\t\tmismatch &&\n\t\t\t\t\t! ( matchingWhileBackspacing || hasOneTriggerWord )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textAfterSelection = getTextContent(\n\t\t\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tallowContext &&\n\t\t\t\t\t! allowContext(\n\t\t\t\t\t\ttextContent.slice( 0, index ),\n\t\t\t\t\t\ttextAfterSelection\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t/^\\s/.test( textWithoutTrigger ) ||\n\t\t\t\t\t/\\s\\s+$/.test( textWithoutTrigger )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn /[\\u0000-\\uFFFF]*$/.test( textWithoutTrigger );\n\t\t\t}\n\t\t);\n\n\t\tif ( ! completer ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\n\t\tconst text = removeAccents( textContent );\n\t\tconst match = text\n\t\t\t.slice( text.lastIndexOf( completer.triggerPrefix ) )\n\t\t\t.match( new RegExp( `${ safeTrigger }([\\u0000-\\uFFFF]*)$` ) );\n\t\tconst query = match && match[ 1 ];\n\n\t\tsetAutocompleter( completer );\n\t\tsetAutocompleterUI( () =>\n\t\t\tcompleter !== autocompleter\n\t\t\t\t? getAutoCompleterUI( completer )\n\t\t\t\t: AutocompleterUI\n\t\t);\n\t\tsetFilterValue( query === null ? '' : query );\n\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: undefined;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: handleKeyDown,\n\t\tpopover: hasSelection && AutocompleterUI && (\n\t\t\t<AutocompleterUI\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tvalue={ record }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ reset }\n\t\t\t/>\n\t\t),\n\t};\n}\n\nfunction useLastDifferentValue( value: UseAutocompleteProps[ 'record' ] ) {\n\tconst history = useRef< Set< typeof value > >( new Set() );\n\n\thistory.current.add( value );\n\n\t// Keep the history size to 2.\n\tif ( history.current.size > 2 ) {\n\t\thistory.current.delete( Array.from( history.current )[ 0 ] );\n\t}\n\n\treturn Array.from( history.current )[ 0 ];\n}\n\nexport function useAutocompleteProps( options: UseAutocompleteProps ) {\n\tconst ref = useRef< HTMLElement >( null );\n\tconst onKeyDownRef = useRef< ( event: KeyboardEvent ) => void >();\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect( ( element: HTMLElement ) => {\n\t\t\tfunction _onKeyDown( event: KeyboardEvent ) {\n\t\t\t\tonKeyDownRef.current?.( event );\n\t\t\t}\n\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t};\n\t\t}, [] ),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? 'list' : undefined,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId,\n\t};\n}\n\nexport default function Autocomplete( {\n\tchildren,\n\tisSelected,\n\t...options\n}: AutocompleteProps ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/autocomplete/index.tsx"],"names":["removeAccents","renderToString","useEffect","useState","useRef","useMemo","useInstanceId","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","getAutoCompleterUI","escapeRegExp","EMPTY_FILTERED_OPTIONS","useAutocomplete","record","onChange","onReplace","completers","contentRef","instanceId","selectedIndex","setSelectedIndex","filteredOptions","setFilteredOptions","filterValue","setFilterValue","autocompleter","setAutocompleter","AutocompleterUI","setAutocompleterUI","backspacing","insertCompletion","replacement","end","start","triggerPrefix","length","toInsert","html","select","option","getOptionCompletion","isDisabled","completion","value","isCompletionObject","obj","action","undefined","completionObject","reset","onChangeOptions","options","handleKeyDown","event","current","key","defaultPrevented","isComposing","keyCode","preventDefault","textContent","completer","find","allowContext","index","lastIndexOf","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","textAfterSelection","test","safeTrigger","text","match","RegExp","query","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","useLastDifferentValue","history","Set","add","size","delete","Array","from","useAutocompleteProps","ref","onKeyDownRef","previousRecord","mergedRefs","element","_onKeyDown","addEventListener","removeEventListener","didUserInput","children","Autocomplete","isSelected","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,SAFD,EAGCC,QAHD,EAICC,MAJD,EAKCC,OALD,QAMO,oBANP;AAQA,SAASC,aAAT,EAAwBC,YAAxB,EAAsCC,YAAtC,QAA0D,oBAA1D;AACA,SACCC,MADD,EAECC,KAFD,EAGCC,MAHD,EAICC,WAJD,EAKCC,cALD,QAMO,sBANP;AAQA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAYA,MAAMC,sBAAqC,GAAG,EAA9C;AAEA,OAAO,SAASC,eAAT,CAA0B;AAChCC,EAAAA,MADgC;AAEhCC,EAAAA,QAFgC;AAGhCC,EAAAA,SAHgC;AAIhCC,EAAAA,UAJgC;AAKhCC,EAAAA;AALgC,CAA1B,EAMmB;AACzB,QAAMC,UAAU,GAAGjB,aAAa,CAAEW,eAAF,CAAhC;AACA,QAAM,CAAEO,aAAF,EAAiBC,gBAAjB,IAAsCtB,QAAQ,CAAE,CAAF,CAApD;AAEA,QAAM,CAAEuB,eAAF,EAAmBC,kBAAnB,IAA0CxB,QAAQ,CAErDa,sBAFqD,CAAxD;AAGA,QAAM,CAAEY,WAAF,EAAeC,cAAf,IACL1B,QAAQ,CAA2C,EAA3C,CADT;AAEA,QAAM,CAAE2B,aAAF,EAAiBC,gBAAjB,IAAsC5B,QAAQ,CACnD,IADmD,CAApD;AAGA,QAAM,CAAE6B,eAAF,EAAmBC,kBAAnB,IAA0C9B,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FjB,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, _n } from '@wordpress/i18n';\nimport { useInstanceId, useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n} from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport type {\n\tAutocompleteProps,\n\tAutocompleterUIProps,\n\tInsertOption,\n\tKeyedOption,\n\tOptionCompletion,\n\tReplaceOption,\n\tUseAutocompleteProps,\n\tWPCompleter,\n} from './types';\n\nconst EMPTY_FILTERED_OPTIONS: KeyedOption[] = [];\n\nexport function useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n}: UseAutocompleteProps ) {\n\tconst instanceId = useInstanceId( useAutocomplete );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\n\tconst [ filteredOptions, setFilteredOptions ] = useState<\n\t\tArray< KeyedOption >\n\t>( EMPTY_FILTERED_OPTIONS );\n\tconst [ filterValue, setFilterValue ] =\n\t\tuseState< AutocompleterUIProps[ 'filterValue' ] >( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState< WPCompleter | null >(\n\t\tnull\n\t);\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState<\n\t\t( ( props: AutocompleterUIProps ) => JSX.Element | null ) | null\n\t>( null );\n\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement: React.ReactNode ) {\n\t\tif ( autocompleter === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t}\n\n\tfunction select( option: KeyedOption ) {\n\t\tconst { getOptionCompletion } = autocompleter || {};\n\n\t\tif ( option.isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( getOptionCompletion ) {\n\t\t\tconst completion = getOptionCompletion( option.value, filterValue );\n\n\t\t\tconst isCompletionObject = (\n\t\t\t\tobj: OptionCompletion\n\t\t\t): obj is InsertOption | ReplaceOption => {\n\t\t\t\treturn (\n\t\t\t\t\tobj !== null &&\n\t\t\t\t\ttypeof obj === 'object' &&\n\t\t\t\t\t'action' in obj &&\n\t\t\t\t\tobj.action !== undefined &&\n\t\t\t\t\t'value' in obj &&\n\t\t\t\t\tobj.value !== undefined\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst completionObject = isCompletionObject( completion )\n\t\t\t\t? completion\n\t\t\t\t: ( {\n\t\t\t\t\t\taction: 'insert-at-caret',\n\t\t\t\t\t\tvalue: completion,\n\t\t\t\t } as InsertOption );\n\n\t\t\tif ( 'replace' === completionObject.action ) {\n\t\t\t\tonReplace( [ completionObject.value ] );\n\t\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t\t// state (below) on an unmounted component.\n\t\t\t\treturn;\n\t\t\t} else if ( 'insert-at-caret' === completionObject.action ) {\n\t\t\t\tinsertCompletion( completionObject.value );\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\treset();\n\t}\n\n\tfunction reset() {\n\t\tsetSelectedIndex( 0 );\n\t\tsetFilteredOptions( EMPTY_FILTERED_OPTIONS );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\t/**\n\t * Load options for an autocompleter.\n\t *\n\t * @param {Array} options\n\t */\n\tfunction onChangeOptions( options: Array< KeyedOption > ) {\n\t\tsetSelectedIndex(\n\t\t\toptions.length === filteredOptions.length ? selectedIndex : 0\n\t\t);\n\t\tsetFilteredOptions( options );\n\t}\n\n\tfunction handleKeyDown( event: KeyboardEvent ) {\n\t\tbackspacing.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tevent.defaultPrevented ||\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex === 0\n\t\t\t\t\t\t? filteredOptions.length\n\t\t\t\t\t\t: selectedIndex ) - 1\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowDown':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex + 1 ) % filteredOptions.length\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'Escape':\n\t\t\t\tsetAutocompleter( null );\n\t\t\t\tsetAutocompleterUI( null );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\treset();\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t\treturn '';\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst completer = completers?.find(\n\t\t\t( { triggerPrefix, allowContext } ) => {\n\t\t\t\tconst index = textContent.lastIndexOf( triggerPrefix );\n\n\t\t\t\tif ( index === -1 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textWithoutTrigger = textContent.slice(\n\t\t\t\t\tindex + triggerPrefix.length\n\t\t\t\t);\n\n\t\t\t\tconst tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n\t\t\t\t// This is a final barrier to prevent the effect from completing with\n\t\t\t\t// an extremely long string, which causes the editor to slow-down\n\t\t\t\t// significantly. This could happen, for example, if `matchingWhileBackspacing`\n\t\t\t\t// is true and one of the \"words\" end up being too long. If that's the case,\n\t\t\t\t// it will be caught by this guard.\n\t\t\t\tif ( tooDistantFromTrigger ) return false;\n\n\t\t\t\tconst mismatch = filteredOptions.length === 0;\n\t\t\t\tconst wordsFromTrigger = textWithoutTrigger.split( /\\s/ );\n\t\t\t\t// We need to allow the effect to run when not backspacing and if there\n\t\t\t\t// was a mismatch. i.e when typing a trigger + the match string or when\n\t\t\t\t// clicking in an existing trigger word on the page. We do that if we\n\t\t\t\t// detect that we have one word from trigger in the current textual context.\n\t\t\t\t//\n\t\t\t\t// Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n\t\t\t\t// allow the effect to run. It will run until there's a mismatch.\n\t\t\t\tconst hasOneTriggerWord = wordsFromTrigger.length === 1;\n\t\t\t\t// This is used to allow the effect to run when backspacing and if\n\t\t\t\t// \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n\t\t\t\t// word\" any word up to the limit of 3 from the trigger character.\n\t\t\t\t// Anything beyond that is ignored if there's a mismatch. This allows\n\t\t\t\t// us to \"escape\" a mismatch when backspacing, but still imposing some\n\t\t\t\t// sane limits.\n\t\t\t\t//\n\t\t\t\t// Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n\t\t\t\t// if the user presses backspace here, it will show the completion popup again.\n\t\t\t\tconst matchingWhileBackspacing =\n\t\t\t\t\tbackspacing.current &&\n\t\t\t\t\ttextWithoutTrigger.split( /\\s/ ).length <= 3;\n\n\t\t\t\tif (\n\t\t\t\t\tmismatch &&\n\t\t\t\t\t! ( matchingWhileBackspacing || hasOneTriggerWord )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textAfterSelection = getTextContent(\n\t\t\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tallowContext &&\n\t\t\t\t\t! allowContext(\n\t\t\t\t\t\ttextContent.slice( 0, index ),\n\t\t\t\t\t\ttextAfterSelection\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t/^\\s/.test( textWithoutTrigger ) ||\n\t\t\t\t\t/\\s\\s+$/.test( textWithoutTrigger )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn /[\\u0000-\\uFFFF]*$/.test( textWithoutTrigger );\n\t\t\t}\n\t\t);\n\n\t\tif ( ! completer ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\n\t\tconst text = removeAccents( textContent );\n\t\tconst match = text\n\t\t\t.slice( text.lastIndexOf( completer.triggerPrefix ) )\n\t\t\t.match( new RegExp( `${ safeTrigger }([\\u0000-\\uFFFF]*)$` ) );\n\t\tconst query = match && match[ 1 ];\n\n\t\tsetAutocompleter( completer );\n\t\tsetAutocompleterUI( () =>\n\t\t\tcompleter !== autocompleter\n\t\t\t\t? getAutoCompleterUI( completer )\n\t\t\t\t: AutocompleterUI\n\t\t);\n\t\tsetFilterValue( query === null ? '' : query );\n\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: undefined;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: handleKeyDown,\n\t\tpopover: hasSelection && AutocompleterUI && (\n\t\t\t<AutocompleterUI\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tvalue={ record }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ reset }\n\t\t\t/>\n\t\t),\n\t};\n}\n\nfunction useLastDifferentValue( value: UseAutocompleteProps[ 'record' ] ) {\n\tconst history = useRef< Set< typeof value > >( new Set() );\n\n\thistory.current.add( value );\n\n\t// Keep the history size to 2.\n\tif ( history.current.size > 2 ) {\n\t\thistory.current.delete( Array.from( history.current )[ 0 ] );\n\t}\n\n\treturn Array.from( history.current )[ 0 ];\n}\n\nexport function useAutocompleteProps( options: UseAutocompleteProps ) {\n\tconst ref = useRef< HTMLElement >( null );\n\tconst onKeyDownRef = useRef< ( event: KeyboardEvent ) => void >();\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect( ( element: HTMLElement ) => {\n\t\t\tfunction _onKeyDown( event: KeyboardEvent ) {\n\t\t\t\tonKeyDownRef.current?.( event );\n\t\t\t}\n\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t};\n\t\t}, [] ),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? 'list' : undefined,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId,\n\t};\n}\n\nexport default function Autocomplete( {\n\tchildren,\n\tisSelected,\n\t...options\n}: AutocompleteProps ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
@@ -88,9 +87,9 @@ export const VisualLabel = ({
88
87
  children,
89
88
  ...props
90
89
  }) => {
91
- return createElement(StyledVisualLabel, _extends({}, props, {
90
+ return createElement(StyledVisualLabel, { ...props,
92
91
  className: classnames('components-base-control__label', className)
93
- }), children);
92
+ }, children);
94
93
  };
95
94
  BaseControl.VisualLabel = VisualLabel;
96
95
  export default BaseControl;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/base-control/index.tsx"],"names":["classnames","VisuallyHidden","Wrapper","StyledField","StyledLabel","StyledHelp","StyledVisualLabel","useBaseControlProps","BaseControl","__nextHasNoMarginBottom","id","label","hideLabelFromVision","help","className","children","undefined","VisualLabel","props"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,oBAA/B;AAEA,SACCC,OADD,EAECC,WAFD,EAGCC,WAHD,EAICC,UAJD,EAKCC,iBALD,QAMO,8BANP;AASA,SAASC,mBAAT,QAAoC,SAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAG,CAAE;AAC5BC,EAAAA,uBAAuB,GAAG,KADE;AAE5BC,EAAAA,EAF4B;AAG5BC,EAAAA,KAH4B;AAI5BC,EAAAA,mBAAmB,GAAG,KAJM;AAK5BC,EAAAA,IAL4B;AAM5BC,EAAAA,SAN4B;AAO5BC,EAAAA;AAP4B,CAAF,KAQF;AACxB,SACC,cAAC,OAAD;AACC,IAAA,SAAS,EAAGf,UAAU,CAAE,yBAAF,EAA6Bc,SAA7B;AADvB,KAGC,cAAC,WAAD;AACC,IAAA,SAAS,EAAC,gCADX,CAEC;AAFD;AAGC,IAAA,uBAAuB,EAAGL;AAH3B,KAKGE,KAAK,IACND,EADC,KAECE,mBAAmB,GACpB,cAAC,cAAD;AAAgB,IAAA,EAAE,EAAC,OAAnB;AAA2B,IAAA,OAAO,EAAGF;AAArC,KACGC,KADH,CADoB,GAKpB,cAAC,WAAD;AACC,IAAA,SAAS,EAAC,gCADX;AAEC,IAAA,OAAO,EAAGD;AAFX,KAIGC,KAJH,CAPA,CALH,EAmBGA,KAAK,IACN,CAAED,EADD,KAECE,mBAAmB,GACpB,cAAC,cAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KAA6BD,KAA7B,CADoB,GAGpB,cAAC,WAAD,CAAa,WAAb,QACGA,KADH,CALA,CAnBH,EA4BGI,QA5BH,CAHD,EAiCG,CAAC,CAAEF,IAAH,IACD,cAAC,UAAD;AACC,IAAA,EAAE,EAAGH,EAAE,GAAGA,EAAE,GAAG,QAAR,GAAmBM,SAD3B;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,IAAA,uBAAuB,EAAGP;AAH3B,KAKGI,IALH,CAlCF,CADD;AA6CA,CAtDM;AAwDP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMI,WAAW,GAAG,CAAE;AAC5BH,EAAAA,SAD4B;AAE5BC,EAAAA,QAF4B;AAG5B,KAAGG;AAHyB,CAAF,KAI4C;AACtE,SACC,cAAC,iBAAD,eACMA,KADN;AAEC,IAAA,SAAS,EAAGlB,UAAU,CACrB,gCADqB,EAErBc,SAFqB;AAFvB,MAOGC,QAPH,CADD;AAWA,CAhBM;AAiBPP,WAAW,CAACS,WAAZ,GAA0BA,WAA1B;AAEA,eAAeT,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { VisuallyHidden } from '../visually-hidden';\nimport type { BaseControlProps, BaseControlVisualLabelProps } from './types';\nimport {\n\tWrapper,\n\tStyledField,\n\tStyledLabel,\n\tStyledHelp,\n\tStyledVisualLabel,\n} from './styles/base-control-styles';\nimport type { WordPressComponentProps } from '../ui/context';\n\nexport { useBaseControlProps } from './hooks';\n\n/**\n * `BaseControl` is a component used to generate labels and help text for components handling user inputs.\n *\n * ```jsx\n * import { BaseControl, useBaseControlProps } from '@wordpress/components';\n *\n * // Render a `BaseControl` for a textarea input\n * const MyCustomTextareaControl = ({ children, ...baseProps }) => (\n * \t// `useBaseControlProps` is a convenience hook to get the props for the `BaseControl`\n * \t// and the inner control itself. Namely, it takes care of generating a unique `id`,\n * \t// properly associating it with the `label` and `help` elements.\n * \tconst { baseControlProps, controlProps } = useBaseControlProps( baseProps );\n *\n * \treturn (\n * \t\t<BaseControl { ...baseControlProps } __nextHasNoMarginBottom={ true }>\n * \t\t\t<textarea { ...controlProps }>\n * \t\t\t { children }\n * \t\t\t</textarea>\n * \t\t</BaseControl>\n * \t);\n * );\n * ```\n */\nexport const BaseControl = ( {\n\t__nextHasNoMarginBottom = false,\n\tid,\n\tlabel,\n\thideLabelFromVision = false,\n\thelp,\n\tclassName,\n\tchildren,\n}: BaseControlProps ) => {\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName={ classnames( 'components-base-control', className ) }\n\t\t>\n\t\t\t<StyledField\n\t\t\t\tclassName=\"components-base-control__field\"\n\t\t\t\t// TODO: Official deprecation for this should start after all internal usages have been migrated\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t>\n\t\t\t\t{ label &&\n\t\t\t\t\tid &&\n\t\t\t\t\t( hideLabelFromVision ? (\n\t\t\t\t\t\t<VisuallyHidden as=\"label\" htmlFor={ id }>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<StyledLabel\n\t\t\t\t\t\t\tclassName=\"components-base-control__label\"\n\t\t\t\t\t\t\thtmlFor={ id }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</StyledLabel>\n\t\t\t\t\t) ) }\n\t\t\t\t{ label &&\n\t\t\t\t\t! id &&\n\t\t\t\t\t( hideLabelFromVision ? (\n\t\t\t\t\t\t<VisuallyHidden as=\"label\">{ label }</VisuallyHidden>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t) ) }\n\t\t\t\t{ children }\n\t\t\t</StyledField>\n\t\t\t{ !! help && (\n\t\t\t\t<StyledHelp\n\t\t\t\t\tid={ id ? id + '__help' : undefined }\n\t\t\t\t\tclassName=\"components-base-control__help\"\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t>\n\t\t\t\t\t{ help }\n\t\t\t\t</StyledHelp>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n};\n\n/**\n * `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.\n *\n * It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled,\n * e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would\n * otherwise use if the `label` prop was passed.\n *\n * @example\n * import { BaseControl } from '@wordpress/components';\n *\n * const MyBaseControl = () => (\n * \t<BaseControl help=\"This button is already accessibly labeled.\">\n * \t\t<BaseControl.VisualLabel>Author</BaseControl.VisualLabel>\n * \t\t<Button>Select an author</Button>\n * \t</BaseControl>\n * );\n */\nexport const VisualLabel = ( {\n\tclassName,\n\tchildren,\n\t...props\n}: WordPressComponentProps< BaseControlVisualLabelProps, 'span' > ) => {\n\treturn (\n\t\t<StyledVisualLabel\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-base-control__label',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t{ children }\n\t\t</StyledVisualLabel>\n\t);\n};\nBaseControl.VisualLabel = VisualLabel;\n\nexport default BaseControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/base-control/index.tsx"],"names":["classnames","VisuallyHidden","Wrapper","StyledField","StyledLabel","StyledHelp","StyledVisualLabel","useBaseControlProps","BaseControl","__nextHasNoMarginBottom","id","label","hideLabelFromVision","help","className","children","undefined","VisualLabel","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,o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IAAA,uBAAuB,EAAGP;AAH3B,KAKGI,IALH,CAlCF,CADD;AA6CA,CAtDM;AAwDP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMI,WAAW,GAAG,CAAE;AAC5BH,EAAAA,SAD4B;AAE5BC,EAAAA,QAF4B;AAG5B,KAAGG;AAHyB,CAAF,KAI4C;AACtE,SACC,cAAC,iBAAD,OACMA,KADN;AAEC,IAAA,SAAS,EAAGlB,UAAU,CACrB,gCADqB,EAErBc,SAFqB;AAFvB,KAOGC,QAPH,CADD;AAWA,CAhBM;AAiBPP,WAAW,CAACS,WAAZ,GAA0BA,WAA1B;AAEA,eAAeT,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { VisuallyHidden } from '../visually-hidden';\nimport type { BaseControlProps, BaseControlVisualLabelProps } from './types';\nimport {\n\tWrapper,\n\tStyledField,\n\tStyledLabel,\n\tStyledHelp,\n\tStyledVisualLabel,\n} from './styles/base-control-styles';\nimport type { WordPressComponentProps } from '../ui/context';\n\nexport { useBaseControlProps } from './hooks';\n\n/**\n * `BaseControl` is a component used to generate labels and help text for components handling user inputs.\n *\n * ```jsx\n * import { BaseControl, useBaseControlProps } from '@wordpress/components';\n *\n * // Render a `BaseControl` for a textarea input\n * const MyCustomTextareaControl = ({ children, ...baseProps }) => (\n * \t// `useBaseControlProps` is a convenience hook to get the props for the `BaseControl`\n * \t// and the inner control itself. Namely, it takes care of generating a unique `id`,\n * \t// properly associating it with the `label` and `help` elements.\n * \tconst { baseControlProps, controlProps } = useBaseControlProps( baseProps );\n *\n * \treturn (\n * \t\t<BaseControl { ...baseControlProps } __nextHasNoMarginBottom={ true }>\n * \t\t\t<textarea { ...controlProps }>\n * \t\t\t { children }\n * \t\t\t</textarea>\n * \t\t</BaseControl>\n * \t);\n * );\n * ```\n */\nexport const BaseControl = ( {\n\t__nextHasNoMarginBottom = false,\n\tid,\n\tlabel,\n\thideLabelFromVision = false,\n\thelp,\n\tclassName,\n\tchildren,\n}: BaseControlProps ) => {\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName={ classnames( 'components-base-control', className ) }\n\t\t>\n\t\t\t<StyledField\n\t\t\t\tclassName=\"components-base-control__field\"\n\t\t\t\t// TODO: Official deprecation for this should start after all internal usages have been migrated\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t>\n\t\t\t\t{ label &&\n\t\t\t\t\tid &&\n\t\t\t\t\t( hideLabelFromVision ? (\n\t\t\t\t\t\t<VisuallyHidden as=\"label\" htmlFor={ id }>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<StyledLabel\n\t\t\t\t\t\t\tclassName=\"components-base-control__label\"\n\t\t\t\t\t\t\thtmlFor={ id }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</StyledLabel>\n\t\t\t\t\t) ) }\n\t\t\t\t{ label &&\n\t\t\t\t\t! id &&\n\t\t\t\t\t( hideLabelFromVision ? (\n\t\t\t\t\t\t<VisuallyHidden as=\"label\">{ label }</VisuallyHidden>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t) ) }\n\t\t\t\t{ children }\n\t\t\t</StyledField>\n\t\t\t{ !! help && (\n\t\t\t\t<StyledHelp\n\t\t\t\t\tid={ id ? id + '__help' : undefined }\n\t\t\t\t\tclassName=\"components-base-control__help\"\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t>\n\t\t\t\t\t{ help }\n\t\t\t\t</StyledHelp>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n};\n\n/**\n * `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.\n *\n * It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled,\n * e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would\n * otherwise use if the `label` prop was passed.\n *\n * @example\n * import { BaseControl } from '@wordpress/components';\n *\n * const MyBaseControl = () => (\n * \t<BaseControl help=\"This button is already accessibly labeled.\">\n * \t\t<BaseControl.VisualLabel>Author</BaseControl.VisualLabel>\n * \t\t<Button>Select an author</Button>\n * \t</BaseControl>\n * );\n */\nexport const VisualLabel = ( {\n\tclassName,\n\tchildren,\n\t...props\n}: WordPressComponentProps< BaseControlVisualLabelProps, 'span' > ) => {\n\treturn (\n\t\t<StyledVisualLabel\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-base-control__label',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t{ children }\n\t\t</StyledVisualLabel>\n\t);\n};\nBaseControl.VisualLabel = VisualLabel;\n\nexport default BaseControl;\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
@@ -71,11 +70,11 @@ const UnconnectedBorderBoxControl = (props, forwardedRef) => {
71
70
  shift: true
72
71
  } : undefined, [popoverPlacement, popoverOffset, popoverAnchor]);
73
72
  const mergedRef = useMergeRefs([setPopoverAnchor, forwardedRef]);
74
- return createElement(View, _extends({
75
- className: className
76
- }, otherProps, {
73
+ return createElement(View, {
74
+ className: className,
75
+ ...otherProps,
77
76
  ref: mergedRef
78
- }), createElement(BorderLabel, {
77
+ }, createElement(BorderLabel, {
79
78
  label: label,
80
79
  hideLabelFromVision: hideLabelFromVision
81
80
  }), createElement(View, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control/component.tsx"],"names":["__","useMemo","useState","useMergeRefs","BorderBoxControlLinkedButton","BorderBoxControlSplitControls","BorderControl","StyledLabel","View","VisuallyHidden","contextConnect","useBorderBoxControl","BorderLabel","props","label","hideLabelFromVision","UnconnectedBorderBoxControl","forwardedRef","className","colors","disableCustomColors","disableUnits","enableAlpha","enableStyle","hasMixedBorders","isLinked","linkedControlClassName","linkedValue","onLinkedChange","onSplitChange","popoverPlacement","popoverOffset","size","splitValue","toggleLinked","wrapperClassName","__experimentalIsRenderedInSidebar","otherProps","popoverAnchor","setPopoverAnchor","popoverProps","placement","offset","anchor","shift","undefined","mergedRef","BorderBoxControl"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,MAAyC,qCAAzC;AACA,OAAOC,6BAAP,MAA0C,sCAA1C;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,WAAT,QAA4B,+CAA5B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,cAAT,QAAwD,kBAAxD;AACA,SAASC,mBAAT,QAAoC,QAApC;;AAQA,MAAMC,WAAW,GAAKC,KAAF,IAAyB;AAC5C,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAiCF,KAAvC;;AAEA,MAAK,CAAEC,KAAP,EAAe;AACd,WAAO,IAAP;AACA;;AAED,SAAOC,mBAAmB,GACzB,cAAC,cAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KAA6BD,KAA7B,CADyB,GAGzB,cAAC,WAAD,QAAeA,KAAf,CAHD;AAKA,CAZD;;AAcA,MAAME,2BAA2B,GAAG,CACnCH,KADmC,EAEnCI,YAFmC,KAG/B;AACJ,QAAM;AACLC,IAAAA,SADK;AAELC,IAAAA,MAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,YAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA,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A,OAAO,MAAMe,gBAAgB,GAAGrC,cAAc,CAC7CM,2BAD6C,EAE7C,kBAF6C,CAAvC;AAKP,eAAe+B,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BorderBoxControlLinkedButton from '../border-box-control-linked-button';\nimport BorderBoxControlSplitControls from '../border-box-control-split-controls';\nimport { BorderControl } from '../../border-control';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderBoxControl } from './hook';\n\nimport type { BorderBoxControlProps } from '../types';\nimport type {\n\tLabelProps,\n\tBorderControlProps,\n} from '../../border-control/types';\n\nconst BorderLabel = ( props: LabelProps ) => {\n\tconst { label, hideLabelFromVision } = props;\n\n\tif ( ! label ) {\n\t\treturn null;\n\t}\n\n\treturn hideLabelFromVision ? (\n\t\t<VisuallyHidden as=\"label\">{ label }</VisuallyHidden>\n\t) : (\n\t\t<StyledLabel>{ label }</StyledLabel>\n\t);\n};\n\nconst UnconnectedBorderBoxControl = (\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tclassName,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tdisableUnits,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thasMixedBorders,\n\t\thideLabelFromVision,\n\t\tisLinked,\n\t\tlabel,\n\t\tlinkedControlClassName,\n\t\tlinkedValue,\n\t\tonLinkedChange,\n\t\tonSplitChange,\n\t\tpopoverPlacement,\n\t\tpopoverOffset,\n\t\tsize,\n\t\tsplitValue,\n\t\ttoggleLinked,\n\t\twrapperClassName,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t...otherProps\n\t} = useBorderBoxControl( props );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(\n\t\tnull\n\t);\n\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps: BorderControlProps[ '__unstablePopoverProps' ] =\n\t\tuseMemo(\n\t\t\t() =>\n\t\t\t\tpopoverPlacement\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tplacement: popoverPlacement,\n\t\t\t\t\t\t\toffset: popoverOffset,\n\t\t\t\t\t\t\tanchor: popoverAnchor,\n\t\t\t\t\t\t\tshift: true,\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t[ popoverPlacement, popoverOffset, popoverAnchor ]\n\t\t);\n\n\tconst mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );\n\n\treturn (\n\t\t<View className={ className } { ...otherProps } ref={ mergedRef }>\n\t\t\t<BorderLabel\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t\t<View className={ wrapperClassName }>\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<BorderControl\n\t\t\t\t\t\tclassName={ linkedControlClassName }\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onLinkedChange }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\thasMixedBorders ? __( 'Mixed' ) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\t\t\tshouldSanitizeBorder={ false } // This component will handle that.\n\t\t\t\t\t\tvalue={ linkedValue }\n\t\t\t\t\t\twithSlider={ true }\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsize === '__unstable-large' ? '116px' : '110px'\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BorderBoxControlSplitControls\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onSplitChange }\n\t\t\t\t\t\tpopoverPlacement={ popoverPlacement }\n\t\t\t\t\t\tpopoverOffset={ popoverOffset }\n\t\t\t\t\t\tvalue={ splitValue }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BorderBoxControlLinkedButton\n\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\tsize={ size }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</View>\n\t);\n};\n\n/**\n * The `BorderBoxControl` effectively has two view states. The first, a \"linked\"\n * view, allows configuration of a flat border via a single `BorderControl`.\n * The second, a \"split\" view, contains a `BorderControl` for each side\n * as well as a visualizer for the currently selected borders. Each view also\n * contains a button to toggle between the two.\n *\n * When switching from the \"split\" view to \"linked\", if the individual side\n * borders are not consistent, the \"linked\" view will display any border\n * properties selections that are consistent while showing a mixed state for\n * those that aren't. For example, if all borders had the same color and style\n * but different widths, then the border dropdown in the \"linked\" view's\n * `BorderControl` would show that consistent color and style but the \"linked\"\n * view's width input would show \"Mixed\" placeholder text.\n *\n * ```jsx\n * import { __experimentalBorderBoxControl as BorderBoxControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderBoxControl = () => {\n * \tconst defaultBorder = {\n * \t\tcolor: '#72aee6',\n * \t\tstyle: 'dashed',\n * \t\twidth: '1px',\n * \t};\n * \tconst [ borders, setBorders ] = useState( {\n * \t\ttop: defaultBorder,\n * \t\tright: defaultBorder,\n * \t\tbottom: defaultBorder,\n * \t\tleft: defaultBorder,\n * \t} );\n * \tconst onChange = ( newBorders ) => setBorders( newBorders );\n *\n * \treturn (\n * \t\t<BorderBoxControl\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Borders' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ borders }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderBoxControl = contextConnect(\n\tUnconnectedBorderBoxControl,\n\t'BorderBoxControl'\n);\n\nexport default BorderBoxControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control/component.tsx"],"names":["__","useMemo","useState","useMergeRefs","BorderBoxControlLinkedButton","BorderBoxControlSplitControls","BorderControl","StyledLabel","View","VisuallyHidden","contextConnect","useBorderBoxControl","BorderLabel","props","label","hideLabelFromVision","UnconnectedBorderBoxControl","forwardedRef","className","colors","disableCustomColors","disableUnits","enableAlpha","enableStyle","hasMixedBorders","isLinked","linkedControlClassName","linkedValue","onLinkedChange","onSplitChange","popoverPlacement","popoverOffset","size","splitValue","toggleLinked","wrapperClassName","__experimentalIsRenderedInSidebar","otherProps","popoverAnchor","setPopoverAnchor","popoverProps","placement","offset","anchor","shift","undefined","mergedRef","BorderBoxControl"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,4BAAP,MAAyC,qCAAzC;AACA,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AAD;AACC,IAAA,MAAM,EAAGb,MADV;AAEC,IAAA,mBAAmB,EAAGC,mBAFvB;AAGC,IAAA,WAAW,EAAGE,WAHf;AAIC,IAAA,WAAW,EAAGC,WAJf;AAKC,IAAA,QAAQ,EAAGM,aALZ;AAMC,IAAA,gBAAgB,EAAGC,gBANpB;AAOC,IAAA,aAAa,EAAGC,aAPjB;AAQC,IAAA,KAAK,EAAGE,UART;AASC,IAAA,iCAAiC,EAChCG,iCAVF;AAYC,IAAA,IAAI,EAAGJ;AAZR,IA1BF,EAyCC,cAAC,4BAAD;AACC,IAAA,OAAO,EAAGE,YADX;AAEC,IAAA,QAAQ,EAAGT,QAFZ;AAGC,IAAA,IAAI,EAAGO;AAHR,IAzCD,CALD,CADD;AAuDA,CA3GD;AA6GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMe,gBAAgB,GAAGrC,cAAc,CAC7CM,2BAD6C,EAE7C,kBAF6C,CAAvC;AAKP,eAAe+B,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BorderBoxControlLinkedButton from '../border-box-control-linked-button';\nimport BorderBoxControlSplitControls from '../border-box-control-split-controls';\nimport { BorderControl } from '../../border-control';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport { View } from '../../view';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderBoxControl } from './hook';\n\nimport type { BorderBoxControlProps } from '../types';\nimport type {\n\tLabelProps,\n\tBorderControlProps,\n} from '../../border-control/types';\n\nconst BorderLabel = ( props: LabelProps ) => {\n\tconst { label, hideLabelFromVision } = props;\n\n\tif ( ! label ) {\n\t\treturn null;\n\t}\n\n\treturn hideLabelFromVision ? (\n\t\t<VisuallyHidden as=\"label\">{ label }</VisuallyHidden>\n\t) : (\n\t\t<StyledLabel>{ label }</StyledLabel>\n\t);\n};\n\nconst UnconnectedBorderBoxControl = (\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div', false >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tclassName,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tdisableUnits,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\thasMixedBorders,\n\t\thideLabelFromVision,\n\t\tisLinked,\n\t\tlabel,\n\t\tlinkedControlClassName,\n\t\tlinkedValue,\n\t\tonLinkedChange,\n\t\tonSplitChange,\n\t\tpopoverPlacement,\n\t\tpopoverOffset,\n\t\tsize,\n\t\tsplitValue,\n\t\ttoggleLinked,\n\t\twrapperClassName,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t...otherProps\n\t} = useBorderBoxControl( props );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(\n\t\tnull\n\t);\n\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps: BorderControlProps[ '__unstablePopoverProps' ] =\n\t\tuseMemo(\n\t\t\t() =>\n\t\t\t\tpopoverPlacement\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tplacement: popoverPlacement,\n\t\t\t\t\t\t\toffset: popoverOffset,\n\t\t\t\t\t\t\tanchor: popoverAnchor,\n\t\t\t\t\t\t\tshift: true,\n\t\t\t\t\t }\n\t\t\t\t\t: undefined,\n\t\t\t[ popoverPlacement, popoverOffset, popoverAnchor ]\n\t\t);\n\n\tconst mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );\n\n\treturn (\n\t\t<View className={ className } { ...otherProps } ref={ mergedRef }>\n\t\t\t<BorderLabel\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t/>\n\t\t\t<View className={ wrapperClassName }>\n\t\t\t\t{ isLinked ? (\n\t\t\t\t\t<BorderControl\n\t\t\t\t\t\tclassName={ linkedControlClassName }\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableUnits={ disableUnits }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onLinkedChange }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\thasMixedBorders ? __( 'Mixed' ) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\t\t\tshouldSanitizeBorder={ false } // This component will handle that.\n\t\t\t\t\t\tvalue={ linkedValue }\n\t\t\t\t\t\twithSlider={ true }\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsize === '__unstable-large' ? '116px' : '110px'\n\t\t\t\t\t\t}\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BorderBoxControlSplitControls\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\tenableStyle={ enableStyle }\n\t\t\t\t\t\tonChange={ onSplitChange }\n\t\t\t\t\t\tpopoverPlacement={ popoverPlacement }\n\t\t\t\t\t\tpopoverOffset={ popoverOffset }\n\t\t\t\t\t\tvalue={ splitValue }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BorderBoxControlLinkedButton\n\t\t\t\t\tonClick={ toggleLinked }\n\t\t\t\t\tisLinked={ isLinked }\n\t\t\t\t\tsize={ size }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</View>\n\t);\n};\n\n/**\n * The `BorderBoxControl` effectively has two view states. The first, a \"linked\"\n * view, allows configuration of a flat border via a single `BorderControl`.\n * The second, a \"split\" view, contains a `BorderControl` for each side\n * as well as a visualizer for the currently selected borders. Each view also\n * contains a button to toggle between the two.\n *\n * When switching from the \"split\" view to \"linked\", if the individual side\n * borders are not consistent, the \"linked\" view will display any border\n * properties selections that are consistent while showing a mixed state for\n * those that aren't. For example, if all borders had the same color and style\n * but different widths, then the border dropdown in the \"linked\" view's\n * `BorderControl` would show that consistent color and style but the \"linked\"\n * view's width input would show \"Mixed\" placeholder text.\n *\n * ```jsx\n * import { __experimentalBorderBoxControl as BorderBoxControl } from '@wordpress/components';\n * import { __ } from '@wordpress/i18n';\n *\n * const colors = [\n * \t{ name: 'Blue 20', color: '#72aee6' },\n * \t// ...\n * ];\n *\n * const MyBorderBoxControl = () => {\n * \tconst defaultBorder = {\n * \t\tcolor: '#72aee6',\n * \t\tstyle: 'dashed',\n * \t\twidth: '1px',\n * \t};\n * \tconst [ borders, setBorders ] = useState( {\n * \t\ttop: defaultBorder,\n * \t\tright: defaultBorder,\n * \t\tbottom: defaultBorder,\n * \t\tleft: defaultBorder,\n * \t} );\n * \tconst onChange = ( newBorders ) => setBorders( newBorders );\n *\n * \treturn (\n * \t\t<BorderBoxControl\n * \t\t\tcolors={ colors }\n * \t\t\tlabel={ __( 'Borders' ) }\n * \t\t\tonChange={ onChange }\n * \t\t\tvalue={ borders }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const BorderBoxControl = contextConnect(\n\tUnconnectedBorderBoxControl,\n\t'BorderBoxControl'\n);\n\nexport default BorderBoxControl;\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
@@ -27,13 +26,13 @@ const BorderBoxControlLinkedButton = (props, forwardedRef) => {
27
26
  text: label
28
27
  }, createElement(View, {
29
28
  className: className
30
- }, createElement(Button, _extends({}, buttonProps, {
29
+ }, createElement(Button, { ...buttonProps,
31
30
  isSmall: true,
32
31
  icon: isLinked ? link : linkOff,
33
32
  iconSize: 24,
34
33
  "aria-label": label,
35
34
  ref: forwardedRef
36
- }))));
35
+ })));
37
36
  };
38
37
 
39
38
  const ConnectedBorderBoxControlLinkedButton = contextConnect(BorderBoxControlLinkedButton, 'BorderBoxControlLinkedButton');
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control-linked-button/component.tsx"],"names":["link","linkOff","__","Button","Tooltip","View","contextConnect","useBorderBoxControlLinkedButton","BorderBoxControlLinkedButton","props","forwardedRef","className","isLinked","buttonProps","label","ConnectedBorderBoxControlLinkedButton"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,OAAf,QAA8B,kBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,OAAP,MAAoB,eAApB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;AACA,SAASC,+BAAT,QAAgD,QAAhD;;AAIA,MAAMC,4BAA4B,GAAG,CACpCC,KADoC,EAEpCC,YAFoC,KAGhC;AACJ,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuB,OAAGC;AAA1B,MACLN,+BAA+B,CAAEE,KAAF,CADhC;AAEA,QAAMK,KAAK,GAAGF,QAAQ,GAAGV,EAAE,CAAE,cAAF,CAAL,GAA0BA,EAAE,CAAE,YAAF,CAAlD;AAEA,SACC,cAAC,OAAD;AAAS,IAAA,IAAI,EAAGY;AAAhB,KACC,cAAC,IAAD;AAAM,IAAA,SAAS,EAAGH;AAAlB,KACC,cAAC,MAAD,eACME,WADN;AAEC,IAAA,OAAO,MAFR;AAGC,IAAA,IAAI,EAAGD,QAAQ,GAAGZ,IAAH,GAAUC,OAH1B;AAIC,IAAA,QAAQ,EAAG,EAJZ;AAKC,kBAAaa,KALd;AAMC,IAAA,GAAG,EAAGJ;AANP,KADD,CADD,CADD;AAcA,CAtBD;;AAwBA,MAAMK,qCAAqC,GAAGT,cAAc,CAC3DE,4BAD2D,EAE3D,8BAF2D,CAA5D;AAIA,eAAeO,qCAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { link, linkOff } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport Tooltip from '../../tooltip';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderBoxControlLinkedButton } from './hook';\n\nimport type { LinkedButtonProps } from '../types';\n\nconst BorderBoxControlLinkedButton = (\n\tprops: WordPressComponentProps< LinkedButtonProps, 'button' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst { className, isLinked, ...buttonProps } =\n\t\tuseBorderBoxControlLinkedButton( props );\n\tconst label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );\n\n\treturn (\n\t\t<Tooltip text={ label }>\n\t\t\t<View className={ className }>\n\t\t\t\t<Button\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t\tisSmall\n\t\t\t\t\ticon={ isLinked ? link : linkOff }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</Tooltip>\n\t);\n};\n\nconst ConnectedBorderBoxControlLinkedButton = contextConnect(\n\tBorderBoxControlLinkedButton,\n\t'BorderBoxControlLinkedButton'\n);\nexport default ConnectedBorderBoxControlLinkedButton;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control-linked-button/component.tsx"],"names":["link","linkOff","__","Button","Tooltip","View","contextConnect","useBorderBoxControlLinkedButton","BorderBoxControlLinkedButton","props","forwardedRef","className","isLinked","buttonProps","label","ConnectedBorderBoxControlLinkedButton"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,OAAf,QAA8B,kBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,OAAP,MAAoB,eAApB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;AACA,SAASC,+BAAT,QAAgD,QAAhD;;AAIA,MAAMC,4BAA4B,GAAG,CACpCC,KADoC,EAEpCC,YAFoC,KAGhC;AACJ,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuB,OAAGC;AAA1B,MACLN,+BAA+B,CAAEE,KAAF,CADhC;AAEA,QAAMK,KAAK,GAAGF,QAAQ,GAAGV,EAAE,CAAE,cAAF,CAAL,GAA0BA,EAAE,CAAE,YAAF,CAAlD;AAEA,SACC,cAAC,OAAD;AAAS,IAAA,IAAI,EAAGY;AAAhB,KACC,cAAC,IAAD;AAAM,IAAA,SAAS,EAAGH;AAAlB,KACC,cAAC,MAAD,OACME,WADN;AAEC,IAAA,OAAO,MAFR;AAGC,IAAA,IAAI,EAAGD,QAAQ,GAAGZ,IAAH,GAAUC,OAH1B;AAIC,IAAA,QAAQ,EAAG,EAJZ;AAKC,kBAAaa,KALd;AAMC,IAAA,GAAG,EAAGJ;AANP,IADD,CADD,CADD;AAcA,CAtBD;;AAwBA,MAAMK,qCAAqC,GAAGT,cAAc,CAC3DE,4BAD2D,EAE3D,8BAF2D,CAA5D;AAIA,eAAeO,qCAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { link, linkOff } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport Tooltip from '../../tooltip';\nimport { View } from '../../view';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderBoxControlLinkedButton } from './hook';\n\nimport type { LinkedButtonProps } from '../types';\n\nconst BorderBoxControlLinkedButton = (\n\tprops: WordPressComponentProps< LinkedButtonProps, 'button' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst { className, isLinked, ...buttonProps } =\n\t\tuseBorderBoxControlLinkedButton( props );\n\tconst label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );\n\n\treturn (\n\t\t<Tooltip text={ label }>\n\t\t\t<View className={ className }>\n\t\t\t\t<Button\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t\tisSmall\n\t\t\t\t\ticon={ isLinked ? link : linkOff }\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</Tooltip>\n\t);\n};\n\nconst ConnectedBorderBoxControlLinkedButton = contextConnect(\n\tBorderBoxControlLinkedButton,\n\t'BorderBoxControlLinkedButton'\n);\nexport default ConnectedBorderBoxControlLinkedButton;\n"]}
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { createElement } from "@wordpress/element";
3
2
 
4
3
  /**
@@ -53,40 +52,44 @@ const BorderBoxControlSplitControls = (props, forwardedRef) => {
53
52
  size
54
53
  };
55
54
  const mergedRef = useMergeRefs([setPopoverAnchor, forwardedRef]);
56
- return createElement(Grid, _extends({}, otherProps, {
55
+ return createElement(Grid, { ...otherProps,
57
56
  ref: mergedRef,
58
57
  gap: 4
59
- }), createElement(BorderBoxControlVisualizer, {
58
+ }, createElement(BorderBoxControlVisualizer, {
60
59
  value: value,
61
60
  size: size
62
- }), createElement(BorderControl, _extends({
61
+ }), createElement(BorderControl, {
63
62
  className: centeredClassName,
64
63
  hideLabelFromVision: true,
65
64
  label: __('Top border'),
66
65
  onChange: newBorder => onChange(newBorder, 'top'),
67
66
  __unstablePopoverProps: popoverProps,
68
- value: value?.top
69
- }, sharedBorderControlProps)), createElement(BorderControl, _extends({
67
+ value: value?.top,
68
+ ...sharedBorderControlProps
69
+ }), createElement(BorderControl, {
70
70
  hideLabelFromVision: true,
71
71
  label: __('Left border'),
72
72
  onChange: newBorder => onChange(newBorder, 'left'),
73
73
  __unstablePopoverProps: popoverProps,
74
- value: value?.left
75
- }, sharedBorderControlProps)), createElement(BorderControl, _extends({
74
+ value: value?.left,
75
+ ...sharedBorderControlProps
76
+ }), createElement(BorderControl, {
76
77
  className: rightAlignedClassName,
77
78
  hideLabelFromVision: true,
78
79
  label: __('Right border'),
79
80
  onChange: newBorder => onChange(newBorder, 'right'),
80
81
  __unstablePopoverProps: popoverProps,
81
- value: value?.right
82
- }, sharedBorderControlProps)), createElement(BorderControl, _extends({
82
+ value: value?.right,
83
+ ...sharedBorderControlProps
84
+ }), createElement(BorderControl, {
83
85
  className: centeredClassName,
84
86
  hideLabelFromVision: true,
85
87
  label: __('Bottom border'),
86
88
  onChange: newBorder => onChange(newBorder, 'bottom'),
87
89
  __unstablePopoverProps: popoverProps,
88
- value: value?.bottom
89
- }, sharedBorderControlProps)));
90
+ value: value?.bottom,
91
+ ...sharedBorderControlProps
92
+ }));
90
93
  };
91
94
 
92
95
  const ConnectedBorderBoxControlSplitControls = contextConnect(BorderBoxControlSplitControls, 'BorderBoxControlSplitControls');