@wordpress/components 23.5.0 → 23.7.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 (1131) hide show
  1. package/CHANGELOG.md +69 -8
  2. package/build/angle-picker-control/angle-circle.js +1 -4
  3. package/build/angle-picker-control/angle-circle.js.map +1 -1
  4. package/build/angle-picker-control/index.js +10 -22
  5. package/build/angle-picker-control/index.js.map +1 -1
  6. package/build/angle-picker-control/styles/angle-picker-control-styles.js +24 -15
  7. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  8. package/build/animate/index.js +29 -19
  9. package/build/animate/index.js.map +1 -1
  10. package/build/animate/types.js.map +1 -0
  11. package/build/animation/index.js.map +1 -1
  12. package/build/autocomplete/autocompleter-ui.js +5 -5
  13. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  14. package/build/autocomplete/get-default-use-items.js.map +1 -1
  15. package/build/autocomplete/index.js +25 -91
  16. package/build/autocomplete/index.js.map +1 -1
  17. package/build/autocomplete/types.js +6 -0
  18. package/build/autocomplete/types.js.map +1 -0
  19. package/build/box-control/axial-input-controls.js.map +1 -1
  20. package/build/color-picker/color-input.js +0 -4
  21. package/build/color-picker/color-input.js.map +1 -1
  22. package/build/color-picker/component.js +5 -4
  23. package/build/color-picker/component.js.map +1 -1
  24. package/build/color-picker/hex-input.js.map +1 -1
  25. package/build/color-picker/hsl-input.js.map +1 -1
  26. package/build/color-picker/input-with-slider.js.map +1 -1
  27. package/build/color-picker/legacy-adapter.js.map +1 -1
  28. package/build/color-picker/picker.js.map +1 -1
  29. package/build/color-picker/rgb-input.js.map +1 -1
  30. package/build/color-picker/use-deprecated-props.js.map +1 -1
  31. package/build/custom-gradient-picker/constants.js +1 -1
  32. package/build/custom-gradient-picker/constants.js.map +1 -1
  33. package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  34. package/build/custom-gradient-picker/gradient-bar/control-points.js +9 -3
  35. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  36. package/build/custom-gradient-picker/gradient-bar/index.js +14 -7
  37. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  38. package/build/custom-gradient-picker/gradient-bar/utils.js +34 -52
  39. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  40. package/build/custom-gradient-picker/index.js +45 -14
  41. package/build/custom-gradient-picker/index.js.map +1 -1
  42. package/build/custom-gradient-picker/serializer.js +14 -3
  43. package/build/custom-gradient-picker/serializer.js.map +1 -1
  44. package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  45. package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  46. package/build/custom-gradient-picker/types.js +6 -0
  47. package/build/custom-gradient-picker/types.js.map +1 -0
  48. package/build/custom-gradient-picker/utils.js +17 -10
  49. package/build/custom-gradient-picker/utils.js.map +1 -1
  50. package/build/dimension-control/index.js +31 -5
  51. package/build/dimension-control/index.js.map +1 -1
  52. package/build/dimension-control/sizes.js +2 -4
  53. package/build/dimension-control/sizes.js.map +1 -1
  54. package/build/dimension-control/types.js +6 -0
  55. package/build/dimension-control/types.js.map +1 -0
  56. package/build/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  57. package/build/duotone-picker/color-list-picker/index.js.map +1 -0
  58. package/build/duotone-picker/color-list-picker/types.js +6 -0
  59. package/build/duotone-picker/color-list-picker/types.js.map +1 -0
  60. package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
  61. package/build/duotone-picker/duotone-picker.js +39 -2
  62. package/build/duotone-picker/duotone-picker.js.map +1 -1
  63. package/build/duotone-picker/duotone-swatch.js.map +1 -1
  64. package/build/duotone-picker/index.js.map +1 -1
  65. package/build/duotone-picker/types.js +6 -0
  66. package/build/duotone-picker/types.js.map +1 -0
  67. package/build/duotone-picker/utils.js +13 -11
  68. package/build/duotone-picker/utils.js.map +1 -1
  69. package/build/flex/flex/hook.js +3 -3
  70. package/build/flex/flex/hook.js.map +1 -1
  71. package/build/font-size-picker/index.js +2 -1
  72. package/build/font-size-picker/index.js.map +1 -1
  73. package/build/form-token-field/index.js +10 -4
  74. package/build/form-token-field/index.js.map +1 -1
  75. package/build/gradient-picker/index.js +61 -7
  76. package/build/gradient-picker/index.js.map +1 -1
  77. package/build/gradient-picker/types.js +6 -0
  78. package/build/gradient-picker/types.js.map +1 -0
  79. package/build/guide/icons.js.map +1 -1
  80. package/build/guide/index.js +46 -8
  81. package/build/guide/index.js.map +1 -1
  82. package/build/guide/page-control.js.map +1 -1
  83. package/build/guide/page.js.map +1 -1
  84. package/build/guide/types.js +6 -0
  85. package/build/guide/types.js.map +1 -0
  86. package/build/h-stack/utils.js +5 -5
  87. package/build/h-stack/utils.js.map +1 -1
  88. package/build/higher-order/navigate-regions/index.js +33 -3
  89. package/build/higher-order/navigate-regions/index.js.map +1 -1
  90. package/build/higher-order/with-fallback-styles/index.js +2 -2
  91. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  92. package/build/higher-order/with-filters/index.js +31 -7
  93. package/build/higher-order/with-filters/index.js.map +1 -1
  94. package/build/higher-order/with-focus-return/index.js +10 -10
  95. package/build/higher-order/with-focus-return/index.js.map +1 -1
  96. package/build/higher-order/with-notices/index.js +28 -25
  97. package/build/higher-order/with-notices/index.js.map +1 -1
  98. package/build/higher-order/with-notices/types.js +6 -0
  99. package/build/higher-order/with-notices/types.js.map +1 -0
  100. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  101. package/build/icon/index.js +1 -8
  102. package/build/icon/index.js.map +1 -1
  103. package/build/index.native.js +18 -9
  104. package/build/index.native.js.map +1 -1
  105. package/build/mobile/bottom-sheet/cell.native.js +1 -1
  106. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  107. package/build/mobile/bottom-sheet-text-control/index.native.js +4 -3
  108. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  109. package/build/navigation/back-button/index.js +6 -5
  110. package/build/navigation/back-button/index.js.map +1 -1
  111. package/build/navigation/constants.js.map +1 -1
  112. package/build/navigation/context.js +7 -4
  113. package/build/navigation/context.js.map +1 -1
  114. package/build/navigation/group/context.js.map +1 -1
  115. package/build/navigation/group/index.js +5 -1
  116. package/build/navigation/group/index.js.map +1 -1
  117. package/build/navigation/index.js +49 -3
  118. package/build/navigation/index.js.map +1 -1
  119. package/build/navigation/item/base-content.js +0 -1
  120. package/build/navigation/item/base-content.js.map +1 -1
  121. package/build/navigation/item/base.js.map +1 -1
  122. package/build/navigation/item/index.js +5 -1
  123. package/build/navigation/item/index.js.map +1 -1
  124. package/build/navigation/item/use-navigation-tree-item.js +1 -1
  125. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  126. package/build/navigation/menu/context.js.map +1 -1
  127. package/build/navigation/menu/index.js +5 -1
  128. package/build/navigation/menu/index.js.map +1 -1
  129. package/build/navigation/menu/menu-title-search.js +8 -6
  130. package/build/navigation/menu/menu-title-search.js.map +1 -1
  131. package/build/navigation/menu/menu-title.js +4 -2
  132. package/build/navigation/menu/menu-title.js.map +1 -1
  133. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  134. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  135. package/build/navigation/styles/navigation-styles.js +36 -36
  136. package/build/navigation/styles/navigation-styles.js.map +1 -1
  137. package/build/navigation/types.js +6 -0
  138. package/build/navigation/types.js.map +1 -0
  139. package/build/navigation/use-create-navigation-tree.js +7 -0
  140. package/build/navigation/use-create-navigation-tree.js.map +1 -1
  141. package/build/navigation/use-navigation-tree-nodes.js +3 -5
  142. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  143. package/build/navigation/utils.js.map +1 -1
  144. package/build/navigator/navigator-screen/component.js +5 -3
  145. package/build/navigator/navigator-screen/component.js.map +1 -1
  146. package/build/number-control/index.js +1 -3
  147. package/build/number-control/index.js.map +1 -1
  148. package/build/palette-edit/index.js +65 -26
  149. package/build/palette-edit/index.js.map +1 -1
  150. package/build/palette-edit/types.js +6 -0
  151. package/build/palette-edit/types.js.map +1 -0
  152. package/build/panel/body.js +15 -17
  153. package/build/panel/body.js.map +1 -1
  154. package/build/placeholder/index.js.map +1 -1
  155. package/build/query-controls/author-select.js +0 -4
  156. package/build/query-controls/author-select.js.map +1 -1
  157. package/build/query-controls/category-select.js +0 -4
  158. package/build/query-controls/category-select.js.map +1 -1
  159. package/build/query-controls/terms.js +30 -15
  160. package/build/query-controls/terms.js.map +1 -1
  161. package/build/range-control/index.js.map +1 -1
  162. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  163. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  164. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  165. package/build/responsive-wrapper/index.js +12 -13
  166. package/build/responsive-wrapper/index.js.map +1 -1
  167. package/build/sandbox/index.native.js +80 -67
  168. package/build/sandbox/index.native.js.map +1 -1
  169. package/build/select-control/index.js +19 -16
  170. package/build/select-control/index.js.map +1 -1
  171. package/build/tab-panel/index.js +1 -1
  172. package/build/tab-panel/index.js.map +1 -1
  173. package/build/toolbar/toolbar-button/index.js +32 -10
  174. package/build/toolbar/toolbar-button/index.js.map +1 -1
  175. package/build/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  176. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  177. package/build/toolbar/toolbar-button/types.js +6 -0
  178. package/build/toolbar/toolbar-button/types.js.map +1 -0
  179. package/build/toolbar/toolbar-context/index.js +4 -2
  180. package/build/toolbar/toolbar-context/index.js.map +1 -1
  181. package/build/tools-panel/tools-panel/hook.js +45 -6
  182. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  183. package/build/tooltip/index.js +18 -6
  184. package/build/tooltip/index.js.map +1 -1
  185. package/build/tree-select/index.js.map +1 -1
  186. package/build/ui/context/get-styled-class-name-from-key.js +2 -2
  187. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  188. package/build/utils/font.js +3 -7
  189. package/build/utils/font.js.map +1 -1
  190. package/build/utils/input/input-control.js +1 -1
  191. package/build/utils/input/input-control.js.map +1 -1
  192. package/build/v-stack/hook.js +2 -0
  193. package/build/v-stack/hook.js.map +1 -1
  194. package/build-module/angle-picker-control/angle-circle.js +1 -4
  195. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  196. package/build-module/angle-picker-control/index.js +12 -21
  197. package/build-module/angle-picker-control/index.js.map +1 -1
  198. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
  199. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  200. package/build-module/animate/index.js +27 -17
  201. package/build-module/animate/index.js.map +1 -1
  202. package/build-module/animation/index.js.map +1 -1
  203. package/build-module/autocomplete/autocompleter-ui.js +6 -6
  204. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  205. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  206. package/build-module/autocomplete/index.js +28 -94
  207. package/build-module/autocomplete/index.js.map +1 -1
  208. package/build-module/autocomplete/types.js +2 -0
  209. package/build-module/box-control/axial-input-controls.js.map +1 -1
  210. package/build-module/color-picker/color-input.js +0 -4
  211. package/build-module/color-picker/color-input.js.map +1 -1
  212. package/build-module/color-picker/component.js +3 -3
  213. package/build-module/color-picker/component.js.map +1 -1
  214. package/build-module/color-picker/hex-input.js.map +1 -1
  215. package/build-module/color-picker/hsl-input.js.map +1 -1
  216. package/build-module/color-picker/input-with-slider.js.map +1 -1
  217. package/build-module/color-picker/legacy-adapter.js.map +1 -1
  218. package/build-module/color-picker/picker.js +4 -0
  219. package/build-module/color-picker/picker.js.map +1 -1
  220. package/build-module/color-picker/rgb-input.js.map +1 -1
  221. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  222. package/build-module/custom-gradient-picker/constants.js +1 -1
  223. package/build-module/custom-gradient-picker/constants.js.map +1 -1
  224. package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  225. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -3
  226. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  227. package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -7
  228. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  229. package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -52
  230. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  231. package/build-module/custom-gradient-picker/index.js +44 -16
  232. package/build-module/custom-gradient-picker/index.js.map +1 -1
  233. package/build-module/custom-gradient-picker/serializer.js +14 -3
  234. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  235. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  236. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  237. package/build-module/custom-gradient-picker/types.js +2 -0
  238. package/build-module/custom-gradient-picker/types.js.map +1 -0
  239. package/build-module/custom-gradient-picker/utils.js +17 -10
  240. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  241. package/build-module/dimension-control/index.js +28 -3
  242. package/build-module/dimension-control/index.js.map +1 -1
  243. package/build-module/dimension-control/sizes.js +6 -5
  244. package/build-module/dimension-control/sizes.js.map +1 -1
  245. package/build-module/dimension-control/types.js +2 -0
  246. package/build-module/dimension-control/types.js.map +1 -0
  247. package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  248. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
  249. package/build-module/duotone-picker/color-list-picker/types.js +2 -0
  250. package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
  251. package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
  252. package/build-module/duotone-picker/duotone-picker.js +38 -2
  253. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  254. package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
  255. package/build-module/duotone-picker/index.js.map +1 -1
  256. package/build-module/duotone-picker/types.js +2 -0
  257. package/build-module/duotone-picker/types.js.map +1 -0
  258. package/build-module/duotone-picker/utils.js +17 -11
  259. package/build-module/duotone-picker/utils.js.map +1 -1
  260. package/build-module/flex/flex/hook.js +3 -3
  261. package/build-module/flex/flex/hook.js.map +1 -1
  262. package/build-module/font-size-picker/index.js +2 -1
  263. package/build-module/font-size-picker/index.js.map +1 -1
  264. package/build-module/form-token-field/index.js +10 -5
  265. package/build-module/form-token-field/index.js.map +1 -1
  266. package/build-module/gradient-picker/index.js +61 -9
  267. package/build-module/gradient-picker/index.js.map +1 -1
  268. package/build-module/gradient-picker/types.js +2 -0
  269. package/build-module/gradient-picker/types.js.map +1 -0
  270. package/build-module/guide/icons.js.map +1 -1
  271. package/build-module/guide/index.js +45 -8
  272. package/build-module/guide/index.js.map +1 -1
  273. package/build-module/guide/page-control.js.map +1 -1
  274. package/build-module/guide/page.js +4 -0
  275. package/build-module/guide/page.js.map +1 -1
  276. package/build-module/guide/types.js +2 -0
  277. package/build-module/guide/types.js.map +1 -0
  278. package/build-module/h-stack/utils.js +5 -5
  279. package/build-module/h-stack/utils.js.map +1 -1
  280. package/build-module/higher-order/navigate-regions/index.js +33 -3
  281. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  282. package/build-module/higher-order/with-fallback-styles/index.js +2 -2
  283. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  284. package/build-module/higher-order/with-filters/index.js +31 -7
  285. package/build-module/higher-order/with-filters/index.js.map +1 -1
  286. package/build-module/higher-order/with-focus-return/index.js +10 -10
  287. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  288. package/build-module/higher-order/with-notices/index.js +29 -26
  289. package/build-module/higher-order/with-notices/index.js.map +1 -1
  290. package/build-module/higher-order/with-notices/types.js +2 -0
  291. package/build-module/higher-order/with-notices/types.js.map +1 -0
  292. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  293. package/build-module/icon/index.js +2 -9
  294. package/build-module/icon/index.js.map +1 -1
  295. package/build-module/index.native.js +1 -0
  296. package/build-module/index.native.js.map +1 -1
  297. package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
  298. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  299. package/build-module/mobile/bottom-sheet-text-control/index.native.js +4 -3
  300. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  301. package/build-module/navigation/back-button/index.js +4 -3
  302. package/build-module/navigation/back-button/index.js.map +1 -1
  303. package/build-module/navigation/constants.js.map +1 -1
  304. package/build-module/navigation/context.js +7 -4
  305. package/build-module/navigation/context.js.map +1 -1
  306. package/build-module/navigation/group/context.js +4 -0
  307. package/build-module/navigation/group/context.js.map +1 -1
  308. package/build-module/navigation/group/index.js +2 -1
  309. package/build-module/navigation/group/index.js.map +1 -1
  310. package/build-module/navigation/index.js +46 -3
  311. package/build-module/navigation/index.js.map +1 -1
  312. package/build-module/navigation/item/base-content.js +0 -1
  313. package/build-module/navigation/item/base-content.js.map +1 -1
  314. package/build-module/navigation/item/base.js.map +1 -1
  315. package/build-module/navigation/item/index.js +2 -1
  316. package/build-module/navigation/item/index.js.map +1 -1
  317. package/build-module/navigation/item/use-navigation-tree-item.js +1 -1
  318. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  319. package/build-module/navigation/menu/context.js +4 -0
  320. package/build-module/navigation/menu/context.js.map +1 -1
  321. package/build-module/navigation/menu/index.js +2 -1
  322. package/build-module/navigation/menu/index.js.map +1 -1
  323. package/build-module/navigation/menu/menu-title-search.js +8 -6
  324. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  325. package/build-module/navigation/menu/menu-title.js +4 -2
  326. package/build-module/navigation/menu/menu-title.js.map +1 -1
  327. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  328. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  329. package/build-module/navigation/styles/navigation-styles.js +36 -36
  330. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  331. package/build-module/navigation/types.js +2 -0
  332. package/build-module/navigation/types.js.map +1 -0
  333. package/build-module/navigation/use-create-navigation-tree.js +7 -0
  334. package/build-module/navigation/use-create-navigation-tree.js.map +1 -1
  335. package/build-module/navigation/use-navigation-tree-nodes.js +2 -2
  336. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  337. package/build-module/navigation/utils.js.map +1 -1
  338. package/build-module/navigator/navigator-screen/component.js +5 -3
  339. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  340. package/build-module/number-control/index.js +1 -3
  341. package/build-module/number-control/index.js.map +1 -1
  342. package/build-module/palette-edit/index.js +63 -26
  343. package/build-module/palette-edit/index.js.map +1 -1
  344. package/build-module/palette-edit/types.js +2 -0
  345. package/build-module/palette-edit/types.js.map +1 -0
  346. package/build-module/panel/body.js +12 -12
  347. package/build-module/panel/body.js.map +1 -1
  348. package/build-module/placeholder/index.js.map +1 -1
  349. package/build-module/query-controls/author-select.js +0 -4
  350. package/build-module/query-controls/author-select.js.map +1 -1
  351. package/build-module/query-controls/category-select.js +1 -5
  352. package/build-module/query-controls/category-select.js.map +1 -1
  353. package/build-module/query-controls/terms.js +29 -16
  354. package/build-module/query-controls/terms.js.map +1 -1
  355. package/build-module/range-control/index.js.map +1 -1
  356. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
  357. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  358. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  359. package/build-module/responsive-wrapper/index.js +12 -12
  360. package/build-module/responsive-wrapper/index.js.map +1 -1
  361. package/build-module/sandbox/index.native.js +70 -58
  362. package/build-module/sandbox/index.native.js.map +1 -1
  363. package/build-module/select-control/index.js +20 -17
  364. package/build-module/select-control/index.js.map +1 -1
  365. package/build-module/tab-panel/index.js +2 -2
  366. package/build-module/tab-panel/index.js.map +1 -1
  367. package/build-module/toolbar/toolbar-button/index.js +32 -9
  368. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  369. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  370. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  371. package/build-module/toolbar/toolbar-button/types.js +2 -0
  372. package/build-module/toolbar/toolbar-button/types.js.map +1 -0
  373. package/build-module/toolbar/toolbar-context/index.js +4 -2
  374. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  375. package/build-module/tools-panel/tools-panel/hook.js +45 -6
  376. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  377. package/build-module/tooltip/index.js +16 -6
  378. package/build-module/tooltip/index.js.map +1 -1
  379. package/build-module/tree-select/index.js.map +1 -1
  380. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  381. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  382. package/build-module/utils/font.js +3 -6
  383. package/build-module/utils/font.js.map +1 -1
  384. package/build-module/utils/input/input-control.js +1 -1
  385. package/build-module/utils/input/input-control.js.map +1 -1
  386. package/build-module/v-stack/hook.js +2 -0
  387. package/build-module/v-stack/hook.js.map +1 -1
  388. package/build-style/style-rtl.css +54 -39
  389. package/build-style/style.css +56 -39
  390. package/build-types/alignment-matrix-control/types.d.ts +4 -4
  391. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  392. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  393. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  394. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +5 -0
  395. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  396. package/build-types/angle-picker-control/types.d.ts +2 -2
  397. package/build-types/angle-picker-control/types.d.ts.map +1 -1
  398. package/build-types/animate/index.d.ts +27 -22
  399. package/build-types/animate/index.d.ts.map +1 -1
  400. package/build-types/animate/stories/index.d.ts +18 -0
  401. package/build-types/animate/stories/index.d.ts.map +1 -0
  402. package/build-types/animate/types.d.ts +30 -0
  403. package/build-types/animate/types.d.ts.map +1 -0
  404. package/build-types/animation/index.d.ts +8 -1
  405. package/build-types/animation/index.d.ts.map +1 -1
  406. package/build-types/autocomplete/autocompleter-ui.d.ts +4 -0
  407. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -0
  408. package/build-types/autocomplete/get-default-use-items.d.ts +3 -0
  409. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -0
  410. package/build-types/autocomplete/index.d.ts +23 -0
  411. package/build-types/autocomplete/index.d.ts.map +1 -0
  412. package/build-types/autocomplete/test/index.d.ts +2 -0
  413. package/build-types/autocomplete/test/index.d.ts.map +1 -0
  414. package/build-types/autocomplete/types.d.ts +201 -0
  415. package/build-types/autocomplete/types.d.ts.map +1 -0
  416. package/build-types/base-control/types.d.ts +2 -2
  417. package/build-types/base-control/types.d.ts.map +1 -1
  418. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  419. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  420. package/build-types/border-box-control/styles.d.ts +3 -3
  421. package/build-types/border-box-control/styles.d.ts.map +1 -1
  422. package/build-types/border-box-control/types.d.ts +8 -8
  423. package/build-types/border-box-control/types.d.ts.map +1 -1
  424. package/build-types/border-box-control/utils.d.ts +5 -5
  425. package/build-types/border-box-control/utils.d.ts.map +1 -1
  426. package/build-types/border-control/border-control/hook.d.ts +3 -3
  427. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  428. package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
  429. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  430. package/build-types/border-control/styles.d.ts +4 -4
  431. package/build-types/border-control/styles.d.ts.map +1 -1
  432. package/build-types/border-control/types.d.ts +6 -6
  433. package/build-types/border-control/types.d.ts.map +1 -1
  434. package/build-types/box-control/types.d.ts +6 -6
  435. package/build-types/box-control/types.d.ts.map +1 -1
  436. package/build-types/button/deprecated.d.ts +6 -6
  437. package/build-types/button/types.d.ts +10 -10
  438. package/build-types/button/types.d.ts.map +1 -1
  439. package/build-types/button-group/types.d.ts +1 -1
  440. package/build-types/button-group/types.d.ts.map +1 -1
  441. package/build-types/card/card/hook.d.ts +1 -1
  442. package/build-types/card/card/hook.d.ts.map +1 -1
  443. package/build-types/card/types.d.ts +10 -10
  444. package/build-types/card/types.d.ts.map +1 -1
  445. package/build-types/checkbox-control/types.d.ts +1 -1
  446. package/build-types/checkbox-control/types.d.ts.map +1 -1
  447. package/build-types/circular-option-picker/types.d.ts +4 -4
  448. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  449. package/build-types/color-indicator/types.d.ts +1 -1
  450. package/build-types/color-indicator/types.d.ts.map +1 -1
  451. package/build-types/color-palette/types.d.ts +7 -7
  452. package/build-types/color-palette/types.d.ts.map +1 -1
  453. package/build-types/color-palette/utils.d.ts +1 -1
  454. package/build-types/color-palette/utils.d.ts.map +1 -1
  455. package/build-types/color-picker/color-input.d.ts +1 -11
  456. package/build-types/color-picker/color-input.d.ts.map +1 -1
  457. package/build-types/color-picker/component.d.ts +8 -9
  458. package/build-types/color-picker/component.d.ts.map +1 -1
  459. package/build-types/color-picker/hex-input.d.ts +1 -10
  460. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  461. package/build-types/color-picker/hsl-input.d.ts +1 -10
  462. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  463. package/build-types/color-picker/input-with-slider.d.ts +1 -9
  464. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  465. package/build-types/color-picker/legacy-adapter.d.ts +1 -3
  466. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  467. package/build-types/color-picker/picker.d.ts +4 -7
  468. package/build-types/color-picker/picker.d.ts.map +1 -1
  469. package/build-types/color-picker/rgb-input.d.ts +1 -10
  470. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  471. package/build-types/color-picker/stories/index.d.ts +19 -0
  472. package/build-types/color-picker/stories/index.d.ts.map +1 -0
  473. package/build-types/color-picker/styles.d.ts +3 -3
  474. package/build-types/color-picker/test/index.d.ts +2 -0
  475. package/build-types/color-picker/test/index.d.ts.map +1 -0
  476. package/build-types/color-picker/types.d.ts +107 -3
  477. package/build-types/color-picker/types.d.ts.map +1 -1
  478. package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
  479. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  480. package/build-types/combobox-control/types.d.ts +2 -2
  481. package/build-types/combobox-control/types.d.ts.map +1 -1
  482. package/build-types/confirm-dialog/component.d.ts +4 -4
  483. package/build-types/confirm-dialog/types.d.ts +5 -5
  484. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  485. package/build-types/custom-gradient-picker/constants.d.ts +25 -0
  486. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -0
  487. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +8 -0
  488. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -0
  489. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +8 -0
  490. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -0
  491. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +4 -0
  492. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -0
  493. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
  494. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
  495. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +90 -0
  496. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -0
  497. package/build-types/custom-gradient-picker/index.d.ts +28 -0
  498. package/build-types/custom-gradient-picker/index.d.ts.map +1 -0
  499. package/build-types/custom-gradient-picker/serializer.d.ts +14 -0
  500. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -0
  501. package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
  502. package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
  503. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +12 -0
  504. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -0
  505. package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
  506. package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
  507. package/build-types/custom-gradient-picker/types.d.ts +120 -0
  508. package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
  509. package/build-types/custom-gradient-picker/utils.d.ts +13 -0
  510. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -0
  511. package/build-types/custom-select-control/styles.d.ts +1 -1
  512. package/build-types/custom-select-control/styles.d.ts.map +1 -1
  513. package/build-types/dashicon/types.d.ts +2 -2
  514. package/build-types/dashicon/types.d.ts.map +1 -1
  515. package/build-types/date-time/date-time/styles.d.ts +1 -4
  516. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  517. package/build-types/date-time/time/styles.d.ts +1 -1
  518. package/build-types/date-time/types.d.ts +4 -4
  519. package/build-types/date-time/types.d.ts.map +1 -1
  520. package/build-types/dimension-control/index.d.ts +28 -0
  521. package/build-types/dimension-control/index.d.ts.map +1 -0
  522. package/build-types/dimension-control/sizes.d.ts +26 -0
  523. package/build-types/dimension-control/sizes.d.ts.map +1 -0
  524. package/build-types/dimension-control/stories/index.d.ts +12 -0
  525. package/build-types/dimension-control/stories/index.d.ts.map +1 -0
  526. package/build-types/dimension-control/types.d.ts +47 -0
  527. package/build-types/dimension-control/types.d.ts.map +1 -0
  528. package/build-types/divider/types.d.ts +1 -1
  529. package/build-types/divider/types.d.ts.map +1 -1
  530. package/build-types/draggable/types.d.ts +1 -1
  531. package/build-types/draggable/types.d.ts.map +1 -1
  532. package/build-types/drop-zone/types.d.ts +2 -2
  533. package/build-types/drop-zone/types.d.ts.map +1 -1
  534. package/build-types/dropdown/types.d.ts +3 -3
  535. package/build-types/dropdown/types.d.ts.map +1 -1
  536. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
  537. package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +4 -4
  538. package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
  539. package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
  540. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
  541. package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
  542. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
  543. package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
  544. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
  545. package/build-types/duotone-picker/index.d.ts +3 -0
  546. package/build-types/duotone-picker/index.d.ts.map +1 -0
  547. package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
  548. package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
  549. package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
  550. package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
  551. package/build-types/duotone-picker/types.d.ts +60 -0
  552. package/build-types/duotone-picker/types.d.ts.map +1 -0
  553. package/build-types/duotone-picker/utils.d.ts +52 -0
  554. package/build-types/duotone-picker/utils.d.ts.map +1 -0
  555. package/build-types/elevation/types.d.ts +1 -1
  556. package/build-types/elevation/types.d.ts.map +1 -1
  557. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  558. package/build-types/external-link/types.d.ts +1 -1
  559. package/build-types/external-link/types.d.ts.map +1 -1
  560. package/build-types/flex/types.d.ts +4 -4
  561. package/build-types/flex/types.d.ts.map +1 -1
  562. package/build-types/focal-point-picker/types.d.ts +7 -7
  563. package/build-types/focal-point-picker/types.d.ts.map +1 -1
  564. package/build-types/font-size-picker/index.d.ts.map +1 -1
  565. package/build-types/font-size-picker/stories/index.d.ts.map +1 -1
  566. package/build-types/font-size-picker/types.d.ts +9 -5
  567. package/build-types/font-size-picker/types.d.ts.map +1 -1
  568. package/build-types/form-file-upload/types.d.ts +1 -1
  569. package/build-types/form-file-upload/types.d.ts.map +1 -1
  570. package/build-types/form-toggle/types.d.ts +1 -1
  571. package/build-types/form-toggle/types.d.ts.map +1 -1
  572. package/build-types/form-token-field/index.d.ts.map +1 -1
  573. package/build-types/form-token-field/stories/index.d.ts +6 -0
  574. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  575. package/build-types/form-token-field/styles.d.ts +1 -1
  576. package/build-types/form-token-field/styles.d.ts.map +1 -1
  577. package/build-types/form-token-field/types.d.ts +7 -1
  578. package/build-types/form-token-field/types.d.ts.map +1 -1
  579. package/build-types/gradient-picker/index.d.ts +50 -0
  580. package/build-types/gradient-picker/index.d.ts.map +1 -0
  581. package/build-types/gradient-picker/stories/index.d.ts +14 -0
  582. package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
  583. package/build-types/gradient-picker/types.d.ts +87 -0
  584. package/build-types/gradient-picker/types.d.ts.map +1 -0
  585. package/build-types/grid/types.d.ts +2 -2
  586. package/build-types/grid/types.d.ts.map +1 -1
  587. package/build-types/guide/icons.d.ts +5 -0
  588. package/build-types/guide/icons.d.ts.map +1 -0
  589. package/build-types/guide/index.d.ts +37 -0
  590. package/build-types/guide/index.d.ts.map +1 -0
  591. package/build-types/guide/page-control.d.ts +4 -0
  592. package/build-types/guide/page-control.d.ts.map +1 -0
  593. package/build-types/guide/page.d.ts +7 -0
  594. package/build-types/guide/page.d.ts.map +1 -0
  595. package/build-types/guide/stories/index.d.ts +9 -0
  596. package/build-types/guide/stories/index.d.ts.map +1 -0
  597. package/build-types/guide/test/index.d.ts +2 -0
  598. package/build-types/guide/test/index.d.ts.map +1 -0
  599. package/build-types/guide/types.d.ts +65 -0
  600. package/build-types/guide/types.d.ts.map +1 -0
  601. package/build-types/h-stack/types.d.ts +6 -6
  602. package/build-types/h-stack/types.d.ts.map +1 -1
  603. package/build-types/heading/hook.d.ts +1 -1
  604. package/build-types/heading/types.d.ts +2 -2
  605. package/build-types/heading/types.d.ts.map +1 -1
  606. package/build-types/higher-order/navigate-regions/index.d.ts +46 -0
  607. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -0
  608. package/build-types/higher-order/with-fallback-styles/index.d.ts +44 -0
  609. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -0
  610. package/build-types/higher-order/with-filters/index.d.ts +89 -0
  611. package/build-types/higher-order/with-filters/index.d.ts.map +1 -0
  612. package/build-types/higher-order/with-filters/test/index.d.ts +2 -0
  613. package/build-types/higher-order/with-filters/test/index.d.ts.map +1 -0
  614. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  615. package/build-types/higher-order/with-focus-return/index.d.ts +20 -0
  616. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -0
  617. package/build-types/higher-order/with-focus-return/test/index.d.ts +2 -0
  618. package/build-types/higher-order/with-focus-return/test/index.d.ts.map +1 -0
  619. package/build-types/higher-order/with-notices/index.d.ts +37 -0
  620. package/build-types/higher-order/with-notices/index.d.ts.map +1 -0
  621. package/build-types/higher-order/with-notices/test/index.d.ts +2 -0
  622. package/build-types/higher-order/with-notices/test/index.d.ts.map +1 -0
  623. package/build-types/higher-order/with-notices/types.d.ts +34 -0
  624. package/build-types/higher-order/with-notices/types.d.ts.map +1 -0
  625. package/build-types/higher-order/with-spoken-messages/index.d.ts +13 -2
  626. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  627. package/build-types/higher-order/with-spoken-messages/test/index.d.ts +2 -0
  628. package/build-types/higher-order/with-spoken-messages/test/index.d.ts.map +1 -0
  629. package/build-types/icon/index.d.ts +10 -6
  630. package/build-types/icon/index.d.ts.map +1 -1
  631. package/build-types/icon/test/index.d.ts +2 -0
  632. package/build-types/icon/test/index.d.ts.map +1 -0
  633. package/build-types/input-control/reducer/actions.d.ts +15 -15
  634. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  635. package/build-types/input-control/reducer/state.d.ts +1 -1
  636. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  637. package/build-types/input-control/styles/input-control-styles.d.ts +4 -4
  638. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  639. package/build-types/input-control/types.d.ts +7 -7
  640. package/build-types/input-control/types.d.ts.map +1 -1
  641. package/build-types/item-group/item/hook.d.ts +1 -1
  642. package/build-types/item-group/types.d.ts +2 -2
  643. package/build-types/item-group/types.d.ts.map +1 -1
  644. package/build-types/keyboard-shortcuts/types.d.ts +3 -3
  645. package/build-types/keyboard-shortcuts/types.d.ts.map +1 -1
  646. package/build-types/menu-group/types.d.ts +1 -1
  647. package/build-types/menu-group/types.d.ts.map +1 -1
  648. package/build-types/menu-item/index.d.ts +1 -1
  649. package/build-types/menu-items-choice/types.d.ts +2 -2
  650. package/build-types/menu-items-choice/types.d.ts.map +1 -1
  651. package/build-types/modal/types.d.ts +1 -1
  652. package/build-types/modal/types.d.ts.map +1 -1
  653. package/build-types/navigable-container/container.d.ts +1 -1
  654. package/build-types/navigable-container/menu.d.ts +1 -1
  655. package/build-types/navigable-container/tabbable.d.ts +1 -1
  656. package/build-types/navigation/back-button/index.d.ts +5 -0
  657. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  658. package/build-types/navigation/constants.d.ts +3 -0
  659. package/build-types/navigation/constants.d.ts.map +1 -0
  660. package/build-types/navigation/context.d.ts +5 -0
  661. package/build-types/navigation/context.d.ts.map +1 -0
  662. package/build-types/navigation/group/context.d.ts +8 -0
  663. package/build-types/navigation/group/context.d.ts.map +1 -0
  664. package/build-types/navigation/group/index.d.ts +5 -0
  665. package/build-types/navigation/group/index.d.ts.map +1 -0
  666. package/build-types/navigation/index.d.ts +46 -0
  667. package/build-types/navigation/index.d.ts.map +1 -0
  668. package/build-types/navigation/item/base-content.d.ts +4 -0
  669. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  670. package/build-types/navigation/item/base.d.ts +4 -0
  671. package/build-types/navigation/item/base.d.ts.map +1 -0
  672. package/build-types/navigation/item/index.d.ts +5 -0
  673. package/build-types/navigation/item/index.d.ts.map +1 -0
  674. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  675. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  676. package/build-types/navigation/menu/context.d.ts +8 -0
  677. package/build-types/navigation/menu/context.d.ts.map +1 -0
  678. package/build-types/navigation/menu/index.d.ts +5 -0
  679. package/build-types/navigation/menu/index.d.ts.map +1 -0
  680. package/build-types/navigation/menu/menu-title-search.d.ts +4 -0
  681. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  682. package/build-types/navigation/menu/menu-title.d.ts +4 -0
  683. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  684. package/build-types/navigation/menu/search-no-results-found.d.ts +4 -0
  685. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  686. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  687. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  688. package/build-types/navigation/stories/index.d.ts +18 -0
  689. package/build-types/navigation/stories/index.d.ts.map +1 -0
  690. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  691. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  692. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  693. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  694. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  695. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  696. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  697. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  698. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  699. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  700. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  701. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  702. package/build-types/navigation/styles/navigation-styles.d.ts +58 -0
  703. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  704. package/build-types/navigation/test/index.d.ts +2 -0
  705. package/build-types/navigation/test/index.d.ts.map +1 -0
  706. package/build-types/navigation/types.d.ts +267 -0
  707. package/build-types/navigation/types.d.ts.map +1 -0
  708. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  709. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  710. package/build-types/navigation/use-navigation-tree-nodes.d.ts +11 -0
  711. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  712. package/build-types/navigation/utils.d.ts +3 -0
  713. package/build-types/navigation/utils.d.ts.map +1 -0
  714. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  715. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  716. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  717. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  718. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  719. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  720. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
  721. package/build-types/navigator/types.d.ts +12 -12
  722. package/build-types/navigator/types.d.ts.map +1 -1
  723. package/build-types/notice/types.d.ts +7 -7
  724. package/build-types/notice/types.d.ts.map +1 -1
  725. package/build-types/number-control/index.d.ts.map +1 -1
  726. package/build-types/number-control/types.d.ts +1 -1
  727. package/build-types/number-control/types.d.ts.map +1 -1
  728. package/build-types/palette-edit/index.d.ts +37 -0
  729. package/build-types/palette-edit/index.d.ts.map +1 -0
  730. package/build-types/palette-edit/stories/index.d.ts +13 -0
  731. package/build-types/palette-edit/stories/index.d.ts.map +1 -0
  732. package/build-types/palette-edit/styles.d.ts +51 -0
  733. package/build-types/palette-edit/styles.d.ts.map +1 -0
  734. package/build-types/palette-edit/test/index.d.ts +2 -0
  735. package/build-types/palette-edit/test/index.d.ts.map +1 -0
  736. package/build-types/palette-edit/types.d.ts +114 -0
  737. package/build-types/palette-edit/types.d.ts.map +1 -0
  738. package/build-types/panel/body.d.ts +9 -0
  739. package/build-types/panel/body.d.ts.map +1 -0
  740. package/build-types/panel/stories/index.d.ts +19 -0
  741. package/build-types/panel/stories/index.d.ts.map +1 -0
  742. package/build-types/panel/test/body.d.ts +2 -0
  743. package/build-types/panel/test/body.d.ts.map +1 -0
  744. package/build-types/panel/types.d.ts +73 -3
  745. package/build-types/panel/types.d.ts.map +1 -1
  746. package/build-types/placeholder/index.d.ts +1 -1
  747. package/build-types/placeholder/index.d.ts.map +1 -1
  748. package/build-types/placeholder/types.d.ts +2 -2
  749. package/build-types/placeholder/types.d.ts.map +1 -1
  750. package/build-types/popover/limit-shift.d.ts +2 -2
  751. package/build-types/popover/limit-shift.d.ts.map +1 -1
  752. package/build-types/popover/types.d.ts +10 -10
  753. package/build-types/popover/types.d.ts.map +1 -1
  754. package/build-types/popover/utils.d.ts +2 -2
  755. package/build-types/popover/utils.d.ts.map +1 -1
  756. package/build-types/query-controls/author-select.d.ts.map +1 -1
  757. package/build-types/query-controls/category-select.d.ts.map +1 -1
  758. package/build-types/query-controls/terms.d.ts.map +1 -1
  759. package/build-types/query-controls/types.d.ts +12 -12
  760. package/build-types/query-controls/types.d.ts.map +1 -1
  761. package/build-types/radio-control/types.d.ts +1 -1
  762. package/build-types/radio-control/types.d.ts.map +1 -1
  763. package/build-types/radio-group/index.d.ts +1 -1
  764. package/build-types/radio-group/radio/index.d.ts +1 -1
  765. package/build-types/range-control/index.d.ts +2 -2
  766. package/build-types/range-control/index.d.ts.map +1 -1
  767. package/build-types/range-control/types.d.ts +17 -17
  768. package/build-types/range-control/types.d.ts.map +1 -1
  769. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  770. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  771. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  772. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  773. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  774. package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
  775. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  776. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  777. package/build-types/responsive-wrapper/stories/index.d.ts +10 -0
  778. package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -1
  779. package/build-types/responsive-wrapper/types.d.ts +3 -3
  780. package/build-types/responsive-wrapper/types.d.ts.map +1 -1
  781. package/build-types/sandbox/types.d.ts +1 -1
  782. package/build-types/sandbox/types.d.ts.map +1 -1
  783. package/build-types/scrollable/types.d.ts +2 -2
  784. package/build-types/scrollable/types.d.ts.map +1 -1
  785. package/build-types/search-control/types.d.ts +1 -1
  786. package/build-types/search-control/types.d.ts.map +1 -1
  787. package/build-types/select-control/index.d.ts +2 -1
  788. package/build-types/select-control/index.d.ts.map +1 -1
  789. package/build-types/select-control/stories/index.d.ts +3 -3
  790. package/build-types/select-control/stories/index.d.ts.map +1 -1
  791. package/build-types/select-control/types.d.ts +44 -20
  792. package/build-types/select-control/types.d.ts.map +1 -1
  793. package/build-types/shortcut/types.d.ts +1 -1
  794. package/build-types/shortcut/types.d.ts.map +1 -1
  795. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  796. package/build-types/slot-fill/provider.d.ts +1 -0
  797. package/build-types/slot-fill/provider.d.ts.map +1 -1
  798. package/build-types/snackbar/types.d.ts +3 -3
  799. package/build-types/snackbar/types.d.ts.map +1 -1
  800. package/build-types/spacer/types.d.ts +1 -1
  801. package/build-types/spacer/types.d.ts.map +1 -1
  802. package/build-types/spinner/index.d.ts +1 -1
  803. package/build-types/style-provider/types.d.ts +1 -1
  804. package/build-types/style-provider/types.d.ts.map +1 -1
  805. package/build-types/surface/types.d.ts +2 -2
  806. package/build-types/surface/types.d.ts.map +1 -1
  807. package/build-types/tab-panel/index.d.ts.map +1 -1
  808. package/build-types/tab-panel/types.d.ts +5 -5
  809. package/build-types/tab-panel/types.d.ts.map +1 -1
  810. package/build-types/text/types.d.ts +3 -3
  811. package/build-types/text/types.d.ts.map +1 -1
  812. package/build-types/text-control/types.d.ts +1 -1
  813. package/build-types/text-control/types.d.ts.map +1 -1
  814. package/build-types/text-highlight/types.d.ts +1 -1
  815. package/build-types/text-highlight/types.d.ts.map +1 -1
  816. package/build-types/textarea-control/types.d.ts +1 -1
  817. package/build-types/textarea-control/types.d.ts.map +1 -1
  818. package/build-types/theme/types.d.ts +3 -3
  819. package/build-types/theme/types.d.ts.map +1 -1
  820. package/build-types/tip/types.d.ts +1 -1
  821. package/build-types/tip/types.d.ts.map +1 -1
  822. package/build-types/toggle-control/types.d.ts +1 -1
  823. package/build-types/toggle-control/types.d.ts.map +1 -1
  824. package/build-types/toggle-group-control/types.d.ts +10 -10
  825. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  826. package/build-types/toolbar/toolbar/types.d.ts +1 -1
  827. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  828. package/build-types/toolbar/toolbar-button/index.d.ts +165 -11
  829. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  830. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +6 -1
  831. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  832. package/build-types/toolbar/toolbar-button/types.d.ts +45 -0
  833. package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -0
  834. package/build-types/toolbar/toolbar-context/index.d.ts +6 -1
  835. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  836. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +1 -1
  837. package/build-types/toolbar/toolbar-item/index.d.ts +1 -1
  838. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  839. package/build-types/tools-panel/types.d.ts +12 -11
  840. package/build-types/tools-panel/types.d.ts.map +1 -1
  841. package/build-types/tooltip/index.d.ts.map +1 -1
  842. package/build-types/tree-grid/types.d.ts +5 -5
  843. package/build-types/tree-grid/types.d.ts.map +1 -1
  844. package/build-types/tree-select/index.d.ts.map +1 -1
  845. package/build-types/tree-select/types.d.ts +4 -10
  846. package/build-types/tree-select/types.d.ts.map +1 -1
  847. package/build-types/truncate/types.d.ts +2 -2
  848. package/build-types/truncate/types.d.ts.map +1 -1
  849. package/build-types/ui/context/context-connect.d.ts +1 -1
  850. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  851. package/build-types/ui/context/wordpress-component.d.ts +3 -3
  852. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  853. package/build-types/ui/control-group/types.d.ts +2 -2
  854. package/build-types/ui/control-group/types.d.ts.map +1 -1
  855. package/build-types/ui/control-label/types.d.ts +1 -1
  856. package/build-types/ui/control-label/types.d.ts.map +1 -1
  857. package/build-types/ui/form-group/form-group-content.d.ts +1 -1
  858. package/build-types/ui/form-group/form-group-help.d.ts +1 -1
  859. package/build-types/ui/form-group/form-group-label.d.ts +1 -1
  860. package/build-types/ui/form-group/types.d.ts +5 -5
  861. package/build-types/ui/form-group/types.d.ts.map +1 -1
  862. package/build-types/ui/form-group/use-form-group.d.ts +3 -3
  863. package/build-types/ui/spinner/component.d.ts +1 -1
  864. package/build-types/ui/tooltip/content.d.ts +1 -1
  865. package/build-types/ui/tooltip/types.d.ts +2 -2
  866. package/build-types/ui/tooltip/types.d.ts.map +1 -1
  867. package/build-types/ui/utils/font-size.d.ts +1 -1
  868. package/build-types/ui/utils/font-size.d.ts.map +1 -1
  869. package/build-types/ui/utils/space.d.ts +1 -1
  870. package/build-types/ui/utils/space.d.ts.map +1 -1
  871. package/build-types/ui/utils/types.d.ts +4 -4
  872. package/build-types/ui/utils/types.d.ts.map +1 -1
  873. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  874. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  875. package/build-types/unit-control/types.d.ts +5 -5
  876. package/build-types/unit-control/types.d.ts.map +1 -1
  877. package/build-types/utils/breakpoint-values.d.ts +1 -1
  878. package/build-types/utils/colors-values.d.ts +1 -1
  879. package/build-types/utils/config-values.d.ts +9 -9
  880. package/build-types/utils/events.d.ts +1 -1
  881. package/build-types/utils/events.d.ts.map +1 -1
  882. package/build-types/utils/font-values.d.ts +1 -1
  883. package/build-types/utils/font.d.ts.map +1 -1
  884. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  885. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  886. package/build-types/utils/input/input-control.d.ts.map +1 -1
  887. package/build-types/utils/types.d.ts +4 -4
  888. package/build-types/utils/types.d.ts.map +1 -1
  889. package/build-types/v-stack/component.d.ts +1 -4
  890. package/build-types/v-stack/component.d.ts.map +1 -1
  891. package/build-types/v-stack/hook.d.ts.map +1 -1
  892. package/build-types/v-stack/stories/index.d.ts +1 -4
  893. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  894. package/build-types/v-stack/types.d.ts +5 -3
  895. package/build-types/v-stack/types.d.ts.map +1 -1
  896. package/build-types/view/types.d.ts +1 -1
  897. package/build-types/view/types.d.ts.map +1 -1
  898. package/build-types/visually-hidden/types.d.ts +1 -1
  899. package/build-types/visually-hidden/types.d.ts.map +1 -1
  900. package/build-types/z-stack/types.d.ts +1 -1
  901. package/build-types/z-stack/types.d.ts.map +1 -1
  902. package/package.json +20 -20
  903. package/src/angle-picker-control/angle-circle.tsx +0 -1
  904. package/src/angle-picker-control/index.tsx +14 -27
  905. package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
  906. package/src/animate/index.tsx +75 -0
  907. package/src/animate/stories/index.tsx +102 -0
  908. package/src/animate/types.ts +32 -0
  909. package/src/autocomplete/README.md +51 -0
  910. package/src/autocomplete/{autocompleter-ui.js → autocompleter-ui.tsx} +21 -10
  911. package/src/autocomplete/{get-default-use-items.js → get-default-use-items.tsx} +11 -6
  912. package/src/autocomplete/{index.js → index.tsx} +77 -111
  913. package/src/autocomplete/test/{index.js → index.tsx} +31 -20
  914. package/src/autocomplete/types.ts +220 -0
  915. package/src/border-box-control/stories/index.tsx +1 -1
  916. package/src/border-control/test/index.js +0 -2
  917. package/src/box-control/axial-input-controls.tsx +1 -1
  918. package/src/button/style.scss +12 -1
  919. package/src/button/types.ts +2 -2
  920. package/src/circular-option-picker/style.scss +10 -0
  921. package/src/circular-option-picker/types.ts +1 -1
  922. package/src/color-indicator/style.scss +1 -0
  923. package/src/color-palette/test/__snapshots__/index.tsx.snap +16 -14
  924. package/src/color-picker/README.md +2 -2
  925. package/src/color-picker/color-input.tsx +1 -12
  926. package/src/color-picker/component.tsx +9 -18
  927. package/src/color-picker/hex-input.tsx +2 -7
  928. package/src/color-picker/hsl-input.tsx +2 -7
  929. package/src/color-picker/input-with-slider.tsx +1 -9
  930. package/src/color-picker/legacy-adapter.tsx +1 -2
  931. package/src/color-picker/picker.tsx +5 -6
  932. package/src/color-picker/rgb-input.tsx +2 -7
  933. package/src/color-picker/stories/index.tsx +51 -0
  934. package/src/color-picker/test/{index.js → index.tsx} +36 -18
  935. package/src/color-picker/types.ts +128 -1
  936. package/src/color-picker/use-deprecated-props.ts +2 -53
  937. package/src/combobox-control/stories/index.tsx +1 -1
  938. package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
  939. package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -132
  940. package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -8
  941. package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
  942. package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
  943. package/src/custom-gradient-picker/{index.js → index.tsx} +63 -20
  944. package/src/custom-gradient-picker/serializer.ts +82 -0
  945. package/src/custom-gradient-picker/stories/index.tsx +45 -0
  946. package/src/custom-gradient-picker/style.scss +25 -4
  947. package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
  948. package/src/custom-gradient-picker/types.ts +137 -0
  949. package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -20
  950. package/src/custom-select-control/test/index.js +6 -4
  951. package/src/dimension-control/README.md +22 -55
  952. package/src/dimension-control/index.tsx +101 -0
  953. package/src/dimension-control/{sizes.js → sizes.ts} +8 -5
  954. package/src/dimension-control/stories/index.tsx +48 -0
  955. package/src/dimension-control/types.ts +48 -0
  956. package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
  957. package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
  958. package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
  959. package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
  960. package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
  961. package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
  962. package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
  963. package/src/duotone-picker/types.ts +61 -0
  964. package/src/duotone-picker/{utils.js → utils.ts} +29 -14
  965. package/src/flex/flex/hook.ts +2 -2
  966. package/src/flex/flex-item/README.md +1 -1
  967. package/src/font-size-picker/README.md +26 -20
  968. package/src/font-size-picker/index.tsx +2 -1
  969. package/src/font-size-picker/stories/index.tsx +1 -0
  970. package/src/font-size-picker/test/index.tsx +23 -0
  971. package/src/font-size-picker/types.ts +4 -0
  972. package/src/form-token-field/README.md +1 -0
  973. package/src/form-token-field/index.tsx +14 -4
  974. package/src/form-token-field/stories/index.tsx +13 -0
  975. package/src/form-token-field/style.scss +0 -7
  976. package/src/form-token-field/test/index.tsx +81 -0
  977. package/src/form-token-field/types.ts +6 -0
  978. package/src/gradient-picker/README.md +16 -23
  979. package/src/gradient-picker/{index.js → index.tsx} +70 -14
  980. package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
  981. package/src/gradient-picker/types.ts +89 -0
  982. package/src/guide/README.md +17 -15
  983. package/src/guide/{icons.js → icons.tsx} +1 -1
  984. package/src/guide/{index.js → index.tsx} +47 -7
  985. package/src/guide/{page-control.js → page-control.tsx} +2 -1
  986. package/src/guide/{page.js → page.tsx} +8 -1
  987. package/src/guide/stories/{index.js → index.tsx} +11 -5
  988. package/src/guide/test/{index.js → index.tsx} +22 -4
  989. package/src/guide/types.ts +68 -0
  990. package/src/h-stack/README.md +2 -2
  991. package/src/h-stack/types.ts +2 -2
  992. package/src/h-stack/utils.ts +3 -3
  993. package/src/higher-order/navigate-regions/{index.js → index.tsx} +47 -11
  994. package/src/higher-order/with-fallback-styles/{index.js → index.tsx} +22 -5
  995. package/src/higher-order/with-filters/{index.js → index.tsx} +44 -12
  996. package/src/higher-order/with-filters/test/{index.js → index.tsx} +5 -1
  997. package/src/higher-order/with-focus-return/index.tsx +74 -0
  998. package/src/higher-order/with-focus-return/test/{index.js → index.tsx} +2 -2
  999. package/src/higher-order/with-notices/README.md +4 -1
  1000. package/src/higher-order/with-notices/index.tsx +116 -0
  1001. package/src/higher-order/with-notices/test/{index.js → index.tsx} +11 -6
  1002. package/src/higher-order/with-notices/types.ts +35 -0
  1003. package/src/higher-order/with-spoken-messages/test/{index.js → index.tsx} +2 -1
  1004. package/src/icon/index.tsx +11 -15
  1005. package/src/icon/test/{index.js → index.tsx} +6 -2
  1006. package/src/index.native.js +1 -0
  1007. package/src/item-group/test/index.js +5 -3
  1008. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
  1009. package/src/mobile/bottom-sheet/cell.native.js +1 -1
  1010. package/src/mobile/bottom-sheet-text-control/README.md +8 -1
  1011. package/src/mobile/bottom-sheet-text-control/index.native.js +2 -1
  1012. package/src/mobile/link-settings/test/link-settings-navigation.native.js +1 -1
  1013. package/src/navigation/README.md +16 -2
  1014. package/src/navigation/back-button/{index.js → index.tsx} +22 -6
  1015. package/src/navigation/{context.js → context.tsx} +8 -5
  1016. package/src/navigation/group/context.tsx +15 -0
  1017. package/src/navigation/group/{index.js → index.tsx} +9 -1
  1018. package/src/navigation/{index.js → index.tsx} +63 -7
  1019. package/src/navigation/item/{base-content.js → base-content.tsx} +5 -2
  1020. package/src/navigation/item/{base.js → base.tsx} +3 -1
  1021. package/src/navigation/item/{index.js → index.tsx} +8 -2
  1022. package/src/navigation/item/{use-navigation-tree-item.js → use-navigation-tree-item.tsx} +9 -2
  1023. package/src/navigation/menu/context.tsx +18 -0
  1024. package/src/navigation/menu/{index.js → index.tsx} +5 -1
  1025. package/src/navigation/menu/{menu-title-search.js → menu-title-search.tsx} +11 -7
  1026. package/src/navigation/menu/{menu-title.js → menu-title.tsx} +5 -3
  1027. package/src/navigation/menu/{search-no-results-found.js → search-no-results-found.tsx} +5 -1
  1028. package/src/navigation/menu/{use-navigation-tree-menu.js → use-navigation-tree-menu.tsx} +3 -1
  1029. package/src/navigation/stories/index.tsx +53 -0
  1030. package/src/navigation/stories/utils/{controlled-state.js → controlled-state.tsx} +32 -13
  1031. package/src/navigation/stories/utils/{default.js → default.tsx} +20 -6
  1032. package/src/navigation/stories/utils/{group.js → group.tsx} +21 -7
  1033. package/src/navigation/stories/utils/{hide-if-empty.js → hide-if-empty.tsx} +19 -6
  1034. package/src/navigation/stories/utils/{more-examples.js → more-examples.tsx} +30 -12
  1035. package/src/navigation/stories/utils/{search.js → search.tsx} +21 -7
  1036. package/src/navigation/test/{index.js → index.tsx} +17 -4
  1037. package/src/navigation/types.ts +325 -0
  1038. package/src/navigation/{use-create-navigation-tree.js → use-create-navigation-tree.tsx} +37 -25
  1039. package/src/navigation/{use-navigation-tree-nodes.js → use-navigation-tree-nodes.tsx} +10 -6
  1040. package/src/navigation/{utils.js → utils.tsx} +2 -2
  1041. package/src/navigator/navigator-screen/component.tsx +13 -7
  1042. package/src/navigator/test/index.tsx +65 -22
  1043. package/src/number-control/index.tsx +0 -2
  1044. package/src/palette-edit/{index.js → index.tsx} +114 -48
  1045. package/src/palette-edit/stories/index.tsx +82 -0
  1046. package/src/palette-edit/test/{index.js → index.tsx} +15 -3
  1047. package/src/palette-edit/types.ts +126 -0
  1048. package/src/panel/README.md +53 -35
  1049. package/src/panel/{body.js → body.tsx} +31 -17
  1050. package/src/panel/stories/{index.js → index.tsx} +16 -6
  1051. package/src/panel/test/{body.js → body.tsx} +12 -17
  1052. package/src/panel/types.ts +78 -0
  1053. package/src/placeholder/index.tsx +2 -6
  1054. package/src/placeholder/test/index.tsx +1 -1
  1055. package/src/placeholder/types.ts +2 -2
  1056. package/src/popover/test/index.tsx +5 -2
  1057. package/src/query-controls/author-select.tsx +1 -6
  1058. package/src/query-controls/category-select.tsx +1 -6
  1059. package/src/query-controls/terms.ts +29 -18
  1060. package/src/range-control/index.tsx +2 -6
  1061. package/src/range-control/types.ts +3 -3
  1062. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -1
  1063. package/src/resizable-box/resize-tooltip/utils.ts +1 -1
  1064. package/src/responsive-wrapper/README.md +8 -2
  1065. package/src/responsive-wrapper/index.tsx +18 -17
  1066. package/src/responsive-wrapper/stories/index.tsx +41 -0
  1067. package/src/responsive-wrapper/style.scss +5 -11
  1068. package/src/responsive-wrapper/types.ts +2 -2
  1069. package/src/sandbox/index.native.js +71 -78
  1070. package/src/select-control/index.tsx +16 -16
  1071. package/src/select-control/stories/index.tsx +24 -12
  1072. package/src/select-control/types.ts +68 -40
  1073. package/src/slot-fill/test/slot.js +8 -6
  1074. package/src/style.scss +1 -1
  1075. package/src/tab-panel/index.tsx +7 -2
  1076. package/src/tab-panel/types.ts +4 -4
  1077. package/src/toolbar/toolbar-button/README.md +13 -1
  1078. package/src/toolbar/toolbar-button/{index.js → index.tsx} +55 -20
  1079. package/src/toolbar/toolbar-button/toolbar-button-container.tsx +13 -0
  1080. package/src/toolbar/toolbar-button/types.ts +46 -0
  1081. package/src/toolbar/toolbar-context/index.ts +15 -0
  1082. package/src/tools-panel/test/index.tsx +86 -0
  1083. package/src/tools-panel/tools-panel/hook.ts +44 -4
  1084. package/src/tools-panel/types.ts +1 -0
  1085. package/src/tooltip/index.js +11 -1
  1086. package/src/tooltip/test/index.js +251 -301
  1087. package/src/tree-select/index.tsx +5 -2
  1088. package/src/tree-select/types.ts +6 -13
  1089. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  1090. package/src/utils/font.js +1 -6
  1091. package/src/utils/input/input-control.js +1 -0
  1092. package/src/v-stack/README.md +2 -2
  1093. package/src/v-stack/hook.ts +6 -4
  1094. package/src/v-stack/stories/index.tsx +28 -7
  1095. package/src/v-stack/test/__snapshots__/index.tsx.snap +20 -18
  1096. package/src/v-stack/types.ts +5 -3
  1097. package/tsconfig.json +1 -15
  1098. package/tsconfig.tsbuildinfo +1 -1
  1099. package/build/color-list-picker/index.js.map +0 -1
  1100. package/build-module/color-list-picker/index.js.map +0 -1
  1101. package/build-types/color-list-picker/index.d.ts.map +0 -1
  1102. package/build-types/color-list-picker/types.d.ts.map +0 -1
  1103. package/src/animate/index.js +0 -58
  1104. package/src/animate/stories/index.js +0 -53
  1105. package/src/color-picker/stories/index.js +0 -41
  1106. package/src/custom-gradient-picker/gradient-bar/utils.js +0 -187
  1107. package/src/custom-gradient-picker/serializer.js +0 -46
  1108. package/src/custom-gradient-picker/stories/index.js +0 -33
  1109. package/src/dimension-control/index.js +0 -73
  1110. package/src/higher-order/with-focus-return/index.js +0 -64
  1111. package/src/higher-order/with-notices/index.js +0 -104
  1112. package/src/navigation/group/context.js +0 -9
  1113. package/src/navigation/menu/context.js +0 -11
  1114. package/src/navigation/stories/index.js +0 -33
  1115. package/src/toolbar/toolbar-button/toolbar-button-container.js +0 -6
  1116. package/src/toolbar/toolbar-context/index.js +0 -10
  1117. /package/build/{color-list-picker → animate}/types.js +0 -0
  1118. /package/build-module/{color-list-picker → animate}/types.js +0 -0
  1119. /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
  1120. /package/{build/color-list-picker → build-module/autocomplete}/types.js.map +0 -0
  1121. /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
  1122. /package/src/animation/{index.js → index.tsx} +0 -0
  1123. /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
  1124. /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
  1125. /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
  1126. /package/src/duotone-picker/{index.js → index.ts} +0 -0
  1127. /package/src/higher-order/with-filters/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1128. /package/src/higher-order/with-spoken-messages/{index.js → index.tsx} +0 -0
  1129. /package/src/navigation/{constants.js → constants.tsx} +0 -0
  1130. /package/src/navigation/styles/{navigation-styles.js → navigation-styles.tsx} +0 -0
  1131. /package/src/panel/test/__snapshots__/{body.js.snap → body.tsx.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/legacy-adapter.tsx"],"names":["ColorPicker","useDeprecatedProps","LegacyAdapter","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,WAAP,MAAwB,aAAxB;AACA,SAASC,kBAAT,QAAmC,wBAAnC;AAIA,OAAO,MAAMC,aAAa,GAAKC,KAAF,IAAiC;AAC7D,SAAO,cAAC,WAAD,EAAkBF,kBAAkB,CAAEE,KAAF,CAApC,CAAP;AACA,CAFM","sourcesContent":["/**\n * Internal dependencies\n */\nimport ColorPicker from './component';\nimport { useDeprecatedProps } from './use-deprecated-props';\n\ntype LegacyAdapterProps = Parameters< typeof useDeprecatedProps >[ 0 ];\n\nexport const LegacyAdapter = ( props: LegacyAdapterProps ) => {\n\treturn <ColorPicker { ...useDeprecatedProps( props ) } />;\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-picker/legacy-adapter.tsx"],"names":["ColorPicker","useDeprecatedProps","LegacyAdapter","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,WAAP,MAAwB,aAAxB;AAEA,SAASC,kBAAT,QAAmC,wBAAnC;AAEA,OAAO,MAAMC,aAAa,GAAKC,KAAF,IAAiC;AAC7D,SAAO,cAAC,WAAD,EAAkBF,kBAAkB,CAAEE,KAAF,CAApC,CAAP;AACA,CAFM","sourcesContent":["/**\n * Internal dependencies\n */\nimport ColorPicker from './component';\nimport type { LegacyAdapterProps } from './types';\nimport { useDeprecatedProps } from './use-deprecated-props';\n\nexport const LegacyAdapter = ( props: LegacyAdapterProps ) => {\n\treturn <ColorPicker { ...useDeprecatedProps( props ) } />;\n};\n"]}
@@ -10,6 +10,10 @@ import { colord } from 'colord';
10
10
  */
11
11
 
12
12
  import { useMemo } from '@wordpress/element';
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
13
17
  export const Picker = _ref => {
14
18
  let {
15
19
  color,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/picker.tsx"],"names":["RgbStringColorPicker","RgbaStringColorPicker","colord","useMemo","Picker","color","enableAlpha","onChange","Component","rgbColor","toRgbString","nextColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,oBAAT,EAA+BC,qBAA/B,QAA4D,gBAA5D;AACA,SAASC,MAAT,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAOA,OAAO,MAAMC,MAAM,GAAG,QAAqD;AAAA,MAAnD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,GAAmD;AAC1E,QAAMC,SAAS,GAAGF,WAAW,GAC1BL,qBAD0B,GAE1BD,oBAFH;AAGA,QAAMS,QAAQ,GAAGN,OAAO,CAAE,MAAME,KAAK,CAACK,WAAN,EAAR,EAA6B,CAAEL,KAAF,CAA7B,CAAxB;AAEA,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGI,QADT;AAEC,IAAA,QAAQ,EAAKE,SAAF,IAAiB;AAC3BJ,MAAAA,QAAQ,CAAEL,MAAM,CAAES,SAAF,CAAR,CAAR;AACA;AAJF,IADD;AAQA,CAdM","sourcesContent":["/**\n * External dependencies\n */\nimport { RgbStringColorPicker, RgbaStringColorPicker } from 'react-colorful';\nimport { colord, Colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\ninterface PickerProps {\n\tcolor: Colord;\n\tenableAlpha: boolean;\n\tonChange: ( nextColor: Colord ) => void;\n}\n\nexport const Picker = ( { color, enableAlpha, onChange }: PickerProps ) => {\n\tconst Component = enableAlpha\n\t\t? RgbaStringColorPicker\n\t\t: RgbStringColorPicker;\n\tconst rgbColor = useMemo( () => color.toRgbString(), [ color ] );\n\n\treturn (\n\t\t<Component\n\t\t\tcolor={ rgbColor }\n\t\t\tonChange={ ( nextColor ) => {\n\t\t\t\tonChange( colord( nextColor ) );\n\t\t\t} }\n\t\t/>\n\t);\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-picker/picker.tsx"],"names":["RgbStringColorPicker","RgbaStringColorPicker","colord","useMemo","Picker","color","enableAlpha","onChange","Component","rgbColor","toRgbString","nextColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,oBAAT,EAA+BC,qBAA/B,QAA4D,gBAA5D;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA;AACA;AACA;;AAGA,OAAO,MAAMC,MAAM,GAAG,QAAqD;AAAA,MAAnD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,GAAmD;AAC1E,QAAMC,SAAS,GAAGF,WAAW,GAC1BL,qBAD0B,GAE1BD,oBAFH;AAGA,QAAMS,QAAQ,GAAGN,OAAO,CAAE,MAAME,KAAK,CAACK,WAAN,EAAR,EAA6B,CAAEL,KAAF,CAA7B,CAAxB;AAEA,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGI,QADT;AAEC,IAAA,QAAQ,EAAKE,SAAF,IAAiB;AAC3BJ,MAAAA,QAAQ,CAAEL,MAAM,CAAES,SAAF,CAAR,CAAR;AACA;AAJF,IADD;AAQA,CAdM","sourcesContent":["/**\n * External dependencies\n */\nimport { RgbStringColorPicker, RgbaStringColorPicker } from 'react-colorful';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport type { PickerProps } from './types';\n\nexport const Picker = ( { color, enableAlpha, onChange }: PickerProps ) => {\n\tconst Component = enableAlpha\n\t\t? RgbaStringColorPicker\n\t\t: RgbStringColorPicker;\n\tconst rgbColor = useMemo( () => color.toRgbString(), [ color ] );\n\n\treturn (\n\t\t<Component\n\t\t\tcolor={ rgbColor }\n\t\t\tonChange={ ( nextColor ) => {\n\t\t\t\tonChange( colord( nextColor ) );\n\t\t\t} }\n\t\t/>\n\t);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/rgb-input.tsx"],"names":["colord","InputWithSlider","RgbInput","color","onChange","enableAlpha","r","g","b","a","toRgb","nextR","nextG","nextB","Math","trunc","nextA"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAQA,OAAO,MAAMC,QAAQ,GAAG,QAAuD;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAqD;AAC9E,QAAM;AAAEC,IAAAA,CAAF;AAAKC,IAAAA,CAAL;AAAQC,IAAAA,CAAR;AAAWC,IAAAA;AAAX,MAAiBN,KAAK,CAACO,KAAN,EAAvB;AAEA,SACC,8BACC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGJ,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IACVP,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,MAAAA,CAAC,EAAEK,KAAL;AAAYJ,MAAAA,CAAZ;AAAeC,MAAAA,CAAf;AAAkBC,MAAAA;AAAlB,KAAF,CAAR;AAPV,IADD,EAWC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,OAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGF,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IACVR,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,MAAAA,CAAF;AAAKC,MAAAA,CAAC,EAAEK,KAAR;AAAeJ,MAAAA,CAAf;AAAkBC,MAAAA;AAAlB,KAAF,CAAR;AAPV,IAXD,EAqBC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,MAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGD,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IACVT,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,MAAAA,CAAF;AAAKC,MAAAA,CAAL;AAAQC,MAAAA,CAAC,EAAEK,KAAX;AAAkBJ,MAAAA;AAAlB,KAAF,CAAR;AAPV,IArBD,EA+BGJ,WAAW,IACZ,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,OAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGS,IAAI,CAACC,KAAL,CAAYN,CAAC,GAAG,GAAhB,CALT;AAMC,IAAA,QAAQ,EAAKO,KAAF,IACVZ,QAAQ,CACPJ,MAAM,CAAE;AACPM,MAAAA,CADO;AAEPC,MAAAA,CAFO;AAGPC,MAAAA,CAHO;AAIPC,MAAAA,CAAC,EAAEO,KAAK,GAAG;AAJJ,KAAF,CADC;AAPV,IAhCF,CADD;AAqDA,CAxDM","sourcesContent":["/**\n * External dependencies\n */\nimport { colord, Colord } from 'colord';\n\n/**\n * Internal dependencies\n */\nimport { InputWithSlider } from './input-with-slider';\n\ninterface RgbInputProps {\n\tcolor: Colord;\n\tonChange: ( nextColor: Colord ) => void;\n\tenableAlpha: boolean;\n}\n\nexport const RgbInput = ( { color, onChange, enableAlpha }: RgbInputProps ) => {\n\tconst { r, g, b, a } = color.toRgb();\n\n\treturn (\n\t\t<>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 255 }\n\t\t\t\tlabel=\"Red\"\n\t\t\t\tabbreviation=\"R\"\n\t\t\t\tvalue={ r }\n\t\t\t\tonChange={ ( nextR: number ) =>\n\t\t\t\t\tonChange( colord( { r: nextR, g, b, a } ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 255 }\n\t\t\t\tlabel=\"Green\"\n\t\t\t\tabbreviation=\"G\"\n\t\t\t\tvalue={ g }\n\t\t\t\tonChange={ ( nextG: number ) =>\n\t\t\t\t\tonChange( colord( { r, g: nextG, b, a } ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 255 }\n\t\t\t\tlabel=\"Blue\"\n\t\t\t\tabbreviation=\"B\"\n\t\t\t\tvalue={ b }\n\t\t\t\tonChange={ ( nextB: number ) =>\n\t\t\t\t\tonChange( colord( { r, g, b: nextB, a } ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ enableAlpha && (\n\t\t\t\t<InputWithSlider\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ 100 }\n\t\t\t\t\tlabel=\"Alpha\"\n\t\t\t\t\tabbreviation=\"A\"\n\t\t\t\t\tvalue={ Math.trunc( a * 100 ) }\n\t\t\t\t\tonChange={ ( nextA: number ) =>\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tcolord( {\n\t\t\t\t\t\t\t\tr,\n\t\t\t\t\t\t\t\tg,\n\t\t\t\t\t\t\t\tb,\n\t\t\t\t\t\t\t\ta: nextA / 100,\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"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-picker/rgb-input.tsx"],"names":["colord","InputWithSlider","RgbInput","color","onChange","enableAlpha","r","g","b","a","toRgb","nextR","nextG","nextB","Math","trunc","nextA"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAGA,OAAO,MAAMC,QAAQ,GAAG,QAAuD;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAqD;AAC9E,QAAM;AAAEC,IAAAA,CAAF;AAAKC,IAAAA,CAAL;AAAQC,IAAAA,CAAR;AAAWC,IAAAA;AAAX,MAAiBN,KAAK,CAACO,KAAN,EAAvB;AAEA,SACC,8BACC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGJ,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IACVP,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,MAAAA,CAAC,EAAEK,KAAL;AAAYJ,MAAAA,CAAZ;AAAeC,MAAAA,CAAf;AAAkBC,MAAAA;AAAlB,KAAF,CAAR;AAPV,IADD,EAWC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,OAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGF,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IACVR,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,MAAAA,CAAF;AAAKC,MAAAA,CAAC,EAAEK,KAAR;AAAeJ,MAAAA,CAAf;AAAkBC,MAAAA;AAAlB,KAAF,CAAR;AAPV,IAXD,EAqBC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,MAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGD,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IACVT,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,MAAAA,CAAF;AAAKC,MAAAA,CAAL;AAAQC,MAAAA,CAAC,EAAEK,KAAX;AAAkBJ,MAAAA;AAAlB,KAAF,CAAR;AAPV,IArBD,EA+BGJ,WAAW,IACZ,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,OAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGS,IAAI,CAACC,KAAL,CAAYN,CAAC,GAAG,GAAhB,CALT;AAMC,IAAA,QAAQ,EAAKO,KAAF,IACVZ,QAAQ,CACPJ,MAAM,CAAE;AACPM,MAAAA,CADO;AAEPC,MAAAA,CAFO;AAGPC,MAAAA,CAHO;AAIPC,MAAAA,CAAC,EAAEO,KAAK,GAAG;AAJJ,KAAF,CADC;AAPV,IAhCF,CADD;AAqDA,CAxDM","sourcesContent":["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * Internal dependencies\n */\nimport { InputWithSlider } from './input-with-slider';\nimport type { RgbInputProps } from './types';\n\nexport const RgbInput = ( { color, onChange, enableAlpha }: RgbInputProps ) => {\n\tconst { r, g, b, a } = color.toRgb();\n\n\treturn (\n\t\t<>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 255 }\n\t\t\t\tlabel=\"Red\"\n\t\t\t\tabbreviation=\"R\"\n\t\t\t\tvalue={ r }\n\t\t\t\tonChange={ ( nextR: number ) =>\n\t\t\t\t\tonChange( colord( { r: nextR, g, b, a } ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 255 }\n\t\t\t\tlabel=\"Green\"\n\t\t\t\tabbreviation=\"G\"\n\t\t\t\tvalue={ g }\n\t\t\t\tonChange={ ( nextG: number ) =>\n\t\t\t\t\tonChange( colord( { r, g: nextG, b, a } ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 255 }\n\t\t\t\tlabel=\"Blue\"\n\t\t\t\tabbreviation=\"B\"\n\t\t\t\tvalue={ b }\n\t\t\t\tonChange={ ( nextB: number ) =>\n\t\t\t\t\tonChange( colord( { r, g, b: nextB, a } ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ enableAlpha && (\n\t\t\t\t<InputWithSlider\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ 100 }\n\t\t\t\t\tlabel=\"Alpha\"\n\t\t\t\t\tabbreviation=\"A\"\n\t\t\t\t\tvalue={ Math.trunc( a * 100 ) }\n\t\t\t\t\tonChange={ ( nextA: number ) =>\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tcolord( {\n\t\t\t\t\t\t\t\tr,\n\t\t\t\t\t\t\t\tg,\n\t\t\t\t\t\t\t\tb,\n\t\t\t\t\t\t\t\ta: nextA / 100,\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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-picker/use-deprecated-props.ts"],"names":["colord","memoize","useCallback","isLegacyProps","props","onChangeComplete","disableAlpha","color","hex","getColorFromLegacyProps","undefined","transformColorStringToLegacyColor","colordColor","toHex","rgb","toRgb","hsv","toHsv","hsl","toHsl","source","oldHue","h","useDeprecatedProps","leg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AAMoB,mBAAmB,GAAGtB,WAAW,CACpCK,KAAF,IAAqB;AACpBF,IAAAA,gBAAgB,CAAEM,iCAAiC,CAAEJ,KAAF,CAAnC,CAAhB;AACA,GAHqC,EAItC,CAAEF,gBAAF,CAJsC,CAAvC;;AAMA,MAAKF,aAAa,CAAEC,KAAF,CAAlB,EAA8B;AAC7B,WAAO;AACNG,MAAAA,KAAK,EAAEE,uBAAuB,CAAEL,KAAK,CAACG,KAAR,CADxB;AAENkB,MAAAA,WAAW,EAAE,CAAErB,KAAK,CAACE,YAFf;AAGNoB,MAAAA,QAAQ,EAAEF;AAHJ,KAAP;AAKA;;AACD,SAAO,EACN,GAAGpB,KADG;AAENG,IAAAA,KAAK,EAAEH,KAAK,CAACG,KAFP;AAGNkB,IAAAA,WAAW,EAAIrB,KAAF,CAA8BqB,WAHrC;AAINC,IAAAA,QAAQ,EAAItB,KAAF,CAA8BsB;AAJlC,GAAP;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tcolord,\n\tHslColor,\n\tHslaColor,\n\tHsvColor,\n\tHsvaColor,\n\tRgbColor,\n\tRgbaColor,\n} from 'colord';\nimport type { ComponentProps } from 'react';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type ColorPicker from './component';\n\ntype ColorPickerProps = ComponentProps< typeof ColorPicker >;\n\n/**\n * @deprecated\n */\ntype LegacyColor =\n\t| string\n\t| {\n\t\t\thex: string;\n\t\t\thsl: HslColor | HslaColor;\n\t\t\thsv: HsvColor | HsvaColor;\n\t\t\trgb: RgbColor | RgbaColor;\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t */\n\t\t\toldHue: number;\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t */\n\t\t\tsource: 'hex';\n\t };\n\n/**\n * @deprecated\n */\nexport interface LegacyProps {\n\tcolor?: LegacyColor;\n\t/**\n\t * @deprecated\n\t */\n\tonChangeComplete: ( colors: LegacyColor ) => void;\n\t/**\n\t * @deprecated\n\t */\n\toldHue: string;\n\tclassName: string;\n\t/**\n\t * @deprecated\n\t */\n\tdisableAlpha: boolean;\n}\n\nfunction isLegacyProps( props: any ): props is LegacyProps {\n\treturn (\n\t\ttypeof props.onChangeComplete !== 'undefined' ||\n\t\ttypeof props.disableAlpha !== 'undefined' ||\n\t\ttypeof props.color?.hex === 'string'\n\t);\n}\n\nfunction getColorFromLegacyProps(\n\tcolor: LegacyProps[ 'color' ]\n): string | undefined {\n\tif ( color === undefined ) return;\n\n\tif ( typeof color === 'string' ) return color;\n\n\tif ( color.hex ) return color.hex;\n\n\treturn undefined;\n}\n\nconst transformColorStringToLegacyColor = memoize(\n\t( color: string ): LegacyColor => {\n\t\tconst colordColor = colord( color );\n\t\tconst hex = colordColor.toHex();\n\t\tconst rgb = colordColor.toRgb();\n\t\tconst hsv = colordColor.toHsv();\n\t\tconst hsl = colordColor.toHsl();\n\n\t\treturn {\n\t\t\thex,\n\t\t\trgb,\n\t\t\thsv,\n\t\t\thsl,\n\t\t\tsource: 'hex',\n\t\t\toldHue: hsl.h,\n\t\t};\n\t}\n);\n\nexport function useDeprecatedProps(\n\tprops: LegacyProps | ColorPickerProps\n): ColorPickerProps {\n\tconst { onChangeComplete } = props as LegacyProps;\n\tconst legacyChangeHandler = useCallback(\n\t\t( color: string ) => {\n\t\t\tonChangeComplete( transformColorStringToLegacyColor( color ) );\n\t\t},\n\t\t[ onChangeComplete ]\n\t);\n\tif ( isLegacyProps( props ) ) {\n\t\treturn {\n\t\t\tcolor: getColorFromLegacyProps( props.color ),\n\t\t\tenableAlpha: ! props.disableAlpha,\n\t\t\tonChange: legacyChangeHandler,\n\t\t};\n\t}\n\treturn {\n\t\t...props,\n\t\tcolor: props.color as ColorPickerProps[ 'color' ],\n\t\tenableAlpha: ( props as ColorPickerProps ).enableAlpha,\n\t\tonChange: ( props as ColorPickerProps ).onChange,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-picker/use-deprecated-props.ts"],"names":["colord","memoize","useCallback","isLegacyProps","props","onChangeComplete","disableAlpha","color","hex","getColorFromLegacyProps","undefined","transformColorStringToLegacyColor","colordColor","toHex","rgb","toRgb","hsv","toHsv","hsl","toHsl","source","oldHue","h","useDeprecatedProps","legacyChangeHandler","enableAlpha","onChange"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AACA,OAAOC,OAAP,MAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AAGA,SAASC,aAAT,CAAwBC,KAAxB,EAA2D;AAAA;;AAC1D,SACC,OAAOA,KAAK,CAACC,gBAAb,KAAkC,WAAlC,IACA,OAAOD,KAAK,CAACE,YAAb,KAA8B,WAD9B,IAEA,wBAAOF,KAAK,CAACG,KAAb,iDAAO,aAAaC,GAApB,MAA4B,QAH7B;AAKA;;AAED,SAASC,uBAAT,CACCF,KADD,EAEsB;AACrB,MAAKA,KAAK,KAAKG,SAAf,EAA2B;AAE3B,MAAK,OAAOH,KAAP,KAAiB,QAAtB,EAAiC,OAAOA,KAAP;AAEjC,MAAKA,KAAK,CAACC,GAAX,EAAiB,OAAOD,KAAK,CAACC,GAAb;AAEjB,SAAOE,SAAP;AACA;;AAED,MAAMC,iCAAiC,GAAGV,OAAO,CAC9CM,KAAF,IAAkC;AACjC,QAAMK,WAAW,GAAGZ,MAAM,CAAEO,KAAF,CAA1B;AACA,QAAMC,GAAG,GAAGI,WAAW,CAACC,KAAZ,EAAZ;AACA,QAAMC,GAAG,GAAGF,WAAW,CAACG,KAAZ,EAAZ;AACA,QAAMC,GAAG,GAAGJ,WAAW,CAACK,KAAZ,EAAZ;AACA,QAAMC,GAAG,GAAGN,WAAW,CAACO,KAAZ,EAAZ;AAEA,SAAO;AACNX,IAAAA,GADM;AAENM,IAAAA,GAFM;AAGNE,IAAAA,GAHM;AAINE,IAAAA,GAJM;AAKNE,IAAAA,MAAM,EAAE,KALF;AAMNC,IAAAA,MAAM,EAAEH,GAAG,CAACI;AANN,GAAP;AAQA,CAhB+C,CAAjD;AAmBA,OAAO,SAASC,kBAAT,CACNnB,KADM,EAEa;AACnB,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,KAA7B;AACA,QAAMoB,mBAAmB,GAAGtB,WAAW,CACpCK,KAAF,IAAqB;AACpBF,IAAAA,gBAAgB,CAAEM,iCAAiC,CAAEJ,KAAF,CAAnC,CAAhB;AACA,GAHqC,EAItC,CAAEF,gBAAF,CAJsC,CAAvC;;AAMA,MAAKF,aAAa,CAAEC,KAAF,CAAlB,EAA8B;AAC7B,WAAO;AACNG,MAAAA,KAAK,EAAEE,uBAAuB,CAAEL,KAAK,CAACG,KAAR,CADxB;AAENkB,MAAAA,WAAW,EAAE,CAAErB,KAAK,CAACE,YAFf;AAGNoB,MAAAA,QAAQ,EAAEF;AAHJ,KAAP;AAKA;;AACD,SAAO,EACN,GAAGpB,KADG;AAENG,IAAAA,KAAK,EAAEH,KAAK,CAACG,KAFP;AAGNkB,IAAAA,WAAW,EAAIrB,KAAF,CAA8BqB,WAHrC;AAINC,IAAAA,QAAQ,EAAItB,KAAF,CAA8BsB;AAJlC,GAAP;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport { colord } from 'colord';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ColorPickerProps, LegacyColor, LegacyProps } from './types';\n\nfunction isLegacyProps( props: any ): props is LegacyProps {\n\treturn (\n\t\ttypeof props.onChangeComplete !== 'undefined' ||\n\t\ttypeof props.disableAlpha !== 'undefined' ||\n\t\ttypeof props.color?.hex === 'string'\n\t);\n}\n\nfunction getColorFromLegacyProps(\n\tcolor: LegacyProps[ 'color' ]\n): string | undefined {\n\tif ( color === undefined ) return;\n\n\tif ( typeof color === 'string' ) return color;\n\n\tif ( color.hex ) return color.hex;\n\n\treturn undefined;\n}\n\nconst transformColorStringToLegacyColor = memoize(\n\t( color: string ): LegacyColor => {\n\t\tconst colordColor = colord( color );\n\t\tconst hex = colordColor.toHex();\n\t\tconst rgb = colordColor.toRgb();\n\t\tconst hsv = colordColor.toHsv();\n\t\tconst hsl = colordColor.toHsl();\n\n\t\treturn {\n\t\t\thex,\n\t\t\trgb,\n\t\t\thsv,\n\t\t\thsl,\n\t\t\tsource: 'hex',\n\t\t\toldHue: hsl.h,\n\t\t};\n\t}\n);\n\nexport function useDeprecatedProps(\n\tprops: LegacyProps | ColorPickerProps\n): ColorPickerProps {\n\tconst { onChangeComplete } = props as LegacyProps;\n\tconst legacyChangeHandler = useCallback(\n\t\t( color: string ) => {\n\t\t\tonChangeComplete( transformColorStringToLegacyColor( color ) );\n\t\t},\n\t\t[ onChangeComplete ]\n\t);\n\tif ( isLegacyProps( props ) ) {\n\t\treturn {\n\t\t\tcolor: getColorFromLegacyProps( props.color ),\n\t\t\tenableAlpha: ! props.disableAlpha,\n\t\t\tonChange: legacyChangeHandler,\n\t\t};\n\t}\n\treturn {\n\t\t...props,\n\t\tcolor: props.color as ColorPickerProps[ 'color' ],\n\t\tenableAlpha: ( props as ColorPickerProps ).enableAlpha,\n\t\tonChange: ( props as ColorPickerProps ).onChange,\n\t};\n}\n"]}
@@ -6,7 +6,7 @@ export const DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%
6
6
  export const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
7
7
  export const HORIZONTAL_GRADIENT_ORIENTATION = {
8
8
  type: 'angular',
9
- value: 90
9
+ value: '90'
10
10
  };
11
11
  export const GRADIENT_OPTIONS = [{
12
12
  value: 'linear-gradient',
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/constants.js"],"names":["__","DEFAULT_GRADIENT","DEFAULT_LINEAR_GRADIENT_ANGLE","HORIZONTAL_GRADIENT_ORIENTATION","type","value","GRADIENT_OPTIONS","label","DIRECTIONAL_ORIENTATION_ANGLE_MAP","top","right","bottom","left"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA,OAAO,MAAMC,gBAAgB,GAC5B,0EADM;AAGP,OAAO,MAAMC,6BAA6B,GAAG,GAAtC;AAEP,OAAO,MAAMC,+BAA+B,GAAG;AAC9CC,EAAAA,IAAI,EAAE,SADwC;AAE9CC,EAAAA,KAAK,EAAE;AAFuC,CAAxC;AAKP,OAAO,MAAMC,gBAAgB,GAAG,CAC/B;AAAED,EAAAA,KAAK,EAAE,iBAAT;AAA4BE,EAAAA,KAAK,EAAEP,EAAE,CAAE,QAAF;AAArC,CAD+B,EAE/B;AAAEK,EAAAA,KAAK,EAAE,iBAAT;AAA4BE,EAAAA,KAAK,EAAEP,EAAE,CAAE,QAAF;AAArC,CAF+B,CAAzB;AAKP,OAAO,MAAMQ,iCAAiC,GAAG;AAChDC,EAAAA,GAAG,EAAE,CAD2C;AAEhD,eAAa,EAFmC;AAGhD,eAAa,EAHmC;AAIhDC,EAAAA,KAAK,EAAE,EAJyC;AAKhD,kBAAgB,GALgC;AAMhD,kBAAgB,GANgC;AAOhDC,EAAAA,MAAM,EAAE,GAPwC;AAQhD,iBAAe,GARiC;AAShD,iBAAe,GATiC;AAUhDC,EAAAA,IAAI,EAAE,GAV0C;AAWhD,cAAY,GAXoC;AAYhD,cAAY;AAZoC,CAA1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const DEFAULT_GRADIENT =\n\t'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';\n\nexport const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;\n\nexport const HORIZONTAL_GRADIENT_ORIENTATION = {\n\ttype: 'angular',\n\tvalue: 90,\n};\n\nexport const GRADIENT_OPTIONS = [\n\t{ value: 'linear-gradient', label: __( 'Linear' ) },\n\t{ value: 'radial-gradient', label: __( 'Radial' ) },\n];\n\nexport const DIRECTIONAL_ORIENTATION_ANGLE_MAP = {\n\ttop: 0,\n\t'top right': 45,\n\t'right top': 45,\n\tright: 90,\n\t'right bottom': 135,\n\t'bottom right': 135,\n\tbottom: 180,\n\t'bottom left': 225,\n\t'left bottom': 225,\n\tleft: 270,\n\t'top left': 315,\n\t'left top': 315,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/constants.ts"],"names":["__","DEFAULT_GRADIENT","DEFAULT_LINEAR_GRADIENT_ANGLE","HORIZONTAL_GRADIENT_ORIENTATION","type","value","GRADIENT_OPTIONS","label","DIRECTIONAL_ORIENTATION_ANGLE_MAP","top","right","bottom","left"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA,OAAO,MAAMC,gBAAgB,GAC5B,0EADM;AAGP,OAAO,MAAMC,6BAA6B,GAAG,GAAtC;AAEP,OAAO,MAAMC,+BAA+B,GAAG;AAC9CC,EAAAA,IAAI,EAAE,SADwC;AAE9CC,EAAAA,KAAK,EAAE;AAFuC,CAAxC;AAKP,OAAO,MAAMC,gBAAgB,GAAG,CAC/B;AAAED,EAAAA,KAAK,EAAE,iBAAT;AAA4BE,EAAAA,KAAK,EAAEP,EAAE,CAAE,QAAF;AAArC,CAD+B,EAE/B;AAAEK,EAAAA,KAAK,EAAE,iBAAT;AAA4BE,EAAAA,KAAK,EAAEP,EAAE,CAAE,QAAF;AAArC,CAF+B,CAAzB;AAKP,OAAO,MAAMQ,iCAAiC,GAAG;AAChDC,EAAAA,GAAG,EAAE,CAD2C;AAEhD,eAAa,EAFmC;AAGhD,eAAa,EAHmC;AAIhDC,EAAAA,KAAK,EAAE,EAJyC;AAKhD,kBAAgB,GALgC;AAMhD,kBAAgB,GANgC;AAOhDC,EAAAA,MAAM,EAAE,GAPwC;AAQhD,iBAAe,GARiC;AAShD,iBAAe,GATiC;AAUhDC,EAAAA,IAAI,EAAE,GAV0C;AAWhD,cAAY,GAXoC;AAYhD,cAAY;AAZoC,CAA1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const DEFAULT_GRADIENT =\n\t'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';\n\nexport const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;\n\nexport const HORIZONTAL_GRADIENT_ORIENTATION = {\n\ttype: 'angular',\n\tvalue: '90',\n} as const;\n\nexport const GRADIENT_OPTIONS = [\n\t{ value: 'linear-gradient', label: __( 'Linear' ) },\n\t{ value: 'radial-gradient', label: __( 'Radial' ) },\n];\n\nexport const DIRECTIONAL_ORIENTATION_ANGLE_MAP = {\n\ttop: 0,\n\t'top right': 45,\n\t'right top': 45,\n\tright: 90,\n\t'right bottom': 135,\n\t'bottom right': 135,\n\tbottom: 180,\n\t'bottom left': 225,\n\t'left bottom': 225,\n\tleft: 270,\n\t'top left': 315,\n\t'left top': 315,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/constants.js"],"names":["GRADIENT_MARKERS_WIDTH","INSERT_POINT_WIDTH","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","MINIMUM_DISTANCE_BETWEEN_POINTS","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER"],"mappings":"AAAA,OAAO,MAAMA,sBAAsB,GAAG,EAA/B;AACP,OAAO,MAAMC,kBAAkB,GAAG,EAA3B;AACP,OAAO,MAAMC,2CAA2C,GAAG,EAApD;AACP,OAAO,MAAMC,+BAA+B,GAAG,CAAxC;AACP,OAAO,MAAMC,wBAAwB,GAAG,CAAjC;AAEP,OAAO,MAAMC,gCAAgC,GAC5CH,2CADM;AAEP,OAAO,MAAMI,4CAA4C,GACxD,CAAEL,kBAAkB,GAAGD,sBAAvB,IAAkD,CAD5C","sourcesContent":["export const GRADIENT_MARKERS_WIDTH = 16;\nexport const INSERT_POINT_WIDTH = 16;\nexport const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;\nexport const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;\nexport const MINIMUM_SIGNIFICANT_MOVE = 5;\n\nexport const KEYBOARD_CONTROL_POINT_VARIATION =\n\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;\nexport const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER =\n\t( INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH ) / 2;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/constants.ts"],"names":["GRADIENT_MARKERS_WIDTH","INSERT_POINT_WIDTH","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","MINIMUM_DISTANCE_BETWEEN_POINTS","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER"],"mappings":"AAAA,OAAO,MAAMA,sBAAsB,GAAG,EAA/B;AACP,OAAO,MAAMC,kBAAkB,GAAG,EAA3B;AACP,OAAO,MAAMC,2CAA2C,GAAG,EAApD;AACP,OAAO,MAAMC,+BAA+B,GAAG,CAAxC;AACP,OAAO,MAAMC,wBAAwB,GAAG,CAAjC;AAEP,OAAO,MAAMC,gCAAgC,GAC5CH,2CADM;AAEP,OAAO,MAAMI,4CAA4C,GACxD,CAAEL,kBAAkB,GAAGD,sBAAvB,IAAkD,CAD5C","sourcesContent":["export const GRADIENT_MARKERS_WIDTH = 16;\nexport const INSERT_POINT_WIDTH = 16;\nexport const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;\nexport const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;\nexport const MINIMUM_SIGNIFICANT_MOVE = 5;\n\nexport const KEYBOARD_CONTROL_POINT_VARIATION =\n\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;\nexport const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER =\n\t( INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH ) / 2;\n"]}
@@ -83,6 +83,10 @@ function ControlPoints(_ref3) {
83
83
  const controlPointMoveState = useRef();
84
84
 
85
85
  const onMouseMove = event => {
86
+ if (controlPointMoveState.current === undefined || gradientPickerDomRef.current === null) {
87
+ return;
88
+ }
89
+
86
90
  const relativePosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current);
87
91
  const {
88
92
  initialPosition,
@@ -113,10 +117,12 @@ function ControlPoints(_ref3) {
113
117
  cleanEventListenersRef.current = cleanEventListeners;
114
118
  useEffect(() => {
115
119
  return () => {
116
- cleanEventListenersRef.current();
120
+ var _cleanEventListenersR;
121
+
122
+ (_cleanEventListenersR = cleanEventListenersRef.current) === null || _cleanEventListenersR === void 0 ? void 0 : _cleanEventListenersR.call(cleanEventListenersRef);
117
123
  };
118
124
  }, []);
119
- return controlPoints.map((point, index) => {
125
+ return createElement(Fragment, null, controlPoints.map((point, index) => {
120
126
  const initialPosition = point === null || point === void 0 ? void 0 : point.position;
121
127
  return ignoreMarkerPosition !== initialPosition && createElement(GradientColorPickerDropdown, {
122
128
  isRenderedInSidebar: __experimentalIsRenderedInSidebar,
@@ -199,7 +205,7 @@ function ControlPoints(_ref3) {
199
205
  transform: 'translateX( -50% )'
200
206
  }
201
207
  });
202
- });
208
+ }));
203
209
  }
204
210
 
205
211
  function InsertPoint(_ref6) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.js"],"names":["classnames","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","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","GradientColorPickerDropdown","isRenderedInSidebar","className","props","popoverProps","placement","offset","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","relativePosition","clientX","current","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","onToggle","addEventListener","code","stopPropagation","onClose","toRgbString","length","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,EAAsCC,OAAtC,QAAqD,oBAArD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,IAAT,QAAqB,kBAArB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,yBAAT,QAA0C,qBAA1C;AAEA,SACCC,eADD,EAECC,YAFD,EAGCC,kBAHD,EAICC,uBAJD,EAKCC,iCALD,EAMCC,0BAND,EAOCC,qCAPD,QAQO,SARP;AASA,SACCC,wBADD,EAECC,gCAFD,QAGO,aAHP;;AAKA,SAASC,kBAAT,OAA+E;AAAA,MAAlD;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAApB;AAA2B,OAAGC;AAA9B,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Aa;AACvB,YAAK,CAAEsD,oBAAP,EAA8B;AAC7BnC,UAAAA,QAAQ,CACP/B,eAAe,CACd8B,aADc,EAEdmC,cAFc,EAGd/E,MAAM,CAAE0B,KAAF,CAAN,CAAgB8C,WAAhB,EAHc,CADR,CAAR;AAOAS,UAAAA,uBAAuB,CAAE,IAAF,CAAvB;AACA,SATD,MASO;AACNpC,UAAAA,QAAQ,CACP3B,iCAAiC,CAChC0B,aADgC,EAEhCmC,cAFgC,EAGhC/E,MAAM,CAAE0B,KAAF,CAAN,CAAgB8C,WAAhB,EAHgC,CAD1B,CAAR;AAOA;AACD;AArBF,MAxBF;AAgDC,IAAA,KAAK,EACJO,cAAc,KAAK,IAAnB,GACG;AACAL,MAAAA,IAAI,EAAG,GAAGK,cAAgB,GAD1B;AAEAJ,MAAAA,SAAS,EAAE;AAFX,KADH,GAKGO;AAtDL,IADD;AA2DA;;AACD5C,aAAa,CAACsC,WAAd,GAA4BA,WAA5B;AAEA,eAAetC,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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';\n\nfunction ControlPointButton( { isOpen, position, color, ...additionalProps } ) {\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$s: gradient position e.g: 70, %2$s: 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={ classnames(\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} ) {\n\t// Open the popover below the gradient control/insertion point\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\tplacement: 'bottom',\n\t\t\toffset: 8,\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst mergedClassName = classnames(\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} ) {\n\tconst controlPointMoveState = useRef();\n\n\tconst onMouseMove = ( event ) => {\n\t\tconst relativePosition = getHorizontalRelativeGradientPosition(\n\t\t\tevent.clientX,\n\t\t\tgradientPickerDomRef.current\n\t\t);\n\t\tconst { initialPosition, index, significantMoveHappened } =\n\t\t\tcontrolPointMoveState.current;\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\tcontrolPointMoveState.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\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.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\tcontrolPointMoveState.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();\n\tcleanEventListenersRef.current = cleanEventListeners;\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListenersRef.current();\n\t\t};\n\t}, [] );\n\n\treturn controlPoints.map( ( point, index ) => {\n\t\tconst initialPosition = point?.position;\n\t\treturn (\n\t\t\tignoreMarkerPosition !== initialPosition && (\n\t\t\t\t<GradientColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tonClose={ onStopControlPointChange }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ControlPointButton\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current\n\t\t\t\t\t\t\t\t\t\t.significantMoveHappened\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\tonStopControlPointChange();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseDown={ () => {\n\t\t\t\t\t\t\t\tif ( window && window.addEventListener ) {\n\t\t\t\t\t\t\t\t\tcontrolPointMoveState.current = {\n\t\t\t\t\t\t\t\t\t\tinitialPosition,\n\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\tsignificantMoveHappened: false,\n\t\t\t\t\t\t\t\t\t\tlistenersActivated: true,\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tonStartControlPointChange();\n\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t'mousemove',\n\t\t\t\t\t\t\t\t\t\tonMouseMove\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t\t\t\t'mouseup',\n\t\t\t\t\t\t\t\t\t\tcleanEventListeners\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\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif ( event.code === 'ArrowLeft' ) {\n\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// to another editor area.\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\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\tKEYBOARD_CONTROL_POINT_VARIATION\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} else if ( event.code === 'ArrowRight' ) {\n\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// to another editor area.\n\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointPosition(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tclampPercent(\n\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\tKEYBOARD_CONTROL_POINT_VARIATION\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}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tposition={ point.position }\n\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\t\t\t\tcolor={ point.color }\n\t\t\t\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\tupdateControlPointColor(\n\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ ! disableRemove && controlPoints.length > 2 && (\n\t\t\t\t\t\t\t\t<HStack\n\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\talignment=\"center\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tonChange(\n\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\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)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Remove Control Point' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\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\tstyle={ {\n\t\t\t\t\t\tleft: `${ point.position }%`,\n\t\t\t\t\t\ttransform: 'translateX( -50% )',\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} ) {\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<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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/>\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"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/control-points.tsx"],"names":["classnames","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","ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","GradientColorPickerDropdown","isRenderedInSidebar","className","props","popoverProps","placement","offset","mergedClassName","ControlPoints","disableRemove","disableAlpha","gradientPickerDomRef","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","current","undefined","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","onToggle","addEventListener","code","stopPropagation","onClose","toRgbString","length","left","transform","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,QAA5B,EAAsCC,OAAtC,QAAqD,oBAArD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,IAAT,QAAqB,kBAArB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,SAASC,MAAT,QAAuB,eAAvB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,yBAAT,QAA0C,qBAA1C;AAEA,SACCC,eADD,EAECC,YAFD,EAGCC,kBAHD,EAICC,uBAJD,EAKCC,iCALD,EAMCC,0BAND,EAOCC,qCAPD,QAQO,SARP;AASA,SACCC,wBADD,EAECC,gCAFD,QAGO,aAHP;;AAaA,SAASC,kBAAT,OAKwE;AAAA,MAL3C;AAC5BC,IAAAA,MAD4B;AAE5BC,IAAAA,QAF4B;AAG5BC,IAAAA,KAH4B;AAI5B,OAAGC;AAJyB,GAK2C;AACvE,QAAMC,UAAU,GAAG3B,aAAa,CAAEsB,kBAAF,CAAhC;AACA,QAAMM,aAAa,GAAI,uEAAuED,UAAY,EAA1G;AACA,SACC,8BACC,cAAC,MAAD;AACC,kBAAarB,OAAO,EACnB;AACAD,IAAAA,EAAE,CACD,iEADC,CAFiB,EAKnBmB,QALmB,EAMnBC,KANmB,CADrB;AASC,wBAAmBG,aATpB;AAUC,qBAAc,MA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EAHc,CADR,CAAR;AAOAS,UAAAA,uBAAuB,CAAE,IAAF,CAAvB;AACA,SATD,MASO;AACNrC,UAAAA,QAAQ,CACP3B,iCAAiC,CAChC0B,aADgC,EAEhCoC,cAFgC,EAGhChF,MAAM,CAAE0B,KAAF,CAAN,CAAgB+C,WAAhB,EAHgC,CAD1B,CAAR;AAOA;AACD;AArBF,MAxBF;AAgDC,IAAA,KAAK,EACJO,cAAc,KAAK,IAAnB,GACG;AACAL,MAAAA,IAAI,EAAG,GAAGK,cAAgB,GAD1B;AAEAJ,MAAAA,SAAS,EAAE;AAFX,KADH,GAKGvB;AAtDL,IADD;AA2DA;;AACDf,aAAa,CAACuC,WAAd,GAA4BA,WAA5B;AAEA,eAAevC,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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 '../../ui/context';\nimport type {\n\tControlPointButtonProps,\n\tControlPointMoveState,\n\tControlPointsProps,\n\tInsertPointProps,\n} from '../types';\nimport type { CustomColorPickerDropdownProps } from '../../color-palette/types';\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$s: gradient position e.g: 70, %2$s: 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={ classnames(\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} as const ),\n\t\t[]\n\t);\n\n\tconst mergedClassName = classnames(\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 controlPointMoveState = useRef< ControlPointMoveState >();\n\n\tconst onMouseMove = ( event: MouseEvent ) => {\n\t\tif (\n\t\t\tcontrolPointMoveState.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\tcontrolPointMoveState.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\tcontrolPointMoveState.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\tcontrolPointMoveState.current &&\n\t\t\tcontrolPointMoveState.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\tcontrolPointMoveState.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\tcontrolPointMoveState.current &&\n\t\t\t\t\t\t\t\t\t\t\tcontrolPointMoveState.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\tcontrolPointMoveState.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<>\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</>\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<ColorPicker\n\t\t\t\t\tenableAlpha={ ! disableAlpha }\n\t\t\t\t\tonChange={ ( color ) => {\n\t\t\t\t\t\tif ( ! alreadyInsertedPoint ) {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\taddControlPoint(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tsetAlreadyInsertedPoint( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tupdateControlPointColorByPosition(\n\t\t\t\t\t\t\t\t\tcontrolPoints,\n\t\t\t\t\t\t\t\t\tinsertPosition,\n\t\t\t\t\t\t\t\t\tcolord( color ).toRgbString()\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/>\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"]}
@@ -17,7 +17,7 @@ import ControlPoints from './control-points';
17
17
  import { getHorizontalRelativeGradientPosition } from './utils';
18
18
  import { MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT } from './constants';
19
19
 
20
- function customGradientBarReducer(state, action) {
20
+ const customGradientBarReducer = (state, action) => {
21
21
  switch (action.type) {
22
22
  case 'MOVE_INSERTER':
23
23
  if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {
@@ -77,7 +77,7 @@ function customGradientBarReducer(state, action) {
77
77
  }
78
78
 
79
79
  return state;
80
- }
80
+ };
81
81
 
82
82
  const customGradientBarReducerInitialState = {
83
83
  id: 'IDLE'
@@ -90,12 +90,16 @@ export default function CustomGradientBar(_ref) {
90
90
  onChange,
91
91
  disableInserter = false,
92
92
  disableAlpha = false,
93
- __experimentalIsRenderedInSidebar
93
+ __experimentalIsRenderedInSidebar = false
94
94
  } = _ref;
95
- const gradientMarkersContainerDomRef = useRef();
95
+ const gradientMarkersContainerDomRef = useRef(null);
96
96
  const [gradientBarState, gradientBarStateDispatch] = useReducer(customGradientBarReducer, customGradientBarReducerInitialState);
97
97
 
98
98
  const onMouseEnterAndMove = event => {
99
+ if (!gradientMarkersContainerDomRef.current) {
100
+ return;
101
+ }
102
+
99
103
  const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientMarkersContainerDomRef.current); // If the insert point is close to an existing control point don't show it.
100
104
 
101
105
  if (controlPoints.some(_ref2 => {
@@ -133,11 +137,14 @@ export default function CustomGradientBar(_ref) {
133
137
  }),
134
138
  onMouseEnter: onMouseEnterAndMove,
135
139
  onMouseMove: onMouseEnterAndMove,
136
- style: {
137
- background
138
- },
139
140
  onMouseLeave: onMouseLeave
140
141
  }, createElement("div", {
142
+ className: "components-custom-gradient-picker__gradient-bar-background",
143
+ style: {
144
+ background,
145
+ opacity: hasGradient ? 1 : 0.4
146
+ }
147
+ }), createElement("div", {
141
148
  ref: gradientMarkersContainerDomRef,
142
149
  className: "components-custom-gradient-picker__markers-container"
143
150
  }, !disableInserter && (isMovingInserter || isInsertingControlPoint) && createElement(ControlPoints.InsertPoint, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/index.js"],"names":["classnames","useRef","useReducer","ControlPoints","getHorizontalRelativeGradientPosition","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","__experimentalIsRenderedInSidebar","gradientMarkersContainerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","clientX","current","some","position","Math","abs","onMouseLeave","isMovingInserter","isInsertingControlPoint","undefined"],"mappings":";;A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BAAyB,EAAG,MAAM;AACjCM,MAAAA,wBAAwB,CAAE;AACzBf,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA,KAlBF;AAmBC,IAAA,wBAAwB,EAAG,MAAM;AAChCe,MAAAA,wBAAwB,CAAE;AACzBf,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA;AAvBF,IA1BD,CAVD,CADD;AAiEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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';\n\nfunction customGradientBarReducer( state, action ) {\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 = { id: 'IDLE' };\n\nexport default function CustomGradientBar( {\n\tbackground,\n\thasGradient,\n\tvalue: controlPoints,\n\tonChange,\n\tdisableInserter = false,\n\tdisableAlpha = false,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientMarkersContainerDomRef = useRef();\n\n\tconst [ gradientBarState, gradientBarStateDispatch ] = useReducer(\n\t\tcustomGradientBarReducer,\n\t\tcustomGradientBarReducerInitialState\n\t);\n\tconst onMouseEnterAndMove = ( event ) => {\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={ classnames(\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\tstyle={ { background } }\n\t\t\tonMouseLeave={ onMouseLeave }\n\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"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/index.tsx"],"names":["classnames","useRef","useReducer","ControlPoints","getHorizontalRelativeGradientPosition","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","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","opacity","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,UAAjB,QAAmC,oBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,SAASC,qCAAT,QAAsD,SAAtD;AACA,SAASC,2CAAT,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AAG,MAAM;AACjCM,MAAAA,wBAAwB,CAAE;AACzBf,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA,KAlBF;AAmBC,IAAA,wBAAwB,EAAG,MAAM;AAChCe,MAAAA,wBAAwB,CAAE;AACzBf,QAAAA,IAAI,EAAE;AADmB,OAAF,CAAxB;AAGA;AAvBF,IA1BD,CAhBD,CADD;AAuEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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={ classnames(\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"]}
@@ -2,44 +2,26 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { MINIMUM_DISTANCE_BETWEEN_POINTS } from './constants';
5
- /**
6
- * Control point for the gradient bar.
7
- *
8
- * @typedef {Object} ControlPoint
9
- * @property {string} color Color of the control point.
10
- * @property {number} position Integer position of the control point as a percentage.
11
- */
12
-
13
- /**
14
- * Color as parsed from the gradient by gradient-parser.
15
- *
16
- * @typedef {Object} Color
17
- * @property {string} r Red component.
18
- * @property {string} g Green component.
19
- * @property {string} b Green component.
20
- * @property {string} [a] Optional alpha component.
21
- */
22
5
 
23
6
  /**
24
7
  * Clamps a number between 0 and 100.
25
8
  *
26
- * @param {number} value Value to clamp.
9
+ * @param value Value to clamp.
27
10
  *
28
- * @return {number} Value clamped between 0 and 100.
11
+ * @return Value clamped between 0 and 100.
29
12
  */
30
-
31
13
  export function clampPercent(value) {
32
14
  return Math.max(0, Math.min(100, value));
33
15
  }
34
16
  /**
35
17
  * Check if a control point is overlapping with another.
36
18
  *
37
- * @param {ControlPoint[]} value Array of control points.
38
- * @param {number} initialIndex Index of the position to test.
39
- * @param {number} newPosition New position of the control point.
40
- * @param {number} minDistance Distance considered to be overlapping.
19
+ * @param value Array of control points.
20
+ * @param initialIndex Index of the position to test.
21
+ * @param newPosition New position of the control point.
22
+ * @param minDistance Distance considered to be overlapping.
41
23
  *
42
- * @return {boolean} True if the point is overlapping.
24
+ * @return True if the point is overlapping.
43
25
  */
44
26
 
45
27
  export function isOverlapping(value, initialIndex, newPosition) {
@@ -57,11 +39,11 @@ export function isOverlapping(value, initialIndex, newPosition) {
57
39
  /**
58
40
  * Adds a control point from an array and returns the new array.
59
41
  *
60
- * @param {ControlPoint[]} points Array of control points.
61
- * @param {number} position Position to insert the new point.
62
- * @param {Color} color Color to update the control point at index.
42
+ * @param points Array of control points.
43
+ * @param position Position to insert the new point.
44
+ * @param color Color to update the control point at index.
63
45
  *
64
- * @return {ControlPoint[]} New array of control points.
46
+ * @return New array of control points.
65
47
  */
66
48
 
67
49
  export function addControlPoint(points, position, color) {
@@ -77,25 +59,25 @@ export function addControlPoint(points, position, color) {
77
59
  /**
78
60
  * Removes a control point from an array and returns the new array.
79
61
  *
80
- * @param {ControlPoint[]} points Array of control points.
81
- * @param {number} index Index to remove.
62
+ * @param points Array of control points.
63
+ * @param index Index to remove.
82
64
  *
83
- * @return {ControlPoint[]} New array of control points.
65
+ * @return New array of control points.
84
66
  */
85
67
 
86
68
  export function removeControlPoint(points, index) {
87
- return points.filter((point, pointIndex) => {
69
+ return points.filter((_point, pointIndex) => {
88
70
  return pointIndex !== index;
89
71
  });
90
72
  }
91
73
  /**
92
74
  * Updates a control point from an array and returns the new array.
93
75
  *
94
- * @param {ControlPoint[]} points Array of control points.
95
- * @param {number} index Index to update.
96
- * @param {ControlPoint[]} newPoint New control point to replace the index.
76
+ * @param points Array of control points.
77
+ * @param index Index to update.
78
+ * @param newPoint New control point to replace the index.
97
79
  *
98
- * @return {ControlPoint[]} New array of control points.
80
+ * @return New array of control points.
99
81
  */
100
82
 
101
83
  export function updateControlPoint(points, index, newPoint) {
@@ -106,11 +88,11 @@ export function updateControlPoint(points, index, newPoint) {
106
88
  /**
107
89
  * Updates the position of a control point from an array and returns the new array.
108
90
  *
109
- * @param {ControlPoint[]} points Array of control points.
110
- * @param {number} index Index to update.
111
- * @param {number} newPosition Position to move the control point at index.
91
+ * @param points Array of control points.
92
+ * @param index Index to update.
93
+ * @param newPosition Position to move the control point at index.
112
94
  *
113
- * @return {ControlPoint[]} New array of control points.
95
+ * @return New array of control points.
114
96
  */
115
97
 
116
98
  export function updateControlPointPosition(points, index, newPosition) {
@@ -126,11 +108,11 @@ export function updateControlPointPosition(points, index, newPosition) {
126
108
  /**
127
109
  * Updates the position of a control point from an array and returns the new array.
128
110
  *
129
- * @param {ControlPoint[]} points Array of control points.
130
- * @param {number} index Index to update.
131
- * @param {Color} newColor Color to update the control point at index.
111
+ * @param points Array of control points.
112
+ * @param index Index to update.
113
+ * @param newColor Color to update the control point at index.
132
114
  *
133
- * @return {ControlPoint[]} New array of control points.
115
+ * @return New array of control points.
134
116
  */
135
117
 
136
118
  export function updateControlPointColor(points, index, newColor) {
@@ -142,11 +124,11 @@ export function updateControlPointColor(points, index, newColor) {
142
124
  /**
143
125
  * Updates the position of a control point from an array and returns the new array.
144
126
  *
145
- * @param {ControlPoint[]} points Array of control points.
146
- * @param {number} position Position of the color stop.
147
- * @param {string} newColor Color to update the control point at index.
127
+ * @param points Array of control points.
128
+ * @param position Position of the color stop.
129
+ * @param newColor Color to update the control point at index.
148
130
  *
149
- * @return {ControlPoint[]} New array of control points.
131
+ * @return New array of control points.
150
132
  */
151
133
 
152
134
  export function updateControlPointColorByPosition(points, position, newColor) {
@@ -156,10 +138,10 @@ export function updateControlPointColorByPosition(points, position, newColor) {
156
138
  /**
157
139
  * Gets the horizontal coordinate when dragging a control point with the mouse.
158
140
  *
159
- * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
160
- * @param {Element} containerElement Container for the gradient picker.
141
+ * @param mouseXcoordinate Horizontal coordinate of the mouse position.
142
+ * @param containerElement Container for the gradient picker.
161
143
  *
162
- * @return {number | undefined} Whole number percentage from the left.
144
+ * @return Whole number percentage from the left.
163
145
  */
164
146
 
165
147
  export function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/utils.js"],"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","pointIndex","updateControlPoint","newValue","updateControlPointPosition","updateControlPointColor","newColor","updateControlPointColorByPosition","getHorizontalRelativeGradientPosition","mouseXCoordinate","containerElement","x","width","getBoundingClientRect","absolutePositionValue","round"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,+BAAT,QAAgD,aAAhD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAC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AzB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASY,iCAAT,CACNjB,MADM,EAENP,QAFM,EAGNuB,QAHM,EAIL;AACD,QAAMnB,KAAK,GAAGG,MAAM,CAACG,SAAP,CAAoBC,KAAF,IAAaA,KAAK,CAACX,QAAN,KAAmBA,QAAlD,CAAd;AACA,SAAOsB,uBAAuB,CAAEf,MAAF,EAAUH,KAAV,EAAiBmB,QAAjB,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,qCAAT,CACNC,gBADM,EAENC,gBAFM,EAGL;AACD,MAAK,CAAEA,gBAAP,EAA0B;AACzB;AACA;;AACD,QAAM;AAAEC,IAAAA,CAAF;AAAKC,IAAAA;AAAL,MAAeF,gBAAgB,CAACG,qBAAjB,EAArB;AACA,QAAMC,qBAAqB,GAAGL,gBAAgB,GAAGE,CAAjD;AACA,SAAOpC,IAAI,CAACwC,KAAL,CACN1C,YAAY,CAAIyC,qBAAqB,GAAG,GAA1B,GAAkCF,KAApC,CADN,CAAP;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { MINIMUM_DISTANCE_BETWEEN_POINTS } from './constants';\n\n/**\n * Control point for the gradient bar.\n *\n * @typedef {Object} ControlPoint\n * @property {string} color Color of the control point.\n * @property {number} position Integer position of the control point as a percentage.\n */\n\n/**\n * Color as parsed from the gradient by gradient-parser.\n *\n * @typedef {Object} Color\n * @property {string} r Red component.\n * @property {string} g Green component.\n * @property {string} b Green component.\n * @property {string} [a] Optional alpha component.\n */\n\n/**\n * Clamps a number between 0 and 100.\n *\n * @param {number} value Value to clamp.\n *\n * @return {number} Value clamped between 0 and 100.\n */\nexport function clampPercent( value ) {\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 {ControlPoint[]} value Array of control points.\n * @param {number} initialIndex Index of the position to test.\n * @param {number} newPosition New position of the control point.\n * @param {number} minDistance Distance considered to be overlapping.\n *\n * @return {boolean} True if the point is overlapping.\n */\nexport function isOverlapping(\n\tvalue,\n\tinitialIndex,\n\tnewPosition,\n\tminDistance = 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 {ControlPoint[]} points Array of control points.\n * @param {number} position Position to insert the new point.\n * @param {Color} color Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function addControlPoint( points, position, color ) {\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 {ControlPoint[]} points Array of control points.\n * @param {number} index Index to remove.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function removeControlPoint( points, index ) {\n\treturn points.filter( ( point, pointIndex ) => {\n\t\treturn pointIndex !== index;\n\t} );\n}\n\n/**\n * Updates a control point from an array and returns the new array.\n *\n * @param {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {ControlPoint[]} newPoint New control point to replace the index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPoint( points, index, newPoint ) {\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 {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {number} newPosition Position to move the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointPosition( points, index, newPosition ) {\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 {ControlPoint[]} points Array of control points.\n * @param {number} index Index to update.\n * @param {Color} newColor Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointColor( points, index, newColor ) {\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 {ControlPoint[]} points Array of control points.\n * @param {number} position Position of the color stop.\n * @param {string} newColor Color to update the control point at index.\n *\n * @return {ControlPoint[]} New array of control points.\n */\nexport function updateControlPointColorByPosition(\n\tpoints,\n\tposition,\n\tnewColor\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 {number} mouseXCoordinate Horizontal coordinate of the mouse position.\n * @param {Element} containerElement Container for the gradient picker.\n *\n * @return {number | undefined} Whole number percentage from the left.\n */\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXCoordinate,\n\tcontainerElement\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"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/utils.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,+BAAT,QAAgD,aAAhD;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAT,CAAuBC,KAAvB,EAAuC;AAC7C,SAAOC,IAAI,CAACC,GAAL,CAAU,CAAV,EAAaD,IAAI,CAACE,GAAL,CAAU,GAAV,EAAeH,KAAf,CAAb,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,aAAT,CACNJ,KADM,EAENK,YAFM,EAGNC,WAHM,EAKL;AAAA,MADDC,WACC,uEADqBT,+BACrB;AACD,QAAMU,eAAe,GAAGR,KAAK,CAAEK,YAAF,CAAL,CAAsBI,QAA9C;AACA,QAAMC,WAAW,GAAGT,IAAI,CAACE,GAAL,CAAUK,eAAV,EAA2BF,WAA3B,CAApB;AACA,QAAMK,WAAW,GAAGV,IAAI,CAACC,GAAL,CAAUM,eAAV,EAA2BF,WAA3B,CAApB;AAEA,SAAON,KAAK,CAACY,IAAN,CAAY,OAAgBC,KAAhB,KAA2B;AAAA,QAAzB;AAAEJ,MAAAA;AAAF,KAAyB;AAC7C,WACCI,KAAK,KAAKR,YAAV,KACEJ,IAAI,CAACa,GAAL,CAAUL,QAAQ,GAAGH,WAArB,IAAqCC,WAArC,IACCG,WAAW,GAAGD,QAAd,IAA0BA,QAAQ,GAAGE,WAFxC,CADD;AAKA,GANM,CAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,eAAT,CACNC,MADM,EAENP,QAFM,EAGNQ,KAHM,E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AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASW,uBAAT,CACNhB,MADM,EAENH,KAFM,EAGNoB,QAHM,EAIL;AACD,QAAMZ,QAAQ,GAAG,EAChB,GAAGL,MAAM,CAAEH,KAAF,CADO;AAEhBI,IAAAA,KAAK,EAAEgB;AAFS,GAAjB;AAIA,SAAOJ,kBAAkB,CAAEb,MAAF,EAAUH,KAAV,EAAiBQ,QAAjB,CAAzB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASa,iCAAT,CACNlB,MADM,EAENP,QAFM,EAGNwB,QAHM,EAIL;AACD,QAAMpB,KAAK,GAAGG,MAAM,CAACG,SAAP,CAAoBC,KAAF,IAAaA,KAAK,CAACX,QAAN,KAAmBA,QAAlD,CAAd;AACA,SAAOuB,uBAAuB,CAAEhB,MAAF,EAAUH,KAAV,EAAiBoB,QAAjB,CAA9B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,SAASE,qCAAT,CACNC,gBADM,EAENC,gBAFM,EAGL;AACD,MAAK,CAAEA,gBAAP,EAA0B;AACzB;AACA;;AACD,QAAM;AAAEC,IAAAA,CAAF;AAAKC,IAAAA;AAAL,MAAeF,gBAAgB,CAACG,qBAAjB,EAArB;AACA,QAAMC,qBAAqB,GAAGL,gBAAgB,GAAGE,CAAjD;AACA,SAAOrC,IAAI,CAACyC,KAAL,CACN3C,YAAY,CAAI0C,qBAAqB,GAAG,GAA1B,GAAkCF,KAApC,CADN,CAAP;AAGA","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"]}