@wordpress/components 28.11.0 → 28.13.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 (560) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/CONTRIBUTING.md +16 -16
  3. package/build/autocomplete/autocompleter-ui.js +1 -0
  4. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  5. package/build/border-box-control/border-box-control/component.js +1 -0
  6. package/build/border-box-control/border-box-control/component.js.map +1 -1
  7. package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
  8. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  9. package/build/border-control/border-control/component.js +2 -1
  10. package/build/border-control/border-control/component.js.map +1 -1
  11. package/build/border-control/border-control/hook.js +3 -1
  12. package/build/border-control/border-control/hook.js.map +1 -1
  13. package/build/border-control/border-control-dropdown/component.js +1 -1
  14. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  15. package/build/border-control/types.js.map +1 -1
  16. package/build/box-control/all-input-control.js +1 -0
  17. package/build/box-control/all-input-control.js.map +1 -1
  18. package/build/box-control/axial-input-controls.js +1 -0
  19. package/build/box-control/axial-input-controls.js.map +1 -1
  20. package/build/box-control/index.js +13 -13
  21. package/build/box-control/index.js.map +1 -1
  22. package/build/box-control/input-controls.js +1 -0
  23. package/build/box-control/input-controls.js.map +1 -1
  24. package/build/box-control/types.js.map +1 -1
  25. package/build/circular-option-picker/circular-option-picker-actions.js +1 -0
  26. package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  27. package/build/circular-option-picker/circular-option-picker-option.js +1 -0
  28. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  29. package/build/color-palette/index.js +2 -0
  30. package/build/color-palette/index.js.map +1 -1
  31. package/build/color-picker/color-copy-button.js +6 -4
  32. package/build/color-picker/color-copy-button.js.map +1 -1
  33. package/build/color-picker/component.js +1 -0
  34. package/build/color-picker/component.js.map +1 -1
  35. package/build/color-picker/styles.js +21 -28
  36. package/build/color-picker/styles.js.map +1 -1
  37. package/build/combobox-control/index.js +17 -12
  38. package/build/combobox-control/index.js.map +1 -1
  39. package/build/composite/hover.js +1 -1
  40. package/build/composite/hover.js.map +1 -1
  41. package/build/composite/typeahead.js +1 -1
  42. package/build/composite/typeahead.js.map +1 -1
  43. package/build/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  44. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  45. package/build/dashicon/types.js.map +1 -1
  46. package/build/dimension-control/index.js +7 -0
  47. package/build/dimension-control/index.js.map +1 -1
  48. package/build/disabled/index.js +8 -1
  49. package/build/disabled/index.js.map +1 -1
  50. package/build/duotone-picker/duotone-picker.js +2 -0
  51. package/build/duotone-picker/duotone-picker.js.map +1 -1
  52. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  53. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  54. package/build/font-size-picker/index.js +7 -0
  55. package/build/font-size-picker/index.js.map +1 -1
  56. package/build/form-file-upload/index.js +7 -1
  57. package/build/form-file-upload/index.js.map +1 -1
  58. package/build/form-token-field/token.js +1 -0
  59. package/build/form-token-field/token.js.map +1 -1
  60. package/build/gradient-picker/index.js +34 -32
  61. package/build/gradient-picker/index.js.map +1 -1
  62. package/build/gradient-picker/types.js.map +1 -1
  63. package/build/guide/page-control.js +1 -0
  64. package/build/guide/page-control.js.map +1 -1
  65. package/build/icon/index.js +9 -0
  66. package/build/icon/index.js.map +1 -1
  67. package/build/menu/styles.js +16 -16
  68. package/build/menu/styles.js.map +1 -1
  69. package/build/menu-item/index.js +1 -0
  70. package/build/menu-item/index.js.map +1 -1
  71. package/build/modal/index.js +2 -2
  72. package/build/modal/index.js.map +1 -1
  73. package/build/notice/index.js +2 -0
  74. package/build/notice/index.js.map +1 -1
  75. package/build/palette-edit/index.js +5 -0
  76. package/build/palette-edit/index.js.map +1 -1
  77. package/build/panel/body.js +1 -0
  78. package/build/panel/body.js.map +1 -1
  79. package/build/popover/index.js +4 -1
  80. package/build/popover/index.js.map +1 -1
  81. package/build/private-apis.js +0 -2
  82. package/build/private-apis.js.map +1 -1
  83. package/build/radio-group/radio.js +6 -0
  84. package/build/radio-group/radio.js.map +1 -1
  85. package/build/radio-group/types.js.map +1 -1
  86. package/build/range-control/index.js +11 -0
  87. package/build/range-control/index.js.map +1 -1
  88. package/build/range-control/types.js.map +1 -1
  89. package/build/slot-fill/bubbles-virtually/fill.js +14 -31
  90. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  91. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
  92. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  93. package/build/slot-fill/bubbles-virtually/slot.js +11 -9
  94. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  95. package/build/slot-fill/bubbles-virtually/use-slot.js +1 -8
  96. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  97. package/build/slot-fill/fill.js +7 -24
  98. package/build/slot-fill/fill.js.map +1 -1
  99. package/build/slot-fill/index.js +5 -10
  100. package/build/slot-fill/index.js.map +1 -1
  101. package/build/slot-fill/provider.js +2 -2
  102. package/build/slot-fill/provider.js.map +1 -1
  103. package/build/slot-fill/slot.js +37 -77
  104. package/build/slot-fill/slot.js.map +1 -1
  105. package/build/slot-fill/types.js.map +1 -1
  106. package/build/snackbar/index.js +2 -1
  107. package/build/snackbar/index.js.map +1 -1
  108. package/build/tabs/tablist.js +13 -2
  109. package/build/tabs/tablist.js.map +1 -1
  110. package/build/text-control/index.js +7 -0
  111. package/build/text-control/index.js.map +1 -1
  112. package/build/toggle-group-control/toggle-group-control/component.js +10 -1
  113. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  114. package/build/toggle-group-control/toggle-group-control-option/component.js +1 -0
  115. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  116. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  117. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  118. package/build/toggle-group-control/types.js.map +1 -1
  119. package/build/utils/deprecated-36px-size.js +3 -2
  120. package/build/utils/deprecated-36px-size.js.map +1 -1
  121. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  122. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  123. package/build-module/border-box-control/border-box-control/component.js +1 -0
  124. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  125. package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
  126. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  127. package/build-module/border-control/border-control/component.js +2 -1
  128. package/build-module/border-control/border-control/component.js.map +1 -1
  129. package/build-module/border-control/border-control/hook.js +3 -1
  130. package/build-module/border-control/border-control/hook.js.map +1 -1
  131. package/build-module/border-control/border-control-dropdown/component.js +1 -1
  132. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  133. package/build-module/border-control/types.js.map +1 -1
  134. package/build-module/box-control/all-input-control.js +1 -0
  135. package/build-module/box-control/all-input-control.js.map +1 -1
  136. package/build-module/box-control/axial-input-controls.js +1 -0
  137. package/build-module/box-control/axial-input-controls.js.map +1 -1
  138. package/build-module/box-control/index.js +13 -13
  139. package/build-module/box-control/index.js.map +1 -1
  140. package/build-module/box-control/input-controls.js +1 -0
  141. package/build-module/box-control/input-controls.js.map +1 -1
  142. package/build-module/box-control/types.js.map +1 -1
  143. package/build-module/circular-option-picker/circular-option-picker-actions.js +1 -0
  144. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  145. package/build-module/circular-option-picker/circular-option-picker-option.js +1 -0
  146. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  147. package/build-module/color-palette/index.js +2 -0
  148. package/build-module/color-palette/index.js.map +1 -1
  149. package/build-module/color-picker/color-copy-button.js +6 -4
  150. package/build-module/color-picker/color-copy-button.js.map +1 -1
  151. package/build-module/color-picker/component.js +1 -0
  152. package/build-module/color-picker/component.js.map +1 -1
  153. package/build-module/color-picker/styles.js +20 -27
  154. package/build-module/color-picker/styles.js.map +1 -1
  155. package/build-module/combobox-control/index.js +18 -13
  156. package/build-module/combobox-control/index.js.map +1 -1
  157. package/build-module/composite/hover.js +1 -1
  158. package/build-module/composite/hover.js.map +1 -1
  159. package/build-module/composite/typeahead.js +1 -1
  160. package/build-module/composite/typeahead.js.map +1 -1
  161. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  162. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  163. package/build-module/dashicon/types.js.map +1 -1
  164. package/build-module/dimension-control/index.js +7 -0
  165. package/build-module/dimension-control/index.js.map +1 -1
  166. package/build-module/disabled/index.js +8 -1
  167. package/build-module/disabled/index.js.map +1 -1
  168. package/build-module/duotone-picker/duotone-picker.js +2 -0
  169. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  170. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  171. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  172. package/build-module/font-size-picker/index.js +7 -0
  173. package/build-module/font-size-picker/index.js.map +1 -1
  174. package/build-module/form-file-upload/index.js +7 -1
  175. package/build-module/form-file-upload/index.js.map +1 -1
  176. package/build-module/form-token-field/token.js +1 -0
  177. package/build-module/form-token-field/token.js.map +1 -1
  178. package/build-module/gradient-picker/index.js +34 -32
  179. package/build-module/gradient-picker/index.js.map +1 -1
  180. package/build-module/gradient-picker/types.js.map +1 -1
  181. package/build-module/guide/page-control.js +1 -0
  182. package/build-module/guide/page-control.js.map +1 -1
  183. package/build-module/icon/index.js +9 -0
  184. package/build-module/icon/index.js.map +1 -1
  185. package/build-module/menu/styles.js +16 -16
  186. package/build-module/menu/styles.js.map +1 -1
  187. package/build-module/menu-item/index.js +1 -0
  188. package/build-module/menu-item/index.js.map +1 -1
  189. package/build-module/modal/index.js +2 -2
  190. package/build-module/modal/index.js.map +1 -1
  191. package/build-module/notice/index.js +2 -0
  192. package/build-module/notice/index.js.map +1 -1
  193. package/build-module/palette-edit/index.js +5 -0
  194. package/build-module/palette-edit/index.js.map +1 -1
  195. package/build-module/panel/body.js +1 -0
  196. package/build-module/panel/body.js.map +1 -1
  197. package/build-module/popover/index.js +4 -1
  198. package/build-module/popover/index.js.map +1 -1
  199. package/build-module/private-apis.js +0 -2
  200. package/build-module/private-apis.js.map +1 -1
  201. package/build-module/radio-group/radio.js +6 -0
  202. package/build-module/radio-group/radio.js.map +1 -1
  203. package/build-module/radio-group/types.js.map +1 -1
  204. package/build-module/range-control/index.js +11 -0
  205. package/build-module/range-control/index.js.map +1 -1
  206. package/build-module/range-control/types.js.map +1 -1
  207. package/build-module/slot-fill/bubbles-virtually/fill.js +15 -32
  208. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  209. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
  210. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  211. package/build-module/slot-fill/bubbles-virtually/slot.js +11 -9
  212. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  213. package/build-module/slot-fill/bubbles-virtually/use-slot.js +2 -9
  214. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  215. package/build-module/slot-fill/fill.js +7 -24
  216. package/build-module/slot-fill/fill.js.map +1 -1
  217. package/build-module/slot-fill/index.js +5 -8
  218. package/build-module/slot-fill/index.js.map +1 -1
  219. package/build-module/slot-fill/provider.js +2 -3
  220. package/build-module/slot-fill/provider.js.map +1 -1
  221. package/build-module/slot-fill/slot.js +38 -78
  222. package/build-module/slot-fill/slot.js.map +1 -1
  223. package/build-module/slot-fill/types.js.map +1 -1
  224. package/build-module/snackbar/index.js +2 -1
  225. package/build-module/snackbar/index.js.map +1 -1
  226. package/build-module/tabs/tablist.js +13 -2
  227. package/build-module/tabs/tablist.js.map +1 -1
  228. package/build-module/text-control/index.js +7 -0
  229. package/build-module/text-control/index.js.map +1 -1
  230. package/build-module/toggle-group-control/toggle-group-control/component.js +10 -1
  231. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  232. package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -0
  233. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  234. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  235. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  236. package/build-module/toggle-group-control/types.js.map +1 -1
  237. package/build-module/utils/deprecated-36px-size.js +3 -2
  238. package/build-module/utils/deprecated-36px-size.js.map +1 -1
  239. package/build-style/style-rtl.css +18 -39
  240. package/build-style/style.css +18 -39
  241. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  242. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  243. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  244. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  245. package/build-types/border-control/border-control/component.d.ts +1 -0
  246. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  247. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  248. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  249. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  250. package/build-types/border-control/stories/index.story.d.ts +10 -5
  251. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  252. package/build-types/border-control/types.d.ts +7 -0
  253. package/build-types/border-control/types.d.ts.map +1 -1
  254. package/build-types/box-control/all-input-control.d.ts.map +1 -1
  255. package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
  256. package/build-types/box-control/index.d.ts +13 -13
  257. package/build-types/box-control/input-controls.d.ts.map +1 -1
  258. package/build-types/box-control/styles/box-control-styles.d.ts +2 -1
  259. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  260. package/build-types/box-control/types.d.ts +2 -0
  261. package/build-types/box-control/types.d.ts.map +1 -1
  262. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  263. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  264. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  265. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  266. package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
  267. package/build-types/color-palette/index.d.ts.map +1 -1
  268. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  269. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  270. package/build-types/color-picker/component.d.ts.map +1 -1
  271. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  272. package/build-types/color-picker/styles.d.ts +2 -4
  273. package/build-types/color-picker/styles.d.ts.map +1 -1
  274. package/build-types/combobox-control/index.d.ts +1 -0
  275. package/build-types/combobox-control/index.d.ts.map +1 -1
  276. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  277. package/build-types/composite/typeahead.d.ts.map +1 -1
  278. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  279. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  280. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  281. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  282. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  283. package/build-types/dashicon/types.d.ts +1 -1
  284. package/build-types/dashicon/types.d.ts.map +1 -1
  285. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  286. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  287. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  288. package/build-types/dimension-control/index.d.ts +1 -0
  289. package/build-types/dimension-control/index.d.ts.map +1 -1
  290. package/build-types/disabled/index.d.ts +8 -1
  291. package/build-types/disabled/index.d.ts.map +1 -1
  292. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  293. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  294. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  295. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  296. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  297. package/build-types/external-link/stories/index.story.d.ts.map +1 -1
  298. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  299. package/build-types/font-size-picker/index.d.ts.map +1 -1
  300. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  301. package/build-types/form-file-upload/index.d.ts.map +1 -1
  302. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  303. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  304. package/build-types/form-token-field/token.d.ts.map +1 -1
  305. package/build-types/gradient-picker/index.d.ts +32 -32
  306. package/build-types/gradient-picker/index.d.ts.map +1 -1
  307. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  308. package/build-types/gradient-picker/types.d.ts +1 -5
  309. package/build-types/gradient-picker/types.d.ts.map +1 -1
  310. package/build-types/guide/page-control.d.ts.map +1 -1
  311. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  312. package/build-types/heading/stories/index.story.d.ts.map +1 -1
  313. package/build-types/icon/index.d.ts +23 -7
  314. package/build-types/icon/index.d.ts.map +1 -1
  315. package/build-types/icon/stories/index.story.d.ts +7 -1
  316. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  317. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  318. package/build-types/lock-unlock.d.ts +2 -2
  319. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  320. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  321. package/build-types/menu-item/index.d.ts.map +1 -1
  322. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  323. package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
  324. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  325. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  326. package/build-types/notice/index.d.ts.map +1 -1
  327. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  328. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  329. package/build-types/palette-edit/index.d.ts.map +1 -1
  330. package/build-types/panel/body.d.ts.map +1 -1
  331. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  332. package/build-types/popover/index.d.ts.map +1 -1
  333. package/build-types/popover/stories/index.story.d.ts.map +1 -1
  334. package/build-types/private-apis.d.ts.map +1 -1
  335. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  336. package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
  337. package/build-types/radio-group/radio.d.ts +4 -2
  338. package/build-types/radio-group/radio.d.ts.map +1 -1
  339. package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
  340. package/build-types/radio-group/types.d.ts +5 -1
  341. package/build-types/radio-group/types.d.ts.map +1 -1
  342. package/build-types/range-control/index.d.ts +3 -1
  343. package/build-types/range-control/index.d.ts.map +1 -1
  344. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  345. package/build-types/range-control/types.d.ts +7 -0
  346. package/build-types/range-control/types.d.ts.map +1 -1
  347. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  348. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  349. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  350. package/build-types/slot-fill/bubbles-virtually/fill.d.ts +1 -1
  351. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  352. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  353. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  354. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +1 -1
  355. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -1
  356. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts +3 -7
  357. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  358. package/build-types/slot-fill/fill.d.ts.map +1 -1
  359. package/build-types/slot-fill/index.d.ts +5 -12
  360. package/build-types/slot-fill/index.d.ts.map +1 -1
  361. package/build-types/slot-fill/provider.d.ts.map +1 -1
  362. package/build-types/slot-fill/slot.d.ts +1 -1
  363. package/build-types/slot-fill/slot.d.ts.map +1 -1
  364. package/build-types/slot-fill/types.d.ts +15 -18
  365. package/build-types/slot-fill/types.d.ts.map +1 -1
  366. package/build-types/slot-fill/use-slot.d.ts +1 -1
  367. package/build-types/slot-fill/use-slot.d.ts.map +1 -1
  368. package/build-types/snackbar/index.d.ts.map +1 -1
  369. package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
  370. package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
  371. package/build-types/spinner/stories/index.story.d.ts.map +1 -1
  372. package/build-types/tabs/tablist.d.ts.map +1 -1
  373. package/build-types/text/stories/index.story.d.ts.map +1 -1
  374. package/build-types/text-control/index.d.ts +1 -0
  375. package/build-types/text-control/index.d.ts.map +1 -1
  376. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  377. package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
  378. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  379. package/build-types/tip/stories/index.story.d.ts.map +1 -1
  380. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  381. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  382. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -0
  383. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  384. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -0
  385. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  386. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  387. package/build-types/toggle-group-control/types.d.ts +7 -0
  388. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  389. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  390. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  391. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  392. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  393. package/build-types/truncate/stories/index.story.d.ts.map +1 -1
  394. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  395. package/build-types/utils/deprecated-36px-size.d.ts +3 -2
  396. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
  397. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  398. package/package.json +4 -4
  399. package/src/autocomplete/autocompleter-ui.tsx +1 -0
  400. package/src/base-control/stories/index.story.tsx +2 -1
  401. package/src/border-box-control/border-box-control/component.tsx +1 -0
  402. package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
  403. package/src/border-control/border-control/component.tsx +1 -0
  404. package/src/border-control/border-control/hook.ts +2 -0
  405. package/src/border-control/border-control-dropdown/component.tsx +1 -1
  406. package/src/border-control/types.ts +7 -0
  407. package/src/box-control/README.md +79 -60
  408. package/src/box-control/all-input-control.tsx +1 -0
  409. package/src/box-control/axial-input-controls.tsx +1 -0
  410. package/src/box-control/docs-manifest.json +5 -0
  411. package/src/box-control/index.tsx +13 -13
  412. package/src/box-control/input-controls.tsx +1 -0
  413. package/src/box-control/types.ts +2 -0
  414. package/src/checkbox-control/stories/index.story.tsx +2 -1
  415. package/src/circular-option-picker/circular-option-picker-actions.tsx +1 -0
  416. package/src/circular-option-picker/circular-option-picker-option.tsx +1 -0
  417. package/src/circular-option-picker/stories/index.story.tsx +2 -1
  418. package/src/circular-option-picker/style.scss +2 -2
  419. package/src/color-indicator/stories/index.story.tsx +2 -1
  420. package/src/color-palette/index.tsx +5 -1
  421. package/src/color-palette/stories/index.story.tsx +2 -1
  422. package/src/color-picker/color-copy-button.tsx +8 -10
  423. package/src/color-picker/component.tsx +1 -0
  424. package/src/color-picker/stories/index.story.tsx +2 -1
  425. package/src/color-picker/styles.ts +0 -13
  426. package/src/combobox-control/README.md +1 -0
  427. package/src/combobox-control/index.tsx +19 -13
  428. package/src/combobox-control/stories/index.story.tsx +3 -1
  429. package/src/combobox-control/style.scss +0 -6
  430. package/src/combobox-control/test/index.tsx +7 -1
  431. package/src/composite/hover.tsx +1 -1
  432. package/src/composite/typeahead.tsx +3 -1
  433. package/src/confirm-dialog/stories/index.story.tsx +2 -1
  434. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +2 -0
  435. package/src/custom-gradient-picker/stories/index.story.tsx +2 -1
  436. package/src/custom-gradient-picker/style.scss +1 -1
  437. package/src/custom-select-control/stories/index.story.tsx +2 -1
  438. package/src/custom-select-control-v2/stories/index.story.tsx +2 -1
  439. package/src/dashicon/types.ts +0 -2
  440. package/src/date-time/stories/date-time.story.tsx +2 -1
  441. package/src/date-time/stories/date.story.tsx +2 -1
  442. package/src/date-time/stories/time.story.tsx +2 -1
  443. package/src/dimension-control/README.md +1 -0
  444. package/src/dimension-control/index.tsx +8 -0
  445. package/src/dimension-control/stories/index.story.tsx +1 -0
  446. package/src/dimension-control/test/__snapshots__/index.test.js.snap +24 -24
  447. package/src/dimension-control/test/index.test.js +7 -1
  448. package/src/disabled/README.md +9 -7
  449. package/src/disabled/index.tsx +8 -1
  450. package/src/disabled/stories/index.story.tsx +1 -0
  451. package/src/drop-zone/stories/index.story.tsx +2 -1
  452. package/src/dropdown/stories/index.story.tsx +2 -1
  453. package/src/dropdown-menu/stories/index.story.tsx +2 -1
  454. package/src/duotone-picker/duotone-picker.tsx +2 -0
  455. package/src/external-link/stories/index.story.tsx +2 -1
  456. package/src/font-size-picker/README.md +1 -0
  457. package/src/font-size-picker/font-size-picker-toggle-group.tsx +1 -0
  458. package/src/font-size-picker/index.tsx +8 -0
  459. package/src/font-size-picker/stories/index.story.tsx +1 -0
  460. package/src/font-size-picker/test/index.tsx +5 -1
  461. package/src/form-file-upload/index.tsx +13 -1
  462. package/src/form-file-upload/stories/index.story.tsx +2 -1
  463. package/src/form-token-field/stories/index.story.tsx +2 -1
  464. package/src/form-token-field/style.scss +8 -12
  465. package/src/form-token-field/token.tsx +1 -0
  466. package/src/gradient-picker/README.md +107 -69
  467. package/src/gradient-picker/docs-manifest.json +5 -0
  468. package/src/gradient-picker/index.tsx +34 -32
  469. package/src/gradient-picker/stories/index.story.tsx +2 -1
  470. package/src/gradient-picker/types.ts +3 -5
  471. package/src/guide/page-control.tsx +1 -0
  472. package/src/guide/style.scss +4 -6
  473. package/src/h-stack/stories/index.story.tsx +2 -1
  474. package/src/heading/stories/index.story.tsx +2 -1
  475. package/src/higher-order/with-constrained-tabbing/README.md +13 -3
  476. package/src/higher-order/with-focus-return/README.md +9 -2
  477. package/src/icon/README.md +22 -65
  478. package/src/icon/docs-manifest.json +5 -0
  479. package/src/icon/index.tsx +28 -13
  480. package/src/icon/stories/index.story.tsx +50 -8
  481. package/src/input-control/stories/index.story.tsx +2 -1
  482. package/src/menu/stories/index.story.tsx +2 -1
  483. package/src/menu/styles.ts +1 -1
  484. package/src/menu-group/stories/index.story.tsx +2 -1
  485. package/src/menu-item/index.tsx +1 -0
  486. package/src/menu-item/stories/index.story.tsx +2 -1
  487. package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
  488. package/src/menu-items-choice/stories/index.story.tsx +2 -1
  489. package/src/modal/index.tsx +2 -2
  490. package/src/modal/stories/index.story.tsx +3 -2
  491. package/src/navigator/stories/index.story.tsx +2 -1
  492. package/src/notice/index.tsx +2 -0
  493. package/src/notice/stories/index.story.tsx +7 -2
  494. package/src/notice/test/__snapshots__/index.tsx.snap +4 -4
  495. package/src/number-control/stories/index.story.tsx +2 -1
  496. package/src/palette-edit/index.tsx +5 -0
  497. package/src/panel/body.tsx +1 -0
  498. package/src/placeholder/stories/index.story.tsx +1 -0
  499. package/src/popover/index.tsx +3 -0
  500. package/src/popover/stories/index.story.tsx +2 -1
  501. package/src/private-apis.ts +0 -2
  502. package/src/progress-bar/stories/index.story.tsx +2 -1
  503. package/src/radio-control/stories/index.story.tsx +2 -1
  504. package/src/radio-group/README.md +8 -8
  505. package/src/radio-group/radio.tsx +7 -0
  506. package/src/radio-group/stories/index.story.tsx +16 -4
  507. package/src/radio-group/types.ts +6 -1
  508. package/src/range-control/README.md +4 -3
  509. package/src/range-control/index.tsx +11 -0
  510. package/src/range-control/stories/index.story.tsx +9 -1
  511. package/src/range-control/test/index.tsx +7 -1
  512. package/src/range-control/types.ts +7 -0
  513. package/src/responsive-wrapper/stories/index.story.tsx +2 -1
  514. package/src/search-control/stories/index.story.tsx +2 -1
  515. package/src/select-control/stories/index.story.tsx +2 -1
  516. package/src/slot-fill/README.md +26 -15
  517. package/src/slot-fill/bubbles-virtually/fill.tsx +18 -28
  518. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +26 -16
  519. package/src/slot-fill/bubbles-virtually/slot.tsx +13 -9
  520. package/src/slot-fill/bubbles-virtually/use-slot.ts +3 -26
  521. package/src/slot-fill/fill.ts +7 -22
  522. package/src/slot-fill/index.tsx +5 -7
  523. package/src/slot-fill/provider.tsx +8 -17
  524. package/src/slot-fill/slot.tsx +48 -85
  525. package/src/slot-fill/types.ts +14 -51
  526. package/src/snackbar/index.tsx +2 -1
  527. package/src/snackbar/stories/index.story.tsx +2 -1
  528. package/src/snackbar/stories/list.story.tsx +2 -1
  529. package/src/snackbar/style.scss +7 -16
  530. package/src/spinner/stories/index.story.tsx +2 -1
  531. package/src/tabs/tablist.tsx +13 -2
  532. package/src/text/stories/index.story.tsx +2 -1
  533. package/src/text-control/README.md +1 -0
  534. package/src/text-control/index.tsx +8 -0
  535. package/src/text-control/stories/index.story.tsx +3 -1
  536. package/src/text-control/test/text-control.tsx +7 -1
  537. package/src/text-highlight/stories/index.story.tsx +2 -1
  538. package/src/textarea-control/stories/index.story.tsx +2 -1
  539. package/src/tip/stories/index.story.tsx +2 -1
  540. package/src/toggle-control/stories/index.story.tsx +2 -1
  541. package/src/toggle-group-control/stories/index.story.tsx +3 -1
  542. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -12
  543. package/src/toggle-group-control/test/index.tsx +7 -1
  544. package/src/toggle-group-control/toggle-group-control/README.md +2 -1
  545. package/src/toggle-group-control/toggle-group-control/component.tsx +11 -1
  546. package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
  547. package/src/toggle-group-control/toggle-group-control-option/component.tsx +1 -0
  548. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  549. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
  550. package/src/toggle-group-control/types.ts +7 -0
  551. package/src/tools-panel/stories/index.story.tsx +3 -0
  552. package/src/tooltip/stories/index.story.tsx +2 -1
  553. package/src/tree-grid/stories/index.story.tsx +2 -1
  554. package/src/tree-select/stories/index.story.tsx +2 -1
  555. package/src/truncate/stories/index.story.tsx +2 -1
  556. package/src/unit-control/stories/index.story.tsx +2 -1
  557. package/src/utils/deprecated-36px-size.ts +8 -2
  558. package/src/v-stack/stories/index.story.tsx +2 -1
  559. package/src/visually-hidden/stories/index.story.tsx +1 -1
  560. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["__","settings","useState","useMemo","forwardRef","Button","RangeControl","Flex","FlexItem","default","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits","VisuallyHidden","getCommonSizeUnit","Container","Header","HeaderHint","HeaderLabel","HeaderToggle","Spacer","FontSizePickerSelect","FontSizePickerToggleGroup","T_SHIRT_NAMES","jsx","_jsx","jsxs","_jsxs","DEFAULT_UNITS","MAX_TOGGLE_GROUP_SIZES","UnforwardedFontSizePicker","props","ref","__next40pxDefaultSize","fallbackFontSize","fontSizes","disableCustomFontSizes","onChange","size","units","unitsProp","value","withSlider","withReset","availableUnits","selectedFontSize","find","fontSize","isCustomValue","userRequestedCustom","setUserRequestedCustom","currentPickerType","length","headerHint","name","indexOf","commonUnit","hasUnits","valueQuantity","valueUnit","isValueUnitRelative","includes","isDisabled","undefined","className","children","as","label","icon","onClick","isPressed","newValue","Number","onSelectCustom","isBlock","labelPosition","hideLabelFromVision","parseInt","min","marginX","marginBottom","__nextHasNoMarginBottom","initialPosition","withInputField","max","step","disabled","accessibleWhenDisabled","variant","FontSizePicker"],"sources":["@wordpress/components/src/font-size-picker/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\nimport { useState, useMemo, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../button';\nimport RangeControl from '../range-control';\nimport { Flex, FlexItem } from '../flex';\nimport {\n\tdefault as UnitControl,\n\tparseQuantityAndUnitFromRawValue,\n\tuseCustomUnits,\n} from '../unit-control';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { getCommonSizeUnit } from './utils';\nimport type { FontSizePickerProps } from './types';\nimport {\n\tContainer,\n\tHeader,\n\tHeaderHint,\n\tHeaderLabel,\n\tHeaderToggle,\n} from './styles';\nimport { Spacer } from '../spacer';\nimport FontSizePickerSelect from './font-size-picker-select';\nimport FontSizePickerToggleGroup from './font-size-picker-toggle-group';\nimport { T_SHIRT_NAMES } from './constants';\n\nconst DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];\n\nconst MAX_TOGGLE_GROUP_SIZES = 5;\n\nconst UnforwardedFontSizePicker = (\n\tprops: FontSizePickerProps,\n\tref: ForwardedRef< any >\n) => {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\tfallbackFontSize,\n\t\tfontSizes = [],\n\t\tdisableCustomFontSizes = false,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tunits: unitsProp = DEFAULT_UNITS,\n\t\tvalue,\n\t\twithSlider = false,\n\t\twithReset = true,\n\t} = props;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: unitsProp,\n\t} );\n\n\tconst selectedFontSize = fontSizes.find(\n\t\t( fontSize ) => fontSize.size === value\n\t);\n\tconst isCustomValue = !! value && ! selectedFontSize;\n\n\t// Initially request a custom picker if the value is not from the predef list.\n\tconst [ userRequestedCustom, setUserRequestedCustom ] =\n\t\tuseState( isCustomValue );\n\n\tlet currentPickerType;\n\tif ( ! disableCustomFontSizes && userRequestedCustom ) {\n\t\t// While showing the custom value picker, switch back to predef only if\n\t\t// `disableCustomFontSizes` is set to `true`.\n\t\tcurrentPickerType = 'custom' as const;\n\t} else {\n\t\tcurrentPickerType =\n\t\t\tfontSizes.length > MAX_TOGGLE_GROUP_SIZES\n\t\t\t\t? ( 'select' as const )\n\t\t\t\t: ( 'togglegroup' as const );\n\t}\n\n\tconst headerHint = useMemo( () => {\n\t\tswitch ( currentPickerType ) {\n\t\t\tcase 'custom':\n\t\t\t\treturn __( 'Custom' );\n\t\t\tcase 'togglegroup':\n\t\t\t\tif ( selectedFontSize ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tselectedFontSize.name ||\n\t\t\t\t\t\tT_SHIRT_NAMES[ fontSizes.indexOf( selectedFontSize ) ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'select':\n\t\t\t\tconst commonUnit = getCommonSizeUnit( fontSizes );\n\t\t\t\tif ( commonUnit ) {\n\t\t\t\t\treturn `(${ commonUnit })`;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn '';\n\t}, [ currentPickerType, selectedFontSize, fontSizes ] );\n\n\tif ( fontSizes.length === 0 && disableCustomFontSizes ) {\n\t\treturn null;\n\t}\n\n\t// If neither the value or first font size is a string, then FontSizePicker\n\t// operates in a legacy \"unitless\" mode where UnitControl can only be used\n\t// to select px values and onChange() is always called with number values.\n\tconst hasUnits =\n\t\ttypeof value === 'string' || typeof fontSizes[ 0 ]?.size === 'string';\n\n\tconst [ valueQuantity, valueUnit ] = parseQuantityAndUnitFromRawValue(\n\t\tvalue,\n\t\tunits\n\t);\n\tconst isValueUnitRelative =\n\t\t!! valueUnit && [ 'em', 'rem', 'vw', 'vh' ].includes( valueUnit );\n\tconst isDisabled = value === undefined;\n\n\treturn (\n\t\t<Container ref={ ref } className=\"components-font-size-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Font size' ) }</VisuallyHidden>\n\t\t\t<Spacer>\n\t\t\t\t<Header className=\"components-font-size-picker__header\">\n\t\t\t\t\t<HeaderLabel\n\t\t\t\t\t\taria-label={ `${ __( 'Size' ) } ${ headerHint || '' }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Size' ) }\n\t\t\t\t\t\t{ headerHint && (\n\t\t\t\t\t\t\t<HeaderHint className=\"components-font-size-picker__header__hint\">\n\t\t\t\t\t\t\t\t{ headerHint }\n\t\t\t\t\t\t\t</HeaderHint>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HeaderLabel>\n\t\t\t\t\t{ ! disableCustomFontSizes && (\n\t\t\t\t\t\t<HeaderToggle\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tcurrentPickerType === 'custom'\n\t\t\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tsetUserRequestedCustom( ! userRequestedCustom )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisPressed={ currentPickerType === 'custom' }\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Header>\n\t\t\t</Spacer>\n\t\t\t<div>\n\t\t\t\t{ currentPickerType === 'select' && (\n\t\t\t\t\t<FontSizePickerSelect\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\thasUnits ? newValue : Number( newValue ),\n\t\t\t\t\t\t\t\t\tfontSizes.find(\n\t\t\t\t\t\t\t\t\t\t( fontSize ) =>\n\t\t\t\t\t\t\t\t\t\t\tfontSize.size === newValue\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonSelectCustom={ () => setUserRequestedCustom( true ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ currentPickerType === 'togglegroup' && (\n\t\t\t\t\t<FontSizePickerToggleGroup\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\thasUnits ? newValue : Number( newValue ),\n\t\t\t\t\t\t\t\t\tfontSizes.find(\n\t\t\t\t\t\t\t\t\t\t( fontSize ) =>\n\t\t\t\t\t\t\t\t\t\t\tfontSize.size === newValue\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ currentPickerType === 'custom' && (\n\t\t\t\t\t<Flex className=\"components-font-size-picker__custom-size-control\">\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetUserRequestedCustom( true );\n\n\t\t\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\t\thasUnits\n\t\t\t\t\t\t\t\t\t\t\t\t? newValue\n\t\t\t\t\t\t\t\t\t\t\t\t: parseInt( newValue, 10 )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t\tunits={ hasUnits ? units : [] }\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t{ withSlider && (\n\t\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t\t<Spacer marginX={ 2 } marginBottom={ 0 }>\n\t\t\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize={\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tclassName=\"components-font-size-picker__custom-input\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Custom Size' ) }\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tvalue={ valueQuantity }\n\t\t\t\t\t\t\t\t\t\tinitialPosition={ fallbackFontSize }\n\t\t\t\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\t\t\tsetUserRequestedCustom( true );\n\n\t\t\t\t\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t\t\t\t\t} else if ( hasUnits ) {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewValue +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( valueUnit ?? 'px' )\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange?.( newValue );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\t\t\tmax={ isValueUnitRelative ? 10 : 100 }\n\t\t\t\t\t\t\t\t\t\tstep={ isValueUnitRelative ? 0.1 : 1 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ withReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\t\t\tsize === '__unstable-large' ||\n\t\t\t\t\t\t\t\t\t\tprops.__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t: 'small'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</Container>\n\t);\n};\n\nexport const FontSizePicker = forwardRef( UnforwardedFontSizePicker );\n\nexport default FontSizePicker;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,QAAQ,oBAAoB;;AAElE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,IAAI,EAAEC,QAAQ,QAAQ,SAAS;AACxC,SACCC,OAAO,IAAIC,WAAW,EACtBC,gCAAgC,EAChCC,cAAc,QACR,iBAAiB;AACxB,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SACCC,SAAS,EACTC,MAAM,EACNC,UAAU,EACVC,WAAW,EACXC,YAAY,QACN,UAAU;AACjB,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,aAAa,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5C,MAAMC,aAAa,GAAG,CAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAE;AAEvD,MAAMC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C;AAEd,CAAC;AAED,OAAO,MAAMyF,cAAc,GAAGrF,UAAU,CAAE0B,yBAA0B,CAAC;AAErE,eAAe2D,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["__","settings","useState","useMemo","forwardRef","Button","RangeControl","Flex","FlexItem","default","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits","VisuallyHidden","getCommonSizeUnit","Container","Header","HeaderHint","HeaderLabel","HeaderToggle","Spacer","FontSizePickerSelect","FontSizePickerToggleGroup","T_SHIRT_NAMES","maybeWarnDeprecated36pxSize","jsx","_jsx","jsxs","_jsxs","DEFAULT_UNITS","MAX_TOGGLE_GROUP_SIZES","UnforwardedFontSizePicker","props","ref","__next40pxDefaultSize","fallbackFontSize","fontSizes","disableCustomFontSizes","onChange","size","units","unitsProp","value","withSlider","withReset","availableUnits","selectedFontSize","find","fontSize","isCustomValue","userRequestedCustom","setUserRequestedCustom","currentPickerType","length","headerHint","name","indexOf","commonUnit","hasUnits","valueQuantity","valueUnit","isValueUnitRelative","includes","isDisabled","undefined","componentName","className","children","as","label","icon","onClick","isPressed","newValue","Number","onSelectCustom","isBlock","labelPosition","hideLabelFromVision","parseInt","min","marginX","marginBottom","__nextHasNoMarginBottom","__shouldNotWarnDeprecated36pxSize","initialPosition","withInputField","max","step","disabled","accessibleWhenDisabled","variant","FontSizePicker"],"sources":["@wordpress/components/src/font-size-picker/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { settings } from '@wordpress/icons';\nimport { useState, useMemo, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../button';\nimport RangeControl from '../range-control';\nimport { Flex, FlexItem } from '../flex';\nimport {\n\tdefault as UnitControl,\n\tparseQuantityAndUnitFromRawValue,\n\tuseCustomUnits,\n} from '../unit-control';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { getCommonSizeUnit } from './utils';\nimport type { FontSizePickerProps } from './types';\nimport {\n\tContainer,\n\tHeader,\n\tHeaderHint,\n\tHeaderLabel,\n\tHeaderToggle,\n} from './styles';\nimport { Spacer } from '../spacer';\nimport FontSizePickerSelect from './font-size-picker-select';\nimport FontSizePickerToggleGroup from './font-size-picker-toggle-group';\nimport { T_SHIRT_NAMES } from './constants';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nconst DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];\n\nconst MAX_TOGGLE_GROUP_SIZES = 5;\n\nconst UnforwardedFontSizePicker = (\n\tprops: FontSizePickerProps,\n\tref: ForwardedRef< any >\n) => {\n\tconst {\n\t\t__next40pxDefaultSize = false,\n\t\tfallbackFontSize,\n\t\tfontSizes = [],\n\t\tdisableCustomFontSizes = false,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tunits: unitsProp = DEFAULT_UNITS,\n\t\tvalue,\n\t\twithSlider = false,\n\t\twithReset = true,\n\t} = props;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: unitsProp,\n\t} );\n\n\tconst selectedFontSize = fontSizes.find(\n\t\t( fontSize ) => fontSize.size === value\n\t);\n\tconst isCustomValue = !! value && ! selectedFontSize;\n\n\t// Initially request a custom picker if the value is not from the predef list.\n\tconst [ userRequestedCustom, setUserRequestedCustom ] =\n\t\tuseState( isCustomValue );\n\n\tlet currentPickerType;\n\tif ( ! disableCustomFontSizes && userRequestedCustom ) {\n\t\t// While showing the custom value picker, switch back to predef only if\n\t\t// `disableCustomFontSizes` is set to `true`.\n\t\tcurrentPickerType = 'custom' as const;\n\t} else {\n\t\tcurrentPickerType =\n\t\t\tfontSizes.length > MAX_TOGGLE_GROUP_SIZES\n\t\t\t\t? ( 'select' as const )\n\t\t\t\t: ( 'togglegroup' as const );\n\t}\n\n\tconst headerHint = useMemo( () => {\n\t\tswitch ( currentPickerType ) {\n\t\t\tcase 'custom':\n\t\t\t\treturn __( 'Custom' );\n\t\t\tcase 'togglegroup':\n\t\t\t\tif ( selectedFontSize ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tselectedFontSize.name ||\n\t\t\t\t\t\tT_SHIRT_NAMES[ fontSizes.indexOf( selectedFontSize ) ]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'select':\n\t\t\t\tconst commonUnit = getCommonSizeUnit( fontSizes );\n\t\t\t\tif ( commonUnit ) {\n\t\t\t\t\treturn `(${ commonUnit })`;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn '';\n\t}, [ currentPickerType, selectedFontSize, fontSizes ] );\n\n\tif ( fontSizes.length === 0 && disableCustomFontSizes ) {\n\t\treturn null;\n\t}\n\n\t// If neither the value or first font size is a string, then FontSizePicker\n\t// operates in a legacy \"unitless\" mode where UnitControl can only be used\n\t// to select px values and onChange() is always called with number values.\n\tconst hasUnits =\n\t\ttypeof value === 'string' || typeof fontSizes[ 0 ]?.size === 'string';\n\n\tconst [ valueQuantity, valueUnit ] = parseQuantityAndUnitFromRawValue(\n\t\tvalue,\n\t\tunits\n\t);\n\tconst isValueUnitRelative =\n\t\t!! valueUnit && [ 'em', 'rem', 'vw', 'vh' ].includes( valueUnit );\n\tconst isDisabled = value === undefined;\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'FontSizePicker',\n\t\t__next40pxDefaultSize,\n\t\tsize,\n\t} );\n\n\treturn (\n\t\t<Container ref={ ref } className=\"components-font-size-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Font size' ) }</VisuallyHidden>\n\t\t\t<Spacer>\n\t\t\t\t<Header className=\"components-font-size-picker__header\">\n\t\t\t\t\t<HeaderLabel\n\t\t\t\t\t\taria-label={ `${ __( 'Size' ) } ${ headerHint || '' }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Size' ) }\n\t\t\t\t\t\t{ headerHint && (\n\t\t\t\t\t\t\t<HeaderHint className=\"components-font-size-picker__header__hint\">\n\t\t\t\t\t\t\t\t{ headerHint }\n\t\t\t\t\t\t\t</HeaderHint>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HeaderLabel>\n\t\t\t\t\t{ ! disableCustomFontSizes && (\n\t\t\t\t\t\t<HeaderToggle\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tcurrentPickerType === 'custom'\n\t\t\t\t\t\t\t\t\t? __( 'Use size preset' )\n\t\t\t\t\t\t\t\t\t: __( 'Set custom size' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tsetUserRequestedCustom( ! userRequestedCustom )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisPressed={ currentPickerType === 'custom' }\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Header>\n\t\t\t</Spacer>\n\t\t\t<div>\n\t\t\t\t{ currentPickerType === 'select' && (\n\t\t\t\t\t<FontSizePickerSelect\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\thasUnits ? newValue : Number( newValue ),\n\t\t\t\t\t\t\t\t\tfontSizes.find(\n\t\t\t\t\t\t\t\t\t\t( fontSize ) =>\n\t\t\t\t\t\t\t\t\t\t\tfontSize.size === newValue\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonSelectCustom={ () => setUserRequestedCustom( true ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ currentPickerType === 'togglegroup' && (\n\t\t\t\t\t<FontSizePickerToggleGroup\n\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\thasUnits ? newValue : Number( newValue ),\n\t\t\t\t\t\t\t\t\tfontSizes.find(\n\t\t\t\t\t\t\t\t\t\t( fontSize ) =>\n\t\t\t\t\t\t\t\t\t\t\tfontSize.size === newValue\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ currentPickerType === 'custom' && (\n\t\t\t\t\t<Flex className=\"components-font-size-picker__custom-size-control\">\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\tsetUserRequestedCustom( true );\n\n\t\t\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\t\thasUnits\n\t\t\t\t\t\t\t\t\t\t\t\t? newValue\n\t\t\t\t\t\t\t\t\t\t\t\t: parseInt( newValue, 10 )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tsize={ size }\n\t\t\t\t\t\t\t\tunits={ hasUnits ? units : [] }\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t{ withSlider && (\n\t\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t\t<Spacer marginX={ 2 } marginBottom={ 0 }>\n\t\t\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize={\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t__shouldNotWarnDeprecated36pxSize\n\t\t\t\t\t\t\t\t\t\tclassName=\"components-font-size-picker__custom-input\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Custom Size' ) }\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tvalue={ valueQuantity }\n\t\t\t\t\t\t\t\t\t\tinitialPosition={ fallbackFontSize }\n\t\t\t\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\t\t\t\tsetUserRequestedCustom( true );\n\n\t\t\t\t\t\t\t\t\t\t\tif ( newValue === undefined ) {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t\t\t\t\t} else if ( hasUnits ) {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnewValue +\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( valueUnit ?? 'px' )\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange?.( newValue );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\t\t\tmax={ isValueUnitRelative ? 10 : 100 }\n\t\t\t\t\t\t\t\t\t\tstep={ isValueUnitRelative ? 0.1 : 1 }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ withReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange?.( undefined );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tsize={\n\t\t\t\t\t\t\t\t\t\tsize === '__unstable-large' ||\n\t\t\t\t\t\t\t\t\t\tprops.__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t: 'small'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</Container>\n\t);\n};\n\nexport const FontSizePicker = forwardRef( UnforwardedFontSizePicker );\n\nexport default FontSizePicker;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,EAAEC,UAAU,QAAQ,oBAAoB;;AAElE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,IAAI,EAAEC,QAAQ,QAAQ,SAAS;AACxC,SACCC,OAAO,IAAIC,WAAW,EACtBC,gCAAgC,EAChCC,cAAc,QACR,iBAAiB;AACxB,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SACCC,SAAS,EACTC,MAAM,EACNC,UAAU,EACVC,WAAW,EACXC,YAAY,QACN,UAAU;AACjB,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,2BAA2B,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5E,MAAMC,aAAa,GAAG,CAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAE;AAEvD,MAAMC,sBAAsB,GAAG,CAAC;AAEhC,MAAMC,yBAAyB,GAAGA,CACjCC,KAA0B,EAC1BC,GAAwB,KACpB;EACJ,MAAM;IACLC,qBAAqB,GAAG,KAAK;IAC7BC,gBAAgB;IAChBC,SAAS,GAAG,EAAE;IACdC,sBAAsB,GAAG,KAAK;IAC9BC,QAAQ;IACRC,IAAI,GAAG,SAAS;IAChBC,KAAK,EAAEC,SAAS,GAAGZ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  children: children
46
46
  });
47
+ // @todo: Temporary fix a bug that prevents Chromium browsers from selecting ".heic" files
48
+ // from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4.
49
+ // This can be removed once the Chromium fix is in the stable channel.
50
+ // Prevent Safari from adding "image/heic" and "image/heif" to the accept attribute.
51
+ const isSafari = globalThis.window?.navigator.userAgent.includes('Safari') && !globalThis.window?.navigator.userAgent.includes('Chrome') && !globalThis.window?.navigator.userAgent.includes('Chromium');
52
+ const compatAccept = !isSafari && !!accept?.includes('image/*') ? `${accept}, image/heic, image/heif` : accept;
47
53
  return /*#__PURE__*/_jsxs("div", {
48
54
  className: "components-form-file-upload",
49
55
  children: [ui, /*#__PURE__*/_jsx("input", {
@@ -53,7 +59,7 @@ export function FormFileUpload({
53
59
  style: {
54
60
  display: 'none'
55
61
  },
56
- accept: accept,
62
+ accept: compatAccept,
57
63
  onChange: onChange,
58
64
  onClick: onClick,
59
65
  "data-testid": "form-file-upload-input"
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","Button","jsx","_jsx","jsxs","_jsxs","FormFileUpload","accept","children","multiple","onChange","onClick","render","props","ref","openFileDialog","current","click","ui","className","type","style","display"],"sources":["@wordpress/components/src/form-file-upload/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport type { WordPressComponentProps } from '../context';\nimport type { FormFileUploadProps } from './types';\n\n/**\n * FormFileUpload is a component that allows users to select files from their local device.\n *\n * ```jsx\n * import { FormFileUpload } from '@wordpress/components';\n *\n * const MyFormFileUpload = () => (\n * <FormFileUpload\n * accept=\"image/*\"\n * onChange={ ( event ) => console.log( event.currentTarget.files ) }\n * >\n * Upload\n * </FormFileUpload>\n * );\n * ```\n */\nexport function FormFileUpload( {\n\taccept,\n\tchildren,\n\tmultiple = false,\n\tonChange,\n\tonClick,\n\trender,\n\t...props\n}: WordPressComponentProps< FormFileUploadProps, 'button', false > ) {\n\tconst ref = useRef< HTMLInputElement >( null );\n\tconst openFileDialog = () => {\n\t\tref.current?.click();\n\t};\n\n\tconst ui = render ? (\n\t\trender( { openFileDialog } )\n\t) : (\n\t\t<Button onClick={ openFileDialog } { ...props }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n\n\treturn (\n\t\t<div className=\"components-form-file-upload\">\n\t\t\t{ ui }\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\tref={ ref }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\taccept={ accept }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tdata-testid=\"form-file-upload-input\"\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default FormFileUpload;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAE;EAC/BC,MAAM;EACNC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EACRC,OAAO;EACPC,MAAM;EACN,GAAGC;AAC6D,CAAC,EAAG;EACpE,MAAMC,GAAG,GAAGd,MAAM,CAAsB,IAAK,CAAC;EAC9C,MAAMe,cAAc,GAAGA,CAAA,KAAM;IAC5BD,GAAG,CAACE,OAAO,EAAEC,KAAK,CAAC,CAAC;EACrB,CAAC;EAED,MAAMC,EAAE,GAAGN,MAAM,GAChBA,MAAM,CAAE;IAAEG;EAAe,CAAE,CAAC,gBAE5BZ,IAAA,CAACF,MAAM;IAACU,OAAO,EAAGI,cAAgB;IAAA,GAAMF,KAAK;IAAAL,QAAA,EAC1CA;EAAQ,CACH,CACR;EAED,oBACCH,KAAA;IAAKc,SAAS,EAAC,6BAA6B;IAAAX,QAAA,GACzCU,EAAE,eACJf,IAAA;MACCiB,IAAI,EAAC,MAAM;MACXN,GAAG,EAAGA,GAAK;MACXL,QAAQ,EAAGA,QAAU;MACrBY,KAAK,EAAG;QAAEC,OAAO,EAAE;MAAO,CAAG;MAC7Bf,MAAM,EAAGA,MAAQ;MACjBG,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA,OAAS;MACnB,eAAY;IAAwB,CACpC,CAAC;EAAA,CACE,CAAC;AAER;AAEA,eAAeL,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["useRef","Button","jsx","_jsx","jsxs","_jsxs","FormFileUpload","accept","children","multiple","onChange","onClick","render","props","ref","openFileDialog","current","click","ui","isSafari","globalThis","window","navigator","userAgent","includes","compatAccept","className","type","style","display"],"sources":["@wordpress/components/src/form-file-upload/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport type { WordPressComponentProps } from '../context';\nimport type { FormFileUploadProps } from './types';\n\n/**\n * FormFileUpload is a component that allows users to select files from their local device.\n *\n * ```jsx\n * import { FormFileUpload } from '@wordpress/components';\n *\n * const MyFormFileUpload = () => (\n * <FormFileUpload\n * accept=\"image/*\"\n * onChange={ ( event ) => console.log( event.currentTarget.files ) }\n * >\n * Upload\n * </FormFileUpload>\n * );\n * ```\n */\nexport function FormFileUpload( {\n\taccept,\n\tchildren,\n\tmultiple = false,\n\tonChange,\n\tonClick,\n\trender,\n\t...props\n}: WordPressComponentProps< FormFileUploadProps, 'button', false > ) {\n\tconst ref = useRef< HTMLInputElement >( null );\n\tconst openFileDialog = () => {\n\t\tref.current?.click();\n\t};\n\n\tconst ui = render ? (\n\t\trender( { openFileDialog } )\n\t) : (\n\t\t<Button onClick={ openFileDialog } { ...props }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n\t// @todo: Temporary fix a bug that prevents Chromium browsers from selecting \".heic\" files\n\t// from the file upload. See https://core.trac.wordpress.org/ticket/62268#comment:4.\n\t// This can be removed once the Chromium fix is in the stable channel.\n\t// Prevent Safari from adding \"image/heic\" and \"image/heif\" to the accept attribute.\n\tconst isSafari =\n\t\tglobalThis.window?.navigator.userAgent.includes( 'Safari' ) &&\n\t\t! globalThis.window?.navigator.userAgent.includes( 'Chrome' ) &&\n\t\t! globalThis.window?.navigator.userAgent.includes( 'Chromium' );\n\tconst compatAccept =\n\t\t! isSafari && !! accept?.includes( 'image/*' )\n\t\t\t? `${ accept }, image/heic, image/heif`\n\t\t\t: accept;\n\n\treturn (\n\t\t<div className=\"components-form-file-upload\">\n\t\t\t{ ui }\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\tref={ ref }\n\t\t\t\tmultiple={ multiple }\n\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\taccept={ compatAccept }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tdata-testid=\"form-file-upload-input\"\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default FormFileUpload;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAI/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAE;EAC/BC,MAAM;EACNC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChBC,QAAQ;EACRC,OAAO;EACPC,MAAM;EACN,GAAGC;AAC6D,CAAC,EAAG;EACpE,MAAMC,GAAG,GAAGd,MAAM,CAAsB,IAAK,CAAC;EAC9C,MAAMe,cAAc,GAAGA,CAAA,KAAM;IAC5BD,GAAG,CAACE,OAAO,EAAEC,KAAK,CAAC,CAAC;EACrB,CAAC;EAED,MAAMC,EAAE,GAAGN,MAAM,GAChBA,MAAM,CAAE;IAAEG;EAAe,CAAE,CAAC,gBAE5BZ,IAAA,CAACF,MAAM;IAACU,OAAO,EAAGI,cAAgB;IAAA,GAAMF,KAAK;IAAAL,QAAA,EAC1CA;EAAQ,CACH,CACR;EACD;EACA;EACA;EACA;EACA,MAAMW,QAAQ,GACbC,UAAU,CAACC,MAAM,EAAEC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,QAAS,CAAC,IAC3D,CAAEJ,UAAU,CAACC,MAAM,EAAEC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,QAAS,CAAC,IAC7D,CAAEJ,UAAU,CAACC,MAAM,EAAEC,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAE,UAAW,CAAC;EAChE,MAAMC,YAAY,GACjB,CAAEN,QAAQ,IAAI,CAAC,CAAEZ,MAAM,EAAEiB,QAAQ,CAAE,SAAU,CAAC,GAC3C,GAAIjB,MAAM,0BAA2B,GACrCA,MAAM;EAEV,oBACCF,KAAA;IAAKqB,SAAS,EAAC,6BAA6B;IAAAlB,QAAA,GACzCU,EAAE,eACJf,IAAA;MACCwB,IAAI,EAAC,MAAM;MACXb,GAAG,EAAGA,GAAK;MACXL,QAAQ,EAAGA,QAAU;MACrBmB,KAAK,EAAG;QAAEC,OAAO,EAAE;MAAO,CAAG;MAC7BtB,MAAM,EAAGkB,YAAc;MACvBf,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA,OAAS;MACnB,eAAY;IAAwB,CACpC,CAAC;EAAA,CACE,CAAC;AAER;AAEA,eAAeL,cAAc","ignoreList":[]}
@@ -62,6 +62,7 @@ export default function Token({
62
62
  })]
63
63
  }), /*#__PURE__*/_jsx(Button, {
64
64
  className: "components-form-token-field__remove-token",
65
+ size: "small",
65
66
  icon: closeSmall,
66
67
  onClick: !disabled ? onClick : undefined
67
68
  // Disable reason: Even when FormTokenField itself is accessibly disabled, token reset buttons shouldn't be in the tab sequence.
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useInstanceId","__","sprintf","closeSmall","Button","VisuallyHidden","jsx","_jsx","jsxs","_jsxs","noop","Token","value","status","title","displayTransform","isBorderless","disabled","onClickRemove","onMouseEnter","onMouseLeave","messages","termPosition","termsCount","instanceId","tokenClasses","onClick","transformedValue","termPositionAndCount","className","children","id","as","icon","undefined","label","remove"],"sources":["@wordpress/components/src/form-token-field/token.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { VisuallyHidden } from '../visually-hidden';\nimport type { TokenProps } from './types';\n\nconst noop = () => {};\n\nexport default function Token( {\n\tvalue,\n\tstatus,\n\ttitle,\n\tdisplayTransform,\n\tisBorderless = false,\n\tdisabled = false,\n\tonClickRemove = noop,\n\tonMouseEnter,\n\tonMouseLeave,\n\tmessages,\n\ttermPosition,\n\ttermsCount,\n}: TokenProps ) {\n\tconst instanceId = useInstanceId( Token );\n\tconst tokenClasses = clsx( 'components-form-token-field__token', {\n\t\t'is-error': 'error' === status,\n\t\t'is-success': 'success' === status,\n\t\t'is-validating': 'validating' === status,\n\t\t'is-borderless': isBorderless,\n\t\t'is-disabled': disabled,\n\t} );\n\n\tconst onClick = () => onClickRemove( { value } );\n\n\tconst transformedValue = displayTransform( value );\n\tconst termPositionAndCount = sprintf(\n\t\t/* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */\n\t\t__( '%1$s (%2$s of %3$s)' ),\n\t\ttransformedValue,\n\t\ttermPosition,\n\t\ttermsCount\n\t);\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ tokenClasses }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\ttitle={ title }\n\t\t>\n\t\t\t<span\n\t\t\t\tclassName=\"components-form-token-field__token-text\"\n\t\t\t\tid={ `components-form-token-field__token-text-${ instanceId }` }\n\t\t\t>\n\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t{ termPositionAndCount }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<span aria-hidden=\"true\">{ transformedValue }</span>\n\t\t\t</span>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"components-form-token-field__remove-token\"\n\t\t\t\ticon={ closeSmall }\n\t\t\t\tonClick={ ! disabled ? onClick : undefined }\n\t\t\t\t// Disable reason: Even when FormTokenField itself is accessibly disabled, token reset buttons shouldn't be in the tab sequence.\n\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tlabel={ messages.remove }\n\t\t\t\taria-describedby={ `components-form-token-field__token-text-${ instanceId }` }\n\t\t\t/>\n\t\t</span>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,cAAc,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGpD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,eAAe,SAASC,KAAKA,CAAE;EAC9BC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,gBAAgB;EAChBC,YAAY,GAAG,KAAK;EACpBC,QAAQ,GAAG,KAAK;EAChBC,aAAa,GAAGR,IAAI;EACpBS,YAAY;EACZC,YAAY;EACZC,QAAQ;EACRC,YAAY;EACZC;AACW,CAAC,EAAG;E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AC9E,CAAC;EAAA,CACG,CAAC;AAET","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useInstanceId","__","sprintf","closeSmall","Button","VisuallyHidden","jsx","_jsx","jsxs","_jsxs","noop","Token","value","status","title","displayTransform","isBorderless","disabled","onClickRemove","onMouseEnter","onMouseLeave","messages","termPosition","termsCount","instanceId","tokenClasses","onClick","transformedValue","termPositionAndCount","className","children","id","as","size","icon","undefined","label","remove"],"sources":["@wordpress/components/src/form-token-field/token.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { VisuallyHidden } from '../visually-hidden';\nimport type { TokenProps } from './types';\n\nconst noop = () => {};\n\nexport default function Token( {\n\tvalue,\n\tstatus,\n\ttitle,\n\tdisplayTransform,\n\tisBorderless = false,\n\tdisabled = false,\n\tonClickRemove = noop,\n\tonMouseEnter,\n\tonMouseLeave,\n\tmessages,\n\ttermPosition,\n\ttermsCount,\n}: TokenProps ) {\n\tconst instanceId = useInstanceId( Token );\n\tconst tokenClasses = clsx( 'components-form-token-field__token', {\n\t\t'is-error': 'error' === status,\n\t\t'is-success': 'success' === status,\n\t\t'is-validating': 'validating' === status,\n\t\t'is-borderless': isBorderless,\n\t\t'is-disabled': disabled,\n\t} );\n\n\tconst onClick = () => onClickRemove( { value } );\n\n\tconst transformedValue = displayTransform( value );\n\tconst termPositionAndCount = sprintf(\n\t\t/* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */\n\t\t__( '%1$s (%2$s of %3$s)' ),\n\t\ttransformedValue,\n\t\ttermPosition,\n\t\ttermsCount\n\t);\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ tokenClasses }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\ttitle={ title }\n\t\t>\n\t\t\t<span\n\t\t\t\tclassName=\"components-form-token-field__token-text\"\n\t\t\t\tid={ `components-form-token-field__token-text-${ instanceId }` }\n\t\t\t>\n\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t{ termPositionAndCount }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<span aria-hidden=\"true\">{ transformedValue }</span>\n\t\t\t</span>\n\n\t\t\t<Button\n\t\t\t\tclassName=\"components-form-token-field__remove-token\"\n\t\t\t\tsize=\"small\"\n\t\t\t\ticon={ closeSmall }\n\t\t\t\tonClick={ ! disabled ? onClick : undefined }\n\t\t\t\t// Disable reason: Even when FormTokenField itself is accessibly disabled, token reset buttons shouldn't be in the tab sequence.\n\t\t\t\t// eslint-disable-next-line no-restricted-syntax\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tlabel={ messages.remove }\n\t\t\t\taria-describedby={ `components-form-token-field__token-text-${ instanceId }` }\n\t\t\t/>\n\t\t</span>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,UAAU,QAAQ,kBAAkB;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,cAAc,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGpD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,eAAe,SAASC,KAAKA,CAAE;EAC9BC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,gBAAgB;EAChBC,YAAY,GAAG,KAAK;EACpBC,QAAQ,GAAG,KAAK;EAChBC,aAAa,GAAGR,IAAI;EACpBS,YAAY;EACZC,YAAY;EACZC,QAAQ;EACRC,YAAY;EACZC;AAC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;MACzB,oBAAmB,2CAA4Cb,UAAU;IAAK,CAC9E,CAAC;EAAA,CACG,CAAC;AAET","ignoreList":[]}
@@ -141,44 +141,44 @@ function Component(props) {
141
141
  }
142
142
 
143
143
  /**
144
- * GradientPicker is a React component that renders a color gradient picker to
144
+ * GradientPicker is a React component that renders a color gradient picker to
145
145
  * define a multi step gradient. There's either a _linear_ or a _radial_ type
146
146
  * available.
147
147
  *
148
148
  * ```jsx
149
- *import { GradientPicker } from '@wordpress/components';
150
- *import { useState } from '@wordpress/element';
149
+ * import { useState } from 'react';
150
+ * import { GradientPicker } from '@wordpress/components';
151
151
  *
152
- *const myGradientPicker = () => {
153
- * const [ gradient, setGradient ] = useState( null );
152
+ * const MyGradientPicker = () => {
153
+ * const [ gradient, setGradient ] = useState( null );
154
154
  *
155
- * return (
156
- * <GradientPicker
157
- * value={ gradient }
158
- * onChange={ ( currentGradient ) => setGradient( currentGradient ) }
159
- * gradients={ [
160
- * {
161
- * name: 'JShine',
162
- * gradient:
163
- * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
164
- * slug: 'jshine',
165
- * },
166
- * {
167
- * name: 'Moonlit Asteroid',
168
- * gradient:
169
- * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
170
- * slug: 'moonlit-asteroid',
171
- * },
172
- * {
173
- * name: 'Rastafarie',
174
- * gradient:
175
- * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
176
- * slug: 'rastafari',
177
- * },
178
- * ] }
179
- * />
180
- * );
181
- *};
155
+ * return (
156
+ * <GradientPicker
157
+ * value={ gradient }
158
+ * onChange={ ( currentGradient ) => setGradient( currentGradient ) }
159
+ * gradients={ [
160
+ * {
161
+ * name: 'JShine',
162
+ * gradient:
163
+ * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',
164
+ * slug: 'jshine',
165
+ * },
166
+ * {
167
+ * name: 'Moonlit Asteroid',
168
+ * gradient:
169
+ * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',
170
+ * slug: 'moonlit-asteroid',
171
+ * },
172
+ * {
173
+ * name: 'Rastafarie',
174
+ * gradient:
175
+ * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',
176
+ * slug: 'rastafari',
177
+ * },
178
+ * ] }
179
+ * />
180
+ * );
181
+ * };
182
182
  *```
183
183
  *
184
184
  */
@@ -209,6 +209,8 @@ export function GradientPicker({
209
209
  value: value,
210
210
  actions: clearable && !disableCustomGradients && /*#__PURE__*/_jsx(CircularOptionPicker.ButtonAction, {
211
211
  onClick: clearGradient,
212
+ accessibleWhenDisabled: true,
213
+ disabled: !value,
212
214
  children: __('Clear')
213
215
  }),
214
216
  headingLevel: headingLevel
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","useInstanceId","useCallback","useMemo","CircularOptionPicker","CustomGradientPicker","VStack","ColorHeading","jsx","_jsx","jsxs","_jsxs","isMultipleOriginObject","obj","Array","isArray","gradients","isMultipleOriginArray","arr","length","every","gradientObj","SingleOrigin","className","clearGradient","onChange","value","additionalProps","gradientOptions","map","gradient","name","slug","index","Option","isSelected","tooltipText","style","color","background","onClick","OptionGroup","options","MultipleOrigin","headingLevel","instanceId","spacing","children","gradientSet","id","level","Component","props","asButtons","loop","actions","ariaLabel","ariaLabelledby","metaProps","_metaProps","GradientPicker","clearable","disableCustomGradients","__experimentalIsRenderedInSidebar","undefined","ButtonAction"],"sources":["@wordpress/components/src/gradient-picker/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\nimport type {\n\tGradientPickerComponentProps,\n\tPickerProps,\n\tOriginObject,\n\tGradientObject,\n} from './types';\n\n// The Multiple Origin Gradients have a `gradients` property (an array of\n// gradient objects), while Single Origin ones have a `gradient` property.\nconst isMultipleOriginObject = (\n\tobj: Record< string, any >\n): obj is OriginObject =>\n\tArray.isArray( obj.gradients ) && ! ( 'gradient' in obj );\n\nconst isMultipleOriginArray = ( arr: any[] ): arr is OriginObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( gradientObj ) => isMultipleOriginObject( gradientObj ) )\n\t);\n};\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\t...additionalProps\n}: PickerProps< GradientObject > ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn gradients.map( ( { gradient, name, slug }, index ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient, index )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker.OptionGroup\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\theadingLevel,\n}: PickerProps< OriginObject > ) {\n\tconst instanceId = useInstanceId( MultipleOrigin );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\tconst id = `color-palette-${ instanceId }-${ index }`;\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel } id={ id }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ ( gradient ) =>\n\t\t\t\t\t\t\t\tonChange( gradient, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\taria-labelledby={ id }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nfunction Component( props: PickerProps< any > ) {\n\tconst {\n\t\tasButtons,\n\t\tloop,\n\t\tactions,\n\t\theadingLevel,\n\t\t'aria-label': ariaLabel,\n\t\t'aria-labelledby': ariaLabelledby,\n\t\t...additionalProps\n\t} = props;\n\tconst options = isMultipleOriginArray( props.gradients ) ? (\n\t\t<MultipleOrigin headingLevel={ headingLevel } { ...additionalProps } />\n\t) : (\n\t\t<SingleOrigin { ...additionalProps } />\n\t);\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\t{ ...metaProps }\n\t\t\tactions={ actions }\n\t\t\toptions={ options }\n\t\t/>\n\t);\n}\n\n/**\n * GradientPicker is a React component that renders a color gradient picker to\n * define a multi step gradient. There's either a _linear_ or a _radial_ type\n * available.\n *\n * ```jsx\n *import { GradientPicker } from '@wordpress/components';\n *import { useState } from '@wordpress/element';\n *\n *const myGradientPicker = () => {\n *\tconst [ gradient, setGradient ] = useState( null );\n *\n *\treturn (\n *\t\t<GradientPicker\n *\t\t\tvalue={ gradient }\n *\t\t\tonChange={ ( currentGradient ) => setGradient( currentGradient ) }\n *\t\t\tgradients={ [\n *\t\t\t\t{\n *\t\t\t\t\tname: 'JShine',\n *\t\t\t\t\tgradient:\n *\t\t\t\t\t\t'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',\n *\t\t\t\t\tslug: 'jshine',\n *\t\t\t\t},\n *\t\t\t\t{\n *\t\t\t\t\tname: 'Moonlit Asteroid',\n *\t\t\t\t\tgradient:\n *\t\t\t\t\t\t'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',\n *\t\t\t\t\tslug: 'moonlit-asteroid',\n *\t\t\t\t},\n *\t\t\t\t{\n *\t\t\t\t\tname: 'Rastafarie',\n *\t\t\t\t\tgradient:\n *\t\t\t\t\t\t'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',\n *\t\t\t\t\tslug: 'rastafari',\n *\t\t\t\t},\n *\t\t\t] }\n *\t\t/>\n *\t);\n *};\n *```\n *\n */\nexport function GradientPicker( {\n\tclassName,\n\tgradients = [],\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tdisableCustomGradients = false,\n\t__experimentalIsRenderedInSidebar,\n\theadingLevel = 2,\n\t...additionalProps\n}: GradientPickerComponentProps ) {\n\tconst clearGradient = useCallback(\n\t\t() => onChange( undefined ),\n\t\t[ onChange ]\n\t);\n\n\treturn (\n\t\t<VStack spacing={ gradients.length ? 4 : 0 }>\n\t\t\t{ ! disableCustomGradients && (\n\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( gradients.length > 0 || clearable ) && (\n\t\t\t\t<Component\n\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tactions={\n\t\t\t\t\t\tclearable &&\n\t\t\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\theadingL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AAe;QAAAuB,QAAA,EAEvBhD,EAAE,CAAE,OAAQ;MAAC,CACmB,CAEpC;MACD6C,YAAY,EAAGA;IAAc,CAC7B,CACD;EAAA,CACM,CAAC;AAEX;AAEA,eAAegB,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","useInstanceId","useCallback","useMemo","CircularOptionPicker","CustomGradientPicker","VStack","ColorHeading","jsx","_jsx","jsxs","_jsxs","isMultipleOriginObject","obj","Array","isArray","gradients","isMultipleOriginArray","arr","length","every","gradientObj","SingleOrigin","className","clearGradient","onChange","value","additionalProps","gradientOptions","map","gradient","name","slug","index","Option","isSelected","tooltipText","style","color","background","onClick","OptionGroup","options","MultipleOrigin","headingLevel","instanceId","spacing","children","gradientSet","id","level","Component","props","asButtons","loop","actions","ariaLabel","ariaLabelledby","metaProps","_metaProps","GradientPicker","clearable","disableCustomGradients","__experimentalIsRenderedInSidebar","undefined","ButtonAction","accessibleWhenDisabled","disabled"],"sources":["@wordpress/components/src/gradient-picker/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\nimport type {\n\tGradientPickerComponentProps,\n\tPickerProps,\n\tOriginObject,\n\tGradientObject,\n} from './types';\n\n// The Multiple Origin Gradients have a `gradients` property (an array of\n// gradient objects), while Single Origin ones have a `gradient` property.\nconst isMultipleOriginObject = (\n\tobj: Record< string, any >\n): obj is OriginObject =>\n\tArray.isArray( obj.gradients ) && ! ( 'gradient' in obj );\n\nconst isMultipleOriginArray = ( arr: any[] ): arr is OriginObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( gradientObj ) => isMultipleOriginObject( gradientObj ) )\n\t);\n};\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\t...additionalProps\n}: PickerProps< GradientObject > ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn gradients.map( ( { gradient, name, slug }, index ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient, index )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker.OptionGroup\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\theadingLevel,\n}: PickerProps< OriginObject > ) {\n\tconst instanceId = useInstanceId( MultipleOrigin );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\tconst id = `color-palette-${ instanceId }-${ index }`;\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel } id={ id }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ ( gradient ) =>\n\t\t\t\t\t\t\t\tonChange( gradient, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\taria-labelledby={ id }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nfunction Component( props: PickerProps< any > ) {\n\tconst {\n\t\tasButtons,\n\t\tloop,\n\t\tactions,\n\t\theadingLevel,\n\t\t'aria-label': ariaLabel,\n\t\t'aria-labelledby': ariaLabelledby,\n\t\t...additionalProps\n\t} = props;\n\tconst options = isMultipleOriginArray( props.gradients ) ? (\n\t\t<MultipleOrigin headingLevel={ headingLevel } { ...additionalProps } />\n\t) : (\n\t\t<SingleOrigin { ...additionalProps } />\n\t);\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\t{ ...metaProps }\n\t\t\tactions={ actions }\n\t\t\toptions={ options }\n\t\t/>\n\t);\n}\n\n/**\n * GradientPicker is a React component that renders a color gradient picker to\n * define a multi step gradient. There's either a _linear_ or a _radial_ type\n * available.\n *\n * ```jsx\n * import { useState } from 'react';\n * import { GradientPicker } from '@wordpress/components';\n *\n * const MyGradientPicker = () => {\n * const [ gradient, setGradient ] = useState( null );\n *\n * return (\n * <GradientPicker\n * value={ gradient }\n * onChange={ ( currentGradient ) => setGradient( currentGradient ) }\n * gradients={ [\n * {\n * name: 'JShine',\n * gradient:\n * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',\n * slug: 'jshine',\n * },\n * {\n * name: 'Moonlit Asteroid',\n * gradient:\n * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',\n * slug: 'moonlit-asteroid',\n * },\n * {\n * name: 'Rastafarie',\n * gradient:\n * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',\n * slug: 'rastafari',\n * },\n * ] }\n * />\n * );\n * };\n *```\n *\n */\nexport function GradientPicker( {\n\tclassName,\n\tgradients = [],\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tdisableCustomGradients = false,\n\t__experimentalIsRenderedInSidebar,\n\theadingLevel = 2,\n\t...additionalProps\n}: GradientPickerComponentProps ) {\n\tconst clearGradient = useCallback(\n\t\t() => onChange( undefined ),\n\t\t[ onChange ]\n\t);\n\n\treturn (\n\t\t<VStack spacing={ gradients.length ? 4 : 0 }>\n\t\t\t{ ! disableCustomGradients && (\n\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( gradients.length > 0 || clearable ) && (\n\t\t\t\t<Component\n\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tactions={\n\t\t\t\t\t\tclearable &&\n\t\t\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default GradientPicker;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;;AAEzD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,YAAY,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQvD;AACA;AACA,MAAMC,sBAAsB,GAC3BC,GAA0B,IAE1BC,KAAK,CAACC,OAAO,CAAE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Aa,GAAGtB,WAAW,CAChC,MAAMuB,QAAQ,CAAEuC,SAAU,CAAC,EAC3B,CAAEvC,QAAQ,CACX,CAAC;EAED,oBACCd,KAAA,CAACL,MAAM;IAACwC,OAAO,EAAG9B,SAAS,CAACG,MAAM,GAAG,CAAC,GAAG,CAAG;IAAA4B,QAAA,GACzC,CAAEe,sBAAsB,iBACzBrD,IAAA,CAACJ,oBAAoB;MACpB0D,iCAAiC,EAChCA,iCACA;MACDrC,KAAK,EAAGA,KAAO;MACfD,QAAQ,EAAGA;IAAU,CACrB,CACD,EACC,CAAET,SAAS,CAACG,MAAM,GAAG,CAAC,IAAI0C,SAAS,kBACpCpD,IAAA,CAAC0C,SAAS;MAAA,GACJxB,eAAe;MACpBJ,SAAS,EAAGA,SAAW;MACvBC,aAAa,EAAGA,aAAe;MAC/BR,SAAS,EAAGA,SAAW;MACvBS,QAAQ,EAAGA,QAAU;MACrBC,KAAK,EAAGA,KAAO;MACf6B,OAAO,EACNM,SAAS,IACT,CAAEC,sBAAsB,iBACvBrD,IAAA,CAACL,oBAAoB,CAAC6D,YAAY;QACjCzB,OAAO,EAAGhB,aAAe;QACzB0C,sBAAsB;QACtBC,QAAQ,EAAG,CAAEzC,KAAO;QAAAqB,QAAA,EAElBhD,EAAE,CAAE,OAAQ;MAAC,CACmB,CAEpC;MACD6C,YAAY,EAAGA;IAAc,CAC7B,CACD;EAAA,CACM,CAAC;AAEX;AAEA,eAAegB,cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/gradient-picker/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\n\nexport type GradientObject = {\n\tgradient: string;\n\tname: string;\n\tslug: string;\n};\nexport type OriginObject = { name: string; gradients: GradientObject[] };\nexport type GradientsProp = GradientObject[] | OriginObject[];\n\ntype GradientPickerBaseProps = {\n\t/**\n\t * The class name added to the wrapper.\n\t */\n\tclassName?: string;\n\t/**\n\t * The function called when a new gradient has been defined. It is passed to\n\t * the `currentGradient` as an argument.\n\t */\n\tonChange: ( currentGradient: string | undefined ) => void;\n\t/**\n\t * The current value of the gradient. Pass a css gradient string (See default value for example).\n\t * Optionally pass in a `null` value to specify no gradient is currently selected.\n\t *\n\t * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'\n\t */\n\tvalue?: GradientObject[ 'gradient' ] | null;\n\t/**\n\t * Whether the palette should have a clearing button or not.\n\t *\n\t * @default true\n\t */\n\tclearable?: boolean;\n\t/**\n\t * The heading level. Only applies in cases where gradients are provided\n\t * from multiple origins (ie. when the array passed as the `gradients` prop\n\t * contains two or more items).\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Whether the control should present as a set of buttons,\n\t * each with its own tab stop.\n\t *\n\t * @default false\n\t */\n\tasButtons?: boolean;\n\t/**\n\t * Prevents keyboard interaction from wrapping around.\n\t * Only used when `asButtons` is not true.\n\t *\n\t * @default true\n\t */\n\tloop?: boolean;\n} & (\n\t| {\n\t\t\t/**\n\t\t\t * A label to identify the purpose of the control.\n\t\t\t *\n\t\t\t * @todo [#54055] Either this or `aria-labelledby` should be required\n\t\t\t */\n\t\t\t'aria-label'?: string;\n\t\t\t'aria-labelledby'?: never;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * An ID of an element to provide a label for the control.\n\t\t\t *\n\t\t\t * @todo [#54055] Either this or `aria-label` should be required\n\t\t\t */\n\t\t\t'aria-labelledby'?: string;\n\t\t\t'aria-label'?: never;\n\t }\n);\n\nexport type GradientPickerComponentProps = GradientPickerBaseProps & {\n\t/**\n\t * An array of objects as predefined gradients displayed above the gradient\n\t * selector. Alternatively, if there are multiple sets (or 'origins') of\n\t * gradients, you can pass an array of objects each with a `name` and a\n\t * `gradients` array which will in turn contain the predefined gradient objects.\n\t *\n\t * @default []\n\t */\n\tgradients?: GradientsProp;\n\t/**\n\t * Start opting in to the new margin-free styles that will become the default\n\t * in a future version, currently scheduled to be WordPress 6.4. (The prop\n\t * can be safely removed once this happens.)\n\t *\n\t * @default false\n\t * @deprecated Default behavior since WP 6.5. Prop can be safely removed.\n\t * @ignore\n\t */\n\t__nextHasNoMargin?: boolean;\n\t/**\n\t * If true, the gradient picker will not be displayed and only defined\n\t * gradients from `gradients` will be shown.\n\t *\n\t * @default false\n\t */\n\tdisableCustomGradients?: boolean;\n\t/**\n\t * Whether this is rendered in the sidebar.\n\t *\n\t * @default false\n\t */\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type PickerProps< TOriginType extends GradientObject | OriginObject > =\n\tGradientPickerBaseProps & {\n\t\tclearGradient: () => void;\n\t\tonChange: (\n\t\t\tcurrentGradient: string | undefined,\n\t\t\tindex: number\n\t\t) => void;\n\t\tactions?: React.ReactNode;\n\t\tgradients: TOriginType[];\n\t};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/gradient-picker/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\n\nexport type GradientObject = {\n\tgradient: string;\n\tname: string;\n\tslug: string;\n};\nexport type OriginObject = { name: string; gradients: GradientObject[] };\nexport type GradientsProp = GradientObject[] | OriginObject[];\n\ntype GradientPickerBaseProps = {\n\t/**\n\t * The class name added to the wrapper.\n\t */\n\tclassName?: string;\n\t/**\n\t * The function called when a new gradient has been defined. It is passed to\n\t * the `currentGradient` as an argument.\n\t */\n\tonChange: ( currentGradient: string | undefined ) => void;\n\t/**\n\t * The current value of the gradient. Pass a css gradient string (See default value for example).\n\t * Optionally pass in a `null` value to specify no gradient is currently selected.\n\t *\n\t * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'\n\t */\n\tvalue?: GradientObject[ 'gradient' ] | null;\n\t/**\n\t * Whether the palette should have a clearing button or not.\n\t *\n\t * @default true\n\t */\n\tclearable?: boolean;\n\t/**\n\t * The heading level. Only applies in cases where gradients are provided\n\t * from multiple origins (i.e. when the array passed as the `gradients` prop\n\t * contains two or more items).\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Whether the control should present as a set of buttons,\n\t * each with its own tab stop.\n\t *\n\t * @default false\n\t */\n\tasButtons?: boolean;\n\t/**\n\t * Prevents keyboard interaction from wrapping around.\n\t * Only used when `asButtons` is not true.\n\t *\n\t * @default true\n\t */\n\tloop?: boolean;\n} & (\n\t| {\n\t\t\t// TODO: [#54055] Either this or `aria-labelledby` should be required\n\t\t\t/**\n\t\t\t * A label to identify the purpose of the control.\n\t\t\t */\n\t\t\t'aria-label'?: string;\n\t\t\t'aria-labelledby'?: never;\n\t }\n\t| {\n\t\t\t// TODO: [#54055] Either this or `aria-label` should be required\n\t\t\t/**\n\t\t\t * An ID of an element to provide a label for the control.\n\t\t\t */\n\t\t\t'aria-labelledby'?: string;\n\t\t\t'aria-label'?: never;\n\t }\n);\n\nexport type GradientPickerComponentProps = GradientPickerBaseProps & {\n\t/**\n\t * An array of objects as predefined gradients displayed above the gradient\n\t * selector. Alternatively, if there are multiple sets (or 'origins') of\n\t * gradients, you can pass an array of objects each with a `name` and a\n\t * `gradients` array which will in turn contain the predefined gradient objects.\n\t *\n\t * @default []\n\t */\n\tgradients?: GradientsProp;\n\t/**\n\t * Start opting in to the new margin-free styles that will become the default\n\t * in a future version, currently scheduled to be WordPress 6.4. (The prop\n\t * can be safely removed once this happens.)\n\t *\n\t * @default false\n\t * @deprecated Default behavior since WP 6.5. Prop can be safely removed.\n\t * @ignore\n\t */\n\t__nextHasNoMargin?: boolean;\n\t/**\n\t * If true, the gradient picker will not be displayed and only defined\n\t * gradients from `gradients` will be shown.\n\t *\n\t * @default false\n\t */\n\tdisableCustomGradients?: boolean;\n\t/**\n\t * Whether this is rendered in the sidebar.\n\t *\n\t * @default false\n\t */\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type PickerProps< TOriginType extends GradientObject | OriginObject > =\n\tGradientPickerBaseProps & {\n\t\tclearGradient: () => void;\n\t\tonChange: (\n\t\t\tcurrentGradient: string | undefined,\n\t\t\tindex: number\n\t\t) => void;\n\t\tactions?: React.ReactNode;\n\t\tgradients: TOriginType[];\n\t};\n"],"mappings":"","ignoreList":[]}
@@ -23,6 +23,7 @@ export default function PageControl({
23
23
  // Set aria-current="step" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current
24
24
  "aria-current": page === currentPage ? 'step' : undefined,
25
25
  children: /*#__PURE__*/_jsx(Button, {
26
+ size: "small",
26
27
  icon: /*#__PURE__*/_jsx(PageControlIcon, {}),
27
28
  "aria-label": sprintf(/* translators: 1: current page number 2: total number of pages */
28
29
  __('Page %1$d of %2$d'), page + 1, numberOfPages),
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","Button","PageControlIcon","jsx","_jsx","PageControl","currentPage","numberOfPages","setCurrentPage","className","children","Array","from","length","map","_","page","undefined","icon","onClick"],"sources":["@wordpress/components/src/guide/page-control.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { PageControlIcon } from './icons';\nimport type { PageControlProps } from './types';\n\nexport default function PageControl( {\n\tcurrentPage,\n\tnumberOfPages,\n\tsetCurrentPage,\n}: PageControlProps ) {\n\treturn (\n\t\t<ul\n\t\t\tclassName=\"components-guide__page-control\"\n\t\t\taria-label={ __( 'Guide controls' ) }\n\t\t>\n\t\t\t{ Array.from( { length: numberOfPages } ).map( ( _, page ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ page }\n\t\t\t\t\t// Set aria-current=\"step\" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current\n\t\t\t\t\taria-current={ page === currentPage ? 'step' : undefined }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ page }\n\t\t\t\t\t\ticon={ <PageControlIcon /> }\n\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t/* translators: 1: current page number 2: total number of pages */\n\t\t\t\t\t\t\t__( 'Page %1$d of %2$d' ),\n\t\t\t\t\t\t\tpage + 1,\n\t\t\t\t\t\t\tnumberOfPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => setCurrentPage( page ) }\n\t\t\t\t\t/>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,eAAe,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG1C,eAAe,SAASC,WAAWA,CAAE;EACpCC,WAAW;EACXC,aAAa;EACbC;AACiB,CAAC,EAAG;EACrB,oBACCJ,IAAA;IACCK,SAAS,EAAC,gCAAgC;IAC1C,cAAaV,EAAE,CAAE,gBAAiB,CAAG;IAAAW,QAAA,EAEnCC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEN;IAAc,CAAE,CAAC,CAACO,GAAG,CAAE,CAAEC,CAAC,EAAEC,IAAI,kBACvDZ,IAAA;MAEC;MACA,gBAAeY,IAAI,KAAKV,WAAW,GAAG,MAAM,GAAGW,SAAW;MAAAP,QAAA,eAE1DN,IAAA,CAACH,MAAM;QAENiB,IAAI,eAAGd,IAAA,CAACF,eAAe,IAAE,CAAG;QAC5B,cAAaF,OAAO,CACnB;QACAD,EAAE,CAAE,mBAAoB,CAAC,EACzBiB,IAAI,GAAG,CAAC,EACRT,aACD,CAAG;QACHY,OAAO,EAAGA,CAAA,KAAMX,cAAc,CAAEQ,IAAK;MAAG,GARlCA,IASN;IAAC,GAdIA,IAeH,CACH;EAAC,CACA,CAAC;AAEP","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","Button","PageControlIcon","jsx","_jsx","PageControl","currentPage","numberOfPages","setCurrentPage","className","children","Array","from","length","map","_","page","undefined","size","icon","onClick"],"sources":["@wordpress/components/src/guide/page-control.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { PageControlIcon } from './icons';\nimport type { PageControlProps } from './types';\n\nexport default function PageControl( {\n\tcurrentPage,\n\tnumberOfPages,\n\tsetCurrentPage,\n}: PageControlProps ) {\n\treturn (\n\t\t<ul\n\t\t\tclassName=\"components-guide__page-control\"\n\t\t\taria-label={ __( 'Guide controls' ) }\n\t\t>\n\t\t\t{ Array.from( { length: numberOfPages } ).map( ( _, page ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ page }\n\t\t\t\t\t// Set aria-current=\"step\" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current\n\t\t\t\t\taria-current={ page === currentPage ? 'step' : undefined }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tkey={ page }\n\t\t\t\t\t\ticon={ <PageControlIcon /> }\n\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t/* translators: 1: current page number 2: total number of pages */\n\t\t\t\t\t\t\t__( 'Page %1$d of %2$d' ),\n\t\t\t\t\t\t\tpage + 1,\n\t\t\t\t\t\t\tnumberOfPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => setCurrentPage( page ) }\n\t\t\t\t\t/>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,eAAe,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG1C,eAAe,SAASC,WAAWA,CAAE;EACpCC,WAAW;EACXC,aAAa;EACbC;AACiB,CAAC,EAAG;EACrB,oBACCJ,IAAA;IACCK,SAAS,EAAC,gCAAgC;IAC1C,cAAaV,EAAE,CAAE,gBAAiB,CAAG;IAAAW,QAAA,EAEnCC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEN;IAAc,CAAE,CAAC,CAACO,GAAG,CAAE,CAAEC,CAAC,EAAEC,IAAI,kBACvDZ,IAAA;MAEC;MACA,gBAAeY,IAAI,KAAKV,WAAW,GAAG,MAAM,GAAGW,SAAW;MAAAP,QAAA,eAE1DN,IAAA,CAACH,MAAM;QACNiB,IAAI,EAAC,OAAO;QAEZC,IAAI,eAAGf,IAAA,CAACF,eAAe,IAAE,CAAG;QAC5B,cAAaF,OAAO,CACnB;QACAD,EAAE,CAAE,mBAAoB,CAAC,EACzBiB,IAAI,GAAG,CAAC,EACRT,aACD,CAAG;QACHa,OAAO,EAAGA,CAAA,KAAMZ,cAAc,CAAEQ,IAAK;MAAG,GARlCA,IASN;IAAC,GAfIA,IAgBH,CACH;EAAC,CACA,CAAC;AAEP","ignoreList":[]}
@@ -13,6 +13,15 @@ import { SVG } from '@wordpress/primitives';
13
13
  */
14
14
  import Dashicon from '../dashicon';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
+ /**
17
+ * Renders a raw icon without any initial styling or wrappers.
18
+ *
19
+ * ```jsx
20
+ * import { wordpress } from '@wordpress/icons';
21
+ *
22
+ * <Icon icon={ wordpress } />
23
+ * ```
24
+ */
16
25
  function Icon({
17
26
  icon = null,
18
27
  size = 'string' === typeof icon ? 20 : 24,
@@ -1 +1 @@
1
- {"version":3,"names":["cloneElement","createElement","isValidElement","SVG","Dashicon","jsx","_jsx","Icon","icon","size","additionalProps","type","appliedProps","props","width","height"],"sources":["@wordpress/components/src/icon/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentType, HTMLProps, SVGProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\nexport type IconType =\n\t| DashiconIconKey\n\t| ComponentType< { size?: number } >\n\t| ( ( props: { size?: number } ) => JSX.Element )\n\t| JSX.Element;\n\ninterface BaseProps {\n\t/**\n\t * The icon to render. Supported values are: Dashicons (specified as\n\t * strings), functions, Component instances and `null`.\n\t *\n\t * @default null\n\t */\n\ticon?: IconType | null;\n\t/**\n\t * The size (width and height) of the icon.\n\t *\n\t * @default `20` when a Dashicon is rendered, `24` for all other icons.\n\t */\n\tsize?: number;\n}\n\ntype AdditionalProps< T > = T extends ComponentType< infer U >\n\t? U\n\t: T extends DashiconIconKey\n\t? SVGProps< SVGSVGElement >\n\t: {};\n\nexport type Props = BaseProps & AdditionalProps< IconType >;\n\nfunction Icon( {\n\ticon = null,\n\tsize = 'string' === typeof icon ? 20 : 24,\n\t...additionalProps\n}: Props ) {\n\tif ( 'string' === typeof icon ) {\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\ticon={ icon }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( additionalProps as HTMLProps< HTMLSpanElement > ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isValidElement( icon ) && Dashicon === icon.type ) {\n\t\treturn cloneElement( icon, {\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( 'function' === typeof icon ) {\n\t\treturn createElement( icon, {\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {\n\t\tconst appliedProps = {\n\t\t\t...icon.props,\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...additionalProps,\n\t\t};\n\n\t\treturn <SVG { ...appliedProps } />;\n\t}\n\n\tif ( isValidElement( icon ) ) {\n\t\treturn cloneElement( icon, {\n\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,CAAC;EACnC;EAEA,IAAKV,cAAc,CAAEM,IAAK,CAAC,EAAG;IAC7B,OAAOR,YAAY,CAAEQ,IAAI,EAAE;MAC1B;MACAC,IAAI;MACJ,GAAGC;IACJ,CAAE,CAAC;EACJ;EAEA,OAAOF,IAAI;AACZ;AAEA,eAAeD,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["cloneElement","createElement","isValidElement","SVG","Dashicon","jsx","_jsx","Icon","icon","size","additionalProps","type","appliedProps","props","width","height"],"sources":["@wordpress/components/src/icon/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentType, HTMLProps, SVGProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\nexport type IconType =\n\t| DashiconIconKey\n\t| ComponentType< { size?: number } >\n\t| ( ( props: { size?: number } ) => JSX.Element )\n\t| JSX.Element;\n\ntype AdditionalProps< T > = T extends ComponentType< infer U >\n\t? U\n\t: T extends DashiconIconKey\n\t? SVGProps< SVGSVGElement >\n\t: {};\n\nexport type Props = {\n\t/**\n\t * The icon to render. In most cases, you should use an icon from\n\t * [the `@wordpress/icons` package](https://wordpress.github.io/gutenberg/?path=/story/icons-icon--library).\n\t *\n\t * Other supported values are: component instances, functions,\n\t * [Dashicons](https://developer.wordpress.org/resource/dashicons/)\n\t * (specified as strings), and `null`.\n\t *\n\t * The `size` value, as well as any other additional props, will be passed through.\n\t *\n\t * @default null\n\t */\n\ticon?: IconType | null;\n\t/**\n\t * The size (width and height) of the icon.\n\t *\n\t * Defaults to `20` when `icon` is a string (i.e. a Dashicon id), otherwise `24`.\n\t *\n\t * @default `'string' === typeof icon ? 20 : 24`.\n\t */\n\tsize?: number;\n} & AdditionalProps< IconType >;\n\n/**\n * Renders a raw icon without any initial styling or wrappers.\n *\n * ```jsx\n * import { wordpress } from '@wordpress/icons';\n *\n * <Icon icon={ wordpress } />\n * ```\n */\nfunction Icon( {\n\ticon = null,\n\tsize = 'string' === typeof icon ? 20 : 24,\n\t...additionalProps\n}: Props ) {\n\tif ( 'string' === typeof icon ) {\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\ticon={ icon }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( additionalProps as HTMLProps< HTMLSpanElement > ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isValidElement( icon ) && Dashicon === icon.type ) {\n\t\treturn cloneElement( icon, {\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( 'function' === typeof icon ) {\n\t\treturn createElement( icon, {\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {\n\t\tconst appliedProps = {\n\t\t\t...icon.props,\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...additionalProps,\n\t\t};\n\n\t\treturn <SVG { ...appliedProps } />;\n\t}\n\n\tif ( isValidElement( icon ) ) {\n\t\treturn cloneElement( icon, {\n\t\t\t// @ts-ignore Just forwarding the size prop along\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\treturn icon;\n}\n\nexport default Icon;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,YAAY,EACZC,aAAa,EACbC,cAAc,QACR,oBAAoB;AAC3B,SAASC,GAAG,QAAQ,uBAAuB;;AAE3C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuCnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAAE;EACdC,IAAI,GAAG,IAAI;EACXC,IAAI,GAAG,QAAQ,KAAK,OAAOD,IAAI,GAAG,EAAE,GAAG,EAAE;EAC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