@wordpress/components 19.17.0 → 20.0.2-next.957ca95e4c.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 (916) hide show
  1. package/CHANGELOG.md +96 -1
  2. package/CONTRIBUTING.md +12 -12
  3. package/build/alignment-matrix-control/index.js +1 -1
  4. package/build/alignment-matrix-control/index.js.map +1 -1
  5. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +13 -13
  6. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  7. package/build/angle-picker-control/index.js +3 -0
  8. package/build/angle-picker-control/index.js.map +1 -1
  9. package/build/angle-picker-control/styles/angle-picker-control-styles.js +14 -4
  10. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  11. package/build/autocomplete/get-default-use-items.js +7 -1
  12. package/build/autocomplete/get-default-use-items.js.map +1 -1
  13. package/build/autocomplete/index.js +12 -12
  14. package/build/autocomplete/index.js.map +1 -1
  15. package/build/base-control/styles/base-control-styles.js +8 -8
  16. package/build/base-control/styles/base-control-styles.js.map +1 -1
  17. package/build/base-field/styles.js +5 -5
  18. package/build/base-field/styles.js.map +1 -1
  19. package/build/box-control/styles/box-control-visualizer-styles.js +8 -8
  20. package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  21. package/build/card/card/component.js +6 -11
  22. package/build/card/card/component.js.map +1 -1
  23. package/build/card/card/hook.js +0 -10
  24. package/build/card/card/hook.js.map +1 -1
  25. package/build/card/card/index.js.map +1 -1
  26. package/build/card/card-body/component.js +7 -8
  27. package/build/card/card-body/component.js.map +1 -1
  28. package/build/card/card-body/hook.js +0 -4
  29. package/build/card/card-body/hook.js.map +1 -1
  30. package/build/card/card-body/index.js.map +1 -1
  31. package/build/card/card-divider/component.js +7 -8
  32. package/build/card/card-divider/component.js.map +1 -1
  33. package/build/card/card-divider/hook.js +0 -4
  34. package/build/card/card-divider/hook.js.map +1 -1
  35. package/build/card/card-divider/index.js.map +1 -1
  36. package/build/card/card-footer/component.js +7 -8
  37. package/build/card/card-footer/component.js.map +1 -1
  38. package/build/card/card-footer/hook.js +0 -4
  39. package/build/card/card-footer/hook.js.map +1 -1
  40. package/build/card/card-footer/index.js.map +1 -1
  41. package/build/card/card-header/component.js +7 -8
  42. package/build/card/card-header/component.js.map +1 -1
  43. package/build/card/card-header/hook.js +0 -4
  44. package/build/card/card-header/hook.js.map +1 -1
  45. package/build/card/card-header/index.js.map +1 -1
  46. package/build/card/card-media/component.js +7 -7
  47. package/build/card/card-media/component.js.map +1 -1
  48. package/build/card/card-media/hook.js +0 -4
  49. package/build/card/card-media/hook.js.map +1 -1
  50. package/build/card/card-media/index.js.map +1 -1
  51. package/build/card/context.js.map +1 -1
  52. package/build/card/index.js.map +1 -1
  53. package/build/card/styles.js +17 -17
  54. package/build/card/styles.js.map +1 -1
  55. package/build/clipboard-button/index.js +16 -1
  56. package/build/clipboard-button/index.js.map +1 -1
  57. package/build/color-list-picker/index.js +16 -5
  58. package/build/color-list-picker/index.js.map +1 -1
  59. package/build/color-palette/index.js +28 -14
  60. package/build/color-palette/index.js.map +1 -1
  61. package/build/color-palette/index.native.js +3 -3
  62. package/build/color-palette/index.native.js.map +1 -1
  63. package/build/combobox-control/index.js +7 -4
  64. package/build/combobox-control/index.js.map +1 -1
  65. package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
  66. package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -0
  67. package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +34 -41
  68. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -0
  69. package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -1
  70. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -0
  71. package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
  72. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -0
  73. package/build/custom-gradient-picker/index.js +30 -4
  74. package/build/custom-gradient-picker/index.js.map +1 -1
  75. package/build/custom-select-control/index.js +21 -11
  76. package/build/custom-select-control/index.js.map +1 -1
  77. package/build/custom-select-control/styles.js +34 -0
  78. package/build/custom-select-control/styles.js.map +1 -0
  79. package/build/date-time/constants.js +9 -0
  80. package/build/date-time/constants.js.map +1 -0
  81. package/build/date-time/date/index.js +196 -188
  82. package/build/date-time/date/index.js.map +1 -1
  83. package/build/date-time/date/styles.js +68 -39
  84. package/build/date-time/date/styles.js.map +1 -1
  85. package/build/date-time/date-time/index.js +3 -2
  86. package/build/date-time/date-time/index.js.map +1 -1
  87. package/build/date-time/date-time/styles.js +19 -5
  88. package/build/date-time/date-time/styles.js.map +1 -1
  89. package/build/date-time/time/index.js +22 -17
  90. package/build/date-time/time/index.js.map +1 -1
  91. package/build/date-time/time/styles.js +12 -12
  92. package/build/date-time/time/styles.js.map +1 -1
  93. package/build/date-time/utils.js +27 -0
  94. package/build/date-time/utils.js.map +1 -0
  95. package/build/dimension-control/index.js +2 -6
  96. package/build/dimension-control/index.js.map +1 -1
  97. package/build/disabled/index.js +28 -11
  98. package/build/disabled/index.js.map +1 -1
  99. package/build/disabled/styles/disabled-styles.js +3 -3
  100. package/build/disabled/styles/disabled-styles.js.map +1 -1
  101. package/build/{swatch → disabled}/types.js +0 -0
  102. package/build/{swatch → disabled}/types.js.map +0 -0
  103. package/build/drop-zone/index.js +2 -4
  104. package/build/drop-zone/index.js.map +1 -1
  105. package/build/dropdown/index.js +5 -6
  106. package/build/dropdown/index.js.map +1 -1
  107. package/build/dropdown-menu/index.js +1 -3
  108. package/build/dropdown-menu/index.js.map +1 -1
  109. package/build/dropdown-menu/index.native.js +0 -17
  110. package/build/dropdown-menu/index.native.js.map +1 -1
  111. package/build/duotone-picker/custom-duotone-bar.js +2 -2
  112. package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
  113. package/build/duotone-picker/duotone-picker.js +9 -1
  114. package/build/duotone-picker/duotone-picker.js.map +1 -1
  115. package/build/duotone-picker/duotone-swatch.js +13 -3
  116. package/build/duotone-picker/duotone-swatch.js.map +1 -1
  117. package/build/focal-point-picker/controls.js +4 -4
  118. package/build/focal-point-picker/controls.js.map +1 -1
  119. package/build/focal-point-picker/focal-point.js +4 -6
  120. package/build/focal-point-picker/focal-point.js.map +1 -1
  121. package/build/focal-point-picker/grid.js +6 -35
  122. package/build/focal-point-picker/grid.js.map +1 -1
  123. package/build/focal-point-picker/index.js +164 -336
  124. package/build/focal-point-picker/index.js.map +1 -1
  125. package/build/focal-point-picker/media.js +4 -34
  126. package/build/focal-point-picker/media.js.map +1 -1
  127. package/build/focal-point-picker/styles/focal-point-picker-style.js +14 -14
  128. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  129. package/build/focal-point-picker/styles/focal-point-style.js +4 -4
  130. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  131. package/build/focal-point-picker/utils.js +2 -6
  132. package/build/focal-point-picker/utils.js.map +1 -1
  133. package/build/focusable-iframe/index.js +6 -0
  134. package/build/focusable-iframe/index.js.map +1 -1
  135. package/build/font-size-picker/index.js +43 -14
  136. package/build/font-size-picker/index.js.map +1 -1
  137. package/build/font-size-picker/utils.js +32 -22
  138. package/build/font-size-picker/utils.js.map +1 -1
  139. package/build/form-token-field/index.js +29 -20
  140. package/build/form-token-field/index.js.map +1 -1
  141. package/build/gradient-picker/index.js +25 -2
  142. package/build/gradient-picker/index.js.map +1 -1
  143. package/build/guide/index.js +13 -9
  144. package/build/guide/index.js.map +1 -1
  145. package/build/guide/page-control.js +3 -7
  146. package/build/guide/page-control.js.map +1 -1
  147. package/build/higher-order/with-constrained-tabbing/index.js +1 -1
  148. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  149. package/build/higher-order/with-spoken-messages/index.js +2 -0
  150. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  151. package/build/isolated-event-container/index.js +4 -0
  152. package/build/isolated-event-container/index.js.map +1 -1
  153. package/build/item-group/styles.js +10 -10
  154. package/build/item-group/styles.js.map +1 -1
  155. package/build/mobile/bottom-sheet/index.native.js +3 -6
  156. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  157. package/build/mobile/global-styles-context/utils.native.js +4 -2
  158. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  159. package/build/mobile/image/index.native.js +6 -26
  160. package/build/mobile/image/index.native.js.map +1 -1
  161. package/build/mobile/picker/index.android.js +3 -3
  162. package/build/mobile/picker/index.android.js.map +1 -1
  163. package/build/modal/index.js +1 -3
  164. package/build/modal/index.js.map +1 -1
  165. package/build/navigable-container/container.js +9 -8
  166. package/build/navigable-container/container.js.map +1 -1
  167. package/build/navigable-container/menu.js +3 -9
  168. package/build/navigable-container/menu.js.map +1 -1
  169. package/build/navigation/menu/menu-title-search.js +1 -3
  170. package/build/navigation/menu/menu-title-search.js.map +1 -1
  171. package/build/navigator/navigator-back-button/hook.js +0 -4
  172. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  173. package/build/navigator/navigator-button/hook.js +0 -4
  174. package/build/navigator/navigator-button/hook.js.map +1 -1
  175. package/build/notice/list.js +10 -6
  176. package/build/notice/list.js.map +1 -1
  177. package/build/palette-edit/index.js +7 -2
  178. package/build/palette-edit/index.js.map +1 -1
  179. package/build/palette-edit/styles.js +10 -10
  180. package/build/palette-edit/styles.js.map +1 -1
  181. package/build/popover/index.js +93 -110
  182. package/build/popover/index.js.map +1 -1
  183. package/build/popover/utils.js +178 -0
  184. package/build/popover/utils.js.map +1 -0
  185. package/build/range-control/index.js +3 -0
  186. package/build/range-control/index.js.map +1 -1
  187. package/build/range-control/styles/range-control-styles.js +43 -37
  188. package/build/range-control/styles/range-control-styles.js.map +1 -1
  189. package/build/select-control/chevron-down.js +30 -0
  190. package/build/select-control/chevron-down.js.map +1 -0
  191. package/build/select-control/index.js +7 -7
  192. package/build/select-control/index.js.map +1 -1
  193. package/build/select-control/styles/select-control-styles.js +30 -15
  194. package/build/select-control/styles/select-control-styles.js.map +1 -1
  195. package/build/snackbar/list.js +5 -3
  196. package/build/snackbar/list.js.map +1 -1
  197. package/build/spinner/index.js +2 -0
  198. package/build/spinner/index.js.map +1 -1
  199. package/build/text/styles.js +7 -7
  200. package/build/text/styles.js.map +1 -1
  201. package/build/text-highlight/index.js +4 -4
  202. package/build/text-highlight/index.js.map +1 -1
  203. package/build/toggle-group-control/toggle-group-control/component.js +17 -9
  204. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  205. package/build/toggle-group-control/toggle-group-control/styles.js +24 -7
  206. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  207. package/build/toggle-group-control/toggle-group-control-option/component.js +15 -5
  208. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  209. package/build/toggle-group-control/toggle-group-control-option-base/component.js +5 -1
  210. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  211. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +20 -7
  212. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  213. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +26 -7
  214. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  215. package/build/tools-panel/styles.js +11 -11
  216. package/build/tools-panel/styles.js.map +1 -1
  217. package/build/tooltip/index.js +1 -7
  218. package/build/tooltip/index.js.map +1 -1
  219. package/build/tree-grid/index.js +4 -10
  220. package/build/tree-grid/index.js.map +1 -1
  221. package/build/ui/context/context-connect.js +1 -3
  222. package/build/ui/context/context-connect.js.map +1 -1
  223. package/build/unit-control/index.js +2 -3
  224. package/build/unit-control/index.js.map +1 -1
  225. package/build/utils/colors-values.js +52 -142
  226. package/build/utils/colors-values.js.map +1 -1
  227. package/build/utils/config-values.js +1 -1
  228. package/build/utils/config-values.js.map +1 -1
  229. package/build/utils/input/input-control.js +1 -1
  230. package/build/utils/input/input-control.js.map +1 -1
  231. package/build/utils/rtl.js +6 -5
  232. package/build/utils/rtl.js.map +1 -1
  233. package/build/utils/strings.js +63 -0
  234. package/build/utils/strings.js.map +1 -0
  235. package/build-module/alignment-matrix-control/index.js +1 -1
  236. package/build-module/alignment-matrix-control/index.js.map +1 -1
  237. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +13 -13
  238. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  239. package/build-module/angle-picker-control/index.js +3 -0
  240. package/build-module/angle-picker-control/index.js.map +1 -1
  241. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -4
  242. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  243. package/build-module/autocomplete/get-default-use-items.js +6 -1
  244. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  245. package/build-module/autocomplete/index.js +11 -11
  246. package/build-module/autocomplete/index.js.map +1 -1
  247. package/build-module/base-control/styles/base-control-styles.js +8 -8
  248. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  249. package/build-module/base-field/styles.js +5 -5
  250. package/build-module/base-field/styles.js.map +1 -1
  251. package/build-module/box-control/styles/box-control-visualizer-styles.js +8 -8
  252. package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  253. package/build-module/card/card/component.js +5 -10
  254. package/build-module/card/card/component.js.map +1 -1
  255. package/build-module/card/card/hook.js +0 -9
  256. package/build-module/card/card/hook.js.map +1 -1
  257. package/build-module/card/card/index.js.map +1 -1
  258. package/build-module/card/card-body/component.js +7 -8
  259. package/build-module/card/card-body/component.js.map +1 -1
  260. package/build-module/card/card-body/hook.js +0 -4
  261. package/build-module/card/card-body/hook.js.map +1 -1
  262. package/build-module/card/card-body/index.js.map +1 -1
  263. package/build-module/card/card-divider/component.js +7 -8
  264. package/build-module/card/card-divider/component.js.map +1 -1
  265. package/build-module/card/card-divider/hook.js +0 -4
  266. package/build-module/card/card-divider/hook.js.map +1 -1
  267. package/build-module/card/card-divider/index.js.map +1 -1
  268. package/build-module/card/card-footer/component.js +7 -8
  269. package/build-module/card/card-footer/component.js.map +1 -1
  270. package/build-module/card/card-footer/hook.js +0 -4
  271. package/build-module/card/card-footer/hook.js.map +1 -1
  272. package/build-module/card/card-footer/index.js.map +1 -1
  273. package/build-module/card/card-header/component.js +7 -8
  274. package/build-module/card/card-header/component.js.map +1 -1
  275. package/build-module/card/card-header/hook.js +0 -4
  276. package/build-module/card/card-header/hook.js.map +1 -1
  277. package/build-module/card/card-header/index.js.map +1 -1
  278. package/build-module/card/card-media/component.js +7 -7
  279. package/build-module/card/card-media/component.js.map +1 -1
  280. package/build-module/card/card-media/hook.js +0 -4
  281. package/build-module/card/card-media/hook.js.map +1 -1
  282. package/build-module/card/card-media/index.js.map +1 -1
  283. package/build-module/card/context.js.map +1 -1
  284. package/build-module/card/index.js.map +1 -1
  285. package/build-module/card/styles.js +17 -17
  286. package/build-module/card/styles.js.map +1 -1
  287. package/build-module/clipboard-button/index.js +17 -1
  288. package/build-module/clipboard-button/index.js.map +1 -1
  289. package/build-module/color-list-picker/index.js +13 -5
  290. package/build-module/color-list-picker/index.js.map +1 -1
  291. package/build-module/color-palette/index.js +27 -13
  292. package/build-module/color-palette/index.js.map +1 -1
  293. package/build-module/color-palette/index.native.js +4 -4
  294. package/build-module/color-palette/index.native.js.map +1 -1
  295. package/build-module/combobox-control/index.js +6 -3
  296. package/build-module/combobox-control/index.js.map +1 -1
  297. package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
  298. package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -0
  299. package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +34 -41
  300. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -0
  301. package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -1
  302. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -0
  303. package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
  304. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -0
  305. package/build-module/custom-gradient-picker/index.js +26 -3
  306. package/build-module/custom-gradient-picker/index.js.map +1 -1
  307. package/build-module/custom-select-control/index.js +20 -12
  308. package/build-module/custom-select-control/index.js.map +1 -1
  309. package/build-module/custom-select-control/styles.js +22 -0
  310. package/build-module/custom-select-control/styles.js.map +1 -0
  311. package/build-module/date-time/constants.js +2 -0
  312. package/build-module/date-time/constants.js.map +1 -0
  313. package/build-module/date-time/date/index.js +199 -186
  314. package/build-module/date-time/date/index.js.map +1 -1
  315. package/build-module/date-time/date/styles.js +61 -36
  316. package/build-module/date-time/date/styles.js.map +1 -1
  317. package/build-module/date-time/date-time/index.js +4 -3
  318. package/build-module/date-time/date-time/index.js.map +1 -1
  319. package/build-module/date-time/date-time/styles.js +20 -1
  320. package/build-module/date-time/date-time/styles.js.map +1 -1
  321. package/build-module/date-time/time/index.js +20 -16
  322. package/build-module/date-time/time/index.js.map +1 -1
  323. package/build-module/date-time/time/styles.js +12 -12
  324. package/build-module/date-time/time/styles.js.map +1 -1
  325. package/build-module/date-time/utils.js +19 -0
  326. package/build-module/date-time/utils.js.map +1 -0
  327. package/build-module/dimension-control/index.js +1 -5
  328. package/build-module/dimension-control/index.js.map +1 -1
  329. package/build-module/disabled/index.js +28 -11
  330. package/build-module/disabled/index.js.map +1 -1
  331. package/build-module/disabled/styles/disabled-styles.js +3 -3
  332. package/build-module/disabled/styles/disabled-styles.js.map +1 -1
  333. package/build-module/{swatch → disabled}/types.js +0 -0
  334. package/build-module/{swatch → disabled}/types.js.map +0 -0
  335. package/build-module/drop-zone/index.js +2 -3
  336. package/build-module/drop-zone/index.js.map +1 -1
  337. package/build-module/dropdown/index.js +5 -6
  338. package/build-module/dropdown/index.js.map +1 -1
  339. package/build-module/dropdown-menu/index.js +1 -2
  340. package/build-module/dropdown-menu/index.js.map +1 -1
  341. package/build-module/dropdown-menu/index.native.js +0 -16
  342. package/build-module/dropdown-menu/index.native.js.map +1 -1
  343. package/build-module/duotone-picker/custom-duotone-bar.js +1 -1
  344. package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
  345. package/build-module/duotone-picker/duotone-picker.js +7 -1
  346. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  347. package/build-module/duotone-picker/duotone-swatch.js +11 -3
  348. package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
  349. package/build-module/focal-point-picker/controls.js +4 -4
  350. package/build-module/focal-point-picker/controls.js.map +1 -1
  351. package/build-module/focal-point-picker/focal-point.js +4 -6
  352. package/build-module/focal-point-picker/focal-point.js.map +1 -1
  353. package/build-module/focal-point-picker/grid.js +6 -34
  354. package/build-module/focal-point-picker/grid.js.map +1 -1
  355. package/build-module/focal-point-picker/index.js +162 -330
  356. package/build-module/focal-point-picker/index.js.map +1 -1
  357. package/build-module/focal-point-picker/media.js +4 -36
  358. package/build-module/focal-point-picker/media.js.map +1 -1
  359. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +13 -14
  360. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  361. package/build-module/focal-point-picker/styles/focal-point-style.js +4 -4
  362. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  363. package/build-module/focal-point-picker/utils.js +2 -6
  364. package/build-module/focal-point-picker/utils.js.map +1 -1
  365. package/build-module/focusable-iframe/index.js +6 -0
  366. package/build-module/focusable-iframe/index.js.map +1 -1
  367. package/build-module/font-size-picker/index.js +39 -14
  368. package/build-module/font-size-picker/index.js.map +1 -1
  369. package/build-module/font-size-picker/utils.js +31 -23
  370. package/build-module/font-size-picker/utils.js.map +1 -1
  371. package/build-module/form-token-field/index.js +30 -20
  372. package/build-module/form-token-field/index.js.map +1 -1
  373. package/build-module/gradient-picker/index.js +23 -2
  374. package/build-module/gradient-picker/index.js.map +1 -1
  375. package/build-module/guide/index.js +13 -8
  376. package/build-module/guide/index.js.map +1 -1
  377. package/build-module/guide/page-control.js +3 -6
  378. package/build-module/guide/page-control.js.map +1 -1
  379. package/build-module/higher-order/with-constrained-tabbing/index.js +1 -1
  380. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  381. package/build-module/higher-order/with-spoken-messages/index.js +2 -0
  382. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  383. package/build-module/isolated-event-container/index.js +3 -0
  384. package/build-module/isolated-event-container/index.js.map +1 -1
  385. package/build-module/item-group/styles.js +10 -10
  386. package/build-module/item-group/styles.js.map +1 -1
  387. package/build-module/mobile/bottom-sheet/index.native.js +3 -5
  388. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  389. package/build-module/mobile/global-styles-context/utils.native.js +3 -2
  390. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  391. package/build-module/mobile/image/index.native.js +8 -28
  392. package/build-module/mobile/image/index.native.js.map +1 -1
  393. package/build-module/mobile/picker/index.android.js +3 -3
  394. package/build-module/mobile/picker/index.android.js.map +1 -1
  395. package/build-module/modal/index.js +1 -2
  396. package/build-module/modal/index.js.map +1 -1
  397. package/build-module/navigable-container/container.js +9 -7
  398. package/build-module/navigable-container/container.js.map +1 -1
  399. package/build-module/navigable-container/menu.js +3 -8
  400. package/build-module/navigable-container/menu.js.map +1 -1
  401. package/build-module/navigation/menu/menu-title-search.js +1 -2
  402. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  403. package/build-module/navigator/navigator-back-button/hook.js +0 -4
  404. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  405. package/build-module/navigator/navigator-button/hook.js +0 -4
  406. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  407. package/build-module/notice/list.js +10 -5
  408. package/build-module/notice/list.js.map +1 -1
  409. package/build-module/palette-edit/index.js +7 -2
  410. package/build-module/palette-edit/index.js.map +1 -1
  411. package/build-module/palette-edit/styles.js +10 -10
  412. package/build-module/palette-edit/styles.js.map +1 -1
  413. package/build-module/popover/index.js +93 -111
  414. package/build-module/popover/index.js.map +1 -1
  415. package/build-module/popover/utils.js +164 -0
  416. package/build-module/popover/utils.js.map +1 -0
  417. package/build-module/range-control/index.js +3 -0
  418. package/build-module/range-control/index.js.map +1 -1
  419. package/build-module/range-control/styles/range-control-styles.js +43 -37
  420. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  421. package/build-module/select-control/chevron-down.js +21 -0
  422. package/build-module/select-control/chevron-down.js.map +1 -0
  423. package/build-module/select-control/index.js +7 -7
  424. package/build-module/select-control/index.js.map +1 -1
  425. package/build-module/select-control/styles/select-control-styles.js +24 -13
  426. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  427. package/build-module/snackbar/list.js +5 -2
  428. package/build-module/snackbar/list.js.map +1 -1
  429. package/build-module/spinner/index.js +2 -0
  430. package/build-module/spinner/index.js.map +1 -1
  431. package/build-module/text/styles.js +7 -7
  432. package/build-module/text/styles.js.map +1 -1
  433. package/build-module/text-highlight/index.js +2 -5
  434. package/build-module/text-highlight/index.js.map +1 -1
  435. package/build-module/toggle-group-control/toggle-group-control/component.js +16 -8
  436. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  437. package/build-module/toggle-group-control/toggle-group-control/styles.js +20 -5
  438. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  439. package/build-module/toggle-group-control/toggle-group-control-option/component.js +17 -3
  440. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  441. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +5 -1
  442. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  443. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +16 -6
  444. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  445. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +27 -5
  446. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  447. package/build-module/tools-panel/styles.js +11 -11
  448. package/build-module/tools-panel/styles.js.map +1 -1
  449. package/build-module/tooltip/index.js +1 -6
  450. package/build-module/tooltip/index.js.map +1 -1
  451. package/build-module/tree-grid/index.js +4 -9
  452. package/build-module/tree-grid/index.js.map +1 -1
  453. package/build-module/ui/context/context-connect.js +1 -2
  454. package/build-module/ui/context/context-connect.js.map +1 -1
  455. package/build-module/unit-control/index.js +2 -2
  456. package/build-module/unit-control/index.js.map +1 -1
  457. package/build-module/utils/colors-values.js +52 -141
  458. package/build-module/utils/colors-values.js.map +1 -1
  459. package/build-module/utils/config-values.js +1 -1
  460. package/build-module/utils/config-values.js.map +1 -1
  461. package/build-module/utils/input/input-control.js +1 -1
  462. package/build-module/utils/input/input-control.js.map +1 -1
  463. package/build-module/utils/rtl.js +6 -4
  464. package/build-module/utils/rtl.js.map +1 -1
  465. package/build-module/utils/strings.js +48 -0
  466. package/build-module/utils/strings.js.map +1 -0
  467. package/build-style/style-rtl.css +202 -1272
  468. package/build-style/style.css +202 -1275
  469. package/build-types/animation/index.d.ts +2 -0
  470. package/build-types/{flyout → animation}/index.d.ts.map +1 -1
  471. package/build-types/card/card/component.d.ts +3 -3
  472. package/build-types/card/card/component.d.ts.map +1 -1
  473. package/build-types/card/card/hook.d.ts +7 -2
  474. package/build-types/card/card/hook.d.ts.map +1 -1
  475. package/build-types/card/card/index.d.ts +2 -2
  476. package/build-types/card/card/index.d.ts.map +1 -1
  477. package/build-types/card/card-body/component.d.ts +3 -3
  478. package/build-types/card/card-body/component.d.ts.map +1 -1
  479. package/build-types/card/card-body/hook.d.ts +5 -2
  480. package/build-types/card/card-body/hook.d.ts.map +1 -1
  481. package/build-types/card/card-body/index.d.ts +2 -2
  482. package/build-types/card/card-body/index.d.ts.map +1 -1
  483. package/build-types/card/card-divider/component.d.ts +3 -3
  484. package/build-types/card/card-divider/component.d.ts.map +1 -1
  485. package/build-types/card/card-divider/hook.d.ts +5 -2
  486. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  487. package/build-types/card/card-divider/index.d.ts +2 -2
  488. package/build-types/card/card-divider/index.d.ts.map +1 -1
  489. package/build-types/card/card-footer/component.d.ts +3 -3
  490. package/build-types/card/card-footer/component.d.ts.map +1 -1
  491. package/build-types/card/card-footer/hook.d.ts +5 -2
  492. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  493. package/build-types/card/card-footer/index.d.ts +2 -2
  494. package/build-types/card/card-footer/index.d.ts.map +1 -1
  495. package/build-types/card/card-header/component.d.ts +3 -3
  496. package/build-types/card/card-header/component.d.ts.map +1 -1
  497. package/build-types/card/card-header/hook.d.ts +5 -2
  498. package/build-types/card/card-header/hook.d.ts.map +1 -1
  499. package/build-types/card/card-header/index.d.ts +2 -2
  500. package/build-types/card/card-header/index.d.ts.map +1 -1
  501. package/build-types/card/card-media/component.d.ts +3 -4
  502. package/build-types/card/card-media/component.d.ts.map +1 -1
  503. package/build-types/card/card-media/hook.d.ts +6 -5
  504. package/build-types/card/card-media/hook.d.ts.map +1 -1
  505. package/build-types/card/card-media/index.d.ts +2 -2
  506. package/build-types/card/card-media/index.d.ts.map +1 -1
  507. package/build-types/card/context.d.ts +3 -2
  508. package/build-types/card/context.d.ts.map +1 -1
  509. package/build-types/card/index.d.ts +6 -6
  510. package/build-types/card/index.d.ts.map +1 -1
  511. package/build-types/card/stories/index.d.ts +12 -0
  512. package/build-types/card/stories/index.d.ts.map +1 -0
  513. package/build-types/card/styles.d.ts +20 -22
  514. package/build-types/card/styles.d.ts.map +1 -1
  515. package/build-types/card/test/index.d.ts +2 -0
  516. package/build-types/{flyout/flyout → card/test}/index.d.ts.map +1 -1
  517. package/build-types/card/types.d.ts +7 -1
  518. package/build-types/card/types.d.ts.map +1 -1
  519. package/build-types/clipboard-button/index.d.ts +16 -0
  520. package/build-types/clipboard-button/index.d.ts.map +1 -0
  521. package/build-types/color-palette/index.d.ts +2 -1
  522. package/build-types/color-palette/index.d.ts.map +1 -1
  523. package/build-types/color-picker/styles.d.ts +2 -2
  524. package/build-types/composite/index.d.ts +2 -0
  525. package/build-types/composite/index.d.ts.map +1 -0
  526. package/build-types/date-time/constants.d.ts +2 -0
  527. package/build-types/date-time/constants.d.ts.map +1 -0
  528. package/build-types/date-time/date/index.d.ts +4 -2
  529. package/build-types/date-time/date/index.d.ts.map +1 -1
  530. package/build-types/date-time/date/styles.d.ts +26 -8
  531. package/build-types/date-time/date/styles.d.ts.map +1 -1
  532. package/build-types/date-time/date/test/index.d.ts +1 -1
  533. package/build-types/date-time/date/test/index.d.ts.map +1 -1
  534. package/build-types/date-time/date-time/styles.d.ts +13 -0
  535. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  536. package/build-types/date-time/time/index.d.ts.map +1 -1
  537. package/build-types/date-time/time/styles.d.ts.map +1 -1
  538. package/build-types/date-time/utils.d.ts +8 -0
  539. package/build-types/date-time/utils.d.ts.map +1 -0
  540. package/build-types/disabled/index.d.ts +35 -28
  541. package/build-types/disabled/index.d.ts.map +1 -1
  542. package/build-types/disabled/stories/index.d.ts +13 -0
  543. package/build-types/disabled/stories/index.d.ts.map +1 -0
  544. package/build-types/disabled/styles/disabled-styles.d.ts +2 -1
  545. package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
  546. package/build-types/disabled/test/index.d.ts +2 -0
  547. package/build-types/disabled/test/index.d.ts.map +1 -0
  548. package/build-types/disabled/types.d.ts +14 -0
  549. package/build-types/disabled/types.d.ts.map +1 -0
  550. package/build-types/disclosure/index.d.ts +2 -0
  551. package/build-types/disclosure/index.d.ts.map +1 -0
  552. package/build-types/dropdown/index.d.ts.map +1 -1
  553. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  554. package/build-types/focusable-iframe/index.d.ts +8 -0
  555. package/build-types/focusable-iframe/index.d.ts.map +1 -0
  556. package/build-types/form-token-field/index.d.ts.map +1 -1
  557. package/build-types/form-token-field/stories/index.d.ts +1 -0
  558. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  559. package/build-types/form-token-field/test/index.d.ts +2 -0
  560. package/build-types/form-token-field/test/index.d.ts.map +1 -0
  561. package/build-types/form-token-field/types.d.ts +7 -0
  562. package/build-types/form-token-field/types.d.ts.map +1 -1
  563. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +3 -0
  564. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -0
  565. package/build-types/higher-order/with-spoken-messages/index.d.ts +4 -0
  566. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -0
  567. package/build-types/isolated-event-container/index.d.ts +3 -0
  568. package/build-types/isolated-event-container/index.d.ts.map +1 -0
  569. package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
  570. package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
  571. package/build-types/navigable-container/menu.d.ts.map +1 -1
  572. package/build-types/navigator/navigator-back-button/hook.d.ts +0 -3
  573. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  574. package/build-types/navigator/navigator-button/hook.d.ts +0 -3
  575. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  576. package/build-types/placeholder/test/index.d.ts +2 -0
  577. package/build-types/placeholder/test/index.d.ts.map +1 -0
  578. package/build-types/popover/index.d.ts +1 -2
  579. package/build-types/popover/index.d.ts.map +1 -1
  580. package/build-types/popover/utils.d.ts +26 -69
  581. package/build-types/popover/utils.d.ts.map +1 -1
  582. package/build-types/radio-context/index.d.ts +6 -0
  583. package/build-types/radio-context/index.d.ts.map +1 -0
  584. package/build-types/range-control/index.d.ts +2 -2
  585. package/build-types/range-control/index.d.ts.map +1 -1
  586. package/build-types/range-control/styles/range-control-styles.d.ts +5 -2
  587. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  588. package/build-types/range-control/types.d.ts +2 -2
  589. package/build-types/range-control/types.d.ts.map +1 -1
  590. package/build-types/select-control/chevron-down.d.ts +4 -0
  591. package/build-types/select-control/chevron-down.d.ts.map +1 -0
  592. package/build-types/select-control/index.d.ts.map +1 -1
  593. package/build-types/select-control/styles/select-control-styles.d.ts +8 -0
  594. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  595. package/build-types/spinner/index.d.ts.map +1 -1
  596. package/build-types/text-highlight/index.d.ts +0 -3
  597. package/build-types/text-highlight/index.d.ts.map +1 -1
  598. package/build-types/toggle-group-control/stories/index.d.ts +25 -0
  599. package/build-types/toggle-group-control/stories/index.d.ts.map +1 -0
  600. package/build-types/toggle-group-control/test/index.d.ts +2 -0
  601. package/build-types/toggle-group-control/test/index.d.ts.map +1 -0
  602. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +6 -3
  603. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  604. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +5 -0
  605. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  606. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +6 -7
  607. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  608. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  609. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +4 -0
  610. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  611. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +11 -9
  612. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
  613. package/build-types/toggle-group-control/types.d.ts +23 -10
  614. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  615. package/build-types/tooltip/index.d.ts.map +1 -1
  616. package/build-types/ui/context/context-connect.d.ts +3 -0
  617. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  618. package/build-types/ui/form-group/use-form-group.d.ts +2 -2
  619. package/build-types/unit-control/index.d.ts +2 -1
  620. package/build-types/unit-control/index.d.ts.map +1 -1
  621. package/build-types/unit-control/types.d.ts +5 -1
  622. package/build-types/unit-control/types.d.ts.map +1 -1
  623. package/build-types/utils/colors-values.d.ts +18 -97
  624. package/build-types/utils/colors-values.d.ts.map +1 -1
  625. package/build-types/utils/rtl.d.ts.map +1 -1
  626. package/build-types/utils/strings.d.ts +10 -0
  627. package/build-types/utils/strings.d.ts.map +1 -0
  628. package/package.json +22 -21
  629. package/src/alignment-matrix-control/index.js +1 -1
  630. package/src/alignment-matrix-control/stories/index.js +49 -24
  631. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +2 -3
  632. package/src/angle-picker-control/index.js +7 -1
  633. package/src/angle-picker-control/stories/index.js +8 -5
  634. package/src/angle-picker-control/styles/angle-picker-control-styles.js +12 -3
  635. package/src/autocomplete/get-default-use-items.js +6 -1
  636. package/src/autocomplete/index.js +11 -19
  637. package/src/base-control/styles/base-control-styles.ts +1 -1
  638. package/src/base-field/styles.js +1 -1
  639. package/src/base-field/test/__snapshots__/index.js.snap +2 -2
  640. package/src/box-control/styles/box-control-visualizer-styles.js +0 -1
  641. package/src/box-control/test/index.js +8 -8
  642. package/src/button/test/index.js +188 -146
  643. package/src/card/card/{component.js → component.tsx} +13 -9
  644. package/src/card/card/{hook.js → hook.ts} +11 -11
  645. package/src/card/card/{index.js → index.ts} +0 -0
  646. package/src/card/card-body/{component.js → component.tsx} +13 -9
  647. package/src/card/card-body/{hook.js → hook.ts} +5 -5
  648. package/src/card/card-body/{index.js → index.ts} +0 -0
  649. package/src/card/card-divider/{component.js → component.tsx} +16 -10
  650. package/src/card/card-divider/{hook.js → hook.ts} +5 -5
  651. package/src/card/card-divider/{index.js → index.ts} +0 -0
  652. package/src/card/card-footer/{component.js → component.tsx} +13 -9
  653. package/src/card/card-footer/{hook.js → hook.ts} +5 -5
  654. package/src/card/card-footer/{index.js → index.ts} +0 -0
  655. package/src/card/card-header/{component.js → component.tsx} +13 -9
  656. package/src/card/card-header/{hook.js → hook.ts} +5 -5
  657. package/src/card/card-header/{index.js → index.ts} +0 -0
  658. package/src/card/card-media/{component.js → component.tsx} +13 -8
  659. package/src/card/card-media/{hook.js → hook.ts} +5 -5
  660. package/src/card/card-media/{index.js → index.ts} +0 -0
  661. package/src/card/{context.js → context.ts} +0 -0
  662. package/src/card/{index.js → index.ts} +0 -0
  663. package/src/card/stories/index.tsx +75 -0
  664. package/src/card/{styles.js → styles.ts} +0 -0
  665. package/src/card/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  666. package/src/card/test/{index.js → index.tsx} +3 -3
  667. package/src/card/types.ts +8 -1
  668. package/src/clipboard-button/index.js +13 -0
  669. package/src/color-list-picker/index.js +15 -3
  670. package/src/color-list-picker/style.scss +11 -0
  671. package/src/color-palette/index.js +40 -21
  672. package/src/color-palette/index.native.js +10 -6
  673. package/src/color-palette/stories/index.js +1 -1
  674. package/src/color-palette/style.scss +0 -14
  675. package/src/color-palette/test/__snapshots__/index.js.snap +28 -7
  676. package/src/combobox-control/index.js +6 -5
  677. package/src/combobox-control/stories/index.js +9 -3
  678. package/src/combobox-control/style.scss +0 -1
  679. package/src/confirm-dialog/test/index.js +85 -62
  680. package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
  681. package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +54 -50
  682. package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -3
  683. package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/test/utils.js +0 -0
  684. package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
  685. package/src/custom-gradient-picker/index.js +30 -3
  686. package/src/custom-gradient-picker/stories/index.js +6 -2
  687. package/src/custom-gradient-picker/style.scss +30 -27
  688. package/src/custom-select-control/README.md +10 -0
  689. package/src/custom-select-control/index.js +22 -16
  690. package/src/custom-select-control/stories/index.js +1 -1
  691. package/src/custom-select-control/style.scss +0 -12
  692. package/src/custom-select-control/styles.ts +28 -0
  693. package/src/custom-select-control/test/index.js +4 -1
  694. package/src/date-time/constants.ts +1 -0
  695. package/src/date-time/date/index.tsx +310 -185
  696. package/src/date-time/date/styles.ts +92 -27
  697. package/src/date-time/date/test/index.tsx +24 -30
  698. package/src/date-time/date-time/index.tsx +3 -3
  699. package/src/date-time/date-time/styles.ts +9 -0
  700. package/src/date-time/time/index.tsx +23 -19
  701. package/src/date-time/time/styles.ts +1 -0
  702. package/src/date-time/utils.ts +17 -0
  703. package/src/dimension-control/index.js +1 -5
  704. package/src/disabled/index.tsx +80 -0
  705. package/src/disabled/stories/index.tsx +87 -0
  706. package/src/disabled/styles/{disabled-styles.js → disabled-styles.tsx} +0 -0
  707. package/src/disabled/test/index.tsx +174 -0
  708. package/src/disabled/types.ts +13 -0
  709. package/src/drop-zone/index.js +2 -3
  710. package/src/dropdown/index.js +3 -5
  711. package/src/dropdown-menu/index.js +1 -2
  712. package/src/dropdown-menu/index.native.js +0 -13
  713. package/src/dropdown-menu/stories/index.js +13 -2
  714. package/src/dropdown-menu/test/index.js +54 -58
  715. package/src/duotone-picker/custom-duotone-bar.js +1 -1
  716. package/src/duotone-picker/duotone-picker.js +34 -26
  717. package/src/duotone-picker/duotone-swatch.js +12 -5
  718. package/src/duotone-picker/stories/duotone-picker.js +66 -0
  719. package/src/duotone-picker/stories/duotone-swatch.js +32 -0
  720. package/src/focal-point-picker/README.md +3 -6
  721. package/src/focal-point-picker/controls.js +4 -4
  722. package/src/focal-point-picker/focal-point.js +2 -8
  723. package/src/focal-point-picker/grid.js +5 -41
  724. package/src/focal-point-picker/index.js +171 -308
  725. package/src/focal-point-picker/media.js +4 -28
  726. package/src/focal-point-picker/styles/focal-point-picker-style.js +5 -8
  727. package/src/focal-point-picker/styles/focal-point-style.js +0 -1
  728. package/src/focal-point-picker/test/index.js +79 -46
  729. package/src/focal-point-picker/utils.js +2 -6
  730. package/src/focusable-iframe/index.js +5 -0
  731. package/src/font-size-picker/index.js +161 -144
  732. package/src/font-size-picker/stories/index.js +1 -0
  733. package/src/font-size-picker/style.scss +8 -5
  734. package/src/font-size-picker/test/index.js +13 -6
  735. package/src/font-size-picker/test/{util.js → utils.js} +77 -1
  736. package/src/font-size-picker/utils.js +38 -23
  737. package/src/form-token-field/README.md +1 -0
  738. package/src/form-token-field/index.tsx +41 -33
  739. package/src/form-token-field/stories/index.tsx +8 -0
  740. package/src/form-token-field/test/index.tsx +2106 -0
  741. package/src/form-token-field/types.ts +7 -0
  742. package/src/gradient-picker/README.md +9 -0
  743. package/src/gradient-picker/index.js +31 -7
  744. package/src/gradient-picker/stories/index.js +57 -81
  745. package/src/guide/index.js +9 -4
  746. package/src/guide/page-control.js +1 -6
  747. package/src/guide/stories/index.js +12 -11
  748. package/src/guide/test/index.js +191 -37
  749. package/src/higher-order/with-constrained-tabbing/index.js +1 -1
  750. package/src/higher-order/with-notices/test/index.js +4 -2
  751. package/src/higher-order/with-spoken-messages/index.js +2 -0
  752. package/src/higher-order/with-spoken-messages/test/index.js +1 -1
  753. package/src/isolated-event-container/index.js +3 -0
  754. package/src/item-group/styles.ts +3 -3
  755. package/src/menu-group/test/index.js +18 -7
  756. package/src/mobile/bottom-sheet/index.native.js +2 -4
  757. package/src/mobile/global-styles-context/utils.native.js +8 -2
  758. package/src/mobile/image/index.native.js +9 -30
  759. package/src/mobile/picker/index.android.js +10 -4
  760. package/src/mobile/picker/styles.native.scss +4 -4
  761. package/src/modal/index.js +1 -2
  762. package/src/modal/test/index.js +11 -9
  763. package/src/navigable-container/container.js +12 -18
  764. package/src/navigable-container/menu.js +3 -7
  765. package/src/navigable-container/test/menu.js +14 -11
  766. package/src/navigation/menu/menu-title-search.js +1 -2
  767. package/src/navigator/navigator-back-button/hook.ts +0 -3
  768. package/src/navigator/navigator-button/hook.ts +0 -3
  769. package/src/notice/list.js +12 -10
  770. package/src/palette-edit/index.js +15 -10
  771. package/src/palette-edit/style.scss +3 -11
  772. package/src/palette-edit/styles.js +6 -5
  773. package/src/placeholder/README.md +1 -1
  774. package/src/placeholder/style.scss +62 -20
  775. package/src/placeholder/test/index.tsx +174 -0
  776. package/src/popover/index.js +129 -126
  777. package/src/popover/stories/index.js +17 -4
  778. package/src/popover/test/__snapshots__/index.js.snap +6 -6
  779. package/src/popover/test/index.js +129 -36
  780. package/src/popover/utils.js +107 -0
  781. package/src/range-control/index.tsx +3 -0
  782. package/src/range-control/styles/range-control-styles.ts +9 -4
  783. package/src/range-control/types.ts +5 -2
  784. package/src/select-control/chevron-down.tsx +25 -0
  785. package/src/select-control/index.tsx +6 -9
  786. package/src/select-control/styles/select-control-styles.ts +23 -14
  787. package/src/slot-fill/test/slot.js +5 -5
  788. package/src/snackbar/list.js +3 -2
  789. package/src/spinner/index.tsx +2 -0
  790. package/src/style.scss +0 -2
  791. package/src/text/styles.js +1 -1
  792. package/src/text/test/index.tsx +1 -1
  793. package/src/text-highlight/index.tsx +1 -5
  794. package/src/toggle-group-control/stories/index.tsx +127 -0
  795. package/src/toggle-group-control/test/__snapshots__/{index.js.snap → index.tsx.snap} +81 -57
  796. package/src/toggle-group-control/test/{index.js → index.tsx} +2 -4
  797. package/src/toggle-group-control/toggle-group-control/README.md +2 -0
  798. package/src/toggle-group-control/toggle-group-control/component.tsx +21 -11
  799. package/src/toggle-group-control/toggle-group-control/styles.ts +14 -6
  800. package/src/toggle-group-control/toggle-group-control-option/component.tsx +19 -3
  801. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +3 -0
  802. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +18 -0
  803. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +6 -8
  804. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +30 -7
  805. package/src/toggle-group-control/types.ts +74 -59
  806. package/src/toolbar/test/index.js +4 -4
  807. package/src/toolbar-group/test/index.js +9 -15
  808. package/src/tools-panel/styles.ts +2 -2
  809. package/src/tools-panel/test/index.js +3 -2
  810. package/src/tooltip/index.js +1 -5
  811. package/src/tooltip/test/index.js +188 -172
  812. package/src/tree-grid/index.js +4 -9
  813. package/src/ui/context/context-connect.ts +3 -2
  814. package/src/unit-control/index.tsx +2 -2
  815. package/src/unit-control/types.ts +10 -1
  816. package/src/utils/colors-values.js +42 -137
  817. package/src/utils/config-values.js +1 -1
  818. package/src/utils/input/input-control.js +6 -6
  819. package/src/utils/rtl.js +6 -2
  820. package/src/utils/strings.ts +83 -0
  821. package/src/utils/test/strings.js +15 -0
  822. package/tsconfig.json +45 -77
  823. package/tsconfig.tsbuildinfo +1 -1
  824. package/build/custom-gradient-bar/constants.js.map +0 -1
  825. package/build/custom-gradient-bar/control-points.js.map +0 -1
  826. package/build/custom-gradient-bar/index.js.map +0 -1
  827. package/build/custom-gradient-bar/utils.js.map +0 -1
  828. package/build/date-time/date/utils.js +0 -34
  829. package/build/date-time/date/utils.js.map +0 -1
  830. package/build/swatch/index.js +0 -41
  831. package/build/swatch/index.js.map +0 -1
  832. package/build/ui/__storybook-utils/example-grid.js +0 -88
  833. package/build/ui/__storybook-utils/example-grid.js.map +0 -1
  834. package/build/ui/__storybook-utils/index.js +0 -19
  835. package/build/ui/__storybook-utils/index.js.map +0 -1
  836. package/build/ui/__storybook-utils/page.js +0 -43
  837. package/build/ui/__storybook-utils/page.js.map +0 -1
  838. package/build/utils/keyboard.js +0 -41
  839. package/build/utils/keyboard.js.map +0 -1
  840. package/build-module/custom-gradient-bar/constants.js.map +0 -1
  841. package/build-module/custom-gradient-bar/control-points.js.map +0 -1
  842. package/build-module/custom-gradient-bar/index.js.map +0 -1
  843. package/build-module/custom-gradient-bar/utils.js.map +0 -1
  844. package/build-module/date-time/date/utils.js +0 -22
  845. package/build-module/date-time/date/utils.js.map +0 -1
  846. package/build-module/swatch/index.js +0 -30
  847. package/build-module/swatch/index.js.map +0 -1
  848. package/build-module/ui/__storybook-utils/example-grid.js +0 -69
  849. package/build-module/ui/__storybook-utils/example-grid.js.map +0 -1
  850. package/build-module/ui/__storybook-utils/index.js +0 -2
  851. package/build-module/ui/__storybook-utils/index.js.map +0 -1
  852. package/build-module/ui/__storybook-utils/page.js +0 -32
  853. package/build-module/ui/__storybook-utils/page.js.map +0 -1
  854. package/build-module/utils/keyboard.js +0 -33
  855. package/build-module/utils/keyboard.js.map +0 -1
  856. package/build-types/color-picker/color-display.d.ts +0 -13
  857. package/build-types/color-picker/color-display.d.ts.map +0 -1
  858. package/build-types/date-time/date/test/utils.d.ts +0 -2
  859. package/build-types/date-time/date/test/utils.d.ts.map +0 -1
  860. package/build-types/date-time/date/utils.d.ts +0 -15
  861. package/build-types/date-time/date/utils.d.ts.map +0 -1
  862. package/build-types/flyout/context.d.ts +0 -6
  863. package/build-types/flyout/context.d.ts.map +0 -1
  864. package/build-types/flyout/flyout/component.d.ts +0 -21
  865. package/build-types/flyout/flyout/component.d.ts.map +0 -1
  866. package/build-types/flyout/flyout/hook.d.ts +0 -270
  867. package/build-types/flyout/flyout/hook.d.ts.map +0 -1
  868. package/build-types/flyout/flyout/index.d.ts +0 -3
  869. package/build-types/flyout/flyout-content/component.d.ts +0 -3
  870. package/build-types/flyout/flyout-content/component.d.ts.map +0 -1
  871. package/build-types/flyout/flyout-content/index.d.ts +0 -2
  872. package/build-types/flyout/flyout-content/index.d.ts.map +0 -1
  873. package/build-types/flyout/index.d.ts +0 -2
  874. package/build-types/flyout/styles.d.ts +0 -22
  875. package/build-types/flyout/styles.d.ts.map +0 -1
  876. package/build-types/flyout/types.d.ts +0 -80
  877. package/build-types/flyout/types.d.ts.map +0 -1
  878. package/build-types/flyout/utils.d.ts +0 -8
  879. package/build-types/flyout/utils.d.ts.map +0 -1
  880. package/build-types/form-token-field/test/lib/fixtures.d.ts +0 -26
  881. package/build-types/form-token-field/test/lib/fixtures.d.ts.map +0 -1
  882. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +0 -21
  883. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +0 -1
  884. package/build-types/swatch/index.d.ts +0 -5
  885. package/build-types/swatch/index.d.ts.map +0 -1
  886. package/build-types/swatch/types.d.ts +0 -11
  887. package/build-types/swatch/types.d.ts.map +0 -1
  888. package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
  889. package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
  890. package/build-types/utils/keyboard.d.ts +0 -12
  891. package/build-types/utils/keyboard.d.ts.map +0 -1
  892. package/src/card/stories/index.js +0 -209
  893. package/src/date-time/date/datepicker.scss +0 -863
  894. package/src/date-time/date/style.scss +0 -85
  895. package/src/date-time/date/test/utils.ts +0 -32
  896. package/src/date-time/date/utils.ts +0 -20
  897. package/src/date-time/style.scss +0 -1
  898. package/src/disabled/index.js +0 -55
  899. package/src/disabled/stories/index.js +0 -61
  900. package/src/disabled/test/index.js +0 -240
  901. package/src/form-token-field/test/index.js +0 -411
  902. package/src/form-token-field/test/lib/fixtures.js +0 -89
  903. package/src/form-token-field/test/lib/token-field-wrapper.tsx +0 -71
  904. package/src/guide/test/page-control.js +0 -43
  905. package/src/menu-group/test/__snapshots__/index.js.snap +0 -23
  906. package/src/placeholder/test/index.js +0 -163
  907. package/src/swatch/index.tsx +0 -22
  908. package/src/swatch/style.scss +0 -21
  909. package/src/swatch/types.ts +0 -11
  910. package/src/toggle-group-control/stories/index.js +0 -203
  911. package/src/tools-panel/test/__snapshots__/index.js.snap +0 -210
  912. package/src/ui/__storybook-utils/example-grid.js +0 -61
  913. package/src/ui/__storybook-utils/index.js +0 -1
  914. package/src/ui/__storybook-utils/page.js +0 -29
  915. package/src/utils/keyboard.js +0 -28
  916. package/src/utils/test/keyboard.js +0 -34
@@ -5,7 +5,6 @@ import { createElement } from "@wordpress/element";
5
5
  /**
6
6
  * External dependencies
7
7
  */
8
- import { map } from 'lodash';
9
8
  import { colord, extend } from 'colord';
10
9
  import namesPlugin from 'colord/plugins/names';
11
10
  import a11yPlugin from 'colord/plugins/a11y';
@@ -26,6 +25,7 @@ import { VStack } from '../v-stack';
26
25
  import { Flex, FlexItem } from '../flex';
27
26
  import { Truncate } from '../truncate';
28
27
  import { ColorHeading } from './styles';
28
+ import DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';
29
29
  extend([namesPlugin, a11yPlugin]);
30
30
 
31
31
  function SinglePalette(_ref) {
@@ -38,16 +38,17 @@ function SinglePalette(_ref) {
38
38
  actions
39
39
  } = _ref;
40
40
  const colorOptions = useMemo(() => {
41
- return map(colors, _ref2 => {
41
+ return colors.map((_ref2, index) => {
42
42
  let {
43
43
  color,
44
44
  name
45
45
  } = _ref2;
46
46
  const colordColor = colord(color);
47
+ const isSelected = value === color;
47
48
  return createElement(CircularOptionPicker.Option, {
48
- key: color,
49
- isSelected: value === color,
50
- selectedIconProps: value === color ? {
49
+ key: `${color}-${index}`,
50
+ isSelected: isSelected,
51
+ selectedIconProps: isSelected ? {
51
52
  fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
52
53
  } : {},
53
54
  tooltipText: name || // translators: %s: color hex code e.g: "#f00".
@@ -56,7 +57,7 @@ function SinglePalette(_ref) {
56
57
  backgroundColor: color,
57
58
  color
58
59
  },
59
- onClick: value === color ? clearColor : () => onChange(color),
60
+ onClick: isSelected ? clearColor : () => onChange(color),
60
61
  "aria-label": name ? // translators: %s: The name of the color e.g: "vivid red".
61
62
  sprintf(__('Color: %s'), name) : // translators: %s: color hex code e.g: "#f00".
62
63
  sprintf(__('Color code: %s'), color)
@@ -103,15 +104,26 @@ function MultiplePalettes(_ref3) {
103
104
  export function CustomColorPickerDropdown(_ref5) {
104
105
  let {
105
106
  isRenderedInSidebar,
107
+ popoverProps: receivedPopoverProps,
106
108
  ...props
107
109
  } = _ref5;
110
+ const popoverProps = useMemo(() => ({
111
+ __unstableShift: true,
112
+ ...(isRenderedInSidebar ? {
113
+ // When in the sidebar: open to the left (stacking),
114
+ // leaving the same gap as the parent popover.
115
+ placement: 'left-start',
116
+ offset: 34
117
+ } : {
118
+ // Default behavior: open below the anchor
119
+ placement: 'bottom',
120
+ offset: 8
121
+ }),
122
+ ...receivedPopoverProps
123
+ }), [isRenderedInSidebar, receivedPopoverProps]);
108
124
  return createElement(Dropdown, _extends({
109
125
  contentClassName: "components-color-palette__custom-color-dropdown-content",
110
- popoverProps: isRenderedInSidebar ? {
111
- placement: 'left-start',
112
- offset: 20,
113
- __unstableShift: true
114
- } : undefined
126
+ popoverProps: popoverProps
115
127
  }, props));
116
128
  }
117
129
  export const extractColorNameFromCurrentValue = function (currentValue) {
@@ -170,11 +182,13 @@ export default function ColorPalette(_ref6) {
170
182
  const showMultiplePalettes = __experimentalHasMultipleOrigins && (colors === null || colors === void 0 ? void 0 : colors.length);
171
183
  const Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;
172
184
 
173
- const renderCustomColorPicker = () => createElement(ColorPicker, {
185
+ const renderCustomColorPicker = () => createElement(DropdownContentWrapper, {
186
+ paddingSize: "none"
187
+ }, createElement(ColorPicker, {
174
188
  color: value,
175
189
  onChange: color => onChange(color),
176
190
  enableAlpha: enableAlpha
177
- });
191
+ }));
178
192
 
179
193
  const colordColor = colord(value);
180
194
  const valueWithoutLeadingHash = value !== null && value !== void 0 && value.startsWith('#') ? value.substring(1) : value !== null && value !== void 0 ? value : '';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-palette/index.js"],"names":["map","colord","extend","namesPlugin","a11yPlugin","__","sprintf","useCallback","useMemo","Dropdown","ColorPicker","CircularOptionPicker","VStack","Flex","FlexItem","Truncate","ColorHeading","SinglePalette","className","clearColor","colors","onChange","value","actions","colorOptions","color","name","colordColor","fill","contrast","backgroundColor","MultiplePalettes","index","colorPalette","length","CustomColorPickerDropdown","isRenderedInSidebar","props","placement","offset","__unstableShift","undefined","extractColorNameFromCurrentValue","currentValue","showMultiplePalettes","currentValueIsCssVariable","test","normalizedCurrentValue","toHex","colorPalettes","paletteColors","colorName","colorValue","normalizedColorValue","showTransparentBackground","alpha","ColorPalette","clearable","disableCustomColors","enableAlpha","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","Component","renderCustomColorPicker","valueWithoutLeadingHash","startsWith","substring","buttonLabelName","customColorAccessibleLabel","isOpen","onToggle","background"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AACA,SAASC,MAAT,EA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AEG,UAAAA,KAAK,EAAE;AAAT,SADH,GAEG;AACA8C,UAAAA,UAAU,EAAEjD,KADZ;AAEAG,UAAAA,KAAK,EACJE,WAAW,CAACE,QAAZ,KACAF,WAAW,CAACE,QAAZ,CAAsB,MAAtB,CADA,GAEG,MAFH,GAGG;AANJ;AAZL,SAsBC,cAAC,QAAD;AACC,QAAA,OAAO,MADR;AAEC,QAAA,EAAE,EAAGd,QAFN;AAGC,QAAA,SAAS,EAAC;AAHX,SAKGoD,eALH,CAtBD,EA6BC,cAAC,QAAD;AACC,QAAA,EAAE,EAAC,MADJ;AAEC,QAAA,SAAS,EAAC;AAFX,SAIGH,uBAJH,CA7BD,CADc;AAAA;AAHhB,IAFF,EA6CC,cAAC,SAAD;AACC,IAAA,SAAS,EAAGP,SADb;AAEC,IAAA,UAAU,EAAGtC,UAFd;AAGC,IAAA,MAAM,EAAGC,MAHV;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,KAAK,EAAGC,KALT;AAMC,IAAA,OAAO,EACN,CAAC,CAAEmC,SAAH,IACC,cAAC,oBAAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAGtC;AADX,OAGGd,EAAE,CAAE,OAAF,CAHL;AARH,IA7CD,CADD;AAgEA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { map } from 'lodash';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Flex, FlexItem } from '../flex';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn map( colors, ( { color, name } ) => {\n\t\t\tconst colordColor = colord( color );\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ color }\n\t\t\t\t\tisSelected={ value === color }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tvalue === color\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tvalue === color ? clearColor : () => onChange( color )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading>{ name }</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\tcolors.length === index + 1 ? actions : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( { isRenderedInSidebar, ...props } ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={\n\t\t\t\tisRenderedInSidebar\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\t\toffset: 20,\n\t\t\t\t\t\t\t__unstableShift: true,\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue,\n\tcolors = [],\n\tshowMultiplePalettes = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\n\tconst currentValueIsCssVariable = /^var\\(/.test( currentValue );\n\tconst normalizedCurrentValue = currentValueIsCssVariable\n\t\t? currentValue\n\t\t: colord( currentValue ).toHex();\n\n\t// Normalize format of `colors` to simplify the following loop\n\tconst colorPalettes = showMultiplePalettes ? colors : [ { colors } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsCssVariable\n\t\t\t\t? colorValue\n\t\t\t\t: colord( colorValue ).toHex();\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\nexport const showTransparentBackground = ( currentValue ) => {\n\tif ( typeof currentValue === 'undefined' ) {\n\t\treturn true;\n\t}\n\treturn colord( currentValue ).alpha() === 0;\n};\n\nexport default function ColorPalette( {\n\tclearable = true,\n\tclassName,\n\tcolors,\n\tdisableCustomColors = false,\n\tenableAlpha,\n\tonChange,\n\tvalue,\n\t__experimentalHasMultipleOrigins = false,\n\t__experimentalIsRenderedInSidebar = false,\n} ) {\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\tconst showMultiplePalettes =\n\t\t__experimentalHasMultipleOrigins && colors?.length;\n\tconst Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;\n\n\tconst renderCustomColorPicker = () => (\n\t\t<ColorPicker\n\t\t\tcolor={ value }\n\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\tenableAlpha={ enableAlpha }\n\t\t/>\n\t);\n\n\tconst colordColor = colord( value );\n\n\tconst valueWithoutLeadingHash = value?.startsWith( '#' )\n\t\t? value.substring( 1 )\n\t\t: value ?? '';\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\tshowMultiplePalettes\n\t\t\t),\n\t\t[ value, colors, showMultiplePalettes ]\n\t);\n\n\tconst customColorAccessibleLabel = !! valueWithoutLeadingHash\n\t\t? sprintf(\n\t\t\t\t// translators: %1$s: The name of the color e.g: \"vivid red\". %2$s: The color's hex code e.g: \"#f00\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tvalueWithoutLeadingHash\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tas={ 'button' }\n\t\t\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tshowTransparentBackground( value )\n\t\t\t\t\t\t\t\t\t? { color: '#000' }\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\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\t\t<FlexItem\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tas={ Truncate }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-name\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonLabelName }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-value\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ valueWithoutLeadingHash }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<Component\n\t\t\t\tclearable={ clearable }\n\t\t\t\tclearColor={ clearColor }\n\t\t\t\tcolors={ colors }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ value }\n\t\t\t\tactions={\n\t\t\t\t\t!! clearable && (\n\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\tonClick={ clearColor }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-palette/index.js"],"names":["colord","extend","namesPlugin","a11yPlugin","__","sprintf","useCallback","useMemo","Dropdown","ColorPicker","CircularOptionPicker","VStack","Flex","FlexItem","Truncate","ColorHeading","DropdownContentWrapper","SinglePalette","className","clearColor","colors","onChange","value","actions","colorOptions","map","index","color","name","colordColor","isSelected","fill","contrast","backgroundColor","MultiplePalettes","colorPalette","length","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","__unstableShift","placement","offset","extractColorNameFromCurrentValue","currentValue","showMultiplePalettes","currentValueIsCssVariable","test","normalizedCurrentValue","toHex","colorPalettes","paletteColors","colorName","colorValue","normalizedColorValue","showTransparentBackground","alpha","ColorPalette","clearable","disableCustomColors","enableAlpha","__experimentalHasMultipleOrigins","__experimentalIsRenderedInSidebar","undefined","Component","renderCustomColorPicker","valueWithoutLeadingHash","startsWith","substring","buttonLabelName","customColorAccessibleLabel","isOpen","onToggle","background"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,SAASC,MAAT,QAAuB,YAAvB;AACA,SAASC,IAAT,EAAeC,QAAf,QAA+B,SAA/B;AACA,SAASC,QAAT,QAAyB,aAAzB;AACA,SAASC,YAAT,QAA6B,UAA7B;AACA,OAAOC,sBAAP,MAAmC,sCAAnC;AAEAf,MAAM,CAAE,CAAEC,WAAF,EAAeC,UAAf,CAAF,CAAN;;AAEA,SAASc,aAAT,OAOI;AAAA,MAPoB;AACvBC,IAAAA,SADuB;AAEvBC,IAAAA,UAFuB;AAGvBC,IAAAA,MAHuB;AAIvBC,IAAAA,QAJuB;AAKvBC,IAAAA,KALuB;AAMvBC,IAAAA;AANuB,GAOpB;AACH,QAAMC,YAAY,GAAGjB,OAAO,CAAE,MAAM;AACnC,WAAOa,MAAM,CAACK,GAAP,CAAY,QAAmBC,KAAnB,KAA8B;AAAA,UAA5B;AAAEC,QAAAA,KAAF;AAASC,QAAAA;AAAT,OAA4B;AAChD,YAAMC,WAAW,GAAG7B,MAAM,CAAE2B,KAAF,CAA1B;AACA,YAAMG,UAAU,GAAGR,KAAK,KAAKK,KAA7B;AAEA,aACC,cAAC,oBAAD,CAAsB,MAAtB;AACC,QAAA,GAAG,EAAI,GAAGA,KAAO,IAAID,KAAO,EAD7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AAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAGzC;AADX,OAGGf,EAAE,CAAE,OAAF,CAHL;AARH,IA7CD,CADD;AAgEA","sourcesContent":["// @ts-nocheck\n/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Flex, FlexItem } from '../flex';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading>{ name }</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\tcolors.length === index + 1 ? actions : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n} ) {\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t__unstableShift: true,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport const extractColorNameFromCurrentValue = (\n\tcurrentValue,\n\tcolors = [],\n\tshowMultiplePalettes = false\n) => {\n\tif ( ! currentValue ) {\n\t\treturn '';\n\t}\n\n\tconst currentValueIsCssVariable = /^var\\(/.test( currentValue );\n\tconst normalizedCurrentValue = currentValueIsCssVariable\n\t\t? currentValue\n\t\t: colord( currentValue ).toHex();\n\n\t// Normalize format of `colors` to simplify the following loop\n\tconst colorPalettes = showMultiplePalettes ? colors : [ { colors } ];\n\tfor ( const { colors: paletteColors } of colorPalettes ) {\n\t\tfor ( const { name: colorName, color: colorValue } of paletteColors ) {\n\t\t\tconst normalizedColorValue = currentValueIsCssVariable\n\t\t\t\t? colorValue\n\t\t\t\t: colord( colorValue ).toHex();\n\n\t\t\tif ( normalizedCurrentValue === normalizedColorValue ) {\n\t\t\t\treturn colorName;\n\t\t\t}\n\t\t}\n\t}\n\n\t// translators: shown when the user has picked a custom color (i.e not in the palette of colors).\n\treturn __( 'Custom' );\n};\n\nexport const showTransparentBackground = ( currentValue ) => {\n\tif ( typeof currentValue === 'undefined' ) {\n\t\treturn true;\n\t}\n\treturn colord( currentValue ).alpha() === 0;\n};\n\nexport default function ColorPalette( {\n\tclearable = true,\n\tclassName,\n\tcolors,\n\tdisableCustomColors = false,\n\tenableAlpha,\n\tonChange,\n\tvalue,\n\t__experimentalHasMultipleOrigins = false,\n\t__experimentalIsRenderedInSidebar = false,\n} ) {\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\tconst showMultiplePalettes =\n\t\t__experimentalHasMultipleOrigins && colors?.length;\n\tconst Component = showMultiplePalettes ? MultiplePalettes : SinglePalette;\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ value }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\n\tconst colordColor = colord( value );\n\n\tconst valueWithoutLeadingHash = value?.startsWith( '#' )\n\t\t? value.substring( 1 )\n\t\t: value ?? '';\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\tshowMultiplePalettes\n\t\t\t),\n\t\t[ value, colors, showMultiplePalettes ]\n\t);\n\n\tconst customColorAccessibleLabel = !! valueWithoutLeadingHash\n\t\t? sprintf(\n\t\t\t\t// translators: %1$s: The name of the color e.g: \"vivid red\". %2$s: The color's hex code e.g: \"#f00\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tvalueWithoutLeadingHash\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tas={ 'button' }\n\t\t\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tshowTransparentBackground( value )\n\t\t\t\t\t\t\t\t\t? { color: '#000' }\n\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\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\t\t<FlexItem\n\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\tas={ Truncate }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-name\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonLabelName }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\t\tas=\"span\"\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-value\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ valueWithoutLeadingHash }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<Component\n\t\t\t\tclearable={ clearable }\n\t\t\t\tclearColor={ clearColor }\n\t\t\t\tcolors={ colors }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tvalue={ value }\n\t\t\t\tactions={\n\t\t\t\t\t!! clearable && (\n\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\tonClick={ clearColor }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  * External dependencies
5
5
  */
6
6
  import { ScrollView, TouchableWithoutFeedback, View, Animated, Easing, Dimensions, Platform, Text } from 'react-native';
7
- import { map, uniq } from 'lodash';
7
+ import { map } from 'lodash';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
@@ -47,9 +47,9 @@ function ColorPalette(_ref) {
47
47
  const isGradientSegment = currentSegment === colorsUtils.segments[1];
48
48
  const scale = useRef(new Animated.Value(1)).current;
49
49
  const opacity = useRef(new Animated.Value(1)).current;
50
- const defaultColors = uniq(map(defaultSettings.colors, 'color'));
51
- const mergedColors = uniq(map(defaultSettings.allColors, 'color'));
52
- const defaultGradientColors = uniq(map(defaultSettings.gradients, 'gradient'));
50
+ const defaultColors = [...new Set(map(defaultSettings.colors, 'color'))];
51
+ const mergedColors = [...new Set(map(defaultSettings.allColors, 'color'))];
52
+ const defaultGradientColors = [...new Set(map(defaultSettings.gradients, 'gradient'))];
53
53
  const colors = isGradientSegment ? defaultGradientColors : defaultColors;
54
54
  const customIndicatorColor = isGradientSegment ? activeColor : customSwatchGradients;
55
55
  const isCustomGradientColor = isGradientColor && isSelectedCustom();
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/color-palette/index.native.js"],"names":["ScrollView","TouchableWithoutFeedback","View","Animated","Easing","Dimensions","Platform","Text","map","uniq","__","useRef","useEffect","usePreferredColorSchemeStyle","styles","ColorIndicator","colorsUtils","ANIMATION_DURATION","contentWidth","scrollPosition","customIndicatorWidth","ColorPalette","enableCustomColor","setColor","activeColor","isGradientColor","defaultSettings","currentSegment","onCustomPress","shouldEnableBottomSheetScroll","shouldShowCustomIndicatorOption","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","customColorIndicatorStyles","customIndicatorWrapperStyles","label","customSwatchGradients","scrollViewRef","isIOS","OS","isGradientSegment","segments","scale","Value","current","opacity","defaultColors","colors","mergedColors","allColors","defaultGradientColors","gradients","customIndicatorColor","isCustomGradientColor","isSelectedCustom","shouldShowCustomIndicator","accessibilityHint","customText","scrollToEndWithDelay","scrollTo","x","y","isWithinColors","includes","isSelected","color","timingAnimation","property","toValue","timing","duration","easing","ease","useNativeDriver","performAnimation","setValue","parallel","start","scaleInterpolation","interpolate","inputRange","outputRange","deselectCustomGradient","width","get","isVisible","onColorPress","onContentSizeChange","delayedScroll","setTimeout","scrollToEnd","clearTimeout","onCustomIndicatorLayout","nativeEvent","layout","onScroll","contentOffset","verticalSeparatorStyle","verticalSeparator","verticalSeparatorDark","customTextStyle","customTextAndroid","customTextDark","customIndicatorWrapperStyle","customIndicatorWrapper","headerText","contentContainer","scaleValue","selected","transform","colorIndicator","toUpperCase"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,UADD,EAECC,wBAFD,EAGCC,IAHD,EAICC,QAJD,EAKCC,MALD,EAMCC,UAND,EAOCC,QAPD,EAQCC,IARD,QASO,cATP;AAUA,SAASC,GAAT,EAAcC,IAAd,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,4BAAT,QAA6C,oBAA7C;AAEA;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,IAAA,UAAU,EAAGE,gBAAgB,EAH9B;AAIC,IAAA,KAAK,EAAG,CACPxC,MAAM,CAACgG,cADA,EAEP7E,0BAFO;AAJT,IADD,EAUGF,qBAAqB,IACtB,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGqE;AAAd,KACG9D,KAAK,GACJmB,UADI,GAEJA,UAAU,CAACsD,WAAX,EAHJ,CAXF,CARD,CAPD,CAvDF,CAPD,CADD;AAsGA;;AAED,eAAe1F,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tScrollView,\n\tTouchableWithoutFeedback,\n\tView,\n\tAnimated,\n\tEasing,\n\tDimensions,\n\tPlatform,\n\tText,\n} from 'react-native';\nimport { map, uniq } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport ColorIndicator from '../color-indicator';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nconst ANIMATION_DURATION = 200;\n\nlet contentWidth = 0;\nlet scrollPosition = 0;\nlet customIndicatorWidth = 0;\n\nfunction ColorPalette( {\n\tenableCustomColor = true,\n\tsetColor,\n\tactiveColor,\n\tisGradientColor,\n\tdefaultSettings,\n\tcurrentSegment,\n\tonCustomPress,\n\tshouldEnableBottomSheetScroll,\n\tshouldShowCustomIndicatorOption = true,\n\tshouldShowCustomLabel = true,\n\tshouldShowCustomVerticalSeparator = true,\n\tcustomColorIndicatorStyles,\n\tcustomIndicatorWrapperStyles,\n\tlabel,\n} ) {\n\tconst customSwatchGradients = [\n\t\t'linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)',\n\t\t'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)',\n\t\t'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)',\n\t];\n\n\tconst scrollViewRef = useRef();\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\n\tconst scale = useRef( new Animated.Value( 1 ) ).current;\n\tconst opacity = useRef( new Animated.Value( 1 ) ).current;\n\n\tconst defaultColors = uniq( map( defaultSettings.colors, 'color' ) );\n\tconst mergedColors = uniq( map( defaultSettings.allColors, 'color' ) );\n\tconst defaultGradientColors = uniq(\n\t\tmap( defaultSettings.gradients, 'gradient' )\n\t);\n\tconst colors = isGradientSegment ? defaultGradientColors : defaultColors;\n\n\tconst customIndicatorColor = isGradientSegment\n\t\t? activeColor\n\t\t: customSwatchGradients;\n\tconst isCustomGradientColor = isGradientColor && isSelectedCustom();\n\tconst shouldShowCustomIndicator =\n\t\tenableCustomColor &&\n\t\tshouldShowCustomIndicatorOption &&\n\t\t( ! isGradientSegment || isCustomGradientColor );\n\n\tconst accessibilityHint = isGradientSegment\n\t\t? __( 'Navigates to customize the gradient' )\n\t\t: __( 'Navigates to custom color picker' );\n\tconst customText = __( 'Custom' );\n\n\tuseEffect( () => {\n\t\tif ( scrollViewRef.current ) {\n\t\t\tif ( isSelectedCustom() ) {\n\t\t\t\tscrollToEndWithDelay();\n\t\t\t} else {\n\t\t\t\tscrollViewRef.current.scrollTo( { x: 0, y: 0 } );\n\t\t\t}\n\t\t}\n\t\t// Temporarily disabling exhuastive-deps until the component can be refactored and updated safely.\n\t\t// Please see https://github.com/WordPress/gutenberg/pull/41253 for discussion and details.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ currentSegment ] );\n\n\tfunction isSelectedCustom() {\n\t\tconst isWithinColors =\n\t\t\tactiveColor && mergedColors && mergedColors.includes( activeColor );\n\t\tif ( enableCustomColor && activeColor ) {\n\t\t\tif ( isGradientSegment ) {\n\t\t\t\treturn isGradientColor && ! isWithinColors;\n\t\t\t}\n\t\t\treturn ! isGradientColor && ! isWithinColors;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction isSelected( color ) {\n\t\treturn ! isSelectedCustom() && activeColor === color;\n\t}\n\n\tfunction timingAnimation( property, toValue ) {\n\t\treturn Animated.timing( property, {\n\t\t\ttoValue,\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: true,\n\t\t} );\n\t}\n\n\tfunction performAnimation( color ) {\n\t\tif ( ! isSelected( color ) ) {\n\t\t\topacity.setValue( 0 );\n\t\t}\n\n\t\tAnimated.parallel( [\n\t\t\ttimingAnimation( scale, 2 ),\n\t\t\ttimingAnimation( opacity, 1 ),\n\t\t] ).start( () => {\n\t\t\topacity.setValue( 1 );\n\t\t\tscale.setValue( 1 );\n\t\t} );\n\t}\n\n\tconst scaleInterpolation = scale.interpolate( {\n\t\tinputRange: [ 1, 1.5, 2 ],\n\t\toutputRange: [ 1, 0.7, 1 ],\n\t} );\n\n\tfunction deselectCustomGradient() {\n\t\tconst { width } = Dimensions.get( 'window' );\n\t\tconst isVisible =\n\t\t\tcontentWidth - scrollPosition - customIndicatorWidth < width;\n\n\t\tif ( isCustomGradientColor ) {\n\t\t\tif ( ! isIOS ) {\n\t\t\t\t// Scroll position on Android doesn't adjust automatically when removing the last item from the horizontal list.\n\t\t\t\t// https://github.com/facebook/react-native/issues/27504\n\t\t\t\t// Workaround: Force the scroll when deselecting custom gradient color and when custom indicator is visible on layout.\n\t\t\t\tif (\n\t\t\t\t\tisCustomGradientColor &&\n\t\t\t\t\tisVisible &&\n\t\t\t\t\tscrollViewRef.current\n\t\t\t\t) {\n\t\t\t\t\tscrollViewRef.current.scrollTo( {\n\t\t\t\t\t\tx: scrollPosition - customIndicatorWidth,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onColorPress( color ) {\n\t\tdeselectCustomGradient();\n\t\tperformAnimation( color );\n\t\tsetColor( color );\n\t}\n\n\tfunction onContentSizeChange( width ) {\n\t\tcontentWidth = width;\n\t\tif ( isSelectedCustom() && scrollViewRef.current ) {\n\t\t\tscrollToEndWithDelay();\n\t\t}\n\t}\n\n\tfunction scrollToEndWithDelay() {\n\t\tconst delayedScroll = setTimeout( () => {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t}, ANIMATION_DURATION );\n\t\treturn () => {\n\t\t\tclearTimeout( delayedScroll );\n\t\t};\n\t}\n\n\tfunction onCustomIndicatorLayout( { nativeEvent } ) {\n\t\tconst { width } = nativeEvent.layout;\n\t\tif ( width !== customIndicatorWidth ) {\n\t\t\tcustomIndicatorWidth = width;\n\t\t}\n\t}\n\n\tfunction onScroll( { nativeEvent } ) {\n\t\tscrollPosition = nativeEvent.contentOffset.x;\n\t}\n\n\tconst verticalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.verticalSeparator,\n\t\tstyles.verticalSeparatorDark\n\t);\n\n\tconst customTextStyle = usePreferredColorSchemeStyle(\n\t\t[ styles.customText, ! isIOS && styles.customTextAndroid ],\n\t\tstyles.customTextDark\n\t);\n\n\tconst customIndicatorWrapperStyle = [\n\t\tstyles.customIndicatorWrapper,\n\t\tcustomIndicatorWrapperStyles,\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{ label && (\n\t\t\t\t<Text accessibilityRole=\"header\" style={ styles.headerText }>\n\t\t\t\t\t{ label }\n\t\t\t\t</Text>\n\t\t\t) }\n\n\t\t\t<ScrollView\n\t\t\t\tcontentContainerStyle={ styles.contentContainer }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\tdisableScrollViewPanResponder\n\t\t\t\tscrollEventThrottle={ 16 }\n\t\t\t\tonScroll={ onScroll }\n\t\t\t\tonContentSizeChange={ onContentSizeChange }\n\t\t\t\tonScrollBeginDrag={ () =>\n\t\t\t\t\tshouldEnableBottomSheetScroll( false )\n\t\t\t\t}\n\t\t\t\tonScrollEndDrag={ () => shouldEnableBottomSheetScroll( true ) }\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\ttestID={ `color-palette${ label ? '-' + label : '' }` }\n\t\t\t>\n\t\t\t\t{ colors.map( ( color ) => {\n\t\t\t\t\tconst scaleValue = isSelected( color )\n\t\t\t\t\t\t? scaleInterpolation\n\t\t\t\t\t\t: 1;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View key={ `${ color }-${ isSelected( color ) }` }>\n\t\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\t\tonPress={ () => onColorPress( color ) }\n\t\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\t\tselected: isSelected( color ),\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taccessibilityHint={ color }\n\t\t\t\t\t\t\t\ttestID={ color }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Animated.View\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tscale: scaleValue,\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\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected( color ) }\n\t\t\t\t\t\t\t\t\t\topacity={ opacity }\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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</Animated.View>\n\t\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ shouldShowCustomIndicator && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ customIndicatorWrapperStyle }\n\t\t\t\t\t\tonLayout={ onCustomIndicatorLayout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCustomVerticalSeparator && (\n\t\t\t\t\t\t\t<View style={ verticalSeparatorStyle } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: isSelectedCustom(),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View style={ customIndicatorWrapperStyle }>\n\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\twithCustomPicker={ ! isGradientSegment }\n\t\t\t\t\t\t\t\t\tcolor={ customIndicatorColor }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelectedCustom() }\n\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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\t{ shouldShowCustomLabel && (\n\t\t\t\t\t\t\t\t\t<Text style={ customTextStyle }>\n\t\t\t\t\t\t\t\t\t\t{ isIOS\n\t\t\t\t\t\t\t\t\t\t\t? customText\n\t\t\t\t\t\t\t\t\t\t\t: customText.toUpperCase() }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</ScrollView>\n\t\t</>\n\t);\n}\n\nexport default ColorPalette;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/color-palette/index.native.js"],"names":["ScrollView","TouchableWithoutFeedback","View","Animated","Easing","Dimensions","Platform","Text","map","__","useRef","useEffect","usePreferredColorSchemeStyle","styles","ColorIndicator","colorsUtils","ANIMATION_DURATION","contentWidth","scrollPosition","customIndicatorWidth","ColorPalette","enableCustomColor","setColor","activeColor","isGradientColor","defaultSettings","currentSegment","onCustomPress","shouldEnableBottomSheetScroll","shouldShowCustomIndicatorOption","shouldShowCustomLabel","shouldShowCustomVerticalSeparator","customColorIndicatorStyles","customIndicatorWrapperStyles","label","customSwatchGradients","scrollViewRef","isIOS","OS","isGradientSegment","segments","scale","Value","current","opacity","defaultColors","Set","colors","mergedColors","allColors","defaultGradientColors","gradients","customIndicatorColor","isCustomGradientColor","isSelectedCustom","shouldShowCustomIndicator","accessibilityHint","customText","scrollToEndWithDelay","scrollTo","x","y","isWithinColors","includes","isSelected","color","timingAnimation","property","toValue","timing","duration","easing","ease","useNativeDriver","performAnimation","setValue","parallel","start","scaleInterpolation","interpolate","inputRange","outputRange","deselectCustomGradient","width","get","isVisible","onColorPress","onContentSizeChange","delayedScroll","setTimeout","scrollToEnd","clearTimeout","onCustomIndicatorLayout","nativeEvent","layout","onScroll","contentOffset","verticalSeparatorStyle","verticalSeparator","verticalSeparatorDark","customTextStyle","customTextAndroid","customTextDark","customIndicatorWrapperStyle","customIndicatorWrapper","headerText","contentContainer","scaleValue","selected","transform","colorIndicator","toUpperCase"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,UADD,EAECC,wBAFD,EAGCC,IAHD,EAICC,QAJD,EAKCC,MALD,EAMCC,UAND,EAOCC,QAPD,EAQCC,IARD,QASO,cATP;AAUA,SAASC,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC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;AANrB,KAQC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAG+C;AAAd,KACC,cAAC,cAAD;AACC,IAAA,gBAAgB,EAAG,CAAEhE,iBADtB;AAEC,IAAA,KAAK,EAAGa,oBAFT;AAGC,IAAA,UAAU,EAAGE,gBAAgB,EAH9B;AAIC,IAAA,KAAK,EAAG,CACPzC,MAAM,CAACiG,cADA,EAEP9E,0BAFO;AAJT,IADD,EAUGF,qBAAqB,IACtB,cAAC,IAAD;AAAM,IAAA,KAAK,EAAGsE;AAAd,KACG/D,KAAK,GACJoB,UADI,GAEJA,UAAU,CAACsD,WAAX,EAHJ,CAXF,CARD,CAPD,CAvDF,CAPD,CADD;AAsGA;;AAED,eAAe3F,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tScrollView,\n\tTouchableWithoutFeedback,\n\tView,\n\tAnimated,\n\tEasing,\n\tDimensions,\n\tPlatform,\n\tText,\n} from 'react-native';\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport ColorIndicator from '../color-indicator';\nimport { colorsUtils } from '../mobile/color-settings/utils';\n\nconst ANIMATION_DURATION = 200;\n\nlet contentWidth = 0;\nlet scrollPosition = 0;\nlet customIndicatorWidth = 0;\n\nfunction ColorPalette( {\n\tenableCustomColor = true,\n\tsetColor,\n\tactiveColor,\n\tisGradientColor,\n\tdefaultSettings,\n\tcurrentSegment,\n\tonCustomPress,\n\tshouldEnableBottomSheetScroll,\n\tshouldShowCustomIndicatorOption = true,\n\tshouldShowCustomLabel = true,\n\tshouldShowCustomVerticalSeparator = true,\n\tcustomColorIndicatorStyles,\n\tcustomIndicatorWrapperStyles,\n\tlabel,\n} ) {\n\tconst customSwatchGradients = [\n\t\t'linear-gradient(120deg, rgba(255,0,0,.8) 0%, rgba(255,255,255,1) 70.71%)',\n\t\t'linear-gradient(240deg, rgba(0,255,0,.8) 0%, rgba(0,255,0,0) 70.71%)',\n\t\t'linear-gradient(360deg, rgba(0,0,255,.8) 0%, rgba(0,0,255,0) 70.71%)',\n\t];\n\n\tconst scrollViewRef = useRef();\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst isGradientSegment = currentSegment === colorsUtils.segments[ 1 ];\n\n\tconst scale = useRef( new Animated.Value( 1 ) ).current;\n\tconst opacity = useRef( new Animated.Value( 1 ) ).current;\n\n\tconst defaultColors = [\n\t\t...new Set( map( defaultSettings.colors, 'color' ) ),\n\t];\n\tconst mergedColors = [\n\t\t...new Set( map( defaultSettings.allColors, 'color' ) ),\n\t];\n\tconst defaultGradientColors = [\n\t\t...new Set( map( defaultSettings.gradients, 'gradient' ) ),\n\t];\n\tconst colors = isGradientSegment ? defaultGradientColors : defaultColors;\n\n\tconst customIndicatorColor = isGradientSegment\n\t\t? activeColor\n\t\t: customSwatchGradients;\n\tconst isCustomGradientColor = isGradientColor && isSelectedCustom();\n\tconst shouldShowCustomIndicator =\n\t\tenableCustomColor &&\n\t\tshouldShowCustomIndicatorOption &&\n\t\t( ! isGradientSegment || isCustomGradientColor );\n\n\tconst accessibilityHint = isGradientSegment\n\t\t? __( 'Navigates to customize the gradient' )\n\t\t: __( 'Navigates to custom color picker' );\n\tconst customText = __( 'Custom' );\n\n\tuseEffect( () => {\n\t\tif ( scrollViewRef.current ) {\n\t\t\tif ( isSelectedCustom() ) {\n\t\t\t\tscrollToEndWithDelay();\n\t\t\t} else {\n\t\t\t\tscrollViewRef.current.scrollTo( { x: 0, y: 0 } );\n\t\t\t}\n\t\t}\n\t\t// Temporarily disabling exhuastive-deps until the component can be refactored and updated safely.\n\t\t// Please see https://github.com/WordPress/gutenberg/pull/41253 for discussion and details.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ currentSegment ] );\n\n\tfunction isSelectedCustom() {\n\t\tconst isWithinColors =\n\t\t\tactiveColor && mergedColors && mergedColors.includes( activeColor );\n\t\tif ( enableCustomColor && activeColor ) {\n\t\t\tif ( isGradientSegment ) {\n\t\t\t\treturn isGradientColor && ! isWithinColors;\n\t\t\t}\n\t\t\treturn ! isGradientColor && ! isWithinColors;\n\t\t}\n\t\treturn false;\n\t}\n\n\tfunction isSelected( color ) {\n\t\treturn ! isSelectedCustom() && activeColor === color;\n\t}\n\n\tfunction timingAnimation( property, toValue ) {\n\t\treturn Animated.timing( property, {\n\t\t\ttoValue,\n\t\t\tduration: ANIMATION_DURATION,\n\t\t\teasing: Easing.ease,\n\t\t\tuseNativeDriver: true,\n\t\t} );\n\t}\n\n\tfunction performAnimation( color ) {\n\t\tif ( ! isSelected( color ) ) {\n\t\t\topacity.setValue( 0 );\n\t\t}\n\n\t\tAnimated.parallel( [\n\t\t\ttimingAnimation( scale, 2 ),\n\t\t\ttimingAnimation( opacity, 1 ),\n\t\t] ).start( () => {\n\t\t\topacity.setValue( 1 );\n\t\t\tscale.setValue( 1 );\n\t\t} );\n\t}\n\n\tconst scaleInterpolation = scale.interpolate( {\n\t\tinputRange: [ 1, 1.5, 2 ],\n\t\toutputRange: [ 1, 0.7, 1 ],\n\t} );\n\n\tfunction deselectCustomGradient() {\n\t\tconst { width } = Dimensions.get( 'window' );\n\t\tconst isVisible =\n\t\t\tcontentWidth - scrollPosition - customIndicatorWidth < width;\n\n\t\tif ( isCustomGradientColor ) {\n\t\t\tif ( ! isIOS ) {\n\t\t\t\t// Scroll position on Android doesn't adjust automatically when removing the last item from the horizontal list.\n\t\t\t\t// https://github.com/facebook/react-native/issues/27504\n\t\t\t\t// Workaround: Force the scroll when deselecting custom gradient color and when custom indicator is visible on layout.\n\t\t\t\tif (\n\t\t\t\t\tisCustomGradientColor &&\n\t\t\t\t\tisVisible &&\n\t\t\t\t\tscrollViewRef.current\n\t\t\t\t) {\n\t\t\t\t\tscrollViewRef.current.scrollTo( {\n\t\t\t\t\t\tx: scrollPosition - customIndicatorWidth,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction onColorPress( color ) {\n\t\tdeselectCustomGradient();\n\t\tperformAnimation( color );\n\t\tsetColor( color );\n\t}\n\n\tfunction onContentSizeChange( width ) {\n\t\tcontentWidth = width;\n\t\tif ( isSelectedCustom() && scrollViewRef.current ) {\n\t\t\tscrollToEndWithDelay();\n\t\t}\n\t}\n\n\tfunction scrollToEndWithDelay() {\n\t\tconst delayedScroll = setTimeout( () => {\n\t\t\tscrollViewRef.current.scrollToEnd();\n\t\t}, ANIMATION_DURATION );\n\t\treturn () => {\n\t\t\tclearTimeout( delayedScroll );\n\t\t};\n\t}\n\n\tfunction onCustomIndicatorLayout( { nativeEvent } ) {\n\t\tconst { width } = nativeEvent.layout;\n\t\tif ( width !== customIndicatorWidth ) {\n\t\t\tcustomIndicatorWidth = width;\n\t\t}\n\t}\n\n\tfunction onScroll( { nativeEvent } ) {\n\t\tscrollPosition = nativeEvent.contentOffset.x;\n\t}\n\n\tconst verticalSeparatorStyle = usePreferredColorSchemeStyle(\n\t\tstyles.verticalSeparator,\n\t\tstyles.verticalSeparatorDark\n\t);\n\n\tconst customTextStyle = usePreferredColorSchemeStyle(\n\t\t[ styles.customText, ! isIOS && styles.customTextAndroid ],\n\t\tstyles.customTextDark\n\t);\n\n\tconst customIndicatorWrapperStyle = [\n\t\tstyles.customIndicatorWrapper,\n\t\tcustomIndicatorWrapperStyles,\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t{ label && (\n\t\t\t\t<Text accessibilityRole=\"header\" style={ styles.headerText }>\n\t\t\t\t\t{ label }\n\t\t\t\t</Text>\n\t\t\t) }\n\n\t\t\t<ScrollView\n\t\t\t\tcontentContainerStyle={ styles.contentContainer }\n\t\t\t\thorizontal\n\t\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\t\tkeyboardShouldPersistTaps=\"always\"\n\t\t\t\tdisableScrollViewPanResponder\n\t\t\t\tscrollEventThrottle={ 16 }\n\t\t\t\tonScroll={ onScroll }\n\t\t\t\tonContentSizeChange={ onContentSizeChange }\n\t\t\t\tonScrollBeginDrag={ () =>\n\t\t\t\t\tshouldEnableBottomSheetScroll( false )\n\t\t\t\t}\n\t\t\t\tonScrollEndDrag={ () => shouldEnableBottomSheetScroll( true ) }\n\t\t\t\tref={ scrollViewRef }\n\t\t\t\ttestID={ `color-palette${ label ? '-' + label : '' }` }\n\t\t\t>\n\t\t\t\t{ colors.map( ( color ) => {\n\t\t\t\t\tconst scaleValue = isSelected( color )\n\t\t\t\t\t\t? scaleInterpolation\n\t\t\t\t\t\t: 1;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<View key={ `${ color }-${ isSelected( color ) }` }>\n\t\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\t\tonPress={ () => onColorPress( color ) }\n\t\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\t\tselected: isSelected( color ),\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\taccessibilityHint={ color }\n\t\t\t\t\t\t\t\ttestID={ color }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Animated.View\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\ttransform: [\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tscale: scaleValue,\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\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\tcolor={ color }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected( color ) }\n\t\t\t\t\t\t\t\t\t\topacity={ opacity }\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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</Animated.View>\n\t\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ shouldShowCustomIndicator && (\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ customIndicatorWrapperStyle }\n\t\t\t\t\t\tonLayout={ onCustomIndicatorLayout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCustomVerticalSeparator && (\n\t\t\t\t\t\t\t<View style={ verticalSeparatorStyle } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<TouchableWithoutFeedback\n\t\t\t\t\t\t\tonPress={ onCustomPress }\n\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\taccessibilityState={ {\n\t\t\t\t\t\t\t\tselected: isSelectedCustom(),\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<View style={ customIndicatorWrapperStyle }>\n\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\twithCustomPicker={ ! isGradientSegment }\n\t\t\t\t\t\t\t\t\tcolor={ customIndicatorColor }\n\t\t\t\t\t\t\t\t\tisSelected={ isSelectedCustom() }\n\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\tstyles.colorIndicator,\n\t\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles,\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\t{ shouldShowCustomLabel && (\n\t\t\t\t\t\t\t\t\t<Text style={ customTextStyle }>\n\t\t\t\t\t\t\t\t\t\t{ isIOS\n\t\t\t\t\t\t\t\t\t\t\t? customText\n\t\t\t\t\t\t\t\t\t\t\t: customText.toUpperCase() }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t</ScrollView>\n\t\t</>\n\t);\n}\n\nexport default ColorPalette;\n"]}
@@ -4,7 +4,6 @@ import { createElement } from "@wordpress/element";
4
4
  * External dependencies
5
5
  */
6
6
  import classnames from 'classnames';
7
- import removeAccents from 'remove-accents';
8
7
  /**
9
8
  * WordPress dependencies
10
9
  */
@@ -26,6 +25,7 @@ import Button from '../button';
26
25
  import { FlexBlock, FlexItem } from '../flex';
27
26
  import withFocusOutside from '../higher-order/with-focus-outside';
28
27
  import { useControlledValue } from '../utils/hooks';
28
+ import { normalizeTextString } from '../utils/strings';
29
29
 
30
30
  const noop = () => {};
31
31
 
@@ -44,6 +44,8 @@ function ComboboxControl(_ref) {
44
44
  var _currentOption$label;
45
45
 
46
46
  let {
47
+ /** Start opting into the new margin-free styles that will become the default in a future version. */
48
+ __nextHasNoMarginBottom = false,
47
49
  __next36pxDefaultSize,
48
50
  value: valueProp,
49
51
  label,
@@ -77,9 +79,9 @@ function ComboboxControl(_ref) {
77
79
  const matchingSuggestions = useMemo(() => {
78
80
  const startsWithMatch = [];
79
81
  const containsMatch = [];
80
- const match = removeAccents(inputValue.toLocaleLowerCase());
82
+ const match = normalizeTextString(inputValue);
81
83
  options.forEach(option => {
82
- const index = removeAccents(option.label).toLocaleLowerCase().indexOf(match);
84
+ const index = normalizeTextString(option.label).indexOf(match);
83
85
 
84
86
  if (index === 0) {
85
87
  startsWithMatch.push(option);
@@ -213,6 +215,7 @@ function ComboboxControl(_ref) {
213
215
  return createElement(DetectOutside, {
214
216
  onFocusOutside: onFocusOutside
215
217
  }, createElement(BaseControl, {
218
+ __nextHasNoMarginBottom: __nextHasNoMarginBottom,
216
219
  className: classnames(className, 'components-combobox-control'),
217
220
  tabIndex: "-1",
218
221
  label: label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/combobox-control/index.js"],"names":["classnames","removeAccents","__","_n","sprintf","Component","useState","useMemo","useRef","useEffect","useInstanceId","speak","closeSmall","InputWrapperFlex","TokenInput","SuggestionsList","BaseControl","Button","FlexBlock","FlexItem","withFocusOutside","useControlledValue","noop","DetectOutside","handleFocusOutside","event","props","onFocusOutside","render","children","ComboboxControl","__next36pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","setValue","currentOption","find","option","currentLabel","instanceId","selectedSuggestion","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","matchingSuggestions","startsWithMatch","containsMatch","match","toLocaleLowerCase","forEach","index","indexOf","push","concat","onSuggestionSelected","newSelectedSuggestion","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onInputChange","text","handleOnReset","current","focus","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","suggestion"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,OAAOC,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,SADD,EAECC,QAFD,EAGCC,OAHD,EAICC,MAJD,EAKCC,SALD,QAMO,oBANP;AAOA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,UAAjC;AACA,OAAOC,UAAP,MAAuB,iCAAvB;AACA,OAAOC,eAAP,MAA4B,sCAA5B;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA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P;AAIC,IAAA,KAAK,EAAGN,UAAU,GAAGI,UAAH,GAAgBR,YAJnC;AAKC,kBACCA,YAAY,GACR,GAAGA,YAAc,KAAKhB,KAAO,EADrB,GAET,IARL;AAUC,IAAA,OAAO,EAAGgD,OAVX;AAWC,IAAA,MAAM,EAAGD,MAXV;AAYC,IAAA,UAAU,EAAG3B,UAZd;AAaC,IAAA,uBAAuB,EAAGO,mBAAmB,CAACO,OAApB,CACzBhB,kBADyB,CAb3B;AAgBC,IAAA,QAAQ,EAAG+B;AAhBZ,IADD,CAHD,EAuBG1C,UAAU,IACX,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,oCADX;AAEC,IAAA,IAAI,EAAG7B,UAFR;AAGC,IAAA,QAAQ,EAAG,CAAEoB,KAHd;AAIC,IAAA,OAAO,EAAGqD,aAJX;AAKC,IAAA,KAAK,EAAGnF,EAAE,CAAE,OAAF;AALX,IADD,CAxBF,CALD,EAwCGoD,UAAU,IACX,cAAC,eAAD;AACC,IAAA,UAAU,EAAGH,UADd;AAEC,IAAA,KAAK,EAAG;AAAEjB,MAAAA,KAAK,EAAEwB;AAAT,KAFT;AAGC,IAAA,gBAAgB,EAAKiC,UAAF,IAClBA,UAAU,CAACzD,KAJb;AAMC,IAAA,WAAW,EAAG2B,mBANf;AAOC,IAAA,aAAa,EAAGA,mBAAmB,CAACO,OAApB,CACfhB,kBADe,CAPjB;AAUC,IAAA,OAAO,EAAGC,qBAVX;AAWC,IAAA,QAAQ,EAAGkB,oBAXZ;AAYC,IAAA,cAAc,MAZf;AAaC,IAAA,wBAAwB,EACvB1B;AAdF,IAzCF,CAXD,CADD,CADD;AA4EA;AACA;;AAED,eAAef,eAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\n\nconst noop = () => {};\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component {\n\t\thandleFocusOutside( event ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nfunction ComboboxControl( {\n\t__next36pxDefaultSize,\n\tvalue: valueProp,\n\tlabel,\n\toptions,\n\tonChange: onChangeProp,\n\tonFilterValueChange = noop,\n\thideLabelFromVision,\n\thelp,\n\tallowReset = true,\n\tclassName,\n\tmessages = {\n\t\tselected: __( 'Item selected.' ),\n\t},\n\t__experimentalRenderItem,\n} ) {\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef();\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch = [];\n\t\tconst containsMatch = [];\n\t\tconst match = removeAccents( inputValue.toLocaleLowerCase() );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = removeAccents( option.label )\n\t\t\t\t.toLocaleLowerCase()\n\t\t\t\t.indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options, value ] );\n\n\tconst onSuggestionSelected = ( newSelectedSuggestion ) => {\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = matchingSuggestions.indexOf( selectedSuggestion );\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown = ( event ) => {\n\t\tlet preventDefault = false;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.code ) {\n\t\t\tcase 'Enter':\n\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tsetIsExpanded( false );\n\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tsetIsExpanded( true );\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current.focus();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tmatchingSuggestions.indexOf( selectedSuggestion ) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-combobox-control'\n\t\t\t\t) }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tcurrentLabel\n\t\t\t\t\t\t\t\t\t\t? `${ currentLabel }, ${ label }`\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\tmatch={ { label: inputValue } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/combobox-control/index.js"],"names":["classnames","__","_n","sprintf","Component","useState","useMemo","useRef","useEffect","useInstanceId","speak","closeSmall","InputWrapperFlex","TokenInput","SuggestionsList","BaseControl","Button","FlexBlock","FlexItem","withFocusOutside","useControlledValue","normalizeTextString","noop","DetectOutside","handleFocusOutside","event","props","onFocusOutside","render","children","ComboboxControl","__nextHasNoMarginBottom","__next36pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","setValue","currentOption","find","option","currentLabel","instanceId","selectedSuggestion","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","matchingSuggestions","startsWithMatch","containsMatch","match","forEach","index","indexOf","push","concat","onSuggestionSelected","newSelectedSuggestion","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onInputChange","text","handleOnReset","current","focus","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","suggestion"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,SADD,EAECC,QAFD,EAGCC,OAHD,EAICC,MAJD,EAKCC,SALD,QAMO,oBANP;AAOA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,UAAjC;AACA,OAAOC,UAAP,MAAuB,iCAAvB;AACA,OAAOC,eAAP,MAA4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classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\n\nconst noop = () => {};\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component {\n\t\thandleFocusOutside( event ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nfunction ComboboxControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__next36pxDefaultSize,\n\tvalue: valueProp,\n\tlabel,\n\toptions,\n\tonChange: onChangeProp,\n\tonFilterValueChange = noop,\n\thideLabelFromVision,\n\thelp,\n\tallowReset = true,\n\tclassName,\n\tmessages = {\n\t\tselected: __( 'Item selected.' ),\n\t},\n\t__experimentalRenderItem,\n} ) {\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef();\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch = [];\n\t\tconst containsMatch = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options, value ] );\n\n\tconst onSuggestionSelected = ( newSelectedSuggestion ) => {\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = matchingSuggestions.indexOf( selectedSuggestion );\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown = ( event ) => {\n\t\tlet preventDefault = false;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.code ) {\n\t\t\tcase 'Enter':\n\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tsetIsExpanded( false );\n\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tsetIsExpanded( true );\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current.focus();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tmatchingSuggestions.indexOf( selectedSuggestion ) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-combobox-control'\n\t\t\t\t) }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tcurrentLabel\n\t\t\t\t\t\t\t\t\t\t? `${ currentLabel }, ${ label }`\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\tmatch={ { label: inputValue } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/gradient-bar/constants.js"],"names":["GRADIENT_MARKERS_WIDTH","INSERT_POINT_WIDTH","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT","MINIMUM_DISTANCE_BETWEEN_POINTS","MINIMUM_SIGNIFICANT_MOVE","KEYBOARD_CONTROL_POINT_VARIATION","MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER"],"mappings":"AAAA,OAAO,MAAMA,sBAAsB,GAAG,EAA/B;AACP,OAAO,MAAMC,kBAAkB,GAAG,EAA3B;AACP,OAAO,MAAMC,2CAA2C,GAAG,EAApD;AACP,OAAO,MAAMC,+BAA+B,GAAG,CAAxC;AACP,OAAO,MAAMC,wBAAwB,GAAG,CAAjC;AAEP,OAAO,MAAMC,gCAAgC,GAC5CH,2CADM;AAEP,OAAO,MAAMI,4CAA4C,GACxD,CAAEL,kBAAkB,GAAGD,sBAAvB,IAAkD,CAD5C","sourcesContent":["export const GRADIENT_MARKERS_WIDTH = 16;\nexport const INSERT_POINT_WIDTH = 16;\nexport const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;\nexport const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;\nexport const MINIMUM_SIGNIFICANT_MOVE = 5;\n\nexport const KEYBOARD_CONTROL_POINT_VARIATION =\n\tMINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;\nexport const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER =\n\t( INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH ) / 2;\n"]}
@@ -14,15 +14,15 @@ import { useInstanceId } from '@wordpress/compose';
14
14
  import { useEffect, useRef, useState, useMemo } from '@wordpress/element';
15
15
  import { __, sprintf } from '@wordpress/i18n';
16
16
  import { plus } from '@wordpress/icons';
17
- import { LEFT, RIGHT } from '@wordpress/keycodes';
18
17
  /**
19
18
  * Internal dependencies
20
19
  */
21
20
 
22
- import Button from '../button';
23
- import { ColorPicker } from '../color-picker';
24
- import { VisuallyHidden } from '../visually-hidden';
25
- import { CustomColorPickerDropdown } from '../color-palette';
21
+ import Button from '../../button';
22
+ import { HStack } from '../../h-stack';
23
+ import { ColorPicker } from '../../color-picker';
24
+ import { VisuallyHidden } from '../../visually-hidden';
25
+ import { CustomColorPickerDropdown } from '../../color-palette';
26
26
  import { addControlPoint, clampPercent, removeControlPoint, updateControlPointColor, updateControlPointColorByPosition, updateControlPointPosition, getHorizontalRelativeGradientPosition } from './utils';
27
27
  import { MINIMUM_SIGNIFICANT_MOVE, KEYBOARD_CONTROL_POINT_VARIATION } from './constants';
28
28
 
@@ -43,11 +43,7 @@ function ControlPointButton(_ref) {
43
43
  "aria-expanded": isOpen,
44
44
  className: classnames('components-custom-gradient-picker__control-point-button', {
45
45
  'is-active': isOpen
46
- }),
47
- style: {
48
- left: `${position}%`,
49
- transform: 'translateX( -50% )'
50
- }
46
+ })
51
47
  }, additionalProps)), createElement(VisuallyHidden, {
52
48
  id: descriptionId
53
49
  }, __('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.')));
@@ -56,25 +52,19 @@ function ControlPointButton(_ref) {
56
52
  function GradientColorPickerDropdown(_ref2) {
57
53
  let {
58
54
  isRenderedInSidebar,
59
- gradientPickerDomRef,
55
+ className,
60
56
  ...props
61
57
  } = _ref2;
62
- const popoverProps = useMemo(() => {
63
- const result = {
64
- className: 'components-custom-gradient-picker__color-picker-popover',
65
- position: 'top'
66
- };
67
-
68
- if (isRenderedInSidebar) {
69
- result.anchorRef = gradientPickerDomRef.current;
70
- result.position = 'bottom left';
71
- }
72
-
73
- return result;
74
- }, [gradientPickerDomRef, isRenderedInSidebar]);
58
+ // Open the popover below the gradient control/insertion point
59
+ const popoverProps = useMemo(() => ({
60
+ placement: 'bottom',
61
+ offset: 8
62
+ }), []);
63
+ const mergedClassName = classnames('components-custom-gradient-picker__control-point-dropdown', className);
75
64
  return createElement(CustomColorPickerDropdown, _extends({
76
65
  isRenderedInSidebar: isRenderedInSidebar,
77
- popoverProps: popoverProps
66
+ popoverProps: popoverProps,
67
+ className: mergedClassName
78
68
  }, props));
79
69
  }
80
70
 
@@ -129,7 +119,6 @@ function ControlPoints(_ref3) {
129
119
  return controlPoints.map((point, index) => {
130
120
  const initialPosition = point === null || point === void 0 ? void 0 : point.position;
131
121
  return ignoreMarkerPosition !== initialPosition && createElement(GradientColorPickerDropdown, {
132
- gradientPickerDomRef: gradientPickerDomRef,
133
122
  isRenderedInSidebar: __experimentalIsRenderedInSidebar,
134
123
  key: index,
135
124
  onClose: onStopControlPointChange,
@@ -167,12 +156,12 @@ function ControlPoints(_ref3) {
167
156
  }
168
157
  },
169
158
  onKeyDown: event => {
170
- if (event.keyCode === LEFT) {
159
+ if (event.code === 'ArrowLeft') {
171
160
  // Stop propagation of the key press event to avoid focus moving
172
161
  // to another editor area.
173
162
  event.stopPropagation();
174
163
  onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position - KEYBOARD_CONTROL_POINT_VARIATION)));
175
- } else if (event.keyCode === RIGHT) {
164
+ } else if (event.code === 'ArrowRight') {
176
165
  // Stop propagation of the key press event to avoid focus moving
177
166
  // to another editor area.
178
167
  event.stopPropagation();
@@ -194,14 +183,20 @@ function ControlPoints(_ref3) {
194
183
  onChange: color => {
195
184
  onChange(updateControlPointColor(controlPoints, index, colord(color).toRgbString()));
196
185
  }
197
- }), !disableRemove && controlPoints.length > 2 && createElement(Button, {
198
- className: "components-custom-gradient-picker__remove-control-point",
186
+ }), !disableRemove && controlPoints.length > 2 && createElement(HStack, {
187
+ className: "components-custom-gradient-picker__remove-control-point-wrapper",
188
+ alignment: "center"
189
+ }, createElement(Button, {
199
190
  onClick: () => {
200
191
  onChange(removeControlPoint(controlPoints, index));
201
192
  onClose();
202
193
  },
203
194
  variant: "link"
204
- }, __('Remove Control Point')));
195
+ }, __('Remove Control Point'))));
196
+ },
197
+ style: {
198
+ left: `${point.position}%`,
199
+ transform: 'translateX( -50% )'
205
200
  }
206
201
  });
207
202
  });
@@ -215,12 +210,10 @@ function InsertPoint(_ref6) {
215
210
  onCloseInserter,
216
211
  insertPosition,
217
212
  disableAlpha,
218
- __experimentalIsRenderedInSidebar,
219
- gradientPickerDomRef
213
+ __experimentalIsRenderedInSidebar
220
214
  } = _ref6;
221
215
  const [alreadyInsertedPoint, setAlreadyInsertedPoint] = useState(false);
222
216
  return createElement(GradientColorPickerDropdown, {
223
- gradientPickerDomRef: gradientPickerDomRef,
224
217
  isRenderedInSidebar: __experimentalIsRenderedInSidebar,
225
218
  className: "components-custom-gradient-picker__inserter",
226
219
  onClose: () => {
@@ -244,12 +237,8 @@ function InsertPoint(_ref6) {
244
237
 
245
238
  onToggle();
246
239
  },
247
- className: "components-custom-gradient-picker__insert-point",
248
- icon: plus,
249
- style: insertPosition !== null ? {
250
- left: `${insertPosition}%`,
251
- transform: 'translateX( -50% )'
252
- } : undefined
240
+ className: "components-custom-gradient-picker__insert-point-dropdown",
241
+ icon: plus
253
242
  });
254
243
  },
255
244
  renderContent: () => createElement(ColorPicker, {
@@ -262,7 +251,11 @@ function InsertPoint(_ref6) {
262
251
  onChange(updateControlPointColorByPosition(controlPoints, insertPosition, colord(color).toRgbString()));
263
252
  }
264
253
  }
265
- })
254
+ }),
255
+ style: insertPosition !== null ? {
256
+ left: `${insertPosition}%`,
257
+ transform: 'translateX( -50% )'
258
+ } : undefined
266
259
  });
267
260
  }
268
261