@wordpress/components 29.0.1-next.a9f418477.0 → 29.1.1

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 (944) hide show
  1. package/CHANGELOG.md +50 -10
  2. package/LICENSE.md +1 -1
  3. package/build/alignment-matrix-control/icon.js +1 -0
  4. package/build/alignment-matrix-control/icon.js.map +1 -1
  5. package/build/alignment-matrix-control/index.js +1 -0
  6. package/build/alignment-matrix-control/index.js.map +1 -1
  7. package/build/autocomplete/autocompleter-ui.js +1 -0
  8. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  9. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  10. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  11. package/build/autocomplete/get-default-use-items.js +1 -0
  12. package/build/autocomplete/get-default-use-items.js.map +1 -1
  13. package/build/autocomplete/index.js +1 -0
  14. package/build/autocomplete/index.js.map +1 -1
  15. package/build/badge/index.js +64 -0
  16. package/build/badge/index.js.map +1 -0
  17. package/build/badge/types.js +6 -0
  18. package/build/badge/types.js.map +1 -0
  19. package/build/border-box-control/utils.js +1 -0
  20. package/build/border-box-control/utils.js.map +1 -1
  21. package/build/border-control/border-control-dropdown/component.js +1 -0
  22. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  23. package/build/border-control/border-control-style-picker/component.js +1 -0
  24. package/build/border-control/border-control-style-picker/component.js.map +1 -1
  25. package/build/box-control/index.js +18 -14
  26. package/build/box-control/index.js.map +1 -1
  27. package/build/box-control/input-control.js +222 -0
  28. package/build/box-control/input-control.js.map +1 -0
  29. package/build/box-control/types.js.map +1 -1
  30. package/build/box-control/utils.js +101 -48
  31. package/build/box-control/utils.js.map +1 -1
  32. package/build/button/index.native.js +1 -0
  33. package/build/button/index.native.js.map +1 -1
  34. package/build/button/types.js.map +1 -1
  35. package/build/button-group/index.js +10 -0
  36. package/build/button-group/index.js.map +1 -1
  37. package/build/button-group/types.js.map +1 -1
  38. package/build/color-indicator/index.native.js +1 -0
  39. package/build/color-indicator/index.native.js.map +1 -1
  40. package/build/color-palette/index.js +1 -0
  41. package/build/color-palette/index.js.map +1 -1
  42. package/build/color-palette/index.native.js +1 -0
  43. package/build/color-palette/index.native.js.map +1 -1
  44. package/build/color-palette/utils.js +1 -0
  45. package/build/color-palette/utils.js.map +1 -1
  46. package/build/combobox-control/index.js +1 -0
  47. package/build/combobox-control/index.js.map +1 -1
  48. package/build/composite/legacy/index.js +1 -0
  49. package/build/composite/legacy/index.js.map +1 -1
  50. package/build/context/context-connect.js +1 -0
  51. package/build/context/context-connect.js.map +1 -1
  52. package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  53. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  54. package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
  55. package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  56. package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
  57. package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  58. package/build/custom-gradient-picker/index.js +1 -0
  59. package/build/custom-gradient-picker/index.js.map +1 -1
  60. package/build/custom-gradient-picker/serializer.js +1 -0
  61. package/build/custom-gradient-picker/serializer.js.map +1 -1
  62. package/build/custom-gradient-picker/utils.js +1 -0
  63. package/build/custom-gradient-picker/utils.js.map +1 -1
  64. package/build/custom-select-control/index.js +2 -3
  65. package/build/custom-select-control/index.js.map +1 -1
  66. package/build/custom-select-control-v2/custom-select.js +2 -3
  67. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  68. package/build/dashicon/index.js +1 -0
  69. package/build/dashicon/index.js.map +1 -1
  70. package/build/date-time/date/index.js +2 -0
  71. package/build/date-time/date/index.js.map +1 -1
  72. package/build/date-time/date/use-lilius/index.js +1 -0
  73. package/build/date-time/date/use-lilius/index.js.map +1 -1
  74. package/build/date-time/time/index.js +1 -0
  75. package/build/date-time/time/index.js.map +1 -1
  76. package/build/dimension-control/index.js +2 -0
  77. package/build/dimension-control/index.js.map +1 -1
  78. package/build/dimension-control/sizes.js +1 -0
  79. package/build/dimension-control/sizes.js.map +1 -1
  80. package/build/draggable/index.js +1 -0
  81. package/build/draggable/index.js.map +1 -1
  82. package/build/draggable/index.native.js +1 -0
  83. package/build/draggable/index.native.js.map +1 -1
  84. package/build/dropdown-menu/index.js +1 -0
  85. package/build/dropdown-menu/index.js.map +1 -1
  86. package/build/dropdown-menu/index.native.js +1 -0
  87. package/build/dropdown-menu/index.native.js.map +1 -1
  88. package/build/duotone-picker/color-list-picker/index.js +1 -0
  89. package/build/duotone-picker/color-list-picker/index.js.map +1 -1
  90. package/build/duotone-picker/duotone-picker.js +1 -0
  91. package/build/duotone-picker/duotone-picker.js.map +1 -1
  92. package/build/duotone-picker/utils.js +1 -0
  93. package/build/duotone-picker/utils.js.map +1 -1
  94. package/build/external-link/index.js +1 -0
  95. package/build/external-link/index.js.map +1 -1
  96. package/build/font-size-picker/font-size-picker-select.js +1 -0
  97. package/build/font-size-picker/font-size-picker-select.js.map +1 -1
  98. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  99. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  100. package/build/font-size-picker/index.js +1 -0
  101. package/build/font-size-picker/index.js.map +1 -1
  102. package/build/font-size-picker/index.native.js +1 -0
  103. package/build/font-size-picker/index.native.js.map +1 -1
  104. package/build/font-size-picker/styles.js +9 -9
  105. package/build/font-size-picker/styles.js.map +1 -1
  106. package/build/font-size-picker/utils.js +1 -0
  107. package/build/font-size-picker/utils.js.map +1 -1
  108. package/build/form-token-field/index.js +1 -0
  109. package/build/form-token-field/index.js.map +1 -1
  110. package/build/form-token-field/suggestions-list.js +1 -0
  111. package/build/form-token-field/suggestions-list.js.map +1 -1
  112. package/build/gradient-picker/index.js +1 -0
  113. package/build/gradient-picker/index.js.map +1 -1
  114. package/build/guide/index.js +1 -0
  115. package/build/guide/index.js.map +1 -1
  116. package/build/guide/page-control.js +1 -0
  117. package/build/guide/page-control.js.map +1 -1
  118. package/build/h-stack/hook.js +1 -0
  119. package/build/h-stack/hook.js.map +1 -1
  120. package/build/heading/hook.js +1 -1
  121. package/build/heading/hook.js.map +1 -1
  122. package/build/higher-order/navigate-regions/index.js +1 -0
  123. package/build/higher-order/navigate-regions/index.js.map +1 -1
  124. package/build/higher-order/with-fallback-styles/index.js +1 -0
  125. package/build/higher-order/with-fallback-styles/index.js.map +1 -1
  126. package/build/higher-order/with-filters/index.js +1 -0
  127. package/build/higher-order/with-filters/index.js.map +1 -1
  128. package/build/higher-order/with-notices/index.js +1 -0
  129. package/build/higher-order/with-notices/index.js.map +1 -1
  130. package/build/input-control/index.js +9 -0
  131. package/build/input-control/index.js.map +1 -1
  132. package/build/input-control/types.js.map +1 -1
  133. package/build/keyboard-shortcuts/index.js +1 -0
  134. package/build/keyboard-shortcuts/index.js.map +1 -1
  135. package/build/menu/checkbox-item.js +2 -0
  136. package/build/menu/checkbox-item.js.map +1 -1
  137. package/build/menu/index.js +25 -94
  138. package/build/menu/index.js.map +1 -1
  139. package/build/menu/item.js +10 -1
  140. package/build/menu/item.js.map +1 -1
  141. package/build/menu/popover.js +89 -0
  142. package/build/menu/popover.js.map +1 -0
  143. package/build/menu/radio-item.js +2 -0
  144. package/build/menu/radio-item.js.map +1 -1
  145. package/build/menu/styles.js +16 -16
  146. package/build/menu/styles.js.map +1 -1
  147. package/build/menu/submenu-trigger-item.js +58 -0
  148. package/build/menu/submenu-trigger-item.js.map +1 -0
  149. package/build/menu/trigger-button.js +45 -0
  150. package/build/menu/trigger-button.js.map +1 -0
  151. package/build/menu/types.js.map +1 -1
  152. package/build/menu-items-choice/index.js +1 -0
  153. package/build/menu-items-choice/index.js.map +1 -1
  154. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  155. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  156. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  157. package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  158. package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
  159. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  160. package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
  161. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  162. package/build/mobile/color-settings/palette.screen.native.js +1 -0
  163. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  164. package/build/mobile/gradient/index.native.js +1 -0
  165. package/build/mobile/gradient/index.native.js.map +1 -1
  166. package/build/mobile/media-edit/index.native.js +1 -0
  167. package/build/mobile/media-edit/index.native.js.map +1 -1
  168. package/build/mobile/picker/index.android.js +1 -0
  169. package/build/mobile/picker/index.android.js.map +1 -1
  170. package/build/mobile/picker/index.ios.js +1 -0
  171. package/build/mobile/picker/index.ios.js.map +1 -1
  172. package/build/mobile/segmented-control/index.native.js +1 -0
  173. package/build/mobile/segmented-control/index.native.js.map +1 -1
  174. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
  175. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  176. package/build/navigable-container/container.js +1 -0
  177. package/build/navigable-container/container.js.map +1 -1
  178. package/build/navigation/back-button/index.js +1 -0
  179. package/build/navigation/back-button/index.js.map +1 -1
  180. package/build/navigation/group/index.js +1 -0
  181. package/build/navigation/group/index.js.map +1 -1
  182. package/build/navigation/index.js +6 -0
  183. package/build/navigation/index.js.map +1 -1
  184. package/build/navigation/item/index.js +1 -0
  185. package/build/navigation/item/index.js.map +1 -1
  186. package/build/navigation/menu/menu-title-search.js +1 -0
  187. package/build/navigation/menu/menu-title-search.js.map +1 -1
  188. package/build/navigation/menu/search-no-results-found.js +1 -0
  189. package/build/navigation/menu/search-no-results-found.js.map +1 -1
  190. package/build/navigation/styles/navigation-styles.js +12 -12
  191. package/build/navigation/styles/navigation-styles.js.map +1 -1
  192. package/build/navigator/navigator/component.js +1 -0
  193. package/build/navigator/navigator/component.js.map +1 -1
  194. package/build/navigator/navigator-screen/component.js +1 -0
  195. package/build/navigator/navigator-screen/component.js.map +1 -1
  196. package/build/navigator/utils/router.js +1 -0
  197. package/build/navigator/utils/router.js.map +1 -1
  198. package/build/notice/index.js +1 -0
  199. package/build/notice/index.js.map +1 -1
  200. package/build/notice/list.js +1 -0
  201. package/build/notice/list.js.map +1 -1
  202. package/build/notice/list.native.js +1 -0
  203. package/build/notice/list.native.js.map +1 -1
  204. package/build/number-control/index.js +1 -0
  205. package/build/number-control/index.js.map +1 -1
  206. package/build/palette-edit/index.js +2 -0
  207. package/build/palette-edit/index.js.map +1 -1
  208. package/build/panel/actions.native.js +1 -0
  209. package/build/panel/actions.native.js.map +1 -1
  210. package/build/private-apis.js +3 -1
  211. package/build/private-apis.js.map +1 -1
  212. package/build/query-controls/index.js +1 -0
  213. package/build/query-controls/index.js.map +1 -1
  214. package/build/query-controls/terms.js +1 -0
  215. package/build/query-controls/terms.js.map +1 -1
  216. package/build/radio-control/index.js +1 -0
  217. package/build/radio-control/index.js.map +1 -1
  218. package/build/radio-control/index.native.js +1 -0
  219. package/build/radio-control/index.native.js.map +1 -1
  220. package/build/radio-group/index.js +6 -0
  221. package/build/radio-group/index.js.map +1 -1
  222. package/build/radio-group/radio.js +2 -3
  223. package/build/radio-group/radio.js.map +1 -1
  224. package/build/range-control/rail.js +1 -0
  225. package/build/range-control/rail.js.map +1 -1
  226. package/build/range-control/styles/range-control-styles.js +28 -28
  227. package/build/range-control/styles/range-control-styles.js.map +1 -1
  228. package/build/resizable-box/index.js +1 -0
  229. package/build/resizable-box/index.js.map +1 -1
  230. package/build/sandbox/index.js +1 -0
  231. package/build/sandbox/index.js.map +1 -1
  232. package/build/sandbox/index.native.js +1 -0
  233. package/build/sandbox/index.native.js.map +1 -1
  234. package/build/search-control/index.native.js +1 -0
  235. package/build/search-control/index.native.js.map +1 -1
  236. package/build/select-control/index.js +10 -0
  237. package/build/select-control/index.js.map +1 -1
  238. package/build/select-control/types.js.map +1 -1
  239. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  240. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  241. package/build/slot-fill/context.js +4 -3
  242. package/build/slot-fill/context.js.map +1 -1
  243. package/build/slot-fill/fill.js +10 -15
  244. package/build/slot-fill/fill.js.map +1 -1
  245. package/build/slot-fill/provider.js +42 -55
  246. package/build/slot-fill/provider.js.map +1 -1
  247. package/build/slot-fill/slot.js +32 -23
  248. package/build/slot-fill/slot.js.map +1 -1
  249. package/build/slot-fill/types.js.map +1 -1
  250. package/build/snackbar/index.js +1 -0
  251. package/build/snackbar/index.js.map +1 -1
  252. package/build/snackbar/list.js +1 -0
  253. package/build/snackbar/list.js.map +1 -1
  254. package/build/tab-panel/index.js +3 -3
  255. package/build/tab-panel/index.js.map +1 -1
  256. package/build/tabs/index.js +22 -4
  257. package/build/tabs/index.js.map +1 -1
  258. package/build/tabs/types.js.map +1 -1
  259. package/build/text/hook.js +6 -6
  260. package/build/text/hook.js.map +1 -1
  261. package/build/text/styles.js +7 -7
  262. package/build/text/styles.js.map +1 -1
  263. package/build/text/utils.js +1 -0
  264. package/build/text/utils.js.map +1 -1
  265. package/build/theme/color-algorithms.js +1 -0
  266. package/build/theme/color-algorithms.js.map +1 -1
  267. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +2 -3
  268. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  269. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  270. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  271. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  272. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  273. package/build/toolbar/toolbar-group/index.js +1 -0
  274. package/build/toolbar/toolbar-group/index.js.map +1 -1
  275. package/build/tools-panel/tools-panel/hook.js +1 -0
  276. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  277. package/build/tools-panel/tools-panel-header/component.js +1 -0
  278. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  279. package/build/tooltip/index.js +2 -3
  280. package/build/tooltip/index.js.map +1 -1
  281. package/build/tree-grid/index.js +1 -0
  282. package/build/tree-grid/index.js.map +1 -1
  283. package/build/tree-select/index.js +11 -2
  284. package/build/tree-select/index.js.map +1 -1
  285. package/build/tree-select/types.js.map +1 -1
  286. package/build/unit-control/index.js +1 -0
  287. package/build/unit-control/index.js.map +1 -1
  288. package/build/unit-control/index.native.js +1 -0
  289. package/build/unit-control/index.native.js.map +1 -1
  290. package/build/unit-control/unit-select-control.js +1 -0
  291. package/build/unit-control/unit-select-control.js.map +1 -1
  292. package/build/unit-control/utils.js +1 -0
  293. package/build/unit-control/utils.js.map +1 -1
  294. package/build/utils/colors-values.js +3 -0
  295. package/build/utils/colors-values.js.map +1 -1
  296. package/build/utils/config-values.js +0 -1
  297. package/build/utils/config-values.js.map +1 -1
  298. package/build/utils/get-valid-children.js +1 -0
  299. package/build/utils/get-valid-children.js.map +1 -1
  300. package/build/utils/hooks/use-animated-offset-rect.js +1 -0
  301. package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
  302. package/build/utils/hooks/use-cx.js +1 -0
  303. package/build/utils/hooks/use-cx.js.map +1 -1
  304. package/build/utils/math.js +1 -0
  305. package/build/utils/math.js.map +1 -1
  306. package/build/utils/rtl.js +1 -0
  307. package/build/utils/rtl.js.map +1 -1
  308. package/build/utils/values.js +1 -0
  309. package/build/utils/values.js.map +1 -1
  310. package/build/z-stack/component.js +1 -0
  311. package/build/z-stack/component.js.map +1 -1
  312. package/build-module/alignment-matrix-control/icon.js +1 -0
  313. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  314. package/build-module/alignment-matrix-control/index.js +1 -0
  315. package/build-module/alignment-matrix-control/index.js.map +1 -1
  316. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  317. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  318. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  319. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  320. package/build-module/autocomplete/get-default-use-items.js +1 -0
  321. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  322. package/build-module/autocomplete/index.js +1 -0
  323. package/build-module/autocomplete/index.js.map +1 -1
  324. package/build-module/badge/index.js +57 -0
  325. package/build-module/badge/index.js.map +1 -0
  326. package/build-module/badge/types.js +2 -0
  327. package/build-module/badge/types.js.map +1 -0
  328. package/build-module/border-box-control/utils.js +1 -0
  329. package/build-module/border-box-control/utils.js.map +1 -1
  330. package/build-module/border-control/border-control-dropdown/component.js +1 -0
  331. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  332. package/build-module/border-control/border-control-style-picker/component.js +1 -0
  333. package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
  334. package/build-module/box-control/index.js +20 -16
  335. package/build-module/box-control/index.js.map +1 -1
  336. package/build-module/box-control/input-control.js +214 -0
  337. package/build-module/box-control/input-control.js.map +1 -0
  338. package/build-module/box-control/types.js.map +1 -1
  339. package/build-module/box-control/utils.js +95 -46
  340. package/build-module/box-control/utils.js.map +1 -1
  341. package/build-module/button/index.native.js +1 -0
  342. package/build-module/button/index.native.js.map +1 -1
  343. package/build-module/button/types.js.map +1 -1
  344. package/build-module/button-group/index.js +10 -0
  345. package/build-module/button-group/index.js.map +1 -1
  346. package/build-module/button-group/types.js.map +1 -1
  347. package/build-module/color-indicator/index.native.js +1 -0
  348. package/build-module/color-indicator/index.native.js.map +1 -1
  349. package/build-module/color-palette/index.js +1 -0
  350. package/build-module/color-palette/index.js.map +1 -1
  351. package/build-module/color-palette/index.native.js +1 -0
  352. package/build-module/color-palette/index.native.js.map +1 -1
  353. package/build-module/color-palette/utils.js +1 -0
  354. package/build-module/color-palette/utils.js.map +1 -1
  355. package/build-module/combobox-control/index.js +1 -0
  356. package/build-module/combobox-control/index.js.map +1 -1
  357. package/build-module/composite/legacy/index.js +1 -0
  358. package/build-module/composite/legacy/index.js.map +1 -1
  359. package/build-module/context/context-connect.js +1 -0
  360. package/build-module/context/context-connect.js.map +1 -1
  361. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
  362. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  363. package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
  364. package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
  365. package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
  366. package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
  367. package/build-module/custom-gradient-picker/index.js +1 -0
  368. package/build-module/custom-gradient-picker/index.js.map +1 -1
  369. package/build-module/custom-gradient-picker/serializer.js +1 -0
  370. package/build-module/custom-gradient-picker/serializer.js.map +1 -1
  371. package/build-module/custom-gradient-picker/utils.js +1 -0
  372. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  373. package/build-module/custom-select-control/index.js +2 -3
  374. package/build-module/custom-select-control/index.js.map +1 -1
  375. package/build-module/custom-select-control-v2/custom-select.js +1 -2
  376. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  377. package/build-module/dashicon/index.js +1 -0
  378. package/build-module/dashicon/index.js.map +1 -1
  379. package/build-module/date-time/date/index.js +2 -0
  380. package/build-module/date-time/date/index.js.map +1 -1
  381. package/build-module/date-time/date/use-lilius/index.js +1 -0
  382. package/build-module/date-time/date/use-lilius/index.js.map +1 -1
  383. package/build-module/date-time/time/index.js +1 -0
  384. package/build-module/date-time/time/index.js.map +1 -1
  385. package/build-module/dimension-control/index.js +2 -0
  386. package/build-module/dimension-control/index.js.map +1 -1
  387. package/build-module/dimension-control/sizes.js +1 -0
  388. package/build-module/dimension-control/sizes.js.map +1 -1
  389. package/build-module/draggable/index.js +1 -0
  390. package/build-module/draggable/index.js.map +1 -1
  391. package/build-module/draggable/index.native.js +1 -0
  392. package/build-module/draggable/index.native.js.map +1 -1
  393. package/build-module/dropdown-menu/index.js +1 -0
  394. package/build-module/dropdown-menu/index.js.map +1 -1
  395. package/build-module/dropdown-menu/index.native.js +1 -0
  396. package/build-module/dropdown-menu/index.native.js.map +1 -1
  397. package/build-module/duotone-picker/color-list-picker/index.js +1 -0
  398. package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
  399. package/build-module/duotone-picker/duotone-picker.js +1 -0
  400. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  401. package/build-module/duotone-picker/utils.js +1 -0
  402. package/build-module/duotone-picker/utils.js.map +1 -1
  403. package/build-module/external-link/index.js +1 -0
  404. package/build-module/external-link/index.js.map +1 -1
  405. package/build-module/font-size-picker/font-size-picker-select.js +1 -0
  406. package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
  407. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  408. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  409. package/build-module/font-size-picker/index.js +1 -0
  410. package/build-module/font-size-picker/index.js.map +1 -1
  411. package/build-module/font-size-picker/index.native.js +1 -0
  412. package/build-module/font-size-picker/index.native.js.map +1 -1
  413. package/build-module/font-size-picker/styles.js +9 -9
  414. package/build-module/font-size-picker/styles.js.map +1 -1
  415. package/build-module/font-size-picker/utils.js +1 -0
  416. package/build-module/font-size-picker/utils.js.map +1 -1
  417. package/build-module/form-token-field/index.js +1 -0
  418. package/build-module/form-token-field/index.js.map +1 -1
  419. package/build-module/form-token-field/suggestions-list.js +1 -0
  420. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  421. package/build-module/gradient-picker/index.js +1 -0
  422. package/build-module/gradient-picker/index.js.map +1 -1
  423. package/build-module/guide/index.js +1 -0
  424. package/build-module/guide/index.js.map +1 -1
  425. package/build-module/guide/page-control.js +1 -0
  426. package/build-module/guide/page-control.js.map +1 -1
  427. package/build-module/h-stack/hook.js +1 -0
  428. package/build-module/h-stack/hook.js.map +1 -1
  429. package/build-module/heading/hook.js +1 -1
  430. package/build-module/heading/hook.js.map +1 -1
  431. package/build-module/higher-order/navigate-regions/index.js +1 -0
  432. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  433. package/build-module/higher-order/with-fallback-styles/index.js +1 -0
  434. package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
  435. package/build-module/higher-order/with-filters/index.js +1 -0
  436. package/build-module/higher-order/with-filters/index.js.map +1 -1
  437. package/build-module/higher-order/with-notices/index.js +1 -0
  438. package/build-module/higher-order/with-notices/index.js.map +1 -1
  439. package/build-module/input-control/index.js +9 -0
  440. package/build-module/input-control/index.js.map +1 -1
  441. package/build-module/input-control/types.js.map +1 -1
  442. package/build-module/keyboard-shortcuts/index.js +1 -0
  443. package/build-module/keyboard-shortcuts/index.js.map +1 -1
  444. package/build-module/menu/checkbox-item.js +2 -0
  445. package/build-module/menu/checkbox-item.js.map +1 -1
  446. package/build-module/menu/index.js +28 -97
  447. package/build-module/menu/index.js.map +1 -1
  448. package/build-module/menu/item.js +10 -1
  449. package/build-module/menu/item.js.map +1 -1
  450. package/build-module/menu/popover.js +81 -0
  451. package/build-module/menu/popover.js.map +1 -0
  452. package/build-module/menu/radio-item.js +2 -0
  453. package/build-module/menu/radio-item.js.map +1 -1
  454. package/build-module/menu/styles.js +16 -16
  455. package/build-module/menu/styles.js.map +1 -1
  456. package/build-module/menu/submenu-trigger-item.js +50 -0
  457. package/build-module/menu/submenu-trigger-item.js.map +1 -0
  458. package/build-module/menu/trigger-button.js +37 -0
  459. package/build-module/menu/trigger-button.js.map +1 -0
  460. package/build-module/menu/types.js.map +1 -1
  461. package/build-module/menu-items-choice/index.js +1 -0
  462. package/build-module/menu-items-choice/index.js.map +1 -1
  463. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
  464. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  465. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
  466. package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
  467. package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
  468. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  469. package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
  470. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  471. package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
  472. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  473. package/build-module/mobile/gradient/index.native.js +1 -0
  474. package/build-module/mobile/gradient/index.native.js.map +1 -1
  475. package/build-module/mobile/media-edit/index.native.js +1 -0
  476. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  477. package/build-module/mobile/picker/index.android.js +1 -0
  478. package/build-module/mobile/picker/index.android.js.map +1 -1
  479. package/build-module/mobile/picker/index.ios.js +1 -0
  480. package/build-module/mobile/picker/index.ios.js.map +1 -1
  481. package/build-module/mobile/segmented-control/index.native.js +1 -0
  482. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  483. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
  484. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  485. package/build-module/navigable-container/container.js +1 -0
  486. package/build-module/navigable-container/container.js.map +1 -1
  487. package/build-module/navigation/back-button/index.js +1 -0
  488. package/build-module/navigation/back-button/index.js.map +1 -1
  489. package/build-module/navigation/group/index.js +1 -0
  490. package/build-module/navigation/group/index.js.map +1 -1
  491. package/build-module/navigation/index.js +6 -0
  492. package/build-module/navigation/index.js.map +1 -1
  493. package/build-module/navigation/item/index.js +1 -0
  494. package/build-module/navigation/item/index.js.map +1 -1
  495. package/build-module/navigation/menu/menu-title-search.js +1 -0
  496. package/build-module/navigation/menu/menu-title-search.js.map +1 -1
  497. package/build-module/navigation/menu/search-no-results-found.js +1 -0
  498. package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
  499. package/build-module/navigation/styles/navigation-styles.js +12 -12
  500. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  501. package/build-module/navigator/navigator/component.js +1 -0
  502. package/build-module/navigator/navigator/component.js.map +1 -1
  503. package/build-module/navigator/navigator-screen/component.js +1 -0
  504. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  505. package/build-module/navigator/utils/router.js +1 -0
  506. package/build-module/navigator/utils/router.js.map +1 -1
  507. package/build-module/notice/index.js +1 -0
  508. package/build-module/notice/index.js.map +1 -1
  509. package/build-module/notice/list.js +1 -0
  510. package/build-module/notice/list.js.map +1 -1
  511. package/build-module/notice/list.native.js +1 -0
  512. package/build-module/notice/list.native.js.map +1 -1
  513. package/build-module/number-control/index.js +1 -0
  514. package/build-module/number-control/index.js.map +1 -1
  515. package/build-module/palette-edit/index.js +2 -0
  516. package/build-module/palette-edit/index.js.map +1 -1
  517. package/build-module/panel/actions.native.js +1 -0
  518. package/build-module/panel/actions.native.js.map +1 -1
  519. package/build-module/private-apis.js +3 -1
  520. package/build-module/private-apis.js.map +1 -1
  521. package/build-module/query-controls/index.js +1 -0
  522. package/build-module/query-controls/index.js.map +1 -1
  523. package/build-module/query-controls/terms.js +1 -0
  524. package/build-module/query-controls/terms.js.map +1 -1
  525. package/build-module/radio-control/index.js +1 -0
  526. package/build-module/radio-control/index.js.map +1 -1
  527. package/build-module/radio-control/index.native.js +1 -0
  528. package/build-module/radio-control/index.native.js.map +1 -1
  529. package/build-module/radio-group/index.js +6 -0
  530. package/build-module/radio-group/index.js.map +1 -1
  531. package/build-module/radio-group/radio.js +1 -2
  532. package/build-module/radio-group/radio.js.map +1 -1
  533. package/build-module/range-control/rail.js +1 -0
  534. package/build-module/range-control/rail.js.map +1 -1
  535. package/build-module/range-control/styles/range-control-styles.js +28 -28
  536. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  537. package/build-module/resizable-box/index.js +1 -0
  538. package/build-module/resizable-box/index.js.map +1 -1
  539. package/build-module/sandbox/index.js +1 -0
  540. package/build-module/sandbox/index.js.map +1 -1
  541. package/build-module/sandbox/index.native.js +1 -0
  542. package/build-module/sandbox/index.native.js.map +1 -1
  543. package/build-module/search-control/index.native.js +1 -0
  544. package/build-module/search-control/index.native.js.map +1 -1
  545. package/build-module/select-control/index.js +10 -0
  546. package/build-module/select-control/index.js.map +1 -1
  547. package/build-module/select-control/types.js.map +1 -1
  548. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
  549. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  550. package/build-module/slot-fill/context.js +5 -3
  551. package/build-module/slot-fill/context.js.map +1 -1
  552. package/build-module/slot-fill/fill.js +10 -15
  553. package/build-module/slot-fill/fill.js.map +1 -1
  554. package/build-module/slot-fill/provider.js +42 -55
  555. package/build-module/slot-fill/provider.js.map +1 -1
  556. package/build-module/slot-fill/slot.js +33 -24
  557. package/build-module/slot-fill/slot.js.map +1 -1
  558. package/build-module/slot-fill/types.js.map +1 -1
  559. package/build-module/snackbar/index.js +1 -0
  560. package/build-module/snackbar/index.js.map +1 -1
  561. package/build-module/snackbar/list.js +1 -0
  562. package/build-module/snackbar/list.js.map +1 -1
  563. package/build-module/tab-panel/index.js +2 -2
  564. package/build-module/tab-panel/index.js.map +1 -1
  565. package/build-module/tabs/index.js +22 -4
  566. package/build-module/tabs/index.js.map +1 -1
  567. package/build-module/tabs/types.js.map +1 -1
  568. package/build-module/text/hook.js +6 -6
  569. package/build-module/text/hook.js.map +1 -1
  570. package/build-module/text/styles.js +7 -7
  571. package/build-module/text/styles.js.map +1 -1
  572. package/build-module/text/utils.js +1 -0
  573. package/build-module/text/utils.js.map +1 -1
  574. package/build-module/theme/color-algorithms.js +1 -0
  575. package/build-module/theme/color-algorithms.js.map +1 -1
  576. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +1 -2
  577. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  578. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  579. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  580. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
  581. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  582. package/build-module/toolbar/toolbar-group/index.js +1 -0
  583. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  584. package/build-module/tools-panel/tools-panel/hook.js +1 -0
  585. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  586. package/build-module/tools-panel/tools-panel-header/component.js +1 -0
  587. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  588. package/build-module/tooltip/index.js +1 -2
  589. package/build-module/tooltip/index.js.map +1 -1
  590. package/build-module/tree-grid/index.js +1 -0
  591. package/build-module/tree-grid/index.js.map +1 -1
  592. package/build-module/tree-select/index.js +11 -2
  593. package/build-module/tree-select/index.js.map +1 -1
  594. package/build-module/tree-select/types.js.map +1 -1
  595. package/build-module/unit-control/index.js +1 -0
  596. package/build-module/unit-control/index.js.map +1 -1
  597. package/build-module/unit-control/index.native.js +1 -0
  598. package/build-module/unit-control/index.native.js.map +1 -1
  599. package/build-module/unit-control/unit-select-control.js +1 -0
  600. package/build-module/unit-control/unit-select-control.js.map +1 -1
  601. package/build-module/unit-control/utils.js +1 -0
  602. package/build-module/unit-control/utils.js.map +1 -1
  603. package/build-module/utils/colors-values.js +3 -0
  604. package/build-module/utils/colors-values.js.map +1 -1
  605. package/build-module/utils/config-values.js +0 -1
  606. package/build-module/utils/config-values.js.map +1 -1
  607. package/build-module/utils/get-valid-children.js +1 -0
  608. package/build-module/utils/get-valid-children.js.map +1 -1
  609. package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
  610. package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
  611. package/build-module/utils/hooks/use-cx.js +1 -0
  612. package/build-module/utils/hooks/use-cx.js.map +1 -1
  613. package/build-module/utils/math.js +1 -0
  614. package/build-module/utils/math.js.map +1 -1
  615. package/build-module/utils/rtl.js +1 -0
  616. package/build-module/utils/rtl.js.map +1 -1
  617. package/build-module/utils/values.js +1 -0
  618. package/build-module/utils/values.js.map +1 -1
  619. package/build-module/z-stack/component.js +1 -0
  620. package/build-module/z-stack/component.js.map +1 -1
  621. package/build-style/style-rtl.css +60 -13
  622. package/build-style/style.css +60 -13
  623. package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
  624. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  625. package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
  626. package/build-types/animate/stories/index.story.d.ts +7 -7
  627. package/build-types/animate/stories/index.story.d.ts.map +1 -1
  628. package/build-types/badge/index.d.ts +8 -0
  629. package/build-types/badge/index.d.ts.map +1 -0
  630. package/build-types/badge/stories/index.story.d.ts +17 -0
  631. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  632. package/build-types/badge/test/index.d.ts +2 -0
  633. package/build-types/badge/test/index.d.ts.map +1 -0
  634. package/build-types/badge/types.d.ts +13 -0
  635. package/build-types/badge/types.d.ts.map +1 -0
  636. package/build-types/base-control/stories/index.story.d.ts +1 -1
  637. package/build-types/border-box-control/stories/index.story.d.ts +1 -1
  638. package/build-types/border-control/stories/index.story.d.ts +5 -5
  639. package/build-types/box-control/index.d.ts +1 -1
  640. package/build-types/box-control/index.d.ts.map +1 -1
  641. package/build-types/box-control/input-control.d.ts +3 -0
  642. package/build-types/box-control/input-control.d.ts.map +1 -0
  643. package/build-types/box-control/stories/index.story.d.ts +356 -11
  644. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  645. package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
  646. package/build-types/box-control/types.d.ts +26 -1
  647. package/build-types/box-control/types.d.ts.map +1 -1
  648. package/build-types/box-control/utils.d.ts +49 -15
  649. package/build-types/box-control/utils.d.ts.map +1 -1
  650. package/build-types/button/stories/e2e/index.story.d.ts +1 -1
  651. package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
  652. package/build-types/button/stories/index.story.d.ts +25 -7
  653. package/build-types/button/stories/index.story.d.ts.map +1 -1
  654. package/build-types/button/types.d.ts +6 -4
  655. package/build-types/button/types.d.ts.map +1 -1
  656. package/build-types/button-group/index.d.ts +3 -1
  657. package/build-types/button-group/index.d.ts.map +1 -1
  658. package/build-types/button-group/stories/index.story.d.ts +6 -0
  659. package/build-types/button-group/stories/index.story.d.ts.map +1 -1
  660. package/build-types/button-group/types.d.ts +7 -0
  661. package/build-types/button-group/types.d.ts.map +1 -1
  662. package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
  663. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  664. package/build-types/color-palette/stories/index.story.d.ts +3 -3
  665. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  666. package/build-types/color-picker/styles.d.ts +2 -2
  667. package/build-types/color-picker/styles.d.ts.map +1 -1
  668. package/build-types/combobox-control/stories/index.story.d.ts +4 -4
  669. package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
  670. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  671. package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
  672. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  673. package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
  674. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  675. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  676. package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
  677. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  678. package/build-types/date-time/date/index.d.ts.map +1 -1
  679. package/build-types/date-time/stories/time.story.d.ts +1 -1
  680. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  681. package/build-types/date-time/time/styles.d.ts +4 -4
  682. package/build-types/dimension-control/index.d.ts.map +1 -1
  683. package/build-types/dimension-control/stories/index.story.d.ts +1 -1
  684. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  685. package/build-types/drop-zone/stories/index.story.d.ts +1 -1
  686. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  687. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
  688. package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
  689. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
  690. package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
  691. package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
  692. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  693. package/build-types/font-size-picker/styles.d.ts.map +1 -1
  694. package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
  695. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  696. package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
  697. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  698. package/build-types/guide/stories/index.story.d.ts +1 -1
  699. package/build-types/guide/stories/index.story.d.ts.map +1 -1
  700. package/build-types/icon/stories/index.story.d.ts +4 -4
  701. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  702. package/build-types/input-control/index.d.ts +1 -0
  703. package/build-types/input-control/index.d.ts.map +1 -1
  704. package/build-types/input-control/stories/index.story.d.ts +7 -7
  705. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  706. package/build-types/input-control/types.d.ts +11 -2
  707. package/build-types/input-control/types.d.ts.map +1 -1
  708. package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
  709. package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
  710. package/build-types/menu/checkbox-item.d.ts.map +1 -1
  711. package/build-types/menu/index.d.ts +10 -1
  712. package/build-types/menu/index.d.ts.map +1 -1
  713. package/build-types/menu/item.d.ts.map +1 -1
  714. package/build-types/menu/popover.d.ts +3 -0
  715. package/build-types/menu/popover.d.ts.map +1 -0
  716. package/build-types/menu/radio-item.d.ts.map +1 -1
  717. package/build-types/menu/stories/index.story.d.ts +9 -9
  718. package/build-types/menu/stories/index.story.d.ts.map +1 -1
  719. package/build-types/menu/submenu-trigger-item.d.ts +3 -0
  720. package/build-types/menu/submenu-trigger-item.d.ts.map +1 -0
  721. package/build-types/menu/trigger-button.d.ts +3 -0
  722. package/build-types/menu/trigger-button.d.ts.map +1 -0
  723. package/build-types/menu/types.d.ts +208 -57
  724. package/build-types/menu/types.d.ts.map +1 -1
  725. package/build-types/menu-group/stories/index.story.d.ts +1 -1
  726. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  727. package/build-types/menu-item/stories/index.story.d.ts +4 -4
  728. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  729. package/build-types/navigation/back-button/index.d.ts.map +1 -1
  730. package/build-types/navigation/index.d.ts.map +1 -1
  731. package/build-types/navigation/item/index.d.ts.map +1 -1
  732. package/build-types/navigation/stories/index.story.d.ts +6 -6
  733. package/build-types/navigation/stories/index.story.d.ts.map +1 -1
  734. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  735. package/build-types/notice/stories/index.story.d.ts +4 -4
  736. package/build-types/notice/stories/index.story.d.ts.map +1 -1
  737. package/build-types/number-control/index.d.ts +1 -1
  738. package/build-types/number-control/index.d.ts.map +1 -1
  739. package/build-types/number-control/stories/index.story.d.ts +2 -2
  740. package/build-types/palette-edit/index.d.ts.map +1 -1
  741. package/build-types/palette-edit/stories/index.story.d.ts +2 -2
  742. package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
  743. package/build-types/private-apis.d.ts.map +1 -1
  744. package/build-types/progress-bar/stories/index.story.d.ts +1 -1
  745. package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
  746. package/build-types/query-controls/stories/index.story.d.ts +1 -1
  747. package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
  748. package/build-types/radio-group/index.d.ts.map +1 -1
  749. package/build-types/radio-group/radio.d.ts.map +1 -1
  750. package/build-types/range-control/index.d.ts +1 -1
  751. package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
  752. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  753. package/build-types/resizable-box/stories/index.story.d.ts +2 -2
  754. package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
  755. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  756. package/build-types/sandbox/stories/index.story.d.ts +1 -1
  757. package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
  758. package/build-types/search-control/stories/index.story.d.ts +1 -1
  759. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  760. package/build-types/select-control/index.d.ts +1 -0
  761. package/build-types/select-control/index.d.ts.map +1 -1
  762. package/build-types/select-control/stories/index.story.d.ts +5 -5
  763. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  764. package/build-types/select-control/types.d.ts +1 -1
  765. package/build-types/select-control/types.d.ts.map +1 -1
  766. package/build-types/shortcut/stories/index.story.d.ts +1 -1
  767. package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
  768. package/build-types/slot-fill/context.d.ts.map +1 -1
  769. package/build-types/slot-fill/fill.d.ts.map +1 -1
  770. package/build-types/slot-fill/provider.d.ts.map +1 -1
  771. package/build-types/slot-fill/slot.d.ts.map +1 -1
  772. package/build-types/slot-fill/types.d.ts +13 -11
  773. package/build-types/slot-fill/types.d.ts.map +1 -1
  774. package/build-types/tab-panel/index.d.ts.map +1 -1
  775. package/build-types/tab-panel/stories/index.story.d.ts +4 -4
  776. package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
  777. package/build-types/tabs/index.d.ts +21 -4
  778. package/build-types/tabs/index.d.ts.map +1 -1
  779. package/build-types/tabs/stories/index.story.d.ts +10 -10
  780. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  781. package/build-types/tabs/types.d.ts +13 -13
  782. package/build-types/tabs/types.d.ts.map +1 -1
  783. package/build-types/text/stories/index.story.d.ts +3 -3
  784. package/build-types/theme/stories/index.story.d.ts +1 -1
  785. package/build-types/toggle-control/stories/index.story.d.ts +2 -2
  786. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  787. package/build-types/toolbar/stories/index.story.d.ts +3 -3
  788. package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
  789. package/build-types/tooltip/index.d.ts.map +1 -1
  790. package/build-types/tooltip/stories/index.story.d.ts +1 -1
  791. package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
  792. package/build-types/tree-grid/stories/index.story.d.ts +1 -1
  793. package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
  794. package/build-types/tree-select/index.d.ts +3 -2
  795. package/build-types/tree-select/index.d.ts.map +1 -1
  796. package/build-types/tree-select/stories/index.story.d.ts +1 -1
  797. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  798. package/build-types/tree-select/types.d.ts +5 -1
  799. package/build-types/tree-select/types.d.ts.map +1 -1
  800. package/build-types/unit-control/index.d.ts +1 -1
  801. package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
  802. package/build-types/utils/colors-values.d.ts +3 -0
  803. package/build-types/utils/colors-values.d.ts.map +1 -1
  804. package/build-types/utils/config-values.d.ts +0 -1
  805. package/build-types/v-stack/stories/index.story.d.ts +1 -1
  806. package/package.json +19 -19
  807. package/src/alignment-matrix-control/README.md +16 -15
  808. package/src/angle-picker-control/README.md +10 -9
  809. package/src/badge/README.md +24 -0
  810. package/src/badge/docs-manifest.json +5 -0
  811. package/src/badge/index.tsx +67 -0
  812. package/src/badge/stories/index.story.tsx +54 -0
  813. package/src/badge/styles.scss +49 -0
  814. package/src/badge/test/index.tsx +45 -0
  815. package/src/badge/types.ts +12 -0
  816. package/src/base-control/README.md +22 -21
  817. package/src/box-control/README.md +41 -24
  818. package/src/box-control/index.tsx +28 -14
  819. package/src/box-control/input-control.tsx +299 -0
  820. package/src/box-control/stories/index.story.tsx +12 -0
  821. package/src/box-control/types.ts +27 -1
  822. package/src/box-control/utils.ts +122 -60
  823. package/src/button/README.md +110 -220
  824. package/src/button/docs-manifest.json +5 -0
  825. package/src/button/stories/best-practices.mdx +31 -0
  826. package/src/button/stories/index.story.tsx +18 -0
  827. package/src/button/style.scss +9 -10
  828. package/src/button/test/index.tsx +9 -2
  829. package/src/button/types.ts +6 -4
  830. package/src/button-group/README.md +4 -0
  831. package/src/button-group/index.tsx +11 -1
  832. package/src/button-group/stories/index.story.tsx +8 -1
  833. package/src/button-group/types.ts +7 -0
  834. package/src/custom-select-control/index.tsx +1 -1
  835. package/src/custom-select-control-v2/custom-select.tsx +1 -2
  836. package/src/custom-select-control-v2/stories/index.story.tsx +4 -0
  837. package/src/date-time/date/index.tsx +1 -0
  838. package/src/dimension-control/index.tsx +1 -0
  839. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  840. package/src/disabled/stories/index.story.tsx +1 -0
  841. package/src/drop-zone/stories/index.story.tsx +7 -1
  842. package/src/font-size-picker/styles.ts +1 -0
  843. package/src/form-file-upload/README.md +22 -21
  844. package/src/gradient-picker/README.md +36 -35
  845. package/src/heading/hook.ts +1 -1
  846. package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
  847. package/src/icon/README.md +9 -8
  848. package/src/input-control/README.md +1 -0
  849. package/src/input-control/index.tsx +10 -0
  850. package/src/input-control/stories/index.story.tsx +6 -1
  851. package/src/input-control/test/index.js +9 -3
  852. package/src/input-control/types.ts +11 -2
  853. package/src/menu/checkbox-item.tsx +2 -1
  854. package/src/menu/index.tsx +61 -165
  855. package/src/menu/item.tsx +17 -2
  856. package/src/menu/popover.tsx +103 -0
  857. package/src/menu/radio-item.tsx +2 -1
  858. package/src/menu/stories/index.story.tsx +533 -381
  859. package/src/menu/styles.ts +1 -1
  860. package/src/menu/submenu-trigger-item.tsx +61 -0
  861. package/src/menu/test/index.tsx +266 -182
  862. package/src/menu/trigger-button.tsx +46 -0
  863. package/src/menu/types.ts +210 -63
  864. package/src/modal/stories/index.story.tsx +4 -1
  865. package/src/navigation/back-button/index.tsx +1 -0
  866. package/src/navigation/index.tsx +7 -0
  867. package/src/navigation/item/index.tsx +2 -0
  868. package/src/navigation/styles/navigation-styles.tsx +3 -2
  869. package/src/navigation/test/index.tsx +4 -0
  870. package/src/navigator/test/index.tsx +4 -0
  871. package/src/number-control/index.tsx +1 -0
  872. package/src/palette-edit/index.tsx +1 -0
  873. package/src/panel/stories/index.story.tsx +3 -3
  874. package/src/private-apis.ts +2 -0
  875. package/src/radio-group/index.tsx +12 -1
  876. package/src/radio-group/radio.tsx +1 -2
  877. package/src/range-control/styles/range-control-styles.ts +8 -4
  878. package/src/select-control/README.md +3 -0
  879. package/src/select-control/index.tsx +10 -0
  880. package/src/select-control/stories/index.story.tsx +2 -0
  881. package/src/select-control/test/select-control.tsx +7 -1
  882. package/src/select-control/types.ts +1 -0
  883. package/src/slot-fill/context.ts +5 -3
  884. package/src/slot-fill/fill.ts +10 -15
  885. package/src/slot-fill/provider.tsx +63 -64
  886. package/src/slot-fill/slot.tsx +40 -27
  887. package/src/slot-fill/types.ts +23 -11
  888. package/src/style.scss +1 -0
  889. package/src/tab-panel/index.tsx +1 -2
  890. package/src/tab-panel/stories/index.story.tsx +4 -0
  891. package/src/tabs/README.md +151 -187
  892. package/src/tabs/docs-manifest.json +22 -0
  893. package/src/tabs/index.tsx +21 -4
  894. package/src/tabs/stories/best-practices.mdx +99 -0
  895. package/src/tabs/stories/index.story.tsx +5 -0
  896. package/src/tabs/types.ts +13 -14
  897. package/src/text/hook.ts +2 -2
  898. package/src/text/styles.ts +1 -1
  899. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  900. package/src/text/test/index.tsx +1 -1
  901. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +24 -24
  902. package/src/toggle-group-control/test/index.tsx +7 -1
  903. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +1 -2
  904. package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
  905. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
  906. package/src/tooltip/index.tsx +1 -2
  907. package/src/tree-grid/stories/index.story.tsx +2 -0
  908. package/src/tree-select/README.md +144 -28
  909. package/src/tree-select/docs-manifest.json +5 -0
  910. package/src/tree-select/index.tsx +11 -2
  911. package/src/tree-select/stories/index.story.tsx +1 -0
  912. package/src/tree-select/types.ts +8 -1
  913. package/src/utils/colors-values.js +3 -0
  914. package/src/utils/config-values.js +0 -1
  915. package/tsconfig.json +0 -3
  916. package/tsconfig.tsbuildinfo +1 -1
  917. package/build/box-control/all-input-control.js +0 -91
  918. package/build/box-control/all-input-control.js.map +0 -1
  919. package/build/box-control/axial-input-controls.js +0 -125
  920. package/build/box-control/axial-input-controls.js.map +0 -1
  921. package/build/box-control/input-controls.js +0 -133
  922. package/build/box-control/input-controls.js.map +0 -1
  923. package/build/slot-fill/use-slot.js +0 -32
  924. package/build/slot-fill/use-slot.js.map +0 -1
  925. package/build-module/box-control/all-input-control.js +0 -84
  926. package/build-module/box-control/all-input-control.js.map +0 -1
  927. package/build-module/box-control/axial-input-controls.js +0 -116
  928. package/build-module/box-control/axial-input-controls.js.map +0 -1
  929. package/build-module/box-control/input-controls.js +0 -124
  930. package/build-module/box-control/input-controls.js.map +0 -1
  931. package/build-module/slot-fill/use-slot.js +0 -24
  932. package/build-module/slot-fill/use-slot.js.map +0 -1
  933. package/build-types/box-control/all-input-control.d.ts +0 -3
  934. package/build-types/box-control/all-input-control.d.ts.map +0 -1
  935. package/build-types/box-control/axial-input-controls.d.ts +0 -3
  936. package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
  937. package/build-types/box-control/input-controls.d.ts +0 -3
  938. package/build-types/box-control/input-controls.d.ts.map +0 -1
  939. package/build-types/slot-fill/use-slot.d.ts +0 -10
  940. package/build-types/slot-fill/use-slot.d.ts.map +0 -1
  941. package/src/box-control/all-input-control.tsx +0 -110
  942. package/src/box-control/axial-input-controls.tsx +0 -165
  943. package/src/box-control/input-controls.tsx +0 -167
  944. package/src/slot-fill/use-slot.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","initialValue","registerSlot","unregisterSlot","registerFill","unregisterFill","getSlot","undefined","getFills","subscribe","SlotFillContext"],"sources":["@wordpress/components/src/slot-fill/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport type { BaseSlotFillContext } from './types';\n\nconst initialValue: BaseSlotFillContext = {\n\tregisterSlot: () => {},\n\tunregisterSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n\tgetSlot: () => undefined,\n\tgetFills: () => [],\n\tsubscribe: () => () => {},\n};\nexport const SlotFillContext = createContext( initialValue );\n\nexport default SlotFillContext;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD;AACA;AACA;;AAGA,MAAMC,YAAiC,GAAG;EACzCC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,OAAO,EAAEA,CAAA,KAAMC,SAAS;EACxBC,QAAQ,EAAEA,CAAA,KAAM,EAAE;EAClBC,SAAS,EAAEA,CAAA,KAAM,MAAM,CAAC;AACzB,CAAC;AACD,OAAO,MAAMC,eAAe,GAAGV,aAAa,CAAEC,YAAa,CAAC;AAE5D,eAAeS,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["observableMap","createContext","initialValue","slots","fills","registerSlot","unregisterSlot","registerFill","unregisterFill","updateFill","SlotFillContext"],"sources":["@wordpress/components/src/slot-fill/context.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { observableMap } from '@wordpress/compose';\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { BaseSlotFillContext } from './types';\n\nconst initialValue: BaseSlotFillContext = {\n\tslots: observableMap(),\n\tfills: observableMap(),\n\tregisterSlot: () => {},\n\tunregisterSlot: () => {},\n\tregisterFill: () => {},\n\tunregisterFill: () => {},\n\tupdateFill: () => {},\n};\nexport const SlotFillContext = createContext( initialValue );\n\nexport default SlotFillContext;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;;AAGA,MAAMC,YAAiC,GAAG;EACzCC,KAAK,EAAEH,aAAa,CAAC,CAAC;EACtBI,KAAK,EAAEJ,aAAa,CAAC,CAAC;EACtBK,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,UAAU,EAAEA,CAAA,KAAM,CAAC;AACpB,CAAC;AACD,OAAO,MAAMC,eAAe,GAAGT,aAAa,CAAEC,YAAa,CAAC;AAE5D,eAAeQ,eAAe","ignoreList":[]}
@@ -7,29 +7,24 @@ import { useContext, useLayoutEffect, useRef } from '@wordpress/element';
7
7
  * Internal dependencies
8
8
  */
9
9
  import SlotFillContext from './context';
10
- import useSlot from './use-slot';
11
10
  export default function Fill({
12
11
  name,
13
12
  children
14
13
  }) {
15
14
  const registry = useContext(SlotFillContext);
16
- const slot = useSlot(name);
17
- const ref = useRef({
18
- name,
19
- children
20
- });
15
+ const instanceRef = useRef({});
16
+ const childrenRef = useRef(children);
17
+ useLayoutEffect(() => {
18
+ childrenRef.current = children;
19
+ }, [children]);
21
20
  useLayoutEffect(() => {
22
- const refValue = ref.current;
23
- refValue.name = name;
24
- registry.registerFill(name, refValue);
25
- return () => registry.unregisterFill(name, refValue);
21
+ const instance = instanceRef.current;
22
+ registry.registerFill(name, instance, childrenRef.current);
23
+ return () => registry.unregisterFill(name, instance);
26
24
  }, [registry, name]);
27
25
  useLayoutEffect(() => {
28
- ref.current.children = children;
29
- if (slot) {
30
- slot.rerender();
31
- }
32
- }, [slot, children]);
26
+ registry.updateFill(name, instanceRef.current, childrenRef.current);
27
+ });
33
28
  return null;
34
29
  }
35
30
  //# sourceMappingURL=fill.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useLayoutEffect","useRef","SlotFillContext","useSlot","Fill","name","children","registry","slot","ref","refValue","current","registerFill","unregisterFill","rerender"],"sources":["@wordpress/components/src/slot-fill/fill.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\nimport type { FillComponentProps } from './types';\n\nexport default function Fill( { name, children }: FillComponentProps ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tconst refValue = ref.current;\n\t\trefValue.name = name;\n\t\tregistry.registerFill( name, refValue );\n\t\treturn () => registry.unregisterFill( name, refValue );\n\t}, [ registry, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.rerender();\n\t\t}\n\t}, [ slot, children ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,oBAAoB;;AAExE;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AACvC,OAAOC,OAAO,MAAM,YAAY;AAGhC,eAAe,SAASC,IAAIA,CAAE;EAAEC,IAAI;EAAEC;AAA6B,CAAC,EAAG;EACtE,MAAMC,QAAQ,GAAGR,UAAU,CAAEG,eAAgB,CAAC;EAC9C,MAAMM,IAAI,GAAGL,OAAO,CAAEE,IAAK,CAAC;EAE5B,MAAMI,GAAG,GAAGR,MAAM,CAAE;IACnBI,IAAI;IACJC;EACD,CAAE,CAAC;EAEHN,eAAe,CAAE,MAAM;IACtB,MAAMU,QAAQ,GAAGD,GAAG,CAACE,OAAO;IAC5BD,QAAQ,CAACL,IAAI,GAAGA,IAAI;IACpBE,QAAQ,CAACK,YAAY,CAAEP,IAAI,EAAEK,QAAS,CAAC;IACvC,OAAO,MAAMH,QAAQ,CAACM,cAAc,CAAER,IAAI,EAAEK,QAAS,CAAC;EACvD,CAAC,EAAE,CAAEH,QAAQ,EAAEF,IAAI,CAAG,CAAC;EAEvBL,eAAe,CAAE,MAAM;IACtBS,GAAG,CAACE,OAAO,CAACL,QAAQ,GAAGA,QAAQ;IAC/B,IAAKE,IAAI,EAAG;MACXA,IAAI,CAACM,QAAQ,CAAC,CAAC;IAChB;EACD,CAAC,EAAE,CAAEN,IAAI,EAAEF,QAAQ,CAAG,CAAC;EAEvB,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["useContext","useLayoutEffect","useRef","SlotFillContext","Fill","name","children","registry","instanceRef","childrenRef","current","instance","registerFill","unregisterFill","updateFill"],"sources":["@wordpress/components/src/slot-fill/fill.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type { FillComponentProps } from './types';\n\nexport default function Fill( { name, children }: FillComponentProps ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst instanceRef = useRef( {} );\n\tconst childrenRef = useRef( children );\n\n\tuseLayoutEffect( () => {\n\t\tchildrenRef.current = children;\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tconst instance = instanceRef.current;\n\t\tregistry.registerFill( name, instance, childrenRef.current );\n\t\treturn () => registry.unregisterFill( name, instance );\n\t}, [ registry, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tregistry.updateFill( name, instanceRef.current, childrenRef.current );\n\t} );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,oBAAoB;;AAExE;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAGvC,eAAe,SAASC,IAAIA,CAAE;EAAEC,IAAI;EAAEC;AAA6B,CAAC,EAAG;EACtE,MAAMC,QAAQ,GAAGP,UAAU,CAAEG,eAAgB,CAAC;EAC9C,MAAMK,WAAW,GAAGN,MAAM,CAAE,CAAC,CAAE,CAAC;EAChC,MAAMO,WAAW,GAAGP,MAAM,CAAEI,QAAS,CAAC;EAEtCL,eAAe,CAAE,MAAM;IACtBQ,WAAW,CAACC,OAAO,GAAGJ,QAAQ;EAC/B,CAAC,EAAE,CAAEA,QAAQ,CAAG,CAAC;EAEjBL,eAAe,CAAE,MAAM;IACtB,MAAMU,QAAQ,GAAGH,WAAW,CAACE,OAAO;IACpCH,QAAQ,CAACK,YAAY,CAAEP,IAAI,EAAEM,QAAQ,EAAEF,WAAW,CAACC,OAAQ,CAAC;IAC5D,OAAO,MAAMH,QAAQ,CAACM,cAAc,CAAER,IAAI,EAAEM,QAAS,CAAC;EACvD,CAAC,EAAE,CAAEJ,QAAQ,EAAEF,IAAI,CAAG,CAAC;EAEvBJ,eAAe,CAAE,MAAM;IACtBM,QAAQ,CAACO,UAAU,CAAET,IAAI,EAAEG,WAAW,CAACE,OAAO,EAAED,WAAW,CAACC,OAAQ,CAAC;EACtE,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -7,81 +8,67 @@ import { useState } from '@wordpress/element';
7
8
  * Internal dependencies
8
9
  */
9
10
  import SlotFillContext from './context';
11
+ import { observableMap } from '@wordpress/compose';
10
12
  import { jsx as _jsx } from "react/jsx-runtime";
11
13
  function createSlotRegistry() {
12
- const slots = {};
13
- const fills = {};
14
- let listeners = [];
15
- function registerSlot(name, slot) {
16
- const previousSlot = slots[name];
17
- slots[name] = slot;
18
- triggerListeners();
19
-
20
- // Sometimes the fills are registered after the initial render of slot
21
- // But before the registerSlot call, we need to rerender the slot.
22
- forceUpdateSlot(name);
23
-
24
- // If a new instance of a slot is being mounted while another with the
25
- // same name exists, force its update _after_ the new slot has been
26
- // assigned into the instance, such that its own rendering of children
27
- // will be empty (the new Slot will subsume all fills for this name).
28
- if (previousSlot) {
29
- previousSlot.rerender();
30
- }
31
- }
32
- function registerFill(name, instance) {
33
- fills[name] = [...(fills[name] || []), instance];
34
- forceUpdateSlot(name);
14
+ const slots = observableMap();
15
+ const fills = observableMap();
16
+ function registerSlot(name, instance) {
17
+ slots.set(name, instance);
35
18
  }
36
19
  function unregisterSlot(name, instance) {
37
20
  // If a previous instance of a Slot by this name unmounts, do nothing,
38
21
  // as the slot and its fills should only be removed for the current
39
22
  // known instance.
40
- if (slots[name] !== instance) {
23
+ if (slots.get(name) !== instance) {
41
24
  return;
42
25
  }
43
- delete slots[name];
44
- triggerListeners();
26
+ slots.delete(name);
45
27
  }
46
- function unregisterFill(name, instance) {
47
- var _fills$name$filter;
48
- fills[name] = (_fills$name$filter = fills[name]?.filter(fill => fill !== instance)) !== null && _fills$name$filter !== void 0 ? _fills$name$filter : [];
49
- forceUpdateSlot(name);
50
- }
51
- function getSlot(name) {
52
- return slots[name];
28
+ function registerFill(name, instance, children) {
29
+ fills.set(name, [...(fills.get(name) || []), {
30
+ instance,
31
+ children
32
+ }]);
53
33
  }
54
- function getFills(name, slotInstance) {
55
- // Fills should only be returned for the current instance of the slot
56
- // in which they occupy.
57
- if (slots[name] !== slotInstance) {
58
- return [];
34
+ function unregisterFill(name, instance) {
35
+ const fillsForName = fills.get(name);
36
+ if (!fillsForName) {
37
+ return;
59
38
  }
60
- return fills[name];
39
+ fills.set(name, fillsForName.filter(fill => fill.instance !== instance));
61
40
  }
62
- function forceUpdateSlot(name) {
63
- const slot = getSlot(name);
64
- if (slot) {
65
- slot.rerender();
41
+ function updateFill(name, instance, children) {
42
+ const fillsForName = fills.get(name);
43
+ if (!fillsForName) {
44
+ return;
66
45
  }
67
- }
68
- function triggerListeners() {
69
- listeners.forEach(listener => listener());
70
- }
71
- function subscribe(listener) {
72
- listeners.push(listener);
73
- return () => {
74
- listeners = listeners.filter(l => l !== listener);
75
- };
46
+ const fillForInstance = fillsForName.find(f => f.instance === instance);
47
+ if (!fillForInstance) {
48
+ return;
49
+ }
50
+ if (fillForInstance.children === children) {
51
+ return;
52
+ }
53
+ fills.set(name, fillsForName.map(f => {
54
+ if (f.instance === instance) {
55
+ // Replace with new record with updated `children`.
56
+ return {
57
+ instance,
58
+ children
59
+ };
60
+ }
61
+ return f;
62
+ }));
76
63
  }
77
64
  return {
65
+ slots,
66
+ fills,
78
67
  registerSlot,
79
68
  unregisterSlot,
80
69
  registerFill,
81
70
  unregisterFill,
82
- getSlot,
83
- getFills,
84
- subscribe
71
+ updateFill
85
72
  };
86
73
  }
87
74
  export function SlotFillProvider({
@@ -1 +1 @@
1
- {"version":3,"names":["useState","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","listeners","registerSlot","name","slot","previousSlot","triggerListeners","forceUpdateSlot","rerender","registerFill","instance","unregisterSlot","unregisterFill","_fills$name$filter","filter","fill","getSlot","getFills","slotInstance","forEach","listener","subscribe","push","l","SlotFillProvider","children","contextValue","Provider","value"],"sources":["@wordpress/components/src/slot-fill/provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type {\n\tFillComponentProps,\n\tBaseSlotFillContext,\n\tSlotFillProviderProps,\n\tSlotKey,\n\tRerenderable,\n} from './types';\n\nfunction createSlotRegistry(): BaseSlotFillContext {\n\tconst slots: Record< SlotKey, Rerenderable > = {};\n\tconst fills: Record< SlotKey, FillComponentProps[] > = {};\n\tlet listeners: Array< () => void > = [];\n\n\tfunction registerSlot( name: SlotKey, slot: Rerenderable ) {\n\t\tconst previousSlot = slots[ name ];\n\t\tslots[ name ] = slot;\n\t\ttriggerListeners();\n\n\t\t// Sometimes the fills are registered after the initial render of slot\n\t\t// But before the registerSlot call, we need to rerender the slot.\n\t\tforceUpdateSlot( name );\n\n\t\t// If a new instance of a slot is being mounted while another with the\n\t\t// same name exists, force its update _after_ the new slot has been\n\t\t// assigned into the instance, such that its own rendering of children\n\t\t// will be empty (the new Slot will subsume all fills for this name).\n\t\tif ( previousSlot ) {\n\t\t\tpreviousSlot.rerender();\n\t\t}\n\t}\n\n\tfunction registerFill( name: SlotKey, instance: FillComponentProps ) {\n\t\tfills[ name ] = [ ...( fills[ name ] || [] ), instance ];\n\t\tforceUpdateSlot( name );\n\t}\n\n\tfunction unregisterSlot( name: SlotKey, instance: Rerenderable ) {\n\t\t// If a previous instance of a Slot by this name unmounts, do nothing,\n\t\t// as the slot and its fills should only be removed for the current\n\t\t// known instance.\n\t\tif ( slots[ name ] !== instance ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdelete slots[ name ];\n\t\ttriggerListeners();\n\t}\n\n\tfunction unregisterFill( name: SlotKey, instance: FillComponentProps ) {\n\t\tfills[ name ] =\n\t\t\tfills[ name ]?.filter( ( fill ) => fill !== instance ) ?? [];\n\t\tforceUpdateSlot( name );\n\t}\n\n\tfunction getSlot( name: SlotKey ): Rerenderable | undefined {\n\t\treturn slots[ name ];\n\t}\n\n\tfunction getFills(\n\t\tname: SlotKey,\n\t\tslotInstance: Rerenderable\n\t): FillComponentProps[] {\n\t\t// Fills should only be returned for the current instance of the slot\n\t\t// in which they occupy.\n\t\tif ( slots[ name ] !== slotInstance ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn fills[ name ];\n\t}\n\n\tfunction forceUpdateSlot( name: SlotKey ) {\n\t\tconst slot = getSlot( name );\n\n\t\tif ( slot ) {\n\t\t\tslot.rerender();\n\t\t}\n\t}\n\n\tfunction triggerListeners() {\n\t\tlisteners.forEach( ( listener ) => listener() );\n\t}\n\n\tfunction subscribe( listener: () => void ) {\n\t\tlisteners.push( listener );\n\n\t\treturn () => {\n\t\t\tlisteners = listeners.filter( ( l ) => l !== listener );\n\t\t};\n\t}\n\n\treturn {\n\t\tregisterSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t\tgetSlot,\n\t\tgetFills,\n\t\tsubscribe,\n\t};\n}\n\nexport function SlotFillProvider( { children }: SlotFillProviderProps ) {\n\tconst [ contextValue ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n\nexport default SlotFillProvider;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASxC,SAASC,kBAAkBA,CAAA,EAAwB;EAClD,MAAMC,KAAsC,GAAG,CAAC,CAAC;EACjD,MAAMC,KAA8C,GAAG,CAAC,CAAC;EACzD,IAAIC,SAA8B,GAAG,EAAE;EAEvC,SAASC,YAAYA,CAAEC,IAAa,EAAEC,IAAkB,EAAG;IAC1D,MAAMC,YAAY,GAAGN,KAAK,CAAEI,IAAI,CAAE;IAClCJ,KAAK,CAAEI,IAAI,CAAE,GAAGC,IAAI;IACpBE,gBAAgB,CAAC,CAAC;;IAElB;IACA;IACAC,eAAe,CAAEJ,IAAK,CAAC;;IAEvB;IACA;IACA;IACA;IACA,IAAKE,YAAY,EAAG;MACnBA,YAAY,CAACG,QAAQ,CAAC,CAAC;IACxB;EACD;EAEA,SAASC,YAAYA,CAAEN,IAAa,EAAEO,QAA4B,EAAG;IACpEV,KAAK,CAAEG,IAAI,CAAE,GAAG,CAAE,IAAKH,KAAK,CAAEG,IAAI,CAAE,IAAI,EAAE,CAAE,EAAEO,QAAQ,CAAE;IACxDH,eAAe,CAAEJ,IAAK,CAAC;EACxB;EAEA,SAASQ,cAAcA,CAAER,IAAa,EAAEO,QAAsB,EAAG;IAChE;IACA;I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IACdF,YAAY;IACZG,cAAc;IACdI,OAAO;IACPC,QAAQ;IACRI;EACD,CAAC;AACF;AAEA,OAAO,SAASG,gBAAgBA,CAAE;EAAEC;AAAgC,CAAC,EAAG;EACvE,MAAM,CAAEC,YAAY,CAAE,GAAGhC,QAAQ,CAAEI,kBAAmB,CAAC;EACvD,oBACCD,IAAA,CAACF,eAAe,CAACgC,QAAQ;IAACC,KAAK,EAAGF,YAAc;IAAAD,QAAA,EAC7CA;EAAQ,CACe,CAAC;AAE7B;AAEA,eAAeD,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["useState","SlotFillContext","observableMap","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","instance","set","unregisterSlot","get","delete","registerFill","children","unregisterFill","fillsForName","filter","fill","updateFill","fillForInstance","find","f","map","SlotFillProvider","contextValue","Provider","value"],"sources":["@wordpress/components/src/slot-fill/provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type {\n\tFillInstance,\n\tFillChildren,\n\tBaseSlotInstance,\n\tBaseSlotFillContext,\n\tSlotFillProviderProps,\n\tSlotKey,\n} from './types';\nimport { observableMap } from '@wordpress/compose';\n\nfunction createSlotRegistry(): BaseSlotFillContext {\n\tconst slots = observableMap< SlotKey, BaseSlotInstance >();\n\tconst fills = observableMap<\n\t\tSlotKey,\n\t\t{ instance: FillInstance; children: FillChildren }[]\n\t>();\n\n\tfunction registerSlot( name: SlotKey, instance: BaseSlotInstance ) {\n\t\tslots.set( name, instance );\n\t}\n\n\tfunction unregisterSlot( name: SlotKey, instance: BaseSlotInstance ) {\n\t\t// If a previous instance of a Slot by this name unmounts, do nothing,\n\t\t// as the slot and its fills should only be removed for the current\n\t\t// known instance.\n\t\tif ( slots.get( name ) !== instance ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslots.delete( name );\n\t}\n\n\tfunction registerFill(\n\t\tname: SlotKey,\n\t\tinstance: FillInstance,\n\t\tchildren: FillChildren\n\t) {\n\t\tfills.set( name, [\n\t\t\t...( fills.get( name ) || [] ),\n\t\t\t{ instance, children },\n\t\t] );\n\t}\n\n\tfunction unregisterFill( name: SlotKey, instance: FillInstance ) {\n\t\tconst fillsForName = fills.get( name );\n\t\tif ( ! fillsForName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfills.set(\n\t\t\tname,\n\t\t\tfillsForName.filter( ( fill ) => fill.instance !== instance )\n\t\t);\n\t}\n\n\tfunction updateFill(\n\t\tname: SlotKey,\n\t\tinstance: FillInstance,\n\t\tchildren: FillChildren\n\t) {\n\t\tconst fillsForName = fills.get( name );\n\t\tif ( ! fillsForName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst fillForInstance = fillsForName.find(\n\t\t\t( f ) => f.instance === instance\n\t\t);\n\t\tif ( ! fillForInstance ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( fillForInstance.children === children ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfills.set(\n\t\t\tname,\n\t\t\tfillsForName.map( ( f ) => {\n\t\t\t\tif ( f.instance === instance ) {\n\t\t\t\t\t// Replace with new record with updated `children`.\n\t\t\t\t\treturn { instance, children };\n\t\t\t\t}\n\n\t\t\t\treturn f;\n\t\t\t} )\n\t\t);\n\t}\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t\tupdateFill,\n\t};\n}\n\nexport function SlotFillProvider( { children }: SlotFillProviderProps ) {\n\tconst [ contextValue ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n\nexport default SlotFillProvider;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAS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AAe,GAAGJ,YAAY,CAACK,IAAI,CACtCC,CAAC,IAAMA,CAAC,CAACd,QAAQ,KAAKA,QACzB,CAAC;IACD,IAAK,CAAEY,eAAe,EAAG;MACxB;IACD;IAEA,IAAKA,eAAe,CAACN,QAAQ,KAAKA,QAAQ,EAAG;MAC5C;IACD;IAEAT,KAAK,CAACI,GAAG,CACRF,IAAI,EACJS,YAAY,CAACO,GAAG,CAAID,CAAC,IAAM;MAC1B,IAAKA,CAAC,CAACd,QAAQ,KAAKA,QAAQ,EAAG;QAC9B;QACA,OAAO;UAAEA,QAAQ;UAAEM;QAAS,CAAC;MAC9B;MAEA,OAAOQ,CAAC;IACT,CAAE,CACH,CAAC;EACF;EAEA,OAAO;IACNlB,KAAK;IACLC,KAAK;IACLC,YAAY;IACZI,cAAc;IACdG,YAAY;IACZE,cAAc;IACdI;EACD,CAAC;AACF;AAEA,OAAO,SAASK,gBAAgBA,CAAE;EAAEV;AAAgC,CAAC,EAAG;EACvE,MAAM,CAAEW,YAAY,CAAE,GAAG3B,QAAQ,CAAEK,kBAAmB,CAAC;EACvD,oBACCD,IAAA,CAACH,eAAe,CAAC2B,QAAQ;IAACC,KAAK,EAAGF,YAAc;IAAAX,QAAA,EAC7CA;EAAQ,CACe,CAAC;AAE7B;AAEA,eAAeU,gBAAgB","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -5,7 +6,8 @@
5
6
  /**
6
7
  * WordPress dependencies
7
8
  */
8
- import { useContext, useEffect, useReducer, useRef, Children, cloneElement, isEmptyElement } from '@wordpress/element';
9
+ import { useObservableValue } from '@wordpress/compose';
10
+ import { useContext, useLayoutEffect, useRef, Children, cloneElement, isEmptyElement } from '@wordpress/element';
9
11
 
10
12
  /**
11
13
  * Internal dependencies
@@ -21,44 +23,51 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
21
23
  function isFunction(maybeFunc) {
22
24
  return typeof maybeFunc === 'function';
23
25
  }
26
+ function addKeysToChildren(children) {
27
+ return Children.map(children, (child, childIndex) => {
28
+ if (!child || typeof child === 'string') {
29
+ return child;
30
+ }
31
+ let childKey = childIndex;
32
+ if (typeof child === 'object' && 'key' in child && child?.key) {
33
+ childKey = child.key;
34
+ }
35
+ return cloneElement(child, {
36
+ key: childKey
37
+ });
38
+ });
39
+ }
24
40
  function Slot(props) {
25
- var _registry$getFills;
41
+ var _useObservableValue;
26
42
  const registry = useContext(SlotFillContext);
27
- const [, rerender] = useReducer(() => [], []);
28
- const ref = useRef({
29
- rerender
30
- });
43
+ const instanceRef = useRef({});
31
44
  const {
32
45
  name,
33
46
  children,
34
47
  fillProps = {}
35
48
  } = props;
36
- useEffect(() => {
37
- const refValue = ref.current;
38
- registry.registerSlot(name, refValue);
39
- return () => registry.unregisterSlot(name, refValue);
49
+ useLayoutEffect(() => {
50
+ const instance = instanceRef.current;
51
+ registry.registerSlot(name, instance);
52
+ return () => registry.unregisterSlot(name, instance);
40
53
  }, [registry, name]);
41
- const fills = ((_registry$getFills = registry.getFills(name, ref.current)) !== null && _registry$getFills !== void 0 ? _registry$getFills : []).map(fill => {
54
+ let fills = (_useObservableValue = useObservableValue(registry.fills, name)) !== null && _useObservableValue !== void 0 ? _useObservableValue : [];
55
+ const currentSlot = useObservableValue(registry.slots, name);
56
+
57
+ // Fills should only be rendered in the currently registered instance of the slot.
58
+ if (currentSlot !== instanceRef.current) {
59
+ fills = [];
60
+ }
61
+ const renderedFills = fills.map(fill => {
42
62
  const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
43
- return Children.map(fillChildren, (child, childIndex) => {
44
- if (!child || typeof child === 'string') {
45
- return child;
46
- }
47
- let childKey = childIndex;
48
- if (typeof child === 'object' && 'key' in child && child?.key) {
49
- childKey = child.key;
50
- }
51
- return cloneElement(child, {
52
- key: childKey
53
- });
54
- });
63
+ return addKeysToChildren(fillChildren);
55
64
  }).filter(
56
65
  // In some cases fills are rendered only when some conditions apply.
57
66
  // This ensures that we only use non-empty fills when rendering, i.e.,
58
67
  // it allows us to render wrappers only when the fills are actually present.
59
68
  element => !isEmptyElement(element));
60
69
  return /*#__PURE__*/_jsx(_Fragment, {
61
- children: isFunction(children) ? children(fills) : fills
70
+ children: isFunction(children) ? children(renderedFills) : renderedFills
62
71
  });
63
72
  }
64
73
  export default Slot;
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useEffect","useReducer","useRef","Children","cloneElement","isEmptyElement","SlotFillContext","Fragment","_Fragment","jsx","_jsx","isFunction","maybeFunc","Slot","props","_registry$getFills","registry","rerender","ref","name","children","fillProps","refValue","current","registerSlot","unregisterSlot","fills","getFills","map","fill","fillChildren","child","childIndex","childKey","key","filter","element"],"sources":["@wordpress/components/src/slot-fill/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ReactNode, Key } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseReducer,\n\tuseRef,\n\tChildren,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type { SlotComponentProps } from './types';\n\n/**\n * Whether the argument is a function.\n *\n * @param maybeFunc The argument to check.\n * @return True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc: any ): maybeFunc is Function {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction Slot( props: Omit< SlotComponentProps, 'bubblesVirtually' > ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst [ , rerender ] = useReducer( () => [], [] );\n\tconst ref = useRef( { rerender } );\n\n\tconst { name, children, fillProps = {} } = props;\n\n\tuseEffect( () => {\n\t\tconst refValue = ref.current;\n\t\tregistry.registerSlot( name, refValue );\n\t\treturn () => registry.unregisterSlot( name, refValue );\n\t}, [ registry, name ] );\n\n\tconst fills: ReactNode[] = ( registry.getFills( name, ref.current ) ?? [] )\n\t\t.map( ( fill ) => {\n\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t? fill.children( fillProps )\n\t\t\t\t: fill.children;\n\t\t\treturn Children.map( fillChildren, ( child, childIndex ) => {\n\t\t\t\tif ( ! child || typeof child === 'string' ) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\t\t\t\tlet childKey: Key = childIndex;\n\t\t\t\tif (\n\t\t\t\t\ttypeof child === 'object' &&\n\t\t\t\t\t'key' in child &&\n\t\t\t\t\tchild?.key\n\t\t\t\t) {\n\t\t\t\t\tchildKey = child.key;\n\t\t\t\t}\n\n\t\t\t\treturn cloneElement( child as ReactElement, {\n\t\t\t\t\tkey: childKey,\n\t\t\t\t} );\n\t\t\t} );\n\t\t} )\n\t\t.filter(\n\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\t( element ) => ! isEmptyElement( element )\n\t\t);\n\n\treturn <>{ isFunction( children ) ? children( fills ) : fills }</>;\n}\n\nexport default Slot;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACZC,cAAc,QACR,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAGxC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CAAEC,SAAc,EAA0B;EAC5D,OAAO,OAAOA,SAAS,KAAK,UAAU;AACvC;AAEA,SAASC,IAAIA,CAAEC,KAAqD,EAAG;EAAA,IAAAC,kBAAA;EACtE,MAAMC,QAAQ,GAAGjB,UAAU,CAAEO,eAAgB,CAAC;EAC9C,MAAM,GAAIW,QAAQ,CAAE,GAAGhB,UAAU,CAAE,MAAM,EAAE,EAAE,EAAG,CAAC;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EACA;EACEC,OAAO,IAAM,CAAE/B,cAAc,CAAE+B,OAAQ,CAC1C,CAAC;EAEF,oBAAO1B,IAAA,CAAAF,SAAA;IAAAY,QAAA,EAAIT,UAAU,CAAES,QAAS,CAAC,GAAGA,QAAQ,CAAEM,KAAM,CAAC,GAAGA;EAAK,CAAI,CAAC;AACnE;AAEA,eAAeb,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["useObservableValue","useContext","useLayoutEffect","useRef","Children","cloneElement","isEmptyElement","SlotFillContext","Fragment","_Fragment","jsx","_jsx","isFunction","maybeFunc","addKeysToChildren","children","map","child","childIndex","childKey","key","Slot","props","_useObservableValue","registry","instanceRef","name","fillProps","instance","current","registerSlot","unregisterSlot","fills","currentSlot","slots","renderedFills","fill","fillChildren","filter","element"],"sources":["@wordpress/components/src/slot-fill/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ReactNode, Key } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useObservableValue } from '@wordpress/compose';\nimport {\n\tuseContext,\n\tuseLayoutEffect,\n\tuseRef,\n\tChildren,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type { SlotComponentProps } from './types';\n\n/**\n * Whether the argument is a function.\n *\n * @param maybeFunc The argument to check.\n * @return True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc: any ): maybeFunc is Function {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction addKeysToChildren( children: ReactNode ) {\n\treturn Children.map( children, ( child, childIndex ) => {\n\t\tif ( ! child || typeof child === 'string' ) {\n\t\t\treturn child;\n\t\t}\n\t\tlet childKey: Key = childIndex;\n\t\tif ( typeof child === 'object' && 'key' in child && child?.key ) {\n\t\t\tchildKey = child.key;\n\t\t}\n\n\t\treturn cloneElement( child as ReactElement, {\n\t\t\tkey: childKey,\n\t\t} );\n\t} );\n}\n\nfunction Slot( props: Omit< SlotComponentProps, 'bubblesVirtually' > ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst instanceRef = useRef( {} );\n\n\tconst { name, children, fillProps = {} } = props;\n\n\tuseLayoutEffect( () => {\n\t\tconst instance = instanceRef.current;\n\t\tregistry.registerSlot( name, instance );\n\t\treturn () => registry.unregisterSlot( name, instance );\n\t}, [ registry, name ] );\n\n\tlet fills = useObservableValue( registry.fills, name ) ?? [];\n\tconst currentSlot = useObservableValue( registry.slots, name );\n\n\t// Fills should only be rendered in the currently registered instance of the slot.\n\tif ( currentSlot !== instanceRef.current ) {\n\t\tfills = [];\n\t}\n\n\tconst renderedFills = fills\n\t\t.map( ( fill ) => {\n\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t? fill.children( fillProps )\n\t\t\t\t: fill.children;\n\t\t\treturn addKeysToChildren( fillChildren );\n\t\t} )\n\t\t.filter(\n\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\t( element ) => ! isEmptyElement( element )\n\t\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isFunction( children )\n\t\t\t\t? children( renderedFills )\n\t\t\t\t: renderedFills }\n\t\t</>\n\t);\n}\n\nexport default Slot;\n"],"mappings":";AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,kBAAkB,QAAQ,oBAAoB;AACvD,SACCC,UAAU,EACVC,eAAe,EACfC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACZC,cAAc,QACR,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAGxC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CAAEC,SAAc,EAA0B;EAC5D,OAAO,OAAOA,SAAS,KAAK,UAAU;AACvC;AAEA,SAASC,iBAAiBA,CAAEC,QAAmB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WAAW,KAAKR,WAAW,CAACI,OAAO,EAAG;IAC1CG,KAAK,GAAG,EAAE;EACX;EAEA,MAAMG,aAAa,GAAGH,KAAK,CACzBhB,GAAG,CAAIoB,IAAI,IAAM;IACjB,MAAMC,YAAY,GAAGzB,UAAU,CAAEwB,IAAI,CAACrB,QAAS,CAAC,GAC7CqB,IAAI,CAACrB,QAAQ,CAAEY,SAAU,CAAC,GAC1BS,IAAI,CAACrB,QAAQ;IAChB,OAAOD,iBAAiB,CAAEuB,YAAa,CAAC;EACzC,CAAE,CAAC,CACFC,MAAM;EACN;EACA;EACA;EACEC,OAAO,IAAM,CAAEjC,cAAc,CAAEiC,OAAQ,CAC1C,CAAC;EAEF,oBACC5B,IAAA,CAAAF,SAAA;IAAAM,QAAA,EACGH,UAAU,CAAEG,QAAS,CAAC,GACrBA,QAAQ,CAAEoB,aAAc,CAAC,GACzBA;EAAa,CACf,CAAC;AAEL;AAEA,eAAed,IAAI","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type { ObservableMap } from '@wordpress/compose';\n\nexport type DistributiveOmit< T, K extends keyof any > = T extends any\n\t? Omit< T, K >\n\t: never;\n\nexport type SlotKey = string | symbol;\n\nexport type FillProps = Record< string, any >;\n\ntype SlotPropBase = {\n\t/**\n\t * Slot name.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * props to pass from `Slot` to `Fill`.\n\t *\n\t * @default {}\n\t */\n\tfillProps?: FillProps;\n};\n\nexport type SlotComponentProps =\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually: true;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: never;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: string;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: React.CSSProperties;\n\t } )\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually?: false;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: ( fills: ReactNode ) => ReactNode;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: never;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: never;\n\t } );\n\nexport type FillComponentProps = {\n\t/**\n\t * The name of the slot to fill into.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * Children elements or render function.\n\t */\n\tchildren?: ReactNode | ( ( fillProps: FillProps ) => ReactNode );\n};\n\nexport type SlotFillProviderProps = {\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n\n\t/**\n\t * Whether to pass slots to the parent provider if existent.\n\t */\n\tpassthrough?: boolean;\n};\n\nexport type SlotRef = RefObject< HTMLElement >;\nexport type Rerenderable = { rerender: () => void };\nexport type FillInstance = {};\n\nexport type SlotFillBubblesVirtuallyContext = {\n\tslots: ObservableMap< SlotKey, { ref: SlotRef; fillProps: FillProps } >;\n\tfills: ObservableMap< SlotKey, FillInstance[] >;\n\tregisterSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tunregisterSlot: ( name: SlotKey, ref: SlotRef ) => void;\n\tupdateSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tregisterFill: ( name: SlotKey, instance: FillInstance ) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillInstance ) => void;\n\n\t/**\n\t * This helps the provider know if it's using the default context value or not.\n\t */\n\tisDefault?: boolean;\n};\n\nexport type BaseSlotFillContext = {\n\tregisterSlot: ( name: SlotKey, slot: Rerenderable ) => void;\n\tunregisterSlot: ( name: SlotKey, slot: Rerenderable ) => void;\n\tregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tgetSlot: ( name: SlotKey ) => Rerenderable | undefined;\n\tgetFills: (\n\t\tname: SlotKey,\n\t\tslotInstance: Rerenderable\n\t) => FillComponentProps[];\n\tsubscribe: ( listener: () => void ) => () => void;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type { ObservableMap } from '@wordpress/compose';\n\nexport type DistributiveOmit< T, K extends keyof any > = T extends any\n\t? Omit< T, K >\n\t: never;\n\nexport type SlotKey = string | symbol;\n\nexport type FillProps = Record< string, any >;\n\ntype SlotPropBase = {\n\t/**\n\t * Slot name.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * props to pass from `Slot` to `Fill`.\n\t *\n\t * @default {}\n\t */\n\tfillProps?: FillProps;\n};\n\nexport type SlotComponentProps =\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually: true;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: never;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: string;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: React.CSSProperties;\n\t } )\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually?: false;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: ( fills: ReactNode ) => ReactNode;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: never;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: never;\n\t } );\n\nexport type FillChildren =\n\t| ReactNode\n\t| ( ( fillProps: FillProps ) => ReactNode );\n\nexport type FillComponentProps = {\n\t/**\n\t * The name of the slot to fill into.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * Children elements or render function.\n\t */\n\tchildren?: FillChildren;\n};\n\nexport type SlotFillProviderProps = {\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n\n\t/**\n\t * Whether to pass slots to the parent provider if existent.\n\t */\n\tpassthrough?: boolean;\n};\n\nexport type SlotRef = RefObject< HTMLElement >;\nexport type FillInstance = {};\nexport type BaseSlotInstance = {};\n\nexport type SlotFillBubblesVirtuallyContext = {\n\tslots: ObservableMap< SlotKey, { ref: SlotRef; fillProps: FillProps } >;\n\tfills: ObservableMap< SlotKey, FillInstance[] >;\n\tregisterSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tunregisterSlot: ( name: SlotKey, ref: SlotRef ) => void;\n\tupdateSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tregisterFill: ( name: SlotKey, instance: FillInstance ) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillInstance ) => void;\n\n\t/**\n\t * This helps the provider know if it's using the default context value or not.\n\t */\n\tisDefault?: boolean;\n};\n\nexport type BaseSlotFillContext = {\n\tslots: ObservableMap< SlotKey, BaseSlotInstance >;\n\tfills: ObservableMap<\n\t\tSlotKey,\n\t\t{ instance: FillInstance; children: FillChildren }[]\n\t>;\n\tregisterSlot: ( name: SlotKey, slot: BaseSlotInstance ) => void;\n\tunregisterSlot: ( name: SlotKey, slot: BaseSlotInstance ) => void;\n\tregisterFill: (\n\t\tname: SlotKey,\n\t\tinstance: FillInstance,\n\t\tchildren: FillChildren\n\t) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillInstance ) => void;\n\tupdateFill: (\n\t\tname: SlotKey,\n\t\tinstance: FillInstance,\n\t\tchildren: FillChildren\n\t) => void;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","speak","useEffect","useLayoutEffect","useRef","forwardRef","renderToString","__","warning","Button","jsx","_jsx","jsxs","_jsxs","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","UnforwardedSnackbar","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","ref","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","callbacksRef","timeoutHandle","setTimeout","clearTimeout","classes","length","globalThis","SCRIPT_DEBUG","snackbarContentClassnames","undefined","tabIndex","role","onKeyPress","map","label","url","index","__next40pxDefaultSize","href","variant","Snackbar"],"sources":["@wordpress/components/src/snackbar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport {\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tforwardRef,\n\trenderToString,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport type { SnackbarProps } from './types';\nimport type { NoticeAction } from '../notice/types';\nimport type { WordPressComponentProps } from '../context';\n\nconst NOTICE_TIMEOUT = 10000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(\n\tmessage: SnackbarProps[ 'spokenMessage' ],\n\tpoliteness: NonNullable< SnackbarProps[ '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 UnforwardedSnackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss,\n\t\tlistRef,\n\t}: WordPressComponentProps< SnackbarProps, 'div' >,\n\tref: ForwardedRef< any >\n) {\n\tfunction dismissMe( event: KeyboardEvent | MouseEvent ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef?.current?.focus();\n\n\t\tonDismiss?.();\n\t\tonRemove?.();\n\t}\n\n\tfunction onActionClick(\n\t\tevent: MouseEvent< HTMLButtonElement >,\n\t\tonClick: NoticeAction[ 'onClick' ]\n\t) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove?.();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// The `onDismiss/onRemove` can have unstable references,\n\t// trigger side-effect cleanup, and reset timers.\n\tconst callbacksRef = useRef( { onDismiss, onRemove } );\n\tuseLayoutEffect( () => {\n\t\tcallbacksRef.current = { onDismiss, onRemove };\n\t} );\n\n\tuseEffect( () => {\n\t\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tcallbacksRef.current.onDismiss?.();\n\t\t\t\tcallbacksRef.current.onRemove?.();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ explicitDismiss ] );\n\n\tconst classes = clsx( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have one action. Use Notice if your message requires many actions.'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = clsx( 'components-snackbar__content', {\n\t\t'components-snackbar__content-with-icon': !! icon,\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : undefined }\n\t\t\ttabIndex={ 0 }\n\t\t\trole={ ! explicitDismiss ? 'button' : undefined }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : undefined }\n\t\t\taria-label={\n\t\t\t\t! explicitDismiss ? __( 'Dismiss this notice' ) : undefined\n\t\t\t}\n\t\t\tdata-testid=\"snackbar\"\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\tevent: MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t) => onActionClick( event, onClick ) }\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label={ __( 'Dismiss this notice' ) }\n\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t&#x2715;\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef( UnforwardedSnackbar );\n\nexport default Snackbar;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SACCC,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,UAAU,EACVC,cAAc,QACR,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAK/B,MAAMC,cAAc,GAAG,KAAK;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,gBAAgBA,CACxBC,OAAyC,EACzCC,UAAwD,EACvD;EACD,MAAMC,aAAa,GAClB,OAAOF,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGV,cAAc,CAAEU,OAAQ,CAAC;EAElEd,SAAS,CAAE,MAAM;IAChB,IAAKgB,aAAa,EAAG;MACpBjB,KAAK,CAAEiB,aAAa,EAAED,UAAW,CAAC;IACnC;EACD,CAAC,EAAE,CAAEC,aAAa,EAAED,UAAU,CAAG,CAAC;AACnC;AAEA,SAASE,mBAAmBA,CAC3B;EACCC,SAAS;EACTC,QAAQ;EACRH,aAAa,GAAGG,QAAQ;EACxBJ,UAAU,GAAG,QAAQ;EACrBK,OAAO,GAAG,EAAE;EACZC,QAAQ;EACRC,IAAI,GAAG,IAAI;EACXC,eAAe,GAAG,KAAK;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IAAI,EAAC,QAAQ;QACb,cAAazC,EAAE,CAAE,qBAAsB,CAAG;QAC1CwC,QAAQ,EAAG,CAAG;QACd3B,SAAS,EAAC,qCAAqC;QAC/Ce,OAAO,EAAGN,SAAW;QACrBoB,UAAU,EAAGpB,SAAW;QAAAR,QAAA,EACxB;MAED,CAAM,CACN;IAAA,CACG;EAAC,CACF,CAAC;AAER;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMoC,QAAQ,GAAGpD,UAAU,CAAEc,mBAAoB,CAAC;AAEzD,eAAesC,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["clsx","speak","useEffect","useLayoutEffect","useRef","forwardRef","renderToString","__","warning","Button","jsx","_jsx","jsxs","_jsxs","NOTICE_TIMEOUT","useSpokenMessage","message","politeness","spokenMessage","UnforwardedSnackbar","className","children","actions","onRemove","icon","explicitDismiss","onDismiss","listRef","ref","dismissMe","event","preventDefault","current","focus","onActionClick","onClick","stopPropagation","callbacksRef","timeoutHandle","setTimeout","clearTimeout","classes","length","globalThis","SCRIPT_DEBUG","snackbarContentClassnames","undefined","tabIndex","role","onKeyPress","map","label","url","index","__next40pxDefaultSize","href","variant","Snackbar"],"sources":["@wordpress/components/src/snackbar/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, KeyboardEvent, MouseEvent } from 'react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { speak } from '@wordpress/a11y';\nimport {\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tforwardRef,\n\trenderToString,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport type { SnackbarProps } from './types';\nimport type { NoticeAction } from '../notice/types';\nimport type { WordPressComponentProps } from '../context';\n\nconst NOTICE_TIMEOUT = 10000;\n\n/**\n * Custom hook which announces the message with the given politeness, if a\n * valid message is provided.\n *\n * @param message Message to announce.\n * @param politeness Politeness to announce.\n */\nfunction useSpokenMessage(\n\tmessage: SnackbarProps[ 'spokenMessage' ],\n\tpoliteness: NonNullable< SnackbarProps[ '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 UnforwardedSnackbar(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tspokenMessage = children,\n\t\tpoliteness = 'polite',\n\t\tactions = [],\n\t\tonRemove,\n\t\ticon = null,\n\t\texplicitDismiss = false,\n\t\t// onDismiss is a callback executed when the snackbar is dismissed.\n\t\t// It is distinct from onRemove, which _looks_ like a callback but is\n\t\t// actually the function to call to remove the snackbar from the UI.\n\t\tonDismiss,\n\t\tlistRef,\n\t}: WordPressComponentProps< SnackbarProps, 'div' >,\n\tref: ForwardedRef< any >\n) {\n\tfunction dismissMe( event: KeyboardEvent | MouseEvent ) {\n\t\tif ( event && event.preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\t// Prevent focus loss by moving it to the list element.\n\t\tlistRef?.current?.focus();\n\n\t\tonDismiss?.();\n\t\tonRemove?.();\n\t}\n\n\tfunction onActionClick(\n\t\tevent: MouseEvent< HTMLButtonElement >,\n\t\tonClick: NoticeAction[ 'onClick' ]\n\t) {\n\t\tevent.stopPropagation();\n\n\t\tonRemove?.();\n\n\t\tif ( onClick ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\tuseSpokenMessage( spokenMessage, politeness );\n\n\t// The `onDismiss/onRemove` can have unstable references,\n\t// trigger side-effect cleanup, and reset timers.\n\tconst callbacksRef = useRef( { onDismiss, onRemove } );\n\tuseLayoutEffect( () => {\n\t\tcallbacksRef.current = { onDismiss, onRemove };\n\t} );\n\n\tuseEffect( () => {\n\t\t// Only set up the timeout dismiss if we're not explicitly dismissing.\n\t\tconst timeoutHandle = setTimeout( () => {\n\t\t\tif ( ! explicitDismiss ) {\n\t\t\t\tcallbacksRef.current.onDismiss?.();\n\t\t\t\tcallbacksRef.current.onRemove?.();\n\t\t\t}\n\t\t}, NOTICE_TIMEOUT );\n\n\t\treturn () => clearTimeout( timeoutHandle );\n\t}, [ explicitDismiss ] );\n\n\tconst classes = clsx( className, 'components-snackbar', {\n\t\t'components-snackbar-explicit-dismiss': !! explicitDismiss,\n\t} );\n\tif ( actions && actions.length > 1 ) {\n\t\t// We need to inform developers that snackbar only accepts 1 action.\n\t\twarning(\n\t\t\t'Snackbar can only have one action. Use Notice if your message requires many actions.'\n\t\t);\n\t\t// return first element only while keeping it inside an array\n\t\tactions = [ actions[ 0 ] ];\n\t}\n\n\tconst snackbarContentClassnames = clsx( 'components-snackbar__content', {\n\t\t'components-snackbar__content-with-icon': !! icon,\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonClick={ ! explicitDismiss ? dismissMe : undefined }\n\t\t\ttabIndex={ 0 }\n\t\t\trole={ ! explicitDismiss ? 'button' : undefined }\n\t\t\tonKeyPress={ ! explicitDismiss ? dismissMe : undefined }\n\t\t\taria-label={\n\t\t\t\t! explicitDismiss ? __( 'Dismiss this notice' ) : undefined\n\t\t\t}\n\t\t\tdata-testid=\"snackbar\"\n\t\t>\n\t\t\t<div className={ snackbarContentClassnames }>\n\t\t\t\t{ icon && (\n\t\t\t\t\t<div className=\"components-snackbar__icon\">{ icon }</div>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ actions.map( ( { label, onClick, url }, index ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\thref={ url }\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ (\n\t\t\t\t\t\t\t\tevent: MouseEvent< HTMLButtonElement >\n\t\t\t\t\t\t\t) => onActionClick( event, onClick ) }\n\t\t\t\t\t\t\tclassName=\"components-snackbar__action\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t\t{ explicitDismiss && (\n\t\t\t\t\t<span\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\taria-label={ __( 'Dismiss this notice' ) }\n\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\tclassName=\"components-snackbar__dismiss-button\"\n\t\t\t\t\t\tonClick={ dismissMe }\n\t\t\t\t\t\tonKeyPress={ dismissMe }\n\t\t\t\t\t>\n\t\t\t\t\t\t&#x2715;\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\n/**\n * A Snackbar displays a succinct message that is cleared out after a small delay.\n *\n * It can also offer the user options, like viewing a published post.\n * But these options should also be available elsewhere in the UI.\n *\n * ```jsx\n * const MySnackbarNotice = () => (\n * <Snackbar>Post published successfully.</Snackbar>\n * );\n * ```\n */\nexport const Snackbar = forwardRef( UnforwardedSnackbar );\n\nexport default Snackbar;\n"],"mappings":";AAAA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,KAAK,QAAQ,iBAAiB;AACvC,SACCC,SAAS,EACTC,eAAe,EACfC,MAAM,EACNC,UAAU,EACVC,cAAc,QACR,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,OAAOC,OAAO,MAAM,oBAAoB;;AAExC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAK/B,MAAMC,cAAc,GAAG,KAAK;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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zCG,IAAI,iBACLb,IAAA;QAAKS,SAAS,EAAC,2BAA2B;QAAAC,QAAA,EAAGG;MAAI,CAAO,CACxD,EACCH,QAAQ,EACRC,OAAO,CAAC4B,GAAG,CAAE,CAAE;QAAEC,KAAK;QAAEhB,OAAO;QAAEiB;MAAI,CAAC,EAAEC,KAAK,KAAM;QACpD,oBACC1C,IAAA,CAACF,MAAM;UACN6C,qBAAqB;UAErBC,IAAI,EAAGH,GAAK;UACZI,OAAO,EAAC,MAAM;UACdrB,OAAO,EACNL,KAAsC,IAClCI,aAAa,CAAEJ,KAAK,EAAEK,OAAQ,CAAG;UACtCf,SAAS,EAAC,6BAA6B;UAAAC,QAAA,EAErC8B;QAAK,GARDE,KASC,CAAC;MAEX,CAAE,CAAC,EACD5B,eAAe,iBAChBd,IAAA;QACCqC,IAAI,EAAC,QAAQ;QACb,cAAazC,EAAE,CAAE,qBAAsB,CAAG;QAC1CwC,QAAQ,EAAG,CAAG;QACd3B,SAAS,EAAC,qCAAqC;QAC/Ce,OAAO,EAAGN,SAAW;QACrBoB,UAAU,EAAGpB,SAAW;QAAAR,QAAA,EACxB;MAED,CAAM,CACN;IAAA,CACG;EAAC,CACF,CAAC;AAER;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMoC,QAAQ,GAAGpD,UAAU,CAAEc,mBAAoB,CAAC;AAEzD,eAAesC,QAAQ","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useReducedMotion","useRef","Snackbar","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","jsx","_jsx","jsxs","_jsxs","SNACKBAR_VARIANTS","init","height","opacity","open","transition","type","duration","ease","delay","exit","SnackbarList","notices","className","children","onRemove","listRef","isReducedMotion","removeNotice","notice","id","tabIndex","ref","map","content","restNotice","div","layout","initial","animate","variants","undefined"],"sources":["@wordpress/components/src/snackbar/list.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Snackbar from '.';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\nimport type { SnackbarListProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nconst SNACKBAR_VARIANTS = {\n\tinit: {\n\t\theight: 0,\n\t\topacity: 0,\n\t},\n\topen: {\n\t\theight: 'auto',\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\theight: { type: 'tween', duration: 0.3, ease: [ 0, 0, 0.2, 1 ] },\n\t\t\topacity: {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: 0.25,\n\t\t\t\tdelay: 0.05,\n\t\t\t\tease: [ 0, 0, 0.2, 1 ],\n\t\t\t},\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\ttransition: {\n\t\t\ttype: 'tween',\n\t\t\tduration: 0.1,\n\t\t\tease: [ 0, 0, 0.2, 1 ],\n\t\t},\n\t},\n};\n\n/**\n * Renders a list of notices.\n *\n * ```jsx\n * const MySnackbarListNotice = () => (\n * <SnackbarList\n * notices={ notices }\n * onRemove={ removeNotice }\n * />\n * );\n * ```\n */\nexport function SnackbarList( {\n\tnotices,\n\tclassName,\n\tchildren,\n\tonRemove,\n}: WordPressComponentProps< SnackbarListProps, 'div' > ) {\n\tconst listRef = useRef< HTMLDivElement | null >( null );\n\tconst isReducedMotion = useReducedMotion();\n\tclassName = clsx( 'components-snackbar-list', className );\n\tconst removeNotice =\n\t\t( notice: SnackbarListProps[ 'notices' ][ number ] ) => () =>\n\t\t\tonRemove?.( notice.id );\n\treturn (\n\t\t<div\n\t\t\tclassName={ className }\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ listRef }\n\t\t\tdata-testid=\"snackbar-list\"\n\t\t>\n\t\t\t{ children }\n\t\t\t<AnimatePresence>\n\t\t\t\t{ notices.map( ( notice ) => {\n\t\t\t\t\tconst { content, ...restNotice } = notice;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ ! isReducedMotion } // See https://www.framer.com/docs/animation/#layout-animations\n\t\t\t\t\t\t\tinitial=\"init\"\n\t\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tkey={ notice.id }\n\t\t\t\t\t\t\tvariants={\n\t\t\t\t\t\t\t\tisReducedMotion ? undefined : SNACKBAR_VARIANTS\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"components-snackbar-list__notice-container\">\n\t\t\t\t\t\t\t\t<Snackbar\n\t\t\t\t\t\t\t\t\t{ ...restNotice }\n\t\t\t\t\t\t\t\t\tonRemove={ removeNotice( notice ) }\n\t\t\t\t\t\t\t\t\tlistRef={ listRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ notice.content }\n\t\t\t\t\t\t\t\t</Snackbar>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</AnimatePresence>\n\t\t</div>\n\t);\n}\n\nexport default SnackbarList;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,GAAG;AACxB,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAItB,MAAMC,iBAAiB,GAAG;E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AQ,eACVjB,IAAA,CAACF,eAAe;MAAAmB,QAAA,EACbF,OAAO,CAACW,GAAG,CAAIJ,MAAM,IAAM;QAC5B,MAAM;UAAEK,OAAO;UAAE,GAAGC;QAAW,CAAC,GAAGN,MAAM;QAEzC,oBACCtB,IAAA,CAACJ,MAAM,CAACiC,GAAG;UACVC,MAAM,EAAG,CAAEV,eAAiB,CAAC;UAAA;UAC7BW,OAAO,EAAC,MAAM;UACdC,OAAO,EAAC,MAAM;UACdnB,IAAI,EAAC,MAAM;UAEXoB,QAAQ,EACPb,eAAe,GAAGc,SAAS,GAAG/B,iBAC9B;UAAAc,QAAA,eAEDjB,IAAA;YAAKgB,SAAS,EAAC,4CAA4C;YAAAC,QAAA,eAC1DjB,IAAA,CAACN,QAAQ;cAAA,GACHkC,UAAU;cACfV,QAAQ,EAAGG,YAAY,CAAEC,MAAO,CAAG;cACnCH,OAAO,EAAGA,OAAS;cAAAF,QAAA,EAEjBK,MAAM,CAACK;YAAO,CACP;UAAC,CACP;QAAC,GAbAL,MAAM,CAACC,EAcF,CAAC;MAEf,CAAE;IAAC,CACa,CAAC;EAAA,CACd,CAAC;AAER;AAEA,eAAeT,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useReducedMotion","useRef","Snackbar","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","jsx","_jsx","jsxs","_jsxs","SNACKBAR_VARIANTS","init","height","opacity","open","transition","type","duration","ease","delay","exit","SnackbarList","notices","className","children","onRemove","listRef","isReducedMotion","removeNotice","notice","id","tabIndex","ref","map","content","restNotice","div","layout","initial","animate","variants","undefined"],"sources":["@wordpress/components/src/snackbar/list.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Snackbar from '.';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\nimport type { SnackbarListProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nconst SNACKBAR_VARIANTS = {\n\tinit: {\n\t\theight: 0,\n\t\topacity: 0,\n\t},\n\topen: {\n\t\theight: 'auto',\n\t\topacity: 1,\n\t\ttransition: {\n\t\t\theight: { type: 'tween', duration: 0.3, ease: [ 0, 0, 0.2, 1 ] },\n\t\t\topacity: {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: 0.25,\n\t\t\t\tdelay: 0.05,\n\t\t\t\tease: [ 0, 0, 0.2, 1 ],\n\t\t\t},\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\ttransition: {\n\t\t\ttype: 'tween',\n\t\t\tduration: 0.1,\n\t\t\tease: [ 0, 0, 0.2, 1 ],\n\t\t},\n\t},\n};\n\n/**\n * Renders a list of notices.\n *\n * ```jsx\n * const MySnackbarListNotice = () => (\n * <SnackbarList\n * notices={ notices }\n * onRemove={ removeNotice }\n * />\n * );\n * ```\n */\nexport function SnackbarList( {\n\tnotices,\n\tclassName,\n\tchildren,\n\tonRemove,\n}: WordPressComponentProps< SnackbarListProps, 'div' > ) {\n\tconst listRef = useRef< HTMLDivElement | null >( null );\n\tconst isReducedMotion = useReducedMotion();\n\tclassName = clsx( 'components-snackbar-list', className );\n\tconst removeNotice =\n\t\t( notice: SnackbarListProps[ 'notices' ][ number ] ) => () =>\n\t\t\tonRemove?.( notice.id );\n\treturn (\n\t\t<div\n\t\t\tclassName={ className }\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ listRef }\n\t\t\tdata-testid=\"snackbar-list\"\n\t\t>\n\t\t\t{ children }\n\t\t\t<AnimatePresence>\n\t\t\t\t{ notices.map( ( notice ) => {\n\t\t\t\t\tconst { content, ...restNotice } = notice;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ ! isReducedMotion } // See https://www.framer.com/docs/animation/#layout-animations\n\t\t\t\t\t\t\tinitial=\"init\"\n\t\t\t\t\t\t\tanimate=\"open\"\n\t\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t\t\tkey={ notice.id }\n\t\t\t\t\t\t\tvariants={\n\t\t\t\t\t\t\t\tisReducedMotion ? undefined : SNACKBAR_VARIANTS\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"components-snackbar-list__notice-container\">\n\t\t\t\t\t\t\t\t<Snackbar\n\t\t\t\t\t\t\t\t\t{ ...restNotice }\n\t\t\t\t\t\t\t\t\tonRemove={ removeNotice( notice ) }\n\t\t\t\t\t\t\t\t\tlistRef={ listRef }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ notice.content }\n\t\t\t\t\t\t\t\t</Snackbar>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</AnimatePresence>\n\t\t</div>\n\t);\n}\n\nexport default SnackbarList;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,GAAG;AACxB,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAItB,MAAMC,iBAAiB,GAAG;EACzBC,IAAI,EAAE;IACLC,MAAM,EAAE,CAAC;IACTC,OAAO,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACLF,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE,CAAC;IACVE,UAAU,EAAE;MACXH,MAAM,EAAE;QAAEI,IAAI,EAAE,OAAO;QAAEC,QAAQ,EAAE,GAAG;QAAEC,IAAI,EAA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AAA;UAC7BW,OAAO,EAAC,MAAM;UACdC,OAAO,EAAC,MAAM;UACdnB,IAAI,EAAC,MAAM;UAEXoB,QAAQ,EACPb,eAAe,GAAGc,SAAS,GAAG/B,iBAC9B;UAAAc,QAAA,eAEDjB,IAAA;YAAKgB,SAAS,EAAC,4CAA4C;YAAAC,QAAA,eAC1DjB,IAAA,CAACN,QAAQ;cAAA,GACHkC,UAAU;cACfV,QAAQ,EAAGG,YAAY,CAAEC,MAAO,CAAG;cACnCH,OAAO,EAAGA,OAAS;cAAAF,QAAA,EAEjBK,MAAM,CAACK;YAAO,CACP;UAAC,CACP;QAAC,GAbAL,MAAM,CAACC,EAcF,CAAC;MAEf,CAAE;IAAC,CACa,CAAC;EAAA,CACd,CAAC;AAER;AAEA,eAAeT,YAAY","ignoreList":[]}
@@ -1,8 +1,8 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * External dependencies
3
4
  */
4
5
  import * as Ariakit from '@ariakit/react';
5
- import { useStoreState } from '@ariakit/react';
6
6
  import clsx from 'clsx';
7
7
  /**
8
8
  * WordPress dependencies
@@ -101,7 +101,7 @@ const UnforwardedTabPanel = ({
101
101
  defaultSelectedId: prependInstanceId(initialTabName),
102
102
  rtl: isRTL()
103
103
  });
104
- const selectedTabName = extractTabName(useStoreState(tabStore, 'selectedId'));
104
+ const selectedTabName = extractTabName(Ariakit.useStoreState(tabStore, 'selectedId'));
105
105
  const setTabStoreSelectedId = useCallback(tabName => {
106
106
  tabStore.setState('selectedId', prependInstanceId(tabName));
107
107
  }, [prependInstanceId, tabStore]);
@@ -1 +1 @@
1
- {"version":3,"names":["Ariakit","useStoreState","clsx","forwardRef","useEffect","useLayoutEffect","useCallback","useInstanceId","usePrevious","isRTL","Button","jsx","_jsx","jsxs","_jsxs","extractTabName","id","match","UnforwardedTabPanel","className","children","tabs","selectOnMove","initialTabName","orientation","activeClass","onSelect","ref","instanceId","TabPanel","prependInstanceId","tabName","tabStore","useTabStore","setSelectedId","newTabValue","newTab","find","t","name","disabled","selectedTab","simplifiedTabName","defaultSelectedId","rtl","selectedTabName","setTabStoreSelectedId","setState","previousSelectedTabName","initialTab","tab","firstEnabledTab","TabList","store","map","Tab","render","__next40pxDefaultSize","icon","label","title","showTooltip","tabId"],"sources":["@wordpress/components/src/tab-panel/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport { useStoreState } from '@ariakit/react';\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { useInstanceId, usePrevious } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nimport Button from '../button';\nimport type { TabPanelProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\n// Separate the actual tab name from the instance ID. This is\n// necessary because Ariakit internally uses the element ID when\n// a new tab is selected, but our implementation looks specifically\n// for the tab name to be passed to the `onSelect` callback.\nconst extractTabName = ( id: string | undefined | null ) => {\n\tif ( typeof id === 'undefined' || id === null ) {\n\t\treturn;\n\t}\n\treturn id.match( /^tab-panel-[0-9]*-(.*)/ )?.[ 1 ];\n};\n\n/**\n * TabPanel is an ARIA-compliant tabpanel.\n *\n * TabPanels organize content across different screens, data sets, and interactions.\n * It has two sections: a list of tabs, and the view to show when tabs are chosen.\n *\n * ```jsx\n * import { TabPanel } from '@wordpress/components';\n *\n * const onSelect = ( tabName ) => {\n * console.log( 'Selecting tab', tabName );\n * };\n *\n * const MyTabPanel = () => (\n * <TabPanel\n * className=\"my-tab-panel\"\n * activeClass=\"active-tab\"\n * onSelect={ onSelect }\n * tabs={ [\n * {\n * name: 'tab1',\n * title: 'Tab 1',\n * className: 'tab-one',\n * },\n * {\n * name: 'tab2',\n * title: 'Tab 2',\n * className: 'tab-two',\n * },\n * ] }\n * >\n * { ( tab ) => <p>{ tab.title }</p> }\n * </TabPanel>\n * );\n * ```\n */\nconst UnforwardedTabPanel = (\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\ttabs,\n\t\tselectOnMove = true,\n\t\tinitialTabName,\n\t\torientation = 'horizontal',\n\t\tactiveClass = 'is-active',\n\t\tonSelect,\n\t}: WordPressComponentProps< TabPanelProps, 'div', false >,\n\tref: ForwardedRef< any >\n) => {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\n\tconst prependInstanceId = useCallback(\n\t\t( tabName: string | undefined ) => {\n\t\t\tif ( typeof tabName === 'undefined' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn `${ instanceId }-${ tabName }`;\n\t\t},\n\t\t[ instanceId ]\n\t);\n\n\tconst tabStore = Ariakit.useTabStore( {\n\t\tsetSelectedId: ( newTabValue ) => {\n\t\t\tif ( typeof newTabValue === 'undefined' || newTabValue === null ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newTab = tabs.find(\n\t\t\t\t( t ) => prependInstanceId( t.name ) === newTabValue\n\t\t\t);\n\t\t\tif ( newTab?.disabled || newTab === selectedTab ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst simplifiedTabName = extractTabName( newTabValue );\n\t\t\tif ( typeof simplifiedTabName === 'undefined' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonSelect?.( simplifiedTabName );\n\t\t},\n\t\torientation,\n\t\tselectOnMove,\n\t\tdefaultSelectedId: prependInstanceId( initialTabName ),\n\t\trtl: isRTL(),\n\t} );\n\n\tconst selectedTabName = extractTabName(\n\t\tuseStoreState( tabStore, 'selectedId' )\n\t);\n\n\tconst setTabStoreSelectedId = useCallback(\n\t\t( tabName: string ) => {\n\t\t\ttabStore.setState( 'selectedId', prependInstanceId( tabName ) );\n\t\t},\n\t\t[ prependInstanceId, tabStore ]\n\t);\n\n\tconst selectedTab = tabs.find( ( { name } ) => name === selectedTabName );\n\n\tconst previousSelectedTabName = usePrevious( selectedTabName );\n\n\t// Ensure `onSelect` is called when the initial tab is selected.\n\tuseEffect( () => {\n\t\tif (\n\t\t\tpreviousSelectedTabName !== selectedTabName &&\n\t\t\tselectedTabName === initialTabName &&\n\t\t\t!! selectedTabName\n\t\t) {\n\t\t\tonSelect?.( selectedTabName );\n\t\t}\n\t}, [ selectedTabName, initialTabName, onSelect, previousSelectedTabName ] );\n\n\t// Handle selecting the initial tab.\n\tuseLayoutEffect( () => {\n\t\t// If there's a selected tab, don't override it.\n\t\tif ( selectedTab ) {\n\t\t\treturn;\n\t\t}\n\t\tconst initialTab = tabs.find( ( tab ) => tab.name === initialTabName );\n\t\t// Wait for the denoted initial tab to be declared before making a\n\t\t// selection. This ensures that if a tab is declared lazily it can\n\t\t// still receive initial selection.\n\t\tif ( initialTabName && ! initialTab ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( initialTab && ! initialTab.disabled ) {\n\t\t\t// Select the initial tab if it's not disabled.\n\t\t\tsetTabStoreSelectedId( initialTab.name );\n\t\t} else {\n\t\t\t// Fallback to the first enabled tab when the initial tab is\n\t\t\t// disabled or it can't be found.\n\t\t\tconst firstEnabledTab = tabs.find( ( tab ) => ! tab.disabled );\n\t\t\tif ( firstEnabledTab ) {\n\t\t\t\tsetTabStoreSelectedId( firstEnabledTab.name );\n\t\t\t}\n\t\t}\n\t}, [\n\t\ttabs,\n\t\tselectedTab,\n\t\tinitialTabName,\n\t\tinstanceId,\n\t\tsetTabStoreSelectedId,\n\t] );\n\n\t// Handle the currently selected tab becoming disabled.\n\tuseEffect( () => {\n\t\t// This effect only runs when the selected tab is defined and becomes disabled.\n\t\tif ( ! selectedTab?.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tconst firstEnabledTab = tabs.find( ( tab ) => ! tab.disabled );\n\t\t// If the currently selected tab becomes disabled, select the first enabled tab.\n\t\t// (if there is one).\n\t\tif ( firstEnabledTab ) {\n\t\t\tsetTabStoreSelectedId( firstEnabledTab.name );\n\t\t}\n\t}, [ tabs, selectedTab?.disabled, setTabStoreSelectedId, instanceId ] );\n\treturn (\n\t\t<div className={ className } ref={ ref }>\n\t\t\t<Ariakit.TabList\n\t\t\t\tstore={ tabStore }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Ariakit.Tab\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\tid={ prependInstanceId( tab.name ) }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t[ activeClass ]:\n\t\t\t\t\t\t\t\t\t\ttab.name === selectedTabName,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tdisabled={ tab.disabled }\n\t\t\t\t\t\t\taria-controls={ `${ prependInstanceId(\n\t\t\t\t\t\t\t\ttab.name\n\t\t\t\t\t\t\t) }-view` }\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\ticon={ tab.icon }\n\t\t\t\t\t\t\t\t\tlabel={ tab.icon && tab.title }\n\t\t\t\t\t\t\t\t\tshowTooltip={ !! tab.icon }\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\t\t{ ! tab.icon && tab.title }\n\t\t\t\t\t\t</Ariakit.Tab>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Ariakit.TabList>\n\t\t\t{ selectedTab && (\n\t\t\t\t<Ariakit.TabPanel\n\t\t\t\t\tid={ `${ prependInstanceId( selectedTab.name ) }-view` }\n\t\t\t\t\tstore={ tabStore }\n\t\t\t\t\ttabId={ prependInstanceId( selectedTab.name ) }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</Ariakit.TabPanel>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport const TabPanel = forwardRef( UnforwardedTabPanel );\nexport default TabPanel;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,OAAOC,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SACCC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,WAAW,QACL,oBAAoB;AAC3B,SAASC,aAAa,EAAEC,WAAW,QAAQ,oBAAoB;AAC/D,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;;AAEA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAI/B;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAKC,EAA6B,IAAM;EAC3D,IAAK,OAAOA,EAAE,KAAK,WAAW,IAAIA,EAAE,KAAK,IAAI,EAAG;IAC/C;EACD;EACA,OAAOA,EAAE,CAACC,KAAK,CAAE,wBAAyB,CAAC,GAAI,CAAC,CAAE;AACnD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAGA,CAC3B;EACCC,SAAS;EACTC,QAAQ;EACRC,IAAI;EACJC,YAAY,GAAG,IAAI;EACnBC,cAAc;EACdC,WAAW,GAAG,YAAY;EAC1BC,WAAW,GAAG,WAAW;EACzBC;AACuD,CAAC,EACzDC,GAAwB,KACpB;EACJ,MAAMC,UAAU,GAAGrB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AE,EAAG,GAAIc,iBAAiB,CAAEW,WAAW,CAACF,IAAK,CAAC,OAAU;MACxDc,KAAK,EAAGrB,QAAU;MAClB8B,KAAK,EAAGhC,iBAAiB,CAAEW,WAAW,CAACF,IAAK,CAAG;MAC/CpB,SAAS,EAAC,mCAAmC;MAAAC,QAAA,EAE3CA,QAAQ,CAAEqB,WAAY;IAAC,CACR,CAClB;EAAA,CACG,CAAC;AAER,CAAC;AAED,OAAO,MAAMZ,QAAQ,GAAG1B,UAAU,CAAEe,mBAAoB,CAAC;AACzD,eAAeW,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["Ariakit","clsx","forwardRef","useEffect","useLayoutEffect","useCallback","useInstanceId","usePrevious","isRTL","Button","jsx","_jsx","jsxs","_jsxs","extractTabName","id","match","UnforwardedTabPanel","className","children","tabs","selectOnMove","initialTabName","orientation","activeClass","onSelect","ref","instanceId","TabPanel","prependInstanceId","tabName","tabStore","useTabStore","setSelectedId","newTabValue","newTab","find","t","name","disabled","selectedTab","simplifiedTabName","defaultSelectedId","rtl","selectedTabName","useStoreState","setTabStoreSelectedId","setState","previousSelectedTabName","initialTab","tab","firstEnabledTab","TabList","store","map","Tab","render","__next40pxDefaultSize","icon","label","title","showTooltip","tabId"],"sources":["@wordpress/components/src/tab-panel/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tforwardRef,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { useInstanceId, usePrevious } from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nimport Button from '../button';\nimport type { TabPanelProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\n// Separate the actual tab name from the instance ID. This is\n// necessary because Ariakit internally uses the element ID when\n// a new tab is selected, but our implementation looks specifically\n// for the tab name to be passed to the `onSelect` callback.\nconst extractTabName = ( id: string | undefined | null ) => {\n\tif ( typeof id === 'undefined' || id === null ) {\n\t\treturn;\n\t}\n\treturn id.match( /^tab-panel-[0-9]*-(.*)/ )?.[ 1 ];\n};\n\n/**\n * TabPanel is an ARIA-compliant tabpanel.\n *\n * TabPanels organize content across different screens, data sets, and interactions.\n * It has two sections: a list of tabs, and the view to show when tabs are chosen.\n *\n * ```jsx\n * import { TabPanel } from '@wordpress/components';\n *\n * const onSelect = ( tabName ) => {\n * console.log( 'Selecting tab', tabName );\n * };\n *\n * const MyTabPanel = () => (\n * <TabPanel\n * className=\"my-tab-panel\"\n * activeClass=\"active-tab\"\n * onSelect={ onSelect }\n * tabs={ [\n * {\n * name: 'tab1',\n * title: 'Tab 1',\n * className: 'tab-one',\n * },\n * {\n * name: 'tab2',\n * title: 'Tab 2',\n * className: 'tab-two',\n * },\n * ] }\n * >\n * { ( tab ) => <p>{ tab.title }</p> }\n * </TabPanel>\n * );\n * ```\n */\nconst UnforwardedTabPanel = (\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\ttabs,\n\t\tselectOnMove = true,\n\t\tinitialTabName,\n\t\torientation = 'horizontal',\n\t\tactiveClass = 'is-active',\n\t\tonSelect,\n\t}: WordPressComponentProps< TabPanelProps, 'div', false >,\n\tref: ForwardedRef< any >\n) => {\n\tconst instanceId = useInstanceId( TabPanel, 'tab-panel' );\n\n\tconst prependInstanceId = useCallback(\n\t\t( tabName: string | undefined ) => {\n\t\t\tif ( typeof tabName === 'undefined' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn `${ instanceId }-${ tabName }`;\n\t\t},\n\t\t[ instanceId ]\n\t);\n\n\tconst tabStore = Ariakit.useTabStore( {\n\t\tsetSelectedId: ( newTabValue ) => {\n\t\t\tif ( typeof newTabValue === 'undefined' || newTabValue === null ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst newTab = tabs.find(\n\t\t\t\t( t ) => prependInstanceId( t.name ) === newTabValue\n\t\t\t);\n\t\t\tif ( newTab?.disabled || newTab === selectedTab ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst simplifiedTabName = extractTabName( newTabValue );\n\t\t\tif ( typeof simplifiedTabName === 'undefined' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonSelect?.( simplifiedTabName );\n\t\t},\n\t\torientation,\n\t\tselectOnMove,\n\t\tdefaultSelectedId: prependInstanceId( initialTabName ),\n\t\trtl: isRTL(),\n\t} );\n\n\tconst selectedTabName = extractTabName(\n\t\tAriakit.useStoreState( tabStore, 'selectedId' )\n\t);\n\n\tconst setTabStoreSelectedId = useCallback(\n\t\t( tabName: string ) => {\n\t\t\ttabStore.setState( 'selectedId', prependInstanceId( tabName ) );\n\t\t},\n\t\t[ prependInstanceId, tabStore ]\n\t);\n\n\tconst selectedTab = tabs.find( ( { name } ) => name === selectedTabName );\n\n\tconst previousSelectedTabName = usePrevious( selectedTabName );\n\n\t// Ensure `onSelect` is called when the initial tab is selected.\n\tuseEffect( () => {\n\t\tif (\n\t\t\tpreviousSelectedTabName !== selectedTabName &&\n\t\t\tselectedTabName === initialTabName &&\n\t\t\t!! selectedTabName\n\t\t) {\n\t\t\tonSelect?.( selectedTabName );\n\t\t}\n\t}, [ selectedTabName, initialTabName, onSelect, previousSelectedTabName ] );\n\n\t// Handle selecting the initial tab.\n\tuseLayoutEffect( () => {\n\t\t// If there's a selected tab, don't override it.\n\t\tif ( selectedTab ) {\n\t\t\treturn;\n\t\t}\n\t\tconst initialTab = tabs.find( ( tab ) => tab.name === initialTabName );\n\t\t// Wait for the denoted initial tab to be declared before making a\n\t\t// selection. This ensures that if a tab is declared lazily it can\n\t\t// still receive initial selection.\n\t\tif ( initialTabName && ! initialTab ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( initialTab && ! initialTab.disabled ) {\n\t\t\t// Select the initial tab if it's not disabled.\n\t\t\tsetTabStoreSelectedId( initialTab.name );\n\t\t} else {\n\t\t\t// Fallback to the first enabled tab when the initial tab is\n\t\t\t// disabled or it can't be found.\n\t\t\tconst firstEnabledTab = tabs.find( ( tab ) => ! tab.disabled );\n\t\t\tif ( firstEnabledTab ) {\n\t\t\t\tsetTabStoreSelectedId( firstEnabledTab.name );\n\t\t\t}\n\t\t}\n\t}, [\n\t\ttabs,\n\t\tselectedTab,\n\t\tinitialTabName,\n\t\tinstanceId,\n\t\tsetTabStoreSelectedId,\n\t] );\n\n\t// Handle the currently selected tab becoming disabled.\n\tuseEffect( () => {\n\t\t// This effect only runs when the selected tab is defined and becomes disabled.\n\t\tif ( ! selectedTab?.disabled ) {\n\t\t\treturn;\n\t\t}\n\t\tconst firstEnabledTab = tabs.find( ( tab ) => ! tab.disabled );\n\t\t// If the currently selected tab becomes disabled, select the first enabled tab.\n\t\t// (if there is one).\n\t\tif ( firstEnabledTab ) {\n\t\t\tsetTabStoreSelectedId( firstEnabledTab.name );\n\t\t}\n\t}, [ tabs, selectedTab?.disabled, setTabStoreSelectedId, instanceId ] );\n\treturn (\n\t\t<div className={ className } ref={ ref }>\n\t\t\t<Ariakit.TabList\n\t\t\t\tstore={ tabStore }\n\t\t\t\tclassName=\"components-tab-panel__tabs\"\n\t\t\t>\n\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Ariakit.Tab\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\tid={ prependInstanceId( tab.name ) }\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'components-tab-panel__tabs-item',\n\t\t\t\t\t\t\t\ttab.className,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t[ activeClass ]:\n\t\t\t\t\t\t\t\t\t\ttab.name === selectedTabName,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tdisabled={ tab.disabled }\n\t\t\t\t\t\t\taria-controls={ `${ prependInstanceId(\n\t\t\t\t\t\t\t\ttab.name\n\t\t\t\t\t\t\t) }-view` }\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\ticon={ tab.icon }\n\t\t\t\t\t\t\t\t\tlabel={ tab.icon && tab.title }\n\t\t\t\t\t\t\t\t\tshowTooltip={ !! tab.icon }\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\t\t{ ! tab.icon && tab.title }\n\t\t\t\t\t\t</Ariakit.Tab>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</Ariakit.TabList>\n\t\t\t{ selectedTab && (\n\t\t\t\t<Ariakit.TabPanel\n\t\t\t\t\tid={ `${ prependInstanceId( selectedTab.name ) }-view` }\n\t\t\t\t\tstore={ tabStore }\n\t\t\t\t\ttabId={ prependInstanceId( selectedTab.name ) }\n\t\t\t\t\tclassName=\"components-tab-panel__tab-content\"\n\t\t\t\t>\n\t\t\t\t\t{ children( selectedTab ) }\n\t\t\t\t</Ariakit.TabPanel>\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport const TabPanel = forwardRef( UnforwardedTabPanel );\nexport default TabPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAOC,IAAI,MAAM,MAAM;AAGvB;AACA;AACA;AACA,SACCC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,WAAW,QACL,oBAAoB;AAC3B,SAASC,aAAa,EAAEC,WAAW,QAAQ,oBAAoB;AAC/D,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;;AAEA,OAAOC,MAAM,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAI/B;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAKC,EAA6B,IAAM;EAC3D,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