@wordpress/components 28.13.1-next.082ed6819.0 → 29.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 (1020) hide show
  1. package/CHANGELOG.md +53 -2
  2. package/CONTRIBUTING.md +16 -16
  3. package/build/alignment-matrix-control/icon.js +1 -0
  4. package/build/alignment-matrix-control/icon.js.map +1 -1
  5. package/build/alignment-matrix-control/index.js +1 -0
  6. package/build/alignment-matrix-control/index.js.map +1 -1
  7. package/build/angle-picker-control/index.js +1 -1
  8. package/build/angle-picker-control/index.js.map +1 -1
  9. package/build/animation/index.js +0 -6
  10. package/build/animation/index.js.map +1 -1
  11. package/build/autocomplete/autocompleter-ui.js +1 -0
  12. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  13. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  14. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  15. package/build/autocomplete/get-default-use-items.js +1 -0
  16. package/build/autocomplete/get-default-use-items.js.map +1 -1
  17. package/build/border-box-control/border-box-control-split-controls/component.js +1 -1
  18. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  19. package/build/border-box-control/utils.js +1 -0
  20. package/build/border-box-control/utils.js.map +1 -1
  21. package/build/border-control/border-control/component.js +2 -0
  22. package/build/border-control/border-control/component.js.map +1 -1
  23. package/build/border-control/border-control-dropdown/component.js +1 -0
  24. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  25. package/build/border-control/border-control-style-picker/component.js +1 -0
  26. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  27. package/build/box-control/index.js +35 -28
  28. package/build/box-control/index.js.map +1 -1
  29. package/build/box-control/input-control.js +161 -0
  30. package/build/box-control/input-control.js.map +1 -0
  31. package/build/box-control/types.js.map +1 -1
  32. package/build/box-control/utils.js +51 -48
  33. package/build/box-control/utils.js.map +1 -1
  34. package/build/button/index.native.js +1 -0
  35. package/build/button/index.native.js.map +1 -1
  36. package/build/button/types.js.map +1 -1
  37. package/build/circular-option-picker/circular-option-picker-actions.js +1 -0
  38. package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  39. package/build/circular-option-picker/circular-option-picker-option.js +1 -0
  40. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  41. package/build/clipboard-button/index.js +5 -3
  42. package/build/clipboard-button/index.js.map +1 -1
  43. package/build/color-indicator/index.native.js +1 -0
  44. package/build/color-indicator/index.native.js.map +1 -1
  45. package/build/color-palette/index.js +1 -0
  46. package/build/color-palette/index.js.map +1 -1
  47. package/build/color-palette/utils.js +1 -0
  48. package/build/color-palette/utils.js.map +1 -1
  49. package/build/color-picker/input-with-slider.js +2 -2
  50. package/build/color-picker/input-with-slider.js.map +1 -1
  51. package/build/combobox-control/index.js +1 -0
  52. package/build/combobox-control/index.js.map +1 -1
  53. package/build/composite/item.js +0 -9
  54. package/build/composite/item.js.map +1 -1
  55. package/build/composite/legacy/index.js +1 -0
  56. package/build/composite/legacy/index.js.map +1 -1
  57. package/build/custom-gradient-picker/gradient-bar/control-points.js +3 -0
  58. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  59. package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
  60. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  61. package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
  62. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  63. package/build/custom-gradient-picker/index.js +3 -0
  64. package/build/custom-gradient-picker/index.js.map +1 -1
  65. package/build/custom-gradient-picker/serializer.js +1 -0
  66. package/build/custom-gradient-picker/serializer.js.map +1 -1
  67. package/build/custom-gradient-picker/types.js.map +1 -1
  68. package/build/custom-gradient-picker/utils.js +1 -0
  69. package/build/custom-gradient-picker/utils.js.map +1 -1
  70. package/build/custom-select-control/index.js +11 -2
  71. package/build/custom-select-control/index.js.map +1 -1
  72. package/build/custom-select-control/types.js.map +1 -1
  73. package/build/dashicon/index.js +1 -0
  74. package/build/dashicon/index.js.map +1 -1
  75. package/build/date-time/date/index.js +1 -0
  76. package/build/date-time/date/index.js.map +1 -1
  77. package/build/date-time/date/use-lilius/index.js +1 -0
  78. package/build/date-time/date/use-lilius/index.js.map +1 -1
  79. package/build/date-time/time/index.js +1 -0
  80. package/build/date-time/time/index.js.map +1 -1
  81. package/build/dimension-control/index.js +1 -0
  82. package/build/dimension-control/index.js.map +1 -1
  83. package/build/dimension-control/sizes.js +1 -0
  84. package/build/dimension-control/sizes.js.map +1 -1
  85. package/build/draggable/index.js +1 -0
  86. package/build/draggable/index.js.map +1 -1
  87. package/build/draggable/index.native.js +1 -0
  88. package/build/draggable/index.native.js.map +1 -1
  89. package/build/drop-zone/index.js +19 -13
  90. package/build/drop-zone/index.js.map +1 -1
  91. package/build/drop-zone/types.js.map +1 -1
  92. package/build/dropdown-menu/index.js +2 -0
  93. package/build/dropdown-menu/index.js.map +1 -1
  94. package/build/dropdown-menu/index.native.js +1 -0
  95. package/build/dropdown-menu/index.native.js.map +1 -1
  96. package/build/duotone-picker/color-list-picker/index.js +10 -14
  97. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  98. package/build/duotone-picker/duotone-picker.js +1 -0
  99. package/build/duotone-picker/duotone-picker.js.map +1 -1
  100. package/build/duotone-picker/utils.js +1 -0
  101. package/build/duotone-picker/utils.js.map +1 -1
  102. package/build/font-size-picker/font-size-picker-select.js +2 -0
  103. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  104. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  105. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  106. package/build/font-size-picker/index.js +2 -0
  107. package/build/font-size-picker/index.js.map +1 -1
  108. package/build/font-size-picker/index.native.js +1 -0
  109. package/build/font-size-picker/index.native.js.map +1 -1
  110. package/build/font-size-picker/utils.js +1 -0
  111. package/build/font-size-picker/utils.js.map +1 -1
  112. package/build/form-file-upload/index.js +11 -1
  113. package/build/form-file-upload/index.js.map +1 -1
  114. package/build/form-file-upload/types.js.map +1 -1
  115. package/build/form-token-field/index.js +6 -0
  116. package/build/form-token-field/index.js.map +1 -1
  117. package/build/form-token-field/suggestions-list.js +1 -0
  118. package/build/form-token-field/suggestions-list.js.map +1 -1
  119. package/build/gradient-picker/index.js +3 -0
  120. package/build/gradient-picker/index.js.map +1 -1
  121. package/build/gradient-picker/types.js.map +1 -1
  122. package/build/guide/index.js +1 -0
  123. package/build/guide/index.js.map +1 -1
  124. package/build/guide/page-control.js +1 -0
  125. package/build/guide/page-control.js.map +1 -1
  126. package/build/h-stack/hook.js +1 -0
  127. package/build/h-stack/hook.js.map +1 -1
  128. package/build/higher-order/navigate-regions/index.js +1 -0
  129. package/build/higher-order/navigate-regions/index.js.map +1 -1
  130. package/build/higher-order/with-fallback-styles/index.js +1 -0
  131. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  132. package/build/higher-order/with-filters/index.js +1 -0
  133. package/build/higher-order/with-filters/index.js.map +1 -1
  134. package/build/higher-order/with-notices/index.js +1 -0
  135. package/build/higher-order/with-notices/index.js.map +1 -1
  136. package/build/icon/index.js +9 -0
  137. package/build/icon/index.js.map +1 -1
  138. package/build/index.js +0 -6
  139. package/build/index.js.map +1 -1
  140. package/build/keyboard-shortcuts/index.js +1 -0
  141. package/build/keyboard-shortcuts/index.js.map +1 -1
  142. package/build/menu/checkbox-item.js +5 -9
  143. package/build/menu/checkbox-item.js.map +1 -1
  144. package/build/menu/group-label.js +4 -1
  145. package/build/menu/group-label.js.map +1 -1
  146. package/build/menu/group.js +4 -1
  147. package/build/menu/group.js.map +1 -1
  148. package/build/menu/item-help-text.js +5 -0
  149. package/build/menu/item-help-text.js.map +1 -1
  150. package/build/menu/item-label.js +5 -0
  151. package/build/menu/item-label.js.map +1 -1
  152. package/build/menu/item.js +4 -8
  153. package/build/menu/item.js.map +1 -1
  154. package/build/menu/radio-item.js +5 -9
  155. package/build/menu/radio-item.js.map +1 -1
  156. package/build/menu/separator.js +5 -2
  157. package/build/menu/separator.js.map +1 -1
  158. package/build/menu/styles.js +16 -16
  159. package/build/menu/styles.js.map +1 -1
  160. package/build/menu-items-choice/index.js +1 -0
  161. package/build/menu-items-choice/index.js.map +1 -1
  162. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  163. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  164. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  165. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  166. package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
  167. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  168. package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
  169. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  170. package/build/mobile/color-settings/palette.screen.native.js +1 -0
  171. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  172. package/build/mobile/gradient/index.native.js +1 -0
  173. package/build/mobile/gradient/index.native.js.map +1 -1
  174. package/build/mobile/media-edit/index.native.js +1 -0
  175. package/build/mobile/media-edit/index.native.js.map +1 -1
  176. package/build/mobile/picker/index.android.js +1 -0
  177. package/build/mobile/picker/index.android.js.map +1 -1
  178. package/build/mobile/picker/index.ios.js +1 -0
  179. package/build/mobile/picker/index.ios.js.map +1 -1
  180. package/build/mobile/segmented-control/index.native.js +1 -0
  181. package/build/mobile/segmented-control/index.native.js.map +1 -1
  182. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
  183. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  184. package/build/modal/aria-helper.js +0 -1
  185. package/build/modal/aria-helper.js.map +1 -1
  186. package/build/modal/index.js +0 -1
  187. package/build/modal/index.js.map +1 -1
  188. package/build/navigable-container/container.js +1 -0
  189. package/build/navigable-container/container.js.map +1 -1
  190. package/build/navigation/group/index.js +1 -0
  191. package/build/navigation/group/index.js.map +1 -1
  192. package/build/navigation/menu/menu-title-search.js +1 -0
  193. package/build/navigation/menu/menu-title-search.js.map +1 -1
  194. package/build/navigation/menu/search-no-results-found.js +1 -0
  195. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  196. package/build/navigation/styles/navigation-styles.js +12 -12
  197. package/build/navigation/styles/navigation-styles.js.map +1 -1
  198. package/build/navigator/navigator/component.js +1 -0
  199. package/build/navigator/navigator/component.js.map +1 -1
  200. package/build/navigator/navigator-screen/component.js +1 -0
  201. package/build/navigator/navigator-screen/component.js.map +1 -1
  202. package/build/navigator/utils/router.js +1 -0
  203. package/build/navigator/utils/router.js.map +1 -1
  204. package/build/notice/index.js +1 -0
  205. package/build/notice/index.js.map +1 -1
  206. package/build/notice/list.js +1 -0
  207. package/build/notice/list.js.map +1 -1
  208. package/build/notice/list.native.js +1 -0
  209. package/build/notice/list.native.js.map +1 -1
  210. package/build/number-control/index.js +8 -0
  211. package/build/number-control/index.js.map +1 -1
  212. package/build/number-control/types.js.map +1 -1
  213. package/build/palette-edit/index.js +1 -0
  214. package/build/palette-edit/index.js.map +1 -1
  215. package/build/panel/actions.native.js +1 -0
  216. package/build/panel/actions.native.js.map +1 -1
  217. package/build/query-controls/index.js +1 -0
  218. package/build/query-controls/index.js.map +1 -1
  219. package/build/query-controls/terms.js +1 -0
  220. package/build/query-controls/terms.js.map +1 -1
  221. package/build/radio-control/index.js +1 -0
  222. package/build/radio-control/index.js.map +1 -1
  223. package/build/radio-control/index.native.js +1 -0
  224. package/build/radio-control/index.native.js.map +1 -1
  225. package/build/range-control/index.js +2 -1
  226. package/build/range-control/index.js.map +1 -1
  227. package/build/range-control/mark.js +0 -1
  228. package/build/range-control/mark.js.map +1 -1
  229. package/build/range-control/rail.js +1 -0
  230. package/build/range-control/rail.js.map +1 -1
  231. package/build/range-control/styles/range-control-styles.js +33 -45
  232. package/build/range-control/styles/range-control-styles.js.map +1 -1
  233. package/build/resizable-box/index.js +10 -1
  234. package/build/resizable-box/index.js.map +1 -1
  235. package/build/sandbox/index.js +1 -0
  236. package/build/sandbox/index.js.map +1 -1
  237. package/build/sandbox/index.native.js +1 -0
  238. package/build/sandbox/index.native.js.map +1 -1
  239. package/build/search-control/index.native.js +1 -0
  240. package/build/search-control/index.native.js.map +1 -1
  241. package/build/select-control/index.js +1 -0
  242. package/build/select-control/index.js.map +1 -1
  243. package/build/slot-fill/bubbles-virtually/fill.js +8 -12
  244. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  245. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +7 -10
  246. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  247. package/build/slot-fill/bubbles-virtually/slot.js +4 -10
  248. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  249. package/build/slot-fill/provider.js +1 -0
  250. package/build/slot-fill/provider.js.map +1 -1
  251. package/build/slot-fill/slot.js +1 -0
  252. package/build/slot-fill/slot.js.map +1 -1
  253. package/build/slot-fill/types.js.map +1 -1
  254. package/build/snackbar/index.js +1 -0
  255. package/build/snackbar/index.js.map +1 -1
  256. package/build/snackbar/list.js +1 -0
  257. package/build/snackbar/list.js.map +1 -1
  258. package/build/style-provider/index.js +0 -1
  259. package/build/style-provider/index.js.map +1 -1
  260. package/build/tab-panel/index.js +1 -0
  261. package/build/tab-panel/index.js.map +1 -1
  262. package/build/tabs/index.js +1 -0
  263. package/build/tabs/index.js.map +1 -1
  264. package/build/tabs/tab.js +0 -17
  265. package/build/tabs/tab.js.map +1 -1
  266. package/build/text/utils.js +1 -0
  267. package/build/text/utils.js.map +1 -1
  268. package/build/theme/color-algorithms.js +1 -0
  269. package/build/theme/color-algorithms.js.map +1 -1
  270. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  271. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  272. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  273. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  274. package/build/toolbar/toolbar-button/index.js +2 -0
  275. package/build/toolbar/toolbar-button/index.js.map +1 -1
  276. package/build/toolbar/toolbar-group/index.js +1 -0
  277. package/build/toolbar/toolbar-group/index.js.map +1 -1
  278. package/build/tools-panel/tools-panel/component.js +2 -0
  279. package/build/tools-panel/tools-panel/component.js.map +1 -1
  280. package/build/tools-panel/tools-panel/hook.js +1 -0
  281. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  282. package/build/tools-panel/tools-panel-header/component.js +1 -0
  283. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  284. package/build/tree-grid/cell.js +4 -1
  285. package/build/tree-grid/cell.js.map +1 -1
  286. package/build/tree-grid/index.js +1 -0
  287. package/build/tree-grid/index.js.map +1 -1
  288. package/build/tree-grid/types.js.map +1 -1
  289. package/build/tree-select/index.js +1 -0
  290. package/build/tree-select/index.js.map +1 -1
  291. package/build/unit-control/index.js +11 -1
  292. package/build/unit-control/index.js.map +1 -1
  293. package/build/unit-control/index.native.js +1 -0
  294. package/build/unit-control/index.native.js.map +1 -1
  295. package/build/unit-control/types.js.map +1 -1
  296. package/build/unit-control/unit-select-control.js +1 -0
  297. package/build/unit-control/unit-select-control.js.map +1 -1
  298. package/build/unit-control/utils.js +1 -0
  299. package/build/unit-control/utils.js.map +1 -1
  300. package/build/utils/colors-values.js +3 -0
  301. package/build/utils/colors-values.js.map +1 -1
  302. package/build/utils/config-values.js +0 -1
  303. package/build/utils/config-values.js.map +1 -1
  304. package/build/utils/get-valid-children.js +1 -0
  305. package/build/utils/get-valid-children.js.map +1 -1
  306. package/build/utils/hooks/use-animated-offset-rect.js +1 -0
  307. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  308. package/build/utils/hooks/use-cx.js +1 -0
  309. package/build/utils/hooks/use-cx.js.map +1 -1
  310. package/build/utils/math.js +1 -0
  311. package/build/utils/math.js.map +1 -1
  312. package/build/utils/rtl.js +1 -0
  313. package/build/utils/rtl.js.map +1 -1
  314. package/build/utils/values.js +1 -0
  315. package/build/utils/values.js.map +1 -1
  316. package/build/z-stack/component.js +1 -0
  317. package/build/z-stack/component.js.map +1 -1
  318. package/build-module/alignment-matrix-control/icon.js +1 -0
  319. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  320. package/build-module/alignment-matrix-control/index.js +1 -0
  321. package/build-module/alignment-matrix-control/index.js.map +1 -1
  322. package/build-module/angle-picker-control/index.js +1 -1
  323. package/build-module/angle-picker-control/index.js.map +1 -1
  324. package/build-module/animation/index.js +1 -1
  325. package/build-module/animation/index.js.map +1 -1
  326. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  327. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  328. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  329. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  330. package/build-module/autocomplete/get-default-use-items.js +1 -0
  331. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  332. package/build-module/border-box-control/border-box-control-split-controls/component.js +1 -1
  333. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  334. package/build-module/border-box-control/utils.js +1 -0
  335. package/build-module/border-box-control/utils.js.map +1 -1
  336. package/build-module/border-control/border-control/component.js +2 -0
  337. package/build-module/border-control/border-control/component.js.map +1 -1
  338. package/build-module/border-control/border-control-dropdown/component.js +1 -0
  339. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  340. package/build-module/border-control/border-control-style-picker/component.js +1 -0
  341. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  342. package/build-module/box-control/index.js +37 -30
  343. package/build-module/box-control/index.js.map +1 -1
  344. package/build-module/box-control/input-control.js +153 -0
  345. package/build-module/box-control/input-control.js.map +1 -0
  346. package/build-module/box-control/types.js.map +1 -1
  347. package/build-module/box-control/utils.js +48 -46
  348. package/build-module/box-control/utils.js.map +1 -1
  349. package/build-module/button/index.native.js +1 -0
  350. package/build-module/button/index.native.js.map +1 -1
  351. package/build-module/button/types.js.map +1 -1
  352. package/build-module/circular-option-picker/circular-option-picker-actions.js +1 -0
  353. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  354. package/build-module/circular-option-picker/circular-option-picker-option.js +1 -0
  355. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  356. package/build-module/clipboard-button/index.js +5 -3
  357. package/build-module/clipboard-button/index.js.map +1 -1
  358. package/build-module/color-indicator/index.native.js +1 -0
  359. package/build-module/color-indicator/index.native.js.map +1 -1
  360. package/build-module/color-palette/index.js +1 -0
  361. package/build-module/color-palette/index.js.map +1 -1
  362. package/build-module/color-palette/utils.js +1 -0
  363. package/build-module/color-palette/utils.js.map +1 -1
  364. package/build-module/color-picker/input-with-slider.js +2 -2
  365. package/build-module/color-picker/input-with-slider.js.map +1 -1
  366. package/build-module/combobox-control/index.js +1 -0
  367. package/build-module/combobox-control/index.js.map +1 -1
  368. package/build-module/composite/item.js +0 -9
  369. package/build-module/composite/item.js.map +1 -1
  370. package/build-module/composite/legacy/index.js +1 -0
  371. package/build-module/composite/legacy/index.js.map +1 -1
  372. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +3 -0
  373. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  374. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  375. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  376. package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
  377. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  378. package/build-module/custom-gradient-picker/index.js +3 -0
  379. package/build-module/custom-gradient-picker/index.js.map +1 -1
  380. package/build-module/custom-gradient-picker/serializer.js +1 -0
  381. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  382. package/build-module/custom-gradient-picker/types.js.map +1 -1
  383. package/build-module/custom-gradient-picker/utils.js +1 -0
  384. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  385. package/build-module/custom-select-control/index.js +11 -2
  386. package/build-module/custom-select-control/index.js.map +1 -1
  387. package/build-module/custom-select-control/types.js.map +1 -1
  388. package/build-module/dashicon/index.js +1 -0
  389. package/build-module/dashicon/index.js.map +1 -1
  390. package/build-module/date-time/date/index.js +1 -0
  391. package/build-module/date-time/date/index.js.map +1 -1
  392. package/build-module/date-time/date/use-lilius/index.js +1 -0
  393. package/build-module/date-time/date/use-lilius/index.js.map +1 -1
  394. package/build-module/date-time/time/index.js +1 -0
  395. package/build-module/date-time/time/index.js.map +1 -1
  396. package/build-module/dimension-control/index.js +1 -0
  397. package/build-module/dimension-control/index.js.map +1 -1
  398. package/build-module/dimension-control/sizes.js +1 -0
  399. package/build-module/dimension-control/sizes.js.map +1 -1
  400. package/build-module/draggable/index.js +1 -0
  401. package/build-module/draggable/index.js.map +1 -1
  402. package/build-module/draggable/index.native.js +1 -0
  403. package/build-module/draggable/index.native.js.map +1 -1
  404. package/build-module/drop-zone/index.js +19 -13
  405. package/build-module/drop-zone/index.js.map +1 -1
  406. package/build-module/drop-zone/types.js.map +1 -1
  407. package/build-module/dropdown-menu/index.js +2 -0
  408. package/build-module/dropdown-menu/index.js.map +1 -1
  409. package/build-module/dropdown-menu/index.native.js +1 -0
  410. package/build-module/dropdown-menu/index.native.js.map +1 -1
  411. package/build-module/duotone-picker/color-list-picker/index.js +11 -15
  412. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  413. package/build-module/duotone-picker/duotone-picker.js +1 -0
  414. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  415. package/build-module/duotone-picker/utils.js +1 -0
  416. package/build-module/duotone-picker/utils.js.map +1 -1
  417. package/build-module/font-size-picker/font-size-picker-select.js +2 -0
  418. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  419. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  420. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  421. package/build-module/font-size-picker/index.js +2 -0
  422. package/build-module/font-size-picker/index.js.map +1 -1
  423. package/build-module/font-size-picker/index.native.js +1 -0
  424. package/build-module/font-size-picker/index.native.js.map +1 -1
  425. package/build-module/font-size-picker/utils.js +1 -0
  426. package/build-module/font-size-picker/utils.js.map +1 -1
  427. package/build-module/form-file-upload/index.js +13 -2
  428. package/build-module/form-file-upload/index.js.map +1 -1
  429. package/build-module/form-file-upload/types.js.map +1 -1
  430. package/build-module/form-token-field/index.js +6 -0
  431. package/build-module/form-token-field/index.js.map +1 -1
  432. package/build-module/form-token-field/suggestions-list.js +1 -0
  433. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  434. package/build-module/gradient-picker/index.js +3 -0
  435. package/build-module/gradient-picker/index.js.map +1 -1
  436. package/build-module/gradient-picker/types.js.map +1 -1
  437. package/build-module/guide/index.js +1 -0
  438. package/build-module/guide/index.js.map +1 -1
  439. package/build-module/guide/page-control.js +1 -0
  440. package/build-module/guide/page-control.js.map +1 -1
  441. package/build-module/h-stack/hook.js +1 -0
  442. package/build-module/h-stack/hook.js.map +1 -1
  443. package/build-module/higher-order/navigate-regions/index.js +1 -0
  444. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  445. package/build-module/higher-order/with-fallback-styles/index.js +1 -0
  446. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  447. package/build-module/higher-order/with-filters/index.js +1 -0
  448. package/build-module/higher-order/with-filters/index.js.map +1 -1
  449. package/build-module/higher-order/with-notices/index.js +1 -0
  450. package/build-module/higher-order/with-notices/index.js.map +1 -1
  451. package/build-module/icon/index.js +9 -0
  452. package/build-module/icon/index.js.map +1 -1
  453. package/build-module/index.js +1 -1
  454. package/build-module/index.js.map +1 -1
  455. package/build-module/keyboard-shortcuts/index.js +1 -0
  456. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  457. package/build-module/menu/checkbox-item.js +5 -9
  458. package/build-module/menu/checkbox-item.js.map +1 -1
  459. package/build-module/menu/group-label.js +4 -1
  460. package/build-module/menu/group-label.js.map +1 -1
  461. package/build-module/menu/group.js +4 -1
  462. package/build-module/menu/group.js.map +1 -1
  463. package/build-module/menu/item-help-text.js +6 -1
  464. package/build-module/menu/item-help-text.js.map +1 -1
  465. package/build-module/menu/item-label.js +6 -1
  466. package/build-module/menu/item-label.js.map +1 -1
  467. package/build-module/menu/item.js +4 -8
  468. package/build-module/menu/item.js.map +1 -1
  469. package/build-module/menu/radio-item.js +5 -9
  470. package/build-module/menu/radio-item.js.map +1 -1
  471. package/build-module/menu/separator.js +5 -2
  472. package/build-module/menu/separator.js.map +1 -1
  473. package/build-module/menu/styles.js +16 -16
  474. package/build-module/menu/styles.js.map +1 -1
  475. package/build-module/menu-items-choice/index.js +1 -0
  476. package/build-module/menu-items-choice/index.js.map +1 -1
  477. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  478. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  479. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  480. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  481. package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
  482. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  483. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
  484. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  485. package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
  486. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  487. package/build-module/mobile/gradient/index.native.js +1 -0
  488. package/build-module/mobile/gradient/index.native.js.map +1 -1
  489. package/build-module/mobile/media-edit/index.native.js +1 -0
  490. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  491. package/build-module/mobile/picker/index.android.js +1 -0
  492. package/build-module/mobile/picker/index.android.js.map +1 -1
  493. package/build-module/mobile/picker/index.ios.js +1 -0
  494. package/build-module/mobile/picker/index.ios.js.map +1 -1
  495. package/build-module/mobile/segmented-control/index.native.js +1 -0
  496. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  497. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
  498. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  499. package/build-module/modal/aria-helper.js +0 -1
  500. package/build-module/modal/aria-helper.js.map +1 -1
  501. package/build-module/modal/index.js +0 -1
  502. package/build-module/modal/index.js.map +1 -1
  503. package/build-module/navigable-container/container.js +1 -0
  504. package/build-module/navigable-container/container.js.map +1 -1
  505. package/build-module/navigation/group/index.js +1 -0
  506. package/build-module/navigation/group/index.js.map +1 -1
  507. package/build-module/navigation/menu/menu-title-search.js +1 -0
  508. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  509. package/build-module/navigation/menu/search-no-results-found.js +1 -0
  510. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  511. package/build-module/navigation/styles/navigation-styles.js +12 -12
  512. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  513. package/build-module/navigator/navigator/component.js +1 -0
  514. package/build-module/navigator/navigator/component.js.map +1 -1
  515. package/build-module/navigator/navigator-screen/component.js +1 -0
  516. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  517. package/build-module/navigator/utils/router.js +1 -0
  518. package/build-module/navigator/utils/router.js.map +1 -1
  519. package/build-module/notice/index.js +1 -0
  520. package/build-module/notice/index.js.map +1 -1
  521. package/build-module/notice/list.js +1 -0
  522. package/build-module/notice/list.js.map +1 -1
  523. package/build-module/notice/list.native.js +1 -0
  524. package/build-module/notice/list.native.js.map +1 -1
  525. package/build-module/number-control/index.js +8 -0
  526. package/build-module/number-control/index.js.map +1 -1
  527. package/build-module/number-control/types.js.map +1 -1
  528. package/build-module/palette-edit/index.js +1 -0
  529. package/build-module/palette-edit/index.js.map +1 -1
  530. package/build-module/panel/actions.native.js +1 -0
  531. package/build-module/panel/actions.native.js.map +1 -1
  532. package/build-module/query-controls/index.js +1 -0
  533. package/build-module/query-controls/index.js.map +1 -1
  534. package/build-module/query-controls/terms.js +1 -0
  535. package/build-module/query-controls/terms.js.map +1 -1
  536. package/build-module/radio-control/index.js +1 -0
  537. package/build-module/radio-control/index.js.map +1 -1
  538. package/build-module/radio-control/index.native.js +1 -0
  539. package/build-module/radio-control/index.native.js.map +1 -1
  540. package/build-module/range-control/index.js +2 -1
  541. package/build-module/range-control/index.js.map +1 -1
  542. package/build-module/range-control/mark.js +0 -1
  543. package/build-module/range-control/mark.js.map +1 -1
  544. package/build-module/range-control/rail.js +1 -0
  545. package/build-module/range-control/rail.js.map +1 -1
  546. package/build-module/range-control/styles/range-control-styles.js +33 -45
  547. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  548. package/build-module/resizable-box/index.js +10 -1
  549. package/build-module/resizable-box/index.js.map +1 -1
  550. package/build-module/sandbox/index.js +1 -0
  551. package/build-module/sandbox/index.js.map +1 -1
  552. package/build-module/sandbox/index.native.js +1 -0
  553. package/build-module/sandbox/index.native.js.map +1 -1
  554. package/build-module/search-control/index.native.js +1 -0
  555. package/build-module/search-control/index.native.js.map +1 -1
  556. package/build-module/select-control/index.js +1 -0
  557. package/build-module/select-control/index.js.map +1 -1
  558. package/build-module/slot-fill/bubbles-virtually/fill.js +9 -13
  559. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  560. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +7 -10
  561. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  562. package/build-module/slot-fill/bubbles-virtually/slot.js +4 -10
  563. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  564. package/build-module/slot-fill/provider.js +1 -0
  565. package/build-module/slot-fill/provider.js.map +1 -1
  566. package/build-module/slot-fill/slot.js +1 -0
  567. package/build-module/slot-fill/slot.js.map +1 -1
  568. package/build-module/slot-fill/types.js.map +1 -1
  569. package/build-module/snackbar/index.js +1 -0
  570. package/build-module/snackbar/index.js.map +1 -1
  571. package/build-module/snackbar/list.js +1 -0
  572. package/build-module/snackbar/list.js.map +1 -1
  573. package/build-module/style-provider/index.js +0 -1
  574. package/build-module/style-provider/index.js.map +1 -1
  575. package/build-module/tab-panel/index.js +1 -0
  576. package/build-module/tab-panel/index.js.map +1 -1
  577. package/build-module/tabs/index.js +1 -0
  578. package/build-module/tabs/index.js.map +1 -1
  579. package/build-module/tabs/tab.js +0 -15
  580. package/build-module/tabs/tab.js.map +1 -1
  581. package/build-module/text/utils.js +1 -0
  582. package/build-module/text/utils.js.map +1 -1
  583. package/build-module/theme/color-algorithms.js +1 -0
  584. package/build-module/theme/color-algorithms.js.map +1 -1
  585. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  586. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  587. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  588. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  589. package/build-module/toolbar/toolbar-button/index.js +2 -0
  590. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  591. package/build-module/toolbar/toolbar-group/index.js +1 -0
  592. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  593. package/build-module/tools-panel/tools-panel/component.js +2 -0
  594. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  595. package/build-module/tools-panel/tools-panel/hook.js +1 -0
  596. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  597. package/build-module/tools-panel/tools-panel-header/component.js +1 -0
  598. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  599. package/build-module/tree-grid/cell.js +4 -1
  600. package/build-module/tree-grid/cell.js.map +1 -1
  601. package/build-module/tree-grid/index.js +1 -0
  602. package/build-module/tree-grid/index.js.map +1 -1
  603. package/build-module/tree-grid/types.js.map +1 -1
  604. package/build-module/tree-select/index.js +1 -0
  605. package/build-module/tree-select/index.js.map +1 -1
  606. package/build-module/unit-control/index.js +11 -1
  607. package/build-module/unit-control/index.js.map +1 -1
  608. package/build-module/unit-control/index.native.js +1 -0
  609. package/build-module/unit-control/index.native.js.map +1 -1
  610. package/build-module/unit-control/types.js.map +1 -1
  611. package/build-module/unit-control/unit-select-control.js +1 -0
  612. package/build-module/unit-control/unit-select-control.js.map +1 -1
  613. package/build-module/unit-control/utils.js +1 -0
  614. package/build-module/unit-control/utils.js.map +1 -1
  615. package/build-module/utils/colors-values.js +3 -0
  616. package/build-module/utils/colors-values.js.map +1 -1
  617. package/build-module/utils/config-values.js +0 -1
  618. package/build-module/utils/config-values.js.map +1 -1
  619. package/build-module/utils/get-valid-children.js +1 -0
  620. package/build-module/utils/get-valid-children.js.map +1 -1
  621. package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
  622. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  623. package/build-module/utils/hooks/use-cx.js +1 -0
  624. package/build-module/utils/hooks/use-cx.js.map +1 -1
  625. package/build-module/utils/math.js +1 -0
  626. package/build-module/utils/math.js.map +1 -1
  627. package/build-module/utils/rtl.js +1 -0
  628. package/build-module/utils/rtl.js.map +1 -1
  629. package/build-module/utils/values.js +1 -0
  630. package/build-module/utils/values.js.map +1 -1
  631. package/build-module/z-stack/component.js +1 -0
  632. package/build-module/z-stack/component.js.map +1 -1
  633. package/build-style/style-rtl.css +15 -11
  634. package/build-style/style.css +15 -11
  635. package/build-types/alignment-matrix-control/styles.d.ts.map +1 -1
  636. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  637. package/build-types/animation/index.d.ts +1 -1
  638. package/build-types/animation/index.d.ts.map +1 -1
  639. package/build-types/base-control/hooks.d.ts +4 -4
  640. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  641. package/build-types/border-box-control/border-box-control/hook.d.ts +83 -83
  642. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +93 -93
  643. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +83 -83
  644. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +83 -83
  645. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  646. package/build-types/border-control/border-control/hook.d.ts +83 -83
  647. package/build-types/border-control/border-control-dropdown/hook.d.ts +83 -83
  648. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  649. package/build-types/box-control/index.d.ts +14 -13
  650. package/build-types/box-control/index.d.ts.map +1 -1
  651. package/build-types/box-control/input-control.d.ts +3 -0
  652. package/build-types/box-control/input-control.d.ts.map +1 -0
  653. package/build-types/box-control/stories/index.story.d.ts +852 -816
  654. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  655. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -1
  656. package/build-types/box-control/styles/box-control-styles.d.ts +3 -2
  657. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  658. package/build-types/box-control/types.d.ts +25 -3
  659. package/build-types/box-control/types.d.ts.map +1 -1
  660. package/build-types/box-control/utils.d.ts +23 -15
  661. package/build-types/box-control/utils.d.ts.map +1 -1
  662. package/build-types/button/stories/index.story.d.ts +18 -0
  663. package/build-types/button/stories/index.story.d.ts.map +1 -1
  664. package/build-types/button/types.d.ts +6 -4
  665. package/build-types/button/types.d.ts.map +1 -1
  666. package/build-types/card/card/hook.d.ts +83 -83
  667. package/build-types/card/card-body/hook.d.ts +83 -83
  668. package/build-types/card/card-divider/hook.d.ts +84 -84
  669. package/build-types/card/card-footer/hook.d.ts +83 -83
  670. package/build-types/card/card-header/hook.d.ts +83 -83
  671. package/build-types/card/card-media/hook.d.ts +83 -83
  672. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  673. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  674. package/build-types/clipboard-button/index.d.ts.map +1 -1
  675. package/build-types/color-picker/styles.d.ts +3 -2
  676. package/build-types/color-picker/styles.d.ts.map +1 -1
  677. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  678. package/build-types/composite/index.d.ts.map +1 -1
  679. package/build-types/composite/item.d.ts.map +1 -1
  680. package/build-types/context/constants.d.ts.map +1 -1
  681. package/build-types/context/get-styled-class-name-from-key.d.ts +1 -9
  682. package/build-types/context/get-styled-class-name-from-key.d.ts.map +1 -1
  683. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  684. package/build-types/custom-gradient-picker/index.d.ts +1 -1
  685. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  686. package/build-types/custom-gradient-picker/types.d.ts +6 -0
  687. package/build-types/custom-gradient-picker/types.d.ts.map +1 -1
  688. package/build-types/custom-select-control/index.d.ts.map +1 -1
  689. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  690. package/build-types/custom-select-control/types.d.ts +7 -0
  691. package/build-types/custom-select-control/types.d.ts.map +1 -1
  692. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  693. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
  694. package/build-types/date-time/date/styles.d.ts.map +1 -1
  695. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  696. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  697. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  698. package/build-types/date-time/time/styles.d.ts +8 -4
  699. package/build-types/date-time/time/styles.d.ts.map +1 -1
  700. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
  701. package/build-types/drop-zone/index.d.ts +1 -1
  702. package/build-types/drop-zone/index.d.ts.map +1 -1
  703. package/build-types/drop-zone/types.d.ts +5 -0
  704. package/build-types/drop-zone/types.d.ts.map +1 -1
  705. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  706. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
  707. package/build-types/elevation/hook.d.ts +83 -83
  708. package/build-types/flex/flex/hook.d.ts +83 -83
  709. package/build-types/flex/flex-block/hook.d.ts +83 -83
  710. package/build-types/flex/flex-item/hook.d.ts +83 -83
  711. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  712. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -1
  713. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  714. package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
  715. package/build-types/font-size-picker/index.d.ts.map +1 -1
  716. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  717. package/build-types/form-file-upload/index.d.ts +2 -1
  718. package/build-types/form-file-upload/index.d.ts.map +1 -1
  719. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  720. package/build-types/form-file-upload/types.d.ts +10 -8
  721. package/build-types/form-file-upload/types.d.ts.map +1 -1
  722. package/build-types/form-token-field/index.d.ts.map +1 -1
  723. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  724. package/build-types/gradient-picker/index.d.ts +1 -1
  725. package/build-types/gradient-picker/index.d.ts.map +1 -1
  726. package/build-types/gradient-picker/types.d.ts +6 -0
  727. package/build-types/gradient-picker/types.d.ts.map +1 -1
  728. package/build-types/grid/hook.d.ts +83 -83
  729. package/build-types/h-stack/hook.d.ts +83 -83
  730. package/build-types/heading/hook.d.ts +82 -82
  731. package/build-types/higher-order/with-fallback-styles/index.d.ts +2 -2
  732. package/build-types/higher-order/with-filters/index.d.ts +4 -4
  733. package/build-types/icon/index.d.ts +23 -7
  734. package/build-types/icon/index.d.ts.map +1 -1
  735. package/build-types/icon/stories/index.story.d.ts +7 -1
  736. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  737. package/build-types/index.d.ts +1 -1
  738. package/build-types/index.d.ts.map +1 -1
  739. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  740. package/build-types/item-group/item/hook.d.ts +83 -83
  741. package/build-types/item-group/item-group/hook.d.ts +83 -83
  742. package/build-types/lock-unlock.d.ts +2 -2
  743. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  744. package/build-types/menu/group-label.d.ts.map +1 -1
  745. package/build-types/menu/group.d.ts.map +1 -1
  746. package/build-types/menu/index.d.ts.map +1 -1
  747. package/build-types/menu/item-help-text.d.ts.map +1 -1
  748. package/build-types/menu/item-label.d.ts.map +1 -1
  749. package/build-types/menu/item.d.ts.map +1 -1
  750. package/build-types/menu/radio-item.d.ts.map +1 -1
  751. package/build-types/menu/separator.d.ts.map +1 -1
  752. package/build-types/menu/styles.d.ts.map +1 -1
  753. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  754. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  755. package/build-types/navigator/navigator-back-button/hook.d.ts +92 -92
  756. package/build-types/navigator/navigator-button/hook.d.ts +92 -92
  757. package/build-types/number-control/index.d.ts +2 -1
  758. package/build-types/number-control/index.d.ts.map +1 -1
  759. package/build-types/number-control/stories/index.story.d.ts +2 -1
  760. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  761. package/build-types/number-control/types.d.ts +7 -0
  762. package/build-types/number-control/types.d.ts.map +1 -1
  763. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  764. package/build-types/progress-bar/styles.d.ts.map +1 -1
  765. package/build-types/range-control/index.d.ts +1 -1
  766. package/build-types/range-control/index.d.ts.map +1 -1
  767. package/build-types/range-control/mark.d.ts.map +1 -1
  768. package/build-types/range-control/styles/range-control-styles.d.ts +4 -3
  769. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  770. package/build-types/resizable-box/index.d.ts.map +1 -1
  771. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  772. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  773. package/build-types/scrollable/hook.d.ts +83 -83
  774. package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
  775. package/build-types/select-control/index.d.ts.map +1 -1
  776. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  777. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  778. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  779. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  780. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  781. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +1 -1
  782. package/build-types/slot-fill/types.d.ts +4 -3
  783. package/build-types/slot-fill/types.d.ts.map +1 -1
  784. package/build-types/spacer/hook.d.ts +83 -83
  785. package/build-types/spinner/styles.d.ts.map +1 -1
  786. package/build-types/surface/hook.d.ts +83 -83
  787. package/build-types/tabs/tab.d.ts +3 -0
  788. package/build-types/tabs/tab.d.ts.map +1 -1
  789. package/build-types/text/hook.d.ts +83 -83
  790. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  791. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  792. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  793. package/build-types/tools-panel/tools-panel/component.d.ts +2 -0
  794. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  795. package/build-types/tools-panel/tools-panel/hook.d.ts +83 -83
  796. package/build-types/tools-panel/tools-panel-header/hook.d.ts +83 -83
  797. package/build-types/tools-panel/tools-panel-item/hook.d.ts +83 -83
  798. package/build-types/tree-grid/cell.d.ts.map +1 -1
  799. package/build-types/tree-grid/types.d.ts +1 -1
  800. package/build-types/tree-grid/types.d.ts.map +1 -1
  801. package/build-types/truncate/hook.d.ts +83 -83
  802. package/build-types/unit-control/index.d.ts +3 -2
  803. package/build-types/unit-control/index.d.ts.map +1 -1
  804. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  805. package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -1
  806. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  807. package/build-types/unit-control/types.d.ts +7 -0
  808. package/build-types/unit-control/types.d.ts.map +1 -1
  809. package/build-types/utils/colors-values.d.ts +3 -0
  810. package/build-types/utils/colors-values.d.ts.map +1 -1
  811. package/build-types/utils/config-values.d.ts +0 -1
  812. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  813. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  814. package/build-types/utils/rtl.d.ts +1 -1
  815. package/build-types/utils/rtl.d.ts.map +1 -1
  816. package/build-types/v-stack/hook.d.ts +83 -83
  817. package/build-types/z-stack/styles.d.ts.map +1 -1
  818. package/package.json +20 -20
  819. package/src/alignment-matrix-control/stories/index.story.tsx +2 -2
  820. package/src/angle-picker-control/index.tsx +1 -1
  821. package/src/angle-picker-control/stories/index.story.tsx +2 -2
  822. package/src/animation/index.tsx +0 -1
  823. package/src/base-control/stories/index.story.tsx +1 -1
  824. package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -1
  825. package/src/border-box-control/stories/index.story.tsx +1 -1
  826. package/src/border-control/border-control/component.tsx +2 -0
  827. package/src/border-control/stories/index.story.tsx +1 -1
  828. package/src/box-control/README.md +80 -60
  829. package/src/box-control/docs-manifest.json +5 -0
  830. package/src/box-control/index.tsx +47 -29
  831. package/src/box-control/input-control.tsx +197 -0
  832. package/src/box-control/stories/index.story.tsx +2 -1
  833. package/src/box-control/test/index.tsx +33 -26
  834. package/src/box-control/types.ts +80 -55
  835. package/src/box-control/utils.ts +62 -60
  836. package/src/button/README.md +108 -219
  837. package/src/button/docs-manifest.json +5 -0
  838. package/src/button/stories/best-practices.mdx +31 -0
  839. package/src/button/stories/index.story.tsx +18 -0
  840. package/src/button/types.ts +6 -4
  841. package/src/button-group/stories/index.story.tsx +1 -1
  842. package/src/card/stories/index.story.tsx +2 -2
  843. package/src/checkbox-control/stories/index.story.tsx +1 -1
  844. package/src/circular-option-picker/circular-option-picker-actions.tsx +1 -0
  845. package/src/circular-option-picker/circular-option-picker-option.tsx +1 -0
  846. package/src/circular-option-picker/stories/index.story.tsx +2 -2
  847. package/src/circular-option-picker/style.scss +2 -2
  848. package/src/clipboard-button/index.tsx +5 -3
  849. package/src/color-palette/stories/index.story.tsx +3 -3
  850. package/src/color-picker/input-with-slider.tsx +1 -1
  851. package/src/color-picker/stories/index.story.tsx +2 -2
  852. package/src/combobox-control/stories/index.story.tsx +1 -1
  853. package/src/composite/item.tsx +1 -19
  854. package/src/composite/stories/index.story.tsx +3 -3
  855. package/src/confirm-dialog/stories/index.story.tsx +1 -1
  856. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +2 -0
  857. package/src/custom-gradient-picker/index.tsx +2 -0
  858. package/src/custom-gradient-picker/style.scss +1 -1
  859. package/src/custom-gradient-picker/types.ts +6 -0
  860. package/src/custom-select-control/README.md +2 -0
  861. package/src/custom-select-control/index.tsx +11 -2
  862. package/src/custom-select-control/stories/index.story.tsx +3 -2
  863. package/src/custom-select-control/test/index.tsx +13 -9
  864. package/src/custom-select-control/types.ts +7 -0
  865. package/src/custom-select-control-v2/stories/index.story.tsx +2 -2
  866. package/src/date-time/stories/date-time.story.tsx +4 -1
  867. package/src/date-time/stories/date.story.tsx +4 -1
  868. package/src/date-time/stories/time.story.tsx +4 -1
  869. package/src/dimension-control/stories/index.story.tsx +1 -1
  870. package/src/disabled/stories/index.story.tsx +3 -3
  871. package/src/divider/stories/index.story.tsx +1 -1
  872. package/src/draggable/stories/index.story.tsx +2 -2
  873. package/src/drop-zone/index.tsx +21 -24
  874. package/src/drop-zone/types.ts +5 -0
  875. package/src/dropdown/stories/index.story.tsx +7 -7
  876. package/src/dropdown-menu/index.tsx +4 -1
  877. package/src/dropdown-menu/stories/index.story.tsx +3 -3
  878. package/src/dropdown-menu/style.scss +1 -1
  879. package/src/duotone-picker/color-list-picker/index.tsx +8 -8
  880. package/src/duotone-picker/color-list-picker/style.scss +0 -6
  881. package/src/duotone-picker/stories/duotone-picker.story.tsx +1 -1
  882. package/src/flex/stories/index.story.tsx +1 -1
  883. package/src/font-size-picker/font-size-picker-select.tsx +1 -0
  884. package/src/font-size-picker/index.tsx +1 -0
  885. package/src/font-size-picker/stories/index.story.tsx +1 -1
  886. package/src/form-file-upload/README.md +58 -48
  887. package/src/form-file-upload/docs-manifest.json +5 -0
  888. package/src/form-file-upload/index.tsx +12 -1
  889. package/src/form-file-upload/stories/index.story.tsx +4 -3
  890. package/src/form-file-upload/test/index.tsx +5 -1
  891. package/src/form-file-upload/types.ts +10 -8
  892. package/src/form-token-field/README.md +1 -0
  893. package/src/form-token-field/index.tsx +7 -0
  894. package/src/form-token-field/stories/index.story.tsx +4 -2
  895. package/src/form-token-field/test/index.tsx +5 -1
  896. package/src/gradient-picker/README.md +8 -0
  897. package/src/gradient-picker/index.tsx +2 -0
  898. package/src/gradient-picker/stories/index.story.tsx +1 -1
  899. package/src/gradient-picker/types.ts +6 -0
  900. package/src/grid/stories/index.story.tsx +1 -1
  901. package/src/h-stack/stories/index.story.tsx +2 -2
  902. package/src/icon/README.md +22 -65
  903. package/src/icon/docs-manifest.json +5 -0
  904. package/src/icon/index.tsx +28 -13
  905. package/src/icon/stories/index.story.tsx +50 -8
  906. package/src/index.ts +1 -5
  907. package/src/input-control/stories/index.story.tsx +4 -4
  908. package/src/item-group/stories/index.story.tsx +2 -2
  909. package/src/menu/checkbox-item.tsx +9 -7
  910. package/src/menu/group-label.tsx +8 -1
  911. package/src/menu/group.tsx +8 -1
  912. package/src/menu/item-help-text.tsx +10 -1
  913. package/src/menu/item-label.tsx +10 -1
  914. package/src/menu/item.tsx +8 -6
  915. package/src/menu/radio-item.tsx +9 -7
  916. package/src/menu/separator.tsx +9 -2
  917. package/src/menu/stories/index.story.tsx +2 -2
  918. package/src/menu/styles.ts +1 -1
  919. package/src/menu-group/stories/index.story.tsx +1 -1
  920. package/src/menu-item/stories/index.story.tsx +1 -1
  921. package/src/menu-items-choice/stories/index.story.tsx +1 -1
  922. package/src/menu-items-choice/style.scss +1 -0
  923. package/src/modal/stories/index.story.tsx +2 -2
  924. package/src/modal/test/index.tsx +2 -1
  925. package/src/navigable-container/stories/navigable-menu.story.tsx +1 -1
  926. package/src/navigable-container/stories/tabbable-container.story.tsx +1 -1
  927. package/src/navigation/stories/index.story.tsx +4 -4
  928. package/src/navigation/styles/navigation-styles.tsx +3 -2
  929. package/src/navigator/stories/index.story.tsx +3 -3
  930. package/src/number-control/README.md +2 -1
  931. package/src/number-control/index.tsx +9 -0
  932. package/src/number-control/stories/index.story.tsx +2 -1
  933. package/src/number-control/test/index.tsx +5 -1
  934. package/src/number-control/types.ts +7 -0
  935. package/src/panel/stories/index.story.tsx +1 -1
  936. package/src/placeholder/stories/index.story.tsx +3 -3
  937. package/src/popover/stories/index.story.tsx +11 -9
  938. package/src/query-controls/stories/index.story.tsx +6 -6
  939. package/src/radio-control/stories/index.story.tsx +1 -1
  940. package/src/radio-group/stories/index.story.tsx +3 -3
  941. package/src/range-control/index.tsx +1 -0
  942. package/src/range-control/mark.tsx +0 -1
  943. package/src/range-control/stories/index.story.tsx +7 -7
  944. package/src/range-control/styles/range-control-styles.ts +18 -19
  945. package/src/resizable-box/index.tsx +10 -0
  946. package/src/resizable-box/stories/index.story.tsx +1 -1
  947. package/src/resizable-box/style.scss +8 -0
  948. package/src/responsive-wrapper/stories/index.story.tsx +1 -1
  949. package/src/sandbox/stories/index.story.tsx +1 -1
  950. package/src/scrollable/stories/index.story.tsx +2 -1
  951. package/src/search-control/stories/index.story.tsx +1 -1
  952. package/src/select-control/stories/index.story.tsx +1 -1
  953. package/src/slot-fill/bubbles-virtually/fill.tsx +7 -11
  954. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +2 -13
  955. package/src/slot-fill/bubbles-virtually/slot.tsx +4 -7
  956. package/src/slot-fill/stories/index.story.tsx +2 -2
  957. package/src/slot-fill/types.ts +4 -3
  958. package/src/snackbar/stories/index.story.tsx +4 -4
  959. package/src/snackbar/stories/list.story.tsx +2 -2
  960. package/src/surface/stories/index.story.tsx +1 -1
  961. package/src/tabs/tab.tsx +0 -18
  962. package/src/tabs/test/index.tsx +1492 -947
  963. package/src/text-control/stories/index.story.tsx +1 -1
  964. package/src/textarea-control/stories/index.story.tsx +1 -1
  965. package/src/theme/stories/index.story.tsx +1 -1
  966. package/src/toggle-control/stories/index.story.tsx +1 -1
  967. package/src/toggle-group-control/stories/index.story.tsx +1 -1
  968. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +22 -22
  969. package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
  970. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
  971. package/src/toolbar/stories/index.story.tsx +1 -1
  972. package/src/toolbar/toolbar-button/index.tsx +2 -0
  973. package/src/tools-panel/stories/index.story.tsx +15 -3
  974. package/src/tools-panel/test/index.tsx +0 -17
  975. package/src/tools-panel/tools-panel/README.md +4 -0
  976. package/src/tools-panel/tools-panel/component.tsx +2 -0
  977. package/src/tooltip/stories/index.story.tsx +1 -1
  978. package/src/tree-grid/cell.tsx +5 -1
  979. package/src/tree-grid/stories/index.story.tsx +1 -1
  980. package/src/tree-grid/types.ts +1 -1
  981. package/src/tree-select/stories/index.story.tsx +1 -1
  982. package/src/unit-control/README.md +3 -3
  983. package/src/unit-control/index.tsx +11 -1
  984. package/src/unit-control/stories/index.story.tsx +5 -4
  985. package/src/unit-control/test/index.tsx +5 -1
  986. package/src/unit-control/types.ts +7 -0
  987. package/src/utils/colors-values.js +3 -0
  988. package/src/utils/config-values.js +0 -1
  989. package/src/view/stories/index.story.tsx +1 -1
  990. package/src/visually-hidden/stories/index.story.tsx +1 -1
  991. package/src/z-stack/stories/index.story.tsx +1 -1
  992. package/tsconfig.tsbuildinfo +1 -1
  993. package/build/box-control/all-input-control.js +0 -90
  994. package/build/box-control/all-input-control.js.map +0 -1
  995. package/build/box-control/axial-input-controls.js +0 -124
  996. package/build/box-control/axial-input-controls.js.map +0 -1
  997. package/build/box-control/input-controls.js +0 -132
  998. package/build/box-control/input-controls.js.map +0 -1
  999. package/build/menu/use-temporary-focus-visible-fix.js +0 -27
  1000. package/build/menu/use-temporary-focus-visible-fix.js.map +0 -1
  1001. package/build-module/box-control/all-input-control.js +0 -83
  1002. package/build-module/box-control/all-input-control.js.map +0 -1
  1003. package/build-module/box-control/axial-input-controls.js +0 -115
  1004. package/build-module/box-control/axial-input-controls.js.map +0 -1
  1005. package/build-module/box-control/input-controls.js +0 -123
  1006. package/build-module/box-control/input-controls.js.map +0 -1
  1007. package/build-module/menu/use-temporary-focus-visible-fix.js +0 -20
  1008. package/build-module/menu/use-temporary-focus-visible-fix.js.map +0 -1
  1009. package/build-types/box-control/all-input-control.d.ts +0 -3
  1010. package/build-types/box-control/all-input-control.d.ts.map +0 -1
  1011. package/build-types/box-control/axial-input-controls.d.ts +0 -3
  1012. package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
  1013. package/build-types/box-control/input-controls.d.ts +0 -3
  1014. package/build-types/box-control/input-controls.d.ts.map +0 -1
  1015. package/build-types/menu/use-temporary-focus-visible-fix.d.ts +0 -8
  1016. package/build-types/menu/use-temporary-focus-visible-fix.d.ts.map +0 -1
  1017. package/src/box-control/all-input-control.tsx +0 -109
  1018. package/src/box-control/axial-input-controls.tsx +0 -164
  1019. package/src/box-control/input-controls.tsx +0 -166
  1020. package/src/menu/use-temporary-focus-visible-fix.ts +0 -22
@@ -1 +1 @@
1
- {"version":3,"names":["colord","extend","namesPlugin","a11yPlugin","__","isSimpleCSSColor","value","valueIsCssVariable","test","valueIsColorMix","extractColorNameFromCurrentValue","currentValue","colors","showMultiplePalettes","currentValueIsSimpleColor","normalizedCurrentValue","toHex","colorPalettes","paletteColors","name","colorName","color","colorValue","normalizedColorValue","isMultiplePaletteObject","obj","Array","isArray","isMultiplePaletteArray","arr","length","every","colorObj","normalizeColorValue","element","ownerDocument","defaultView","computedBackgroundColor","getComputedStyle","backgroundColor"],"sources":["@wordpress/components/src/color-palette/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { ColorObject, ColorPaletteProps, PaletteObject } from './types';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Checks if a color value is a simple CSS color.\n *\n * @param value The color value to check.\n * @return A boolean indicating whether the color value is a simple CSS color.\n */\nconst isSimpleCSSColor = ( value: string ): boolean => {\n\tconst valueIsCssVariable = /var\\(/.test( value ?? '' );\n\tconst valueIsColorMix = /color-mix\\(/.test( value ?? '' );\n\treturn ! valueIsCssVariable && ! valueIsColorMix;\n};\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue?: ColorPaletteProps[ 'value' ],\n\tcolors: ColorPaletteProps[ 'colors' ] = [],\n\tshowMultiplePalettes: boolean = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\tconst currentValueIsSimpleColor = currentValue\n\t\t? isSimpleCSSColor( currentValue )\n\t\t: false;\n\tconst normalizedCurrentValue = currentValueIsSimpleColor\n\t\t? colord( currentValue ).toHex()\n\t\t: currentValue;\n\n\t// Normalize format of `colors` to simplify the following loop\n\ttype normalizedPaletteObject = { colors: ColorObject[] };\n\tconst colorPalettes: normalizedPaletteObject[] = showMultiplePalettes\n\t\t? ( colors as PaletteObject[] )\n\t\t: [ { colors: colors as ColorObject[] } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsSimpleColor\n\t\t\t\t? colord( colorValue ).toHex()\n\t\t\t\t: colorValue;\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\n// The PaletteObject type has a `colors` property (an array of ColorObject),\n// while the ColorObject type has a `color` property (the CSS color value).\nexport const isMultiplePaletteObject = (\n\tobj: PaletteObject | ColorObject\n): obj is PaletteObject =>\n\tArray.isArray( ( obj as PaletteObject ).colors ) && ! ( 'color' in obj );\n\nexport const isMultiplePaletteArray = (\n\tarr: ( PaletteObject | ColorObject )[]\n): arr is PaletteObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( colorObj ) => isMultiplePaletteObject( colorObj ) )\n\t);\n};\n\n/**\n * Transform a CSS variable used as background color into the color value itself.\n *\n * @param value The color value that may be a CSS variable.\n * @param element The element for which to get the computed style.\n * @return The background color value computed from a element.\n */\nexport const normalizeColorValue = (\n\tvalue: string | undefined,\n\telement: HTMLElement | null\n) => {\n\tif ( ! value || ! element || isSimpleCSSColor( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst computedBackgroundColor =\n\t\tdefaultView?.getComputedStyle( element ).backgroundColor;\n\n\treturn computedBackgroundColor\n\t\t? colord( computedBackgroundColor ).toHex()\n\t\t: value;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,UAAU,MAAM,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGAH,MAAM,CAAE,CAAEC,WAAW,EAAEC,UAAU,CAAG,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,gBAAgB,GAAKC,KAAa,IAAe;EACtD,MAAMC,kBAAkB,GAAG,OAAO,CAACC,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACtD,MAAMG,eAAe,GAAG,aAAa,CAACD,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACzD,OAAO,CAAEC,kBAAkB,IAAI,CAAEE,eAAe;AACjD,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAGA,CAC/CC,YAA2C,EAC3CC,MAAqC,GAAG,EAAE,EAC1CC,oBAA6B,GAAG,KAAK,KACjC;EACJ,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAO,EAAE;EACV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C,EAAG;IACxD,OAAOA,KAAK;EACb;EAEA,MAAM;IAAE6B;EAAc,CAAC,GAAGD,OAAO;EACjC,MAAM;IAAEE;EAAY,CAAC,GAAGD,aAAa;EACrC,MAAME,uBAAuB,GAC5BD,WAAW,EAAEE,gBAAgB,CAAEJ,OAAQ,CAAC,CAACK,eAAe;EAEzD,OAAOF,uBAAuB,GAC3BrC,MAAM,CAAEqC,uBAAwB,CAAC,CAACrB,KAAK,CAAC,CAAC,GACzCV,KAAK;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["colord","extend","namesPlugin","a11yPlugin","__","isSimpleCSSColor","value","valueIsCssVariable","test","valueIsColorMix","extractColorNameFromCurrentValue","currentValue","colors","showMultiplePalettes","currentValueIsSimpleColor","normalizedCurrentValue","toHex","colorPalettes","paletteColors","name","colorName","color","colorValue","normalizedColorValue","isMultiplePaletteObject","obj","Array","isArray","isMultiplePaletteArray","arr","length","every","colorObj","normalizeColorValue","element","ownerDocument","defaultView","computedBackgroundColor","getComputedStyle","backgroundColor"],"sources":["@wordpress/components/src/color-palette/utils.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { ColorObject, ColorPaletteProps, PaletteObject } from './types';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Checks if a color value is a simple CSS color.\n *\n * @param value The color value to check.\n * @return A boolean indicating whether the color value is a simple CSS color.\n */\nconst isSimpleCSSColor = ( value: string ): boolean => {\n\tconst valueIsCssVariable = /var\\(/.test( value ?? '' );\n\tconst valueIsColorMix = /color-mix\\(/.test( value ?? '' );\n\treturn ! valueIsCssVariable && ! valueIsColorMix;\n};\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue?: ColorPaletteProps[ 'value' ],\n\tcolors: ColorPaletteProps[ 'colors' ] = [],\n\tshowMultiplePalettes: boolean = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\tconst currentValueIsSimpleColor = currentValue\n\t\t? isSimpleCSSColor( currentValue )\n\t\t: false;\n\tconst normalizedCurrentValue = currentValueIsSimpleColor\n\t\t? colord( currentValue ).toHex()\n\t\t: currentValue;\n\n\t// Normalize format of `colors` to simplify the following loop\n\ttype normalizedPaletteObject = { colors: ColorObject[] };\n\tconst colorPalettes: normalizedPaletteObject[] = showMultiplePalettes\n\t\t? ( colors as PaletteObject[] )\n\t\t: [ { colors: colors as ColorObject[] } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsSimpleColor\n\t\t\t\t? colord( colorValue ).toHex()\n\t\t\t\t: colorValue;\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\n// The PaletteObject type has a `colors` property (an array of ColorObject),\n// while the ColorObject type has a `color` property (the CSS color value).\nexport const isMultiplePaletteObject = (\n\tobj: PaletteObject | ColorObject\n): obj is PaletteObject =>\n\tArray.isArray( ( obj as PaletteObject ).colors ) && ! ( 'color' in obj );\n\nexport const isMultiplePaletteArray = (\n\tarr: ( PaletteObject | ColorObject )[]\n): arr is PaletteObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( colorObj ) => isMultiplePaletteObject( colorObj ) )\n\t);\n};\n\n/**\n * Transform a CSS variable used as background color into the color value itself.\n *\n * @param value The color value that may be a CSS variable.\n * @param element The element for which to get the computed style.\n * @return The background color value computed from a element.\n */\nexport const normalizeColorValue = (\n\tvalue: string | undefined,\n\telement: HTMLElement | null\n) => {\n\tif ( ! value || ! element || isSimpleCSSColor( value ) ) {\n\t\treturn value;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tconst computedBackgroundColor =\n\t\tdefaultView?.getComputedStyle( element ).backgroundColor;\n\n\treturn computedBackgroundColor\n\t\t? colord( computedBackgroundColor ).toHex()\n\t\t: value;\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,UAAU,MAAM,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGAH,MAAM,CAAE,CAAEC,WAAW,EAAEC,UAAU,CAAG,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,gBAAgB,GAAKC,KAAa,IAAe;EACtD,MAAMC,kBAAkB,GAAG,OAAO,CAACC,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACtD,MAAMG,eAAe,GAAG,aAAa,CAACD,IAAI,CAAEF,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAG,CAAC;EACzD,OAAO,CAAEC,kBAAkB,IAAI,CAAEE,eAAe;AACjD,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAGA,CAC/CC,YAA2C,EAC3CC,MAAqC,GAAG,EAAE,EAC1CC,oBAA6B,GAAG,KAAK,KACjC;EACJ,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAO,EAAE;EACV;EACA,MAAMG,yBAAyB,GAAGH,YAAY,GAC3CN,gBAAgB,CAAEM,YAAa,CAAC,GAChC,KAAK;EACR,MAAMI,sBAAsB,GAAGD,yBAAyB,GACrDd,MAAM,CAAEW,YAAa,CAAC,CAACK,KAAK,CAAC,CAAC,GAC9BL,YAAY;;EAEf;;EAEA,MAAMM,aAAwC,GAAGJ,oBAAoB,GAChED,MAAM,GACR,CAAE;IAAEA,MAAM,EAAEA;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K,CAAC,CAAC,GACzCV,KAAK;AACT,CAAC","ignoreList":[]}
@@ -29,6 +29,7 @@ export const InputWithSlider = ({
29
29
  return /*#__PURE__*/_jsxs(HStack, {
30
30
  spacing: 4,
31
31
  children: [/*#__PURE__*/_jsx(NumberControlWrapper, {
32
+ __next40pxDefaultSize: true,
32
33
  min: min,
33
34
  max: max,
34
35
  label: label,
@@ -42,8 +43,7 @@ export const InputWithSlider = ({
42
43
  children: abbreviation
43
44
  })
44
45
  }),
45
- spinControls: "none",
46
- size: "__unstable-large"
46
+ spinControls: "none"
47
47
  }), /*#__PURE__*/_jsx(RangeControl, {
48
48
  __nextHasNoMarginBottom: true,
49
49
  __next40pxDefaultSize: true,
@@ -1 +1 @@
1
- {"version":3,"names":["HStack","Text","RangeControl","NumberControlWrapper","COLORS","InputControlPrefixWrapper","jsx","_jsx","jsxs","_jsxs","InputWithSlider","min","max","label","abbreviation","onChange","value","onNumberControlChange","newValue","parseInt","spacing","children","hideLabelFromVision","prefix","color","theme","accent","lineHeight","spinControls","size","__nextHasNoMarginBottom","__next40pxDefaultSize","withInputField"],"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { HStack } from '../h-stack';\nimport { Text } from '../text';\nimport { RangeControl, NumberControlWrapper } from './styles';\nimport { COLORS } from '../utils/colors-values';\nimport type { InputWithSliderProps } from './types';\nimport InputControlPrefixWrapper from '../input-control/input-prefix-wrapper';\n\nexport const InputWithSlider = ( {\n\tmin,\n\tmax,\n\tlabel,\n\tabbreviation,\n\tonChange,\n\tvalue,\n}: InputWithSliderProps ) => {\n\tconst onNumberControlChange = ( newValue?: number | string ) => {\n\t\tif ( ! newValue ) {\n\t\t\tonChange( 0 );\n\t\t\treturn;\n\t\t}\n\t\tif ( typeof newValue === 'string' ) {\n\t\t\tonChange( parseInt( newValue, 10 ) );\n\t\t\treturn;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\treturn (\n\t\t<HStack spacing={ 4 }>\n\t\t\t<NumberControlWrapper\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onNumberControlChange }\n\t\t\t\tprefix={\n\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t<Text color={ COLORS.theme.accent } lineHeight={ 1 }>\n\t\t\t\t\t\t\t{ abbreviation }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t}\n\t\t\t\tspinControls=\"none\"\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t/>\n\t\t\t<RangeControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185\n\t\t\t\tonChange={ onChange }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t</HStack>\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,YAAY;AACnC,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,UAAU;AAC7D,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,OAAOC,yBAAyB,MAAM,uCAAuC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9E,OAAO,MAAMC,eAAe,GAAGA,CAAE;EAChCC,GAAG;EACHC,GAAG;EACHC,KAAK;EACLC,YAAY;EACZC,QAAQ;EACRC;AACqB,CAAC,KAAM;EAC5B,MAAMC,qBAAqB,GAAKC,QAA0B,IAAM;IAC/D,IAAK,CAAEA,QAAQ,EAAG;MACjBH,QAAQ,CAAE,CAAE,CAAC;MACb;IACD;IACA,IAAK,OAAOG,QAAQ,KAAK,QAAQ,EAAG;MACnCH,QAAQ,CAAEI,QAAQ,CAAED,QAAQ,EAAE,EAAG,CAAE,CAAC;MACpC;IACD;IACAH,QAAQ,CAAEG,QAAS,CAAC;EACrB,CAAC;EAED,oBACCT,KAAA,CAACT,MAAM;IAACoB,OAAO,EAAG,CAAG;IAAAC,QAAA,gBACpBd,IAAA,CAACJ,oBAAoB;MACpBQ,GAAG,EAAGA,GAAK;MACXC,GAAG,EAAGA,GAAK;MACXC,KAAK,EAAGA,KAAO;MACfS,mBAAmB;MACnBN,KAAK,EAAGA,KAAO;MACfD,QAAQ,EAAGE,qBAAuB;MAClCM,MAAM,eACLhB,IAAA,CAACF,yBAAyB;QAAAgB,QAAA,eACzBd,IAAA,CAACN,IAAI;UAACuB,KAAK,EAAGpB,MAAM,CAACqB,KAAK,CAACC,MAAQ;UAACC,UAAU,EAAG,CAAG;UAAAN,QAAA,EACjDP;QAAY,CACT;MAAC,CACmB,CAC3B;MACDc,YAAY,EAAC,MAAM;MACnBC,IAAI,EAAC;IAAkB,CACvB,CAAC,eACFtB,IAAA,CAACL,YAAY;MACZ4B,uBAAuB;MACvBC,qBAAqB;MACrBlB,KAAK,EAAGA,KAAO;MACfS,mBAAmB;MACnBX,GAAG,EAAGA,GAAK;MACXC,GAAG,EAAGA,GAAK;MACXI,KAAK,EAAGA;MACR;MACA;MAAA;MACAD,QAAQ,EAAGA,QAAU;MACrBiB,cAAc,EAAG;IAAO,CACxB,CAAC;EAAA,CACK,CAAC;AAEX,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["HStack","Text","RangeControl","NumberControlWrapper","COLORS","InputControlPrefixWrapper","jsx","_jsx","jsxs","_jsxs","InputWithSlider","min","max","label","abbreviation","onChange","value","onNumberControlChange","newValue","parseInt","spacing","children","__next40pxDefaultSize","hideLabelFromVision","prefix","color","theme","accent","lineHeight","spinControls","__nextHasNoMarginBottom","withInputField"],"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { HStack } from '../h-stack';\nimport { Text } from '../text';\nimport { RangeControl, NumberControlWrapper } from './styles';\nimport { COLORS } from '../utils/colors-values';\nimport type { InputWithSliderProps } from './types';\nimport InputControlPrefixWrapper from '../input-control/input-prefix-wrapper';\n\nexport const InputWithSlider = ( {\n\tmin,\n\tmax,\n\tlabel,\n\tabbreviation,\n\tonChange,\n\tvalue,\n}: InputWithSliderProps ) => {\n\tconst onNumberControlChange = ( newValue?: number | string ) => {\n\t\tif ( ! newValue ) {\n\t\t\tonChange( 0 );\n\t\t\treturn;\n\t\t}\n\t\tif ( typeof newValue === 'string' ) {\n\t\t\tonChange( parseInt( newValue, 10 ) );\n\t\t\treturn;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\treturn (\n\t\t<HStack spacing={ 4 }>\n\t\t\t<NumberControlWrapper\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onNumberControlChange }\n\t\t\t\tprefix={\n\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t<Text color={ COLORS.theme.accent } lineHeight={ 1 }>\n\t\t\t\t\t\t\t{ abbreviation }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t}\n\t\t\t\tspinControls=\"none\"\n\t\t\t/>\n\t\t\t<RangeControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185\n\t\t\t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,EAAC;IAAM,CACnB,CAAC,eACFtB,IAAA,CAACL,YAAY;MACZ4B,uBAAuB;MACvBR,qBAAqB;MACrBT,KAAK,EAAGA,KAAO;MACfU,mBAAmB;MACnBZ,GAAG,EAAGA,GAAK;MACXC,GAAG,EAAGA,GAAK;MACXI,KAAK,EAAGA;MACR;MACA;MAAA;MACAD,QAAQ,EAAGA,QAAU;MACrBgB,cAAc,EAAG;IAAO,CACxB,CAAC;EAAA,CACK,CAAC;AAEX,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","_n","sprintf","Component","useState","useMemo","useRef","useEffect","useInstanceId","speak","closeSmall","InputWrapperFlex","TokenInput","SuggestionsList","BaseControl","Button","FlexBlock","withFocusOutside","useControlledValue","normalizeTextString","useDeprecated36pxDefaultSizeProp","withIgnoreIMEEvents","maybeWarnDeprecated36pxSize","jsx","_jsx","jsxs","_jsxs","noop","DetectOutside","handleFocusOutside","event","props","onFocusOutside","render","children","getIndexOfMatchingSuggestion","selectedSuggestion","matchingSuggestions","indexOf","ComboboxControl","_currentOption$label","__nextHasNoMarginBottom","__next40pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","expandOnFocus","placeholder","setValue","currentOption","find","option","currentLabel","instanceId","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","startsWithMatch","containsMatch","match","forEach","index","push","concat","onSuggestionSelected","newSelectedSuggestion","disabled","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onClick","onInputChange","text","handleOnReset","current","focus","handleResetStopPropagation","stopPropagation","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","componentName","size","undefined","__associatedWPComponentName","id","tabIndex","ref","selectedSuggestionIndex","icon","displayTransform","suggestion","suggestions","selectedIndex","onHover","onSelect","scrollIntoView"],"sources":["@wordpress/components/src/combobox-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\nimport type { ComboboxControlOption, ComboboxControlProps } from './types';\nimport type { TokenInputProps } from '../form-token-field/types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst noop = () => {};\n\ninterface DetectOutsideComponentProps {\n\tonFocusOutside: ( event: React.FocusEvent ) => void;\n\tchildren?: React.ReactNode;\n}\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component< DetectOutsideComponentProps > {\n\t\thandleFocusOutside( event: React.FocusEvent ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nconst getIndexOfMatchingSuggestion = (\n\tselectedSuggestion: ComboboxControlOption | null,\n\tmatchingSuggestions: ComboboxControlOption[]\n) =>\n\tselectedSuggestion === null\n\t\t? -1\n\t\t: matchingSuggestions.indexOf( selectedSuggestion );\n\n/**\n * `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of\n * being able to search for options using a search input.\n *\n * ```jsx\n * import { ComboboxControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const options = [\n * \t{\n * \t\tvalue: 'small',\n * \t\tlabel: 'Small',\n * \t},\n * \t{\n * \t\tvalue: 'normal',\n * \t\tlabel: 'Normal',\n * \t\tdisabled: true,\n * \t},\n * \t{\n * \t\tvalue: 'large',\n * \t\tlabel: 'Large',\n * \t\tdisabled: false,\n * \t},\n * ];\n *\n * function MyComboboxControl() {\n * \tconst [ fontSize, setFontSize ] = useState();\n * \tconst [ filteredOptions, setFilteredOptions ] = useState( options );\n * \treturn (\n * \t\t<ComboboxControl\n * \t\t\t__next40pxDefaultSize\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel=\"Font Size\"\n * \t\t\tvalue={ fontSize }\n * \t\t\tonChange={ setFontSize }\n * \t\t\toptions={ filteredOptions }\n * \t\t\tonFilterValueChange={ ( inputValue ) =>\n * \t\t\t\tsetFilteredOptions(\n * \t\t\t\t\toptions.filter( ( option ) =>\n * \t\t\t\t\t\toption.label\n * \t\t\t\t\t\t\t.toLowerCase()\n * \t\t\t\t\t\t\t.startsWith( inputValue.toLowerCase() )\n * \t\t\t\t\t)\n * \t\t\t\t)\n * \t\t\t}\n * \t\t/>\n * \t);\n * }\n * ```\n */\nfunction ComboboxControl( props: ComboboxControlProps ) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tvalue: valueProp,\n\t\tlabel,\n\t\toptions,\n\t\tonChange: onChangeProp,\n\t\tonFilterValueChange = noop,\n\t\thideLabelFromVision,\n\t\thelp,\n\t\tallowReset = true,\n\t\tclassName,\n\t\tmessages = {\n\t\t\tselected: __( 'Item selected.' ),\n\t\t},\n\t\t__experimentalRenderItem,\n\t\texpandOnFocus = true,\n\t\tplaceholder,\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef< HTMLInputElement >( null );\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch: ComboboxControlOption[] = [];\n\t\tconst containsMatch: ComboboxControlOption[] = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options ] );\n\n\tconst onSuggestionSelected = (\n\t\tnewSelectedSuggestion: ComboboxControlOption\n\t) => {\n\t\tif ( newSelectedSuggestion.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = getIndexOfMatchingSuggestion(\n\t\t\tselectedSuggestion,\n\t\t\tmatchingSuggestions\n\t\t);\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown: React.KeyboardEventHandler< HTMLDivElement > =\n\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\tlet preventDefault = false;\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tswitch ( event.code ) {\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tsetIsExpanded( false );\n\t\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( preventDefault ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t} );\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tif ( expandOnFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onClick = () => {\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange: TokenInputProps[ 'onChange' ] = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current?.focus();\n\t};\n\n\t// Stop propagation of the keydown event when pressing Enter on the Reset\n\t// button to prevent calling the onKeydown callback on the container div\n\t// element which actually sets the selected suggestion.\n\tconst handleResetStopPropagation: React.KeyboardEventHandler<\n\t\tHTMLButtonElement\n\t> = ( event ) => {\n\t\tevent.stopPropagation();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tgetIndexOfMatchingSuggestion(\n\t\t\t\tselectedSuggestion,\n\t\t\t\tmatchingSuggestions\n\t\t\t) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'ComboboxControl',\n\t\t__next40pxDefaultSize,\n\t\tsize: undefined,\n\t} );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t__associatedWPComponentName=\"ComboboxControl\"\n\t\t\t\tclassName={ clsx( className, 'components-combobox-control' ) }\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t// Disable reason: Focus returns to input field when reset is clicked.\n\t\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResetStopPropagation }\n\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t// The empty string for `value` here is not actually used, but is\n\t\t\t\t\t\t\t// just a quick way to satisfy the TypeScript requirements of SuggestionsList.\n\t\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330\n\t\t\t\t\t\t\tmatch={ { label: inputValue, value: '' } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,MAAM,EACNC,SAAS,QACH,oBAAoB;AAC3B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,OAAOC,UAAU,MAAM,iCAAiC;AACxD,OAAOC,eAAe,MAAM,sCAAsC;AAClE,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,SAAS,QAAQ,SAAS;AACnC,OAAOC,gBAAgB,MAAM,oCAAoC;AACjE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,mBAAmB,QAAQ,kBAAkB;AAGtD,SAASC,gCAAgC,QAAQ,+BAA+B;AAChF,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,2BAA2B,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5E,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAOrB,MAAMC,aAAa,GAAGX,gBAAgB,CACrC,cAAcd,SAAS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AAU,IAC9BA,UAAU,CAACrE,KACX;UACDsE,WAAW,EAAG9E,mBAAqB;UACnC+E,aAAa,EAAGjF,4BAA4B,CAC3CC,kBAAkB,EAClBC,mBACD,CAAG;UACHgF,OAAO,EAAGpD,qBAAuB;UACjCqD,QAAQ,EAAGtC,oBAAsB;UACjCuC,cAAc;UACd/D,wBAAwB,EACvBA;QACA,CACD,CACD;MAAA,CACG;IAAC,CACM;EAAC,CACA,CAAC;EAEjB;AACD;AAEA,eAAejB,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","_n","sprintf","Component","useState","useMemo","useRef","useEffect","useInstanceId","speak","closeSmall","InputWrapperFlex","TokenInput","SuggestionsList","BaseControl","Button","FlexBlock","withFocusOutside","useControlledValue","normalizeTextString","useDeprecated36pxDefaultSizeProp","withIgnoreIMEEvents","maybeWarnDeprecated36pxSize","jsx","_jsx","jsxs","_jsxs","noop","DetectOutside","handleFocusOutside","event","props","onFocusOutside","render","children","getIndexOfMatchingSuggestion","selectedSuggestion","matchingSuggestions","indexOf","ComboboxControl","_currentOption$label","__nextHasNoMarginBottom","__next40pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","expandOnFocus","placeholder","setValue","currentOption","find","option","currentLabel","instanceId","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","startsWithMatch","containsMatch","match","forEach","index","push","concat","onSuggestionSelected","newSelectedSuggestion","disabled","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onClick","onInputChange","text","handleOnReset","current","focus","handleResetStopPropagation","stopPropagation","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","componentName","size","undefined","__associatedWPComponentName","id","tabIndex","ref","selectedSuggestionIndex","icon","displayTransform","suggestion","suggestions","selectedIndex","onHover","onSelect","scrollIntoView"],"sources":["@wordpress/components/src/combobox-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\nimport type { ComboboxControlOption, ComboboxControlProps } from './types';\nimport type { TokenInputProps } from '../form-token-field/types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst noop = () => {};\n\ninterface DetectOutsideComponentProps {\n\tonFocusOutside: ( event: React.FocusEvent ) => void;\n\tchildren?: React.ReactNode;\n}\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component< DetectOutsideComponentProps > {\n\t\thandleFocusOutside( event: React.FocusEvent ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nconst getIndexOfMatchingSuggestion = (\n\tselectedSuggestion: ComboboxControlOption | null,\n\tmatchingSuggestions: ComboboxControlOption[]\n) =>\n\tselectedSuggestion === null\n\t\t? -1\n\t\t: matchingSuggestions.indexOf( selectedSuggestion );\n\n/**\n * `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of\n * being able to search for options using a search input.\n *\n * ```jsx\n * import { ComboboxControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const options = [\n * \t{\n * \t\tvalue: 'small',\n * \t\tlabel: 'Small',\n * \t},\n * \t{\n * \t\tvalue: 'normal',\n * \t\tlabel: 'Normal',\n * \t\tdisabled: true,\n * \t},\n * \t{\n * \t\tvalue: 'large',\n * \t\tlabel: 'Large',\n * \t\tdisabled: false,\n * \t},\n * ];\n *\n * function MyComboboxControl() {\n * \tconst [ fontSize, setFontSize ] = useState();\n * \tconst [ filteredOptions, setFilteredOptions ] = useState( options );\n * \treturn (\n * \t\t<ComboboxControl\n * \t\t\t__next40pxDefaultSize\n * \t\t\t__nextHasNoMarginBottom\n * \t\t\tlabel=\"Font Size\"\n * \t\t\tvalue={ fontSize }\n * \t\t\tonChange={ setFontSize }\n * \t\t\toptions={ filteredOptions }\n * \t\t\tonFilterValueChange={ ( inputValue ) =>\n * \t\t\t\tsetFilteredOptions(\n * \t\t\t\t\toptions.filter( ( option ) =>\n * \t\t\t\t\t\toption.label\n * \t\t\t\t\t\t\t.toLowerCase()\n * \t\t\t\t\t\t\t.startsWith( inputValue.toLowerCase() )\n * \t\t\t\t\t)\n * \t\t\t\t)\n * \t\t\t}\n * \t\t/>\n * \t);\n * }\n * ```\n */\nfunction ComboboxControl( props: ComboboxControlProps ) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\t__next40pxDefaultSize = false,\n\t\tvalue: valueProp,\n\t\tlabel,\n\t\toptions,\n\t\tonChange: onChangeProp,\n\t\tonFilterValueChange = noop,\n\t\thideLabelFromVision,\n\t\thelp,\n\t\tallowReset = true,\n\t\tclassName,\n\t\tmessages = {\n\t\t\tselected: __( 'Item selected.' ),\n\t\t},\n\t\t__experimentalRenderItem,\n\t\texpandOnFocus = true,\n\t\tplaceholder,\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef< HTMLInputElement >( null );\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch: ComboboxControlOption[] = [];\n\t\tconst containsMatch: ComboboxControlOption[] = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options ] );\n\n\tconst onSuggestionSelected = (\n\t\tnewSelectedSuggestion: ComboboxControlOption\n\t) => {\n\t\tif ( newSelectedSuggestion.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = getIndexOfMatchingSuggestion(\n\t\t\tselectedSuggestion,\n\t\t\tmatchingSuggestions\n\t\t);\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown: React.KeyboardEventHandler< HTMLDivElement > =\n\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\tlet preventDefault = false;\n\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tswitch ( event.code ) {\n\t\t\t\tcase 'Enter':\n\t\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tsetIsExpanded( false );\n\t\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( preventDefault ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t} );\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tif ( expandOnFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onClick = () => {\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange: TokenInputProps[ 'onChange' ] = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current?.focus();\n\t};\n\n\t// Stop propagation of the keydown event when pressing Enter on the Reset\n\t// button to prevent calling the onKeydown callback on the container div\n\t// element which actually sets the selected suggestion.\n\tconst handleResetStopPropagation: React.KeyboardEventHandler<\n\t\tHTMLButtonElement\n\t> = ( event ) => {\n\t\tevent.stopPropagation();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tgetIndexOfMatchingSuggestion(\n\t\t\t\tselectedSuggestion,\n\t\t\t\tmatchingSuggestions\n\t\t\t) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'ComboboxControl',\n\t\t__next40pxDefaultSize,\n\t\tsize: undefined,\n\t} );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t__associatedWPComponentName=\"ComboboxControl\"\n\t\t\t\tclassName={ clsx( className, 'components-combobox-control' ) }\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t// Disable reason: Focus returns to input field when reset is clicked.\n\t\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResetStopPropagation }\n\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t// The empty string for `value` here is not actually used, but is\n\t\t\t\t\t\t\t// just a quick way to satisfy the TypeScript requirements of SuggestionsList.\n\t\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330\n\t\t\t\t\t\t\tmatch={ { label: inputValue, value: '' } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ getIndexOfMatchingSuggestion(\n\t\t\t\t\t\t\t\tselectedSuggestion,\n\t\t\t\t\t\t\t\tmatchingSuggestions\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,MAAM,EACNC,SAAS,QACH,oBAAoB;AAC3B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,OAAOC,UAAU,MAAM,iCAAiC;AACxD,OAAOC,eAAe,MAAM,sCAAsC;AAClE,OAAOC,WAAW,MAAM,iBAAiB;AACzC,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,SAAS,QAAQ,SAAS;AACnC,OAAOC,gBAAgB,MAAM,oCAAoC;AACjE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,mBAAmB,QAAQ,kBAAkB;AAGtD,SAASC,gCAAgC,QAAQ,+BAA+B;AAChF,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,2BAA2B,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5E,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAOrB,MAAMC,aAAa,GAAGX,gBAAgB,CACrC,cAAcd,SAAS,CAAgC;EACtD0B,kBAAkBA,CAAEC,KAAuB,EAAG;IAC7C,IAAI,CAACC,KAAK,CAAC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EAAGjF,4BAA4B,CAC3CC,kBAAkB,EAClBC,mBACD,CAAG;UACHgF,OAAO,EAAGpD,qBAAuB;UACjCqD,QAAQ,EAAGtC,oBAAsB;UACjCuC,cAAc;UACd/D,wBAAwB,EACvBA;QACA,CACD,CACD;MAAA,CACG;IAAC,CACM;EAAC,CACA,CAAC;EAEjB;AACD;AAEA,eAAejB,eAAe","ignoreList":[]}
@@ -22,17 +22,8 @@ export const CompositeItem = forwardRef(function CompositeItem(props, ref) {
22
22
  // legacy compat layer. The `store` prop is documented, but its type is
23
23
  // obfuscated to discourage its use outside of the component's internals.
24
24
  const store = (_props$store = props.store) !== null && _props$store !== void 0 ? _props$store : context.store;
25
-
26
- // If the active item is not connected, Composite may end up in a state
27
- // where none of the items are tabbable. In this case, we force all items to
28
- // be tabbable, so that as soon as an item received focus, it becomes active
29
- // and Composite goes back to working as expected.
30
- const tabbable = Ariakit.useStoreState(store, state => {
31
- return state?.activeId !== null && !store?.item(state?.activeId)?.element?.isConnected;
32
- });
33
25
  return /*#__PURE__*/_jsx(Ariakit.CompositeItem, {
34
26
  store: store,
35
- tabbable: tabbable,
36
27
  ...props,
37
28
  ref: ref
38
29
  });
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","forwardRef","useCompositeContext","jsx","_jsx","CompositeItem","props","ref","_props$store","context","store","tabbable","useStoreState","state","activeId","item","element","isConnected"],"sources":["@wordpress/components/src/composite/item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useCompositeContext } from './context';\nimport type { CompositeItemProps } from './types';\n\nexport const CompositeItem = forwardRef<\n\tHTMLButtonElement,\n\tWordPressComponentProps< CompositeItemProps, 'button', false >\n>( function CompositeItem( props, ref ) {\n\tconst context = useCompositeContext();\n\n\t// @ts-expect-error The store prop is undocumented and only used by the\n\t// legacy compat layer. The `store` prop is documented, but its type is\n\t// obfuscated to discourage its use outside of the component's internals.\n\tconst store = ( props.store ?? context.store ) as Ariakit.CompositeStore;\n\n\t// If the active item is not connected, Composite may end up in a state\n\t// where none of the items are tabbable. In this case, we force all items to\n\t// be tabbable, so that as soon as an item received focus, it becomes active\n\t// and Composite goes back to working as expected.\n\tconst tabbable = Ariakit.useStoreState( store, ( state ) => {\n\t\treturn (\n\t\t\tstate?.activeId !== null &&\n\t\t\t! store?.item( state?.activeId )?.element?.isConnected\n\t\t);\n\t} );\n\n\treturn (\n\t\t<Ariakit.CompositeItem\n\t\t\tstore={ store }\n\t\t\ttabbable={ tabbable }\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;;AAEA,SAASC,mBAAmB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGhD,OAAO,MAAMC,aAAa,GAAGJ,UAAU,CAGpC,SAASI,aAAaA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EAAA,IAAAC,YAAA;EACvC,MAAMC,OAAO,GAAGP,mBAAmB,CAAC,CAAC;;EAErC;EACA;EACA;EACA,MAAMQ,KAAK,IAAAF,YAAA,GAAKF,KAAK,CAACI,KAAK,cAAAF,YAAA,cAAAA,YAAA,GAAIC,OAAO,CAACC,KAAiC;;EAExE;EACA;EACA;EACA;EACA,MAAMC,QAAQ,GAAGX,OAAO,CAACY,aAAa,CAAEF,KAAK,EAAIG,KAAK,IAAM;IAC3D,OACCA,KAAK,EAAEC,QAAQ,KAAK,IAAI,IACxB,CAAEJ,KAAK,EAAEK,IAAI,CAAEF,KAAK,EAAEC,QAAS,CAAC,EAAEE,OAAO,EAAEC,WAAW;EAExD,CAAE,CAAC;EAEH,oBACCb,IAAA,CAACJ,OAAO,CAACK,aAAa;IACrBK,KAAK,EAAGA,KAAO;IACfC,QAAQ,EAAGA,QAAU;IAAA,GAChBL,KAAK;IACVC,GAAG,EAAGA;EAAK,CACX,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","forwardRef","useCompositeContext","jsx","_jsx","CompositeItem","props","ref","_props$store","context","store"],"sources":["@wordpress/components/src/composite/item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useCompositeContext } from './context';\nimport type { CompositeItemProps } from './types';\n\nexport const CompositeItem = forwardRef<\n\tHTMLButtonElement,\n\tWordPressComponentProps< CompositeItemProps, 'button', false >\n>( function CompositeItem( props, ref ) {\n\tconst context = useCompositeContext();\n\n\t// @ts-expect-error The store prop is undocumented and only used by the\n\t// legacy compat layer. The `store` prop is documented, but its type is\n\t// obfuscated to discourage its use outside of the component's internals.\n\tconst store = ( props.store ?? context.store ) as Ariakit.CompositeStore;\n\n\treturn <Ariakit.CompositeItem store={ store } { ...props } ref={ ref } />;\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;;AAEA,SAASC,mBAAmB,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGhD,OAAO,MAAMC,aAAa,GAAGJ,UAAU,CAGpC,SAASI,aAAaA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EAAA,IAAAC,YAAA;EACvC,MAAMC,OAAO,GAAGP,mBAAmB,CAAC,CAAC;;EAErC;EACA;EACA;EACA,MAAMQ,KAAK,IAAAF,YAAA,GAAKF,KAAK,CAACI,KAAK,cAAAF,YAAA,cAAAA,YAAA,GAAIC,OAAO,CAACC,KAAiC;EAExE,oBAAON,IAAA,CAACJ,OAAO,CAACK,aAAa;IAACK,KAAK,EAAGA,KAAO;IAAA,GAAMJ,KAAK;IAAGC,GAAG,EAAGA;EAAK,CAAE,CAAC;AAC1E,CAAE,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * Composite is a component that may contain navigable items represented by
3
4
  * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","forwardRef","useInstanceId","deprecated","Composite","Current","jsx","_jsx","mapLegacyStatePropsToComponentProps","legacyProps","state","rest","store","props","LEGACY_TO_NEW_DISPLAY_NAME","__unstableComposite","__unstableCompositeGroup","__unstableCompositeItem","__unstableUseCompositeState","proxyComposite","ProxiedComponent","propMap","_ProxiedComponent$dis","displayName","Component","since","alternative","hasOwnProperty","undefined","id","baseId","Object","entries","forEach","from","to","assign","UnproxiedCompositeGroup","role","ref","Row","Group","CompositeGroup","CompositeItem","Item","focusable","useCompositeState","legacyStateOptions","currentId","defaultActiveId","orientation","rtl","loop","focusLoop","wrap","focusWrap","shift","focusShift","unstable_virtual","virtualFocus","useCompositeStore"],"sources":["@wordpress/components/src/composite/legacy/index.tsx"],"sourcesContent":["/**\n * Composite is a component that may contain navigable items represented by\n * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements\n * all the keyboard navigation mechanisms to ensure that there's only one\n * tab stop for the whole Composite element. This means that it can behave as\n * a roving tabindex or aria-activedescendant container.\n *\n * This file aims at providing components that are as close as possible to the\n * original `reakit`-based implementation (which was removed from the codebase),\n * although it is recommended that consumers of the package switch to the stable,\n * un-prefixed, `ariakit`-based version of `Composite`.\n *\n * @see https://ariakit.org/components/composite\n */\n\n/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Composite as Current } from '..';\n\ntype Orientation = 'horizontal' | 'vertical';\n\nexport interface LegacyStateOptions {\n\t/**\n\t * ID that will serve as a base for all the items IDs.\n\t */\n\tbaseId?: string;\n\t/**\n\t * Determines how next and previous functions will behave. If `rtl` is set\n\t * to `true`, they will be inverted. This only affects the composite widget\n\t * behavior. You still need to set `dir=\"rtl\"` on HTML/CSS.\n\t *\n\t * @default false\n\t */\n\trtl?: boolean;\n\t/**\n\t * Defines the orientation of the composite widget. If the composite has a\n\t * single row or column (one-dimensional), the orientation value determines\n\t * which arrow keys can be used to move focus.\n\t */\n\torientation?: Orientation;\n\t/**\n\t * The current focused item `id`.\n\t */\n\tcurrentId?: string;\n\t/**\n\t * Determines how focus moves from the start and end of rows and columns.\n\t *\n\t * @default false\n\t */\n\tloop?: boolean | Orientation;\n\t/**\n\t * If enabled, moving to the next item from the last one in a row or column\n\t * will focus the first item in the next row or column and vice-versa.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\twrap?: boolean | Orientation;\n\t/**\n\t * If enabled, moving up or down when there's no next item or the next item\n\t * is disabled will shift to the item right before it.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\tshift?: boolean;\n\tunstable_virtual?: boolean;\n}\n\ntype Component = React.FunctionComponent< any >;\n\ntype CompositeStore = ReturnType< typeof Ariakit.useCompositeStore >;\ntype CompositeStoreState = { store: CompositeStore };\nexport type CompositeState = CompositeStoreState &\n\tRequired< Pick< LegacyStateOptions, 'baseId' > >;\n\n// Legacy composite components can either provide state through a\n// single `state` prop, or via individual props, usually through\n// spreading the state generated by `useCompositeState`.\n// That is, `<Composite* { ...state }>`.\nexport type CompositeStateProps =\n\t| { state: CompositeState }\n\t| ( CompositeState & { state?: never } );\ntype ComponentProps< C extends Component > = React.ComponentPropsWithRef< C >;\nexport type CompositeProps< C extends Component > = ComponentProps< C > &\n\tCompositeStateProps;\ntype CompositeComponent< C extends Component > = (\n\tprops: CompositeProps< C >\n) => React.ReactElement;\ntype CompositeComponentProps = CompositeState &\n\t(\n\t\t| ComponentProps< typeof Current.Group >\n\t\t| ComponentProps< typeof Current.Item >\n\t\t| ComponentProps< typeof Current.Row >\n\t);\n\nfunction mapLegacyStatePropsToComponentProps(\n\tlegacyProps: CompositeStateProps\n): CompositeComponentProps {\n\t// If a `state` prop is provided, we unpack that; otherwise,\n\t// the necessary props are provided directly in `legacyProps`.\n\tif ( legacyProps.state ) {\n\t\tconst { state, ...rest } = legacyProps;\n\t\tconst { store, ...props } =\n\t\t\tmapLegacyStatePropsToComponentProps( state );\n\t\treturn { ...rest, ...props, store };\n\t}\n\n\treturn legacyProps;\n}\n\nconst LEGACY_TO_NEW_DISPLAY_NAME = {\n\t__unstableComposite: 'Composite',\n\t__unstableCompositeGroup: 'Composite.Group or Composite.Row',\n\t__unstableCompositeItem: 'Composite.Item',\n\t__unstableUseCompositeState: 'Composite',\n};\n\nfunction proxyComposite< C extends Component >(\n\tProxiedComponent: C | React.ForwardRefExoticComponent< C >,\n\tpropMap: Record< string, string > = {}\n): CompositeComponent< C > {\n\tconst displayName = ProxiedComponent.displayName ?? '';\n\n\tconst Component = ( legacyProps: CompositeStateProps ) => {\n\t\tdeprecated( `wp.components.${ displayName }`, {\n\t\t\tsince: '6.7',\n\t\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty(\n\t\t\t\tdisplayName\n\t\t\t)\n\t\t\t\t? LEGACY_TO_NEW_DISPLAY_NAME[\n\t\t\t\t\t\tdisplayName as keyof typeof LEGACY_TO_NEW_DISPLAY_NAME\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t} );\n\n\t\tconst { store, ...rest } =\n\t\t\tmapLegacyStatePropsToComponentProps( legacyProps );\n\t\tlet props = rest as ComponentProps< C >;\n\t\tprops = {\n\t\t\t...props,\n\t\t\tid: useInstanceId( store, props.baseId, props.id ),\n\t\t};\n\n\t\tObject.entries( propMap ).forEach( ( [ from, to ] ) => {\n\t\t\tif ( props.hasOwnProperty( from ) ) {\n\t\t\t\tObject.assign( props, { [ to ]: props[ from ] } );\n\t\t\t\tdelete props[ from ];\n\t\t\t}\n\t\t} );\n\n\t\tdelete props.baseId;\n\n\t\treturn <ProxiedComponent { ...props } store={ store } />;\n\t};\n\tComponent.displayName = displayName;\n\treturn Component;\n}\n\n// The old `CompositeGroup` used to behave more like the current\n// `CompositeRow`, but this has been split into two different\n// components. We handle that difference by checking on the\n// provided role, and returning the appropriate component.\nconst UnproxiedCompositeGroup = forwardRef<\n\tany,\n\tReact.ComponentPropsWithoutRef< typeof Current.Group | typeof Current.Row >\n>( ( { role, ...props }, ref ) => {\n\tconst Component = role === 'row' ? Current.Row : Current.Group;\n\treturn <Component ref={ ref } role={ role } { ...props } />;\n} );\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport const Composite = proxyComposite(\n\tObject.assign( Current, { displayName: '__unstableComposite' } ),\n\t{ baseId: 'id' }\n);\n/**\n * _Note: please use the `Composite.Row` or `Composite.Group` components instead._\n *\n * @deprecated\n */\nexport const CompositeGroup = proxyComposite(\n\tObject.assign( UnproxiedCompositeGroup, {\n\t\tdisplayName: '__unstableCompositeGroup',\n\t} )\n);\n/**\n * _Note: please use the `Composite.Item` component instead._\n *\n * @deprecated\n */\nexport const CompositeItem = proxyComposite(\n\tObject.assign( Current.Item, {\n\t\tdisplayName: '__unstableCompositeItem',\n\t} ),\n\t{\n\t\tfocusable: 'accessibleWhenDisabled',\n\t}\n);\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport function useCompositeState(\n\tlegacyStateOptions: LegacyStateOptions = {}\n): CompositeState {\n\tdeprecated( `wp.components.__unstableUseCompositeState`, {\n\t\tsince: '6.7',\n\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState,\n\t} );\n\n\tconst {\n\t\tbaseId,\n\t\tcurrentId: defaultActiveId,\n\t\torientation,\n\t\trtl = false,\n\t\tloop: focusLoop = false,\n\t\twrap: focusWrap = false,\n\t\tshift: focusShift = false,\n\t\t// eslint-disable-next-line camelcase\n\t\tunstable_virtual: virtualFocus,\n\t} = legacyStateOptions;\n\n\treturn {\n\t\tbaseId: useInstanceId( Composite, 'composite', baseId ),\n\t\tstore: Ariakit.useCompositeStore( {\n\t\t\tdefaultActiveId,\n\t\t\trtl,\n\t\t\torientation,\n\t\t\tfocusLoop,\n\t\t\tfocusShift,\n\t\t\tfocusWrap,\n\t\t\tvirtualFocus,\n\t\t} ),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,SAAS,IAAIC,OAAO,QAAQ,IAAI;;AA6DzC;AACA;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAiBA,SAASC,mCAAmCA,CAC3CC,WAAgC,EACN;EAC1B;EACA;EACA,IAAKA,WAAW,CAACC,KAAK,EAAG;IACxB,MAAM;MAAEA,KAAK;MAAE,GAAGC;IAAK,CAAC,GAAGF,WAAW;IACtC,MAAM;MAAEG,KAAK;MAAE,GAAGC;IAAM,CAAC,GACxBL,mCAAmC,CAAEE,KAAM,CAAC;IAC7C,OAAO;MAAE,GAAGC,IAAI;MAAE,GAAGE,KAAK;MAAED;IAAM,CAAC;EACpC;EAEA,OAAOH,WAAW;AACnB;AAEA,MAAMK,0BAA0B,GAAG;EAClCC,mBAAmB,EAAE,WAAW;EAChCC,wBAAwB,EAAE,kCAAkC;EAC5DC,uBAAuB,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1BC,WAAW;IACXC,GAAG,GAAG,KAAK;IACXC,IAAI,EAAEC,SAAS,GAAG,KAAK;IACvBC,IAAI,EAAEC,SAAS,GAAG,KAAK;IACvBC,KAAK,EAAEC,UAAU,GAAG,KAAK;IACzB;IACAC,gBAAgB,EAAEC;EACnB,CAAC,GAAGZ,kBAAkB;EAEtB,OAAO;IACNjB,MAAM,EAAE5B,aAAa,CAAEE,SAAS,EAAE,WAAW,EAAE0B,MAAO,CAAC;IACvDlB,KAAK,EAAEZ,OAAO,CAAC4D,iBAAiB,CAAE;MACjCX,eAAe;MACfE,GAAG;MACHD,WAAW;MACXG,SAAS;MACTI,UAAU;MACVF,SAAS;MACTI;IACD,CAAE;EACH,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","forwardRef","useInstanceId","deprecated","Composite","Current","jsx","_jsx","mapLegacyStatePropsToComponentProps","legacyProps","state","rest","store","props","LEGACY_TO_NEW_DISPLAY_NAME","__unstableComposite","__unstableCompositeGroup","__unstableCompositeItem","__unstableUseCompositeState","proxyComposite","ProxiedComponent","propMap","_ProxiedComponent$dis","displayName","Component","since","alternative","hasOwnProperty","undefined","id","baseId","Object","entries","forEach","from","to","assign","UnproxiedCompositeGroup","role","ref","Row","Group","CompositeGroup","CompositeItem","Item","focusable","useCompositeState","legacyStateOptions","currentId","defaultActiveId","orientation","rtl","loop","focusLoop","wrap","focusWrap","shift","focusShift","unstable_virtual","virtualFocus","useCompositeStore"],"sources":["@wordpress/components/src/composite/legacy/index.tsx"],"sourcesContent":["/**\n * Composite is a component that may contain navigable items represented by\n * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements\n * all the keyboard navigation mechanisms to ensure that there's only one\n * tab stop for the whole Composite element. This means that it can behave as\n * a roving tabindex or aria-activedescendant container.\n *\n * This file aims at providing components that are as close as possible to the\n * original `reakit`-based implementation (which was removed from the codebase),\n * although it is recommended that consumers of the package switch to the stable,\n * un-prefixed, `ariakit`-based version of `Composite`.\n *\n * @see https://ariakit.org/components/composite\n */\n\n/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Composite as Current } from '..';\n\ntype Orientation = 'horizontal' | 'vertical';\n\nexport interface LegacyStateOptions {\n\t/**\n\t * ID that will serve as a base for all the items IDs.\n\t */\n\tbaseId?: string;\n\t/**\n\t * Determines how next and previous functions will behave. If `rtl` is set\n\t * to `true`, they will be inverted. This only affects the composite widget\n\t * behavior. You still need to set `dir=\"rtl\"` on HTML/CSS.\n\t *\n\t * @default false\n\t */\n\trtl?: boolean;\n\t/**\n\t * Defines the orientation of the composite widget. If the composite has a\n\t * single row or column (one-dimensional), the orientation value determines\n\t * which arrow keys can be used to move focus.\n\t */\n\torientation?: Orientation;\n\t/**\n\t * The current focused item `id`.\n\t */\n\tcurrentId?: string;\n\t/**\n\t * Determines how focus moves from the start and end of rows and columns.\n\t *\n\t * @default false\n\t */\n\tloop?: boolean | Orientation;\n\t/**\n\t * If enabled, moving to the next item from the last one in a row or column\n\t * will focus the first item in the next row or column and vice-versa.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\twrap?: boolean | Orientation;\n\t/**\n\t * If enabled, moving up or down when there's no next item or the next item\n\t * is disabled will shift to the item right before it.\n\t *\n\t * ** Has effect only on two-dimensional composites. **\n\t *\n\t * @default false\n\t */\n\tshift?: boolean;\n\tunstable_virtual?: boolean;\n}\n\ntype Component = React.FunctionComponent< any >;\n\ntype CompositeStore = ReturnType< typeof Ariakit.useCompositeStore >;\ntype CompositeStoreState = { store: CompositeStore };\nexport type CompositeState = CompositeStoreState &\n\tRequired< Pick< LegacyStateOptions, 'baseId' > >;\n\n// Legacy composite components can either provide state through a\n// single `state` prop, or via individual props, usually through\n// spreading the state generated by `useCompositeState`.\n// That is, `<Composite* { ...state }>`.\nexport type CompositeStateProps =\n\t| { state: CompositeState }\n\t| ( CompositeState & { state?: never } );\ntype ComponentProps< C extends Component > = React.ComponentPropsWithRef< C >;\nexport type CompositeProps< C extends Component > = ComponentProps< C > &\n\tCompositeStateProps;\ntype CompositeComponent< C extends Component > = (\n\tprops: CompositeProps< C >\n) => React.ReactElement;\ntype CompositeComponentProps = CompositeState &\n\t(\n\t\t| ComponentProps< typeof Current.Group >\n\t\t| ComponentProps< typeof Current.Item >\n\t\t| ComponentProps< typeof Current.Row >\n\t);\n\nfunction mapLegacyStatePropsToComponentProps(\n\tlegacyProps: CompositeStateProps\n): CompositeComponentProps {\n\t// If a `state` prop is provided, we unpack that; otherwise,\n\t// the necessary props are provided directly in `legacyProps`.\n\tif ( legacyProps.state ) {\n\t\tconst { state, ...rest } = legacyProps;\n\t\tconst { store, ...props } =\n\t\t\tmapLegacyStatePropsToComponentProps( state );\n\t\treturn { ...rest, ...props, store };\n\t}\n\n\treturn legacyProps;\n}\n\nconst LEGACY_TO_NEW_DISPLAY_NAME = {\n\t__unstableComposite: 'Composite',\n\t__unstableCompositeGroup: 'Composite.Group or Composite.Row',\n\t__unstableCompositeItem: 'Composite.Item',\n\t__unstableUseCompositeState: 'Composite',\n};\n\nfunction proxyComposite< C extends Component >(\n\tProxiedComponent: C | React.ForwardRefExoticComponent< C >,\n\tpropMap: Record< string, string > = {}\n): CompositeComponent< C > {\n\tconst displayName = ProxiedComponent.displayName ?? '';\n\n\tconst Component = ( legacyProps: CompositeStateProps ) => {\n\t\tdeprecated( `wp.components.${ displayName }`, {\n\t\t\tsince: '6.7',\n\t\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty(\n\t\t\t\tdisplayName\n\t\t\t)\n\t\t\t\t? LEGACY_TO_NEW_DISPLAY_NAME[\n\t\t\t\t\t\tdisplayName as keyof typeof LEGACY_TO_NEW_DISPLAY_NAME\n\t\t\t\t ]\n\t\t\t\t: undefined,\n\t\t} );\n\n\t\tconst { store, ...rest } =\n\t\t\tmapLegacyStatePropsToComponentProps( legacyProps );\n\t\tlet props = rest as ComponentProps< C >;\n\t\tprops = {\n\t\t\t...props,\n\t\t\tid: useInstanceId( store, props.baseId, props.id ),\n\t\t};\n\n\t\tObject.entries( propMap ).forEach( ( [ from, to ] ) => {\n\t\t\tif ( props.hasOwnProperty( from ) ) {\n\t\t\t\tObject.assign( props, { [ to ]: props[ from ] } );\n\t\t\t\tdelete props[ from ];\n\t\t\t}\n\t\t} );\n\n\t\tdelete props.baseId;\n\n\t\treturn <ProxiedComponent { ...props } store={ store } />;\n\t};\n\tComponent.displayName = displayName;\n\treturn Component;\n}\n\n// The old `CompositeGroup` used to behave more like the current\n// `CompositeRow`, but this has been split into two different\n// components. We handle that difference by checking on the\n// provided role, and returning the appropriate component.\nconst UnproxiedCompositeGroup = forwardRef<\n\tany,\n\tReact.ComponentPropsWithoutRef< typeof Current.Group | typeof Current.Row >\n>( ( { role, ...props }, ref ) => {\n\tconst Component = role === 'row' ? Current.Row : Current.Group;\n\treturn <Component ref={ ref } role={ role } { ...props } />;\n} );\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport const Composite = proxyComposite(\n\tObject.assign( Current, { displayName: '__unstableComposite' } ),\n\t{ baseId: 'id' }\n);\n/**\n * _Note: please use the `Composite.Row` or `Composite.Group` components instead._\n *\n * @deprecated\n */\nexport const CompositeGroup = proxyComposite(\n\tObject.assign( UnproxiedCompositeGroup, {\n\t\tdisplayName: '__unstableCompositeGroup',\n\t} )\n);\n/**\n * _Note: please use the `Composite.Item` component instead._\n *\n * @deprecated\n */\nexport const CompositeItem = proxyComposite(\n\tObject.assign( Current.Item, {\n\t\tdisplayName: '__unstableCompositeItem',\n\t} ),\n\t{\n\t\tfocusable: 'accessibleWhenDisabled',\n\t}\n);\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport function useCompositeState(\n\tlegacyStateOptions: LegacyStateOptions = {}\n): CompositeState {\n\tdeprecated( `wp.components.__unstableUseCompositeState`, {\n\t\tsince: '6.7',\n\t\talternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState,\n\t} );\n\n\tconst {\n\t\tbaseId,\n\t\tcurrentId: defaultActiveId,\n\t\torientation,\n\t\trtl = false,\n\t\tloop: focusLoop = false,\n\t\twrap: focusWrap = false,\n\t\tshift: focusShift = false,\n\t\t// eslint-disable-next-line camelcase\n\t\tunstable_virtual: virtualFocus,\n\t} = legacyStateOptions;\n\n\treturn {\n\t\tbaseId: useInstanceId( Composite, 'composite', baseId ),\n\t\tstore: Ariakit.useCompositeStore( {\n\t\t\tdefaultActiveId,\n\t\t\trtl,\n\t\t\torientation,\n\t\t\tfocusLoop,\n\t\t\tfocusShift,\n\t\t\tfocusWrap,\n\t\t\tvirtualFocus,\n\t\t} ),\n\t};\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,SAAS,IAAIC,OAAO,QAAQ,IAAI;;AA6DzC;AACA;AACA;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAiBA,SAASC,mCAAmCA,CAC3CC,WAAgC,EACN;EAC1B;EACA;EACA,IAAKA,WAAW,CAACC,KAAK,EAAG;IACxB,MAAM;MAAEA,KAAK;MAAE,GAAGC;IAAK,CAAC,GAAGF,WAAW;IACtC,MAAM;MAAEG,KAAK;MAAE,GAAGC;IAAM,CAAC,GACxBL,mCAAmC,CAAEE,KAAM,CAAC;IAC7C,OAAO;MAAE,GAAGC,IAAI;MAAE,GAAGE,KAAK;MAAED;IAAM,CAAC;EAC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xDsB,KAAK,EAAE,KAAK;IACZC,WAAW,EAAEZ,0BAA0B,CAACI;EACzC,CAAE,CAAC;EAEH,MAAM;IACLY,MAAM;IACNkB,SAAS,EAAEC,eAAe;IAC1BC,WAAW;IACXC,GAAG,GAAG,KAAK;IACXC,IAAI,EAAEC,SAAS,GAAG,KAAK;IACvBC,IAAI,EAAEC,SAAS,GAAG,KAAK;IACvBC,KAAK,EAAEC,UAAU,GAAG,KAAK;IACzB;IACAC,gBAAgB,EAAEC;EACnB,CAAC,GAAGZ,kBAAkB;EAEtB,OAAO;IACNjB,MAAM,EAAE5B,aAAa,CAAEE,SAAS,EAAE,WAAW,EAAE0B,MAAO,CAAC;IACvDlB,KAAK,EAAEZ,OAAO,CAAC4D,iBAAiB,CAAE;MACjCX,eAAe;MACfE,GAAG;MACHD,WAAW;MACXG,SAAS;MACTI,UAAU;MACVF,SAAS;MACTI;IACD,CAAE;EACH,CAAC;AACF","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -40,6 +41,7 @@ function ControlPointButton({
40
41
  "aria-describedby": descriptionId,
41
42
  "aria-haspopup": "true",
42
43
  "aria-expanded": isOpen,
44
+ __next40pxDefaultSize: true,
43
45
  className: clsx('components-custom-gradient-picker__control-point-button', {
44
46
  'is-active': isOpen
45
47
  }),
@@ -220,6 +222,7 @@ function InsertPoint({
220
222
  isOpen,
221
223
  onToggle
222
224
  }) => /*#__PURE__*/_jsx(Button, {
225
+ __next40pxDefaultSize: true,
223
226
  "aria-expanded": isOpen,
224
227
  "aria-haspopup": "true",
225
228
  onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","colord","useInstanceId","useEffect","useRef","useState","useMemo","__","sprintf","plus","Button","HStack","ColorPicker","VisuallyHidden","CustomColorPickerDropdown","addControlPoint","clampPercent","removeControlPoint","updateControlPointColor","updateControlPointColorByPosition","updateControlPointPosition","getHorizontalRelativeGradientPosition","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","DropdownContentWrapper","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","children","className","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","placement","offset","resize","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveStateRef","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","renderContent","paddingSize","enableAlpha","toRgbString","length","alignment","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","icon"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: 1: gradient position e.g: 70. 2: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = clsx(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveStateRef = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveStateRef.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveStateRef.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveStateRef.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\t\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}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AAW,CAAC,CAC7B,CACD,CAAC;UACF;QACD;MAAG,CACH;IAAC,CACqB,CACtB;IACHI,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAE,GAAIK,cAAc,GAAI;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACDjC;EACH,CACD,CAAC;AAEJ;AACAf,aAAa,CAACiD,WAAW,GAAGA,WAAW;AAEvC,eAAejD,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["clsx","colord","useInstanceId","useEffect","useRef","useState","useMemo","__","sprintf","plus","Button","HStack","ColorPicker","VisuallyHidden","CustomColorPickerDropdown","addControlPoint","clampPercent","removeControlPoint","updateControlPointColor","updateControlPointColorByPosition","updateControlPointPosition","getHorizontalRelativeGradientPosition","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","DropdownContentWrapper","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","children","__next40pxDefaultSize","className","id","GradientColorPickerDropdown","isRenderedInSidebar","props","popoverProps","placement","offset","resize","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveStateRef","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","onClose","renderToggle","onToggle","onClick","onMouseDown","addEventListener","onKeyDown","code","stopPropagation","renderContent","paddingSize","enableAlpha","toRgbString","length","alignment","variant","style","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","icon"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useRef, useState, useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport { HStack } from '../../h-stack';\nimport { ColorPicker } from '../../color-picker';\nimport { VisuallyHidden } from '../../visually-hidden';\nimport { CustomColorPickerDropdown } from '../../color-palette';\n\nimport {\n\taddControlPoint,\n\tclampPercent,\n\tremoveControlPoint,\n\tupdateControlPointColor,\n\tupdateControlPointColorByPosition,\n\tupdateControlPointPosition,\n\tgetHorizontalRelativeGradientPosition,\n} from './utils';\nimport {\n\tMINIMUM_SIGNIFICANT_MOVE,\n\tKEYBOARD_CONTROL_POINT_VARIATION,\n} from './constants';\nimport type { WordPressComponentProps } from '../../context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\nimport DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';\n\nfunction ControlPointButton( {\n\tisOpen,\n\tposition,\n\tcolor,\n\t...additionalProps\n}: WordPressComponentProps< ControlPointButtonProps, 'button', true > ) {\n\tconst instanceId = useInstanceId( ControlPointButton );\n\tconst descriptionId = `components-custom-gradient-picker__control-point-button-description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t// translators: 1: gradient position e.g: 70. 2: gradient color code e.g: rgb(52,121,151).\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Gradient control point at position %1$s%% with color code %2$s.'\n\t\t\t\t\t),\n\t\t\t\t\tposition,\n\t\t\t\t\tcolor\n\t\t\t\t) }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\taria-haspopup=\"true\"\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'components-custom-gradient-picker__control-point-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isOpen,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ __(\n\t\t\t\t\t'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.'\n\t\t\t\t) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n\nfunction GradientColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tclassName,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() =>\n\t\t\t( {\n\t\t\t\tplacement: 'bottom',\n\t\t\t\toffset: 8,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t} ) as const,\n\t\t[]\n\t);\n\n\tconst mergedClassName = clsx(\n\t\t'components-custom-gradient-picker__control-point-dropdown',\n\t\tclassName\n\t);\n\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName={ mergedClassName }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ControlPoints( {\n\tdisableRemove,\n\tdisableAlpha,\n\tgradientPickerDomRef,\n\tignoreMarkerPosition,\n\tvalue: controlPoints,\n\tonChange,\n\tonStartControlPointChange,\n\tonStopControlPointChange,\n\t__experimentalIsRenderedInSidebar,\n}: ControlPointsProps ) {\n\tconst controlPointMoveStateRef = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveStateRef.current === undefined ||\n\t\t\tgradientPickerDomRef.current === null\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveStateRef.current;\n\n\t\tif (\n\t\t\t! significantMoveHappened &&\n\t\t\tMath.abs( initialPosition - relativePosition ) >=\n\t\t\t\tMINIMUM_SIGNIFICANT_MOVE\n\t\t) {\n\t\t\tcontrolPointMoveStateRef.current.significantMoveHappened = true;\n\t\t}\n\n\t\tonChange(\n\t\t\tupdateControlPointPosition( controlPoints, index, relativePosition )\n\t\t);\n\t};\n\n\tconst cleanEventListeners = () => {\n\t\tif (\n\t\t\twindow &&\n\t\t\twindow.removeEventListener &&\n\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated\n\t\t) {\n\t\t\twindow.removeEventListener( 'mousemove', onMouseMove );\n\t\t\twindow.removeEventListener( 'mouseup', cleanEventListeners );\n\t\t\tonStopControlPointChange();\n\t\t\tcontrolPointMoveStateRef.current.listenersActivated = false;\n\t\t}\n\t};\n\n\t// Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`\n\t// This memoization would prevent the event listeners from being properly cleaned.\n\t// Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.\n\tconst cleanEventListenersRef = useRef< () => void >();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current?.();\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ controlPoints.map( ( point, index ) => {\n\t\t\t\tconst initialPosition = point?.position;\n\t\t\t\treturn (\n\t\t\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\t\t\tisRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current\n\t\t\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\twindow &&\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveStateRef.current = {\n\t\t\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\t\t\tcleanEventListeners\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t\tevent.code === 'ArrowRight'\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t// Stop propagation of the key press event to avoid focus moving\n\t\t\t\t\t\t\t\t\t\t\t// to another editor area.\n\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpoint.position +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tKEYBOARD_CONTROL_POINT_VARIATION\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolord(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolor\n\t\t\t\t\t\t\t\t\t\t\t\t\t).toRgbString()\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\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\t\t{ ! disableRemove &&\n\t\t\t\t\t\t\t\t\t\tcontrolPoints.length > 2 && (\n\t\t\t\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point-wrapper\"\n\t\t\t\t\t\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove Control Point'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nfunction InsertPoint( {\n\tvalue: controlPoints,\n\tonChange,\n\tonOpenInserter,\n\tonCloseInserter,\n\tinsertPosition,\n\tdisableAlpha,\n\t__experimentalIsRenderedInSidebar,\n}: InsertPointProps ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\tclassName=\"components-custom-gradient-picker__inserter\"\n\t\t\tonClose={ () => {\n\t\t\t\tonCloseInserter();\n\t\t\t} }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\tonCloseInserter();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( false );\n\t\t\t\t\t\t\tonOpenInserter();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonToggle();\n\t\t\t\t\t} }\n\t\t\t\t\tclassName=\"components-custom-gradient-picker__insert-point-dropdown\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t\tstyle={\n\t\t\t\tinsertPosition !== null\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\t\t\t\t\t\ttransform: 'translateX( -50% )',\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,MAAM,QAAQ,QAAQ;;AAE/B;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACzE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,MAAM,QAAQ,eAAe;AACtC,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,yBAAyB,QAAQ,qBAAqB;AAE/D,SACCC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,uBAAuB,EACvBC,iCAAiC,EACjCC,0BAA0B,EAC1BC,qCAAqC,QAC/B,SAAS;AAChB,SACCC,wBAAwB,EAC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MACX,CAAG;MACH1C,SAAS,EAAC,0DAA0D;MACpEiE,IAAI,EAAGhG;IAAM,CACb,CACC;IACHgF,aAAa,EAAGA,CAAA,kBACf/D,IAAA,CAACF,sBAAsB;MAACkE,WAAW,EAAC,MAAM;MAAApD,QAAA,eACzCZ,IAAA,CAACd,WAAW;QACX+E,WAAW,EAAG,CAAEvC,YAAc;QAC9BK,QAAQ,EAAKvB,KAAK,IAAM;UACvB,IAAK,CAAEqE,oBAAoB,EAAG;YAC7B9C,QAAQ,CACP1C,eAAe,CACdyC,aAAa,EACb8C,cAAc,EACdrG,MAAM,CAAEiC,KAAM,CAAC,CAAC0D,WAAW,CAAC,CAC7B,CACD,CAAC;YACDY,uBAAuB,CAAE,IAAK,CAAC;UAChC,CAAC,MAAM;YACN/C,QAAQ,CACPtC,iCAAiC,CAChCqC,aAAa,EACb8C,cAAc,EACdrG,MAAM,CAAEiC,KAAM,CAAC,CAAC0D,WAAW,CAAC,CAC7B,CACD,CAAC;UACF;QACD;MAAG,CACH;IAAC,CACqB,CACtB;IACHI,KAAK,EACJM,cAAc,KAAK,IAAI,GACpB;MACAL,IAAI,EAAE,GAAIK,cAAc,GAAI;MAC5BJ,SAAS,EAAE;IACX,CAAC,GACDjC;EACH,CACD,CAAC;AAEJ;AACAf,aAAa,CAACiD,WAAW,GAAGA,WAAW;AAEvC,eAAejD,aAAa","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useRef","useReducer","ControlPoints","getHorizontalRelativeGradientPosition","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","jsx","_jsx","jsxs","_jsxs","customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","__experimentalIsRenderedInSidebar","gradientMarkersContainerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","current","clientX","some","position","Math","abs","onMouseLeave","isMovingInserter","isInsertingControlPoint","className","onMouseEnter","onMouseMove","children","style","opacity","ref","InsertPoint","onOpenInserter","onCloseInserter","disableRemove","gradientPickerDomRef","ignoreMarkerPosition","undefined","onStartControlPointChange","onStopControlPointChange"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useReducer } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ControlPoints from './control-points';\nimport { getHorizontalRelativeGradientPosition } from './utils';\nimport { MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT } from './constants';\nimport type {\n\tCustomGradientBarProps,\n\tCustomGradientBarReducerState,\n\tCustomGradientBarReducerAction,\n\tCustomGradientBarIdleState,\n} from '../types';\nimport type { MouseEventHandler } from 'react';\n\nconst customGradientBarReducer = (\n\tstate: CustomGradientBarReducerState,\n\taction: CustomGradientBarReducerAction\n): CustomGradientBarReducerState => {\n\tswitch ( action.type ) {\n\t\tcase 'MOVE_INSERTER':\n\t\t\tif ( state.id === 'IDLE' || state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'MOVING_INSERTER',\n\t\t\t\t\tinsertPosition: action.insertPosition,\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'STOP_INSERTER_MOVE':\n\t\t\tif ( state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'OPEN_INSERTER':\n\t\t\tif ( state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'INSERTING_CONTROL_POINT',\n\t\t\t\t\tinsertPosition: state.insertPosition,\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'CLOSE_INSERTER':\n\t\t\tif ( state.id === 'INSERTING_CONTROL_POINT' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'START_CONTROL_CHANGE':\n\t\t\tif ( state.id === 'IDLE' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'MOVING_CONTROL_POINT',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'STOP_CONTROL_CHANGE':\n\t\t\tif ( state.id === 'MOVING_CONTROL_POINT' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn state;\n};\nconst customGradientBarReducerInitialState: CustomGradientBarIdleState = {\n\tid: 'IDLE',\n};\n\nexport default function CustomGradientBar( {\n\tbackground,\n\thasGradient,\n\tvalue: controlPoints,\n\tonChange,\n\tdisableInserter = false,\n\tdisableAlpha = false,\n\t__experimentalIsRenderedInSidebar = false,\n}: CustomGradientBarProps ) {\n\tconst gradientMarkersContainerDomRef = useRef< HTMLDivElement >( null );\n\n\tconst [ gradientBarState, gradientBarStateDispatch ] = useReducer(\n\t\tcustomGradientBarReducer,\n\t\tcustomGradientBarReducerInitialState\n\t);\n\tconst onMouseEnterAndMove: MouseEventHandler< HTMLDivElement > = (\n\t\tevent\n\t) => {\n\t\tif ( ! gradientMarkersContainerDomRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst insertPosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientMarkersContainerDomRef.current\n\t\t);\n\n\t\t// If the insert point is close to an existing control point don't show it.\n\t\tif (\n\t\t\tcontrolPoints.some( ( { position } ) => {\n\t\t\t\treturn (\n\t\t\t\t\tMath.abs( insertPosition - position ) <\n\t\t\t\t\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT\n\t\t\t\t);\n\t\t\t} )\n\t\t) {\n\t\t\tif ( gradientBarState.id === 'MOVING_INSERTER' ) {\n\t\t\t\tgradientBarStateDispatch( { type: 'STOP_INSERTER_MOVE' } );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tgradientBarStateDispatch( { type: 'MOVE_INSERTER', insertPosition } );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tgradientBarStateDispatch( { type: 'STOP_INSERTER_MOVE' } );\n\t};\n\n\tconst isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';\n\tconst isInsertingControlPoint =\n\t\tgradientBarState.id === 'INSERTING_CONTROL_POINT';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'components-custom-gradient-picker__gradient-bar',\n\t\t\t\t{ 'has-gradient': hasGradient }\n\t\t\t) }\n\t\t\tonMouseEnter={ onMouseEnterAndMove }\n\t\t\tonMouseMove={ onMouseEnterAndMove }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"components-custom-gradient-picker__gradient-bar-background\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tbackground,\n\t\t\t\t\topacity: hasGradient ? 1 : 0.4,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ gradientMarkersContainerDomRef }\n\t\t\t\tclassName=\"components-custom-gradient-picker__markers-container\"\n\t\t\t>\n\t\t\t\t{ ! disableInserter &&\n\t\t\t\t\t( isMovingInserter || isInsertingControlPoint ) && (\n\t\t\t\t\t\t<ControlPoints.InsertPoint\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisableAlpha={ disableAlpha }\n\t\t\t\t\t\t\tinsertPosition={ gradientBarState.insertPosition }\n\t\t\t\t\t\t\tvalue={ controlPoints }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonOpenInserter={ () => {\n\t\t\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\t\t\ttype: 'OPEN_INSERTER',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCloseInserter={ () => {\n\t\t\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\t\t\ttype: 'CLOSE_INSERTER',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t<ControlPoints\n\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t}\n\t\t\t\t\tdisableAlpha={ disableAlpha }\n\t\t\t\t\tdisableRemove={ disableInserter }\n\t\t\t\t\tgradientPickerDomRef={ gradientMarkersContainerDomRef }\n\t\t\t\t\tignoreMarkerPosition={\n\t\t\t\t\t\tisInsertingControlPoint\n\t\t\t\t\t\t\t? gradientBarState.insertPosition\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ controlPoints }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonStartControlPointChange={ () => {\n\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\ttype: 'START_CONTROL_CHANGE',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonStopControlPointChange={ () => {\n\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\ttype: 'STOP_CONTROL_CHANGE',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,UAAU,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,OAAOC,aAAa,MAA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AwB,CAAE;YACzBf,IAAI,EAAE;UACP,CAAE,CAAC;QACJ;MAAG,CACH,CAAC;IAAA,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useRef","useReducer","ControlPoints","getHorizontalRelativeGradientPosition","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","jsx","_jsx","jsxs","_jsxs","customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","__experimentalIsRenderedInSidebar","gradientMarkersContainerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","current","clientX","some","position","Math","abs","onMouseLeave","isMovingInserter","isInsertingControlPoint","className","onMouseEnter","onMouseMove","children","style","opacity","ref","InsertPoint","onOpenInserter","onCloseInserter","disableRemove","gradientPickerDomRef","ignoreMarkerPosition","undefined","onStartControlPointChange","onStopControlPointChange"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useReducer } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ControlPoints from './control-points';\nimport { getHorizontalRelativeGradientPosition } from './utils';\nimport { MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT } from './constants';\nimport type {\n\tCustomGradientBarProps,\n\tCustomGradientBarReducerState,\n\tCustomGradientBarReducerAction,\n\tCustomGradientBarIdleState,\n} from '../types';\nimport type { MouseEventHandler } from 'react';\n\nconst customGradientBarReducer = (\n\tstate: CustomGradientBarReducerState,\n\taction: CustomGradientBarReducerAction\n): CustomGradientBarReducerState => {\n\tswitch ( action.type ) {\n\t\tcase 'MOVE_INSERTER':\n\t\t\tif ( state.id === 'IDLE' || state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'MOVING_INSERTER',\n\t\t\t\t\tinsertPosition: action.insertPosition,\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'STOP_INSERTER_MOVE':\n\t\t\tif ( state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'OPEN_INSERTER':\n\t\t\tif ( state.id === 'MOVING_INSERTER' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'INSERTING_CONTROL_POINT',\n\t\t\t\t\tinsertPosition: state.insertPosition,\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'CLOSE_INSERTER':\n\t\t\tif ( state.id === 'INSERTING_CONTROL_POINT' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'START_CONTROL_CHANGE':\n\t\t\tif ( state.id === 'IDLE' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'MOVING_CONTROL_POINT',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'STOP_CONTROL_CHANGE':\n\t\t\tif ( state.id === 'MOVING_CONTROL_POINT' ) {\n\t\t\t\treturn {\n\t\t\t\t\tid: 'IDLE',\n\t\t\t\t};\n\t\t\t}\n\t\t\tbreak;\n\t}\n\treturn state;\n};\nconst customGradientBarReducerInitialState: CustomGradientBarIdleState = {\n\tid: 'IDLE',\n};\n\nexport default function CustomGradientBar( {\n\tbackground,\n\thasGradient,\n\tvalue: controlPoints,\n\tonChange,\n\tdisableInserter = false,\n\tdisableAlpha = false,\n\t__experimentalIsRenderedInSidebar = false,\n}: CustomGradientBarProps ) {\n\tconst gradientMarkersContainerDomRef = useRef< HTMLDivElement >( null );\n\n\tconst [ gradientBarState, gradientBarStateDispatch ] = useReducer(\n\t\tcustomGradientBarReducer,\n\t\tcustomGradientBarReducerInitialState\n\t);\n\tconst onMouseEnterAndMove: MouseEventHandler< HTMLDivElement > = (\n\t\tevent\n\t) => {\n\t\tif ( ! gradientMarkersContainerDomRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst insertPosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientMarkersContainerDomRef.current\n\t\t);\n\n\t\t// If the insert point is close to an existing control point don't show it.\n\t\tif (\n\t\t\tcontrolPoints.some( ( { position } ) => {\n\t\t\t\treturn (\n\t\t\t\t\tMath.abs( insertPosition - position ) <\n\t\t\t\t\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT\n\t\t\t\t);\n\t\t\t} )\n\t\t) {\n\t\t\tif ( gradientBarState.id === 'MOVING_INSERTER' ) {\n\t\t\t\tgradientBarStateDispatch( { type: 'STOP_INSERTER_MOVE' } );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tgradientBarStateDispatch( { type: 'MOVE_INSERTER', insertPosition } );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tgradientBarStateDispatch( { type: 'STOP_INSERTER_MOVE' } );\n\t};\n\n\tconst isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';\n\tconst isInsertingControlPoint =\n\t\tgradientBarState.id === 'INSERTING_CONTROL_POINT';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'components-custom-gradient-picker__gradient-bar',\n\t\t\t\t{ 'has-gradient': hasGradient }\n\t\t\t) }\n\t\t\tonMouseEnter={ onMouseEnterAndMove }\n\t\t\tonMouseMove={ onMouseEnterAndMove }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"components-custom-gradient-picker__gradient-bar-background\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tbackground,\n\t\t\t\t\topacity: hasGradient ? 1 : 0.4,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ gradientMarkersContainerDomRef }\n\t\t\t\tclassName=\"components-custom-gradient-picker__markers-container\"\n\t\t\t>\n\t\t\t\t{ ! disableInserter &&\n\t\t\t\t\t( isMovingInserter || isInsertingControlPoint ) && (\n\t\t\t\t\t\t<ControlPoints.InsertPoint\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisableAlpha={ disableAlpha }\n\t\t\t\t\t\t\tinsertPosition={ gradientBarState.insertPosition }\n\t\t\t\t\t\t\tvalue={ controlPoints }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonOpenInserter={ () => {\n\t\t\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\t\t\ttype: 'OPEN_INSERTER',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCloseInserter={ () => {\n\t\t\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\t\t\ttype: 'CLOSE_INSERTER',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t<ControlPoints\n\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t}\n\t\t\t\t\tdisableAlpha={ disableAlpha }\n\t\t\t\t\tdisableRemove={ disableInserter }\n\t\t\t\t\tgradientPickerDomRef={ gradientMarkersContainerDomRef }\n\t\t\t\t\tignoreMarkerPosition={\n\t\t\t\t\t\tisInsertingControlPoint\n\t\t\t\t\t\t\t? gradientBarState.insertPosition\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ controlPoints }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonStartControlPointChange={ () => {\n\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\ttype: 'START_CONTROL_CHANGE',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonStopControlPointChange={ () => {\n\t\t\t\t\t\tgradientBarStateDispatch( {\n\t\t\t\t\t\t\ttype: 'STOP_CONTROL_CHANGE',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,UAAU,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,SAASC,qCAAqC,QAAQ,SAAS;AAC/D,SAASC,2CAA2C,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS1E,MAAMC,wBAAwB,GAAGA,CAChCC,KAAoC,EACpCC,MAAsC,KACH;EACnC,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,eAAe;MACnB,IAAKF,KAAK,CAACG,EAAE,KAAK,MAAM,IAAIH,KAAK,CAACG,EAAE,KAAK,iBAAiB,EAAG;QAC5D,OAAO;UACNA,EAAE,EAAE,iBAAiB;UACrBC,cAAc,EAAEH,MAAM,CAACG;QACxB,CAAC;MACF;MACA;IACD,KAAK,oBAAoB;MACxB,IAAKJ,KAAK,CAACG,EAAE,KAAK,iBAAiB,EAAG;QACrC,OAAO;UACNA,EAAE,EAAE;QACL,CAAC;MACF;MACA;IACD,KAAK,eAAe;MACnB,IAAKH,KAAK,CAACG,EAAE,KAAK,iBAAiB,EAAG;QACrC,OAAO;UACNA,EAAE,EAAE,yBAAyB;UAC7BC,cAAc,EAAEJ,KAAK,CAACI;QACvB,CAAC;MACF;MACA;IACD,KAAK,gBAAgB;MACpB,IAAKJ,KAAK,CAACG,EAAE,KAAK,yBAAyB,EAAG;QAC7C,OAAO;UACNA,EAAE,EAAE;Q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a;QACbsB,iCAAiC,EAChCA,iCACA;QACDD,YAAY,EAAGA,YAAc;QAC7B0B,aAAa,EAAG3B,eAAiB;QACjC4B,oBAAoB,EAAGzB,8BAAgC;QACvD0B,oBAAoB,EACnBb,uBAAuB,GACpBZ,gBAAgB,CAACZ,cAAc,GAC/BsC,SACH;QACDjC,KAAK,EAAGC,aAAe;QACvBC,QAAQ,EAAGA,QAAU;QACrBgC,yBAAyB,EAAGA,CAAA,KAAM;UACjC1B,wBAAwB,CAAE;YACzBf,IAAI,EAAE;UACP,CAAE,CAAC;QACJ,CAAG;QACH0C,wBAAwB,EAAGA,CAAA,KAAM;UAChC3B,wBAAwB,CAAE;YACzBf,IAAI,EAAE;UACP,CAAE,CAAC;QACJ;MAAG,CACH,CAAC;IAAA,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * Internal dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["MINIMUM_DISTANCE_BETWEEN_POINTS","clampPercent","value","Math","max","min","isOverlapping","initialIndex","newPosition","minDistance","initialPosition","position","minPosition","maxPosition","some","index","abs","addControlPoint","points","color","nextIndex","findIndex","point","newPoint","newPoints","slice","splice","removeControlPoint","filter","_point","pointIndex","updateControlPoint","newValue","updateControlPointPosition","updateControlPointColor","newColor","updateControlPointColorByPosition","getHorizontalRelativeGradientPosition","mouseXCoordinate","containerElement","x","width","getBoundingClientRect","absolutePositionValue","round"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/utils.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { MINIMUM_DISTANCE_BETWEEN_POINTS } from './constants';\nimport type { ControlPoint } from '../types';\n\n/**\n * Clamps a number between 0 and 100.\n *\n * @param value Value to clamp.\n *\n * @return Value clamped between 0 and 100.\n */\nexport function clampPercent( value: number ) {\n\treturn Math.max( 0, Math.min( 100, value ) );\n}\n\n/**\n * Check if a control point is overlapping with another.\n *\n * @param value Array of control points.\n * @param initialIndex Index of the position to test.\n * @param newPosition New position of the control point.\n * @param minDistance Distance considered to be overlapping.\n *\n * @return True if the point is overlapping.\n */\nexport function isOverlapping(\n\tvalue: ControlPoint[],\n\tinitialIndex: number,\n\tnewPosition: number,\n\tminDistance: number = MINIMUM_DISTANCE_BETWEEN_POINTS\n) {\n\tconst initialPosition = value[ initialIndex ].position;\n\tconst minPosition = Math.min( initialPosition, newPosition );\n\tconst maxPosition = Math.max( initialPosition, newPosition );\n\n\treturn value.some( ( { position }, index ) => {\n\t\treturn (\n\t\t\tindex !== initialIndex &&\n\t\t\t( Math.abs( position - newPosition ) < minDistance ||\n\t\t\t\t( minPosition < position && position < maxPosition ) )\n\t\t);\n\t} );\n}\n\n/**\n * Adds a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param position Position to insert the new point.\n * @param color Color to update the control point at index.\n *\n * @return New array of control points.\n */\nexport function addControlPoint(\n\tpoints: ControlPoint[],\n\tposition: number,\n\tcolor: ControlPoint[ 'color' ]\n) {\n\tconst nextIndex = points.findIndex(\n\t\t( point ) => point.position > position\n\t);\n\tconst newPoint = { color, position };\n\tconst newPoints = points.slice();\n\tnewPoints.splice( nextIndex - 1, 0, newPoint );\n\treturn newPoints;\n}\n\n/**\n * Removes a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to remove.\n *\n * @return New array of control points.\n */\nexport function removeControlPoint( points: ControlPoint[], index: number ) {\n\treturn points.filter( ( _point, pointIndex ) => {\n\t\treturn pointIndex !== index;\n\t} );\n}\n/**\n * Updates a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to update.\n * @param newPoint New control point to replace the index.\n *\n * @return New array of control points.\n */\nexport function updateControlPoint(\n\tpoints: ControlPoint[],\n\tindex: number,\n\tnewPoint: ControlPoint\n) {\n\tconst newValue = points.slice();\n\tnewValue[ index ] = newPoint;\n\treturn newValue;\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to update.\n * @param newPosition Position to move the control point at index.\n *\n * @return New array of control points.\n */\nexport function updateControlPointPosition(\n\tpoints: ControlPoint[],\n\tindex: number,\n\tnewPosition: ControlPoint[ 'position' ]\n) {\n\tif ( isOverlapping( points, index, newPosition ) ) {\n\t\treturn points;\n\t}\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tposition: newPosition,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to update.\n * @param newColor Color to update the control point at index.\n *\n * @return New array of control points.\n */\nexport function updateControlPointColor(\n\tpoints: ControlPoint[],\n\tindex: number,\n\tnewColor: ControlPoint[ 'color' ]\n) {\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tcolor: newColor,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param position Position of the color stop.\n * @param newColor Color to update the control point at index.\n *\n * @return New array of control points.\n */\nexport function updateControlPointColorByPosition(\n\tpoints: ControlPoint[],\n\tposition: ControlPoint[ 'position' ],\n\tnewColor: ControlPoint[ 'color' ]\n) {\n\tconst index = points.findIndex( ( point ) => point.position === position );\n\treturn updateControlPointColor( points, index, newColor );\n}\n\n/**\n * Gets the horizontal coordinate when dragging a control point with the mouse.\n *\n * @param mouseXcoordinate Horizontal coordinate of the mouse position.\n * @param containerElement Container for the gradient picker.\n *\n * @return Whole number percentage from the left.\n */\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXcoordinate: number,\n\tcontainerElement: HTMLDivElement\n): number;\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXcoordinate: number,\n\tcontainerElement: null\n): undefined;\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXCoordinate: number,\n\tcontainerElement: HTMLDivElement | null\n) {\n\tif ( ! containerElement ) {\n\t\treturn;\n\t}\n\tconst { x, width } = containerElement.getBoundingClientRect();\n\tconst absolutePositionValue = mouseXCoordinate - x;\n\treturn Math.round(\n\t\tclampPercent( ( absolutePositionValue * 100 ) / width )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,+BAA+B,QAAQ,aAAa;AAG7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,KAAa,EAAG;EAC7C,OAAOC,IAAI,CAACC,GAAG,CAAE,CAAC,EAAED,IAAI,CAACE,GAAG,CAAE,GAAG,EAAEH,KAAM,CAAE,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,aAAaA,CAC5BJ,KAAqB,EACrBK,YAAoB,EACpBC,WAAmB,EACnBC,WAAmB,GAAGT,+BAA+B,EACpD;EACD,MAAMU,eAAe,GAAGR,KAAK,CAAEK,YAAY,CAAE,CAACI,QAAQ;EACtD,MAAMC,WAAW,GAAGT,IAAI,CAACE,GAAG,CAAEK,eAAe,EAAEF,WAAY,CAAC;EAC5D,MAAMK,WAAW,GAAGV,IAAI,CAACC,GAAG,CAAEM,eAAe,EAAEF,WAAY,CAAC;EAE5D,OAAON,KAAK,CAACY,IAAI,CAAE,CAAE;IAAEH;EAAS,CAAC,EAAEI,KAAK,KAAM;IAC7C,OACCA,KAAK,KAAKR,YAAY,KACpBJ,IAAI,CAACa,GAAG,CAAEL,QAAQ,GAAGH,WAAY,CAAC,GAAGC,WAAW,IAC/CG,WAAW,GAAGD,QAAQ,IAAIA,QAAQ,GAAGE,WAAa,CAAE;EAEzD,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,eAAeA,CAC9BC,MAAsB,EACtBP,QAAgB,EAChBQ,KAA8B,EAC7B;EACD,MAAMC,SAAS,GAAGF,MAAM,CAACG,SAAS,CAC/BC,KAAK,IAAMA,KAAK,CAACX,QAAQ,GAAGA,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AMZ,QAAQ,GAAG;IAChB,GAAGL,MAAM,CAAEH,KAAK,CAAE;IAClBI,KAAK,EAAEgB;EACR,CAAC;EACD,OAAOJ,kBAAkB,CAAEb,MAAM,EAAEH,KAAK,EAAEQ,QAAS,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASa,iCAAiCA,CAChDlB,MAAsB,EACtBP,QAAoC,EACpCwB,QAAiC,EAChC;EACD,MAAMpB,KAAK,GAAGG,MAAM,CAACG,SAAS,CAAIC,KAAK,IAAMA,KAAK,CAACX,QAAQ,KAAKA,QAAS,CAAC;EAC1E,OAAOuB,uBAAuB,CAAEhB,MAAM,EAAEH,KAAK,EAAEoB,QAAS,CAAC;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,SAASE,qCAAqCA,CACpDC,gBAAwB,EACxBC,gBAAuC,EACtC;EACD,IAAK,CAAEA,gBAAgB,EAAG;IACzB;EACD;EACA,MAAM;IAAEC,CAAC;IAAEC;EAAM,CAAC,GAAGF,gBAAgB,CAACG,qBAAqB,CAAC,CAAC;EAC7D,MAAMC,qBAAqB,GAAGL,gBAAgB,GAAGE,CAAC;EAClD,OAAOrC,IAAI,CAACyC,KAAK,CAChB3C,YAAY,CAAI0C,qBAAqB,GAAG,GAAG,GAAKF,KAAM,CACvD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["MINIMUM_DISTANCE_BETWEEN_POINTS","clampPercent","value","Math","max","min","isOverlapping","initialIndex","newPosition","minDistance","initialPosition","position","minPosition","maxPosition","some","index","abs","addControlPoint","points","color","nextIndex","findIndex","point","newPoint","newPoints","slice","splice","removeControlPoint","filter","_point","pointIndex","updateControlPoint","newValue","updateControlPointPosition","updateControlPointColor","newColor","updateControlPointColorByPosition","getHorizontalRelativeGradientPosition","mouseXCoordinate","containerElement","x","width","getBoundingClientRect","absolutePositionValue","round"],"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/utils.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { MINIMUM_DISTANCE_BETWEEN_POINTS } from './constants';\nimport type { ControlPoint } from '../types';\n\n/**\n * Clamps a number between 0 and 100.\n *\n * @param value Value to clamp.\n *\n * @return Value clamped between 0 and 100.\n */\nexport function clampPercent( value: number ) {\n\treturn Math.max( 0, Math.min( 100, value ) );\n}\n\n/**\n * Check if a control point is overlapping with another.\n *\n * @param value Array of control points.\n * @param initialIndex Index of the position to test.\n * @param newPosition New position of the control point.\n * @param minDistance Distance considered to be overlapping.\n *\n * @return True if the point is overlapping.\n */\nexport function isOverlapping(\n\tvalue: ControlPoint[],\n\tinitialIndex: number,\n\tnewPosition: number,\n\tminDistance: number = MINIMUM_DISTANCE_BETWEEN_POINTS\n) {\n\tconst initialPosition = value[ initialIndex ].position;\n\tconst minPosition = Math.min( initialPosition, newPosition );\n\tconst maxPosition = Math.max( initialPosition, newPosition );\n\n\treturn value.some( ( { position }, index ) => {\n\t\treturn (\n\t\t\tindex !== initialIndex &&\n\t\t\t( Math.abs( position - newPosition ) < minDistance ||\n\t\t\t\t( minPosition < position && position < maxPosition ) )\n\t\t);\n\t} );\n}\n\n/**\n * Adds a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param position Position to insert the new point.\n * @param color Color to update the control point at index.\n *\n * @return New array of control points.\n */\nexport function addControlPoint(\n\tpoints: ControlPoint[],\n\tposition: number,\n\tcolor: ControlPoint[ 'color' ]\n) {\n\tconst nextIndex = points.findIndex(\n\t\t( point ) => point.position > position\n\t);\n\tconst newPoint = { color, position };\n\tconst newPoints = points.slice();\n\tnewPoints.splice( nextIndex - 1, 0, newPoint );\n\treturn newPoints;\n}\n\n/**\n * Removes a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to remove.\n *\n * @return New array of control points.\n */\nexport function removeControlPoint( points: ControlPoint[], index: number ) {\n\treturn points.filter( ( _point, pointIndex ) => {\n\t\treturn pointIndex !== index;\n\t} );\n}\n/**\n * Updates a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to update.\n * @param newPoint New control point to replace the index.\n *\n * @return New array of control points.\n */\nexport function updateControlPoint(\n\tpoints: ControlPoint[],\n\tindex: number,\n\tnewPoint: ControlPoint\n) {\n\tconst newValue = points.slice();\n\tnewValue[ index ] = newPoint;\n\treturn newValue;\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to update.\n * @param newPosition Position to move the control point at index.\n *\n * @return New array of control points.\n */\nexport function updateControlPointPosition(\n\tpoints: ControlPoint[],\n\tindex: number,\n\tnewPosition: ControlPoint[ 'position' ]\n) {\n\tif ( isOverlapping( points, index, newPosition ) ) {\n\t\treturn points;\n\t}\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tposition: newPosition,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param index Index to update.\n * @param newColor Color to update the control point at index.\n *\n * @return New array of control points.\n */\nexport function updateControlPointColor(\n\tpoints: ControlPoint[],\n\tindex: number,\n\tnewColor: ControlPoint[ 'color' ]\n) {\n\tconst newPoint = {\n\t\t...points[ index ],\n\t\tcolor: newColor,\n\t};\n\treturn updateControlPoint( points, index, newPoint );\n}\n\n/**\n * Updates the position of a control point from an array and returns the new array.\n *\n * @param points Array of control points.\n * @param position Position of the color stop.\n * @param newColor Color to update the control point at index.\n *\n * @return New array of control points.\n */\nexport function updateControlPointColorByPosition(\n\tpoints: ControlPoint[],\n\tposition: ControlPoint[ 'position' ],\n\tnewColor: ControlPoint[ 'color' ]\n) {\n\tconst index = points.findIndex( ( point ) => point.position === position );\n\treturn updateControlPointColor( points, index, newColor );\n}\n\n/**\n * Gets the horizontal coordinate when dragging a control point with the mouse.\n *\n * @param mouseXcoordinate Horizontal coordinate of the mouse position.\n * @param containerElement Container for the gradient picker.\n *\n * @return Whole number percentage from the left.\n */\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXcoordinate: number,\n\tcontainerElement: HTMLDivElement\n): number;\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXcoordinate: number,\n\tcontainerElement: null\n): undefined;\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXCoordinate: number,\n\tcontainerElement: HTMLDivElement | null\n) {\n\tif ( ! containerElement ) {\n\t\treturn;\n\t}\n\tconst { x, width } = containerElement.getBoundingClientRect();\n\tconst absolutePositionValue = mouseXCoordinate - x;\n\treturn Math.round(\n\t\tclampPercent( ( absolutePositionValue * 100 ) / width )\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,+BAA+B,QAAQ,aAAa;AAG7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,KAAa,EAAG;EAC7C,OAAOC,IAAI,CAACC,GAAG,CAAE,CAAC,EAAED,IAAI,CAACE,GAAG,CAAE,GAAG,EAAEH,KAAM,CAAE,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,aAAaA,CAC5BJ,KAAqB,EACrBK,YAAoB,EACpBC,WAAmB,EACnBC,WAAmB,GAAGT,+BAA+B,EACpD;EACD,MAAMU,eAAe,GAAGR,KAAK,CAAEK,YAAY,CAAE,CAACI,QAAQ;EACtD,MAAMC,WAAW,GAAGT,IAAI,CAACE,GAAG,CAAEK,eAAe,EAAEF,WAAY,CAAC;EAC5D,MAAMK,WAAW,GAAGV,IAAI,CAACC,GAAG,CAAEM,eAAe,EAAEF,WAAY,CAAC;EAE5D,OAAON,KAAK,CAACY,IAAI,CAAE,CAAE;IAAEH;EAAS,CAAC,EAAEI,KAAK,KAAM;IAC7C,OACCA,KAAK,KAAKR,YAAY,KACpBJ,IAAI,CAACa,GAAG,CAAEL,QAAQ,GAAGH,WAAY,CAAC,GAAGC,WAAW,IAC/CG,WAAW,GAAGD,QAAQ,IAAIA,Q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GradientTypePicker = ({
110
111
  export function CustomGradientPicker({
111
112
  value,
112
113
  onChange,
114
+ enableAlpha = true,
113
115
  __experimentalIsRenderedInSidebar = false
114
116
  }) {
115
117
  const {
@@ -138,6 +140,7 @@ export function CustomGradientPicker({
138
140
  className: "components-custom-gradient-picker",
139
141
  children: [/*#__PURE__*/_jsx(CustomGradientBar, {
140
142
  __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
143
+ disableAlpha: !enableAlpha,
141
144
  background: background,
142
145
  hasGradient: hasGradient,
143
146
  value: controlPoints,