@wordpress/components 19.12.0 → 19.15.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 (1409) hide show
  1. package/CHANGELOG.md +116 -3
  2. package/CONTRIBUTING.md +94 -12
  3. package/build/alignment-matrix-control/index.js +3 -3
  4. package/build/alignment-matrix-control/index.js.map +1 -1
  5. package/build/alignment-matrix-control/utils.js +1 -7
  6. package/build/alignment-matrix-control/utils.js.map +1 -1
  7. package/build/angle-picker-control/index.js +2 -2
  8. package/build/angle-picker-control/index.js.map +1 -1
  9. package/build/autocomplete/autocompleter-ui.js +4 -2
  10. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  11. package/build/autocomplete/autocompleter-ui.native.js +9 -3
  12. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  13. package/build/autocomplete/get-default-use-items.js +5 -1
  14. package/build/autocomplete/get-default-use-items.js.map +1 -1
  15. package/build/autocomplete/index.js +9 -3
  16. package/build/autocomplete/index.js.map +1 -1
  17. package/build/border-box-control/border-box-control/component.js +2 -1
  18. package/build/border-box-control/border-box-control/component.js.map +1 -1
  19. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  20. package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
  21. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  22. package/build/border-box-control/utils.js.map +1 -1
  23. package/build/border-control/border-control/component.js +40 -4
  24. package/build/border-control/border-control/component.js.map +1 -1
  25. package/build/border-control/border-control/hook.js.map +1 -1
  26. package/build/box-control/all-input-control.js +6 -10
  27. package/build/box-control/all-input-control.js.map +1 -1
  28. package/build/box-control/axial-input-controls.js.map +1 -1
  29. package/build/box-control/index.js +4 -8
  30. package/build/box-control/index.js.map +1 -1
  31. package/build/box-control/input-controls.js +6 -10
  32. package/build/box-control/input-controls.js.map +1 -1
  33. package/build/box-control/unit-control.js +4 -4
  34. package/build/box-control/unit-control.js.map +1 -1
  35. package/build/box-control/utils.js +3 -3
  36. package/build/box-control/utils.js.map +1 -1
  37. package/build/button/index.native.js +1 -3
  38. package/build/button/index.native.js.map +1 -1
  39. package/build/checkbox-control/index.js.map +1 -1
  40. package/build/color-indicator/index.js +27 -10
  41. package/build/color-indicator/index.js.map +1 -1
  42. package/build/color-indicator/types.js +6 -0
  43. package/build/color-indicator/types.js.map +1 -0
  44. package/build/color-palette/index.js +2 -1
  45. package/build/color-palette/index.js.map +1 -1
  46. package/build/color-picker/component.js +6 -9
  47. package/build/color-picker/component.js.map +1 -1
  48. package/build/color-picker/hex-input.js +5 -4
  49. package/build/color-picker/hex-input.js.map +1 -1
  50. package/build/color-picker/index.native.js +35 -34
  51. package/build/color-picker/index.native.js.map +1 -1
  52. package/build/color-picker/input-with-slider.js +4 -3
  53. package/build/color-picker/input-with-slider.js.map +1 -1
  54. package/build/color-picker/styles.js +42 -36
  55. package/build/color-picker/styles.js.map +1 -1
  56. package/build/color-picker/use-deprecated-props.js +22 -31
  57. package/build/color-picker/use-deprecated-props.js.map +1 -1
  58. package/build/combobox-control/index.js +18 -8
  59. package/build/combobox-control/index.js.map +1 -1
  60. package/build/combobox-control/styles.js +39 -0
  61. package/build/combobox-control/styles.js.map +1 -0
  62. package/build/confirm-dialog/component.js.map +1 -1
  63. package/build/custom-gradient-bar/constants.js +1 -3
  64. package/build/custom-gradient-bar/constants.js.map +1 -1
  65. package/build/custom-gradient-bar/control-points.js +15 -8
  66. package/build/custom-gradient-bar/control-points.js.map +1 -1
  67. package/build/custom-gradient-bar/index.js +5 -5
  68. package/build/custom-gradient-bar/index.js.map +1 -1
  69. package/build/custom-gradient-bar/utils.js +5 -7
  70. package/build/custom-gradient-bar/utils.js.map +1 -1
  71. package/build/custom-gradient-picker/index.js +8 -8
  72. package/build/custom-gradient-picker/index.js.map +1 -1
  73. package/build/custom-gradient-picker/index.native.js +8 -9
  74. package/build/custom-gradient-picker/index.native.js.map +1 -1
  75. package/build/custom-gradient-picker/serializer.js +4 -7
  76. package/build/custom-gradient-picker/serializer.js.map +1 -1
  77. package/build/custom-gradient-picker/utils.js.map +1 -1
  78. package/build/custom-select-control/index.js.map +1 -1
  79. package/build/date-time/date/index.js +7 -5
  80. package/build/date-time/date/index.js.map +1 -1
  81. package/build/date-time/date-time/index.js +6 -4
  82. package/build/date-time/date-time/index.js.map +1 -1
  83. package/build/dimension-control/index.js +1 -3
  84. package/build/dimension-control/index.js.map +1 -1
  85. package/build/divider/styles.js +5 -5
  86. package/build/divider/styles.js.map +1 -1
  87. package/build/draggable/index.js.map +1 -1
  88. package/build/draggable/index.native.js +6 -1
  89. package/build/draggable/index.native.js.map +1 -1
  90. package/build/drop-zone/provider.js.map +1 -1
  91. package/build/dropdown/index.js +2 -2
  92. package/build/dropdown/index.js.map +1 -1
  93. package/build/dropdown-menu/index.js +16 -5
  94. package/build/dropdown-menu/index.js.map +1 -1
  95. package/build/dropdown-menu/index.native.js +17 -6
  96. package/build/dropdown-menu/index.native.js.map +1 -1
  97. package/build/duotone-picker/duotone-picker.js +42 -29
  98. package/build/duotone-picker/duotone-picker.js.map +1 -1
  99. package/build/elevation/hook.js +14 -14
  100. package/build/elevation/hook.js.map +1 -1
  101. package/build/external-link/index.js +20 -10
  102. package/build/external-link/index.js.map +1 -1
  103. package/build/external-link/styles/external-link-styles.js +3 -3
  104. package/build/external-link/styles/external-link-styles.js.map +1 -1
  105. package/build/external-link/types.js +6 -0
  106. package/build/external-link/types.js.map +1 -0
  107. package/build/flex/flex/hook.js +9 -5
  108. package/build/flex/flex/hook.js.map +1 -1
  109. package/build/focal-point-picker/controls.js +3 -7
  110. package/build/focal-point-picker/controls.js.map +1 -1
  111. package/build/focal-point-picker/grid.js +2 -7
  112. package/build/focal-point-picker/grid.js.map +1 -1
  113. package/build/focal-point-picker/index.js.map +1 -1
  114. package/build/focal-point-picker/index.native.js +12 -12
  115. package/build/focal-point-picker/index.native.js.map +1 -1
  116. package/build/focal-point-picker/media.js +4 -8
  117. package/build/focal-point-picker/media.js.map +1 -1
  118. package/build/focal-point-picker/tooltip/index.native.js +11 -12
  119. package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
  120. package/build/font-size-picker/index.js +1 -1
  121. package/build/font-size-picker/index.js.map +1 -1
  122. package/build/form-toggle/index.js +34 -9
  123. package/build/form-toggle/index.js.map +1 -1
  124. package/build/form-toggle/types.js +6 -0
  125. package/build/form-toggle/types.js.map +1 -0
  126. package/build/form-token-field/index.js +344 -360
  127. package/build/form-token-field/index.js.map +1 -1
  128. package/build/form-token-field/styles.js +40 -0
  129. package/build/form-token-field/styles.js.map +1 -0
  130. package/build/form-token-field/suggestions-list.js +22 -21
  131. package/build/form-token-field/suggestions-list.js.map +1 -1
  132. package/build/form-token-field/token-input.js +39 -53
  133. package/build/form-token-field/token-input.js.map +1 -1
  134. package/build/form-token-field/token.js +3 -3
  135. package/build/form-token-field/token.js.map +1 -1
  136. package/build/form-token-field/types.js +6 -0
  137. package/build/form-token-field/types.js.map +1 -0
  138. package/build/gradient-picker/index.js.map +1 -1
  139. package/build/grid/component.js +7 -8
  140. package/build/grid/component.js.map +1 -1
  141. package/build/grid/hook.js +1 -5
  142. package/build/grid/hook.js.map +1 -1
  143. package/build/grid/index.js.map +1 -1
  144. package/build/grid/utils.js +4 -7
  145. package/build/grid/utils.js.map +1 -1
  146. package/build/h-stack/component.js +5 -9
  147. package/build/h-stack/component.js.map +1 -1
  148. package/build/h-stack/hook.js +8 -10
  149. package/build/h-stack/hook.js.map +1 -1
  150. package/build/h-stack/index.js.map +1 -1
  151. package/build/h-stack/utils.js +8 -19
  152. package/build/h-stack/utils.js.map +1 -1
  153. package/build/heading/component.js +0 -1
  154. package/build/heading/component.js.map +1 -1
  155. package/build/heading/hook.js.map +1 -1
  156. package/build/heading/types.js +6 -0
  157. package/build/heading/types.js.map +1 -0
  158. package/build/higher-order/navigate-regions/index.js.map +1 -1
  159. package/build/higher-order/with-focus-return/index.js.map +1 -1
  160. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  161. package/build/icon/index.js.map +1 -1
  162. package/build/input-control/index.js +5 -5
  163. package/build/input-control/index.js.map +1 -1
  164. package/build/input-control/input-field.js +10 -10
  165. package/build/input-control/input-field.js.map +1 -1
  166. package/build/input-control/reducer/reducer.js.map +1 -1
  167. package/build/input-control/utils.js +1 -1
  168. package/build/input-control/utils.js.map +1 -1
  169. package/build/menu-item/index.js +1 -3
  170. package/build/menu-item/index.js.map +1 -1
  171. package/build/menu-items-choice/index.js +3 -7
  172. package/build/menu-items-choice/index.js.map +1 -1
  173. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  174. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  175. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -7
  176. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  177. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  178. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
  179. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  180. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  181. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  182. package/build/mobile/color-settings/index.native.js.map +1 -1
  183. package/build/mobile/focal-point-settings-panel/index.native.js +1 -1
  184. package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  185. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  186. package/build/mobile/gradient/index.native.js.map +1 -1
  187. package/build/mobile/html-text-input/index.native.js.map +1 -1
  188. package/build/mobile/image/index.native.js +4 -2
  189. package/build/mobile/image/index.native.js.map +1 -1
  190. package/build/mobile/inserter-button/index.native.js.map +1 -1
  191. package/build/mobile/link-picker/index.native.js +4 -4
  192. package/build/mobile/link-picker/index.native.js.map +1 -1
  193. package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  194. package/build/mobile/media-edit/index.native.js.map +1 -1
  195. package/build/mobile/segmented-control/index.native.js +3 -5
  196. package/build/mobile/segmented-control/index.native.js.map +1 -1
  197. package/build/modal/index.js +18 -4
  198. package/build/modal/index.js.map +1 -1
  199. package/build/navigable-container/container.js +4 -2
  200. package/build/navigable-container/container.js.map +1 -1
  201. package/build/navigation/context.js +12 -16
  202. package/build/navigation/context.js.map +1 -1
  203. package/build/navigation/group/index.js +4 -7
  204. package/build/navigation/group/index.js.map +1 -1
  205. package/build/navigation/index.js +7 -4
  206. package/build/navigation/index.js.map +1 -1
  207. package/build/navigation/item/base.js +6 -3
  208. package/build/navigation/item/base.js.map +1 -1
  209. package/build/navigation/item/index.js +3 -3
  210. package/build/navigation/item/index.js.map +1 -1
  211. package/build/navigation/item/use-navigation-tree-item.js +2 -1
  212. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  213. package/build/navigation/menu/menu-title-search.js +1 -7
  214. package/build/navigation/menu/menu-title-search.js.map +1 -1
  215. package/build/navigation/menu/search-no-results-found.js +1 -7
  216. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  217. package/build/navigation/use-navigation-tree-nodes.js +18 -10
  218. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  219. package/build/navigation/utils.js +4 -2
  220. package/build/navigation/utils.js.map +1 -1
  221. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  222. package/build/navigator/navigator-button/hook.js.map +1 -1
  223. package/build/navigator/navigator-provider/component.js +1 -1
  224. package/build/navigator/navigator-provider/component.js.map +1 -1
  225. package/build/navigator/navigator-screen/component.js +1 -1
  226. package/build/navigator/navigator-screen/component.js.map +1 -1
  227. package/build/notice/index.js +5 -5
  228. package/build/notice/index.js.map +1 -1
  229. package/build/notice/list.js +4 -2
  230. package/build/notice/list.js.map +1 -1
  231. package/build/panel/body.js +3 -3
  232. package/build/panel/body.js.map +1 -1
  233. package/build/placeholder/index.js +26 -12
  234. package/build/placeholder/index.js.map +1 -1
  235. package/build/popover/index.js +4 -4
  236. package/build/popover/index.js.map +1 -1
  237. package/build/radio-control/index.js +43 -7
  238. package/build/radio-control/index.js.map +1 -1
  239. package/build/radio-control/types.js +6 -0
  240. package/build/radio-control/types.js.map +1 -0
  241. package/build/range-control/index.js +63 -47
  242. package/build/range-control/index.js.map +1 -1
  243. package/build/range-control/input-range.js +11 -17
  244. package/build/range-control/input-range.js.map +1 -1
  245. package/build/range-control/mark.js +5 -7
  246. package/build/range-control/mark.js.map +1 -1
  247. package/build/range-control/rail.js +10 -16
  248. package/build/range-control/rail.js.map +1 -1
  249. package/build/range-control/styles/range-control-styles.js +62 -62
  250. package/build/range-control/styles/range-control-styles.js.map +1 -1
  251. package/build/range-control/tooltip.js +5 -7
  252. package/build/range-control/tooltip.js.map +1 -1
  253. package/build/range-control/types.js +6 -0
  254. package/build/range-control/types.js.map +1 -0
  255. package/build/range-control/utils.js +27 -36
  256. package/build/range-control/utils.js.map +1 -1
  257. package/build/resizable-box/resize-tooltip/index.js +3 -3
  258. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  259. package/build/resizable-box/resize-tooltip/utils.js +5 -13
  260. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  261. package/build/responsive-wrapper/index.js.map +1 -1
  262. package/build/scrollable/component.js +7 -8
  263. package/build/scrollable/component.js.map +1 -1
  264. package/build/scrollable/hook.js +0 -8
  265. package/build/scrollable/hook.js.map +1 -1
  266. package/build/scrollable/index.js.map +1 -1
  267. package/build/scrollable/styles.js +7 -7
  268. package/build/scrollable/styles.js.map +1 -1
  269. package/build/select-control/index.js +5 -3
  270. package/build/select-control/index.js.map +1 -1
  271. package/build/shortcut/index.js +2 -8
  272. package/build/shortcut/index.js.map +1 -1
  273. package/build/slot-fill/fill.js +1 -7
  274. package/build/slot-fill/fill.js.map +1 -1
  275. package/build/slot-fill/index.native.js +6 -8
  276. package/build/slot-fill/index.native.js.map +1 -1
  277. package/build/slot-fill/provider.js +4 -8
  278. package/build/slot-fill/provider.js.map +1 -1
  279. package/build/slot-fill/slot.js +17 -10
  280. package/build/slot-fill/slot.js.map +1 -1
  281. package/build/snackbar/index.js +7 -7
  282. package/build/snackbar/index.js.map +1 -1
  283. package/build/snackbar/list.js +3 -1
  284. package/build/snackbar/list.js.map +1 -1
  285. package/build/spacer/component.js +5 -5
  286. package/build/spacer/component.js.map +1 -1
  287. package/build/spacer/hook.js +2 -2
  288. package/build/spacer/hook.js.map +1 -1
  289. package/build/spacer/index.js.map +1 -1
  290. package/build/spinner/index.js +26 -13
  291. package/build/spinner/index.js.map +1 -1
  292. package/build/spinner/styles.js +10 -10
  293. package/build/spinner/styles.js.map +1 -1
  294. package/build/tab-panel/index.js +3 -1
  295. package/build/tab-panel/index.js.map +1 -1
  296. package/build/text/hook.js +4 -4
  297. package/build/text/hook.js.map +1 -1
  298. package/build/text/utils.js.map +1 -1
  299. package/build/text-highlight/index.js +22 -5
  300. package/build/text-highlight/index.js.map +1 -1
  301. package/build/text-highlight/types.js +6 -0
  302. package/build/text-highlight/types.js.map +1 -0
  303. package/build/tip/index.js +5 -11
  304. package/build/tip/index.js.map +1 -1
  305. package/build/tip/types.js +6 -0
  306. package/build/tip/types.js.map +1 -0
  307. package/build/toggle-control/index.js +1 -3
  308. package/build/toggle-control/index.js.map +1 -1
  309. package/build/toggle-control/index.native.js +1 -7
  310. package/build/toggle-control/index.native.js.map +1 -1
  311. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  312. package/build/toolbar/index.js.map +1 -1
  313. package/build/toolbar-group/index.js +3 -3
  314. package/build/toolbar-group/index.js.map +1 -1
  315. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  316. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  317. package/build/tooltip/index.js +2 -1
  318. package/build/tooltip/index.js.map +1 -1
  319. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  320. package/build/tree-select/index.js +59 -6
  321. package/build/tree-select/index.js.map +1 -1
  322. package/build/tree-select/types.js +6 -0
  323. package/build/tree-select/types.js.map +1 -0
  324. package/build/truncate/component.js +7 -8
  325. package/build/truncate/component.js.map +1 -1
  326. package/build/truncate/hook.js +3 -10
  327. package/build/truncate/hook.js.map +1 -1
  328. package/build/truncate/index.js.map +1 -1
  329. package/build/truncate/styles.js +1 -1
  330. package/build/truncate/styles.js.map +1 -1
  331. package/build/truncate/utils.js +3 -16
  332. package/build/truncate/utils.js.map +1 -1
  333. package/build/ui/form-group/form-group-content.js.map +1 -1
  334. package/build/ui/utils/get-valid-children.js.map +1 -1
  335. package/build/unit-control/index.js.map +1 -1
  336. package/build/utils/math.js +17 -7
  337. package/build/utils/math.js.map +1 -1
  338. package/build/utils/unit-values.js.map +1 -1
  339. package/build/utils/values.js.map +1 -1
  340. package/build/v-stack/component.js +9 -9
  341. package/build/v-stack/component.js.map +1 -1
  342. package/build/v-stack/hook.js +0 -5
  343. package/build/v-stack/hook.js.map +1 -1
  344. package/build/v-stack/index.js.map +1 -1
  345. package/build/visually-hidden/component.js +12 -13
  346. package/build/visually-hidden/component.js.map +1 -1
  347. package/build/visually-hidden/index.js.map +1 -1
  348. package/build/visually-hidden/styles.js +3 -1
  349. package/build/visually-hidden/styles.js.map +1 -1
  350. package/build/visually-hidden/types.js +6 -0
  351. package/build/visually-hidden/types.js.map +1 -0
  352. package/build/z-stack/component.js +22 -3
  353. package/build/z-stack/component.js.map +1 -1
  354. package/build/z-stack/types.js +6 -0
  355. package/build/z-stack/types.js.map +1 -0
  356. package/build-module/alignment-matrix-control/index.js +2 -1
  357. package/build-module/alignment-matrix-control/index.js.map +1 -1
  358. package/build-module/alignment-matrix-control/utils.js +1 -6
  359. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  360. package/build-module/angle-picker-control/index.js +1 -1
  361. package/build-module/angle-picker-control/index.js.map +1 -1
  362. package/build-module/autocomplete/autocompleter-ui.js +4 -2
  363. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  364. package/build-module/autocomplete/autocompleter-ui.native.js +9 -3
  365. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  366. package/build-module/autocomplete/get-default-use-items.js +3 -2
  367. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  368. package/build-module/autocomplete/index.js +7 -4
  369. package/build-module/autocomplete/index.js.map +1 -1
  370. package/build-module/border-box-control/border-box-control/component.js +2 -1
  371. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  372. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  373. package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
  374. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  375. package/build-module/border-box-control/utils.js.map +1 -1
  376. package/build-module/border-control/border-control/component.js +38 -3
  377. package/build-module/border-control/border-control/component.js.map +1 -1
  378. package/build-module/border-control/border-control/hook.js.map +1 -1
  379. package/build-module/box-control/all-input-control.js +3 -5
  380. package/build-module/box-control/all-input-control.js.map +1 -1
  381. package/build-module/box-control/axial-input-controls.js.map +1 -1
  382. package/build-module/box-control/index.js +3 -6
  383. package/build-module/box-control/index.js.map +1 -1
  384. package/build-module/box-control/input-controls.js +3 -5
  385. package/build-module/box-control/input-controls.js.map +1 -1
  386. package/build-module/box-control/unit-control.js +3 -1
  387. package/build-module/box-control/unit-control.js.map +1 -1
  388. package/build-module/box-control/utils.js +4 -4
  389. package/build-module/box-control/utils.js.map +1 -1
  390. package/build-module/button/index.native.js +1 -2
  391. package/build-module/button/index.native.js.map +1 -1
  392. package/build-module/checkbox-control/index.js.map +1 -1
  393. package/build-module/color-indicator/index.js +29 -8
  394. package/build-module/color-indicator/index.js.map +1 -1
  395. package/build-module/color-indicator/types.js +2 -0
  396. package/build-module/color-indicator/types.js.map +1 -0
  397. package/build-module/color-palette/index.js +2 -1
  398. package/build-module/color-palette/index.js.map +1 -1
  399. package/build-module/color-picker/component.js +7 -8
  400. package/build-module/color-picker/component.js.map +1 -1
  401. package/build-module/color-picker/hex-input.js +4 -3
  402. package/build-module/color-picker/hex-input.js.map +1 -1
  403. package/build-module/color-picker/index.native.js +36 -35
  404. package/build-module/color-picker/index.native.js.map +1 -1
  405. package/build-module/color-picker/input-with-slider.js +4 -3
  406. package/build-module/color-picker/input-with-slider.js.map +1 -1
  407. package/build-module/color-picker/styles.js +28 -31
  408. package/build-module/color-picker/styles.js.map +1 -1
  409. package/build-module/color-picker/use-deprecated-props.js +22 -31
  410. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  411. package/build-module/combobox-control/index.js +18 -8
  412. package/build-module/combobox-control/index.js.map +1 -1
  413. package/build-module/combobox-control/styles.js +27 -0
  414. package/build-module/combobox-control/styles.js.map +1 -0
  415. package/build-module/confirm-dialog/component.js.map +1 -1
  416. package/build-module/custom-gradient-bar/constants.js +0 -1
  417. package/build-module/custom-gradient-bar/constants.js.map +1 -1
  418. package/build-module/custom-gradient-bar/control-points.js +16 -9
  419. package/build-module/custom-gradient-bar/control-points.js.map +1 -1
  420. package/build-module/custom-gradient-bar/index.js +6 -6
  421. package/build-module/custom-gradient-bar/index.js.map +1 -1
  422. package/build-module/custom-gradient-bar/utils.js +6 -8
  423. package/build-module/custom-gradient-bar/utils.js.map +1 -1
  424. package/build-module/custom-gradient-picker/index.js +8 -7
  425. package/build-module/custom-gradient-picker/index.js.map +1 -1
  426. package/build-module/custom-gradient-picker/index.native.js +8 -8
  427. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  428. package/build-module/custom-gradient-picker/serializer.js +4 -6
  429. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  430. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  431. package/build-module/custom-select-control/index.js.map +1 -1
  432. package/build-module/date-time/date/index.js +7 -4
  433. package/build-module/date-time/date/index.js.map +1 -1
  434. package/build-module/date-time/date-time/index.js +5 -2
  435. package/build-module/date-time/date-time/index.js.map +1 -1
  436. package/build-module/dimension-control/index.js +1 -2
  437. package/build-module/dimension-control/index.js.map +1 -1
  438. package/build-module/divider/styles.js +5 -5
  439. package/build-module/divider/styles.js.map +1 -1
  440. package/build-module/draggable/index.js.map +1 -1
  441. package/build-module/draggable/index.native.js +6 -1
  442. package/build-module/draggable/index.native.js.map +1 -1
  443. package/build-module/drop-zone/provider.js.map +1 -1
  444. package/build-module/dropdown/index.js +2 -2
  445. package/build-module/dropdown/index.js.map +1 -1
  446. package/build-module/dropdown-menu/index.js +16 -4
  447. package/build-module/dropdown-menu/index.js.map +1 -1
  448. package/build-module/dropdown-menu/index.native.js +16 -4
  449. package/build-module/dropdown-menu/index.native.js.map +1 -1
  450. package/build-module/duotone-picker/duotone-picker.js +42 -29
  451. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  452. package/build-module/elevation/hook.js +13 -13
  453. package/build-module/elevation/hook.js.map +1 -1
  454. package/build-module/external-link/index.js +22 -8
  455. package/build-module/external-link/index.js.map +1 -1
  456. package/build-module/external-link/styles/external-link-styles.js +3 -3
  457. package/build-module/external-link/styles/external-link-styles.js.map +1 -1
  458. package/build-module/external-link/types.js +2 -0
  459. package/build-module/external-link/types.js.map +1 -0
  460. package/build-module/flex/flex/hook.js +7 -5
  461. package/build-module/flex/flex/hook.js.map +1 -1
  462. package/build-module/focal-point-picker/controls.js +3 -5
  463. package/build-module/focal-point-picker/controls.js.map +1 -1
  464. package/build-module/focal-point-picker/grid.js +2 -6
  465. package/build-module/focal-point-picker/grid.js.map +1 -1
  466. package/build-module/focal-point-picker/index.js.map +1 -1
  467. package/build-module/focal-point-picker/index.native.js +9 -9
  468. package/build-module/focal-point-picker/index.native.js.map +1 -1
  469. package/build-module/focal-point-picker/media.js +3 -5
  470. package/build-module/focal-point-picker/media.js.map +1 -1
  471. package/build-module/focal-point-picker/tooltip/index.native.js +11 -12
  472. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  473. package/build-module/font-size-picker/index.js +1 -1
  474. package/build-module/font-size-picker/index.js.map +1 -1
  475. package/build-module/form-toggle/index.js +31 -7
  476. package/build-module/form-toggle/index.js.map +1 -1
  477. package/build-module/form-toggle/types.js +2 -0
  478. package/build-module/form-toggle/types.js.map +1 -0
  479. package/build-module/form-token-field/index.js +345 -363
  480. package/build-module/form-token-field/index.js.map +1 -1
  481. package/build-module/form-token-field/styles.js +28 -0
  482. package/build-module/form-token-field/styles.js.map +1 -0
  483. package/build-module/form-token-field/suggestions-list.js +27 -23
  484. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  485. package/build-module/form-token-field/token-input.js +43 -58
  486. package/build-module/form-token-field/token-input.js.map +1 -1
  487. package/build-module/form-token-field/token.js +3 -1
  488. package/build-module/form-token-field/token.js.map +1 -1
  489. package/build-module/form-token-field/types.js +2 -0
  490. package/build-module/form-token-field/types.js.map +1 -0
  491. package/build-module/gradient-picker/index.js.map +1 -1
  492. package/build-module/grid/component.js +7 -8
  493. package/build-module/grid/component.js.map +1 -1
  494. package/build-module/grid/hook.js +1 -5
  495. package/build-module/grid/hook.js.map +1 -1
  496. package/build-module/grid/index.js.map +1 -1
  497. package/build-module/grid/utils.js +3 -8
  498. package/build-module/grid/utils.js.map +1 -1
  499. package/build-module/h-stack/component.js +3 -7
  500. package/build-module/h-stack/component.js.map +1 -1
  501. package/build-module/h-stack/hook.js +10 -12
  502. package/build-module/h-stack/hook.js.map +1 -1
  503. package/build-module/h-stack/index.js.map +1 -1
  504. package/build-module/h-stack/utils.js +8 -20
  505. package/build-module/h-stack/utils.js.map +1 -1
  506. package/build-module/heading/component.js +0 -1
  507. package/build-module/heading/component.js.map +1 -1
  508. package/build-module/heading/hook.js.map +1 -1
  509. package/build-module/heading/types.js +2 -0
  510. package/build-module/heading/types.js.map +1 -0
  511. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  512. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  513. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  514. package/build-module/icon/index.js.map +1 -1
  515. package/build-module/input-control/index.js +2 -1
  516. package/build-module/input-control/index.js.map +1 -1
  517. package/build-module/input-control/input-field.js +2 -1
  518. package/build-module/input-control/input-field.js.map +1 -1
  519. package/build-module/input-control/reducer/reducer.js.map +1 -1
  520. package/build-module/input-control/utils.js +1 -1
  521. package/build-module/input-control/utils.js.map +1 -1
  522. package/build-module/menu-item/index.js +1 -2
  523. package/build-module/menu-item/index.js.map +1 -1
  524. package/build-module/menu-items-choice/index.js +3 -5
  525. package/build-module/menu-items-choice/index.js.map +1 -1
  526. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  527. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  528. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -6
  529. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  530. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  531. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +0 -1
  532. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  533. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  534. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  535. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  536. package/build-module/mobile/focal-point-settings-panel/index.native.js +2 -2
  537. package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  538. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  539. package/build-module/mobile/gradient/index.native.js.map +1 -1
  540. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  541. package/build-module/mobile/image/index.native.js +3 -2
  542. package/build-module/mobile/image/index.native.js.map +1 -1
  543. package/build-module/mobile/inserter-button/index.native.js.map +1 -1
  544. package/build-module/mobile/link-picker/index.native.js +4 -3
  545. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  546. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  547. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  548. package/build-module/mobile/segmented-control/index.native.js +3 -4
  549. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  550. package/build-module/modal/index.js +20 -6
  551. package/build-module/modal/index.js.map +1 -1
  552. package/build-module/navigable-container/container.js +5 -2
  553. package/build-module/navigable-container/container.js.map +1 -1
  554. package/build-module/navigation/context.js +3 -5
  555. package/build-module/navigation/context.js.map +1 -1
  556. package/build-module/navigation/group/index.js +3 -6
  557. package/build-module/navigation/group/index.js.map +1 -1
  558. package/build-module/navigation/index.js +7 -2
  559. package/build-module/navigation/index.js.map +1 -1
  560. package/build-module/navigation/item/base.js +5 -2
  561. package/build-module/navigation/item/base.js.map +1 -1
  562. package/build-module/navigation/item/index.js +3 -1
  563. package/build-module/navigation/item/index.js.map +1 -1
  564. package/build-module/navigation/item/use-navigation-tree-item.js +2 -1
  565. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  566. package/build-module/navigation/menu/menu-title-search.js +1 -6
  567. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  568. package/build-module/navigation/menu/search-no-results-found.js +1 -6
  569. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  570. package/build-module/navigation/use-navigation-tree-nodes.js +18 -9
  571. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  572. package/build-module/navigation/utils.js +2 -2
  573. package/build-module/navigation/utils.js.map +1 -1
  574. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  575. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  576. package/build-module/navigator/navigator-provider/component.js +1 -1
  577. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  578. package/build-module/navigator/navigator-screen/component.js +1 -1
  579. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  580. package/build-module/notice/index.js +2 -1
  581. package/build-module/notice/index.js.map +1 -1
  582. package/build-module/notice/list.js +4 -1
  583. package/build-module/notice/list.js.map +1 -1
  584. package/build-module/panel/body.js +3 -1
  585. package/build-module/panel/body.js.map +1 -1
  586. package/build-module/placeholder/index.js +24 -11
  587. package/build-module/placeholder/index.js.map +1 -1
  588. package/build-module/popover/index.js +4 -4
  589. package/build-module/popover/index.js.map +1 -1
  590. package/build-module/radio-control/index.js +40 -7
  591. package/build-module/radio-control/index.js.map +1 -1
  592. package/build-module/radio-control/types.js +2 -0
  593. package/build-module/radio-control/types.js.map +1 -0
  594. package/build-module/range-control/index.js +57 -41
  595. package/build-module/range-control/index.js.map +1 -1
  596. package/build-module/range-control/input-range.js +7 -11
  597. package/build-module/range-control/input-range.js.map +1 -1
  598. package/build-module/range-control/mark.js +5 -6
  599. package/build-module/range-control/mark.js.map +1 -1
  600. package/build-module/range-control/rail.js +10 -15
  601. package/build-module/range-control/rail.js.map +1 -1
  602. package/build-module/range-control/styles/range-control-styles.js +62 -64
  603. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  604. package/build-module/range-control/tooltip.js +5 -6
  605. package/build-module/range-control/tooltip.js.map +1 -1
  606. package/build-module/range-control/types.js +2 -0
  607. package/build-module/range-control/types.js.map +1 -0
  608. package/build-module/range-control/utils.js +24 -32
  609. package/build-module/range-control/utils.js.map +1 -1
  610. package/build-module/resizable-box/resize-tooltip/index.js +2 -1
  611. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  612. package/build-module/resizable-box/resize-tooltip/utils.js +5 -11
  613. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  614. package/build-module/responsive-wrapper/index.js.map +1 -1
  615. package/build-module/scrollable/component.js +7 -8
  616. package/build-module/scrollable/component.js.map +1 -1
  617. package/build-module/scrollable/hook.js +0 -8
  618. package/build-module/scrollable/hook.js.map +1 -1
  619. package/build-module/scrollable/index.js.map +1 -1
  620. package/build-module/scrollable/styles.js +7 -7
  621. package/build-module/scrollable/styles.js.map +1 -1
  622. package/build-module/select-control/index.js +3 -1
  623. package/build-module/select-control/index.js.map +1 -1
  624. package/build-module/shortcut/index.js +2 -7
  625. package/build-module/shortcut/index.js.map +1 -1
  626. package/build-module/slot-fill/fill.js +1 -6
  627. package/build-module/slot-fill/fill.js.map +1 -1
  628. package/build-module/slot-fill/index.native.js +6 -7
  629. package/build-module/slot-fill/index.native.js.map +1 -1
  630. package/build-module/slot-fill/provider.js +4 -7
  631. package/build-module/slot-fill/provider.js.map +1 -1
  632. package/build-module/slot-fill/slot.js +15 -8
  633. package/build-module/slot-fill/slot.js.map +1 -1
  634. package/build-module/snackbar/index.js +3 -1
  635. package/build-module/snackbar/index.js.map +1 -1
  636. package/build-module/snackbar/list.js +4 -1
  637. package/build-module/snackbar/list.js.map +1 -1
  638. package/build-module/spacer/component.js +3 -4
  639. package/build-module/spacer/component.js.map +1 -1
  640. package/build-module/spacer/hook.js +2 -2
  641. package/build-module/spacer/hook.js.map +1 -1
  642. package/build-module/spacer/index.js.map +1 -1
  643. package/build-module/spinner/index.js +22 -13
  644. package/build-module/spinner/index.js.map +1 -1
  645. package/build-module/spinner/styles.js +10 -10
  646. package/build-module/spinner/styles.js.map +1 -1
  647. package/build-module/tab-panel/index.js +3 -1
  648. package/build-module/tab-panel/index.js.map +1 -1
  649. package/build-module/text/hook.js +4 -4
  650. package/build-module/text/hook.js.map +1 -1
  651. package/build-module/text/utils.js.map +1 -1
  652. package/build-module/text-highlight/index.js +23 -6
  653. package/build-module/text-highlight/index.js.map +1 -1
  654. package/build-module/text-highlight/types.js +2 -0
  655. package/build-module/text-highlight/types.js.map +1 -0
  656. package/build-module/tip/index.js +6 -10
  657. package/build-module/tip/index.js.map +1 -1
  658. package/build-module/tip/types.js +2 -0
  659. package/build-module/tip/types.js.map +1 -0
  660. package/build-module/toggle-control/index.js +1 -2
  661. package/build-module/toggle-control/index.js.map +1 -1
  662. package/build-module/toggle-control/index.native.js +1 -6
  663. package/build-module/toggle-control/index.native.js.map +1 -1
  664. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  665. package/build-module/toolbar/index.js.map +1 -1
  666. package/build-module/toolbar-group/index.js +3 -2
  667. package/build-module/toolbar-group/index.js.map +1 -1
  668. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  669. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  670. package/build-module/tooltip/index.js +2 -1
  671. package/build-module/tooltip/index.js.map +1 -1
  672. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  673. package/build-module/tree-select/index.js +56 -6
  674. package/build-module/tree-select/index.js.map +1 -1
  675. package/build-module/tree-select/types.js +2 -0
  676. package/build-module/tree-select/types.js.map +1 -0
  677. package/build-module/truncate/component.js +7 -8
  678. package/build-module/truncate/component.js.map +1 -1
  679. package/build-module/truncate/hook.js +3 -10
  680. package/build-module/truncate/hook.js.map +1 -1
  681. package/build-module/truncate/index.js.map +1 -1
  682. package/build-module/truncate/styles.js +1 -1
  683. package/build-module/truncate/styles.js.map +1 -1
  684. package/build-module/truncate/utils.js +3 -16
  685. package/build-module/truncate/utils.js.map +1 -1
  686. package/build-module/ui/form-group/form-group-content.js.map +1 -1
  687. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  688. package/build-module/unit-control/index.js.map +1 -1
  689. package/build-module/utils/math.js +15 -6
  690. package/build-module/utils/math.js.map +1 -1
  691. package/build-module/utils/unit-values.js.map +1 -1
  692. package/build-module/utils/values.js.map +1 -1
  693. package/build-module/v-stack/component.js +9 -9
  694. package/build-module/v-stack/component.js.map +1 -1
  695. package/build-module/v-stack/hook.js +0 -5
  696. package/build-module/v-stack/hook.js.map +1 -1
  697. package/build-module/v-stack/index.js.map +1 -1
  698. package/build-module/visually-hidden/component.js +12 -13
  699. package/build-module/visually-hidden/component.js.map +1 -1
  700. package/build-module/visually-hidden/index.js.map +1 -1
  701. package/build-module/visually-hidden/styles.js +3 -1
  702. package/build-module/visually-hidden/styles.js.map +1 -1
  703. package/build-module/visually-hidden/types.js +2 -0
  704. package/build-module/visually-hidden/types.js.map +1 -0
  705. package/build-module/z-stack/component.js +21 -2
  706. package/build-module/z-stack/component.js.map +1 -1
  707. package/build-module/z-stack/types.js +2 -0
  708. package/build-module/z-stack/types.js.map +1 -0
  709. package/build-style/style-rtl.css +61 -22
  710. package/build-style/style.css +61 -23
  711. package/build-types/base-control/stories/index.d.ts.map +1 -1
  712. package/build-types/base-field/hook.d.ts +0 -1
  713. package/build-types/base-field/hook.d.ts.map +1 -1
  714. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  715. package/build-types/border-box-control/border-box-control/hook.d.ts +0 -1
  716. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  717. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  718. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +0 -1
  719. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  720. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  721. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +0 -1
  722. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  723. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +0 -1
  724. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  725. package/build-types/border-box-control/utils.d.ts.map +1 -1
  726. package/build-types/border-control/border-control/component.d.ts +36 -2
  727. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  728. package/build-types/border-control/border-control/hook.d.ts +1 -2
  729. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  730. package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
  731. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  732. package/build-types/border-control/border-control-style-picker/hook.d.ts +0 -1
  733. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  734. package/build-types/border-control/stories/index.d.ts +33 -0
  735. package/build-types/border-control/stories/index.d.ts.map +1 -0
  736. package/build-types/button-group/index.d.ts +1 -1
  737. package/build-types/button-group/index.d.ts.map +1 -1
  738. package/build-types/card/card/hook.d.ts +0 -1
  739. package/build-types/card/card/hook.d.ts.map +1 -1
  740. package/build-types/card/card-body/hook.d.ts +0 -1
  741. package/build-types/card/card-body/hook.d.ts.map +1 -1
  742. package/build-types/card/card-divider/hook.d.ts +0 -1
  743. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  744. package/build-types/card/card-footer/hook.d.ts +0 -1
  745. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  746. package/build-types/card/card-header/hook.d.ts +0 -1
  747. package/build-types/card/card-header/hook.d.ts.map +1 -1
  748. package/build-types/card/card-media/hook.d.ts +0 -1
  749. package/build-types/card/card-media/hook.d.ts.map +1 -1
  750. package/build-types/checkbox-control/index.d.ts.map +1 -1
  751. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  752. package/build-types/color-indicator/index.d.ts +16 -5
  753. package/build-types/color-indicator/index.d.ts.map +1 -1
  754. package/build-types/color-indicator/stories/index.d.ts +12 -0
  755. package/build-types/color-indicator/stories/index.d.ts.map +1 -0
  756. package/build-types/color-indicator/test/index.d.ts +2 -0
  757. package/build-types/color-indicator/test/index.d.ts.map +1 -0
  758. package/build-types/color-indicator/types.d.ts +12 -0
  759. package/build-types/color-indicator/types.d.ts.map +1 -0
  760. package/build-types/color-palette/index.d.ts.map +1 -1
  761. package/build-types/color-palette/styles.d.ts +4 -2
  762. package/build-types/color-palette/styles.d.ts.map +1 -1
  763. package/build-types/color-picker/component.d.ts.map +1 -1
  764. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  765. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  766. package/build-types/color-picker/styles.d.ts +48 -32
  767. package/build-types/color-picker/styles.d.ts.map +1 -1
  768. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  769. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  770. package/build-types/date-time/date/index.d.ts +1 -1
  771. package/build-types/date-time/date/index.d.ts.map +1 -1
  772. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  773. package/build-types/date-time/stories/date-time.d.ts.map +1 -1
  774. package/build-types/date-time/stories/date.d.ts.map +1 -1
  775. package/build-types/date-time/time/styles.d.ts +1 -1
  776. package/build-types/date-time/types.d.ts +6 -0
  777. package/build-types/date-time/types.d.ts.map +1 -1
  778. package/build-types/divider/styles.d.ts.map +1 -1
  779. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  780. package/build-types/elevation/hook.d.ts +0 -1
  781. package/build-types/elevation/hook.d.ts.map +1 -1
  782. package/build-types/external-link/index.d.ts +17 -0
  783. package/build-types/external-link/index.d.ts.map +1 -0
  784. package/build-types/external-link/stories/index.d.ts +12 -0
  785. package/build-types/external-link/stories/index.d.ts.map +1 -0
  786. package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
  787. package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
  788. package/build-types/external-link/types.d.ts +15 -0
  789. package/build-types/external-link/types.d.ts.map +1 -0
  790. package/build-types/flex/flex/hook.d.ts +0 -1
  791. package/build-types/flex/flex/hook.d.ts.map +1 -1
  792. package/build-types/flex/flex-block/hook.d.ts +0 -1
  793. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  794. package/build-types/flex/flex-item/hook.d.ts +0 -1
  795. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  796. package/build-types/form-toggle/index.d.ts +29 -0
  797. package/build-types/form-toggle/index.d.ts.map +1 -0
  798. package/build-types/form-toggle/stories/index.d.ts +12 -0
  799. package/build-types/form-toggle/stories/index.d.ts.map +1 -0
  800. package/build-types/form-toggle/test/index.d.ts +2 -0
  801. package/build-types/form-toggle/test/index.d.ts.map +1 -0
  802. package/build-types/form-toggle/types.d.ts +22 -0
  803. package/build-types/form-toggle/types.d.ts.map +1 -0
  804. package/build-types/form-token-field/index.d.ts +15 -0
  805. package/build-types/form-token-field/index.d.ts.map +1 -0
  806. package/build-types/form-token-field/stories/index.d.ts +13 -0
  807. package/build-types/form-token-field/stories/index.d.ts.map +1 -0
  808. package/build-types/form-token-field/styles.d.ts +14 -0
  809. package/build-types/form-token-field/styles.d.ts.map +1 -0
  810. package/build-types/form-token-field/suggestions-list.d.ts +10 -0
  811. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -0
  812. package/build-types/form-token-field/test/lib/fixtures.d.ts +26 -0
  813. package/build-types/form-token-field/test/lib/fixtures.d.ts.map +1 -0
  814. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +21 -0
  815. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -0
  816. package/build-types/form-token-field/token-input.d.ts +12 -0
  817. package/build-types/form-token-field/token-input.d.ts.map +1 -0
  818. package/build-types/form-token-field/token.d.ts +4 -0
  819. package/build-types/form-token-field/token.d.ts.map +1 -0
  820. package/build-types/form-token-field/types.d.ts +183 -0
  821. package/build-types/form-token-field/types.d.ts.map +1 -0
  822. package/build-types/grid/component.d.ts +3 -3
  823. package/build-types/grid/component.d.ts.map +1 -1
  824. package/build-types/grid/hook.d.ts +5 -3
  825. package/build-types/grid/hook.d.ts.map +1 -1
  826. package/build-types/grid/index.d.ts +2 -2
  827. package/build-types/grid/index.d.ts.map +1 -1
  828. package/build-types/grid/stories/index.d.ts +9 -0
  829. package/build-types/grid/stories/index.d.ts.map +1 -0
  830. package/build-types/grid/test/grid.d.ts +2 -0
  831. package/build-types/grid/test/grid.d.ts.map +1 -0
  832. package/build-types/grid/types.d.ts +16 -15
  833. package/build-types/grid/types.d.ts.map +1 -1
  834. package/build-types/grid/utils.d.ts +50 -69
  835. package/build-types/grid/utils.d.ts.map +1 -1
  836. package/build-types/h-stack/component.d.ts +3 -2
  837. package/build-types/h-stack/component.d.ts.map +1 -1
  838. package/build-types/h-stack/hook.d.ts +5 -4
  839. package/build-types/h-stack/hook.d.ts.map +1 -1
  840. package/build-types/h-stack/index.d.ts +2 -2
  841. package/build-types/h-stack/index.d.ts.map +1 -1
  842. package/build-types/h-stack/stories/index.d.ts +9 -0
  843. package/build-types/h-stack/stories/index.d.ts.map +1 -0
  844. package/build-types/h-stack/test/index.d.ts +2 -0
  845. package/build-types/h-stack/test/index.d.ts.map +1 -0
  846. package/build-types/h-stack/utils.d.ts +8 -4
  847. package/build-types/h-stack/utils.d.ts.map +1 -1
  848. package/build-types/heading/component.d.ts +1 -2
  849. package/build-types/heading/component.d.ts.map +1 -1
  850. package/build-types/heading/hook.d.ts +1 -29
  851. package/build-types/heading/hook.d.ts.map +1 -1
  852. package/build-types/heading/stories/index.d.ts.map +1 -1
  853. package/build-types/heading/test/index.d.ts +2 -0
  854. package/build-types/heading/test/index.d.ts.map +1 -0
  855. package/build-types/heading/types.d.ts +16 -0
  856. package/build-types/heading/types.d.ts.map +1 -0
  857. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  858. package/build-types/icon/index.d.ts +1 -1
  859. package/build-types/icon/index.d.ts.map +1 -1
  860. package/build-types/input-control/index.d.ts +1 -1
  861. package/build-types/input-control/index.d.ts.map +1 -1
  862. package/build-types/input-control/input-field.d.ts +1 -1
  863. package/build-types/input-control/input-field.d.ts.map +1 -1
  864. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  865. package/build-types/input-control/stories/index.d.ts +5 -5
  866. package/build-types/input-control/stories/index.d.ts.map +1 -1
  867. package/build-types/item-group/item/hook.d.ts +0 -1
  868. package/build-types/item-group/item/hook.d.ts.map +1 -1
  869. package/build-types/item-group/item-group/hook.d.ts +0 -1
  870. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  871. package/build-types/menu-item/index.d.ts.map +1 -1
  872. package/build-types/navigator/navigator-back-button/hook.d.ts +0 -1
  873. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  874. package/build-types/navigator/navigator-button/hook.d.ts +0 -1
  875. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  876. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  877. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  878. package/build-types/popover/index.d.ts.map +1 -1
  879. package/build-types/radio-control/index.d.ts +31 -0
  880. package/build-types/radio-control/index.d.ts.map +1 -0
  881. package/build-types/radio-control/stories/index.d.ts +12 -0
  882. package/build-types/radio-control/stories/index.d.ts.map +1 -0
  883. package/build-types/radio-control/types.d.ts +29 -0
  884. package/build-types/radio-control/types.d.ts.map +1 -0
  885. package/build-types/range-control/index.d.ts +54 -29
  886. package/build-types/range-control/index.d.ts.map +1 -1
  887. package/build-types/range-control/input-range.d.ts +7 -10
  888. package/build-types/range-control/input-range.d.ts.map +1 -1
  889. package/build-types/range-control/mark.d.ts +4 -7
  890. package/build-types/range-control/mark.d.ts.map +1 -1
  891. package/build-types/range-control/rail.d.ts +4 -9
  892. package/build-types/range-control/rail.d.ts.map +1 -1
  893. package/build-types/range-control/stories/index.d.ts +48 -0
  894. package/build-types/range-control/stories/index.d.ts.map +1 -0
  895. package/build-types/range-control/styles/range-control-styles.d.ts +32 -40
  896. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  897. package/build-types/range-control/test/index.d.ts +2 -0
  898. package/build-types/range-control/test/index.d.ts.map +1 -0
  899. package/build-types/range-control/tooltip.d.ts +4 -11
  900. package/build-types/range-control/tooltip.d.ts.map +1 -1
  901. package/build-types/range-control/types.d.ts +302 -0
  902. package/build-types/range-control/types.d.ts.map +1 -0
  903. package/build-types/range-control/utils.d.ts +15 -33
  904. package/build-types/range-control/utils.d.ts.map +1 -1
  905. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  906. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  907. package/build-types/scrollable/component.d.ts +3 -3
  908. package/build-types/scrollable/component.d.ts.map +1 -1
  909. package/build-types/scrollable/hook.d.ts +5 -3
  910. package/build-types/scrollable/hook.d.ts.map +1 -1
  911. package/build-types/scrollable/index.d.ts +2 -2
  912. package/build-types/scrollable/index.d.ts.map +1 -1
  913. package/build-types/scrollable/stories/index.d.ts +9 -0
  914. package/build-types/scrollable/stories/index.d.ts.map +1 -0
  915. package/build-types/scrollable/styles.d.ts +7 -7
  916. package/build-types/scrollable/styles.d.ts.map +1 -1
  917. package/build-types/scrollable/test/index.d.ts +2 -0
  918. package/build-types/scrollable/test/index.d.ts.map +1 -0
  919. package/build-types/scrollable/types.d.ts +9 -6
  920. package/build-types/scrollable/types.d.ts.map +1 -1
  921. package/build-types/select-control/index.d.ts +1 -1
  922. package/build-types/select-control/index.d.ts.map +1 -1
  923. package/build-types/select-control/stories/index.d.ts +3 -3
  924. package/build-types/select-control/stories/index.d.ts.map +1 -1
  925. package/build-types/shortcut/index.d.ts.map +1 -1
  926. package/build-types/slot-fill/fill.d.ts.map +1 -1
  927. package/build-types/slot-fill/provider.d.ts.map +1 -1
  928. package/build-types/slot-fill/slot.d.ts.map +1 -1
  929. package/build-types/spacer/component.d.ts +3 -4
  930. package/build-types/spacer/component.d.ts.map +1 -1
  931. package/build-types/spacer/hook.d.ts +2 -3
  932. package/build-types/spacer/hook.d.ts.map +1 -1
  933. package/build-types/spacer/index.d.ts +1 -1
  934. package/build-types/spacer/index.d.ts.map +1 -1
  935. package/build-types/spacer/stories/index.d.ts +12 -0
  936. package/build-types/spacer/stories/index.d.ts.map +1 -0
  937. package/build-types/spacer/test/index.d.ts +2 -0
  938. package/build-types/spacer/test/index.d.ts.map +1 -0
  939. package/build-types/spacer/types.d.ts +41 -29
  940. package/build-types/spacer/types.d.ts.map +1 -1
  941. package/build-types/spinner/index.d.ts +16 -15
  942. package/build-types/spinner/index.d.ts.map +1 -1
  943. package/build-types/spinner/stories/index.d.ts +13 -0
  944. package/build-types/spinner/stories/index.d.ts.map +1 -0
  945. package/build-types/spinner/styles.d.ts +4 -3
  946. package/build-types/spinner/styles.d.ts.map +1 -1
  947. package/build-types/surface/hook.d.ts +0 -1
  948. package/build-types/surface/hook.d.ts.map +1 -1
  949. package/build-types/text/hook.d.ts +0 -1
  950. package/build-types/text/hook.d.ts.map +1 -1
  951. package/build-types/text/types.d.ts +1 -1
  952. package/build-types/text/types.d.ts.map +1 -1
  953. package/build-types/text/utils.d.ts.map +1 -1
  954. package/build-types/text-control/index.d.ts +1 -1
  955. package/build-types/text-control/index.d.ts.map +1 -1
  956. package/build-types/text-control/stories/index.d.ts.map +1 -1
  957. package/build-types/text-highlight/index.d.ts +23 -0
  958. package/build-types/text-highlight/index.d.ts.map +1 -0
  959. package/build-types/text-highlight/stories/index.d.ts +12 -0
  960. package/build-types/text-highlight/stories/index.d.ts.map +1 -0
  961. package/build-types/text-highlight/test/index.d.ts +2 -0
  962. package/build-types/text-highlight/test/index.d.ts.map +1 -0
  963. package/build-types/text-highlight/types.d.ts +17 -0
  964. package/build-types/text-highlight/types.d.ts.map +1 -0
  965. package/build-types/tip/index.d.ts +5 -14
  966. package/build-types/tip/index.d.ts.map +1 -1
  967. package/build-types/tip/stories/index.d.ts +12 -0
  968. package/build-types/tip/stories/index.d.ts.map +1 -0
  969. package/build-types/tip/types.d.ts +11 -0
  970. package/build-types/tip/types.d.ts.map +1 -0
  971. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
  972. package/build-types/tools-panel/tools-panel/hook.d.ts +0 -1
  973. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  974. package/build-types/tools-panel/tools-panel-header/hook.d.ts +0 -1
  975. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  976. package/build-types/tools-panel/tools-panel-item/hook.d.ts +0 -1
  977. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  978. package/build-types/tooltip/index.d.ts.map +1 -1
  979. package/build-types/tree-select/index.d.ts +53 -0
  980. package/build-types/tree-select/index.d.ts.map +1 -0
  981. package/build-types/tree-select/stories/index.d.ts +12 -0
  982. package/build-types/tree-select/stories/index.d.ts.map +1 -0
  983. package/build-types/tree-select/types.d.ts +30 -0
  984. package/build-types/tree-select/types.d.ts.map +1 -0
  985. package/build-types/truncate/component.d.ts +3 -3
  986. package/build-types/truncate/component.d.ts.map +1 -1
  987. package/build-types/truncate/hook.d.ts +5 -3
  988. package/build-types/truncate/hook.d.ts.map +1 -1
  989. package/build-types/truncate/index.d.ts +2 -2
  990. package/build-types/truncate/index.d.ts.map +1 -1
  991. package/build-types/truncate/stories/index.d.ts +13 -0
  992. package/build-types/truncate/stories/index.d.ts.map +1 -0
  993. package/build-types/truncate/styles.d.ts +1 -1
  994. package/build-types/truncate/styles.d.ts.map +1 -1
  995. package/build-types/truncate/test/index.d.ts +2 -0
  996. package/build-types/truncate/test/index.d.ts.map +1 -0
  997. package/build-types/truncate/types.d.ts +22 -11
  998. package/build-types/truncate/types.d.ts.map +1 -1
  999. package/build-types/truncate/utils.d.ts +17 -28
  1000. package/build-types/truncate/utils.d.ts.map +1 -1
  1001. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  1002. package/build-types/ui/control-group/hook.d.ts +0 -1
  1003. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  1004. package/build-types/ui/control-label/hook.d.ts +0 -1
  1005. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  1006. package/build-types/ui/form-group/form-group.d.ts +1 -1
  1007. package/build-types/ui/form-group/types.d.ts +1 -1
  1008. package/build-types/ui/form-group/types.d.ts.map +1 -1
  1009. package/build-types/ui/form-group/use-form-group.d.ts +5 -7
  1010. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  1011. package/build-types/ui/utils/get-valid-children.d.ts +2 -2
  1012. package/build-types/ui/utils/get-valid-children.d.ts.map +1 -1
  1013. package/build-types/unit-control/index.d.ts +1 -1
  1014. package/build-types/unit-control/index.d.ts.map +1 -1
  1015. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  1016. package/build-types/utils/math.d.ts +10 -0
  1017. package/build-types/utils/math.d.ts.map +1 -1
  1018. package/build-types/utils/unit-values.d.ts.map +1 -1
  1019. package/build-types/utils/values.d.ts.map +1 -1
  1020. package/build-types/v-stack/component.d.ts +5 -4
  1021. package/build-types/v-stack/component.d.ts.map +1 -1
  1022. package/build-types/v-stack/hook.d.ts +5 -4
  1023. package/build-types/v-stack/hook.d.ts.map +1 -1
  1024. package/build-types/v-stack/index.d.ts +2 -2
  1025. package/build-types/v-stack/index.d.ts.map +1 -1
  1026. package/build-types/v-stack/stories/index.d.ts +9 -0
  1027. package/build-types/v-stack/stories/index.d.ts.map +1 -0
  1028. package/build-types/v-stack/test/index.d.ts +2 -0
  1029. package/build-types/v-stack/test/index.d.ts.map +1 -0
  1030. package/build-types/v-stack/types.d.ts +21 -1
  1031. package/build-types/v-stack/types.d.ts.map +1 -1
  1032. package/build-types/visually-hidden/component.d.ts +8 -10
  1033. package/build-types/visually-hidden/component.d.ts.map +1 -1
  1034. package/build-types/visually-hidden/index.d.ts +1 -1
  1035. package/build-types/visually-hidden/index.d.ts.map +1 -1
  1036. package/build-types/visually-hidden/stories/index.d.ts +14 -0
  1037. package/build-types/visually-hidden/stories/index.d.ts.map +1 -0
  1038. package/build-types/visually-hidden/styles.d.ts +5 -2
  1039. package/build-types/visually-hidden/styles.d.ts.map +1 -1
  1040. package/build-types/visually-hidden/test/index.d.ts +2 -0
  1041. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  1042. package/build-types/visually-hidden/types.d.ts +11 -0
  1043. package/build-types/visually-hidden/types.d.ts.map +1 -0
  1044. package/build-types/z-stack/component.d.ts +18 -28
  1045. package/build-types/z-stack/component.d.ts.map +1 -1
  1046. package/build-types/z-stack/stories/index.d.ts +6 -0
  1047. package/build-types/z-stack/stories/index.d.ts.map +1 -0
  1048. package/build-types/z-stack/types.d.ts +33 -0
  1049. package/build-types/z-stack/types.d.ts.map +1 -0
  1050. package/package.json +18 -17
  1051. package/src/alignment-matrix-control/index.js +2 -1
  1052. package/src/alignment-matrix-control/utils.js +1 -6
  1053. package/src/angle-picker-control/index.js +1 -1
  1054. package/src/autocomplete/autocompleter-ui.js +4 -1
  1055. package/src/autocomplete/autocompleter-ui.native.js +8 -2
  1056. package/src/autocomplete/get-default-use-items.js +3 -2
  1057. package/src/autocomplete/index.js +7 -10
  1058. package/src/base-control/stories/index.tsx +2 -3
  1059. package/src/border-box-control/border-box-control/component.tsx +1 -0
  1060. package/src/border-box-control/border-box-control-linked-button/component.tsx +2 -5
  1061. package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
  1062. package/src/border-box-control/utils.ts +5 -2
  1063. package/src/border-control/border-control/component.tsx +41 -4
  1064. package/src/border-control/border-control/hook.ts +3 -4
  1065. package/src/border-control/stories/index.tsx +150 -0
  1066. package/src/box-control/all-input-control.js +2 -4
  1067. package/src/box-control/axial-input-controls.js +4 -6
  1068. package/src/box-control/index.js +3 -6
  1069. package/src/box-control/input-controls.js +33 -36
  1070. package/src/box-control/unit-control.js +2 -1
  1071. package/src/box-control/utils.js +4 -4
  1072. package/src/button/README.md +1 -1
  1073. package/src/button/index.native.js +1 -2
  1074. package/src/card/stories/index.js +10 -5
  1075. package/src/checkbox-control/index.tsx +2 -3
  1076. package/src/checkbox-control/stories/index.tsx +2 -3
  1077. package/src/checkbox-control/test/index.tsx +2 -1
  1078. package/src/color-indicator/README.md +7 -9
  1079. package/src/color-indicator/index.tsx +47 -0
  1080. package/src/color-indicator/stories/index.tsx +37 -0
  1081. package/src/color-indicator/test/__snapshots__/index.tsx.snap +11 -0
  1082. package/src/color-indicator/test/{index.js → index.tsx} +4 -4
  1083. package/src/color-indicator/types.ts +12 -0
  1084. package/src/color-palette/index.js +5 -1
  1085. package/src/color-picker/component.tsx +12 -11
  1086. package/src/color-picker/hex-input.tsx +3 -2
  1087. package/src/color-picker/index.native.js +27 -31
  1088. package/src/color-picker/input-with-slider.tsx +4 -2
  1089. package/src/color-picker/styles.ts +20 -6
  1090. package/src/color-picker/use-deprecated-props.ts +24 -43
  1091. package/src/combobox-control/index.js +18 -8
  1092. package/src/combobox-control/stories/index.js +3 -2
  1093. package/src/combobox-control/style.scss +1 -1
  1094. package/src/combobox-control/styles.ts +27 -0
  1095. package/src/confirm-dialog/component.tsx +7 -8
  1096. package/src/custom-gradient-bar/constants.js +2 -2
  1097. package/src/custom-gradient-bar/control-points.js +20 -16
  1098. package/src/custom-gradient-bar/index.js +11 -11
  1099. package/src/custom-gradient-bar/test/utils.js +79 -0
  1100. package/src/custom-gradient-bar/utils.js +6 -18
  1101. package/src/custom-gradient-picker/index.js +4 -11
  1102. package/src/custom-gradient-picker/index.native.js +3 -11
  1103. package/src/custom-gradient-picker/serializer.js +5 -11
  1104. package/src/custom-gradient-picker/style.scss +1 -3
  1105. package/src/custom-gradient-picker/utils.js +4 -3
  1106. package/src/custom-select-control/index.js +2 -1
  1107. package/src/custom-select-control/stories/index.js +1 -2
  1108. package/src/date-time/README.md +7 -0
  1109. package/src/date-time/date/index.tsx +4 -2
  1110. package/src/date-time/date/style.scss +10 -0
  1111. package/src/date-time/date/test/index.tsx +1 -1
  1112. package/src/date-time/date-time/index.tsx +8 -8
  1113. package/src/date-time/stories/date-time.tsx +4 -6
  1114. package/src/date-time/stories/date.tsx +2 -3
  1115. package/src/date-time/time/test/index.tsx +12 -12
  1116. package/src/date-time/types.ts +7 -0
  1117. package/src/dimension-control/README.md +5 -2
  1118. package/src/dimension-control/index.js +1 -2
  1119. package/src/dimension-control/test/index.test.js +7 -7
  1120. package/src/divider/styles.ts +2 -3
  1121. package/src/draggable/index.js +3 -3
  1122. package/src/draggable/index.native.js +12 -4
  1123. package/src/drop-zone/provider.js +1 -2
  1124. package/src/dropdown/index.js +2 -2
  1125. package/src/dropdown-menu/index.js +13 -4
  1126. package/src/dropdown-menu/index.native.js +13 -5
  1127. package/src/duotone-picker/duotone-picker.js +58 -37
  1128. package/src/duotone-picker/style.scss +19 -0
  1129. package/src/elevation/hook.js +11 -11
  1130. package/src/external-link/README.md +18 -0
  1131. package/src/external-link/{index.js → index.tsx} +35 -9
  1132. package/src/external-link/stories/index.tsx +36 -0
  1133. package/src/external-link/styles/{external-link-styles.js → external-link-styles.ts} +0 -0
  1134. package/src/external-link/types.ts +15 -0
  1135. package/src/flex/flex/README.md +5 -10
  1136. package/src/flex/flex/hook.js +4 -1
  1137. package/src/flex/flex-item/README.md +1 -1
  1138. package/src/focal-point-picker/controls.js +1 -5
  1139. package/src/focal-point-picker/grid.js +2 -5
  1140. package/src/focal-point-picker/index.js +2 -8
  1141. package/src/focal-point-picker/index.native.js +9 -9
  1142. package/src/focal-point-picker/media.js +2 -5
  1143. package/src/focal-point-picker/tooltip/index.native.js +10 -11
  1144. package/src/font-size-picker/index.js +3 -1
  1145. package/src/form-toggle/README.md +10 -11
  1146. package/src/form-toggle/index.tsx +71 -0
  1147. package/src/form-toggle/stories/index.tsx +52 -0
  1148. package/src/form-toggle/test/__snapshots__/index.tsx.snap +54 -0
  1149. package/src/form-toggle/test/index.tsx +102 -0
  1150. package/src/form-toggle/types.ts +22 -0
  1151. package/src/form-token-field/index.tsx +715 -0
  1152. package/src/form-token-field/stories/index.tsx +103 -0
  1153. package/src/form-token-field/style.scss +4 -8
  1154. package/src/form-token-field/styles.ts +32 -0
  1155. package/src/form-token-field/{suggestions-list.js → suggestions-list.tsx} +43 -29
  1156. package/src/form-token-field/test/index.js +70 -40
  1157. package/src/form-token-field/test/lib/token-field-wrapper.tsx +71 -0
  1158. package/src/form-token-field/token-input.tsx +76 -0
  1159. package/src/form-token-field/{token.js → token.tsx} +4 -2
  1160. package/src/form-token-field/types.ts +185 -0
  1161. package/src/gradient-picker/index.js +4 -3
  1162. package/src/grid/README.md +33 -19
  1163. package/src/grid/{component.js → component.tsx} +13 -9
  1164. package/src/grid/{hook.js → hook.ts} +5 -5
  1165. package/src/grid/{index.js → index.ts} +0 -0
  1166. package/src/grid/stories/index.tsx +72 -0
  1167. package/src/grid/test/{grid.js → grid.tsx} +4 -4
  1168. package/src/grid/types.ts +16 -17
  1169. package/src/grid/{utils.js → utils.ts} +9 -7
  1170. package/src/guide/style.scss +1 -0
  1171. package/src/h-stack/{component.js → component.tsx} +8 -8
  1172. package/src/h-stack/{hook.js → hook.tsx} +21 -16
  1173. package/src/h-stack/{index.js → index.ts} +0 -0
  1174. package/src/h-stack/stories/index.tsx +92 -0
  1175. package/src/h-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1176. package/src/h-stack/test/{index.js → index.tsx} +0 -0
  1177. package/src/h-stack/{utils.js → utils.ts} +16 -16
  1178. package/src/heading/README.md +4 -3
  1179. package/src/heading/component.tsx +2 -2
  1180. package/src/heading/hook.ts +6 -46
  1181. package/src/heading/stories/index.tsx +5 -1
  1182. package/src/heading/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1183. package/src/heading/test/index.tsx +68 -0
  1184. package/src/heading/types.ts +29 -0
  1185. package/src/higher-order/navigate-regions/README.md +4 -1
  1186. package/src/higher-order/navigate-regions/index.js +7 -5
  1187. package/src/higher-order/with-filters/test/index.js +43 -36
  1188. package/src/higher-order/with-focus-return/index.js +14 -13
  1189. package/src/higher-order/with-spoken-messages/index.js +8 -7
  1190. package/src/higher-order/with-spoken-messages/test/index.js +1 -1
  1191. package/src/icon/index.tsx +3 -3
  1192. package/src/input-control/index.tsx +2 -1
  1193. package/src/input-control/input-field.tsx +2 -1
  1194. package/src/input-control/reducer/reducer.ts +23 -21
  1195. package/src/input-control/test/index.js +106 -31
  1196. package/src/input-control/utils.ts +1 -1
  1197. package/src/item-group/stories/index.js +2 -1
  1198. package/src/menu-item/index.js +1 -2
  1199. package/src/menu-item/test/index.js +2 -1
  1200. package/src/menu-items-choice/index.js +2 -5
  1201. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +2 -4
  1202. package/src/mobile/bottom-sheet/cell.native.js +2 -3
  1203. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +3 -5
  1204. package/src/mobile/bottom-sheet/index.native.js +14 -17
  1205. package/src/mobile/bottom-sheet/keyboard-avoiding-view.native.js +2 -7
  1206. package/src/mobile/bottom-sheet/picker-cell.native.js +2 -7
  1207. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +4 -6
  1208. package/src/mobile/color-settings/index.native.js +2 -4
  1209. package/src/mobile/focal-point-settings-panel/index.native.js +2 -2
  1210. package/src/mobile/global-styles-context/index.native.js +8 -7
  1211. package/src/mobile/gradient/index.native.js +12 -9
  1212. package/src/mobile/gradient/test/index.native.js +1 -3
  1213. package/src/mobile/html-text-input/index.native.js +2 -3
  1214. package/src/mobile/image/index.native.js +3 -2
  1215. package/src/mobile/inserter-button/index.native.js +2 -6
  1216. package/src/mobile/link-picker/index.native.js +2 -3
  1217. package/src/mobile/link-settings/image-link-destinations-screen.native.js +6 -2
  1218. package/src/mobile/media-edit/index.native.js +2 -3
  1219. package/src/mobile/segmented-control/index.native.js +9 -9
  1220. package/src/mobile/utils/test/index.native.js +3 -12
  1221. package/src/modal/index.js +22 -3
  1222. package/src/modal/stories/index.js +17 -1
  1223. package/src/modal/style.scss +9 -18
  1224. package/src/navigable-container/container.js +3 -2
  1225. package/src/navigable-container/test/menu.js +1 -2
  1226. package/src/navigable-container/test/tabbable.js +1 -2
  1227. package/src/navigation/context.js +2 -5
  1228. package/src/navigation/group/index.js +8 -3
  1229. package/src/navigation/index.js +5 -1
  1230. package/src/navigation/item/base.js +5 -3
  1231. package/src/navigation/item/index.js +2 -1
  1232. package/src/navigation/item/use-navigation-tree-item.js +2 -0
  1233. package/src/navigation/menu/menu-title-search.js +3 -6
  1234. package/src/navigation/menu/search-no-results-found.js +3 -6
  1235. package/src/navigation/stories/controlled-state.js +1 -1
  1236. package/src/navigation/stories/more-examples.js +2 -3
  1237. package/src/navigation/test/index.js +252 -52
  1238. package/src/navigation/use-navigation-tree-nodes.js +11 -10
  1239. package/src/navigation/utils.js +2 -2
  1240. package/src/navigator/navigator-back-button/hook.ts +14 -12
  1241. package/src/navigator/navigator-button/hook.ts +14 -13
  1242. package/src/navigator/navigator-provider/component.tsx +2 -6
  1243. package/src/navigator/navigator-screen/component.tsx +3 -3
  1244. package/src/notice/index.js +2 -1
  1245. package/src/notice/list.js +3 -1
  1246. package/src/number-control/stories/index.js +24 -24
  1247. package/src/panel/body.js +2 -1
  1248. package/src/placeholder/README.md +7 -6
  1249. package/src/placeholder/index.js +27 -10
  1250. package/src/placeholder/style.scss +23 -0
  1251. package/src/popover/README.md +2 -2
  1252. package/src/popover/index.js +7 -4
  1253. package/src/radio-control/README.md +17 -23
  1254. package/src/radio-control/index.tsx +107 -0
  1255. package/src/radio-control/stories/index.tsx +72 -0
  1256. package/src/radio-control/types.ts +32 -0
  1257. package/src/range-control/README.md +107 -79
  1258. package/src/range-control/{index.js → index.tsx} +81 -49
  1259. package/src/range-control/{input-range.js → input-range.tsx} +13 -12
  1260. package/src/range-control/{mark.js → mark.tsx} +15 -9
  1261. package/src/range-control/{rail.js → rail.tsx} +40 -23
  1262. package/src/range-control/stories/index.tsx +244 -0
  1263. package/src/range-control/styles/{range-control-styles.js → range-control-styles.ts} +28 -24
  1264. package/src/range-control/test/index.tsx +311 -0
  1265. package/src/range-control/{tooltip.js → tooltip.tsx} +19 -14
  1266. package/src/range-control/types.ts +326 -0
  1267. package/src/range-control/utils.ts +132 -0
  1268. package/src/resizable-box/resize-tooltip/index.tsx +2 -1
  1269. package/src/resizable-box/resize-tooltip/utils.ts +3 -8
  1270. package/src/responsive-wrapper/index.js +2 -4
  1271. package/src/sandbox/test/index.js +4 -6
  1272. package/src/scrollable/README.md +14 -8
  1273. package/src/scrollable/{component.js → component.tsx} +13 -10
  1274. package/src/scrollable/{hook.js → hook.ts} +5 -7
  1275. package/src/scrollable/{index.js → index.ts} +0 -0
  1276. package/src/scrollable/stories/{index.js → index.tsx} +29 -34
  1277. package/src/scrollable/{styles.js → styles.ts} +0 -0
  1278. package/src/scrollable/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
  1279. package/src/scrollable/test/index.tsx +34 -0
  1280. package/src/scrollable/types.ts +10 -5
  1281. package/src/select-control/index.tsx +3 -1
  1282. package/src/select-control/stories/index.tsx +3 -4
  1283. package/src/select-control/test/select-control.tsx +22 -15
  1284. package/src/shortcut/index.js +2 -7
  1285. package/src/slot-fill/fill.js +1 -5
  1286. package/src/slot-fill/index.native.js +2 -7
  1287. package/src/slot-fill/provider.js +3 -7
  1288. package/src/slot-fill/slot.js +31 -24
  1289. package/src/slot-fill/test/slot.js +2 -3
  1290. package/src/snackbar/index.js +1 -1
  1291. package/src/snackbar/list.js +2 -1
  1292. package/src/spacer/README.md +43 -37
  1293. package/src/spacer/component.tsx +5 -6
  1294. package/src/spacer/hook.ts +4 -2
  1295. package/src/spacer/index.ts +1 -1
  1296. package/src/spacer/stories/index.tsx +70 -0
  1297. package/src/spacer/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
  1298. package/src/spacer/test/index.tsx +149 -0
  1299. package/src/spacer/types.ts +41 -29
  1300. package/src/spinner/{index.js → index.tsx} +23 -9
  1301. package/src/spinner/stories/index.tsx +32 -0
  1302. package/src/spinner/{styles.js → styles.ts} +0 -0
  1303. package/src/style.scss +1 -0
  1304. package/src/tab-panel/README.md +1 -1
  1305. package/src/tab-panel/index.js +3 -1
  1306. package/src/text/hook.js +4 -1
  1307. package/src/text/types.ts +1 -1
  1308. package/src/text/utils.js +2 -3
  1309. package/src/text-control/stories/index.tsx +4 -6
  1310. package/src/text-highlight/README.md +6 -6
  1311. package/src/text-highlight/index.tsx +49 -0
  1312. package/src/text-highlight/stories/index.tsx +33 -0
  1313. package/src/text-highlight/test/index.tsx +93 -0
  1314. package/src/text-highlight/types.ts +16 -0
  1315. package/src/tip/index.tsx +22 -0
  1316. package/src/tip/stories/index.tsx +33 -0
  1317. package/src/tip/types.ts +11 -0
  1318. package/src/toggle-control/index.js +1 -2
  1319. package/src/toggle-control/index.native.js +2 -6
  1320. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +2 -4
  1321. package/src/toolbar/index.js +1 -2
  1322. package/src/toolbar-group/index.js +1 -2
  1323. package/src/tools-panel/tools-panel/hook.ts +2 -4
  1324. package/src/tools-panel/tools-panel-header/hook.ts +2 -5
  1325. package/src/tooltip/index.js +1 -0
  1326. package/src/tree-grid/roving-tab-index-item.js +2 -4
  1327. package/src/tree-grid/test/index.js +2 -3
  1328. package/src/tree-select/README.md +2 -2
  1329. package/src/tree-select/index.tsx +99 -0
  1330. package/src/tree-select/stories/index.tsx +80 -0
  1331. package/src/tree-select/types.ts +35 -0
  1332. package/src/truncate/README.md +16 -12
  1333. package/src/truncate/{component.js → component.tsx} +13 -9
  1334. package/src/truncate/{hook.js → hook.ts} +8 -10
  1335. package/src/truncate/{index.js → index.ts} +0 -0
  1336. package/src/truncate/stories/index.tsx +49 -0
  1337. package/src/truncate/{styles.js → styles.ts} +0 -0
  1338. package/src/truncate/test/{index.js → index.tsx} +4 -4
  1339. package/src/truncate/types.ts +28 -10
  1340. package/src/truncate/{utils.js → utils.ts} +19 -19
  1341. package/src/ui/context/wordpress-component.ts +4 -5
  1342. package/src/ui/form-group/form-group-content.js +4 -4
  1343. package/src/ui/form-group/types.ts +1 -1
  1344. package/src/ui/utils/get-valid-children.ts +4 -2
  1345. package/src/unit-control/index.tsx +7 -9
  1346. package/src/unit-control/stories/index.tsx +8 -12
  1347. package/src/unit-control/test/index.tsx +4 -7
  1348. package/src/utils/hooks/stories/use-cx.js +8 -7
  1349. package/src/utils/hooks/test/use-controlled-state.js +2 -1
  1350. package/src/utils/math.js +14 -5
  1351. package/src/utils/test/math.js +22 -1
  1352. package/src/utils/unit-values.ts +2 -1
  1353. package/src/utils/values.js +2 -3
  1354. package/src/v-stack/README.md +6 -18
  1355. package/src/v-stack/{component.js → component.tsx} +15 -10
  1356. package/src/v-stack/{hook.js → hook.ts} +5 -6
  1357. package/src/v-stack/{index.js → index.ts} +0 -0
  1358. package/src/v-stack/stories/index.tsx +41 -0
  1359. package/src/v-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1360. package/src/v-stack/test/{index.js → index.tsx} +0 -0
  1361. package/src/v-stack/types.ts +21 -1
  1362. package/src/visually-hidden/{component.js → component.tsx} +23 -15
  1363. package/src/visually-hidden/{index.js → index.ts} +0 -0
  1364. package/src/visually-hidden/stories/index.tsx +66 -0
  1365. package/src/visually-hidden/{styles.js → styles.ts} +6 -2
  1366. package/src/visually-hidden/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1367. package/src/visually-hidden/test/index.tsx +17 -0
  1368. package/src/visually-hidden/types.ts +11 -0
  1369. package/src/z-stack/README.md +14 -3
  1370. package/src/z-stack/component.tsx +24 -29
  1371. package/src/z-stack/stories/index.tsx +76 -0
  1372. package/src/z-stack/types.ts +33 -0
  1373. package/tsconfig.json +7 -0
  1374. package/tsconfig.tsbuildinfo +1 -1
  1375. package/src/border-control/stories/index.js +0 -119
  1376. package/src/color-indicator/index.js +0 -16
  1377. package/src/color-indicator/stories/index.js +0 -22
  1378. package/src/color-indicator/test/__snapshots__/index.js.snap +0 -13
  1379. package/src/external-link/stories/index.js +0 -23
  1380. package/src/form-toggle/index.js +0 -37
  1381. package/src/form-toggle/stories/index.js +0 -28
  1382. package/src/form-toggle/test/index.js +0 -75
  1383. package/src/form-token-field/index.js +0 -725
  1384. package/src/form-token-field/stories/index.js +0 -102
  1385. package/src/form-token-field/test/lib/token-field-wrapper.js +0 -56
  1386. package/src/form-token-field/token-input.js +0 -81
  1387. package/src/grid/stories/index.js +0 -49
  1388. package/src/h-stack/stories/index.js +0 -22
  1389. package/src/heading/test/index.js +0 -67
  1390. package/src/radio-control/index.js +0 -69
  1391. package/src/radio-control/stories/index.js +0 -41
  1392. package/src/range-control/stories/index.js +0 -180
  1393. package/src/range-control/test/index.js +0 -320
  1394. package/src/range-control/utils.js +0 -132
  1395. package/src/scrollable/test/index.js +0 -31
  1396. package/src/spacer/stories/index.js +0 -59
  1397. package/src/spacer/test/index.js +0 -146
  1398. package/src/spinner/stories/index.js +0 -43
  1399. package/src/text-highlight/index.js +0 -28
  1400. package/src/text-highlight/stories/index.js +0 -28
  1401. package/src/text-highlight/test/index.js +0 -120
  1402. package/src/tip/index.js +0 -24
  1403. package/src/tip/stories/index.js +0 -26
  1404. package/src/tree-select/index.js +0 -48
  1405. package/src/tree-select/stories/index.js +0 -80
  1406. package/src/truncate/stories/index.js +0 -38
  1407. package/src/visually-hidden/stories/index.js +0 -42
  1408. package/src/visually-hidden/test/index.js +0 -19
  1409. package/src/z-stack/stories/index.js +0 -70
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.InputWrapperFlex = void 0;
9
+
10
+ var _base = _interopRequireDefault(require("@emotion/styled/base"));
11
+
12
+ var _react = require("@emotion/react");
13
+
14
+ var _flex = require("../flex");
15
+
16
+ var _space = require("../ui/utils/space");
17
+
18
+ /**
19
+ * External dependencies
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+ const deprecatedDefaultSize = _ref => {
26
+ let {
27
+ __next36pxDefaultSize
28
+ } = _ref;
29
+ return !__next36pxDefaultSize && /*#__PURE__*/(0, _react.css)("height:28px;padding-left:", (0, _space.space)(1), ";padding-right:", (0, _space.space)(1), ";" + (process.env.NODE_ENV === "production" ? "" : ";label:deprecatedDefaultSize;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvY29tYm9ib3gtY29udHJvbC9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBY0kiLCJmaWxlIjoiQHdvcmRwcmVzcy9jb21wb25lbnRzL3NyYy9jb21ib2JveC1jb250cm9sL3N0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBJbnRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgRmxleCB9IGZyb20gJy4uL2ZsZXgnO1xuaW1wb3J0IHsgc3BhY2UgfSBmcm9tICcuLi91aS91dGlscy9zcGFjZSc7XG5cbmNvbnN0IGRlcHJlY2F0ZWREZWZhdWx0U2l6ZSA9ICggeyBfX25leHQzNnB4RGVmYXVsdFNpemUgfSApID0+XG5cdCEgX19uZXh0MzZweERlZmF1bHRTaXplICYmXG5cdGNzc2Bcblx0XHRoZWlnaHQ6IDI4cHg7IC8vIDMwcHggLSAycHggdmVydGljYWwgYm9yZGVycyBvbiBwYXJlbnQgY29udGFpbmVyXG5cdFx0cGFkZGluZy1sZWZ0OiAkeyBzcGFjZSggMSApIH07XG5cdFx0cGFkZGluZy1yaWdodDogJHsgc3BhY2UoIDEgKSB9O1xuXHRgO1xuXG5leHBvcnQgY29uc3QgSW5wdXRXcmFwcGVyRmxleCA9IHN0eWxlZCggRmxleCApYFxuXHRoZWlnaHQ6IDM0cHg7IC8vIDM2cHggLSAycHggdmVydGljYWwgYm9yZGVycyBvbiBwYXJlbnQgY29udGFpbmVyXG5cdHBhZGRpbmctbGVmdDogJHsgc3BhY2UoIDIgKSB9O1xuXHRwYWRkaW5nLXJpZ2h0OiAkeyBzcGFjZSggMiApIH07XG5cblx0JHsgZGVwcmVjYXRlZERlZmF1bHRTaXplIH1cbmA7XG4iXX0= */");
30
+ };
31
+
32
+ const InputWrapperFlex = ( /*#__PURE__*/0, _base.default)(_flex.Flex, process.env.NODE_ENV === "production" ? {
33
+ target: "evuatpg0"
34
+ } : {
35
+ target: "evuatpg0",
36
+ label: "InputWrapperFlex"
37
+ })("height:34px;padding-left:", (0, _space.space)(2), ";padding-right:", (0, _space.space)(2), ";", deprecatedDefaultSize, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvY29tYm9ib3gtY29udHJvbC9zdHlsZXMudHMiXSwibmFtZX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biJdfQ== */"));
38
+ exports.InputWrapperFlex = InputWrapperFlex;
39
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/combobox-control/styles.ts"],"names":["deprecatedDefaultSize","__next36pxDefaultSize","css","InputWrapperFlex","Flex"],"mappings":";;;;;;;;;;;AAIA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,qBAAqB,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA,SAC7B,CAAEA,qBAAF,qBACAC,UADA,+BAGkB,kBAAO,CAAP,CAHlB,qBAImB,kBAAO,CAAP,CAJnB,23CAD6B;AAAA,CAA9B;;AAQO,MAAMC,gBAAgB,GAAG,iCAAQC,UAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,8BAEX,kBAAO,CAAP,CAFW,qBAGV,kBAAO,CAAP,CAHU,OAKzBJ,qBALyB,izCAAtB","sourcesContent":["/**\n * External dependencies\n */\nimport styled from '@emotion/styled';\nimport { css } from '@emotion/react';\n\n/**\n * Internal dependencies\n */\nimport { Flex } from '../flex';\nimport { space } from '../ui/utils/space';\n\nconst deprecatedDefaultSize = ( { __next36pxDefaultSize } ) =>\n\t! __next36pxDefaultSize &&\n\tcss`\n\t\theight: 28px; // 30px - 2px vertical borders on parent container\n\t\tpadding-left: ${ space( 1 ) };\n\t\tpadding-right: ${ space( 1 ) };\n\t`;\n\nexport const InputWrapperFlex = styled( Flex )`\n\theight: 34px; // 36px - 2px vertical borders on parent container\n\tpadding-left: ${ space( 2 ) };\n\tpadding-right: ${ space( 2 ) };\n\n\t${ deprecatedDefaultSize }\n`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/confirm-dialog/component.tsx"],"names":["ConfirmDialog","props","forwardedRef","isOpen","isOpenProp","onConfirm","onCancel","children","confirmButtonText","cancelButtonText","otherProps","cx","wrapperClassName","styles","wrapper","setIsOpen","shouldSelfClose","setShouldSelfClose","isIsOpenSet","handleEvent","callback","event","handleEnter","key","cancelLabel","confirmLabel"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAeA,SAASA,aAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,MAAM,EAAEC,UADH;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,iBALK;AAMLC,IAAAA,gBANK;AAOL,OAAGC;AAPE,MAQF,+BAAkBT,KAAlB,EAAyB,eAAzB,CARJ;AAUA,QAAMU,EAAE,GAAG,mBAAX;AACA,QAAMC,gBAAgB,GAAGD,EAAE,CAAEE,MAAM,CAACC,OAAT,CAA3B;AAEA,QAAM,CAAEX,MAAF,EAAUY,SAAV,IAAwB,wBAA9B;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,wBAAhD;AAEA,0BAAW,MAAM;AAChB;AACA;AACA;AACA;AACA,UAAMC,WAAW,GAAG,OAAOd,UAAP,KAAsB,WAA1C;AACAW,IAAAA,SAAS,CAAEG,WAAW,GAAGd,UAAH,GAAgB,IAA7B,CAAT;AACAa,IAAAA,kBAAkB,CAAE,CAAEC,WAAJ,CAAlB;AACA,GARD,EAQG,CAAEd,UAAF,CARH;AAUA,QAAMe,WAAW,GAAG,0BACjBC,QAAF,IACCC,KADqD,IAEjD;AACJD,IAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAIC,KAAJ,CAAR;;AACA,QAAKL,eAAL,EAAuB;AACtBD,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GARkB,EASnB,CAAEC,eAAF,EAAmBD,SAAnB,CATmB,CAApB;AAYA,QAAMO,WAAW,GAAG,0BACjBD,KAAF,IAA8C;AAC7C,QAAKA,KAAK,CAACE,GAAN,KAAc,OAAnB,EAA6B;AAC5BJ,MAAAA,WAAW,CAAEd,SAAF,CAAX,CAA0BgB,KAA1B;AACA;AACD,GALkB,EAMnB,CAAEF,WAAF,EAAed,SAAf,CANmB,CAApB;AASA,QAAMmB,WAAW,GAAGf,gBAAH,aAAGA,gBAAH,cAAGA,gBAAH,GAAuB,cAAI,QAAJ,CAAxC;AACA,QAAMgB,YAAY,GAAGjB,iBAAH,aAAGA,iBAAH,cAAGA,iBAAH,GAAwB,cAAI,IAAJ,CAA1C;AAEA,SACC,qDACGL,MAAM,IACP,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGgB,WAAW,CAAEb,QAAF,CAD7B;AAEC,IAAA,SAAS,EAAGgB,WAFb;AAGC,IAAA,gBAAgB,EAAGE,WAHpB;AAIC,IAAA,aAAa,EAAG,IAJjB;AAKC,IAAA,GAAG,EAAGtB,YALP;AAMC,IAAA,gBAAgB,EAAGU,gBANpB;AAOC,IAAA,wBAAwB;AAPzB,KAQMF,UARN,GAUC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,UAAD,QAAQH,QAAR,CADD,EAEC,4BAAC,UAAD;AAAM,IAAA,SAAS,EAAC,KAAhB;AAAsB,IAAA,OAAO,EAAC;AAA9B,KACC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAGY,WAAW,CAAEb,QAAF;AAFtB,KAIGkB,WAJH,CADD,EAOC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAGL,WAAW,CAAEd,SAAF;AAFtB,KAIGoB,YAJH,CAPD,CAFD,CAVD,CAFF,CADD;AAkCA;;eAEc,6BAAgBzB,aAAhB,EAA+B,eAA/B,C","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, KeyboardEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport type { OwnProps, DialogInputEvent } from './types';\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\nimport * as styles from './styles';\nimport { useCx } from '../utils/hooks/use-cx';\n\nfunction ConfirmDialog(\n\tprops: WordPressComponentProps< OwnProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tisOpen: isOpenProp,\n\t\tonConfirm,\n\t\tonCancel,\n\t\tchildren,\n\t\tconfirmButtonText,\n\t\tcancelButtonText,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ConfirmDialog' );\n\n\tconst cx = useCx();\n\tconst wrapperClassName = cx( styles.wrapper );\n\n\tconst [ isOpen, setIsOpen ] = useState< boolean >();\n\tconst [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();\n\n\tuseEffect( () => {\n\t\t// We only allow the dialog to close itself if `isOpenProp` is *not* set.\n\t\t// If `isOpenProp` is set, then it (probably) means it's controlled by a\n\t\t// parent component. In that case, `shouldSelfClose` might do more harm than\n\t\t// good, so we disable it.\n\t\tconst isIsOpenSet = typeof isOpenProp !== 'undefined';\n\t\tsetIsOpen( isIsOpenSet ? isOpenProp : true );\n\t\tsetShouldSelfClose( ! isIsOpenSet );\n\t}, [ isOpenProp ] );\n\n\tconst handleEvent = useCallback(\n\t\t( callback?: ( event: DialogInputEvent ) => void ) => (\n\t\t\tevent: DialogInputEvent\n\t\t) => {\n\t\t\tcallback?.( event );\n\t\t\tif ( shouldSelfClose ) {\n\t\t\t\tsetIsOpen( false );\n\t\t\t}\n\t\t},\n\t\t[ shouldSelfClose, setIsOpen ]\n\t);\n\n\tconst handleEnter = useCallback(\n\t\t( event: KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\thandleEvent( onConfirm )( event );\n\t\t\t}\n\t\t},\n\t\t[ handleEvent, onConfirm ]\n\t);\n\n\tconst cancelLabel = cancelButtonText ?? __( 'Cancel' );\n\tconst confirmLabel = confirmButtonText ?? __( 'OK' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tonRequestClose={ handleEvent( onCancel ) }\n\t\t\t\t\tonKeyDown={ handleEnter }\n\t\t\t\t\tcloseButtonLabel={ cancelLabel }\n\t\t\t\t\tisDismissible={ true }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\toverlayClassName={ wrapperClassName }\n\t\t\t\t\t__experimentalHideHeader\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 8 }>\n\t\t\t\t\t\t<Text>{ children }</Text>\n\t\t\t\t\t\t<Flex direction=\"row\" justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onCancel ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ cancelLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onConfirm ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default contextConnect( ConfirmDialog, 'ConfirmDialog' );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/confirm-dialog/component.tsx"],"names":["ConfirmDialog","props","forwardedRef","isOpen","isOpenProp","onConfirm","onCancel","children","confirmButtonText","cancelButtonText","otherProps","cx","wrapperClassName","styles","wrapper","setIsOpen","shouldSelfClose","setShouldSelfClose","isIsOpenSet","handleEvent","callback","event","handleEnter","key","cancelLabel","confirmLabel"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAeA,SAASA,aAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,MAAM,EAAEC,UADH;AAELC,IAAAA,SAFK;AAGLC,IAAAA,QAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,iBALK;AAMLC,IAAAA,gBANK;AAOL,OAAGC;AAPE,MAQF,+BAAkBT,KAAlB,EAAyB,eAAzB,CARJ;AAUA,QAAMU,EAAE,GAAG,mBAAX;AACA,QAAMC,gBAAgB,GAAGD,EAAE,CAAEE,MAAM,CAACC,OAAT,CAA3B;AAEA,QAAM,CAAEX,MAAF,EAAUY,SAAV,IAAwB,wBAA9B;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,wBAAhD;AAEA,0BAAW,MAAM;AAChB;AACA;AACA;AACA;AACA,UAAMC,WAAW,GAAG,OAAOd,UAAP,KAAsB,WAA1C;AACAW,IAAAA,SAAS,CAAEG,WAAW,GAAGd,UAAH,GAAgB,IAA7B,CAAT;AACAa,IAAAA,kBAAkB,CAAE,CAAEC,WAAJ,CAAlB;AACA,GARD,EAQG,CAAEd,UAAF,CARH;AAUA,QAAMe,WAAW,GAAG,0BACjBC,QAAF,IACGC,KAAF,IAA+B;AAC9BD,IAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAIC,KAAJ,CAAR;;AACA,QAAKL,eAAL,EAAuB;AACtBD,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GAPiB,EAQnB,CAAEC,eAAF,EAAmBD,SAAnB,CARmB,CAApB;AAWA,QAAMO,WAAW,GAAG,0BACjBD,KAAF,IAA8C;AAC7C,QAAKA,KAAK,CAACE,GAAN,KAAc,OAAnB,EAA6B;AAC5BJ,MAAAA,WAAW,CAAEd,SAAF,CAAX,CAA0BgB,KAA1B;AACA;AACD,GALkB,EAMnB,CAAEF,WAAF,EAAed,SAAf,CANmB,CAApB;AASA,QAAMmB,WAAW,GAAGf,gBAAH,aAAGA,gBAAH,cAAGA,gBAAH,GAAuB,cAAI,QAAJ,CAAxC;AACA,QAAMgB,YAAY,GAAGjB,iBAAH,aAAGA,iBAAH,cAAGA,iBAAH,GAAwB,cAAI,IAAJ,CAA1C;AAEA,SACC,qDACGL,MAAM,IACP,4BAAC,cAAD;AACC,IAAA,cAAc,EAAGgB,WAAW,CAAEb,QAAF,CAD7B;AAEC,IAAA,SAAS,EAAGgB,WAFb;AAGC,IAAA,gBAAgB,EAAGE,WAHpB;AAIC,IAAA,aAAa,EAAG,IAJjB;AAKC,IAAA,GAAG,EAAGtB,YALP;AAMC,IAAA,gBAAgB,EAAGU,gBANpB;AAOC,IAAA,wBAAwB;AAPzB,KAQMF,UARN,GAUC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,UAAD,QAAQH,QAAR,CADD,EAEC,4BAAC,UAAD;AAAM,IAAA,SAAS,EAAC,KAAhB;AAAsB,IAAA,OAAO,EAAC;AAA9B,KACC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAGY,WAAW,CAAEb,QAAF;AAFtB,KAIGkB,WAJH,CADD,EAOC,4BAAC,eAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAGL,WAAW,CAAEd,SAAF;AAFtB,KAIGoB,YAJH,CAPD,CAFD,CAVD,CAFF,CADD;AAkCA;;eAEc,6BAAgBzB,aAAhB,EAA+B,eAA/B,C","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, KeyboardEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport type { OwnProps, DialogInputEvent } from './types';\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\nimport * as styles from './styles';\nimport { useCx } from '../utils/hooks/use-cx';\n\nfunction ConfirmDialog(\n\tprops: WordPressComponentProps< OwnProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tisOpen: isOpenProp,\n\t\tonConfirm,\n\t\tonCancel,\n\t\tchildren,\n\t\tconfirmButtonText,\n\t\tcancelButtonText,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ConfirmDialog' );\n\n\tconst cx = useCx();\n\tconst wrapperClassName = cx( styles.wrapper );\n\n\tconst [ isOpen, setIsOpen ] = useState< boolean >();\n\tconst [ shouldSelfClose, setShouldSelfClose ] = useState< boolean >();\n\n\tuseEffect( () => {\n\t\t// We only allow the dialog to close itself if `isOpenProp` is *not* set.\n\t\t// If `isOpenProp` is set, then it (probably) means it's controlled by a\n\t\t// parent component. In that case, `shouldSelfClose` might do more harm than\n\t\t// good, so we disable it.\n\t\tconst isIsOpenSet = typeof isOpenProp !== 'undefined';\n\t\tsetIsOpen( isIsOpenSet ? isOpenProp : true );\n\t\tsetShouldSelfClose( ! isIsOpenSet );\n\t}, [ isOpenProp ] );\n\n\tconst handleEvent = useCallback(\n\t\t( callback?: ( event: DialogInputEvent ) => void ) =>\n\t\t\t( event: DialogInputEvent ) => {\n\t\t\t\tcallback?.( event );\n\t\t\t\tif ( shouldSelfClose ) {\n\t\t\t\t\tsetIsOpen( false );\n\t\t\t\t}\n\t\t\t},\n\t\t[ shouldSelfClose, setIsOpen ]\n\t);\n\n\tconst handleEnter = useCallback(\n\t\t( event: KeyboardEvent< HTMLDivElement > ) => {\n\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\thandleEvent( onConfirm )( event );\n\t\t\t}\n\t\t},\n\t\t[ handleEvent, onConfirm ]\n\t);\n\n\tconst cancelLabel = cancelButtonText ?? __( 'Cancel' );\n\tconst confirmLabel = confirmButtonText ?? __( 'OK' );\n\n\treturn (\n\t\t<>\n\t\t\t{ isOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\tonRequestClose={ handleEvent( onCancel ) }\n\t\t\t\t\tonKeyDown={ handleEnter }\n\t\t\t\t\tcloseButtonLabel={ cancelLabel }\n\t\t\t\t\tisDismissible={ true }\n\t\t\t\t\tref={ forwardedRef }\n\t\t\t\t\toverlayClassName={ wrapperClassName }\n\t\t\t\t\t__experimentalHideHeader\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t>\n\t\t\t\t\t<VStack spacing={ 8 }>\n\t\t\t\t\t\t<Text>{ children }</Text>\n\t\t\t\t\t\t<Flex direction=\"row\" justify=\"flex-end\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onCancel ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ cancelLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ handleEvent( onConfirm ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</VStack>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default contextConnect( ConfirmDialog, 'ConfirmDialog' );\n"]}
@@ -3,13 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MINIMUM_SIGNIFICANT_MOVE = exports.MINIMUM_DISTANCE_BETWEEN_POINTS = exports.MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = exports.MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = exports.MINIMUM_ABSOLUTE_LEFT_POSITION = exports.KEYBOARD_CONTROL_POINT_VARIATION = exports.INSERT_POINT_WIDTH = exports.GRADIENT_MARKERS_WIDTH = void 0;
6
+ exports.MINIMUM_SIGNIFICANT_MOVE = exports.MINIMUM_DISTANCE_BETWEEN_POINTS = exports.MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = exports.MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = exports.KEYBOARD_CONTROL_POINT_VARIATION = exports.INSERT_POINT_WIDTH = exports.GRADIENT_MARKERS_WIDTH = void 0;
7
7
  const GRADIENT_MARKERS_WIDTH = 16;
8
8
  exports.GRADIENT_MARKERS_WIDTH = GRADIENT_MARKERS_WIDTH;
9
9
  const INSERT_POINT_WIDTH = 16;
10
10
  exports.INSERT_POINT_WIDTH = INSERT_POINT_WIDTH;
11
- const MINIMUM_ABSOLUTE_LEFT_POSITION = 5;
12
- exports.MINIMUM_ABSOLUTE_LEFT_POSITION = MINIMUM_ABSOLUTE_LEFT_POSITION;
13
11
  const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;
14
12
  exports.MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
15
13
  const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/constants.js"],"names":["GRADIENT_MARKERS_WIDTH","INSERT_POINT_WIDTH","MINIMUM_ABSOLUTE_LEFT_POSITION","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","MINIMUM_DISTANCE_BETWEEN_POINTS","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER"],"mappings":";;;;;;AAAO,MAAMA,sBAAsB,GAAG,EAA/B;;AACA,MAAMC,kBAAkB,GAAG,EAA3B;;AACA,MAAMC,8BAA8B,GAAG,CAAvC;;AACA,MAAMC,2CAA2C,GAAG,EAApD;;AACA,MAAMC,+BAA+B,GAAG,CAAxC;;AACA,MAAMC,wBAAwB,GAAG,CAAjC;;AAEA,MAAMC,gCAAgC,GAAGH,2CAAzC;;AACA,MAAMI,4CAA4C,GACxD,CAAEN,kBAAkB,GAAGD,sBAAvB,IAAkD,CAD5C","sourcesContent":["export const GRADIENT_MARKERS_WIDTH = 16;\nexport const INSERT_POINT_WIDTH = 16;\nexport const MINIMUM_ABSOLUTE_LEFT_POSITION = 5;\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 = MINIMUM_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-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":";;;;;;AAAO,MAAMA,sBAAsB,GAAG,EAA/B;;AACA,MAAMC,kBAAkB,GAAG,EAA3B;;AACA,MAAMC,2CAA2C,GAAG,EAApD;;AACA,MAAMC,+BAA+B,GAAG,CAAxC;;AACA,MAAMC,wBAAwB,GAAG,CAAjC;;AAEA,MAAMC,gCAAgC,GAC5CH,2CADM;;AAEA,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"]}
@@ -65,7 +65,8 @@ function ControlPointButton(_ref) {
65
65
  'is-active': isOpen
66
66
  }),
67
67
  style: {
68
- left: `${position}%`
68
+ left: `${position}%`,
69
+ transform: 'translateX( -50% )'
69
70
  }
70
71
  }, additionalProps)), (0, _element.createElement)(_visuallyHidden.VisuallyHidden, {
71
72
  id: descriptionId
@@ -90,7 +91,7 @@ function GradientColorPickerDropdown(_ref2) {
90
91
  }
91
92
 
92
93
  return result;
93
- }, [gradientPickerDomRef.current, isRenderedInSidebar]);
94
+ }, [gradientPickerDomRef, isRenderedInSidebar]);
94
95
  return (0, _element.createElement)(_colorPalette.CustomColorPickerDropdown, (0, _extends2.default)({
95
96
  isRenderedInSidebar: isRenderedInSidebar,
96
97
  popoverProps: popoverProps
@@ -112,7 +113,7 @@ function ControlPoints(_ref3) {
112
113
  const controlPointMoveState = (0, _element.useRef)();
113
114
 
114
115
  const onMouseMove = event => {
115
- const relativePosition = (0, _utils.getHorizontalRelativeGradientPosition)(event.clientX, gradientPickerDomRef.current, _constants.GRADIENT_MARKERS_WIDTH);
116
+ const relativePosition = (0, _utils.getHorizontalRelativeGradientPosition)(event.clientX, gradientPickerDomRef.current);
116
117
  const {
117
118
  initialPosition,
118
119
  index,
@@ -133,11 +134,16 @@ function ControlPoints(_ref3) {
133
134
  onStopControlPointChange();
134
135
  controlPointMoveState.current.listenersActivated = false;
135
136
  }
136
- };
137
+ }; // Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`
138
+ // This memoization would prevent the event listeners from being properly cleaned.
139
+ // Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.
140
+
137
141
 
142
+ const cleanEventListenersRef = (0, _element.useRef)();
143
+ cleanEventListenersRef.current = cleanEventListeners;
138
144
  (0, _element.useEffect)(() => {
139
145
  return () => {
140
- cleanEventListeners();
146
+ cleanEventListenersRef.current();
141
147
  };
142
148
  }, []);
143
149
  return controlPoints.map((point, index) => {
@@ -260,9 +266,10 @@ function InsertPoint(_ref6) {
260
266
  },
261
267
  className: "components-custom-gradient-picker__insert-point",
262
268
  icon: _icons.plus,
263
- style: {
264
- left: insertPosition !== null ? `${insertPosition}%` : undefined
265
- }
269
+ style: insertPosition !== null ? {
270
+ left: `${insertPosition}%`,
271
+ transform: 'translateX( -50% )'
272
+ } : undefined
266
273
  });
267
274
  },
268
275
  renderContent: () => (0, _element.createElement)(_colorPicker.ColorPicker, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/control-points.js"],"names":["ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","left","GradientColorPickerDropdown","isRenderedInSidebar","gradientPickerDomRef","props","popoverProps","result","className","anchorRef","current","ControlPoints","disableRemove","disableAlpha","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","relativePosition","clientX","GRADIENT_MARKERS_WIDTH","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","cleanEventListeners","window","removeEventListener","listenersActivated","map","point","onToggle","addEventListener","keyCode","LEFT","stopPropagation","KEYBOARD_CONTROL_POINT_VARIATION","RIGHT","onClose","toRgbString","length","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","plus","undefined"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AASA;;AAhCA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAqBA,SAASA,kBAAT,OAA+E;AAAA,MAAlD;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAApB;AAA2B,OAAGC;AAA9B,GAAkD;AAC9E,QAAMC,UAAU,GAAG,4BAAeL,kBAAf,CAAnB;AACA,QAAMM,aAAa,GAAI,uEAAuED,UAAY,EAA1G;AACA,SACC,qDACC,4BAAC,eAAD;AACC,kBAAa,oBACZ;AACA,kBACC,iEADD,CAFY,EAKZH,QALY,EAMZC,KANY,CADd;AASC,wBAAmBG,aATpB;AAUC,qBAAc,MAVf;AAWC,qBAAgBL,MAXjB;AAYC,IAAA,SAAS,EAAG,yBACX,yDADW,EAEX;AACC,mBAAaA;AADd,KAFW,CAZb;AAkBC,IAAA,KAAK,EAAG;AACPM,MAAAA,IAAI,EAAG,GAAGL,QAAU;AADb;AAlBT,KAqBME,eArBN,EADD,EAwBC,4BAAC,8BAAD;AAAgB,IAAA,EAAE,EAAGE;AAArB,KACG,cACD,sKADC,CADH,CAxBD,CADD;AAgCA;;AAED,SAASE,2BAAT,QAII;AAAA,MAJkC;AACrCC,IAAAA,mBADqC;AAErCC,IAAAA,oBAFqC;AAGrC,OAAGC;AAHkC,GAIlC;AACH,QAAMC,YAAY,GAAG,sBAAS,MAAM;AACnC,UAAMC,MAAM,GAAG;AACdC,MAAAA,SAAS,EACR,yDAFa;AAGdZ,MAAAA,QAAQ,EAAE;AAHI,KAAf;;AAKA,QAAKO,mBAAL,EAA2B;AAC1BI,MAAAA,MAAM,CAACE,SA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AXF;AAYC,QAAA,SAAS,EAAC,iDAZX;AAaC,QAAA,IAAI,EAAGgB,WAbR;AAcC,QAAA,KAAK,EAAG;AACPtD,UAAAA,IAAI,EACHmD,cAAc,KAAK,IAAnB,GACI,GAAGA,cAAgB,GADvB,GAEGI;AAJG;AAdT,QADc;AAAA,KAPhB;AA8BC,IAAA,aAAa,EAAG,MACf,4BAAC,wBAAD;AACC,MAAA,WAAW,EAAG,CAAE3C,YADjB;AAEC,MAAA,QAAQ,EAAKhB,KAAF,IAAa;AACvB,YAAK,CAAEwD,oBAAP,EAA8B;AAC7BpC,UAAAA,QAAQ,CACP,4BACCD,aADD,EAECoC,cAFD,EAGC,oBAAQvD,KAAR,EAAgBkD,WAAhB,EAHD,CADO,CAAR;AAOAO,UAAAA,uBAAuB,CAAE,IAAF,CAAvB;AACA,SATD,MASO;AACNrC,UAAAA,QAAQ,CACP,8CACCD,aADD,EAECoC,cAFD,EAGC,oBAAQvD,KAAR,EAAgBkD,WAAhB,EAHD,CADO,CAAR;AAOA;AACD;AArBF;AA/BF,IADD;AA0DA;;AACDpC,aAAa,CAACsC,WAAd,GAA4BA,WAA5B;eAEetC,a","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';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\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\tGRADIENT_MARKERS_WIDTH,\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\tstyle={ {\n\t\t\t\t\tleft: `${ position }%`,\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\tgradientPickerDomRef,\n\t...props\n} ) {\n\tconst popoverProps = useMemo( () => {\n\t\tconst result = {\n\t\t\tclassName:\n\t\t\t\t'components-custom-gradient-picker__color-picker-popover',\n\t\t\tposition: 'top',\n\t\t};\n\t\tif ( isRenderedInSidebar ) {\n\t\t\tresult.anchorRef = gradientPickerDomRef.current;\n\t\t\tresult.position = 'bottom left';\n\t\t}\n\t\treturn result;\n\t}, [ gradientPickerDomRef.current, isRenderedInSidebar ] );\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\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\tGRADIENT_MARKERS_WIDTH\n\t\t);\n\t\tconst {\n\t\t\tinitialPosition,\n\t\t\tindex,\n\t\t\tsignificantMoveHappened,\n\t\t} = controlPointMoveState.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\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tcleanEventListeners();\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\tgradientPickerDomRef={ gradientPickerDomRef }\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.keyCode === LEFT ) {\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.keyCode === RIGHT ) {\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<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\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)\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Remove Control Point' ) }\n\t\t\t\t\t\t\t\t</Button>\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\tgradientPickerDomRef,\n} ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tgradientPickerDomRef={ gradientPickerDomRef }\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\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft:\n\t\t\t\t\t\t\tinsertPosition !== null\n\t\t\t\t\t\t\t\t? `${ insertPosition }%`\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} }\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/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/control-points.js"],"names":["ControlPointButton","isOpen","position","color","additionalProps","instanceId","descriptionId","left","transform","GradientColorPickerDropdown","isRenderedInSidebar","gradientPickerDomRef","props","popoverProps","result","className","anchorRef","current","ControlPoints","disableRemove","disableAlpha","ignoreMarkerPosition","value","controlPoints","onChange","onStartControlPointChange","onStopControlPointChange","__experimentalIsRenderedInSidebar","controlPointMoveState","onMouseMove","event","relativePosition","clientX","initialPosition","index","significantMoveHappened","Math","abs","MINIMUM_SIGNIFICANT_MOVE","cleanEventListeners","window","removeEventListener","listenersActivated","cleanEventListenersRef","map","point","onToggle","addEventListener","keyCode","LEFT","stopPropagation","KEYBOARD_CONTROL_POINT_VARIATION","RIGHT","onClose","toRgbString","length","InsertPoint","onOpenInserter","onCloseInserter","insertPosition","alreadyInsertedPoint","setAlreadyInsertedPoint","plus","undefined"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAKA;;AAEA;;AAC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AAaC,QAAA,IAAI,EAAGgB,WAbR;AAcC,QAAA,KAAK,EACJH,cAAc,KAAK,IAAnB,GACG;AACApD,UAAAA,IAAI,EAAG,GAAGoD,cAAgB,GAD1B;AAEAnD,UAAAA,SAAS,EAAE;AAFX,SADH,GAKGuD;AApBL,QADc;AAAA,KAPhB;AAgCC,IAAA,aAAa,EAAG,MACf,4BAAC,wBAAD;AACC,MAAA,WAAW,EAAG,CAAE3C,YADjB;AAEC,MAAA,QAAQ,EAAKjB,KAAF,IAAa;AACvB,YAAK,CAAEyD,oBAAP,EAA8B;AAC7BpC,UAAAA,QAAQ,CACP,4BACCD,aADD,EAECoC,cAFD,EAGC,oBAAQxD,KAAR,EAAgBmD,WAAhB,EAHD,CADO,CAAR;AAOAO,UAAAA,uBAAuB,CAAE,IAAF,CAAvB;AACA,SATD,MASO;AACNrC,UAAAA,QAAQ,CACP,8CACCD,aADD,EAECoC,cAFD,EAGC,oBAAQxD,KAAR,EAAgBmD,WAAhB,EAHD,CADO,CAAR;AAOA;AACD;AArBF;AAjCF,IADD;AA4DA;;AACDpC,aAAa,CAACsC,WAAd,GAA4BA,WAA5B;eAEetC,a","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';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\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\tstyle={ {\n\t\t\t\t\tleft: `${ position }%`,\n\t\t\t\t\ttransform: 'translateX( -50% )',\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\tgradientPickerDomRef,\n\t...props\n} ) {\n\tconst popoverProps = useMemo( () => {\n\t\tconst result = {\n\t\t\tclassName:\n\t\t\t\t'components-custom-gradient-picker__color-picker-popover',\n\t\t\tposition: 'top',\n\t\t};\n\t\tif ( isRenderedInSidebar ) {\n\t\t\tresult.anchorRef = gradientPickerDomRef.current;\n\t\t\tresult.position = 'bottom left';\n\t\t}\n\t\treturn result;\n\t}, [ gradientPickerDomRef, isRenderedInSidebar ] );\n\treturn (\n\t\t<CustomColorPickerDropdown\n\t\t\tisRenderedInSidebar={ isRenderedInSidebar }\n\t\t\tpopoverProps={ popoverProps }\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\tgradientPickerDomRef={ gradientPickerDomRef }\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.keyCode === LEFT ) {\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.keyCode === RIGHT ) {\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<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-custom-gradient-picker__remove-control-point\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\t\t\t\tremoveControlPoint(\n\t\t\t\t\t\t\t\t\t\t\t\tcontrolPoints,\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)\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Remove Control Point' ) }\n\t\t\t\t\t\t\t\t</Button>\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\tgradientPickerDomRef,\n} ) {\n\tconst [ alreadyInsertedPoint, setAlreadyInsertedPoint ] = useState( false );\n\treturn (\n\t\t<GradientColorPickerDropdown\n\t\t\tgradientPickerDomRef={ gradientPickerDomRef }\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\"\n\t\t\t\t\ticon={ plus }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tinsertPosition !== null\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tleft: `${ insertPosition }%`,\n\t\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\t: undefined\n\t\t\t\t\t}\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/>\n\t);\n}\nControlPoints.InsertPoint = InsertPoint;\n\nexport default ControlPoints;\n"]}
@@ -106,11 +106,11 @@ function CustomGradientBar(_ref) {
106
106
  disableAlpha = false,
107
107
  __experimentalIsRenderedInSidebar
108
108
  } = _ref;
109
- const gradientPickerDomRef = (0, _element.useRef)();
109
+ const gradientMarkersContainerDomRef = (0, _element.useRef)();
110
110
  const [gradientBarState, gradientBarStateDispatch] = (0, _element.useReducer)(customGradientBarReducer, customGradientBarReducerInitialState);
111
111
 
112
112
  const onMouseEnterAndMove = event => {
113
- const insertPosition = (0, _utils.getHorizontalRelativeGradientPosition)(event.clientX, gradientPickerDomRef.current, _constants.INSERT_POINT_WIDTH); // If the insert point is close to an existing control point don't show it.
113
+ const insertPosition = (0, _utils.getHorizontalRelativeGradientPosition)(event.clientX, gradientMarkersContainerDomRef.current); // If the insert point is close to an existing control point don't show it.
114
114
 
115
115
  if ((0, _lodash.some)(controlPoints, _ref2 => {
116
116
  let {
@@ -142,7 +142,6 @@ function CustomGradientBar(_ref) {
142
142
  const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';
143
143
  const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';
144
144
  return (0, _element.createElement)("div", {
145
- ref: gradientPickerDomRef,
146
145
  className: (0, _classnames.default)('components-custom-gradient-picker__gradient-bar', {
147
146
  'has-gradient': hasGradient
148
147
  }),
@@ -153,10 +152,11 @@ function CustomGradientBar(_ref) {
153
152
  },
154
153
  onMouseLeave: onMouseLeave
155
154
  }, (0, _element.createElement)("div", {
155
+ ref: gradientMarkersContainerDomRef,
156
156
  className: "components-custom-gradient-picker__markers-container"
157
157
  }, !disableInserter && (isMovingInserter || isInsertingControlPoint) && (0, _element.createElement)(_controlPoints.default.InsertPoint, {
158
158
  __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
159
- gradientPickerDomRef: gradientPickerDomRef,
159
+ gradientPickerDomRef: gradientMarkersContainerDomRef,
160
160
  disableAlpha: disableAlpha,
161
161
  insertPosition: gradientBarState.insertPosition,
162
162
  value: controlPoints,
@@ -175,7 +175,7 @@ function CustomGradientBar(_ref) {
175
175
  __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
176
176
  disableAlpha: disableAlpha,
177
177
  disableRemove: disableInserter,
178
- gradientPickerDomRef: gradientPickerDomRef,
178
+ gradientPickerDomRef: gradientMarkersContainerDomRef,
179
179
  ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,
180
180
  value: controlPoints,
181
181
  onChange: onChange,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/index.js"],"names":["customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","__experimentalIsRenderedInSidebar","gradientPickerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","clientX","current","INSERT_POINT_WIDTH","position","Math","abs","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","onMouseLeave","isMovingInserter","isInsertingControlPoint","undefined"],"mappings":";;;;;;;;;AAUA;;AANA;;AACA;;AAUA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AAQA,SAASA,wBAAT,CAAmCC,KAAnC,EAA0CC,MAA1C,EAAmD;AAClD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,eAAL;AACC,UAAKF,KAAK,CAACG,EAAN,KAAa,MAAb,IAAuBH,KAAK,CAACG,EAAN,KAAa,iBAAzC,EAA6D;AAC5D,eAAO;AACNA,UAAAA,EAAE,EAAE,iBADE;AAENC,UAAAA,cAAc,EAAEH,MAAM,CAACG;AAFjB,SAAP;AAIA;;AACD;;AACD,SAAK,oBAAL;AACC,UAAKJ,KAAK,CAACG,EAAN,KAAa,iBAAlB,EAAsC;AACrC,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;;AACD,SAAK,eAAL;AACC,UAAKH,KAAK,CAACG,EAAN,KAAa,iBAAlB,EAAsC;AACrC,eAAO;AACNA,UAAAA,EAAE,EAAE,yBADE;AAENC,UAAAA,cAAc,EAAEJ,KAAK,CAACI;AAFhB,SAAP;AAIA;;AACD;;AACD,SAAK,gBAAL;AACC,UAAKJ,KAAK,CAACG,EAAN,KAAa,yBAAlB,EAA8C;AAC7C,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;;AACD,SAAK,sBAAL;AACC,UAAKH,KAAK,CAACG,EAAN,KAAa,MAAlB,EAA2B;AAC1B,eAAO;AACNA,UAAAA,EAAE,EAAE;AADE,SAAP;AAGA;;AACD;;AACD,SAAK,qBAAL;AAC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AgB,CAACZ,cADG,GAEpB0B,SAVL;AAYC,IAAA,KAAK,EAAGpB,aAZT;AAaC,IAAA,QAAQ,EAAGC,QAbZ;AAcC,IAAA,yBAAyB,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,IAxBD,CAXD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\n\nimport { some } from 'lodash';\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 {\n\tINSERT_POINT_WIDTH,\n\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT,\n} 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 gradientPickerDomRef = 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\tgradientPickerDomRef.current,\n\t\t\tINSERT_POINT_WIDTH\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\tsome( controlPoints, ( { 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\tref={ gradientPickerDomRef }\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 className=\"components-custom-gradient-picker__markers-container\">\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\tgradientPickerDomRef={ gradientPickerDomRef }\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={ gradientPickerDomRef }\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-bar/index.js"],"names":["customGradientBarReducer","state","action","type","id","insertPosition","customGradientBarReducerInitialState","CustomGradientBar","background","hasGradient","value","controlPoints","onChange","disableInserter","disableAlpha","__experimentalIsRenderedInSidebar","gradientMarkersContainerDomRef","gradientBarState","gradientBarStateDispatch","onMouseEnterAndMove","event","clientX","current","position","Math","abs","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","onMouseLeave","isMovingInserter","isInsertingControlPoint","undefined"],"mappings":";;;;;;;;;AAUA;;AANA;;AACA;;AAUA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;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7BD,CAVD,CADD;AAoEA","sourcesContent":["/**\n * External dependencies\n */\n\nimport { some } from 'lodash';\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\tsome( controlPoints, ( { 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\tgradientPickerDomRef={\n\t\t\t\t\t\t\t\tgradientMarkersContainerDomRef\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"]}
@@ -179,15 +179,14 @@ function updateControlPointColorByPosition(points, position, newColor) {
179
179
  /**
180
180
  * Gets the horizontal coordinate when dragging a control point with the mouse.
181
181
  *
182
- * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
183
- * @param {Element} containerElement Container for the gradient picker.
184
- * @param {number} positionedElementWidth Width of the positioned element.
182
+ * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
183
+ * @param {Element} containerElement Container for the gradient picker.
185
184
  *
186
185
  * @return {number} Whole number percentage from the left.
187
186
  */
188
187
 
189
188
 
190
- function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement, positionedElementWidth) {
189
+ function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement) {
191
190
  if (!containerElement) {
192
191
  return;
193
192
  }
@@ -196,8 +195,7 @@ function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElemen
196
195
  x,
197
196
  width
198
197
  } = containerElement.getBoundingClientRect();
199
- const absolutePositionValue = mouseXCoordinate - x - _constants.MINIMUM_ABSOLUTE_LEFT_POSITION - positionedElementWidth / 2;
200
- const availableWidth = width - _constants.MINIMUM_ABSOLUTE_LEFT_POSITION - _constants.INSERT_POINT_WIDTH;
201
- return Math.round(clampPercent(absolutePositionValue * 100 / availableWidth));
198
+ const absolutePositionValue = mouseXCoordinate - x;
199
+ return Math.round(clampPercent(absolutePositionValue * 100 / width));
202
200
  }
203
201
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/utils.js"],"names":["clampPercent","value","Math","max","min","isOverlapping","initialIndex","newPosition","minDistance","MINIMUM_DISTANCE_BETWEEN_POINTS","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","positionedElementWidth","x","width","getBoundingClientRect","absolutePositionValue","MINIMUM_ABSOLUTE_LEFT_POSITION","availableWidth","INSERT_POINT_WIDTH","round"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,KAAvB,EAA+B;AACrC,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;;;AACO,SAASI,aAAT,CACNJ,KADM,EAENK,YAFM,EAGNC,WAHM,EAKL;AAAA,MADDC,WACC,uEADaC,0CACb;AACD,QAAMC,eAAe,GAAGT,KAAK,CAAEK,YAAF,CAAL,CAAsBK,QAA9C;AACA,QAAMC,WAAW,GAAGV,IAAI,CAACE,GAAL,CAAUM,eAAV,EAA2BH,WAA3B,CAApB;AACA,QAAMM,WAAW,GAAGX,IAA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AAA;AAAL,MAAeH,gBAAgB,CAACI,qBAAjB,EAArB;AACA,QAAMC,qBAAqB,GAC1BN,gBAAgB,GAChBG,CADA,GAEAI,yCAFA,GAGAL,sBAAsB,GAAG,CAJ1B;AAKA,QAAMM,cAAc,GACnBJ,KAAK,GAAGG,yCAAR,GAAyCE,6BAD1C;AAEA,SAAO5C,IAAI,CAAC6C,KAAL,CACN/C,YAAY,CAAI2C,qBAAqB,GAAG,GAA1B,GAAkCE,cAApC,CADN,CAAP;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tMINIMUM_DISTANCE_BETWEEN_POINTS,\n\tMINIMUM_ABSOLUTE_LEFT_POSITION,\n\tINSERT_POINT_WIDTH,\n} 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 * @param {number} positionedElementWidth Width of the positioned element.\n *\n * @return {number} Whole number percentage from the left.\n */\nexport function getHorizontalRelativeGradientPosition(\n\tmouseXCoordinate,\n\tcontainerElement,\n\tpositionedElementWidth\n) {\n\tif ( ! containerElement ) {\n\t\treturn;\n\t}\n\tconst { x, width } = containerElement.getBoundingClientRect();\n\tconst absolutePositionValue =\n\t\tmouseXCoordinate -\n\t\tx -\n\t\tMINIMUM_ABSOLUTE_LEFT_POSITION -\n\t\tpositionedElementWidth / 2;\n\tconst availableWidth =\n\t\twidth - MINIMUM_ABSOLUTE_LEFT_POSITION - INSERT_POINT_WIDTH;\n\treturn Math.round(\n\t\tclampPercent( ( absolutePositionValue * 100 ) / availableWidth )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-bar/utils.js"],"names":["clampPercent","value","Math","max","min","isOverlapping","initialIndex","newPosition","minDistance","MINIMUM_DISTANCE_BETWEEN_POINTS","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":";;;;;;;;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,KAAvB,EAA+B;AACrC,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;;;AACO,SAASI,aAAT,CACNJ,KADM,EAENK,YAFM,EAGNC,WAHM,EAKL;AAAA,MADDC,WACC,uEADaC,0CACb;AACD,QAAMC,eAAe,GAAGT,KAAK,CAAEK,YAAF,CAAL,CAAsBK,QAA9C;AACA,QAAMC,WAAW,GAAGV,IAAI,CAACE,GAAL,CAAUM,eAAV,EAA2BH,WAA3B,CAApB;AACA,QAAMM,WAAW,GAAGX,IAAI,CAACC,GAAL,CAAUO,eAAV,EAA2BH,WAA3B,CAApB;AAEA,SAAON,KAAK,CAACa,IAAN,CAAY,OAAgBC,KAAhB,KAA2B;AAAA,QAAzB;AAAEJ,MAAAA;AAAF,KAAyB;AAC7C,WACCI,KAAK,KAAKT,YAAV,KACEJ,IAAI,CAACc,GAAL,CAAUL,QAAQ,GAAGJ,WAArB,IAAqCC,WAArC,IACCI,WAAW,GAAGD,QAAd,IAA0BA,QAAQ,GAAGE,WAFxC,CADD;AAKA,GANM,CAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,eAAT,CAA0BC,MAA1B,EAAkCP,QAAlC,EAA4CQ,KAA5C,EAAoD;AAC1D,QAAMC,SAAS,GAAGF,MAAM,CAACG,SAAP,CACfC,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T,CAAkCf,MAAlC,EAA0CH,KAA1C,EAAiDmB,QAAjD,EAA4D;AAClE,QAAMX,QAAQ,GAAG,EAChB,GAAGL,MAAM,CAAEH,KAAF,CADO;AAEhBI,IAAAA,KAAK,EAAEe;AAFS,GAAjB;AAIA,SAAOJ,kBAAkB,CAAEZ,MAAF,EAAUH,KAAV,EAAiBQ,QAAjB,CAAzB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,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;;;AACO,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';\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} 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"]}
@@ -9,8 +9,6 @@ exports.default = CustomGradientPicker;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
13
-
14
12
  var _i18n = require("@wordpress/i18n");
15
13
 
16
14
  var _anglePickerControl = _interopRequireDefault(require("../angle-picker-control"));
@@ -29,10 +27,6 @@ var _constants = require("./constants");
29
27
 
30
28
  var _customGradientPickerStyles = require("./styles/custom-gradient-picker-styles");
31
29
 
32
- /**
33
- * External dependencies
34
- */
35
-
36
30
  /**
37
31
  * WordPress dependencies
38
32
  */
@@ -41,12 +35,14 @@ var _customGradientPickerStyles = require("./styles/custom-gradient-picker-style
41
35
  * Internal dependencies
42
36
  */
43
37
  const GradientAnglePicker = _ref => {
38
+ var _gradientAST$orientat, _gradientAST$orientat2;
39
+
44
40
  let {
45
41
  gradientAST,
46
42
  hasGradient,
47
43
  onChange
48
44
  } = _ref;
49
- const angle = (0, _lodash.get)(gradientAST, ['orientation', 'value'], _constants.DEFAULT_LINEAR_GRADIENT_ANGLE);
45
+ const angle = (_gradientAST$orientat = gradientAST === null || gradientAST === void 0 ? void 0 : (_gradientAST$orientat2 = gradientAST.orientation) === null || _gradientAST$orientat2 === void 0 ? void 0 : _gradientAST$orientat2.value) !== null && _gradientAST$orientat !== void 0 ? _gradientAST$orientat : _constants.DEFAULT_LINEAR_GRADIENT_ANGLE;
50
46
 
51
47
  const onAngleChange = newAngle => {
52
48
  onChange((0, _serializer.serializeGradient)({ ...gradientAST,
@@ -84,7 +80,11 @@ const GradientTypePicker = _ref2 => {
84
80
  };
85
81
 
86
82
  const onSetRadialGradient = () => {
87
- onChange((0, _serializer.serializeGradient)({ ...(0, _lodash.omit)(gradientAST, ['orientation']),
83
+ const {
84
+ orientation,
85
+ ...restGradientAST
86
+ } = gradientAST;
87
+ onChange((0, _serializer.serializeGradient)({ ...restGradientAST,
88
88
  type: 'radial-gradient'
89
89
  }));
90
90
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","orientation","type","value","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","__experimentalIsRenderedInSidebar","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAuBA,MAAMA,mBAAmB,GAAG,QAA8C;AAAA,MAA5C;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACzE,QAAMC,KAAK,GAAG,iBACbH,WADa,EAEb,CAAE,aAAF,EAAiB,OAAjB,CAFa,EAGbI,wCAHa,CAAd;;AAKA,QAAMC,aAAa,GAAKC,QAAF,IAAgB;AACrCJ,IAAAA,QAAQ,CACP,mCAAmB,EAClB,GAAGF,WADe;AAElBO,MAAAA,WAAW,EAAE;AACZC,QAAAA,IAAI,EAAE,SADM;AAEZC,QAAAA,KAAK,EAAEH;AAFK;AAFK,KAAnB,CADO,CAAR;AASA,GAVD;;AAWA,SACC,4BAAC,2BAAD;AACC,IAAA,QAAQ,EAAGD,aADZ;AAEC,IAAA,aAAa,EAAC,KAFf;AAGC,IAAA,KAAK,EAAGJ,WAAW,GAAGE,KAAH,GAAW;AAH/B,IADD;AAOA,CAxBD;;AA0BA,MAAMO,kBAAkB,GAAG,SAA8C;AAAA,MAA5C;AAAEV,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACx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AZ,KAAsBW,2BAA1C,CANG,CAOH;AACA;;AACA,QAAMC,aAAa,GAAGrB,WAAW,CAACsB,UAAZ,CAAuBC,GAAvB,CAA8BC,SAAF,KAAmB;AACpEC,IAAAA,KAAK,EAAE,4BAAiBD,SAAjB,CAD6D;AAEpEE,IAAAA,QAAQ,EAAEC,QAAQ,CAAEH,SAAS,CAACI,MAAV,CAAiBnB,KAAnB;AAFkD,GAAnB,CAA5B,CAAtB;AAKA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,0BAAD;AACC,IAAA,iCAAiC,EAChCS,iCAFF;AAIC,IAAA,UAAU,EAAGC,UAJd;AAKC,IAAA,WAAW,EAAGlB,WALf;AAMC,IAAA,KAAK,EAAGoB,aANT;AAOC,IAAA,QAAQ,EAAKQ,gBAAF,IAAwB;AAClC3B,MAAAA,QAAQ,CACP,mCACC,4CACCF,WADD,EAEC6B,gBAFD,CADD,CADO,CAAR;AAQA;AAhBF,IADD,EAmBC,4BAAC,UAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,yCAAD,QACC,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAG7B,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IADD,CAJD,EAWC,4BAAC,4CAAD,QACGF,WAAW,CAACQ,IAAZ,KAAqB,iBAArB,IACD,4BAAC,mBAAD;AACC,IAAA,WAAW,EAAGR,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAnBD,CADD;AA2CA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from '../custom-gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle = get(\n\t\tgradientAST,\n\t\t[ 'orientation', 'value' ],\n\t\tDEFAULT_LINEAR_GRADIENT_ANGLE\n\t);\n\tconst onAngleChange = ( newAngle ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: newAngle,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\tonChange={ onAngleChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...omit( gradientAST, [ 'orientation' ] ),\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( {\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => ( {\n\t\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\treturn (\n\t\t<div className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","type","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","__experimentalIsRenderedInSidebar","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;AAuBA,MAAMA,mBAAmB,GAAG,QAA8C;AAAA;;AAAA,MAA5C;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACzE,QAAMC,KAAK,4BACVH,WADU,aACVA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AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,yCAAD,QACC,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAG9B,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IADD,CAJD,EAWC,4BAAC,4CAAD,QACGF,WAAW,CAACS,IAAZ,KAAqB,iBAArB,IACD,4BAAC,mBAAD;AACC,IAAA,WAAW,EAAGT,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAnBD,CADD;AA2CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from '../custom-gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: newAngle,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\tonChange={ onAngleChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( {\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => ( {\n\t\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\treturn (\n\t\t<div className=\"components-custom-gradient-picker\">\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</div>\n\t);\n}\n"]}
@@ -9,8 +9,6 @@ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _lodash = require("lodash");
13
-
14
12
  var _components = require("@wordpress/components");
15
13
 
16
14
  var _i18n = require("@wordpress/i18n");
@@ -25,10 +23,6 @@ var _constants = require("./constants");
25
23
 
26
24
  var _style = _interopRequireDefault(require("./style.scss"));
27
25
 
28
- /**
29
- * External dependencies
30
- */
31
-
32
26
  /**
33
27
  * WordPress dependencies
34
28
  */
@@ -57,7 +51,10 @@ function CustomGradientPicker(_ref) {
57
51
  }
58
52
 
59
53
  function getGradientColor(type) {
60
- const orientation = (0, _lodash.get)(gradientAST, ['orientation']);
54
+ const {
55
+ orientation,
56
+ ...restGradientAST
57
+ } = gradientAST;
61
58
 
62
59
  if (orientation) {
63
60
  setGradientOrientation(orientation);
@@ -68,7 +65,7 @@ function CustomGradientPicker(_ref) {
68
65
  orientation: gradientOrientation
69
66
  }),
70
67
  type
71
- } : { ...(0, _lodash.omit)(gradientAST, ['orientation']),
68
+ } : { ...restGradientAST,
72
69
  type
73
70
  });
74
71
  }
@@ -94,7 +91,9 @@ function CustomGradientPicker(_ref) {
94
91
  }
95
92
 
96
93
  function getGradientAngle() {
97
- return (0, _lodash.get)(gradientAST, ['orientation', 'value'], _constants.DEFAULT_LINEAR_GRADIENT_ANGLE);
94
+ var _gradientAST$orientat, _gradientAST$orientat2;
95
+
96
+ return (_gradientAST$orientat = gradientAST === null || gradientAST === void 0 ? void 0 : (_gradientAST$orientat2 = gradientAST.orientation) === null || _gradientAST$orientat2 === void 0 ? void 0 : _gradientAST$orientat2.value) !== null && _gradientAST$orientat !== void 0 ? _gradientAST$orientat : _constants.DEFAULT_LINEAR_GRADIENT_ANGLE;
98
97
  }
99
98
 
100
99
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.PanelBody, {