@wordpress/components 23.6.0 → 23.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/CHANGELOG.md +32 -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 +14 -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/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  43. package/build/duotone-picker/color-list-picker/index.js.map +1 -0
  44. package/build/duotone-picker/color-list-picker/types.js +6 -0
  45. package/build/duotone-picker/color-list-picker/types.js.map +1 -0
  46. package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
  47. package/build/duotone-picker/duotone-picker.js +39 -2
  48. package/build/duotone-picker/duotone-picker.js.map +1 -1
  49. package/build/duotone-picker/duotone-swatch.js.map +1 -1
  50. package/build/duotone-picker/index.js.map +1 -1
  51. package/build/duotone-picker/types.js +6 -0
  52. package/build/duotone-picker/types.js.map +1 -0
  53. package/build/duotone-picker/utils.js +13 -11
  54. package/build/duotone-picker/utils.js.map +1 -1
  55. package/build/form-token-field/index.js +9 -3
  56. package/build/form-token-field/index.js.map +1 -1
  57. package/build/gradient-picker/index.js +61 -9
  58. package/build/gradient-picker/index.js.map +1 -1
  59. package/build/gradient-picker/types.js +6 -0
  60. package/build/gradient-picker/types.js.map +1 -0
  61. package/build/palette-edit/index.js +1 -2
  62. package/build/palette-edit/index.js.map +1 -1
  63. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  64. package/build/sandbox/index.native.js +80 -67
  65. package/build/sandbox/index.native.js.map +1 -1
  66. package/build/tab-panel/index.js +1 -1
  67. package/build/tab-panel/index.js.map +1 -1
  68. package/build/tools-panel/tools-panel/hook.js +45 -6
  69. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  70. package/build/utils/input/input-control.js +1 -1
  71. package/build/utils/input/input-control.js.map +1 -1
  72. package/build-module/angle-picker-control/angle-circle.js +1 -4
  73. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  74. package/build-module/angle-picker-control/index.js +12 -21
  75. package/build-module/angle-picker-control/index.js.map +1 -1
  76. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
  77. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  78. package/build-module/animate/index.js +25 -17
  79. package/build-module/animate/index.js.map +1 -1
  80. package/build-module/box-control/axial-input-controls.js.map +1 -1
  81. package/build-module/color-picker/color-input.js +0 -4
  82. package/build-module/color-picker/color-input.js.map +1 -1
  83. package/build-module/color-picker/component.js +3 -3
  84. package/build-module/color-picker/component.js.map +1 -1
  85. package/build-module/color-picker/hex-input.js.map +1 -1
  86. package/build-module/color-picker/hsl-input.js.map +1 -1
  87. package/build-module/color-picker/input-with-slider.js.map +1 -1
  88. package/build-module/color-picker/legacy-adapter.js.map +1 -1
  89. package/build-module/color-picker/picker.js +4 -0
  90. package/build-module/color-picker/picker.js.map +1 -1
  91. package/build-module/color-picker/rgb-input.js.map +1 -1
  92. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  93. package/build-module/custom-gradient-picker/constants.js +1 -1
  94. package/build-module/custom-gradient-picker/constants.js.map +1 -1
  95. package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  96. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -4
  97. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  98. package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -8
  99. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  100. package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -54
  101. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  102. package/build-module/custom-gradient-picker/index.js +44 -17
  103. package/build-module/custom-gradient-picker/index.js.map +1 -1
  104. package/build-module/custom-gradient-picker/serializer.js +14 -4
  105. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  106. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  107. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  108. package/build-module/custom-gradient-picker/types.js +2 -0
  109. package/build-module/custom-gradient-picker/utils.js +17 -12
  110. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  111. package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  112. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
  113. package/build-module/duotone-picker/color-list-picker/types.js +2 -0
  114. package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
  115. package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
  116. package/build-module/duotone-picker/duotone-picker.js +38 -2
  117. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  118. package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
  119. package/build-module/duotone-picker/index.js.map +1 -1
  120. package/build-module/duotone-picker/types.js +2 -0
  121. package/build-module/duotone-picker/types.js.map +1 -0
  122. package/build-module/duotone-picker/utils.js +17 -11
  123. package/build-module/duotone-picker/utils.js.map +1 -1
  124. package/build-module/form-token-field/index.js +9 -4
  125. package/build-module/form-token-field/index.js.map +1 -1
  126. package/build-module/gradient-picker/index.js +61 -10
  127. package/build-module/gradient-picker/index.js.map +1 -1
  128. package/build-module/gradient-picker/types.js +2 -0
  129. package/build-module/gradient-picker/types.js.map +1 -0
  130. package/build-module/palette-edit/index.js +1 -2
  131. package/build-module/palette-edit/index.js.map +1 -1
  132. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  133. package/build-module/sandbox/index.native.js +70 -58
  134. package/build-module/sandbox/index.native.js.map +1 -1
  135. package/build-module/tab-panel/index.js +2 -2
  136. package/build-module/tab-panel/index.js.map +1 -1
  137. package/build-module/tools-panel/tools-panel/hook.js +45 -6
  138. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  139. package/build-module/utils/input/input-control.js +1 -1
  140. package/build-module/utils/input/input-control.js.map +1 -1
  141. package/build-style/style-rtl.css +40 -28
  142. package/build-style/style.css +42 -28
  143. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  144. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  145. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +5 -0
  146. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  147. package/build-types/animate/index.d.ts +27 -22
  148. package/build-types/animate/index.d.ts.map +1 -1
  149. package/build-types/animate/stories/index.d.ts +18 -0
  150. package/build-types/animate/stories/index.d.ts.map +1 -0
  151. package/build-types/animate/types.d.ts +30 -0
  152. package/build-types/animate/types.d.ts.map +1 -0
  153. package/build-types/color-picker/color-input.d.ts +1 -11
  154. package/build-types/color-picker/color-input.d.ts.map +1 -1
  155. package/build-types/color-picker/component.d.ts +8 -9
  156. package/build-types/color-picker/component.d.ts.map +1 -1
  157. package/build-types/color-picker/hex-input.d.ts +1 -10
  158. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  159. package/build-types/color-picker/hsl-input.d.ts +1 -10
  160. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  161. package/build-types/color-picker/input-with-slider.d.ts +1 -9
  162. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  163. package/build-types/color-picker/legacy-adapter.d.ts +1 -3
  164. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  165. package/build-types/color-picker/picker.d.ts +4 -7
  166. package/build-types/color-picker/picker.d.ts.map +1 -1
  167. package/build-types/color-picker/rgb-input.d.ts +1 -10
  168. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  169. package/build-types/color-picker/stories/index.d.ts +19 -0
  170. package/build-types/color-picker/stories/index.d.ts.map +1 -0
  171. package/build-types/color-picker/test/index.d.ts +2 -0
  172. package/build-types/color-picker/test/index.d.ts.map +1 -0
  173. package/build-types/color-picker/types.d.ts +105 -1
  174. package/build-types/color-picker/types.d.ts.map +1 -1
  175. package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
  176. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  177. package/build-types/custom-gradient-picker/constants.d.ts +8 -8
  178. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
  179. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +7 -7
  180. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -1
  181. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +5 -22
  182. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  183. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +3 -9
  184. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
  185. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
  186. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
  187. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +44 -92
  188. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -1
  189. package/build-types/custom-gradient-picker/index.d.ts +27 -6
  190. package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
  191. package/build-types/custom-gradient-picker/serializer.d.ts +13 -16
  192. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
  193. package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
  194. package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
  195. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +3 -2
  196. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -1
  197. package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
  198. package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
  199. package/build-types/custom-gradient-picker/types.d.ts +120 -0
  200. package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
  201. package/build-types/custom-gradient-picker/utils.d.ts +12 -4
  202. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -1
  203. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
  204. package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +2 -2
  205. package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
  206. package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
  207. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
  208. package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
  209. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
  210. package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
  211. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
  212. package/build-types/duotone-picker/index.d.ts +3 -0
  213. package/build-types/duotone-picker/index.d.ts.map +1 -0
  214. package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
  215. package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
  216. package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
  217. package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
  218. package/build-types/duotone-picker/types.d.ts +60 -0
  219. package/build-types/duotone-picker/types.d.ts.map +1 -0
  220. package/build-types/duotone-picker/utils.d.ts +52 -0
  221. package/build-types/duotone-picker/utils.d.ts.map +1 -0
  222. package/build-types/form-token-field/index.d.ts.map +1 -1
  223. package/build-types/form-token-field/types.d.ts +6 -0
  224. package/build-types/form-token-field/types.d.ts.map +1 -1
  225. package/build-types/gradient-picker/index.d.ts +49 -11
  226. package/build-types/gradient-picker/index.d.ts.map +1 -1
  227. package/build-types/gradient-picker/stories/index.d.ts +14 -0
  228. package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
  229. package/build-types/gradient-picker/types.d.ts +87 -0
  230. package/build-types/gradient-picker/types.d.ts.map +1 -0
  231. package/build-types/palette-edit/index.d.ts.map +1 -1
  232. package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
  233. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  234. package/build-types/tab-panel/index.d.ts.map +1 -1
  235. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  236. package/build-types/tools-panel/types.d.ts +1 -0
  237. package/build-types/tools-panel/types.d.ts.map +1 -1
  238. package/build-types/utils/input/input-control.d.ts.map +1 -1
  239. package/package.json +19 -19
  240. package/src/angle-picker-control/angle-circle.tsx +0 -1
  241. package/src/angle-picker-control/index.tsx +14 -27
  242. package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
  243. package/src/animate/index.tsx +75 -0
  244. package/src/animate/stories/index.tsx +102 -0
  245. package/src/animate/types.ts +32 -0
  246. package/src/border-box-control/stories/index.tsx +1 -1
  247. package/src/box-control/axial-input-controls.tsx +1 -1
  248. package/src/circular-option-picker/style.scss +10 -0
  249. package/src/color-indicator/style.scss +1 -0
  250. package/src/color-picker/README.md +2 -2
  251. package/src/color-picker/color-input.tsx +1 -12
  252. package/src/color-picker/component.tsx +9 -18
  253. package/src/color-picker/hex-input.tsx +2 -7
  254. package/src/color-picker/hsl-input.tsx +2 -7
  255. package/src/color-picker/input-with-slider.tsx +1 -9
  256. package/src/color-picker/legacy-adapter.tsx +1 -2
  257. package/src/color-picker/picker.tsx +5 -6
  258. package/src/color-picker/rgb-input.tsx +2 -7
  259. package/src/color-picker/stories/index.tsx +51 -0
  260. package/src/color-picker/test/{index.js → index.tsx} +36 -18
  261. package/src/color-picker/types.ts +128 -1
  262. package/src/color-picker/use-deprecated-props.ts +2 -53
  263. package/src/combobox-control/stories/index.tsx +1 -1
  264. package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
  265. package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -134
  266. package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -10
  267. package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
  268. package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
  269. package/src/custom-gradient-picker/{index.js → index.tsx} +63 -22
  270. package/src/custom-gradient-picker/serializer.ts +82 -0
  271. package/src/custom-gradient-picker/stories/index.tsx +45 -0
  272. package/src/custom-gradient-picker/style.scss +25 -4
  273. package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
  274. package/src/custom-gradient-picker/types.ts +137 -0
  275. package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -22
  276. package/src/custom-select-control/test/index.js +6 -4
  277. package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
  278. package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
  279. package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
  280. package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
  281. package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
  282. package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
  283. package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
  284. package/src/duotone-picker/types.ts +61 -0
  285. package/src/duotone-picker/{utils.js → utils.ts} +29 -14
  286. package/src/flex/flex-item/README.md +1 -1
  287. package/src/form-token-field/README.md +1 -0
  288. package/src/form-token-field/index.tsx +10 -3
  289. package/src/form-token-field/style.scss +0 -7
  290. package/src/form-token-field/test/index.tsx +1 -0
  291. package/src/form-token-field/types.ts +6 -0
  292. package/src/gradient-picker/README.md +16 -23
  293. package/src/gradient-picker/{index.js → index.tsx} +70 -16
  294. package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
  295. package/src/gradient-picker/types.ts +89 -0
  296. package/src/item-group/test/index.js +5 -3
  297. package/src/palette-edit/index.tsx +4 -5
  298. package/src/resizable-box/resize-tooltip/utils.ts +1 -1
  299. package/src/sandbox/index.native.js +71 -78
  300. package/src/slot-fill/test/slot.js +8 -6
  301. package/src/style.scss +1 -1
  302. package/src/tab-panel/index.tsx +7 -2
  303. package/src/tools-panel/test/index.tsx +86 -0
  304. package/src/tools-panel/tools-panel/hook.ts +44 -4
  305. package/src/tools-panel/types.ts +1 -0
  306. package/src/tooltip/test/index.js +251 -301
  307. package/src/utils/input/input-control.js +1 -0
  308. package/tsconfig.json +1 -2
  309. package/tsconfig.tsbuildinfo +1 -1
  310. package/build/color-list-picker/index.js.map +0 -1
  311. package/build-module/color-list-picker/index.js.map +0 -1
  312. package/build-types/color-list-picker/index.d.ts.map +0 -1
  313. package/build-types/color-list-picker/types.d.ts.map +0 -1
  314. package/src/animate/index.js +0 -60
  315. package/src/animate/stories/index.js +0 -53
  316. package/src/color-picker/stories/index.js +0 -41
  317. package/src/custom-gradient-picker/gradient-bar/utils.js +0 -189
  318. package/src/custom-gradient-picker/serializer.js +0 -48
  319. package/src/custom-gradient-picker/stories/index.js +0 -33
  320. /package/build/{color-list-picker → animate}/types.js +0 -0
  321. /package/build-module/{color-list-picker → animate}/types.js +0 -0
  322. /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
  323. /package/{build/color-list-picker → build-module/custom-gradient-picker}/types.js.map +0 -0
  324. /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
  325. /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
  326. /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
  327. /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
  328. /package/src/duotone-picker/{index.js → index.ts} +0 -0
@@ -0,0 +1,137 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type gradientParser from 'gradient-parser';
5
+
6
+ export type CustomGradientPickerProps = {
7
+ /**
8
+ * Start opting in to the new margin-free styles that will become the default
9
+ * in a future version, currently scheduled to be WordPress 6.4. (The prop
10
+ * can be safely removed once this happens.)
11
+ *
12
+ * @default false
13
+ */
14
+ __nextHasNoMargin?: boolean;
15
+ /**
16
+ * The current value of the gradient. Pass a css gradient string (See default value for example).
17
+ * Optionally pass in a `null` value to specify no gradient is currently selected.
18
+ *
19
+ * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'
20
+ */
21
+ value?: string | null;
22
+ /**
23
+ * The function called when a new gradient has been defined. It is passed to
24
+ * the `currentGradient` as an argument.
25
+ */
26
+ onChange: ( currentGradient: string ) => void;
27
+ /**
28
+ * Whether this is rendered in the sidebar.
29
+ *
30
+ * @default false
31
+ */
32
+ __experimentalIsRenderedInSidebar?: boolean;
33
+ };
34
+
35
+ export type GradientAnglePickerProps = {
36
+ gradientAST:
37
+ | gradientParser.LinearGradientNode
38
+ | gradientParser.RepeatingLinearGradientNode;
39
+ hasGradient: boolean;
40
+ onChange: ( gradient: string ) => void;
41
+ };
42
+
43
+ export type GradientTypePickerProps = {
44
+ gradientAST: gradientParser.GradientNode;
45
+ hasGradient: boolean;
46
+ onChange: ( gradient: string ) => void;
47
+ };
48
+
49
+ export type ControlPoint = { color: string; position: number };
50
+
51
+ // When dealing with unions of objects, using `Pick` will result
52
+ // in a new type where each desired prop is a union of the values for that prop
53
+ // across all of the original union members. This does not maintain the specific
54
+ // combinations of props present in the original union.
55
+ // To avoid this, the `DistributivePick` type will
56
+ // "distribute" the `Pick` across the union. This allows the `Pick`
57
+ // to act on each member individually, maintaining the relationships between the
58
+ // resulting props.
59
+ // https://stackoverflow.com/questions/57103834/typescript-omit-a-property-from-all-interfaces-in-a-union-but-keep-the-union-s
60
+ type DistributivePick< T, K extends keyof T > = T extends any
61
+ ? Pick< T, K >
62
+ : never;
63
+
64
+ export type ColorStopTypeAndValue = DistributivePick<
65
+ gradientParser.ColorStop,
66
+ 'type' | 'value'
67
+ >;
68
+
69
+ export type CustomGradientBarProps = {
70
+ background: React.CSSProperties[ 'background' ];
71
+ hasGradient: boolean;
72
+ value: ControlPoint[];
73
+ onChange: ( newControlPoints: ControlPoint[] ) => void;
74
+ disableInserter?: boolean;
75
+ disableAlpha?: boolean;
76
+ __experimentalIsRenderedInSidebar?: boolean;
77
+ };
78
+
79
+ export type CustomGradientBarIdleState = { id: 'IDLE' };
80
+ type CustomGradientBarMovingInserterState = {
81
+ id: 'MOVING_INSERTER';
82
+ insertPosition: number;
83
+ };
84
+ type CustomGradientBarInsertingControlPointState = {
85
+ id: 'INSERTING_CONTROL_POINT';
86
+ insertPosition: number;
87
+ };
88
+ type CustomGradientBarMovingControlPointState = { id: 'MOVING_CONTROL_POINT' };
89
+
90
+ export type CustomGradientBarReducerState =
91
+ | CustomGradientBarIdleState
92
+ | CustomGradientBarMovingInserterState
93
+ | CustomGradientBarInsertingControlPointState
94
+ | CustomGradientBarMovingControlPointState;
95
+
96
+ export type CustomGradientBarReducerAction =
97
+ | { type: 'MOVE_INSERTER'; insertPosition: number }
98
+ | { type: 'STOP_INSERTER_MOVE' }
99
+ | { type: 'OPEN_INSERTER' }
100
+ | { type: 'CLOSE_INSERTER' }
101
+ | { type: 'START_CONTROL_CHANGE' }
102
+ | { type: 'STOP_CONTROL_CHANGE' };
103
+
104
+ export type ControlPointButtonProps = {
105
+ isOpen: boolean;
106
+ position: ControlPoint[ 'position' ];
107
+ color: string;
108
+ };
109
+
110
+ export type ControlPointsProps = {
111
+ disableRemove: boolean;
112
+ disableAlpha: boolean;
113
+ gradientPickerDomRef: React.RefObject< HTMLDivElement >;
114
+ ignoreMarkerPosition?: number;
115
+ value: ControlPoint[];
116
+ onChange: ( controlPoints: ControlPoint[] ) => void;
117
+ onStartControlPointChange: () => void;
118
+ onStopControlPointChange: () => void;
119
+ __experimentalIsRenderedInSidebar: boolean;
120
+ };
121
+
122
+ export type ControlPointMoveState = {
123
+ initialPosition: number;
124
+ index: number;
125
+ significantMoveHappened: boolean;
126
+ listenersActivated: boolean;
127
+ };
128
+
129
+ export type InsertPointProps = {
130
+ value: ControlPoint[];
131
+ onChange: ( controlPoints: ControlPoint[] ) => void;
132
+ onOpenInserter: () => void;
133
+ onCloseInserter: () => void;
134
+ insertPosition: number;
135
+ disableAlpha: boolean;
136
+ __experimentalIsRenderedInSidebar: boolean;
137
+ };
@@ -1,5 +1,3 @@
1
- // @ts-nocheck
2
-
3
1
  /**
4
2
  * External dependencies
5
3
  */
@@ -16,10 +14,13 @@ import {
16
14
  DIRECTIONAL_ORIENTATION_ANGLE_MAP,
17
15
  } from './constants';
18
16
  import { serializeGradient } from './serializer';
17
+ import type { ControlPoint } from './types';
19
18
 
20
19
  extend( [ namesPlugin ] );
21
20
 
22
- export function getLinearGradientRepresentation( gradientAST ) {
21
+ export function getLinearGradientRepresentation(
22
+ gradientAST: gradientParser.GradientNode
23
+ ) {
23
24
  return serializeGradient( {
24
25
  type: 'linear-gradient',
25
26
  orientation: HORIZONTAL_GRADIENT_ORIENTATION,
@@ -27,29 +28,41 @@ export function getLinearGradientRepresentation( gradientAST ) {
27
28
  } );
28
29
  }
29
30
 
30
- function hasUnsupportedLength( item ) {
31
+ function hasUnsupportedLength( item: gradientParser.ColorStop ) {
31
32
  return item.length === undefined || item.length.type !== '%';
32
33
  }
33
34
 
34
- export function getGradientAstWithDefault( value ) {
35
+ export function getGradientAstWithDefault( value?: string | null ) {
35
36
  // gradientAST will contain the gradient AST as parsed by gradient-parser npm module.
36
37
  // More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.
37
- let gradientAST;
38
+ let gradientAST: gradientParser.GradientNode | undefined;
39
+ let hasGradient = !! value;
40
+
41
+ const valueToParse = value ?? DEFAULT_GRADIENT;
38
42
 
39
43
  try {
40
- gradientAST = gradientParser.parse( value )[ 0 ];
41
- gradientAST.value = value;
44
+ gradientAST = gradientParser.parse( valueToParse )[ 0 ];
42
45
  } catch ( error ) {
46
+ // eslint-disable-next-line no-console
47
+ console.warn(
48
+ 'wp.components.CustomGradientPicker failed to parse the gradient with error',
49
+ error
50
+ );
51
+
43
52
  gradientAST = gradientParser.parse( DEFAULT_GRADIENT )[ 0 ];
44
- gradientAST.value = DEFAULT_GRADIENT;
53
+ hasGradient = false;
45
54
  }
46
55
 
47
- if ( gradientAST.orientation?.type === 'directional' ) {
48
- gradientAST.orientation.type = 'angular';
49
- gradientAST.orientation.value =
50
- DIRECTIONAL_ORIENTATION_ANGLE_MAP[
56
+ if (
57
+ ! Array.isArray( gradientAST.orientation ) &&
58
+ gradientAST.orientation?.type === 'directional'
59
+ ) {
60
+ gradientAST.orientation = {
61
+ type: 'angular',
62
+ value: DIRECTIONAL_ORIENTATION_ANGLE_MAP[
51
63
  gradientAST.orientation.value
52
- ].toString();
64
+ ].toString(),
65
+ };
53
66
  }
54
67
 
55
68
  if ( gradientAST.colorStops.some( hasUnsupportedLength ) ) {
@@ -57,19 +70,18 @@ export function getGradientAstWithDefault( value ) {
57
70
  const step = 100 / ( colorStops.length - 1 );
58
71
  colorStops.forEach( ( stop, index ) => {
59
72
  stop.length = {
60
- value: step * index,
73
+ value: `${ step * index }`,
61
74
  type: '%',
62
75
  };
63
76
  } );
64
- gradientAST.value = serializeGradient( gradientAST );
65
77
  }
66
78
 
67
- return gradientAST;
79
+ return { gradientAST, hasGradient };
68
80
  }
69
81
 
70
82
  export function getGradientAstWithControlPoints(
71
- gradientAST,
72
- newControlPoints
83
+ gradientAST: gradientParser.GradientNode,
84
+ newControlPoints: ControlPoint[]
73
85
  ) {
74
86
  return {
75
87
  ...gradientAST,
@@ -81,13 +93,16 @@ export function getGradientAstWithControlPoints(
81
93
  value: position?.toString(),
82
94
  },
83
95
  type: a < 1 ? 'rgba' : 'rgb',
84
- value: a < 1 ? [ r, g, b, a ] : [ r, g, b ],
96
+ value:
97
+ a < 1
98
+ ? [ `${ r }`, `${ g }`, `${ b }`, `${ a }` ]
99
+ : [ `${ r }`, `${ g }`, `${ b }` ],
85
100
  };
86
101
  } ),
87
- };
102
+ } as gradientParser.GradientNode;
88
103
  }
89
104
 
90
- export function getStopCssColor( colorStop ) {
105
+ export function getStopCssColor( colorStop: gradientParser.ColorStop ) {
91
106
  switch ( colorStop.type ) {
92
107
  case 'hex':
93
108
  return `#${ colorStop.value }`;
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render, fireEvent, screen } from '@testing-library/react';
4
+ import { render, screen } from '@testing-library/react';
5
+ import userEvent from '@testing-library/user-event';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -9,7 +10,8 @@ import { render, fireEvent, screen } from '@testing-library/react';
9
10
  import CustomSelectControl from '..';
10
11
 
11
12
  describe( 'CustomSelectControl', () => {
12
- it( 'Captures the keypress event and does not let it propagate', () => {
13
+ it( 'Captures the keypress event and does not let it propagate', async () => {
14
+ const user = userEvent.setup();
13
15
  const onKeyDown = jest.fn();
14
16
  const options = [
15
17
  {
@@ -39,10 +41,10 @@ describe( 'CustomSelectControl', () => {
39
41
  </div>
40
42
  );
41
43
  const toggleButton = screen.getByRole( 'button' );
42
- fireEvent.click( toggleButton );
44
+ await user.click( toggleButton );
43
45
 
44
46
  const customSelect = screen.getByRole( 'listbox' );
45
- fireEvent.keyDown( customSelect );
47
+ await user.type( customSelect, '{enter}' );
46
48
 
47
49
  expect( onKeyDown ).toHaveBeenCalledTimes( 0 );
48
50
  } );
@@ -7,11 +7,11 @@ import { swatch } from '@wordpress/icons';
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
- import Button from '../button';
11
- import ColorPalette from '../color-palette';
12
- import ColorIndicator from '../color-indicator';
13
- import Icon from '../icon';
14
- import { HStack } from '../h-stack';
10
+ import Button from '../../button';
11
+ import ColorPalette from '../../color-palette';
12
+ import ColorIndicator from '../../color-indicator';
13
+ import Icon from '../../icon';
14
+ import { HStack } from '../../h-stack';
15
15
  import type { ColorListPickerProps, ColorOptionProps } from './types';
16
16
 
17
17
  function ColorOption( {
@@ -75,7 +75,8 @@ function ColorListPicker( {
75
75
  disableCustomColors={ disableCustomColors }
76
76
  enableAlpha={ enableAlpha }
77
77
  onChange={ ( newColor ) => {
78
- const newColors = value.slice();
78
+ const newColors: ( string | undefined )[] =
79
+ value.slice();
79
80
  newColors[ index ] = newColor;
80
81
  onChange( newColors );
81
82
  } }
@@ -5,7 +5,7 @@ import type { CSSProperties } from 'react';
5
5
 
6
6
  export type ColorListPickerProps = {
7
7
  /**
8
- * A list of predifened colors. Each color is an object with a `name` and a
8
+ * A list of predefined colors. Each color is an object with a `name` and a
9
9
  * `color` value.
10
10
  * The `name` is a string used to identify the color in the UI.
11
11
  * The `color` is a valid CSS color string.
@@ -21,7 +21,7 @@ export type ColorListPickerProps = {
21
21
  /**
22
22
  * An array containing the currently selected colors.
23
23
  */
24
- value?: Array< string | undefined >;
24
+ value?: Array< string >;
25
25
  /**
26
26
  * Controls whether the custom color picker is displayed.
27
27
  */
@@ -11,7 +11,13 @@ import {
11
11
 
12
12
  const PLACEHOLDER_VALUES = [ '#333', '#CCC' ];
13
13
 
14
- export default function CustomDuotoneBar( { value, onChange } ) {
14
+ export default function CustomDuotoneBar( {
15
+ value,
16
+ onChange,
17
+ }: {
18
+ value?: string[];
19
+ onChange: ( value?: string[] ) => void;
20
+ } ) {
15
21
  const hasGradient = !! value;
16
22
  const values = hasGradient ? value : PLACEHOLDER_VALUES;
17
23
  const background = getGradientFromCSSColors( values );
@@ -12,14 +12,48 @@ import { __, sprintf } from '@wordpress/i18n';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import ColorListPicker from '../color-list-picker';
15
+ import ColorListPicker from './color-list-picker';
16
16
  import CircularOptionPicker from '../circular-option-picker';
17
17
  import { VStack } from '../v-stack';
18
18
 
19
19
  import CustomDuotoneBar from './custom-duotone-bar';
20
20
  import { getDefaultColors, getGradientFromCSSColors } from './utils';
21
21
  import { Spacer } from '../spacer';
22
+ import type { DuotonePickerProps } from './types';
22
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
+ */
23
57
  function DuotonePicker( {
24
58
  clearable = true,
25
59
  unsetable = true,
@@ -29,7 +63,7 @@ function DuotonePicker( {
29
63
  disableCustomDuotone,
30
64
  value,
31
65
  onChange,
32
- } ) {
66
+ }: DuotonePickerProps ) {
33
67
  const [ defaultDark, defaultLight ] = useMemo(
34
68
  () => getDefaultColors( colorPalette ),
35
69
  [ colorPalette ]
@@ -125,6 +159,9 @@ function DuotonePicker( {
125
159
  newColors.length >= 2
126
160
  ? newColors
127
161
  : undefined;
162
+ // @ts-expect-error TODO: The color arrays for a DuotonePicker should be a tuple of two colors,
163
+ // but it's currently typed as a string[].
164
+ // See also https://github.com/WordPress/gutenberg/pull/49060#discussion_r1136951035
128
165
  onChange( newValue );
129
166
  } }
130
167
  />
@@ -9,8 +9,9 @@ import { swatch } from '@wordpress/icons';
9
9
  import ColorIndicator from '../color-indicator';
10
10
  import Icon from '../icon';
11
11
  import { getGradientFromCSSColors } from './utils';
12
+ import type { DuotoneSwatchProps } from './types';
12
13
 
13
- function DuotoneSwatch( { values } ) {
14
+ function DuotoneSwatch( { values }: DuotoneSwatchProps ) {
14
15
  return values ? (
15
16
  <ColorIndicator
16
17
  colorValue={ getGradientFromCSSColors( values, '135deg' ) }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -6,23 +11,22 @@ import { useState } from '@wordpress/element';
6
11
  /**
7
12
  * Internal dependencies
8
13
  */
9
- import { DuotonePicker } from '../';
14
+ import { DuotonePicker } from '..';
15
+ import type { DuotonePickerProps } from '../types';
10
16
 
11
- export default {
17
+ const meta: ComponentMeta< typeof DuotonePicker > = {
12
18
  title: 'Components/DuotonePicker',
13
19
  component: DuotonePicker,
14
20
  argTypes: {
15
- clearable: { control: { type: 'boolean' } },
16
- disableCustomColors: { control: { type: 'boolean' } },
17
- disableCustomDuotone: { control: { type: 'boolean' } },
18
21
  onChange: { action: 'onChange' },
19
- unsetable: { control: { type: 'boolean' } },
22
+ value: { control: { type: null } },
20
23
  },
21
24
  parameters: {
22
25
  controls: { expanded: true },
23
26
  docs: { source: { state: 'open' } },
24
27
  },
25
28
  };
29
+ export default meta;
26
30
 
27
31
  const DUOTONE_PALETTE = [
28
32
  {
@@ -44,8 +48,11 @@ const COLOR_PALETTE = [
44
48
  { color: '#8c00b7', name: 'Purple', slug: 'purple' },
45
49
  ];
46
50
 
47
- const Template = ( { onChange, ...args } ) => {
48
- const [ value, setValue ] = useState();
51
+ const Template: ComponentStory< typeof DuotonePicker > = ( {
52
+ onChange,
53
+ ...args
54
+ } ) => {
55
+ const [ value, setValue ] = useState< DuotonePickerProps[ 'value' ] >();
49
56
 
50
57
  return (
51
58
  <DuotonePicker
@@ -1,9 +1,14 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
4
- import { DuotoneSwatch } from '../';
9
+ import { DuotoneSwatch } from '..';
5
10
 
6
- export default {
11
+ const meta: ComponentMeta< typeof DuotoneSwatch > = {
7
12
  title: 'Components/DuotoneSwatch',
8
13
  component: DuotoneSwatch,
9
14
  parameters: {
@@ -11,8 +16,9 @@ export default {
11
16
  docs: { source: { state: 'open' } },
12
17
  },
13
18
  };
19
+ export default meta;
14
20
 
15
- const Template = ( args ) => {
21
+ const Template: ComponentStory< typeof DuotoneSwatch > = ( args ) => {
16
22
  return <DuotoneSwatch { ...args } />;
17
23
  };
18
24
 
@@ -0,0 +1,61 @@
1
+ export type DuotonePickerProps = {
2
+ /**
3
+ * Whether there should be a button to clear the duotone value.
4
+ *
5
+ * @default true
6
+ */
7
+ clearable?: boolean;
8
+ /**
9
+ * Whether there should be an `unset` option.
10
+ *
11
+ * @default true
12
+ */
13
+ unsetable?: boolean;
14
+ /**
15
+ * Array of color presets of the form `{ color: '#000000', name: 'Black', slug: 'black' }`.
16
+ */
17
+ colorPalette: Color[];
18
+ /**
19
+ * Array of duotone presets of the form `{ colors: [ '#000000', '#ffffff' ], name: 'Grayscale', slug: 'grayscale' }`.
20
+ */
21
+ duotonePalette: DuotoneColor[];
22
+ /**
23
+ * Whether custom colors should be disabled.
24
+ *
25
+ * @default false
26
+ */
27
+ disableCustomColors?: boolean;
28
+ /**
29
+ * Whether custom duotone values should be disabled.
30
+ *
31
+ * @default false
32
+ */
33
+ disableCustomDuotone?: boolean;
34
+ /**
35
+ * An array of colors for the duotone effect.
36
+ */
37
+ value?: string[] | 'unset';
38
+ /**
39
+ * Callback which is called when the duotone colors change.
40
+ */
41
+ onChange: ( value: DuotonePickerProps[ 'value' ] | undefined ) => void;
42
+ };
43
+
44
+ type Color = {
45
+ color: string;
46
+ name: string;
47
+ slug: string;
48
+ };
49
+
50
+ type DuotoneColor = {
51
+ colors: string[];
52
+ name: string;
53
+ slug: string;
54
+ };
55
+
56
+ export type DuotoneSwatchProps = {
57
+ /**
58
+ * An array of colors to show or `null` to show the placeholder swatch icon.
59
+ */
60
+ values?: string[] | null;
61
+ };
@@ -4,6 +4,11 @@
4
4
  import { colord, extend } from 'colord';
5
5
  import namesPlugin from 'colord/plugins/names';
6
6
 
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import type { DuotonePickerProps } from './types';
11
+
7
12
  extend( [ namesPlugin ] );
8
13
 
9
14
  /**
@@ -18,11 +23,13 @@ extend( [ namesPlugin ] );
18
23
  /**
19
24
  * Calculate the brightest and darkest values from a color palette.
20
25
  *
21
- * @param {Object[]} palette Color palette for the theme.
26
+ * @param palette Color palette for the theme.
22
27
  *
23
- * @return {string[]} Tuple of the darkest color and brightest color.
28
+ * @return Tuple of the darkest color and brightest color.
24
29
  */
25
- export function getDefaultColors( palette ) {
30
+ export function getDefaultColors(
31
+ palette: DuotonePickerProps[ 'colorPalette' ]
32
+ ) {
26
33
  // A default dark and light color are required.
27
34
  if ( ! palette || palette.length < 2 ) return [ '#000', '#fff' ];
28
35
 
@@ -38,7 +45,10 @@ export function getDefaultColors( palette ) {
38
45
  current.brightness >= max.brightness ? current : max,
39
46
  ];
40
47
  },
41
- [ { brightness: 1 }, { brightness: 0 } ]
48
+ [
49
+ { brightness: 1, color: '' },
50
+ { brightness: 0, color: '' },
51
+ ]
42
52
  )
43
53
  .map( ( { color } ) => color );
44
54
  }
@@ -46,12 +56,15 @@ export function getDefaultColors( palette ) {
46
56
  /**
47
57
  * Generate a duotone gradient from a list of colors.
48
58
  *
49
- * @param {string[]} colors CSS color strings.
50
- * @param {string} angle CSS gradient angle.
59
+ * @param colors CSS color strings.
60
+ * @param angle CSS gradient angle.
51
61
  *
52
- * @return {string} CSS gradient string for the duotone swatch.
62
+ * @return CSS gradient string for the duotone swatch.
53
63
  */
54
- export function getGradientFromCSSColors( colors = [], angle = '90deg' ) {
64
+ export function getGradientFromCSSColors(
65
+ colors: string[] = [],
66
+ angle = '90deg'
67
+ ) {
55
68
  const l = 100 / colors.length;
56
69
 
57
70
  const stops = colors
@@ -64,11 +77,11 @@ export function getGradientFromCSSColors( colors = [], angle = '90deg' ) {
64
77
  /**
65
78
  * Convert a color array to an array of color stops.
66
79
  *
67
- * @param {string[]} colors CSS colors array
80
+ * @param colors CSS colors array
68
81
  *
69
- * @return {Object[]} Color stop information.
82
+ * @return Color stop information.
70
83
  */
71
- export function getColorStopsFromColors( colors ) {
84
+ export function getColorStopsFromColors( colors: string[] ) {
72
85
  return colors.map( ( color, i ) => ( {
73
86
  position: ( i * 100 ) / ( colors.length - 1 ),
74
87
  color,
@@ -78,10 +91,12 @@ export function getColorStopsFromColors( colors ) {
78
91
  /**
79
92
  * Convert a color stop array to an array colors.
80
93
  *
81
- * @param {Object[]} colorStops Color stop information.
94
+ * @param colorStops Color stop information.
82
95
  *
83
- * @return {string[]} CSS colors array.
96
+ * @return CSS colors array.
84
97
  */
85
- export function getColorsFromColorStops( colorStops = [] ) {
98
+ export function getColorsFromColorStops(
99
+ colorStops: { position: number; color: string }[] = []
100
+ ) {
86
101
  return colorStops.map( ( { color } ) => color );
87
102
  }
@@ -16,7 +16,7 @@ The CSS display property of `FlexItem`.
16
16
 
17
17
  ### `isBlock`: `boolean`
18
18
 
19
- Determins if `FlexItem` should render as an adaptive full-width block.
19
+ Determines if `FlexItem` should render as an adaptive full-width block.
20
20
 
21
21
  - Required: No
22
22
  - Default: `false`
@@ -61,6 +61,7 @@ The `value` property is handled in a manner similar to controlled form component
61
61
  - `__experimentalShowHowTo` - If false, the text on how to use the select (ie: _Separate with commas or the Enter key._) will be hidden.
62
62
  - `__experimentalValidateInput` - If passed, all introduced values will be validated before being added as tokens.
63
63
  - `__experimentalAutoSelectFirstMatch` - If true, the select the first matching suggestion when the user presses the Enter key (or space when tokenizeOnSpace is true).
64
+ - `__nextHasNoMarginBottom` - Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.5. (The prop can be safely removed once this happens.)
64
65
 
65
66
  ## Usage
66
67