@wordpress/components 23.5.0 → 23.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1131) hide show
  1. package/CHANGELOG.md +69 -8
  2. package/build/angle-picker-control/angle-circle.js +1 -4
  3. package/build/angle-picker-control/angle-circle.js.map +1 -1
  4. package/build/angle-picker-control/index.js +10 -22
  5. package/build/angle-picker-control/index.js.map +1 -1
  6. package/build/angle-picker-control/styles/angle-picker-control-styles.js +24 -15
  7. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  8. package/build/animate/index.js +29 -19
  9. package/build/animate/index.js.map +1 -1
  10. package/build/animate/types.js.map +1 -0
  11. package/build/animation/index.js.map +1 -1
  12. package/build/autocomplete/autocompleter-ui.js +5 -5
  13. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  14. package/build/autocomplete/get-default-use-items.js.map +1 -1
  15. package/build/autocomplete/index.js +25 -91
  16. package/build/autocomplete/index.js.map +1 -1
  17. package/build/autocomplete/types.js +6 -0
  18. package/build/autocomplete/types.js.map +1 -0
  19. package/build/box-control/axial-input-controls.js.map +1 -1
  20. package/build/color-picker/color-input.js +0 -4
  21. package/build/color-picker/color-input.js.map +1 -1
  22. package/build/color-picker/component.js +5 -4
  23. package/build/color-picker/component.js.map +1 -1
  24. package/build/color-picker/hex-input.js.map +1 -1
  25. package/build/color-picker/hsl-input.js.map +1 -1
  26. package/build/color-picker/input-with-slider.js.map +1 -1
  27. package/build/color-picker/legacy-adapter.js.map +1 -1
  28. package/build/color-picker/picker.js.map +1 -1
  29. package/build/color-picker/rgb-input.js.map +1 -1
  30. package/build/color-picker/use-deprecated-props.js.map +1 -1
  31. package/build/custom-gradient-picker/constants.js +1 -1
  32. package/build/custom-gradient-picker/constants.js.map +1 -1
  33. package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  34. package/build/custom-gradient-picker/gradient-bar/control-points.js +9 -3
  35. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  36. package/build/custom-gradient-picker/gradient-bar/index.js +14 -7
  37. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  38. package/build/custom-gradient-picker/gradient-bar/utils.js +34 -52
  39. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  40. package/build/custom-gradient-picker/index.js +45 -14
  41. package/build/custom-gradient-picker/index.js.map +1 -1
  42. package/build/custom-gradient-picker/serializer.js +14 -3
  43. package/build/custom-gradient-picker/serializer.js.map +1 -1
  44. package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  45. package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  46. package/build/custom-gradient-picker/types.js +6 -0
  47. package/build/custom-gradient-picker/types.js.map +1 -0
  48. package/build/custom-gradient-picker/utils.js +17 -10
  49. package/build/custom-gradient-picker/utils.js.map +1 -1
  50. package/build/dimension-control/index.js +31 -5
  51. package/build/dimension-control/index.js.map +1 -1
  52. package/build/dimension-control/sizes.js +2 -4
  53. package/build/dimension-control/sizes.js.map +1 -1
  54. package/build/dimension-control/types.js +6 -0
  55. package/build/dimension-control/types.js.map +1 -0
  56. package/build/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  57. package/build/duotone-picker/color-list-picker/index.js.map +1 -0
  58. package/build/duotone-picker/color-list-picker/types.js +6 -0
  59. package/build/duotone-picker/color-list-picker/types.js.map +1 -0
  60. package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
  61. package/build/duotone-picker/duotone-picker.js +39 -2
  62. package/build/duotone-picker/duotone-picker.js.map +1 -1
  63. package/build/duotone-picker/duotone-swatch.js.map +1 -1
  64. package/build/duotone-picker/index.js.map +1 -1
  65. package/build/duotone-picker/types.js +6 -0
  66. package/build/duotone-picker/types.js.map +1 -0
  67. package/build/duotone-picker/utils.js +13 -11
  68. package/build/duotone-picker/utils.js.map +1 -1
  69. package/build/flex/flex/hook.js +3 -3
  70. package/build/flex/flex/hook.js.map +1 -1
  71. package/build/font-size-picker/index.js +2 -1
  72. package/build/font-size-picker/index.js.map +1 -1
  73. package/build/form-token-field/index.js +10 -4
  74. package/build/form-token-field/index.js.map +1 -1
  75. package/build/gradient-picker/index.js +61 -7
  76. package/build/gradient-picker/index.js.map +1 -1
  77. package/build/gradient-picker/types.js +6 -0
  78. package/build/gradient-picker/types.js.map +1 -0
  79. package/build/guide/icons.js.map +1 -1
  80. package/build/guide/index.js +46 -8
  81. package/build/guide/index.js.map +1 -1
  82. package/build/guide/page-control.js.map +1 -1
  83. package/build/guide/page.js.map +1 -1
  84. package/build/guide/types.js +6 -0
  85. package/build/guide/types.js.map +1 -0
  86. package/build/h-stack/utils.js +5 -5
  87. package/build/h-stack/utils.js.map +1 -1
  88. package/build/higher-order/navigate-regions/index.js +33 -3
  89. package/build/higher-order/navigate-regions/index.js.map +1 -1
  90. package/build/higher-order/with-fallback-styles/index.js +2 -2
  91. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  92. package/build/higher-order/with-filters/index.js +31 -7
  93. package/build/higher-order/with-filters/index.js.map +1 -1
  94. package/build/higher-order/with-focus-return/index.js +10 -10
  95. package/build/higher-order/with-focus-return/index.js.map +1 -1
  96. package/build/higher-order/with-notices/index.js +28 -25
  97. package/build/higher-order/with-notices/index.js.map +1 -1
  98. package/build/higher-order/with-notices/types.js +6 -0
  99. package/build/higher-order/with-notices/types.js.map +1 -0
  100. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  101. package/build/icon/index.js +1 -8
  102. package/build/icon/index.js.map +1 -1
  103. package/build/index.native.js +18 -9
  104. package/build/index.native.js.map +1 -1
  105. package/build/mobile/bottom-sheet/cell.native.js +1 -1
  106. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  107. package/build/mobile/bottom-sheet-text-control/index.native.js +4 -3
  108. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  109. package/build/navigation/back-button/index.js +6 -5
  110. package/build/navigation/back-button/index.js.map +1 -1
  111. package/build/navigation/constants.js.map +1 -1
  112. package/build/navigation/context.js +7 -4
  113. package/build/navigation/context.js.map +1 -1
  114. package/build/navigation/group/context.js.map +1 -1
  115. package/build/navigation/group/index.js +5 -1
  116. package/build/navigation/group/index.js.map +1 -1
  117. package/build/navigation/index.js +49 -3
  118. package/build/navigation/index.js.map +1 -1
  119. package/build/navigation/item/base-content.js +0 -1
  120. package/build/navigation/item/base-content.js.map +1 -1
  121. package/build/navigation/item/base.js.map +1 -1
  122. package/build/navigation/item/index.js +5 -1
  123. package/build/navigation/item/index.js.map +1 -1
  124. package/build/navigation/item/use-navigation-tree-item.js +1 -1
  125. package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
  126. package/build/navigation/menu/context.js.map +1 -1
  127. package/build/navigation/menu/index.js +5 -1
  128. package/build/navigation/menu/index.js.map +1 -1
  129. package/build/navigation/menu/menu-title-search.js +8 -6
  130. package/build/navigation/menu/menu-title-search.js.map +1 -1
  131. package/build/navigation/menu/menu-title.js +4 -2
  132. package/build/navigation/menu/menu-title.js.map +1 -1
  133. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  134. package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  135. package/build/navigation/styles/navigation-styles.js +36 -36
  136. package/build/navigation/styles/navigation-styles.js.map +1 -1
  137. package/build/navigation/types.js +6 -0
  138. package/build/navigation/types.js.map +1 -0
  139. package/build/navigation/use-create-navigation-tree.js +7 -0
  140. package/build/navigation/use-create-navigation-tree.js.map +1 -1
  141. package/build/navigation/use-navigation-tree-nodes.js +3 -5
  142. package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
  143. package/build/navigation/utils.js.map +1 -1
  144. package/build/navigator/navigator-screen/component.js +5 -3
  145. package/build/navigator/navigator-screen/component.js.map +1 -1
  146. package/build/number-control/index.js +1 -3
  147. package/build/number-control/index.js.map +1 -1
  148. package/build/palette-edit/index.js +65 -26
  149. package/build/palette-edit/index.js.map +1 -1
  150. package/build/palette-edit/types.js +6 -0
  151. package/build/palette-edit/types.js.map +1 -0
  152. package/build/panel/body.js +15 -17
  153. package/build/panel/body.js.map +1 -1
  154. package/build/placeholder/index.js.map +1 -1
  155. package/build/query-controls/author-select.js +0 -4
  156. package/build/query-controls/author-select.js.map +1 -1
  157. package/build/query-controls/category-select.js +0 -4
  158. package/build/query-controls/category-select.js.map +1 -1
  159. package/build/query-controls/terms.js +30 -15
  160. package/build/query-controls/terms.js.map +1 -1
  161. package/build/range-control/index.js.map +1 -1
  162. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  163. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  164. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  165. package/build/responsive-wrapper/index.js +12 -13
  166. package/build/responsive-wrapper/index.js.map +1 -1
  167. package/build/sandbox/index.native.js +80 -67
  168. package/build/sandbox/index.native.js.map +1 -1
  169. package/build/select-control/index.js +19 -16
  170. package/build/select-control/index.js.map +1 -1
  171. package/build/tab-panel/index.js +1 -1
  172. package/build/tab-panel/index.js.map +1 -1
  173. package/build/toolbar/toolbar-button/index.js +32 -10
  174. package/build/toolbar/toolbar-button/index.js.map +1 -1
  175. package/build/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  176. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  177. package/build/toolbar/toolbar-button/types.js +6 -0
  178. package/build/toolbar/toolbar-button/types.js.map +1 -0
  179. package/build/toolbar/toolbar-context/index.js +4 -2
  180. package/build/toolbar/toolbar-context/index.js.map +1 -1
  181. package/build/tools-panel/tools-panel/hook.js +45 -6
  182. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  183. package/build/tooltip/index.js +18 -6
  184. package/build/tooltip/index.js.map +1 -1
  185. package/build/tree-select/index.js.map +1 -1
  186. package/build/ui/context/get-styled-class-name-from-key.js +2 -2
  187. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  188. package/build/utils/font.js +3 -7
  189. package/build/utils/font.js.map +1 -1
  190. package/build/utils/input/input-control.js +1 -1
  191. package/build/utils/input/input-control.js.map +1 -1
  192. package/build/v-stack/hook.js +2 -0
  193. package/build/v-stack/hook.js.map +1 -1
  194. package/build-module/angle-picker-control/angle-circle.js +1 -4
  195. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  196. package/build-module/angle-picker-control/index.js +12 -21
  197. package/build-module/angle-picker-control/index.js.map +1 -1
  198. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
  199. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  200. package/build-module/animate/index.js +27 -17
  201. package/build-module/animate/index.js.map +1 -1
  202. package/build-module/animation/index.js.map +1 -1
  203. package/build-module/autocomplete/autocompleter-ui.js +6 -6
  204. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  205. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  206. package/build-module/autocomplete/index.js +28 -94
  207. package/build-module/autocomplete/index.js.map +1 -1
  208. package/build-module/autocomplete/types.js +2 -0
  209. package/build-module/box-control/axial-input-controls.js.map +1 -1
  210. package/build-module/color-picker/color-input.js +0 -4
  211. package/build-module/color-picker/color-input.js.map +1 -1
  212. package/build-module/color-picker/component.js +3 -3
  213. package/build-module/color-picker/component.js.map +1 -1
  214. package/build-module/color-picker/hex-input.js.map +1 -1
  215. package/build-module/color-picker/hsl-input.js.map +1 -1
  216. package/build-module/color-picker/input-with-slider.js.map +1 -1
  217. package/build-module/color-picker/legacy-adapter.js.map +1 -1
  218. package/build-module/color-picker/picker.js +4 -0
  219. package/build-module/color-picker/picker.js.map +1 -1
  220. package/build-module/color-picker/rgb-input.js.map +1 -1
  221. package/build-module/color-picker/use-deprecated-props.js.map +1 -1
  222. package/build-module/custom-gradient-picker/constants.js +1 -1
  223. package/build-module/custom-gradient-picker/constants.js.map +1 -1
  224. package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
  225. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -3
  226. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  227. package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -7
  228. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  229. package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -52
  230. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  231. package/build-module/custom-gradient-picker/index.js +44 -16
  232. package/build-module/custom-gradient-picker/index.js.map +1 -1
  233. package/build-module/custom-gradient-picker/serializer.js +14 -3
  234. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  235. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
  236. package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
  237. package/build-module/custom-gradient-picker/types.js +2 -0
  238. package/build-module/custom-gradient-picker/types.js.map +1 -0
  239. package/build-module/custom-gradient-picker/utils.js +17 -10
  240. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  241. package/build-module/dimension-control/index.js +28 -3
  242. package/build-module/dimension-control/index.js.map +1 -1
  243. package/build-module/dimension-control/sizes.js +6 -5
  244. package/build-module/dimension-control/sizes.js.map +1 -1
  245. package/build-module/dimension-control/types.js +2 -0
  246. package/build-module/dimension-control/types.js.map +1 -0
  247. package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
  248. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
  249. package/build-module/duotone-picker/color-list-picker/types.js +2 -0
  250. package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
  251. package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
  252. package/build-module/duotone-picker/duotone-picker.js +38 -2
  253. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  254. package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
  255. package/build-module/duotone-picker/index.js.map +1 -1
  256. package/build-module/duotone-picker/types.js +2 -0
  257. package/build-module/duotone-picker/types.js.map +1 -0
  258. package/build-module/duotone-picker/utils.js +17 -11
  259. package/build-module/duotone-picker/utils.js.map +1 -1
  260. package/build-module/flex/flex/hook.js +3 -3
  261. package/build-module/flex/flex/hook.js.map +1 -1
  262. package/build-module/font-size-picker/index.js +2 -1
  263. package/build-module/font-size-picker/index.js.map +1 -1
  264. package/build-module/form-token-field/index.js +10 -5
  265. package/build-module/form-token-field/index.js.map +1 -1
  266. package/build-module/gradient-picker/index.js +61 -9
  267. package/build-module/gradient-picker/index.js.map +1 -1
  268. package/build-module/gradient-picker/types.js +2 -0
  269. package/build-module/gradient-picker/types.js.map +1 -0
  270. package/build-module/guide/icons.js.map +1 -1
  271. package/build-module/guide/index.js +45 -8
  272. package/build-module/guide/index.js.map +1 -1
  273. package/build-module/guide/page-control.js.map +1 -1
  274. package/build-module/guide/page.js +4 -0
  275. package/build-module/guide/page.js.map +1 -1
  276. package/build-module/guide/types.js +2 -0
  277. package/build-module/guide/types.js.map +1 -0
  278. package/build-module/h-stack/utils.js +5 -5
  279. package/build-module/h-stack/utils.js.map +1 -1
  280. package/build-module/higher-order/navigate-regions/index.js +33 -3
  281. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  282. package/build-module/higher-order/with-fallback-styles/index.js +2 -2
  283. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  284. package/build-module/higher-order/with-filters/index.js +31 -7
  285. package/build-module/higher-order/with-filters/index.js.map +1 -1
  286. package/build-module/higher-order/with-focus-return/index.js +10 -10
  287. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  288. package/build-module/higher-order/with-notices/index.js +29 -26
  289. package/build-module/higher-order/with-notices/index.js.map +1 -1
  290. package/build-module/higher-order/with-notices/types.js +2 -0
  291. package/build-module/higher-order/with-notices/types.js.map +1 -0
  292. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  293. package/build-module/icon/index.js +2 -9
  294. package/build-module/icon/index.js.map +1 -1
  295. package/build-module/index.native.js +1 -0
  296. package/build-module/index.native.js.map +1 -1
  297. package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
  298. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  299. package/build-module/mobile/bottom-sheet-text-control/index.native.js +4 -3
  300. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  301. package/build-module/navigation/back-button/index.js +4 -3
  302. package/build-module/navigation/back-button/index.js.map +1 -1
  303. package/build-module/navigation/constants.js.map +1 -1
  304. package/build-module/navigation/context.js +7 -4
  305. package/build-module/navigation/context.js.map +1 -1
  306. package/build-module/navigation/group/context.js +4 -0
  307. package/build-module/navigation/group/context.js.map +1 -1
  308. package/build-module/navigation/group/index.js +2 -1
  309. package/build-module/navigation/group/index.js.map +1 -1
  310. package/build-module/navigation/index.js +46 -3
  311. package/build-module/navigation/index.js.map +1 -1
  312. package/build-module/navigation/item/base-content.js +0 -1
  313. package/build-module/navigation/item/base-content.js.map +1 -1
  314. package/build-module/navigation/item/base.js.map +1 -1
  315. package/build-module/navigation/item/index.js +2 -1
  316. package/build-module/navigation/item/index.js.map +1 -1
  317. package/build-module/navigation/item/use-navigation-tree-item.js +1 -1
  318. package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
  319. package/build-module/navigation/menu/context.js +4 -0
  320. package/build-module/navigation/menu/context.js.map +1 -1
  321. package/build-module/navigation/menu/index.js +2 -1
  322. package/build-module/navigation/menu/index.js.map +1 -1
  323. package/build-module/navigation/menu/menu-title-search.js +8 -6
  324. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  325. package/build-module/navigation/menu/menu-title.js +4 -2
  326. package/build-module/navigation/menu/menu-title.js.map +1 -1
  327. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  328. package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
  329. package/build-module/navigation/styles/navigation-styles.js +36 -36
  330. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  331. package/build-module/navigation/types.js +2 -0
  332. package/build-module/navigation/types.js.map +1 -0
  333. package/build-module/navigation/use-create-navigation-tree.js +7 -0
  334. package/build-module/navigation/use-create-navigation-tree.js.map +1 -1
  335. package/build-module/navigation/use-navigation-tree-nodes.js +2 -2
  336. package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
  337. package/build-module/navigation/utils.js.map +1 -1
  338. package/build-module/navigator/navigator-screen/component.js +5 -3
  339. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  340. package/build-module/number-control/index.js +1 -3
  341. package/build-module/number-control/index.js.map +1 -1
  342. package/build-module/palette-edit/index.js +63 -26
  343. package/build-module/palette-edit/index.js.map +1 -1
  344. package/build-module/palette-edit/types.js +2 -0
  345. package/build-module/palette-edit/types.js.map +1 -0
  346. package/build-module/panel/body.js +12 -12
  347. package/build-module/panel/body.js.map +1 -1
  348. package/build-module/placeholder/index.js.map +1 -1
  349. package/build-module/query-controls/author-select.js +0 -4
  350. package/build-module/query-controls/author-select.js.map +1 -1
  351. package/build-module/query-controls/category-select.js +1 -5
  352. package/build-module/query-controls/category-select.js.map +1 -1
  353. package/build-module/query-controls/terms.js +29 -16
  354. package/build-module/query-controls/terms.js.map +1 -1
  355. package/build-module/range-control/index.js.map +1 -1
  356. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
  357. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  358. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  359. package/build-module/responsive-wrapper/index.js +12 -12
  360. package/build-module/responsive-wrapper/index.js.map +1 -1
  361. package/build-module/sandbox/index.native.js +70 -58
  362. package/build-module/sandbox/index.native.js.map +1 -1
  363. package/build-module/select-control/index.js +20 -17
  364. package/build-module/select-control/index.js.map +1 -1
  365. package/build-module/tab-panel/index.js +2 -2
  366. package/build-module/tab-panel/index.js.map +1 -1
  367. package/build-module/toolbar/toolbar-button/index.js +32 -9
  368. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  369. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +12 -4
  370. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  371. package/build-module/toolbar/toolbar-button/types.js +2 -0
  372. package/build-module/toolbar/toolbar-button/types.js.map +1 -0
  373. package/build-module/toolbar/toolbar-context/index.js +4 -2
  374. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  375. package/build-module/tools-panel/tools-panel/hook.js +45 -6
  376. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  377. package/build-module/tooltip/index.js +16 -6
  378. package/build-module/tooltip/index.js.map +1 -1
  379. package/build-module/tree-select/index.js.map +1 -1
  380. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  381. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  382. package/build-module/utils/font.js +3 -6
  383. package/build-module/utils/font.js.map +1 -1
  384. package/build-module/utils/input/input-control.js +1 -1
  385. package/build-module/utils/input/input-control.js.map +1 -1
  386. package/build-module/v-stack/hook.js +2 -0
  387. package/build-module/v-stack/hook.js.map +1 -1
  388. package/build-style/style-rtl.css +54 -39
  389. package/build-style/style.css +56 -39
  390. package/build-types/alignment-matrix-control/types.d.ts +4 -4
  391. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  392. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  393. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  394. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +5 -0
  395. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  396. package/build-types/angle-picker-control/types.d.ts +2 -2
  397. package/build-types/angle-picker-control/types.d.ts.map +1 -1
  398. package/build-types/animate/index.d.ts +27 -22
  399. package/build-types/animate/index.d.ts.map +1 -1
  400. package/build-types/animate/stories/index.d.ts +18 -0
  401. package/build-types/animate/stories/index.d.ts.map +1 -0
  402. package/build-types/animate/types.d.ts +30 -0
  403. package/build-types/animate/types.d.ts.map +1 -0
  404. package/build-types/animation/index.d.ts +8 -1
  405. package/build-types/animation/index.d.ts.map +1 -1
  406. package/build-types/autocomplete/autocompleter-ui.d.ts +4 -0
  407. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -0
  408. package/build-types/autocomplete/get-default-use-items.d.ts +3 -0
  409. package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -0
  410. package/build-types/autocomplete/index.d.ts +23 -0
  411. package/build-types/autocomplete/index.d.ts.map +1 -0
  412. package/build-types/autocomplete/test/index.d.ts +2 -0
  413. package/build-types/autocomplete/test/index.d.ts.map +1 -0
  414. package/build-types/autocomplete/types.d.ts +201 -0
  415. package/build-types/autocomplete/types.d.ts.map +1 -0
  416. package/build-types/base-control/types.d.ts +2 -2
  417. package/build-types/base-control/types.d.ts.map +1 -1
  418. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  419. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  420. package/build-types/border-box-control/styles.d.ts +3 -3
  421. package/build-types/border-box-control/styles.d.ts.map +1 -1
  422. package/build-types/border-box-control/types.d.ts +8 -8
  423. package/build-types/border-box-control/types.d.ts.map +1 -1
  424. package/build-types/border-box-control/utils.d.ts +5 -5
  425. package/build-types/border-box-control/utils.d.ts.map +1 -1
  426. package/build-types/border-control/border-control/hook.d.ts +3 -3
  427. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  428. package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
  429. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  430. package/build-types/border-control/styles.d.ts +4 -4
  431. package/build-types/border-control/styles.d.ts.map +1 -1
  432. package/build-types/border-control/types.d.ts +6 -6
  433. package/build-types/border-control/types.d.ts.map +1 -1
  434. package/build-types/box-control/types.d.ts +6 -6
  435. package/build-types/box-control/types.d.ts.map +1 -1
  436. package/build-types/button/deprecated.d.ts +6 -6
  437. package/build-types/button/types.d.ts +10 -10
  438. package/build-types/button/types.d.ts.map +1 -1
  439. package/build-types/button-group/types.d.ts +1 -1
  440. package/build-types/button-group/types.d.ts.map +1 -1
  441. package/build-types/card/card/hook.d.ts +1 -1
  442. package/build-types/card/card/hook.d.ts.map +1 -1
  443. package/build-types/card/types.d.ts +10 -10
  444. package/build-types/card/types.d.ts.map +1 -1
  445. package/build-types/checkbox-control/types.d.ts +1 -1
  446. package/build-types/checkbox-control/types.d.ts.map +1 -1
  447. package/build-types/circular-option-picker/types.d.ts +4 -4
  448. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  449. package/build-types/color-indicator/types.d.ts +1 -1
  450. package/build-types/color-indicator/types.d.ts.map +1 -1
  451. package/build-types/color-palette/types.d.ts +7 -7
  452. package/build-types/color-palette/types.d.ts.map +1 -1
  453. package/build-types/color-palette/utils.d.ts +1 -1
  454. package/build-types/color-palette/utils.d.ts.map +1 -1
  455. package/build-types/color-picker/color-input.d.ts +1 -11
  456. package/build-types/color-picker/color-input.d.ts.map +1 -1
  457. package/build-types/color-picker/component.d.ts +8 -9
  458. package/build-types/color-picker/component.d.ts.map +1 -1
  459. package/build-types/color-picker/hex-input.d.ts +1 -10
  460. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  461. package/build-types/color-picker/hsl-input.d.ts +1 -10
  462. package/build-types/color-picker/hsl-input.d.ts.map +1 -1
  463. package/build-types/color-picker/input-with-slider.d.ts +1 -9
  464. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  465. package/build-types/color-picker/legacy-adapter.d.ts +1 -3
  466. package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
  467. package/build-types/color-picker/picker.d.ts +4 -7
  468. package/build-types/color-picker/picker.d.ts.map +1 -1
  469. package/build-types/color-picker/rgb-input.d.ts +1 -10
  470. package/build-types/color-picker/rgb-input.d.ts.map +1 -1
  471. package/build-types/color-picker/stories/index.d.ts +19 -0
  472. package/build-types/color-picker/stories/index.d.ts.map +1 -0
  473. package/build-types/color-picker/styles.d.ts +3 -3
  474. package/build-types/color-picker/test/index.d.ts +2 -0
  475. package/build-types/color-picker/test/index.d.ts.map +1 -0
  476. package/build-types/color-picker/types.d.ts +107 -3
  477. package/build-types/color-picker/types.d.ts.map +1 -1
  478. package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
  479. package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
  480. package/build-types/combobox-control/types.d.ts +2 -2
  481. package/build-types/combobox-control/types.d.ts.map +1 -1
  482. package/build-types/confirm-dialog/component.d.ts +4 -4
  483. package/build-types/confirm-dialog/types.d.ts +5 -5
  484. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  485. package/build-types/custom-gradient-picker/constants.d.ts +25 -0
  486. package/build-types/custom-gradient-picker/constants.d.ts.map +1 -0
  487. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +8 -0
  488. package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -0
  489. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +8 -0
  490. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -0
  491. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +4 -0
  492. package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -0
  493. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
  494. package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
  495. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +90 -0
  496. package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -0
  497. package/build-types/custom-gradient-picker/index.d.ts +28 -0
  498. package/build-types/custom-gradient-picker/index.d.ts.map +1 -0
  499. package/build-types/custom-gradient-picker/serializer.d.ts +14 -0
  500. package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -0
  501. package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
  502. package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
  503. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +12 -0
  504. package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -0
  505. package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
  506. package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
  507. package/build-types/custom-gradient-picker/types.d.ts +120 -0
  508. package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
  509. package/build-types/custom-gradient-picker/utils.d.ts +13 -0
  510. package/build-types/custom-gradient-picker/utils.d.ts.map +1 -0
  511. package/build-types/custom-select-control/styles.d.ts +1 -1
  512. package/build-types/custom-select-control/styles.d.ts.map +1 -1
  513. package/build-types/dashicon/types.d.ts +2 -2
  514. package/build-types/dashicon/types.d.ts.map +1 -1
  515. package/build-types/date-time/date-time/styles.d.ts +1 -4
  516. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  517. package/build-types/date-time/time/styles.d.ts +1 -1
  518. package/build-types/date-time/types.d.ts +4 -4
  519. package/build-types/date-time/types.d.ts.map +1 -1
  520. package/build-types/dimension-control/index.d.ts +28 -0
  521. package/build-types/dimension-control/index.d.ts.map +1 -0
  522. package/build-types/dimension-control/sizes.d.ts +26 -0
  523. package/build-types/dimension-control/sizes.d.ts.map +1 -0
  524. package/build-types/dimension-control/stories/index.d.ts +12 -0
  525. package/build-types/dimension-control/stories/index.d.ts.map +1 -0
  526. package/build-types/dimension-control/types.d.ts +47 -0
  527. package/build-types/dimension-control/types.d.ts.map +1 -0
  528. package/build-types/divider/types.d.ts +1 -1
  529. package/build-types/divider/types.d.ts.map +1 -1
  530. package/build-types/draggable/types.d.ts +1 -1
  531. package/build-types/draggable/types.d.ts.map +1 -1
  532. package/build-types/drop-zone/types.d.ts +2 -2
  533. package/build-types/drop-zone/types.d.ts.map +1 -1
  534. package/build-types/dropdown/types.d.ts +3 -3
  535. package/build-types/dropdown/types.d.ts.map +1 -1
  536. package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
  537. package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +4 -4
  538. package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
  539. package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
  540. package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
  541. package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
  542. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
  543. package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
  544. package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
  545. package/build-types/duotone-picker/index.d.ts +3 -0
  546. package/build-types/duotone-picker/index.d.ts.map +1 -0
  547. package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
  548. package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
  549. package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
  550. package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
  551. package/build-types/duotone-picker/types.d.ts +60 -0
  552. package/build-types/duotone-picker/types.d.ts.map +1 -0
  553. package/build-types/duotone-picker/utils.d.ts +52 -0
  554. package/build-types/duotone-picker/utils.d.ts.map +1 -0
  555. package/build-types/elevation/types.d.ts +1 -1
  556. package/build-types/elevation/types.d.ts.map +1 -1
  557. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  558. package/build-types/external-link/types.d.ts +1 -1
  559. package/build-types/external-link/types.d.ts.map +1 -1
  560. package/build-types/flex/types.d.ts +4 -4
  561. package/build-types/flex/types.d.ts.map +1 -1
  562. package/build-types/focal-point-picker/types.d.ts +7 -7
  563. package/build-types/focal-point-picker/types.d.ts.map +1 -1
  564. package/build-types/font-size-picker/index.d.ts.map +1 -1
  565. package/build-types/font-size-picker/stories/index.d.ts.map +1 -1
  566. package/build-types/font-size-picker/types.d.ts +9 -5
  567. package/build-types/font-size-picker/types.d.ts.map +1 -1
  568. package/build-types/form-file-upload/types.d.ts +1 -1
  569. package/build-types/form-file-upload/types.d.ts.map +1 -1
  570. package/build-types/form-toggle/types.d.ts +1 -1
  571. package/build-types/form-toggle/types.d.ts.map +1 -1
  572. package/build-types/form-token-field/index.d.ts.map +1 -1
  573. package/build-types/form-token-field/stories/index.d.ts +6 -0
  574. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  575. package/build-types/form-token-field/styles.d.ts +1 -1
  576. package/build-types/form-token-field/styles.d.ts.map +1 -1
  577. package/build-types/form-token-field/types.d.ts +7 -1
  578. package/build-types/form-token-field/types.d.ts.map +1 -1
  579. package/build-types/gradient-picker/index.d.ts +50 -0
  580. package/build-types/gradient-picker/index.d.ts.map +1 -0
  581. package/build-types/gradient-picker/stories/index.d.ts +14 -0
  582. package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
  583. package/build-types/gradient-picker/types.d.ts +87 -0
  584. package/build-types/gradient-picker/types.d.ts.map +1 -0
  585. package/build-types/grid/types.d.ts +2 -2
  586. package/build-types/grid/types.d.ts.map +1 -1
  587. package/build-types/guide/icons.d.ts +5 -0
  588. package/build-types/guide/icons.d.ts.map +1 -0
  589. package/build-types/guide/index.d.ts +37 -0
  590. package/build-types/guide/index.d.ts.map +1 -0
  591. package/build-types/guide/page-control.d.ts +4 -0
  592. package/build-types/guide/page-control.d.ts.map +1 -0
  593. package/build-types/guide/page.d.ts +7 -0
  594. package/build-types/guide/page.d.ts.map +1 -0
  595. package/build-types/guide/stories/index.d.ts +9 -0
  596. package/build-types/guide/stories/index.d.ts.map +1 -0
  597. package/build-types/guide/test/index.d.ts +2 -0
  598. package/build-types/guide/test/index.d.ts.map +1 -0
  599. package/build-types/guide/types.d.ts +65 -0
  600. package/build-types/guide/types.d.ts.map +1 -0
  601. package/build-types/h-stack/types.d.ts +6 -6
  602. package/build-types/h-stack/types.d.ts.map +1 -1
  603. package/build-types/heading/hook.d.ts +1 -1
  604. package/build-types/heading/types.d.ts +2 -2
  605. package/build-types/heading/types.d.ts.map +1 -1
  606. package/build-types/higher-order/navigate-regions/index.d.ts +46 -0
  607. package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -0
  608. package/build-types/higher-order/with-fallback-styles/index.d.ts +44 -0
  609. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -0
  610. package/build-types/higher-order/with-filters/index.d.ts +89 -0
  611. package/build-types/higher-order/with-filters/index.d.ts.map +1 -0
  612. package/build-types/higher-order/with-filters/test/index.d.ts +2 -0
  613. package/build-types/higher-order/with-filters/test/index.d.ts.map +1 -0
  614. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  615. package/build-types/higher-order/with-focus-return/index.d.ts +20 -0
  616. package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -0
  617. package/build-types/higher-order/with-focus-return/test/index.d.ts +2 -0
  618. package/build-types/higher-order/with-focus-return/test/index.d.ts.map +1 -0
  619. package/build-types/higher-order/with-notices/index.d.ts +37 -0
  620. package/build-types/higher-order/with-notices/index.d.ts.map +1 -0
  621. package/build-types/higher-order/with-notices/test/index.d.ts +2 -0
  622. package/build-types/higher-order/with-notices/test/index.d.ts.map +1 -0
  623. package/build-types/higher-order/with-notices/types.d.ts +34 -0
  624. package/build-types/higher-order/with-notices/types.d.ts.map +1 -0
  625. package/build-types/higher-order/with-spoken-messages/index.d.ts +13 -2
  626. package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
  627. package/build-types/higher-order/with-spoken-messages/test/index.d.ts +2 -0
  628. package/build-types/higher-order/with-spoken-messages/test/index.d.ts.map +1 -0
  629. package/build-types/icon/index.d.ts +10 -6
  630. package/build-types/icon/index.d.ts.map +1 -1
  631. package/build-types/icon/test/index.d.ts +2 -0
  632. package/build-types/icon/test/index.d.ts.map +1 -0
  633. package/build-types/input-control/reducer/actions.d.ts +15 -15
  634. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  635. package/build-types/input-control/reducer/state.d.ts +1 -1
  636. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  637. package/build-types/input-control/styles/input-control-styles.d.ts +4 -4
  638. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  639. package/build-types/input-control/types.d.ts +7 -7
  640. package/build-types/input-control/types.d.ts.map +1 -1
  641. package/build-types/item-group/item/hook.d.ts +1 -1
  642. package/build-types/item-group/types.d.ts +2 -2
  643. package/build-types/item-group/types.d.ts.map +1 -1
  644. package/build-types/keyboard-shortcuts/types.d.ts +3 -3
  645. package/build-types/keyboard-shortcuts/types.d.ts.map +1 -1
  646. package/build-types/menu-group/types.d.ts +1 -1
  647. package/build-types/menu-group/types.d.ts.map +1 -1
  648. package/build-types/menu-item/index.d.ts +1 -1
  649. package/build-types/menu-items-choice/types.d.ts +2 -2
  650. package/build-types/menu-items-choice/types.d.ts.map +1 -1
  651. package/build-types/modal/types.d.ts +1 -1
  652. package/build-types/modal/types.d.ts.map +1 -1
  653. package/build-types/navigable-container/container.d.ts +1 -1
  654. package/build-types/navigable-container/menu.d.ts +1 -1
  655. package/build-types/navigable-container/tabbable.d.ts +1 -1
  656. package/build-types/navigation/back-button/index.d.ts +5 -0
  657. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  658. package/build-types/navigation/constants.d.ts +3 -0
  659. package/build-types/navigation/constants.d.ts.map +1 -0
  660. package/build-types/navigation/context.d.ts +5 -0
  661. package/build-types/navigation/context.d.ts.map +1 -0
  662. package/build-types/navigation/group/context.d.ts +8 -0
  663. package/build-types/navigation/group/context.d.ts.map +1 -0
  664. package/build-types/navigation/group/index.d.ts +5 -0
  665. package/build-types/navigation/group/index.d.ts.map +1 -0
  666. package/build-types/navigation/index.d.ts +46 -0
  667. package/build-types/navigation/index.d.ts.map +1 -0
  668. package/build-types/navigation/item/base-content.d.ts +4 -0
  669. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  670. package/build-types/navigation/item/base.d.ts +4 -0
  671. package/build-types/navigation/item/base.d.ts.map +1 -0
  672. package/build-types/navigation/item/index.d.ts +5 -0
  673. package/build-types/navigation/item/index.d.ts.map +1 -0
  674. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  675. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  676. package/build-types/navigation/menu/context.d.ts +8 -0
  677. package/build-types/navigation/menu/context.d.ts.map +1 -0
  678. package/build-types/navigation/menu/index.d.ts +5 -0
  679. package/build-types/navigation/menu/index.d.ts.map +1 -0
  680. package/build-types/navigation/menu/menu-title-search.d.ts +4 -0
  681. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  682. package/build-types/navigation/menu/menu-title.d.ts +4 -0
  683. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  684. package/build-types/navigation/menu/search-no-results-found.d.ts +4 -0
  685. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  686. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  687. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  688. package/build-types/navigation/stories/index.d.ts +18 -0
  689. package/build-types/navigation/stories/index.d.ts.map +1 -0
  690. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  691. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  692. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  693. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  694. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  695. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  696. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  697. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  698. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  699. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  700. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  701. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  702. package/build-types/navigation/styles/navigation-styles.d.ts +58 -0
  703. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  704. package/build-types/navigation/test/index.d.ts +2 -0
  705. package/build-types/navigation/test/index.d.ts.map +1 -0
  706. package/build-types/navigation/types.d.ts +267 -0
  707. package/build-types/navigation/types.d.ts.map +1 -0
  708. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  709. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  710. package/build-types/navigation/use-navigation-tree-nodes.d.ts +11 -0
  711. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  712. package/build-types/navigation/utils.d.ts +3 -0
  713. package/build-types/navigation/utils.d.ts.map +1 -0
  714. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  715. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
  716. package/build-types/navigator/navigator-button/component.d.ts +1 -1
  717. package/build-types/navigator/navigator-button/hook.d.ts +1 -1
  718. package/build-types/navigator/navigator-screen/component.d.ts +1 -1
  719. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  720. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
  721. package/build-types/navigator/types.d.ts +12 -12
  722. package/build-types/navigator/types.d.ts.map +1 -1
  723. package/build-types/notice/types.d.ts +7 -7
  724. package/build-types/notice/types.d.ts.map +1 -1
  725. package/build-types/number-control/index.d.ts.map +1 -1
  726. package/build-types/number-control/types.d.ts +1 -1
  727. package/build-types/number-control/types.d.ts.map +1 -1
  728. package/build-types/palette-edit/index.d.ts +37 -0
  729. package/build-types/palette-edit/index.d.ts.map +1 -0
  730. package/build-types/palette-edit/stories/index.d.ts +13 -0
  731. package/build-types/palette-edit/stories/index.d.ts.map +1 -0
  732. package/build-types/palette-edit/styles.d.ts +51 -0
  733. package/build-types/palette-edit/styles.d.ts.map +1 -0
  734. package/build-types/palette-edit/test/index.d.ts +2 -0
  735. package/build-types/palette-edit/test/index.d.ts.map +1 -0
  736. package/build-types/palette-edit/types.d.ts +114 -0
  737. package/build-types/palette-edit/types.d.ts.map +1 -0
  738. package/build-types/panel/body.d.ts +9 -0
  739. package/build-types/panel/body.d.ts.map +1 -0
  740. package/build-types/panel/stories/index.d.ts +19 -0
  741. package/build-types/panel/stories/index.d.ts.map +1 -0
  742. package/build-types/panel/test/body.d.ts +2 -0
  743. package/build-types/panel/test/body.d.ts.map +1 -0
  744. package/build-types/panel/types.d.ts +73 -3
  745. package/build-types/panel/types.d.ts.map +1 -1
  746. package/build-types/placeholder/index.d.ts +1 -1
  747. package/build-types/placeholder/index.d.ts.map +1 -1
  748. package/build-types/placeholder/types.d.ts +2 -2
  749. package/build-types/placeholder/types.d.ts.map +1 -1
  750. package/build-types/popover/limit-shift.d.ts +2 -2
  751. package/build-types/popover/limit-shift.d.ts.map +1 -1
  752. package/build-types/popover/types.d.ts +10 -10
  753. package/build-types/popover/types.d.ts.map +1 -1
  754. package/build-types/popover/utils.d.ts +2 -2
  755. package/build-types/popover/utils.d.ts.map +1 -1
  756. package/build-types/query-controls/author-select.d.ts.map +1 -1
  757. package/build-types/query-controls/category-select.d.ts.map +1 -1
  758. package/build-types/query-controls/terms.d.ts.map +1 -1
  759. package/build-types/query-controls/types.d.ts +12 -12
  760. package/build-types/query-controls/types.d.ts.map +1 -1
  761. package/build-types/radio-control/types.d.ts +1 -1
  762. package/build-types/radio-control/types.d.ts.map +1 -1
  763. package/build-types/radio-group/index.d.ts +1 -1
  764. package/build-types/radio-group/radio/index.d.ts +1 -1
  765. package/build-types/range-control/index.d.ts +2 -2
  766. package/build-types/range-control/index.d.ts.map +1 -1
  767. package/build-types/range-control/types.d.ts +17 -17
  768. package/build-types/range-control/types.d.ts.map +1 -1
  769. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  770. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  771. package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
  772. package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
  773. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  774. package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
  775. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  776. package/build-types/responsive-wrapper/index.d.ts.map +1 -1
  777. package/build-types/responsive-wrapper/stories/index.d.ts +10 -0
  778. package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -1
  779. package/build-types/responsive-wrapper/types.d.ts +3 -3
  780. package/build-types/responsive-wrapper/types.d.ts.map +1 -1
  781. package/build-types/sandbox/types.d.ts +1 -1
  782. package/build-types/sandbox/types.d.ts.map +1 -1
  783. package/build-types/scrollable/types.d.ts +2 -2
  784. package/build-types/scrollable/types.d.ts.map +1 -1
  785. package/build-types/search-control/types.d.ts +1 -1
  786. package/build-types/search-control/types.d.ts.map +1 -1
  787. package/build-types/select-control/index.d.ts +2 -1
  788. package/build-types/select-control/index.d.ts.map +1 -1
  789. package/build-types/select-control/stories/index.d.ts +3 -3
  790. package/build-types/select-control/stories/index.d.ts.map +1 -1
  791. package/build-types/select-control/types.d.ts +44 -20
  792. package/build-types/select-control/types.d.ts.map +1 -1
  793. package/build-types/shortcut/types.d.ts +1 -1
  794. package/build-types/shortcut/types.d.ts.map +1 -1
  795. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  796. package/build-types/slot-fill/provider.d.ts +1 -0
  797. package/build-types/slot-fill/provider.d.ts.map +1 -1
  798. package/build-types/snackbar/types.d.ts +3 -3
  799. package/build-types/snackbar/types.d.ts.map +1 -1
  800. package/build-types/spacer/types.d.ts +1 -1
  801. package/build-types/spacer/types.d.ts.map +1 -1
  802. package/build-types/spinner/index.d.ts +1 -1
  803. package/build-types/style-provider/types.d.ts +1 -1
  804. package/build-types/style-provider/types.d.ts.map +1 -1
  805. package/build-types/surface/types.d.ts +2 -2
  806. package/build-types/surface/types.d.ts.map +1 -1
  807. package/build-types/tab-panel/index.d.ts.map +1 -1
  808. package/build-types/tab-panel/types.d.ts +5 -5
  809. package/build-types/tab-panel/types.d.ts.map +1 -1
  810. package/build-types/text/types.d.ts +3 -3
  811. package/build-types/text/types.d.ts.map +1 -1
  812. package/build-types/text-control/types.d.ts +1 -1
  813. package/build-types/text-control/types.d.ts.map +1 -1
  814. package/build-types/text-highlight/types.d.ts +1 -1
  815. package/build-types/text-highlight/types.d.ts.map +1 -1
  816. package/build-types/textarea-control/types.d.ts +1 -1
  817. package/build-types/textarea-control/types.d.ts.map +1 -1
  818. package/build-types/theme/types.d.ts +3 -3
  819. package/build-types/theme/types.d.ts.map +1 -1
  820. package/build-types/tip/types.d.ts +1 -1
  821. package/build-types/tip/types.d.ts.map +1 -1
  822. package/build-types/toggle-control/types.d.ts +1 -1
  823. package/build-types/toggle-control/types.d.ts.map +1 -1
  824. package/build-types/toggle-group-control/types.d.ts +10 -10
  825. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  826. package/build-types/toolbar/toolbar/types.d.ts +1 -1
  827. package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
  828. package/build-types/toolbar/toolbar-button/index.d.ts +165 -11
  829. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  830. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +6 -1
  831. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
  832. package/build-types/toolbar/toolbar-button/types.d.ts +45 -0
  833. package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -0
  834. package/build-types/toolbar/toolbar-context/index.d.ts +6 -1
  835. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
  836. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +1 -1
  837. package/build-types/toolbar/toolbar-item/index.d.ts +1 -1
  838. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  839. package/build-types/tools-panel/types.d.ts +12 -11
  840. package/build-types/tools-panel/types.d.ts.map +1 -1
  841. package/build-types/tooltip/index.d.ts.map +1 -1
  842. package/build-types/tree-grid/types.d.ts +5 -5
  843. package/build-types/tree-grid/types.d.ts.map +1 -1
  844. package/build-types/tree-select/index.d.ts.map +1 -1
  845. package/build-types/tree-select/types.d.ts +4 -10
  846. package/build-types/tree-select/types.d.ts.map +1 -1
  847. package/build-types/truncate/types.d.ts +2 -2
  848. package/build-types/truncate/types.d.ts.map +1 -1
  849. package/build-types/ui/context/context-connect.d.ts +1 -1
  850. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  851. package/build-types/ui/context/wordpress-component.d.ts +3 -3
  852. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  853. package/build-types/ui/control-group/types.d.ts +2 -2
  854. package/build-types/ui/control-group/types.d.ts.map +1 -1
  855. package/build-types/ui/control-label/types.d.ts +1 -1
  856. package/build-types/ui/control-label/types.d.ts.map +1 -1
  857. package/build-types/ui/form-group/form-group-content.d.ts +1 -1
  858. package/build-types/ui/form-group/form-group-help.d.ts +1 -1
  859. package/build-types/ui/form-group/form-group-label.d.ts +1 -1
  860. package/build-types/ui/form-group/types.d.ts +5 -5
  861. package/build-types/ui/form-group/types.d.ts.map +1 -1
  862. package/build-types/ui/form-group/use-form-group.d.ts +3 -3
  863. package/build-types/ui/spinner/component.d.ts +1 -1
  864. package/build-types/ui/tooltip/content.d.ts +1 -1
  865. package/build-types/ui/tooltip/types.d.ts +2 -2
  866. package/build-types/ui/tooltip/types.d.ts.map +1 -1
  867. package/build-types/ui/utils/font-size.d.ts +1 -1
  868. package/build-types/ui/utils/font-size.d.ts.map +1 -1
  869. package/build-types/ui/utils/space.d.ts +1 -1
  870. package/build-types/ui/utils/space.d.ts.map +1 -1
  871. package/build-types/ui/utils/types.d.ts +4 -4
  872. package/build-types/ui/utils/types.d.ts.map +1 -1
  873. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  874. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  875. package/build-types/unit-control/types.d.ts +5 -5
  876. package/build-types/unit-control/types.d.ts.map +1 -1
  877. package/build-types/utils/breakpoint-values.d.ts +1 -1
  878. package/build-types/utils/colors-values.d.ts +1 -1
  879. package/build-types/utils/config-values.d.ts +9 -9
  880. package/build-types/utils/events.d.ts +1 -1
  881. package/build-types/utils/events.d.ts.map +1 -1
  882. package/build-types/utils/font-values.d.ts +1 -1
  883. package/build-types/utils/font.d.ts.map +1 -1
  884. package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
  885. package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
  886. package/build-types/utils/input/input-control.d.ts.map +1 -1
  887. package/build-types/utils/types.d.ts +4 -4
  888. package/build-types/utils/types.d.ts.map +1 -1
  889. package/build-types/v-stack/component.d.ts +1 -4
  890. package/build-types/v-stack/component.d.ts.map +1 -1
  891. package/build-types/v-stack/hook.d.ts.map +1 -1
  892. package/build-types/v-stack/stories/index.d.ts +1 -4
  893. package/build-types/v-stack/stories/index.d.ts.map +1 -1
  894. package/build-types/v-stack/types.d.ts +5 -3
  895. package/build-types/v-stack/types.d.ts.map +1 -1
  896. package/build-types/view/types.d.ts +1 -1
  897. package/build-types/view/types.d.ts.map +1 -1
  898. package/build-types/visually-hidden/types.d.ts +1 -1
  899. package/build-types/visually-hidden/types.d.ts.map +1 -1
  900. package/build-types/z-stack/types.d.ts +1 -1
  901. package/build-types/z-stack/types.d.ts.map +1 -1
  902. package/package.json +20 -20
  903. package/src/angle-picker-control/angle-circle.tsx +0 -1
  904. package/src/angle-picker-control/index.tsx +14 -27
  905. package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
  906. package/src/animate/index.tsx +75 -0
  907. package/src/animate/stories/index.tsx +102 -0
  908. package/src/animate/types.ts +32 -0
  909. package/src/autocomplete/README.md +51 -0
  910. package/src/autocomplete/{autocompleter-ui.js → autocompleter-ui.tsx} +21 -10
  911. package/src/autocomplete/{get-default-use-items.js → get-default-use-items.tsx} +11 -6
  912. package/src/autocomplete/{index.js → index.tsx} +77 -111
  913. package/src/autocomplete/test/{index.js → index.tsx} +31 -20
  914. package/src/autocomplete/types.ts +220 -0
  915. package/src/border-box-control/stories/index.tsx +1 -1
  916. package/src/border-control/test/index.js +0 -2
  917. package/src/box-control/axial-input-controls.tsx +1 -1
  918. package/src/button/style.scss +12 -1
  919. package/src/button/types.ts +2 -2
  920. package/src/circular-option-picker/style.scss +10 -0
  921. package/src/circular-option-picker/types.ts +1 -1
  922. package/src/color-indicator/style.scss +1 -0
  923. package/src/color-palette/test/__snapshots__/index.tsx.snap +16 -14
  924. package/src/color-picker/README.md +2 -2
  925. package/src/color-picker/color-input.tsx +1 -12
  926. package/src/color-picker/component.tsx +9 -18
  927. package/src/color-picker/hex-input.tsx +2 -7
  928. package/src/color-picker/hsl-input.tsx +2 -7
  929. package/src/color-picker/input-with-slider.tsx +1 -9
  930. package/src/color-picker/legacy-adapter.tsx +1 -2
  931. package/src/color-picker/picker.tsx +5 -6
  932. package/src/color-picker/rgb-input.tsx +2 -7
  933. package/src/color-picker/stories/index.tsx +51 -0
  934. package/src/color-picker/test/{index.js → index.tsx} +36 -18
  935. package/src/color-picker/types.ts +128 -1
  936. package/src/color-picker/use-deprecated-props.ts +2 -53
  937. package/src/combobox-control/stories/index.tsx +1 -1
  938. package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
  939. package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -132
  940. package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -8
  941. package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
  942. package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
  943. package/src/custom-gradient-picker/{index.js → index.tsx} +63 -20
  944. package/src/custom-gradient-picker/serializer.ts +82 -0
  945. package/src/custom-gradient-picker/stories/index.tsx +45 -0
  946. package/src/custom-gradient-picker/style.scss +25 -4
  947. package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
  948. package/src/custom-gradient-picker/types.ts +137 -0
  949. package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -20
  950. package/src/custom-select-control/test/index.js +6 -4
  951. package/src/dimension-control/README.md +22 -55
  952. package/src/dimension-control/index.tsx +101 -0
  953. package/src/dimension-control/{sizes.js → sizes.ts} +8 -5
  954. package/src/dimension-control/stories/index.tsx +48 -0
  955. package/src/dimension-control/types.ts +48 -0
  956. package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
  957. package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
  958. package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
  959. package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
  960. package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
  961. package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
  962. package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
  963. package/src/duotone-picker/types.ts +61 -0
  964. package/src/duotone-picker/{utils.js → utils.ts} +29 -14
  965. package/src/flex/flex/hook.ts +2 -2
  966. package/src/flex/flex-item/README.md +1 -1
  967. package/src/font-size-picker/README.md +26 -20
  968. package/src/font-size-picker/index.tsx +2 -1
  969. package/src/font-size-picker/stories/index.tsx +1 -0
  970. package/src/font-size-picker/test/index.tsx +23 -0
  971. package/src/font-size-picker/types.ts +4 -0
  972. package/src/form-token-field/README.md +1 -0
  973. package/src/form-token-field/index.tsx +14 -4
  974. package/src/form-token-field/stories/index.tsx +13 -0
  975. package/src/form-token-field/style.scss +0 -7
  976. package/src/form-token-field/test/index.tsx +81 -0
  977. package/src/form-token-field/types.ts +6 -0
  978. package/src/gradient-picker/README.md +16 -23
  979. package/src/gradient-picker/{index.js → index.tsx} +70 -14
  980. package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
  981. package/src/gradient-picker/types.ts +89 -0
  982. package/src/guide/README.md +17 -15
  983. package/src/guide/{icons.js → icons.tsx} +1 -1
  984. package/src/guide/{index.js → index.tsx} +47 -7
  985. package/src/guide/{page-control.js → page-control.tsx} +2 -1
  986. package/src/guide/{page.js → page.tsx} +8 -1
  987. package/src/guide/stories/{index.js → index.tsx} +11 -5
  988. package/src/guide/test/{index.js → index.tsx} +22 -4
  989. package/src/guide/types.ts +68 -0
  990. package/src/h-stack/README.md +2 -2
  991. package/src/h-stack/types.ts +2 -2
  992. package/src/h-stack/utils.ts +3 -3
  993. package/src/higher-order/navigate-regions/{index.js → index.tsx} +47 -11
  994. package/src/higher-order/with-fallback-styles/{index.js → index.tsx} +22 -5
  995. package/src/higher-order/with-filters/{index.js → index.tsx} +44 -12
  996. package/src/higher-order/with-filters/test/{index.js → index.tsx} +5 -1
  997. package/src/higher-order/with-focus-return/index.tsx +74 -0
  998. package/src/higher-order/with-focus-return/test/{index.js → index.tsx} +2 -2
  999. package/src/higher-order/with-notices/README.md +4 -1
  1000. package/src/higher-order/with-notices/index.tsx +116 -0
  1001. package/src/higher-order/with-notices/test/{index.js → index.tsx} +11 -6
  1002. package/src/higher-order/with-notices/types.ts +35 -0
  1003. package/src/higher-order/with-spoken-messages/test/{index.js → index.tsx} +2 -1
  1004. package/src/icon/index.tsx +11 -15
  1005. package/src/icon/test/{index.js → index.tsx} +6 -2
  1006. package/src/index.native.js +1 -0
  1007. package/src/item-group/test/index.js +5 -3
  1008. package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
  1009. package/src/mobile/bottom-sheet/cell.native.js +1 -1
  1010. package/src/mobile/bottom-sheet-text-control/README.md +8 -1
  1011. package/src/mobile/bottom-sheet-text-control/index.native.js +2 -1
  1012. package/src/mobile/link-settings/test/link-settings-navigation.native.js +1 -1
  1013. package/src/navigation/README.md +16 -2
  1014. package/src/navigation/back-button/{index.js → index.tsx} +22 -6
  1015. package/src/navigation/{context.js → context.tsx} +8 -5
  1016. package/src/navigation/group/context.tsx +15 -0
  1017. package/src/navigation/group/{index.js → index.tsx} +9 -1
  1018. package/src/navigation/{index.js → index.tsx} +63 -7
  1019. package/src/navigation/item/{base-content.js → base-content.tsx} +5 -2
  1020. package/src/navigation/item/{base.js → base.tsx} +3 -1
  1021. package/src/navigation/item/{index.js → index.tsx} +8 -2
  1022. package/src/navigation/item/{use-navigation-tree-item.js → use-navigation-tree-item.tsx} +9 -2
  1023. package/src/navigation/menu/context.tsx +18 -0
  1024. package/src/navigation/menu/{index.js → index.tsx} +5 -1
  1025. package/src/navigation/menu/{menu-title-search.js → menu-title-search.tsx} +11 -7
  1026. package/src/navigation/menu/{menu-title.js → menu-title.tsx} +5 -3
  1027. package/src/navigation/menu/{search-no-results-found.js → search-no-results-found.tsx} +5 -1
  1028. package/src/navigation/menu/{use-navigation-tree-menu.js → use-navigation-tree-menu.tsx} +3 -1
  1029. package/src/navigation/stories/index.tsx +53 -0
  1030. package/src/navigation/stories/utils/{controlled-state.js → controlled-state.tsx} +32 -13
  1031. package/src/navigation/stories/utils/{default.js → default.tsx} +20 -6
  1032. package/src/navigation/stories/utils/{group.js → group.tsx} +21 -7
  1033. package/src/navigation/stories/utils/{hide-if-empty.js → hide-if-empty.tsx} +19 -6
  1034. package/src/navigation/stories/utils/{more-examples.js → more-examples.tsx} +30 -12
  1035. package/src/navigation/stories/utils/{search.js → search.tsx} +21 -7
  1036. package/src/navigation/test/{index.js → index.tsx} +17 -4
  1037. package/src/navigation/types.ts +325 -0
  1038. package/src/navigation/{use-create-navigation-tree.js → use-create-navigation-tree.tsx} +37 -25
  1039. package/src/navigation/{use-navigation-tree-nodes.js → use-navigation-tree-nodes.tsx} +10 -6
  1040. package/src/navigation/{utils.js → utils.tsx} +2 -2
  1041. package/src/navigator/navigator-screen/component.tsx +13 -7
  1042. package/src/navigator/test/index.tsx +65 -22
  1043. package/src/number-control/index.tsx +0 -2
  1044. package/src/palette-edit/{index.js → index.tsx} +114 -48
  1045. package/src/palette-edit/stories/index.tsx +82 -0
  1046. package/src/palette-edit/test/{index.js → index.tsx} +15 -3
  1047. package/src/palette-edit/types.ts +126 -0
  1048. package/src/panel/README.md +53 -35
  1049. package/src/panel/{body.js → body.tsx} +31 -17
  1050. package/src/panel/stories/{index.js → index.tsx} +16 -6
  1051. package/src/panel/test/{body.js → body.tsx} +12 -17
  1052. package/src/panel/types.ts +78 -0
  1053. package/src/placeholder/index.tsx +2 -6
  1054. package/src/placeholder/test/index.tsx +1 -1
  1055. package/src/placeholder/types.ts +2 -2
  1056. package/src/popover/test/index.tsx +5 -2
  1057. package/src/query-controls/author-select.tsx +1 -6
  1058. package/src/query-controls/category-select.tsx +1 -6
  1059. package/src/query-controls/terms.ts +29 -18
  1060. package/src/range-control/index.tsx +2 -6
  1061. package/src/range-control/types.ts +3 -3
  1062. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -1
  1063. package/src/resizable-box/resize-tooltip/utils.ts +1 -1
  1064. package/src/responsive-wrapper/README.md +8 -2
  1065. package/src/responsive-wrapper/index.tsx +18 -17
  1066. package/src/responsive-wrapper/stories/index.tsx +41 -0
  1067. package/src/responsive-wrapper/style.scss +5 -11
  1068. package/src/responsive-wrapper/types.ts +2 -2
  1069. package/src/sandbox/index.native.js +71 -78
  1070. package/src/select-control/index.tsx +16 -16
  1071. package/src/select-control/stories/index.tsx +24 -12
  1072. package/src/select-control/types.ts +68 -40
  1073. package/src/slot-fill/test/slot.js +8 -6
  1074. package/src/style.scss +1 -1
  1075. package/src/tab-panel/index.tsx +7 -2
  1076. package/src/tab-panel/types.ts +4 -4
  1077. package/src/toolbar/toolbar-button/README.md +13 -1
  1078. package/src/toolbar/toolbar-button/{index.js → index.tsx} +55 -20
  1079. package/src/toolbar/toolbar-button/toolbar-button-container.tsx +13 -0
  1080. package/src/toolbar/toolbar-button/types.ts +46 -0
  1081. package/src/toolbar/toolbar-context/index.ts +15 -0
  1082. package/src/tools-panel/test/index.tsx +86 -0
  1083. package/src/tools-panel/tools-panel/hook.ts +44 -4
  1084. package/src/tools-panel/types.ts +1 -0
  1085. package/src/tooltip/index.js +11 -1
  1086. package/src/tooltip/test/index.js +251 -301
  1087. package/src/tree-select/index.tsx +5 -2
  1088. package/src/tree-select/types.ts +6 -13
  1089. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  1090. package/src/utils/font.js +1 -6
  1091. package/src/utils/input/input-control.js +1 -0
  1092. package/src/v-stack/README.md +2 -2
  1093. package/src/v-stack/hook.ts +6 -4
  1094. package/src/v-stack/stories/index.tsx +28 -7
  1095. package/src/v-stack/test/__snapshots__/index.tsx.snap +20 -18
  1096. package/src/v-stack/types.ts +5 -3
  1097. package/tsconfig.json +1 -15
  1098. package/tsconfig.tsbuildinfo +1 -1
  1099. package/build/color-list-picker/index.js.map +0 -1
  1100. package/build-module/color-list-picker/index.js.map +0 -1
  1101. package/build-types/color-list-picker/index.d.ts.map +0 -1
  1102. package/build-types/color-list-picker/types.d.ts.map +0 -1
  1103. package/src/animate/index.js +0 -58
  1104. package/src/animate/stories/index.js +0 -53
  1105. package/src/color-picker/stories/index.js +0 -41
  1106. package/src/custom-gradient-picker/gradient-bar/utils.js +0 -187
  1107. package/src/custom-gradient-picker/serializer.js +0 -46
  1108. package/src/custom-gradient-picker/stories/index.js +0 -33
  1109. package/src/dimension-control/index.js +0 -73
  1110. package/src/higher-order/with-focus-return/index.js +0 -64
  1111. package/src/higher-order/with-notices/index.js +0 -104
  1112. package/src/navigation/group/context.js +0 -9
  1113. package/src/navigation/menu/context.js +0 -11
  1114. package/src/navigation/stories/index.js +0 -33
  1115. package/src/toolbar/toolbar-button/toolbar-button-container.js +0 -6
  1116. package/src/toolbar/toolbar-context/index.js +0 -10
  1117. /package/build/{color-list-picker → animate}/types.js +0 -0
  1118. /package/build-module/{color-list-picker → animate}/types.js +0 -0
  1119. /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
  1120. /package/{build/color-list-picker → build-module/autocomplete}/types.js.map +0 -0
  1121. /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
  1122. /package/src/animation/{index.js → index.tsx} +0 -0
  1123. /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
  1124. /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
  1125. /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
  1126. /package/src/duotone-picker/{index.js → index.ts} +0 -0
  1127. /package/src/higher-order/with-filters/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  1128. /package/src/higher-order/with-spoken-messages/{index.js → index.tsx} +0 -0
  1129. /package/src/navigation/{constants.js → constants.tsx} +0 -0
  1130. /package/src/navigation/styles/{navigation-styles.js → navigation-styles.tsx} +0 -0
  1131. /package/src/panel/test/__snapshots__/{body.js.snap → body.tsx.snap} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/palette-edit/index.js"],"names":["DEFAULT_COLOR","NameInput","value","onChange","label","getNameForPosition","elements","slugPrefix","temporaryNameRegex","RegExp","position","reduce","previousValue","currentValue","slug","matches","match","id","parseInt","ColorPickerPopover","isGradient","element","onClose","color","newColor","gradient","newGradient","Option","canOnlyChangeValues","isEditing","onStartEditing","onRemove","onStopEditing","focusOutsideProps","undefined","style","cursor","background","name","nextName","lineSolid","isTemporaryElement","regex","test","DEFAULT_GRADIENT","PaletteEditListView","editingElement","setEditingElement","elementsReference","current","some","index","newElements","filter","length","debounceOnChange","map","newElement","currentElement","currentIndex","_currentElement","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","setIsEditing","isAdding","elementsLength","hasElements","onSelectPaletteItem","newEditingElementIndex","selectedElement","key","plus","tempOptionName","moreVertical","isSmall"],"mappings":";;;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAYA;;AACA;;AACA;;AA3CA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AA2BA,MAAMA,aAAa,GAAG,MAAtB;;AAEA,SAASC,SAAT,OAAiD;AAAA,MAA7B;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAA6B;AAChD,SACC,4BAAC,wBAAD;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UANd;AAOC,IAAA,UAAU,EAAGa;AAPd,IAFF,EAYG,CAAES,SAAF,IAAeiB,cAAc,KAAK,IAAlC,IACD,4BAAC,kBAAD;AACC,IAAA,UAAU,EAAG1B,UADd;AAEC,IAAA,OAAO,EAAG,MAAM2B,iBAAiB,CAAE,IAAF,CAFlC;AAGC,IAAA,QAAQ,EAAKU,UAAF,IAAkB;AAC5BF,MAAAA,gBAAgB,CACfjD,QAAQ,CAACkD,GAAT,CACC,CAAEE,cAAF,EAAkBC,YAAlB,KAAoC;AACnC,YACCA,YAAY,KAAKb,cADlB,EAEE;AACD,iBAAOW,UAAP;AACA;;AACD,eAAOC,cAAP;AACA,OARF,CADe,CAAhB;AAYA,KAhBF;AAiBC,IAAA,OAAO,EAAGpD,QAAQ,CAAEwC,cAAF;AAjBnB,IAbF,EAiCG,CAAEjB,SAAF,KACCT,UAAU,GACX,4BAAC,uBAAD;AACC,IAAA,iBAAiB,MADlB;AAEC,IAAA,SAAS,EAAG2C,SAFb;AAGC,IAAA,QAAQ,EAAGU,mBAHZ;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,sBAAsB,EAAG;AAL1B,IADW,GASX,4BAAC,qBAAD;AACC,IAAA,MAAM,EAAGT,MADV;AAEC,IAAA,QAAQ,EAAGS,mBAFZ;AAGC,IAAA,SAAS,EAAG,KAHb;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAVA,CAjCH,CA/HF,EAmLG,CAAED,WAAF,IAAiBL,YAnLpB,CADD;AAuLA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport {\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseDebounce,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport {\n\tPaletteActionsContainer,\n\tPaletteEditStyles,\n\tPaletteHeading,\n\tPaletteHStackHeader,\n\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\n\nconst DEFAULT_COLOR = '#000';\n\nfunction NameInput( { value, onChange, label } ) {\n\treturn (\n\t\t<NameInputControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Returns a temporary name for a palette item in the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs for temporary names.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param {string} elements An array of color palette items.\n * @param {string} slugPrefix The slug prefix used to match the element slug.\n *\n * @return {string} A unique name for a palette item.\n */\nexport function getNameForPosition( elements, slugPrefix ) {\n\tconst temporaryNameRegex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\tconst position = elements.reduce( ( previousValue, currentValue ) => {\n\t\tif ( typeof currentValue?.slug === 'string' ) {\n\t\t\tconst matches = currentValue?.slug.match( temporaryNameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id >= previousValue ) {\n\t\t\t\t\treturn id + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn previousValue;\n\t}, 1 );\n\n\treturn sprintf(\n\t\t/* translators: %s: is a temporary id for a custom color */\n\t\t__( 'Color %s' ),\n\t\tposition\n\t);\n}\n\nfunction ColorPickerPopover( {\n\tisGradient,\n\telement,\n\tonChange,\n\tonClose = () => {},\n} ) {\n\treturn (\n\t\t<Popover\n\t\t\tplacement=\"left-start\"\n\t\t\toffset={ 20 }\n\t\t\tclassName=\"components-palette-edit__popover\"\n\t\t\tonClose={ onClose }\n\t\t>\n\t\t\t{ ! isGradient && (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tcolor={ element.color }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColor ) =>\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\tcolor: newColor,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isGradient && (\n\t\t\t\t<div className=\"components-palette-edit__popover-gradient-picker\">\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tvalue={ element.gradient }\n\t\t\t\t\t\tonChange={ ( newGradient ) =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\tgradient: newGradient,\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</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction Option( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tisEditing,\n\tonStartEditing,\n\tonRemove,\n\tonStopEditing,\n\tslugPrefix,\n\tisGradient,\n} ) {\n\tconst focusOutsideProps = useFocusOutside( onStopEditing );\n\tconst value = isGradient ? element.gradient : element.color;\n\n\treturn (\n\t\t<PaletteItem\n\t\t\tclassName={ isEditing ? 'is-selected' : undefined }\n\t\t\tas=\"div\"\n\t\t\tonClick={ onStartEditing }\n\t\t\t{ ...( isEditing\n\t\t\t\t? { ...focusOutsideProps }\n\t\t\t\t: {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t},\n\t\t\t\t } ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<IndicatorStyled\n\t\t\t\t\t\tstyle={ { background: value, color: 'transparent' } }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ isEditing && ! canOnlyChangeValues ? (\n\t\t\t\t\t\t<NameInput\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Gradient name' )\n\t\t\t\t\t\t\t\t\t: __( 'Color name' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ element.name }\n\t\t\t\t\t\t\tonChange={ ( nextName ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\t\tname: nextName,\n\t\t\t\t\t\t\t\t\tslug: slugPrefix + kebabCase( nextName ),\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\t\t<NameContainer>{ element.name }</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isEditing && ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ __( 'Remove color' ) }\n\t\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ isEditing && (\n\t\t\t\t<ColorPickerPopover\n\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\telement={ element }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\nfunction isTemporaryElement( slugPrefix, { slug, color, gradient } ) {\n\tconst regex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\treturn (\n\t\tregex.test( slug ) &&\n\t\t( ( !! color && color === DEFAULT_COLOR ) ||\n\t\t\t( !! gradient && gradient === DEFAULT_GRADIENT ) )\n\t);\n}\n\nfunction PaletteEditListView( {\n\telements,\n\tonChange,\n\teditingElement,\n\tsetEditingElement,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n} ) {\n\t// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n\tconst elementsReference = useRef();\n\tuseEffect( () => {\n\t\telementsReference.current = elements;\n\t}, [ elements ] );\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\telementsReference.current.some( ( element, index ) =>\n\t\t\t\t\tisTemporaryElement( slugPrefix, element, index )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst newElements = elementsReference.current.filter(\n\t\t\t\t\t( element ) => ! isTemporaryElement( slugPrefix, element )\n\t\t\t\t);\n\t\t\t\tonChange( newElements.length ? newElements : undefined );\n\t\t\t}\n\t\t};\n\t\t// Disable reason: adding the missing dependency here would cause breaking changes that will require\n\t\t// a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<ItemGroup isRounded>\n\t\t\t\t{ elements.map( ( element, index ) => (\n\t\t\t\t\t<Option\n\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\tonStartEditing={ () => {\n\t\t\t\t\t\t\tif ( editingElement !== index ) {\n\t\t\t\t\t\t\t\tsetEditingElement( index );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn currentElement;\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\tonRemove={ () => {\n\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\tconst newElements = elements.filter(\n\t\t\t\t\t\t\t\t( _currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tnewElements.length ? newElements : undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisEditing={ index === editingElement }\n\t\t\t\t\t\tonStopEditing={ () => {\n\t\t\t\t\t\t\tif ( index === editingElement ) {\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nconst EMPTY_ARRAY = [];\n\nexport default function PaletteEdit( {\n\tgradients,\n\tcolors = EMPTY_ARRAY,\n\tonChange,\n\tpaletteLabel,\n\tpaletteLabelHeadingLevel = 2,\n\temptyMessage,\n\tcanOnlyChangeValues,\n\tcanReset,\n\tslugPrefix = '',\n} ) {\n\tconst isGradient = !! gradients;\n\tconst elements = isGradient ? gradients : colors;\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ editingElement, setEditingElement ] = useState( null );\n\tconst isAdding =\n\t\tisEditing &&\n\t\teditingElement &&\n\t\telements[ editingElement ] &&\n\t\t! elements[ editingElement ].slug;\n\tconst elementsLength = elements.length;\n\tconst hasElements = elementsLength > 0;\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\tconst onSelectPaletteItem = useCallback(\n\t\t( value, newEditingElementIndex ) => {\n\t\t\tconst selectedElement = elements[ newEditingElementIndex ];\n\t\t\tconst key = isGradient ? 'gradient' : 'color';\n\t\t\t// Ensures that the index returned matches a known element value.\n\t\t\tif ( !! selectedElement && selectedElement[ key ] === value ) {\n\t\t\t\tsetEditingElement( newEditingElementIndex );\n\t\t\t} else {\n\t\t\t\tsetIsEditing( true );\n\t\t\t}\n\t\t},\n\t\t[ isGradient, elements ]\n\t);\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<PaletteHStackHeader>\n\t\t\t\t<PaletteHeading level={ paletteLabelHeadingLevel }>\n\t\t\t\t\t{ paletteLabel }\n\t\t\t\t</PaletteHeading>\n\t\t\t\t<PaletteActionsContainer>\n\t\t\t\t\t{ hasElements && isEditing && (\n\t\t\t\t\t\t<DoneButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</DoneButton>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tisPressed={ isAdding }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Add gradient' )\n\t\t\t\t\t\t\t\t\t: __( 'Add color' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst tempOptionName = getNameForPosition(\n\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\tslugPrefix\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t...elements,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t...( isGradient\n\t\t\t\t\t\t\t\t\t\t\t? { gradient: DEFAULT_GRADIENT }\n\t\t\t\t\t\t\t\t\t\t\t: { color: DEFAULT_COLOR } ),\n\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\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\tsetIsEditing( true );\n\t\t\t\t\t\t\t\tsetEditingElement( elements.length );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasElements &&\n\t\t\t\t\t\t( ! isEditing ||\n\t\t\t\t\t\t\t! canOnlyChangeValues ||\n\t\t\t\t\t\t\tcanReset ) && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t\t? __( 'Gradient options' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Color options' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavigableMenu role=\"menu\">\n\t\t\t\t\t\t\t\t\t\t\t{ ! isEditing && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\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\t\t{ __( 'Show details' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\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\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\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\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all gradients'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all colors'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ canReset && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\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\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\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\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Reset gradient' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Reset colors' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</NavigableMenu>\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</DropdownMenu>\n\t\t\t\t\t\t) }\n\t\t\t\t</PaletteActionsContainer>\n\t\t\t</PaletteHStackHeader>\n\t\t\t{ hasElements && (\n\t\t\t\t<>\n\t\t\t\t\t{ isEditing && (\n\t\t\t\t\t\t<PaletteEditListView\n\t\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\t\telements={ elements }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\teditingElement={ editingElement }\n\t\t\t\t\t\t\tsetEditingElement={ setEditingElement }\n\t\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing && editingElement !== null && (\n\t\t\t\t\t\t<ColorPickerPopover\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tonClose={ () => setEditingElement( null ) }\n\t\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentIndex === editingElement\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn currentElement;\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} }\n\t\t\t\t\t\t\telement={ elements[ editingElement ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing &&\n\t\t\t\t\t\t( isGradient ? (\n\t\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomGradients={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage }\n\t\t</PaletteEditStyles>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/palette-edit/index.tsx"],"names":["DEFAULT_COLOR","NameInput","value","onChange","label","getNameForPosition","elements","slugPrefix","temporaryNameRegex","RegExp","position","reduce","previousValue","currentValue","slug","matches","match","id","parseInt","ColorPickerPopover","isGradient","element","onClose","color","newColor","gradient","newGradient","Option","canOnlyChangeValues","isEditing","onStartEditing","onRemove","onStopEditing","focusOutsideProps","undefined","style","cursor","background","name","nextName","lineSolid","isTemporaryElement","regex","test","DEFAULT_GRADIENT","PaletteEditListView","editingElement","setEditingElement","elementsReference","current","some","newElements","filter","length","debounceOnChange","map","index","newElement","currentElement","currentIndex","_currentElement","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","setIsEditing","isAdding","elementsLength","hasElements","onSelectPaletteItem","newEditingElementIndex","selectedElement","key","plus","tempOptionName","moreVertical","isSmall"],"mappings":";;;;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAYA;;AACA;;AACA;;AA3CA;AACA;AACA;;AAGA;AACA;AACA;;AASA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EC,IAAA,SAAS,EAAG2C,SAFb;AAGC,IAAA,QAAQ,EAAGU,mBAHZ;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,sBAAsB,EAAG;AAL1B,IADW,GASX,4BAAC,qBAAD;AACC,IAAA,MAAM,EAAGT,MADV;AAEC,IAAA,QAAQ,EAAGS,mBAFZ;AAGC,IAAA,SAAS,EAAG,KAHb;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAVA,CAxCH,CA1IF,EAqMG,CAAED,WAAF,IAAiBL,YArMpB,CADD;AAyMA;;eAEcL,W","sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport {\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseDebounce,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { ColorPicker } from '../color-picker';\nimport { FlexItem } from '../flex';\nimport { HStack } from '../h-stack';\nimport { ItemGroup } from '../item-group';\nimport { VStack } from '../v-stack';\nimport GradientPicker from '../gradient-picker';\nimport ColorPalette from '../color-palette';\nimport DropdownMenu from '../dropdown-menu';\nimport Popover from '../popover';\nimport {\n\tPaletteActionsContainer,\n\tPaletteEditStyles,\n\tPaletteHeading,\n\tPaletteHStackHeader,\n\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\n\tGradient,\n\tNameInputProps,\n\tOptionProps,\n\tPaletteEditListViewProps,\n\tPaletteEditProps,\n\tPaletteElement,\n} from './types';\n\nconst DEFAULT_COLOR = '#000';\n\nfunction NameInput( { value, onChange, label }: NameInputProps ) {\n\treturn (\n\t\t<NameInputControl\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Returns a temporary name for a palette item in the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs for temporary names.\n * It expects slugs to be in the format: slugPrefix + color- + number.\n * It then sets the id component of the new name based on the incremented id of the highest existing slug id.\n *\n * @param elements An array of color palette items.\n * @param slugPrefix The slug prefix used to match the element slug.\n *\n * @return A unique name for a palette item.\n */\nexport function getNameForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst temporaryNameRegex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\tconst position = elements.reduce( ( previousValue, currentValue ) => {\n\t\tif ( typeof currentValue?.slug === 'string' ) {\n\t\t\tconst matches = currentValue?.slug.match( temporaryNameRegex );\n\t\t\tif ( matches ) {\n\t\t\t\tconst id = parseInt( matches[ 1 ], 10 );\n\t\t\t\tif ( id >= previousValue ) {\n\t\t\t\t\treturn id + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn previousValue;\n\t}, 1 );\n\n\treturn sprintf(\n\t\t/* translators: %s: is a temporary id for a custom color */\n\t\t__( 'Color %s' ),\n\t\tposition\n\t);\n}\n\nfunction ColorPickerPopover< T extends Color | Gradient >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\treturn (\n\t\t<Popover\n\t\t\tplacement=\"left-start\"\n\t\t\toffset={ 20 }\n\t\t\tclassName=\"components-palette-edit__popover\"\n\t\t\tonClose={ onClose }\n\t\t>\n\t\t\t{ ! isGradient && (\n\t\t\t\t<ColorPicker\n\t\t\t\t\tcolor={ element.color }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColor ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\tcolor: newColor,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isGradient && (\n\t\t\t\t<div className=\"components-palette-edit__popover-gradient-picker\">\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tvalue={ element.gradient }\n\t\t\t\t\t\tonChange={ ( newGradient ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\tgradient: newGradient,\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</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction Option< T extends Color | Gradient >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tisEditing,\n\tonStartEditing,\n\tonRemove,\n\tonStopEditing,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst focusOutsideProps = useFocusOutside( onStopEditing );\n\tconst value = isGradient ? element.gradient : element.color;\n\n\treturn (\n\t\t<PaletteItem\n\t\t\tclassName={ isEditing ? 'is-selected' : undefined }\n\t\t\tas=\"div\"\n\t\t\tonClick={ onStartEditing }\n\t\t\t{ ...( isEditing\n\t\t\t\t? { ...focusOutsideProps }\n\t\t\t\t: {\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t},\n\t\t\t\t } ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<IndicatorStyled\n\t\t\t\t\t\tstyle={ { background: value, color: 'transparent' } }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ isEditing && ! canOnlyChangeValues ? (\n\t\t\t\t\t\t<NameInput\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Gradient name' )\n\t\t\t\t\t\t\t\t\t: __( 'Color name' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ element.name }\n\t\t\t\t\t\t\tonChange={ ( nextName?: string ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...element,\n\t\t\t\t\t\t\t\t\tname: nextName,\n\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\tkebabCase( nextName ?? '' ),\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\t\t<NameContainer>{ element.name }</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ isEditing && ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ __( 'Remove color' ) }\n\t\t\t\t\t\t\tonClick={ onRemove }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ isEditing && (\n\t\t\t\t<ColorPickerPopover\n\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\telement={ element }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\nfunction isTemporaryElement(\n\tslugPrefix: string,\n\t{ slug, color, gradient }: Color | Gradient\n) {\n\tconst regex = new RegExp( `^${ slugPrefix }color-([\\\\d]+)$` );\n\treturn (\n\t\tregex.test( slug ) &&\n\t\t( ( !! color && color === DEFAULT_COLOR ) ||\n\t\t\t( !! gradient && gradient === DEFAULT_GRADIENT ) )\n\t);\n}\n\nfunction PaletteEditListView< T extends Color | Gradient >( {\n\telements,\n\tonChange,\n\teditingElement,\n\tsetEditingElement,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n}: PaletteEditListViewProps< T > ) {\n\t// When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.\n\tconst elementsReference = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReference.current = elements;\n\t}, [ elements ] );\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\telementsReference.current?.some( ( element ) =>\n\t\t\t\t\tisTemporaryElement( slugPrefix, element )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tconst newElements = elementsReference.current.filter(\n\t\t\t\t\t( element ) => ! isTemporaryElement( slugPrefix, element )\n\t\t\t\t);\n\t\t\t\tonChange( newElements.length ? newElements : undefined );\n\t\t\t}\n\t\t};\n\t\t// Disable reason: adding the missing dependency here would cause breaking changes that will require\n\t\t// a heavier refactor to avoid. See https://github.com/WordPress/gutenberg/pull/43911\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<ItemGroup isRounded>\n\t\t\t\t{ elements.map( ( element, index ) => (\n\t\t\t\t\t<Option\n\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\telement={ element }\n\t\t\t\t\t\tonStartEditing={ () => {\n\t\t\t\t\t\t\tif ( editingElement !== index ) {\n\t\t\t\t\t\t\t\tsetEditingElement( index );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( newElement ) => {\n\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t( currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn currentElement;\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\tonRemove={ () => {\n\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\tconst newElements = elements.filter(\n\t\t\t\t\t\t\t\t( _currentElement, currentIndex ) => {\n\t\t\t\t\t\t\t\t\tif ( currentIndex === index ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\t\tnewElements.length ? newElements : undefined\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisEditing={ index === editingElement }\n\t\t\t\t\t\tonStopEditing={ () => {\n\t\t\t\t\t\t\tif ( index === editingElement ) {\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</VStack>\n\t);\n}\n\nconst EMPTY_ARRAY: Color[] = [];\n\n/**\n * Allows editing a palette of colors or gradients.\n *\n * ```jsx\n * import { PaletteEdit } from '@wordpress/components';\n * const MyPaletteEdit = () => {\n * const [ controlledColors, setControlledColors ] = useState( colors );\n *\n * return (\n * <PaletteEdit\n * colors={ controlledColors }\n * onChange={ ( newColors?: Color[] ) => {\n * setControlledColors( newColors );\n * } }\n * paletteLabel=\"Here is a label\"\n * />\n * );\n * };\n * ```\n */\nexport function PaletteEdit( {\n\tgradients,\n\tcolors = EMPTY_ARRAY,\n\tonChange,\n\tpaletteLabel,\n\tpaletteLabelHeadingLevel = 2,\n\temptyMessage,\n\tcanOnlyChangeValues,\n\tcanReset,\n\tslugPrefix = '',\n}: PaletteEditProps ) {\n\tconst isGradient = !! gradients;\n\tconst elements = isGradient ? gradients : colors;\n\tconst [ isEditing, setIsEditing ] = useState( false );\n\tconst [ editingElement, setEditingElement ] = useState<\n\t\tnumber | null | undefined\n\t>( null );\n\tconst isAdding =\n\t\tisEditing &&\n\t\t!! editingElement &&\n\t\telements[ editingElement ] &&\n\t\t! elements[ editingElement ].slug;\n\tconst elementsLength = elements.length;\n\tconst hasElements = elementsLength > 0;\n\tconst debounceOnChange = useDebounce( onChange, 100 );\n\tconst onSelectPaletteItem = useCallback(\n\t\t(\n\t\t\tvalue?: PaletteElement[ keyof PaletteElement ],\n\t\t\tnewEditingElementIndex?: number\n\t\t) => {\n\t\t\tconst selectedElement =\n\t\t\t\tnewEditingElementIndex === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: elements[ newEditingElementIndex ];\n\t\t\tconst key = isGradient ? 'gradient' : 'color';\n\t\t\t// Ensures that the index returned matches a known element value.\n\t\t\tif ( !! selectedElement && selectedElement[ key ] === value ) {\n\t\t\t\tsetEditingElement( newEditingElementIndex );\n\t\t\t} else {\n\t\t\t\tsetIsEditing( true );\n\t\t\t}\n\t\t},\n\t\t[ isGradient, elements ]\n\t);\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<PaletteHStackHeader>\n\t\t\t\t<PaletteHeading level={ paletteLabelHeadingLevel }>\n\t\t\t\t\t{ paletteLabel }\n\t\t\t\t</PaletteHeading>\n\t\t\t\t<PaletteActionsContainer>\n\t\t\t\t\t{ hasElements && isEditing && (\n\t\t\t\t\t\t<DoneButton\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\t\t\t\t\t\tsetEditingElement( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</DoneButton>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tisPressed={ isAdding }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t? __( 'Add gradient' )\n\t\t\t\t\t\t\t\t\t: __( 'Add color' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst tempOptionName = getNameForPosition(\n\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\tslugPrefix\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif ( !! gradients ) {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...gradients,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tgradient: DEFAULT_GRADIENT,\n\t\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\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} else {\n\t\t\t\t\t\t\t\t\tonChange( [\n\t\t\t\t\t\t\t\t\t\t...colors,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tcolor: DEFAULT_COLOR,\n\t\t\t\t\t\t\t\t\t\t\tname: tempOptionName,\n\t\t\t\t\t\t\t\t\t\t\tslug:\n\t\t\t\t\t\t\t\t\t\t\t\tslugPrefix +\n\t\t\t\t\t\t\t\t\t\t\t\tkebabCase( tempOptionName ),\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\tsetIsEditing( true );\n\t\t\t\t\t\t\t\tsetEditingElement( elements.length );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ hasElements &&\n\t\t\t\t\t\t( ! isEditing ||\n\t\t\t\t\t\t\t! canOnlyChangeValues ||\n\t\t\t\t\t\t\tcanReset ) && (\n\t\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisGradient\n\t\t\t\t\t\t\t\t\t\t? __( 'Gradient options' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Color options' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ( { onClose }: { onClose: () => void } ) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<NavigableMenu role=\"menu\">\n\t\t\t\t\t\t\t\t\t\t\t{ ! isEditing && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( true );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\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\t\t{ __( 'Show details' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsEditing( false );\n\t\t\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\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-palette-edit__menu-button\"\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\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all gradients'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Remove all colors'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t{ canReset && (\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetEditingElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnull\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\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\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\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\t\t{ isGradient\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Reset gradient' )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Reset colors' ) }\n\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</NavigableMenu>\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</DropdownMenu>\n\t\t\t\t\t\t) }\n\t\t\t\t</PaletteActionsContainer>\n\t\t\t</PaletteHStackHeader>\n\t\t\t{ hasElements && (\n\t\t\t\t<>\n\t\t\t\t\t{ isEditing && (\n\t\t\t\t\t\t<PaletteEditListView< ( typeof elements )[ number ] >\n\t\t\t\t\t\t\tcanOnlyChangeValues={ canOnlyChangeValues }\n\t\t\t\t\t\t\telements={ elements }\n\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\teditingElement={ editingElement }\n\t\t\t\t\t\t\tsetEditingElement={ setEditingElement }\n\t\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing && editingElement !== null && (\n\t\t\t\t\t\t<ColorPickerPopover\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tonClose={ () => setEditingElement( null ) }\n\t\t\t\t\t\t\tonChange={ (\n\t\t\t\t\t\t\t\tnewElement: ( typeof elements )[ number ]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tdebounceOnChange(\n\t\t\t\t\t\t\t\t\t// @ts-expect-error TODO: Don't know how to resolve\n\t\t\t\t\t\t\t\t\telements.map(\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\tcurrentElement: ( typeof elements )[ number ],\n\t\t\t\t\t\t\t\t\t\t\tcurrentIndex: number\n\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentIndex === editingElement\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn newElement;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\treturn currentElement;\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} }\n\t\t\t\t\t\t\telement={ elements[ editingElement ?? -1 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditing &&\n\t\t\t\t\t\t( isGradient ? (\n\t\t\t\t\t\t\t<GradientPicker\n\t\t\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomGradients={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t\t\tonChange={ onSelectPaletteItem }\n\t\t\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t\t\t\tdisableCustomColors={ true }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -5,7 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.PanelBody = PanelBody;
8
+ exports.PanelBody = void 0;
9
+ exports.UnforwardedPanelBody = UnforwardedPanelBody;
9
10
  exports.default = void 0;
10
11
 
11
12
  var _element = require("@wordpress/element");
@@ -31,14 +32,10 @@ var _utils = require("../utils");
31
32
  /**
32
33
  * WordPress dependencies
33
34
  */
34
-
35
- /**
36
- * Internal dependencies
37
- */
38
35
  const noop = () => {};
39
36
 
40
- function PanelBody(_ref, ref) {
41
- let {
37
+ function UnforwardedPanelBody(props, ref) {
38
+ const {
42
39
  buttonProps = {},
43
40
  children,
44
41
  className,
@@ -48,11 +45,12 @@ function PanelBody(_ref, ref) {
48
45
  opened,
49
46
  title,
50
47
  scrollAfterOpen = true
51
- } = _ref;
48
+ } = props;
52
49
  const [isOpened, setIsOpened] = (0, _utils.useControlledState)(opened, {
53
- initial: initialOpen === undefined ? true : initialOpen
50
+ initial: initialOpen === undefined ? true : initialOpen,
51
+ fallback: false
54
52
  });
55
- const nodeRef = (0, _element.useRef)(); // Defaults to 'smooth' scrolling
53
+ const nodeRef = (0, _element.useRef)(null); // Defaults to 'smooth' scrolling
56
54
  // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
57
55
 
58
56
  const scrollBehavior = (0, _compose.useReducedMotion)() ? 'auto' : 'smooth';
@@ -92,21 +90,21 @@ function PanelBody(_ref, ref) {
92
90
  ref: (0, _compose.useMergeRefs)([nodeRef, ref])
93
91
  }, (0, _element.createElement)(PanelBodyTitle, (0, _extends2.default)({
94
92
  icon: icon,
95
- isOpened: isOpened,
93
+ isOpened: Boolean(isOpened),
96
94
  onClick: handleOnToggle,
97
95
  title: title
98
96
  }, buttonProps)), typeof children === 'function' ? children({
99
- opened: isOpened
97
+ opened: Boolean(isOpened)
100
98
  }) : isOpened && children);
101
99
  }
102
100
 
103
- const PanelBodyTitle = (0, _element.forwardRef)((_ref2, ref) => {
101
+ const PanelBodyTitle = (0, _element.forwardRef)((_ref, ref) => {
104
102
  let {
105
103
  isOpened,
106
104
  icon,
107
105
  title,
108
106
  ...props
109
- } = _ref2;
107
+ } = _ref;
110
108
  if (!title) return null;
111
109
  return (0, _element.createElement)("h2", {
112
110
  className: "components-panel__body-title"
@@ -125,8 +123,8 @@ const PanelBodyTitle = (0, _element.forwardRef)((_ref2, ref) => {
125
123
  size: 20
126
124
  })));
127
125
  });
128
- const ForwardedComponent = (0, _element.forwardRef)(PanelBody);
129
- ForwardedComponent.displayName = 'PanelBody';
130
- var _default = ForwardedComponent;
126
+ const PanelBody = (0, _element.forwardRef)(UnforwardedPanelBody);
127
+ exports.PanelBody = PanelBody;
128
+ var _default = PanelBody;
131
129
  exports.default = _default;
132
130
  //# sourceMappingURL=body.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/panel/body.js"],"names":["noop","PanelBody","ref","buttonProps","children","className","icon","initialOpen","onToggle","opened","title","scrollAfterOpen","isOpened","setIsOpened","initial","undefined","nodeRef","scrollBehavior","handleOnToggle","event","preventDefault","next","scrollAfterOpenRef","current","scrollIntoView","inline","block","behavior","classes","PanelBodyTitle","props","chevronUp","chevronDown","ForwardedComponent","displayName"],"mappings":";;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAKA,MAAMA,IA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CAAvB;AAoCA,MAAM2B,kBAAkB,GAAG,yBAAYhC,SAAZ,CAA3B;AACAgC,kBAAkB,CAACC,WAAnB,GAAiC,WAAjC;eAEeD,kB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { chevronUp, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport Icon from '../icon';\nimport { useControlledState, useUpdateEffect } from '../utils';\n\nconst noop = () => {};\n\nexport function PanelBody(\n\t{\n\t\tbuttonProps = {},\n\t\tchildren,\n\t\tclassName,\n\t\ticon,\n\t\tinitialOpen,\n\t\tonToggle = noop,\n\t\topened,\n\t\ttitle,\n\t\tscrollAfterOpen = true,\n\t},\n\tref\n) {\n\tconst [ isOpened, setIsOpened ] = useControlledState( opened, {\n\t\tinitial: initialOpen === undefined ? true : initialOpen,\n\t} );\n\tconst nodeRef = useRef();\n\n\t// Defaults to 'smooth' scrolling\n\t// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView\n\tconst scrollBehavior = useReducedMotion() ? 'auto' : 'smooth';\n\n\tconst handleOnToggle = ( event ) => {\n\t\tevent.preventDefault();\n\t\tconst next = ! isOpened;\n\t\tsetIsOpened( next );\n\t\tonToggle( next );\n\t};\n\n\t// Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.\n\tconst scrollAfterOpenRef = useRef();\n\tscrollAfterOpenRef.current = scrollAfterOpen;\n\t// Runs after initial render.\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\tisOpened &&\n\t\t\tscrollAfterOpenRef.current &&\n\t\t\tnodeRef.current?.scrollIntoView\n\t\t) {\n\t\t\t/*\n\t\t\t * Scrolls the content into view when visible.\n\t\t\t * This improves the UX when there are multiple stacking <PanelBody />\n\t\t\t * components in a scrollable container.\n\t\t\t */\n\t\t\tnodeRef.current.scrollIntoView( {\n\t\t\t\tinline: 'nearest',\n\t\t\t\tblock: 'nearest',\n\t\t\t\tbehavior: scrollBehavior,\n\t\t\t} );\n\t\t}\n\t}, [ isOpened, scrollBehavior ] );\n\n\tconst classes = classnames( 'components-panel__body', className, {\n\t\t'is-opened': isOpened,\n\t} );\n\n\treturn (\n\t\t<div className={ classes } ref={ useMergeRefs( [ nodeRef, ref ] ) }>\n\t\t\t<PanelBodyTitle\n\t\t\t\ticon={ icon }\n\t\t\t\tisOpened={ isOpened }\n\t\t\t\tonClick={ handleOnToggle }\n\t\t\t\ttitle={ title }\n\t\t\t\t{ ...buttonProps }\n\t\t\t/>\n\t\t\t{ typeof children === 'function'\n\t\t\t\t? children( { opened: isOpened } )\n\t\t\t\t: isOpened && children }\n\t\t</div>\n\t);\n}\n\nconst PanelBodyTitle = forwardRef(\n\t( { isOpened, icon, title, ...props }, ref ) => {\n\t\tif ( ! title ) return null;\n\n\t\treturn (\n\t\t\t<h2 className=\"components-panel__body-title\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"components-panel__body-toggle\"\n\t\t\t\t\taria-expanded={ isOpened }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ /*\n\t\t\t\t\tFirefox + NVDA don't announce aria-expanded because the browser\n\t\t\t\t\trepaints the whole element, so this wrapping span hides that.\n\t\t\t\t*/ }\n\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"components-panel__arrow\"\n\t\t\t\t\t\t\ticon={ isOpened ? chevronUp : chevronDown }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ title }\n\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tclassName=\"components-panel__icon\"\n\t\t\t\t\t\t\tsize={ 20 }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t</h2>\n\t\t);\n\t}\n);\n\nconst ForwardedComponent = forwardRef( PanelBody );\nForwardedComponent.displayName = 'PanelBody';\n\nexport default ForwardedComponent;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/panel/body.tsx"],"names":["noop","UnforwardedPanelBody","props","ref","buttonProps","children","className","icon","initialOpen","onToggle","opened","title","scrollAfterOpen","isOpened","setIsOpened","initial","undefined","fallback","nodeRef","scrollBehavior","handleOnToggle","event","preventDefault","next","scrollAfterOpenRef","current","scrollIntoView","inline","block","behavior","classes","Boolean","PanelBodyTitle","chevronUp","chevronDown","PanelBody"],"mappings":";;;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AAOA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;AAcA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEO,SAASC,oBAAT,CACNC,KADM,EAENC,GAFM,EAGL;AACD,QAAM;AACLC,IAAAA,WAAW,GAAG,EADT;AAELC,IAAAA,QAFK;AAGLC,IAAAA,SAHK;AAILC,IAAAA,IAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA,QAAQ,GAAGT,IANN;AAOLU,IAAAA,MAPK;AAQLC,IAAAA,KARK;AASLC,IAAAA,eAAe,GAAG;AATb,MAUFV,KAVJ;AAWA,QAAM,CAAEW,QAAF,EAAYC,WAAZ,IAA4B,+BACjCJ,MADiC,EAEjC;AACCK,IAAAA,OAAO,EAAEP,WAAW,KAAKQ,SAAhB,GAA4B,IAA5B,GAAmCR,WAD7C;AAECS,IAAAA,QAAQ,EAAE;AAFX,GAFiC,CAAlC;AAOA,QAAMC,OAAO,GAAG,qBAAuB,IAAvB,CAAhB,CAnBC,CAqBD;AACA;;AACA,QAAMC,cAAc,GAAG,mCAAqB,MAArB,GAA8B,QAArD;;AAEA,QAAMC,cAAc,GAAKC,KAAF,IAA+B;AACrDA,IAAAA,KAAK,CAACC,cAAN;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;AAAA,MAPJ;AACCU,IAAAA,QADD;AAECN,IAAAA,IAFD;AAGCI,IAAAA,KAHD;AAIC,OAAGT;AAJJ,GAOI;AACJ,MAAK,CAAES,KAAP,EAAe,OAAO,IAAP;AAEf,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,+BADX;AAEC,qBAAgBE,QAFjB;AAGC,IAAA,GAAG,EAAGV;AAHP,KAIMD,KAJN,GAUC;AAAM,mBAAY;AAAlB,KACC,4BAAC,aAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,IAAI,EAAGW,QAAQ,GAAGoB,gBAAH,GAAeC;AAF/B,IADD,CAVD,EAgBGvB,KAhBH,EAiBGJ,IAAI,IACL,4BAAC,aAAD;AACC,IAAA,IAAI,EAAGA,IADR;AAEC,IAAA,SAAS,EAAC,wBAFX;AAGC,IAAA,IAAI,EAAG;AAHR,IAlBF,CADD,CADD;AA6BA,CAzCqB,CAAvB;AA4CO,MAAM4B,SAAS,GAAG,yBAAYlC,oBAAZ,CAAlB;;eAEQkC,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useRef } from '@wordpress/element';\nimport { chevronUp, chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { PanelBodyProps, PanelBodyTitleProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { useControlledState, useUpdateEffect } from '../utils';\n\nconst noop = () => {};\n\nexport function UnforwardedPanelBody(\n\tprops: PanelBodyProps,\n\tref: React.ForwardedRef< HTMLDivElement >\n) {\n\tconst {\n\t\tbuttonProps = {},\n\t\tchildren,\n\t\tclassName,\n\t\ticon,\n\t\tinitialOpen,\n\t\tonToggle = noop,\n\t\topened,\n\t\ttitle,\n\t\tscrollAfterOpen = true,\n\t} = props;\n\tconst [ isOpened, setIsOpened ] = useControlledState< boolean | undefined >(\n\t\topened,\n\t\t{\n\t\t\tinitial: initialOpen === undefined ? true : initialOpen,\n\t\t\tfallback: false,\n\t\t}\n\t);\n\tconst nodeRef = useRef< HTMLElement >( null );\n\n\t// Defaults to 'smooth' scrolling\n\t// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView\n\tconst scrollBehavior = useReducedMotion() ? 'auto' : 'smooth';\n\n\tconst handleOnToggle = ( event: React.MouseEvent ) => {\n\t\tevent.preventDefault();\n\t\tconst next = ! isOpened;\n\t\tsetIsOpened( next );\n\t\tonToggle( next );\n\t};\n\n\t// Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.\n\tconst scrollAfterOpenRef = useRef< boolean | undefined >();\n\tscrollAfterOpenRef.current = scrollAfterOpen;\n\t// Runs after initial render.\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\tisOpened &&\n\t\t\tscrollAfterOpenRef.current &&\n\t\t\tnodeRef.current?.scrollIntoView\n\t\t) {\n\t\t\t/*\n\t\t\t * Scrolls the content into view when visible.\n\t\t\t * This improves the UX when there are multiple stacking <PanelBody />\n\t\t\t * components in a scrollable container.\n\t\t\t */\n\t\t\tnodeRef.current.scrollIntoView( {\n\t\t\t\tinline: 'nearest',\n\t\t\t\tblock: 'nearest',\n\t\t\t\tbehavior: scrollBehavior,\n\t\t\t} );\n\t\t}\n\t}, [ isOpened, scrollBehavior ] );\n\n\tconst classes = classnames( 'components-panel__body', className, {\n\t\t'is-opened': isOpened,\n\t} );\n\n\treturn (\n\t\t<div className={ classes } ref={ useMergeRefs( [ nodeRef, ref ] ) }>\n\t\t\t<PanelBodyTitle\n\t\t\t\ticon={ icon }\n\t\t\t\tisOpened={ Boolean( isOpened ) }\n\t\t\t\tonClick={ handleOnToggle }\n\t\t\t\ttitle={ title }\n\t\t\t\t{ ...buttonProps }\n\t\t\t/>\n\t\t\t{ typeof children === 'function'\n\t\t\t\t? children( { opened: Boolean( isOpened ) } )\n\t\t\t\t: isOpened && children }\n\t\t</div>\n\t);\n}\n\nconst PanelBodyTitle = forwardRef(\n\t(\n\t\t{\n\t\t\tisOpened,\n\t\t\ticon,\n\t\t\ttitle,\n\t\t\t...props\n\t\t}: WordPressComponentProps< PanelBodyTitleProps, 'button' >,\n\t\tref: React.ForwardedRef< any >\n\t) => {\n\t\tif ( ! title ) return null;\n\n\t\treturn (\n\t\t\t<h2 className=\"components-panel__body-title\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"components-panel__body-toggle\"\n\t\t\t\t\taria-expanded={ isOpened }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ /*\n\t\t\t\t\tFirefox + NVDA don't announce aria-expanded because the browser\n\t\t\t\t\trepaints the whole element, so this wrapping span hides that.\n\t\t\t\t*/ }\n\t\t\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tclassName=\"components-panel__arrow\"\n\t\t\t\t\t\t\ticon={ isOpened ? chevronUp : chevronDown }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t\t{ title }\n\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tclassName=\"components-panel__icon\"\n\t\t\t\t\t\t\tsize={ 20 }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t</h2>\n\t\t);\n\t}\n);\n\nexport const PanelBody = forwardRef( UnforwardedPanelBody );\n\nexport default PanelBody;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/placeholder/index.tsx"],"names":["PlaceholderIllustration","Placeholder","props","icon","children","label","instructions","className","notices","preview","isColumnLayout","withIllustration","additionalProps","resizeListener","width","modifierClassNames","classes","fieldsetClasses"],"mappings":";;;;;;;;;;;;;;AAGA;;AAK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,EAAGI;AAAxC,MACGL,gBAAgB,GAAGX,uBAAH,GAA6B,IADhD,EAEGa,cAFH,EAGGL,OAHH,EAIGC,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CALF,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,aAAD;AAAM,IAAA,IAAI,EAAGN;AAAb,IADD,EAEGE,KAFH,CATD,EAaC;AAAU,IAAA,SAAS,EAAGY;AAAtB,KACG,CAAC,CAAEX,YAAH,IACD;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACGA,YADH,CAFF,EAMGF,QANH,CAbD,CADD;AAwBA;;eAEcH,W","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useResizeObserver } from '@wordpress/compose';\nimport { SVG, Path } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport type { PlaceholderProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst PlaceholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\n/**\n * Renders a placeholder. Normally used by blocks to render their empty state.\n *\n * ```jsx\n * import { Placeholder } from '@wordpress/components';\n * import { more } from '@wordpress/icons';\n *\n * const MyPlaceholder = () => <Placeholder icon={ more } label=\"Placeholder\" />;\n * ```\n */\nexport function Placeholder< IconProps = unknown >(\n\tprops: WordPressComponentProps<\n\t\tPlaceholderProps< IconProps >,\n\t\t'div',\n\t\tfalse\n\t>\n) {\n\tconst {\n\t\ticon,\n\t\tchildren,\n\t\tlabel,\n\t\tinstructions,\n\t\tclassName,\n\t\tnotices,\n\t\tpreview,\n\t\tisColumnLayout,\n\t\twithIllustration,\n\t\t...additionalProps\n\t} = props;\n\tconst [ resizeListener, { width } ] = useResizeObserver();\n\n\t// Since `useResizeObserver` will report a width of `null` until after the\n\t// first render, avoid applying any modifier classes until width is known.\n\tlet modifierClassNames;\n\tif ( typeof width === 'number' ) {\n\t\tmodifierClassNames = {\n\t\t\t'is-large': width >= 480,\n\t\t\t'is-medium': width >= 160 && width < 480,\n\t\t\t'is-small': width < 160,\n\t\t};\n\t}\n\n\tconst classes = classnames(\n\t\t'components-placeholder',\n\t\tclassName,\n\t\tmodifierClassNames,\n\t\twithIllustration ? 'has-illustration' : null\n\t);\n\tconst fieldsetClasses = classnames( 'components-placeholder__fieldset', {\n\t\t'is-column-layout': isColumnLayout,\n\t} );\n\treturn (\n\t\t<div { ...additionalProps } className={ classes }>\n\t\t\t{ withIllustration ? PlaceholderIllustration : null }\n\t\t\t{ resizeListener }\n\t\t\t{ notices }\n\t\t\t{ preview && (\n\t\t\t\t<div className=\"components-placeholder__preview\">\n\t\t\t\t\t{ preview }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-placeholder__label\">\n\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t{ label }\n\t\t\t</div>\n\t\t\t<fieldset className={ fieldsetClasses }>\n\t\t\t\t{ !! instructions && (\n\t\t\t\t\t<legend className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ instructions }\n\t\t\t\t\t</legend>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t</fieldset>\n\t\t</div>\n\t);\n}\n\nexport default Placeholder;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/placeholder/index.tsx"],"names":["PlaceholderIllustration","Placeholder","props","icon","children","label","instructions","className","notices","preview","isColumnLayout","withIllustration","additionalProps","resizeListener","width","modifierClassNames","classes","fieldsetClasses"],"mappings":";;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;A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Ga,cAFH,EAGGL,OAHH,EAIGC,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CALF,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,aAAD;AAAM,IAAA,IAAI,EAAGN;AAAb,IADD,EAEGE,KAFH,CATD,EAaC;AAAU,IAAA,SAAS,EAAGY;AAAtB,KACG,CAAC,CAAEX,YAAH,IACD;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACGA,YADH,CAFF,EAMGF,QANH,CAbD,CADD;AAwBA;;eAEcH,W","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useResizeObserver } from '@wordpress/compose';\nimport { SVG, Path } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Icon from '../icon';\nimport type { PlaceholderProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst PlaceholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\n/**\n * Renders a placeholder. Normally used by blocks to render their empty state.\n *\n * ```jsx\n * import { Placeholder } from '@wordpress/components';\n * import { more } from '@wordpress/icons';\n *\n * const MyPlaceholder = () => <Placeholder icon={ more } label=\"Placeholder\" />;\n * ```\n */\nexport function Placeholder(\n\tprops: WordPressComponentProps< PlaceholderProps, 'div', false >\n) {\n\tconst {\n\t\ticon,\n\t\tchildren,\n\t\tlabel,\n\t\tinstructions,\n\t\tclassName,\n\t\tnotices,\n\t\tpreview,\n\t\tisColumnLayout,\n\t\twithIllustration,\n\t\t...additionalProps\n\t} = props;\n\tconst [ resizeListener, { width } ] = useResizeObserver();\n\n\t// Since `useResizeObserver` will report a width of `null` until after the\n\t// first render, avoid applying any modifier classes until width is known.\n\tlet modifierClassNames;\n\tif ( typeof width === 'number' ) {\n\t\tmodifierClassNames = {\n\t\t\t'is-large': width >= 480,\n\t\t\t'is-medium': width >= 160 && width < 480,\n\t\t\t'is-small': width < 160,\n\t\t};\n\t}\n\n\tconst classes = classnames(\n\t\t'components-placeholder',\n\t\tclassName,\n\t\tmodifierClassNames,\n\t\twithIllustration ? 'has-illustration' : null\n\t);\n\tconst fieldsetClasses = classnames( 'components-placeholder__fieldset', {\n\t\t'is-column-layout': isColumnLayout,\n\t} );\n\treturn (\n\t\t<div { ...additionalProps } className={ classes }>\n\t\t\t{ withIllustration ? PlaceholderIllustration : null }\n\t\t\t{ resizeListener }\n\t\t\t{ notices }\n\t\t\t{ preview && (\n\t\t\t\t<div className=\"components-placeholder__preview\">\n\t\t\t\t\t{ preview }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"components-placeholder__label\">\n\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t{ label }\n\t\t\t</div>\n\t\t\t<fieldset className={ fieldsetClasses }>\n\t\t\t\t{ !! instructions && (\n\t\t\t\t\t<legend className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ instructions }\n\t\t\t\t\t</legend>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t</fieldset>\n\t\t</div>\n\t);\n}\n\nexport default Placeholder;\n"]}
@@ -29,10 +29,6 @@ function AuthorSelect(_ref) {
29
29
  return (0, _element.createElement)(_treeSelect.default, {
30
30
  label,
31
31
  noOptionLabel,
32
- // Since the `multiple` attribute is not passed to `TreeSelect`, it is
33
- // safe to assume that the argument of `onChange` cannot be `string[]`.
34
- // The correct solution would be to type `SelectControl` better, so that
35
- // the type of `value` and `onChange` vary depending on `multiple`.
36
32
  onChange: onChangeProp,
37
33
  tree: termsTree,
38
34
  selectedId: selectedAuthorId !== undefined ? String(selectedAuthorId) : undefined
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/query-controls/author-select.tsx"],"names":["AuthorSelect","label","noOptionLabel","authorList","selectedAuthorId","onChange","onChangeProp","termsTree","undefined","String"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAMe,SAASA,YAAT,OAMQ;AAAA,MANe;AACrCC,IAAAA,KADqC;AAErCC,IAAAA,aAFqC;AAGrCC,IAAAA,UAHqC;AAIrCC,IAAAA,gBAJqC;AAKrCC,IAAAA,QAAQ,EAAEC;AAL2B,GAMf;AACtB,MAAK,CAAEH,UAAP,EAAoB,OAAO,IAAP;AACpB,QAAMI,SAAS,GAAG,2BAAgBJ,UAAhB,CAAlB;AACA,SACC,4BAAC,mBAAD;AAEEF,IAAAA,KAFF;AAGEC,IAAAA,aAHF;AAIE;AACA;AACA;AACA;AACAG,IAAAA,QAAQ,EAAEC,YARZ;AAUC,IAAA,IAAI,EAAGC,SAVR;AAWC,IAAA,UAAU,EACTH,gBAAgB,KAAKI,SAArB,GACGC,MAAM,CAAEL,gBAAF,CADT,GAEGI;AAdL,IADD;AAmBA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { buildTermsTree } from './terms';\nimport TreeSelect from '../tree-select';\nimport type { TreeSelectProps } from '../tree-select/types';\nimport type { AuthorSelectProps } from './types';\n\nexport default function AuthorSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tauthorList,\n\tselectedAuthorId,\n\tonChange: onChangeProp,\n}: AuthorSelectProps ) {\n\tif ( ! authorList ) return null;\n\tconst termsTree = buildTermsTree( authorList );\n\treturn (\n\t\t<TreeSelect\n\t\t\t{ ...{\n\t\t\t\tlabel,\n\t\t\t\tnoOptionLabel,\n\t\t\t\t// Since the `multiple` attribute is not passed to `TreeSelect`, it is\n\t\t\t\t// safe to assume that the argument of `onChange` cannot be `string[]`.\n\t\t\t\t// The correct solution would be to type `SelectControl` better, so that\n\t\t\t\t// the type of `value` and `onChange` vary depending on `multiple`.\n\t\t\t\tonChange: onChangeProp as TreeSelectProps[ 'onChange' ],\n\t\t\t} }\n\t\t\ttree={ termsTree }\n\t\t\tselectedId={\n\t\t\t\tselectedAuthorId !== undefined\n\t\t\t\t\t? String( selectedAuthorId )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/query-controls/author-select.tsx"],"names":["AuthorSelect","label","noOptionLabel","authorList","selectedAuthorId","onChange","onChangeProp","termsTree","undefined","String"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAKe,SAASA,YAAT,OAMQ;AAAA,MANe;AACrCC,IAAAA,KADqC;AAErCC,IAAAA,aAFqC;AAGrCC,IAAAA,UAHqC;AAIrCC,IAAAA,gBAJqC;AAKrCC,IAAAA,QAAQ,EAAEC;AAL2B,GAMf;AACtB,MAAK,CAAEH,UAAP,EAAoB,OAAO,IAAP;AACpB,QAAMI,SAAS,GAAG,2BAAgBJ,UAAhB,CAAlB;AACA,SACC,4BAAC,mBAAD;AAEEF,IAAAA,KAFF;AAGEC,IAAAA,aAHF;AAIEG,IAAAA,QAAQ,EAAEC,YAJZ;AAMC,IAAA,IAAI,EAAGC,SANR;AAOC,IAAA,UAAU,EACTH,gBAAgB,KAAKI,SAArB,GACGC,MAAM,CAAEL,gBAAF,CADT,GAEGI;AAVL,IADD;AAeA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { buildTermsTree } from './terms';\nimport TreeSelect from '../tree-select';\nimport type { AuthorSelectProps } from './types';\n\nexport default function AuthorSelect( {\n\tlabel,\n\tnoOptionLabel,\n\tauthorList,\n\tselectedAuthorId,\n\tonChange: onChangeProp,\n}: AuthorSelectProps ) {\n\tif ( ! authorList ) return null;\n\tconst termsTree = buildTermsTree( authorList );\n\treturn (\n\t\t<TreeSelect\n\t\t\t{ ...{\n\t\t\t\tlabel,\n\t\t\t\tnoOptionLabel,\n\t\t\t\tonChange: onChangeProp,\n\t\t\t} }\n\t\t\ttree={ termsTree }\n\t\t\tselectedId={\n\t\t\t\tselectedAuthorId !== undefined\n\t\t\t\t\t? String( selectedAuthorId )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -37,10 +37,6 @@ function CategorySelect(_ref) {
37
37
  return (0, _element.createElement)(_treeSelect.default, (0, _extends2.default)({
38
38
  label,
39
39
  noOptionLabel,
40
- // Since the `multiple` attribute is not passed to `TreeSelect`, it is
41
- // safe to assume that the argument of `onChange` cannot be `string[]`.
42
- // The correct solution would be to type `SelectControl` better, so that
43
- // the type of `value` and `onChange` vary depending on `multiple`.
44
40
  onChange: onChangeProp,
45
41
  tree: termsTree,
46
42
  selectedId: selectedCategoryId !== undefined ? String(selectedCategoryId) : undefined
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/query-controls/category-select.tsx"],"names":["CategorySelect","label","noOptionLabel","categoriesList","selectedCategoryId","onChange","onChangeProp","props","termsTree","undefined","String"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAJA;AACA;AACA;;AAKA;AACA;AACA;AAIe,SAASA,cAAT,OAOU;AAAA,MAPe;AACvCC,IAAAA,KADuC;AAEvCC,IAAAA,aAFuC;AAGvCC,IAAAA,cAHuC;AAIvCC,IAAAA,kBAJuC;AAKvCC,IAAAA,QAAQ,EAAEC,YAL6B;AAMvC,OAAGC;AANoC,GAOf;AACxB,QAAMC,SAAS,GAAG,sBAAS,MAAM;AAChC,WAAO,2BAAgBL,cAAhB,CAAP;AACA,GAFiB,EAEf,CAAEA,cAAF,CAFe,CAAlB;AAIA,SACC,4BAAC,mBAAD;AAEEF,IAAAA,KAFF;AAGEC,IAAAA,aAHF;AAIE;AACA;AACA;AACA;AACAG,IAAAA,QAAQ,EAAEC,YARZ;AAUC,IAAA,IAAI,EAAGE,SAVR;AAWC,IAAA,UAAU,EACTJ,kBAAkB,KAAKK,SAAvB,GACGC,MAAM,CAAEN,kBAAF,CADT,GAEGK;AAdL,KAgBMF,KAhBN,EADD;AAoBA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { buildTermsTree } from './terms';\nimport TreeSelect from '../tree-select';\nimport type { TreeSelectProps } from '../tree-select/types';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport type { CategorySelectProps } from './types';\n\nexport default function CategorySelect( {\n\tlabel,\n\tnoOptionLabel,\n\tcategoriesList,\n\tselectedCategoryId,\n\tonChange: onChangeProp,\n\t...props\n}: CategorySelectProps ) {\n\tconst termsTree = useMemo( () => {\n\t\treturn buildTermsTree( categoriesList );\n\t}, [ categoriesList ] );\n\n\treturn (\n\t\t<TreeSelect\n\t\t\t{ ...{\n\t\t\t\tlabel,\n\t\t\t\tnoOptionLabel,\n\t\t\t\t// Since the `multiple` attribute is not passed to `TreeSelect`, it is\n\t\t\t\t// safe to assume that the argument of `onChange` cannot be `string[]`.\n\t\t\t\t// The correct solution would be to type `SelectControl` better, so that\n\t\t\t\t// the type of `value` and `onChange` vary depending on `multiple`.\n\t\t\t\tonChange: onChangeProp as TreeSelectProps[ 'onChange' ],\n\t\t\t} }\n\t\t\ttree={ termsTree }\n\t\t\tselectedId={\n\t\t\t\tselectedCategoryId !== undefined\n\t\t\t\t\t? String( selectedCategoryId )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/query-controls/category-select.tsx"],"names":["CategorySelect","label","noOptionLabel","categoriesList","selectedCategoryId","onChange","onChangeProp","props","termsTree","undefined","String"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,cAAT,OAOU;AAAA,MAPe;AACvCC,IAAAA,KADuC;AAEvCC,IAAAA,aAFuC;AAGvCC,IAAAA,cAHuC;AAIvCC,IAAAA,kBAJuC;AAKvCC,IAAAA,QAAQ,EAAEC,YAL6B;AAMvC,OAAGC;AANoC,GAOf;AACxB,QAAMC,SAAS,GAAG,sBAAS,MAAM;AAChC,WAAO,2BAAgBL,cAAhB,CAAP;AACA,GAFiB,EAEf,CAAEA,cAAF,CAFe,CAAlB;AAIA,SACC,4BAAC,mBAAD;AAEEF,IAAAA,KAFF;AAGEC,IAAAA,aAHF;AAIEG,IAAAA,QAAQ,EAAEC,YAJZ;AAMC,IAAA,IAAI,EAAGE,SANR;AAOC,IAAA,UAAU,EACTJ,kBAAkB,KAAKK,SAAvB,GACGC,MAAM,CAAEN,kBAAF,CADT,GAEGK;AAVL,KAYMF,KAZN,EADD;AAgBA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { buildTermsTree } from './terms';\nimport TreeSelect from '../tree-select';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport type { CategorySelectProps } from './types';\n\nexport default function CategorySelect( {\n\tlabel,\n\tnoOptionLabel,\n\tcategoriesList,\n\tselectedCategoryId,\n\tonChange: onChangeProp,\n\t...props\n}: CategorySelectProps ) {\n\tconst termsTree = useMemo( () => {\n\t\treturn buildTermsTree( categoriesList );\n\t}, [ categoriesList ] );\n\n\treturn (\n\t\t<TreeSelect\n\t\t\t{ ...{\n\t\t\t\tlabel,\n\t\t\t\tnoOptionLabel,\n\t\t\t\tonChange: onChangeProp,\n\t\t\t} }\n\t\t\ttree={ termsTree }\n\t\t\tselectedId={\n\t\t\t\tselectedCategoryId !== undefined\n\t\t\t\t\t? String( selectedCategoryId )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.buildTermsTree = buildTermsTree;
7
7
 
8
- var _lodash = require("lodash");
9
-
10
8
  /**
11
- * External dependencies
9
+ * Internal dependencies
12
10
  */
13
-
11
+ const ensureParentsAreDefined = terms => {
12
+ return terms.every(term => term.parent !== null);
13
+ };
14
14
  /**
15
15
  * Returns terms in a tree form.
16
16
  *
@@ -18,21 +18,36 @@ var _lodash = require("lodash");
18
18
  *
19
19
  * @return Terms in tree format.
20
20
  */
21
+
22
+
21
23
  function buildTermsTree(flatTerms) {
22
- const flatTermsWithParentAndChildren = flatTerms.map(term => {
23
- return {
24
- children: [],
25
- parent: null,
26
- ...term,
27
- id: String(term.id)
28
- };
29
- });
30
- const termsByParent = (0, _lodash.groupBy)(flatTermsWithParentAndChildren, 'parent');
31
-
32
- if (termsByParent.null && termsByParent.null.length) {
24
+ const flatTermsWithParentAndChildren = flatTerms.map(term => ({
25
+ children: [],
26
+ parent: null,
27
+ ...term,
28
+ id: String(term.id)
29
+ })); // We use a custom type guard here to ensure that the parent property is
30
+ // defined on all terms. The type of the `parent` property is `number | null`
31
+ // and we need to ensure that it is `number`. This is because we use the
32
+ // `parent` property as a key in the `termsByParent` object.
33
+
34
+ if (!ensureParentsAreDefined(flatTermsWithParentAndChildren)) {
33
35
  return flatTermsWithParentAndChildren;
34
36
  }
35
37
 
38
+ const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
39
+ const {
40
+ parent
41
+ } = term;
42
+
43
+ if (!acc[parent]) {
44
+ acc[parent] = [];
45
+ }
46
+
47
+ acc[parent].push(term);
48
+ return acc;
49
+ }, {});
50
+
36
51
  const fillWithChildren = terms => {
37
52
  return terms.map(term => {
38
53
  const children = termsByParent[term.id];
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/query-controls/terms.ts"],"names":["buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","id","String","termsByParent","null","length","fillWithChildren","terms"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAAyBC,SAAzB,EAAuE;AAC7E,QAAMC,8BAA2D,GAChED,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AAC1B,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF,IAHG;AAING,MAAAA,EAAE,EAAEC,MAAM,CAAEJ,IAAI,CAACG,EAAP;AAJJ,KAAP;AAMA,GAPD,CADD;AAUA,QAAME,aAA4B,GAAG,qBACpCP,8BADoC,EAEpC,QAFoC,CAArC;;AAIA,MAAKO,aAAa,CAACC,IAAd,IAAsBD,aAAa,CAACC,IAAd,CAAmBC,MAA9C,EAAuD;AACtD,WAAOT,8BAAP;AACA;;AACD,QAAMU,gBAAgB,GACrBC,KADwB,IAES;AACjC,WAAOA,KAAK,CAACV,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGI,aAAa,CAAEL,IAAI,CAACG,EAAP,CAA9B;AACA,aAAO,EACN,GAAGH,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACM,MAArB,GACGC,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAbD;;AAeA,SAAOO,gBAAgB,CAAEH,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { groupBy } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tAuthor,\n\tCategory,\n\tTermWithParentAndChildren,\n\tTermsByParent,\n} from './types';\n\n/**\n * Returns terms in a tree form.\n *\n * @param flatTerms Array of terms in flat format.\n *\n * @return Terms in tree format.\n */\nexport function buildTermsTree( flatTerms: readonly ( Author | Category )[] ) {\n\tconst flatTermsWithParentAndChildren: TermWithParentAndChildren[] =\n\t\tflatTerms.map( ( term ) => {\n\t\t\treturn {\n\t\t\t\tchildren: [],\n\t\t\t\tparent: null,\n\t\t\t\t...term,\n\t\t\t\tid: String( term.id ),\n\t\t\t};\n\t\t} );\n\n\tconst termsByParent: TermsByParent = groupBy(\n\t\tflatTermsWithParentAndChildren,\n\t\t'parent'\n\t);\n\tif ( termsByParent.null && termsByParent.null.length ) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\tconst fillWithChildren = (\n\t\tterms: TermWithParentAndChildren[]\n\t): TermWithParentAndChildren[] => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/query-controls/terms.ts"],"names":["ensureParentsAreDefined","terms","every","term","parent","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","children","id","String","termsByParent","reduce","acc","push","fillWithChildren","length"],"mappings":";;;;;;;AAAA;AACA;AACA;AAQA,MAAMA,uBAAuB,GAC5BC,KAD+B,IAEoC;AACnE,SAAOA,KAAK,CAACC,KAAN,CAAeC,IAAF,IAAYA,IAAI,CAACC,MAAL,KAAgB,IAAzC,CAAP;AACA,CAJD;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CAAyBC,SAAzB,EAAuE;AAC7E,QAAMC,8BAA2D,GAChED,SAAS,CAACE,GAAV,CAAiBL,IAAF,KAAc;AAC5BM,IAAAA,QAAQ,EAAE,EADkB;AAE5BL,IAAAA,MAAM,EAAE,IAFoB;AAG5B,OAAGD,IAHyB;AAI5BO,IAAAA,EAAE,EAAEC,MAAM,CAAER,IAAI,CAACO,EAAP;AAJkB,GAAd,CAAf,CADD,CAD6E,CAS7E;AACA;AACA;AACA;;AACA,MAAK,CAAEV,uBAAuB,CAAEO,8BAAF,CAA9B,EAAmE;AAClE,WAAOA,8BAAP;AACA;;AAED,QAAMK,aAAa,GAAGL,8BAA8B,CAACM,MAA/B,CACrB,CAAEC,GAAF,EAAsBX,IAAtB,KAAgC;AAC/B,UAAM;AAAEC,MAAAA;AAAF,QAAaD,IAAnB;;AACA,QAAK,CAAEW,GAAG,CAAEV,MAAF,CAAV,EAAuB;AACtBU,MAAAA,GAAG,CAAEV,MAAF,CAAH,GAAgB,EAAhB;AACA;;AACDU,IAAAA,GAAG,CAAEV,MAAF,CAAH,CAAcW,IAAd,CAAoBZ,IAApB;AACA,WAAOW,GAAP;AACA,GARoB,EASrB,EATqB,CAAtB;;AAYA,QAAME,gBAAgB,GACrBf,KADwB,IAES;AACjC,WAAOA,KAAK,CAACO,GAAN,CAAaL,IAAF,IAAY;AAC7B,YAAMM,QAAQ,GAAGG,aAAa,CAAET,IAAI,CAACO,EAAP,CAA9B;AACA,aAAO,EACN,GAAGP,IADG;AAENM,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACQ,MAArB,GACGD,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAbD;;AAeA,SAAOO,gBAAgB,CAAEJ,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport type {\n\tAuthor,\n\tCategory,\n\tTermWithParentAndChildren,\n\tTermsByParent,\n} from './types';\n\nconst ensureParentsAreDefined = (\n\tterms: TermWithParentAndChildren[]\n): terms is ( TermWithParentAndChildren & { parent: number } )[] => {\n\treturn terms.every( ( term ) => term.parent !== null );\n};\n/**\n * Returns terms in a tree form.\n *\n * @param flatTerms Array of terms in flat format.\n *\n * @return Terms in tree format.\n */\nexport function buildTermsTree( flatTerms: readonly ( Author | Category )[] ) {\n\tconst flatTermsWithParentAndChildren: TermWithParentAndChildren[] =\n\t\tflatTerms.map( ( term ) => ( {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t\tid: String( term.id ),\n\t\t} ) );\n\n\t// We use a custom type guard here to ensure that the parent property is\n\t// defined on all terms. The type of the `parent` property is `number | null`\n\t// and we need to ensure that it is `number`. This is because we use the\n\t// `parent` property as a key in the `termsByParent` object.\n\tif ( ! ensureParentsAreDefined( flatTermsWithParentAndChildren ) ) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\n\tconst termsByParent = flatTermsWithParentAndChildren.reduce(\n\t\t( acc: TermsByParent, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\n\tconst fillWithChildren = (\n\t\tterms: TermWithParentAndChildren[]\n\t): TermWithParentAndChildren[] => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/range-control/index.tsx"],"names":["noop","UnforwardedRangeControl","props","forwardedRef","__nextHasNoMarginBottom","afterIcon","allowReset","beforeIcon","className","color","colorProp","COLORS","ui","theme","currentInput","disabled","help","hideLabelFromVision","initialPosition","isShiftStepEnabled","label","marks","max","min","onBlur","onChange","onFocus","onMouseLeave","onMouseMove","railColor","renderTooltipContent","v","resetFallbackValue","shiftStep","showTooltip","showTooltipProp","step","trackColor","value","valueProp","withInputField","otherProps","setValue","initial","isResetPendent","hasTooltip","hasInputField","setShowTooltip","isFocused","setIsFocused","inputRef","isCurrentlyFocused","current","matches","isThumbFocused","isValueReset","currentValue","undefined","inputSliderValue","rangeFillValue","fillValue","fillValueOffset","classes","wrapperClasses","id","describedBy","enableTooltip","Number","isFinite","handleOnRangeChange","event","nextValue","parseFloat","target","handleOnChange","next","isNaN","handleOnInputNumberBlur","handleOnReset","resetValue","onChangeResetValue","handleShowTooltip","handleHideTooltip","hand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,GANP;AAOC,IAAA,GAAG,EAAGC,GAPP;AAQC,IAAA,MAAM,EAAGsD,uBARV;AASC,IAAA,QAAQ,EAAGH,cATZ;AAUC,IAAA,SAAS,EAAGzC,SAVb;AAWC,IAAA,IAAI,EAAGG,IAXR,CAYC;AAZD;AAaC,IAAA,KAAK,EAAGsB;AAbT,IA5EF,EA4FGpD,UAAU,IACX,4BAAC,sCAAD,QACC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,QAAQ,EAAGS,QAAQ,IAAIuB,KAAK,KAAKmB,SAFlC;AAGC,IAAA,OAAO,EAAC,WAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,OAAO,EAAGqB;AALX,KAOG,cAAI,OAAJ,CAPH,CADD,CA7FF,CARD,CADD;AAqHA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMS,YAAY,GAAG,yBAAYtF,uBAAZ,CAArB;;eAEQsF,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport {\n\tActionRightWrapper,\n\tAfterIconWrapper,\n\tBeforeIconWrapper,\n\tInputNumber,\n\tRoot,\n\tTrack,\n\tThumbWrapper,\n\tThumb,\n\tWrapper,\n} from './styles/range-control-styles';\n\nimport type { RangeControlProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst noop = () => {};\n\nfunction UnforwardedRangeControl< IconProps = unknown >(\n\tprops: WordPressComponentProps<\n\t\tRangeControlProps< IconProps >,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tafterIcon,\n\t\tallowReset = false,\n\t\tbeforeIcon,\n\t\tclassName,\n\t\tcolor: colorProp = COLORS.ui.theme,\n\t\tcurrentInput,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tinitialPosition,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmarks = false,\n\t\tmax = 100,\n\t\tmin = 0,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\tonMouseLeave = noop,\n\t\tonMouseMove = noop,\n\t\trailColor,\n\t\trenderTooltipContent = ( v ) => v,\n\t\tresetFallbackValue,\n\t\tshiftStep = 10,\n\t\tshowTooltip: showTooltipProp,\n\t\tstep = 1,\n\t\ttrackColor,\n\t\tvalue: valueProp,\n\t\twithInputField = true,\n\t\t...otherProps\n\t} = props;\n\n\tconst [ value, setValue ] = useControlledRangeValue( {\n\t\tmin,\n\t\tmax,\n\t\tvalue: valueProp ?? null,\n\t\tinitial: initialPosition,\n\t} );\n\tconst isResetPendent = useRef( false );\n\n\tlet hasTooltip = showTooltipProp;\n\tlet hasInputField = withInputField;\n\n\tif ( step === 'any' ) {\n\t\t// The tooltip and number input field are hidden when the step is \"any\"\n\t\t// because the decimals get too lengthy to fit well.\n\t\thasTooltip = false;\n\t\thasInputField = false;\n\t}\n\n\tconst [ showTooltip, setShowTooltip ] = useState( hasTooltip );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst isCurrentlyFocused = inputRef.current?.matches( ':focus' );\n\tconst isThumbFocused = ! disabled && isFocused;\n\n\tconst isValueReset = value === null;\n\tconst currentValue = value !== undefined ? value : currentInput;\n\n\tconst inputSliderValue = isValueReset ? '' : currentValue;\n\tconst rangeFillValue = isValueReset ? ( max - min ) / 2 + min : value;\n\n\tconst fillValue = isValueReset\n\t\t? 50\n\t\t: ( ( value - min ) / ( max - min ) ) * 100;\n\tconst fillValueOffset = `${ clamp( fillValue, 0, 100 ) }%`;\n\n\tconst classes = classnames( 'components-range-control', className );\n\n\tconst wrapperClasses = classnames(\n\t\t'components-range-control__wrapper',\n\t\t!! marks && 'is-marked'\n\t);\n\n\tconst id = useInstanceId(\n\t\tUnforwardedRangeControl,\n\t\t'inspector-range-control'\n\t);\n\tconst describedBy = !! help ? `${ id }__help` : undefined;\n\tconst enableTooltip = hasTooltip !== false && Number.isFinite( value );\n\n\tconst handleOnRangeChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = parseFloat( event.target.value );\n\t\tsetValue( nextValue );\n\t\tonChange( nextValue );\n\t};\n\n\tconst handleOnChange = ( next?: string ) => {\n\t\t// @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n\t\t// potentially receive a NaN when next is undefined.\n\t\tlet nextValue = parseFloat( next );\n\t\tsetValue( nextValue );\n\n\t\t/*\n\t\t * Calls onChange only when nextValue is numeric\n\t\t * otherwise may queue a reset for the blur event.\n\t\t */\n\t\tif ( ! isNaN( nextValue ) ) {\n\t\t\tif ( nextValue < min || nextValue > max ) {\n\t\t\t\tnextValue = floatClamp( nextValue, min, max ) as number;\n\t\t\t}\n\n\t\t\tonChange( nextValue );\n\t\t\tisResetPendent.current = false;\n\t\t} else if ( allowReset ) {\n\t\t\tisResetPendent.current = true;\n\t\t}\n\t};\n\n\tconst handleOnInputNumberBlur = () => {\n\t\tif ( isResetPendent.current ) {\n\t\t\thandleOnReset();\n\t\t\tisResetPendent.current = false;\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tlet resetValue: number | null = parseFloat( `${ resetFallbackValue }` );\n\t\tlet onChangeResetValue: number | undefined = resetValue;\n\n\t\tif ( isNaN( resetValue ) ) {\n\t\t\tresetValue = null;\n\t\t\tonChangeResetValue = undefined;\n\t\t}\n\n\t\tsetValue( resetValue );\n\n\t\t/**\n\t\t * Previously, this callback would always receive undefined as\n\t\t * an argument. This behavior is unexpected, specifically\n\t\t * when resetFallbackValue is defined.\n\t\t *\n\t\t * The value of undefined is not ideal. Passing it through\n\t\t * to internal <input /> elements would change it from a\n\t\t * controlled component to an uncontrolled component.\n\t\t *\n\t\t * For now, to minimize unexpected regressions, we're going to\n\t\t * preserve the undefined callback argument, except when a\n\t\t * resetFallbackValue is defined.\n\t\t */\n\t\tonChange( onChangeResetValue );\n\t};\n\n\tconst handleShowTooltip = () => setShowTooltip( true );\n\tconst handleHideTooltip = () => setShowTooltip( false );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t\thandleHideTooltip();\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t\thandleShowTooltip();\n\t};\n\n\tconst offsetStyle = {\n\t\t[ isRTL() ? 'right' : 'left' ]: fillValueOffset,\n\t};\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ `${ id }` }\n\t\t\thelp={ help }\n\t\t>\n\t\t\t<Root className=\"components-range-control__root\">\n\t\t\t\t{ beforeIcon && (\n\t\t\t\t\t<BeforeIconWrapper>\n\t\t\t\t\t\t<Icon icon={ beforeIcon } />\n\t\t\t\t\t</BeforeIconWrapper>\n\t\t\t\t) }\n\t\t\t\t<Wrapper\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\t\tcolor={ colorProp }\n\t\t\t\t\tmarks={ !! marks }\n\t\t\t\t>\n\t\t\t\t\t<InputRange\n\t\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t\tclassName=\"components-range-control__slider\"\n\t\t\t\t\t\tdescribedBy={ describedBy }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tid={ `${ id }` }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\t\tonChange={ handleOnRangeChange }\n\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\tonMouseMove={ onMouseMove }\n\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\tref={ useMergeRefs( [ inputRef, forwardedRef ] ) }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue ?? undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeRail\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tmarks={ marks }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\trailColor={ railColor }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ rangeFillValue }\n\t\t\t\t\t/>\n\t\t\t\t\t<Track\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tclassName=\"components-range-control__track\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tstyle={ { width: fillValueOffset } }\n\t\t\t\t\t\ttrackColor={ trackColor }\n\t\t\t\t\t/>\n\t\t\t\t\t<ThumbWrapper\n\t\t\t\t\t\tclassName=\"components-range-control__thumb-wrapper\"\n\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Thumb\n\t\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\t\tisFocused={ isThumbFocused }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ThumbWrapper>\n\t\t\t\t\t{ enableTooltip && (\n\t\t\t\t\t\t<SimpleTooltip\n\t\t\t\t\t\t\tclassName=\"components-range-control__tooltip\"\n\t\t\t\t\t\t\tinputRef={ inputRef }\n\t\t\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\t\t\t\tshow={ isCurrentlyFocused || showTooltip }\n\t\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Wrapper>\n\t\t\t\t{ afterIcon && (\n\t\t\t\t\t<AfterIconWrapper>\n\t\t\t\t\t\t<Icon icon={ afterIcon } />\n\t\t\t\t\t</AfterIconWrapper>\n\t\t\t\t) }\n\t\t\t\t{ hasInputField && (\n\t\t\t\t\t<InputNumber\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tclassName=\"components-range-control__number\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tinputMode=\"decimal\"\n\t\t\t\t\t\tisShiftStepEnabled={ isShiftStepEnabled }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnInputNumberBlur }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tshiftStep={ shiftStep }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if the `null` value is necessary\n\t\t\t\t\t\tvalue={ inputSliderValue }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<ActionRightWrapper>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-range-control__reset\"\n\t\t\t\t\t\t\tdisabled={ disabled || value === undefined }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ActionRightWrapper>\n\t\t\t\t) }\n\t\t\t</Root>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ isChecked, setChecked ] = useState( true );\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={50}\n * label=\"Opacity\"\n * max={100}\n * min={0}\n * onChange={() => {}}\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef( UnforwardedRangeControl );\n\nexport default RangeControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/range-control/index.tsx"],"names":["noop","UnforwardedRangeControl","props","forwardedRef","__nextHasNoMarginBottom","afterIcon","allowReset","beforeIcon","className","color","colorProp","COLORS","ui","theme","currentInput","disabled","help","hideLabelFromVision","initialPosition","isShiftStepEnabled","label","marks","max","min","onBlur","onChange","onFocus","onMouseLeave","onMouseMove","railColor","renderTooltipContent","v","resetFallbackValue","shiftStep","showTooltip","showTooltipProp","step","trackColor","value","valueProp","withInputField","otherProps","setValue","initial","isResetPendent","hasTooltip","hasInputField","setShowTooltip","isFocused","setIsFocused","inputRef","isCurrentlyFocused","current","matches","isThumbFocused","isValueReset","currentValue","undefined","inputSliderValue","rangeFillValue","fillValue","fillValueOffset","classes","wrapperClasses","id","describedBy","enableTooltip","Number","isFinite","handleOnRangeChange","event","nextValue","parseFloat","target","handleOnChange","next","isNaN","handleOnInputNumberBlur","handleOnReset","resetValue","onChangeResetValue","handle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C,IAAA,GAAG,EAAGG,GANP;AAOC,IAAA,GAAG,EAAGC,GAPP;AAQC,IAAA,MAAM,EAAGsD,uBARV;AASC,IAAA,QAAQ,EAAGH,cATZ;AAUC,IAAA,SAAS,EAAGzC,SAVb;AAWC,IAAA,IAAI,EAAGG,IAXR,CAYC;AAZD;AAaC,IAAA,KAAK,EAAGsB;AAbT,IA5EF,EA4FGpD,UAAU,IACX,4BAAC,sCAAD,QACC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,QAAQ,EAAGS,QAAQ,IAAIuB,KAAK,KAAKmB,SAFlC;AAGC,IAAA,OAAO,EAAC,WAHT;AAIC,IAAA,OAAO,MAJR;AAKC,IAAA,OAAO,EAAGqB;AALX,KAOG,cAAI,OAAJ,CAPH,CADD,CA7FF,CARD,CADD;AAqHA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMS,YAAY,GAAG,yBAAYtF,uBAAZ,CAArB;;eAEQsF,Y","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useRef, useState, forwardRef } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport Icon from '../icon';\nimport { COLORS } from '../utils';\nimport { floatClamp, useControlledRangeValue } from './utils';\nimport { clamp } from '../utils/math';\nimport InputRange from './input-range';\nimport RangeRail from './rail';\nimport SimpleTooltip from './tooltip';\nimport {\n\tActionRightWrapper,\n\tAfterIconWrapper,\n\tBeforeIconWrapper,\n\tInputNumber,\n\tRoot,\n\tTrack,\n\tThumbWrapper,\n\tThumb,\n\tWrapper,\n} from './styles/range-control-styles';\n\nimport type { RangeControlProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst noop = () => {};\n\nfunction UnforwardedRangeControl(\n\tprops: WordPressComponentProps< RangeControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tafterIcon,\n\t\tallowReset = false,\n\t\tbeforeIcon,\n\t\tclassName,\n\t\tcolor: colorProp = COLORS.ui.theme,\n\t\tcurrentInput,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision = false,\n\t\tinitialPosition,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmarks = false,\n\t\tmax = 100,\n\t\tmin = 0,\n\t\tonBlur = noop,\n\t\tonChange = noop,\n\t\tonFocus = noop,\n\t\tonMouseLeave = noop,\n\t\tonMouseMove = noop,\n\t\trailColor,\n\t\trenderTooltipContent = ( v ) => v,\n\t\tresetFallbackValue,\n\t\tshiftStep = 10,\n\t\tshowTooltip: showTooltipProp,\n\t\tstep = 1,\n\t\ttrackColor,\n\t\tvalue: valueProp,\n\t\twithInputField = true,\n\t\t...otherProps\n\t} = props;\n\n\tconst [ value, setValue ] = useControlledRangeValue( {\n\t\tmin,\n\t\tmax,\n\t\tvalue: valueProp ?? null,\n\t\tinitial: initialPosition,\n\t} );\n\tconst isResetPendent = useRef( false );\n\n\tlet hasTooltip = showTooltipProp;\n\tlet hasInputField = withInputField;\n\n\tif ( step === 'any' ) {\n\t\t// The tooltip and number input field are hidden when the step is \"any\"\n\t\t// because the decimals get too lengthy to fit well.\n\t\thasTooltip = false;\n\t\thasInputField = false;\n\t}\n\n\tconst [ showTooltip, setShowTooltip ] = useState( hasTooltip );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst isCurrentlyFocused = inputRef.current?.matches( ':focus' );\n\tconst isThumbFocused = ! disabled && isFocused;\n\n\tconst isValueReset = value === null;\n\tconst currentValue = value !== undefined ? value : currentInput;\n\n\tconst inputSliderValue = isValueReset ? '' : currentValue;\n\tconst rangeFillValue = isValueReset ? ( max - min ) / 2 + min : value;\n\n\tconst fillValue = isValueReset\n\t\t? 50\n\t\t: ( ( value - min ) / ( max - min ) ) * 100;\n\tconst fillValueOffset = `${ clamp( fillValue, 0, 100 ) }%`;\n\n\tconst classes = classnames( 'components-range-control', className );\n\n\tconst wrapperClasses = classnames(\n\t\t'components-range-control__wrapper',\n\t\t!! marks && 'is-marked'\n\t);\n\n\tconst id = useInstanceId(\n\t\tUnforwardedRangeControl,\n\t\t'inspector-range-control'\n\t);\n\tconst describedBy = !! help ? `${ id }__help` : undefined;\n\tconst enableTooltip = hasTooltip !== false && Number.isFinite( value );\n\n\tconst handleOnRangeChange = ( event: ChangeEvent< HTMLInputElement > ) => {\n\t\tconst nextValue = parseFloat( event.target.value );\n\t\tsetValue( nextValue );\n\t\tonChange( nextValue );\n\t};\n\n\tconst handleOnChange = ( next?: string ) => {\n\t\t// @ts-expect-error TODO: Investigate if it's problematic for setValue() to\n\t\t// potentially receive a NaN when next is undefined.\n\t\tlet nextValue = parseFloat( next );\n\t\tsetValue( nextValue );\n\n\t\t/*\n\t\t * Calls onChange only when nextValue is numeric\n\t\t * otherwise may queue a reset for the blur event.\n\t\t */\n\t\tif ( ! isNaN( nextValue ) ) {\n\t\t\tif ( nextValue < min || nextValue > max ) {\n\t\t\t\tnextValue = floatClamp( nextValue, min, max ) as number;\n\t\t\t}\n\n\t\t\tonChange( nextValue );\n\t\t\tisResetPendent.current = false;\n\t\t} else if ( allowReset ) {\n\t\t\tisResetPendent.current = true;\n\t\t}\n\t};\n\n\tconst handleOnInputNumberBlur = () => {\n\t\tif ( isResetPendent.current ) {\n\t\t\thandleOnReset();\n\t\t\tisResetPendent.current = false;\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tlet resetValue: number | null = parseFloat( `${ resetFallbackValue }` );\n\t\tlet onChangeResetValue: number | undefined = resetValue;\n\n\t\tif ( isNaN( resetValue ) ) {\n\t\t\tresetValue = null;\n\t\t\tonChangeResetValue = undefined;\n\t\t}\n\n\t\tsetValue( resetValue );\n\n\t\t/**\n\t\t * Previously, this callback would always receive undefined as\n\t\t * an argument. This behavior is unexpected, specifically\n\t\t * when resetFallbackValue is defined.\n\t\t *\n\t\t * The value of undefined is not ideal. Passing it through\n\t\t * to internal <input /> elements would change it from a\n\t\t * controlled component to an uncontrolled component.\n\t\t *\n\t\t * For now, to minimize unexpected regressions, we're going to\n\t\t * preserve the undefined callback argument, except when a\n\t\t * resetFallbackValue is defined.\n\t\t */\n\t\tonChange( onChangeResetValue );\n\t};\n\n\tconst handleShowTooltip = () => setShowTooltip( true );\n\tconst handleHideTooltip = () => setShowTooltip( false );\n\n\tconst handleOnBlur = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonBlur( event );\n\t\tsetIsFocused( false );\n\t\thandleHideTooltip();\n\t};\n\n\tconst handleOnFocus = ( event: FocusEvent< HTMLInputElement > ) => {\n\t\tonFocus( event );\n\t\tsetIsFocused( true );\n\t\thandleShowTooltip();\n\t};\n\n\tconst offsetStyle = {\n\t\t[ isRTL() ? 'right' : 'left' ]: fillValueOffset,\n\t};\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ `${ id }` }\n\t\t\thelp={ help }\n\t\t>\n\t\t\t<Root className=\"components-range-control__root\">\n\t\t\t\t{ beforeIcon && (\n\t\t\t\t\t<BeforeIconWrapper>\n\t\t\t\t\t\t<Icon icon={ beforeIcon } />\n\t\t\t\t\t</BeforeIconWrapper>\n\t\t\t\t) }\n\t\t\t\t<Wrapper\n\t\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\t\tclassName={ wrapperClasses }\n\t\t\t\t\tcolor={ colorProp }\n\t\t\t\t\tmarks={ !! marks }\n\t\t\t\t>\n\t\t\t\t\t<InputRange\n\t\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\t\tclassName=\"components-range-control__slider\"\n\t\t\t\t\t\tdescribedBy={ describedBy }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tid={ `${ id }` }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\t\tonChange={ handleOnRangeChange }\n\t\t\t\t\t\tonFocus={ handleOnFocus }\n\t\t\t\t\t\tonMouseMove={ onMouseMove }\n\t\t\t\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\t\t\t\tref={ useMergeRefs( [ inputRef, forwardedRef ] ) }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ inputSliderValue ?? undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<RangeRail\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tmarks={ marks }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\trailColor={ railColor }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\tvalue={ rangeFillValue }\n\t\t\t\t\t/>\n\t\t\t\t\t<Track\n\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\tclassName=\"components-range-control__track\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tstyle={ { width: fillValueOffset } }\n\t\t\t\t\t\ttrackColor={ trackColor }\n\t\t\t\t\t/>\n\t\t\t\t\t<ThumbWrapper\n\t\t\t\t\t\tclassName=\"components-range-control__thumb-wrapper\"\n\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Thumb\n\t\t\t\t\t\t\taria-hidden={ true }\n\t\t\t\t\t\t\tisFocused={ isThumbFocused }\n\t\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ThumbWrapper>\n\t\t\t\t\t{ enableTooltip && (\n\t\t\t\t\t\t<SimpleTooltip\n\t\t\t\t\t\t\tclassName=\"components-range-control__tooltip\"\n\t\t\t\t\t\t\tinputRef={ inputRef }\n\t\t\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\t\t\t\tshow={ isCurrentlyFocused || showTooltip }\n\t\t\t\t\t\t\tstyle={ offsetStyle }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Wrapper>\n\t\t\t\t{ afterIcon && (\n\t\t\t\t\t<AfterIconWrapper>\n\t\t\t\t\t\t<Icon icon={ afterIcon } />\n\t\t\t\t\t</AfterIconWrapper>\n\t\t\t\t) }\n\t\t\t\t{ hasInputField && (\n\t\t\t\t\t<InputNumber\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\tclassName=\"components-range-control__number\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t\tinputMode=\"decimal\"\n\t\t\t\t\t\tisShiftStepEnabled={ isShiftStepEnabled }\n\t\t\t\t\t\tmax={ max }\n\t\t\t\t\t\tmin={ min }\n\t\t\t\t\t\tonBlur={ handleOnInputNumberBlur }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tshiftStep={ shiftStep }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if the `null` value is necessary\n\t\t\t\t\t\tvalue={ inputSliderValue }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowReset && (\n\t\t\t\t\t<ActionRightWrapper>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"components-range-control__reset\"\n\t\t\t\t\t\t\tdisabled={ disabled || value === undefined }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ActionRightWrapper>\n\t\t\t\t) }\n\t\t\t</Root>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * RangeControls are used to make selections from a range of incremental values.\n *\n * ```jsx\n * import { RangeControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyRangeControl = () => {\n * const [ isChecked, setChecked ] = useState( true );\n * return (\n * <RangeControl\n * help=\"Please select how transparent you would like this.\"\n * initialPosition={50}\n * label=\"Opacity\"\n * max={100}\n * min={0}\n * onChange={() => {}}\n * />\n * );\n * };\n * ```\n */\nexport const RangeControl = forwardRef( UnforwardedRangeControl );\n\nexport default RangeControl;\n"]}