@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
@@ -1,10 +1,114 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { Colord } from 'colord';
4
+ import type { Colord, HslColor, HsvaColor, HsvColor, RgbaColor, RgbColor } from 'colord';
5
+ import type { HslaColor } from 'react-colorful';
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import type { WordPressComponentProps } from '../ui/context';
10
+ import type { useDeprecatedProps } from './use-deprecated-props';
5
11
  export type ColorType = 'rgb' | 'hsl' | 'hex';
6
12
  export type ColorCopyButtonProps = {
7
13
  color: Colord;
8
14
  colorType: ColorType;
9
15
  };
16
+ export type LegacyAdapterProps = Parameters<typeof useDeprecatedProps>[0];
17
+ export type ColorPickerProps = WordPressComponentProps<{
18
+ /**
19
+ * When `true` the color picker will display the alpha channel both in
20
+ * the bottom inputs as well as in the color picker itself.
21
+ *
22
+ * @default false
23
+ */
24
+ enableAlpha?: boolean;
25
+ /**
26
+ * The current color value to display in the picker.
27
+ * Must be a hex or hex8 string.
28
+ */
29
+ color?: string;
30
+ /**
31
+ * Fired when the color changes. Always passes a hex or hex8 color string.
32
+ */
33
+ onChange?: (color: string) => void;
34
+ /**
35
+ * An optional default value to use for the color picker.
36
+ */
37
+ defaultValue?: string;
38
+ /**
39
+ * The format to copy when clicking the displayed color format.
40
+ */
41
+ copyFormat?: ColorType;
42
+ }, 'div', false>;
43
+ export interface PickerProps {
44
+ color: Colord;
45
+ enableAlpha: boolean;
46
+ onChange: (nextColor: Colord) => void;
47
+ }
48
+ export interface ColorInputProps {
49
+ colorType: 'hsl' | 'hex' | 'rgb';
50
+ color: Colord;
51
+ onChange: (nextColor: Colord) => void;
52
+ enableAlpha: boolean;
53
+ }
54
+ export interface InputWithSliderProps {
55
+ min: number;
56
+ max: number;
57
+ value: number;
58
+ label: string;
59
+ abbreviation: string;
60
+ onChange: (value: number) => void;
61
+ }
62
+ export interface HexInputProps {
63
+ color: Colord;
64
+ onChange: (nextColor: Colord) => void;
65
+ enableAlpha: boolean;
66
+ }
67
+ export interface HslInputProps {
68
+ color: Colord;
69
+ onChange: (nextColor: Colord) => void;
70
+ enableAlpha: boolean;
71
+ }
72
+ export interface RgbInputProps {
73
+ color: Colord;
74
+ onChange: (nextColor: Colord) => void;
75
+ enableAlpha: boolean;
76
+ }
77
+ /**
78
+ * @deprecated
79
+ */
80
+ export type LegacyColor = string | {
81
+ hex: string;
82
+ hsl: HslColor | HslaColor;
83
+ hsv: HsvColor | HsvaColor;
84
+ rgb: RgbColor | RgbaColor;
85
+ /**
86
+ * @deprecated
87
+ */
88
+ oldHue: number;
89
+ /**
90
+ * @deprecated
91
+ */
92
+ source: 'hex';
93
+ };
94
+ /**
95
+ * @deprecated
96
+ */
97
+ export interface LegacyProps {
98
+ color?: LegacyColor;
99
+ /**
100
+ * @deprecated
101
+ */
102
+ onChangeComplete: (colors: LegacyColor) => void;
103
+ /**
104
+ * @deprecated
105
+ */
106
+ oldHue: string;
107
+ className: string;
108
+ /**
109
+ * @deprecated
110
+ */
111
+ disableAlpha: boolean;
112
+ onChange?: never;
113
+ }
10
114
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/color-picker/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAC9C,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/color-picker/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD;;GAEG;AACH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAC9C,MAAM,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAE,OAAO,kBAAkB,CAAE,CAAE,CAAC,CAAE,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CACrD;IACC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACvB,EACD,KAAK,EACL,KAAK,CACL,CAAC;AAEF,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACxC,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACxC,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACxC,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IACxC,WAAW,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GACpB,MAAM,GACN;IACA,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC1B,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC1B,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;CACb,CAAC;AAEL;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,gBAAgB,EAAE,CAAE,MAAM,EAAE,WAAW,KAAM,IAAI,CAAC;IAClD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC;CACjB"}
@@ -1,49 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { HslColor, HslaColor, HsvColor, HsvaColor, RgbColor, RgbaColor } from 'colord';
5
- import type { ComponentProps } from 'react';
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
9
- import type ColorPicker from './component';
10
- type ColorPickerProps = ComponentProps<typeof ColorPicker>;
11
- /**
12
- * @deprecated
13
- */
14
- type LegacyColor = string | {
15
- hex: string;
16
- hsl: HslColor | HslaColor;
17
- hsv: HsvColor | HsvaColor;
18
- rgb: RgbColor | RgbaColor;
19
- /**
20
- * @deprecated
21
- */
22
- oldHue: number;
23
- /**
24
- * @deprecated
25
- */
26
- source: 'hex';
27
- };
28
- /**
29
- * @deprecated
30
- */
31
- export interface LegacyProps {
32
- color?: LegacyColor;
33
- /**
34
- * @deprecated
35
- */
36
- onChangeComplete: (colors: LegacyColor) => void;
37
- /**
38
- * @deprecated
39
- */
40
- oldHue: string;
41
- className: string;
42
- /**
43
- * @deprecated
44
- */
45
- disableAlpha: boolean;
46
- }
4
+ import type { ColorPickerProps, LegacyProps } from './types';
47
5
  export declare function useDeprecatedProps(props: LegacyProps | ColorPickerProps): ColorPickerProps;
48
- export {};
49
6
  //# sourceMappingURL=use-deprecated-props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-deprecated-props.d.ts","sourceRoot":"","sources":["../../src/color-picker/use-deprecated-props.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEN,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ5C;;GAEG;AACH,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAE3C,KAAK,gBAAgB,GAAG,cAAc,CAAE,OAAO,WAAW,CAAE,CAAC;AAE7D;;GAEG;AACH,KAAK,WAAW,GACb,MAAM,GACN;IACA,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC1B,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC1B,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC;CACb,CAAC;AAEL;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,gBAAgB,EAAE,CAAE,MAAM,EAAE,WAAW,KAAM,IAAI,CAAC;IAClD;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;CACtB;AAyCD,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GACnC,gBAAgB,CAqBlB"}
1
+ {"version":3,"file":"use-deprecated-props.d.ts","sourceRoot":"","sources":["../../src/color-picker/use-deprecated-props.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAyC1E,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GACnC,gBAAgB,CAqBlB"}
@@ -1,14 +1,14 @@
1
- export const DEFAULT_GRADIENT: "linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)";
2
- export const DEFAULT_LINEAR_GRADIENT_ANGLE: 180;
3
- export namespace HORIZONTAL_GRADIENT_ORIENTATION {
4
- const type: string;
5
- const value: number;
6
- }
7
- export const GRADIENT_OPTIONS: {
1
+ export declare const DEFAULT_GRADIENT = "linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)";
2
+ export declare const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
3
+ export declare const HORIZONTAL_GRADIENT_ORIENTATION: {
4
+ readonly type: "angular";
5
+ readonly value: "90";
6
+ };
7
+ export declare const GRADIENT_OPTIONS: {
8
8
  value: string;
9
9
  label: string;
10
10
  }[];
11
- export const DIRECTIONAL_ORIENTATION_ANGLE_MAP: {
11
+ export declare const DIRECTIONAL_ORIENTATION_ANGLE_MAP: {
12
12
  top: number;
13
13
  'top right': number;
14
14
  'right top': number;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/constants.js"],"names":[],"mappings":"AAKA,0GAC4E;AAE5E,gDAAiD;;;;;AAOjD;;;IAGE;AAEF;;;;;;;;;;;;;EAaE"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,6EAC8C,CAAC;AAE5E,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,eAAO,MAAM,+BAA+B;;;CAGlC,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;GAG5B,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;CAa7C,CAAC"}
@@ -1,8 +1,8 @@
1
- export const GRADIENT_MARKERS_WIDTH: 16;
2
- export const INSERT_POINT_WIDTH: 16;
3
- export const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT: 10;
4
- export const MINIMUM_DISTANCE_BETWEEN_POINTS: 0;
5
- export const MINIMUM_SIGNIFICANT_MOVE: 5;
6
- export const KEYBOARD_CONTROL_POINT_VARIATION: 10;
7
- export const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER: number;
1
+ export declare const GRADIENT_MARKERS_WIDTH = 16;
2
+ export declare const INSERT_POINT_WIDTH = 16;
3
+ export declare const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;
4
+ export declare const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;
5
+ export declare const MINIMUM_SIGNIFICANT_MOVE = 5;
6
+ export declare const KEYBOARD_CONTROL_POINT_VARIATION = 10;
7
+ export declare const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER: number;
8
8
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/constants.js"],"names":[],"mappings":"AAAA,wCAAyC;AACzC,oCAAqC;AACrC,6DAA8D;AAC9D,gDAAiD;AACjD,yCAA0C;AAE1C,kDAC6C;AAC7C,kEACqD"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,2CAA2C,KAAK,CAAC;AAC9D,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,gCAAgC,KACD,CAAC;AAC7C,eAAO,MAAM,4CAA4C,QACL,CAAC"}
@@ -1,25 +1,8 @@
1
- export default ControlPoints;
2
- declare function ControlPoints({ disableRemove, disableAlpha, gradientPickerDomRef, ignoreMarkerPosition, value: controlPoints, onChange, onStartControlPointChange, onStopControlPointChange, __experimentalIsRenderedInSidebar, }: {
3
- disableRemove: any;
4
- disableAlpha: any;
5
- gradientPickerDomRef: any;
6
- ignoreMarkerPosition: any;
7
- value: any;
8
- onChange: any;
9
- onStartControlPointChange: any;
10
- onStopControlPointChange: any;
11
- __experimentalIsRenderedInSidebar: any;
12
- }): any;
1
+ /// <reference types="react" />
2
+ import type { ControlPointsProps, InsertPointProps } from '../types';
3
+ declare function ControlPoints({ disableRemove, disableAlpha, gradientPickerDomRef, ignoreMarkerPosition, value: controlPoints, onChange, onStartControlPointChange, onStopControlPointChange, __experimentalIsRenderedInSidebar, }: ControlPointsProps): JSX.Element;
13
4
  declare namespace ControlPoints {
14
- export { InsertPoint };
5
+ var InsertPoint: ({ value: controlPoints, onChange, onOpenInserter, onCloseInserter, insertPosition, disableAlpha, __experimentalIsRenderedInSidebar, }: InsertPointProps) => JSX.Element;
15
6
  }
16
- declare function InsertPoint({ value: controlPoints, onChange, onOpenInserter, onCloseInserter, insertPosition, disableAlpha, __experimentalIsRenderedInSidebar, }: {
17
- value: any;
18
- onChange: any;
19
- onOpenInserter: any;
20
- onCloseInserter: any;
21
- insertPosition: any;
22
- disableAlpha: any;
23
- __experimentalIsRenderedInSidebar: any;
24
- }): JSX.Element;
7
+ export default ControlPoints;
25
8
  //# sourceMappingURL=control-points.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-points.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/control-points.js"],"names":[],"mappings":";AAsGA;;;;;;;;;;QA0LC;;;;AAED;;;;;;;;gBAqEC"}
1
+ {"version":3,"file":"control-points.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/control-points.tsx"],"names":[],"mappings":";AAqCA,OAAO,KAAK,EAGX,kBAAkB,EAClB,gBAAgB,EAChB,MAAM,UAAU,CAAC;AAwElB,iBAAS,aAAa,CAAE,EACvB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,EAAE,aAAa,EACpB,QAAQ,EACR,yBAAyB,EACzB,wBAAwB,EACxB,iCAAiC,GACjC,EAAE,kBAAkB,eAyMpB;kBAnNQ,aAAa;;;AA6RtB,eAAe,aAAa,CAAC"}
@@ -1,10 +1,4 @@
1
- export default function CustomGradientBar({ background, hasGradient, value: controlPoints, onChange, disableInserter, disableAlpha, __experimentalIsRenderedInSidebar, }: {
2
- background: any;
3
- hasGradient: any;
4
- value: any;
5
- onChange: any;
6
- disableInserter?: boolean | undefined;
7
- disableAlpha?: boolean | undefined;
8
- __experimentalIsRenderedInSidebar: any;
9
- }): JSX.Element;
1
+ /// <reference types="react" />
2
+ import type { CustomGradientBarProps } from '../types';
3
+ export default function CustomGradientBar({ background, hasGradient, value: controlPoints, onChange, disableInserter, disableAlpha, __experimentalIsRenderedInSidebar, }: CustomGradientBarProps): JSX.Element;
10
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/index.js"],"names":[],"mappings":"AAsEA;;;;;;;;gBAgHC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EACX,sBAAsB,EAItB,MAAM,UAAU,CAAC;AA2DlB,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,UAAU,EACV,WAAW,EACX,KAAK,EAAE,aAAa,EACpB,QAAQ,EACR,eAAuB,EACvB,YAAoB,EACpB,iCAAyC,GACzC,EAAE,sBAAsB,eAoHxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/custom-gradient-picker/gradient-bar/test/utils.ts"],"names":[],"mappings":""}
@@ -1,138 +1,90 @@
1
- /**
2
- * Control point for the gradient bar.
3
- *
4
- * @typedef {Object} ControlPoint
5
- * @property {string} color Color of the control point.
6
- * @property {number} position Integer position of the control point as a percentage.
7
- */
8
- /**
9
- * Color as parsed from the gradient by gradient-parser.
10
- *
11
- * @typedef {Object} Color
12
- * @property {string} r Red component.
13
- * @property {string} g Green component.
14
- * @property {string} b Green component.
15
- * @property {string} [a] Optional alpha component.
16
- */
1
+ import type { ControlPoint } from '../types';
17
2
  /**
18
3
  * Clamps a number between 0 and 100.
19
4
  *
20
- * @param {number} value Value to clamp.
5
+ * @param value Value to clamp.
21
6
  *
22
- * @return {number} Value clamped between 0 and 100.
7
+ * @return Value clamped between 0 and 100.
23
8
  */
24
- export function clampPercent(value: number): number;
9
+ export declare function clampPercent(value: number): number;
25
10
  /**
26
11
  * Check if a control point is overlapping with another.
27
12
  *
28
- * @param {ControlPoint[]} value Array of control points.
29
- * @param {number} initialIndex Index of the position to test.
30
- * @param {number} newPosition New position of the control point.
31
- * @param {number} minDistance Distance considered to be overlapping.
13
+ * @param value Array of control points.
14
+ * @param initialIndex Index of the position to test.
15
+ * @param newPosition New position of the control point.
16
+ * @param minDistance Distance considered to be overlapping.
32
17
  *
33
- * @return {boolean} True if the point is overlapping.
18
+ * @return True if the point is overlapping.
34
19
  */
35
- export function isOverlapping(value: ControlPoint[], initialIndex: number, newPosition: number, minDistance?: number): boolean;
20
+ export declare function isOverlapping(value: ControlPoint[], initialIndex: number, newPosition: number, minDistance?: number): boolean;
36
21
  /**
37
22
  * Adds a control point from an array and returns the new array.
38
23
  *
39
- * @param {ControlPoint[]} points Array of control points.
40
- * @param {number} position Position to insert the new point.
41
- * @param {Color} color Color to update the control point at index.
24
+ * @param points Array of control points.
25
+ * @param position Position to insert the new point.
26
+ * @param color Color to update the control point at index.
42
27
  *
43
- * @return {ControlPoint[]} New array of control points.
28
+ * @return New array of control points.
44
29
  */
45
- export function addControlPoint(points: ControlPoint[], position: number, color: Color): ControlPoint[];
30
+ export declare function addControlPoint(points: ControlPoint[], position: number, color: ControlPoint['color']): ControlPoint[];
46
31
  /**
47
32
  * Removes a control point from an array and returns the new array.
48
33
  *
49
- * @param {ControlPoint[]} points Array of control points.
50
- * @param {number} index Index to remove.
34
+ * @param points Array of control points.
35
+ * @param index Index to remove.
51
36
  *
52
- * @return {ControlPoint[]} New array of control points.
37
+ * @return New array of control points.
53
38
  */
54
- export function removeControlPoint(points: ControlPoint[], index: number): ControlPoint[];
39
+ export declare function removeControlPoint(points: ControlPoint[], index: number): ControlPoint[];
55
40
  /**
56
41
  * Updates a control point from an array and returns the new array.
57
42
  *
58
- * @param {ControlPoint[]} points Array of control points.
59
- * @param {number} index Index to update.
60
- * @param {ControlPoint[]} newPoint New control point to replace the index.
43
+ * @param points Array of control points.
44
+ * @param index Index to update.
45
+ * @param newPoint New control point to replace the index.
61
46
  *
62
- * @return {ControlPoint[]} New array of control points.
47
+ * @return New array of control points.
63
48
  */
64
- export function updateControlPoint(points: ControlPoint[], index: number, newPoint: ControlPoint[]): ControlPoint[];
49
+ export declare function updateControlPoint(points: ControlPoint[], index: number, newPoint: ControlPoint): ControlPoint[];
65
50
  /**
66
51
  * Updates the position of a control point from an array and returns the new array.
67
52
  *
68
- * @param {ControlPoint[]} points Array of control points.
69
- * @param {number} index Index to update.
70
- * @param {number} newPosition Position to move the control point at index.
53
+ * @param points Array of control points.
54
+ * @param index Index to update.
55
+ * @param newPosition Position to move the control point at index.
71
56
  *
72
- * @return {ControlPoint[]} New array of control points.
57
+ * @return New array of control points.
73
58
  */
74
- export function updateControlPointPosition(points: ControlPoint[], index: number, newPosition: number): ControlPoint[];
59
+ export declare function updateControlPointPosition(points: ControlPoint[], index: number, newPosition: ControlPoint['position']): ControlPoint[];
75
60
  /**
76
61
  * Updates the position of a control point from an array and returns the new array.
77
62
  *
78
- * @param {ControlPoint[]} points Array of control points.
79
- * @param {number} index Index to update.
80
- * @param {Color} newColor Color to update the control point at index.
63
+ * @param points Array of control points.
64
+ * @param index Index to update.
65
+ * @param newColor Color to update the control point at index.
81
66
  *
82
- * @return {ControlPoint[]} New array of control points.
67
+ * @return New array of control points.
83
68
  */
84
- export function updateControlPointColor(points: ControlPoint[], index: number, newColor: Color): ControlPoint[];
69
+ export declare function updateControlPointColor(points: ControlPoint[], index: number, newColor: ControlPoint['color']): ControlPoint[];
85
70
  /**
86
71
  * Updates the position of a control point from an array and returns the new array.
87
72
  *
88
- * @param {ControlPoint[]} points Array of control points.
89
- * @param {number} position Position of the color stop.
90
- * @param {string} newColor Color to update the control point at index.
73
+ * @param points Array of control points.
74
+ * @param position Position of the color stop.
75
+ * @param newColor Color to update the control point at index.
91
76
  *
92
- * @return {ControlPoint[]} New array of control points.
77
+ * @return New array of control points.
93
78
  */
94
- export function updateControlPointColorByPosition(points: ControlPoint[], position: number, newColor: string): ControlPoint[];
79
+ export declare function updateControlPointColorByPosition(points: ControlPoint[], position: ControlPoint['position'], newColor: ControlPoint['color']): ControlPoint[];
95
80
  /**
96
81
  * Gets the horizontal coordinate when dragging a control point with the mouse.
97
82
  *
98
- * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
99
- * @param {Element} containerElement Container for the gradient picker.
83
+ * @param mouseXcoordinate Horizontal coordinate of the mouse position.
84
+ * @param containerElement Container for the gradient picker.
100
85
  *
101
- * @return {number | undefined} Whole number percentage from the left.
102
- */
103
- export function getHorizontalRelativeGradientPosition(mouseXCoordinate: number, containerElement: Element): number | undefined;
104
- /**
105
- * Control point for the gradient bar.
106
- */
107
- export type ControlPoint = {
108
- /**
109
- * Color of the control point.
110
- */
111
- color: string;
112
- /**
113
- * Integer position of the control point as a percentage.
114
- */
115
- position: number;
116
- };
117
- /**
118
- * Color as parsed from the gradient by gradient-parser.
86
+ * @return Whole number percentage from the left.
119
87
  */
120
- export type Color = {
121
- /**
122
- * Red component.
123
- */
124
- r: string;
125
- /**
126
- * Green component.
127
- */
128
- g: string;
129
- /**
130
- * Green component.
131
- */
132
- b: string;
133
- /**
134
- * Optional alpha component.
135
- */
136
- a?: string | undefined;
137
- };
88
+ export declare function getHorizontalRelativeGradientPosition(mouseXcoordinate: number, containerElement: HTMLDivElement): number;
89
+ export declare function getHorizontalRelativeGradientPosition(mouseXcoordinate: number, containerElement: null): undefined;
138
90
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/utils.js"],"names":[],"mappings":"AAOA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH;;;;;;GAMG;AACH,oCAJW,MAAM,GAEL,MAAM,CAIjB;AAED;;;;;;;;;GASG;AACH,qCAPW,YAAY,EAAE,gBACd,MAAM,eACN,MAAM,gBACN,MAAM,GAEL,OAAO,CAmBlB;AAED;;;;;;;;GAQG;AACH,wCANW,YAAY,EAAE,YACd,MAAM,SACN,KAAK,GAEJ,YAAY,EAAE,CAUzB;AAED;;;;;;;GAOG;AACH,2CALW,YAAY,EAAE,SACd,MAAM,GAEL,YAAY,EAAE,CAMzB;AAED;;;;;;;;GAQG;AACH,2CANW,YAAY,EAAE,SACd,MAAM,YACN,YAAY,EAAE,GAEb,YAAY,EAAE,CAMzB;AAED;;;;;;;;GAQG;AACH,mDANW,YAAY,EAAE,SACd,MAAM,eACN,MAAM,GAEL,YAAY,EAAE,CAWzB;AAED;;;;;;;;GAQG;AACH,gDANW,YAAY,EAAE,SACd,MAAM,YACN,KAAK,GAEJ,YAAY,EAAE,CAQzB;AAED;;;;;;;;GAQG;AACH,0DANW,YAAY,EAAE,YACd,MAAM,YACN,MAAM,GAEL,YAAY,EAAE,CASzB;AAED;;;;;;;GAOG;AACH,wEALW,MAAM,oBACN,OAAO,GAEN,MAAM,GAAG,SAAS,CAc7B;;;;;;;;WAjLa,MAAM;;;;cACN,MAAM;;;;;;;;;OAON,MAAM;;;;OACN,MAAM;;;;OACN,MAAM"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/gradient-bar/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAE,KAAK,EAAE,MAAM,UAE1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,YAAY,EAAE,EACrB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,WAAW,GAAE,MAAwC,WAarD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,YAAY,EAAE,EACtB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,YAAY,CAAE,OAAO,CAAE,kBAS9B;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,kBAIxE;AACD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CACjC,MAAM,EAAE,YAAY,EAAE,EACtB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,YAAY,kBAKtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,YAAY,EAAE,EACtB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,YAAY,CAAE,UAAU,CAAE,kBAUvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACtC,MAAM,EAAE,YAAY,EAAE,EACtB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,YAAY,CAAE,OAAO,CAAE,kBAOjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,YAAY,EAAE,EACtB,QAAQ,EAAE,YAAY,CAAE,UAAU,CAAE,EACpC,QAAQ,EAAE,YAAY,CAAE,OAAO,CAAE,kBAIjC;AAED;;;;;;;GAOG;AACH,wBAAgB,qCAAqC,CACpD,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,cAAc,GAC9B,MAAM,CAAC;AACV,wBAAgB,qCAAqC,CACpD,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,IAAI,GACpB,SAAS,CAAC"}
@@ -1,7 +1,28 @@
1
- export default function CustomGradientPicker({ __nextHasNoMargin, value, onChange, __experimentalIsRenderedInSidebar, }: {
2
- __nextHasNoMargin?: boolean | undefined;
3
- value: any;
4
- onChange: any;
5
- __experimentalIsRenderedInSidebar: any;
6
- }): JSX.Element;
1
+ /// <reference types="react" />
2
+ import type { CustomGradientPickerProps } from './types';
3
+ /**
4
+ * CustomGradientPicker is a React component that renders a UI for specifying
5
+ * linear or radial gradients. Radial gradients are displayed in the picker as
6
+ * a slice of the gradient from the center to the outside.
7
+ *
8
+ * ```jsx
9
+ * import { CustomGradientPicker } from '@wordpress/components';
10
+ * import { useState } from '@wordpress/element';
11
+ *
12
+ * const MyCustomGradientPicker = () => {
13
+ * const [ gradient, setGradient ] = useState();
14
+ *
15
+ * return (
16
+ * <CustomGradientPicker
17
+ * value={ gradient }
18
+ * onChange={ setGradient }
19
+ * />
20
+ * );
21
+ * };
22
+ * ```
23
+ */
24
+ export declare function CustomGradientPicker({
25
+ /** Start opting into the new margin-free styles that will become the default in a future version. */
26
+ __nextHasNoMargin, value, onChange, __experimentalIsRenderedInSidebar, }: CustomGradientPickerProps): JSX.Element;
27
+ export default CustomGradientPicker;
7
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/index.js"],"names":[],"mappings":"AA6GA;;;;;gBA+EC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/index.tsx"],"names":[],"mappings":";AAoCA,OAAO,KAAK,EACX,yBAAyB,EAGzB,MAAM,SAAS,CAAC;AAiFjB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAE;AACrC,qGAAqG;AACrG,iBAAyB,EACzB,KAAK,EACL,QAAQ,EACR,iCAAyC,GACzC,EAAE,yBAAyB,eA+E3B;AAED,eAAe,oBAAoB,CAAC"}
@@ -1,17 +1,14 @@
1
- export function serializeGradientColor({ type, value }: {
2
- type: any;
3
- value: any;
4
- }): any;
5
- export function serializeGradientPosition(position: any): string;
6
- export function serializeGradientColorStop({ type, value, length }: {
7
- type: any;
8
- value: any;
9
- length: any;
10
- }): string;
11
- export function serializeGradientOrientation(orientation: any): string | undefined;
12
- export function serializeGradient({ type, orientation, colorStops }: {
13
- type: any;
14
- orientation: any;
15
- colorStops: any;
16
- }): string;
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type gradientParser from 'gradient-parser';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import type { ColorStopTypeAndValue } from './types';
9
+ export declare function serializeGradientColor({ type, value, }: ColorStopTypeAndValue): string;
10
+ export declare function serializeGradientPosition(position: gradientParser.ColorStop['length']): string;
11
+ export declare function serializeGradientColorStop({ type, value, length, }: gradientParser.ColorStop): string;
12
+ export declare function serializeGradientOrientation(orientation: gradientParser.GradientNode['orientation']): string | undefined;
13
+ export declare function serializeGradient({ type, orientation, colorStops, }: gradientParser.GradientNode): string;
17
14
  //# sourceMappingURL=serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/serializer.js"],"names":[],"mappings":"AAEA;;;QAQC;AAED,iEAMC;AAED;;;;WAKC;AAED,mFAKC;AAED;;;;WAaC"}
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/serializer.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAClD;;GAEG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,sBAAsB,CAAE,EACvC,IAAI,EACJ,KAAK,GACL,EAAE,qBAAqB,UAQvB;AAED,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAE,QAAQ,CAAE,UAO9C;AAED,wBAAgB,0BAA0B,CAAE,EAC3C,IAAI,EACJ,KAAK,EACL,MAAM,GACN,EAAE,cAAc,CAAC,SAAS,UAK1B;AAED,wBAAgB,4BAA4B,CAC3C,WAAW,EAAE,cAAc,CAAC,YAAY,CAAE,aAAa,CAAE,sBAUzD;AAED,wBAAgB,iBAAiB,CAAE,EAClC,IAAI,EACJ,WAAW,EACX,UAAU,GACV,EAAE,cAAc,CAAC,YAAY,UAqB7B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import CustomGradientPicker from '../';
9
+ declare const meta: ComponentMeta<typeof CustomGradientPicker>;
10
+ export default meta;
11
+ export declare const Default: ComponentStory<typeof CustomGradientPicker>;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMtE;;GAEG;AACH,OAAO,oBAAoB,MAAM,KAAK,CAAC;AAEvC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,oBAAoB,CAQrD,CAAC;AACF,eAAe,IAAI,CAAC;AAkBpB,eAAO,MAAM,OAAO,6CAA2C,CAAC"}
@@ -1,9 +1,10 @@
1
- export const SelectWrapper: import("@emotion/styled").StyledComponent<import("../../flex/types").FlexBlockProps & import("react").RefAttributes<any> & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "display" | "children" | "as" | keyof import("react").RefAttributes<any>> & {
1
+ /// <reference types="react" />
2
+ export declare const SelectWrapper: import("@emotion/styled").StyledComponent<import("../../flex/types").FlexBlockProps & import("react").RefAttributes<any> & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "display" | "children" | "as" | keyof import("react").RefAttributes<any>> & {
2
3
  as?: keyof JSX.IntrinsicElements | undefined;
3
4
  } & {
4
5
  theme?: import("@emotion/react").Theme | undefined;
5
6
  }, {}, {}>;
6
- export const AccessoryWrapper: import("@emotion/styled").StyledComponent<import("../../flex/types").FlexBlockProps & import("react").RefAttributes<any> & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "display" | "children" | "as" | keyof import("react").RefAttributes<any>> & {
7
+ export declare const AccessoryWrapper: import("@emotion/styled").StyledComponent<import("../../flex/types").FlexBlockProps & import("react").RefAttributes<any> & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "display" | "children" | "as" | keyof import("react").RefAttributes<any>> & {
7
8
  as?: keyof JSX.IntrinsicElements | undefined;
8
9
  } & {
9
10
  theme?: import("@emotion/react").Theme | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"custom-gradient-picker-styles.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/styles/custom-gradient-picker-styles.js"],"names":[],"mappings":"AASA;;;;WAEE;AAEF;;;;WAEE"}
1
+ {"version":3,"file":"custom-gradient-picker-styles.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/styles/custom-gradient-picker-styles.tsx"],"names":[],"mappings":";AASA,eAAO,MAAM,aAAa;;;;UAEzB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;UAE5B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../src/custom-gradient-picker/test/serializer.ts"],"names":[],"mappings":""}