@wordpress/components 20.0.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1021) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/CONTRIBUTING.md +5 -56
  3. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +13 -13
  4. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  5. package/build/angle-picker-control/index.js +10 -0
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/autocomplete/get-default-use-items.js +7 -1
  8. package/build/autocomplete/get-default-use-items.js.map +1 -1
  9. package/build/autocomplete/index.js +3 -1
  10. package/build/autocomplete/index.js.map +1 -1
  11. package/build/border-box-control/border-box-control/component.js +5 -1
  12. package/build/border-box-control/border-box-control/component.js.map +1 -1
  13. package/build/border-box-control/border-box-control-split-controls/component.js +5 -1
  14. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  15. package/build/border-control/border-control-dropdown/component.js +2 -1
  16. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  17. package/build/card/styles.js +17 -17
  18. package/build/card/styles.js.map +1 -1
  19. package/build/checkbox-control/index.js +3 -3
  20. package/build/checkbox-control/index.js.map +1 -1
  21. package/build/clipboard-button/index.js +16 -1
  22. package/build/clipboard-button/index.js.map +1 -1
  23. package/build/color-palette/index.js +7 -3
  24. package/build/color-palette/index.js.map +1 -1
  25. package/build/color-picker/input-with-slider.js +2 -1
  26. package/build/color-picker/input-with-slider.js.map +1 -1
  27. package/build/combobox-control/index.js +1 -1
  28. package/build/combobox-control/index.js.map +1 -1
  29. package/build/custom-gradient-picker/index.js +12 -1
  30. package/build/custom-gradient-picker/index.js.map +1 -1
  31. package/build/date-time/date/index.js +26 -7
  32. package/build/date-time/date/index.js.map +1 -1
  33. package/build/date-time/date/styles.js +22 -12
  34. package/build/date-time/date/styles.js.map +1 -1
  35. package/build/date-time/date-time/index.js +1 -3
  36. package/build/date-time/date-time/index.js.map +1 -1
  37. package/build/date-time/date-time/styles.js +19 -5
  38. package/build/date-time/date-time/styles.js.map +1 -1
  39. package/build/date-time/time/styles.js +12 -12
  40. package/build/date-time/time/styles.js.map +1 -1
  41. package/build/date-time/time/timezone.js +1 -1
  42. package/build/date-time/time/timezone.js.map +1 -1
  43. package/build/disabled/index.js +14 -6
  44. package/build/disabled/index.js.map +1 -1
  45. package/build/disabled/styles/disabled-styles.js +8 -18
  46. package/build/disabled/styles/disabled-styles.js.map +1 -1
  47. package/build/drop-zone/index.js +44 -9
  48. package/build/drop-zone/index.js.map +1 -1
  49. package/build/drop-zone/provider.js.map +1 -1
  50. package/build/drop-zone/types.js +6 -0
  51. package/build/drop-zone/types.js.map +1 -0
  52. package/build/dropdown-menu/index.js +1 -3
  53. package/build/dropdown-menu/index.js.map +1 -1
  54. package/build/dropdown-menu/index.native.js +0 -17
  55. package/build/dropdown-menu/index.native.js.map +1 -1
  56. package/build/flex/flex/hook.js +6 -30
  57. package/build/flex/flex/hook.js.map +1 -1
  58. package/build/focal-point-picker/controls.js +14 -9
  59. package/build/focal-point-picker/controls.js.map +1 -1
  60. package/build/focal-point-picker/focal-point.js +4 -6
  61. package/build/focal-point-picker/focal-point.js.map +1 -1
  62. package/build/focal-point-picker/grid.js +6 -35
  63. package/build/focal-point-picker/grid.js.map +1 -1
  64. package/build/focal-point-picker/index.js +225 -328
  65. package/build/focal-point-picker/index.js.map +1 -1
  66. package/build/focal-point-picker/media.js +5 -31
  67. package/build/focal-point-picker/media.js.map +1 -1
  68. package/build/focal-point-picker/styles/focal-point-picker-style.js +74 -45
  69. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  70. package/build/focal-point-picker/styles/focal-point-style.js +12 -12
  71. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  72. package/build/focal-point-picker/types.js +6 -0
  73. package/build/focal-point-picker/types.js.map +1 -0
  74. package/build/focal-point-picker/utils.js +8 -12
  75. package/build/focal-point-picker/utils.js.map +1 -1
  76. package/build/focusable-iframe/index.js +6 -0
  77. package/build/focusable-iframe/index.js.map +1 -1
  78. package/build/font-size-picker/index.js +11 -0
  79. package/build/font-size-picker/index.js.map +1 -1
  80. package/build/font-size-picker/utils.js +1 -1
  81. package/build/font-size-picker/utils.js.map +1 -1
  82. package/build/form-file-upload/index.js +22 -2
  83. package/build/form-file-upload/index.js.map +1 -1
  84. package/build/form-file-upload/types.js +6 -0
  85. package/build/form-file-upload/types.js.map +1 -0
  86. package/build/form-toggle/index.js +1 -3
  87. package/build/form-toggle/index.js.map +1 -1
  88. package/build/form-token-field/index.js +4 -6
  89. package/build/form-token-field/index.js.map +1 -1
  90. package/build/form-token-field/suggestions-list.js +1 -3
  91. package/build/form-token-field/suggestions-list.js.map +1 -1
  92. package/build/gradient-picker/index.js +35 -25
  93. package/build/gradient-picker/index.js.map +1 -1
  94. package/build/guide/index.js +8 -6
  95. package/build/guide/index.js.map +1 -1
  96. package/build/higher-order/with-constrained-tabbing/index.js +1 -1
  97. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  98. package/build/higher-order/with-spoken-messages/index.js +2 -0
  99. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  100. package/build/icon/index.js +1 -2
  101. package/build/icon/index.js.map +1 -1
  102. package/build/input-control/input-base.js +3 -2
  103. package/build/input-control/input-base.js.map +1 -1
  104. package/build/input-control/label.js +2 -2
  105. package/build/input-control/label.js.map +1 -1
  106. package/build/input-control/styles/input-control-styles.js +41 -128
  107. package/build/input-control/styles/input-control-styles.js.map +1 -1
  108. package/build/isolated-event-container/index.js +4 -0
  109. package/build/isolated-event-container/index.js.map +1 -1
  110. package/build/mobile/global-styles-context/utils.native.js +1 -1
  111. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  112. package/build/modal/aria-helper.js +3 -10
  113. package/build/modal/aria-helper.js.map +1 -1
  114. package/build/navigable-container/container.js +5 -1
  115. package/build/navigable-container/container.js.map +1 -1
  116. package/build/navigable-container/menu.js +10 -12
  117. package/build/navigable-container/menu.js.map +1 -1
  118. package/build/navigable-container/tabbable.js +2 -4
  119. package/build/navigable-container/tabbable.js.map +1 -1
  120. package/build/navigation/menu/menu-title-search.js +1 -3
  121. package/build/navigation/menu/menu-title-search.js.map +1 -1
  122. package/build/navigator/navigator-button/hook.js +1 -1
  123. package/build/navigator/navigator-button/hook.js.map +1 -1
  124. package/build/navigator/navigator-screen/component.js +2 -2
  125. package/build/navigator/navigator-screen/component.js.map +1 -1
  126. package/build/number-control/index.js +29 -25
  127. package/build/number-control/index.js.map +1 -1
  128. package/build/number-control/types.js +6 -0
  129. package/build/number-control/types.js.map +1 -0
  130. package/build/palette-edit/index.js +6 -2
  131. package/build/palette-edit/index.js.map +1 -1
  132. package/build/placeholder/index.js +1 -3
  133. package/build/placeholder/index.js.map +1 -1
  134. package/build/popover/index.js +162 -181
  135. package/build/popover/index.js.map +1 -1
  136. package/build/popover/types.js +6 -0
  137. package/build/popover/types.js.map +1 -0
  138. package/build/popover/utils.js +119 -24
  139. package/build/popover/utils.js.map +1 -1
  140. package/build/radio-control/index.js +7 -4
  141. package/build/radio-control/index.js.map +1 -1
  142. package/build/range-control/index.js +4 -1
  143. package/build/range-control/index.js.map +1 -1
  144. package/build/range-control/styles/range-control-styles.js +33 -33
  145. package/build/range-control/styles/range-control-styles.js.map +1 -1
  146. package/build/sandbox/index.js +2 -2
  147. package/build/sandbox/index.js.map +1 -1
  148. package/build/search-control/index.js +38 -10
  149. package/build/search-control/index.js.map +1 -1
  150. package/build/search-control/types.js +6 -0
  151. package/build/search-control/types.js.map +1 -0
  152. package/build/select-control/index.native.js +2 -1
  153. package/build/select-control/index.native.js.map +1 -1
  154. package/build/tab-panel/index.js +48 -9
  155. package/build/tab-panel/index.js.map +1 -1
  156. package/build/tab-panel/types.js +6 -0
  157. package/build/tab-panel/types.js.map +1 -0
  158. package/build/text-control/index.js +2 -0
  159. package/build/text-control/index.js.map +1 -1
  160. package/build/text-highlight/index.js +4 -4
  161. package/build/text-highlight/index.js.map +1 -1
  162. package/build/textarea-control/index.js +3 -3
  163. package/build/textarea-control/index.js.map +1 -1
  164. package/build/toggle-control/index.js +44 -4
  165. package/build/toggle-control/index.js.map +1 -1
  166. package/build/toggle-control/types.js +6 -0
  167. package/build/toggle-control/types.js.map +1 -0
  168. package/build/toggle-group-control/toggle-group-control/component.js +3 -3
  169. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  170. package/build/toggle-group-control/toggle-group-control/styles.js +23 -8
  171. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  172. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  173. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  174. package/build/tooltip/index.js +1 -1
  175. package/build/tooltip/index.js.map +1 -1
  176. package/build/ui/context/context-connect.js +31 -22
  177. package/build/ui/context/context-connect.js.map +1 -1
  178. package/build/ui/context/context-system-provider.js +4 -3
  179. package/build/ui/context/context-system-provider.js.map +1 -1
  180. package/build/unit-control/index.js +1 -1
  181. package/build/unit-control/index.js.map +1 -1
  182. package/build/unit-control/styles/unit-control-styles.js +9 -9
  183. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  184. package/build/utils/colors-values.js +2 -30
  185. package/build/utils/colors-values.js.map +1 -1
  186. package/build/utils/math.js +4 -4
  187. package/build/utils/math.js.map +1 -1
  188. package/build/utils/strings.js +13 -0
  189. package/build/utils/strings.js.map +1 -1
  190. package/build/utils/values.js +62 -6
  191. package/build/utils/values.js.map +1 -1
  192. package/build/view/component.js +6 -7
  193. package/build/view/component.js.map +1 -1
  194. package/build/view/types.js +6 -0
  195. package/build/view/types.js.map +1 -0
  196. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +13 -13
  197. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  198. package/build-module/angle-picker-control/index.js +9 -0
  199. package/build-module/angle-picker-control/index.js.map +1 -1
  200. package/build-module/autocomplete/get-default-use-items.js +6 -1
  201. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  202. package/build-module/autocomplete/index.js +2 -1
  203. package/build-module/autocomplete/index.js.map +1 -1
  204. package/build-module/border-box-control/border-box-control/component.js +5 -1
  205. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  206. package/build-module/border-box-control/border-box-control-split-controls/component.js +5 -1
  207. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  208. package/build-module/border-control/border-control-dropdown/component.js +2 -1
  209. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  210. package/build-module/card/styles.js +17 -17
  211. package/build-module/card/styles.js.map +1 -1
  212. package/build-module/checkbox-control/index.js +3 -3
  213. package/build-module/checkbox-control/index.js.map +1 -1
  214. package/build-module/clipboard-button/index.js +17 -1
  215. package/build-module/clipboard-button/index.js.map +1 -1
  216. package/build-module/color-palette/index.js +6 -3
  217. package/build-module/color-palette/index.js.map +1 -1
  218. package/build-module/color-picker/input-with-slider.js +2 -1
  219. package/build-module/color-picker/input-with-slider.js.map +1 -1
  220. package/build-module/combobox-control/index.js +1 -1
  221. package/build-module/combobox-control/index.js.map +1 -1
  222. package/build-module/custom-gradient-picker/index.js +11 -1
  223. package/build-module/custom-gradient-picker/index.js.map +1 -1
  224. package/build-module/date-time/date/index.js +29 -11
  225. package/build-module/date-time/date/index.js.map +1 -1
  226. package/build-module/date-time/date/styles.js +21 -5
  227. package/build-module/date-time/date/styles.js.map +1 -1
  228. package/build-module/date-time/date-time/index.js +2 -3
  229. package/build-module/date-time/date-time/index.js.map +1 -1
  230. package/build-module/date-time/date-time/styles.js +20 -1
  231. package/build-module/date-time/date-time/styles.js.map +1 -1
  232. package/build-module/date-time/time/styles.js +12 -12
  233. package/build-module/date-time/time/styles.js.map +1 -1
  234. package/build-module/date-time/time/timezone.js +1 -1
  235. package/build-module/date-time/time/timezone.js.map +1 -1
  236. package/build-module/disabled/index.js +16 -8
  237. package/build-module/disabled/index.js.map +1 -1
  238. package/build-module/disabled/styles/disabled-styles.js +6 -12
  239. package/build-module/disabled/styles/disabled-styles.js.map +1 -1
  240. package/build-module/drop-zone/index.js +40 -9
  241. package/build-module/drop-zone/index.js.map +1 -1
  242. package/build-module/drop-zone/provider.js.map +1 -1
  243. package/build-module/drop-zone/types.js +2 -0
  244. package/build-module/drop-zone/types.js.map +1 -0
  245. package/build-module/dropdown-menu/index.js +1 -2
  246. package/build-module/dropdown-menu/index.js.map +1 -1
  247. package/build-module/dropdown-menu/index.native.js +0 -16
  248. package/build-module/dropdown-menu/index.native.js.map +1 -1
  249. package/build-module/flex/flex/hook.js +7 -29
  250. package/build-module/flex/flex/hook.js.map +1 -1
  251. package/build-module/focal-point-picker/controls.js +15 -10
  252. package/build-module/focal-point-picker/controls.js.map +1 -1
  253. package/build-module/focal-point-picker/focal-point.js +4 -6
  254. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  255. package/build-module/focal-point-picker/grid.js +6 -34
  256. package/build-module/focal-point-picker/grid.js.map +1 -1
  257. package/build-module/focal-point-picker/index.js +222 -324
  258. package/build-module/focal-point-picker/index.js.map +1 -1
  259. package/build-module/focal-point-picker/media.js +6 -34
  260. package/build-module/focal-point-picker/media.js.map +1 -1
  261. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +71 -44
  262. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  263. package/build-module/focal-point-picker/styles/focal-point-style.js +12 -12
  264. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  265. package/build-module/focal-point-picker/types.js +2 -0
  266. package/build-module/focal-point-picker/types.js.map +1 -0
  267. package/build-module/focal-point-picker/utils.js +8 -12
  268. package/build-module/focal-point-picker/utils.js.map +1 -1
  269. package/build-module/focusable-iframe/index.js +6 -0
  270. package/build-module/focusable-iframe/index.js.map +1 -1
  271. package/build-module/font-size-picker/index.js +10 -0
  272. package/build-module/font-size-picker/index.js.map +1 -1
  273. package/build-module/font-size-picker/utils.js +1 -1
  274. package/build-module/font-size-picker/utils.js.map +1 -1
  275. package/build-module/form-file-upload/index.js +21 -4
  276. package/build-module/form-file-upload/index.js.map +1 -1
  277. package/build-module/form-file-upload/types.js +2 -0
  278. package/build-module/form-file-upload/types.js.map +1 -0
  279. package/build-module/form-toggle/index.js +1 -3
  280. package/build-module/form-toggle/index.js.map +1 -1
  281. package/build-module/form-token-field/index.js +4 -5
  282. package/build-module/form-token-field/index.js.map +1 -1
  283. package/build-module/form-token-field/suggestions-list.js +1 -2
  284. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  285. package/build-module/gradient-picker/index.js +34 -25
  286. package/build-module/gradient-picker/index.js.map +1 -1
  287. package/build-module/guide/index.js +8 -5
  288. package/build-module/guide/index.js.map +1 -1
  289. package/build-module/higher-order/with-constrained-tabbing/index.js +1 -1
  290. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  291. package/build-module/higher-order/with-spoken-messages/index.js +2 -0
  292. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  293. package/build-module/icon/index.js +1 -2
  294. package/build-module/icon/index.js.map +1 -1
  295. package/build-module/input-control/input-base.js +4 -3
  296. package/build-module/input-control/input-base.js.map +1 -1
  297. package/build-module/input-control/label.js +3 -3
  298. package/build-module/input-control/label.js.map +1 -1
  299. package/build-module/input-control/styles/input-control-styles.js +41 -127
  300. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  301. package/build-module/isolated-event-container/index.js +3 -0
  302. package/build-module/isolated-event-container/index.js.map +1 -1
  303. package/build-module/mobile/global-styles-context/utils.native.js +2 -2
  304. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  305. package/build-module/modal/aria-helper.js +3 -8
  306. package/build-module/modal/aria-helper.js.map +1 -1
  307. package/build-module/navigable-container/container.js +5 -1
  308. package/build-module/navigable-container/container.js.map +1 -1
  309. package/build-module/navigable-container/menu.js +10 -11
  310. package/build-module/navigable-container/menu.js.map +1 -1
  311. package/build-module/navigable-container/tabbable.js +2 -3
  312. package/build-module/navigable-container/tabbable.js.map +1 -1
  313. package/build-module/navigation/menu/menu-title-search.js +1 -2
  314. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  315. package/build-module/navigator/navigator-button/hook.js +1 -1
  316. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  317. package/build-module/navigator/navigator-screen/component.js +2 -2
  318. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  319. package/build-module/number-control/index.js +31 -23
  320. package/build-module/number-control/index.js.map +1 -1
  321. package/build-module/number-control/types.js +2 -0
  322. package/build-module/number-control/types.js.map +1 -0
  323. package/build-module/palette-edit/index.js +6 -2
  324. package/build-module/palette-edit/index.js.map +1 -1
  325. package/build-module/placeholder/index.js +1 -3
  326. package/build-module/placeholder/index.js.map +1 -1
  327. package/build-module/popover/index.js +164 -183
  328. package/build-module/popover/index.js.map +1 -1
  329. package/build-module/popover/types.js +2 -0
  330. package/build-module/popover/types.js.map +1 -0
  331. package/build-module/popover/utils.js +112 -23
  332. package/build-module/popover/utils.js.map +1 -1
  333. package/build-module/radio-control/index.js +7 -5
  334. package/build-module/radio-control/index.js.map +1 -1
  335. package/build-module/range-control/index.js +4 -1
  336. package/build-module/range-control/index.js.map +1 -1
  337. package/build-module/range-control/styles/range-control-styles.js +33 -33
  338. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  339. package/build-module/sandbox/index.js +2 -2
  340. package/build-module/sandbox/index.js.map +1 -1
  341. package/build-module/search-control/index.js +34 -7
  342. package/build-module/search-control/index.js.map +1 -1
  343. package/build-module/search-control/types.js +2 -0
  344. package/build-module/search-control/types.js.map +1 -0
  345. package/build-module/select-control/index.native.js +1 -1
  346. package/build-module/select-control/index.native.js.map +1 -1
  347. package/build-module/tab-panel/index.js +46 -10
  348. package/build-module/tab-panel/index.js.map +1 -1
  349. package/build-module/tab-panel/types.js +2 -0
  350. package/build-module/tab-panel/types.js.map +1 -0
  351. package/build-module/text-control/index.js +2 -0
  352. package/build-module/text-control/index.js.map +1 -1
  353. package/build-module/text-highlight/index.js +2 -5
  354. package/build-module/text-highlight/index.js.map +1 -1
  355. package/build-module/textarea-control/index.js +3 -3
  356. package/build-module/textarea-control/index.js.map +1 -1
  357. package/build-module/toggle-control/index.js +38 -4
  358. package/build-module/toggle-control/index.js.map +1 -1
  359. package/build-module/toggle-control/types.js +2 -0
  360. package/build-module/toggle-control/types.js.map +1 -0
  361. package/build-module/toggle-group-control/toggle-group-control/component.js +4 -3
  362. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  363. package/build-module/toggle-group-control/toggle-group-control/styles.js +20 -6
  364. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  365. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  366. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  367. package/build-module/tooltip/index.js +1 -1
  368. package/build-module/tooltip/index.js.map +1 -1
  369. package/build-module/ui/context/context-connect.js +30 -23
  370. package/build-module/ui/context/context-connect.js.map +1 -1
  371. package/build-module/ui/context/context-system-provider.js +5 -4
  372. package/build-module/ui/context/context-system-provider.js.map +1 -1
  373. package/build-module/unit-control/index.js +1 -1
  374. package/build-module/unit-control/index.js.map +1 -1
  375. package/build-module/unit-control/styles/unit-control-styles.js +9 -9
  376. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  377. package/build-module/utils/colors-values.js +2 -30
  378. package/build-module/utils/colors-values.js.map +1 -1
  379. package/build-module/utils/math.js +4 -4
  380. package/build-module/utils/math.js.map +1 -1
  381. package/build-module/utils/strings.js +11 -0
  382. package/build-module/utils/strings.js.map +1 -1
  383. package/build-module/utils/values.js +48 -6
  384. package/build-module/utils/values.js.map +1 -1
  385. package/build-module/view/component.js +5 -8
  386. package/build-module/view/component.js.map +1 -1
  387. package/build-module/view/types.js +2 -0
  388. package/build-module/view/types.js.map +1 -0
  389. package/build-style/style-rtl.css +4 -49
  390. package/build-style/style.css +4 -49
  391. package/build-types/animation/index.d.ts +2 -0
  392. package/build-types/animation/index.d.ts.map +1 -0
  393. package/build-types/base-field/hook.d.ts +54 -55
  394. package/build-types/base-field/hook.d.ts.map +1 -1
  395. package/build-types/border-box-control/border-box-control/component.d.ts +10 -2
  396. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  397. package/build-types/border-box-control/border-box-control/hook.d.ts +56 -57
  398. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  399. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +2 -1
  400. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  401. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +55 -56
  402. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  403. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +9 -2
  404. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  405. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +56 -57
  406. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  407. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts +2 -1
  408. package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
  409. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +55 -56
  410. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  411. package/build-types/border-box-control/types.d.ts +5 -4
  412. package/build-types/border-box-control/types.d.ts.map +1 -1
  413. package/build-types/border-control/border-control/component.d.ts +14 -2
  414. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  415. package/build-types/border-control/border-control/hook.d.ts +56 -57
  416. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  417. package/build-types/border-control/border-control-dropdown/component.d.ts +10 -2
  418. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  419. package/build-types/border-control/border-control-dropdown/hook.d.ts +56 -57
  420. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  421. package/build-types/border-control/border-control-style-picker/component.d.ts +6 -2
  422. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  423. package/build-types/border-control/border-control-style-picker/hook.d.ts +55 -56
  424. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  425. package/build-types/border-control/stories/index.d.ts +74 -6
  426. package/build-types/border-control/stories/index.d.ts.map +1 -1
  427. package/build-types/border-control/types.d.ts +6 -8
  428. package/build-types/border-control/types.d.ts.map +1 -1
  429. package/build-types/button-group/index.d.ts +1 -3
  430. package/build-types/button-group/index.d.ts.map +1 -1
  431. package/build-types/card/card/component.d.ts +9 -2
  432. package/build-types/card/card/component.d.ts.map +1 -1
  433. package/build-types/card/card/hook.d.ts +55 -56
  434. package/build-types/card/card/hook.d.ts.map +1 -1
  435. package/build-types/card/card-body/component.d.ts +9 -2
  436. package/build-types/card/card-body/component.d.ts.map +1 -1
  437. package/build-types/card/card-body/hook.d.ts +55 -56
  438. package/build-types/card/card-body/hook.d.ts.map +1 -1
  439. package/build-types/card/card-divider/component.d.ts +7 -2
  440. package/build-types/card/card-divider/component.d.ts.map +1 -1
  441. package/build-types/card/card-divider/hook.d.ts +55 -55
  442. package/build-types/card/card-footer/component.d.ts +11 -2
  443. package/build-types/card/card-footer/component.d.ts.map +1 -1
  444. package/build-types/card/card-footer/hook.d.ts +55 -56
  445. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  446. package/build-types/card/card-header/component.d.ts +1 -1
  447. package/build-types/card/card-header/component.d.ts.map +1 -1
  448. package/build-types/card/card-header/hook.d.ts +55 -56
  449. package/build-types/card/card-header/hook.d.ts.map +1 -1
  450. package/build-types/card/card-media/component.d.ts +2 -1
  451. package/build-types/card/card-media/component.d.ts.map +1 -1
  452. package/build-types/card/card-media/hook.d.ts +55 -56
  453. package/build-types/card/card-media/hook.d.ts.map +1 -1
  454. package/build-types/checkbox-control/index.d.ts +1 -1
  455. package/build-types/checkbox-control/index.d.ts.map +1 -1
  456. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  457. package/build-types/checkbox-control/types.d.ts +1 -1
  458. package/build-types/checkbox-control/types.d.ts.map +1 -1
  459. package/build-types/clipboard-button/index.d.ts +16 -0
  460. package/build-types/clipboard-button/index.d.ts.map +1 -0
  461. package/build-types/color-indicator/index.d.ts +1 -3
  462. package/build-types/color-indicator/index.d.ts.map +1 -1
  463. package/build-types/color-palette/index.d.ts.map +1 -1
  464. package/build-types/color-palette/styles.d.ts +1 -3
  465. package/build-types/color-palette/styles.d.ts.map +1 -1
  466. package/build-types/color-picker/component.d.ts +2 -1
  467. package/build-types/color-picker/component.d.ts.map +1 -1
  468. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  469. package/build-types/color-picker/styles.d.ts +12 -25
  470. package/build-types/color-picker/styles.d.ts.map +1 -1
  471. package/build-types/composite/index.d.ts +2 -0
  472. package/build-types/composite/index.d.ts.map +1 -0
  473. package/build-types/confirm-dialog/component.d.ts +4 -8
  474. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  475. package/build-types/date-time/date/index.d.ts +1 -1
  476. package/build-types/date-time/date/index.d.ts.map +1 -1
  477. package/build-types/date-time/date/styles.d.ts +8 -8
  478. package/build-types/date-time/date/styles.d.ts.map +1 -1
  479. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  480. package/build-types/date-time/date-time/styles.d.ts +11 -0
  481. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  482. package/build-types/date-time/time/styles.d.ts +21 -43
  483. package/build-types/date-time/time/styles.d.ts.map +1 -1
  484. package/build-types/disabled/index.d.ts +1 -1
  485. package/build-types/disabled/index.d.ts.map +1 -1
  486. package/build-types/disabled/styles/disabled-styles.d.ts +1 -5
  487. package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
  488. package/build-types/disclosure/index.d.ts +2 -0
  489. package/build-types/disclosure/index.d.ts.map +1 -0
  490. package/build-types/divider/component.d.ts +7 -2
  491. package/build-types/divider/component.d.ts.map +1 -1
  492. package/build-types/drop-zone/index.d.ts +29 -0
  493. package/build-types/drop-zone/index.d.ts.map +1 -0
  494. package/build-types/drop-zone/provider.d.ts +5 -0
  495. package/build-types/drop-zone/provider.d.ts.map +1 -0
  496. package/build-types/drop-zone/stories/index.d.ts +12 -0
  497. package/build-types/drop-zone/stories/index.d.ts.map +1 -0
  498. package/build-types/drop-zone/types.d.ts +29 -0
  499. package/build-types/drop-zone/types.d.ts.map +1 -0
  500. package/build-types/dropdown/dropdown-content-wrapper.d.ts +2 -1
  501. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
  502. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  503. package/build-types/elevation/component.d.ts +2 -1
  504. package/build-types/elevation/component.d.ts.map +1 -1
  505. package/build-types/elevation/hook.d.ts +54 -55
  506. package/build-types/elevation/hook.d.ts.map +1 -1
  507. package/build-types/external-link/index.d.ts +1 -1
  508. package/build-types/external-link/index.d.ts.map +1 -1
  509. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  510. package/build-types/flex/flex/component.d.ts +2 -1
  511. package/build-types/flex/flex/component.d.ts.map +1 -1
  512. package/build-types/flex/flex/hook.d.ts +55 -56
  513. package/build-types/flex/flex/hook.d.ts.map +1 -1
  514. package/build-types/flex/flex-block/component.d.ts +2 -1
  515. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  516. package/build-types/flex/flex-block/hook.d.ts +55 -56
  517. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  518. package/build-types/flex/flex-item/component.d.ts +2 -1
  519. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  520. package/build-types/flex/flex-item/hook.d.ts +55 -56
  521. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  522. package/build-types/focal-point-picker/controls.d.ts +4 -0
  523. package/build-types/focal-point-picker/controls.d.ts.map +1 -0
  524. package/build-types/focal-point-picker/focal-point.d.ts +5 -0
  525. package/build-types/focal-point-picker/focal-point.d.ts.map +1 -0
  526. package/build-types/focal-point-picker/grid.d.ts +5 -0
  527. package/build-types/focal-point-picker/grid.d.ts.map +1 -0
  528. package/build-types/focal-point-picker/index.d.ts +51 -0
  529. package/build-types/focal-point-picker/index.d.ts.map +1 -0
  530. package/build-types/focal-point-picker/media.d.ts +4 -0
  531. package/build-types/focal-point-picker/media.d.ts.map +1 -0
  532. package/build-types/focal-point-picker/stories/index.d.ts +15 -0
  533. package/build-types/focal-point-picker/stories/index.d.ts.map +1 -0
  534. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +56 -0
  535. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -0
  536. package/build-types/focal-point-picker/styles/focal-point-style.d.ts +19 -0
  537. package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -0
  538. package/build-types/focal-point-picker/types.d.ts +79 -0
  539. package/build-types/focal-point-picker/types.d.ts.map +1 -0
  540. package/build-types/focal-point-picker/utils.d.ts +26 -0
  541. package/build-types/focal-point-picker/utils.d.ts.map +1 -0
  542. package/build-types/focusable-iframe/index.d.ts +8 -0
  543. package/build-types/focusable-iframe/index.d.ts.map +1 -0
  544. package/build-types/form-file-upload/index.d.ts +22 -0
  545. package/build-types/form-file-upload/index.d.ts.map +1 -0
  546. package/build-types/form-file-upload/stories/index.d.ts +23 -0
  547. package/build-types/form-file-upload/stories/index.d.ts.map +1 -0
  548. package/build-types/form-file-upload/test/index.d.ts +2 -0
  549. package/build-types/form-file-upload/test/index.d.ts.map +1 -0
  550. package/build-types/form-file-upload/types.d.ts +63 -0
  551. package/build-types/form-file-upload/types.d.ts.map +1 -0
  552. package/build-types/form-toggle/index.d.ts +1 -1
  553. package/build-types/form-toggle/index.d.ts.map +1 -1
  554. package/build-types/form-token-field/index.d.ts.map +1 -1
  555. package/build-types/form-token-field/styles.d.ts +1 -3
  556. package/build-types/form-token-field/styles.d.ts.map +1 -1
  557. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  558. package/build-types/form-token-field/token-input.d.ts +1 -3
  559. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  560. package/build-types/grid/component.d.ts +2 -1
  561. package/build-types/grid/component.d.ts.map +1 -1
  562. package/build-types/grid/hook.d.ts +55 -56
  563. package/build-types/grid/hook.d.ts.map +1 -1
  564. package/build-types/h-stack/component.d.ts +5 -2
  565. package/build-types/h-stack/component.d.ts.map +1 -1
  566. package/build-types/h-stack/hook.d.ts +55 -56
  567. package/build-types/h-stack/hook.d.ts.map +1 -1
  568. package/build-types/heading/component.d.ts +4 -2
  569. package/build-types/heading/component.d.ts.map +1 -1
  570. package/build-types/heading/hook.d.ts +54 -55
  571. package/build-types/heading/hook.d.ts.map +1 -1
  572. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +3 -0
  573. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -0
  574. package/build-types/higher-order/with-spoken-messages/index.d.ts +4 -0
  575. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -0
  576. package/build-types/input-control/index.d.ts +1 -1
  577. package/build-types/input-control/index.d.ts.map +1 -1
  578. package/build-types/input-control/input-base.d.ts.map +1 -1
  579. package/build-types/input-control/input-field.d.ts +1 -3
  580. package/build-types/input-control/input-field.d.ts.map +1 -1
  581. package/build-types/input-control/input-prefix-wrapper.d.ts +2 -1
  582. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  583. package/build-types/input-control/input-suffix-wrapper.d.ts +2 -1
  584. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  585. package/build-types/input-control/label.d.ts.map +1 -1
  586. package/build-types/input-control/stories/index.d.ts +5 -5
  587. package/build-types/input-control/stories/index.d.ts.map +1 -1
  588. package/build-types/input-control/styles/input-control-styles.d.ts +2 -6
  589. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  590. package/build-types/input-control/types.d.ts +3 -0
  591. package/build-types/input-control/types.d.ts.map +1 -1
  592. package/build-types/isolated-event-container/index.d.ts +3 -0
  593. package/build-types/isolated-event-container/index.d.ts.map +1 -0
  594. package/build-types/item-group/item/component.d.ts +2 -1
  595. package/build-types/item-group/item/component.d.ts.map +1 -1
  596. package/build-types/item-group/item/hook.d.ts +54 -55
  597. package/build-types/item-group/item/hook.d.ts.map +1 -1
  598. package/build-types/item-group/item-group/component.d.ts +2 -1
  599. package/build-types/item-group/item-group/component.d.ts.map +1 -1
  600. package/build-types/item-group/item-group/hook.d.ts +54 -55
  601. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  602. package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
  603. package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
  604. package/build-types/modal/aria-helper.d.ts.map +1 -1
  605. package/build-types/navigable-container/menu.d.ts.map +1 -1
  606. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  607. package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
  608. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  609. package/build-types/navigator/navigator-back-button/hook.d.ts +59 -60
  610. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  611. package/build-types/navigator/navigator-button/component.d.ts +7 -2
  612. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  613. package/build-types/navigator/navigator-button/hook.d.ts +59 -60
  614. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  615. package/build-types/navigator/navigator-provider/component.d.ts +2 -1
  616. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  617. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  618. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  619. package/build-types/number-control/index.d.ts +10 -28
  620. package/build-types/number-control/index.d.ts.map +1 -1
  621. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  622. package/build-types/number-control/types.d.ts +72 -0
  623. package/build-types/number-control/types.d.ts.map +1 -0
  624. package/build-types/placeholder/index.d.ts +1 -1
  625. package/build-types/placeholder/index.d.ts.map +1 -1
  626. package/build-types/popover/index.d.ts +28 -25
  627. package/build-types/popover/index.d.ts.map +1 -1
  628. package/build-types/popover/stories/index.d.ts +12 -0
  629. package/build-types/popover/stories/index.d.ts.map +1 -0
  630. package/build-types/popover/types.d.ts +161 -0
  631. package/build-types/popover/types.d.ts.map +1 -0
  632. package/build-types/popover/utils.d.ts +42 -24
  633. package/build-types/popover/utils.d.ts.map +1 -1
  634. package/build-types/radio-context/index.d.ts +6 -0
  635. package/build-types/radio-context/index.d.ts.map +1 -0
  636. package/build-types/radio-control/index.d.ts +1 -1
  637. package/build-types/radio-control/index.d.ts.map +1 -1
  638. package/build-types/range-control/index.d.ts +2 -4
  639. package/build-types/range-control/index.d.ts.map +1 -1
  640. package/build-types/range-control/input-range.d.ts +2 -4
  641. package/build-types/range-control/input-range.d.ts.map +1 -1
  642. package/build-types/range-control/styles/range-control-styles.d.ts +5 -10
  643. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  644. package/build-types/resizable-box/index.d.ts +1 -1
  645. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  646. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  647. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -3
  648. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  649. package/build-types/scrollable/component.d.ts +2 -1
  650. package/build-types/scrollable/component.d.ts.map +1 -1
  651. package/build-types/scrollable/hook.d.ts +55 -56
  652. package/build-types/scrollable/hook.d.ts.map +1 -1
  653. package/build-types/search-control/index.d.ts +29 -0
  654. package/build-types/search-control/index.d.ts.map +1 -0
  655. package/build-types/search-control/stories/index.d.ts +47 -0
  656. package/build-types/search-control/stories/index.d.ts.map +1 -0
  657. package/build-types/search-control/types.d.ts +39 -0
  658. package/build-types/search-control/types.d.ts.map +1 -0
  659. package/build-types/select-control/index.d.ts +1 -3
  660. package/build-types/select-control/index.d.ts.map +1 -1
  661. package/build-types/select-control/stories/index.d.ts +2 -6
  662. package/build-types/select-control/stories/index.d.ts.map +1 -1
  663. package/build-types/select-control/styles/select-control-styles.d.ts +1 -3
  664. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  665. package/build-types/spacer/component.d.ts +2 -1
  666. package/build-types/spacer/component.d.ts.map +1 -1
  667. package/build-types/spacer/hook.d.ts +55 -56
  668. package/build-types/spacer/hook.d.ts.map +1 -1
  669. package/build-types/spinner/index.d.ts +1 -3
  670. package/build-types/spinner/index.d.ts.map +1 -1
  671. package/build-types/surface/component.d.ts +2 -1
  672. package/build-types/surface/component.d.ts.map +1 -1
  673. package/build-types/surface/hook.d.ts +55 -56
  674. package/build-types/surface/hook.d.ts.map +1 -1
  675. package/build-types/tab-panel/index.d.ts +42 -0
  676. package/build-types/tab-panel/index.d.ts.map +1 -0
  677. package/build-types/tab-panel/stories/index.d.ts +12 -0
  678. package/build-types/tab-panel/stories/index.d.ts.map +1 -0
  679. package/build-types/tab-panel/test/index.d.ts +2 -0
  680. package/build-types/tab-panel/test/index.d.ts.map +1 -0
  681. package/build-types/tab-panel/types.d.ts +64 -0
  682. package/build-types/tab-panel/types.d.ts.map +1 -0
  683. package/build-types/text/component.d.ts +1 -1
  684. package/build-types/text/component.d.ts.map +1 -1
  685. package/build-types/text/hook.d.ts +55 -56
  686. package/build-types/text/hook.d.ts.map +1 -1
  687. package/build-types/text-control/index.d.ts +2 -4
  688. package/build-types/text-control/index.d.ts.map +1 -1
  689. package/build-types/text-control/types.d.ts +1 -1
  690. package/build-types/text-control/types.d.ts.map +1 -1
  691. package/build-types/text-highlight/index.d.ts +0 -3
  692. package/build-types/text-highlight/index.d.ts.map +1 -1
  693. package/build-types/textarea-control/index.d.ts +1 -1
  694. package/build-types/textarea-control/index.d.ts.map +1 -1
  695. package/build-types/textarea-control/types.d.ts +1 -1
  696. package/build-types/textarea-control/types.d.ts.map +1 -1
  697. package/build-types/toggle-control/index.d.ts +26 -0
  698. package/build-types/toggle-control/index.d.ts.map +1 -0
  699. package/build-types/toggle-control/stories/index.d.ts +13 -0
  700. package/build-types/toggle-control/stories/index.d.ts.map +1 -0
  701. package/build-types/toggle-control/test/index.d.ts +2 -0
  702. package/build-types/toggle-control/test/index.d.ts.map +1 -0
  703. package/build-types/toggle-control/types.d.ts +20 -0
  704. package/build-types/toggle-control/types.d.ts.map +1 -0
  705. package/build-types/toggle-group-control/stories/index.d.ts +4 -2
  706. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
  707. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +12 -2
  708. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  709. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +4 -0
  710. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  711. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -4
  712. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  713. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +2 -1
  714. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  715. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +3 -5
  716. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  717. package/build-types/toggle-group-control/types.d.ts +2 -2
  718. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  719. package/build-types/tools-panel/tools-panel/component.d.ts +2 -1
  720. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  721. package/build-types/tools-panel/tools-panel/hook.d.ts +55 -56
  722. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  723. package/build-types/tools-panel/tools-panel-header/component.d.ts +2 -1
  724. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  725. package/build-types/tools-panel/tools-panel-header/hook.d.ts +55 -56
  726. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  727. package/build-types/tools-panel/tools-panel-item/component.d.ts +6 -2
  728. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  729. package/build-types/tools-panel/tools-panel-item/hook.d.ts +55 -56
  730. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  731. package/build-types/truncate/component.d.ts +2 -1
  732. package/build-types/truncate/component.d.ts.map +1 -1
  733. package/build-types/truncate/hook.d.ts +55 -56
  734. package/build-types/truncate/hook.d.ts.map +1 -1
  735. package/build-types/ui/context/context-connect.d.ts +10 -9
  736. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  737. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  738. package/build-types/ui/context/test/context-connect.d.ts +2 -0
  739. package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
  740. package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
  741. package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
  742. package/build-types/ui/context/wordpress-component.d.ts +8 -9
  743. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  744. package/build-types/ui/control-group/component.d.ts +4 -1
  745. package/build-types/ui/control-group/component.d.ts.map +1 -1
  746. package/build-types/ui/control-group/hook.d.ts +55 -56
  747. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  748. package/build-types/ui/control-label/component.d.ts +4 -1
  749. package/build-types/ui/control-label/component.d.ts.map +1 -1
  750. package/build-types/ui/control-label/hook.d.ts +55 -56
  751. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  752. package/build-types/ui/form-group/form-group.d.ts +4 -8
  753. package/build-types/ui/form-group/form-group.d.ts.map +1 -1
  754. package/build-types/ui/form-group/use-form-group.d.ts +112 -114
  755. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  756. package/build-types/ui/shortcut/component.d.ts +2 -1
  757. package/build-types/ui/shortcut/component.d.ts.map +1 -1
  758. package/build-types/ui/spinner/component.d.ts +1 -1
  759. package/build-types/ui/tooltip/component.d.ts +11 -1
  760. package/build-types/ui/tooltip/component.d.ts.map +1 -1
  761. package/build-types/ui/tooltip/content.d.ts +7 -1
  762. package/build-types/ui/tooltip/styles.d.ts +1 -3
  763. package/build-types/ui/tooltip/styles.d.ts.map +1 -1
  764. package/build-types/unit-control/index.d.ts +2 -12
  765. package/build-types/unit-control/index.d.ts.map +1 -1
  766. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  767. package/build-types/unit-control/styles/unit-control-styles.d.ts +5 -10
  768. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  769. package/build-types/unit-control/types.d.ts +3 -35
  770. package/build-types/unit-control/types.d.ts.map +1 -1
  771. package/build-types/utils/colors-values.d.ts +0 -18
  772. package/build-types/utils/colors-values.d.ts.map +1 -1
  773. package/build-types/utils/math.d.ts +6 -6
  774. package/build-types/utils/math.d.ts.map +1 -1
  775. package/build-types/utils/strings.d.ts +8 -0
  776. package/build-types/utils/strings.d.ts.map +1 -1
  777. package/build-types/utils/values.d.ts +10 -8
  778. package/build-types/utils/values.d.ts.map +1 -1
  779. package/build-types/v-stack/component.d.ts +8 -2
  780. package/build-types/v-stack/component.d.ts.map +1 -1
  781. package/build-types/v-stack/hook.d.ts +55 -56
  782. package/build-types/v-stack/hook.d.ts.map +1 -1
  783. package/build-types/v-stack/stories/index.d.ts +8 -1
  784. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  785. package/build-types/view/component.d.ts +8 -6
  786. package/build-types/view/component.d.ts.map +1 -1
  787. package/build-types/view/stories/index.d.ts +12 -0
  788. package/build-types/view/stories/index.d.ts.map +1 -0
  789. package/build-types/view/types.d.ts +8 -0
  790. package/build-types/view/types.d.ts.map +1 -0
  791. package/build-types/visually-hidden/component.d.ts +2 -1
  792. package/build-types/visually-hidden/component.d.ts.map +1 -1
  793. package/build-types/z-stack/component.d.ts +2 -1
  794. package/build-types/z-stack/component.d.ts.map +1 -1
  795. package/package.json +17 -17
  796. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +2 -1
  797. package/src/angle-picker-control/README.md +9 -1
  798. package/src/angle-picker-control/index.js +12 -0
  799. package/src/angle-picker-control/stories/index.js +3 -3
  800. package/src/autocomplete/get-default-use-items.js +6 -1
  801. package/src/autocomplete/index.js +2 -1
  802. package/src/base-field/test/__snapshots__/index.js.snap +3 -5
  803. package/src/border-box-control/border-box-control/component.tsx +9 -2
  804. package/src/border-box-control/border-box-control-split-controls/component.tsx +8 -2
  805. package/src/border-box-control/types.ts +5 -4
  806. package/src/border-control/border-control-dropdown/component.tsx +3 -8
  807. package/src/border-control/types.ts +7 -9
  808. package/src/card/styles.ts +1 -1
  809. package/src/card/test/__snapshots__/index.tsx.snap +39 -51
  810. package/src/checkbox-control/index.tsx +3 -6
  811. package/src/checkbox-control/stories/index.tsx +6 -2
  812. package/src/checkbox-control/types.ts +4 -1
  813. package/src/clipboard-button/index.js +13 -0
  814. package/src/color-palette/index.js +9 -6
  815. package/src/color-palette/style.scss +0 -14
  816. package/src/color-palette/test/__snapshots__/index.js.snap +78 -95
  817. package/src/color-picker/input-with-slider.tsx +1 -0
  818. package/src/combobox-control/index.js +1 -1
  819. package/src/combobox-control/test/index.js +311 -0
  820. package/src/custom-gradient-picker/index.js +13 -1
  821. package/src/custom-gradient-picker/stories/index.js +3 -0
  822. package/src/date-time/date/index.tsx +28 -8
  823. package/src/date-time/date/styles.ts +6 -0
  824. package/src/date-time/date/test/index.tsx +6 -2
  825. package/src/date-time/date-time/index.tsx +3 -4
  826. package/src/date-time/date-time/styles.ts +9 -0
  827. package/src/date-time/time/styles.ts +1 -0
  828. package/src/date-time/time/timezone.tsx +1 -1
  829. package/src/dimension-control/test/__snapshots__/index.test.js.snap +1122 -164
  830. package/src/dimension-control/test/index.test.js +29 -38
  831. package/src/disabled/index.tsx +27 -9
  832. package/src/disabled/styles/disabled-styles.tsx +2 -2
  833. package/src/disabled/test/index.tsx +38 -0
  834. package/src/drop-zone/README.md +3 -3
  835. package/src/drop-zone/{index.js → index.tsx} +48 -13
  836. package/src/drop-zone/{provider.js → provider.ts} +5 -1
  837. package/src/drop-zone/stories/index.tsx +30 -0
  838. package/src/drop-zone/types.ts +29 -0
  839. package/src/dropdown/README.md +6 -4
  840. package/src/dropdown/stories/index.js +1 -1
  841. package/src/dropdown-menu/index.js +1 -2
  842. package/src/dropdown-menu/index.native.js +0 -13
  843. package/src/dropdown-menu/test/index.js +54 -58
  844. package/src/flex/flex/hook.ts +5 -54
  845. package/src/flex/test/__snapshots__/index.tsx.snap +7 -15
  846. package/src/focal-point-picker/README.md +5 -8
  847. package/src/focal-point-picker/controls.tsx +94 -0
  848. package/src/focal-point-picker/{focal-point.js → focal-point.tsx} +6 -6
  849. package/src/focal-point-picker/grid.tsx +31 -0
  850. package/src/focal-point-picker/index.tsx +286 -0
  851. package/src/focal-point-picker/{media.js → media.tsx} +10 -28
  852. package/src/focal-point-picker/stories/index.tsx +93 -0
  853. package/src/focal-point-picker/styles/{focal-point-picker-style.js → focal-point-picker-style.ts} +35 -12
  854. package/src/focal-point-picker/styles/{focal-point-style.js → focal-point-style.ts} +2 -1
  855. package/src/focal-point-picker/test/index.js +28 -8
  856. package/src/focal-point-picker/types.ts +93 -0
  857. package/src/focal-point-picker/{utils.js → utils.ts} +11 -15
  858. package/src/focusable-iframe/index.js +5 -0
  859. package/src/font-size-picker/README.md +9 -0
  860. package/src/font-size-picker/index.js +9 -0
  861. package/src/font-size-picker/stories/index.js +3 -5
  862. package/src/font-size-picker/test/index.js +15 -2
  863. package/src/font-size-picker/test/utils.js +1 -2
  864. package/src/font-size-picker/utils.js +1 -1
  865. package/src/form-file-upload/README.md +6 -1
  866. package/src/form-file-upload/{index.js → index.tsx} +22 -4
  867. package/src/form-file-upload/stories/index.tsx +74 -0
  868. package/src/form-file-upload/test/{index.js → index.tsx} +7 -3
  869. package/src/form-file-upload/types.ts +63 -0
  870. package/src/form-toggle/index.tsx +1 -6
  871. package/src/form-token-field/index.tsx +4 -5
  872. package/src/form-token-field/suggestions-list.tsx +1 -2
  873. package/src/gradient-picker/README.md +9 -0
  874. package/src/gradient-picker/index.js +50 -47
  875. package/src/gradient-picker/stories/index.js +11 -0
  876. package/src/guide/index.js +6 -3
  877. package/src/guide/test/index.js +138 -1
  878. package/src/h-stack/test/__snapshots__/index.tsx.snap +3 -12
  879. package/src/higher-order/with-constrained-tabbing/index.js +1 -1
  880. package/src/higher-order/with-filters/test/__snapshots__/index.js.snap +87 -0
  881. package/src/higher-order/with-filters/test/index.js +20 -74
  882. package/src/higher-order/with-spoken-messages/index.js +2 -0
  883. package/src/icon/index.tsx +1 -1
  884. package/src/icon/stories/index.js +18 -0
  885. package/src/icon/test/index.js +32 -83
  886. package/src/input-control/input-base.tsx +9 -11
  887. package/src/input-control/label.tsx +9 -4
  888. package/src/input-control/styles/input-control-styles.tsx +0 -43
  889. package/src/input-control/types.ts +3 -0
  890. package/src/isolated-event-container/index.js +3 -0
  891. package/src/isolated-event-container/test/index.js +53 -11
  892. package/src/item-group/test/__snapshots__/index.js.snap +16 -16
  893. package/src/keyboard-shortcuts/test/index.js +16 -31
  894. package/src/menu-item/test/__snapshots__/index.js.snap +60 -62
  895. package/src/menu-item/test/index.js +30 -22
  896. package/src/mobile/global-styles-context/utils.native.js +7 -2
  897. package/src/modal/aria-helper.js +3 -8
  898. package/src/navigable-container/README.md +2 -0
  899. package/src/navigable-container/container.js +8 -1
  900. package/src/navigable-container/menu.js +14 -11
  901. package/src/navigable-container/stories/navigable-menu.js +49 -0
  902. package/src/navigable-container/stories/tabbable-container.js +40 -0
  903. package/src/navigable-container/tabbable.js +2 -3
  904. package/src/navigable-container/test/navigable-menu.js +277 -0
  905. package/src/navigable-container/test/tababble-container.js +175 -0
  906. package/src/navigation/menu/menu-title-search.js +1 -2
  907. package/src/navigator/navigator-button/hook.ts +1 -1
  908. package/src/navigator/navigator-screen/component.tsx +6 -1
  909. package/src/number-control/index.tsx +209 -0
  910. package/src/number-control/stories/index.js +6 -18
  911. package/src/number-control/types.ts +75 -0
  912. package/src/palette-edit/index.js +14 -10
  913. package/src/palette-edit/style.scss +3 -11
  914. package/src/panel/test/__snapshots__/header.js.snap +9 -0
  915. package/src/panel/test/__snapshots__/index.js.snap +17 -0
  916. package/src/panel/test/__snapshots__/row.js.snap +17 -0
  917. package/src/panel/test/header.js +30 -23
  918. package/src/panel/test/index.js +33 -25
  919. package/src/panel/test/row.js +18 -11
  920. package/src/placeholder/index.tsx +4 -5
  921. package/src/placeholder/style.scss +5 -4
  922. package/src/popover/README.md +83 -48
  923. package/src/popover/{index.js → index.tsx} +254 -202
  924. package/src/popover/stories/{index.js → index.tsx} +51 -55
  925. package/src/popover/types.ts +173 -0
  926. package/src/popover/utils.ts +230 -0
  927. package/src/radio-control/index.tsx +28 -29
  928. package/src/radio-control/style.scss +0 -17
  929. package/src/range-control/index.tsx +4 -1
  930. package/src/range-control/styles/range-control-styles.ts +8 -8
  931. package/src/sandbox/index.js +2 -2
  932. package/src/search-control/README.md +5 -3
  933. package/src/search-control/{index.js → index.tsx} +35 -7
  934. package/src/search-control/stories/index.tsx +66 -0
  935. package/src/search-control/types.ts +43 -0
  936. package/src/select-control/index.native.js +1 -1
  937. package/src/slot-fill/test/index.js +69 -12
  938. package/src/style.scss +0 -1
  939. package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
  940. package/src/tab-panel/README.md +1 -2
  941. package/src/tab-panel/{index.js → index.tsx} +58 -13
  942. package/src/tab-panel/stories/index.tsx +37 -0
  943. package/src/tab-panel/test/index.tsx +120 -0
  944. package/src/tab-panel/types.ts +65 -0
  945. package/src/text-control/index.tsx +2 -0
  946. package/src/text-control/types.ts +5 -1
  947. package/src/text-highlight/index.tsx +1 -5
  948. package/src/textarea-control/index.tsx +3 -6
  949. package/src/textarea-control/types.ts +1 -1
  950. package/src/toggle-control/index.tsx +97 -0
  951. package/src/toggle-control/stories/index.tsx +58 -0
  952. package/src/toggle-control/test/index.tsx +53 -0
  953. package/src/toggle-control/types.ts +28 -0
  954. package/src/toggle-group-control/stories/index.tsx +10 -3
  955. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +62 -44
  956. package/src/toggle-group-control/toggle-group-control/component.tsx +6 -5
  957. package/src/toggle-group-control/toggle-group-control/styles.ts +5 -0
  958. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  959. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
  960. package/src/toggle-group-control/types.ts +2 -2
  961. package/src/tooltip/index.js +1 -1
  962. package/src/ui/context/context-connect.ts +58 -31
  963. package/src/ui/context/context-system-provider.js +5 -4
  964. package/src/ui/context/test/context-connect.tsx +55 -0
  965. package/src/ui/context/test/wordpress-component.tsx +36 -0
  966. package/src/ui/context/wordpress-component.ts +18 -12
  967. package/src/ui/control-group/test/__snapshots__/index.js.snap +1 -4
  968. package/src/unit-control/index.tsx +1 -1
  969. package/src/unit-control/stories/index.tsx +7 -16
  970. package/src/unit-control/styles/unit-control-styles.ts +2 -2
  971. package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -6
  972. package/src/unit-control/types.ts +3 -44
  973. package/src/utils/colors-values.js +2 -24
  974. package/src/utils/math.js +4 -4
  975. package/src/utils/strings.ts +11 -0
  976. package/src/utils/values.js +48 -6
  977. package/src/v-stack/test/__snapshots__/index.tsx.snap +3 -12
  978. package/src/view/{component.js → component.tsx} +13 -4
  979. package/src/view/stories/index.tsx +32 -0
  980. package/src/view/types.ts +6 -0
  981. package/tsconfig.json +39 -76
  982. package/tsconfig.tsbuildinfo +1 -1
  983. package/build/ui/__storybook-utils/example-grid.js +0 -88
  984. package/build/ui/__storybook-utils/example-grid.js.map +0 -1
  985. package/build/ui/__storybook-utils/index.js +0 -19
  986. package/build/ui/__storybook-utils/index.js.map +0 -1
  987. package/build/ui/__storybook-utils/page.js +0 -43
  988. package/build/ui/__storybook-utils/page.js.map +0 -1
  989. package/build/utils/keyboard.js +0 -41
  990. package/build/utils/keyboard.js.map +0 -1
  991. package/build-module/ui/__storybook-utils/example-grid.js +0 -69
  992. package/build-module/ui/__storybook-utils/example-grid.js.map +0 -1
  993. package/build-module/ui/__storybook-utils/index.js +0 -2
  994. package/build-module/ui/__storybook-utils/index.js.map +0 -1
  995. package/build-module/ui/__storybook-utils/page.js +0 -32
  996. package/build-module/ui/__storybook-utils/page.js.map +0 -1
  997. package/build-module/utils/keyboard.js +0 -33
  998. package/build-module/utils/keyboard.js.map +0 -1
  999. package/build-types/utils/keyboard.d.ts +0 -12
  1000. package/build-types/utils/keyboard.d.ts.map +0 -1
  1001. package/src/focal-point-picker/controls.js +0 -66
  1002. package/src/focal-point-picker/grid.js +0 -62
  1003. package/src/focal-point-picker/index.js +0 -344
  1004. package/src/focal-point-picker/stories/index.js +0 -76
  1005. package/src/guide/test/page-control.js +0 -40
  1006. package/src/navigable-container/test/menu.js +0 -310
  1007. package/src/navigable-container/test/tabbable.js +0 -158
  1008. package/src/number-control/index.js +0 -192
  1009. package/src/popover/utils.js +0 -107
  1010. package/src/search-control/stories/index.js +0 -39
  1011. package/src/tab-panel/stories/index.js +0 -39
  1012. package/src/tab-panel/test/index.js +0 -179
  1013. package/src/toggle-control/index.js +0 -55
  1014. package/src/toggle-control/stories/index.js +0 -64
  1015. package/src/toggle-control/style.scss +0 -14
  1016. package/src/toggle-control/test/index.js +0 -52
  1017. package/src/ui/__storybook-utils/example-grid.js +0 -61
  1018. package/src/ui/__storybook-utils/index.js +0 -1
  1019. package/src/ui/__storybook-utils/page.js +0 -29
  1020. package/src/utils/keyboard.js +0 -28
  1021. package/src/utils/test/keyboard.js +0 -34
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/autocomplete/get-default-use-items.js"],"names":["debounce","escapeRegExp","removeAccents","useLayoutEffect","useState","filterOptions","search","options","maxResults","filtered","i","length","option","keywords","label","isMatch","some","keyword","test","push","getDefaultUseItems","autocompleter","filterValue","items","setItems","isDebounced","loadOptions","promise","Promise","resolve","then","optionsData","canceled","keyedOptions","map","optionData","optionIndex","key","name","value","getOptionLabel","getOptionKeywords","isDisabled","isOptionDisabled","RegExp","cancel"],"mappings":"AAAA;AACA;A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AL,EAAe;AACdA,UAAAA,OAAO,CAACK,QAAR,GAAmB,IAAnB;AACA;AACD,OALD;AAMA,KArDc,EAqDZ,CAAEV,WAAF,CArDY,CAAf;AAuDA,WAAO,CAAEC,KAAF,CAAP;AACA,GArED;AAsEA","sourcesContent":["/**\n * External dependencies\n */\nimport { debounce, escapeRegExp } from 'lodash';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useState } from '@wordpress/element';\n\nfunction filterOptions( search, options = [], maxResults = 10 ) {\n\tconst filtered = [];\n\tfor ( let i = 0; i < options.length; i++ ) {\n\t\tconst option = options[ i ];\n\n\t\t// Merge label into keywords.\n\t\tlet { keywords = [] } = option;\n\t\tif ( 'string' === typeof option.label ) {\n\t\t\tkeywords = [ ...keywords, option.label ];\n\t\t}\n\n\t\tconst isMatch = keywords.some( ( keyword ) =>\n\t\t\tsearch.test( removeAccents( keyword ) )\n\t\t);\n\t\tif ( ! isMatch ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfiltered.push( option );\n\n\t\t// Abort early if max reached.\n\t\tif ( filtered.length === maxResults ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn filtered;\n}\n\nexport default function getDefaultUseItems( autocompleter ) {\n\treturn ( filterValue ) => {\n\t\tconst [ items, setItems ] = useState( [] );\n\t\t/*\n\t\t * We support both synchronous and asynchronous retrieval of completer options\n\t\t * but internally treat all as async so we maintain a single, consistent code path.\n\t\t *\n\t\t * Because networks can be slow, and the internet is wonderfully unpredictable,\n\t\t * we don't want two promises updating the state at once. This ensures that only\n\t\t * the most recent promise will act on `optionsData`. This doesn't use the state\n\t\t * because `setState` is batched, and so there's no guarantee that setting\n\t\t * `activePromise` in the state would result in it actually being in `this.state`\n\t\t * before the promise resolves and we check to see if this is the active promise or not.\n\t\t */\n\t\tuseLayoutEffect( () => {\n\t\t\tconst { options, isDebounced } = autocompleter;\n\t\t\tconst loadOptions = debounce(\n\t\t\t\t() => {\n\t\t\t\t\tconst promise = Promise.resolve(\n\t\t\t\t\t\ttypeof options === 'function'\n\t\t\t\t\t\t\t? options( filterValue )\n\t\t\t\t\t\t\t: options\n\t\t\t\t\t).then( ( optionsData ) => {\n\t\t\t\t\t\tif ( promise.canceled ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst keyedOptions = optionsData.map(\n\t\t\t\t\t\t\t( optionData, optionIndex ) => ( {\n\t\t\t\t\t\t\t\tkey: `${ autocompleter.name }-${ optionIndex }`,\n\t\t\t\t\t\t\t\tvalue: optionData,\n\t\t\t\t\t\t\t\tlabel: autocompleter.getOptionLabel(\n\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tkeywords: autocompleter.getOptionKeywords\n\t\t\t\t\t\t\t\t\t? autocompleter.getOptionKeywords(\n\t\t\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: [],\n\t\t\t\t\t\t\t\tisDisabled: autocompleter.isOptionDisabled\n\t\t\t\t\t\t\t\t\t? autocompleter.isOptionDisabled(\n\t\t\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Create a regular expression to filter the options.\n\t\t\t\t\t\tconst search = new RegExp(\n\t\t\t\t\t\t\t'(?:\\\\b|\\\\s|^)' + escapeRegExp( filterValue ),\n\t\t\t\t\t\t\t'i'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetItems( filterOptions( search, keyedOptions ) );\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn promise;\n\t\t\t\t},\n\t\t\t\tisDebounced ? 250 : 0\n\t\t\t);\n\n\t\t\tconst promise = loadOptions();\n\n\t\t\treturn () => {\n\t\t\t\tloadOptions.cancel();\n\t\t\t\tif ( promise ) {\n\t\t\t\t\tpromise.canceled = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}, [ filterValue ] );\n\n\t\treturn [ items ];\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/autocomplete/get-default-use-items.js"],"names":["debounce","removeAccents","useLayoutEffect","useState","escapeRegExp","filterOptions","search","options","maxResults","filtered","i","length","option","keywords","label","isMatch","some","keyword","test","push","getDefaultUseItems","autocompleter","filterValue","items","setItems","isDebounced","loadOptions","promise","Promise","resolve","then","optionsData","canceled","keyedOptions","map","optionData","optionIndex","key","name","value","getOptionLabel","getOptionKeywords","isDisabled","isOptionDisabled","RegExp","cancel"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AACA,OAAOC,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,kBAA7B;;AAEA,SAASC,aAAT,CAAwBC,MAAxB,EAAgE;AAAA,MAAhCC,OAAgC,uEAAtB,EAAsB;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAC/D,QAAMC,QAAQ,GAAG,EAAjB;;AACA,OAAM,IAAIC,CAAC,GAAG,CAAd,EAAiBA,CAAC,GAAGH,OAAO,CAACI,MAA7B,EAAqCD,CAAC,EAAtC,EAA2C;AAC1C,UAAME,MAAM,GAAGL,OAAO,CAAEG,CAAF,CAAtB,CAD0C,CAG1C;;AACA,QAAI;AAAEG,MAAAA,QAAQ,GAAG;AAAb,QAAoBD,MAAxB;;AACA,QAAK,aAAa,OAAOA,MAAM,CAACE,KAAhC,EAAwC;AACvCD,MAAAA,QAAQ,GAAG,CAAE,GAAGA,QAAL,EAAeD,MAAM,CAACE,KAAtB,CAAX;AACA;;AAED,UAAMC,OAAO,GAAGF,QAAQ,CAACG,IAAT,CAAiBC,OAAF,IAC9BX,MAAM,CAACY,IAAP,CAAajB,aAAa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ACsB,gBAAd,CACAR,UADA,CADS,GAIT;AAf6B,WAAjC,CADoB,CAArB,CAJ0B,CAwB1B;;AACA,gBAAM7B,MAAM,GAAG,IAAIsC,MAAJ,CACd,kBAAkBxC,YAAY,CAAEkB,WAAF,CADhB,EAEd,GAFc,CAAf;AAIAE,UAAAA,QAAQ,CAAEnB,aAAa,CAAEC,MAAF,EAAU2B,YAAV,CAAf,CAAR;AACA,SAlCe,CAAhB;AAoCA,eAAON,OAAP;AACA,OAvC0B,EAwC3BF,WAAW,GAAG,GAAH,GAAS,CAxCO,CAA5B;AA2CA,YAAME,OAAO,GAAGD,WAAW,EAA3B;AAEA,aAAO,MAAM;AACZA,QAAAA,WAAW,CAACmB,MAAZ;;AACA,YAAKlB,OAAL,EAAe;AACdA,UAAAA,OAAO,CAACK,QAAR,GAAmB,IAAnB;AACA;AACD,OALD;AAMA,KArDc,EAqDZ,CAAEV,WAAF,CArDY,CAAf;AAuDA,WAAO,CAAEC,KAAF,CAAP;AACA,GArED;AAsEA","sourcesContent":["/**\n * External dependencies\n */\nimport { debounce } from 'lodash';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { escapeRegExp } from '../utils/strings';\n\nfunction filterOptions( search, options = [], maxResults = 10 ) {\n\tconst filtered = [];\n\tfor ( let i = 0; i < options.length; i++ ) {\n\t\tconst option = options[ i ];\n\n\t\t// Merge label into keywords.\n\t\tlet { keywords = [] } = option;\n\t\tif ( 'string' === typeof option.label ) {\n\t\t\tkeywords = [ ...keywords, option.label ];\n\t\t}\n\n\t\tconst isMatch = keywords.some( ( keyword ) =>\n\t\t\tsearch.test( removeAccents( keyword ) )\n\t\t);\n\t\tif ( ! isMatch ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfiltered.push( option );\n\n\t\t// Abort early if max reached.\n\t\tif ( filtered.length === maxResults ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn filtered;\n}\n\nexport default function getDefaultUseItems( autocompleter ) {\n\treturn ( filterValue ) => {\n\t\tconst [ items, setItems ] = useState( [] );\n\t\t/*\n\t\t * We support both synchronous and asynchronous retrieval of completer options\n\t\t * but internally treat all as async so we maintain a single, consistent code path.\n\t\t *\n\t\t * Because networks can be slow, and the internet is wonderfully unpredictable,\n\t\t * we don't want two promises updating the state at once. This ensures that only\n\t\t * the most recent promise will act on `optionsData`. This doesn't use the state\n\t\t * because `setState` is batched, and so there's no guarantee that setting\n\t\t * `activePromise` in the state would result in it actually being in `this.state`\n\t\t * before the promise resolves and we check to see if this is the active promise or not.\n\t\t */\n\t\tuseLayoutEffect( () => {\n\t\t\tconst { options, isDebounced } = autocompleter;\n\t\t\tconst loadOptions = debounce(\n\t\t\t\t() => {\n\t\t\t\t\tconst promise = Promise.resolve(\n\t\t\t\t\t\ttypeof options === 'function'\n\t\t\t\t\t\t\t? options( filterValue )\n\t\t\t\t\t\t\t: options\n\t\t\t\t\t).then( ( optionsData ) => {\n\t\t\t\t\t\tif ( promise.canceled ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst keyedOptions = optionsData.map(\n\t\t\t\t\t\t\t( optionData, optionIndex ) => ( {\n\t\t\t\t\t\t\t\tkey: `${ autocompleter.name }-${ optionIndex }`,\n\t\t\t\t\t\t\t\tvalue: optionData,\n\t\t\t\t\t\t\t\tlabel: autocompleter.getOptionLabel(\n\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tkeywords: autocompleter.getOptionKeywords\n\t\t\t\t\t\t\t\t\t? autocompleter.getOptionKeywords(\n\t\t\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: [],\n\t\t\t\t\t\t\t\tisDisabled: autocompleter.isOptionDisabled\n\t\t\t\t\t\t\t\t\t? autocompleter.isOptionDisabled(\n\t\t\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Create a regular expression to filter the options.\n\t\t\t\t\t\tconst search = new RegExp(\n\t\t\t\t\t\t\t'(?:\\\\b|\\\\s|^)' + escapeRegExp( filterValue ),\n\t\t\t\t\t\t\t'i'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetItems( filterOptions( search, keyedOptions ) );\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn promise;\n\t\t\t\t},\n\t\t\t\tisDebounced ? 250 : 0\n\t\t\t);\n\n\t\t\tconst promise = loadOptions();\n\n\t\t\treturn () => {\n\t\t\t\tloadOptions.cancel();\n\t\t\t\tif ( promise ) {\n\t\t\t\t\tpromise.canceled = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}, [ filterValue ] );\n\n\t\treturn [ items ];\n\t};\n}\n"]}
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "@wordpress/element";
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { escapeRegExp, find } from 'lodash';
6
+ import { find } from 'lodash';
7
7
  import removeAccents from 'remove-accents';
8
8
  /**
9
9
  * WordPress dependencies
@@ -19,6 +19,7 @@ import { speak } from '@wordpress/a11y';
19
19
  */
20
20
 
21
21
  import { getAutoCompleterUI } from './autocompleter-ui';
22
+ import { escapeRegExp } from '../utils/strings';
22
23
  /**
23
24
  * A raw completer option.
24
25
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/autocomplete/index.js"],"names":["escapeRegExp","find","removeAccents","renderToString","useEffect","useState","useRef","useMemo","__","_n","sprintf","useInstanceId","useDebounce","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","getAutoCompleterUI","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","action","undefined","reset","announce","options","onChangeOptions","handleKeyDown","event","current","code","defaultPrevented","preventDefault","textContent","text","textAfterSelection","completer","allowContext","index","lastIndexOf","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","test","safeTrigger","match","RegExp","query","key","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","useAutocompleteProps","ref","onKeyDownRef","element","_onKeyDown","addEventListener","removeEventListener","children","Autocomplete","isSelected","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,EAAuBC,IAAvB,QAAmC,QAAnC;AACA,OAAOC,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;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;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A,QAAM;AAAEwF,IAAAA,OAAF;AAAWJ,IAAAA,SAAX;AAAsBC,IAAAA,QAAtB;AAAgCE,IAAAA;AAAhC,MAA8CvE,eAAe,CAAE,EACpE,GAAGqC,OADiE;AAEpEhC,IAAAA,UAAU,EAAEqE;AAFwD,GAAF,CAAnE;AAIAC,EAAAA,YAAY,CAAClC,OAAb,GAAuB8B,SAAvB;AACA,SAAO;AACNG,IAAAA,GAAG,EAAEnF,YAAY,CAAE,CAClBmF,GADkB,EAElBlF,YAAY,CAAIoF,OAAF,IAAe;AAC5B,eAASC,UAAT,CAAqBrC,KAArB,EAA6B;AAC5BmC,QAAAA,YAAY,CAAClC,OAAb,CAAsBD,KAAtB;AACA;;AACDoC,MAAAA,OAAO,CAACE,gBAAR,CAA0B,SAA1B,EAAqCD,UAArC;AACA,aAAO,MAAM;AACZD,QAAAA,OAAO,CAACG,mBAAR,CAA6B,SAA7B,EAAwCF,UAAxC;AACA,OAFD;AAGA,KARW,EAQT,EARS,CAFM,CAAF,CADX;AAaNG,IAAAA,QAAQ,EAAER,OAbJ;AAcN,yBAAqBJ,SAAS,GAAG,MAAH,GAAYlC,SAdpC;AAeN,iBAAakC,SAfP;AAgBN,6BAAyBC;AAhBnB,GAAP;AAkBA;AAED,eAAe,SAASY,YAAT,QAA8D;AAAA,MAAvC;AAAED,IAAAA,QAAF;AAAYE,IAAAA,UAAZ;AAAwB,OAAG7C;AAA3B,GAAuC;AAC5E,QAAM;AAAEmC,IAAAA,OAAF;AAAW,OAAGW;AAAd,MAAwBnF,eAAe,CAAEqC,OAAF,CAA7C;AACA,SACC,8BACG2C,QAAQ,CAAEG,KAAF,CADX,EAEGD,UAAU,IAAIV,OAFjB,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport { escapeRegExp, find } from 'lodash';\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';\n\n/**\n * A raw completer option.\n *\n * @typedef {*} CompleterOption\n */\n\n/**\n * @callback FnGetOptions\n *\n * @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.\n */\n\n/**\n * @callback FnGetOptionKeywords\n * @param {CompleterOption} option a completer option.\n *\n * @return {string[]} list of key words to search.\n */\n\n/**\n * @callback FnIsOptionDisabled\n * @param {CompleterOption} option a completer option.\n *\n * @return {string[]} whether or not the given option is disabled.\n */\n\n/**\n * @callback FnGetOptionLabel\n * @param {CompleterOption} option a completer option.\n *\n * @return {(string|Array.<(string|WPElement)>)} list of react components to render.\n */\n\n/**\n * @callback FnAllowContext\n * @param {string} before the string before the auto complete trigger and query.\n * @param {string} after the string after the autocomplete trigger and query.\n *\n * @return {boolean} true if the completer can handle.\n */\n\n/**\n * @typedef {Object} OptionCompletion\n * @property {'insert-at-caret'|'replace'} action the intended placement of the completion.\n * @property {OptionCompletionValue} value the completion value.\n */\n\n/**\n * A completion value.\n *\n * @typedef {(string|WPElement|Object)} OptionCompletionValue\n */\n\n/**\n * @callback FnGetOptionCompletion\n * @param {CompleterOption} value the value of the completer option.\n * @param {string} query the text value of the autocomplete query.\n *\n * @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an\n * \t\t\t\t\t\t\t\t\t\t\t\t\t OptionCompletionValue is returned, the\n * \t\t\t\t\t\t\t\t\t\t\t\t\t completion action defaults to `insert-at-caret`.\n */\n\n/**\n * @typedef {Object} WPCompleter\n * @property {string} name a way to identify a completer, useful for selective overriding.\n * @property {?string} className A class to apply to the popup menu.\n * @property {string} triggerPrefix the prefix that will display the menu.\n * @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.\n * @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.\n * @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.\n * @property {FnGetOptionLabel} getOptionLabel get the label for a given option.\n * @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.\n * @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.\n */\n\nfunction useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst instanceId = useInstanceId( useAutocomplete );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\tconst [ filteredOptions, setFilteredOptions ] = useState( [] );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState( null );\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState( null );\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement ) {\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 ) {\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 { action, value } =\n\t\t\t\tundefined === completion.action ||\n\t\t\t\tundefined === completion.value\n\t\t\t\t\t? { action: 'insert-at-caret', value: completion }\n\t\t\t\t\t: completion;\n\n\t\t\tif ( 'replace' === action ) {\n\t\t\t\tonReplace( [ 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' === action ) {\n\t\t\t\tinsertCompletion( 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( [] );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\tfunction announce( options ) {\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 ) {\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 ) {\n\t\tbackspacing.current = event.code === '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\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\t\tswitch ( event.code ) {\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}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\treset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst text = removeAccents( textContent );\n\t\tconst textAfterSelection = getTextContent(\n\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t);\n\t\tconst completer = find(\n\t\t\tcompleters,\n\t\t\t( { triggerPrefix, allowContext } ) => {\n\t\t\t\tconst index = text.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 = text.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\tif (\n\t\t\t\t\tallowContext &&\n\t\t\t\t\t! allowContext( text.slice( 0, index ), textAfterSelection )\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\treset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\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 );\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: null;\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\nexport function useAutocompleteProps( options ) {\n\tconst ref = useRef();\n\tconst onKeyDownRef = useRef();\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\treturn {\n\t\tref: useMergeRefs( [\n\t\t\tref,\n\t\t\tuseRefEffect( ( element ) => {\n\t\t\t\tfunction _onKeyDown( event ) {\n\t\t\t\t\tonKeyDownRef.current( event );\n\t\t\t\t}\n\t\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\t\treturn () => {\n\t\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t\t};\n\t\t\t}, [] ),\n\t\t] ),\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( { children, isSelected, ...options } ) {\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.js"],"names":["find","removeAccents","renderToString","useEffect","useState","useRef","useMemo","__","_n","sprintf","useInstanceId","useDebounce","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","getAutoCompleterUI","escapeRegExp","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","action","undefined","reset","announce","options","onChangeOptions","handleKeyDown","event","current","code","defaultPrevented","preventDefault","textContent","text","textAfterSelection","completer","allowContext","index","lastIndexOf","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","test","safeTrigger","match","RegExp","query","key","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","useAutocompleteProps","ref","onKeyDownRef","element","_onKeyDown","addEventListener","removeEventListener","children","Autocomplete","isSelected","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AACA,OAAOC,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;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA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B;AACA,QAAM4F,YAAY,GAAG5F,MAAM,EAA3B;AACA,QAAM;AAAEyF,IAAAA,OAAF;AAAWJ,IAAAA,SAAX;AAAsBC,IAAAA,QAAtB;AAAgCE,IAAAA;AAAhC,MAA8CvE,eAAe,CAAE,EACpE,GAAGqC,OADiE;AAEpEhC,IAAAA,UAAU,EAAEqE;AAFwD,GAAF,CAAnE;AAIAC,EAAAA,YAAY,CAAClC,OAAb,GAAuB8B,SAAvB;AACA,SAAO;AACNG,IAAAA,GAAG,EAAEpF,YAAY,CAAE,CAClBoF,GADkB,EAElBnF,YAAY,CAAIqF,OAAF,IAAe;AAC5B,eAASC,UAAT,CAAqBrC,KAArB,EAA6B;AAC5BmC,QAAAA,YAAY,CAAClC,OAAb,CAAsBD,KAAtB;AACA;;AACDoC,MAAAA,OAAO,CAACE,gBAAR,CAA0B,SAA1B,EAAqCD,UAArC;AACA,aAAO,MAAM;AACZD,QAAAA,OAAO,CAACG,mBAAR,CAA6B,SAA7B,EAAwCF,UAAxC;AACA,OAFD;AAGA,KARW,EAQT,EARS,CAFM,CAAF,CADX;AAaNG,IAAAA,QAAQ,EAAER,OAbJ;AAcN,yBAAqBJ,SAAS,GAAG,MAAH,GAAYlC,SAdpC;AAeN,iBAAakC,SAfP;AAgBN,6BAAyBC;AAhBnB,GAAP;AAkBA;AAED,eAAe,SAASY,YAAT,QAA8D;AAAA,MAAvC;AAAED,IAAAA,QAAF;AAAYE,IAAAA,UAAZ;AAAwB,OAAG7C;AAA3B,GAAuC;AAC5E,QAAM;AAAEmC,IAAAA,OAAF;AAAW,OAAGW;AAAd,MAAwBnF,eAAe,CAAEqC,OAAF,CAA7C;AACA,SACC,8BACG2C,QAAQ,CAAEG,KAAF,CADX,EAEGD,UAAU,IAAIV,OAFjB,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\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';\n\n/**\n * A raw completer option.\n *\n * @typedef {*} CompleterOption\n */\n\n/**\n * @callback FnGetOptions\n *\n * @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.\n */\n\n/**\n * @callback FnGetOptionKeywords\n * @param {CompleterOption} option a completer option.\n *\n * @return {string[]} list of key words to search.\n */\n\n/**\n * @callback FnIsOptionDisabled\n * @param {CompleterOption} option a completer option.\n *\n * @return {string[]} whether or not the given option is disabled.\n */\n\n/**\n * @callback FnGetOptionLabel\n * @param {CompleterOption} option a completer option.\n *\n * @return {(string|Array.<(string|WPElement)>)} list of react components to render.\n */\n\n/**\n * @callback FnAllowContext\n * @param {string} before the string before the auto complete trigger and query.\n * @param {string} after the string after the autocomplete trigger and query.\n *\n * @return {boolean} true if the completer can handle.\n */\n\n/**\n * @typedef {Object} OptionCompletion\n * @property {'insert-at-caret'|'replace'} action the intended placement of the completion.\n * @property {OptionCompletionValue} value the completion value.\n */\n\n/**\n * A completion value.\n *\n * @typedef {(string|WPElement|Object)} OptionCompletionValue\n */\n\n/**\n * @callback FnGetOptionCompletion\n * @param {CompleterOption} value the value of the completer option.\n * @param {string} query the text value of the autocomplete query.\n *\n * @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an\n * \t\t\t\t\t\t\t\t\t\t\t\t\t OptionCompletionValue is returned, the\n * \t\t\t\t\t\t\t\t\t\t\t\t\t completion action defaults to `insert-at-caret`.\n */\n\n/**\n * @typedef {Object} WPCompleter\n * @property {string} name a way to identify a completer, useful for selective overriding.\n * @property {?string} className A class to apply to the popup menu.\n * @property {string} triggerPrefix the prefix that will display the menu.\n * @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.\n * @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.\n * @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.\n * @property {FnGetOptionLabel} getOptionLabel get the label for a given option.\n * @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.\n * @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.\n */\n\nfunction useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst instanceId = useInstanceId( useAutocomplete );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\tconst [ filteredOptions, setFilteredOptions ] = useState( [] );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState( null );\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState( null );\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement ) {\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 ) {\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 { action, value } =\n\t\t\t\tundefined === completion.action ||\n\t\t\t\tundefined === completion.value\n\t\t\t\t\t? { action: 'insert-at-caret', value: completion }\n\t\t\t\t\t: completion;\n\n\t\t\tif ( 'replace' === action ) {\n\t\t\t\tonReplace( [ 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' === action ) {\n\t\t\t\tinsertCompletion( 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( [] );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\tfunction announce( options ) {\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 ) {\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 ) {\n\t\tbackspacing.current = event.code === '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\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\t\tswitch ( event.code ) {\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}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\treset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst text = removeAccents( textContent );\n\t\tconst textAfterSelection = getTextContent(\n\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t);\n\t\tconst completer = find(\n\t\t\tcompleters,\n\t\t\t( { triggerPrefix, allowContext } ) => {\n\t\t\t\tconst index = text.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 = text.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\tif (\n\t\t\t\t\tallowContext &&\n\t\t\t\t\t! allowContext( text.slice( 0, index ), textAfterSelection )\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\treset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\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 );\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: null;\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\nexport function useAutocompleteProps( options ) {\n\tconst ref = useRef();\n\tconst onKeyDownRef = useRef();\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\treturn {\n\t\tref: useMergeRefs( [\n\t\t\tref,\n\t\t\tuseRefEffect( ( element ) => {\n\t\t\t\tfunction _onKeyDown( event ) {\n\t\t\t\t\tonKeyDownRef.current( event );\n\t\t\t\t}\n\t\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\t\treturn () => {\n\t\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t\t};\n\t\t\t}, [] ),\n\t\t] ),\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( { children, isSelected, ...options } ) {\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,6 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { createElement } from "@wordpress/element";
3
3
 
4
+ /**
5
+ * External dependencies
6
+ */
7
+
4
8
  /**
5
9
  * WordPress dependencies
6
10
  */
@@ -66,7 +70,7 @@ const BorderBoxControl = (props, forwardedRef) => {
66
70
  placement: popoverPlacement,
67
71
  offset: popoverOffset,
68
72
  anchorRef: containerRef,
69
- __unstableShift: true
73
+ shift: true
70
74
  } : undefined;
71
75
  return createElement(View, _extends({
72
76
  className: className
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control/component.tsx"],"names":["__","useRef","useMergeRefs","BorderBoxControlLinkedButton","BorderBoxControlSplitControls","BorderControl","HStack","StyledLabel","View","VisuallyHidden","contextConnect","useBorderBoxControl","BorderLabel","props","label","hideLabelFromVision","BorderBoxControl","forwardedRef","className","colors","disableCustomColors","enableAlpha","enableStyle","hasMixedBorders","isLinked","linkedControlClassName","linkedValue","onLinkedChange","onSplitChange","popoverPlacement","popoverOffset","splitValue","toggleLinked","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","__next36pxDefaultSize","otherProps","containerRef","mergedRef","popoverProps","placement","offset","anchorRef","__unstableShift","undefined","ConnectedBorderBoxControl"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,oBAAvB;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,MAAT,QAAuB,eAAvB;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;;AAKA,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,mBAA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MU,yBAAyB,GAAGnC,cAAc,CAC/CM,gBAD+C,EAE/C,kBAF+C,CAAhD;AAKA,eAAe6B,yBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef } 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 { HStack } from '../../h-stack';\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 { LabelProps } 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 BorderBoxControl = (\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tclassName,\n\t\tcolors,\n\t\tdisableCustomColors,\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\tsplitValue,\n\t\ttoggleLinked,\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next36pxDefaultSize = false,\n\t\t...otherProps\n\t} = useBorderBoxControl( props );\n\tconst containerRef = useRef();\n\tconst mergedRef = useMergeRefs( [ containerRef, forwardedRef ] );\n\tconst popoverProps = popoverPlacement\n\t\t? {\n\t\t\t\tplacement: popoverPlacement,\n\t\t\t\toffset: popoverOffset,\n\t\t\t\tanchorRef: containerRef,\n\t\t\t\t__unstableShift: true,\n\t\t }\n\t\t: undefined;\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<HStack alignment={ 'start' } expanded={ true } spacing={ 0 }>\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\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={ '110px' }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\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\t__next36pxDefaultSize={ __next36pxDefaultSize }\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__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\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\t__next36pxDefaultSize={ __next36pxDefaultSize }\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\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</View>\n\t);\n};\n\nconst ConnectedBorderBoxControl = contextConnect(\n\tBorderBoxControl,\n\t'BorderBoxControl'\n);\n\nexport default ConnectedBorderBoxControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control/component.tsx"],"names":["__","useRef","useMergeRefs","BorderBoxControlLinkedButton","BorderBoxControlSplitControls","BorderControl","HStack","StyledLabel","View","VisuallyHidden","contextConnect","useBorderBoxControl","BorderLabel","props","label","hideLabelFromVision","BorderBoxControl","forwardedRef","className","colors","disableCustomColors","enableAlpha","enableStyle","hasMixedBorders","isLinked","linkedControlClassName","linkedValue","onLinkedChange","onSplitChange","popoverPlacement","popoverOffset","splitValue","toggleLinked","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","__next36pxDefaultSize","otherProps","containerRef","mergedRef","popoverProps","placement","offset","anchorRef","shift","undefined","ConnectedBorderBoxControl"],"mappings":";;;AAAA;AACA;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AiC,EAChCC,iCAnBF;AAqBC,IAAA,qBAAqB,EAAGC;AArBzB,IADS,GAyBT,cAAC,6BAAD;AACC,IAAA,MAAM,EAAGhB,MADV;AAEC,IAAA,mBAAmB,EAAGC,mBAFvB;AAGC,IAAA,WAAW,EAAGC,WAHf;AAIC,IAAA,WAAW,EAAGC,WAJf;AAKC,IAAA,QAAQ,EAAGM,aALZ;AAMC,IAAA,gBAAgB,EAAGC,gBANpB;AAOC,IAAA,aAAa,EAAGC,aAPjB;AAQC,IAAA,KAAK,EAAGC,UART;AASC,IAAA,gCAAgC,EAC/BE,gCAVF;AAYC,IAAA,iCAAiC,EAChCC,iCAbF;AAeC,IAAA,qBAAqB,EAAGC;AAfzB,IA1BF,EA4CC,cAAC,4BAAD;AACC,IAAA,OAAO,EAAGH,YADX;AAEC,IAAA,QAAQ,EAAGR,QAFZ;AAGC,IAAA,qBAAqB,EAAGW;AAHzB,IA5CD,CALD,CADD;AA0DA,CAlGD;;AAoGA,MAAMU,yBAAyB,GAAGnC,cAAc,CAC/CM,gBAD+C,EAE/C,kBAF+C,CAAhD;AAKA,eAAe6B,yBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef } 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 { HStack } from '../../h-stack';\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 { LabelProps } 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 BorderBoxControl = (\n\tprops: WordPressComponentProps< BorderBoxControlProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tclassName,\n\t\tcolors,\n\t\tdisableCustomColors,\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\tsplitValue,\n\t\ttoggleLinked,\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next36pxDefaultSize = false,\n\t\t...otherProps\n\t} = useBorderBoxControl( props );\n\tconst containerRef = useRef();\n\tconst mergedRef = useMergeRefs( [ containerRef, forwardedRef ] );\n\tconst popoverProps: ComponentProps<\n\t\ttypeof BorderControl\n\t>[ '__unstablePopoverProps' ] = popoverPlacement\n\t\t? {\n\t\t\t\tplacement: popoverPlacement,\n\t\t\t\toffset: popoverOffset,\n\t\t\t\tanchorRef: containerRef,\n\t\t\t\tshift: true,\n\t\t }\n\t\t: undefined;\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<HStack alignment={ 'start' } expanded={ true } spacing={ 0 }>\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\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={ '110px' }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\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\t__next36pxDefaultSize={ __next36pxDefaultSize }\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__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\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\t__next36pxDefaultSize={ __next36pxDefaultSize }\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\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</View>\n\t);\n};\n\nconst ConnectedBorderBoxControl = contextConnect(\n\tBorderBoxControl,\n\t'BorderBoxControl'\n);\n\nexport default ConnectedBorderBoxControl;\n"]}
@@ -1,6 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { createElement } from "@wordpress/element";
3
3
 
4
+ /**
5
+ * External dependencies
6
+ */
7
+
4
8
  /**
5
9
  * WordPress dependencies
6
10
  */
@@ -40,7 +44,7 @@ const BorderBoxControlSplitControls = (props, forwardedRef) => {
40
44
  placement: popoverPlacement,
41
45
  offset: popoverOffset,
42
46
  anchorRef: containerRef,
43
- __unstableShift: true
47
+ shift: true
44
48
  } : undefined;
45
49
  const sharedBorderControlProps = {
46
50
  colors,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control-split-controls/component.tsx"],"names":["__","useRef","useMergeRefs","BorderBoxControlVisualizer","BorderControl","Grid","contextConnect","useBorderBoxControlSplitControls","BorderBoxControlSplitControls","props","forwardedRef","centeredClassName","colors","disableCustomColors","enableAlpha","enableStyle","onChange","popoverPlacement","popoverOffset","rightAlignedClassName","value","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","__next36pxDefaultSize","otherProps","containerRef","mergedRef","popoverProps","placement","offset","anchorRef","__unstableShift","undefined","sharedBorderControlProps","isCompact","newBorder","top","left","right","bottom","ConnectedBorderBoxControlSplitControls"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,IAAT,QAAqB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AMC,IAAA,KAAK,EAAGP,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEmB;AANhB,KAOMN,wBAPN,EA/BD,CADD;AA2CA,CArFD;;AAuFA,MAAMO,sCAAsC,GAAGlC,cAAc,CAC5DE,6BAD4D,EAE5D,+BAF4D,CAA7D;AAIA,eAAegC,sCAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BorderBoxControlVisualizer from '../border-box-control-visualizer';\nimport { BorderControl } from '../../border-control';\nimport { Grid } from '../../grid';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderBoxControlSplitControls } from './hook';\n\nimport type { SplitControlsProps } from '../types';\n\nconst BorderBoxControlSplitControls = (\n\tprops: WordPressComponentProps< SplitControlsProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tcenteredClassName,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tonChange,\n\t\tpopoverPlacement,\n\t\tpopoverOffset,\n\t\trightAlignedClassName,\n\t\tvalue,\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next36pxDefaultSize,\n\t\t...otherProps\n\t} = useBorderBoxControlSplitControls( props );\n\tconst containerRef = useRef();\n\tconst mergedRef = useMergeRefs( [ containerRef, forwardedRef ] );\n\tconst popoverProps = popoverPlacement\n\t\t? {\n\t\t\t\tplacement: popoverPlacement,\n\t\t\t\toffset: popoverOffset,\n\t\t\t\tanchorRef: containerRef,\n\t\t\t\t__unstableShift: true,\n\t\t }\n\t\t: undefined;\n\n\tconst sharedBorderControlProps = {\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tisCompact: true,\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next36pxDefaultSize,\n\t};\n\n\treturn (\n\t\t<Grid { ...otherProps } ref={ mergedRef } gap={ 4 }>\n\t\t\t<BorderBoxControlVisualizer\n\t\t\t\tvalue={ value }\n\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\tclassName={ centeredClassName }\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Top border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'top' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.top }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Left border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'left' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.left }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\tclassName={ rightAlignedClassName }\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Right border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'right' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.right }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\tclassName={ centeredClassName }\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Bottom border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'bottom' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.bottom }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t</Grid>\n\t);\n};\n\nconst ConnectedBorderBoxControlSplitControls = contextConnect(\n\tBorderBoxControlSplitControls,\n\t'BorderBoxControlSplitControls'\n);\nexport default ConnectedBorderBoxControlSplitControls;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/border-box-control/border-box-control-split-controls/component.tsx"],"names":["__","useRef","useMergeRefs","BorderBoxControlVisualizer","BorderControl","Grid","contextConnect","useBorderBoxControlSplitControls","BorderBoxControlSplitControls","props","forwardedRef","centeredClassName","colors","disableCustomColors","enableAlpha","enableStyle","onChange","popoverPlacement","popoverOffset","rightAlignedClassName","value","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","__next36pxDefaultSize","otherProps","containerRef","mergedRef","popoverProps","placement","offset","anchorRef","shift","undefined","sharedBorderControlProps","isCompact","newBorder","top","left","right","bottom","ConnectedBorderBoxControlSplitControls"],"mappings":";;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,0BAAP,MAAuC,kCAAvC;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,cAAT,QAAwD,kBAAxD;AACA,SAASC,gCAAT,QAAiD,QAAjD;;AAIA,MAAMC,6BAA6B,GAAG,CACrCC,KADqC,EAErCC,YAFqC,KAGjC;AACJ,QAAM;AACLC,IAAAA,iBADK;AAELC,IAAAA,MAFK;AAGLC,IAAAA,mBAHK;AAILC,IAAAA,WAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA,QANK;AAOLC,IAAAA,gBAPK;AAQLC,IAAAA,aARK;AASLC,IAAAA,qBATK;AAULC,IAAAA,KAVK;AAWLC,IAAAA,gCAXK;AAYLC,IAAAA,iCAZK;AAaLC,IAAAA,qBAbK;AAcL,OAAGC;AAdE,MAeFjB,gCAAgC,CAAEE,KAAF,CAfpC;AAgBA,QAAMgB,Y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,EAAa,MAAb,CAHrC;AAIC,IAAA,sBAAsB,EAAGR,YAJ1B;AAKC,IAAA,KAAK,EAAGP,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEiB;AALhB,KAMMJ,wBANN,EAdD,EAsBC,cAAC,aAAD;AACC,IAAA,SAAS,EAAGd,qBADb;AAEC,IAAA,mBAAmB,EAAG,IAFvB;AAGC,IAAA,KAAK,EAAGnB,EAAE,CAAE,cAAF,CAHX;AAIC,IAAA,QAAQ,EAAKmC,SAAF,IAAiBnB,QAAQ,CAAEmB,SAAF,EAAa,OAAb,CAJrC;AAKC,IAAA,sBAAsB,EAAGR,YAL1B;AAMC,IAAA,KAAK,EAAGP,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEkB;AANhB,KAOML,wBAPN,EAtBD,EA+BC,cAAC,aAAD;AACC,IAAA,SAAS,EAAGtB,iBADb;AAEC,IAAA,mBAAmB,EAAG,IAFvB;AAGC,IAAA,KAAK,EAAGX,EAAE,CAAE,eAAF,CAHX;AAIC,IAAA,QAAQ,EAAKmC,SAAF,IAAiBnB,QAAQ,CAAEmB,SAAF,EAAa,QAAb,CAJrC;AAKC,IAAA,sBAAsB,EAAGR,YAL1B;AAMC,IAAA,KAAK,EAAGP,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEmB;AANhB,KAOMN,wBAPN,EA/BD,CADD;AA2CA,CAvFD;;AAyFA,MAAMO,sCAAsC,GAAGlC,cAAc,CAC5DE,6BAD4D,EAE5D,+BAF4D,CAA7D;AAIA,eAAegC,sCAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentProps } from 'react';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BorderBoxControlVisualizer from '../border-box-control-visualizer';\nimport { BorderControl } from '../../border-control';\nimport { Grid } from '../../grid';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderBoxControlSplitControls } from './hook';\n\nimport type { SplitControlsProps } from '../types';\n\nconst BorderBoxControlSplitControls = (\n\tprops: WordPressComponentProps< SplitControlsProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\tcenteredClassName,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tonChange,\n\t\tpopoverPlacement,\n\t\tpopoverOffset,\n\t\trightAlignedClassName,\n\t\tvalue,\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next36pxDefaultSize,\n\t\t...otherProps\n\t} = useBorderBoxControlSplitControls( props );\n\tconst containerRef = useRef();\n\tconst mergedRef = useMergeRefs( [ containerRef, forwardedRef ] );\n\tconst popoverProps: ComponentProps<\n\t\ttypeof BorderControl\n\t>[ '__unstablePopoverProps' ] = popoverPlacement\n\t\t? {\n\t\t\t\tplacement: popoverPlacement,\n\t\t\t\toffset: popoverOffset,\n\t\t\t\tanchorRef: containerRef,\n\t\t\t\tshift: true,\n\t\t }\n\t\t: undefined;\n\n\tconst sharedBorderControlProps = {\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tenableStyle,\n\t\tisCompact: true,\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\t__next36pxDefaultSize,\n\t};\n\n\treturn (\n\t\t<Grid { ...otherProps } ref={ mergedRef } gap={ 4 }>\n\t\t\t<BorderBoxControlVisualizer\n\t\t\t\tvalue={ value }\n\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\tclassName={ centeredClassName }\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Top border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'top' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.top }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Left border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'left' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.left }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\tclassName={ rightAlignedClassName }\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Right border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'right' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.right }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t\t<BorderControl\n\t\t\t\tclassName={ centeredClassName }\n\t\t\t\thideLabelFromVision={ true }\n\t\t\t\tlabel={ __( 'Bottom border' ) }\n\t\t\t\tonChange={ ( newBorder ) => onChange( newBorder, 'bottom' ) }\n\t\t\t\t__unstablePopoverProps={ popoverProps }\n\t\t\t\tvalue={ value?.bottom }\n\t\t\t\t{ ...sharedBorderControlProps }\n\t\t\t/>\n\t\t</Grid>\n\t);\n};\n\nconst ConnectedBorderBoxControlSplitControls = contextConnect(\n\tBorderBoxControlSplitControls,\n\t'BorderBoxControlSplitControls'\n);\nexport default ConnectedBorderBoxControlSplitControls;\n"]}
@@ -126,7 +126,8 @@ const BorderControlDropdown = (props, forwardedRef) => {
126
126
  className: indicatorClassName,
127
127
  colorValue: color
128
128
  })));
129
- };
129
+ }; // TODO: update types once Dropdown component is refactored to TypeScript.
130
+
130
131
 
131
132
  const renderContent = _ref2 => {
132
133
  let {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/border-control/border-control-dropdown/component.tsx"],"names":["__","sprintf","closeSmall","BorderControlStylePicker","Button","ColorIndicator","ColorPalette","Dropdown","HStack","VStack","contextConnect","useBorderControlDropdown","StyledLabel","DropdownContentWrapper","noop","undefined","getColorObject","colorValue","colors","hasMultipleColorOrigins","matchedColor","some","origin","color","find","getToggleAriaLabel","colorObject","style","isStyleEnabled","name","BorderControlDropdown","props","forwardedRef","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","border","disableCustomColors","enableAlpha","indicatorClassName","indicatorWrapperClassName","onReset","onColorChange","onStyleChange","popoverContentClassName","popoverControlsClassName","resetButtonClassName","showDropdownHeader","enableStyle","__unstablePopoverProps","otherProps","toggleAriaLabel","showResetButton","dropdownPosition","renderToggle","onToggle","renderContent","onClose","ConnectedBorderControlDropdown"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,cAAP,MAA2B,uBAA3B;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,QAAP,MAAqB,gBAArB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,cAAT,QAAwD,kBAAxD;AACA,SAASC,wBAAT,QAAyC,QAAzC;AACA,SAASC,WAAT,QAA4B,+CAA5B;AACA,OAAOC,sBAAP,MAAmC,yCAAnC;;AAUA,MAAMC,IAAI,GAAG,MAAMC,SAAnB;;AACA,MAAMC,cAAc,GAAG,CACtBC,UADsB,EAEtBC,MAFsB,EAGtBC,uBAHsB,KAIlB;AACJ,MAAK,CAAEF,UAAF,IAAgB,CAAEC,MAAvB,EAAgC;AAC/B;AACA;;AAED,MAAKC,uBAAL,EAA+B;AAC9B,QAAIC,YAAJ;AAEEF,IAAAA,MAAF,CAA4BG,IAA5B,CAAoCC,MAAF,IACjCA,MAAM,C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AA,OAAO;AACP;AANF,OAQGxD,EAAE,CAAE,kBAAF,CARL,CADD,CAtCF,CADqB;AAAA,GAAtB;;AAuDA,SACC,cAAC,QAAD;AACC,IAAA,YAAY,EAAGqD,YADhB;AAEC,IAAA,aAAa,EAAGE,aAFjB;AAGC,IAAA,YAAY,EAAG,EACd,GAAGP;AADW;AAHhB,KAMMC,UANN;AAOC,IAAA,GAAG,EAAGjB;AAPP,KADD;AAWA,CAhID;;AAkIA,MAAMyB,8BAA8B,GAAG/C,cAAc,CACpDoB,qBADoD,EAEpD,uBAFoD,CAArD;AAKA,eAAe2B,8BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { HStack } from '../../h-stack';\nimport { VStack } from '../../v-stack';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderControlDropdown } from './hook';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nimport type {\n\tColor,\n\tColorOrigin,\n\tColors,\n\tDropdownProps,\n\tPopoverProps,\n} from '../types';\n\nconst noop = () => undefined;\nconst getColorObject = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolors: Colors | undefined,\n\thasMultipleColorOrigins: boolean\n) => {\n\tif ( ! colorValue || ! colors ) {\n\t\treturn;\n\t}\n\n\tif ( hasMultipleColorOrigins ) {\n\t\tlet matchedColor;\n\n\t\t( colors as ColorOrigin[] ).some( ( origin ) =>\n\t\t\torigin.colors.some( ( color ) => {\n\t\t\t\tif ( color.color === colorValue ) {\n\t\t\t\t\tmatchedColor = color;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t} )\n\t\t);\n\n\t\treturn matchedColor;\n\t}\n\n\treturn ( colors as Color[] ).find(\n\t\t( color ) => color.color === colorValue\n\t);\n};\n\nconst getToggleAriaLabel = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolorObject: Color | undefined,\n\tstyle: CSSProperties[ 'borderStyle' ],\n\tisStyleEnabled: boolean\n) => {\n\tif ( isStyleEnabled ) {\n\t\tif ( colorObject ) {\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\". %3$s: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".',\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tcolorObject.color,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".',\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tcolorObject.color\n\t\t\t\t );\n\t\t}\n\n\t\tif ( colorValue ) {\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\". %2$s: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".',\n\t\t\t\t\t\tcolorValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\".',\n\t\t\t\t\t\tcolorValue\n\t\t\t\t );\n\t\t}\n\n\t\treturn __( 'Border color and style picker.' );\n\t}\n\n\tif ( colorObject ) {\n\t\treturn sprintf(\n\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t'Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".',\n\t\t\tcolorObject.name,\n\t\t\tcolorObject.color\n\t\t);\n\t}\n\n\tif ( colorValue ) {\n\t\treturn sprintf(\n\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t'Border color picker. The currently selected color has a value of \"%1$s\".',\n\t\t\tcolorValue\n\t\t);\n\t}\n\n\treturn __( 'Border color picker.' );\n};\n\nconst BorderControlDropdown = (\n\tprops: WordPressComponentProps< DropdownProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\tborder,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tindicatorClassName,\n\t\tindicatorWrapperClassName,\n\t\tonReset,\n\t\tonColorChange,\n\t\tonStyleChange,\n\t\tpopoverContentClassName,\n\t\tpopoverControlsClassName,\n\t\tresetButtonClassName,\n\t\tshowDropdownHeader,\n\t\tenableStyle = true,\n\t\t__unstablePopoverProps,\n\t\t...otherProps\n\t} = useBorderControlDropdown( props );\n\n\tconst { color, style } = border || {};\n\tconst colorObject = getColorObject(\n\t\tcolor,\n\t\tcolors,\n\t\t!! __experimentalHasMultipleOrigins\n\t);\n\n\tconst toggleAriaLabel = getToggleAriaLabel(\n\t\tcolor,\n\t\tcolorObject,\n\t\tstyle,\n\t\tenableStyle\n\t);\n\n\tconst showResetButton = color || ( style && style !== 'none' );\n\tconst dropdownPosition = __experimentalIsRenderedInSidebar\n\t\t? 'bottom left'\n\t\t: undefined;\n\n\tconst renderToggle = ( { onToggle = noop } ) => (\n\t\t<Button\n\t\t\tonClick={ onToggle }\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ toggleAriaLabel }\n\t\t\tposition={ dropdownPosition }\n\t\t\tlabel={ __( 'Border color and style picker' ) }\n\t\t\tshowTooltip={ true }\n\t\t>\n\t\t\t<span className={ indicatorWrapperClassName }>\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tclassName={ indicatorClassName }\n\t\t\t\t\tcolorValue={ color }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</Button>\n\t);\n\n\tconst renderContent = ( { onClose }: PopoverProps ) => (\n\t\t<>\n\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t<VStack className={ popoverControlsClassName } spacing={ 6 }>\n\t\t\t\t\t{ showDropdownHeader ? (\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<StyledLabel>{ __( 'Border color' ) }</StyledLabel>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tlabel={ __( 'Close border color' ) }\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t) : undefined }\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tclassName={ popoverContentClassName }\n\t\t\t\t\t\tvalue={ color }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\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\tclearable={ false }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t\t{ enableStyle && (\n\t\t\t\t\t\t<BorderControlStylePicker\n\t\t\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\t\tonChange={ onStyleChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</DropdownContentWrapper>\n\t\t\t{ showResetButton && (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ resetButtonClassName }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset to default' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ renderToggle }\n\t\t\trenderContent={ renderContent }\n\t\t\tpopoverProps={ {\n\t\t\t\t...__unstablePopoverProps,\n\t\t\t} }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n};\n\nconst ConnectedBorderControlDropdown = contextConnect(\n\tBorderControlDropdown,\n\t'BorderControlDropdown'\n);\n\nexport default ConnectedBorderControlDropdown;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/border-control/border-control-dropdown/component.tsx"],"names":["__","sprintf","closeSmall","BorderControlStylePicker","Button","ColorIndicator","ColorPalette","Dropdown","HStack","VStack","contextConnect","useBorderControlDropdown","StyledLabel","DropdownContentWrapper","noop","undefined","getColorObject","colorValue","colors","hasMultipleColorOrigins","matchedColor","some","origin","color","find","getToggleAriaLabel","colorObject","style","isStyleEnabled","name","BorderControlDropdown","props","forwardedRef","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","border","disableCustomColors","enableAlpha","indicatorClassName","indicatorWrapperClassName","onReset","onColorChange","onStyleChange","popoverContentClassName","popoverControlsClassName","resetButtonClassName","showDropdownHeader","enableStyle","__unstablePopoverProps","otherProps","toggleAriaLabel","showResetButton","dropdownPosition","renderToggle","onToggle","renderContent","onClose","ConnectedBorderControlDropdown"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,gCAArC;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,cAAP,MAA2B,uBAA3B;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,QAAP,MAAqB,gBAArB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,cAAT,QAAwD,kBAAxD;AACA,SAASC,wBAAT,QAAyC,QAAzC;AACA,SAASC,WAAT,QAA4B,+CAA5B;AACA,OAAOC,sBAAP,MAAmC,yCAAnC;;AAIA,MAAMC,IAAI,GAAG,MAAMC,SAAnB;;AACA,MAAMC,cAAc,GAAG,CACtBC,UADsB,EAEtBC,MAFsB,EAGtBC,uBAHsB,KAIlB;AACJ,MAAK,CAAEF,UAAF,IAAgB,CAAEC,MAAvB,EAAgC;AAC/B;AACA;;AAED,MAAKC,uBAAL,EAA+B;AAC9B,QAAIC,YAAJ;AAEEF,IAAAA,MAAF,CAA4BG,IAA5B,CAAoCC,MAAF,IACjCA,MAAM,CAACJ,MAAP,CAAcG,IAAd,CAAsBE,KAAF,IAAa;AAChC,UAAKA,KAAK,CAACA,KAAN,KAAgBN,UAArB,EAAkC;AACjCG,QAAAA,YAAY,GAAGG,KAAf;AACA,eAAO,IAAP;AACA;;AAED,aAAO,KAAP;AACA,KAPD,CADD;AAWA,WAAOH,YAAP;AACA;;AAED,SAASF,MAAF,CAAsBM,IAAtB,CACJD,KAAF,IAAaA,KAAK,CA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AAPP,KADD;AAWA,CAjID;;AAmIA,MAAMyB,8BAA8B,GAAG/C,cAAc,CACpDoB,qBADoD,EAEpD,uBAFoD,CAArD;AAKA,eAAe2B,8BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BorderControlStylePicker from '../border-control-style-picker';\nimport Button from '../../button';\nimport ColorIndicator from '../../color-indicator';\nimport ColorPalette from '../../color-palette';\nimport Dropdown from '../../dropdown';\nimport { HStack } from '../../h-stack';\nimport { VStack } from '../../v-stack';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport { useBorderControlDropdown } from './hook';\nimport { StyledLabel } from '../../base-control/styles/base-control-styles';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nimport type { Color, ColorOrigin, Colors, DropdownProps } from '../types';\n\nconst noop = () => undefined;\nconst getColorObject = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolors: Colors | undefined,\n\thasMultipleColorOrigins: boolean\n) => {\n\tif ( ! colorValue || ! colors ) {\n\t\treturn;\n\t}\n\n\tif ( hasMultipleColorOrigins ) {\n\t\tlet matchedColor;\n\n\t\t( colors as ColorOrigin[] ).some( ( origin ) =>\n\t\t\torigin.colors.some( ( color ) => {\n\t\t\t\tif ( color.color === colorValue ) {\n\t\t\t\t\tmatchedColor = color;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t} )\n\t\t);\n\n\t\treturn matchedColor;\n\t}\n\n\treturn ( colors as Color[] ).find(\n\t\t( color ) => color.color === colorValue\n\t);\n};\n\nconst getToggleAriaLabel = (\n\tcolorValue: CSSProperties[ 'borderColor' ],\n\tcolorObject: Color | undefined,\n\tstyle: CSSProperties[ 'borderStyle' ],\n\tisStyleEnabled: boolean\n) => {\n\tif ( isStyleEnabled ) {\n\t\tif ( colorObject ) {\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\". %3$s: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\". The currently selected style is \"%3$s\".',\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tcolorObject.color,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".',\n\t\t\t\t\t\tcolorObject.name,\n\t\t\t\t\t\tcolorObject.color\n\t\t\t\t );\n\t\t}\n\n\t\tif ( colorValue ) {\n\t\t\treturn style\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\". %2$s: The current border style selection e.g. \"solid\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\". The currently selected style is \"%2$s\".',\n\t\t\t\t\t\tcolorValue,\n\t\t\t\t\t\tstyle\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t\t\t\t'Border color and style picker. The currently selected color has a value of \"%1$s\".',\n\t\t\t\t\t\tcolorValue\n\t\t\t\t );\n\t\t}\n\n\t\treturn __( 'Border color and style picker.' );\n\t}\n\n\tif ( colorObject ) {\n\t\treturn sprintf(\n\t\t\t// translators: %1$s: The name of the color e.g. \"vivid red\". %2$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t'Border color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".',\n\t\t\tcolorObject.name,\n\t\t\tcolorObject.color\n\t\t);\n\t}\n\n\tif ( colorValue ) {\n\t\treturn sprintf(\n\t\t\t// translators: %1$s: The color's hex code e.g.: \"#f00:\".\n\t\t\t'Border color picker. The currently selected color has a value of \"%1$s\".',\n\t\t\tcolorValue\n\t\t);\n\t}\n\n\treturn __( 'Border color picker.' );\n};\n\nconst BorderControlDropdown = (\n\tprops: WordPressComponentProps< DropdownProps, 'div' >,\n\tforwardedRef: React.ForwardedRef< any >\n) => {\n\tconst {\n\t\t__experimentalHasMultipleOrigins,\n\t\t__experimentalIsRenderedInSidebar,\n\t\tborder,\n\t\tcolors,\n\t\tdisableCustomColors,\n\t\tenableAlpha,\n\t\tindicatorClassName,\n\t\tindicatorWrapperClassName,\n\t\tonReset,\n\t\tonColorChange,\n\t\tonStyleChange,\n\t\tpopoverContentClassName,\n\t\tpopoverControlsClassName,\n\t\tresetButtonClassName,\n\t\tshowDropdownHeader,\n\t\tenableStyle = true,\n\t\t__unstablePopoverProps,\n\t\t...otherProps\n\t} = useBorderControlDropdown( props );\n\n\tconst { color, style } = border || {};\n\tconst colorObject = getColorObject(\n\t\tcolor,\n\t\tcolors,\n\t\t!! __experimentalHasMultipleOrigins\n\t);\n\n\tconst toggleAriaLabel = getToggleAriaLabel(\n\t\tcolor,\n\t\tcolorObject,\n\t\tstyle,\n\t\tenableStyle\n\t);\n\n\tconst showResetButton = color || ( style && style !== 'none' );\n\tconst dropdownPosition = __experimentalIsRenderedInSidebar\n\t\t? 'bottom left'\n\t\t: undefined;\n\n\tconst renderToggle = ( { onToggle = noop } ) => (\n\t\t<Button\n\t\t\tonClick={ onToggle }\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-label={ toggleAriaLabel }\n\t\t\tposition={ dropdownPosition }\n\t\t\tlabel={ __( 'Border color and style picker' ) }\n\t\t\tshowTooltip={ true }\n\t\t>\n\t\t\t<span className={ indicatorWrapperClassName }>\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tclassName={ indicatorClassName }\n\t\t\t\t\tcolorValue={ color }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</Button>\n\t);\n\n\t// TODO: update types once Dropdown component is refactored to TypeScript.\n\tconst renderContent = ( { onClose }: { onClose: () => void } ) => (\n\t\t<>\n\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t<VStack className={ popoverControlsClassName } spacing={ 6 }>\n\t\t\t\t\t{ showDropdownHeader ? (\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<StyledLabel>{ __( 'Border color' ) }</StyledLabel>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tlabel={ __( 'Close border color' ) }\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t) : undefined }\n\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\tclassName={ popoverContentClassName }\n\t\t\t\t\t\tvalue={ color }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t\t\t\t__experimentalHasMultipleOrigins={\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\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\tclearable={ false }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t\t{ enableStyle && (\n\t\t\t\t\t\t<BorderControlStylePicker\n\t\t\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\t\tonChange={ onStyleChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t</DropdownContentWrapper>\n\t\t\t{ showResetButton && (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ resetButtonClassName }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonReset();\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset to default' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\trenderToggle={ renderToggle }\n\t\t\trenderContent={ renderContent }\n\t\t\tpopoverProps={ {\n\t\t\t\t...__unstablePopoverProps,\n\t\t\t} }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t/>\n\t);\n};\n\nconst ConnectedBorderControlDropdown = contextConnect(\n\tBorderControlDropdown,\n\t'BorderControlDropdown'\n);\n\nexport default ConnectedBorderControlDropdown;\n"]}