@wordpress/components 23.6.0 → 23.8.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 (484) hide show
  1. package/CHANGELOG.md +43 -4
  2. package/build/angle-picker-control/angle-circle.js +1 -4
  3. package/build/angle-picker-control/angle-circle.js.map +1 -1
  4. package/build/angle-picker-control/index.js +10 -22
  5. package/build/angle-picker-control/index.js.map +1 -1
  6. package/build/angle-picker-control/styles/angle-picker-control-styles.js +24 -15
  7. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  8. package/build/animate/index.js +27 -19
  9. package/build/animate/index.js.map +1 -1
  10. package/build/animate/types.js.map +1 -0
  11. package/build/box-control/axial-input-controls.js.map +1 -1
  12. package/build/color-picker/color-input.js +0 -4
  13. package/build/color-picker/color-input.js.map +1 -1
  14. package/build/color-picker/component.js +5 -4
  15. package/build/color-picker/component.js.map +1 -1
  16. package/build/color-picker/hex-input.js.map +1 -1
  17. package/build/color-picker/hsl-input.js.map +1 -1
  18. package/build/color-picker/input-with-slider.js.map +1 -1
  19. package/build/color-picker/legacy-adapter.js.map +1 -1
  20. package/build/color-picker/picker.js.map +1 -1
  21. package/build/color-picker/rgb-input.js.map +1 -1
  22. package/build/color-picker/use-deprecated-props.js.map +1 -1
  23. package/build/custom-gradient-picker/constants.js +1 -1
  24. package/build/custom-gradient-picker/constants.js.map +1 -1
  25. package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  26. package/build/custom-gradient-picker/gradient-bar/control-points.js +9 -5
  27. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  28. package/build/custom-gradient-picker/gradient-bar/index.js +14 -9
  29. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  30. package/build/custom-gradient-picker/gradient-bar/utils.js +34 -54
  31. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  32. package/build/custom-gradient-picker/index.js +45 -16
  33. package/build/custom-gradient-picker/index.js.map +1 -1
  34. package/build/custom-gradient-picker/serializer.js +10 -4
  35. package/build/custom-gradient-picker/serializer.js.map +1 -1
  36. package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  37. package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  38. package/build/custom-gradient-picker/types.js +6 -0
  39. package/build/custom-gradient-picker/types.js.map +1 -0
  40. package/build/custom-gradient-picker/utils.js +17 -12
  41. package/build/custom-gradient-picker/utils.js.map +1 -1
  42. package/build/drop-zone/index.js +8 -8
  43. package/build/drop-zone/index.js.map +1 -1
  44. package/build/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  45. package/build/duotone-picker/color-list-picker/index.js.map +1 -0
  46. package/build/duotone-picker/color-list-picker/types.js +6 -0
  47. package/build/duotone-picker/color-list-picker/types.js.map +1 -0
  48. package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
  49. package/build/duotone-picker/duotone-picker.js +39 -2
  50. package/build/duotone-picker/duotone-picker.js.map +1 -1
  51. package/build/duotone-picker/duotone-swatch.js.map +1 -1
  52. package/build/duotone-picker/index.js.map +1 -1
  53. package/build/duotone-picker/types.js +6 -0
  54. package/build/duotone-picker/types.js.map +1 -0
  55. package/build/duotone-picker/utils.js +13 -11
  56. package/build/duotone-picker/utils.js.map +1 -1
  57. package/build/form-token-field/index.js +9 -3
  58. package/build/form-token-field/index.js.map +1 -1
  59. package/build/gradient-picker/index.js +61 -9
  60. package/build/gradient-picker/index.js.map +1 -1
  61. package/build/gradient-picker/types.js +6 -0
  62. package/build/gradient-picker/types.js.map +1 -0
  63. package/build/index.js.map +1 -1
  64. package/build/mobile/keyboard-aware-flat-list/index.android.js +0 -4
  65. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  66. package/build/mobile/keyboard-aware-flat-list/index.ios.js +100 -55
  67. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  68. package/build/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +82 -0
  69. package/build/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js.map +1 -0
  70. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js +85 -0
  71. package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +1 -0
  72. package/build/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +44 -0
  73. package/build/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js.map +1 -0
  74. package/build/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +53 -0
  75. package/build/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js.map +1 -0
  76. package/build/navigator/navigator-provider/component.js +4 -2
  77. package/build/navigator/navigator-provider/component.js.map +1 -1
  78. package/build/navigator/navigator-screen/component.js +4 -3
  79. package/build/navigator/navigator-screen/component.js.map +1 -1
  80. package/build/palette-edit/index.js +1 -2
  81. package/build/palette-edit/index.js.map +1 -1
  82. package/build/private-apis.js.map +1 -1
  83. package/build/query-controls/author-select.js +2 -1
  84. package/build/query-controls/author-select.js.map +1 -1
  85. package/build/query-controls/category-select.js +3 -1
  86. package/build/query-controls/category-select.js.map +1 -1
  87. package/build/query-controls/index.js +7 -1
  88. package/build/query-controls/index.js.map +1 -1
  89. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  90. package/build/sandbox/index.native.js +129 -93
  91. package/build/sandbox/index.native.js.map +1 -1
  92. package/build/tab-panel/index.js +1 -1
  93. package/build/tab-panel/index.js.map +1 -1
  94. package/build/tools-panel/tools-panel/hook.js +45 -6
  95. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  96. package/build/utils/input/input-control.js +1 -1
  97. package/build/utils/input/input-control.js.map +1 -1
  98. package/build-module/angle-picker-control/angle-circle.js +1 -4
  99. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  100. package/build-module/angle-picker-control/index.js +12 -21
  101. package/build-module/angle-picker-control/index.js.map +1 -1
  102. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
  103. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  104. package/build-module/animate/index.js +25 -17
  105. package/build-module/animate/index.js.map +1 -1
  106. package/build-module/box-control/axial-input-controls.js.map +1 -1
  107. package/build-module/color-picker/color-input.js +0 -4
  108. package/build-module/color-picker/color-input.js.map +1 -1
  109. package/build-module/color-picker/component.js +3 -3
  110. package/build-module/color-picker/component.js.map +1 -1
  111. package/build-module/color-picker/hex-input.js.map +1 -1
  112. package/build-module/color-picker/hsl-input.js.map +1 -1
  113. package/build-module/color-picker/input-with-slider.js.map +1 -1
  114. package/build-module/color-picker/legacy-adapter.js.map +1 -1
  115. package/build-module/color-picker/picker.js +4 -0
  116. package/build-module/color-picker/picker.js.map +1 -1
  117. package/build-module/color-picker/rgb-input.js.map +1 -1
  118. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  119. package/build-module/custom-gradient-picker/constants.js +1 -1
  120. package/build-module/custom-gradient-picker/constants.js.map +1 -1
  121. package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  122. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -4
  123. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  124. package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -8
  125. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  126. package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -54
  127. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  128. package/build-module/custom-gradient-picker/index.js +44 -17
  129. package/build-module/custom-gradient-picker/index.js.map +1 -1
  130. package/build-module/custom-gradient-picker/serializer.js +10 -4
  131. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  132. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  133. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  134. package/build-module/custom-gradient-picker/types.js +2 -0
  135. package/build-module/custom-gradient-picker/utils.js +17 -12
  136. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  137. package/build-module/drop-zone/index.js +8 -8
  138. package/build-module/drop-zone/index.js.map +1 -1
  139. package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  140. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
  141. package/build-module/duotone-picker/color-list-picker/types.js +2 -0
  142. package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
  143. package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
  144. package/build-module/duotone-picker/duotone-picker.js +38 -2
  145. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  146. package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
  147. package/build-module/duotone-picker/index.js.map +1 -1
  148. package/build-module/duotone-picker/types.js +2 -0
  149. package/build-module/duotone-picker/types.js.map +1 -0
  150. package/build-module/duotone-picker/utils.js +17 -11
  151. package/build-module/duotone-picker/utils.js.map +1 -1
  152. package/build-module/form-token-field/index.js +9 -4
  153. package/build-module/form-token-field/index.js.map +1 -1
  154. package/build-module/gradient-picker/index.js +61 -10
  155. package/build-module/gradient-picker/index.js.map +1 -1
  156. package/build-module/gradient-picker/types.js +2 -0
  157. package/build-module/gradient-picker/types.js.map +1 -0
  158. package/build-module/index.js.map +1 -1
  159. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +0 -4
  160. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  161. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +97 -54
  162. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  163. package/build-module/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +73 -0
  164. package/build-module/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js.map +1 -0
  165. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js +76 -0
  166. package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +1 -0
  167. package/build-module/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +33 -0
  168. package/build-module/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js.map +1 -0
  169. package/build-module/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +40 -0
  170. package/build-module/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js.map +1 -0
  171. package/build-module/navigator/navigator-provider/component.js +4 -2
  172. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  173. package/build-module/navigator/navigator-screen/component.js +4 -3
  174. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  175. package/build-module/palette-edit/index.js +1 -2
  176. package/build-module/palette-edit/index.js.map +1 -1
  177. package/build-module/private-apis.js.map +1 -1
  178. package/build-module/query-controls/author-select.js +2 -1
  179. package/build-module/query-controls/author-select.js.map +1 -1
  180. package/build-module/query-controls/category-select.js +3 -1
  181. package/build-module/query-controls/category-select.js.map +1 -1
  182. package/build-module/query-controls/index.js +7 -2
  183. package/build-module/query-controls/index.js.map +1 -1
  184. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  185. package/build-module/sandbox/index.native.js +121 -87
  186. package/build-module/sandbox/index.native.js.map +1 -1
  187. package/build-module/tab-panel/index.js +2 -2
  188. package/build-module/tab-panel/index.js.map +1 -1
  189. package/build-module/tools-panel/tools-panel/hook.js +45 -6
  190. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  191. package/build-module/utils/input/input-control.js +1 -1
  192. package/build-module/utils/input/input-control.js.map +1 -1
  193. package/build-style/style-rtl.css +41 -29
  194. package/build-style/style.css +43 -29
  195. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  196. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  197. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +6 -1
  198. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  199. package/build-types/animate/index.d.ts +27 -22
  200. package/build-types/animate/index.d.ts.map +1 -1
  201. package/build-types/animate/stories/index.d.ts +18 -0
  202. package/build-types/animate/stories/index.d.ts.map +1 -0
  203. package/build-types/animate/types.d.ts +30 -0
  204. package/build-types/animate/types.d.ts.map +1 -0
  205. package/build-types/border-box-control/border-box-control/hook.d.ts +2 -2
  206. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +2 -2
  207. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +2 -2
  208. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +2 -2
  209. package/build-types/border-control/border-control/hook.d.ts +2 -2
  210. package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
  211. package/build-types/border-control/border-control-style-picker/hook.d.ts +2 -2
  212. package/build-types/box-control/styles/box-control-styles.d.ts +5 -5
  213. package/build-types/button/deprecated.d.ts +2 -2
  214. package/build-types/card/card/hook.d.ts +2 -2
  215. package/build-types/card/card-body/hook.d.ts +2 -2
  216. package/build-types/card/card-divider/hook.d.ts +2 -2
  217. package/build-types/card/card-footer/hook.d.ts +2 -2
  218. package/build-types/card/card-header/hook.d.ts +2 -2
  219. package/build-types/card/card-media/hook.d.ts +2 -2
  220. package/build-types/color-palette/styles.d.ts +1 -1
  221. package/build-types/color-picker/color-input.d.ts +1 -11
  222. package/build-types/color-picker/color-input.d.ts.map +1 -1
  223. package/build-types/color-picker/component.d.ts +8 -9
  224. package/build-types/color-picker/component.d.ts.map +1 -1
  225. package/build-types/color-picker/hex-input.d.ts +1 -10
  226. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  227. package/build-types/color-picker/hsl-input.d.ts +1 -10
  228. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  229. package/build-types/color-picker/input-with-slider.d.ts +1 -9
  230. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  231. package/build-types/color-picker/legacy-adapter.d.ts +1 -3
  232. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  233. package/build-types/color-picker/picker.d.ts +4 -7
  234. package/build-types/color-picker/picker.d.ts.map +1 -1
  235. package/build-types/color-picker/rgb-input.d.ts +1 -10
  236. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  237. package/build-types/color-picker/stories/index.d.ts +19 -0
  238. package/build-types/color-picker/stories/index.d.ts.map +1 -0
  239. package/build-types/color-picker/styles.d.ts +5 -5
  240. package/build-types/color-picker/test/index.d.ts +2 -0
  241. package/build-types/color-picker/test/index.d.ts.map +1 -0
  242. package/build-types/color-picker/types.d.ts +105 -1
  243. package/build-types/color-picker/types.d.ts.map +1 -1
  244. package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
  245. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  246. package/build-types/combobox-control/styles.d.ts +1 -1
  247. package/build-types/custom-gradient-picker/constants.d.ts +8 -8
  248. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
  249. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +7 -7
  250. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -1
  251. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +5 -22
  252. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  253. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +3 -9
  254. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  255. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
  256. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
  257. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +44 -92
  258. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -1
  259. package/build-types/custom-gradient-picker/index.d.ts +27 -6
  260. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  261. package/build-types/custom-gradient-picker/serializer.d.ts +9 -16
  262. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  263. package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
  264. package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
  265. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +3 -2
  266. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -1
  267. package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
  268. package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
  269. package/build-types/custom-gradient-picker/types.d.ts +118 -0
  270. package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
  271. package/build-types/custom-gradient-picker/utils.d.ts +12 -4
  272. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -1
  273. package/build-types/date-time/date/styles.d.ts +2 -2
  274. package/build-types/date-time/date-time/styles.d.ts +1 -1
  275. package/build-types/date-time/time/styles.d.ts +8 -8
  276. package/build-types/drop-zone/index.d.ts.map +1 -1
  277. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
  278. package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +2 -2
  279. package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
  280. package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
  281. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
  282. package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
  283. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
  284. package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
  285. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
  286. package/build-types/duotone-picker/index.d.ts +3 -0
  287. package/build-types/duotone-picker/index.d.ts.map +1 -0
  288. package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
  289. package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
  290. package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
  291. package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
  292. package/build-types/duotone-picker/types.d.ts +60 -0
  293. package/build-types/duotone-picker/types.d.ts.map +1 -0
  294. package/build-types/duotone-picker/utils.d.ts +52 -0
  295. package/build-types/duotone-picker/utils.d.ts.map +1 -0
  296. package/build-types/elevation/hook.d.ts +2 -2
  297. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  298. package/build-types/flex/flex/hook.d.ts +2 -2
  299. package/build-types/flex/flex-block/hook.d.ts +2 -2
  300. package/build-types/flex/flex-item/hook.d.ts +2 -2
  301. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -2
  302. package/build-types/form-token-field/index.d.ts.map +1 -1
  303. package/build-types/form-token-field/styles.d.ts +1 -1
  304. package/build-types/form-token-field/types.d.ts +6 -0
  305. package/build-types/form-token-field/types.d.ts.map +1 -1
  306. package/build-types/gradient-picker/index.d.ts +49 -11
  307. package/build-types/gradient-picker/index.d.ts.map +1 -1
  308. package/build-types/gradient-picker/stories/index.d.ts +14 -0
  309. package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
  310. package/build-types/gradient-picker/types.d.ts +87 -0
  311. package/build-types/gradient-picker/types.d.ts.map +1 -0
  312. package/build-types/grid/hook.d.ts +2 -2
  313. package/build-types/h-stack/hook.d.ts +2 -2
  314. package/build-types/heading/hook.d.ts +2 -2
  315. package/build-types/index.d.ts +128 -0
  316. package/build-types/index.d.ts.map +1 -0
  317. package/build-types/input-control/styles/input-control-styles.d.ts +2 -2
  318. package/build-types/item-group/item/hook.d.ts +2 -2
  319. package/build-types/item-group/item-group/hook.d.ts +2 -2
  320. package/build-types/navigation/styles/navigation-styles.d.ts +2 -2
  321. package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
  322. package/build-types/navigator/navigator-button/hook.d.ts +2 -2
  323. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  324. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  325. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  326. package/build-types/navigator/stories/index.d.ts +1 -0
  327. package/build-types/navigator/stories/index.d.ts.map +1 -1
  328. package/build-types/navigator/types.d.ts +2 -2
  329. package/build-types/navigator/types.d.ts.map +1 -1
  330. package/build-types/number-control/index.d.ts +2 -2
  331. package/build-types/number-control/stories/index.d.ts +2 -2
  332. package/build-types/palette-edit/index.d.ts.map +1 -1
  333. package/build-types/palette-edit/styles.d.ts +3 -3
  334. package/build-types/popover/index.d.ts +1 -1
  335. package/build-types/popover/stories/e2e/index.d.ts +1 -1
  336. package/build-types/private-apis.d.ts +2 -3
  337. package/build-types/private-apis.d.ts.map +1 -1
  338. package/build-types/query-controls/author-select.d.ts.map +1 -1
  339. package/build-types/query-controls/category-select.d.ts.map +1 -1
  340. package/build-types/query-controls/index.d.ts.map +1 -1
  341. package/build-types/range-control/index.d.ts +1 -1
  342. package/build-types/range-control/styles/range-control-styles.d.ts +2 -2
  343. package/build-types/resizable-box/index.d.ts +1 -1
  344. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  345. package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
  346. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  347. package/build-types/resizable-box/stories/index.d.ts +2 -2
  348. package/build-types/scrollable/hook.d.ts +2 -2
  349. package/build-types/search-control/index.d.ts +1 -1
  350. package/build-types/search-control/stories/index.d.ts +2 -2
  351. package/build-types/spacer/hook.d.ts +2 -2
  352. package/build-types/spinner/index.d.ts +1 -1
  353. package/build-types/surface/hook.d.ts +2 -2
  354. package/build-types/tab-panel/index.d.ts.map +1 -1
  355. package/build-types/text/hook.d.ts +2 -2
  356. package/build-types/text-control/index.d.ts +1 -1
  357. package/build-types/toolbar/toolbar-button/index.d.ts +2 -2
  358. package/build-types/tools-panel/tools-panel/hook.d.ts +2 -2
  359. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  360. package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -2
  361. package/build-types/tools-panel/tools-panel-item/hook.d.ts +2 -2
  362. package/build-types/tools-panel/types.d.ts +1 -0
  363. package/build-types/tools-panel/types.d.ts.map +1 -1
  364. package/build-types/truncate/hook.d.ts +2 -2
  365. package/build-types/ui/control-group/hook.d.ts +2 -2
  366. package/build-types/ui/control-label/hook.d.ts +2 -2
  367. package/build-types/ui/form-group/form-group.d.ts +2 -2
  368. package/build-types/ui/form-group/use-form-group.d.ts +2 -2
  369. package/build-types/unit-control/index.d.ts +1 -1
  370. package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -2
  371. package/build-types/utils/input/input-control.d.ts.map +1 -1
  372. package/build-types/v-stack/hook.d.ts +2 -2
  373. package/package.json +20 -19
  374. package/src/angle-picker-control/angle-circle.tsx +0 -1
  375. package/src/angle-picker-control/index.tsx +14 -27
  376. package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
  377. package/src/animate/index.tsx +75 -0
  378. package/src/animate/stories/index.tsx +102 -0
  379. package/src/animate/types.ts +32 -0
  380. package/src/border-box-control/stories/index.tsx +1 -1
  381. package/src/box-control/axial-input-controls.tsx +1 -1
  382. package/src/circular-option-picker/style.scss +10 -0
  383. package/src/color-indicator/style.scss +1 -0
  384. package/src/color-picker/README.md +2 -2
  385. package/src/color-picker/color-input.tsx +1 -12
  386. package/src/color-picker/component.tsx +9 -18
  387. package/src/color-picker/hex-input.tsx +2 -7
  388. package/src/color-picker/hsl-input.tsx +2 -7
  389. package/src/color-picker/input-with-slider.tsx +1 -9
  390. package/src/color-picker/legacy-adapter.tsx +1 -2
  391. package/src/color-picker/picker.tsx +5 -6
  392. package/src/color-picker/rgb-input.tsx +2 -7
  393. package/src/color-picker/stories/index.tsx +51 -0
  394. package/src/color-picker/test/{index.js → index.tsx} +36 -18
  395. package/src/color-picker/types.ts +128 -1
  396. package/src/color-picker/use-deprecated-props.ts +2 -53
  397. package/src/combobox-control/stories/index.tsx +1 -1
  398. package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
  399. package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -134
  400. package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -10
  401. package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
  402. package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
  403. package/src/custom-gradient-picker/{index.js → index.tsx} +63 -22
  404. package/src/custom-gradient-picker/serializer.ts +78 -0
  405. package/src/custom-gradient-picker/stories/index.tsx +45 -0
  406. package/src/custom-gradient-picker/style.scss +25 -4
  407. package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
  408. package/src/custom-gradient-picker/types.ts +119 -0
  409. package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -22
  410. package/src/custom-select-control/test/index.js +6 -4
  411. package/src/drop-zone/index.tsx +12 -8
  412. package/src/drop-zone/style.scss +1 -1
  413. package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
  414. package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
  415. package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
  416. package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
  417. package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
  418. package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
  419. package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
  420. package/src/duotone-picker/types.ts +61 -0
  421. package/src/duotone-picker/{utils.js → utils.ts} +29 -14
  422. package/src/flex/flex-item/README.md +1 -1
  423. package/src/form-token-field/README.md +1 -0
  424. package/src/form-token-field/index.tsx +10 -3
  425. package/src/form-token-field/style.scss +0 -7
  426. package/src/form-token-field/test/index.tsx +1 -0
  427. package/src/form-token-field/types.ts +6 -0
  428. package/src/gradient-picker/README.md +16 -23
  429. package/src/gradient-picker/{index.js → index.tsx} +70 -16
  430. package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
  431. package/src/gradient-picker/types.ts +89 -0
  432. package/src/item-group/test/index.js +5 -3
  433. package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -4
  434. package/src/mobile/keyboard-aware-flat-list/index.ios.js +118 -67
  435. package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +203 -0
  436. package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-text-input.native.js +140 -0
  437. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +82 -0
  438. package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +147 -0
  439. package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +87 -0
  440. package/src/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js +105 -0
  441. package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +36 -0
  442. package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +54 -0
  443. package/src/navigator/navigator-provider/component.tsx +2 -0
  444. package/src/navigator/navigator-screen/component.tsx +5 -2
  445. package/src/navigator/stories/index.tsx +68 -0
  446. package/src/navigator/test/index.tsx +52 -0
  447. package/src/navigator/types.ts +2 -1
  448. package/src/palette-edit/index.tsx +4 -5
  449. package/src/query-controls/author-select.tsx +1 -0
  450. package/src/query-controls/category-select.tsx +1 -0
  451. package/src/query-controls/index.tsx +4 -2
  452. package/src/resizable-box/resize-tooltip/utils.ts +1 -1
  453. package/src/sandbox/index.native.js +139 -112
  454. package/src/slot-fill/test/slot.js +8 -6
  455. package/src/style.scss +1 -1
  456. package/src/tab-panel/index.tsx +7 -2
  457. package/src/tools-panel/test/index.tsx +86 -0
  458. package/src/tools-panel/tools-panel/hook.ts +44 -4
  459. package/src/tools-panel/types.ts +1 -0
  460. package/src/tooltip/test/index.js +251 -301
  461. package/src/utils/input/input-control.js +1 -0
  462. package/tsconfig.json +1 -3
  463. package/tsconfig.tsbuildinfo +1 -1
  464. package/build/color-list-picker/index.js.map +0 -1
  465. package/build-module/color-list-picker/index.js.map +0 -1
  466. package/build-types/color-list-picker/index.d.ts.map +0 -1
  467. package/build-types/color-list-picker/types.d.ts.map +0 -1
  468. package/src/animate/index.js +0 -60
  469. package/src/animate/stories/index.js +0 -53
  470. package/src/color-picker/stories/index.js +0 -41
  471. package/src/custom-gradient-picker/gradient-bar/utils.js +0 -189
  472. package/src/custom-gradient-picker/serializer.js +0 -48
  473. package/src/custom-gradient-picker/stories/index.js +0 -33
  474. /package/build/{color-list-picker → animate}/types.js +0 -0
  475. /package/build-module/{color-list-picker → animate}/types.js +0 -0
  476. /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
  477. /package/{build/color-list-picker → build-module/custom-gradient-picker}/types.js.map +0 -0
  478. /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
  479. /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
  480. /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
  481. /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
  482. /package/src/duotone-picker/{index.js → index.ts} +0 -0
  483. /package/src/{index.js → index.ts} +0 -0
  484. /package/src/{private-apis.js → private-apis.ts} +0 -0
@@ -114,24 +114,21 @@ export function DropZoneComponent(_ref) {
114
114
  let children;
115
115
  const backdrop = {
116
116
  hidden: {
117
- scaleY: 0,
118
117
  opacity: 0
119
118
  },
120
119
  show: {
121
- scaleY: 1,
122
120
  opacity: 1,
123
121
  transition: {
124
122
  type: 'tween',
125
123
  duration: 0.2,
126
- delay: 0.1,
127
- delayChildren: 0.2
124
+ delay: 0,
125
+ delayChildren: 0.1
128
126
  }
129
127
  },
130
128
  exit: {
131
- scaleY: 1,
132
129
  opacity: 0,
133
130
  transition: {
134
- duration: 0.3,
131
+ duration: 0.2,
135
132
  delayChildren: 0
136
133
  }
137
134
  }
@@ -139,11 +136,14 @@ export function DropZoneComponent(_ref) {
139
136
  const foreground = {
140
137
  hidden: {
141
138
  opacity: 0,
142
- scale: 0.75
139
+ scale: 0.9
143
140
  },
144
141
  show: {
145
142
  opacity: 1,
146
- scale: 1
143
+ scale: 1,
144
+ transition: {
145
+ duration: 0.1
146
+ }
147
147
  },
148
148
  exit: {
149
149
  opacity: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/drop-zone/index.tsx"],"names":["classnames","__","useState","upload","Icon","getFilesFromDataTransfer","__experimentalUseDropZone","useDropZone","useReducedMotion","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","restProps","isDraggingOverDocument","setIsDraggingOverDocument","isDraggingOverElement","setIsDraggingOverElement","type","setType","ref","event","files","dataTransfer","html","getData","length","onDragStart","_type","types","includes","onDragEnd","undefined","onDragEnter","onDragLeave","disableMotion","children","backdrop","hidden","scaleY","opacity","show","transition","duration","delay","delayChildren","exit","foreground","scale","pointerEvents","classes"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,kBAA7B;AACA,SAASC,wBAAT,QAAyC,gBAAzC;AACA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,gBAFD,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,SACCC,gBAAgB,IAAIC,MADrB,EAECC,yBAAyB,IAAIC,eAF9B,QAGO,cAHP;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAT,OAOqD;AAAA,MAPzB;AAClCC,IAAAA,SADkC;AAElCC,IAAAA,KAFkC;AAGlCC,IAAAA,WAHkC;AAIlCC,IAAAA,UAJkC;AAKlCC,IAAAA,MALkC;AAMlC,OAAGC;AAN+B,GAOyB;AAC3D,QAAM,CAAEC,sBAAF,EAA0BC,yBAA1B,IACLnB,QAAQ,EADT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c,GAGd,cAAC,eAAD,QAAmBA,QAAnB,CAJF,CADD;AASA;AAED,eAAe7B,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { upload, Icon } from '@wordpress/icons';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\nimport type { DropType, DropZoneProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.\n *\n * ```jsx\n * import { DropZone } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDropZone = () => {\n * const [ hasDropped, setHasDropped ] = useState( false );\n *\n * return (\n * <div>\n * { hasDropped ? 'Dropped!' : 'Drop something here' }\n * <DropZone\n * onFilesDrop={ () => setHasDropped( true ) }\n * onHTMLDrop={ () => setHasDropped( true ) }\n * onDrop={ () => setHasDropped( true ) }\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function DropZoneComponent( {\n\tclassName,\n\tlabel,\n\tonFilesDrop,\n\tonHTMLDrop,\n\tonDrop,\n\t...restProps\n}: WordPressComponentProps< DropZoneProps, 'div', false > ) {\n\tconst [ isDraggingOverDocument, setIsDraggingOverDocument ] =\n\t\tuseState< boolean >();\n\tconst [ isDraggingOverElement, setIsDraggingOverElement ] =\n\t\tuseState< boolean >();\n\tconst [ type, setType ] = useState< DropType >();\n\tconst ref = useDropZone( {\n\t\tonDrop( event ) {\n\t\t\tconst files = event.dataTransfer\n\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t: [];\n\t\t\tconst html = event.dataTransfer?.getData( 'text/html' );\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( html && onHTMLDrop ) {\n\t\t\t\tonHTMLDrop( html );\n\t\t\t} else if ( files.length && onFilesDrop ) {\n\t\t\t\tonFilesDrop( files );\n\t\t\t} else if ( onDrop ) {\n\t\t\t\tonDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragStart( event ) {\n\t\t\tsetIsDraggingOverDocument( true );\n\n\t\t\tlet _type: DropType = 'default';\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( event.dataTransfer?.types.includes( 'text/html' ) ) {\n\t\t\t\t_type = 'html';\n\t\t\t} else if (\n\t\t\t\t// Check for the types because sometimes the files themselves\n\t\t\t\t// are only available on drop.\n\t\t\t\tevent.dataTransfer?.types.includes( 'Files' ) ||\n\t\t\t\t( event.dataTransfer\n\t\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t\t: []\n\t\t\t\t).length > 0\n\t\t\t) {\n\t\t\t\t_type = 'file';\n\t\t\t}\n\n\t\t\tsetType( _type );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tsetIsDraggingOverDocument( false );\n\t\t\tsetType( undefined );\n\t\t},\n\t\tonDragEnter() {\n\t\t\tsetIsDraggingOverElement( true );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t},\n\t} );\n\tconst disableMotion = useReducedMotion();\n\n\tlet children;\n\tconst backdrop = {\n\t\thidden: { scaleY: 0, opacity: 0 },\n\t\tshow: {\n\t\t\tscaleY: 1,\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: 0.2,\n\t\t\t\tdelay: 0.1,\n\t\t\t\tdelayChildren: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\tscaleY: 1,\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tdelayChildren: 0,\n\t\t\t},\n\t\t},\n\t};\n\n\tconst foreground = {\n\t\thidden: { opacity: 0, scale: 0.75 },\n\t\tshow: { opacity: 1, scale: 1 },\n\t\texit: { opacity: 0, scale: 0.9 },\n\t};\n\n\tif ( isDraggingOverElement ) {\n\t\tchildren = (\n\t\t\t<motion.div\n\t\t\t\tvariants={ backdrop }\n\t\t\t\tinitial={ disableMotion ? 'show' : 'hidden' }\n\t\t\t\tanimate=\"show\"\n\t\t\t\texit={ disableMotion ? 'show' : 'exit' }\n\t\t\t\tclassName=\"components-drop-zone__content\"\n\t\t\t\t// Without this, when this div is shown,\n\t\t\t\t// Safari calls a onDropZoneLeave causing a loop because of this bug\n\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=66547\n\t\t\t\tstyle={ { pointerEvents: 'none' } }\n\t\t\t>\n\t\t\t\t<motion.div variants={ foreground }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tclassName=\"components-drop-zone__content-icon\"\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"components-drop-zone__content-text\">\n\t\t\t\t\t\t{ label ? label : __( 'Drop files to upload' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t);\n\t}\n\n\tconst classes = classnames( 'components-drop-zone', className, {\n\t\t'is-active':\n\t\t\t( isDraggingOverDocument || isDraggingOverElement ) &&\n\t\t\t( ( type === 'file' && onFilesDrop ) ||\n\t\t\t\t( type === 'html' && onHTMLDrop ) ||\n\t\t\t\t( type === 'default' && onDrop ) ),\n\t\t'is-dragging-over-document': isDraggingOverDocument,\n\t\t'is-dragging-over-element': isDraggingOverElement,\n\t\t[ `is-dragging-${ type }` ]: !! type,\n\t} );\n\n\treturn (\n\t\t<div { ...restProps } ref={ ref } className={ classes }>\n\t\t\t{ disableMotion ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<AnimatePresence>{ children }</AnimatePresence>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default DropZoneComponent;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/drop-zone/index.tsx"],"names":["classnames","__","useState","upload","Icon","getFilesFromDataTransfer","__experimentalUseDropZone","useDropZone","useReducedMotion","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","restProps","isDraggingOverDocument","setIsDraggingOverDocument","isDraggingOverElement","setIsDraggingOverElement","type","setType","ref","event","files","dataTransfer","html","getData","length","onDragStart","_type","types","includes","onDragEnd","undefined","onDragEnter","onDragLeave","disableMotion","children","backdrop","hidden","opacity","show","transition","duration","delay","delayChildren","exit","foreground","scale","pointerEvents","classes"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,kBAA7B;AACA,SAASC,wBAAT,QAAyC,gBAAzC;AACA,SACCC,yBAAyB,IAAIC,WAD9B,EAECC,gBAFD,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,SACCC,gBAAgB,IAAIC,MADrB,EAECC,yBAAyB,IAAIC,eAF9B,QAGO,cAHP;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAT,OAOqD;AAAA,MAPzB;AAClCC,IAAAA,SADkC;AAElCC,IAAAA,KAFkC;AAGlCC,IAAAA,WAHkC;AAIlCC,IAAAA,UAJkC;AAKlCC,IAAAA,MALkC;AA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C,IAAA,SAAS,EAAG6B;AAA9C,MACGd,aAAa,GACdC,QADc,GAGd,cAAC,eAAD,QAAmBA,QAAnB,CAJF,CADD;AASA;AAED,eAAe7B,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { upload, Icon } from '@wordpress/icons';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\nimport type { DropType, DropZoneProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.\n *\n * ```jsx\n * import { DropZone } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDropZone = () => {\n * const [ hasDropped, setHasDropped ] = useState( false );\n *\n * return (\n * <div>\n * { hasDropped ? 'Dropped!' : 'Drop something here' }\n * <DropZone\n * onFilesDrop={ () => setHasDropped( true ) }\n * onHTMLDrop={ () => setHasDropped( true ) }\n * onDrop={ () => setHasDropped( true ) }\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function DropZoneComponent( {\n\tclassName,\n\tlabel,\n\tonFilesDrop,\n\tonHTMLDrop,\n\tonDrop,\n\t...restProps\n}: WordPressComponentProps< DropZoneProps, 'div', false > ) {\n\tconst [ isDraggingOverDocument, setIsDraggingOverDocument ] =\n\t\tuseState< boolean >();\n\tconst [ isDraggingOverElement, setIsDraggingOverElement ] =\n\t\tuseState< boolean >();\n\tconst [ type, setType ] = useState< DropType >();\n\tconst ref = useDropZone( {\n\t\tonDrop( event ) {\n\t\t\tconst files = event.dataTransfer\n\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t: [];\n\t\t\tconst html = event.dataTransfer?.getData( 'text/html' );\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( html && onHTMLDrop ) {\n\t\t\t\tonHTMLDrop( html );\n\t\t\t} else if ( files.length && onFilesDrop ) {\n\t\t\t\tonFilesDrop( files );\n\t\t\t} else if ( onDrop ) {\n\t\t\t\tonDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragStart( event ) {\n\t\t\tsetIsDraggingOverDocument( true );\n\n\t\t\tlet _type: DropType = 'default';\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( event.dataTransfer?.types.includes( 'text/html' ) ) {\n\t\t\t\t_type = 'html';\n\t\t\t} else if (\n\t\t\t\t// Check for the types because sometimes the files themselves\n\t\t\t\t// are only available on drop.\n\t\t\t\tevent.dataTransfer?.types.includes( 'Files' ) ||\n\t\t\t\t( event.dataTransfer\n\t\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t\t: []\n\t\t\t\t).length > 0\n\t\t\t) {\n\t\t\t\t_type = 'file';\n\t\t\t}\n\n\t\t\tsetType( _type );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tsetIsDraggingOverDocument( false );\n\t\t\tsetType( undefined );\n\t\t},\n\t\tonDragEnter() {\n\t\t\tsetIsDraggingOverElement( true );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t},\n\t} );\n\tconst disableMotion = useReducedMotion();\n\n\tlet children;\n\tconst backdrop = {\n\t\thidden: { opacity: 0 },\n\t\tshow: {\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: 0.2,\n\t\t\t\tdelay: 0,\n\t\t\t\tdelayChildren: 0.1,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.2,\n\t\t\t\tdelayChildren: 0,\n\t\t\t},\n\t\t},\n\t};\n\n\tconst foreground = {\n\t\thidden: { opacity: 0, scale: 0.9 },\n\t\tshow: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.1,\n\t\t\t},\n\t\t},\n\t\texit: { opacity: 0, scale: 0.9 },\n\t};\n\n\tif ( isDraggingOverElement ) {\n\t\tchildren = (\n\t\t\t<motion.div\n\t\t\t\tvariants={ backdrop }\n\t\t\t\tinitial={ disableMotion ? 'show' : 'hidden' }\n\t\t\t\tanimate=\"show\"\n\t\t\t\texit={ disableMotion ? 'show' : 'exit' }\n\t\t\t\tclassName=\"components-drop-zone__content\"\n\t\t\t\t// Without this, when this div is shown,\n\t\t\t\t// Safari calls a onDropZoneLeave causing a loop because of this bug\n\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=66547\n\t\t\t\tstyle={ { pointerEvents: 'none' } }\n\t\t\t>\n\t\t\t\t<motion.div variants={ foreground }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tclassName=\"components-drop-zone__content-icon\"\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"components-drop-zone__content-text\">\n\t\t\t\t\t\t{ label ? label : __( 'Drop files to upload' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t);\n\t}\n\n\tconst classes = classnames( 'components-drop-zone', className, {\n\t\t'is-active':\n\t\t\t( isDraggingOverDocument || isDraggingOverElement ) &&\n\t\t\t( ( type === 'file' && onFilesDrop ) ||\n\t\t\t\t( type === 'html' && onHTMLDrop ) ||\n\t\t\t\t( type === 'default' && onDrop ) ),\n\t\t'is-dragging-over-document': isDraggingOverDocument,\n\t\t'is-dragging-over-element': isDraggingOverElement,\n\t\t[ `is-dragging-${ type }` ]: !! type,\n\t} );\n\n\treturn (\n\t\t<div { ...restProps } ref={ ref } className={ classes }>\n\t\t\t{ disableMotion ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<AnimatePresence>{ children }</AnimatePresence>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default DropZoneComponent;\n"]}
@@ -9,11 +9,11 @@ import { swatch } from '@wordpress/icons';
9
9
  * Internal dependencies
10
10
  */
11
11
 
12
- import Button from '../button';
13
- import ColorPalette from '../color-palette';
14
- import ColorIndicator from '../color-indicator';
15
- import Icon from '../icon';
16
- import { HStack } from '../h-stack';
12
+ import Button from '../../button';
13
+ import ColorPalette from '../../color-palette';
14
+ import ColorIndicator from '../../color-indicator';
15
+ import Icon from '../../icon';
16
+ import { HStack } from '../../h-stack';
17
17
 
18
18
  function ColorOption(_ref) {
19
19
  let {
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/components/src/duotone-picker/color-list-picker/index.tsx"],"names":["useState","swatch","Button","ColorPalette","ColorIndicator","Icon","HStack","ColorOption","label","value","colors","disableCustomColors","enableAlpha","onChange","isOpen","setIsOpen","prev","ColorListPicker","labels","map","index","newColor","newColors","slice"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,cAAP,MAA2B,uBAA3B;AACA,OAAOC,IAAP,MAAiB,YAAjB;AACA,SAASC,MAAT,QAAuB,eAAvB;;AAGA,SAASC,WAAT,OAOsB;AAAA,MAPA;AACrBC,IAAAA,KADqB;AAErBC,IAAAA,KAFqB;AAGrBC,IAAAA,MAHqB;AAIrBC,IAAAA,mBAJqB;AAKrBC,IAAAA,WALqB;AAMrBC,IAAAA;AANqB,G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AAMC,IAAA,WAAW,EAAGC,WANf;AAOC,IAAA,QAAQ,EAAKS,QAAF,IAAgB;AAC1B,YAAMC,SAAmC,GACxCb,KAAK,CAACc,KAAN,EADD;AAEAD,MAAAA,SAAS,CAAEF,KAAF,CAAT,GAAqBC,QAArB;AACAR,MAAAA,QAAQ,CAAES,SAAF,CAAR;AACA;AAZF,IADC,CADH,CADD;AAoBA;;AAED,eAAeL,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { swatch } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport ColorPalette from '../../color-palette';\nimport ColorIndicator from '../../color-indicator';\nimport Icon from '../../icon';\nimport { HStack } from '../../h-stack';\nimport type { ColorListPickerProps, ColorOptionProps } from './types';\n\nfunction ColorOption( {\n\tlabel,\n\tvalue,\n\tcolors,\n\tdisableCustomColors,\n\tenableAlpha,\n\tonChange,\n}: ColorOptionProps ) {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tclassName=\"components-color-list-picker__swatch-button\"\n\t\t\t\tonClick={ () => setIsOpen( ( prev ) => ! prev ) }\n\t\t\t>\n\t\t\t\t<HStack justify=\"flex-start\" spacing={ 2 }>\n\t\t\t\t\t{ value ? (\n\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\tcolorValue={ value }\n\t\t\t\t\t\t\tclassName=\"components-color-list-picker__swatch-color\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Icon icon={ swatch } />\n\t\t\t\t\t) }\n\t\t\t\t\t<span>{ label }</span>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t\t{ isOpen && (\n\t\t\t\t<ColorPalette\n\t\t\t\t\tclassName=\"components-color-list-picker__color-picker\"\n\t\t\t\t\tcolors={ colors }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tclearable={ false }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction ColorListPicker( {\n\tcolors,\n\tlabels,\n\tvalue = [],\n\tdisableCustomColors,\n\tenableAlpha,\n\tonChange,\n}: ColorListPickerProps ) {\n\treturn (\n\t\t<div className=\"components-color-list-picker\">\n\t\t\t{ labels.map( ( label, index ) => (\n\t\t\t\t<ColorOption\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tvalue={ value[ index ] }\n\t\t\t\t\tcolors={ colors }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tconst newColors: ( string | undefined )[] =\n\t\t\t\t\t\t\tvalue.slice();\n\t\t\t\t\t\tnewColors[ index ] = newColor;\n\t\t\t\t\t\tonChange( newColors );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nexport default ColorListPicker;\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/duotone-picker/custom-duotone-bar.js"],"names":["CustomGradientBar","getColorStopsFromColors","getGradientFromCSSColors","getColorsFromColorStops","PLACEHOLDER_VALUES","CustomDuotoneBar","value","onChange","hasGradient","values","background","controlPoints","newColorStops","newValue"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,iBAAP,MAA8B,wCAA9B;AAEA,SACCC,uBADD,EAECC,wBAFD,EAGCC,uBAHD,QAIO,SAJP;AAMA,MAAMC,kBAAkB,GAAG,CAAE,MAAF,EAAU,MAAV,CAA3B;AAEA,eAAe,SAASC,gBAAT,OAAiD;AAAA,MAAtB;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAsB;AAC/D,QAAMC,WAAW,GAAG,CAAC,CAAEF,KAAvB;AACA,QAAMG,MAAM,GAAGD,WAAW,GAAGF,KAAH,GAAWF,kBAArC;AACA,QAAMM,UAAU,GAAGR,wBAAwB,CAAEO,MAAF,CAA3C;AACA,QAAME,aAAa,GAAGV,uBAAuB,CAAEQ,MAAF,CAA7C;AACA,SACC,cAAC,iBAAD;AACC,IAAA,eAAe,MADhB;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,WAAW,EAAGF,WAHf;AAIC,IAAA,KAAK,EAAGG,aAJT;AAKC,IAAA,QAAQ,EAAKC,aAAF,IAAqB;AAC/B,YAAMC,QAAQ,GAAGV,uBAAuB,CAAES,aAAF,CAAxC;AACAL,MAAAA,QAAQ,CAAEM,QAAF,CAAR;AACA;AARF,IADD;AAYA","sourcesContent":["/**\n * Internal dependencies\n */\nimport CustomGradientBar from '../custom-gradient-picker/gradient-bar';\n\nimport {\n\tgetColorStopsFromColors,\n\tgetGradientFromCSSColors,\n\tgetColorsFromColorStops,\n} from './utils';\n\nconst PLACEHOLDER_VALUES = [ '#333', '#CCC' ];\n\nexport default function CustomDuotoneBar( { value, onChange } ) {\n\tconst hasGradient = !! value;\n\tconst values = hasGradient ? value : PLACEHOLDER_VALUES;\n\tconst background = getGradientFromCSSColors( values );\n\tconst controlPoints = getColorStopsFromColors( values );\n\treturn (\n\t\t<CustomGradientBar\n\t\t\tdisableInserter\n\t\t\tbackground={ background }\n\t\t\thasGradient={ hasGradient }\n\t\t\tvalue={ controlPoints }\n\t\t\tonChange={ ( newColorStops ) => {\n\t\t\t\tconst newValue = getColorsFromColorStops( newColorStops );\n\t\t\t\tonChange( newValue );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/duotone-picker/custom-duotone-bar.tsx"],"names":["CustomGradientBar","getColorStopsFromColors","getGradientFromCSSColors","getColorsFromColorStops","PLACEHOLDER_VALUES","CustomDuotoneBar","value","onChange","hasGradient","values","background","controlPoints","newColorStops","newValue"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,iBAAP,MAA8B,wCAA9B;AAEA,SACCC,uBADD,EAECC,wBAFD,EAGCC,uBAHD,QAIO,SAJP;AAMA,MAAMC,kBAAkB,GAAG,CAAE,MAAF,EAAU,MAAV,CAA3B;AAEA,eAAe,SAASC,gBAAT,OAMX;AAAA,MANsC;AACzCC,IAAAA,KADyC;AAEzCC,IAAAA;AAFyC,GAMtC;AACH,QAAMC,WAAW,GAAG,CAAC,CAAEF,KAAvB;AACA,QAAMG,MAAM,GAAGD,WAAW,GAAGF,KAAH,GAAWF,kBAArC;AACA,QAAMM,UAAU,GAAGR,wBAAwB,CAAEO,MAAF,CAA3C;AACA,QAAME,aAAa,GAAGV,uBAAuB,CAAEQ,MAAF,CAA7C;AACA,SACC,cAAC,iBAAD;AACC,IAAA,eAAe,MADhB;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,WAAW,EAAGF,WAHf;AAIC,IAAA,KAAK,EAAGG,aAJT;AAKC,IAAA,QAAQ,EAAKC,aAAF,IAAqB;AAC/B,YAAMC,QAAQ,GAAGV,uBAAuB,CAAES,aAAF,CAAxC;AACAL,MAAAA,QAAQ,CAAEM,QAAF,CAAR;AACA;AARF,IADD;AAYA","sourcesContent":["/**\n * Internal dependencies\n */\nimport CustomGradientBar from '../custom-gradient-picker/gradient-bar';\n\nimport {\n\tgetColorStopsFromColors,\n\tgetGradientFromCSSColors,\n\tgetColorsFromColorStops,\n} from './utils';\n\nconst PLACEHOLDER_VALUES = [ '#333', '#CCC' ];\n\nexport default function CustomDuotoneBar( {\n\tvalue,\n\tonChange,\n}: {\n\tvalue?: string[];\n\tonChange: ( value?: string[] ) => void;\n} ) {\n\tconst hasGradient = !! value;\n\tconst values = hasGradient ? value : PLACEHOLDER_VALUES;\n\tconst background = getGradientFromCSSColors( values );\n\tconst controlPoints = getColorStopsFromColors( values );\n\treturn (\n\t\t<CustomGradientBar\n\t\t\tdisableInserter\n\t\t\tbackground={ background }\n\t\t\thasGradient={ hasGradient }\n\t\t\tvalue={ controlPoints }\n\t\t\tonChange={ ( newColorStops ) => {\n\t\t\t\tconst newValue = getColorsFromColorStops( newColorStops );\n\t\t\t\tonChange( newValue );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
@@ -14,13 +14,46 @@ import { __, sprintf } from '@wordpress/i18n';
14
14
  * Internal dependencies
15
15
  */
16
16
 
17
- import ColorListPicker from '../color-list-picker';
17
+ import ColorListPicker from './color-list-picker';
18
18
  import CircularOptionPicker from '../circular-option-picker';
19
19
  import { VStack } from '../v-stack';
20
20
  import CustomDuotoneBar from './custom-duotone-bar';
21
21
  import { getDefaultColors, getGradientFromCSSColors } from './utils';
22
22
  import { Spacer } from '../spacer';
23
23
 
24
+ /**
25
+ * ```jsx
26
+ * import { DuotonePicker, DuotoneSwatch } from '@wordpress/components';
27
+ * import { useState } from '@wordpress/element';
28
+ *
29
+ * const DUOTONE_PALETTE = [
30
+ * { colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' },
31
+ * { colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' },
32
+ * ];
33
+ *
34
+ * const COLOR_PALETTE = [
35
+ * { color: '#ff4747', name: 'Red', slug: 'red' },
36
+ * { color: '#fcff41', name: 'Yellow', slug: 'yellow' },
37
+ * { color: '#000097', name: 'Blue', slug: 'blue' },
38
+ * { color: '#8c00b7', name: 'Purple', slug: 'purple' },
39
+ * ];
40
+ *
41
+ * const Example = () => {
42
+ * const [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] );
43
+ * return (
44
+ * <>
45
+ * <DuotonePicker
46
+ * duotonePalette={ DUOTONE_PALETTE }
47
+ * colorPalette={ COLOR_PALETTE }
48
+ * value={ duotone }
49
+ * onChange={ setDuotone }
50
+ * />
51
+ * <DuotoneSwatch values={ duotone } />
52
+ * </>
53
+ * );
54
+ * };
55
+ * ```
56
+ */
24
57
  function DuotonePicker(_ref) {
25
58
  let {
26
59
  clearable = true,
@@ -98,7 +131,10 @@ function DuotonePicker(_ref) {
98
131
  newColors[1] = defaultLight;
99
132
  }
100
133
 
101
- const newValue = newColors.length >= 2 ? newColors : undefined;
134
+ const newValue = newColors.length >= 2 ? newColors : undefined; // @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors,
135
+ // but it's currently typed as a string[].
136
+ // See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035
137
+
102
138
  onChange(newValue);
103
139
  }
104
140
  }))));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/duotone-picker/duotone-picker.js"],"names":["fastDeepEqual","useMemo","__","sprintf","ColorListPicker","CircularOptionPicker","VStack","CustomDuotoneBar","getDefaultColors","getGradientFromCSSColors","Spacer","DuotonePicker","clearable","unsetable","colorPalette","duotonePalette","disableCustomColors","disableCustomDuotone","value","onChange","defaultDark","defaultLight","isUnset","unsetOption","undefined","options","map","colors","slug","name","style","background","color","tooltipText","label","isSelected","newColors","newValue","length"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,SAASC,MAAT,QAAuB,YAAvB;AAEA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASC,gBAAT,EAA2BC,wBAA3B,QAA2D,SAA3D;AACA,SAASC,MAAT,QAAuB,WAAvB;;AAEA,SAASC,aAAT,OASI;AAAA,MAToB;AACvBC,IAAAA,SAAS,GAAG,IADW;AAEvBC,IAAAA,SAAS,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B,SAAF,IAAiB;AAC3B,UAAK,CAAEA,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBhB,WAAjB;AACA;;AACD,UAAK,CAAEgB,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBf,YAAjB;AACA;;AACD,YAAMgB,QAAQ,GACbD,SAAS,CAACE,MAAV,IAAoB,CAApB,GACGF,SADH,GAEGZ,SAHJ;AAIAL,MAAAA,QAAQ,CAAEkB,QAAF,CAAR;AACA;AAlBF,IARF,CADD,CAZD,CADD;AA+CA;;AAED,eAAe1B,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorListPicker from '../color-list-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\n\nimport CustomDuotoneBar from './custom-duotone-bar';\nimport { getDefaultColors, getGradientFromCSSColors } from './utils';\nimport { Spacer } from '../spacer';\n\nfunction DuotonePicker( {\n\tclearable = true,\n\tunsetable = true,\n\tcolorPalette,\n\tduotonePalette,\n\tdisableCustomColors,\n\tdisableCustomDuotone,\n\tvalue,\n\tonChange,\n} ) {\n\tconst [ defaultDark, defaultLight ] = useMemo(\n\t\t() => getDefaultColors( colorPalette ),\n\t\t[ colorPalette ]\n\t);\n\n\tconst isUnset = value === 'unset';\n\n\tconst unsetOption = (\n\t\t<CircularOptionPicker.Option\n\t\t\tkey=\"unset\"\n\t\t\tvalue=\"unset\"\n\t\t\tisSelected={ isUnset }\n\t\t\ttooltipText={ __( 'Unset' ) }\n\t\t\tclassName=\"components-duotone-picker__color-indicator\"\n\t\t\tonClick={ () => {\n\t\t\t\tonChange( isUnset ? undefined : 'unset' );\n\t\t\t} }\n\t\t/>\n\t);\n\n\tconst options = duotonePalette.map( ( { colors, slug, name } ) => {\n\t\tconst style = {\n\t\t\tbackground: getGradientFromCSSColors( colors, '135deg' ),\n\t\t\tcolor: 'transparent',\n\t\t};\n\t\tconst tooltipText =\n\t\t\tname ??\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: duotone code e.g: \"dark-grayscale\" or \"7f7f7f-ffffff\".\n\t\t\t\t__( 'Duotone code: %s' ),\n\t\t\t\tslug\n\t\t\t);\n\t\tconst label = name\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The name of the option e.g: \"Dark grayscale\".\n\t\t\t\t\t__( 'Duotone: %s' ),\n\t\t\t\t\tname\n\t\t\t )\n\t\t\t: tooltipText;\n\t\tconst isSelected = fastDeepEqual( colors, value );\n\n\t\treturn (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ colors }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\taria-label={ label }\n\t\t\t\ttooltipText={ tooltipText }\n\t\t\t\tstyle={ style }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonChange( isSelected ? undefined : colors );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} );\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\toptions={ unsetable ? [ unsetOption, ...options ] : options }\n\t\t\tactions={\n\t\t\t\t!! clearable && (\n\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\tonClick={ () => onChange( undefined ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<Spacer paddingTop={ 4 }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t{ ! disableCustomColors && ! disableCustomDuotone && (\n\t\t\t\t\t\t<CustomDuotoneBar\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! disableCustomDuotone && (\n\t\t\t\t\t\t<ColorListPicker\n\t\t\t\t\t\t\tlabels={ [ __( 'Shadows' ), __( 'Highlights' ) ] }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t\tonChange={ ( newColors ) => {\n\t\t\t\t\t\t\t\tif ( ! newColors[ 0 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 0 ] = defaultDark;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( ! newColors[ 1 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 1 ] = defaultLight;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\t\t\tnewColors.length >= 2\n\t\t\t\t\t\t\t\t\t\t? newColors\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tonChange( newValue );\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</VStack>\n\t\t\t</Spacer>\n\t\t</CircularOptionPicker>\n\t);\n}\n\nexport default DuotonePicker;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/duotone-picker/duotone-picker.tsx"],"names":["fastDeepEqual","useMemo","__","sprintf","ColorListPicker","CircularOptionPicker","VStack","CustomDuotoneBar","getDefaultColors","getGradientFromCSSColors","Spacer","DuotonePicker","clearable","unsetable","colorPalette","duotonePalette","disableCustomColors","disableCustomDuotone","value","onChange","defaultDark","defaultLight","isUnset","unsetOption","undefined","options","map","colors","slug","name","style","background","color","tooltipText","label","isSelected","newColors","newValue","length"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MA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E,CAAE,OAAF,CAHL;AAJH,KAYC,cAAC,MAAD;AAAQ,IAAA,UAAU,EAAG;AAArB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACG,CAAEc,mBAAF,IAAyB,CAAEC,oBAA3B,IACD,cAAC,gBAAD;AACC,IAAA,KAAK,EAAGK,OAAO,GAAGE,SAAH,GAAeN,KAD/B;AAEC,IAAA,QAAQ,EAAGC;AAFZ,IAFF,EAOG,CAAEF,oBAAF,IACD,cAAC,eAAD;AACC,IAAA,MAAM,EAAG,CAAEf,EAAE,CAAE,SAAF,CAAJ,EAAmBA,EAAE,CAAE,YAAF,CAArB,CADV;AAEC,IAAA,MAAM,EAAGY,YAFV;AAGC,IAAA,KAAK,EAAGQ,OAAO,GAAGE,SAAH,GAAeN,KAH/B;AAIC,IAAA,mBAAmB,EAAGF,mBAJvB;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,QAAQ,EAAKoB,SAAF,IAAiB;AAC3B,UAAK,CAAEA,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBhB,WAAjB;AACA;;AACD,UAAK,CAAEgB,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBf,YAAjB;AACA;;AACD,YAAMgB,QAAQ,GACbD,SAAS,CAACE,MAAV,IAAoB,CAApB,GACGF,SADH,GAEGZ,SAHJ,CAP2B,CAW3B;AACA;AACA;;AACAL,MAAAA,QAAQ,CAAEkB,QAAF,CAAR;AACA;AArBF,IARF,CADD,CAZD,CADD;AAkDA;;AAED,eAAe1B,aAAf","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorListPicker from './color-list-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\n\nimport CustomDuotoneBar from './custom-duotone-bar';\nimport { getDefaultColors, getGradientFromCSSColors } from './utils';\nimport { Spacer } from '../spacer';\nimport type { DuotonePickerProps } from './types';\n\n/**\n * ```jsx\n * import { DuotonePicker, DuotoneSwatch } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const DUOTONE_PALETTE = [\n * \t{ colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' },\n * \t{ colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' },\n * ];\n *\n * const COLOR_PALETTE = [\n * \t{ color: '#ff4747', name: 'Red', slug: 'red' },\n * \t{ color: '#fcff41', name: 'Yellow', slug: 'yellow' },\n * \t{ color: '#000097', name: 'Blue', slug: 'blue' },\n * \t{ color: '#8c00b7', name: 'Purple', slug: 'purple' },\n * ];\n *\n * const Example = () => {\n * \tconst [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] );\n * \treturn (\n * \t\t<>\n * \t\t\t<DuotonePicker\n * \t\t\t\tduotonePalette={ DUOTONE_PALETTE }\n * \t\t\t\tcolorPalette={ COLOR_PALETTE }\n * \t\t\t\tvalue={ duotone }\n * \t\t\t\tonChange={ setDuotone }\n * \t\t\t/>\n * \t\t\t<DuotoneSwatch values={ duotone } />\n * \t\t</>\n * \t);\n * };\n * ```\n */\nfunction DuotonePicker( {\n\tclearable = true,\n\tunsetable = true,\n\tcolorPalette,\n\tduotonePalette,\n\tdisableCustomColors,\n\tdisableCustomDuotone,\n\tvalue,\n\tonChange,\n}: DuotonePickerProps ) {\n\tconst [ defaultDark, defaultLight ] = useMemo(\n\t\t() => getDefaultColors( colorPalette ),\n\t\t[ colorPalette ]\n\t);\n\n\tconst isUnset = value === 'unset';\n\n\tconst unsetOption = (\n\t\t<CircularOptionPicker.Option\n\t\t\tkey=\"unset\"\n\t\t\tvalue=\"unset\"\n\t\t\tisSelected={ isUnset }\n\t\t\ttooltipText={ __( 'Unset' ) }\n\t\t\tclassName=\"components-duotone-picker__color-indicator\"\n\t\t\tonClick={ () => {\n\t\t\t\tonChange( isUnset ? undefined : 'unset' );\n\t\t\t} }\n\t\t/>\n\t);\n\n\tconst options = duotonePalette.map( ( { colors, slug, name } ) => {\n\t\tconst style = {\n\t\t\tbackground: getGradientFromCSSColors( colors, '135deg' ),\n\t\t\tcolor: 'transparent',\n\t\t};\n\t\tconst tooltipText =\n\t\t\tname ??\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: duotone code e.g: \"dark-grayscale\" or \"7f7f7f-ffffff\".\n\t\t\t\t__( 'Duotone code: %s' ),\n\t\t\t\tslug\n\t\t\t);\n\t\tconst label = name\n\t\t\t? sprintf(\n\t\t\t\t\t// translators: %s: The name of the option e.g: \"Dark grayscale\".\n\t\t\t\t\t__( 'Duotone: %s' ),\n\t\t\t\t\tname\n\t\t\t )\n\t\t\t: tooltipText;\n\t\tconst isSelected = fastDeepEqual( colors, value );\n\n\t\treturn (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ colors }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\taria-label={ label }\n\t\t\t\ttooltipText={ tooltipText }\n\t\t\t\tstyle={ style }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonChange( isSelected ? undefined : colors );\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} );\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\toptions={ unsetable ? [ unsetOption, ...options ] : options }\n\t\t\tactions={\n\t\t\t\t!! clearable && (\n\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\tonClick={ () => onChange( undefined ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<Spacer paddingTop={ 4 }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t{ ! disableCustomColors && ! disableCustomDuotone && (\n\t\t\t\t\t\t<CustomDuotoneBar\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! disableCustomDuotone && (\n\t\t\t\t\t\t<ColorListPicker\n\t\t\t\t\t\t\tlabels={ [ __( 'Shadows' ), __( 'Highlights' ) ] }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tvalue={ isUnset ? undefined : value }\n\t\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t\tonChange={ ( newColors ) => {\n\t\t\t\t\t\t\t\tif ( ! newColors[ 0 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 0 ] = defaultDark;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( ! newColors[ 1 ] ) {\n\t\t\t\t\t\t\t\t\tnewColors[ 1 ] = defaultLight;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\t\t\tnewColors.length >= 2\n\t\t\t\t\t\t\t\t\t\t? newColors\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\t// @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors,\n\t\t\t\t\t\t\t\t// but it's currently typed as a string[].\n\t\t\t\t\t\t\t\t// See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035\n\t\t\t\t\t\t\t\tonChange( newValue );\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</VStack>\n\t\t\t</Spacer>\n\t\t</CircularOptionPicker>\n\t);\n}\n\nexport default DuotonePicker;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/duotone-picker/duotone-swatch.js"],"names":["swatch","ColorIndicator","Icon","getGradientFromCSSColors","DuotoneSwatch","values"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,wBAAT,QAAyC,SAAzC;;AAEA,SAASC,aAAT,OAAqC;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AACpC,SAAOA,MAAM,GACZ,cAAC,cAAD;AACC,IAAA,UAAU,EAAGF,wBAAwB,CAAEE,MAAF,EAAU,QAAV;AADtC,IADY,GAKZ,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGL;AAAb,IALD;AAOA;;AAED,eAAeI,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { swatch } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ColorIndicator from '../color-indicator';\nimport Icon from '../icon';\nimport { getGradientFromCSSColors } from './utils';\n\nfunction DuotoneSwatch( { values } ) {\n\treturn values ? (\n\t\t<ColorIndicator\n\t\t\tcolorValue={ getGradientFromCSSColors( values, '135deg' ) }\n\t\t/>\n\t) : (\n\t\t<Icon icon={ swatch } />\n\t);\n}\n\nexport default DuotoneSwatch;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/duotone-picker/duotone-swatch.tsx"],"names":["swatch","ColorIndicator","Icon","getGradientFromCSSColors","DuotoneSwatch","values"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,wBAAT,QAAyC,SAAzC;;AAGA,SAASC,aAAT,OAAyD;AAAA,MAAjC;AAAEC,IAAAA;AAAF,GAAiC;AACxD,SAAOA,MAAM,GACZ,cAAC,cAAD;AACC,IAAA,UAAU,EAAGF,wBAAwB,CAAEE,MAAF,EAAU,QAAV;AADtC,IADY,GAKZ,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGL;AAAb,IALD;AAOA;;AAED,eAAeI,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { swatch } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ColorIndicator from '../color-indicator';\nimport Icon from '../icon';\nimport { getGradientFromCSSColors } from './utils';\nimport type { DuotoneSwatchProps } from './types';\n\nfunction DuotoneSwatch( { values }: DuotoneSwatchProps ) {\n\treturn values ? (\n\t\t<ColorIndicator\n\t\t\tcolorValue={ getGradientFromCSSColors( values, '135deg' ) }\n\t\t/>\n\t) : (\n\t\t<Icon icon={ swatch } />\n\t);\n}\n\nexport default DuotoneSwatch;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/duotone-picker/index.js"],"names":["default","DuotonePicker","DuotoneSwatch"],"mappings":"AAAA,SAASA,OAAO,IAAIC,aAApB,QAAyC,kBAAzC;AACA,SAASD,OAAO,IAAIE,aAApB,QAAyC,kBAAzC","sourcesContent":["export { default as DuotonePicker } from './duotone-picker';\nexport { default as DuotoneSwatch } from './duotone-swatch';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/duotone-picker/index.ts"],"names":["default","DuotonePicker","DuotoneSwatch"],"mappings":"AAAA,SAASA,OAAO,IAAIC,aAApB,QAAyC,kBAAzC;AACA,SAASD,OAAO,IAAIE,aAApB,QAAyC,kBAAzC","sourcesContent":["export { default as DuotonePicker } from './duotone-picker';\nexport { default as DuotoneSwatch } from './duotone-swatch';\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -3,6 +3,10 @@
3
3
  */
4
4
  import { colord, extend } from 'colord';
5
5
  import namesPlugin from 'colord/plugins/names';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+
6
10
  extend([namesPlugin]);
7
11
  /**
8
12
  * Object representation for a color.
@@ -16,9 +20,9 @@ extend([namesPlugin]);
16
20
  /**
17
21
  * Calculate the brightest and darkest values from a color palette.
18
22
  *
19
- * @param {Object[]} palette Color palette for the theme.
23
+ * @param palette Color palette for the theme.
20
24
  *
21
- * @return {string[]} Tuple of the darkest color and brightest color.
25
+ * @return Tuple of the darkest color and brightest color.
22
26
  */
23
27
 
24
28
  export function getDefaultColors(palette) {
@@ -36,9 +40,11 @@ export function getDefaultColors(palette) {
36
40
  let [min, max] = _ref2;
37
41
  return [current.brightness <= min.brightness ? current : min, current.brightness >= max.brightness ? current : max];
38
42
  }, [{
39
- brightness: 1
43
+ brightness: 1,
44
+ color: ''
40
45
  }, {
41
- brightness: 0
46
+ brightness: 0,
47
+ color: ''
42
48
  }]).map(_ref3 => {
43
49
  let {
44
50
  color
@@ -49,10 +55,10 @@ export function getDefaultColors(palette) {
49
55
  /**
50
56
  * Generate a duotone gradient from a list of colors.
51
57
  *
52
- * @param {string[]} colors CSS color strings.
53
- * @param {string} angle CSS gradient angle.
58
+ * @param colors CSS color strings.
59
+ * @param angle CSS gradient angle.
54
60
  *
55
- * @return {string} CSS gradient string for the duotone swatch.
61
+ * @return CSS gradient string for the duotone swatch.
56
62
  */
57
63
 
58
64
  export function getGradientFromCSSColors() {
@@ -65,9 +71,9 @@ export function getGradientFromCSSColors() {
65
71
  /**
66
72
  * Convert a color array to an array of color stops.
67
73
  *
68
- * @param {string[]} colors CSS colors array
74
+ * @param colors CSS colors array
69
75
  *
70
- * @return {Object[]} Color stop information.
76
+ * @return Color stop information.
71
77
  */
72
78
 
73
79
  export function getColorStopsFromColors(colors) {
@@ -79,9 +85,9 @@ export function getColorStopsFromColors(colors) {
79
85
  /**
80
86
  * Convert a color stop array to an array colors.
81
87
  *
82
- * @param {Object[]} colorStops Color stop information.
88
+ * @param colorStops Color stop information.
83
89
  *
84
- * @return {string[]} CSS colors array.
90
+ * @return CSS colors array.
85
91
  */
86
92
 
87
93
  export function getColorsFromColorStops() {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/duotone-picker/utils.js"],"names":["colord","extend","namesPlugin","getDefaultColors","palette","length","map","color","brightness","reduce","current","min","max","getGradientFromCSSColors","colors","angle","l","stops","c","i","join","getColorStopsFromColors","position","getColorsFromColorStops","colorStops"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEAD,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,OAA3B,EAAqC;AAC3C;AACA,MAAK,CAAEA,OAAF,IAAaA,OAAO,CAACC,MAAR,GAAiB,CAAnC,EAAuC,OAAO,CAAE,MAAF,EAAU,MAAV,CAAP;AAEvC,SAAOD,OAAO,CACZE,GADK,CACA;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAmB;AACxBA,MAAAA,KADwB;AAExBC,MAAAA,UAAU,EAAER,MAAM,CAAEO,KAAF,CAAN,CAAgBC,UAAhB;AAFY,KAAnB;AAAA,GADA,EAKLC,MALK,CAML,QAAgBC,OAAhB,KAA6B;AAAA,QAA3B,CAAEC,GAAF,EAAOC,GAAP,CAA2B;AAC5B,WAAO,CACNF,OAAO,CAACF,UAAR,IAAsBG,GAAG,CAACH,UAA1B,GAAuCE,OAAvC,GAAiDC,GAD3C,EAEND,OAAO,CAACF,UAAR,IAAsBI,GAAG,CAACJ,UAA1B,GAAuCE,OAAvC,GAAiDE,GAF3C,CAAP;AAIA,GAXI,EAYL,CAAE;AAAEJ,IAAAA,UAAU,EAAE;AAAd,GAAF,EAAqB;AAAEA,IAAAA,UAAU,EAAE;AAAd,GAArB,CAZK,EAcLF,GAdK,CAcA;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAiBA,KAAjB;AAAA,GAdA,CAAP;AAeA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,wBAAT,GAAkE;AAAA,MAA/BC,MAA+B,uEAAtB,EAAsB;AAAA,MAAlBC,KAAkB,uEAAV,OAAU;AACxE,QAAMC,CAAC,GAAG,MAAMF,MAAM,CAACT,MAAvB;AAEA,QAAMY,KAAK,GAAGH,MAAM,CAClBR,GADY,CACP,CAAEY,CAAF,EAAKC,CAAL,KAAa,GAAGD,CAAG,IAAIC,CAAC,GAAGH,CAAG,MAAME,CAAG,IAAI,CAAEC,CAAC,GAAG,CAAN,IAAYH,CAAG,GADnD,EAEZI,IAFY,CAEN,IAFM,CAAd;AAIA,SAAQ,oBAAoBL,KAAO,KAAKE,KAAO,IAA/C;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,uBAAT,CAAkCP,MAAlC,EAA2C;AACjD,SAAOA,MAAM,CAACR,GAAP,CAAY,CAAEC,KAAF,EAASY,CAAT,MAAkB;AACpCG,IAAAA,QAAQ,EAAIH,CAAC,GAAG,GAAN,IAAgBL,MAAM,CAACT,MAAP,GAAgB,CAAhC,CAD0B;AAEpCE,IAAAA;AAFoC,GAAlB,CAAZ,CAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgB,uBAAT,GAAoD;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAC1D,SAAOA,UAAU,CAAClB,GAAX,CAAgB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAiBA,KAAjB;AAAA,GAAhB,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\nextend( [ namesPlugin ] );\n\n/**\n * Object representation for a color.\n *\n * @typedef {Object} RGBColor\n * @property {number} r Red component of the color in the range [0,1].\n * @property {number} g Green component of the color in the range [0,1].\n * @property {number} b Blue component of the color in the range [0,1].\n */\n\n/**\n * Calculate the brightest and darkest values from a color palette.\n *\n * @param {Object[]} palette Color palette for the theme.\n *\n * @return {string[]} Tuple of the darkest color and brightest color.\n */\nexport function getDefaultColors( palette ) {\n\t// A default dark and light color are required.\n\tif ( ! palette || palette.length < 2 ) return [ '#000', '#fff' ];\n\n\treturn palette\n\t\t.map( ( { color } ) => ( {\n\t\t\tcolor,\n\t\t\tbrightness: colord( color ).brightness(),\n\t\t} ) )\n\t\t.reduce(\n\t\t\t( [ min, max ], current ) => {\n\t\t\t\treturn [\n\t\t\t\t\tcurrent.brightness <= min.brightness ? current : min,\n\t\t\t\t\tcurrent.brightness >= max.brightness ? current : max,\n\t\t\t\t];\n\t\t\t},\n\t\t\t[ { brightness: 1 }, { brightness: 0 } ]\n\t\t)\n\t\t.map( ( { color } ) => color );\n}\n\n/**\n * Generate a duotone gradient from a list of colors.\n *\n * @param {string[]} colors CSS color strings.\n * @param {string} angle CSS gradient angle.\n *\n * @return {string} CSS gradient string for the duotone swatch.\n */\nexport function getGradientFromCSSColors( colors = [], angle = '90deg' ) {\n\tconst l = 100 / colors.length;\n\n\tconst stops = colors\n\t\t.map( ( c, i ) => `${ c } ${ i * l }%, ${ c } ${ ( i + 1 ) * l }%` )\n\t\t.join( ', ' );\n\n\treturn `linear-gradient( ${ angle }, ${ stops } )`;\n}\n\n/**\n * Convert a color array to an array of color stops.\n *\n * @param {string[]} colors CSS colors array\n *\n * @return {Object[]} Color stop information.\n */\nexport function getColorStopsFromColors( colors ) {\n\treturn colors.map( ( color, i ) => ( {\n\t\tposition: ( i * 100 ) / ( colors.length - 1 ),\n\t\tcolor,\n\t} ) );\n}\n\n/**\n * Convert a color stop array to an array colors.\n *\n * @param {Object[]} colorStops Color stop information.\n *\n * @return {string[]} CSS colors array.\n */\nexport function getColorsFromColorStops( colorStops = [] ) {\n\treturn colorStops.map( ( { color } ) => color );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/duotone-picker/utils.ts"],"names":["colord","extend","namesPlugin","getDefaultColors","palette","length","map","color","brightness","reduce","current","min","max","getGradientFromCSSColors","colors","angle","l","stops","c","i","join","getColorStopsFromColors","position","getColorsFromColorStops","colorStops"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AAGAD,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CACNC,OADM,EAEL;AACD;AACA,MAAK,CAAEA,OAAF,IAAaA,OAAO,CAACC,MAAR,GAAiB,CAAnC,EAAuC,OAAO,CAAE,MAAF,EAAU,MAAV,CAAP;AAEvC,SAAOD,OAAO,CACZE,GADK,CACA;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAmB;AACxBA,MAAAA,KADwB;AAExBC,MAAAA,UAAU,EAAER,MAAM,CAAEO,KAAF,CAAN,CAAgBC,UAAhB;AAFY,KAAnB;AAAA,GADA,EAKLC,MALK,CAML,QAAgBC,OAAhB,KAA6B;AAAA,QAA3B,CAAEC,GAAF,EAAOC,GAAP,CAA2B;AAC5B,WAAO,CACNF,OAAO,CAACF,UAAR,IAAsBG,GAAG,CAACH,UAA1B,GAAuCE,OAAvC,GAAiDC,GAD3C,EAEND,OAAO,CAACF,UAAR,IAAsBI,GAAG,CAACJ,UAA1B,GAAuCE,OAAvC,GAAiDE,GAF3C,CAAP;AAIA,GAXI,EAYL,CACC;AAAEJ,IAAAA,UAAU,EAAE,CAAd;AAAiBD,IAAAA,KAAK,EAAE;AAAxB,GADD,EAEC;AAAEC,IAAAA,UAAU,EAAE,CAAd;AAAiBD,IAAAA,KAAK,EAAE;AAAxB,GAFD,CAZK,EAiBLD,GAjBK,CAiBA;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAiBA,KAAjB;AAAA,GAjBA,CAAP;AAkBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,wBAAT,GAGL;AAAA,MAFDC,MAEC,uEAFkB,EAElB;AAAA,MADDC,KACC,uEADO,OACP;AACD,QAAMC,CAAC,GAAG,MAAMF,MAAM,CAACT,MAAvB;AAEA,QAAMY,KAAK,GAAGH,MAAM,CAClBR,GADY,CACP,CAAEY,CAAF,EAAKC,CAAL,KAAa,GAAGD,CAAG,IAAIC,CAAC,GAAGH,CAAG,MAAME,CAAG,IAAI,CAAEC,CAAC,GAAG,CAAN,IAAYH,CAAG,GADnD,EAEZI,IAFY,CAEN,IAFM,CAAd;AAIA,SAAQ,oBAAoBL,KAAO,KAAKE,KAAO,IAA/C;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASI,uBAAT,CAAkCP,MAAlC,EAAqD;AAC3D,SAAOA,MAAM,CAACR,GAAP,CAAY,CAAEC,KAAF,EAASY,CAAT,MAAkB;AACpCG,IAAAA,QAAQ,EAAIH,CAAC,GAAG,GAAN,IAAgBL,MAAM,CAACT,MAAP,GAAgB,CAAhC,CAD0B;AAEpCE,IAAAA;AAFoC,GAAlB,CAAZ,CAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgB,uBAAT,GAEL;AAAA,MADDC,UACC,uEADmD,EACnD;AACD,SAAOA,UAAU,CAAClB,GAAX,CAAgB;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAiBA,KAAjB;AAAA,GAAhB,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * Internal dependencies\n */\nimport type { DuotonePickerProps } from './types';\n\nextend( [ namesPlugin ] );\n\n/**\n * Object representation for a color.\n *\n * @typedef {Object} RGBColor\n * @property {number} r Red component of the color in the range [0,1].\n * @property {number} g Green component of the color in the range [0,1].\n * @property {number} b Blue component of the color in the range [0,1].\n */\n\n/**\n * Calculate the brightest and darkest values from a color palette.\n *\n * @param palette Color palette for the theme.\n *\n * @return Tuple of the darkest color and brightest color.\n */\nexport function getDefaultColors(\n\tpalette: DuotonePickerProps[ 'colorPalette' ]\n) {\n\t// A default dark and light color are required.\n\tif ( ! palette || palette.length < 2 ) return [ '#000', '#fff' ];\n\n\treturn palette\n\t\t.map( ( { color } ) => ( {\n\t\t\tcolor,\n\t\t\tbrightness: colord( color ).brightness(),\n\t\t} ) )\n\t\t.reduce(\n\t\t\t( [ min, max ], current ) => {\n\t\t\t\treturn [\n\t\t\t\t\tcurrent.brightness <= min.brightness ? current : min,\n\t\t\t\t\tcurrent.brightness >= max.brightness ? current : max,\n\t\t\t\t];\n\t\t\t},\n\t\t\t[\n\t\t\t\t{ brightness: 1, color: '' },\n\t\t\t\t{ brightness: 0, color: '' },\n\t\t\t]\n\t\t)\n\t\t.map( ( { color } ) => color );\n}\n\n/**\n * Generate a duotone gradient from a list of colors.\n *\n * @param colors CSS color strings.\n * @param angle CSS gradient angle.\n *\n * @return CSS gradient string for the duotone swatch.\n */\nexport function getGradientFromCSSColors(\n\tcolors: string[] = [],\n\tangle = '90deg'\n) {\n\tconst l = 100 / colors.length;\n\n\tconst stops = colors\n\t\t.map( ( c, i ) => `${ c } ${ i * l }%, ${ c } ${ ( i + 1 ) * l }%` )\n\t\t.join( ', ' );\n\n\treturn `linear-gradient( ${ angle }, ${ stops } )`;\n}\n\n/**\n * Convert a color array to an array of color stops.\n *\n * @param colors CSS colors array\n *\n * @return Color stop information.\n */\nexport function getColorStopsFromColors( colors: string[] ) {\n\treturn colors.map( ( color, i ) => ( {\n\t\tposition: ( i * 100 ) / ( colors.length - 1 ),\n\t\tcolor,\n\t} ) );\n}\n\n/**\n * Convert a color stop array to an array colors.\n *\n * @param colorStops Color stop information.\n *\n * @return CSS colors array.\n */\nexport function getColorsFromColorStops(\n\tcolorStops: { position: number; color: string }[] = []\n) {\n\treturn colorStops.map( ( { color } ) => color );\n}\n"]}
@@ -23,7 +23,8 @@ import TokenInput from './token-input';
23
23
  import { TokensAndInputWrapperFlex } from './styles';
24
24
  import SuggestionsList from './suggestions-list';
25
25
  import { FlexItem } from '../flex';
26
- import { StyledLabel } from '../base-control/styles/base-control-styles';
26
+ import { StyledHelp, StyledLabel } from '../base-control/styles/base-control-styles';
27
+ import { Spacer } from '../spacer';
27
28
 
28
29
  const identity = value => value;
29
30
  /**
@@ -68,7 +69,8 @@ export function FormTokenField(props) {
68
69
  __experimentalValidateInput = () => true,
69
70
  __experimentalShowHowTo = true,
70
71
  __next36pxDefaultSize = false,
71
- __experimentalAutoSelectFirstMatch = false
72
+ __experimentalAutoSelectFirstMatch = false,
73
+ __nextHasNoMarginBottom = false
72
74
  } = props;
73
75
  const instanceId = useInstanceId(FormTokenField); // We reset to these initial values again in the onBlur
74
76
 
@@ -633,9 +635,12 @@ export function FormTokenField(props) {
633
635
  onHover: onSuggestionHovered,
634
636
  onSelect: onSuggestionSelected,
635
637
  __experimentalRenderItem: __experimentalRenderItem
636
- })), __experimentalShowHowTo && createElement("p", {
638
+ })), !__nextHasNoMarginBottom && createElement(Spacer, {
639
+ marginBottom: 2
640
+ }), __experimentalShowHowTo && createElement(StyledHelp, {
637
641
  id: `components-form-token-suggestions-howto-${instanceId}`,
638
- className: "components-form-token-field__help"
642
+ className: "components-form-token-field__help",
643
+ __nextHasNoMarginBottom: __nextHasNoMarginBottom
639
644
  }, tokenizeOnSpace ? __('Separate with commas, spaces, or the Enter key.') : __('Separate with commas or the Enter key.')));
640
645
  /* eslint-enable jsx-a11y/no-static-element-interactions */
641
646
  }