@wordpress/components 19.4.1-next.f435e9e01b.0 → 19.6.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 (944) hide show
  1. package/CHANGELOG.md +37 -4
  2. package/CONTRIBUTING.md +69 -2
  3. package/build/alignment-matrix-control/utils.js +1 -1
  4. package/build/alignment-matrix-control/utils.js.map +1 -1
  5. package/build/angle-picker-control/angle-circle.js +1 -1
  6. package/build/angle-picker-control/angle-circle.js.map +1 -1
  7. package/build/animation/index.js +0 -6
  8. package/build/animation/index.js.map +1 -1
  9. package/build/autocomplete/get-default-use-items.js +3 -3
  10. package/build/autocomplete/get-default-use-items.js.map +1 -1
  11. package/build/base-field/hook.js +1 -1
  12. package/build/base-field/hook.js.map +1 -1
  13. package/build/box-control/icon.js +1 -1
  14. package/build/box-control/icon.js.map +1 -1
  15. package/build/box-control/index.js +4 -4
  16. package/build/box-control/index.js.map +1 -1
  17. package/build/box-control/unit-control.js +2 -2
  18. package/build/box-control/unit-control.js.map +1 -1
  19. package/build/box-control/utils.js +12 -8
  20. package/build/box-control/utils.js.map +1 -1
  21. package/build/button/index.js +5 -5
  22. package/build/button/index.js.map +1 -1
  23. package/build/button/index.native.js +7 -7
  24. package/build/button/index.native.js.map +1 -1
  25. package/build/card/card/component.js +2 -2
  26. package/build/card/card/component.js.map +1 -1
  27. package/build/card/card-body/component.js +1 -1
  28. package/build/card/card-body/component.js.map +1 -1
  29. package/build/card/card-divider/component.js +1 -1
  30. package/build/card/card-divider/component.js.map +1 -1
  31. package/build/card/card-footer/component.js +1 -1
  32. package/build/card/card-footer/component.js.map +1 -1
  33. package/build/card/card-header/component.js +1 -1
  34. package/build/card/card-header/component.js.map +1 -1
  35. package/build/card/card-media/component.js +1 -1
  36. package/build/card/card-media/component.js.map +1 -1
  37. package/build/color-palette/index.native.js +35 -30
  38. package/build/color-palette/index.native.js.map +1 -1
  39. package/build/color-picker/color-display.js +1 -1
  40. package/build/color-picker/color-display.js.map +1 -1
  41. package/build/color-picker/component.js.map +1 -1
  42. package/build/color-picker/hex-input.js +6 -9
  43. package/build/color-picker/hex-input.js.map +1 -1
  44. package/build/color-picker/styles.js +8 -8
  45. package/build/color-picker/styles.js.map +1 -1
  46. package/build/combobox-control/index.js +1 -1
  47. package/build/combobox-control/index.js.map +1 -1
  48. package/build/confirm-dialog/component.js +4 -2
  49. package/build/confirm-dialog/component.js.map +1 -1
  50. package/build/date-time/time.js +7 -4
  51. package/build/date-time/time.js.map +1 -1
  52. package/build/divider/component.js +5 -4
  53. package/build/divider/component.js.map +1 -1
  54. package/build/draggable/index.js +3 -3
  55. package/build/draggable/index.js.map +1 -1
  56. package/build/elevation/component.js +1 -1
  57. package/build/elevation/component.js.map +1 -1
  58. package/build/flex/flex/component.js +1 -1
  59. package/build/flex/flex/component.js.map +1 -1
  60. package/build/flex/flex-block/component.js +1 -1
  61. package/build/flex/flex-block/component.js.map +1 -1
  62. package/build/flex/flex-item/component.js +1 -1
  63. package/build/flex/flex-item/component.js.map +1 -1
  64. package/build/flyout/flyout/component.js +1 -1
  65. package/build/flyout/flyout/component.js.map +1 -1
  66. package/build/flyout/flyout-content/component.js +1 -1
  67. package/build/flyout/flyout-content/component.js.map +1 -1
  68. package/build/focal-point-picker/index.js +18 -12
  69. package/build/focal-point-picker/index.js.map +1 -1
  70. package/build/focal-point-picker/index.native.js +7 -7
  71. package/build/focal-point-picker/index.native.js.map +1 -1
  72. package/build/focal-point-picker/tooltip/index.native.js +1 -1
  73. package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
  74. package/build/font-size-picker/index.js +1 -2
  75. package/build/font-size-picker/index.js.map +1 -1
  76. package/build/form-token-field/index.js +6 -6
  77. package/build/form-token-field/index.js.map +1 -1
  78. package/build/form-token-field/suggestions-list.js +2 -2
  79. package/build/form-token-field/suggestions-list.js.map +1 -1
  80. package/build/grid/component.js +1 -1
  81. package/build/grid/component.js.map +1 -1
  82. package/build/h-stack/component.js +1 -1
  83. package/build/h-stack/component.js.map +1 -1
  84. package/build/heading/component.js +6 -5
  85. package/build/heading/component.js.map +1 -1
  86. package/build/heading/hook.js +1 -1
  87. package/build/heading/hook.js.map +1 -1
  88. package/build/higher-order/with-notices/index.js +1 -1
  89. package/build/higher-order/with-notices/index.js.map +1 -1
  90. package/build/index.js +14 -2
  91. package/build/index.js.map +1 -1
  92. package/build/index.native.js +15 -1
  93. package/build/index.native.js.map +1 -1
  94. package/build/input-control/index.js.map +1 -1
  95. package/build/input-control/input-base.js +1 -1
  96. package/build/input-control/input-base.js.map +1 -1
  97. package/build/input-control/input-field.js +19 -17
  98. package/build/input-control/input-field.js.map +1 -1
  99. package/build/input-control/reducer/reducer.js +3 -0
  100. package/build/input-control/reducer/reducer.js.map +1 -1
  101. package/build/input-control/styles/input-control-styles.js +25 -25
  102. package/build/input-control/styles/input-control-styles.js.map +1 -1
  103. package/build/isolated-event-container/index.js +1 -1
  104. package/build/isolated-event-container/index.js.map +1 -1
  105. package/build/item-group/item/component.js.map +1 -1
  106. package/build/item-group/item-group/component.js.map +1 -1
  107. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
  108. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  109. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
  110. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  111. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  112. package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  113. package/build/mobile/bottom-sheet/cell.native.js +1 -1
  114. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  115. package/build/mobile/bottom-sheet/index.native.js +11 -11
  116. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  117. package/build/mobile/bottom-sheet/link-cell.native.js +1 -1
  118. package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
  119. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
  120. package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  121. package/build/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
  122. package/build/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
  123. package/build/mobile/color-settings/palette.screen.native.js +26 -9
  124. package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
  125. package/build/mobile/global-styles-context/utils.native.js +73 -19
  126. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  127. package/build/mobile/gradient/index.native.js +2 -2
  128. package/build/mobile/gradient/index.native.js.map +1 -1
  129. package/build/mobile/html-text-input/container.ios.js +3 -3
  130. package/build/mobile/html-text-input/container.ios.js.map +1 -1
  131. package/build/mobile/html-text-input/index.native.js +1 -1
  132. package/build/mobile/html-text-input/index.native.js.map +1 -1
  133. package/build/mobile/image/index.native.js +1 -1
  134. package/build/mobile/image/index.native.js.map +1 -1
  135. package/build/mobile/inserter-button/index.native.js +3 -3
  136. package/build/mobile/inserter-button/index.native.js.map +1 -1
  137. package/build/mobile/inserter-button/sparkles.js +25 -0
  138. package/build/mobile/inserter-button/sparkles.js.map +1 -0
  139. package/build/mobile/keyboard-aware-flat-list/index.android.js +1 -1
  140. package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  141. package/build/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
  142. package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  143. package/build/mobile/link-picker/index.native.js +3 -3
  144. package/build/mobile/link-picker/index.native.js.map +1 -1
  145. package/build/mobile/link-picker/link-picker-results.native.js +8 -8
  146. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  147. package/build/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
  148. package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  149. package/build/mobile/link-settings/index.native.js +1 -1
  150. package/build/mobile/link-settings/index.native.js.map +1 -1
  151. package/build/modal/aria-helper.js +1 -1
  152. package/build/modal/aria-helper.js.map +1 -1
  153. package/build/modal/index.js +2 -2
  154. package/build/modal/index.js.map +1 -1
  155. package/build/navigable-container/container.js +2 -2
  156. package/build/navigable-container/container.js.map +1 -1
  157. package/build/navigable-container/tabbable.js +1 -1
  158. package/build/navigable-container/tabbable.js.map +1 -1
  159. package/build/navigation/item/index.js +1 -1
  160. package/build/navigation/item/index.js.map +1 -1
  161. package/build/navigation/menu/index.js +1 -1
  162. package/build/navigation/menu/index.js.map +1 -1
  163. package/build/navigator/index.js +16 -0
  164. package/build/navigator/index.js.map +1 -1
  165. package/build/navigator/navigator-back-button/component.js +72 -0
  166. package/build/navigator/navigator-back-button/component.js.map +1 -0
  167. package/build/navigator/navigator-back-button/hook.js +49 -0
  168. package/build/navigator/navigator-back-button/hook.js.map +1 -0
  169. package/build/navigator/navigator-back-button/index.js +16 -0
  170. package/build/navigator/navigator-back-button/index.js.map +1 -0
  171. package/build/navigator/navigator-button/component.js +71 -0
  172. package/build/navigator/navigator-button/component.js.map +1 -0
  173. package/build/navigator/navigator-button/hook.js +59 -0
  174. package/build/navigator/navigator-button/hook.js.map +1 -0
  175. package/build/navigator/navigator-button/index.js +16 -0
  176. package/build/navigator/navigator-button/index.js.map +1 -0
  177. package/build/navigator/navigator-provider/component.js +12 -22
  178. package/build/navigator/navigator-provider/component.js.map +1 -1
  179. package/build/navigator/navigator-screen/component.js +14 -22
  180. package/build/navigator/navigator-screen/component.js.map +1 -1
  181. package/build/number-control/index.js +1 -1
  182. package/build/number-control/index.js.map +1 -1
  183. package/build/panel/body.js +2 -2
  184. package/build/panel/body.js.map +1 -1
  185. package/build/popover/index.js +3 -3
  186. package/build/popover/index.js.map +1 -1
  187. package/build/popover/utils.js +6 -6
  188. package/build/popover/utils.js.map +1 -1
  189. package/build/radio-group/index.js +1 -1
  190. package/build/radio-group/index.js.map +1 -1
  191. package/build/range-control/styles/range-control-styles.js +29 -29
  192. package/build/range-control/styles/range-control-styles.js.map +1 -1
  193. package/build/resizable-box/index.js.map +1 -1
  194. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  195. package/build/resizable-box/resize-tooltip/label.js.map +1 -1
  196. package/build/sandbox/index.js +5 -5
  197. package/build/sandbox/index.js.map +1 -1
  198. package/build/sandbox/index.native.js +1 -1
  199. package/build/sandbox/index.native.js.map +1 -1
  200. package/build/scrollable/component.js +1 -1
  201. package/build/scrollable/component.js.map +1 -1
  202. package/build/select-control/index.js +1 -1
  203. package/build/select-control/index.js.map +1 -1
  204. package/build/select-control/styles/select-control-styles.js +5 -5
  205. package/build/select-control/styles/select-control-styles.js.map +1 -1
  206. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  207. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  208. package/build/slot-fill/bubbles-virtually/slot.js +1 -1
  209. package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
  210. package/build/slot-fill/fill.js +1 -1
  211. package/build/slot-fill/fill.js.map +1 -1
  212. package/build/slot-fill/provider.js +1 -1
  213. package/build/slot-fill/provider.js.map +1 -1
  214. package/build/snackbar/index.js +1 -1
  215. package/build/snackbar/index.js.map +1 -1
  216. package/build/snackbar/list.js +1 -1
  217. package/build/snackbar/list.js.map +1 -1
  218. package/build/spacer/component.js.map +1 -1
  219. package/build/style-provider/index.js +2 -2
  220. package/build/style-provider/index.js.map +1 -1
  221. package/build/surface/component.js +1 -1
  222. package/build/surface/component.js.map +1 -1
  223. package/build/text/component.js +1 -1
  224. package/build/text/component.js.map +1 -1
  225. package/build/text-control/index.js +2 -2
  226. package/build/text-control/index.js.map +1 -1
  227. package/build/toggle-group-control/toggle-group-control/component.js +2 -2
  228. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  229. package/build/toggle-group-control/toggle-group-control-option/component.js +1 -4
  230. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  231. package/build/toggle-group-control/toggle-group-control-option/styles.js +12 -19
  232. package/build/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
  233. package/build/toolbar/index.js +1 -1
  234. package/build/toolbar/index.js.map +1 -1
  235. package/build/tools-panel/tools-panel/component.js.map +1 -1
  236. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  237. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  238. package/build/tooltip/index.js +3 -3
  239. package/build/tooltip/index.js.map +1 -1
  240. package/build/tooltip/index.native.js +7 -7
  241. package/build/tooltip/index.native.js.map +1 -1
  242. package/build/tree-grid/index.js +54 -7
  243. package/build/tree-grid/index.js.map +1 -1
  244. package/build/truncate/component.js +1 -1
  245. package/build/truncate/component.js.map +1 -1
  246. package/build/truncate/utils.js +1 -1
  247. package/build/truncate/utils.js.map +1 -1
  248. package/build/ui/context/context-connect.js +8 -15
  249. package/build/ui/context/context-connect.js.map +1 -1
  250. package/build/ui/context/context-system-provider.js +2 -2
  251. package/build/ui/context/context-system-provider.js.map +1 -1
  252. package/build/ui/context/index.js.map +1 -1
  253. package/build/ui/control-group/component.js +1 -1
  254. package/build/ui/control-group/component.js.map +1 -1
  255. package/build/ui/control-label/component.js +1 -1
  256. package/build/ui/control-label/component.js.map +1 -1
  257. package/build/ui/form-group/form-group.js +1 -1
  258. package/build/ui/form-group/form-group.js.map +1 -1
  259. package/build/ui/shortcut/component.js.map +1 -1
  260. package/build/ui/spinner/component.js +1 -1
  261. package/build/ui/spinner/component.js.map +1 -1
  262. package/build/ui/tooltip/component.js +1 -1
  263. package/build/ui/tooltip/component.js.map +1 -1
  264. package/build/ui/tooltip/content.js +1 -1
  265. package/build/ui/tooltip/content.js.map +1 -1
  266. package/build/ui/utils/colors.js +2 -2
  267. package/build/ui/utils/colors.js.map +1 -1
  268. package/build/ui/utils/space.js +2 -2
  269. package/build/ui/utils/space.js.map +1 -1
  270. package/build/unit-control/index.js +38 -29
  271. package/build/unit-control/index.js.map +1 -1
  272. package/build/unit-control/index.native.js +4 -2
  273. package/build/unit-control/index.native.js.map +1 -1
  274. package/build/unit-control/unit-select-control.js +1 -1
  275. package/build/unit-control/unit-select-control.js.map +1 -1
  276. package/build/unit-control/utils.js +96 -104
  277. package/build/unit-control/utils.js.map +1 -1
  278. package/build/utils/breakpoint-values.js +1 -1
  279. package/build/utils/breakpoint-values.js.map +1 -1
  280. package/build/utils/colors-values.js +1 -1
  281. package/build/utils/colors-values.js.map +1 -1
  282. package/build/v-stack/component.js +1 -1
  283. package/build/v-stack/component.js.map +1 -1
  284. package/build/visually-hidden/component.js +1 -1
  285. package/build/visually-hidden/component.js.map +1 -1
  286. package/build/z-stack/component.js.map +1 -1
  287. package/build-module/alignment-matrix-control/utils.js +1 -1
  288. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  289. package/build-module/angle-picker-control/angle-circle.js +1 -1
  290. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  291. package/build-module/animation/index.js +1 -1
  292. package/build-module/animation/index.js.map +1 -1
  293. package/build-module/autocomplete/get-default-use-items.js +3 -3
  294. package/build-module/autocomplete/get-default-use-items.js.map +1 -1
  295. package/build-module/base-field/hook.js +1 -1
  296. package/build-module/base-field/hook.js.map +1 -1
  297. package/build-module/box-control/icon.js +1 -1
  298. package/build-module/box-control/icon.js.map +1 -1
  299. package/build-module/box-control/index.js +5 -5
  300. package/build-module/box-control/index.js.map +1 -1
  301. package/build-module/box-control/unit-control.js +1 -1
  302. package/build-module/box-control/unit-control.js.map +1 -1
  303. package/build-module/box-control/utils.js +13 -9
  304. package/build-module/box-control/utils.js.map +1 -1
  305. package/build-module/button/index.js +5 -5
  306. package/build-module/button/index.js.map +1 -1
  307. package/build-module/button/index.native.js +7 -7
  308. package/build-module/button/index.native.js.map +1 -1
  309. package/build-module/card/card/component.js +2 -2
  310. package/build-module/card/card/component.js.map +1 -1
  311. package/build-module/card/card-body/component.js +1 -1
  312. package/build-module/card/card-body/component.js.map +1 -1
  313. package/build-module/card/card-divider/component.js +1 -1
  314. package/build-module/card/card-divider/component.js.map +1 -1
  315. package/build-module/card/card-footer/component.js +1 -1
  316. package/build-module/card/card-footer/component.js.map +1 -1
  317. package/build-module/card/card-header/component.js +1 -1
  318. package/build-module/card/card-header/component.js.map +1 -1
  319. package/build-module/card/card-media/component.js +1 -1
  320. package/build-module/card/card-media/component.js.map +1 -1
  321. package/build-module/color-palette/index.native.js +36 -31
  322. package/build-module/color-palette/index.native.js.map +1 -1
  323. package/build-module/color-picker/color-display.js +1 -1
  324. package/build-module/color-picker/color-display.js.map +1 -1
  325. package/build-module/color-picker/component.js.map +1 -1
  326. package/build-module/color-picker/hex-input.js +6 -9
  327. package/build-module/color-picker/hex-input.js.map +1 -1
  328. package/build-module/color-picker/styles.js +8 -8
  329. package/build-module/color-picker/styles.js.map +1 -1
  330. package/build-module/combobox-control/index.js +1 -1
  331. package/build-module/combobox-control/index.js.map +1 -1
  332. package/build-module/confirm-dialog/component.js +4 -5
  333. package/build-module/confirm-dialog/component.js.map +1 -1
  334. package/build-module/date-time/time.js +7 -4
  335. package/build-module/date-time/time.js.map +1 -1
  336. package/build-module/divider/component.js +3 -3
  337. package/build-module/divider/component.js.map +1 -1
  338. package/build-module/draggable/index.js +3 -3
  339. package/build-module/draggable/index.js.map +1 -1
  340. package/build-module/elevation/component.js +1 -1
  341. package/build-module/elevation/component.js.map +1 -1
  342. package/build-module/flex/flex/component.js +1 -1
  343. package/build-module/flex/flex/component.js.map +1 -1
  344. package/build-module/flex/flex-block/component.js +1 -1
  345. package/build-module/flex/flex-block/component.js.map +1 -1
  346. package/build-module/flex/flex-item/component.js +1 -1
  347. package/build-module/flex/flex-item/component.js.map +1 -1
  348. package/build-module/flyout/flyout/component.js +1 -1
  349. package/build-module/flyout/flyout/component.js.map +1 -1
  350. package/build-module/flyout/flyout-content/component.js +1 -1
  351. package/build-module/flyout/flyout-content/component.js.map +1 -1
  352. package/build-module/focal-point-picker/index.js +18 -12
  353. package/build-module/focal-point-picker/index.js.map +1 -1
  354. package/build-module/focal-point-picker/index.native.js +7 -7
  355. package/build-module/focal-point-picker/index.native.js.map +1 -1
  356. package/build-module/focal-point-picker/tooltip/index.native.js +1 -1
  357. package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
  358. package/build-module/font-size-picker/index.js +1 -2
  359. package/build-module/font-size-picker/index.js.map +1 -1
  360. package/build-module/form-token-field/index.js +6 -6
  361. package/build-module/form-token-field/index.js.map +1 -1
  362. package/build-module/form-token-field/suggestions-list.js +2 -2
  363. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  364. package/build-module/grid/component.js +1 -1
  365. package/build-module/grid/component.js.map +1 -1
  366. package/build-module/h-stack/component.js +1 -1
  367. package/build-module/h-stack/component.js.map +1 -1
  368. package/build-module/heading/component.js +4 -4
  369. package/build-module/heading/component.js.map +1 -1
  370. package/build-module/heading/hook.js +1 -1
  371. package/build-module/heading/hook.js.map +1 -1
  372. package/build-module/higher-order/with-notices/index.js +1 -1
  373. package/build-module/higher-order/with-notices/index.js.map +1 -1
  374. package/build-module/index.js +5 -5
  375. package/build-module/index.js.map +1 -1
  376. package/build-module/index.native.js +5 -5
  377. package/build-module/index.native.js.map +1 -1
  378. package/build-module/input-control/index.js.map +1 -1
  379. package/build-module/input-control/input-base.js +1 -1
  380. package/build-module/input-control/input-base.js.map +1 -1
  381. package/build-module/input-control/input-field.js +19 -16
  382. package/build-module/input-control/input-field.js.map +1 -1
  383. package/build-module/input-control/reducer/reducer.js +3 -0
  384. package/build-module/input-control/reducer/reducer.js.map +1 -1
  385. package/build-module/input-control/styles/input-control-styles.js +25 -25
  386. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  387. package/build-module/isolated-event-container/index.js +1 -1
  388. package/build-module/isolated-event-container/index.js.map +1 -1
  389. package/build-module/item-group/item/component.js.map +1 -1
  390. package/build-module/item-group/item-group/component.js.map +1 -1
  391. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
  392. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  393. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
  394. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
  395. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +1 -1
  396. package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
  397. package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
  398. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  399. package/build-module/mobile/bottom-sheet/index.native.js +11 -11
  400. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  401. package/build-module/mobile/bottom-sheet/link-cell.native.js +1 -1
  402. package/build-module/mobile/bottom-sheet/link-cell.native.js.map +1 -1
  403. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
  404. package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
  405. package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
  406. package/build-module/mobile/bottom-sheet/nav-bar/back-button.native.js.map +1 -1
  407. package/build-module/mobile/color-settings/palette.screen.native.js +27 -10
  408. package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
  409. package/build-module/mobile/global-styles-context/utils.native.js +70 -20
  410. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  411. package/build-module/mobile/gradient/index.native.js +2 -2
  412. package/build-module/mobile/gradient/index.native.js.map +1 -1
  413. package/build-module/mobile/html-text-input/container.ios.js +3 -3
  414. package/build-module/mobile/html-text-input/container.ios.js.map +1 -1
  415. package/build-module/mobile/html-text-input/index.native.js +1 -1
  416. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  417. package/build-module/mobile/image/index.native.js +1 -1
  418. package/build-module/mobile/image/index.native.js.map +1 -1
  419. package/build-module/mobile/inserter-button/index.native.js +1 -1
  420. package/build-module/mobile/inserter-button/index.native.js.map +1 -1
  421. package/build-module/mobile/inserter-button/sparkles.js +16 -0
  422. package/build-module/mobile/inserter-button/sparkles.js.map +1 -0
  423. package/build-module/mobile/keyboard-aware-flat-list/index.android.js +1 -1
  424. package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
  425. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
  426. package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
  427. package/build-module/mobile/link-picker/index.native.js +3 -3
  428. package/build-module/mobile/link-picker/index.native.js.map +1 -1
  429. package/build-module/mobile/link-picker/link-picker-results.native.js +8 -8
  430. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  431. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
  432. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  433. package/build-module/mobile/link-settings/index.native.js +1 -1
  434. package/build-module/mobile/link-settings/index.native.js.map +1 -1
  435. package/build-module/modal/aria-helper.js +1 -1
  436. package/build-module/modal/aria-helper.js.map +1 -1
  437. package/build-module/modal/index.js +2 -2
  438. package/build-module/modal/index.js.map +1 -1
  439. package/build-module/navigable-container/container.js +2 -2
  440. package/build-module/navigable-container/container.js.map +1 -1
  441. package/build-module/navigable-container/tabbable.js +1 -1
  442. package/build-module/navigable-container/tabbable.js.map +1 -1
  443. package/build-module/navigation/item/index.js +1 -1
  444. package/build-module/navigation/item/index.js.map +1 -1
  445. package/build-module/navigation/menu/index.js +1 -1
  446. package/build-module/navigation/menu/index.js.map +1 -1
  447. package/build-module/navigator/index.js +2 -0
  448. package/build-module/navigator/index.js.map +1 -1
  449. package/build-module/navigator/navigator-back-button/component.js +59 -0
  450. package/build-module/navigator/navigator-back-button/component.js.map +1 -0
  451. package/build-module/navigator/navigator-back-button/hook.js +36 -0
  452. package/build-module/navigator/navigator-back-button/hook.js.map +1 -0
  453. package/build-module/navigator/navigator-back-button/index.js +2 -0
  454. package/build-module/navigator/navigator-back-button/index.js.map +1 -0
  455. package/build-module/navigator/navigator-button/component.js +58 -0
  456. package/build-module/navigator/navigator-button/component.js.map +1 -0
  457. package/build-module/navigator/navigator-button/hook.js +46 -0
  458. package/build-module/navigator/navigator-button/hook.js.map +1 -0
  459. package/build-module/navigator/navigator-button/index.js +2 -0
  460. package/build-module/navigator/navigator-button/index.js.map +1 -0
  461. package/build-module/navigator/navigator-provider/component.js +12 -22
  462. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  463. package/build-module/navigator/navigator-screen/component.js +13 -22
  464. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  465. package/build-module/number-control/index.js +1 -1
  466. package/build-module/number-control/index.js.map +1 -1
  467. package/build-module/panel/body.js +2 -2
  468. package/build-module/panel/body.js.map +1 -1
  469. package/build-module/popover/index.js +3 -3
  470. package/build-module/popover/index.js.map +1 -1
  471. package/build-module/popover/utils.js +6 -6
  472. package/build-module/popover/utils.js.map +1 -1
  473. package/build-module/radio-group/index.js +1 -1
  474. package/build-module/radio-group/index.js.map +1 -1
  475. package/build-module/range-control/styles/range-control-styles.js +29 -29
  476. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  477. package/build-module/resizable-box/index.js.map +1 -1
  478. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  479. package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
  480. package/build-module/sandbox/index.js +5 -5
  481. package/build-module/sandbox/index.js.map +1 -1
  482. package/build-module/sandbox/index.native.js +1 -1
  483. package/build-module/sandbox/index.native.js.map +1 -1
  484. package/build-module/scrollable/component.js +1 -1
  485. package/build-module/scrollable/component.js.map +1 -1
  486. package/build-module/select-control/index.js +2 -2
  487. package/build-module/select-control/index.js.map +1 -1
  488. package/build-module/select-control/styles/select-control-styles.js +5 -5
  489. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  490. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  491. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  492. package/build-module/slot-fill/bubbles-virtually/slot.js +1 -1
  493. package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
  494. package/build-module/slot-fill/fill.js +1 -1
  495. package/build-module/slot-fill/fill.js.map +1 -1
  496. package/build-module/slot-fill/provider.js +1 -1
  497. package/build-module/slot-fill/provider.js.map +1 -1
  498. package/build-module/snackbar/index.js +1 -1
  499. package/build-module/snackbar/index.js.map +1 -1
  500. package/build-module/snackbar/list.js +1 -1
  501. package/build-module/snackbar/list.js.map +1 -1
  502. package/build-module/spacer/component.js.map +1 -1
  503. package/build-module/style-provider/index.js +2 -2
  504. package/build-module/style-provider/index.js.map +1 -1
  505. package/build-module/surface/component.js +1 -1
  506. package/build-module/surface/component.js.map +1 -1
  507. package/build-module/text/component.js +1 -1
  508. package/build-module/text/component.js.map +1 -1
  509. package/build-module/text-control/index.js +2 -2
  510. package/build-module/text-control/index.js.map +1 -1
  511. package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
  512. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  513. package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -4
  514. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  515. package/build-module/toggle-group-control/toggle-group-control-option/styles.js +11 -17
  516. package/build-module/toggle-group-control/toggle-group-control-option/styles.js.map +1 -1
  517. package/build-module/toolbar/index.js +1 -1
  518. package/build-module/toolbar/index.js.map +1 -1
  519. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  520. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  521. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  522. package/build-module/tooltip/index.js +3 -3
  523. package/build-module/tooltip/index.js.map +1 -1
  524. package/build-module/tooltip/index.native.js +7 -7
  525. package/build-module/tooltip/index.native.js.map +1 -1
  526. package/build-module/tree-grid/index.js +55 -8
  527. package/build-module/tree-grid/index.js.map +1 -1
  528. package/build-module/truncate/component.js +1 -1
  529. package/build-module/truncate/component.js.map +1 -1
  530. package/build-module/truncate/utils.js +1 -1
  531. package/build-module/truncate/utils.js.map +1 -1
  532. package/build-module/ui/context/context-connect.js +9 -16
  533. package/build-module/ui/context/context-connect.js.map +1 -1
  534. package/build-module/ui/context/context-system-provider.js +2 -2
  535. package/build-module/ui/context/context-system-provider.js.map +1 -1
  536. package/build-module/ui/context/index.js.map +1 -1
  537. package/build-module/ui/control-group/component.js +1 -1
  538. package/build-module/ui/control-group/component.js.map +1 -1
  539. package/build-module/ui/control-label/component.js +1 -1
  540. package/build-module/ui/control-label/component.js.map +1 -1
  541. package/build-module/ui/form-group/form-group.js +1 -1
  542. package/build-module/ui/form-group/form-group.js.map +1 -1
  543. package/build-module/ui/shortcut/component.js.map +1 -1
  544. package/build-module/ui/spinner/component.js +1 -1
  545. package/build-module/ui/spinner/component.js.map +1 -1
  546. package/build-module/ui/tooltip/component.js +1 -1
  547. package/build-module/ui/tooltip/component.js.map +1 -1
  548. package/build-module/ui/tooltip/content.js +1 -1
  549. package/build-module/ui/tooltip/content.js.map +1 -1
  550. package/build-module/ui/utils/colors.js +2 -2
  551. package/build-module/ui/utils/colors.js.map +1 -1
  552. package/build-module/ui/utils/space.js +2 -2
  553. package/build-module/ui/utils/space.js.map +1 -1
  554. package/build-module/unit-control/index.js +39 -30
  555. package/build-module/unit-control/index.js.map +1 -1
  556. package/build-module/unit-control/index.native.js +5 -3
  557. package/build-module/unit-control/index.native.js.map +1 -1
  558. package/build-module/unit-control/unit-select-control.js +1 -1
  559. package/build-module/unit-control/unit-select-control.js.map +1 -1
  560. package/build-module/unit-control/utils.js +92 -100
  561. package/build-module/unit-control/utils.js.map +1 -1
  562. package/build-module/utils/breakpoint-values.js +1 -1
  563. package/build-module/utils/breakpoint-values.js.map +1 -1
  564. package/build-module/utils/colors-values.js +1 -1
  565. package/build-module/utils/colors-values.js.map +1 -1
  566. package/build-module/v-stack/component.js +1 -1
  567. package/build-module/v-stack/component.js.map +1 -1
  568. package/build-module/visually-hidden/component.js +1 -1
  569. package/build-module/visually-hidden/component.js.map +1 -1
  570. package/build-module/z-stack/component.js.map +1 -1
  571. package/build-style/style-rtl.css +8 -0
  572. package/build-style/style.css +8 -0
  573. package/build-types/base-field/hook.d.ts +2 -1
  574. package/build-types/base-field/hook.d.ts.map +1 -1
  575. package/build-types/card/card/hook.d.ts +2 -1
  576. package/build-types/card/card/hook.d.ts.map +1 -1
  577. package/build-types/card/card-body/hook.d.ts +2 -1
  578. package/build-types/card/card-body/hook.d.ts.map +1 -1
  579. package/build-types/card/card-divider/hook.d.ts +2 -3
  580. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  581. package/build-types/card/card-footer/hook.d.ts +2 -1
  582. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  583. package/build-types/card/card-header/hook.d.ts +2 -1
  584. package/build-types/card/card-header/hook.d.ts.map +1 -1
  585. package/build-types/card/card-media/hook.d.ts +2 -1
  586. package/build-types/card/card-media/hook.d.ts.map +1 -1
  587. package/build-types/color-picker/styles.d.ts +2 -4
  588. package/build-types/color-picker/styles.d.ts.map +1 -1
  589. package/build-types/confirm-dialog/component.d.ts +10 -6
  590. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  591. package/build-types/confirm-dialog/types.d.ts +2 -0
  592. package/build-types/confirm-dialog/types.d.ts.map +1 -1
  593. package/build-types/divider/component.d.ts +2 -2
  594. package/build-types/divider/component.d.ts.map +1 -1
  595. package/build-types/divider/stories/index.d.ts +10 -0
  596. package/build-types/divider/stories/index.d.ts.map +1 -0
  597. package/build-types/divider/types.d.ts +1 -1
  598. package/build-types/divider/types.d.ts.map +1 -1
  599. package/build-types/elevation/hook.d.ts +2 -1
  600. package/build-types/elevation/hook.d.ts.map +1 -1
  601. package/build-types/flex/flex/hook.d.ts +2 -1
  602. package/build-types/flex/flex/hook.d.ts.map +1 -1
  603. package/build-types/flex/flex-block/hook.d.ts +2 -1
  604. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  605. package/build-types/flex/flex-item/hook.d.ts +2 -1
  606. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  607. package/build-types/flyout/flyout/hook.d.ts +2 -2
  608. package/build-types/grid/hook.d.ts +2 -1
  609. package/build-types/grid/hook.d.ts.map +1 -1
  610. package/build-types/h-stack/hook.d.ts +3 -2
  611. package/build-types/h-stack/hook.d.ts.map +1 -1
  612. package/build-types/heading/component.d.ts +3 -3
  613. package/build-types/heading/component.d.ts.map +1 -1
  614. package/build-types/heading/hook.d.ts +2 -1
  615. package/build-types/heading/hook.d.ts.map +1 -1
  616. package/build-types/heading/stories/index.d.ts +12 -0
  617. package/build-types/heading/stories/index.d.ts.map +1 -0
  618. package/build-types/input-control/index.d.ts +3 -3
  619. package/build-types/input-control/index.d.ts.map +1 -1
  620. package/build-types/input-control/input-base.d.ts +2 -2
  621. package/build-types/input-control/input-base.d.ts.map +1 -1
  622. package/build-types/input-control/input-field.d.ts +1 -3
  623. package/build-types/input-control/input-field.d.ts.map +1 -1
  624. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  625. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  626. package/build-types/input-control/types.d.ts +1 -1
  627. package/build-types/input-control/types.d.ts.map +1 -1
  628. package/build-types/item-group/item/hook.d.ts +2 -1
  629. package/build-types/item-group/item/hook.d.ts.map +1 -1
  630. package/build-types/item-group/item-group/hook.d.ts +2 -1
  631. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  632. package/build-types/navigator/index.d.ts +2 -0
  633. package/build-types/navigator/index.d.ts.map +1 -1
  634. package/build-types/navigator/navigator-back-button/component.d.ts +38 -0
  635. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -0
  636. package/build-types/navigator/navigator-back-button/hook.d.ts +283 -0
  637. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -0
  638. package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
  639. package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
  640. package/build-types/navigator/navigator-button/component.d.ts +37 -0
  641. package/build-types/navigator/navigator-button/component.d.ts.map +1 -0
  642. package/build-types/navigator/navigator-button/hook.d.ts +283 -0
  643. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -0
  644. package/build-types/navigator/navigator-button/index.d.ts +2 -0
  645. package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
  646. package/build-types/navigator/navigator-provider/component.d.ts +10 -20
  647. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  648. package/build-types/navigator/navigator-screen/component.d.ts +10 -20
  649. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  650. package/build-types/navigator/types.d.ts +21 -0
  651. package/build-types/navigator/types.d.ts.map +1 -1
  652. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  653. package/build-types/resizable-box/index.d.ts +2 -2
  654. package/build-types/resizable-box/index.d.ts.map +1 -1
  655. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  656. package/build-types/scrollable/hook.d.ts +2 -1
  657. package/build-types/scrollable/hook.d.ts.map +1 -1
  658. package/build-types/select-control/index.d.ts +1 -3
  659. package/build-types/select-control/index.d.ts.map +1 -1
  660. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  661. package/build-types/spacer/hook.d.ts +2 -1
  662. package/build-types/spacer/hook.d.ts.map +1 -1
  663. package/build-types/surface/hook.d.ts +2 -1
  664. package/build-types/surface/hook.d.ts.map +1 -1
  665. package/build-types/text/hook.d.ts +2 -1
  666. package/build-types/text/hook.d.ts.map +1 -1
  667. package/build-types/text/types.d.ts +1 -2
  668. package/build-types/text/types.d.ts.map +1 -1
  669. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  670. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts +0 -4
  671. package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +1 -1
  672. package/build-types/tools-panel/tools-panel/hook.d.ts +2 -1
  673. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  674. package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
  675. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  676. package/build-types/tools-panel/tools-panel-item/hook.d.ts +2 -1
  677. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  678. package/build-types/truncate/hook.d.ts +2 -1
  679. package/build-types/truncate/hook.d.ts.map +1 -1
  680. package/build-types/ui/context/context-connect.d.ts +18 -16
  681. package/build-types/ui/context/context-connect.d.ts.map +1 -1
  682. package/build-types/ui/context/index.d.ts +4 -4
  683. package/build-types/ui/context/index.d.ts.map +1 -1
  684. package/build-types/ui/context/wordpress-component.d.ts +3 -6
  685. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  686. package/build-types/ui/control-group/hook.d.ts +2 -1
  687. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  688. package/build-types/ui/control-label/hook.d.ts +2 -1
  689. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  690. package/build-types/ui/form-group/use-form-group.d.ts +6 -4
  691. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  692. package/build-types/unit-control/index.d.ts +3 -5
  693. package/build-types/unit-control/index.d.ts.map +1 -1
  694. package/build-types/unit-control/types.d.ts +4 -6
  695. package/build-types/unit-control/types.d.ts.map +1 -1
  696. package/build-types/unit-control/utils.d.ts +47 -38
  697. package/build-types/unit-control/utils.d.ts.map +1 -1
  698. package/build-types/v-stack/hook.d.ts +2 -1
  699. package/build-types/v-stack/hook.d.ts.map +1 -1
  700. package/build-types/z-stack/component.d.ts.map +1 -1
  701. package/package.json +19 -18
  702. package/src/alignment-matrix-control/README.md +4 -0
  703. package/src/alignment-matrix-control/stories/index.js +1 -1
  704. package/src/alignment-matrix-control/utils.js +1 -1
  705. package/src/angle-picker-control/angle-circle.js +1 -1
  706. package/src/animation/index.js +0 -1
  707. package/src/autocomplete/get-default-use-items.js +3 -3
  708. package/src/base-control/stories/index.js +65 -22
  709. package/src/base-field/hook.js +1 -1
  710. package/src/box-control/icon.js +1 -1
  711. package/src/box-control/index.js +5 -5
  712. package/src/box-control/stories/index.js +4 -1
  713. package/src/box-control/test/index.js +27 -7
  714. package/src/box-control/unit-control.js +1 -1
  715. package/src/box-control/utils.js +13 -9
  716. package/src/button/index.js +5 -5
  717. package/src/button/index.native.js +7 -7
  718. package/src/button/style.scss +1 -0
  719. package/src/card/card/component.js +1 -1
  720. package/src/card/card-body/component.js +1 -1
  721. package/src/card/card-divider/component.js +1 -1
  722. package/src/card/card-footer/component.js +1 -1
  723. package/src/card/card-header/component.js +1 -1
  724. package/src/card/card-media/component.js +1 -1
  725. package/src/color-palette/index.native.js +92 -75
  726. package/src/color-palette/style.native.scss +10 -5
  727. package/src/color-palette/style.scss +1 -0
  728. package/src/color-picker/color-display.tsx +1 -1
  729. package/src/color-picker/component.tsx +2 -2
  730. package/src/color-picker/hex-input.tsx +9 -9
  731. package/src/color-picker/styles.ts +1 -1
  732. package/src/color-picker/test/index.js +1 -1
  733. package/src/combobox-control/index.js +1 -1
  734. package/src/combobox-control/style.scss +1 -0
  735. package/src/confirm-dialog/README.md +56 -45
  736. package/src/confirm-dialog/component.tsx +6 -4
  737. package/src/confirm-dialog/stories/index.js +19 -0
  738. package/src/confirm-dialog/test/index.js +28 -0
  739. package/src/confirm-dialog/types.ts +2 -0
  740. package/src/date-time/style.scss +4 -0
  741. package/src/date-time/time.js +16 -5
  742. package/src/dimension-control/test/index.test.js +1 -1
  743. package/src/disabled/test/index.js +1 -1
  744. package/src/divider/component.tsx +5 -5
  745. package/src/divider/stories/index.tsx +70 -0
  746. package/src/divider/types.ts +3 -1
  747. package/src/draggable/index.js +3 -3
  748. package/src/draggable/stories/index.js +1 -1
  749. package/src/elevation/component.js +1 -1
  750. package/src/flex/flex/component.js +1 -1
  751. package/src/flex/flex-block/component.js +1 -1
  752. package/src/flex/flex-item/component.js +1 -1
  753. package/src/flyout/flyout/README.md +1 -1
  754. package/src/flyout/flyout/component.js +1 -1
  755. package/src/flyout/flyout-content/component.js +1 -1
  756. package/src/flyout/test/index.js +1 -1
  757. package/src/focal-point-picker/README.md +7 -0
  758. package/src/focal-point-picker/index.js +12 -7
  759. package/src/focal-point-picker/index.native.js +7 -7
  760. package/src/focal-point-picker/stories/index.js +30 -0
  761. package/src/focal-point-picker/test/index.js +44 -0
  762. package/src/focal-point-picker/tooltip/index.native.js +1 -1
  763. package/src/font-size-picker/README.md +1 -2
  764. package/src/font-size-picker/index.js +1 -2
  765. package/src/font-size-picker/stories/index.js +87 -108
  766. package/src/font-size-picker/test/index.js +0 -2
  767. package/src/form-file-upload/README.md +1 -1
  768. package/src/form-file-upload/stories/index.js +51 -0
  769. package/src/form-token-field/index.js +6 -6
  770. package/src/form-token-field/style.scss +1 -0
  771. package/src/form-token-field/suggestions-list.js +2 -2
  772. package/src/form-token-field/test/index.js +6 -6
  773. package/src/grid/component.js +1 -1
  774. package/src/h-stack/component.js +1 -1
  775. package/src/heading/component.tsx +6 -6
  776. package/src/heading/hook.ts +1 -1
  777. package/src/heading/stories/index.tsx +37 -0
  778. package/src/higher-order/with-filters/test/index.js +1 -1
  779. package/src/higher-order/with-focus-outside/test/index.js +1 -1
  780. package/src/higher-order/with-notices/index.js +1 -1
  781. package/src/higher-order/with-notices/test/index.js +3 -3
  782. package/src/index.js +6 -4
  783. package/src/index.native.js +9 -5
  784. package/src/input-control/index.tsx +2 -2
  785. package/src/input-control/input-base.tsx +3 -3
  786. package/src/input-control/input-field.tsx +16 -15
  787. package/src/input-control/reducer/reducer.ts +3 -0
  788. package/src/input-control/stories/index.js +1 -1
  789. package/src/input-control/styles/input-control-styles.tsx +1 -0
  790. package/src/input-control/test/index.js +4 -4
  791. package/src/input-control/types.ts +1 -1
  792. package/src/isolated-event-container/index.js +1 -1
  793. package/src/item-group/item/component.tsx +2 -2
  794. package/src/item-group/item-group/component.tsx +2 -2
  795. package/src/item-group/test/index.js +0 -1
  796. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +4 -4
  797. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -1
  798. package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +10 -1
  799. package/src/mobile/bottom-sheet/cell.native.js +1 -1
  800. package/src/mobile/bottom-sheet/index.native.js +11 -11
  801. package/src/mobile/bottom-sheet/link-cell.native.js +1 -1
  802. package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +1 -1
  803. package/src/mobile/bottom-sheet/nav-bar/back-button.native.js +1 -1
  804. package/src/mobile/color-settings/palette.screen.native.js +39 -9
  805. package/src/mobile/color-settings/style.native.scss +4 -0
  806. package/src/mobile/global-styles-context/test/fixtures/theme.native.js +27 -0
  807. package/src/mobile/global-styles-context/test/utils.native.js +2 -2
  808. package/src/mobile/global-styles-context/utils.native.js +85 -16
  809. package/src/mobile/gradient/index.native.js +2 -2
  810. package/src/mobile/html-text-input/container.ios.js +3 -3
  811. package/src/mobile/html-text-input/index.native.js +1 -1
  812. package/src/mobile/html-text-input/test/index.native.js +14 -14
  813. package/src/mobile/image/index.native.js +1 -1
  814. package/src/mobile/image/style.native.scss +1 -0
  815. package/src/mobile/inserter-button/index.native.js +1 -2
  816. package/src/mobile/inserter-button/sparkles.js +15 -0
  817. package/src/mobile/keyboard-aware-flat-list/index.android.js +1 -1
  818. package/src/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
  819. package/src/mobile/link-picker/index.native.js +3 -3
  820. package/src/mobile/link-picker/link-picker-results.native.js +8 -8
  821. package/src/mobile/link-settings/image-link-destinations-screen.native.js +2 -2
  822. package/src/mobile/link-settings/index.native.js +1 -2
  823. package/src/mobile/link-settings/test/edit.native.js +15 -15
  824. package/src/modal/aria-helper.js +1 -1
  825. package/src/modal/index.js +2 -2
  826. package/src/navigable-container/container.js +2 -2
  827. package/src/navigable-container/tabbable.js +1 -1
  828. package/src/navigable-container/test/menu.js +5 -5
  829. package/src/navigable-container/test/tabbable.js +2 -2
  830. package/src/navigation/item/index.js +1 -1
  831. package/src/navigation/menu/index.js +1 -1
  832. package/src/navigation/stories/controlled-state.js +2 -2
  833. package/src/navigation/stories/index.js +1 -1
  834. package/src/navigator/index.ts +2 -0
  835. package/src/navigator/navigator-back-button/README.md +31 -0
  836. package/src/navigator/navigator-back-button/component.tsx +62 -0
  837. package/src/navigator/navigator-back-button/hook.ts +40 -0
  838. package/src/navigator/navigator-back-button/index.ts +1 -0
  839. package/src/navigator/navigator-button/README.md +38 -0
  840. package/src/navigator/navigator-button/component.tsx +61 -0
  841. package/src/navigator/navigator-button/hook.ts +55 -0
  842. package/src/navigator/navigator-button/index.ts +1 -0
  843. package/src/navigator/navigator-provider/README.md +20 -33
  844. package/src/navigator/navigator-provider/component.tsx +13 -23
  845. package/src/navigator/navigator-screen/README.md +1 -1
  846. package/src/navigator/navigator-screen/component.tsx +16 -25
  847. package/src/navigator/stories/index.js +24 -37
  848. package/src/navigator/test/index.js +105 -51
  849. package/src/navigator/types.ts +27 -1
  850. package/src/number-control/index.js +1 -1
  851. package/src/number-control/stories/index.js +1 -1
  852. package/src/panel/body.js +2 -2
  853. package/src/popover/index.js +3 -3
  854. package/src/popover/utils.js +6 -6
  855. package/src/radio/stories/index.js +1 -1
  856. package/src/radio-group/index.js +1 -1
  857. package/src/radio-group/stories/index.js +4 -1
  858. package/src/range-control/stories/index.js +1 -1
  859. package/src/range-control/styles/range-control-styles.js +1 -1
  860. package/src/range-control/test/index.js +2 -2
  861. package/src/resizable-box/index.tsx +2 -2
  862. package/src/resizable-box/resize-tooltip/index.tsx +2 -2
  863. package/src/resizable-box/resize-tooltip/label.tsx +2 -2
  864. package/src/sandbox/index.js +5 -5
  865. package/src/sandbox/index.native.js +1 -1
  866. package/src/scrollable/component.js +1 -1
  867. package/src/select-control/index.tsx +3 -4
  868. package/src/select-control/styles/select-control-styles.ts +1 -0
  869. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  870. package/src/slot-fill/bubbles-virtually/slot.js +1 -2
  871. package/src/slot-fill/fill.js +1 -1
  872. package/src/slot-fill/provider.js +1 -1
  873. package/src/snackbar/index.js +1 -1
  874. package/src/snackbar/list.js +1 -1
  875. package/src/spacer/component.tsx +2 -2
  876. package/src/style-provider/index.js +2 -2
  877. package/src/surface/component.js +1 -1
  878. package/src/tab-panel/test/index.js +1 -1
  879. package/src/text/component.js +1 -1
  880. package/src/text/test/index.js +2 -2
  881. package/src/text/types.ts +6 -8
  882. package/src/text-control/index.js +2 -2
  883. package/src/text-highlight/test/index.js +4 -4
  884. package/src/toggle-control/test/index.js +3 -3
  885. package/src/toggle-group-control/stories/index.js +1 -1
  886. package/src/toggle-group-control/test/__snapshots__/index.js.snap +1 -27
  887. package/src/toggle-group-control/toggle-group-control/component.tsx +4 -4
  888. package/src/toggle-group-control/toggle-group-control-option/component.tsx +3 -6
  889. package/src/toggle-group-control/toggle-group-control-option/styles.ts +1 -12
  890. package/src/toolbar/index.js +1 -1
  891. package/src/toolbar-group/test/index.js +2 -2
  892. package/src/tools-panel/stories/index.js +0 -1
  893. package/src/tools-panel/tools-panel/component.tsx +2 -2
  894. package/src/tools-panel/tools-panel-header/component.tsx +2 -2
  895. package/src/tools-panel/tools-panel-item/component.tsx +2 -2
  896. package/src/tooltip/index.js +3 -3
  897. package/src/tooltip/index.native.js +7 -7
  898. package/src/tooltip/test/index.js +2 -2
  899. package/src/tooltip/test/index.native.js +2 -2
  900. package/src/tree-grid/README.md +24 -1
  901. package/src/tree-grid/index.js +70 -7
  902. package/src/tree-grid/stories/index.js +4 -1
  903. package/src/tree-grid/test/__snapshots__/index.js.snap +1 -14
  904. package/src/tree-grid/test/index.js +303 -8
  905. package/src/truncate/component.js +1 -1
  906. package/src/truncate/utils.js +1 -1
  907. package/src/ui/context/{context-connect.js → context-connect.ts} +27 -16
  908. package/src/ui/context/context-system-provider.js +2 -2
  909. package/src/ui/context/{index.js → index.ts} +0 -0
  910. package/src/ui/context/wordpress-component.ts +3 -2
  911. package/src/ui/control-group/component.js +1 -1
  912. package/src/ui/control-label/component.js +1 -1
  913. package/src/ui/form-group/form-group.js +1 -1
  914. package/src/ui/shortcut/component.tsx +2 -2
  915. package/src/ui/spinner/component.js +1 -1
  916. package/src/ui/tooltip/component.js +1 -1
  917. package/src/ui/tooltip/content.js +1 -1
  918. package/src/ui/tooltip/test/index.js +4 -4
  919. package/src/ui/utils/colors.js +2 -2
  920. package/src/ui/utils/space.ts +2 -2
  921. package/src/unit-control/README.md +1 -1
  922. package/src/unit-control/index.native.js +5 -3
  923. package/src/unit-control/index.tsx +66 -37
  924. package/src/unit-control/stories/index.js +1 -1
  925. package/src/unit-control/test/index.js +102 -3
  926. package/src/unit-control/test/utils.js +56 -15
  927. package/src/unit-control/types.ts +5 -8
  928. package/src/unit-control/unit-select-control.tsx +1 -1
  929. package/src/unit-control/utils.ts +128 -125
  930. package/src/utils/breakpoint-values.js +1 -1
  931. package/src/utils/colors-values.js +1 -1
  932. package/src/utils/hooks/test/use-controlled-state.js +1 -1
  933. package/src/utils/hooks/test/use-controlled-value.js +3 -3
  934. package/src/utils/hooks/test/use-latest-ref.js +1 -1
  935. package/src/utils/test/math.js +2 -2
  936. package/src/utils/test/rtl.js +12 -12
  937. package/src/v-stack/component.js +1 -1
  938. package/src/visually-hidden/component.js +1 -1
  939. package/src/z-stack/component.tsx +2 -2
  940. package/tsconfig.json +1 -1
  941. package/tsconfig.tsbuildinfo +1 -1
  942. package/src/divider/stories/index.js +0 -64
  943. package/src/heading/stories/index.js +0 -24
  944. package/src/tools-panel/stories/typography-panel.js +0 -215
@@ -11,7 +11,7 @@ import { includes } from 'lodash';
11
11
 
12
12
  import { focus } from '@wordpress/dom';
13
13
  import { forwardRef, useCallback } from '@wordpress/element';
14
- import { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';
14
+ import { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';
15
15
  /**
16
16
  * Internal dependencies
17
17
  */
@@ -47,6 +47,7 @@ function getRowFocusables(rowElement) {
47
47
  * @param {WPElement} props.children Children to be rendered.
48
48
  * @param {Function} props.onExpandRow Callback to fire when row is expanded.
49
49
  * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
50
+ * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
50
51
  * @param {Object} ref A ref to the underlying DOM table element.
51
52
  */
52
53
 
@@ -56,6 +57,7 @@ function TreeGrid(_ref, ref) {
56
57
  children,
57
58
  onExpandRow = () => {},
58
59
  onCollapseRow = () => {},
60
+ onFocusRow = () => {},
59
61
  ...props
60
62
  } = _ref;
61
63
  const onKeyDown = useCallback(event => {
@@ -63,12 +65,13 @@ function TreeGrid(_ref, ref) {
63
65
  keyCode,
64
66
  metaKey,
65
67
  ctrlKey,
66
- altKey,
67
- shiftKey
68
- } = event;
69
- const hasModifierKeyPressed = metaKey || ctrlKey || altKey || shiftKey;
68
+ altKey
69
+ } = event; // The shift key is intentionally absent from the following list,
70
+ // to enable shift + up/down to select items from the list.
71
+
72
+ const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
70
73
 
71
- if (hasModifierKeyPressed || !includes([UP, DOWN, LEFT, RIGHT], keyCode)) {
74
+ if (hasModifierKeyPressed || !includes([UP, DOWN, LEFT, RIGHT, HOME, END], keyCode)) {
72
75
  return;
73
76
  } // The event will be handled, stop propagation.
74
77
 
@@ -200,12 +203,56 @@ function TreeGrid(_ref, ref) {
200
203
 
201
204
 
202
205
  const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
203
- focusablesInNextRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
206
+ focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
207
+ // and the row that is now in focus.
208
+
209
+ onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
210
+ // doesn't try to handle key navigation.
211
+
212
+ event.preventDefault();
213
+ } else if (includes([HOME, END], keyCode)) {
214
+ // Calculate the rowIndex of the next row.
215
+ const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
216
+ const currentRowIndex = rows.indexOf(activeRow);
217
+ let nextRowIndex;
218
+
219
+ if (keyCode === HOME) {
220
+ nextRowIndex = 0;
221
+ } else {
222
+ nextRowIndex = rows.length - 1;
223
+ } // Focus is either at the top or bottom edge of the grid. Do nothing.
224
+
225
+
226
+ if (nextRowIndex === currentRowIndex) {
227
+ // Prevent key use for anything else. For example, Voiceover
228
+ // will start navigating horizontally when reaching the vertical
229
+ // bounds of a table.
230
+ event.preventDefault();
231
+ return;
232
+ } // Get the focusables in the next row.
233
+
234
+
235
+ const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
236
+
237
+ if (!focusablesInNextRow || !focusablesInNextRow.length) {
238
+ // Prevent key use for anything else. For example, Voiceover
239
+ // will still focus text when using arrow keys, while this
240
+ // component should limit navigation to focusables.
241
+ event.preventDefault();
242
+ return;
243
+ } // Try to focus the element in the next row that's at a similar column to the activeElement.
244
+
245
+
246
+ const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
247
+ focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
248
+ // and the row that is now in focus.
249
+
250
+ onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
204
251
  // doesn't try to handle key navigation.
205
252
 
206
253
  event.preventDefault();
207
254
  }
208
- }, [onExpandRow, onCollapseRow]);
255
+ }, [onExpandRow, onCollapseRow, onFocusRow]);
209
256
  /* Disable reason: A treegrid is implemented using a table element. */
210
257
 
211
258
  /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/index.js"],"names":["includes","focus","forwardRef","useCallback","UP","DOWN","LEFT","RIGHT","RovingTabIndexContainer","getRowFocusables","rowElement","focusablesInRow","focusable","find","sequential","length","filter","closest","TreeGrid","ref","children","onExpandRow","onCollapseRow","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","shiftKey","hasModifierKeyPressed","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","focusableItems","nextRowIndex","focusablesInNextRow","default","TreeGridRow","TreeGridCell","TreeGridItem"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,oBAAxC;AACA,SAASC,EAAT,EAAaC,IAAb,EAAmBC,IAAnB,EAAyBC,KAAzB,QAAsC,qBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,oBAApC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,UAA3B,EAAwC;AACvC,QAAMC,eAAe,GAAGV,KAAK,CAACW,SAAN,CAAgBC,IAAhB,CAAsBH,UAAtB,EAAkC;AACzDI,IAAAA,UAAU,EAAE;AAD6C,GAAlC,CAAxB;;AAIA,MAAK,CAAEH,eAAF,IAAqB,CAAEA,eAAe,CAACI,MAA5C,EAAqD;AACpD;AACA;;AAED,SAAOJ,eAAe,CAACK,MAAhB,CAA0BJ,SAAF,IAAiB;AAC/C,WAAOA,SAAS,CAACK,OAAV,CAAmB,cAAnB,MAAwCP,UAA/C;AACA,GAFM,CAAP;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASQ,QAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,WAAW,GAAG,MAAM,CAAE,CAAlC;AAAoCC,IAAAA,aAAa,GAAG,MAAM,CAAE,CAA5D;AAA8D,OAAGC;AAAjE,GAEC;AACD,QAAMC,SAAS,GAAGrB,WAAW,CAC1BsB,K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,eAAtB,EAAwC;AACvC;AACA;AACA;AACA/B,QAAAA,KAAK,CAACuB,cAAN;AACA;AACA,OAxB8C,CA0B/C;;;AACA,YAAMY,mBAAmB,GAAGnD,gBAAgB,CAC3C0C,IAAI,CAAEQ,YAAF,CADuC,CAA5C,CA3B+C,CA+B/C;;AACA,UAAK,CAAEC,mBAAF,IAAyB,CAAEA,mBAAmB,CAAC7C,MAApD,EAA6D;AAC5D;AACA;AACA;AACAU,QAAAA,KAAK,CAACuB,cAAN;AACA;AACA,OAtC8C,CAwC/C;;;AACA,YAAMJ,SAAS,GAAGC,IAAI,CAACE,GAAL,CACjBR,kBADiB,EAEjBqB,mBAAmB,CAAC7C,MAApB,GAA6B,CAFZ,CAAlB;AAIA6C,MAAAA,mBAAmB,CAAEhB,SAAF,CAAnB,CAAiC3C,KAAjC,GA7C+C,CA+C/C;AACA;;AACAwB,MAAAA,KAAK,CAACuB,cAAN;AACA;AACD,GAzK2B,EA0K5B,CAAE3B,WAAF,EAAeC,aAAf,CA1K4B,CAA7B;AA6KA;;AACA;;AACA,SACC,cAAC,uBAAD,QACC,oCACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGL;AAJP,MAMC,6BAASC,QAAT,CAND,CADD,CADD;AAYA;AACA;;AAED,eAAelB,UAAU,CAAEgB,QAAF,CAAzB;AACA,SAAS2C,OAAO,IAAIC,WAApB,QAAuC,OAAvC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,QAAxC;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,QAAxC","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param {Element} rowElement The DOM element representing the row.\n *\n * @return {?Array} The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\n\t} );\n\n\tif ( ! focusablesInRow || ! focusablesInRow.length ) {\n\t\treturn;\n\t}\n\n\treturn focusablesInRow.filter( ( focusable ) => {\n\t\treturn focusable.closest( '[role=\"row\"]' ) === rowElement;\n\t} );\n}\n\n/**\n * Renders both a table and tbody element, used to create a tree hierarchy.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered.\n * @param {Function} props.onExpandRow Callback to fire when row is expanded.\n * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.\n * @param {Object} ref A ref to the underlying DOM table element.\n */\nfunction TreeGrid(\n\t{ children, onExpandRow = () => {}, onCollapseRow = () => {}, ...props },\n\tref\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey, shiftKey } = event;\n\n\t\t\tconst hasModifierKeyPressed =\n\t\t\t\tmetaKey || ctrlKey || altKey || shiftKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! includes( [ UP, DOWN, LEFT, RIGHT ], keyCode )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The event will be handled, stop propagation.\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst { activeElement } = document;\n\t\t\tconst { currentTarget: treeGridElement } = event;\n\t\t\tif ( ! treeGridElement.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Calculate the columnIndex of the active element.\n\t\t\tconst activeRow = activeElement.closest( '[role=\"row\"]' );\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf( activeElement );\n\t\t\tconst canExpandCollapse = 0 === currentColumnIndex;\n\t\t\tconst cannotFocusNextColumn =\n\t\t\t\tcanExpandCollapse &&\n\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'false' &&\n\t\t\t\tkeyCode === RIGHT;\n\n\t\t\tif ( includes( [ LEFT, RIGHT ], keyCode ) ) {\n\t\t\t\t// Calculate to the next element.\n\t\t\t\tlet nextIndex;\n\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\tnextIndex = Math.max( 0, currentColumnIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextIndex = Math.min(\n\t\t\t\t\t\tcurrentColumnIndex + 1,\n\t\t\t\t\t\tfocusablesInRow.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is at the left most column.\n\t\t\t\tif ( canExpandCollapse ) {\n\t\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\t\t// Left:\n\t\t\t\t\t\t// If a row is focused, and it is expanded, collapses the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'true'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonCollapseRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, moves to the parent row (if there is one).\n\t\t\t\t\t\tconst level = Math.max(\n\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\tactiveRow?.getAttribute( 'aria-level' ) ?? 1,\n\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t) - 1,\n\t\t\t\t\t\t\t1\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst rows = Array.from(\n\t\t\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet parentRow = activeRow;\n\t\t\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\t\t\tfor ( let i = currentRowIndex; i >= 0; i-- ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' ),\n\t\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t\t) === level\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tparentRow = rows[ i ];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetRowFocusables( parentRow )?.[ 0 ]?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( keyCode === RIGHT ) {\n\t\t\t\t\t\t// Right:\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, expands the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\t\t\t\t\t\t'false'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonExpandRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is expanded, focuses the rightmost cell in the row.\n\t\t\t\t\t\tconst focusableItems = getRowFocusables( activeRow );\n\t\t\t\t\t\tif ( focusableItems.length > 0 ) {\n\t\t\t\t\t\t\tfocusableItems[\n\t\t\t\t\t\t\t\tfocusableItems.length - 1\n\t\t\t\t\t\t\t]?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start reading text on continued use of left/right arrow\n\t\t\t\t\t// keys.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.\n\t\t\t\tif ( cannotFocusNextColumn ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfocusablesInRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( includes( [ UP, DOWN ], keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === UP ) {\n\t\t\t\t\tnextRowIndex = Math.max( 0, currentRowIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = Math.min(\n\t\t\t\t\t\tcurrentRowIndex + 1,\n\t\t\t\t\t\trows.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ onExpandRow, onCollapseRow ]\n\t);\n\n\t/* Disable reason: A treegrid is implemented using a table element. */\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<RovingTabIndexContainer>\n\t\t\t<table\n\t\t\t\t{ ...props }\n\t\t\t\trole=\"treegrid\"\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t</table>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( TreeGrid );\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/index.js"],"names":["includes","focus","forwardRef","useCallback","UP","DOWN","LEFT","RIGHT","HOME","END","RovingTabIndexContainer","getRowFocusables","rowElement","focusablesInRow","focusable","find","sequential","length","filter","closest","TreeGrid","ref","children","onExpandRow","onCollapseRow","onFocusRow","props","onKeyDown","event","keyCode","metaKey","ctrlKey","altKey","hasModifierKeyPressed","stopPropagation","activeElement","document","currentTarget","treeGridElement","contains","activeRow","currentColumnIndex","indexOf","canExpandCollapse","cannotFocusNextColumn","getAttribute","nextIndex","Math","max","min","preventDefault","level","parseInt","rows","Array","from","querySelectorAll","parentRow","currentRowIndex","i","focusableItems","nextRowIndex","focusablesInNextRow","default","TreeGridRow","TreeGridCell","TreeGridItem"],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EC,mBAAF,IAAyB,CAAEA,mBAAmB,CAAC7C,MAApD,EAA6D;AAC5D;AACA;AACA;AACAW,QAAAA,KAAK,CAACsB,cAAN;AACA;AACA,OAnC+C,CAqChD;;;AACA,YAAMJ,SAAS,GAAGC,IAAI,CAACE,GAAL,CACjBR,kBADiB,EAEjBqB,mBAAmB,CAAC7C,MAApB,GAA6B,CAFZ,CAAlB;AAIA6C,MAAAA,mBAAmB,CAAEhB,SAAF,CAAnB,CAAiC7C,KAAjC,GA1CgD,CA4ChD;AACA;;AACAwB,MAAAA,UAAU,CAAEG,KAAF,EAASY,SAAT,EAAoBa,IAAI,CAAEQ,YAAF,CAAxB,CAAV,CA9CgD,CAgDhD;AACA;;AACAjC,MAAAA,KAAK,CAACsB,cAAN;AACA;AACD,GAjO2B,EAkO5B,CAAE3B,WAAF,EAAeC,aAAf,EAA8BC,UAA9B,CAlO4B,CAA7B;AAqOA;;AACA;;AACA,SACC,cAAC,uBAAD,QACC,oCACMC,KADN;AAEC,IAAA,IAAI,EAAC,UAFN;AAGC,IAAA,SAAS,EAAGC,SAHb;AAIC,IAAA,GAAG,EAAGN;AAJP,MAMC,6BAASC,QAAT,CAND,CADD,CADD;AAYA;AACA;;AAED,eAAepB,UAAU,CAAEkB,QAAF,CAAzB;AACA,SAAS2C,OAAO,IAAIC,WAApB,QAAuC,OAAvC;AACA,SAASD,OAAO,IAAIE,YAApB,QAAwC,QAAxC;AACA,SAASF,OAAO,IAAIG,YAApB,QAAwC,QAAxC","sourcesContent":["/**\n * External dependencies\n */\nimport { includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport { forwardRef, useCallback } from '@wordpress/element';\nimport { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport RovingTabIndexContainer from './roving-tab-index';\n\n/**\n * Return focusables in a row element, excluding those from other branches\n * nested within the row.\n *\n * @param {Element} rowElement The DOM element representing the row.\n *\n * @return {?Array} The array of focusables in the row.\n */\nfunction getRowFocusables( rowElement ) {\n\tconst focusablesInRow = focus.focusable.find( rowElement, {\n\t\tsequential: true,\n\t} );\n\n\tif ( ! focusablesInRow || ! focusablesInRow.length ) {\n\t\treturn;\n\t}\n\n\treturn focusablesInRow.filter( ( focusable ) => {\n\t\treturn focusable.closest( '[role=\"row\"]' ) === rowElement;\n\t} );\n}\n\n/**\n * Renders both a table and tbody element, used to create a tree hierarchy.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered.\n * @param {Function} props.onExpandRow Callback to fire when row is expanded.\n * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.\n * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.\n * @param {Object} ref A ref to the underlying DOM table element.\n */\nfunction TreeGrid(\n\t{\n\t\tchildren,\n\t\tonExpandRow = () => {},\n\t\tonCollapseRow = () => {},\n\t\tonFocusRow = () => {},\n\t\t...props\n\t},\n\tref\n) {\n\tconst onKeyDown = useCallback(\n\t\t( event ) => {\n\t\t\tconst { keyCode, metaKey, ctrlKey, altKey } = event;\n\n\t\t\t// The shift key is intentionally absent from the following list,\n\t\t\t// to enable shift + up/down to select items from the list.\n\t\t\tconst hasModifierKeyPressed = metaKey || ctrlKey || altKey;\n\n\t\t\tif (\n\t\t\t\thasModifierKeyPressed ||\n\t\t\t\t! includes( [ UP, DOWN, LEFT, RIGHT, HOME, END ], keyCode )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// The event will be handled, stop propagation.\n\t\t\tevent.stopPropagation();\n\n\t\t\tconst { activeElement } = document;\n\t\t\tconst { currentTarget: treeGridElement } = event;\n\t\t\tif ( ! treeGridElement.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Calculate the columnIndex of the active element.\n\t\t\tconst activeRow = activeElement.closest( '[role=\"row\"]' );\n\t\t\tconst focusablesInRow = getRowFocusables( activeRow );\n\t\t\tconst currentColumnIndex = focusablesInRow.indexOf( activeElement );\n\t\t\tconst canExpandCollapse = 0 === currentColumnIndex;\n\t\t\tconst cannotFocusNextColumn =\n\t\t\t\tcanExpandCollapse &&\n\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'false' &&\n\t\t\t\tkeyCode === RIGHT;\n\n\t\t\tif ( includes( [ LEFT, RIGHT ], keyCode ) ) {\n\t\t\t\t// Calculate to the next element.\n\t\t\t\tlet nextIndex;\n\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\tnextIndex = Math.max( 0, currentColumnIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextIndex = Math.min(\n\t\t\t\t\t\tcurrentColumnIndex + 1,\n\t\t\t\t\t\tfocusablesInRow.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is at the left most column.\n\t\t\t\tif ( canExpandCollapse ) {\n\t\t\t\t\tif ( keyCode === LEFT ) {\n\t\t\t\t\t\t// Left:\n\t\t\t\t\t\t// If a row is focused, and it is expanded, collapses the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) === 'true'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonCollapseRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, moves to the parent row (if there is one).\n\t\t\t\t\t\tconst level = Math.max(\n\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\tactiveRow?.getAttribute( 'aria-level' ) ?? 1,\n\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t) - 1,\n\t\t\t\t\t\t\t1\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst rows = Array.from(\n\t\t\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlet parentRow = activeRow;\n\t\t\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\t\t\tfor ( let i = currentRowIndex; i >= 0; i-- ) {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tparseInt(\n\t\t\t\t\t\t\t\t\trows[ i ].getAttribute( 'aria-level' ),\n\t\t\t\t\t\t\t\t\t10\n\t\t\t\t\t\t\t\t) === level\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tparentRow = rows[ i ];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetRowFocusables( parentRow )?.[ 0 ]?.focus();\n\t\t\t\t\t}\n\t\t\t\t\tif ( keyCode === RIGHT ) {\n\t\t\t\t\t\t// Right:\n\t\t\t\t\t\t// If a row is focused, and it is collapsed, expands the current row.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tactiveRow.getAttribute( 'aria-expanded' ) ===\n\t\t\t\t\t\t\t'false'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonExpandRow( activeRow );\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If a row is focused, and it is expanded, focuses the rightmost cell in the row.\n\t\t\t\t\t\tconst focusableItems = getRowFocusables( activeRow );\n\t\t\t\t\t\tif ( focusableItems.length > 0 ) {\n\t\t\t\t\t\t\tfocusableItems[\n\t\t\t\t\t\t\t\tfocusableItems.length - 1\n\t\t\t\t\t\t\t]?.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start reading text on continued use of left/right arrow\n\t\t\t\t\t// keys.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Focus the next element. If at most left column and row is collapsed, moving right is not allowed as this will expand. However, if row is collapsed, moving left is allowed.\n\t\t\t\tif ( cannotFocusNextColumn ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfocusablesInRow[ nextIndex ].focus();\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( includes( [ UP, DOWN ], keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === UP ) {\n\t\t\t\t\tnextRowIndex = Math.max( 0, currentRowIndex - 1 );\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = Math.min(\n\t\t\t\t\t\tcurrentRowIndex + 1,\n\t\t\t\t\t\trows.length - 1\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t} else if ( includes( [ HOME, END ], keyCode ) ) {\n\t\t\t\t// Calculate the rowIndex of the next row.\n\t\t\t\tconst rows = Array.from(\n\t\t\t\t\ttreeGridElement.querySelectorAll( '[role=\"row\"]' )\n\t\t\t\t);\n\t\t\t\tconst currentRowIndex = rows.indexOf( activeRow );\n\t\t\t\tlet nextRowIndex;\n\n\t\t\t\tif ( keyCode === HOME ) {\n\t\t\t\t\tnextRowIndex = 0;\n\t\t\t\t} else {\n\t\t\t\t\tnextRowIndex = rows.length - 1;\n\t\t\t\t}\n\n\t\t\t\t// Focus is either at the top or bottom edge of the grid. Do nothing.\n\t\t\t\tif ( nextRowIndex === currentRowIndex ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will start navigating horizontally when reaching the vertical\n\t\t\t\t\t// bounds of a table.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Get the focusables in the next row.\n\t\t\t\tconst focusablesInNextRow = getRowFocusables(\n\t\t\t\t\trows[ nextRowIndex ]\n\t\t\t\t);\n\n\t\t\t\t// If for some reason there are no focusables in the next row, do nothing.\n\t\t\t\tif ( ! focusablesInNextRow || ! focusablesInNextRow.length ) {\n\t\t\t\t\t// Prevent key use for anything else. For example, Voiceover\n\t\t\t\t\t// will still focus text when using arrow keys, while this\n\t\t\t\t\t// component should limit navigation to focusables.\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Try to focus the element in the next row that's at a similar column to the activeElement.\n\t\t\t\tconst nextIndex = Math.min(\n\t\t\t\t\tcurrentColumnIndex,\n\t\t\t\t\tfocusablesInNextRow.length - 1\n\t\t\t\t);\n\t\t\t\tfocusablesInNextRow[ nextIndex ].focus();\n\n\t\t\t\t// Let consumers know the row that was originally focused,\n\t\t\t\t// and the row that is now in focus.\n\t\t\t\tonFocusRow( event, activeRow, rows[ nextRowIndex ] );\n\n\t\t\t\t// Prevent key use for anything else. This ensures Voiceover\n\t\t\t\t// doesn't try to handle key navigation.\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t},\n\t\t[ onExpandRow, onCollapseRow, onFocusRow ]\n\t);\n\n\t/* Disable reason: A treegrid is implemented using a table element. */\n\t/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */\n\treturn (\n\t\t<RovingTabIndexContainer>\n\t\t\t<table\n\t\t\t\t{ ...props }\n\t\t\t\trole=\"treegrid\"\n\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t<tbody>{ children }</tbody>\n\t\t\t</table>\n\t\t</RovingTabIndexContainer>\n\t);\n\t/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */\n}\n\nexport default forwardRef( TreeGrid );\nexport { default as TreeGridRow } from './row';\nexport { default as TreeGridCell } from './cell';\nexport { default as TreeGridItem } from './item';\n"]}
@@ -9,7 +9,7 @@ import { View } from '../view';
9
9
  import useTruncate from './hook';
10
10
  /**
11
11
  * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
12
- * @param {import('react').Ref<any>} forwardedRef
12
+ * @param {import('react').ForwardedRef<any>} forwardedRef
13
13
  */
14
14
 
15
15
  function Truncate(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/component.js"],"names":["contextConnect","View","useTruncate","Truncate","props","forwardedRef","truncateProps","ConnectedTruncate"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,WAAP,MAAwB,QAAxB;AAEA;AACA;AACA;AACA;;AACA,SAASC,QAAT,CAAmBC,KAAnB,EAA0BC,YAA1B,EAAyC;AACxC,QAAMC,aAAa,GAAGJ,WAAW,CAAEE,KAAF,CAAjC;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,aAArB;AAAqC,IAAA,GAAG,EAAGD;AAA3C,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,iBAAiB,GAAGP,cAAc,CAAEG,QAAF,EAAY,UAAZ,CAAxC;AAEA,eAAeI,iBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport useTruncate from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Truncate( props, forwardedRef ) {\n\tconst truncateProps = useTruncate( props );\n\n\treturn <View as=\"span\" { ...truncateProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Truncate` is a typography primitive that trims text content.\n * For almost all cases, it is recommended that `Text`, `Heading`, or\n * `Subheading` is used to render text content. However,`Truncate` is\n * available for custom implementations.\n *\n * @example\n * ```jsx\n * import { __experimentalTruncate as Truncate } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Truncate>\n * \t\t\tLorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex\n * \t\t\tneque, vulputate a diam et, luctus convallis lacus. Vestibulum ac\n * \t\t\tmollis mi. Morbi id elementum massa.\n * \t\t</Truncate>\n * \t);\n * }\n * ```\n */\nconst ConnectedTruncate = contextConnect( Truncate, 'Truncate' );\n\nexport default ConnectedTruncate;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/component.js"],"names":["contextConnect","View","useTruncate","Truncate","props","forwardedRef","truncateProps","ConnectedTruncate"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,eAA/B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,OAAOC,WAAP,MAAwB,QAAxB;AAEA;AACA;AACA;AACA;;AACA,SAASC,QAAT,CAAmBC,KAAnB,EAA0BC,YAA1B,EAAyC;AACxC,QAAMC,aAAa,GAAGJ,WAAW,CAAEE,KAAF,CAAjC;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAqBE,aAArB;AAAqC,IAAA,GAAG,EAAGD;AAA3C,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,iBAAiB,GAAGP,cAAc,CAAEG,QAAF,EAAY,UAAZ,CAAxC;AAEA,eAAeI,iBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../ui/context';\nimport { View } from '../view';\nimport useTruncate from './hook';\n\n/**\n * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Truncate( props, forwardedRef ) {\n\tconst truncateProps = useTruncate( props );\n\n\treturn <View as=\"span\" { ...truncateProps } ref={ forwardedRef } />;\n}\n\n/**\n * `Truncate` is a typography primitive that trims text content.\n * For almost all cases, it is recommended that `Text`, `Heading`, or\n * `Subheading` is used to render text content. However,`Truncate` is\n * available for custom implementations.\n *\n * @example\n * ```jsx\n * import { __experimentalTruncate as Truncate } from `@wordpress/components`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Truncate>\n * \t\t\tLorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex\n * \t\t\tneque, vulputate a diam et, luctus convallis lacus. Vestibulum ac\n * \t\t\tmollis mi. Morbi id elementum massa.\n * \t\t</Truncate>\n * \t);\n * }\n * ```\n */\nconst ConnectedTruncate = contextConnect( Truncate, 'Truncate' );\n\nexport default ConnectedTruncate;\n"]}
@@ -33,7 +33,7 @@ export function truncateMiddle(word, headLength, tailLength, ellipsis) {
33
33
  const wordLength = word.length; // Setting default values
34
34
  // eslint-disable-next-line no-bitwise
35
35
 
36
- const frontLength = ~~headLength; // will cast to integer
36
+ const frontLength = ~~headLength; // Will cast to integer
37
37
  // eslint-disable-next-line no-bitwise
38
38
 
39
39
  const backLength = ~~tailLength;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/truncate/utils.js"],"names":["isNil","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","auto","head","middle","tail","none","TRUNCATE_DEFAULT_PROPS","ellipsis","ellipsizeMode","limit","numberOfLines","truncateMiddle","word","headLength","tailLength","wordLength","length","frontLength","backLength","truncateStr","slice","truncateContent","words","props","mergedProps","truncateHead","truncateTail","Math","floor","truncatedContent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA,OAAO,MAAMC,iBAAiB,GAAG,GAA1B;AACP,OAAO,MAAMC,aAAa,GAAG;AAC5BC,EAAAA,IAAI,EAAE,MADsB;AAE5BC,EAAAA,IAAI,EAAE,MAFsB;AAG5BC,EAAAA,MAAM,EAAE,QAHoB;AAI5BC,EAAAA,IAAI,EAAE,MAJsB;AAK5BC,EAAAA,IAAI,EAAE;AALsB,CAAtB;AAQP,OAAO,MAAMC,sBAAsB,GAAG;AACrCC,EAAAA,QAAQ,EAAER,iBAD2B;AAErCS,EAAAA,aAAa,EAAER,aAAa,CAACC,IAFQ;AAGrCQ,EAAAA,KAAK,EAAE,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AqCe,WAA3C;;AAEA,MAAKhB,aAAa,KAAKR,aAAa,CAACK,IAArC,EAA4C;AAC3C,WAAOiB,KAAP;AACA;;AAED,MAAIG,YAAJ;AACA,MAAIC,YAAJ;;AAEA,UAASlB,aAAT;AACC,SAAKR,aAAa,CAACE,IAAnB;AACCuB,MAAAA,YAAY,GAAG,CAAf;AACAC,MAAAA,YAAY,GAAGjB,KAAf;AACA;;AACD,SAAKT,aAAa,CAACG,MAAnB;AACCsB,MAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAYnB,KAAK,GAAG,CAApB,CAAf;AACAiB,MAAAA,YAAY,GAAGC,IAAI,CAACC,KAAL,CAAYnB,KAAK,GAAG,CAApB,CAAf;AACA;;AACD;AACCgB,MAAAA,YAAY,GAAGhB,KAAf;AACAiB,MAAAA,YAAY,GAAG,CAAf;AAXF;;AAcA,QAAMG,gBAAgB,GACrBrB,aAAa,KAAKR,aAAa,CAACC,IAAhC,GACGU,cAAc,CAAEW,KAAF,EAASG,YAAT,EAAuBC,YAAvB,EAAqCnB,QAArC,CADjB,GAEGe,KAHJ;AAKA,SAAOO,gBAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isNil } from 'lodash';\n\nexport const TRUNCATE_ELLIPSIS = '…';\nexport const TRUNCATE_TYPE = {\n\tauto: 'auto',\n\thead: 'head',\n\tmiddle: 'middle',\n\ttail: 'tail',\n\tnone: 'none',\n};\n\nexport const TRUNCATE_DEFAULT_PROPS = {\n\tellipsis: TRUNCATE_ELLIPSIS,\n\tellipsizeMode: TRUNCATE_TYPE.auto,\n\tlimit: 0,\n\tnumberOfLines: 0,\n};\n\n// Source\n// https://github.com/kahwee/truncate-middle\n/**\n * @param {string} word\n * @param {number} headLength\n * @param {number} tailLength\n * @param {string} ellipsis\n */\nexport function truncateMiddle( word, headLength, tailLength, ellipsis ) {\n\tif ( typeof word !== 'string' ) {\n\t\treturn '';\n\t}\n\tconst wordLength = word.length;\n\t// Setting default values\n\t// eslint-disable-next-line no-bitwise\n\tconst frontLength = ~~headLength; // will cast to integer\n\t// eslint-disable-next-line no-bitwise\n\tconst backLength = ~~tailLength;\n\t/* istanbul ignore next */\n\tconst truncateStr = ! isNil( ellipsis ) ? ellipsis : TRUNCATE_ELLIPSIS;\n\n\tif (\n\t\t( frontLength === 0 && backLength === 0 ) ||\n\t\tfrontLength >= wordLength ||\n\t\tbackLength >= wordLength ||\n\t\tfrontLength + backLength >= wordLength\n\t) {\n\t\treturn word;\n\t} else if ( backLength === 0 ) {\n\t\treturn word.slice( 0, frontLength ) + truncateStr;\n\t}\n\treturn (\n\t\tword.slice( 0, frontLength ) +\n\t\ttruncateStr +\n\t\tword.slice( wordLength - backLength )\n\t);\n}\n\n/**\n *\n * @param {string} words\n * @param {typeof TRUNCATE_DEFAULT_PROPS} props\n */\nexport function truncateContent( words = '', props ) {\n\tconst mergedProps = { ...TRUNCATE_DEFAULT_PROPS, ...props };\n\tconst { ellipsis, ellipsizeMode, limit } = mergedProps;\n\n\tif ( ellipsizeMode === TRUNCATE_TYPE.none ) {\n\t\treturn words;\n\t}\n\n\tlet truncateHead;\n\tlet truncateTail;\n\n\tswitch ( ellipsizeMode ) {\n\t\tcase TRUNCATE_TYPE.head:\n\t\t\ttruncateHead = 0;\n\t\t\ttruncateTail = limit;\n\t\t\tbreak;\n\t\tcase TRUNCATE_TYPE.middle:\n\t\t\ttruncateHead = Math.floor( limit / 2 );\n\t\t\ttruncateTail = Math.floor( limit / 2 );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ttruncateHead = limit;\n\t\t\ttruncateTail = 0;\n\t}\n\n\tconst truncatedContent =\n\t\tellipsizeMode !== TRUNCATE_TYPE.auto\n\t\t\t? truncateMiddle( words, truncateHead, truncateTail, ellipsis )\n\t\t\t: words;\n\n\treturn truncatedContent;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/truncate/utils.js"],"names":["isNil","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","auto","head","middle","tail","none","TRUNCATE_DEFAULT_PROPS","ellipsis","ellipsizeMode","limit","numberOfLines","truncateMiddle","word","headLength","tailLength","wordLength","length","frontLength","backLength","truncateStr","slice","truncateContent","words","props","mergedProps","truncateHead","truncateTail","Math","floor","truncatedContent"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA,OAAO,MAAMC,iBAAiB,GAAG,GAA1B;AACP,OAAO,MAAMC,aAAa,GAAG;AAC5BC,EAAAA,IAAI,EAAE,MADsB;AAE5BC,EAAAA,IAAI,EAAE,MAFsB;AAG5BC,EAAAA,MAAM,EAAE,QAHoB;AAI5BC,EAAAA,IAAI,EAAE,MAJsB;AAK5BC,EAAAA,IAAI,EAAE;AALsB,CAAtB;AAQP,OAAO,MAAMC,sBAAsB,GAAG;AACrCC,EAAAA,QAAQ,EAAER,iBAD2B;AAErCS,EAAAA,aAAa,EAAER,aAAa,CAACC,IAFQ;AAGrCQ,EAAAA,KAAK,EAAE,CAH8B;AAIrCC,EAAAA,aAAa,EAAE;AAJsB,CAA/B,C,CAOP;AACA;;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,IAAzB,EAA+BC,UAA/B,EAA2CC,UAA3C,EAAuDP,QAAvD,EAAkE;AACxE,MAAK,OAAOK,IAAP,KAAgB,QAArB,EAAgC;AAC/B,WAAO,EAAP;AACA;;AACD,QAAMG,UAAU,GAAGH,IAAI,CAACI,MAAxB,CAJwE,CAKxE;AACA;;AACA,QAAMC,WAAW,GAAG,CAAC,CAACJ,UAAtB,CAPwE,CAOtC;AAClC;;AACA,QAAMK,UAAU,GAAG,CAAC,CAACJ,UAArB;AACA;;AACA,QAAMK,WAAW,GAAG,CAAErB,KAAK,CAAES,QAAF,CAAP,GAAsBA,QAAtB,GAAiCR,iBAArD;;AAEA,MACGkB,WAAW,KAAK,CAAhB,IAAqBC,UAAU,KAAK,CAAtC,IACAD,WAAW,IAAIF,UADf,IAEAG,UAA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ASG,YAAT,EAAuBC,YAAvB,EAAqCnB,QAArC,CADjB,GAEGe,KAHJ;AAKA,SAAOO,gBAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isNil } from 'lodash';\n\nexport const TRUNCATE_ELLIPSIS = '…';\nexport const TRUNCATE_TYPE = {\n\tauto: 'auto',\n\thead: 'head',\n\tmiddle: 'middle',\n\ttail: 'tail',\n\tnone: 'none',\n};\n\nexport const TRUNCATE_DEFAULT_PROPS = {\n\tellipsis: TRUNCATE_ELLIPSIS,\n\tellipsizeMode: TRUNCATE_TYPE.auto,\n\tlimit: 0,\n\tnumberOfLines: 0,\n};\n\n// Source\n// https://github.com/kahwee/truncate-middle\n/**\n * @param {string} word\n * @param {number} headLength\n * @param {number} tailLength\n * @param {string} ellipsis\n */\nexport function truncateMiddle( word, headLength, tailLength, ellipsis ) {\n\tif ( typeof word !== 'string' ) {\n\t\treturn '';\n\t}\n\tconst wordLength = word.length;\n\t// Setting default values\n\t// eslint-disable-next-line no-bitwise\n\tconst frontLength = ~~headLength; // Will cast to integer\n\t// eslint-disable-next-line no-bitwise\n\tconst backLength = ~~tailLength;\n\t/* istanbul ignore next */\n\tconst truncateStr = ! isNil( ellipsis ) ? ellipsis : TRUNCATE_ELLIPSIS;\n\n\tif (\n\t\t( frontLength === 0 && backLength === 0 ) ||\n\t\tfrontLength >= wordLength ||\n\t\tbackLength >= wordLength ||\n\t\tfrontLength + backLength >= wordLength\n\t) {\n\t\treturn word;\n\t} else if ( backLength === 0 ) {\n\t\treturn word.slice( 0, frontLength ) + truncateStr;\n\t}\n\treturn (\n\t\tword.slice( 0, frontLength ) +\n\t\ttruncateStr +\n\t\tword.slice( wordLength - backLength )\n\t);\n}\n\n/**\n *\n * @param {string} words\n * @param {typeof TRUNCATE_DEFAULT_PROPS} props\n */\nexport function truncateContent( words = '', props ) {\n\tconst mergedProps = { ...TRUNCATE_DEFAULT_PROPS, ...props };\n\tconst { ellipsis, ellipsizeMode, limit } = mergedProps;\n\n\tif ( ellipsizeMode === TRUNCATE_TYPE.none ) {\n\t\treturn words;\n\t}\n\n\tlet truncateHead;\n\tlet truncateTail;\n\n\tswitch ( ellipsizeMode ) {\n\t\tcase TRUNCATE_TYPE.head:\n\t\t\ttruncateHead = 0;\n\t\t\ttruncateTail = limit;\n\t\t\tbreak;\n\t\tcase TRUNCATE_TYPE.middle:\n\t\t\ttruncateHead = Math.floor( limit / 2 );\n\t\t\ttruncateTail = Math.floor( limit / 2 );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ttruncateHead = limit;\n\t\t\ttruncateTail = 0;\n\t}\n\n\tconst truncatedContent =\n\t\tellipsizeMode !== TRUNCATE_TYPE.auto\n\t\t\t? truncateMiddle( words, truncateHead, truncateTail, ellipsis )\n\t\t\t: words;\n\n\treturn truncatedContent;\n}\n"]}
@@ -2,10 +2,10 @@
2
2
  * External dependencies
3
3
  */
4
4
  import { uniq } from 'lodash';
5
+
5
6
  /**
6
7
  * WordPress dependencies
7
8
  */
8
-
9
9
  import { forwardRef, memo } from '@wordpress/element';
10
10
  import warn from '@wordpress/warning';
11
11
  /**
@@ -14,7 +14,6 @@ import warn from '@wordpress/warning';
14
14
 
15
15
  import { CONNECT_STATIC_NAMESPACE } from './constants';
16
16
  import { getStyledClassNameFromKey } from './get-styled-class-name-from-key';
17
- /* eslint-disable jsdoc/valid-types */
18
17
 
19
18
  /**
20
19
  * Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
@@ -24,18 +23,13 @@ import { getStyledClassNameFromKey } from './get-styled-class-name-from-key';
24
23
  * The hope is that we can improve render performance by removing functional
25
24
  * component wrappers.
26
25
  *
27
- * @template {import('./wordpress-component').WordPressComponentProps<{}, any, any>} P
28
- * @param {(props: P, ref: import('react').Ref<any>) => JSX.Element | null} Component The component to register into the Context system.
29
- * @param {string} namespace The namespace to register the component under.
30
- * @param {Object} options
31
- * @param {boolean} [options.memo=false]
32
- * @return {import('./wordpress-component').WordPressComponentFromProps<P>} The connected WordPressComponent
26
+ * @param Component The component to register into the Context system.
27
+ * @param namespace The namespace to register the component under.
28
+ * @param options
29
+ * @return The connected WordPressComponent
33
30
  */
34
-
35
31
  export function contextConnect(Component, namespace) {
36
32
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
37
-
38
- /* eslint-enable jsdoc/valid-types */
39
33
  const {
40
34
  memo: memoProp = false
41
35
  } = options;
@@ -75,8 +69,8 @@ export function contextConnect(Component, namespace) {
75
69
  /**
76
70
  * Attempts to retrieve the connected namespace from a component.
77
71
  *
78
- * @param {import('react').ReactChild | undefined | {}} Component The component to retrieve a namespace from.
79
- * @return {Array<string>} The connected namespaces.
72
+ * @param Component The component to retrieve a namespace from.
73
+ * @return The connected namespaces.
80
74
  */
81
75
 
82
76
  export function getConnectNamespace(Component) {
@@ -99,9 +93,8 @@ export function getConnectNamespace(Component) {
99
93
  /**
100
94
  * Checks to see if a component is connected within the Context system.
101
95
  *
102
- * @param {import('react').ReactNode} Component The component to retrieve a namespace from.
103
- * @param {Array<string>|string} match The namespace to check.
104
- * @return {boolean} The result.
96
+ * @param Component The component to retrieve a namespace from.
97
+ * @param match The namespace to check.
105
98
  */
106
99
 
107
100
  export function hasConnectNamespace(Component, match) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-connect.js"],"names":["uniq","forwardRef","memo","warn","CONNECT_STATIC_NAMESPACE","getStyledClassNameFromKey","contextConnect","Component","namespace","options","memoProp","WrappedComponent","mergedNamespace","Array","isArray","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,oBAAjC;AACA,OAAOC,IAAP,MAAiB,oBAAjB;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,aAAzC;AACA,SAASC,yBAAT,QAA0C,kCAA1C;AAEA;;AACA;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AChD,MAAK,CAAEA,SAAP,EAAmB,OAAO,EAAP;AAEnB,MAAIW,UAAU,GAAG,EAAjB,CAHgD,CAKhD;;AACA,MAAKX,SAAS,CAAEH,wBAAF,CAAd,EAA6C;AAC5C;AACAc,IAAAA,UAAU,GAAGX,SAAS,CAAEH,wBAAF,CAAtB;AACA,GAT+C,CAWhD;;;AACA,MAAKG,SAAS,CAACY,IAAV,IAAkBZ,SAAS,CAACY,IAAV,CAAgBf,wBAAhB,CAAvB,EAAoE;AACnE;AACAc,IAAAA,UAAU,GAAGX,SAAS,CAACY,IAAV,CAAgBf,wBAAhB,CAAb;AACA;;AAED,SAAOc,UAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,mBAAT,CAA8Bb,SAA9B,EAAyCc,KAAzC,EAAiD;AACvD,MAAK,CAAEd,SAAP,EAAmB,OAAO,KAAP;;AAEnB,MAAK,OAAOc,KAAP,KAAiB,QAAtB,EAAiC;AAChC,WAAOJ,mBAAmB,CAAEV,SAAF,CAAnB,CAAiCe,QAAjC,CAA2CD,KAA3C,CAAP;AACA;;AACD,MAAKR,KAAK,CAACC,OAAN,CAAeO,KAAf,CAAL,EAA8B;AAC7B,WAAOA,KAAK,CAACE,IAAN,CAAcC,MAAF,IAClBP,mBAAmB,CAAEV,SAAF,CAAnB,CAAiCe,QAAjC,CAA2CE,MAA3C,CADM,CAAP;AAGA;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { uniq } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * This is an (experimental) evolution of the initial connect() HOC.\n * The hope is that we can improve render performance by removing functional\n * component wrappers.\n *\n * @template {import('./wordpress-component').WordPressComponentProps<{}, any, any>} P\n * @param {(props: P, ref: import('react').Ref<any>) => JSX.Element | null} Component The component to register into the Context system.\n * @param {string} namespace The namespace to register the component under.\n * @param {Object} options\n * @param {boolean} [options.memo=false]\n * @return {import('./wordpress-component').WordPressComponentFromProps<P>} The connected WordPressComponent\n */\nexport function contextConnect( Component, namespace, options = {} ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst { memo: memoProp = false } = options;\n\n\tlet WrappedComponent = forwardRef( Component );\n\tif ( memoProp ) {\n\t\t// @ts-ignore\n\t\tWrappedComponent = memo( WrappedComponent );\n\t}\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-ignore internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\tWrappedComponent.displayName = namespace;\n\n\t// @ts-ignore internal property\n\tWrappedComponent[ CONNECT_STATIC_NAMESPACE ] = uniq( mergedNamespace );\n\n\t// @ts-ignore WordPressComponent property\n\tWrappedComponent.selector = `.${ getStyledClassNameFromKey( namespace ) }`;\n\n\t// @ts-ignore\n\treturn WrappedComponent;\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param {import('react').ReactChild | undefined | {}} Component The component to retrieve a namespace from.\n * @return {Array<string>} The connected namespaces.\n */\nexport function getConnectNamespace( Component ) {\n\tif ( ! Component ) return [];\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param {import('react').ReactNode} Component The component to retrieve a namespace from.\n * @param {Array<string>|string} match The namespace to check.\n * @return {boolean} The result.\n */\nexport function hasConnectNamespace( Component, match ) {\n\tif ( ! Component ) return false;\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-connect.ts"],"names":["uniq","forwardRef","memo","warn","CONNECT_STATIC_NAMESPACE","getStyledClassNameFromKey","contextConnect","Component","namespace","options","memoProp","WrappedComponent","mergedNamespace","Array","isArray","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;;AAGA;AACA;AACA;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,oBAAjC;AACA,OAAOC,IAAP,MAAiB,oBAAjB;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,aAAzC;AACA,SAASC,yBAAT,QAA0C,kCAA1C;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAT,CACNC,SADM,EAENC,SAFM,EAI6B;AAAA,MADnCC,OACmC,uEADF,EACE;AACnC,QAAM;AAAEP,IAAAA,IAAI,EAAEQ,QAAQ,GAAG;AA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,CAACY,IAAV,IAAkBZ,SAAS,CAACY,IAAV,CAAgBf,wBAAhB,CAAvB,EAAoE;AACnE;AACAc,IAAAA,UAAU,GAAGX,SAAS,CAACY,IAAV,CAAgBf,wBAAhB,CAAb;AACA;;AAED,SAAOc,UAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,mBAAT,CACNb,SADM,EAENc,KAFM,EAGI;AACV,MAAK,CAAEd,SAAP,EAAmB,OAAO,KAAP;;AAEnB,MAAK,OAAOc,KAAP,KAAiB,QAAtB,EAAiC;AAChC,WAAOJ,mBAAmB,CAAEV,SAAF,CAAnB,CAAiCe,QAAjC,CAA2CD,KAA3C,CAAP;AACA;;AACD,MAAKR,KAAK,CAACC,OAAN,CAAeO,KAAf,CAAL,EAA8B;AAC7B,WAAOA,KAAK,CAACE,IAAN,CAAcC,MAAF,IAClBP,mBAAmB,CAAEV,SAAF,CAAnB,CAAiCe,QAAjC,CAA2CE,MAA3C,CADM,CAAP;AAGA;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { uniq } from 'lodash';\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype ContextConnectOptions = {\n\t/** Defaults to `false`. */\n\tmemo?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * This is an (experimental) evolution of the initial connect() HOC.\n * The hope is that we can improve render performance by removing functional\n * component wrappers.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @param options\n * @return The connected WordPressComponent\n */\nexport function contextConnect< P >(\n\tComponent: ( props: P, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tnamespace: string,\n\toptions: ContextConnectOptions = {}\n): WordPressComponentFromProps< P > {\n\tconst { memo: memoProp = false } = options;\n\n\tlet WrappedComponent = forwardRef( Component );\n\tif ( memoProp ) {\n\t\t// @ts-ignore\n\t\tWrappedComponent = memo( WrappedComponent );\n\t}\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-ignore internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\tWrappedComponent.displayName = namespace;\n\n\t// @ts-ignore internal property\n\tWrappedComponent[ CONNECT_STATIC_NAMESPACE ] = uniq( mergedNamespace );\n\n\t// @ts-ignore WordPressComponent property\n\tWrappedComponent.selector = `.${ getStyledClassNameFromKey( namespace ) }`;\n\n\t// @ts-ignore\n\treturn WrappedComponent;\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) return [];\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) return false;\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"]}
@@ -50,8 +50,8 @@ function useContextSystemBridge(_ref) {
50
50
  const parentContext = useComponentsContext();
51
51
  const valueRef = useRef(value);
52
52
  useUpdateEffect(() => {
53
- if ( // objects are equivalent
54
- isEqual(valueRef.current, value) && // but not the same reference
53
+ if ( // Objects are equivalent.
54
+ isEqual(valueRef.current, value) && // But not the same reference.
55
55
  valueRef.current !== value) {
56
56
  typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;
57
57
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["isEqual","merge","cloneDeep","createContext","useContext","useRef","useEffect","useMemo","memo","warn","ComponentsContext","useComponentsContext","useUpdateEffect","effect","deps","mounted","current","undefined","useContextSystemBridge","value","parentContext","valueRef","JSON","stringify","config","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,KAAlB,EAAyBC,SAAzB,QAA0C,QAA1C;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,UAFD,EAGCC,MAHD,EAICC,SAJD,EAKCC,OALD,EAMCC,IAND,QAOO,oBAPP;AAQA,OAAOC,IAAP,MAAiB,oBAAjB;AAEA,OAAO,MAAMC,iBAAiB,GAAGP,aAAa;AAC7C;AAAqC,EADQ,CAAvC;AAGP,OAAO,MAAMQ,oBAAoB,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A;AACA;AACA;AACA;AACA;;;AACA,MAAMC,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYP,IAAAA;AAAZ,GAAyB;AAC5D,QAAMQ,YAAY,GAAGT,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGQ;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUA,OAAO,MAAME,qBAAqB,GAAGpB,IAAI,CAAEiB,yBAAF,CAAlC","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual, merge, cloneDeep } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Runs an effect only on update (i.e., ignores the first render)\n *\n * @param {import('react').EffectCallback} effect\n * @param {import('react').DependencyList} deps\n */\nfunction useUpdateEffect( effect, deps ) {\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tif ( mounted.current ) {\n\t\t\treturn effect();\n\t\t}\n\t\tmounted.current = true;\n\t\treturn undefined;\n\t}, deps );\n}\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// objects are equivalent\n\t\t\tisEqual( valueRef.current, value ) &&\n\t\t\t// but not the same reference\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `merge` and `cloneDeep` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `merge` and `cloneDeep`!\n\tconst config = useMemo( () => {\n\t\treturn merge( cloneDeep( parentContext ), value );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["isEqual","merge","cloneDeep","createContext","useContext","useRef","useEffect","useMemo","memo","warn","ComponentsContext","useComponentsContext","useUpdateEffect","effect","deps","mounted","current","undefined","useContextSystemBridge","value","parentContext","valueRef","JSON","stringify","config","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,CAAEA,KAAF,CATY,CAAf,CAL4C,CAgB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMK,MAAM,GAAGjB,OAAO,CAAE,MAAM;AAC7B,WAAON,KAAK,CAAEC,SAAS,CAAEkB,aAAF,CAAX,EAA8BD,KAA9B,CAAZ;AACA,GAFqB,EAEnB,CAAEC,aAAF,EAAiBD,KAAjB,CAFmB,CAAtB;AAIA,SAAOK,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYP,IAAAA;AAAZ,GAAyB;AAC5D,QAAMQ,YAAY,GAAGT,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,cAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGQ;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUA,OAAO,MAAME,qBAAqB,GAAGpB,IAAI,CAAEiB,yBAAF,CAAlC","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual, merge, cloneDeep } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Runs an effect only on update (i.e., ignores the first render)\n *\n * @param {import('react').EffectCallback} effect\n * @param {import('react').DependencyList} deps\n */\nfunction useUpdateEffect( effect, deps ) {\n\tconst mounted = useRef( false );\n\tuseEffect( () => {\n\t\tif ( mounted.current ) {\n\t\t\treturn effect();\n\t\t}\n\t\tmounted.current = true;\n\t\treturn undefined;\n\t}, deps );\n}\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tisEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `merge` and `cloneDeep` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `merge` and `cloneDeep`!\n\tconst config = useMemo( () => {\n\t\treturn merge( cloneDeep( parentContext ), value );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/index.js"],"names":["ContextSystemProvider","useComponentsContext","contextConnect","hasConnectNamespace","getConnectNamespace","useContextSystem"],"mappings":"AAAA,SACCA,qBADD,EAECC,oBAFD,QAGO,2BAHP;AAIA,SACCC,cADD,EAECC,mBAFD,EAGCC,mBAHD,QAIO,mBAJP;AAKA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,cAAc,uBAAd","sourcesContent":["export {\n\tContextSystemProvider,\n\tuseComponentsContext,\n} from './context-system-provider';\nexport {\n\tcontextConnect,\n\thasConnectNamespace,\n\tgetConnectNamespace,\n} from './context-connect';\nexport { useContextSystem } from './use-context-system';\nexport * from './wordpress-component';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/index.ts"],"names":["ContextSystemProvider","useComponentsContext","contextConnect","hasConnectNamespace","getConnectNamespace","useContextSystem"],"mappings":"AAAA,SACCA,qBADD,EAECC,oBAFD,QAGO,2BAHP;AAIA,SACCC,cADD,EAECC,mBAFD,EAGCC,mBAHD,QAIO,mBAJP;AAKA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,cAAc,uBAAd","sourcesContent":["export {\n\tContextSystemProvider,\n\tuseComponentsContext,\n} from './context-system-provider';\nexport {\n\tcontextConnect,\n\thasConnectNamespace,\n\tgetConnectNamespace,\n} from './context-connect';\nexport { useContextSystem } from './use-context-system';\nexport * from './wordpress-component';\n"]}
@@ -14,7 +14,7 @@ import { useControlGroup } from './hook';
14
14
  import { contextConnect } from '../context';
15
15
  /**
16
16
  * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props
17
- * @param {import('react').Ref<any>} forwardedRef
17
+ * @param {import('react').ForwardedRef<any>} forwardedRef
18
18
  */
19
19
 
20
20
  function ControlGroup(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/control-group/component.js"],"names":["Flex","Grid","useControlGroup","contextConnect","ControlGroup","props","forwardedRef","children","direction","templateColumns","otherProps","isGrid","ConnectedControlGroup"],"mappings":";;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,YAArB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,eAAT,QAAgC,QAAhC;AACA,SAASC,cAAT,QAA+B,YAA/B;AAEA;AACA;AACA;AACA;;AACA,SAASC,YAAT,CAAuBC,KAAvB,EAA8BC,YAA9B,EAA6C;AAC5C,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,SAAS,GAAG,KAFP;AAGLC,IAAAA,eAHK;AAIL,OAAGC;AAJE,MAKFR,eAAe,CAAEG,KAAF,CALnB;AAOA,QAAMM,MAAM,GAAG,CAAC,CAAEF,eAAlB;;AAEA,MAAKE,MAAL,EAAc;AACb,WACC,cAAC,IAAD;AACC,MAAA,GAAG,EAAG,CADP;AAEC,MAAA,eAAe,EAAGF;AAFnB,OAGMC,UAHN;AAIC,MAAA,GAAG,EAAGJ;AAJP,QAMGC,QANH,CADD;AAUA;;AAED,SACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAGC,SADb;AAEC,IAAA,GAAG,EAAI;AAFR,KAGME,UAHN;AAIC,IAAA,GAAG,EAAGJ;AAJP,MAMGC,QANH,CADD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMK,qBAAqB,GAAGT,cAAc,CAAEC,YAAF,EAAgB,cAAhB,CAA5C;AAEA,eAAeQ,qBAAf","sourcesContent":["/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { Flex } from '../../flex';\nimport { Grid } from '../../grid';\nimport { useControlGroup } from './hook';\nimport { contextConnect } from '../context';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction ControlGroup( props, forwardedRef ) {\n\tconst {\n\t\tchildren,\n\t\tdirection = 'row',\n\t\ttemplateColumns,\n\t\t...otherProps\n\t} = useControlGroup( props );\n\n\tconst isGrid = !! templateColumns;\n\n\tif ( isGrid ) {\n\t\treturn (\n\t\t\t<Grid\n\t\t\t\tgap={ 0 }\n\t\t\t\ttemplateColumns={ templateColumns }\n\t\t\t\t{ ...otherProps }\n\t\t\t\tref={ forwardedRef }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Grid>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Flex\n\t\t\tdirection={ direction }\n\t\t\tgap={ `-1px` }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t{ children }\n\t\t</Flex>\n\t);\n}\n\n/**\n * `ControlGroup` is a layout-based component for rendering a group of\n * control-based components, such as `Button`, `Select` or `TextInput`.\n * Control components that render within `ControlGroup` automatically\n * have their borders offset and border-radii rounded.\n *\n * @example\n * ```jsx\n * import { Button, ControlGroup, Select, TextInput } from `@wordpress/components/ui`;\n *\n * function Example() {\n * return (\n * <ControlGroup templateColumns=\"auto 1fr auto\">\n * <Select />\n * <TextInput placeholder=\"First name\" />\n * <Button variant=\"primary\" />\n * </ControlGroup>\n * );\n * }\n * ```\n */\nconst ConnectedControlGroup = contextConnect( ControlGroup, 'ControlGroup' );\n\nexport default ConnectedControlGroup;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/control-group/component.js"],"names":["Flex","Grid","useControlGroup","contextConnect","ControlGroup","props","forwardedRef","children","direction","templateColumns","otherProps","isGrid","ConnectedControlGroup"],"mappings":";;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,YAArB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,eAAT,QAAgC,QAAhC;AACA,SAASC,cAAT,QAA+B,YAA/B;AAEA;AACA;AACA;AACA;;AACA,SAASC,YAAT,CAAuBC,KAAvB,EAA8BC,YAA9B,EAA6C;AAC5C,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,SAAS,GAAG,KAFP;AAGLC,IAAAA,eAHK;AAIL,OAAGC;AAJE,MAKFR,eAAe,CAAEG,KAAF,CALnB;AAOA,QAAMM,MAAM,GAAG,CAAC,CAAEF,eAAlB;;AAEA,MAAKE,MAAL,EAAc;AACb,WACC,cAAC,IAAD;AACC,MAAA,GAAG,EAAG,CADP;AAEC,MAAA,eAAe,EAAGF;AAFnB,OAGMC,UAHN;AAIC,MAAA,GAAG,EAAGJ;AAJP,QAMGC,QANH,CADD;AAUA;;AAED,SACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAGC,SADb;AAEC,IAAA,GAAG,EAAI;AAFR,KAGME,UAHN;AAIC,IAAA,GAAG,EAAGJ;AAJP,MAMGC,QANH,CADD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMK,qBAAqB,GAAGT,cAAc,CAAEC,YAAF,EAAgB,cAAhB,CAA5C;AAEA,eAAeQ,qBAAf","sourcesContent":["/**\n * External dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { Flex } from '../../flex';\nimport { Grid } from '../../grid';\nimport { useControlGroup } from './hook';\nimport { contextConnect } from '../context';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction ControlGroup( props, forwardedRef ) {\n\tconst {\n\t\tchildren,\n\t\tdirection = 'row',\n\t\ttemplateColumns,\n\t\t...otherProps\n\t} = useControlGroup( props );\n\n\tconst isGrid = !! templateColumns;\n\n\tif ( isGrid ) {\n\t\treturn (\n\t\t\t<Grid\n\t\t\t\tgap={ 0 }\n\t\t\t\ttemplateColumns={ templateColumns }\n\t\t\t\t{ ...otherProps }\n\t\t\t\tref={ forwardedRef }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</Grid>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Flex\n\t\t\tdirection={ direction }\n\t\t\tgap={ `-1px` }\n\t\t\t{ ...otherProps }\n\t\t\tref={ forwardedRef }\n\t\t>\n\t\t\t{ children }\n\t\t</Flex>\n\t);\n}\n\n/**\n * `ControlGroup` is a layout-based component for rendering a group of\n * control-based components, such as `Button`, `Select` or `TextInput`.\n * Control components that render within `ControlGroup` automatically\n * have their borders offset and border-radii rounded.\n *\n * @example\n * ```jsx\n * import { Button, ControlGroup, Select, TextInput } from `@wordpress/components/ui`;\n *\n * function Example() {\n * return (\n * <ControlGroup templateColumns=\"auto 1fr auto\">\n * <Select />\n * <TextInput placeholder=\"First name\" />\n * <Button variant=\"primary\" />\n * </ControlGroup>\n * );\n * }\n * ```\n */\nconst ConnectedControlGroup = contextConnect( ControlGroup, 'ControlGroup' );\n\nexport default ConnectedControlGroup;\n"]}
@@ -9,7 +9,7 @@ import { View } from '../../view';
9
9
  import { useControlLabel } from './hook';
10
10
  /**
11
11
  * @param {import('../context').WordPressComponentProps<import('./types').Props, 'label', false>} props
12
- * @param {import('react').Ref<any>} forwardedRef
12
+ * @param {import('react').ForwardedRef<any>} forwardedRef
13
13
  */
14
14
 
15
15
  function ControlLabel(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/control-label/component.js"],"names":["contextConnect","View","useControlLabel","ControlLabel","props","forwardedRef","controlLabelProps","ConnectedControlLabel"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,YAA/B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,eAAT,QAAgC,QAAhC;AAEA;AACA;AACA;AACA;;AACA,SAASC,YAAT,CAAuBC,KAAvB,EAA8BC,YAA9B,EAA6C;AAC5C,QAAMC,iBAAiB,GAAGJ,eAAe,CAAEE,KAAF,CAAzC;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAsBE,iBAAtB;AAA0C,IAAA,GAAG,EAAGD;AAAhD,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,qBAAqB,GAAGP,cAAc,CAAEG,YAAF,EAAgB,cAAhB,CAA5C;AAEA,eAAeI,qBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../context';\nimport { View } from '../../view';\nimport { useControlLabel } from './hook';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').Props, 'label', false>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction ControlLabel( props, forwardedRef ) {\n\tconst controlLabelProps = useControlLabel( props );\n\n\treturn <View as=\"label\" { ...controlLabelProps } ref={ forwardedRef } />;\n}\n\n/**\n * `ControlLabel` is a form component that works with `FormGroup` to provide a\n * label for form elements (e.g. `Switch` or `TextInput`).\n *\n * ```jsx\n * import { ControlLabel, FormGroup, TextInput } from '@wordpress/components/ui';\n *\n * function Example() {\n * \treturn (\n * \t\t<FormGroup>\n * \t\t\t<ControlLabel>First Name</ControlLabel>\n * \t\t\t<TextInput />\n * \t\t</FormGroup>\n * \t);\n * }\n * ```\n */\nconst ConnectedControlLabel = contextConnect( ControlLabel, 'ControlLabel' );\n\nexport default ConnectedControlLabel;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/control-label/component.js"],"names":["contextConnect","View","useControlLabel","ControlLabel","props","forwardedRef","controlLabelProps","ConnectedControlLabel"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,YAA/B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,eAAT,QAAgC,QAAhC;AAEA;AACA;AACA;AACA;;AACA,SAASC,YAAT,CAAuBC,KAAvB,EAA8BC,YAA9B,EAA6C;AAC5C,QAAMC,iBAAiB,GAAGJ,eAAe,CAAEE,KAAF,CAAzC;AAEA,SAAO,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAAsBE,iBAAtB;AAA0C,IAAA,GAAG,EAAGD;AAAhD,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,qBAAqB,GAAGP,cAAc,CAAEG,YAAF,EAAgB,cAAhB,CAA5C;AAEA,eAAeI,qBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../context';\nimport { View } from '../../view';\nimport { useControlLabel } from './hook';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').Props, 'label', false>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction ControlLabel( props, forwardedRef ) {\n\tconst controlLabelProps = useControlLabel( props );\n\n\treturn <View as=\"label\" { ...controlLabelProps } ref={ forwardedRef } />;\n}\n\n/**\n * `ControlLabel` is a form component that works with `FormGroup` to provide a\n * label for form elements (e.g. `Switch` or `TextInput`).\n *\n * ```jsx\n * import { ControlLabel, FormGroup, TextInput } from '@wordpress/components/ui';\n *\n * function Example() {\n * \treturn (\n * \t\t<FormGroup>\n * \t\t\t<ControlLabel>First Name</ControlLabel>\n * \t\t\t<TextInput />\n * \t\t</FormGroup>\n * \t);\n * }\n * ```\n */\nconst ConnectedControlLabel = contextConnect( ControlLabel, 'ControlLabel' );\n\nexport default ConnectedControlLabel;\n"]}
@@ -11,7 +11,7 @@ import FormGroupContent from './form-group-content';
11
11
  import { useFormGroup } from './use-form-group';
12
12
  /**
13
13
  * @param {import('../context').WordPressComponentProps<import('./types').FormGroupProps, 'div'>} props
14
- * @param {import('react').Ref<any>} forwardedRef
14
+ * @param {import('react').ForwardedRef<any>} forwardedRef
15
15
  */
16
16
 
17
17
  function FormGroup(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/form-group/form-group.js"],"names":["contextConnect","Grid","View","FormGroupContent","useFormGroup","FormGroup","props","forwardedRef","contentProps","horizontal","otherProps","ConnectedFormGroup"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,YAA/B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAEA;AACA;AACA;AACA;;AACA,SAASC,SAAT,CAAoBC,KAApB,EAA2BC,YAA3B,EAA0C;AACzC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,UAAhB;AAA4B,OAAGC;AAA/B,MAA8CN,YAAY,CAAEE,KAAF,CAAhE;;AAEA,MAAKG,UAAL,EAAkB;AACjB,WACC,cAAC,IAAD;AACC,MAAA,eAAe,EAAC;AADjB,OAEMC,UAFN;AAGC,MAAA,GAAG,EAAGH;AAHP,QAKC,cAAC,gBAAD,EAAuBC,YAAvB,CALD,CADD;AASA;;AAED,SACC,cAAC,IAAD,eAAWE,UAAX;AAAwB,IAAA,GAAG,EAAGH;AAA9B,MACC,cAAC,gBAAD,EAAuBC,YAAvB,CADD,CADD;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,kBAAkB,GAAGX,cAAc,CAAEK,SAAF,EAAa,WAAb,CAAzC;AAEA,eAAeM,kBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../context';\nimport { Grid } from '../../grid';\nimport { View } from '../../view';\nimport FormGroupContent from './form-group-content';\nimport { useFormGroup } from './use-form-group';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').FormGroupProps, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction FormGroup( props, forwardedRef ) {\n\tconst { contentProps, horizontal, ...otherProps } = useFormGroup( props );\n\n\tif ( horizontal ) {\n\t\treturn (\n\t\t\t<Grid\n\t\t\t\ttemplateColumns=\"minmax(0, 1fr) 2fr\"\n\t\t\t\t{ ...otherProps }\n\t\t\t\tref={ forwardedRef }\n\t\t\t>\n\t\t\t\t<FormGroupContent { ...contentProps } />\n\t\t\t</Grid>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View { ...otherProps } ref={ forwardedRef }>\n\t\t\t<FormGroupContent { ...contentProps } />\n\t\t</View>\n\t);\n}\n\n/**\n * `FormGroup` is a form component that groups a label with a form element (e.g. `Switch` or `TextInput`).\n *\n * @example\n * ```jsx\n * import { FormGroup, TextInput } from `@wordpress/components/ui`;\n *\n * function Example() {\n * \treturn (\n * \t\t<FormGroup label=\"First name\">\n * \t\t\t<TextInput />\n * \t\t</FormGroup>\n * \t);\n * }\n * ```\n */\nconst ConnectedFormGroup = contextConnect( FormGroup, 'FormGroup' );\n\nexport default ConnectedFormGroup;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/form-group/form-group.js"],"names":["contextConnect","Grid","View","FormGroupContent","useFormGroup","FormGroup","props","forwardedRef","contentProps","horizontal","otherProps","ConnectedFormGroup"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,YAA/B;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,SAASC,IAAT,QAAqB,YAArB;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAEA;AACA;AACA;AACA;;AACA,SAASC,SAAT,CAAoBC,KAApB,EAA2BC,YAA3B,EAA0C;AACzC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,UAAhB;AAA4B,OAAGC;AAA/B,MAA8CN,YAAY,CAAEE,KAAF,CAAhE;;AAEA,MAAKG,UAAL,EAAkB;AACjB,WACC,cAAC,IAAD;AACC,MAAA,eAAe,EAAC;AADjB,OAEMC,UAFN;AAGC,MAAA,GAAG,EAAGH;AAHP,QAKC,cAAC,gBAAD,EAAuBC,YAAvB,CALD,CADD;AASA;;AAED,SACC,cAAC,IAAD,eAAWE,UAAX;AAAwB,IAAA,GAAG,EAAGH;AAA9B,MACC,cAAC,gBAAD,EAAuBC,YAAvB,CADD,CADD;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,kBAAkB,GAAGX,cAAc,CAAEK,SAAF,EAAa,WAAb,CAAzC;AAEA,eAAeM,kBAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport { contextConnect } from '../context';\nimport { Grid } from '../../grid';\nimport { View } from '../../view';\nimport FormGroupContent from './form-group-content';\nimport { useFormGroup } from './use-form-group';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').FormGroupProps, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction FormGroup( props, forwardedRef ) {\n\tconst { contentProps, horizontal, ...otherProps } = useFormGroup( props );\n\n\tif ( horizontal ) {\n\t\treturn (\n\t\t\t<Grid\n\t\t\t\ttemplateColumns=\"minmax(0, 1fr) 2fr\"\n\t\t\t\t{ ...otherProps }\n\t\t\t\tref={ forwardedRef }\n\t\t\t>\n\t\t\t\t<FormGroupContent { ...contentProps } />\n\t\t\t</Grid>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View { ...otherProps } ref={ forwardedRef }>\n\t\t\t<FormGroupContent { ...contentProps } />\n\t\t</View>\n\t);\n}\n\n/**\n * `FormGroup` is a form component that groups a label with a form element (e.g. `Switch` or `TextInput`).\n *\n * @example\n * ```jsx\n * import { FormGroup, TextInput } from `@wordpress/components/ui`;\n *\n * function Example() {\n * \treturn (\n * \t\t<FormGroup label=\"First name\">\n * \t\t\t<TextInput />\n * \t\t</FormGroup>\n * \t);\n * }\n * ```\n */\nconst ConnectedFormGroup = contextConnect( FormGroup, 'FormGroup' );\n\nexport default ConnectedFormGroup;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/shortcut/component.tsx"],"names":["useContextSystem","contextConnect","View","Shortcut","props","forwardedRef","as","asProp","shortcut","className","otherProps","displayText","ariaLabel","display","ConnectedShortcut"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,gBADD,EAECC,cAFD,QAIO,YAJP;AAKA,SAASC,IAAT,QAAqB,YAArB;;AAYA,SAASC,QAAT,CACCC,KADD,EAECC,YAFD,EAGsB;AACrB,QAAM;AACLC,IAAAA,EAAE,EAAEC,MAAM,GAAG,MADR;AAELC,IAAAA,QAFK;AAGLC,IAAAA,SAHK;AAIL,OAAGC;AAJE,MAKFV,gBAAgB,CAAEI,KAAF,EAAS,UAAT,CALpB;;AAMA,MAAK,CAAEI,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,MAAIG,WAAJ;AACA,MAAIC,SAAJ;;AAEA,MAAK,OAAOJ,QAAP,KAAoB,QAAzB,EAAoC;AACnCG,IAAAA,WAAW,GAAGH,QAAd;AACA,GAFD,MAEO;AACNG,IAAAA,WAAW,GAAGH,QAAQ,CAACK,OAAvB;AACAD,IAAAA,SAAS,GAAGJ,QAAQ,CAACI,SAArB;AACA;;AAED,SACC,cAAC,IAAD;AACC,IAAA,EAAE,EAAGL,MADN;AAEC,IAAA,SAAS,EAAGE,SAFb;AAGC,kBAAaG,SAHd;AAIC,IAAA,GAAG,EAAGP;AAJP,KAKMK,UALN,GAOGC,WAPH,CADD;AAWA;;AAED,MAAMG,iBAAiB,GAAGb,cAAc,CAAEE,QAAF,EAAY,UAAZ,CAAxC;AAEA,eAAeW,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { Ref } from 'react';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../context';\nimport { View } from '../../view';\n\nexport interface ShortcutDescription {\n\tdisplay: string;\n\tariaLabel: string;\n}\n\nexport interface Props {\n\tshortcut?: ShortcutDescription | string;\n\tclassName?: string;\n}\n\nfunction Shortcut(\n\tprops: WordPressComponentProps< Props, 'span' >,\n\tforwardedRef: Ref< any >\n): JSX.Element | null {\n\tconst {\n\t\tas: asProp = 'span',\n\t\tshortcut,\n\t\tclassName,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Shortcut' );\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\tlet displayText: string;\n\tlet ariaLabel: string | undefined;\n\n\tif ( typeof shortcut === 'string' ) {\n\t\tdisplayText = shortcut;\n\t} else {\n\t\tdisplayText = shortcut.display;\n\t\tariaLabel = shortcut.ariaLabel;\n\t}\n\n\treturn (\n\t\t<View\n\t\t\tas={ asProp }\n\t\t\tclassName={ className }\n\t\t\taria-label={ ariaLabel }\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...otherProps }\n\t\t>\n\t\t\t{ displayText }\n\t\t</View>\n\t);\n}\n\nconst ConnectedShortcut = contextConnect( Shortcut, 'Shortcut' );\n\nexport default ConnectedShortcut;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/shortcut/component.tsx"],"names":["useContextSystem","contextConnect","View","Shortcut","props","forwardedRef","as","asProp","shortcut","className","otherProps","displayText","ariaLabel","display","ConnectedShortcut"],"mappings":";;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,gBADD,EAECC,cAFD,QAIO,YAJP;AAKA,SAASC,IAAT,QAAqB,YAArB;;AAYA,SAASC,QAAT,CACCC,KADD,EAECC,YAFD,EAGsB;AACrB,QAAM;AACLC,IAAAA,EAAE,EAAEC,MAAM,GAAG,MADR;AAELC,IAAAA,QAFK;AAGLC,IAAAA,SAHK;AAIL,OAAGC;AAJE,MAKFV,gBAAgB,CAAEI,KAAF,EAAS,UAAT,CALpB;;AAMA,MAAK,CAAEI,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,MAAIG,WAAJ;AACA,MAAIC,SAAJ;;AAEA,MAAK,OAAOJ,QAAP,KAAoB,QAAzB,EAAoC;AACnCG,IAAAA,WAAW,GAAGH,QAAd;AACA,GAFD,MAEO;AACNG,IAAAA,WAAW,GAAGH,QAAQ,CAACK,OAAvB;AACAD,IAAAA,SAAS,GAAGJ,QAAQ,CAACI,SAArB;AACA;;AAED,SACC,cAAC,IAAD;AACC,IAAA,EAAE,EAAGL,MADN;AAEC,IAAA,SAAS,EAAGE,SAFb;AAGC,kBAAaG,SAHd;AAIC,IAAA,GAAG,EAAGP;AAJP,KAKMK,UALN,GAOGC,WAPH,CADD;AAWA;;AAED,MAAMG,iBAAiB,GAAGb,cAAc,CAAEE,QAAF,EAAY,UAAZ,CAAxC;AAEA,eAAeW,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../context';\nimport { View } from '../../view';\n\nexport interface ShortcutDescription {\n\tdisplay: string;\n\tariaLabel: string;\n}\n\nexport interface Props {\n\tshortcut?: ShortcutDescription | string;\n\tclassName?: string;\n}\n\nfunction Shortcut(\n\tprops: WordPressComponentProps< Props, 'span' >,\n\tforwardedRef: ForwardedRef< any >\n): JSX.Element | null {\n\tconst {\n\t\tas: asProp = 'span',\n\t\tshortcut,\n\t\tclassName,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Shortcut' );\n\tif ( ! shortcut ) {\n\t\treturn null;\n\t}\n\n\tlet displayText: string;\n\tlet ariaLabel: string | undefined;\n\n\tif ( typeof shortcut === 'string' ) {\n\t\tdisplayText = shortcut;\n\t} else {\n\t\tdisplayText = shortcut.display;\n\t\tariaLabel = shortcut.ariaLabel;\n\t}\n\n\treturn (\n\t\t<View\n\t\t\tas={ asProp }\n\t\t\tclassName={ className }\n\t\t\taria-label={ ariaLabel }\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...otherProps }\n\t\t>\n\t\t\t{ displayText }\n\t\t</View>\n\t);\n}\n\nconst ConnectedShortcut = contextConnect( Shortcut, 'Shortcut' );\n\nexport default ConnectedShortcut;\n"]}
@@ -21,7 +21,7 @@ import { COLORS } from '../../utils/colors-values';
21
21
  /**
22
22
  *
23
23
  * @param {import('../context').WordPressComponentProps<Props, 'div'>} props
24
- * @param {import('react').Ref<any>} forwardedRef
24
+ * @param {import('react').ForwardedRef<any>} forwardedRef
25
25
  */
26
26
 
27
27
  function Spinner(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/spinner/component.js"],"names":["BarsView","BarsWrapperView","ContainerView","BASE_SIZE","WRAPPER_SIZE","contextConnect","useContextSystem","COLORS","Spinner","props","forwardedRef","color","black","size","otherProps","ratio","scale","transform","styles","height","width"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,eAAnB,EAAoCC,aAApC,QAAyD,UAAzD;AACA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,SAAxC;AACA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,YAAjD;AACA,SAASC,MAAT,QAAuB,2BAAvB;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,SAASC,OAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAwC;AACvC,QAAM;AACLC,IAAAA,KAAK,GAAGJ,MAAM,CAACK,KADV;AAELC,IAAAA,IAAI,GAAGV,SAFF;AAGL,OAAGW;AAHE,MAIFR,gBAAgB,CAAEG,KAAF,EAAS,SAAT,CAJpB;AAKA,QAAMM,KAAK,GAAGF,IAAI,GAAGV,SAArB;AACA,QAAMa,KAAK,GAAKD,KAAK,GAAGZ,SAAV,GAAwBC,YAAtC;AACA,QAAMa,SAAS,GAAI,SAASD,KAAO,GAAnC;AAEA,QAAME,MAAM,GAAG;AAAED,IAAAA;AAAF,GAAf;AAEA,SACC,cAAC,aAAD,eACMH,UADN;AAEC,iBAAY,IAFb;AAGC,IAAA,GAAG,EAAGJ,YAHP;AAIC,IAAA,KAAK,EAAG;AAAES,MAAAA,MAAM,EAAEN,IAAV;AAAgBO,MAAAA,KAAK,EAAEP;AAAvB;AAJT,MAMC,cAAC,eAAD;AAAiB,mBAAc,IAA/B;AAAsC,IAAA,KAAK,EAAGK;AAA9C,KACC,cAAC,QAAD;AAAU,IAAA,KAAK,EAAG;AAAEP,MAAAA;AAAF;AAAlB,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,IAJD,EAKC;AAAK,IAAA,SAAS,EAAC;AAAf,IALD,EAMC;AAAK,IAAA,SAAS,EAAC;AAAf,IAND,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,IAPD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,IARD,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,IATD,EAUC;AAAK,IAAA,SAAS,EAAC;AAAf,IAVD,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,IAXD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,IAZD,CADD,CAND,CADD;AAyBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAeN,cAAc,CAAEG,OAAF,EAAW,SAAX,CAA7B","sourcesContent":["/**\n * Internal dependencies\n */\nimport { BarsView, BarsWrapperView, ContainerView } from './styles';\nimport { BASE_SIZE, WRAPPER_SIZE } from './utils';\nimport { contextConnect, useContextSystem } from '../context';\nimport { COLORS } from '../../utils/colors-values';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef Props\n * @property {import('react').CSSProperties['color']} [color] Color of `Spinner`.\n * @property {number} [size=16] Size of `Spinner`.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n *\n * @param {import('../context').WordPressComponentProps<Props, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Spinner( props, forwardedRef ) {\n\tconst {\n\t\tcolor = COLORS.black,\n\t\tsize = BASE_SIZE,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Spinner' );\n\tconst ratio = size / BASE_SIZE;\n\tconst scale = ( ratio * BASE_SIZE ) / WRAPPER_SIZE;\n\tconst transform = `scale(${ scale })`;\n\n\tconst styles = { transform };\n\n\treturn (\n\t\t<ContainerView\n\t\t\t{ ...otherProps }\n\t\t\taria-busy={ true }\n\t\t\tref={ forwardedRef }\n\t\t\tstyle={ { height: size, width: size } }\n\t\t>\n\t\t\t<BarsWrapperView aria-hidden={ true } style={ styles }>\n\t\t\t\t<BarsView style={ { color } }>\n\t\t\t\t\t<div className=\"InnerBar1\" />\n\t\t\t\t\t<div className=\"InnerBar2\" />\n\t\t\t\t\t<div className=\"InnerBar3\" />\n\t\t\t\t\t<div className=\"InnerBar4\" />\n\t\t\t\t\t<div className=\"InnerBar5\" />\n\t\t\t\t\t<div className=\"InnerBar6\" />\n\t\t\t\t\t<div className=\"InnerBar7\" />\n\t\t\t\t\t<div className=\"InnerBar8\" />\n\t\t\t\t\t<div className=\"InnerBar9\" />\n\t\t\t\t\t<div className=\"InnerBar10\" />\n\t\t\t\t\t<div className=\"InnerBar11\" />\n\t\t\t\t\t<div className=\"InnerBar12\" />\n\t\t\t\t</BarsView>\n\t\t\t</BarsWrapperView>\n\t\t</ContainerView>\n\t);\n}\n\n/**\n * `Spinner` is a component that notify users that their action is being processed.\n *\n * @example\n * ```jsx\n * import { Spinner } from `@wordpress/components/ui`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Spinner />\n * \t);\n * }\n * ```\n */\nexport default contextConnect( Spinner, 'Spinner' );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/spinner/component.js"],"names":["BarsView","BarsWrapperView","ContainerView","BASE_SIZE","WRAPPER_SIZE","contextConnect","useContextSystem","COLORS","Spinner","props","forwardedRef","color","black","size","otherProps","ratio","scale","transform","styles","height","width"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,eAAnB,EAAoCC,aAApC,QAAyD,UAAzD;AACA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,SAAxC;AACA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,YAAjD;AACA,SAASC,MAAT,QAAuB,2BAAvB;AAEA;;AACA;AACA;AACA;AACA;AACA;;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,SAASC,OAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAwC;AACvC,QAAM;AACLC,IAAAA,KAAK,GAAGJ,MAAM,CAACK,KADV;AAELC,IAAAA,IAAI,GAAGV,SAFF;AAGL,OAAGW;AAHE,MAIFR,gBAAgB,CAAEG,KAAF,EAAS,SAAT,CAJpB;AAKA,QAAMM,KAAK,GAAGF,IAAI,GAAGV,SAArB;AACA,QAAMa,KAAK,GAAKD,KAAK,GAAGZ,SAAV,GAAwBC,YAAtC;AACA,QAAMa,SAAS,GAAI,SAASD,KAAO,GAAnC;AAEA,QAAME,MAAM,GAAG;AAAED,IAAAA;AAAF,GAAf;AAEA,SACC,cAAC,aAAD,eACMH,UADN;AAEC,iBAAY,IAFb;AAGC,IAAA,GAAG,EAAGJ,YAHP;AAIC,IAAA,KAAK,EAAG;AAAES,MAAAA,MAAM,EAAEN,IAAV;AAAgBO,MAAAA,KAAK,EAAEP;AAAvB;AAJT,MAMC,cAAC,eAAD;AAAiB,mBAAc,IAA/B;AAAsC,IAAA,KAAK,EAAGK;AAA9C,KACC,cAAC,QAAD;AAAU,IAAA,KAAK,EAAG;AAAEP,MAAAA;AAAF;AAAlB,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,IAJD,EAKC;AAAK,IAAA,SAAS,EAAC;AAAf,IALD,EAMC;AAAK,IAAA,SAAS,EAAC;AAAf,IAND,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,IAPD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,IARD,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,IATD,EAUC;AAAK,IAAA,SAAS,EAAC;AAAf,IAVD,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,IAXD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,IAZD,CADD,CAND,CADD;AAyBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAeN,cAAc,CAAEG,OAAF,EAAW,SAAX,CAA7B","sourcesContent":["/**\n * Internal dependencies\n */\nimport { BarsView, BarsWrapperView, ContainerView } from './styles';\nimport { BASE_SIZE, WRAPPER_SIZE } from './utils';\nimport { contextConnect, useContextSystem } from '../context';\nimport { COLORS } from '../../utils/colors-values';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @typedef Props\n * @property {import('react').CSSProperties['color']} [color] Color of `Spinner`.\n * @property {number} [size=16] Size of `Spinner`.\n */\n/* eslint-enable jsdoc/valid-types */\n\n/**\n *\n * @param {import('../context').WordPressComponentProps<Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Spinner( props, forwardedRef ) {\n\tconst {\n\t\tcolor = COLORS.black,\n\t\tsize = BASE_SIZE,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Spinner' );\n\tconst ratio = size / BASE_SIZE;\n\tconst scale = ( ratio * BASE_SIZE ) / WRAPPER_SIZE;\n\tconst transform = `scale(${ scale })`;\n\n\tconst styles = { transform };\n\n\treturn (\n\t\t<ContainerView\n\t\t\t{ ...otherProps }\n\t\t\taria-busy={ true }\n\t\t\tref={ forwardedRef }\n\t\t\tstyle={ { height: size, width: size } }\n\t\t>\n\t\t\t<BarsWrapperView aria-hidden={ true } style={ styles }>\n\t\t\t\t<BarsView style={ { color } }>\n\t\t\t\t\t<div className=\"InnerBar1\" />\n\t\t\t\t\t<div className=\"InnerBar2\" />\n\t\t\t\t\t<div className=\"InnerBar3\" />\n\t\t\t\t\t<div className=\"InnerBar4\" />\n\t\t\t\t\t<div className=\"InnerBar5\" />\n\t\t\t\t\t<div className=\"InnerBar6\" />\n\t\t\t\t\t<div className=\"InnerBar7\" />\n\t\t\t\t\t<div className=\"InnerBar8\" />\n\t\t\t\t\t<div className=\"InnerBar9\" />\n\t\t\t\t\t<div className=\"InnerBar10\" />\n\t\t\t\t\t<div className=\"InnerBar11\" />\n\t\t\t\t\t<div className=\"InnerBar12\" />\n\t\t\t\t</BarsView>\n\t\t\t</BarsWrapperView>\n\t\t</ContainerView>\n\t);\n}\n\n/**\n * `Spinner` is a component that notify users that their action is being processed.\n *\n * @example\n * ```jsx\n * import { Spinner } from `@wordpress/components/ui`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Spinner />\n * \t);\n * }\n * ```\n */\nexport default contextConnect( Spinner, 'Spinner' );\n"]}
@@ -21,7 +21,7 @@ import TooltipContent from './content';
21
21
  import { TooltipShortcut } from './styles';
22
22
  /**
23
23
  * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props
24
- * @param {import('react').Ref<any>} forwardedRef
24
+ * @param {import('react').ForwardedRef<any>} forwardedRef
25
25
  */
26
26
 
27
27
  function Tooltip(props, forwardedRef) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/tooltip/component.js"],"names":["TooltipReference","useTooltipState","useMemo","cloneElement","contextConnect","useContextSystem","TooltipContext","TooltipContent","TooltipShortcut","Tooltip","props","forwardedRef","animated","animationDuration","baseId","children","content","focusable","gutter","id","modal","placement","visible","shortcut","otherProps","tooltip","undefined","contextProps","ref","referenceProps","tabIndex","ConnectedTooltip"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA,SAASA,gBA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AAA0C,IAAA,GAAG,EAAGT;AAAhD,KACGK,OADH,EAEGO,QAAQ,IAAI,cAAC,eAAD;AAAiB,IAAA,QAAQ,EAAGA;AAA5B,IAFf,CAFF,EAOGR,QAAQ,IACT,cAAC,gBAAD,eACMU,OADN,EAEMV,QAAQ,CAACL,KAFf;AAGC;AACA,IAAA,GAAG,EAAGK,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEa;AAJjB,MAMKC,cAAF,IAAsB;AACvB,QAAK,CAAEZ,SAAP,EAAmB;AAClBY,MAAAA,cAAc,CAACC,QAAf,GAA0BJ,SAA1B;AACA;;AACD,WAAOvB,YAAY,CAAEY,QAAF,EAAYc,cAAZ,CAAnB;AACA,GAXF,CARF,CADD;AAyBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,gBAAgB,GAAG3B,cAAc,CAAEK,OAAF,EAAW,SAAX,CAAvC;AAEA,eAAesB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport { TooltipReference, useTooltipState } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, cloneElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, useContextSystem } from '../context';\nimport { TooltipContext } from './context';\nimport TooltipContent from './content';\nimport { TooltipShortcut } from './styles';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').Ref<any>} forwardedRef\n */\nfunction Tooltip( props, forwardedRef ) {\n\tconst {\n\t\tanimated = true,\n\t\tanimationDuration = 160,\n\t\tbaseId,\n\t\tchildren,\n\t\tcontent,\n\t\tfocusable = true,\n\t\tgutter = 4,\n\t\tid,\n\t\tmodal = true,\n\t\tplacement,\n\t\tvisible = false,\n\t\tshortcut,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Tooltip' );\n\n\tconst tooltip = useTooltipState( {\n\t\tanimated: animated ? animationDuration : undefined,\n\t\tbaseId: baseId || id,\n\t\tgutter,\n\t\tplacement,\n\t\tvisible,\n\t\t...otherProps,\n\t} );\n\n\tconst contextProps = useMemo(\n\t\t() => ( {\n\t\t\ttooltip,\n\t\t} ),\n\t\t[ tooltip ]\n\t);\n\n\treturn (\n\t\t<TooltipContext.Provider value={ contextProps }>\n\t\t\t{ content && (\n\t\t\t\t<TooltipContent unstable_portal={ modal } ref={ forwardedRef }>\n\t\t\t\t\t{ content }\n\t\t\t\t\t{ shortcut && <TooltipShortcut shortcut={ shortcut } /> }\n\t\t\t\t</TooltipContent>\n\t\t\t) }\n\t\t\t{ children && (\n\t\t\t\t<TooltipReference\n\t\t\t\t\t{ ...tooltip }\n\t\t\t\t\t{ ...children.props }\n\t\t\t\t\t// @ts-ignore If ref doesn't exist that's fine with us, it'll just be undefined, but it can exist on ReactElement and there's no reason to try to scope this (it'll just overcomplicate things)\n\t\t\t\t\tref={ children?.ref }\n\t\t\t\t>\n\t\t\t\t\t{ ( referenceProps ) => {\n\t\t\t\t\t\tif ( ! focusable ) {\n\t\t\t\t\t\t\treferenceProps.tabIndex = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cloneElement( children, referenceProps );\n\t\t\t\t\t} }\n\t\t\t\t</TooltipReference>\n\t\t\t) }\n\t\t</TooltipContext.Provider>\n\t);\n}\n\n/**\n * `Tooltip` is a component that provides context for a user interface element.\n *\n * @example\n * ```jsx\n * import { Tooltip, Text } from `@wordpress/components/ui`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Tooltip content=\"Code is Poetry\">\n * \t\t\t<Text>WordPress.org</Text>\n * \t\t</Tooltip>\n * \t)\n * }\n * ```\n */\nconst ConnectedTooltip = contextConnect( Tooltip, 'Tooltip' );\n\nexport default ConnectedTooltip;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/tooltip/component.js"],"names":["TooltipReference","useTooltipState","useMemo","cloneElement","contextConnect","useContextSystem","TooltipContext","TooltipContent","TooltipShortcut","Tooltip","props","forwardedRef","animated","animationDuration","baseId","children","content","focusable","gutter","id","modal","placement","visible","shortcut","otherProps","tooltip","undefined","contextProps","ref","referenceProps","tabIndex","ConnectedTooltip"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,eAA3B,QAAkD,QAAlD;AAEA;AACA;AACA;;AACA,SAASC,OAAT,EAAkBC,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,cAAT,EAAyBC,gBAAzB,QAAiD,YAAjD;AACA,SAASC,cAAT,QAA+B,WAA/B;AACA,OAAOC,cAAP,MAA2B,WAA3B;AACA,SAASC,eAAT,QAAgC,UAAhC;AAEA;AACA;AACA;AACA;;AACA,SAASC,OAAT,CAAkBC,KAAlB,EAAyBC,YAAzB,EAAwC;AACvC,QAAM;AACLC,IAAAA,QAAQ,GAAG,IADN;AAELC,IAAAA,iBAAiB,GAAG,GAFf;AAGLC,IAAAA,MAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,OALK;AAMLC,IAAAA,SAAS,GAAG,IANP;AAOLC,IAAAA,MAAM,GAAG,CAPJ;AAQLC,IAAAA,EARK;AASLC,IAAAA,KAAK,GAAG,IATH;AAULC,IAAAA,SAVK;AAWLC,IAAAA,OAAO,GAAG,KAXL;AAYLC,IAAAA,QAZK;AAaL,OAAGC;AAbE,MAcFnB,gBAAgB,CAAEK,KAAF,EAAS,SAAT,CAdpB;AAgBA,QAAMe,OAAO,GAAGxB,eAAe,CAAE;AAChCW,IAAAA,QAAQ,EAAEA,QAAQ,GAAGC,iBAAH,GAAuBa,SADT;AAEhCZ,IAAAA,MAAM,EAAEA,MAAM,IAAIK,EAFc;AAGhCD,IAAAA,MAHgC;AAIhCG,IAAAA,SAJgC;AAKhCC,IAAAA,OALgC;AAMhC,OAAGE;AAN6B,GAAF,CAA/B;AASA,QAAMG,YAAY,GAAGzB,OAAO,CAC3B,OAAQ;AACPuB,IAAAA;AADO,GAAR,CAD2B,EAI3B,CAAEA,OAAF,CAJ2B,CAA5B;AAOA,SACC,cAAC,cAAD,CAAgB,QAAhB;AAAyB,IAAA,KAAK,EAAGE;AAAjC,KACGX,OAAO,IACR,cAAC,cAAD;AAAgB,IAAA,eAAe,EAAGI,KAAlC;AAA0C,IAAA,GAAG,EAAGT;AAAhD,KACGK,OADH,EAEGO,QAAQ,IAAI,cAAC,eAAD;AAAiB,IAAA,QAAQ,EAAGA;AAA5B,IAFf,CAFF,EAOGR,QAAQ,IACT,cAAC,gBAAD,eACMU,OADN,EAEMV,QAAQ,CAACL,KAFf;AAGC;AACA,IAAA,GAAG,EAAGK,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAEa;AAJjB,MAMKC,cAAF,IAAsB;AACvB,QAAK,CAAEZ,SAAP,EAAmB;AAClBY,MAAAA,cAAc,CAACC,QAAf,GAA0BJ,SAA1B;AACA;;AACD,WAAOvB,YAAY,CAAEY,QAAF,EAAYc,cAAZ,CAAnB;AACA,GAXF,CARF,CADD;AAyBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAME,gBAAgB,GAAG3B,cAAc,CAAEK,OAAF,EAAW,SAAX,CAAvC;AAEA,eAAesB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport { TooltipReference, useTooltipState } from 'reakit';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, cloneElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { contextConnect, useContextSystem } from '../context';\nimport { TooltipContext } from './context';\nimport TooltipContent from './content';\nimport { TooltipShortcut } from './styles';\n\n/**\n * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props\n * @param {import('react').ForwardedRef<any>} forwardedRef\n */\nfunction Tooltip( props, forwardedRef ) {\n\tconst {\n\t\tanimated = true,\n\t\tanimationDuration = 160,\n\t\tbaseId,\n\t\tchildren,\n\t\tcontent,\n\t\tfocusable = true,\n\t\tgutter = 4,\n\t\tid,\n\t\tmodal = true,\n\t\tplacement,\n\t\tvisible = false,\n\t\tshortcut,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Tooltip' );\n\n\tconst tooltip = useTooltipState( {\n\t\tanimated: animated ? animationDuration : undefined,\n\t\tbaseId: baseId || id,\n\t\tgutter,\n\t\tplacement,\n\t\tvisible,\n\t\t...otherProps,\n\t} );\n\n\tconst contextProps = useMemo(\n\t\t() => ( {\n\t\t\ttooltip,\n\t\t} ),\n\t\t[ tooltip ]\n\t);\n\n\treturn (\n\t\t<TooltipContext.Provider value={ contextProps }>\n\t\t\t{ content && (\n\t\t\t\t<TooltipContent unstable_portal={ modal } ref={ forwardedRef }>\n\t\t\t\t\t{ content }\n\t\t\t\t\t{ shortcut && <TooltipShortcut shortcut={ shortcut } /> }\n\t\t\t\t</TooltipContent>\n\t\t\t) }\n\t\t\t{ children && (\n\t\t\t\t<TooltipReference\n\t\t\t\t\t{ ...tooltip }\n\t\t\t\t\t{ ...children.props }\n\t\t\t\t\t// @ts-ignore If ref doesn't exist that's fine with us, it'll just be undefined, but it can exist on ReactElement and there's no reason to try to scope this (it'll just overcomplicate things)\n\t\t\t\t\tref={ children?.ref }\n\t\t\t\t>\n\t\t\t\t\t{ ( referenceProps ) => {\n\t\t\t\t\t\tif ( ! focusable ) {\n\t\t\t\t\t\t\treferenceProps.tabIndex = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn cloneElement( children, referenceProps );\n\t\t\t\t\t} }\n\t\t\t\t</TooltipReference>\n\t\t\t) }\n\t\t</TooltipContext.Provider>\n\t);\n}\n\n/**\n * `Tooltip` is a component that provides context for a user interface element.\n *\n * @example\n * ```jsx\n * import { Tooltip, Text } from `@wordpress/components/ui`;\n *\n * function Example() {\n * \treturn (\n * \t\t<Tooltip content=\"Code is Poetry\">\n * \t\t\t<Text>WordPress.org</Text>\n * \t\t</Tooltip>\n * \t)\n * }\n * ```\n */\nconst ConnectedTooltip = contextConnect( Tooltip, 'Tooltip' );\n\nexport default ConnectedTooltip;\n"]}
@@ -21,7 +21,7 @@ const {
21
21
  /**
22
22
  *
23
23
  * @param {import('../context').WordPressComponentProps<import('./types').ContentProps, 'div'>} props
24
- * @param {import('react').Ref<any>} forwardedRef
24
+ * @param {import('react').ForwardedRef<any>} forwardedRef
25
25
  */
26
26
 
27
27
  function TooltipContent(props, forwardedRef) {