@wordpress/components 28.12.0 → 28.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (442) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/CONTRIBUTING.md +16 -16
  3. package/build/autocomplete/autocompleter-ui.js +1 -0
  4. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  5. package/build/border-box-control/border-box-control/component.js +1 -0
  6. package/build/border-box-control/border-box-control/component.js.map +1 -1
  7. package/build/border-box-control/border-box-control-split-controls/component.js +2 -1
  8. package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  9. package/build/border-control/border-control/component.js +2 -1
  10. package/build/border-control/border-control/component.js.map +1 -1
  11. package/build/border-control/border-control/hook.js +3 -1
  12. package/build/border-control/border-control/hook.js.map +1 -1
  13. package/build/border-control/types.js.map +1 -1
  14. package/build/box-control/all-input-control.js +1 -0
  15. package/build/box-control/all-input-control.js.map +1 -1
  16. package/build/box-control/axial-input-controls.js +1 -0
  17. package/build/box-control/axial-input-controls.js.map +1 -1
  18. package/build/box-control/index.js +13 -13
  19. package/build/box-control/index.js.map +1 -1
  20. package/build/box-control/input-controls.js +1 -0
  21. package/build/box-control/input-controls.js.map +1 -1
  22. package/build/box-control/types.js.map +1 -1
  23. package/build/circular-option-picker/circular-option-picker-actions.js +1 -0
  24. package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  25. package/build/circular-option-picker/circular-option-picker-option.js +1 -0
  26. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  27. package/build/color-palette/index.js +2 -0
  28. package/build/color-palette/index.js.map +1 -1
  29. package/build/color-picker/color-copy-button.js +6 -4
  30. package/build/color-picker/color-copy-button.js.map +1 -1
  31. package/build/color-picker/component.js +1 -0
  32. package/build/color-picker/component.js.map +1 -1
  33. package/build/color-picker/styles.js +21 -28
  34. package/build/color-picker/styles.js.map +1 -1
  35. package/build/combobox-control/index.js +17 -12
  36. package/build/combobox-control/index.js.map +1 -1
  37. package/build/composite/hover.js +1 -1
  38. package/build/composite/hover.js.map +1 -1
  39. package/build/composite/typeahead.js +1 -1
  40. package/build/composite/typeahead.js.map +1 -1
  41. package/build/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  42. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  43. package/build/dashicon/types.js.map +1 -1
  44. package/build/dimension-control/index.js +7 -0
  45. package/build/dimension-control/index.js.map +1 -1
  46. package/build/disabled/index.js +8 -1
  47. package/build/disabled/index.js.map +1 -1
  48. package/build/duotone-picker/duotone-picker.js +2 -0
  49. package/build/duotone-picker/duotone-picker.js.map +1 -1
  50. package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
  51. package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  52. package/build/font-size-picker/index.js +7 -0
  53. package/build/font-size-picker/index.js.map +1 -1
  54. package/build/form-file-upload/index.js +3 -1
  55. package/build/form-file-upload/index.js.map +1 -1
  56. package/build/gradient-picker/index.js +34 -32
  57. package/build/gradient-picker/index.js.map +1 -1
  58. package/build/gradient-picker/types.js.map +1 -1
  59. package/build/icon/index.js +9 -0
  60. package/build/icon/index.js.map +1 -1
  61. package/build/menu/styles.js +16 -16
  62. package/build/menu/styles.js.map +1 -1
  63. package/build/modal/index.js +2 -2
  64. package/build/modal/index.js.map +1 -1
  65. package/build/private-apis.js +0 -2
  66. package/build/private-apis.js.map +1 -1
  67. package/build/range-control/index.js +11 -0
  68. package/build/range-control/index.js.map +1 -1
  69. package/build/range-control/types.js.map +1 -1
  70. package/build/slot-fill/bubbles-virtually/fill.js +14 -31
  71. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  72. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
  73. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  74. package/build/slot-fill/bubbles-virtually/slot.js +11 -9
  75. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  76. package/build/slot-fill/bubbles-virtually/use-slot.js +1 -8
  77. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  78. package/build/slot-fill/fill.js +7 -24
  79. package/build/slot-fill/fill.js.map +1 -1
  80. package/build/slot-fill/index.js +5 -10
  81. package/build/slot-fill/index.js.map +1 -1
  82. package/build/slot-fill/provider.js +2 -2
  83. package/build/slot-fill/provider.js.map +1 -1
  84. package/build/slot-fill/slot.js +37 -77
  85. package/build/slot-fill/slot.js.map +1 -1
  86. package/build/slot-fill/types.js.map +1 -1
  87. package/build/text-control/index.js +7 -0
  88. package/build/text-control/index.js.map +1 -1
  89. package/build/toggle-group-control/toggle-group-control/component.js +9 -0
  90. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  91. package/build/toggle-group-control/toggle-group-control-option/component.js +1 -0
  92. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  93. package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  94. package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  95. package/build/toggle-group-control/types.js.map +1 -1
  96. package/build/utils/deprecated-36px-size.js +3 -2
  97. package/build/utils/deprecated-36px-size.js.map +1 -1
  98. package/build-module/autocomplete/autocompleter-ui.js +1 -0
  99. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  100. package/build-module/border-box-control/border-box-control/component.js +1 -0
  101. package/build-module/border-box-control/border-box-control/component.js.map +1 -1
  102. package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -1
  103. package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
  104. package/build-module/border-control/border-control/component.js +2 -1
  105. package/build-module/border-control/border-control/component.js.map +1 -1
  106. package/build-module/border-control/border-control/hook.js +3 -1
  107. package/build-module/border-control/border-control/hook.js.map +1 -1
  108. package/build-module/border-control/types.js.map +1 -1
  109. package/build-module/box-control/all-input-control.js +1 -0
  110. package/build-module/box-control/all-input-control.js.map +1 -1
  111. package/build-module/box-control/axial-input-controls.js +1 -0
  112. package/build-module/box-control/axial-input-controls.js.map +1 -1
  113. package/build-module/box-control/index.js +13 -13
  114. package/build-module/box-control/index.js.map +1 -1
  115. package/build-module/box-control/input-controls.js +1 -0
  116. package/build-module/box-control/input-controls.js.map +1 -1
  117. package/build-module/box-control/types.js.map +1 -1
  118. package/build-module/circular-option-picker/circular-option-picker-actions.js +1 -0
  119. package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
  120. package/build-module/circular-option-picker/circular-option-picker-option.js +1 -0
  121. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  122. package/build-module/color-palette/index.js +2 -0
  123. package/build-module/color-palette/index.js.map +1 -1
  124. package/build-module/color-picker/color-copy-button.js +6 -4
  125. package/build-module/color-picker/color-copy-button.js.map +1 -1
  126. package/build-module/color-picker/component.js +1 -0
  127. package/build-module/color-picker/component.js.map +1 -1
  128. package/build-module/color-picker/styles.js +20 -27
  129. package/build-module/color-picker/styles.js.map +1 -1
  130. package/build-module/combobox-control/index.js +18 -13
  131. package/build-module/combobox-control/index.js.map +1 -1
  132. package/build-module/composite/hover.js +1 -1
  133. package/build-module/composite/hover.js.map +1 -1
  134. package/build-module/composite/typeahead.js +1 -1
  135. package/build-module/composite/typeahead.js.map +1 -1
  136. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +2 -0
  137. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  138. package/build-module/dashicon/types.js.map +1 -1
  139. package/build-module/dimension-control/index.js +7 -0
  140. package/build-module/dimension-control/index.js.map +1 -1
  141. package/build-module/disabled/index.js +8 -1
  142. package/build-module/disabled/index.js.map +1 -1
  143. package/build-module/duotone-picker/duotone-picker.js +2 -0
  144. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  145. package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
  146. package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
  147. package/build-module/font-size-picker/index.js +7 -0
  148. package/build-module/font-size-picker/index.js.map +1 -1
  149. package/build-module/form-file-upload/index.js +3 -1
  150. package/build-module/form-file-upload/index.js.map +1 -1
  151. package/build-module/gradient-picker/index.js +34 -32
  152. package/build-module/gradient-picker/index.js.map +1 -1
  153. package/build-module/gradient-picker/types.js.map +1 -1
  154. package/build-module/icon/index.js +9 -0
  155. package/build-module/icon/index.js.map +1 -1
  156. package/build-module/menu/styles.js +16 -16
  157. package/build-module/menu/styles.js.map +1 -1
  158. package/build-module/modal/index.js +2 -2
  159. package/build-module/modal/index.js.map +1 -1
  160. package/build-module/private-apis.js +0 -2
  161. package/build-module/private-apis.js.map +1 -1
  162. package/build-module/range-control/index.js +11 -0
  163. package/build-module/range-control/index.js.map +1 -1
  164. package/build-module/range-control/types.js.map +1 -1
  165. package/build-module/slot-fill/bubbles-virtually/fill.js +15 -32
  166. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  167. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
  168. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  169. package/build-module/slot-fill/bubbles-virtually/slot.js +11 -9
  170. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  171. package/build-module/slot-fill/bubbles-virtually/use-slot.js +2 -9
  172. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  173. package/build-module/slot-fill/fill.js +7 -24
  174. package/build-module/slot-fill/fill.js.map +1 -1
  175. package/build-module/slot-fill/index.js +5 -8
  176. package/build-module/slot-fill/index.js.map +1 -1
  177. package/build-module/slot-fill/provider.js +2 -3
  178. package/build-module/slot-fill/provider.js.map +1 -1
  179. package/build-module/slot-fill/slot.js +38 -78
  180. package/build-module/slot-fill/slot.js.map +1 -1
  181. package/build-module/slot-fill/types.js.map +1 -1
  182. package/build-module/text-control/index.js +7 -0
  183. package/build-module/text-control/index.js.map +1 -1
  184. package/build-module/toggle-group-control/toggle-group-control/component.js +9 -0
  185. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  186. package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -0
  187. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  188. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
  189. package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
  190. package/build-module/toggle-group-control/types.js.map +1 -1
  191. package/build-module/utils/deprecated-36px-size.js +3 -2
  192. package/build-module/utils/deprecated-36px-size.js.map +1 -1
  193. package/build-style/style-rtl.css +3 -10
  194. package/build-style/style.css +3 -10
  195. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  196. package/build-types/base-control/stories/index.story.d.ts.map +1 -1
  197. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  198. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
  199. package/build-types/border-control/border-control/component.d.ts +1 -0
  200. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  201. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  202. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  203. package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
  204. package/build-types/border-control/stories/index.story.d.ts +10 -5
  205. package/build-types/border-control/stories/index.story.d.ts.map +1 -1
  206. package/build-types/border-control/types.d.ts +7 -0
  207. package/build-types/border-control/types.d.ts.map +1 -1
  208. package/build-types/box-control/all-input-control.d.ts.map +1 -1
  209. package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
  210. package/build-types/box-control/index.d.ts +13 -13
  211. package/build-types/box-control/input-controls.d.ts.map +1 -1
  212. package/build-types/box-control/styles/box-control-styles.d.ts +2 -1
  213. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  214. package/build-types/box-control/types.d.ts +2 -0
  215. package/build-types/box-control/types.d.ts.map +1 -1
  216. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  217. package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
  218. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  219. package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
  220. package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
  221. package/build-types/color-palette/index.d.ts.map +1 -1
  222. package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
  223. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  224. package/build-types/color-picker/component.d.ts.map +1 -1
  225. package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
  226. package/build-types/color-picker/styles.d.ts +2 -4
  227. package/build-types/color-picker/styles.d.ts.map +1 -1
  228. package/build-types/combobox-control/index.d.ts +1 -0
  229. package/build-types/combobox-control/index.d.ts.map +1 -1
  230. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  231. package/build-types/composite/typeahead.d.ts.map +1 -1
  232. package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
  233. package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
  234. package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
  235. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
  236. package/build-types/dashicon/types.d.ts +1 -1
  237. package/build-types/dashicon/types.d.ts.map +1 -1
  238. package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
  239. package/build-types/date-time/stories/date.story.d.ts.map +1 -1
  240. package/build-types/date-time/stories/time.story.d.ts.map +1 -1
  241. package/build-types/dimension-control/index.d.ts +1 -0
  242. package/build-types/dimension-control/index.d.ts.map +1 -1
  243. package/build-types/disabled/index.d.ts +8 -1
  244. package/build-types/disabled/index.d.ts.map +1 -1
  245. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  246. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  247. package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
  248. package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
  249. package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
  250. package/build-types/font-size-picker/index.d.ts.map +1 -1
  251. package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
  252. package/build-types/form-file-upload/index.d.ts.map +1 -1
  253. package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
  254. package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
  255. package/build-types/gradient-picker/index.d.ts +32 -32
  256. package/build-types/gradient-picker/index.d.ts.map +1 -1
  257. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  258. package/build-types/gradient-picker/types.d.ts +1 -5
  259. package/build-types/gradient-picker/types.d.ts.map +1 -1
  260. package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
  261. package/build-types/icon/index.d.ts +23 -7
  262. package/build-types/icon/index.d.ts.map +1 -1
  263. package/build-types/icon/stories/index.story.d.ts +7 -1
  264. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  265. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  266. package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
  267. package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
  268. package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
  269. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  270. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  271. package/build-types/private-apis.d.ts.map +1 -1
  272. package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
  273. package/build-types/range-control/index.d.ts +3 -1
  274. package/build-types/range-control/index.d.ts.map +1 -1
  275. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  276. package/build-types/range-control/types.d.ts +7 -0
  277. package/build-types/range-control/types.d.ts.map +1 -1
  278. package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
  279. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  280. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  281. package/build-types/slot-fill/bubbles-virtually/fill.d.ts +1 -1
  282. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  283. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  284. package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
  285. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +1 -1
  286. package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts.map +1 -1
  287. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts +3 -7
  288. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  289. package/build-types/slot-fill/fill.d.ts.map +1 -1
  290. package/build-types/slot-fill/index.d.ts +5 -12
  291. package/build-types/slot-fill/index.d.ts.map +1 -1
  292. package/build-types/slot-fill/provider.d.ts.map +1 -1
  293. package/build-types/slot-fill/slot.d.ts +1 -1
  294. package/build-types/slot-fill/slot.d.ts.map +1 -1
  295. package/build-types/slot-fill/types.d.ts +15 -18
  296. package/build-types/slot-fill/types.d.ts.map +1 -1
  297. package/build-types/slot-fill/use-slot.d.ts +1 -1
  298. package/build-types/slot-fill/use-slot.d.ts.map +1 -1
  299. package/build-types/text-control/index.d.ts +1 -0
  300. package/build-types/text-control/index.d.ts.map +1 -1
  301. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  302. package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
  303. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  304. package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
  305. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -0
  306. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  307. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -0
  308. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  309. package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
  310. package/build-types/toggle-group-control/types.d.ts +7 -0
  311. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  312. package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
  313. package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
  314. package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
  315. package/build-types/utils/deprecated-36px-size.d.ts +2 -1
  316. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
  317. package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
  318. package/package.json +2 -2
  319. package/src/autocomplete/autocompleter-ui.tsx +1 -0
  320. package/src/base-control/stories/index.story.tsx +2 -1
  321. package/src/border-box-control/border-box-control/component.tsx +1 -0
  322. package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
  323. package/src/border-control/border-control/component.tsx +1 -0
  324. package/src/border-control/border-control/hook.ts +2 -0
  325. package/src/border-control/types.ts +7 -0
  326. package/src/box-control/README.md +79 -60
  327. package/src/box-control/all-input-control.tsx +1 -0
  328. package/src/box-control/axial-input-controls.tsx +1 -0
  329. package/src/box-control/docs-manifest.json +5 -0
  330. package/src/box-control/index.tsx +13 -13
  331. package/src/box-control/input-controls.tsx +1 -0
  332. package/src/box-control/types.ts +2 -0
  333. package/src/checkbox-control/stories/index.story.tsx +2 -1
  334. package/src/circular-option-picker/circular-option-picker-actions.tsx +1 -0
  335. package/src/circular-option-picker/circular-option-picker-option.tsx +1 -0
  336. package/src/circular-option-picker/stories/index.story.tsx +2 -1
  337. package/src/circular-option-picker/style.scss +2 -2
  338. package/src/color-indicator/stories/index.story.tsx +2 -1
  339. package/src/color-palette/index.tsx +5 -1
  340. package/src/color-palette/stories/index.story.tsx +2 -1
  341. package/src/color-picker/color-copy-button.tsx +8 -10
  342. package/src/color-picker/component.tsx +1 -0
  343. package/src/color-picker/stories/index.story.tsx +2 -1
  344. package/src/color-picker/styles.ts +0 -13
  345. package/src/combobox-control/README.md +1 -0
  346. package/src/combobox-control/index.tsx +19 -13
  347. package/src/combobox-control/stories/index.story.tsx +3 -1
  348. package/src/combobox-control/style.scss +0 -6
  349. package/src/combobox-control/test/index.tsx +7 -1
  350. package/src/composite/hover.tsx +1 -1
  351. package/src/composite/typeahead.tsx +3 -1
  352. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +2 -0
  353. package/src/custom-gradient-picker/stories/index.story.tsx +2 -1
  354. package/src/custom-gradient-picker/style.scss +1 -1
  355. package/src/custom-select-control/stories/index.story.tsx +2 -1
  356. package/src/custom-select-control-v2/stories/index.story.tsx +2 -1
  357. package/src/dashicon/types.ts +0 -2
  358. package/src/date-time/stories/date-time.story.tsx +2 -1
  359. package/src/date-time/stories/date.story.tsx +2 -1
  360. package/src/date-time/stories/time.story.tsx +2 -1
  361. package/src/dimension-control/README.md +1 -0
  362. package/src/dimension-control/index.tsx +8 -0
  363. package/src/dimension-control/stories/index.story.tsx +1 -0
  364. package/src/dimension-control/test/__snapshots__/index.test.js.snap +24 -24
  365. package/src/dimension-control/test/index.test.js +7 -1
  366. package/src/disabled/README.md +9 -7
  367. package/src/disabled/index.tsx +8 -1
  368. package/src/disabled/stories/index.story.tsx +1 -0
  369. package/src/drop-zone/stories/index.story.tsx +2 -1
  370. package/src/dropdown-menu/stories/index.story.tsx +2 -1
  371. package/src/duotone-picker/duotone-picker.tsx +2 -0
  372. package/src/font-size-picker/README.md +1 -0
  373. package/src/font-size-picker/font-size-picker-toggle-group.tsx +1 -0
  374. package/src/font-size-picker/index.tsx +8 -0
  375. package/src/font-size-picker/stories/index.story.tsx +1 -0
  376. package/src/font-size-picker/test/index.tsx +5 -1
  377. package/src/form-file-upload/index.tsx +9 -3
  378. package/src/form-file-upload/stories/index.story.tsx +2 -1
  379. package/src/form-token-field/stories/index.story.tsx +2 -1
  380. package/src/gradient-picker/README.md +107 -69
  381. package/src/gradient-picker/docs-manifest.json +5 -0
  382. package/src/gradient-picker/index.tsx +34 -32
  383. package/src/gradient-picker/stories/index.story.tsx +2 -1
  384. package/src/gradient-picker/types.ts +3 -5
  385. package/src/h-stack/stories/index.story.tsx +2 -1
  386. package/src/higher-order/with-constrained-tabbing/README.md +13 -3
  387. package/src/higher-order/with-focus-return/README.md +9 -2
  388. package/src/icon/README.md +22 -65
  389. package/src/icon/docs-manifest.json +5 -0
  390. package/src/icon/index.tsx +28 -13
  391. package/src/icon/stories/index.story.tsx +50 -8
  392. package/src/input-control/stories/index.story.tsx +2 -1
  393. package/src/menu/styles.ts +1 -1
  394. package/src/menu-group/stories/index.story.tsx +2 -1
  395. package/src/menu-item/stories/index.story.tsx +2 -1
  396. package/src/menu-items-choice/stories/index.story.tsx +2 -1
  397. package/src/modal/index.tsx +2 -2
  398. package/src/modal/stories/index.story.tsx +1 -1
  399. package/src/number-control/stories/index.story.tsx +2 -1
  400. package/src/placeholder/stories/index.story.tsx +1 -0
  401. package/src/private-apis.ts +0 -2
  402. package/src/radio-control/stories/index.story.tsx +2 -1
  403. package/src/range-control/README.md +4 -3
  404. package/src/range-control/index.tsx +11 -0
  405. package/src/range-control/stories/index.story.tsx +9 -1
  406. package/src/range-control/test/index.tsx +7 -1
  407. package/src/range-control/types.ts +7 -0
  408. package/src/responsive-wrapper/stories/index.story.tsx +2 -1
  409. package/src/search-control/stories/index.story.tsx +2 -1
  410. package/src/select-control/stories/index.story.tsx +2 -1
  411. package/src/slot-fill/README.md +26 -15
  412. package/src/slot-fill/bubbles-virtually/fill.tsx +18 -28
  413. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +26 -16
  414. package/src/slot-fill/bubbles-virtually/slot.tsx +13 -9
  415. package/src/slot-fill/bubbles-virtually/use-slot.ts +3 -26
  416. package/src/slot-fill/fill.ts +7 -22
  417. package/src/slot-fill/index.tsx +5 -7
  418. package/src/slot-fill/provider.tsx +8 -17
  419. package/src/slot-fill/slot.tsx +48 -85
  420. package/src/slot-fill/types.ts +14 -51
  421. package/src/text-control/README.md +1 -0
  422. package/src/text-control/index.tsx +8 -0
  423. package/src/text-control/stories/index.story.tsx +3 -1
  424. package/src/text-control/test/text-control.tsx +7 -1
  425. package/src/textarea-control/stories/index.story.tsx +2 -1
  426. package/src/toggle-control/stories/index.story.tsx +2 -1
  427. package/src/toggle-group-control/stories/index.story.tsx +3 -1
  428. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -12
  429. package/src/toggle-group-control/test/index.tsx +7 -1
  430. package/src/toggle-group-control/toggle-group-control/README.md +2 -1
  431. package/src/toggle-group-control/toggle-group-control/component.tsx +10 -0
  432. package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
  433. package/src/toggle-group-control/toggle-group-control-option/component.tsx +1 -0
  434. package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
  435. package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
  436. package/src/toggle-group-control/types.ts +7 -0
  437. package/src/tools-panel/stories/index.story.tsx +3 -0
  438. package/src/tree-select/stories/index.story.tsx +2 -1
  439. package/src/unit-control/stories/index.story.tsx +2 -1
  440. package/src/utils/deprecated-36px-size.ts +3 -0
  441. package/src/v-stack/stories/index.story.tsx +2 -1
  442. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["useState","isShallowEqual","observableMap","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","slot","get","set","unregisterSlot","delete","updateSlot","slotFills","forEach","fill","current","rerender","registerFill","unregisterFill","fillsForName","filter","fillRef","SlotFillProvider","children","registry","Provider","value"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { observableMap } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillProviderProps,\n\tSlotFillBubblesVirtuallyContext,\n} from '../types';\n\nfunction createSlotRegistry(): SlotFillBubblesVirtuallyContext {\n\tconst slots: SlotFillBubblesVirtuallyContext[ 'slots' ] = observableMap();\n\tconst fills: SlotFillBubblesVirtuallyContext[ 'fills' ] = observableMap();\n\n\tconst registerSlot: SlotFillBubblesVirtuallyContext[ 'registerSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\n\t\tslots.set( name, {\n\t\t\t...slot,\n\t\t\tref: ref || slot?.ref,\n\t\t\tfillProps: fillProps || slot?.fillProps || {},\n\t\t} );\n\t};\n\n\tconst unregisterSlot: SlotFillBubblesVirtuallyContext[ 'unregisterSlot' ] =\n\t\t( name, ref ) => {\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slots.get( name )?.ref === ref ) {\n\t\t\t\tslots.delete( name );\n\t\t\t}\n\t\t};\n\n\tconst updateSlot: SlotFillBubblesVirtuallyContext[ 'updateSlot' ] = (\n\t\tname,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslot.fillProps = fillProps;\n\t\tconst slotFills = fills.get( name );\n\t\tif ( slotFills ) {\n\t\t\t// Force update fills.\n\t\t\tslotFills.forEach( ( fill ) => fill.current.rerender() );\n\t\t}\n\t};\n\n\tconst registerFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\n\t\tfills.set( name, [ ...( fills.get( name ) || [] ), ref ] );\n\t};\n\n\tconst unregisterFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\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( ( fillRef ) => fillRef !== ref )\n\t\t);\n\t};\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n\nexport default function SlotFillProvider( {\n\tchildren,\n}: SlotFillProviderProps ) {\n\tconst [ registry ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMlD,SAASC,kBAAkBA,CAAA,EAAoC;EAC9D,MAAMC,KAAiD,GAAGL,aAAa,CAAC,CAAC;EACzE,MAAMM,KAAiD,GAAGN,aAAa,CAAC,CAAC;EAEzE,MAAMO,YAA+D,GAAGA,CACvEC,IAAI,EACJC,GAAG,EACHC,SAAS,KACL;IACJ,MAAMC,IAAI,GAAGN,KAAK,CAACO,GAAG,CAAEJ,IAAK,CAAC;IAE9BH,KAAK,CAACQ,GAAG,CAAEL,IAAI,EAAE;MAChB,GAAGG,IAAI;MACPF,GAAG,EAAEA,GAAG,IAAIE,IAAI,EAAEF,GAAG;MACrBC,SAAS,EAAEA,SAAS,IAAIC,IAAI,EAAED,SAAS,IAAI,CAAC;IAC7C,CAAE,CAAC;EACJ,CAAC;EAED,MAAMI,cAAmE,GACxEA,CAAEN,IAAI,EAAEC,GAAG,KAAM;IAChB;IACA;IACA,IAAKJ,KAAK,CAACO,GAAG,CAAEJ,IAAK,CAAC,EAAEC,GAAG,KAAKA,GAAG,EAAG;MACrCJ,KAAK,CAACU,MAAM,CAAEP,IAAK,CAAC;IACrB;EACD,CAAC;EAEF,MAAMQ,UAA2D,GAAGA,CACnER,IAAI,EACJE,SAAS,KACL;IACJ,MAAMC,IAAI,GAAGN,KAAK,CA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EAAQ,CACe,CAAC;AAE7B","ignoreList":[]}
1
+ {"version":3,"names":["useState","isShallowEqual","observableMap","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","slot","get","set","unregisterSlot","delete","updateSlot","slotFills","forEach","fill","rerender","registerFill","unregisterFill","fillsForName","filter","fillRef","SlotFillProvider","children","registry","Provider","value"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { observableMap } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillProviderProps,\n\tSlotFillBubblesVirtuallyContext,\n} from '../types';\n\nfunction createSlotRegistry(): SlotFillBubblesVirtuallyContext {\n\tconst slots: SlotFillBubblesVirtuallyContext[ 'slots' ] = observableMap();\n\tconst fills: SlotFillBubblesVirtuallyContext[ 'fills' ] = observableMap();\n\n\tconst registerSlot: SlotFillBubblesVirtuallyContext[ 'registerSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\n\t\tslots.set( name, {\n\t\t\t...slot,\n\t\t\tref: ref || slot?.ref,\n\t\t\tfillProps: fillProps || slot?.fillProps || {},\n\t\t} );\n\t};\n\n\tconst unregisterSlot: SlotFillBubblesVirtuallyContext[ 'unregisterSlot' ] =\n\t\t( name, ref ) => {\n\t\t\tconst slot = slots.get( name );\n\t\t\tif ( ! slot ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slot.ref !== ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tslots.delete( name );\n\t\t};\n\n\tconst updateSlot: SlotFillBubblesVirtuallyContext[ 'updateSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( slot.ref !== ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslot.fillProps = fillProps;\n\t\tconst slotFills = fills.get( name );\n\t\tif ( slotFills ) {\n\t\t\t// Force update fills.\n\t\t\tslotFills.forEach( ( fill ) => fill.rerender() );\n\t\t}\n\t};\n\n\tconst registerFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\n\t\tfills.set( name, [ ...( fills.get( name ) || [] ), ref ] );\n\t};\n\n\tconst unregisterFill: SlotFillBubblesVirtuallyContext[ 'unregisterFill' ] =\n\t\t( name, ref ) => {\n\t\t\tconst fillsForName = fills.get( name );\n\t\t\tif ( ! fillsForName ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfills.set(\n\t\t\t\tname,\n\t\t\t\tfillsForName.filter( ( fillRef ) => fillRef !== ref )\n\t\t\t);\n\t\t};\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n\nexport default function SlotFillProvider( {\n\tchildren,\n}: SlotFillProviderProps ) {\n\tconst [ registry ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA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AG;MAChB;MACAA,SAAS,CAACC,OAAO,CAAIC,IAAI,IAAMA,IAAI,CAACC,QAAQ,CAAC,CAAE,CAAC;IACjD;EACD,CAAC;EAED,MAAMC,YAA+D,GAAGA,CACvEb,IAAI,EACJC,GAAG,KACC;IACJH,KAAK,CAACO,GAAG,CAAEL,IAAI,EAAE,CAAE,IAAKF,KAAK,CAACM,GAAG,CAAEJ,IAAK,CAAC,IAAI,EAAE,CAAE,EAAEC,GAAG,CAAG,CAAC;EAC3D,CAAC;EAED,MAAMa,cAAmE,GACxEA,CAAEd,IAAI,EAAEC,GAAG,KAAM;IAChB,MAAMc,YAAY,GAAGjB,KAAK,CAACM,GAAG,CAAEJ,IAAK,CAAC;IACtC,IAAK,CAAEe,YAAY,EAAG;MACrB;IACD;IAEAjB,KAAK,CAACO,GAAG,CACRL,IAAI,EACJe,YAAY,CAACC,MAAM,CAAIC,OAAO,IAAMA,OAAO,KAAKhB,GAAI,CACrD,CAAC;EACF,CAAC;EAEF,OAAO;IACNJ,KAAK;IACLC,KAAK;IACLC,YAAY;IACZS,UAAU;IACVF,cAAc;IACdO,YAAY;IACZC;EACD,CAAC;AACF;AAEA,eAAe,SAASI,gBAAgBA,CAAE;EACzCC;AACsB,CAAC,EAAG;EAC1B,MAAM,CAAEC,QAAQ,CAAE,GAAG9B,QAAQ,CAAEM,kBAAmB,CAAC;EACnD,oBACCD,IAAA,CAACF,eAAe,CAAC4B,QAAQ;IAACC,KAAK,EAAGF,QAAU;IAAAD,QAAA,EACzCA;EAAQ,CACe,CAAC;AAE7B","ignoreList":[]}
@@ -21,7 +21,6 @@ function Slot(props, forwardedRef) {
21
21
  as,
22
22
  // `children` is not allowed. However, if it is passed,
23
23
  // it will be displayed as is, so remove `children`.
24
- // @ts-ignore
25
24
  children,
26
25
  ...restProps
27
26
  } = props;
@@ -31,20 +30,23 @@ function Slot(props, forwardedRef) {
31
30
  ...registry
32
31
  } = useContext(SlotFillContext);
33
32
  const ref = useRef(null);
33
+
34
+ // We don't want to unregister and register the slot whenever
35
+ // `fillProps` change, which would cause the fill to be re-mounted. Instead,
36
+ // we can just update the slot (see hook below).
37
+ // For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
38
+ const fillPropsRef = useRef(fillProps);
39
+ useLayoutEffect(() => {
40
+ fillPropsRef.current = fillProps;
41
+ }, [fillProps]);
34
42
  useLayoutEffect(() => {
35
- registerSlot(name, ref, fillProps);
43
+ registerSlot(name, ref, fillPropsRef.current);
36
44
  return () => {
37
45
  unregisterSlot(name, ref);
38
46
  };
39
- // We don't want to unregister and register the slot whenever
40
- // `fillProps` change, which would cause the fill to be re-mounted. Instead,
41
- // we can just update the slot (see hook below).
42
- // For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
43
47
  }, [registerSlot, unregisterSlot, name]);
44
- // fillProps may be an update that interacts with the layout, so we
45
- // useLayoutEffect.
46
48
  useLayoutEffect(() => {
47
- registry.updateSlot(name, fillProps);
49
+ registry.updateSlot(name, ref, fillPropsRef.current);
48
50
  });
49
51
  return /*#__PURE__*/_jsx(View, {
50
52
  as: as,
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","useLayoutEffect","useContext","forwardRef","useMergeRefs","View","SlotFillContext","jsx","_jsx","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","ref","updateSlot"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\nimport type { WordPressComponentProps } from '../../context';\nimport type { SlotComponentProps } from '../types';\n\nfunction Slot(\n\tprops: WordPressComponentProps<\n\t\tOmit< SlotComponentProps, 'bubblesVirtually' >,\n\t\t'div'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\t// @ts-ignore\n\t\tchildren,\n\t\t...restProps\n\t} = props;\n\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\tconst ref = useRef< HTMLElement >( null );\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillProps );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t\t// We don't want to unregister and register the slot whenever\n\t\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t\t// we can just update the slot (see hook below).\n\t\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\t}, [ registerSlot, unregisterSlot, name ] );\n\t// fillProps may be an update that interacts with the layout, so we\n\t// useLayoutEffect.\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, fillProps );\n\t} );\n\n\treturn (\n\t\t<View\n\t\t\tas={ as }\n\t\t\tref={ useMergeRefs( [ forwardedRef, ref ] ) }\n\t\t\t{ ...restProps }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( Slot );\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,MAAM,EACNC,eAAe,EACfC,UAAU,EACVC,UAAU,QACJ,oBAAoB;AAC3B,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIlD,SAASC,IAAIA,CACZC,KAGC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,IAAI;IACJC,SAAS,GAAG,CAAC,CAAC;IACdC,EAAE;IACF;IACA;IACA;IACAC,QAAQ;IACR,GAAGC;EACJ,CAAC,GAAGN,KAAK;EAET,MAAM;IAAEO,YAAY;IAAEC,cAAc;IAAE,GAAGC;EAAS,CAAC,GAClDjB,UAAU,CAAEI,eAAgB,CAAC;EAC9B,MAAMc,GAAG,GAAGpB,MAAM,CAAiB,IAAK,CAAC;EAEzCC,eAAe,CAAE,MAAM;IACtBgB,YAAY,CAAEL,IAAI,EAAEQ,GAAG,EAAEP,SAAU,CAAC;IACpC,OAAO,MAAM;MACZK,cAAc,CAAEN,IAAI,EAAEQ,GAAI,CAAC;IAC5B,CAAC;IACD;IACA;IACA;IACA;EACD,CAAC,EAAE,CAAEH,YAAY,EAAEC,cAAc,EAAEN,IAAI,CAAG,CAAC;EAC3C;EACA;EACAX,eAAe,CAAE,MAAM;IACtBkB,QAAQ,CAACE,UAAU,CAAET,IAAI,EAAEC,SAAU,CAAC;EACvC,CAAE,CAAC;EAEH,oBACCL,IAAA,CAACH,IAAI;IACJS,EAAE,EAAGA,EAAI;IACTM,GAAG,EAAGhB,YAAY,CAAE,CAAEO,YAAY,EAAES,GAAG,CAAG,CAAG;IAAA,GACxCJ;EAAS,CACd,CAAC;AAEJ;AAEA,eAAeb,UAAU,CAAEM,IAAK,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useRef","useLayoutEffect","useContext","forwardRef","useMergeRefs","View","SlotFillContext","jsx","_jsx","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","ref","fillPropsRef","current","updateSlot"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\nimport type { WordPressComponentProps } from '../../context';\nimport type { SlotComponentProps } from '../types';\n\nfunction Slot(\n\tprops: WordPressComponentProps<\n\t\tOmit< SlotComponentProps, 'bubblesVirtually' >,\n\t\t'div'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\tchildren,\n\t\t...restProps\n\t} = props;\n\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\n\tconst ref = useRef< HTMLElement >( null );\n\n\t// We don't want to unregister and register the slot whenever\n\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t// we can just update the slot (see hook below).\n\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\tconst fillPropsRef = useRef( fillProps );\n\tuseLayoutEffect( () => {\n\t\tfillPropsRef.current = fillProps;\n\t}, [ fillProps ] );\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillPropsRef.current );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t}, [ registerSlot, unregisterSlot, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, ref, fillPropsRef.current );\n\t} );\n\n\treturn (\n\t\t<View\n\t\t\tas={ as }\n\t\t\tref={ useMergeRefs( [ forwardedRef, ref ] ) }\n\t\t\t{ ...restProps }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( Slot );\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,MAAM,EACNC,eAAe,EACfC,UAAU,EACVC,UAAU,QACJ,oBAAoB;AAC3B,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIlD,SAASC,IAAIA,CACZC,KAGC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,IAAI;IACJC,SAAS,GAAG,CAAC,CAAC;IACdC,EAAE;IACF;IACA;IACAC,QAAQ;IACR,GAAGC;EACJ,CAAC,GAAGN,KAAK;EAET,MAAM;IAAEO,YAAY;IAAEC,cAAc;IAAE,GAAGC;EAAS,CAAC,GAClDjB,UAAU,CAAEI,eAAgB,CAAC;EAE9B,MAAMc,GAAG,GAAGpB,MAAM,CAAiB,IAAK,CAAC;;EAEzC;EACA;EACA;EACA;EACA,MAAMqB,YAAY,GAAGrB,MAAM,CAAEa,SAAU,CAAC;EACxCZ,eAAe,CAAE,MAAM;IACtBoB,YAAY,CAACC,OAAO,GAAGT,SAAS;EACjC,CAAC,EAAE,CAAEA,SAAS,CAAG,CAAC;EAElBZ,eAAe,CAAE,MAAM;IACtBgB,YAAY,CAAEL,IAAI,EAAEQ,GAAG,EAAEC,YAAY,CAACC,OAAQ,CAAC;IAC/C,OAAO,MAAM;MACZJ,cAAc,CAAEN,IAAI,EAAEQ,GAAI,CAAC;IAC5B,CAAC;EACF,CAAC,EAAE,CAAEH,YAAY,EAAEC,cAAc,EAAEN,IAAI,CAAG,CAAC;EAE3CX,eAAe,CAAE,MAAM;IACtBkB,QAAQ,CAACI,UAAU,CAAEX,IAAI,EAAEQ,GAAG,EAAEC,YAAY,CAACC,OAAQ,CAAC;EACvD,CAAE,CAAC;EAEH,oBACCd,IAAA,CAACH,IAAI;IACJS,EAAE,EAAGA,EAAI;IACTM,GAAG,EAAGhB,YAAY,CAAE,CAAEO,YAAY,EAAES,GAAG,CAAG,CAAG;IAAA,GACxCJ;EAAS,CACd,CAAC;AAEJ;AAEA,eAAeb,UAAU,CAAEM,IAAK,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useMemo, useContext } from '@wordpress/element';
4
+ import { useContext } from '@wordpress/element';
5
5
  import { useObservableValue } from '@wordpress/compose';
6
6
 
7
7
  /**
@@ -11,15 +11,8 @@ import SlotFillContext from './slot-fill-context';
11
11
  export default function useSlot(name) {
12
12
  const registry = useContext(SlotFillContext);
13
13
  const slot = useObservableValue(registry.slots, name);
14
- const api = useMemo(() => ({
15
- updateSlot: fillProps => registry.updateSlot(name, fillProps),
16
- unregisterSlot: ref => registry.unregisterSlot(name, ref),
17
- registerFill: ref => registry.registerFill(name, ref),
18
- unregisterFill: ref => registry.unregisterFill(name, ref)
19
- }), [name, registry]);
20
14
  return {
21
- ...slot,
22
- ...api
15
+ ...slot
23
16
  };
24
17
  }
25
18
  //# sourceMappingURL=use-slot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useContext","useObservableValue","SlotFillContext","useSlot","name","registry","slot","slots","api","updateSlot","fillProps","unregisterSlot","ref","registerFill","unregisterFill"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\nimport { useObservableValue } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillBubblesVirtuallyFillRef,\n\tSlotFillBubblesVirtuallySlotRef,\n\tFillProps,\n\tSlotKey,\n} from '../types';\n\nexport default function useSlot( name: SlotKey ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useObservableValue( registry.slots, name );\n\n\tconst api = useMemo(\n\t\t() => ( {\n\t\t\tupdateSlot: ( fillProps: FillProps ) =>\n\t\t\t\tregistry.updateSlot( name, fillProps ),\n\t\t\tunregisterSlot: ( ref: SlotFillBubblesVirtuallySlotRef ) =>\n\t\t\t\tregistry.unregisterSlot( name, ref ),\n\t\t\tregisterFill: ( ref: SlotFillBubblesVirtuallyFillRef ) =>\n\t\t\t\tregistry.registerFill( name, ref ),\n\t\t\tunregisterFill: ( ref: SlotFillBubblesVirtuallyFillRef ) =>\n\t\t\t\tregistry.unregisterFill( name, ref ),\n\t\t} ),\n\t\t[ name, registry ]\n\t);\n\n\treturn {\n\t\t...slot,\n\t\t...api,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,UAAU,QAAQ,oBAAoB;AACxD,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAQjD,eAAe,SAASC,OAAOA,CAAEC,IAAa,EAAG;EAChD,MAAMC,QAAQ,GAAGL,UAAU,CAAEE,eAAgB,CAAC;EAC9C,MAAMI,IAAI,GAAGL,kBAAkB,CAAEI,QAAQ,CAACE,KAAK,EAAEH,IAAK,CAAC;EAEvD,MAAMI,GAAG,GAAGT,OAAO,CAClB,OAAQ;IACPU,UAAU,EAAIC,SAAoB,IACjCL,QAAQ,CAACI,UAAU,CAAEL,IAAI,EAAEM,SAAU,CAAC;IACvCC,cAAc,EAAIC,GAAoC,IACrDP,QAAQ,CAACM,cAAc,CAAEP,IAAI,EAAEQ,GAAI,CAAC;IACrCC,YAAY,EAAID,GAAoC,IACnDP,QAAQ,CAACQ,YAAY,CAAET,IAAI,EAAEQ,GAAI,CAAC;IACnCE,cAAc,EAAIF,GAAoC,IACrDP,QAAQ,CAACS,cAAc,CAAEV,IAAI,EAAEQ,GAAI;EACrC,CAAC,CAAE,EACH,CAAER,IAAI,EAAEC,QAAQ,CACjB,CAAC;EAED,OAAO;IACN,GAAGC,IAAI;IACP,GAAGE;EACJ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useContext","useObservableValue","SlotFillContext","useSlot","name","registry","slot","slots"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { useObservableValue } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type { SlotKey } from '../types';\n\nexport default function useSlot( name: SlotKey ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useObservableValue( registry.slots, name );\n\treturn { ...slot };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAGjD,eAAe,SAASC,OAAOA,CAAEC,IAAa,EAAG;EAChD,MAAMC,QAAQ,GAAGL,UAAU,CAAEE,eAAgB,CAAC;EAC9C,MAAMI,IAAI,GAAGL,kBAAkB,CAAEI,QAAQ,CAACE,KAAK,EAAEH,IAAK,CAAC;EACvD,OAAO;IAAE,GAAGE;EAAK,CAAC;AACnB","ignoreList":[]}
@@ -12,10 +12,7 @@ export default function Fill({
12
12
  name,
13
13
  children
14
14
  }) {
15
- const {
16
- registerFill,
17
- unregisterFill
18
- } = useContext(SlotFillContext);
15
+ const registry = useContext(SlotFillContext);
19
16
  const slot = useSlot(name);
20
17
  const ref = useRef({
21
18
  name,
@@ -23,30 +20,16 @@ export default function Fill({
23
20
  });
24
21
  useLayoutEffect(() => {
25
22
  const refValue = ref.current;
26
- registerFill(name, refValue);
27
- return () => unregisterFill(name, refValue);
28
- // The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
29
- // We'll leave them as-is until a more detailed investigation/refactor can be performed.
30
- }, []);
23
+ refValue.name = name;
24
+ registry.registerFill(name, refValue);
25
+ return () => registry.unregisterFill(name, refValue);
26
+ }, [registry, name]);
31
27
  useLayoutEffect(() => {
32
28
  ref.current.children = children;
33
29
  if (slot) {
34
- slot.forceUpdate();
30
+ slot.rerender();
35
31
  }
36
- // The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
37
- // We'll leave them as-is until a more detailed investigation/refactor can be performed.
38
- }, [children]);
39
- useLayoutEffect(() => {
40
- if (name === ref.current.name) {
41
- // Ignore initial effect.
42
- return;
43
- }
44
- unregisterFill(ref.current.name, ref.current);
45
- ref.current.name = name;
46
- registerFill(name, ref.current);
47
- // The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
48
- // We'll leave them as-is until a more detailed investigation/refactor can be performed.
49
- }, [name]);
32
+ }, [slot, children]);
50
33
  return null;
51
34
  }
52
35
  //# sourceMappingURL=fill.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useLayoutEffect","useRef","SlotFillContext","useSlot","Fill","name","children","registerFill","unregisterFill","slot","ref","refValue","current","forceUpdate"],"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 { registerFill, unregisterFill } = 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\tregisterFill( name, refValue );\n\t\treturn () => unregisterFill( name, refValue );\n\t\t// The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t}, [] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.forceUpdate();\n\t\t}\n\t\t// The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t}, [ children ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( name === ref.current.name ) {\n\t\t\t// Ignore initial effect.\n\t\t\treturn;\n\t\t}\n\t\tunregisterFill( ref.current.name, ref.current );\n\t\tref.current.name = name;\n\t\tregisterFill( name, ref.current );\n\t\t// The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.\n\t\t// We'll leave them as-is until a more detailed investigation/refactor can be performed.\n\t}, [ name ] );\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,MAAM;IAAEC,YAAY;IAAEC;EAAe,CAAC,GAAGT,UAAU,CAAEG,eAAgB,CAAC;EACtE,MAAMO,IAAI,GAAGN,OAAO,CAAEE,IAAK,CAAC;EAE5B,MAAMK,GAAG,GAAGT,MAAM,CAAE;IACnBI,IAAI;IACJC;EACD,CAAE,CAAC;EAEHN,eAAe,CAAE,MAAM;IACtB,MAAMW,QAAQ,GAAGD,GAAG,CAACE,OAAO;IAC5BL,YAAY,CAAEF,IAAI,EAAEM,QAAS,CAAC;IAC9B,OAAO,MAAMH,cAAc,CAAEH,IAAI,EAAEM,QAAS,CAAC;IAC7C;IACA;EACD,CAAC,EAAE,EAAG,CAAC;EAEPX,eAAe,CAAE,MAAM;IACtBU,GAAG,CAACE,OAAO,CAACN,QAAQ,GAAGA,QAAQ;IAC/B,IAAKG,IAAI,EAAG;MACXA,IAAI,CAACI,WAAW,CAAC,CAAC;IACnB;IACA;IACA;EACD,CAAC,EAAE,CAAEP,QAAQ,CAAG,CAAC;EAEjBN,eAAe,CAAE,MAAM;IACtB,IAAKK,IAAI,KAAKK,GAAG,CAACE,OAAO,CAACP,IAAI,EAAG;MAChC;MACA;IACD;IACAG,cAAc,CAAEE,GAAG,CAACE,OAAO,CAACP,IAAI,EAAEK,GAAG,CAACE,OAAQ,CAAC;IAC/CF,GAAG,CAACE,OAAO,CAACP,IAAI,GAAGA,IAAI;IACvBE,YAAY,CAAEF,IAAI,EAAEK,GAAG,CAACE,OAAQ,CAAC;IACjC;IACA;EACD,CAAC,EAAE,CAAEP,IAAI,CAAG,CAAC;EAEb,OAAO,IAAI;AACZ","ignoreList":[]}
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":[]}
@@ -77,18 +77,15 @@ export function createSlotFill(key) {
77
77
  ...props
78
78
  });
79
79
  SlotComponent.displayName = `${baseName}Slot`;
80
+ /**
81
+ * @deprecated 6.8.0
82
+ * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.
83
+ */
80
84
  SlotComponent.__unstableName = key;
81
85
  return {
86
+ name: key,
82
87
  Fill: FillComponent,
83
88
  Slot: SlotComponent
84
89
  };
85
90
  }
86
- export const createPrivateSlotFill = name => {
87
- const privateKey = Symbol(name);
88
- const privateSlotFill = createSlotFill(privateKey);
89
- return {
90
- privateKey,
91
- ...privateSlotFill
92
- };
93
- };
94
91
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","useContext","BaseFill","BaseSlot","BubblesVirtuallyFill","BubblesVirtuallySlot","BubblesVirtuallySlotFillProvider","SlotFillProvider","SlotFillContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","default","useSlot","useSlotFills","Fill","props","children","UnforwardedSlot","ref","bubblesVirtually","restProps","Slot","Provider","passthrough","parent","isDefault","displayName","createSlotFill","key","baseName","description","FillComponent","name","SlotComponent","__unstableName","createPrivateSlotFill","privateKey","Symbol","privateSlotFill"],"sources":["@wordpress/components/src/slot-fill/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport SlotFillContext from './bubbles-virtually/slot-fill-context';\nimport type { WordPressComponentProps } from '../context';\n\nexport { default as useSlot } from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\nimport type {\n\tDistributiveOmit,\n\tFillComponentProps,\n\tSlotComponentProps,\n\tSlotFillProviderProps,\n\tSlotKey,\n} from './types';\n\nexport function Fill( props: FillComponentProps ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\n\nexport function UnforwardedSlot(\n\tprops: SlotComponentProps &\n\t\tOmit< WordPressComponentProps< {}, 'div' >, 'className' >,\n\tref: ForwardedRef< any >\n) {\n\tconst { bubblesVirtually, ...restProps } = props;\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...restProps } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...restProps } />;\n}\nexport const Slot = forwardRef( UnforwardedSlot );\n\nexport function Provider( {\n\tchildren,\n\tpassthrough = false,\n}: SlotFillProviderProps ) {\n\tconst parent = useContext( SlotFillContext );\n\tif ( ! parent.isDefault && passthrough ) {\n\t\treturn <>{ children }</>;\n\t}\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\nProvider.displayName = 'SlotFillProvider';\n\nexport function createSlotFill( key: SlotKey ) {\n\tconst baseName = typeof key === 'symbol' ? key.description : key;\n\tconst FillComponent = ( props: Omit< FillComponentProps, 'name' > ) => (\n\t\t<Fill name={ key } { ...props } />\n\t);\n\tFillComponent.displayName = `${ baseName }Fill`;\n\n\tconst SlotComponent = (\n\t\tprops: DistributiveOmit< SlotComponentProps, 'name' >\n\t) => <Slot name={ key } { ...props } />;\n\tSlotComponent.displayName = `${ baseName }Slot`;\n\tSlotComponent.__unstableName = key;\n\n\treturn {\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n\nexport const createPrivateSlotFill = ( name: string ) => {\n\tconst privateKey = Symbol( name );\n\tconst privateSlotFill = createSlotFill( privateKey );\n\n\treturn { privateKey, ...privateSlotFill };\n};\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,QAAQ;AAC7B,OAAOC,QAAQ,MAAM,QAAQ;AAC7B,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,gBAAgB,MAAM,YAAY;AACzC,OAAOC,eAAe,MAAM,uCAAuC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGpE,SAASC,OAAO,IAAIC,OAAO,QAAQ,8BAA8B;AACjE,SAASD,OAAO,IAAIE,YAAY,QAAQ,oCAAoC;AAS5E,OAAO,SAASC,IAAIA,CAAEC,KAAyB,EAAG;EACjD;EACA;EACA;EACA,oBACCL,KAAA,CAAAF,S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AA,GAAMb;EAAK,CAAI,CACjC;EACDgB,aAAa,CAACL,WAAW,GAAG,GAAIG,QAAQ,MAAO;EAE/C,MAAMI,aAAa,GAClBlB,KAAqD,iBACjDT,IAAA,CAACe,IAAI;IAACW,IAAI,EAAGJ,GAAK;IAAA,GAAMb;EAAK,CAAI,CAAC;EACvCkB,aAAa,CAACP,WAAW,GAAG,GAAIG,QAAQ,MAAO;EAC/CI,aAAa,CAACC,cAAc,GAAGN,GAAG;EAElC,OAAO;IACNd,IAAI,EAAEiB,aAAa;IACnBV,IAAI,EAAEY;EACP,CAAC;AACF;AAEA,OAAO,MAAME,qBAAqB,GAAKH,IAAY,IAAM;EACxD,MAAMI,UAAU,GAAGC,MAAM,CAAEL,IAAK,CAAC;EACjC,MAAMM,eAAe,GAAGX,cAAc,CAAES,UAAW,CAAC;EAEpD,OAAO;IAAEA,UAAU;IAAE,GAAGE;EAAgB,CAAC;AAC1C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","useContext","BaseFill","BaseSlot","BubblesVirtuallyFill","BubblesVirtuallySlot","BubblesVirtuallySlotFillProvider","SlotFillProvider","SlotFillContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","default","useSlot","useSlotFills","Fill","props","children","UnforwardedSlot","ref","bubblesVirtually","restProps","Slot","Provider","passthrough","parent","isDefault","displayName","createSlotFill","key","baseName","description","FillComponent","name","SlotComponent","__unstableName"],"sources":["@wordpress/components/src/slot-fill/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport SlotFillContext from './bubbles-virtually/slot-fill-context';\nimport type { WordPressComponentProps } from '../context';\n\nexport { default as useSlot } from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\nimport type {\n\tDistributiveOmit,\n\tFillComponentProps,\n\tSlotComponentProps,\n\tSlotFillProviderProps,\n\tSlotKey,\n} from './types';\n\nexport function Fill( props: FillComponentProps ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\n\nexport function UnforwardedSlot(\n\tprops: SlotComponentProps &\n\t\tOmit< WordPressComponentProps< {}, 'div' >, 'className' >,\n\tref: ForwardedRef< any >\n) {\n\tconst { bubblesVirtually, ...restProps } = props;\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...restProps } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...restProps } />;\n}\nexport const Slot = forwardRef( UnforwardedSlot );\n\nexport function Provider( {\n\tchildren,\n\tpassthrough = false,\n}: SlotFillProviderProps ) {\n\tconst parent = useContext( SlotFillContext );\n\tif ( ! parent.isDefault && passthrough ) {\n\t\treturn <>{ children }</>;\n\t}\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\nProvider.displayName = 'SlotFillProvider';\n\nexport function createSlotFill( key: SlotKey ) {\n\tconst baseName = typeof key === 'symbol' ? key.description : key;\n\tconst FillComponent = ( props: Omit< FillComponentProps, 'name' > ) => (\n\t\t<Fill name={ key } { ...props } />\n\t);\n\tFillComponent.displayName = `${ baseName }Fill`;\n\n\tconst SlotComponent = (\n\t\tprops: DistributiveOmit< SlotComponentProps, 'name' >\n\t) => <Slot name={ key } { ...props } />;\n\tSlotComponent.displayName = `${ baseName }Slot`;\n\t/**\n\t * @deprecated 6.8.0\n\t * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.\n\t */\n\tSlotComponent.__unstableName = key;\n\n\treturn {\n\t\tname: key,\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,QAAQ;AAC7B,OAAOC,QAAQ,MAAM,QAAQ;AAC7B,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,gBAAgB,MAAM,YAAY;AACzC,OAAOC,eAAe,MAAM,uCAAuC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGpE,SAASC,OAAO,IAAIC,OAAO,QAAQ,8BAA8B;AACjE,SAASD,OAAO,IAAIE,YAAY,QAAQ,oCAAoC;AAS5E,OAAO,SAASC,IAAIA,CAAEC,KAAyB,EAAG;EACjD;EACA;EACA;EACA,oBACCL,KAAA,CAAAF,SAAA;IAAAQ,QAAA,gBACCV,IAAA,CAACR,QAAQ;MAAA,GAAMiB;IAAK,CAAI,CAAC,eACzBT,IAAA,CAACN,oBAAoB;MAAA,GAAMe;IAAK,CAAI,CAAC;EAAA,CACpC,CAAC;AAEL;AAEA,OAAO,SAASE,eAAeA,CAC9BF,KAC0D,EAC1DG,GAAwB,EACvB;EACD,MAAM;IAAEC,gBAAgB;IAAE,GAAGC;EAAU,CAAC,GAAGL,KAAK;EAChD,IAAKI,gBAAgB,EAAG;IACvB,oBAAOb,IAAA,CAACL,oBAAoB;MAAA,GAAMmB,SAAS;MAAGF,GAAG,EAAGA;IAAK,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EACP,CAAC;AACF","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
-
5
4
  import { useState } from '@wordpress/element';
6
5
 
7
6
  /**
@@ -27,7 +26,7 @@ function createSlotRegistry() {
27
26
  // assigned into the instance, such that its own rendering of children
28
27
  // will be empty (the new Slot will subsume all fills for this name).
29
28
  if (previousSlot) {
30
- previousSlot.forceUpdate();
29
+ previousSlot.rerender();
31
30
  }
32
31
  }
33
32
  function registerFill(name, instance) {
@@ -63,7 +62,7 @@ function createSlotRegistry() {
63
62
  function forceUpdateSlot(name) {
64
63
  const slot = getSlot(name);
65
64
  if (slot) {
66
- slot.forceUpdate();
65
+ slot.rerender();
67
66
  }
68
67
  }
69
68
  function triggerListeners() {
@@ -1 +1 @@
1
- {"version":3,"names":["useState","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","listeners","registerSlot","name","slot","previousSlot","triggerListeners","forceUpdateSlot","forceUpdate","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 type { Component } from '@wordpress/element';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type {\n\tFillComponentProps,\n\tBaseSlotFillContext,\n\tBaseSlotComponentProps,\n\tSlotFillProviderProps,\n\tSlotKey,\n} from './types';\n\nfunction createSlotRegistry(): BaseSlotFillContext {\n\tconst slots: Record< SlotKey, Component< BaseSlotComponentProps > > = {};\n\tconst fills: Record< SlotKey, FillComponentProps[] > = {};\n\tlet listeners: Array< () => void > = [];\n\n\tfunction registerSlot(\n\t\tname: SlotKey,\n\t\tslot: Component< BaseSlotComponentProps >\n\t) {\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.forceUpdate();\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(\n\t\tname: SlotKey,\n\t\tinstance: Component< BaseSlotComponentProps >\n\t) {\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(\n\t\tname: SlotKey\n\t): Component< BaseSlotComponentProps > | undefined {\n\t\treturn slots[ name ];\n\t}\n\n\tfunction getFills(\n\t\tname: SlotKey,\n\t\tslotInstance: Component< BaseSlotComponentProps >\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.forceUpdate();\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;;AAEA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASxC,SAASC,kBAAkBA,CAAA,EAAwB;EAClD,MAAMC,KAA6D,GAAG,CAAC,CAAC;EACxE,MAAMC,KAA8C,GAAG,CAAC,CAAC;EACzD,IAAIC,SAA8B,GAAG,EAAE;EAEvC,SAASC,YAAYA,CACpBC,IAAa,EACbC,IAAyC,EACxC;IACD,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,WAAW,CAAC,CAAC;IAC3B;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,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,KAAKH,QAAS,CAAC;IACxD,CAAC;EACF;EAEA,OAAO;IACNlB,YAAY;IACZS,cAAc;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","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;IACA;IACA,IAAKX,KAAK,CAAEI,IAAI,CAAE,KAAKO,QAAQ,EAAG;MACjC;IACD;IAEA,OAAOX,KAAK,CAAEI,IAAI,CAAE;IACpBG,gBAAgB,CAAC,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ACvE,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":[]}
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * WordPress dependencies
7
7
  */
8
- import { Children, Component, cloneElement, isEmptyElement } from '@wordpress/element';
8
+ import { useContext, useEffect, useReducer, useRef, Children, cloneElement, isEmptyElement } from '@wordpress/element';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
@@ -21,85 +21,45 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
21
21
  function isFunction(maybeFunc) {
22
22
  return typeof maybeFunc === 'function';
23
23
  }
24
- class SlotComponent extends Component {
25
- constructor(props) {
26
- super(props);
27
- this.isUnmounted = false;
28
- }
29
- componentDidMount() {
30
- const {
31
- registerSlot
32
- } = this.props;
33
- this.isUnmounted = false;
34
- registerSlot(this.props.name, this);
35
- }
36
- componentWillUnmount() {
37
- const {
38
- unregisterSlot
39
- } = this.props;
40
- this.isUnmounted = true;
41
- unregisterSlot(this.props.name, this);
42
- }
43
- componentDidUpdate(prevProps) {
44
- const {
45
- name,
46
- unregisterSlot,
47
- registerSlot
48
- } = this.props;
49
- if (prevProps.name !== name) {
50
- unregisterSlot(prevProps.name, this);
51
- registerSlot(name, this);
52
- }
53
- }
54
- forceUpdate() {
55
- if (this.isUnmounted) {
56
- return;
57
- }
58
- super.forceUpdate();
59
- }
60
- render() {
61
- var _getFills;
62
- const {
63
- children,
64
- name,
65
- fillProps = {},
66
- getFills
67
- } = this.props;
68
- const fills = ((_getFills = getFills(name, this)) !== null && _getFills !== void 0 ? _getFills : []).map(fill => {
69
- const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
70
- return Children.map(fillChildren, (child, childIndex) => {
71
- if (!child || typeof child === 'string') {
72
- return child;
73
- }
74
- let childKey = childIndex;
75
- if (typeof child === 'object' && 'key' in child && child?.key) {
76
- childKey = child.key;
77
- }
78
- return cloneElement(child, {
79
- key: childKey
80
- });
24
+ function Slot(props) {
25
+ var _registry$getFills;
26
+ const registry = useContext(SlotFillContext);
27
+ const [, rerender] = useReducer(() => [], []);
28
+ const ref = useRef({
29
+ rerender
30
+ });
31
+ const {
32
+ name,
33
+ children,
34
+ fillProps = {}
35
+ } = props;
36
+ useEffect(() => {
37
+ const refValue = ref.current;
38
+ registry.registerSlot(name, refValue);
39
+ return () => registry.unregisterSlot(name, refValue);
40
+ }, [registry, name]);
41
+ const fills = ((_registry$getFills = registry.getFills(name, ref.current)) !== null && _registry$getFills !== void 0 ? _registry$getFills : []).map(fill => {
42
+ 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
81
53
  });
82
- }).filter(
83
- // In some cases fills are rendered only when some conditions apply.
84
- // This ensures that we only use non-empty fills when rendering, i.e.,
85
- // it allows us to render wrappers only when the fills are actually present.
86
- element => !isEmptyElement(element));
87
- return /*#__PURE__*/_jsx(_Fragment, {
88
- children: isFunction(children) ? children(fills) : fills
89
54
  });
90
- }
55
+ }).filter(
56
+ // In some cases fills are rendered only when some conditions apply.
57
+ // This ensures that we only use non-empty fills when rendering, i.e.,
58
+ // it allows us to render wrappers only when the fills are actually present.
59
+ element => !isEmptyElement(element));
60
+ return /*#__PURE__*/_jsx(_Fragment, {
61
+ children: isFunction(children) ? children(fills) : fills
62
+ });
91
63
  }
92
- const Slot = props => /*#__PURE__*/_jsx(SlotFillContext.Consumer, {
93
- children: ({
94
- registerSlot,
95
- unregisterSlot,
96
- getFills
97
- }) => /*#__PURE__*/_jsx(SlotComponent, {
98
- ...props,
99
- registerSlot: registerSlot,
100
- unregisterSlot: unregisterSlot,
101
- getFills: getFills
102
- })
103
- });
104
64
  export default Slot;
105
65
  //# sourceMappingURL=slot.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Children","Component","cloneElement","isEmptyElement","SlotFillContext","Fragment","_Fragment","jsx","_jsx","isFunction","maybeFunc","SlotComponent","constructor","props","isUnmounted","componentDidMount","registerSlot","name","componentWillUnmount","unregisterSlot","componentDidUpdate","prevProps","forceUpdate","render","_getFills","children","fillProps","getFills","fills","map","fill","fillChildren","child","childIndex","childKey","key","filter","element","Slot","Consumer"],"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\tChildren,\n\tComponent,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type { BaseSlotComponentProps, 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\nclass SlotComponent extends Component< BaseSlotComponentProps > {\n\tprivate isUnmounted: boolean;\n\n\tconstructor( props: BaseSlotComponentProps ) {\n\t\tsuper( props );\n\n\t\tthis.isUnmounted = false;\n\t}\n\n\tcomponentDidMount() {\n\t\tconst { registerSlot } = this.props;\n\t\tthis.isUnmounted = false;\n\t\tregisterSlot( this.props.name, this );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { unregisterSlot } = this.props;\n\t\tthis.isUnmounted = true;\n\t\tunregisterSlot( this.props.name, this );\n\t}\n\n\tcomponentDidUpdate( prevProps: BaseSlotComponentProps ) {\n\t\tconst { name, unregisterSlot, registerSlot } = this.props;\n\n\t\tif ( prevProps.name !== name ) {\n\t\t\tunregisterSlot( prevProps.name, this );\n\t\t\tregisterSlot( name, this );\n\t\t}\n\t}\n\n\tforceUpdate() {\n\t\tif ( this.isUnmounted ) {\n\t\t\treturn;\n\t\t}\n\t\tsuper.forceUpdate();\n\t}\n\n\trender() {\n\t\tconst { children, name, fillProps = {}, getFills } = this.props;\n\t\tconst fills: ReactNode[] = ( getFills( name, this ) ?? [] )\n\t\t\t.map( ( fill ) => {\n\t\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t\t? fill.children( fillProps )\n\t\t\t\t\t: fill.children;\n\t\t\t\treturn Children.map( fillChildren, ( child, childIndex ) => {\n\t\t\t\t\tif ( ! child || typeof child === 'string' ) {\n\t\t\t\t\t\treturn child;\n\t\t\t\t\t}\n\t\t\t\t\tlet childKey: Key = childIndex;\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof child === 'object' &&\n\t\t\t\t\t\t'key' in child &&\n\t\t\t\t\t\tchild?.key\n\t\t\t\t\t) {\n\t\t\t\t\t\tchildKey = child.key;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn cloneElement( child as ReactElement, {\n\t\t\t\t\t\tkey: childKey,\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t} )\n\t\t\t.filter(\n\t\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\t\t( element ) => ! isEmptyElement( element )\n\t\t\t);\n\n\t\treturn <>{ isFunction( children ) ? children( fills ) : fills }</>;\n\t}\n}\n\nconst Slot = ( props: Omit< SlotComponentProps, 'bubblesVirtually' > ) => (\n\t<SlotFillContext.Consumer>\n\t\t{ ( { registerSlot, unregisterSlot, getFills } ) => (\n\t\t\t<SlotComponent\n\t\t\t\t{ ...props }\n\t\t\t\tregisterSlot={ registerSlot }\n\t\t\t\tunregisterSlot={ unregisterSlot }\n\t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KAAM,CAAC,GAAGA;IAAK,CAAI,CAAC;EACnE;AACD;AAEA,MAAMU,IAAI,GAAKzB,KAAqD,iBACnEL,IAAA,CAACJ,eAAe,CAACmC,QAAQ;EAAAd,QAAA,EACtBA,CAAE;IAAET,YAAY;IAAEG,cAAc;IAAEQ;EAAS,CAAC,kBAC7CnB,IAAA,CAACG,aAAa;IAAA,GACRE,KAAK;IACVG,YAAY,EAAGA,YAAc;IAC7BG,cAAc,EAAGA,cAAgB;IACjCQ,QAAQ,EAAGA;EAAU,CACrB;AACD,CACwB,CAC1B;AAED,eAAeW,IAAI","ignoreList":[]}
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,M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,OAAO9B,YAAY,CAAE2B,KAAK,EAAkB;QAC3CG,GAAG,EAAED;MACN,CAAE,CAAC;IACJ,CAAE,CAAC;EACJ,CAAE,CAAC,CACFE,MAAM;EACN;EACA;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 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { Component, MutableRefObject, 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 SlotFillBubblesVirtuallySlotRef = RefObject< HTMLElement >;\nexport type SlotFillBubblesVirtuallyFillRef = MutableRefObject< {\n\trerender: () => void;\n} >;\n\nexport type SlotFillBubblesVirtuallyContext = {\n\tslots: ObservableMap<\n\t\tSlotKey,\n\t\t{\n\t\t\tref: SlotFillBubblesVirtuallySlotRef;\n\t\t\tfillProps: FillProps;\n\t\t}\n\t>;\n\tfills: ObservableMap< SlotKey, SlotFillBubblesVirtuallyFillRef[] >;\n\tregisterSlot: (\n\t\tname: SlotKey,\n\t\tref: SlotFillBubblesVirtuallySlotRef,\n\t\tfillProps: FillProps\n\t) => void;\n\tunregisterSlot: (\n\t\tname: SlotKey,\n\t\tref: SlotFillBubblesVirtuallySlotRef\n\t) => void;\n\tupdateSlot: ( name: SlotKey, fillProps: FillProps ) => void;\n\tregisterFill: (\n\t\tname: SlotKey,\n\t\tref: SlotFillBubblesVirtuallyFillRef\n\t) => void;\n\tunregisterFill: (\n\t\tname: SlotKey,\n\t\tref: SlotFillBubblesVirtuallyFillRef\n\t) => 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: (\n\t\tname: SlotKey,\n\t\tslot: Component< BaseSlotComponentProps >\n\t) => void;\n\tunregisterSlot: (\n\t\tname: SlotKey,\n\t\tslot: Component< BaseSlotComponentProps >\n\t) => void;\n\tregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tgetSlot: (\n\t\tname: SlotKey\n\t) => Component< BaseSlotComponentProps > | undefined;\n\tgetFills: (\n\t\tname: SlotKey,\n\t\tslotInstance: Component< BaseSlotComponentProps >\n\t) => FillComponentProps[];\n\tsubscribe: ( listener: () => void ) => () => void;\n};\n\nexport type BaseSlotComponentProps = Pick<\n\tBaseSlotFillContext,\n\t'registerSlot' | 'unregisterSlot' | 'getFills'\n> &\n\tOmit< SlotComponentProps, 'bubblesVirtually' > & {\n\t\tchildren?: ( fills: ReactNode ) => ReactNode;\n\t};\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 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 };\n\nexport type SlotFillBubblesVirtuallyContext = {\n\tslots: ObservableMap< SlotKey, { ref: SlotRef; fillProps: FillProps } >;\n\tfills: ObservableMap< SlotKey, Rerenderable[] >;\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, ref: Rerenderable ) => void;\n\tunregisterFill: ( name: SlotKey, ref: Rerenderable ) => 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":[]}
@@ -14,6 +14,7 @@ import { forwardRef } from '@wordpress/element';
14
14
  * Internal dependencies
15
15
  */
16
16
  import BaseControl from '../base-control';
17
+ import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  function UnforwardedTextControl(props, ref) {
19
20
  const {
@@ -31,6 +32,11 @@ function UnforwardedTextControl(props, ref) {
31
32
  } = props;
32
33
  const id = useInstanceId(TextControl, 'inspector-text-control', idProp);
33
34
  const onChangeValue = event => onChange(event.target.value);
35
+ maybeWarnDeprecated36pxSize({
36
+ componentName: 'TextControl',
37
+ size: undefined,
38
+ __next40pxDefaultSize
39
+ });
34
40
  return /*#__PURE__*/_jsx(BaseControl, {
35
41
  __nextHasNoMarginBottom: __nextHasNoMarginBottom,
36
42
  __associatedWPComponentName: "TextControl",
@@ -67,6 +73,7 @@ function UnforwardedTextControl(props, ref) {
67
73
  * return (
68
74
  * <TextControl
69
75
  * __nextHasNoMarginBottom
76
+ * __next40pxDefaultSize
70
77
  * label="Additional CSS Class"
71
78
  * value={ className }
72
79
  * onChange={ ( value ) => setClassName( value ) }
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useInstanceId","forwardRef","BaseControl","jsx","_jsx","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","__next40pxDefaultSize","label","hideLabelFromVision","value","help","id","idProp","className","onChange","type","additionalProps","TextControl","onChangeValue","event","target","__associatedWPComponentName","children","undefined"],"sources":["@wordpress/components/src/text-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context';\nimport type { TextControlProps } from './types';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\t__next40pxDefaultSize = false,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tid: idProp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst id = useInstanceId( TextControl, 'inspector-text-control', idProp );\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"TextControl\"\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName={ clsx( 'components-text-control__input', {\n\t\t\t\t\t'is-next-40px-default-size': __next40pxDefaultSize,\n\t\t\t\t} ) }\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * __nextHasNoMarginBottom\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AACl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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGnB,UAAU,CAAEI,sBAAuB,CAAC;AAE/D,eAAee,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useInstanceId","forwardRef","BaseControl","maybeWarnDeprecated36pxSize","jsx","_jsx","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","__next40pxDefaultSize","label","hideLabelFromVision","value","help","id","idProp","className","onChange","type","additionalProps","TextControl","onChangeValue","event","target","componentName","size","undefined","__associatedWPComponentName","children"],"sources":["@wordpress/components/src/text-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context';\nimport type { TextControlProps } from './types';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\t__next40pxDefaultSize = false,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tid: idProp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst id = useInstanceId( TextControl, 'inspector-text-control', idProp );\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'TextControl',\n\t\tsize: undefined,\n\t\t__next40pxDefaultSize,\n\t} );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"TextControl\"\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName={ clsx( 'components-text-control__input', {\n\t\t\t\t\t'is-next-40px-default-size': __next40pxDefaultSize,\n\t\t\t\t} ) }\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * __nextHasNoMarginBottom\n * __next40pxDefaultSize\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,iBAAiB;AAGzC,SAASC,2BAA2B,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5E,SAASC,sBAAsBA,CAC9BC,KAAkE,EAClEC,GAAqC,EACpC;EACD,MAAM;IACLC,uBAAuB;IACvBC,qBAAqB,GAAG,KAAK;IAC7BC,KAAK;IACLC,mBAAmB;IACnBC,KAAK;IACLC,IAAI;IACJC,EAAE,EAAEC,MAAM;IACVC,SAAS;IACTC,QAAQ;IACRC,IAAI,GAAG,MAAM;IACb,GAAGC;EACJ,CAAC,GAAGb,KAAK;EACT,MAAMQ,EAAE,GAAGf,aAAa,CAAEqB,WAAW,EAAE,wBAAwB,EAAEL,MAAO,CAAC;EACzE,MAAMM,aAAa,GAAKC,KAAsC,IAC7DL,QAAQ,CAAEK,KAAK,CAACC,MAAM,CAACX,KAAM,CAAC;EAE/BV,2BAA2B,CAAE;IAC5BsB,aAAa,EAAE,aAAa;IAC5BC,IAAI,EAAEC,SAAS;IACfjB;EACD,CAAE,CAAC;EAEH,oBACCL,IAAA,CAACH,WAAW;IACXO,uBAAuB,EAAGA,uBAAyB;IACnDmB,2BAA2B,EAAC,aAAa;IACzCjB,KAAK,EAAGA,KAAO;IACfC,mBAAmB,EAAGA,mBAAqB;IAC3CG,EAAE,EAAGA,EAAI;IACTD,IAAI,EAAGA,IAAM;IACbG,SAAS,EAAGA,SAAW;IAAAY,QAAA,eAEvBxB,IAAA;MACCY,SAAS,EAAGlB,IAAI,CAAE,gCAAgC,EAAE;QACnD,2BAA2B,EAAEW;MAC9B,CAAE,CAAG;MACLS,IAAI,EAAGA,IAAM;MACbJ,EAAE,EAAGA,EAAI;MACTF,KAAK,EAAGA,KAAO;MACfK,QAAQ,EAAGI,aAAe;MAC1B,oBAAmB,CAAC,CAAER,IAAI,GAAGC,EAAE,GAAG,QAAQ,GAAGY,SAAW;MACxDnB,GAAG,EAAGA,GAAK;MAAA,GACNY;IAAe,CACpB;EAAC,CACU,CAAC;AAEhB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGpB,UAAU,CAAEK,sBAAuB,CAAC;AAE/D,eAAee,WAAW","ignoreList":[]}
@@ -21,11 +21,13 @@ import { ToggleGroupControlAsButtonGroup } from './as-button-group';
21
21
  import { useTrackElementOffsetRect } from '../../utils/element-rect';
22
22
  import { useMergeRefs } from '@wordpress/compose';
23
23
  import { useAnimatedOffsetRect } from '../../utils/hooks/use-animated-offset-rect';
24
+ import { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';
24
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
26
  function UnconnectedToggleGroupControl(props, forwardedRef) {
26
27
  const {
27
28
  __nextHasNoMarginBottom = false,
28
29
  __next40pxDefaultSize = false,
30
+ __shouldNotWarnDeprecated36pxSize,
29
31
  className,
30
32
  isAdaptiveWidth = false,
31
33
  isBlock = false,
@@ -57,6 +59,12 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
57
59
  size: normalizedSize
58
60
  }), isBlock && styles.block, className), [className, cx, isBlock, isDeselectable, normalizedSize]);
59
61
  const MainControl = isDeselectable ? ToggleGroupControlAsButtonGroup : ToggleGroupControlAsRadioGroup;
62
+ maybeWarnDeprecated36pxSize({
63
+ componentName: 'ToggleGroupControl',
64
+ size,
65
+ __next40pxDefaultSize,
66
+ __shouldNotWarnDeprecated36pxSize
67
+ });
60
68
  return /*#__PURE__*/_jsxs(BaseControl, {
61
69
  help: help,
62
70
  __nextHasNoMarginBottom: __nextHasNoMarginBottom,
@@ -106,6 +114,7 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
106
114
  * value="vertical"
107
115
  * isBlock
108
116
  * __nextHasNoMarginBottom
117
+ * __next40pxDefaultSize
109
118
  * >
110
119
  * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
111
120
  * <ToggleGroupControlOption value="vertical" label="Vertical" />