@wordpress/components 28.8.6 → 28.10.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 (894) hide show
  1. package/CHANGELOG.md +44 -5
  2. package/build/alignment-matrix-control/icon.js.map +1 -1
  3. package/build/alignment-matrix-control/types.js.map +1 -1
  4. package/build/alignment-matrix-control/utils.js.map +1 -1
  5. package/build/angle-picker-control/angle-circle.js.map +1 -1
  6. package/build/autocomplete/autocompleter-ui.js +3 -3
  7. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  8. package/build/autocomplete/get-default-use-items.js.map +1 -1
  9. package/build/autocomplete/index.js +5 -1
  10. package/build/autocomplete/index.js.map +1 -1
  11. package/build/base-control/hooks.js.map +1 -1
  12. package/build/base-control/index.js.map +1 -1
  13. package/build/border-box-control/border-box-control/component.js +3 -14
  14. package/build/border-box-control/border-box-control/component.js.map +1 -1
  15. package/build/border-box-control/border-box-control/hook.js.map +1 -1
  16. package/build/border-box-control/styles.js.map +1 -1
  17. package/build/border-box-control/utils.js.map +1 -1
  18. package/build/border-control/border-control/component.js +1 -2
  19. package/build/border-control/border-control/component.js.map +1 -1
  20. package/build/border-control/border-control/hook.js.map +1 -1
  21. package/build/border-control/border-control-dropdown/component.js +2 -14
  22. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  23. package/build/border-control/styles.js +13 -13
  24. package/build/border-control/styles.js.map +1 -1
  25. package/build/border-control/types.js.map +1 -1
  26. package/build/box-control/axial-input-controls.js.map +1 -1
  27. package/build/box-control/icon.js.map +1 -1
  28. package/build/box-control/index.js +4 -4
  29. package/build/box-control/index.js.map +1 -1
  30. package/build/box-control/input-controls.js.map +1 -1
  31. package/build/box-control/types.js.map +1 -1
  32. package/build/button/index.native.js +1 -1
  33. package/build/button/index.native.js.map +1 -1
  34. package/build/card/card/component.js +1 -1
  35. package/build/card/card/component.js.map +1 -1
  36. package/build/card/styles.js.map +1 -1
  37. package/build/color-palette/index.js.map +1 -1
  38. package/build/color-palette/index.native.js +2 -1
  39. package/build/color-palette/index.native.js.map +1 -1
  40. package/build/color-picker/styles.js.map +1 -1
  41. package/build/combobox-control/index.js +1 -1
  42. package/build/combobox-control/index.js.map +1 -1
  43. package/build/composite/legacy/index.js.map +1 -1
  44. package/build/context/context-connect.js +1 -0
  45. package/build/context/context-connect.js.map +1 -1
  46. package/build/context/context-system-provider.js +1 -1
  47. package/build/context/context-system-provider.js.map +1 -1
  48. package/build/context/get-styled-class-name-from-key.js.map +1 -1
  49. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  50. package/build/custom-gradient-picker/index.js.map +1 -1
  51. package/build/custom-gradient-picker/serializer.js.map +1 -1
  52. package/build/custom-gradient-picker/utils.js.map +1 -1
  53. package/build/custom-select-control-v2/styles.js.map +1 -1
  54. package/build/dashicon/index.js.map +1 -1
  55. package/build/date-time/date/styles.js.map +1 -1
  56. package/build/date-time/time/timezone.js.map +1 -1
  57. package/build/draggable/index.js.map +1 -1
  58. package/build/drop-zone/index.js.map +1 -1
  59. package/build/dropdown-menu-v2/styles.js.map +1 -1
  60. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  61. package/build/duotone-picker/utils.js.map +1 -1
  62. package/build/elevation/hook.js.map +1 -1
  63. package/build/external-link/index.js +20 -23
  64. package/build/external-link/index.js.map +1 -1
  65. package/build/focal-point-picker/index.js.map +1 -1
  66. package/build/focal-point-picker/index.native.js.map +1 -1
  67. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  68. package/build/font-size-picker/index.js.map +1 -1
  69. package/build/form-token-field/index.js +2 -1
  70. package/build/form-token-field/index.js.map +1 -1
  71. package/build/form-token-field/suggestions-list.js.map +1 -1
  72. package/build/form-token-field/token-input.js.map +1 -1
  73. package/build/form-token-field/token.js +1 -1
  74. package/build/form-token-field/token.js.map +1 -1
  75. package/build/gradient-picker/index.js.map +1 -1
  76. package/build/grid/hook.js.map +1 -1
  77. package/build/guide/page-control.js +1 -1
  78. package/build/guide/page-control.js.map +1 -1
  79. package/build/h-stack/hook.js.map +1 -1
  80. package/build/heading/hook.js.map +1 -1
  81. package/build/index.js +36 -5
  82. package/build/index.js.map +1 -1
  83. package/build/input-control/index.js.map +1 -1
  84. package/build/input-control/input-base.js.map +1 -1
  85. package/build/input-control/styles/input-control-styles.js.map +1 -1
  86. package/build/item-group/styles.js.map +1 -1
  87. package/build/menu-group/index.js.map +1 -1
  88. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  89. package/build/mobile/bottom-sheet/cell.native.js +4 -4
  90. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  91. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  92. package/build/mobile/bottom-sheet/range-cell.native.js +1 -1
  93. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  94. package/build/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
  95. package/build/mobile/bottom-sheet/stepper-cell/index.native.js +1 -1
  96. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  97. package/build/mobile/bottom-sheet/switch-cell.native.js +4 -4
  98. package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  99. package/build/mobile/cycle-select-control/index.native.js.map +1 -1
  100. package/build/mobile/gradient/index.native.js.map +1 -1
  101. package/build/mobile/image/index.native.js.map +1 -1
  102. package/build/mobile/link-picker/index.native.js +1 -1
  103. package/build/mobile/link-picker/index.native.js.map +1 -1
  104. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  105. package/build/mobile/picker/index.android.js.map +1 -1
  106. package/build/mobile/segmented-control/index.native.js.map +1 -1
  107. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  108. package/build/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  109. package/build/modal/aria-helper.js +2 -1
  110. package/build/modal/aria-helper.js.map +1 -1
  111. package/build/modal/index.js +2 -1
  112. package/build/modal/index.js.map +1 -1
  113. package/build/modal/use-modal-exit-animation.js.map +1 -1
  114. package/build/navigation/group/index.js.map +1 -1
  115. package/build/navigation/item/base.js.map +1 -1
  116. package/build/navigation/menu/index.js.map +1 -1
  117. package/build/navigation/menu/menu-title-search.js +2 -2
  118. package/build/navigation/menu/menu-title-search.js.map +1 -1
  119. package/build/navigation/menu/menu-title.js.map +1 -1
  120. package/build/navigation/styles/navigation-styles.js.map +1 -1
  121. package/build/navigator/index.js +128 -32
  122. package/build/navigator/index.js.map +1 -1
  123. package/build/navigator/legacy.js +179 -0
  124. package/build/navigator/legacy.js.map +1 -0
  125. package/build/navigator/{navigator-provider → navigator}/component.js +5 -40
  126. package/build/navigator/navigator/component.js.map +1 -0
  127. package/build/navigator/navigator-back-button/component.js +2 -38
  128. package/build/navigator/navigator-back-button/component.js.map +1 -1
  129. package/build/navigator/navigator-back-button/hook.js +1 -1
  130. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  131. package/build/navigator/navigator-button/component.js +2 -37
  132. package/build/navigator/navigator-button/component.js.map +1 -1
  133. package/build/navigator/navigator-button/hook.js +1 -1
  134. package/build/navigator/navigator-button/hook.js.map +1 -1
  135. package/build/navigator/navigator-screen/component.js +40 -62
  136. package/build/navigator/navigator-screen/component.js.map +1 -1
  137. package/build/navigator/navigator-screen/use-screen-animate-presence.js +114 -0
  138. package/build/navigator/navigator-screen/use-screen-animate-presence.js.map +1 -0
  139. package/build/navigator/navigator-to-parent-button/component.js +3 -7
  140. package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
  141. package/build/navigator/styles.js +78 -35
  142. package/build/navigator/styles.js.map +1 -1
  143. package/build/navigator/types.js.map +1 -1
  144. package/build/navigator/use-navigator.js +4 -1
  145. package/build/navigator/use-navigator.js.map +1 -1
  146. package/build/number-control/styles/number-control-styles.js.map +1 -1
  147. package/build/palette-edit/index.js +1 -1
  148. package/build/palette-edit/index.js.map +1 -1
  149. package/build/popover/index.js +1 -1
  150. package/build/popover/index.js.map +1 -1
  151. package/build/popover/overlay-middlewares.js.map +1 -1
  152. package/build/popover/utils.js.map +1 -1
  153. package/build/progress-bar/index.js.map +1 -1
  154. package/build/progress-bar/styles.js.map +1 -1
  155. package/build/query-controls/index.js.map +1 -1
  156. package/build/query-controls/index.native.js.map +1 -1
  157. package/build/radio-control/index.js.map +1 -1
  158. package/build/radio-control/index.native.js.map +1 -1
  159. package/build/range-control/index.js.map +1 -1
  160. package/build/range-control/index.native.js.map +1 -1
  161. package/build/range-control/rail.js.map +1 -1
  162. package/build/range-control/styles/range-control-styles.js +32 -32
  163. package/build/range-control/styles/range-control-styles.js.map +1 -1
  164. package/build/range-control/tooltip.js +1 -1
  165. package/build/range-control/tooltip.js.map +1 -1
  166. package/build/range-control/utils.js.map +1 -1
  167. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  168. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  169. package/build/responsive-wrapper/index.js.map +1 -1
  170. package/build/sandbox/index.js.map +1 -1
  171. package/build/sandbox/index.native.js.map +1 -1
  172. package/build/search-control/index.js +11 -2
  173. package/build/search-control/index.js.map +1 -1
  174. package/build/search-control/index.native.js.map +1 -1
  175. package/build/search-control/types.js.map +1 -1
  176. package/build/select-control/index.js.map +1 -1
  177. package/build/select-control/index.native.js.map +1 -1
  178. package/build/slot-fill/index.js.map +1 -1
  179. package/build/spinner/styles.js.map +1 -1
  180. package/build/style-provider/index.js +1 -0
  181. package/build/style-provider/index.js.map +1 -1
  182. package/build/surface/hook.js.map +1 -1
  183. package/build/surface/styles.js.map +1 -1
  184. package/build/tab-panel/index.js.map +1 -1
  185. package/build/tabs/index.js.map +1 -1
  186. package/build/tabs/styles.js +30 -12
  187. package/build/tabs/styles.js.map +1 -1
  188. package/build/tabs/tab.js +7 -2
  189. package/build/tabs/tab.js.map +1 -1
  190. package/build/tabs/tablist.js +71 -39
  191. package/build/tabs/tablist.js.map +1 -1
  192. package/build/tabs/tabpanel.js.map +1 -1
  193. package/build/tabs/use-track-overflow.js +73 -0
  194. package/build/tabs/use-track-overflow.js.map +1 -0
  195. package/build/text/get-line-height.js.map +1 -1
  196. package/build/text/styles/text-mixins.native.js.map +1 -1
  197. package/build/text/utils.js.map +1 -1
  198. package/build/text-control/index.native.js.map +1 -1
  199. package/build/text-highlight/index.js.map +1 -1
  200. package/build/textarea-control/index.js.map +1 -1
  201. package/build/theme/color-algorithms.js.map +1 -1
  202. package/build/theme/styles.js.map +1 -1
  203. package/build/toggle-control/index.js.map +1 -1
  204. package/build/toggle-control/index.native.js.map +1 -1
  205. package/build/toggle-group-control/toggle-group-control/as-button-group.js +4 -2
  206. package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  207. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +13 -2
  208. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  209. package/build/toggle-group-control/toggle-group-control/component.js +15 -8
  210. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  211. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  212. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  213. package/build/toggle-group-control/toggle-group-control-option-base/component.js +13 -20
  214. package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  215. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -9
  216. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  217. package/build/toggle-group-control/types.js.map +1 -1
  218. package/build/toolbar/toolbar/index.js.map +1 -1
  219. package/build/tools-panel/styles.js.map +1 -1
  220. package/build/unit-control/index.js.map +1 -1
  221. package/build/unit-control/utils.js.map +1 -1
  222. package/build/utils/breakpoint.js.map +1 -1
  223. package/build/utils/colors-values.js.map +1 -1
  224. package/build/utils/config-values.js.map +1 -1
  225. package/build/utils/element-rect.js +22 -13
  226. package/build/utils/element-rect.js.map +1 -1
  227. package/build/utils/font-size.js.map +1 -1
  228. package/build/utils/hooks/use-animated-offset-rect.js +80 -0
  229. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -0
  230. package/build/utils/hooks/use-cx.js.map +1 -1
  231. package/build/utils/hooks/use-on-value-update.js +3 -7
  232. package/build/utils/hooks/use-on-value-update.js.map +1 -1
  233. package/build/utils/math.js +2 -2
  234. package/build/utils/math.js.map +1 -1
  235. package/build/utils/space.js.map +1 -1
  236. package/build/utils/unit-values.js.map +1 -1
  237. package/build/utils/use-responsive-value.js.map +1 -1
  238. package/build-module/alignment-matrix-control/cell.js +1 -2
  239. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  240. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  241. package/build-module/alignment-matrix-control/types.js.map +1 -1
  242. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  243. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  244. package/build-module/angle-picker-control/index.js +1 -2
  245. package/build-module/angle-picker-control/index.js.map +1 -1
  246. package/build-module/autocomplete/autocompleter-ui.js +4 -6
  247. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  248. package/build-module/autocomplete/autocompleter-ui.native.js +1 -2
  249. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  250. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  251. package/build-module/autocomplete/index.js +6 -4
  252. package/build-module/autocomplete/index.js.map +1 -1
  253. package/build-module/base-control/hooks.js.map +1 -1
  254. package/build-module/base-control/index.js +1 -2
  255. package/build-module/base-control/index.js.map +1 -1
  256. package/build-module/base-control/index.native.js +1 -2
  257. package/build-module/base-control/index.native.js.map +1 -1
  258. package/build-module/border-box-control/border-box-control/component.js +4 -16
  259. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  260. package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
  261. package/build-module/border-box-control/border-box-control-split-controls/component.js +1 -2
  262. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  263. package/build-module/border-box-control/styles.js.map +1 -1
  264. package/build-module/border-box-control/utils.js.map +1 -1
  265. package/build-module/border-control/border-control/component.js +2 -4
  266. package/build-module/border-control/border-control/component.js.map +1 -1
  267. package/build-module/border-control/border-control/hook.js.map +1 -1
  268. package/build-module/border-control/border-control-dropdown/component.js +3 -17
  269. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  270. package/build-module/border-control/styles.js +13 -13
  271. package/build-module/border-control/styles.js.map +1 -1
  272. package/build-module/border-control/types.js.map +1 -1
  273. package/build-module/box-control/all-input-control.js +1 -3
  274. package/build-module/box-control/all-input-control.js.map +1 -1
  275. package/build-module/box-control/axial-input-controls.js +1 -3
  276. package/build-module/box-control/axial-input-controls.js.map +1 -1
  277. package/build-module/box-control/icon.js +1 -2
  278. package/build-module/box-control/icon.js.map +1 -1
  279. package/build-module/box-control/index.js +5 -6
  280. package/build-module/box-control/index.js.map +1 -1
  281. package/build-module/box-control/input-controls.js +1 -3
  282. package/build-module/box-control/input-controls.js.map +1 -1
  283. package/build-module/box-control/types.js.map +1 -1
  284. package/build-module/button/index.js +1 -3
  285. package/build-module/button/index.js.map +1 -1
  286. package/build-module/button/index.native.js +2 -3
  287. package/build-module/button/index.native.js.map +1 -1
  288. package/build-module/card/card/component.js +2 -3
  289. package/build-module/card/card/component.js.map +1 -1
  290. package/build-module/card/styles.js.map +1 -1
  291. package/build-module/checkbox-control/index.js +1 -2
  292. package/build-module/checkbox-control/index.js.map +1 -1
  293. package/build-module/circular-option-picker/circular-option-picker-option.js +1 -2
  294. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  295. package/build-module/circular-option-picker/circular-option-picker.js +1 -2
  296. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  297. package/build-module/color-indicator/index.native.js +1 -2
  298. package/build-module/color-indicator/index.native.js.map +1 -1
  299. package/build-module/color-palette/index.js +1 -2
  300. package/build-module/color-palette/index.js.map +1 -1
  301. package/build-module/color-palette/index.native.js +3 -4
  302. package/build-module/color-palette/index.native.js.map +1 -1
  303. package/build-module/color-picker/component.js +1 -2
  304. package/build-module/color-picker/component.js.map +1 -1
  305. package/build-module/color-picker/hsl-input.js +1 -3
  306. package/build-module/color-picker/hsl-input.js.map +1 -1
  307. package/build-module/color-picker/hsv-color-picker.native.js +1 -2
  308. package/build-module/color-picker/hsv-color-picker.native.js.map +1 -1
  309. package/build-module/color-picker/hue-picker.native.js +1 -2
  310. package/build-module/color-picker/hue-picker.native.js.map +1 -1
  311. package/build-module/color-picker/index.native.js +1 -3
  312. package/build-module/color-picker/index.native.js.map +1 -1
  313. package/build-module/color-picker/input-with-slider.js +1 -2
  314. package/build-module/color-picker/input-with-slider.js.map +1 -1
  315. package/build-module/color-picker/rgb-input.js +1 -3
  316. package/build-module/color-picker/rgb-input.js.map +1 -1
  317. package/build-module/color-picker/saturation-picker.native.js +1 -2
  318. package/build-module/color-picker/saturation-picker.native.js.map +1 -1
  319. package/build-module/color-picker/styles.js.map +1 -1
  320. package/build-module/combobox-control/index.js +2 -3
  321. package/build-module/combobox-control/index.js.map +1 -1
  322. package/build-module/composite/legacy/index.js.map +1 -1
  323. package/build-module/confirm-dialog/component.js +1 -3
  324. package/build-module/confirm-dialog/component.js.map +1 -1
  325. package/build-module/context/context-connect.js +1 -0
  326. package/build-module/context/context-connect.js.map +1 -1
  327. package/build-module/context/context-system-provider.js +1 -1
  328. package/build-module/context/context-system-provider.js.map +1 -1
  329. package/build-module/context/get-styled-class-name-from-key.js.map +1 -1
  330. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -3
  331. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  332. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -2
  333. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  334. package/build-module/custom-gradient-picker/index.js +1 -2
  335. package/build-module/custom-gradient-picker/index.js.map +1 -1
  336. package/build-module/custom-gradient-picker/index.native.js +1 -3
  337. package/build-module/custom-gradient-picker/index.native.js.map +1 -1
  338. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  339. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  340. package/build-module/custom-select-control/index.js +1 -3
  341. package/build-module/custom-select-control/index.js.map +1 -1
  342. package/build-module/custom-select-control-v2/custom-select.js +1 -2
  343. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  344. package/build-module/custom-select-control-v2/item.js +1 -2
  345. package/build-module/custom-select-control-v2/item.js.map +1 -1
  346. package/build-module/custom-select-control-v2/styles.js.map +1 -1
  347. package/build-module/dashicon/index.js.map +1 -1
  348. package/build-module/date-time/date/index.js +1 -2
  349. package/build-module/date-time/date/index.js.map +1 -1
  350. package/build-module/date-time/date/styles.js.map +1 -1
  351. package/build-module/date-time/date-time/index.js +1 -3
  352. package/build-module/date-time/date-time/index.js.map +1 -1
  353. package/build-module/date-time/time/index.js +1 -2
  354. package/build-module/date-time/time/index.js.map +1 -1
  355. package/build-module/date-time/time/time-input/index.js +1 -2
  356. package/build-module/date-time/time/time-input/index.js.map +1 -1
  357. package/build-module/date-time/time/timezone.js.map +1 -1
  358. package/build-module/dimension-control/index.js +1 -3
  359. package/build-module/dimension-control/index.js.map +1 -1
  360. package/build-module/draggable/index.js +1 -3
  361. package/build-module/draggable/index.js.map +1 -1
  362. package/build-module/drop-zone/index.js +1 -2
  363. package/build-module/drop-zone/index.js.map +1 -1
  364. package/build-module/dropdown/index.js +1 -2
  365. package/build-module/dropdown/index.js.map +1 -1
  366. package/build-module/dropdown/index.native.js +1 -2
  367. package/build-module/dropdown/index.native.js.map +1 -1
  368. package/build-module/dropdown-menu/index.js +1 -2
  369. package/build-module/dropdown-menu/index.js.map +1 -1
  370. package/build-module/dropdown-menu/index.native.js +1 -2
  371. package/build-module/dropdown-menu/index.native.js.map +1 -1
  372. package/build-module/dropdown-menu-v2/checkbox-item.js +1 -2
  373. package/build-module/dropdown-menu-v2/checkbox-item.js.map +1 -1
  374. package/build-module/dropdown-menu-v2/index.js +1 -3
  375. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  376. package/build-module/dropdown-menu-v2/item.js +1 -2
  377. package/build-module/dropdown-menu-v2/item.js.map +1 -1
  378. package/build-module/dropdown-menu-v2/radio-item.js +1 -2
  379. package/build-module/dropdown-menu-v2/radio-item.js.map +1 -1
  380. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  381. package/build-module/duotone-picker/color-list-picker/index.js +1 -3
  382. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  383. package/build-module/duotone-picker/duotone-picker.js +1 -2
  384. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  385. package/build-module/duotone-picker/utils.js.map +1 -1
  386. package/build-module/elevation/hook.js.map +1 -1
  387. package/build-module/external-link/index.js +21 -25
  388. package/build-module/external-link/index.js.map +1 -1
  389. package/build-module/external-link/index.native.js +1 -2
  390. package/build-module/external-link/index.native.js.map +1 -1
  391. package/build-module/focal-point-picker/controls.js +1 -2
  392. package/build-module/focal-point-picker/controls.js.map +1 -1
  393. package/build-module/focal-point-picker/focal-point.native.js +1 -2
  394. package/build-module/focal-point-picker/focal-point.native.js.map +1 -1
  395. package/build-module/focal-point-picker/grid.js +1 -2
  396. package/build-module/focal-point-picker/grid.js.map +1 -1
  397. package/build-module/focal-point-picker/index.js +1 -2
  398. package/build-module/focal-point-picker/index.js.map +1 -1
  399. package/build-module/focal-point-picker/index.native.js +1 -2
  400. package/build-module/focal-point-picker/index.native.js.map +1 -1
  401. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  402. package/build-module/focal-point-picker/tooltip/index.native.js +1 -2
  403. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  404. package/build-module/font-size-picker/index.js +1 -2
  405. package/build-module/font-size-picker/index.js.map +1 -1
  406. package/build-module/font-size-picker/index.native.js +1 -3
  407. package/build-module/font-size-picker/index.native.js.map +1 -1
  408. package/build-module/form-file-upload/index.js +1 -2
  409. package/build-module/form-file-upload/index.js.map +1 -1
  410. package/build-module/form-toggle/index.js +1 -2
  411. package/build-module/form-toggle/index.js.map +1 -1
  412. package/build-module/form-token-field/index.js +3 -3
  413. package/build-module/form-token-field/index.js.map +1 -1
  414. package/build-module/form-token-field/suggestions-list.js +1 -2
  415. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  416. package/build-module/form-token-field/token-input.js.map +1 -1
  417. package/build-module/form-token-field/token.js +2 -3
  418. package/build-module/form-token-field/token.js.map +1 -1
  419. package/build-module/gradient-picker/index.js +1 -2
  420. package/build-module/gradient-picker/index.js.map +1 -1
  421. package/build-module/grid/hook.js.map +1 -1
  422. package/build-module/guide/index.js +1 -2
  423. package/build-module/guide/index.js.map +1 -1
  424. package/build-module/guide/page-control.js +1 -1
  425. package/build-module/guide/page-control.js.map +1 -1
  426. package/build-module/h-stack/hook.js.map +1 -1
  427. package/build-module/heading/hook.js.map +1 -1
  428. package/build-module/higher-order/with-fallback-styles/index.js +3 -4
  429. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  430. package/build-module/index.js +14 -4
  431. package/build-module/index.js.map +1 -1
  432. package/build-module/input-control/index.js.map +1 -1
  433. package/build-module/input-control/input-base.js +1 -2
  434. package/build-module/input-control/input-base.js.map +1 -1
  435. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  436. package/build-module/item-group/styles.js.map +1 -1
  437. package/build-module/keyboard-shortcuts/index.js +1 -3
  438. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  439. package/build-module/menu-group/index.js +1 -2
  440. package/build-module/menu-group/index.js.map +1 -1
  441. package/build-module/menu-item/index.js +1 -2
  442. package/build-module/menu-item/index.js.map +1 -1
  443. package/build-module/menu-items-choice/index.js +1 -2
  444. package/build-module/menu-items-choice/index.js.map +1 -1
  445. package/build-module/mobile/badge/index.native.js +1 -3
  446. package/build-module/mobile/badge/index.native.js.map +1 -1
  447. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -2
  448. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  449. package/build-module/mobile/bottom-sheet/cell.native.js +5 -6
  450. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  451. package/build-module/mobile/bottom-sheet/color-cell.native.js +1 -2
  452. package/build-module/mobile/bottom-sheet/color-cell.native.js.map +1 -1
  453. package/build-module/mobile/bottom-sheet/index.native.js +1 -3
  454. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  455. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -2
  456. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  457. package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -2
  458. package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
  459. package/build-module/mobile/bottom-sheet/range-cell.native.js +2 -3
  460. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  461. package/build-module/mobile/bottom-sheet/range-text-input.native.js +1 -2
  462. package/build-module/mobile/bottom-sheet/range-text-input.native.js.map +1 -1
  463. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +2 -3
  464. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  465. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.android.js +1 -2
  466. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.android.js.map +1 -1
  467. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.ios.js +1 -2
  468. package/build-module/mobile/bottom-sheet/stepper-cell/stepper.ios.js.map +1 -1
  469. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js +1 -3
  470. package/build-module/mobile/bottom-sheet/sub-sheet/index.native.js.map +1 -1
  471. package/build-module/mobile/bottom-sheet/switch-cell.native.js +4 -4
  472. package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  473. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -3
  474. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  475. package/build-module/mobile/bottom-sheet-text-control/index.native.js +1 -3
  476. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  477. package/build-module/mobile/color-settings/gradient-picker-screen.native.js +1 -2
  478. package/build-module/mobile/color-settings/gradient-picker-screen.native.js.map +1 -1
  479. package/build-module/mobile/color-settings/index.native.js +1 -2
  480. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  481. package/build-module/mobile/color-settings/palette.screen.native.js +1 -3
  482. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  483. package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
  484. package/build-module/mobile/focal-point-settings-panel/index.native.js +1 -2
  485. package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
  486. package/build-module/mobile/gradient/index.native.js +1 -2
  487. package/build-module/mobile/gradient/index.native.js.map +1 -1
  488. package/build-module/mobile/html-text-input/index.native.js +1 -2
  489. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  490. package/build-module/mobile/image/icon-retry.native.js +1 -2
  491. package/build-module/mobile/image/icon-retry.native.js.map +1 -1
  492. package/build-module/mobile/image/image-editing-button.native.js +1 -2
  493. package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
  494. package/build-module/mobile/image/index.native.js +1 -3
  495. package/build-module/mobile/image/index.native.js.map +1 -1
  496. package/build-module/mobile/keyboard-avoiding-view/index.ios.js +1 -2
  497. package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
  498. package/build-module/mobile/link-picker/index.native.js +2 -3
  499. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  500. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  501. package/build-module/mobile/link-settings/index.native.js +1 -3
  502. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  503. package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -2
  504. package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
  505. package/build-module/mobile/picker/index.android.js +1 -2
  506. package/build-module/mobile/picker/index.android.js.map +1 -1
  507. package/build-module/mobile/segmented-control/index.native.js +1 -2
  508. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  509. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  510. package/build-module/mobile/utils/use-unit-converter-to-mobile.native.js.map +1 -1
  511. package/build-module/modal/aria-helper.js +2 -1
  512. package/build-module/modal/aria-helper.js.map +1 -1
  513. package/build-module/modal/index.js +3 -4
  514. package/build-module/modal/index.js.map +1 -1
  515. package/build-module/modal/use-modal-exit-animation.js.map +1 -1
  516. package/build-module/navigation/back-button/index.js +1 -2
  517. package/build-module/navigation/back-button/index.js.map +1 -1
  518. package/build-module/navigation/group/index.js +1 -2
  519. package/build-module/navigation/group/index.js.map +1 -1
  520. package/build-module/navigation/item/base-content.js +1 -3
  521. package/build-module/navigation/item/base-content.js.map +1 -1
  522. package/build-module/navigation/item/base.js.map +1 -1
  523. package/build-module/navigation/item/index.js +1 -2
  524. package/build-module/navigation/item/index.js.map +1 -1
  525. package/build-module/navigation/menu/index.js +1 -2
  526. package/build-module/navigation/menu/index.js.map +1 -1
  527. package/build-module/navigation/menu/menu-title-search.js +2 -2
  528. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  529. package/build-module/navigation/menu/menu-title.js +1 -2
  530. package/build-module/navigation/menu/menu-title.js.map +1 -1
  531. package/build-module/navigation/menu/search-no-results-found.js +1 -2
  532. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  533. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  534. package/build-module/navigator/index.js +130 -5
  535. package/build-module/navigator/index.js.map +1 -1
  536. package/build-module/navigator/legacy.js +167 -0
  537. package/build-module/navigator/legacy.js.map +1 -0
  538. package/build-module/navigator/{navigator-provider → navigator}/component.js +4 -39
  539. package/build-module/navigator/navigator/component.js.map +1 -0
  540. package/build-module/navigator/navigator-back-button/component.js +1 -37
  541. package/build-module/navigator/navigator-back-button/component.js.map +1 -1
  542. package/build-module/navigator/navigator-back-button/hook.js +1 -1
  543. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  544. package/build-module/navigator/navigator-button/component.js +1 -36
  545. package/build-module/navigator/navigator-button/component.js.map +1 -1
  546. package/build-module/navigator/navigator-button/hook.js +1 -1
  547. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  548. package/build-module/navigator/navigator-screen/component.js +39 -61
  549. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  550. package/build-module/navigator/navigator-screen/use-screen-animate-presence.js +106 -0
  551. package/build-module/navigator/navigator-screen/use-screen-animate-presence.js.map +1 -0
  552. package/build-module/navigator/navigator-to-parent-button/component.js +2 -6
  553. package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
  554. package/build-module/navigator/styles.js +77 -33
  555. package/build-module/navigator/styles.js.map +1 -1
  556. package/build-module/navigator/types.js.map +1 -1
  557. package/build-module/navigator/use-navigator.js +4 -1
  558. package/build-module/navigator/use-navigator.js.map +1 -1
  559. package/build-module/notice/index.js +1 -2
  560. package/build-module/notice/index.js.map +1 -1
  561. package/build-module/notice/index.native.js +1 -3
  562. package/build-module/notice/index.native.js.map +1 -1
  563. package/build-module/number-control/index.js +1 -3
  564. package/build-module/number-control/index.js.map +1 -1
  565. package/build-module/number-control/styles/number-control-styles.js.map +1 -1
  566. package/build-module/palette-edit/index.js +2 -4
  567. package/build-module/palette-edit/index.js.map +1 -1
  568. package/build-module/panel/actions.native.js +1 -2
  569. package/build-module/panel/actions.native.js.map +1 -1
  570. package/build-module/panel/body.js +1 -2
  571. package/build-module/panel/body.js.map +1 -1
  572. package/build-module/panel/body.native.js +1 -2
  573. package/build-module/panel/body.native.js.map +1 -1
  574. package/build-module/panel/header.js +1 -2
  575. package/build-module/panel/header.js.map +1 -1
  576. package/build-module/panel/index.js +1 -2
  577. package/build-module/panel/index.js.map +1 -1
  578. package/build-module/placeholder/index.js +1 -2
  579. package/build-module/placeholder/index.js.map +1 -1
  580. package/build-module/popover/index.js +2 -4
  581. package/build-module/popover/index.js.map +1 -1
  582. package/build-module/popover/overlay-middlewares.js.map +1 -1
  583. package/build-module/popover/utils.js.map +1 -1
  584. package/build-module/progress-bar/index.js +1 -2
  585. package/build-module/progress-bar/index.js.map +1 -1
  586. package/build-module/progress-bar/styles.js.map +1 -1
  587. package/build-module/query-controls/index.js.map +1 -1
  588. package/build-module/query-controls/index.native.js +1 -3
  589. package/build-module/query-controls/index.native.js.map +1 -1
  590. package/build-module/radio-control/index.js +1 -2
  591. package/build-module/radio-control/index.js.map +1 -1
  592. package/build-module/radio-control/index.native.js +1 -2
  593. package/build-module/radio-control/index.native.js.map +1 -1
  594. package/build-module/range-control/index.js +1 -2
  595. package/build-module/range-control/index.js.map +1 -1
  596. package/build-module/range-control/index.native.js.map +1 -1
  597. package/build-module/range-control/mark.js +1 -3
  598. package/build-module/range-control/mark.js.map +1 -1
  599. package/build-module/range-control/rail.js +1 -3
  600. package/build-module/range-control/rail.js.map +1 -1
  601. package/build-module/range-control/styles/range-control-styles.js +32 -32
  602. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  603. package/build-module/range-control/tooltip.js +1 -1
  604. package/build-module/range-control/tooltip.js.map +1 -1
  605. package/build-module/range-control/utils.js.map +1 -1
  606. package/build-module/resizable-box/index.js +1 -2
  607. package/build-module/resizable-box/index.js.map +1 -1
  608. package/build-module/resizable-box/resize-tooltip/index.js +1 -2
  609. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  610. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  611. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  612. package/build-module/responsive-wrapper/index.js.map +1 -1
  613. package/build-module/sandbox/index.js +1 -2
  614. package/build-module/sandbox/index.js.map +1 -1
  615. package/build-module/sandbox/index.native.js +1 -2
  616. package/build-module/sandbox/index.native.js.map +1 -1
  617. package/build-module/search-control/index.js +11 -2
  618. package/build-module/search-control/index.js.map +1 -1
  619. package/build-module/search-control/index.native.js +1 -2
  620. package/build-module/search-control/index.native.js.map +1 -1
  621. package/build-module/search-control/types.js.map +1 -1
  622. package/build-module/select-control/index.js.map +1 -1
  623. package/build-module/select-control/index.native.js.map +1 -1
  624. package/build-module/slot-fill/index.js +1 -3
  625. package/build-module/slot-fill/index.js.map +1 -1
  626. package/build-module/slot-fill/slot.js +1 -2
  627. package/build-module/slot-fill/slot.js.map +1 -1
  628. package/build-module/snackbar/index.js +1 -2
  629. package/build-module/snackbar/index.js.map +1 -1
  630. package/build-module/snackbar/list.js +1 -2
  631. package/build-module/snackbar/list.js.map +1 -1
  632. package/build-module/spinner/index.js +1 -2
  633. package/build-module/spinner/index.js.map +1 -1
  634. package/build-module/spinner/styles.js.map +1 -1
  635. package/build-module/style-provider/index.js +1 -0
  636. package/build-module/style-provider/index.js.map +1 -1
  637. package/build-module/surface/hook.js.map +1 -1
  638. package/build-module/surface/styles.js.map +1 -1
  639. package/build-module/tab-panel/index.js +1 -2
  640. package/build-module/tab-panel/index.js.map +1 -1
  641. package/build-module/tabs/index.js.map +1 -1
  642. package/build-module/tabs/styles.js +28 -6
  643. package/build-module/tabs/styles.js.map +1 -1
  644. package/build-module/tabs/tab.js +9 -4
  645. package/build-module/tabs/tab.js.map +1 -1
  646. package/build-module/tabs/tablist.js +72 -40
  647. package/build-module/tabs/tablist.js.map +1 -1
  648. package/build-module/tabs/tabpanel.js.map +1 -1
  649. package/build-module/tabs/use-track-overflow.js +67 -0
  650. package/build-module/tabs/use-track-overflow.js.map +1 -0
  651. package/build-module/text/get-line-height.js.map +1 -1
  652. package/build-module/text/styles/text-mixins.native.js.map +1 -1
  653. package/build-module/text/utils.js.map +1 -1
  654. package/build-module/text-control/index.native.js.map +1 -1
  655. package/build-module/text-highlight/index.js +1 -2
  656. package/build-module/text-highlight/index.js.map +1 -1
  657. package/build-module/textarea-control/index.js.map +1 -1
  658. package/build-module/theme/color-algorithms.js.map +1 -1
  659. package/build-module/theme/styles.js.map +1 -1
  660. package/build-module/tip/index.js +1 -2
  661. package/build-module/tip/index.js.map +1 -1
  662. package/build-module/toggle-control/index.js +1 -2
  663. package/build-module/toggle-control/index.js.map +1 -1
  664. package/build-module/toggle-control/index.native.js.map +1 -1
  665. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +4 -2
  666. package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
  667. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +14 -3
  668. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  669. package/build-module/toggle-group-control/toggle-group-control/component.js +17 -12
  670. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  671. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  672. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  673. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +16 -25
  674. package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
  675. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +7 -8
  676. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  677. package/build-module/toggle-group-control/types.js.map +1 -1
  678. package/build-module/toolbar/toolbar/index.js.map +1 -1
  679. package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js +2 -2
  680. package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -1
  681. package/build-module/toolbar/toolbar-group/index.js +1 -2
  682. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  683. package/build-module/tools-panel/styles.js.map +1 -1
  684. package/build-module/tools-panel/tools-panel/component.js +1 -2
  685. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  686. package/build-module/tools-panel/tools-panel-header/component.js +1 -3
  687. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  688. package/build-module/tooltip/index.js +1 -2
  689. package/build-module/tooltip/index.js.map +1 -1
  690. package/build-module/tooltip/index.native.js +1 -3
  691. package/build-module/tooltip/index.native.js.map +1 -1
  692. package/build-module/tree-grid/cell.js +1 -2
  693. package/build-module/tree-grid/cell.js.map +1 -1
  694. package/build-module/unit-control/index.js.map +1 -1
  695. package/build-module/unit-control/index.native.js +1 -3
  696. package/build-module/unit-control/index.native.js.map +1 -1
  697. package/build-module/unit-control/utils.js.map +1 -1
  698. package/build-module/utils/breakpoint.js.map +1 -1
  699. package/build-module/utils/colors-values.js.map +1 -1
  700. package/build-module/utils/config-values.js.map +1 -1
  701. package/build-module/utils/element-rect.js +22 -12
  702. package/build-module/utils/element-rect.js.map +1 -1
  703. package/build-module/utils/font-size.js.map +1 -1
  704. package/build-module/utils/hooks/use-animated-offset-rect.js +74 -0
  705. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -0
  706. package/build-module/utils/hooks/use-cx.js.map +1 -1
  707. package/build-module/utils/hooks/use-on-value-update.js +3 -6
  708. package/build-module/utils/hooks/use-on-value-update.js.map +1 -1
  709. package/build-module/utils/math.js +2 -2
  710. package/build-module/utils/math.js.map +1 -1
  711. package/build-module/utils/space.js.map +1 -1
  712. package/build-module/utils/unit-values.js.map +1 -1
  713. package/build-module/utils/use-responsive-value.js.map +1 -1
  714. package/build-style/style-rtl.css +30 -14
  715. package/build-style/style.css +30 -14
  716. package/build-types/alignment-matrix-control/types.d.ts +2 -0
  717. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  718. package/build-types/autocomplete/index.d.ts.map +1 -1
  719. package/build-types/border-box-control/border-box-control/component.d.ts +5 -15
  720. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  721. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +2 -1
  722. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  723. package/build-types/border-box-control/stories/index.story.d.ts +3 -2
  724. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  725. package/build-types/border-control/border-control/component.d.ts +3 -2
  726. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  727. package/build-types/border-control/border-control-dropdown/component.d.ts +2 -1
  728. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  729. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  730. package/build-types/border-control/stories/index.story.d.ts +15 -30
  731. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  732. package/build-types/border-control/styles.d.ts.map +1 -1
  733. package/build-types/border-control/types.d.ts +12 -7
  734. package/build-types/border-control/types.d.ts.map +1 -1
  735. package/build-types/box-control/index.d.ts +4 -4
  736. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  737. package/build-types/box-control/types.d.ts +3 -3
  738. package/build-types/composite/stories/index.story.d.ts +22 -0
  739. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  740. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  741. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  742. package/build-types/index.d.ts +23 -4
  743. package/build-types/index.d.ts.map +1 -1
  744. package/build-types/modal/aria-helper.d.ts.map +1 -1
  745. package/build-types/navigator/index.d.ts +171 -5
  746. package/build-types/navigator/index.d.ts.map +1 -1
  747. package/build-types/navigator/legacy.d.ts +226 -0
  748. package/build-types/navigator/legacy.d.ts.map +1 -0
  749. package/build-types/navigator/navigator/component.d.ts +3 -0
  750. package/build-types/navigator/navigator/component.d.ts.map +1 -0
  751. package/build-types/navigator/navigator-back-button/component.d.ts +0 -35
  752. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  753. package/build-types/navigator/navigator-button/component.d.ts +0 -34
  754. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  755. package/build-types/navigator/navigator-screen/component.d.ts +0 -35
  756. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  757. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +16 -0
  758. package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -0
  759. package/build-types/navigator/navigator-to-parent-button/component.d.ts +0 -4
  760. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  761. package/build-types/navigator/stories/index.story.d.ts +5 -5
  762. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  763. package/build-types/navigator/styles.d.ts +20 -7
  764. package/build-types/navigator/styles.d.ts.map +1 -1
  765. package/build-types/navigator/types.d.ts +19 -1
  766. package/build-types/navigator/types.d.ts.map +1 -1
  767. package/build-types/navigator/use-navigator.d.ts +4 -1
  768. package/build-types/navigator/use-navigator.d.ts.map +1 -1
  769. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  770. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  771. package/build-types/search-control/index.d.ts.map +1 -1
  772. package/build-types/search-control/stories/index.story.d.ts +0 -8
  773. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  774. package/build-types/search-control/types.d.ts +3 -0
  775. package/build-types/search-control/types.d.ts.map +1 -1
  776. package/build-types/select-control/stories/index.story.d.ts +7 -0
  777. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  778. package/build-types/tabs/stories/index.story.d.ts +2 -1
  779. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  780. package/build-types/tabs/styles.d.ts +7 -0
  781. package/build-types/tabs/styles.d.ts.map +1 -1
  782. package/build-types/tabs/tab.d.ts.map +1 -1
  783. package/build-types/tabs/tablist.d.ts.map +1 -1
  784. package/build-types/tabs/use-track-overflow.d.ts +17 -0
  785. package/build-types/tabs/use-track-overflow.d.ts.map +1 -0
  786. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +2 -2
  787. package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
  788. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +2 -2
  789. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  790. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  791. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  792. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  793. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +0 -1
  794. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  795. package/build-types/toggle-group-control/types.d.ts +2 -1
  796. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  797. package/build-types/utils/element-rect.d.ts +8 -0
  798. package/build-types/utils/element-rect.d.ts.map +1 -1
  799. package/build-types/utils/hooks/use-animated-offset-rect.d.ts +62 -0
  800. package/build-types/utils/hooks/use-animated-offset-rect.d.ts.map +1 -0
  801. package/build-types/utils/hooks/use-on-value-update.d.ts.map +1 -1
  802. package/package.json +20 -20
  803. package/schemas/docs-manifest.json +38 -0
  804. package/src/alignment-matrix-control/README.md +46 -36
  805. package/src/alignment-matrix-control/docs-manifest.json +12 -0
  806. package/src/alignment-matrix-control/types.ts +2 -0
  807. package/src/angle-picker-control/README.md +36 -23
  808. package/src/angle-picker-control/docs-manifest.json +5 -0
  809. package/src/autocomplete/index.tsx +4 -1
  810. package/src/border-box-control/border-box-control/README.md +22 -26
  811. package/src/border-box-control/border-box-control/component.tsx +3 -14
  812. package/src/border-box-control/stories/index.story.tsx +2 -1
  813. package/src/border-control/border-control/README.md +26 -36
  814. package/src/border-control/border-control/component.tsx +1 -2
  815. package/src/border-control/border-control-dropdown/component.tsx +1 -15
  816. package/src/border-control/stories/index.story.tsx +4 -10
  817. package/src/border-control/styles.ts +0 -1
  818. package/src/border-control/test/index.js +2 -15
  819. package/src/border-control/types.ts +12 -7
  820. package/src/box-control/README.md +9 -12
  821. package/src/box-control/index.tsx +4 -4
  822. package/src/box-control/stories/index.story.tsx +1 -1
  823. package/src/box-control/types.ts +3 -3
  824. package/src/button/style.scss +5 -1
  825. package/src/composite/legacy/test/index.tsx +22 -21
  826. package/src/composite/stories/index.story.tsx +42 -0
  827. package/src/composite/test/index.tsx +629 -38
  828. package/src/dropdown/stories/index.story.tsx +1 -0
  829. package/src/dropdown/style.scss +10 -13
  830. package/src/dropdown-menu/stories/index.story.tsx +3 -0
  831. package/src/index.ts +19 -1
  832. package/src/menu-group/style.scss +4 -1
  833. package/src/menu-items-choice/style.scss +2 -0
  834. package/src/modal/aria-helper.ts +1 -0
  835. package/src/navigator/README.md +176 -0
  836. package/src/navigator/index.tsx +131 -0
  837. package/src/navigator/legacy.ts +169 -0
  838. package/src/navigator/{navigator-provider → navigator}/component.tsx +6 -44
  839. package/src/navigator/navigator-back-button/component.tsx +1 -37
  840. package/src/navigator/navigator-back-button/hook.ts +1 -1
  841. package/src/navigator/navigator-button/component.tsx +1 -36
  842. package/src/navigator/navigator-button/hook.ts +1 -1
  843. package/src/navigator/navigator-screen/component.tsx +48 -76
  844. package/src/navigator/navigator-screen/use-screen-animate-presence.ts +177 -0
  845. package/src/navigator/navigator-to-parent-button/component.tsx +2 -7
  846. package/src/navigator/stories/index.story.tsx +55 -54
  847. package/src/navigator/styles.ts +112 -41
  848. package/src/navigator/test/index.tsx +47 -47
  849. package/src/navigator/types.ts +19 -1
  850. package/src/navigator/use-navigator.ts +4 -1
  851. package/src/range-control/styles/range-control-styles.ts +19 -10
  852. package/src/range-control/tooltip.tsx +1 -1
  853. package/src/search-control/README.md +2 -0
  854. package/src/search-control/index.tsx +9 -2
  855. package/src/search-control/stories/index.story.tsx +0 -15
  856. package/src/search-control/test/index.tsx +4 -1
  857. package/src/search-control/types.ts +3 -0
  858. package/src/select-control/stories/index.story.tsx +14 -1
  859. package/src/tabs/stories/index.story.tsx +106 -0
  860. package/src/tabs/styles.ts +161 -58
  861. package/src/tabs/tab.tsx +8 -2
  862. package/src/tabs/tablist.tsx +72 -39
  863. package/src/tabs/use-track-overflow.ts +76 -0
  864. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +208 -44
  865. package/src/toggle-group-control/test/index.tsx +26 -0
  866. package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +18 -10
  867. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +30 -12
  868. package/src/toggle-group-control/toggle-group-control/component.tsx +19 -6
  869. package/src/toggle-group-control/toggle-group-control/styles.ts +41 -0
  870. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +15 -28
  871. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -11
  872. package/src/toggle-group-control/types.ts +3 -1
  873. package/src/tools-panel/tools-panel/README.md +10 -10
  874. package/src/utils/element-rect.ts +32 -15
  875. package/src/utils/hooks/use-animated-offset-rect.ts +107 -0
  876. package/src/utils/hooks/use-on-value-update.ts +3 -6
  877. package/tsconfig.tsbuildinfo +1 -1
  878. package/build/navigator/navigator-provider/component.js.map +0 -1
  879. package/build/utils/hooks/use-event.js +0 -41
  880. package/build/utils/hooks/use-event.js.map +0 -1
  881. package/build-module/navigator/navigator-provider/component.js.map +0 -1
  882. package/build-module/utils/hooks/use-event.js +0 -35
  883. package/build-module/utils/hooks/use-event.js.map +0 -1
  884. package/build-types/navigator/navigator-provider/component.d.ts +0 -37
  885. package/build-types/navigator/navigator-provider/component.d.ts.map +0 -1
  886. package/build-types/utils/hooks/use-event.d.ts +0 -20
  887. package/build-types/utils/hooks/use-event.d.ts.map +0 -1
  888. package/src/navigator/index.ts +0 -6
  889. package/src/navigator/navigator-back-button/README.md +0 -15
  890. package/src/navigator/navigator-button/README.md +0 -38
  891. package/src/navigator/navigator-provider/README.md +0 -94
  892. package/src/navigator/navigator-screen/README.md +0 -33
  893. package/src/navigator/navigator-to-parent-button/README.md +0 -17
  894. package/src/utils/hooks/use-event.ts +0 -38
@@ -1 +1 @@
1
- {"version":3,"names":["css","keyframes","navigatorProviderWrapper","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","fadeInFromRight","opacity","transform","fadeInFromLeft","navigatorScreenAnimation","isInitial","isBack","isRTL","animationName","navigatorScreen","props"],"sources":["@wordpress/components/src/navigator/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css, keyframes } from '@emotion/react';\n\nexport const navigatorProviderWrapper = css`\n\t/* Prevents horizontal overflow while animating screen transitions */\n\toverflow-x: hidden;\n\t/* Mark this subsection of the DOM as isolated, providing performance benefits\n\t * by limiting calculations of layout, style and paint to a DOM subtree rather\n\t * than the entire page.\n\t */\n\tcontain: content;\n`;\n\nconst fadeInFromRight = keyframes( {\n\t'0%': {\n\t\topacity: 0,\n\t\ttransform: `translateX( 50px )`,\n\t},\n\t'100%': { opacity: 1, transform: 'none' },\n} );\n\nconst fadeInFromLeft = keyframes( {\n\t'0%': {\n\t\topacity: 0,\n\t\ttransform: `translateX( -50px )`,\n\t},\n\t'100%': { opacity: 1, transform: 'none' },\n} );\n\ntype NavigatorScreenAnimationProps = {\n\tisInitial?: boolean;\n\tisBack?: boolean;\n\tisRTL: boolean;\n};\n\nconst navigatorScreenAnimation = ( {\n\tisInitial,\n\tisBack,\n\tisRTL,\n}: NavigatorScreenAnimationProps ) => {\n\tif ( isInitial && ! isBack ) {\n\t\treturn;\n\t}\n\n\tconst animationName =\n\t\t( isRTL && isBack ) || ( ! isRTL && ! isBack )\n\t\t\t? fadeInFromRight\n\t\t\t: fadeInFromLeft;\n\n\treturn css`\n\t\tanimation-duration: 0.14s;\n\t\tanimation-timing-function: ease-in-out;\n\t\twill-change: transform, opacity;\n\t\tanimation-name: ${ animationName };\n\n\t\t@media ( prefers-reduced-motion ) {\n\t\t\tanimation-duration: 0s;\n\t\t}\n\t`;\n};\n\nexport const navigatorScreen = ( props: NavigatorScreenAnimationProps ) => css`\n\t/* Ensures horizontal overflow is visually accessible */\n\toverflow-x: auto;\n\t/* In case the root has a height, it should not be exceeded */\n\tmax-height: 100%;\n\n\t${ navigatorScreenAnimation( props ) }\n`;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,GAAG,EAAEC,SAAS,QAAQ,gBAAgB;AAE/C,OAAO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,CAQpC;AAED,MAAMC,eAAe,GAAGV,SAAS,CAAE;EAClC,IAAI,EAAE;IACLW,OAAO,EAAE,CAAC;IACVC,SAAS,EAAG;EACb,CAAC;EACD,MAAM,EAAE;IAAED,OAAO,EAAE,CAAC;IAAEC,SAAS,EAAE;EAAO;AACzC,CAAE,CAAC;AAEH,MAAMC,cAAc,GAAGb,SAAS,CAAE;EACjC,IAAI,EAAE;IACLW,OAAO,EAAE,CAAC;IACVC,SAAS,EAAG;EACb,CAAC;EACD,MAAM,EAAE;IAAED,OAAO,EAAE,CAAC;IAAEC,SAAS,EAAE;EAAO;AACzC,CAAE,CAAC;AAQH,MAAME,wBAAwB,GAAGA,CAAE;EAClCC,SAAS;EACTC,MAAM;EACNC;AAC8B,CAAC,KAAM;EACrC,IAAKF,SAAS,IAAI,CAAEC,MAAM,EAAG;IAC5B;EACD;EAEA,MAAME,aAAa,GAChBD,KAAK,IAAID,MAAM,IAAQ,CAAEC,KAAK,IAAI,CAAED,MAAQ,GAC3CN,eAAe,GACfG,cAAc;EAElB,oBAAOd,GAAG,iHAIUmB,aAAa,kEAAAhB,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA;AAMlC,CAAC;AAED,OAAO,MAAMe,eAAe,GAAKC,KAAoC,iBAAMrB,GAAG,qCAM1Ee,wBAAwB,CAAEM,KAAM,CAAC,SAAAlB,OAAA,CAAAC,GAAA,CAAAC,QAAA,qDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,mnFACpC","ignoreList":[]}
1
+ {"version":3,"names":["css","keyframes","navigatorWrapper","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","fadeIn","from","opacity","fadeOut","to","slideFromRight","transform","slideToLeft","slideFromLeft","slideToRight","FADE","DURATION","EASING","DELAY","IN","OUT","SLIDE","TOTAL_ANIMATION_DURATION","Math","max","ANIMATION_END_NAMES","end","in","out","start","ANIMATION","navigatorScreenAnimation","direction","type","navigatorScreen"],"sources":["@wordpress/components/src/navigator/styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css, keyframes } from '@emotion/react';\n\nexport const navigatorWrapper = css`\n\tposition: relative;\n\t/* Prevents horizontal overflow while animating screen transitions */\n\toverflow-x: clip;\n\t/*\n\t * Mark this DOM subtree as isolated when it comes to layout calculations,\n\t * providing performance benefits.\n\t */\n\tcontain: layout;\n\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tgrid-template-rows: 1fr;\n\talign-items: start;\n`;\n\nconst fadeIn = keyframes( {\n\tfrom: {\n\t\topacity: 0,\n\t},\n} );\n\nconst fadeOut = keyframes( {\n\tto: {\n\t\topacity: 0,\n\t},\n} );\n\nexport const slideFromRight = keyframes( {\n\tfrom: {\n\t\ttransform: 'translateX(100px)',\n\t},\n} );\n\nexport const slideToLeft = keyframes( {\n\tto: {\n\t\ttransform: 'translateX(-80px)',\n\t},\n} );\n\nexport const slideFromLeft = keyframes( {\n\tfrom: {\n\t\ttransform: 'translateX(-100px)',\n\t},\n} );\n\nexport const slideToRight = keyframes( {\n\tto: {\n\t\ttransform: 'translateX(80px)',\n\t},\n} );\n\nconst FADE = {\n\tDURATION: 70,\n\tEASING: 'linear',\n\tDELAY: {\n\t\tIN: 70,\n\t\tOUT: 40,\n\t},\n};\nconst SLIDE = {\n\tDURATION: 300,\n\tEASING: 'cubic-bezier(0.33, 0, 0, 1)',\n};\n\nexport const TOTAL_ANIMATION_DURATION = {\n\tIN: Math.max( FADE.DURATION + FADE.DELAY.IN, SLIDE.DURATION ),\n\tOUT: Math.max( FADE.DURATION + FADE.DELAY.OUT, SLIDE.DURATION ),\n};\n\nexport const ANIMATION_END_NAMES = {\n\tend: {\n\t\tin: slideFromRight.name,\n\t\tout: slideToLeft.name,\n\t},\n\tstart: {\n\t\tin: slideFromLeft.name,\n\t\tout: slideToRight.name,\n\t},\n};\n\nconst ANIMATION = {\n\tend: {\n\t\tin: css`\n\t\t\t${ FADE.DURATION }ms ${ FADE.EASING } ${ FADE.DELAY\n\t\t\t\t.IN }ms both ${ fadeIn }, ${ SLIDE.DURATION }ms ${ SLIDE.EASING } both ${ slideFromRight }\n\t\t`,\n\t\tout: css`\n\t\t\t${ FADE.DURATION }ms ${ FADE.EASING } ${ FADE.DELAY\n\t\t\t\t.OUT }ms both ${ fadeOut }, ${ SLIDE.DURATION }ms ${ SLIDE.EASING } both ${ slideToLeft }\n\t\t`,\n\t},\n\tstart: {\n\t\tin: css`\n\t\t\t${ FADE.DURATION }ms ${ FADE.EASING } ${ FADE.DELAY\n\t\t\t\t.IN }ms both ${ fadeIn }, ${ SLIDE.DURATION }ms ${ SLIDE.EASING } both ${ slideFromLeft }\n\t\t`,\n\t\tout: css`\n\t\t\t${ FADE.DURATION }ms ${ FADE.EASING } ${ FADE.DELAY\n\t\t\t\t.OUT }ms both ${ fadeOut }, ${ SLIDE.DURATION }ms ${ SLIDE.EASING } both ${ slideToRight }\n\t\t`,\n\t},\n} as const;\nexport const navigatorScreenAnimation = css`\n\tz-index: 1;\n\n\t&[data-animation-type='out'] {\n\t\tz-index: 0;\n\t}\n\n\t@media not ( prefers-reduced-motion ) {\n\t\t&:not( [data-skip-animation] ) {\n\t\t\t${ ( [ 'start', 'end' ] as const ).map( ( direction ) =>\n\t\t\t\t( [ 'in', 'out' ] as const ).map(\n\t\t\t\t\t( type ) => css`\n\t\t\t\t\t\t&[data-animation-direction='${ direction }'][data-animation-type='${ type }'] {\n\t\t\t\t\t\t\tanimation: ${ ANIMATION[ direction ][ type ] };\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}\n\t}\n`;\n\nexport const navigatorScreen = css`\n\t/* Ensures horizontal overflow is visually accessible */\n\toverflow-x: auto;\n\t/* In case the root has a height, it should not be exceeded */\n\tmax-height: 100%;\n\tbox-sizing: border-box;\n\n\tposition: relative;\n\n\tgrid-column: 1 / -1;\n\tgrid-row: 1 / -1;\n`;\n"],"mappings":";AAAA;AACA;AACA;AACA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AAA,CAAAC,GAAA,CAAAC,QAAA,wCAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,mmJACxF;IACD6B,GAAG,eAAElC,GAAG,CACJqB,IAAI,CAACC,QAAQ,SAAQD,IAAI,CAACE,MAAM,OAAMF,IAAI,CAACG,KAAK,CACjDE,GAAG,cAAaZ,OAAO,OAAOa,KAAK,CAACL,QAAQ,SAAQK,KAAK,CAACJ,MAAM,YAAWH,YAAY,SAAAjB,OAAA,CAAAC,GAAA,CAAAC,QAAA,yCAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAE3F;AACD,CAAU;AACV,OAAO,MAAMgC,wBAAwB,gBAAGrC,GAAG,4HASnC,CAAE,OAAO,EAAE,KAAK,CAAE,CAAYQ,GAAG,CAAI8B,SAAS,IAChD,CAAE,IAAI,EAAE,KAAK,CAAE,CAAY9B,GAAG,CAC7B+B,IAAI,iBAAMvC,GAAG,iCACiBsC,SAAS,8BAA6BC,IAAI,mBAC1DH,SAAS,CAAEE,SAAS,CAAE,CAAEC,IAAI,CAAE,UAAApC,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,umJAG/C,CACD,CAAC,WAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,umJAGH;AAED,OAAO,MAAMmC,eAAe,GAAArC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,CAW3B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/navigator/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\n\nexport type MatchParams = Record< string, string | string[] >;\n\nexport type NavigateOptions = {\n\t/**\n\t * Specify the CSS selector used to restore focus on an given element when\n\t * navigating back. When not provided, the component will attempt to restore\n\t * focus on the element that originated the forward navigation.\n\t */\n\tfocusTargetSelector?: string;\n\t/**\n\t * Whether the navigation is a backwards navigation. This enables focus\n\t * restoration (when possible), and causes the animation to be backwards.\n\t */\n\tisBack?: boolean;\n\t/**\n\t * Opt out of focus management. Useful when the consumer of the component\n\t * wants to manage focus themselves.\n\t */\n\tskipFocus?: boolean;\n\t/**\n\t * Note: this option is deprecated and currently doesn't have any effect.\n\t * @deprecated\n\t * @ignore\n\t */\n\treplace?: boolean;\n};\n\nexport type NavigateToParentOptions = Omit< NavigateOptions, 'isBack' >;\n\nexport type NavigatorLocation = NavigateOptions & {\n\t/**\n\t * Whether the current location is the initial one (ie. first in the stack).\n\t */\n\tisInitial?: boolean;\n\t/**\n\t * The path associated to the location.\n\t */\n\tpath?: string;\n\t/**\n\t * Whether focus was already restored for this location (in case of\n\t * backwards navigation).\n\t */\n\thasRestoredFocus?: boolean;\n};\n\n// Returned by the `useNavigator` hook.\nexport type Navigator = {\n\t/**\n\t * The current location.\n\t */\n\tlocation: NavigatorLocation;\n\t/**\n\t * Params associated with the current location\n\t */\n\tparams: MatchParams;\n\t/**\n\t * Navigate to a new location.\n\t */\n\tgoTo: ( path: string, options?: NavigateOptions ) => void;\n\t/**\n\t * Go back to the parent location (ie. \"/some/path\" will navigate back\n\t * to \"/some\")\n\t */\n\tgoBack: ( options?: NavigateToParentOptions ) => void;\n\t/**\n\t * _Note: This function is deprecated. Please use `goBack` instead._\n\t * @deprecated\n\t * @ignore\n\t */\n\tgoToParent: ( options?: NavigateToParentOptions ) => void;\n};\n\nexport type NavigatorContext = Navigator & {\n\taddScreen: ( screen: Screen ) => void;\n\tremoveScreen: ( screen: Screen ) => void;\n\tmatch?: string;\n};\n\nexport type NavigatorProviderProps = {\n\t/**\n\t * The initial active path.\n\t */\n\tinitialPath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorScreenProps = {\n\t/**\n\t * The screen's path, matched against the current path stored in the navigator.\n\t */\n\tpath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorBackButtonProps = ButtonAsButtonProps;\n\nexport type NavigatorToParentButtonProps = NavigatorBackButtonProps;\n\nexport type NavigatorButtonProps = NavigatorBackButtonProps & {\n\t/**\n\t * The path of the screen to navigate to. The value of this prop needs to be\n\t * a valid value for an HTML attribute.\n\t */\n\tpath: string;\n\t/**\n\t * The HTML attribute used to identify the `NavigatorButton`, which is used\n\t * by `Navigator` to restore focus.\n\t *\n\t * @default 'id'\n\t */\n\tattributeName?: string;\n};\n\nexport type Screen = {\n\tid: string;\n\tpath: string;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/navigator/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\n\nexport type MatchParams = Record< string, string | string[] >;\n\nexport type NavigateOptions = {\n\t/**\n\t * Specify the CSS selector used to restore focus on an given element when\n\t * navigating back. When not provided, the component will attempt to restore\n\t * focus on the element that originated the forward navigation.\n\t */\n\tfocusTargetSelector?: string;\n\t/**\n\t * Whether the navigation is a backwards navigation. This enables focus\n\t * restoration (when possible), and causes the animation to be backwards.\n\t */\n\tisBack?: boolean;\n\t/**\n\t * Opt out of focus management. Useful when the consumer of the component\n\t * wants to manage focus themselves.\n\t */\n\tskipFocus?: boolean;\n\t/**\n\t * Note: this option is deprecated and currently doesn't have any effect.\n\t * @deprecated\n\t * @ignore\n\t */\n\treplace?: boolean;\n};\n\nexport type NavigateToParentOptions = Omit< NavigateOptions, 'isBack' >;\n\nexport type NavigatorLocation = NavigateOptions & {\n\t/**\n\t * Whether the current location is the initial one (ie. first in the stack).\n\t */\n\tisInitial?: boolean;\n\t/**\n\t * The path associated to the location.\n\t */\n\tpath?: string;\n\t/**\n\t * Whether focus was already restored for this location (in case of\n\t * backwards navigation).\n\t */\n\thasRestoredFocus?: boolean;\n};\n\n// Returned by the `useNavigator` hook.\nexport type Navigator = {\n\t/**\n\t * The current location.\n\t */\n\tlocation: NavigatorLocation;\n\t/**\n\t * Params associated with the current location\n\t */\n\tparams: MatchParams;\n\t/**\n\t * Navigate to a new location.\n\t */\n\tgoTo: ( path: string, options?: NavigateOptions ) => void;\n\t/**\n\t * Go back to the parent location (ie. \"/some/path\" will navigate back\n\t * to \"/some\")\n\t */\n\tgoBack: ( options?: NavigateToParentOptions ) => void;\n\t/**\n\t * _Note: This function is deprecated. Please use `goBack` instead._\n\t * @deprecated\n\t * @ignore\n\t */\n\tgoToParent: ( options?: NavigateToParentOptions ) => void;\n};\n\nexport type NavigatorContext = Navigator & {\n\taddScreen: ( screen: Screen ) => void;\n\tremoveScreen: ( screen: Screen ) => void;\n\tmatch?: string;\n};\n\nexport type NavigatorProps = {\n\t/**\n\t * The initial active path.\n\t */\n\tinitialPath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorScreenProps = {\n\t/**\n\t * The screen's path, matched against the current path stored in the navigator.\n\t *\n\t * `Navigator` assumes that screens are organized hierarchically according\n\t * to their `path`, which should follow a URL-like scheme where each path\n\t * segment starts with and is separated by the `/` character.\n\t *\n\t * `Navigator` will treat \"back\" navigations as going to the parent screen —\n\t * it is, therefore, the responsibility of the consumer of the component to\n\t * create the correct screen hierarchy.\n\t *\n\t * For example:\n\t * - `/` is the root of all paths. There should always be a screen with\n\t * `path=\"/\"`;\n\t * - `/parent/child` is a child of `/parent`;\n\t * - `/parent/child/grand-child` is a child of `/parent/child`;\n\t * - `/parent/:param` is a child of `/parent` as well;\n\t * - if the current screen has a `path=\"/parent/child/grand-child\"`, when\n\t * going \"back\" `Navigator` will try to recursively navigate the path\n\t * hierarchy until a matching screen (or the root `/`) is found.\n\t */\n\tpath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorBackButtonProps = ButtonAsButtonProps;\n\nexport type NavigatorToParentButtonProps = NavigatorBackButtonProps;\n\nexport type NavigatorButtonProps = NavigatorBackButtonProps & {\n\t/**\n\t * The path of the screen to navigate to. The value of this prop needs to be\n\t * a valid value for an HTML attribute.\n\t */\n\tpath: string;\n\t/**\n\t * The HTML attribute used to identify the `NavigatorButton`, which is used\n\t * by `Navigator` to restore focus.\n\t *\n\t * @default 'id'\n\t */\n\tattributeName?: string;\n};\n\nexport type Screen = {\n\tid: string;\n\tpath: string;\n};\n"],"mappings":"","ignoreList":[]}
@@ -8,7 +8,10 @@ import { useContext } from '@wordpress/element';
8
8
  */
9
9
  import { NavigatorContext } from './context';
10
10
  /**
11
- * Retrieves a `navigator` instance.
11
+ * Retrieves a `navigator` instance. This hook provides advanced functionality,
12
+ * such as imperatively navigating to a new location (with options like
13
+ * navigating back or skipping focus restoration) and accessing the current
14
+ * location and path parameters.
12
15
  */
13
16
  export function useNavigator() {
14
17
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","NavigatorContext","useNavigator","location","params","goTo","goBack","goToParent"],"sources":["@wordpress/components/src/navigator/use-navigator.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { NavigatorContext } from './context';\nimport type { Navigator } from './types';\n\n/**\n * Retrieves a `navigator` instance.\n */\nexport function useNavigator(): Navigator {\n\tconst { location, params, goTo, goBack, goToParent } =\n\t\tuseContext( NavigatorContext );\n\n\treturn {\n\t\tlocation,\n\t\tgoTo,\n\t\tgoBack,\n\t\tgoToParent,\n\t\tparams,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,WAAW;AAG5C;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAA,EAAc;EACzC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC;EAAW,CAAC,GACnDP,UAAU,CAAEC,gBAAiB,CAAC;EAE/B,OAAO;IACNE,QAAQ;IACRE,IAAI;IACJC,MAAM;IACNC,UAAU;IACVH;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useContext","NavigatorContext","useNavigator","location","params","goTo","goBack","goToParent"],"sources":["@wordpress/components/src/navigator/use-navigator.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { NavigatorContext } from './context';\nimport type { Navigator } from './types';\n\n/**\n * Retrieves a `navigator` instance. This hook provides advanced functionality,\n * such as imperatively navigating to a new location (with options like\n * navigating back or skipping focus restoration) and accessing the current\n * location and path parameters.\n */\nexport function useNavigator(): Navigator {\n\tconst { location, params, goTo, goBack, goToParent } =\n\t\tuseContext( NavigatorContext );\n\n\treturn {\n\t\tlocation,\n\t\tgoTo,\n\t\tgoBack,\n\t\tgoToParent,\n\t\tparams,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,WAAW;AAG5C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAA,EAAc;EACzC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC;EAAW,CAAC,GACnDP,UAAU,CAAEC,gBAAiB,CAAC;EAE/B,OAAO;IACNE,QAAQ;IACRE,IAAI;IACJC,MAAM;IACNC,UAAU;IACVH;EACD,CAAC;AACF","ignoreList":[]}
@@ -16,8 +16,7 @@ import { close } from '@wordpress/icons';
16
16
  */
17
17
  import Button from '../button';
18
18
  import { VisuallyHidden } from '../visually-hidden';
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
20
  const noop = () => {};
22
21
 
23
22
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","RawHTML","useEffect","renderToString","speak","close","Button","VisuallyHidden","jsx","_jsx","jsxs","_jsxs","noop","useSpokenMessage","message","politeness","spokenMessage","getDefaultPoliteness","status","getStatusLabel","Notice","className","children","onRemove","isDismissible","actions","__unstableHTML","onDismiss","classes","onDismissNotice","map","buttonCustomClasses","label","isPrimary","variant","noDefaultClasses","onClick","url","index","computedVariant","href","undefined","icon"],"sources":["@wordpress/components/src/notice/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RawHTML, useEffect, renderToString } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport type { NoticeAction, NoticeProps } from './types';\nimport type { DeprecatedButtonProps } from '../button/types';\nimport { VisuallyHidden } from '../visually-hidden';\n\nconst noop = () => {};\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n */\nfunction useSpokenMessage(\n\tmessage: NoticeProps[ 'spokenMessage' ],\n\tpoliteness: NoticeProps[ 'politeness' ]\n) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction getDefaultPoliteness( status: NoticeProps[ 'status' ] ) {\n\tswitch ( status ) {\n\t\tcase 'success':\n\t\tcase 'warning':\n\t\tcase 'info':\n\t\t\treturn 'polite';\n\t\t// The default will also catch the 'error' status.\n\t\tdefault:\n\t\t\treturn 'assertive';\n\t}\n}\n\nfunction getStatusLabel( status: NoticeProps[ 'status' ] ) {\n\tswitch ( status ) {\n\t\tcase 'warning':\n\t\t\treturn __( 'Warning notice' );\n\t\tcase 'info':\n\t\t\treturn __( 'Information notice' );\n\t\tcase 'error':\n\t\t\treturn __( 'Error notice' );\n\t\t// The default will also catch the 'success' status.\n\t\tdefault:\n\t\t\treturn __( 'Notice' );\n\t}\n}\n\n/**\n * `Notice` is a component used to communicate feedback to the user.\n *\n *```jsx\n * import { Notice } from `@wordpress/components`;\n *\n * const MyNotice = () => (\n * <Notice status=\"error\">An unknown error occurred.</Notice>\n * );\n * ```\n */\nfunction Notice( {\n\tclassName,\n\tstatus = 'info',\n\tchildren,\n\tspokenMessage = children,\n\tonRemove = noop,\n\tisDismissible = true,\n\tactions = [],\n\tpoliteness = getDefaultPoliteness( status ),\n\t__unstableHTML,\n\t// onDismiss is a callback executed when the notice is dismissed.\n\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t// actually the function to call to remove the notice from the UI.\n\tonDismiss = noop,\n}: NoticeProps ) {\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\tconst classes = clsx( className, 'components-notice', 'is-' + status, {\n\t\t'is-dismissible': isDismissible,\n\t} );\n\n\tif ( __unstableHTML && typeof children === 'string' ) {\n\t\tchildren = <RawHTML>{ children }</RawHTML>;\n\t}\n\n\tconst onDismissNotice = () => {\n\t\tonDismiss();\n\t\tonRemove();\n\t};\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t<VisuallyHidden>{ getStatusLabel( status ) }</VisuallyHidden>\n\t\t\t<div className=\"components-notice__content\">\n\t\t\t\t{ children }\n\t\t\t\t<div className=\"components-notice__actions\">\n\t\t\t\t\t{ actions.map(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclassName: buttonCustomClasses,\n\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\tisPrimary,\n\t\t\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t\t\tnoDefaultClasses = false,\n\t\t\t\t\t\t\t\tonClick,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t}: NoticeAction &\n\t\t\t\t\t\t\t\t// `isPrimary` is a legacy prop included for\n\t\t\t\t\t\t\t\t// backcompat, but `variant` should be used\n\t\t\t\t\t\t\t\t// instead.\n\t\t\t\t\t\t\t\tPick< DeprecatedButtonProps, 'isPrimary' >,\n\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tlet computedVariant = variant;\n\t\t\t\t\t\t\tif ( variant !== 'primary' && ! noDefaultClasses ) {\n\t\t\t\t\t\t\t\tcomputedVariant = ! url ? 'secondary' : 'link';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttypeof computedVariant === 'undefined' &&\n\t\t\t\t\t\t\t\tisPrimary\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcomputedVariant = 'primary';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\t\t\tvariant={ computedVariant }\n\t\t\t\t\t\t\t\t\tonClick={ url ? undefined : onClick }\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'components-notice__action',\n\t\t\t\t\t\t\t\t\t\tbuttonCustomClasses\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</Button>\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</div>\n\t\t\t{ isDismissible && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"components-notice__dismiss\"\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\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gB,GAAG,KAAK;UACxBC,OAAO;UACPC;QAKyC,CAAC,EAC3CC,KAAK,KACD;UACJ,IAAIC,eAAe,GAAGL,OAAO;UAC7B,IAAKA,OAAO,KAAK,SAAS,IAAI,CAAEC,gBAAgB,EAAG;YAClDI,eAAe,GAAG,CAAEF,GAAG,GAAG,WAAW,GAAG,MAAM;UAC/C;UACA,IACC,OAAOE,eAAe,KAAK,WAAW,IACtCN,SAAS,EACR;YACDM,eAAe,GAAG,SAAS;UAC5B;UAEA,oBACC9B,IAAA,CAACH,MAAM;YAENkC,IAAI,EAAGH,GAAK;YACZH,OAAO,EAAGK,eAAiB;YAC3BH,OAAO,EAAGC,GAAG,GAAGI,SAAS,GAAGL,OAAS;YACrCf,SAAS,EAAGtB,IAAI,CACf,2BAA2B,EAC3BgC,mBACD,CAAG;YAAAT,QAAA,EAEDU;UAAK,GATDM,KAUC,CAAC;QAEX,CACD;MAAC,CACG,CAAC;IAAA,CACF,CAAC,EACJd,aAAa,iBACdf,IAAA,CAACH,MAAM;MACNe,SAAS,EAAC,4BAA4B;MACtCqB,IAAI,EAAGrC,KAAO;MACd2B,KAAK,EAAGhC,EAAE,CAAE,OAAQ,CAAG;MACvBoC,OAAO,EAAGP;IAAiB,CAC3B,CACD;EAAA,CACG,CAAC;AAER;AAEA,eAAeT,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","RawHTML","useEffect","renderToString","speak","close","Button","VisuallyHidden","jsx","_jsx","jsxs","_jsxs","noop","useSpokenMessage","message","politeness","spokenMessage","getDefaultPoliteness","status","getStatusLabel","Notice","className","children","onRemove","isDismissible","actions","__unstableHTML","onDismiss","classes","onDismissNotice","map","buttonCustomClasses","label","isPrimary","variant","noDefaultClasses","onClick","url","index","computedVariant","href","undefined","icon"],"sources":["@wordpress/components/src/notice/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { RawHTML, useEffect, renderToString } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport type { NoticeAction, NoticeProps } from './types';\nimport type { DeprecatedButtonProps } from '../button/types';\nimport { VisuallyHidden } from '../visually-hidden';\n\nconst noop = () => {};\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n */\nfunction useSpokenMessage(\n\tmessage: NoticeProps[ 'spokenMessage' ],\n\tpoliteness: NoticeProps[ 'politeness' ]\n) {\n\tconst spokenMessage =\n\t\ttypeof message === 'string' ? message : renderToString( message );\n\n\tuseEffect( () => {\n\t\tif ( spokenMessage ) {\n\t\t\tspeak( spokenMessage, politeness );\n\t\t}\n\t}, [ spokenMessage, politeness ] );\n}\n\nfunction getDefaultPoliteness( status: NoticeProps[ 'status' ] ) {\n\tswitch ( status ) {\n\t\tcase 'success':\n\t\tcase 'warning':\n\t\tcase 'info':\n\t\t\treturn 'polite';\n\t\t// The default will also catch the 'error' status.\n\t\tdefault:\n\t\t\treturn 'assertive';\n\t}\n}\n\nfunction getStatusLabel( status: NoticeProps[ 'status' ] ) {\n\tswitch ( status ) {\n\t\tcase 'warning':\n\t\t\treturn __( 'Warning notice' );\n\t\tcase 'info':\n\t\t\treturn __( 'Information notice' );\n\t\tcase 'error':\n\t\t\treturn __( 'Error notice' );\n\t\t// The default will also catch the 'success' status.\n\t\tdefault:\n\t\t\treturn __( 'Notice' );\n\t}\n}\n\n/**\n * `Notice` is a component used to communicate feedback to the user.\n *\n *```jsx\n * import { Notice } from `@wordpress/components`;\n *\n * const MyNotice = () => (\n * <Notice status=\"error\">An unknown error occurred.</Notice>\n * );\n * ```\n */\nfunction Notice( {\n\tclassName,\n\tstatus = 'info',\n\tchildren,\n\tspokenMessage = children,\n\tonRemove = noop,\n\tisDismissible = true,\n\tactions = [],\n\tpoliteness = getDefaultPoliteness( status ),\n\t__unstableHTML,\n\t// onDismiss is a callback executed when the notice is dismissed.\n\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t// actually the function to call to remove the notice from the UI.\n\tonDismiss = noop,\n}: NoticeProps ) {\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\tconst classes = clsx( className, 'components-notice', 'is-' + status, {\n\t\t'is-dismissible': isDismissible,\n\t} );\n\n\tif ( __unstableHTML && typeof children === 'string' ) {\n\t\tchildren = <RawHTML>{ children }</RawHTML>;\n\t}\n\n\tconst onDismissNotice = () => {\n\t\tonDismiss();\n\t\tonRemove();\n\t};\n\n\treturn (\n\t\t<div className={ classes }>\n\t\t\t<VisuallyHidden>{ getStatusLabel( status ) }</VisuallyHidden>\n\t\t\t<div className=\"components-notice__content\">\n\t\t\t\t{ children }\n\t\t\t\t<div className=\"components-notice__actions\">\n\t\t\t\t\t{ actions.map(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclassName: buttonCustomClasses,\n\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\tisPrimary,\n\t\t\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t\t\tnoDefaultClasses = false,\n\t\t\t\t\t\t\t\tonClick,\n\t\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t}: NoticeAction &\n\t\t\t\t\t\t\t\t// `isPrimary` is a legacy prop included for\n\t\t\t\t\t\t\t\t// backcompat, but `variant` should be used\n\t\t\t\t\t\t\t\t// instead.\n\t\t\t\t\t\t\t\tPick< DeprecatedButtonProps, 'isPrimary' >,\n\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tlet computedVariant = variant;\n\t\t\t\t\t\t\tif ( variant !== 'primary' && ! noDefaultClasses ) {\n\t\t\t\t\t\t\t\tcomputedVariant = ! url ? 'secondary' : 'link';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttypeof computedVariant === 'undefined' &&\n\t\t\t\t\t\t\t\tisPrimary\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcomputedVariant = 'primary';\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\t\t\tvariant={ computedVariant }\n\t\t\t\t\t\t\t\t\tonClick={ url ? undefined : onClick }\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'components-notice__action',\n\t\t\t\t\t\t\t\t\t\tbuttonCustomClasses\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</Button>\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</div>\n\t\t\t{ isDismissible && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"components-notice__dismiss\"\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ onDismissNotice }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default Notice;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,SAAS,EAAEC,cAAc,QAAQ,oBAAoB;AACvE,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SAASC,KAAK,QAAQ,kBAAkB;;AAExC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAG9B,SAASC,cAAc,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpD,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;;AAErB;AACA;AAC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U;UAAK,GATDM,KAUC,CAAC;QAEX,CACD;MAAC,CACG,CAAC;IAAA,CACF,CAAC,EACJd,aAAa,iBACdf,IAAA,CAACH,MAAM;MACNe,SAAS,EAAC,4BAA4B;MACtCqB,IAAI,EAAGrC,KAAO;MACd2B,KAAK,EAAGhC,EAAE,CAAE,OAAQ,CAAG;MACvBoC,OAAO,EAAGP;IAAiB,CAC3B,CACD;EAAA,CACG,CAAC;AAER;AAEA,eAAeT,MAAM","ignoreList":[]}
@@ -14,9 +14,7 @@ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
14
14
  * Internal dependencies
15
15
  */
16
16
  import styles from './style.scss';
17
- import { jsx as _jsx } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
- import { Fragment as _Fragment } from "react/jsx-runtime";
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
20
18
  const HIDE_TIMER = 3000;
21
19
  const Notice = ({
22
20
  onNoticeHidden,
@@ -1 +1 @@
1
- {"version":3,"names":["Animated","Easing","Text","TouchableWithoutFeedback","View","useWindowDimensions","BlurView","useEffect","useRef","useCallback","Platform","usePreferredColorSchemeStyle","styles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","HIDE_TIMER","Notice","onNoticeHidden","content","id","status","width","animationValue","Value","current","timer","timing","toValue","duration","useNativeDriver","easing","out","quad","start","finished","setTimeout","onHide","clearTimeout","noticeSolidStyles","noticeSolid","noticeSolidDark","successTextStyles","successText","successTextDark","errorTextStyles","errorText","errorTextDark","textStyles","containerStyles","notice","isIOS","transform","translateY","interpolate","inputRange","outputRange","children","style","onPress","noticeContent","numberOfLines","blurBackground","blurType","blurAmount"],"sources":["@wordpress/components/src/notice/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tAnimated,\n\tEasing,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n\tuseWindowDimensions,\n} from 'react-native';\nimport { BlurView } from '@react-native-community/blur';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useCallback, Platform } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst HIDE_TIMER = 3000;\n\nconst Notice = ( { onNoticeHidden, content, id, status } ) => {\n\tconst { width } = useWindowDimensions();\n\tconst animationValue = useRef( new Animated.Value( 0 ) ).current;\n\tconst timer = useRef( null );\n\n\tuseEffect( () => {\n\t\t// start animation\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: 1,\n\t\t\tduration: 300,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( ( { finished } ) => {\n\t\t\tif ( finished && onNoticeHidden ) {\n\t\t\t\ttimer.current = setTimeout( () => {\n\t\t\t\t\tonHide();\n\t\t\t\t}, HIDE_TIMER );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tclearTimeout( timer?.current );\n\t\t};\n\t}, [ animationValue, onHide, onNoticeHidden ] );\n\n\tconst onHide = useCallback( () => {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: 0,\n\t\t\tduration: 150,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( ( { finished } ) => {\n\t\t\tif ( finished && onNoticeHidden ) {\n\t\t\t\tonNoticeHidden( id );\n\t\t\t}\n\t\t} );\n\t}, [ animationValue, onNoticeHidden, id ] );\n\n\tconst noticeSolidStyles = usePreferredColorSchemeStyle(\n\t\tstyles.noticeSolid,\n\t\tstyles.noticeSolidDark\n\t);\n\n\tconst successTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.successText,\n\t\tstyles.successTextDark\n\t);\n\n\tconst errorTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.errorText,\n\t\tstyles.errorTextDark\n\t);\n\n\tconst textStyles = [\n\t\tstatus === 'success' && successTextStyles,\n\t\tstatus === 'error' && errorTextStyles,\n\t];\n\n\tconst containerStyles = [\n\t\tstyles.notice,\n\t\t! Platform.isIOS && noticeSolidStyles,\n\t\t{\n\t\t\twidth,\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: animationValue.interpolate( {\n\t\t\t\t\t\tinputRange: [ 0, 1 ],\n\t\t\t\t\t\toutputRange: [ -24, 0 ],\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Animated.View style={ containerStyles }>\n\t\t\t\t<TouchableWithoutFeedback onPress={ onHide }>\n\t\t\t\t\t<View style={ styles.noticeContent }>\n\t\t\t\t\t\t<Text numberOfLines={ 3 } style={ textStyles }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t{ Platform.isIOS && (\n\t\t\t\t\t<BlurView\n\t\t\t\t\t\tstyle={ styles.blurBackground }\n\t\t\t\t\t\tblurType=\"prominent\"\n\t\t\t\t\t\tblurAmount={ 10 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\nexport default Notice;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,MAAM,EACNC,IAAI,EACJC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACb,cAAc;AACrB,SAASC,QAAQ,QAAQ,8BAA8B;;AAEvD;AACA;AACA;AACA,SAASC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC7E,SAASC,4BAA4B,QAAQ,oBAAoB;;AAEjE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAElC,MAAMC,UAAU,G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AAC8D,aAAa,EAAG,CAAG;YAACH,KAAK,EAAGV,UAAY;YAAAS,QAAA,EAC3CtC;UAAO,CACJ;QAAC,CACF;MAAC,CACkB,CAAC,EACzBZ,QAAQ,CAAC4C,KAAK,iBACfxC,IAAA,CAACR,QAAQ;QACRuD,KAAK,EAAGjD,MAAM,CAACqD,cAAgB;QAC/BC,QAAQ,EAAC,WAAW;QACpBC,UAAU,EAAG;MAAI,CACjB,CACD;IAAA,CACa;EAAC,CACf,CAAC;AAEL,CAAC;AAED,eAAe/C,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["Animated","Easing","Text","TouchableWithoutFeedback","View","useWindowDimensions","BlurView","useEffect","useRef","useCallback","Platform","usePreferredColorSchemeStyle","styles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","HIDE_TIMER","Notice","onNoticeHidden","content","id","status","width","animationValue","Value","current","timer","timing","toValue","duration","useNativeDriver","easing","out","quad","start","finished","setTimeout","onHide","clearTimeout","noticeSolidStyles","noticeSolid","noticeSolidDark","successTextStyles","successText","successTextDark","errorTextStyles","errorText","errorTextDark","textStyles","containerStyles","notice","isIOS","transform","translateY","interpolate","inputRange","outputRange","children","style","onPress","noticeContent","numberOfLines","blurBackground","blurType","blurAmount"],"sources":["@wordpress/components/src/notice/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tAnimated,\n\tEasing,\n\tText,\n\tTouchableWithoutFeedback,\n\tView,\n\tuseWindowDimensions,\n} from 'react-native';\nimport { BlurView } from '@react-native-community/blur';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef, useCallback, Platform } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nconst HIDE_TIMER = 3000;\n\nconst Notice = ( { onNoticeHidden, content, id, status } ) => {\n\tconst { width } = useWindowDimensions();\n\tconst animationValue = useRef( new Animated.Value( 0 ) ).current;\n\tconst timer = useRef( null );\n\n\tuseEffect( () => {\n\t\t// start animation\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: 1,\n\t\t\tduration: 300,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( ( { finished } ) => {\n\t\t\tif ( finished && onNoticeHidden ) {\n\t\t\t\ttimer.current = setTimeout( () => {\n\t\t\t\t\tonHide();\n\t\t\t\t}, HIDE_TIMER );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tclearTimeout( timer?.current );\n\t\t};\n\t}, [ animationValue, onHide, onNoticeHidden ] );\n\n\tconst onHide = useCallback( () => {\n\t\tAnimated.timing( animationValue, {\n\t\t\ttoValue: 0,\n\t\t\tduration: 150,\n\t\t\tuseNativeDriver: true,\n\t\t\teasing: Easing.out( Easing.quad ),\n\t\t} ).start( ( { finished } ) => {\n\t\t\tif ( finished && onNoticeHidden ) {\n\t\t\t\tonNoticeHidden( id );\n\t\t\t}\n\t\t} );\n\t}, [ animationValue, onNoticeHidden, id ] );\n\n\tconst noticeSolidStyles = usePreferredColorSchemeStyle(\n\t\tstyles.noticeSolid,\n\t\tstyles.noticeSolidDark\n\t);\n\n\tconst successTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.successText,\n\t\tstyles.successTextDark\n\t);\n\n\tconst errorTextStyles = usePreferredColorSchemeStyle(\n\t\tstyles.errorText,\n\t\tstyles.errorTextDark\n\t);\n\n\tconst textStyles = [\n\t\tstatus === 'success' && successTextStyles,\n\t\tstatus === 'error' && errorTextStyles,\n\t];\n\n\tconst containerStyles = [\n\t\tstyles.notice,\n\t\t! Platform.isIOS && noticeSolidStyles,\n\t\t{\n\t\t\twidth,\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: animationValue.interpolate( {\n\t\t\t\t\t\tinputRange: [ 0, 1 ],\n\t\t\t\t\t\toutputRange: [ -24, 0 ],\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<Animated.View style={ containerStyles }>\n\t\t\t\t<TouchableWithoutFeedback onPress={ onHide }>\n\t\t\t\t\t<View style={ styles.noticeContent }>\n\t\t\t\t\t\t<Text numberOfLines={ 3 } style={ textStyles }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableWithoutFeedback>\n\t\t\t\t{ Platform.isIOS && (\n\t\t\t\t\t<BlurView\n\t\t\t\t\t\tstyle={ styles.blurBackground }\n\t\t\t\t\t\tblurType=\"prominent\"\n\t\t\t\t\t\tblurAmount={ 10 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\nexport default Notice;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,MAAM,EACNC,IAAI,EACJC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACb,cAAc;AACrB,SAASC,QAAQ,QAAQ,8BAA8B;;AAEvD;AACA;AACA;AACA,SAASC,SAAS,EAAEC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,oBAAoB;AAC7E,SAASC,4BAA4B,QAAQ,oBAAoB;;AAEjE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAElC,MAAMC,UAAU,GAAG,IAAI;AAEvB,MAAMC,MAAM,GAAGA,CAAE;EAAEC,cAAc;EAAEC,OAAO;EAAEC,EAAE;EAAEC;AAAO,CAAC,KAAM;EAC7D,MAAM;IAAEC;EAAM,CAAC,GAAGpB,mBAAmB,CAAC,CAAC;EACvC,MAAMqB,cAAc,GAAGlB,MAAM,CAAE,IAAIR,QAAQ,CAAC2B,KAAK,CAAE,CAAE,CAAE,CAAC,CAACC,OAAO;EAChE,MAAMC,KAAK,GAAG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AAC;AAEL,CAAC;AAED,eAAe/C,MAAM","ignoreList":[]}
@@ -22,9 +22,7 @@ import { HStack } from '../h-stack';
22
22
  import { Spacer } from '../spacer';
23
23
  import { useCx } from '../utils';
24
24
  import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
25
- import { jsx as _jsx } from "react/jsx-runtime";
26
- import { jsxs as _jsxs } from "react/jsx-runtime";
27
- import { Fragment as _Fragment } from "react/jsx-runtime";
25
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
28
26
  const noop = () => {};
29
27
  function UnforwardedNumberControl(props, forwardedRef) {
30
28
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useRef","forwardRef","isRTL","__","plus","plusIcon","reset","resetIcon","useMergeRefs","deprecated","Input","SpinButton","styles","inputControlActionTypes","add","subtract","roundClamp","ensureNumber","isValueEmpty","HStack","Spacer","useCx","useDeprecated36pxDefaultSizeProp","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","UnforwardedNumberControl","props","forwardedRef","__unstableStateReducer","stateReducerProp","className","dragDirection","hideHTMLArrows","spinControls","isDragEnabled","isShiftStepEnabled","label","max","Infinity","min","required","shiftStep","step","spinFactor","type","typeProp","value","valueProp","size","suffix","onChange","restProps","alternative","since","version","inputRef","mergedRef","isStepAny","baseStep","baseSpin","baseValue","constrainValue","stepOverride","Math","autoComplete","undefined","classes","cx","spinButtonClasses","smallSpinButtons","spinValue","direction","event","preventDefault","shift","shiftKey","delta","nextValue","numberControlStateReducer","state","action","nextState","payload","currentValue","PRESS_UP","PRESS_DOWN","DRAG","x","y","enableShift","modifier","directionModifier","ceil","abs","sign","distance","PRESS_ENTER","COMMIT","applyEmptyValue","buildSpinButtonClickHandler","String","target","current","inputMode","ref","_stateReducerProp","baseState","children","marginBottom","marginRight","spacing","icon","onClick","NumberControl"],"sources":["@wordpress/components/src/number-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Input, SpinButton, styles } from './styles/number-control-styles';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { add, subtract, roundClamp } from '../utils/math';\nimport { ensureNumber, isValueEmpty } from '../utils/values';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\nimport type { NumberControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport { useCx } from '../utils';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nconst noop = () => {};\n\nfunction UnforwardedNumberControl(\n\tprops: WordPressComponentProps< NumberControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tclassName,\n\t\tdragDirection = 'n',\n\t\thideHTMLArrows = false,\n\t\tspinControls = hideHTMLArrows ? 'none' : 'native',\n\t\tisDragEnabled = true,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmax = Infinity,\n\t\tmin = -Infinity,\n\t\trequired = false,\n\t\tshiftStep = 10,\n\t\tstep = 1,\n\t\tspinFactor = 1,\n\t\ttype: typeProp = 'number',\n\t\tvalue: valueProp,\n\t\tsize = 'default',\n\t\tsuffix,\n\t\tonChange = noop,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp< NumberControlProps >( props );\n\n\tif ( hideHTMLArrows ) {\n\t\tdeprecated( 'wp.components.NumberControl hideHTMLArrows prop ', {\n\t\t\talternative: 'spinControls=\"none\"',\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst mergedRef = useMergeRefs( [ inputRef, forwardedRef ] );\n\n\tconst isStepAny = step === 'any';\n\tconst baseStep = isStepAny ? 1 : ensureNumber( step );\n\tconst baseSpin = ensureNumber( spinFactor ) * baseStep;\n\tconst baseValue = roundClamp( 0, min, max, baseStep );\n\tconst constrainValue = (\n\t\tvalue: number | string,\n\t\tstepOverride?: number\n\t) => {\n\t\t// When step is \"any\" clamp the value, otherwise round and clamp it.\n\t\t// Use '' + to convert to string for use in input value attribute.\n\t\treturn isStepAny\n\t\t\t? '' + Math.min( max, Math.max( min, ensureNumber( value ) ) )\n\t\t\t: '' + roundClamp( value, min, max, stepOverride ?? baseStep );\n\t};\n\n\tconst autoComplete = typeProp === 'number' ? 'off' : undefined;\n\tconst classes = clsx( 'components-number-control', className );\n\tconst cx = useCx();\n\tconst spinButtonClasses = cx( size === 'small' && styles.smallSpinButtons );\n\n\tconst spinValue = (\n\t\tvalue: string | number | undefined,\n\t\tdirection: 'up' | 'down',\n\t\tevent: KeyboardEvent | MouseEvent | undefined\n\t) => {\n\t\tevent?.preventDefault();\n\t\tconst shift = event?.shiftKey && isShiftStepEnabled;\n\t\tconst delta = shift ? ensureNumber( shiftStep ) * baseSpin : baseSpin;\n\t\tlet nextValue = isValueEmpty( value ) ? baseValue : value;\n\t\tif ( direction === 'up' ) {\n\t\t\tnextValue = add( nextValue, delta );\n\t\t} else if ( direction === 'down' ) {\n\t\t\tnextValue = subtract( nextValue, delta );\n\t\t}\n\t\treturn constrainValue( nextValue, shift ? delta : undefined );\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst numberControlStateReducer: NumberControlProps[ '__unstableStateReducer' ] =\n\t\t( state, action ) => {\n\t\t\tconst nextState = { ...state };\n\n\t\t\tconst { type, payload } = action;\n\t\t\tconst event = payload.event;\n\t\t\tconst currentValue = nextState.value;\n\n\t\t\t/**\n\t\t\t * Handles custom UP and DOWN Keyboard events\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_UP ||\n\t\t\t\ttype === inputControlActionTypes.PRESS_DOWN\n\t\t\t) {\n\t\t\t\tnextState.value = spinValue(\n\t\t\t\t\tcurrentValue,\n\t\t\t\t\ttype === inputControlActionTypes.PRESS_UP ? 'up' : 'down',\n\t\t\t\t\tevent as KeyboardEvent | undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles drag to update events\n\t\t\t */\n\t\t\tif ( type === inputControlActionTypes.DRAG && isDragEnabled ) {\n\t\t\t\tconst [ x, y ] = payload.delta;\n\t\t\t\tconst enableShift = payload.shiftKey && isShiftStepEnabled;\n\t\t\t\tconst modifier = enableShift\n\t\t\t\t\t? ensureNumber( shiftStep ) * baseSpin\n\t\t\t\t\t: baseSpin;\n\n\t\t\t\tlet directionModifier;\n\t\t\t\tlet delta;\n\n\t\t\t\tswitch ( dragDirection ) {\n\t\t\t\t\tcase 'n':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = -1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'e':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? -1 : 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 's':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'w':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? 1 : -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( delta !== 0 ) {\n\t\t\t\t\tdelta = Math.ceil( Math.abs( delta ) ) * Math.sign( delta );\n\t\t\t\t\tconst distance = delta * modifier * directionModifier;\n\n\t\t\t\t\tnextState.value = constrainValue(\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t\tadd( currentValue, distance ),\n\t\t\t\t\t\tenableShift ? modifier : undefined\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles commit (ENTER key press or blur)\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_ENTER ||\n\t\t\t\ttype === inputControlActionTypes.COMMIT\n\t\t\t) {\n\t\t\t\tconst applyEmptyValue =\n\t\t\t\t\trequired === false && currentValue === '';\n\n\t\t\t\tnextState.value = applyEmptyValue\n\t\t\t\t\t? currentValue\n\t\t\t\t\t: // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t constrainValue( currentValue );\n\t\t\t}\n\n\t\t\treturn nextState;\n\t\t};\n\n\tconst buildSpinButtonClickHandler =\n\t\t( direction: 'up' | 'down' ) =>\n\t\t( event: MouseEvent< HTMLButtonElement > ) =>\n\t\t\tonChange( String( spinValue( valueProp, direction, event ) ), {\n\t\t\t\t// Set event.target to the <input> so that consumers can use\n\t\t\t\t// e.g. event.target.validity.\n\t\t\t\tevent: {\n\t\t\t\t\t...event,\n\t\t\t\t\ttarget: inputRef.current!,\n\t\t\t\t},\n\t\t\t} );\n\n\treturn (\n\t\t<Input\n\t\t\tautoComplete={ autoComplete }\n\t\t\tinputMode=\"numeric\"\n\t\t\t{ ...restProps }\n\t\t\tclassName={ classes }\n\t\t\tdragDirection={ dragDirection }\n\t\t\thideHTMLArrows={ spinControls !== 'native' }\n\t\t\tisDragEnabled={ isDragEnabled }\n\t\t\tlabel={ label }\n\t\t\tmax={ max }\n\t\t\tmin={ min }\n\t\t\tref={ mergedRef }\n\t\t\trequired={ required }\n\t\t\tstep={ step }\n\t\t\ttype={ typeProp }\n\t\t\t// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components\n\t\t\tvalue={ valueProp }\n\t\t\t__unstableStateReducer={ ( state, action ) => {\n\t\t\t\tconst baseState = numberControlStateReducer( state, action );\n\t\t\t\treturn stateReducerProp?.( baseState, action ) ?? baseState;\n\t\t\t} }\n\t\t\tsize={ size }\n\t\t\tsuffix={\n\t\t\t\tspinControls === 'custom' ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t<Spacer marginBottom={ 0 } marginRight={ 2 }>\n\t\t\t\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ plusIcon }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Increment' ) }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'up'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Decrement' ) }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'down'\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</HStack>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tsuffix\n\t\t\t\t)\n\t\t\t}\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport const NumberControl = forwardRef( UnforwardedNumberControl );\n\nexport default NumberControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,S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7C,MAAMC,SAAS,GAAG5B,yBAAyB,CAAEC,KAAK,EAAEC,MAAO,CAAC;MAC5D,QAAAyB,iBAAA,GAAO5E,gBAAgB,GAAI6E,SAAS,EAAE1B,MAAO,CAAC,cAAAyB,iBAAA,cAAAA,iBAAA,GAAIC,SAAS;IAC5D,CAAG;IACH1D,IAAI,EAAGA,IAAM;IACbC,MAAM,EACLhB,YAAY,KAAK,QAAQ,gBACxBZ,KAAA,CAAAE,SAAA;MAAAoF,QAAA,GACG1D,MAAM,eACR9B,IAAA,CAACJ,MAAM;QAAC6F,YAAY,EAAG,CAAG;QAACC,WAAW,EAAG,CAAG;QAAAF,QAAA,eAC3CtF,KAAA,CAACP,MAAM;UAACgG,OAAO,EAAG,CAAG;UAAAH,QAAA,gBACpBxF,IAAA,CAACb,UAAU;YACVwB,SAAS,EAAGsC,iBAAmB;YAC/B2C,IAAI,EAAG/G,QAAU;YACjBgD,IAAI,EAAC,OAAO;YACZZ,KAAK,EAAGtC,EAAE,CAAE,WAAY,CAAG;YAC3BkH,OAAO,EAAGb,2BAA2B,CACpC,IACD;UAAG,CACH,CAAC,eACFhF,IAAA,CAACb,UAAU;YACVwB,SAAS,EAAGsC,iBAAmB;YAC/B2C,IAAI,EAAG7G,SAAW;YAClB8C,IAAI,EAAC,OAAO;YACZZ,KAAK,EAAGtC,EAAE,CAAE,WAAY,CAAG;YAC3BkH,OAAO,EAAGb,2BAA2B,CACpC,MACD;UAAG,CACH,CAAC;QAAA,CACK;MAAC,CACF,CAAC;IAAA,CACR,CAAC,GAEHlD,MAED;IACDC,QAAQ,EAAGA;EAAU,CACrB,CAAC;AAEJ;AAEA,OAAO,MAAM+D,aAAa,GAAGrH,UAAU,CAAE6B,wBAAyB,CAAC;AAEnE,eAAewF,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useRef","forwardRef","isRTL","__","plus","plusIcon","reset","resetIcon","useMergeRefs","deprecated","Input","SpinButton","styles","inputControlActionTypes","add","subtract","roundClamp","ensureNumber","isValueEmpty","HStack","Spacer","useCx","useDeprecated36pxDefaultSizeProp","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","noop","UnforwardedNumberControl","props","forwardedRef","__unstableStateReducer","stateReducerProp","className","dragDirection","hideHTMLArrows","spinControls","isDragEnabled","isShiftStepEnabled","label","max","Infinity","min","required","shiftStep","step","spinFactor","type","typeProp","value","valueProp","size","suffix","onChange","restProps","alternative","since","version","inputRef","mergedRef","isStepAny","baseStep","baseSpin","baseValue","constrainValue","stepOverride","Math","autoComplete","undefined","classes","cx","spinButtonClasses","smallSpinButtons","spinValue","direction","event","preventDefault","shift","shiftKey","delta","nextValue","numberControlStateReducer","state","action","nextState","payload","currentValue","PRESS_UP","PRESS_DOWN","DRAG","x","y","enableShift","modifier","directionModifier","ceil","abs","sign","distance","PRESS_ENTER","COMMIT","applyEmptyValue","buildSpinButtonClickHandler","String","target","current","inputMode","ref","_stateReducerProp","baseState","children","marginBottom","marginRight","spacing","icon","onClick","NumberControl"],"sources":["@wordpress/components/src/number-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { plus as plusIcon, reset as resetIcon } from '@wordpress/icons';\nimport { useMergeRefs } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Input, SpinButton, styles } from './styles/number-control-styles';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { add, subtract, roundClamp } from '../utils/math';\nimport { ensureNumber, isValueEmpty } from '../utils/values';\nimport type { WordPressComponentProps } from '../context/wordpress-component';\nimport type { NumberControlProps } from './types';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport { useCx } from '../utils';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nconst noop = () => {};\n\nfunction UnforwardedNumberControl(\n\tprops: WordPressComponentProps< NumberControlProps, 'input', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tclassName,\n\t\tdragDirection = 'n',\n\t\thideHTMLArrows = false,\n\t\tspinControls = hideHTMLArrows ? 'none' : 'native',\n\t\tisDragEnabled = true,\n\t\tisShiftStepEnabled = true,\n\t\tlabel,\n\t\tmax = Infinity,\n\t\tmin = -Infinity,\n\t\trequired = false,\n\t\tshiftStep = 10,\n\t\tstep = 1,\n\t\tspinFactor = 1,\n\t\ttype: typeProp = 'number',\n\t\tvalue: valueProp,\n\t\tsize = 'default',\n\t\tsuffix,\n\t\tonChange = noop,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp< NumberControlProps >( props );\n\n\tif ( hideHTMLArrows ) {\n\t\tdeprecated( 'wp.components.NumberControl hideHTMLArrows prop ', {\n\t\t\talternative: 'spinControls=\"none\"',\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.3',\n\t\t} );\n\t}\n\tconst inputRef = useRef< HTMLInputElement >();\n\tconst mergedRef = useMergeRefs( [ inputRef, forwardedRef ] );\n\n\tconst isStepAny = step === 'any';\n\tconst baseStep = isStepAny ? 1 : ensureNumber( step );\n\tconst baseSpin = ensureNumber( spinFactor ) * baseStep;\n\tconst baseValue = roundClamp( 0, min, max, baseStep );\n\tconst constrainValue = (\n\t\tvalue: number | string,\n\t\tstepOverride?: number\n\t) => {\n\t\t// When step is \"any\" clamp the value, otherwise round and clamp it.\n\t\t// Use '' + to convert to string for use in input value attribute.\n\t\treturn isStepAny\n\t\t\t? '' + Math.min( max, Math.max( min, ensureNumber( value ) ) )\n\t\t\t: '' + roundClamp( value, min, max, stepOverride ?? baseStep );\n\t};\n\n\tconst autoComplete = typeProp === 'number' ? 'off' : undefined;\n\tconst classes = clsx( 'components-number-control', className );\n\tconst cx = useCx();\n\tconst spinButtonClasses = cx( size === 'small' && styles.smallSpinButtons );\n\n\tconst spinValue = (\n\t\tvalue: string | number | undefined,\n\t\tdirection: 'up' | 'down',\n\t\tevent: KeyboardEvent | MouseEvent | undefined\n\t) => {\n\t\tevent?.preventDefault();\n\t\tconst shift = event?.shiftKey && isShiftStepEnabled;\n\t\tconst delta = shift ? ensureNumber( shiftStep ) * baseSpin : baseSpin;\n\t\tlet nextValue = isValueEmpty( value ) ? baseValue : value;\n\t\tif ( direction === 'up' ) {\n\t\t\tnextValue = add( nextValue, delta );\n\t\t} else if ( direction === 'down' ) {\n\t\t\tnextValue = subtract( nextValue, delta );\n\t\t}\n\t\treturn constrainValue( nextValue, shift ? delta : undefined );\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst numberControlStateReducer: NumberControlProps[ '__unstableStateReducer' ] =\n\t\t( state, action ) => {\n\t\t\tconst nextState = { ...state };\n\n\t\t\tconst { type, payload } = action;\n\t\t\tconst event = payload.event;\n\t\t\tconst currentValue = nextState.value;\n\n\t\t\t/**\n\t\t\t * Handles custom UP and DOWN Keyboard events\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_UP ||\n\t\t\t\ttype === inputControlActionTypes.PRESS_DOWN\n\t\t\t) {\n\t\t\t\tnextState.value = spinValue(\n\t\t\t\t\tcurrentValue,\n\t\t\t\t\ttype === inputControlActionTypes.PRESS_UP ? 'up' : 'down',\n\t\t\t\t\tevent as KeyboardEvent | undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles drag to update events\n\t\t\t */\n\t\t\tif ( type === inputControlActionTypes.DRAG && isDragEnabled ) {\n\t\t\t\tconst [ x, y ] = payload.delta;\n\t\t\t\tconst enableShift = payload.shiftKey && isShiftStepEnabled;\n\t\t\t\tconst modifier = enableShift\n\t\t\t\t\t? ensureNumber( shiftStep ) * baseSpin\n\t\t\t\t\t: baseSpin;\n\n\t\t\t\tlet directionModifier;\n\t\t\t\tlet delta;\n\n\t\t\t\tswitch ( dragDirection ) {\n\t\t\t\t\tcase 'n':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = -1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'e':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? -1 : 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 's':\n\t\t\t\t\t\tdelta = y;\n\t\t\t\t\t\tdirectionModifier = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'w':\n\t\t\t\t\t\tdelta = x;\n\t\t\t\t\t\tdirectionModifier = isRTL() ? 1 : -1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( delta !== 0 ) {\n\t\t\t\t\tdelta = Math.ceil( Math.abs( delta ) ) * Math.sign( delta );\n\t\t\t\t\tconst distance = delta * modifier * directionModifier;\n\n\t\t\t\t\tnextState.value = constrainValue(\n\t\t\t\t\t\t// @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t\tadd( currentValue, distance ),\n\t\t\t\t\t\tenableShift ? modifier : undefined\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Handles commit (ENTER key press or blur)\n\t\t\t */\n\t\t\tif (\n\t\t\t\ttype === inputControlActionTypes.PRESS_ENTER ||\n\t\t\t\ttype === inputControlActionTypes.COMMIT\n\t\t\t) {\n\t\t\t\tconst applyEmptyValue =\n\t\t\t\t\trequired === false && currentValue === '';\n\n\t\t\t\tnextState.value = applyEmptyValue\n\t\t\t\t\t? currentValue\n\t\t\t\t\t: // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined\n\t\t\t\t\t constrainValue( currentValue );\n\t\t\t}\n\n\t\t\treturn nextState;\n\t\t};\n\n\tconst buildSpinButtonClickHandler =\n\t\t( direction: 'up' | 'down' ) =>\n\t\t( event: MouseEvent< HTMLButtonElement > ) =>\n\t\t\tonChange( String( spinValue( valueProp, direction, event ) ), {\n\t\t\t\t// Set event.target to the <input> so that consumers can use\n\t\t\t\t// e.g. event.target.validity.\n\t\t\t\tevent: {\n\t\t\t\t\t...event,\n\t\t\t\t\ttarget: inputRef.current!,\n\t\t\t\t},\n\t\t\t} );\n\n\treturn (\n\t\t<Input\n\t\t\tautoComplete={ autoComplete }\n\t\t\tinputMode=\"numeric\"\n\t\t\t{ ...restProps }\n\t\t\tclassName={ classes }\n\t\t\tdragDirection={ dragDirection }\n\t\t\thideHTMLArrows={ spinControls !== 'native' }\n\t\t\tisDragEnabled={ isDragEnabled }\n\t\t\tlabel={ label }\n\t\t\tmax={ max }\n\t\t\tmin={ min }\n\t\t\tref={ mergedRef }\n\t\t\trequired={ required }\n\t\t\tstep={ step }\n\t\t\ttype={ typeProp }\n\t\t\t// @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components\n\t\t\tvalue={ valueProp }\n\t\t\t__unstableStateReducer={ ( state, action ) => {\n\t\t\t\tconst baseState = numberControlStateReducer( state, action );\n\t\t\t\treturn stateReducerProp?.( baseState, action ) ?? baseState;\n\t\t\t} }\n\t\t\tsize={ size }\n\t\t\tsuffix={\n\t\t\t\tspinControls === 'custom' ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t<Spacer marginBottom={ 0 } marginRight={ 2 }>\n\t\t\t\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ plusIcon }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Increment' ) }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'up'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<SpinButton\n\t\t\t\t\t\t\t\t\tclassName={ spinButtonClasses }\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Decrement' ) }\n\t\t\t\t\t\t\t\t\tonClick={ buildSpinButtonClickHandler(\n\t\t\t\t\t\t\t\t\t\t'down'\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</HStack>\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\tsuffix\n\t\t\t\t)\n\t\t\t}\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\nexport const NumberControl = forwardRef( UnforwardedNumberControl );\n\nexport default NumberControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,UAAU,QAAQ,oBAAoB;AACvD,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,IAAIC,QAAQ,EAAEC,KAAK,IAAIC,SAAS,QAAQ,kBAAkB;AACvE,SAASC,YAAY,QAAQ,oBAAoB;AACjD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,KAAK,EAAEC,UAAU,EAAEC,MAAM,QAAQ,gCAAgC;AAC1E,OAAO,KAAKC,uBAAuB,MAAM,kCAAkC;AAC3E,SAASC,GAAG,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,eAAe;AACzD,SAASC,YAAY,EAAEC,YAAY,QAAQ,iBAAiB;AAG5D,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,KAAK,Q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G/G,QAAU;YACjBgD,IAAI,EAAC,OAAO;YACZZ,KAAK,EAAGtC,EAAE,CAAE,WAAY,CAAG;YAC3BkH,OAAO,EAAGb,2BAA2B,CACpC,IACD;UAAG,CACH,CAAC,eACFhF,IAAA,CAACb,UAAU;YACVwB,SAAS,EAAGsC,iBAAmB;YAC/B2C,IAAI,EAAG7G,SAAW;YAClB8C,IAAI,EAAC,OAAO;YACZZ,KAAK,EAAGtC,EAAE,CAAE,WAAY,CAAG;YAC3BkH,OAAO,EAAGb,2BAA2B,CACpC,MACD;UAAG,CACH,CAAC;QAAA,CACK;MAAC,CACF,CAAC;IAAA,CACR,CAAC,GAEHlD,MAED;IACDC,QAAQ,EAAGA;EAAU,CACrB,CAAC;AAEJ;AAEA,OAAO,MAAM+D,aAAa,GAAGrH,UAAU,CAAE6B,wBAAyB,CAAC;AAEnE,eAAewF,aAAa","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["css","InputControl","COLORS","Button","space","_ref","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","htmlArrowStyles","hideHTMLArrows","Input","_styled","target","label","SpinButton","theme","accent","smallSpinButtons"],"sources":["@wordpress/components/src/number-control/styles/number-control-styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport InputControl from '../../input-control';\nimport { COLORS } from '../../utils';\nimport Button from '../../button';\nimport { space } from '../../utils/space';\n\nconst htmlArrowStyles = ( { hideHTMLArrows }: { hideHTMLArrows: boolean } ) => {\n\tif ( ! hideHTMLArrows ) {\n\t\treturn ``;\n\t}\n\n\treturn css`\n\t\tinput[type='number']::-webkit-outer-spin-button,\n\t\tinput[type='number']::-webkit-inner-spin-button {\n\t\t\t-webkit-appearance: none !important;\n\t\t\tmargin: 0 !important;\n\t\t}\n\n\t\tinput[type='number'] {\n\t\t\t-moz-appearance: textfield;\n\t\t}\n\t`;\n};\n\nexport const Input = styled( InputControl )`\n\t${ htmlArrowStyles };\n`;\n\nexport const SpinButton = styled( Button )`\n\t&&&&& {\n\t\tcolor: ${ COLORS.theme.accent };\n\t}\n`;\n\nconst smallSpinButtons = css`\n\twidth: ${ space( 5 ) };\n\tmin-width: ${ space( 5 ) };\n\theight: ${ space( 5 ) };\n`;\n\nexport const styles = { smallSpinButtons };\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;AAGpC;AACA;AACA;AACA,OAAOC,YAAY,MAAM,qBAAqB;AAC9C,SAASC,MAAM,QAAQ,aAAa;AACpC,OAAOC,MAAM,MAAM,cAAc;AACjC,SAASC,KAAK,QAAQ,mBAAmB;AAAC,IAAAC,IAAA,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA;AAE1C,MAAMC,eAAe,GAAGA,CAAE;EAAEC;AAA4C,CAAC,KAAM;EAC9E,IAAK,CAAEA,cAAc,EAAG;IACvB,OAAQ,EAAC;EACV;EAEA,OAAAV,IAAA;AAWD,CAAC;AAED,OAAO,MAAMW,KAAK,gBAAGC,OAAA,CAAQhB,YAAY,EAAAK,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAU,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,CACvCL,eAAe,SAAAR,OAAA,CAAAC,GAAA,CAAAC,QAAA,40DAClB;AAED,OAAO,MAAMY,UAAU,gBAAGH,OAAA,CAAQd,MAAM,EAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAU,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,iBAE9BjB,MAAM,CAACmB,KAAK,CAACC,MAAM,UAAAhB,OAAA,CAAAC,GAAA,CAAAC,QAAA,40DAE9B;AAED,MAAMe,gBAAgB,gBAAGvB,GAAG,WACjBI,KAAK,CAAE,CAAE,CAAC,iBACNA,KAAK,CAAE,CAAE,CAAC,cACbA,KAAK,CAAE,CAAE,CAAC,SAAAE,OAAA,CAAAC,GAAA,CAAAC,QAAA,sDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,20DACrB;AAED,OAAO,MAAME,MAAM,GAAG;EAAEa;AAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["css","InputControl","COLORS","Button","space","_ref","process","env","NODE_ENV","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","htmlArrowStyles","hideHTMLArrows","Input","_styled","target","label","SpinButton","theme","accent","smallSpinButtons"],"sources":["@wordpress/components/src/number-control/styles/number-control-styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport InputControl from '../../input-control';\nimport { COLORS } from '../../utils';\nimport Button from '../../button';\nimport { space } from '../../utils/space';\n\nconst htmlArrowStyles = ( { hideHTMLArrows }: { hideHTMLArrows: boolean } ) => {\n\tif ( ! hideHTMLArrows ) {\n\t\treturn ``;\n\t}\n\n\treturn css`\n\t\tinput[type='number']::-webkit-outer-spin-button,\n\t\tinput[type='number']::-webkit-inner-spin-button {\n\t\t\t-webkit-appearance: none !important;\n\t\t\tmargin: 0 !important;\n\t\t}\n\n\t\tinput[type='number'] {\n\t\t\t-moz-appearance: textfield;\n\t\t}\n\t`;\n};\n\nexport const Input = styled( InputControl )`\n\t${ htmlArrowStyles };\n`;\n\nexport const SpinButton = styled( Button )`\n\t&&&&& {\n\t\tcolor: ${ COLORS.theme.accent };\n\t}\n`;\n\nconst smallSpinButtons = css`\n\twidth: ${ space( 5 ) };\n\tmin-width: ${ space( 5 ) };\n\theight: ${ space( 5 ) };\n`;\n\nexport const styles = { smallSpinButtons };\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;AAG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29
29
  import { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';
30
30
  import CustomGradientPicker from '../custom-gradient-picker';
31
31
  import { kebabCase } from '../utils/strings';
32
- import { jsx as _jsx } from "react/jsx-runtime";
33
- import { jsxs as _jsxs } from "react/jsx-runtime";
34
- import { Fragment as _Fragment } from "react/jsx-runtime";
32
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
35
33
  const DEFAULT_COLOR = '#000';
36
34
  function NameInput({
37
35
  value,
@@ -94,7 +92,7 @@ export function getNameAndSlugForPosition(elements, slugPrefix) {
94
92
  return previousValue;
95
93
  }, 1);
96
94
  return {
97
- name: sprintf( /* translators: %s: is an id for a custom color */
95
+ name: sprintf(/* translators: %s: is an id for a custom color */
98
96
  __('Color %s'), position),
99
97
  slug: `${slugPrefix}color-${position}`
100
98
  };
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useState","useRef","useEffect","useCallback","useMemo","__","sprintf","lineSolid","moreVertical","plus","useDebounce","Button","ColorPicker","FlexItem","HStack","ItemGroup","VStack","GradientPicker","ColorPalette","DropdownMenu","Popover","PaletteActionsContainer","PaletteEditStyles","PaletteHeading","IndicatorStyled","PaletteItem","NameContainer","NameInputControl","DoneButton","RemoveButton","PaletteEditContents","NavigableMenu","DEFAULT_GRADIENT","CustomGradientPicker","kebabCase","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_COLOR","NameInput","value","onChange","label","hideLabelFromVision","deduplicateElementSlugs","elements","slugCounts","map","element","_newSlug","newSlug","slug","getNameAndSlugForPosition","slugPrefix","nameRegex","RegExp","position","reduce","previousValue","currentValue","matches","match","id","parseInt","name","ColorPickerPopover","isGradient","popoverProps","receivedPopoverProps","onClose","shift","offset","resize","placement","className","children","color","enableAlpha","newColor","__experimentalIsRenderedInSidebar","gradient","newGradient","Option","canOnlyChangeValues","onRemove","isEditingColor","setIsEditingColor","popoverAnchor","setPopoverAnchor","anchor","ref","as","justify","onClick","trim","length","style","padding","colorValue","nextName","size","icon","PaletteEditListView","addColorRef","elementsReferenceRef","current","debounceOnChange","updatedElements","spacing","isRounded","index","newElement","currentElement","currentIndex","newElements","filter","_currentElement","undefined","focus","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","isEditing","setIsEditing","editingElement","setEditingElement","isAdding","elementsLength","hasElements","onSelectPaletteItem","newEditingElementIndex","selectedElement","key","level","isPressed","toggleProps","role","variant","clearable","disableCustomGradients","disableCustomColors"],"sources":["@wordpress/components/src/palette-edit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport { useDebounce } 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\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n\tPaletteEditContents,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\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 * Deduplicates the slugs of the provided elements.\n */\nexport function deduplicateElementSlugs< T extends PaletteElement >(\n\telements: T[]\n) {\n\tconst slugCounts: { [ slug: string ]: number } = {};\n\n\treturn elements.map( ( element ) => {\n\t\tlet newSlug: string | undefined;\n\n\t\tconst { slug } = element;\n\t\tslugCounts[ slug ] = ( slugCounts[ slug ] || 0 ) + 1;\n\n\t\tif ( slugCounts[ slug ] > 1 ) {\n\t\t\tnewSlug = `${ slug }-${ slugCounts[ slug ] - 1 }`;\n\t\t}\n\n\t\treturn { ...element, slug: newSlug ?? slug };\n\t} );\n}\n\n/**\n * Returns a name and slug for a palette item. The name takes the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\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 name and slug for the new palette item.\n */\nexport function getNameAndSlugForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst nameRegex = 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( nameRegex );\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 {\n\t\tname: sprintf(\n\t\t\t/* translators: %s: is an id for a custom color */\n\t\t\t__( 'Color %s' ),\n\t\t\tposition\n\t\t),\n\t\tslug: `${ slugPrefix }color-${ position }`,\n\t};\n}\n\nfunction ColorPickerPopover< T extends PaletteElement >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tpopoverProps: receivedPopoverProps,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\tconst popoverProps: ColorPickerPopoverProps< T >[ 'popoverProps' ] =\n\t\tuseMemo(\n\t\t\t() => ( {\n\t\t\t\tshift: true,\n\t\t\t\toffset: 20,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t\tplacement: 'left-start',\n\t\t\t\t...receivedPopoverProps,\n\t\t\t\tclassName: clsx(\n\t\t\t\t\t'components-palette-edit__popover',\n\t\t\t\t\treceivedPopoverProps?.className\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[ receivedPopoverProps ]\n\t\t);\n\n\treturn (\n\t\t<Popover { ...popoverProps } onClose={ onClose }>\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__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 PaletteElement >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tonRemove,\n\tpopoverProps: receivedPopoverProps,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst value = isGradient ? element.gradient : element.color;\n\tconst [ isEditingColor, setIsEditingColor ] = useState( false );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t...receivedPopoverProps,\n\t\t\t// Use the custom palette color item as the popover anchor.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<PaletteItem ref={ setPopoverAnchor } as=\"div\">\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsEditingColor( true );\n\t\t\t\t\t} }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %s is a color or gradient name, e.g. \"Red\".\n\t\t\t\t\t\t__( 'Edit: %s' ),\n\t\t\t\t\t\telement.name.trim().length ? element.name : value\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { padding: 0 } }\n\t\t\t\t>\n\t\t\t\t\t<IndicatorStyled colorValue={ value } />\n\t\t\t\t</Button>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ ! 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>\n\t\t\t\t\t\t\t{ element.name.trim().length\n\t\t\t\t\t\t\t\t? element.name\n\t\t\t\t\t\t\t\t: /* Fall back to non-breaking space to maintain height */\n\t\t\t\t\t\t\t\t '\\u00A0' }\n\t\t\t\t\t\t</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s is a color or gradient name, e.g. \"Red\".\n\t\t\t\t\t\t\t\t__( 'Remove color: %s' ),\n\t\t\t\t\t\t\t\telement.name.trim().length\n\t\t\t\t\t\t\t\t\t? element.name\n\t\t\t\t\t\t\t\t\t: value\n\t\t\t\t\t\t\t) }\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{ isEditingColor && (\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\tpopoverProps={ popoverProps }\n\t\t\t\t\tonClose={ () => setIsEditingColor( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\nfunction PaletteEditListView< T extends PaletteElement >( {\n\telements,\n\tonChange,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n\tpopoverProps,\n\taddColorRef,\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 elementsReferenceRef = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReferenceRef.current = elements;\n\t}, [ elements ] );\n\n\tconst debounceOnChange = useDebounce(\n\t\t( updatedElements: T[] ) =>\n\t\t\tonChange( deduplicateElementSlugs( updatedElements ) ),\n\t\t100\n\t);\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\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\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\taddColorRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\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\tpopoverProps,\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\tconst addColorRef = useRef< HTMLButtonElement | null >( null );\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<HStack>\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\tsize=\"small\"\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\tref={ addColorRef }\n\t\t\t\t\t\t\tsize=\"small\"\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 { name, slug } =\n\t\t\t\t\t\t\t\t\tgetNameAndSlugForPosition(\n\t\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\t\tslugPrefix\n\t\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,\n\t\t\t\t\t\t\t\t\t\t\tslug,\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,\n\t\t\t\t\t\t\t\t\t\t\tslug,\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\tsize: 'small',\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</HStack>\n\t\t\t{ hasElements && (\n\t\t\t\t<PaletteEditContents>\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\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\taddColorRef={ addColorRef }\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\tpopoverProps={ popoverProps }\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\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\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\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</PaletteEditContents>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage && (\n\t\t\t\t<PaletteEditContents>{ emptyMessage }</PaletteEditContents>\n\t\t\t) }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,WAAW,EACXC,OAAO,QACD,oBAAoB;AAC3B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,YAAY,EAAEC,IAAI,QAAQ,kBAAkB;AAChE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,MAAM,QAAQ,YAAY;AACnC,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC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S,EAAG,KAAO;QACnBC,sBAAsB;MAAA,CACtB,CAAC,gBAEF/G,IAAA,CAAClB,YAAY;QACZ2G,MAAM,EAAGA,MAAQ;QACjBjF,QAAQ,EAAG6F,mBAAqB;QAChCS,SAAS,EAAG,KAAO;QACnBE,mBAAmB;MAAA,CACnB,CACD,CAAE;IAAA,CACgB,CACrB,EACC,CAAEZ,WAAW,IAAIR,YAAY,iBAC9B5F,IAAA,CAACN,mBAAmB;MAAAgD,QAAA,EAAGkD;IAAY,CAAuB,CAC1D;EAAA,CACiB,CAAC;AAEtB;AAEA,eAAeL,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useState","useRef","useEffect","useCallback","useMemo","__","sprintf","lineSolid","moreVertical","plus","useDebounce","Button","ColorPicker","FlexItem","HStack","ItemGroup","VStack","GradientPicker","ColorPalette","DropdownMenu","Popover","PaletteActionsContainer","PaletteEditStyles","PaletteHeading","IndicatorStyled","PaletteItem","NameContainer","NameInputControl","DoneButton","RemoveButton","PaletteEditContents","NavigableMenu","DEFAULT_GRADIENT","CustomGradientPicker","kebabCase","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULT_COLOR","NameInput","value","onChange","label","hideLabelFromVision","deduplicateElementSlugs","elements","slugCounts","map","element","_newSlug","newSlug","slug","getNameAndSlugForPosition","slugPrefix","nameRegex","RegExp","position","reduce","previousValue","currentValue","matches","match","id","parseInt","name","ColorPickerPopover","isGradient","popoverProps","receivedPopoverProps","onClose","shift","offset","resize","placement","className","children","color","enableAlpha","newColor","__experimentalIsRenderedInSidebar","gradient","newGradient","Option","canOnlyChangeValues","onRemove","isEditingColor","setIsEditingColor","popoverAnchor","setPopoverAnchor","anchor","ref","as","justify","onClick","trim","length","style","padding","colorValue","nextName","size","icon","PaletteEditListView","addColorRef","elementsReferenceRef","current","debounceOnChange","updatedElements","spacing","isRounded","index","newElement","currentElement","currentIndex","newElements","filter","_currentElement","undefined","focus","EMPTY_ARRAY","PaletteEdit","gradients","colors","paletteLabel","paletteLabelHeadingLevel","emptyMessage","canReset","isEditing","setIsEditing","editingElement","setEditingElement","isAdding","elementsLength","hasElements","onSelectPaletteItem","newEditingElementIndex","selectedElement","key","level","isPressed","toggleProps","role","variant","clearable","disableCustomGradients","disableCustomColors"],"sources":["@wordpress/components/src/palette-edit/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { lineSolid, moreVertical, plus } from '@wordpress/icons';\nimport { useDebounce } 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\tIndicatorStyled,\n\tPaletteItem,\n\tNameContainer,\n\tNameInputControl,\n\tDoneButton,\n\tRemoveButton,\n\tPaletteEditContents,\n} from './styles';\nimport { NavigableMenu } from '../navigable-container';\nimport { DEFAULT_GRADIENT } from '../custom-gradient-picker/constants';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { kebabCase } from '../utils/strings';\nimport type {\n\tColor,\n\tColorPickerPopoverProps,\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 * Deduplicates the slugs of the provided elements.\n */\nexport function deduplicateElementSlugs< T extends PaletteElement >(\n\telements: T[]\n) {\n\tconst slugCounts: { [ slug: string ]: number } = {};\n\n\treturn elements.map( ( element ) => {\n\t\tlet newSlug: string | undefined;\n\n\t\tconst { slug } = element;\n\t\tslugCounts[ slug ] = ( slugCounts[ slug ] || 0 ) + 1;\n\n\t\tif ( slugCounts[ slug ] > 1 ) {\n\t\t\tnewSlug = `${ slug }-${ slugCounts[ slug ] - 1 }`;\n\t\t}\n\n\t\treturn { ...element, slug: newSlug ?? slug };\n\t} );\n}\n\n/**\n * Returns a name and slug for a palette item. The name takes the format \"Color + id\".\n * To ensure there are no duplicate ids, this function checks all slugs.\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 name and slug for the new palette item.\n */\nexport function getNameAndSlugForPosition(\n\telements: PaletteElement[],\n\tslugPrefix: string\n) {\n\tconst nameRegex = 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( nameRegex );\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 {\n\t\tname: sprintf(\n\t\t\t/* translators: %s: is an id for a custom color */\n\t\t\t__( 'Color %s' ),\n\t\t\tposition\n\t\t),\n\t\tslug: `${ slugPrefix }color-${ position }`,\n\t};\n}\n\nfunction ColorPickerPopover< T extends PaletteElement >( {\n\tisGradient,\n\telement,\n\tonChange,\n\tpopoverProps: receivedPopoverProps,\n\tonClose = () => {},\n}: ColorPickerPopoverProps< T > ) {\n\tconst popoverProps: ColorPickerPopoverProps< T >[ 'popoverProps' ] =\n\t\tuseMemo(\n\t\t\t() => ( {\n\t\t\t\tshift: true,\n\t\t\t\toffset: 20,\n\t\t\t\t// Disabling resize as it would otherwise cause the popover to show\n\t\t\t\t// scrollbars while dragging the color picker's handle close to the\n\t\t\t\t// popover edge.\n\t\t\t\tresize: false,\n\t\t\t\tplacement: 'left-start',\n\t\t\t\t...receivedPopoverProps,\n\t\t\t\tclassName: clsx(\n\t\t\t\t\t'components-palette-edit__popover',\n\t\t\t\t\treceivedPopoverProps?.className\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[ receivedPopoverProps ]\n\t\t);\n\n\treturn (\n\t\t<Popover { ...popoverProps } onClose={ onClose }>\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__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 PaletteElement >( {\n\tcanOnlyChangeValues,\n\telement,\n\tonChange,\n\tonRemove,\n\tpopoverProps: receivedPopoverProps,\n\tslugPrefix,\n\tisGradient,\n}: OptionProps< T > ) {\n\tconst value = isGradient ? element.gradient : element.color;\n\tconst [ isEditingColor, setIsEditingColor ] = useState( false );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t...receivedPopoverProps,\n\t\t\t// Use the custom palette color item as the popover anchor.\n\t\t\tanchor: popoverAnchor,\n\t\t} ),\n\t\t[ popoverAnchor, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<PaletteItem ref={ setPopoverAnchor } as=\"div\">\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsEditingColor( true );\n\t\t\t\t\t} }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %s is a color or gradient name, e.g. \"Red\".\n\t\t\t\t\t\t__( 'Edit: %s' ),\n\t\t\t\t\t\telement.name.trim().length ? element.name : value\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ { padding: 0 } }\n\t\t\t\t>\n\t\t\t\t\t<IndicatorStyled colorValue={ value } />\n\t\t\t\t</Button>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t{ ! 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>\n\t\t\t\t\t\t\t{ element.name.trim().length\n\t\t\t\t\t\t\t\t? element.name\n\t\t\t\t\t\t\t\t: /* Fall back to non-breaking space to maintain height */\n\t\t\t\t\t\t\t\t '\\u00A0' }\n\t\t\t\t\t\t</NameContainer>\n\t\t\t\t\t) }\n\t\t\t\t</FlexItem>\n\t\t\t\t{ ! canOnlyChangeValues && (\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<RemoveButton\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\ticon={ lineSolid }\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s is a color or gradient name, e.g. \"Red\".\n\t\t\t\t\t\t\t\t__( 'Remove color: %s' ),\n\t\t\t\t\t\t\t\telement.name.trim().length\n\t\t\t\t\t\t\t\t\t? element.name\n\t\t\t\t\t\t\t\t\t: value\n\t\t\t\t\t\t\t) }\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{ isEditingColor && (\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\tpopoverProps={ popoverProps }\n\t\t\t\t\tonClose={ () => setIsEditingColor( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PaletteItem>\n\t);\n}\n\nfunction PaletteEditListView< T extends PaletteElement >( {\n\telements,\n\tonChange,\n\tcanOnlyChangeValues,\n\tslugPrefix,\n\tisGradient,\n\tpopoverProps,\n\taddColorRef,\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 elementsReferenceRef = useRef< typeof elements >();\n\tuseEffect( () => {\n\t\telementsReferenceRef.current = elements;\n\t}, [ elements ] );\n\n\tconst debounceOnChange = useDebounce(\n\t\t( updatedElements: T[] ) =>\n\t\t\tonChange( deduplicateElementSlugs( updatedElements ) ),\n\t\t100\n\t);\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\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\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\taddColorRef.current?.focus();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\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\tpopoverProps,\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\tconst addColorRef = useRef< HTMLButtonElement | null >( null );\n\n\treturn (\n\t\t<PaletteEditStyles>\n\t\t\t<HStack>\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\tsize=\"small\"\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\tref={ addColorRef }\n\t\t\t\t\t\t\tsize=\"small\"\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 { name, slug } =\n\t\t\t\t\t\t\t\t\tgetNameAndSlugForPosition(\n\t\t\t\t\t\t\t\t\t\telements,\n\t\t\t\t\t\t\t\t\t\tslugPrefix\n\t\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,\n\t\t\t\t\t\t\t\t\t\t\tslug,\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,\n\t\t\t\t\t\t\t\t\t\t\tslug,\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\tsize: 'small',\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</HStack>\n\t\t\t{ hasElements && (\n\t\t\t\t<PaletteEditContents>\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\tslugPrefix={ slugPrefix }\n\t\t\t\t\t\t\tisGradient={ isGradient }\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\taddColorRef={ addColorRef }\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\tpopoverProps={ popoverProps }\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\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\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\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</PaletteEditContents>\n\t\t\t) }\n\t\t\t{ ! hasElements && emptyMessage && (\n\t\t\t\t<PaletteEditContents>{ emptyMessage }</PaletteEditContents>\n\t\t\t) }\n\t\t</PaletteEditStyles>\n\t);\n}\n\nexport default PaletteEdit;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,MAAM,EACNC,SAAS,EACTC,WAAW,EACXC,OAAO,QACD,oBAAoB;AAC3B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,YAAY,EAAEC,IAAI,QAAQ,kBAAkB;AAChE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,MAAM,QAAQ,YAAY;AACnC,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,OAAO,MAAM,YAAY;AAChC,SACCC,uBAAuB,EACvBC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,WAAW,EACX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;MAAA,CACnB,CACD,CAAE;IAAA,CACgB,CACrB,EACC,CAAEZ,WAAW,IAAIR,YAAY,iBAC9B5F,IAAA,CAACN,mBAAmB;MAAAgD,QAAA,EAAGkD;IAAY,CAAuB,CAC1D;EAAA,CACiB,CAAC;AAEtB;AAEA,eAAeL,WAAW","ignoreList":[]}
@@ -15,8 +15,7 @@ import { useMemo } from '@wordpress/element';
15
15
  import styles from './actions.scss';
16
16
  import BottomSeparatorCover from './bottom-separator-cover';
17
17
  import TextControl from '../text-control';
18
- import { jsx as _jsx } from "react/jsx-runtime";
19
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
19
  function PanelActions({
21
20
  actions,
22
21
  getStylesFromColorScheme
@@ -1 +1 @@
1
- {"version":3,"names":["View","withPreferredColorScheme","useMemo","styles","BottomSeparatorCover","TextControl","jsx","_jsx","jsxs","_jsxs","PanelActions","actions","getStylesFromColorScheme","mappedActions","map","label","onPress","labelStyle","defaultLabelStyle","style","panelActionsContainer","panelActionsContainerDark","children"],"sources":["@wordpress/components/src/panel/actions.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './actions.scss';\nimport BottomSeparatorCover from './bottom-separator-cover';\nimport TextControl from '../text-control';\n\nfunction PanelActions( { actions, getStylesFromColorScheme } ) {\n\tconst mappedActions = useMemo( () => {\n\t\treturn actions.map( ( { label, onPress } ) => {\n\t\t\treturn (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonPress={ onPress }\n\t\t\t\t\tlabelStyle={ styles.defaultLabelStyle }\n\t\t\t\t\tkey={ label }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ actions ] );\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.panelActionsContainer,\n\t\t\t\tstyles.panelActionsContainerDark\n\t\t\t) }\n\t\t>\n\t\t\t{ mappedActions }\n\t\t\t<BottomSeparatorCover />\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( PanelActions );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,gBAAgB;AACnC,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE1C,SAASC,YAAYA,CAAE;EAAEC,OAAO;EAAEC;AAAyB,CAAC,EAAG;EAC9D,MAAMC,aAAa,GAAGX,OAAO,CAAE,MAAM;IACpC,OAAOS,OAAO,CAACG,GAAG,CAAE,CAAE;MAAEC,KAAK;MAAEC;IAAQ,CAAC,KAAM;MAC7C,oBACCT,IAAA,CAACF,WAAW;QACXU,KAAK,EAAGA,KAAO;QACfC,OAAO,EAAGA,OAAS;QACnBC,UAAU,EAAGd,MAAM,CAACe;MAAmB,GACjCH,KACN,CAAC;IAEJ,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEJ,OAAO,CAAG,CAAC;EAEhB,oBACCF,KAAA,CAACT,IAAI;IACJmB,KAAK,EAAGP,wBAAwB,CAC/BT,MAAM,CAACiB,qBAAqB,EAC5BjB,MAAM,CAACkB,yBACR,CAAG;IAAAC,QAAA,GAEDT,aAAa,eACfN,IAAA,CAACH,oBAAoB,IAAE,CAAC;EAAA,CACnB,CAAC;AAET;AAEA,eAAeH,wBAAwB,CAAES,YAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["View","withPreferredColorScheme","useMemo","styles","BottomSeparatorCover","TextControl","jsx","_jsx","jsxs","_jsxs","PanelActions","actions","getStylesFromColorScheme","mappedActions","map","label","onPress","labelStyle","defaultLabelStyle","style","panelActionsContainer","panelActionsContainerDark","children"],"sources":["@wordpress/components/src/panel/actions.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './actions.scss';\nimport BottomSeparatorCover from './bottom-separator-cover';\nimport TextControl from '../text-control';\n\nfunction PanelActions( { actions, getStylesFromColorScheme } ) {\n\tconst mappedActions = useMemo( () => {\n\t\treturn actions.map( ( { label, onPress } ) => {\n\t\t\treturn (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tonPress={ onPress }\n\t\t\t\t\tlabelStyle={ styles.defaultLabelStyle }\n\t\t\t\t\tkey={ label }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ actions ] );\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.panelActionsContainer,\n\t\t\t\tstyles.panelActionsContainerDark\n\t\t\t) }\n\t\t>\n\t\t\t{ mappedActions }\n\t\t\t<BottomSeparatorCover />\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( PanelActions );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,cAAc;;AAEnC;AACA;AACA;AACA,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,OAAOC,MAAM,MAAM,gBAAgB;AACnC,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1C,SAASC,YAAYA,CAAE;EAAEC,OAAO;EAAEC;AAAyB,CAAC,EAAG;EAC9D,MAAMC,aAAa,GAAGX,OAAO,CAAE,MAAM;IACpC,OAAOS,OAAO,CAACG,GAAG,CAAE,CAAE;MAAEC,KAAK;MAAEC;IAAQ,CAAC,KAAM;MAC7C,oBACCT,IAAA,CAACF,WAAW;QACXU,KAAK,EAAGA,KAAO;QACfC,OAAO,EAAGA,OAAS;QACnBC,UAAU,EAAGd,MAAM,CAACe;MAAmB,GACjCH,KACN,CAAC;IAEJ,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEJ,OAAO,CAAG,CAAC;EAEhB,oBACCF,KAAA,CAACT,IAAI;IACJmB,KAAK,EAAGP,wBAAwB,CAC/BT,MAAM,CAACiB,qBAAqB,EAC5BjB,MAAM,CAACkB,yBACR,CAAG;IAAAC,QAAA,GAEDT,aAAa,eACfN,IAAA,CAACH,oBAAoB,IAAE,CAAC;EAAA,CACnB,CAAC;AAET;AAEA,eAAeH,wBAAwB,CAAES,YAAa,CAAC","ignoreList":[]}
@@ -17,8 +17,7 @@ import { chevronUp, chevronDown } from '@wordpress/icons';
17
17
  import Button from '../button';
18
18
  import Icon from '../icon';
19
19
  import { useControlledState, useUpdateEffect } from '../utils';
20
- import { jsx as _jsx } from "react/jsx-runtime";
21
- import { jsxs as _jsxs } from "react/jsx-runtime";
20
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
21
  const noop = () => {};
23
22
  export function UnforwardedPanelBody(props, ref) {
24
23
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useReducedMotion","useMergeRefs","forwardRef","useRef","chevronUp","chevronDown","Button","Icon","useControlledState","useUpdateEffect","jsx","_jsx","jsxs","_jsxs","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","PanelBodyTitle","Boolean","onClick","size","PanelBody"],"sources":["@wordpress/components/src/panel/body.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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 '../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 = clsx( '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 ) {\n\t\t\treturn null;\n\t\t}\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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,oBAAoB;AACnE,SAASC,UAAU,EAAEC,MAAM,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,kBAAkB;;AAEzD;AACA;AACA;;AAGA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE/D,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,SAASC,oBAAoBA,CACnCC,KAAqB,EACrBC,GAAyC,EACxC;EACD,MAAM;IACLC,WAAW,GAAG,CAAC,CAAC;IAChBC,QAAQ;IACRC,SAAS;IACTC,IAAI;IACJC,WAAW;IACXC,QAAQ,GAAGT,IAAI;IACfU,MAAM;IACNC,KAAK;IACLC,eAAe,GAAG;EACnB,CAAC,GAAGV,KAAK;EACT,MAAM,CAAEW,QAAQ,EAAEC,WAAW,CAAE,GAAGpB,kBAAkB,CACnDgB,MAAM,EACN;IACCK,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AGb,cAAgB;MAC1BT,KAAK,EAAGA,KAAO;MAAA,GACVP;IAAW,CAChB,CAAC,EACA,OAAOC,QAAQ,KAAK,UAAU,GAC7BA,QAAQ,CAAE;MAAEK,MAAM,EAAEsB,OAAO,CAAEnB,QAAS;IAAE,CAAE,CAAC,GAC3CA,QAAQ,IAAIR,QAAQ;EAAA,CACnB,CAAC;AAER;AAEA,MAAM0B,cAAc,GAAG3C,UAAU,CAChC,CACC;EACCyB,QAAQ;EACRN,IAAI;EACJI,KAAK;EACL,GAAGT;AACsD,CAAC,EAC3DC,GAA8B,KAC1B;EACJ,IAAK,CAAEQ,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,oBACCd,IAAA;IAAIS,SAAS,EAAC,8BAA8B;IAAAD,QAAA,eAC3CN,KAAA,CAACP,MAAM;MACNc,SAAS,EAAC,+BAA+B;MACzC,iBAAgBO,QAAU;MAC1BV,GAAG,EAAGA,GAAK;MAAA,GACND,KAAK;MAAAG,QAAA,gBAMVR,IAAA;QAAM,eAAY,MAAM;QAAAQ,QAAA,eACvBR,IAAA,CAACJ,IAAI;UACJa,SAAS,EAAC,yBAAyB;UACnCC,IAAI,EAAGM,QAAQ,GAAGvB,SAAS,GAAGC;QAAa,CAC3C;MAAC,CACG,CAAC,EACLoB,KAAK,EACLJ,IAAI,iBACLV,IAAA,CAACJ,IAAI;QACJc,IAAI,EAAGA,IAAM;QACbD,SAAS,EAAC,wBAAwB;QAClC4B,IAAI,EAAG;MAAI,CACX,CACD;IAAA,CACM;EAAC,CACN,CAAC;AAEP,CACD,CAAC;AAED,OAAO,MAAMC,SAAS,GAAG/C,UAAU,CAAEa,oBAAqB,CAAC;AAE3D,eAAekC,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useReducedMotion","useMergeRefs","forwardRef","useRef","chevronUp","chevronDown","Button","Icon","useControlledState","useUpdateEffect","jsx","_jsx","jsxs","_jsxs","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","PanelBodyTitle","Boolean","onClick","size","PanelBody"],"sources":["@wordpress/components/src/panel/body.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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 '../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 = clsx( '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 ) {\n\t\t\treturn null;\n\t\t}\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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,oBAAoB;AACnE,SAASC,UAAU,EAAEC,MAAM,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,kBAAkB;;AAEzD;AACA;AACA;;AAGA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/D,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,OAAO,SAASC,oBAAoBA,CACnCC,KAAqB,EACrBC,GAAyC,EACxC;EACD,MAAM;IACLC,WAAW,GAAG,CAAC,CAAC;IAChBC,QAAQ;IACRC,SAAS;IACTC,IAAI;IACJC,WAAW;IACXC,QAAQ,GAAGT,IAAI;IACfU,MAAM;IACNC,KAAK;IACLC,eAAe,GA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