@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,120 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * External dependencies
4
+ */
5
+ import type gradientParser from 'gradient-parser';
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
+ export type GradientAnglePickerProps = {
35
+ gradientAST: gradientParser.LinearGradientNode | gradientParser.RepeatingLinearGradientNode;
36
+ hasGradient: boolean;
37
+ onChange: (gradient: string) => void;
38
+ };
39
+ export type GradientTypePickerProps = {
40
+ gradientAST: gradientParser.GradientNode;
41
+ hasGradient: boolean;
42
+ onChange: (gradient: string) => void;
43
+ };
44
+ export type ControlPoint = {
45
+ color: string;
46
+ position: number;
47
+ };
48
+ type DistributivePick<T, K extends keyof T> = T extends any ? Pick<T, K> : never;
49
+ export type ColorStopTypeAndValue = DistributivePick<gradientParser.ColorStop, 'type' | 'value'>;
50
+ export type CustomGradientBarProps = {
51
+ background: React.CSSProperties['background'];
52
+ hasGradient: boolean;
53
+ value: ControlPoint[];
54
+ onChange: (newControlPoints: ControlPoint[]) => void;
55
+ disableInserter?: boolean;
56
+ disableAlpha?: boolean;
57
+ __experimentalIsRenderedInSidebar?: boolean;
58
+ };
59
+ export type CustomGradientBarIdleState = {
60
+ id: 'IDLE';
61
+ };
62
+ type CustomGradientBarMovingInserterState = {
63
+ id: 'MOVING_INSERTER';
64
+ insertPosition: number;
65
+ };
66
+ type CustomGradientBarInsertingControlPointState = {
67
+ id: 'INSERTING_CONTROL_POINT';
68
+ insertPosition: number;
69
+ };
70
+ type CustomGradientBarMovingControlPointState = {
71
+ id: 'MOVING_CONTROL_POINT';
72
+ };
73
+ export type CustomGradientBarReducerState = CustomGradientBarIdleState | CustomGradientBarMovingInserterState | CustomGradientBarInsertingControlPointState | CustomGradientBarMovingControlPointState;
74
+ export type CustomGradientBarReducerAction = {
75
+ type: 'MOVE_INSERTER';
76
+ insertPosition: number;
77
+ } | {
78
+ type: 'STOP_INSERTER_MOVE';
79
+ } | {
80
+ type: 'OPEN_INSERTER';
81
+ } | {
82
+ type: 'CLOSE_INSERTER';
83
+ } | {
84
+ type: 'START_CONTROL_CHANGE';
85
+ } | {
86
+ type: 'STOP_CONTROL_CHANGE';
87
+ };
88
+ export type ControlPointButtonProps = {
89
+ isOpen: boolean;
90
+ position: ControlPoint['position'];
91
+ color: string;
92
+ };
93
+ export type ControlPointsProps = {
94
+ disableRemove: boolean;
95
+ disableAlpha: boolean;
96
+ gradientPickerDomRef: React.RefObject<HTMLDivElement>;
97
+ ignoreMarkerPosition?: number;
98
+ value: ControlPoint[];
99
+ onChange: (controlPoints: ControlPoint[]) => void;
100
+ onStartControlPointChange: () => void;
101
+ onStopControlPointChange: () => void;
102
+ __experimentalIsRenderedInSidebar: boolean;
103
+ };
104
+ export type ControlPointMoveState = {
105
+ initialPosition: number;
106
+ index: number;
107
+ significantMoveHappened: boolean;
108
+ listenersActivated: boolean;
109
+ };
110
+ export type InsertPointProps = {
111
+ value: ControlPoint[];
112
+ onChange: (controlPoints: ControlPoint[]) => void;
113
+ onOpenInserter: () => void;
114
+ onCloseInserter: () => void;
115
+ insertPosition: number;
116
+ disableAlpha: boolean;
117
+ __experimentalIsRenderedInSidebar: boolean;
118
+ };
119
+ export {};
120
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/types.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,yBAAyB,GAAG;IACvC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,O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C;IACtB,QAAQ,EAAE,CAAE,aAAa,EAAE,YAAY,EAAE,KAAM,IAAI,CAAC;IACpD,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,iCAAiC,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB,EAAE,OAAO,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAE,aAAa,EAAE,YAAY,EAAE,KAAM,IAAI,CAAC;IACpD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,iCAAiC,EAAE,OAAO,CAAC;CAC3C,CAAC"}
@@ -1,5 +1,13 @@
1
- export function getLinearGradientRepresentation(gradientAST: any): string;
2
- export function getGradientAstWithDefault(value: any): any;
3
- export function getGradientAstWithControlPoints(gradientAST: any, newControlPoints: any): any;
4
- export function getStopCssColor(colorStop: any): any;
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import gradientParser from 'gradient-parser';
5
+ import type { ControlPoint } from './types';
6
+ export declare function getLinearGradientRepresentation(gradientAST: gradientParser.GradientNode): string;
7
+ export declare function getGradientAstWithDefault(value?: string | null): {
8
+ gradientAST: gradientParser.GradientNode;
9
+ hasGradient: boolean;
10
+ };
11
+ export declare function getGradientAstWithControlPoints(gradientAST: gradientParser.GradientNode, newControlPoints: ControlPoint[]): gradientParser.GradientNode;
12
+ export declare function getStopCssColor(colorStop: gradientParser.ColorStop): string;
5
13
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/utils.js"],"names":[],"mappings":"AAqBA,0EAMC;AAMD,2DAkCC;AAED,8FAkBC;AAED,qDAcC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/custom-gradient-picker/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAa7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,wBAAgB,+BAA+B,CAC9C,WAAW,EAAE,cAAc,CAAC,YAAY,UAOxC;AAMD,wBAAgB,yBAAyB,CAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;;;EA6C/D;AAED,wBAAgB,+BAA+B,CAC9C,WAAW,EAAE,cAAc,CAAC,YAAY,EACxC,gBAAgB,EAAE,YAAY,EAAE,+BAmBhC;AAED,wBAAgB,eAAe,CAAE,SAAS,EAAE,cAAc,CAAC,SAAS,UAcnE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/duotone-picker/color-list-picker/index.tsx"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,SAAS,CAAC;AA4CtE,iBAAS,eAAe,CAAE,EACzB,MAAM,EACN,MAAM,EACN,KAAU,EACV,mBAAmB,EACnB,WAAW,EACX,QAAQ,GACR,EAAE,oBAAoB,eAqBtB;AAED,eAAe,eAAe,CAAC"}
@@ -4,7 +4,7 @@
4
4
  import type { CSSProperties } from 'react';
5
5
  export type ColorListPickerProps = {
6
6
  /**
7
- * A list of predifened colors. Each color is an object with a `name` and a
7
+ * A list of predefined colors. Each color is an object with a `name` and a
8
8
  * `color` value.
9
9
  * The `name` is a string used to identify the color in the UI.
10
10
  * The `color` is a valid CSS color string.
@@ -20,7 +20,7 @@ export type ColorListPickerProps = {
20
20
  /**
21
21
  * An array containing the currently selected colors.
22
22
  */
23
- value?: Array<string | undefined>;
23
+ value?: Array<string>;
24
24
  /**
25
25
  * Controls whether the custom color picker is displayed.
26
26
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/duotone-picker/color-list-picker/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG;IAClC;;;;;OAKG;IACH,MAAM,EAAE,KAAK,CAAE;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,WAAW,CAAE,aAAa,CAAE,OAAO,CAAE,CAAE,CAAC;KAC/C,CAAE,CAAC;IACJ;;OAEG;IACH,MAAM,EAAE,KAAK,CAAE,MAAM,CAAE,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAE,MAAM,CAAE,CAAC;IACxB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,CAAE,QAAQ,EAAE,KAAK,CAAE,MAAM,GAAG,SAAS,CAAE,KAAM,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAClC,oBAAoB,EACpB,QAAQ,GAAG,qBAAqB,GAAG,aAAa,CAChD,GAAG;IACH,KAAK,EAAE,oBAAoB,CAAE,QAAQ,CAAE,CAAE,MAAM,CAAE,CAAC;IAClD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,CAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,KAAM,IAAI,CAAC;CACnD,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export default function CustomDuotoneBar({ value, onChange, }: {
3
+ value?: string[];
4
+ onChange: (value?: string[]) => void;
5
+ }): JSX.Element;
6
+ //# sourceMappingURL=custom-duotone-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-duotone-bar.d.ts","sourceRoot":"","sources":["../../src/duotone-picker/custom-duotone-bar.tsx"],"names":[],"mappings":";AAaA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,EACzC,KAAK,EACL,QAAQ,GACR,EAAE;IACF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,CAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAM,IAAI,CAAC;CACvC,eAiBA"}
@@ -0,0 +1,38 @@
1
+ /// <reference types="react" />
2
+ import type { DuotonePickerProps } from './types';
3
+ /**
4
+ * ```jsx
5
+ * import { DuotonePicker, DuotoneSwatch } from '@wordpress/components';
6
+ * import { useState } from '@wordpress/element';
7
+ *
8
+ * const DUOTONE_PALETTE = [
9
+ * { colors: [ '#8c00b7', '#fcff41' ], name: 'Purple and yellow', slug: 'purple-yellow' },
10
+ * { colors: [ '#000097', '#ff4747' ], name: 'Blue and red', slug: 'blue-red' },
11
+ * ];
12
+ *
13
+ * const COLOR_PALETTE = [
14
+ * { color: '#ff4747', name: 'Red', slug: 'red' },
15
+ * { color: '#fcff41', name: 'Yellow', slug: 'yellow' },
16
+ * { color: '#000097', name: 'Blue', slug: 'blue' },
17
+ * { color: '#8c00b7', name: 'Purple', slug: 'purple' },
18
+ * ];
19
+ *
20
+ * const Example = () => {
21
+ * const [ duotone, setDuotone ] = useState( [ '#000000', '#ffffff' ] );
22
+ * return (
23
+ * <>
24
+ * <DuotonePicker
25
+ * duotonePalette={ DUOTONE_PALETTE }
26
+ * colorPalette={ COLOR_PALETTE }
27
+ * value={ duotone }
28
+ * onChange={ setDuotone }
29
+ * />
30
+ * <DuotoneSwatch values={ duotone } />
31
+ * </>
32
+ * );
33
+ * };
34
+ * ```
35
+ */
36
+ declare function DuotonePicker({ clearable, unsetable, colorPalette, duotonePalette, disableCustomColors, disableCustomDuotone, value, onChange, }: DuotonePickerProps): JSX.Element;
37
+ export default DuotonePicker;
38
+ //# sourceMappingURL=duotone-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duotone-picker.d.ts","sourceRoot":"","sources":["../../src/duotone-picker/duotone-picker.tsx"],"names":[],"mappings":";AAqBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,iBAAS,aAAa,CAAE,EACvB,SAAgB,EAChB,SAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,EACL,QAAQ,GACR,EAAE,kBAAkB,eA2GpB;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { DuotoneSwatchProps } from './types';
3
+ declare function DuotoneSwatch({ values }: DuotoneSwatchProps): JSX.Element;
4
+ export default DuotoneSwatch;
5
+ //# sourceMappingURL=duotone-swatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duotone-swatch.d.ts","sourceRoot":"","sources":["../../src/duotone-picker/duotone-swatch.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,iBAAS,aAAa,CAAE,EAAE,MAAM,EAAE,EAAE,kBAAkB,eAQrD;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as DuotonePicker } from './duotone-picker';
2
+ export { default as DuotoneSwatch } from './duotone-swatch';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/duotone-picker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { DuotonePicker } from '..';
9
+ declare const meta: ComponentMeta<typeof DuotonePicker>;
10
+ export default meta;
11
+ export declare const Default: ComponentStory<typeof DuotonePicker>;
12
+ //# sourceMappingURL=duotone-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duotone-picker.d.ts","sourceRoot":"","sources":["../../../src/duotone-picker/stories/duotone-picker.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOtE;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGnC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,aAAa,CAW9C,CAAC;AACF,eAAe,IAAI,CAAC;AAwCpB,eAAO,MAAM,OAAO,sCAAsB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { DuotoneSwatch } from '..';
9
+ declare const meta: ComponentMeta<typeof DuotoneSwatch>;
10
+ export default meta;
11
+ export declare const Default: ComponentStory<typeof DuotoneSwatch>;
12
+ export declare const SingleColor: ComponentStory<typeof DuotoneSwatch>;
13
+ export declare const Null: ComponentStory<typeof DuotoneSwatch>;
14
+ //# sourceMappingURL=duotone-swatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duotone-swatch.d.ts","sourceRoot":"","sources":["../../../src/duotone-picker/stories/duotone-swatch.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEnC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,aAAa,CAO9C,CAAC;AACF,eAAe,IAAI,CAAC;AAMpB,eAAO,MAAM,OAAO,sCAAsB,CAAC;AAK3C,eAAO,MAAM,WAAW,sCAAsB,CAAC;AAK/C,eAAO,MAAM,IAAI,sCAAsB,CAAC"}
@@ -0,0 +1,60 @@
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
+ type Color = {
44
+ color: string;
45
+ name: string;
46
+ slug: string;
47
+ };
48
+ type DuotoneColor = {
49
+ colors: string[];
50
+ name: string;
51
+ slug: string;
52
+ };
53
+ export type DuotoneSwatchProps = {
54
+ /**
55
+ * An array of colors to show or `null` to show the placeholder swatch icon.
56
+ */
57
+ values?: string[] | null;
58
+ };
59
+ export {};
60
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/duotone-picker/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,KAAK,EAAE,CAAC;IACtB;;OAEG;IACH,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,CAAE,KAAK,EAAE,kBAAkB,CAAE,OAAO,CAAE,GAAG,SAAS,KAAM,IAAI,CAAC;CACvE,CAAC;AAEF,KAAK,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,KAAK,YAAY,GAAG;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACzB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { DuotonePickerProps } from './types';
5
+ /**
6
+ * Object representation for a color.
7
+ *
8
+ * @typedef {Object} RGBColor
9
+ * @property {number} r Red component of the color in the range [0,1].
10
+ * @property {number} g Green component of the color in the range [0,1].
11
+ * @property {number} b Blue component of the color in the range [0,1].
12
+ */
13
+ /**
14
+ * Calculate the brightest and darkest values from a color palette.
15
+ *
16
+ * @param palette Color palette for the theme.
17
+ *
18
+ * @return Tuple of the darkest color and brightest color.
19
+ */
20
+ export declare function getDefaultColors(palette: DuotonePickerProps['colorPalette']): string[];
21
+ /**
22
+ * Generate a duotone gradient from a list of colors.
23
+ *
24
+ * @param colors CSS color strings.
25
+ * @param angle CSS gradient angle.
26
+ *
27
+ * @return CSS gradient string for the duotone swatch.
28
+ */
29
+ export declare function getGradientFromCSSColors(colors?: string[], angle?: string): string;
30
+ /**
31
+ * Convert a color array to an array of color stops.
32
+ *
33
+ * @param colors CSS colors array
34
+ *
35
+ * @return Color stop information.
36
+ */
37
+ export declare function getColorStopsFromColors(colors: string[]): {
38
+ position: number;
39
+ color: string;
40
+ }[];
41
+ /**
42
+ * Convert a color stop array to an array colors.
43
+ *
44
+ * @param colorStops Color stop information.
45
+ *
46
+ * @return CSS colors array.
47
+ */
48
+ export declare function getColorsFromColorStops(colorStops?: {
49
+ position: number;
50
+ color: string;
51
+ }[]): string[];
52
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/duotone-picker/utils.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIlD;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,kBAAkB,CAAE,cAAc,CAAE,YAuB7C;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,GAAE,MAAM,EAAO,EACrB,KAAK,SAAU,UASf;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAE,MAAM,EAAE,MAAM,EAAE;;;IAKxD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,GAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAO,YAGtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form-token-field/index.tsx"],"names":[],"mappings":";AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,SAAS,CAAC;AAM9D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,mBAAmB,eAurBzD;AAED,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form-token-field/index.tsx"],"names":[],"mappings":";AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,SAAS,CAAC;AAU9D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,mBAAmB,eA0rBzD;AAED,eAAe,cAAc,CAAC"}
@@ -160,6 +160,12 @@ export interface FormTokenFieldProps extends Pick<ComponentPropsWithRef<'input'>
160
160
  __experimentalRenderItem?: (args: {
161
161
  item: string;
162
162
  }) => ReactNode;
163
+ /**
164
+ * Start opting into the new margin-free styles that will become the default in a future version.
165
+ *
166
+ * @default false
167
+ */
168
+ __nextHasNoMarginBottom?: boolean;
163
169
  }
164
170
  /**
165
171
  * `T` can be either a `string` or an object which must have a `value` prop as a string.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/form-token-field/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,qBAAqB,EACrB,iBAAiB,EACjB,SAAS,EACT,MAAM,OAAO,CAAC;AAEf,KAAK,QAAQ,GAAG;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YA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M,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,uBAAuB,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAE,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAM,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;CACd"}
@@ -1,12 +1,50 @@
1
- export default function GradientPicker({ __nextHasNoMargin, className, gradients, onChange, value, clearable, disableCustomGradients, __experimentalIsRenderedInSidebar, headingLevel, }: {
2
- __nextHasNoMargin?: boolean | undefined;
3
- className: any;
4
- gradients: any;
5
- onChange: any;
6
- value: any;
7
- clearable?: boolean | undefined;
8
- disableCustomGradients?: boolean | undefined;
9
- __experimentalIsRenderedInSidebar: any;
10
- headingLevel?: number | undefined;
11
- }): JSX.Element;
1
+ /// <reference types="react" />
2
+ import type { GradientPickerComponentProps } from './types';
3
+ /**
4
+ * GradientPicker is a React component that renders a color gradient picker to
5
+ * define a multi step gradient. There's either a _linear_ or a _radial_ type
6
+ * available.
7
+ *
8
+ * ```jsx
9
+ *import { GradientPicker } from '@wordpress/components';
10
+ *import { useState } from '@wordpress/element';
11
+ *
12
+ *const myGradientPicker = () => {
13
+ * const [ gradient, setGradient ] = useState( null );
14
+ *
15
+ * return (
16
+ * <GradientPicker
17
+ * __nextHasNoMargin
18
+ * value={ gradient }
19
+ * onChange={ ( currentGradient ) => setGradient( currentGradient ) }
20
+ * gradients={ [
21
+ * {
22
+ * name: 'JShine',
23
+ * gradient:
24
+ * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
25
+ * slug: 'jshine',
26
+ * },
27
+ * {
28
+ * name: 'Moonlit Asteroid',
29
+ * gradient:
30
+ * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
31
+ * slug: 'moonlit-asteroid',
32
+ * },
33
+ * {
34
+ * name: 'Rastafarie',
35
+ * gradient:
36
+ * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
37
+ * slug: 'rastafari',
38
+ * },
39
+ * ] }
40
+ * />
41
+ * );
42
+ *};
43
+ *```
44
+ *
45
+ */
46
+ export declare function GradientPicker({
47
+ /** Start opting into the new margin-free styles that will become the default in a future version. */
48
+ __nextHasNoMargin, className, gradients, onChange, value, clearable, disableCustomGradients, __experimentalIsRenderedInSidebar, headingLevel, }: GradientPickerComponentProps): JSX.Element;
49
+ export default GradientPicker;
12
50
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gradient-picker/index.js"],"names":[],"mappings":"AA6GA;;;;;;;;;;gBAyEC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gradient-picker/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EACX,4BAA4B,EAI5B,MAAM,SAAS,CAAC;AAsGjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,cAAc,CAAE;AAC/B,qGAAqG;AACrG,iBAAyB,EACzB,SAAS,EACT,SAAc,EACd,QAAQ,EACR,KAAK,EACL,SAAgB,EAChB,sBAA8B,EAC9B,iCAAiC,EACjC,YAAgB,GAChB,EAAE,4BAA4B,eA0D9B;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import GradientPicker from '..';
9
+ declare const meta: ComponentMeta<typeof GradientPicker>;
10
+ export default meta;
11
+ export declare const Default: ComponentStory<typeof GradientPicker>;
12
+ export declare const WithNoExistingGradients: ComponentStory<typeof GradientPicker>;
13
+ export declare const MultipleOrigins: ComponentStory<typeof GradientPicker>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gradient-picker/stories/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMtE;;GAEG;AACH,OAAO,cAAc,MAAM,IAAI,CAAC;AAEhC,QAAA,MAAM,IAAI,EAAE,aAAa,CAAE,OAAO,cAAc,CAW/C,CAAC;AACF,eAAe,IAAI,CAAC;AA2DpB,eAAO,MAAM,OAAO,uCAAsB,CAAC;AAM3C,eAAO,MAAM,uBAAuB,uCAAsB,CAAC;AAM3D,eAAO,MAAM,eAAe,uCAAsB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Internal dependencies
4
+ */
5
+ import type { HeadingSize } from '../heading/types';
6
+ export type GradientObject = {
7
+ gradient: string;
8
+ name: string;
9
+ slug: string;
10
+ };
11
+ export type OriginObject = {
12
+ name: string;
13
+ gradients: GradientObject[];
14
+ };
15
+ export type GradientsProp = GradientObject[] | OriginObject[];
16
+ type GradientPickerBaseProps = {
17
+ /**
18
+ * The class name added to the wrapper.
19
+ */
20
+ className?: string;
21
+ /**
22
+ * The function called when a new gradient has been defined. It is passed to
23
+ * the `currentGradient` as an argument.
24
+ */
25
+ onChange: (currentGradient: string | undefined) => void;
26
+ /**
27
+ * The current value of the gradient. Pass a css gradient string (See default value for example).
28
+ * Optionally pass in a `null` value to specify no gradient is currently selected.
29
+ *
30
+ * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'
31
+ */
32
+ value?: GradientObject['gradient'] | null;
33
+ /**
34
+ * Whether the palette should have a clearing button or not.
35
+ *
36
+ * @default true
37
+ */
38
+ clearable?: boolean;
39
+ /**
40
+ * The heading level. Only applies in cases where gradients are provided
41
+ * from multiple origins (ie. when the array passed as the `gradients` prop
42
+ * contains two or more items).
43
+ *
44
+ * @default 2
45
+ */
46
+ headingLevel?: HeadingSize;
47
+ };
48
+ export type GradientPickerComponentProps = GradientPickerBaseProps & {
49
+ /**
50
+ * An array of objects as predefined gradients displayed above the gradient
51
+ * selector. Alternatively, if there are multiple sets (or 'origins') of
52
+ * gradients, you can pass an array of objects each with a `name` and a
53
+ * `gradients` array which will in turn contain the predefined gradient objects.
54
+ *
55
+ * @default []
56
+ */
57
+ gradients?: GradientsProp;
58
+ /**
59
+ * Start opting in to the new margin-free styles that will become the default
60
+ * in a future version, currently scheduled to be WordPress 6.4. (The prop
61
+ * can be safely removed once this happens.)
62
+ *
63
+ * @default false
64
+ */
65
+ __nextHasNoMargin?: boolean;
66
+ /**
67
+ * If true, the gradient picker will not be displayed and only defined
68
+ * gradients from `gradients` will be shown.
69
+ *
70
+ * @default false
71
+ */
72
+ disableCustomGradients?: boolean;
73
+ /**
74
+ * Whether this is rendered in the sidebar.
75
+ *
76
+ * @default false
77
+ */
78
+ __experimentalIsRenderedInSidebar?: boolean;
79
+ };
80
+ export type PickerProps<TOriginType extends GradientObject | OriginObject> = GradientPickerBaseProps & {
81
+ clearGradient: () => void;
82
+ onChange: (currentGradient: string | undefined, index: number) => void;
83
+ actions?: React.ReactNode;
84
+ gradients: TOriginType[];
85
+ };
86
+ export {};
87
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gradient-picker/types.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACb,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,S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;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,cAAc,EAAE,EAC1B,UAAU,EAAE,MAAM,UAqBlB;AAkOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAE,EAC5B,SAAS,EACT,MAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,wBAA4B,EAC5B,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,UAAe,GACf,EAAE,gBAAgB,eA6OlB;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/palette-edit/index.tsx"],"names":[],"mappings":";AA4CA,OAAO,KAAK,EAOX,gBAAgB,EAChB,cAAc,EACd,MAAM,SAAS,CAAC;AAejB;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,cAAc,EAAE,EAC1B,UAAU,EAAE,MAAM,UAqBlB;AAkOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAE,EAC5B,SAAS,EACT,MAAoB,EACpB,QAAQ,EACR,YAAY,EACZ,wBAA4B,EAC5B,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,UAAe,GACf,EAAE,gBAAgB,eA4OlB;AAED,eAAe,WAAW,CAAC"}
@@ -4,7 +4,7 @@ export declare const POSITIONS: {
4
4
  readonly bottom: "bottom";
5
5
  readonly corner: "corner";
6
6
  };
7
- export type Position = typeof POSITIONS[keyof typeof POSITIONS];
7
+ export type Position = (typeof POSITIONS)[keyof typeof POSITIONS];
8
8
  interface UseResizeLabelProps {
9
9
  /** The label value. */
10
10
  label?: string;