@wordpress/components 28.6.0 → 28.8.1-next.5368f64a9.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 (644) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/CONTRIBUTING.md +42 -19
  3. package/build/alignment-matrix-control/cell.js +4 -7
  4. package/build/alignment-matrix-control/cell.js.map +1 -1
  5. package/build/alignment-matrix-control/icon.js +31 -19
  6. package/build/alignment-matrix-control/icon.js.map +1 -1
  7. package/build/alignment-matrix-control/index.js +55 -51
  8. package/build/alignment-matrix-control/index.js.map +1 -1
  9. package/build/alignment-matrix-control/styles.js +73 -0
  10. package/build/alignment-matrix-control/styles.js.map +1 -0
  11. package/build/alignment-matrix-control/types.js.map +1 -1
  12. package/build/angle-picker-control/angle-circle.js +9 -9
  13. package/build/angle-picker-control/angle-circle.js.map +1 -1
  14. package/build/border-control/border-control/component.js +18 -13
  15. package/build/border-control/border-control/component.js.map +1 -1
  16. package/build/circular-option-picker/circular-option-picker-option.js +15 -9
  17. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  18. package/build/circular-option-picker/circular-option-picker.js +15 -12
  19. package/build/circular-option-picker/circular-option-picker.js.map +1 -1
  20. package/build/circular-option-picker/types.js.map +1 -1
  21. package/build/clipboard-button/index.js +6 -6
  22. package/build/clipboard-button/index.js.map +1 -1
  23. package/build/color-palette/utils.js +1 -2
  24. package/build/color-palette/utils.js.map +1 -1
  25. package/build/color-picker/color-copy-button.js +8 -8
  26. package/build/color-picker/color-copy-button.js.map +1 -1
  27. package/build/color-picker/hex-input.js +8 -8
  28. package/build/color-picker/hex-input.js.map +1 -1
  29. package/build/color-picker/input-with-slider.js +8 -8
  30. package/build/color-picker/input-with-slider.js.map +1 -1
  31. package/build/color-picker/styles.js +8 -8
  32. package/build/color-picker/styles.js.map +1 -1
  33. package/build/combobox-control/types.js.map +1 -1
  34. package/build/composite/context.js +1 -1
  35. package/build/composite/context.js.map +1 -1
  36. package/build/composite/group-label.js +33 -0
  37. package/build/composite/group-label.js.map +1 -0
  38. package/build/composite/group.js +33 -0
  39. package/build/composite/group.js.map +1 -0
  40. package/build/composite/hover.js +33 -0
  41. package/build/composite/hover.js.map +1 -0
  42. package/build/composite/index.js +63 -118
  43. package/build/composite/index.js.map +1 -1
  44. package/build/composite/item.js +33 -0
  45. package/build/composite/item.js.map +1 -0
  46. package/build/composite/legacy/index.js +59 -7
  47. package/build/composite/legacy/index.js.map +1 -1
  48. package/build/composite/row.js +33 -0
  49. package/build/composite/row.js.map +1 -0
  50. package/build/composite/typeahead.js +33 -0
  51. package/build/composite/typeahead.js.map +1 -0
  52. package/build/composite/types.js.map +1 -1
  53. package/build/custom-gradient-picker/gradient-bar/control-points.js +8 -8
  54. package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  55. package/build/custom-select-control-v2/styles.js +12 -14
  56. package/build/custom-select-control-v2/styles.js.map +1 -1
  57. package/build/date-time/date/index.js +1 -1
  58. package/build/date-time/date/index.js.map +1 -1
  59. package/build/date-time/date/styles.js +37 -26
  60. package/build/date-time/date/styles.js.map +1 -1
  61. package/build/date-time/date/use-lilius/index.js +163 -0
  62. package/build/date-time/date/use-lilius/index.js.map +1 -0
  63. package/build/date-time/time/time-input/index.js +17 -19
  64. package/build/date-time/time/time-input/index.js.map +1 -1
  65. package/build/dimension-control/index.js +6 -1
  66. package/build/dimension-control/index.js.map +1 -1
  67. package/build/draggable/index.js +4 -4
  68. package/build/draggable/index.js.map +1 -1
  69. package/build/dropdown-menu-v2/checkbox-item.js +69 -0
  70. package/build/dropdown-menu-v2/checkbox-item.js.map +1 -0
  71. package/build/dropdown-menu-v2/context.js +17 -0
  72. package/build/dropdown-menu-v2/context.js.map +1 -0
  73. package/build/dropdown-menu-v2/group-label.js +40 -0
  74. package/build/dropdown-menu-v2/group-label.js.map +1 -0
  75. package/build/dropdown-menu-v2/group.js +29 -0
  76. package/build/dropdown-menu-v2/group.js.map +1 -0
  77. package/build/dropdown-menu-v2/index.js +58 -146
  78. package/build/dropdown-menu-v2/index.js.map +1 -1
  79. package/build/dropdown-menu-v2/item-help-text.js +27 -0
  80. package/build/dropdown-menu-v2/item-help-text.js.map +1 -0
  81. package/build/dropdown-menu-v2/item-label.js +27 -0
  82. package/build/dropdown-menu-v2/item-label.js.map +1 -0
  83. package/build/dropdown-menu-v2/item.js +53 -0
  84. package/build/dropdown-menu-v2/item.js.map +1 -0
  85. package/build/dropdown-menu-v2/radio-item.js +79 -0
  86. package/build/dropdown-menu-v2/radio-item.js.map +1 -0
  87. package/build/dropdown-menu-v2/separator.js +30 -0
  88. package/build/dropdown-menu-v2/separator.js.map +1 -0
  89. package/build/dropdown-menu-v2/styles.js +54 -78
  90. package/build/dropdown-menu-v2/styles.js.map +1 -1
  91. package/build/dropdown-menu-v2/types.js.map +1 -1
  92. package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js +27 -0
  93. package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +1 -0
  94. package/build/focal-point-picker/styles/focal-point-style.js +7 -2
  95. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  96. package/build/form-token-field/types.js.map +1 -1
  97. package/build/index.js +13 -0
  98. package/build/index.js.map +1 -1
  99. package/build/input-control/index.js +2 -2
  100. package/build/input-control/index.js.map +1 -1
  101. package/build/input-control/input-base.js +5 -10
  102. package/build/input-control/input-base.js.map +1 -1
  103. package/build/input-control/input-prefix-wrapper.js +3 -3
  104. package/build/input-control/input-prefix-wrapper.js.map +1 -1
  105. package/build/input-control/input-suffix-wrapper.js +2 -3
  106. package/build/input-control/input-suffix-wrapper.js.map +1 -1
  107. package/build/input-control/reducer/reducer.js +8 -8
  108. package/build/input-control/reducer/reducer.js.map +1 -1
  109. package/build/input-control/styles/input-control-styles.js +75 -45
  110. package/build/input-control/styles/input-control-styles.js.map +1 -1
  111. package/build/input-control/types.js.map +1 -1
  112. package/build/input-control/utils.js +3 -3
  113. package/build/input-control/utils.js.map +1 -1
  114. package/build/item-group/styles.js +10 -10
  115. package/build/item-group/styles.js.map +1 -1
  116. package/build/modal/index.js +16 -9
  117. package/build/modal/index.js.map +1 -1
  118. package/build/navigation/index.js +4 -4
  119. package/build/navigation/index.js.map +1 -1
  120. package/build/navigation/styles/navigation-styles.js +13 -13
  121. package/build/navigation/styles/navigation-styles.js.map +1 -1
  122. package/build/navigator/index.js +12 -13
  123. package/build/navigator/index.js.map +1 -1
  124. package/build/navigator/navigator-back-button/hook.js +2 -2
  125. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  126. package/build/navigator/navigator-button/hook.js +2 -2
  127. package/build/navigator/navigator-button/hook.js.map +1 -1
  128. package/build/navigator/navigator-provider/component.js +99 -67
  129. package/build/navigator/navigator-provider/component.js.map +1 -1
  130. package/build/navigator/navigator-screen/component.js +5 -0
  131. package/build/navigator/navigator-screen/component.js.map +1 -1
  132. package/build/navigator/navigator-to-parent-button/component.js +2 -2
  133. package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
  134. package/build/navigator/types.js.map +1 -1
  135. package/build/navigator/use-navigator.js +1 -2
  136. package/build/navigator/use-navigator.js.map +1 -1
  137. package/build/palette-edit/index.js +2 -2
  138. package/build/palette-edit/index.js.map +1 -1
  139. package/build/private-apis.js +1 -14
  140. package/build/private-apis.js.map +1 -1
  141. package/build/range-control/styles/range-control-styles.js +30 -30
  142. package/build/range-control/styles/range-control-styles.js.map +1 -1
  143. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  144. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  145. package/build/select-control/styles/select-control-styles.js +12 -12
  146. package/build/select-control/styles/select-control-styles.js.map +1 -1
  147. package/build/slot-fill/bubbles-virtually/fill.js +4 -4
  148. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  149. package/build/slot-fill/index.js +1 -0
  150. package/build/slot-fill/index.js.map +1 -1
  151. package/build/snackbar/index.js +4 -4
  152. package/build/snackbar/index.js.map +1 -1
  153. package/build/tabs/index.js +4 -4
  154. package/build/tabs/index.js.map +1 -1
  155. package/build/tabs/styles.js +3 -3
  156. package/build/tabs/styles.js.map +1 -1
  157. package/build/tabs/tablist.js +5 -4
  158. package/build/tabs/tablist.js.map +1 -1
  159. package/build/toggle-group-control/toggle-group-control/utils.js +6 -6
  160. package/build/toggle-group-control/toggle-group-control/utils.js.map +1 -1
  161. package/build/tools-panel/tools-panel/hook.js +6 -6
  162. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  163. package/build/unit-control/styles/unit-control-styles.js +7 -7
  164. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  165. package/build/utils/config-values.js +6 -4
  166. package/build/utils/config-values.js.map +1 -1
  167. package/build/utils/element-rect.js +73 -105
  168. package/build/utils/element-rect.js.map +1 -1
  169. package/build/utils/hooks/use-update-effect.js +4 -4
  170. package/build/utils/hooks/use-update-effect.js.map +1 -1
  171. package/build-module/alignment-matrix-control/cell.js +2 -5
  172. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  173. package/build-module/alignment-matrix-control/icon.js +31 -19
  174. package/build-module/alignment-matrix-control/icon.js.map +1 -1
  175. package/build-module/alignment-matrix-control/index.js +55 -50
  176. package/build-module/alignment-matrix-control/index.js.map +1 -1
  177. package/build-module/alignment-matrix-control/styles.js +70 -0
  178. package/build-module/alignment-matrix-control/styles.js.map +1 -0
  179. package/build-module/alignment-matrix-control/types.js.map +1 -1
  180. package/build-module/angle-picker-control/angle-circle.js +9 -9
  181. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  182. package/build-module/border-control/border-control/component.js +18 -13
  183. package/build-module/border-control/border-control/component.js.map +1 -1
  184. package/build-module/circular-option-picker/circular-option-picker-option.js +16 -10
  185. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  186. package/build-module/circular-option-picker/circular-option-picker.js +16 -13
  187. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  188. package/build-module/circular-option-picker/types.js.map +1 -1
  189. package/build-module/clipboard-button/index.js +6 -6
  190. package/build-module/clipboard-button/index.js.map +1 -1
  191. package/build-module/color-palette/utils.js +1 -2
  192. package/build-module/color-palette/utils.js.map +1 -1
  193. package/build-module/color-picker/color-copy-button.js +8 -8
  194. package/build-module/color-picker/color-copy-button.js.map +1 -1
  195. package/build-module/color-picker/hex-input.js +7 -8
  196. package/build-module/color-picker/hex-input.js.map +1 -1
  197. package/build-module/color-picker/input-with-slider.js +7 -8
  198. package/build-module/color-picker/input-with-slider.js.map +1 -1
  199. package/build-module/color-picker/styles.js +8 -8
  200. package/build-module/color-picker/styles.js.map +1 -1
  201. package/build-module/combobox-control/types.js.map +1 -1
  202. package/build-module/composite/context.js +1 -1
  203. package/build-module/composite/context.js.map +1 -1
  204. package/build-module/composite/group-label.js +25 -0
  205. package/build-module/composite/group-label.js.map +1 -0
  206. package/build-module/composite/group.js +25 -0
  207. package/build-module/composite/group.js.map +1 -0
  208. package/build-module/composite/hover.js +25 -0
  209. package/build-module/composite/hover.js.map +1 -0
  210. package/build-module/composite/index.js +64 -118
  211. package/build-module/composite/index.js.map +1 -1
  212. package/build-module/composite/item.js +25 -0
  213. package/build-module/composite/item.js.map +1 -0
  214. package/build-module/composite/legacy/index.js +57 -8
  215. package/build-module/composite/legacy/index.js.map +1 -1
  216. package/build-module/composite/row.js +25 -0
  217. package/build-module/composite/row.js.map +1 -0
  218. package/build-module/composite/typeahead.js +25 -0
  219. package/build-module/composite/typeahead.js.map +1 -0
  220. package/build-module/composite/types.js.map +1 -1
  221. package/build-module/custom-gradient-picker/gradient-bar/control-points.js +8 -8
  222. package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
  223. package/build-module/custom-select-control-v2/styles.js +12 -14
  224. package/build-module/custom-select-control-v2/styles.js.map +1 -1
  225. package/build-module/date-time/date/index.js +1 -2
  226. package/build-module/date-time/date/index.js.map +1 -1
  227. package/build-module/date-time/date/styles.js +33 -26
  228. package/build-module/date-time/date/styles.js.map +1 -1
  229. package/build-module/date-time/date/use-lilius/index.js +158 -0
  230. package/build-module/date-time/date/use-lilius/index.js.map +1 -0
  231. package/build-module/date-time/time/time-input/index.js +17 -19
  232. package/build-module/date-time/time/time-input/index.js.map +1 -1
  233. package/build-module/dimension-control/index.js +6 -1
  234. package/build-module/dimension-control/index.js.map +1 -1
  235. package/build-module/draggable/index.js +4 -4
  236. package/build-module/draggable/index.js.map +1 -1
  237. package/build-module/dropdown-menu-v2/checkbox-item.js +62 -0
  238. package/build-module/dropdown-menu-v2/checkbox-item.js.map +1 -0
  239. package/build-module/dropdown-menu-v2/context.js +11 -0
  240. package/build-module/dropdown-menu-v2/context.js.map +1 -0
  241. package/build-module/dropdown-menu-v2/group-label.js +32 -0
  242. package/build-module/dropdown-menu-v2/group-label.js.map +1 -0
  243. package/build-module/dropdown-menu-v2/group.js +21 -0
  244. package/build-module/dropdown-menu-v2/group.js.map +1 -0
  245. package/build-module/dropdown-menu-v2/index.js +57 -144
  246. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  247. package/build-module/dropdown-menu-v2/item-help-text.js +19 -0
  248. package/build-module/dropdown-menu-v2/item-help-text.js.map +1 -0
  249. package/build-module/dropdown-menu-v2/item-label.js +19 -0
  250. package/build-module/dropdown-menu-v2/item-label.js.map +1 -0
  251. package/build-module/dropdown-menu-v2/item.js +46 -0
  252. package/build-module/dropdown-menu-v2/item.js.map +1 -0
  253. package/build-module/dropdown-menu-v2/radio-item.js +72 -0
  254. package/build-module/dropdown-menu-v2/radio-item.js.map +1 -0
  255. package/build-module/dropdown-menu-v2/separator.js +22 -0
  256. package/build-module/dropdown-menu-v2/separator.js.map +1 -0
  257. package/build-module/dropdown-menu-v2/styles.js +54 -78
  258. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  259. package/build-module/dropdown-menu-v2/types.js.map +1 -1
  260. package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js +20 -0
  261. package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +1 -0
  262. package/build-module/focal-point-picker/styles/focal-point-style.js +6 -2
  263. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  264. package/build-module/form-token-field/types.js.map +1 -1
  265. package/build-module/index.js +3 -1
  266. package/build-module/index.js.map +1 -1
  267. package/build-module/input-control/index.js +2 -2
  268. package/build-module/input-control/index.js.map +1 -1
  269. package/build-module/input-control/input-base.js +6 -11
  270. package/build-module/input-control/input-base.js.map +1 -1
  271. package/build-module/input-control/input-prefix-wrapper.js +4 -3
  272. package/build-module/input-control/input-prefix-wrapper.js.map +1 -1
  273. package/build-module/input-control/input-suffix-wrapper.js +3 -3
  274. package/build-module/input-control/input-suffix-wrapper.js.map +1 -1
  275. package/build-module/input-control/reducer/reducer.js +8 -8
  276. package/build-module/input-control/reducer/reducer.js.map +1 -1
  277. package/build-module/input-control/styles/input-control-styles.js +74 -44
  278. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  279. package/build-module/input-control/types.js.map +1 -1
  280. package/build-module/input-control/utils.js +3 -3
  281. package/build-module/input-control/utils.js.map +1 -1
  282. package/build-module/item-group/styles.js +10 -10
  283. package/build-module/item-group/styles.js.map +1 -1
  284. package/build-module/modal/index.js +17 -9
  285. package/build-module/modal/index.js.map +1 -1
  286. package/build-module/navigation/index.js +4 -4
  287. package/build-module/navigation/index.js.map +1 -1
  288. package/build-module/navigation/styles/navigation-styles.js +14 -14
  289. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  290. package/build-module/navigator/index.js +6 -6
  291. package/build-module/navigator/index.js.map +1 -1
  292. package/build-module/navigator/navigator-back-button/hook.js +1 -1
  293. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  294. package/build-module/navigator/navigator-button/hook.js +1 -1
  295. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  296. package/build-module/navigator/navigator-provider/component.js +99 -67
  297. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  298. package/build-module/navigator/navigator-screen/component.js +4 -0
  299. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  300. package/build-module/navigator/navigator-to-parent-button/component.js +1 -1
  301. package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
  302. package/build-module/navigator/types.js.map +1 -1
  303. package/build-module/navigator/use-navigator.js +1 -2
  304. package/build-module/navigator/use-navigator.js.map +1 -1
  305. package/build-module/palette-edit/index.js +2 -2
  306. package/build-module/palette-edit/index.js.map +1 -1
  307. package/build-module/private-apis.js +1 -14
  308. package/build-module/private-apis.js.map +1 -1
  309. package/build-module/range-control/styles/range-control-styles.js +31 -31
  310. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  311. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
  312. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  313. package/build-module/select-control/styles/select-control-styles.js +13 -13
  314. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  315. package/build-module/slot-fill/bubbles-virtually/fill.js +4 -4
  316. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  317. package/build-module/slot-fill/index.js +1 -0
  318. package/build-module/slot-fill/index.js.map +1 -1
  319. package/build-module/snackbar/index.js +4 -4
  320. package/build-module/snackbar/index.js.map +1 -1
  321. package/build-module/tabs/index.js +4 -4
  322. package/build-module/tabs/index.js.map +1 -1
  323. package/build-module/tabs/styles.js +4 -4
  324. package/build-module/tabs/styles.js.map +1 -1
  325. package/build-module/tabs/tablist.js +5 -4
  326. package/build-module/tabs/tablist.js.map +1 -1
  327. package/build-module/toggle-group-control/toggle-group-control/utils.js +6 -6
  328. package/build-module/toggle-group-control/toggle-group-control/utils.js.map +1 -1
  329. package/build-module/tools-panel/tools-panel/hook.js +6 -6
  330. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  331. package/build-module/unit-control/styles/unit-control-styles.js +7 -7
  332. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  333. package/build-module/utils/config-values.js +6 -4
  334. package/build-module/utils/config-values.js.map +1 -1
  335. package/build-module/utils/element-rect.js +74 -105
  336. package/build-module/utils/element-rect.js.map +1 -1
  337. package/build-module/utils/hooks/use-update-effect.js +4 -4
  338. package/build-module/utils/hooks/use-update-effect.js.map +1 -1
  339. package/build-style/style-rtl.css +11 -27
  340. package/build-style/style.css +11 -27
  341. package/build-types/alignment-matrix-control/cell.d.ts +1 -1
  342. package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
  343. package/build-types/alignment-matrix-control/icon.d.ts +1 -1
  344. package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
  345. package/build-types/alignment-matrix-control/index.d.ts +16 -6
  346. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  347. package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
  348. package/build-types/alignment-matrix-control/{styles/alignment-matrix-control-styles.d.ts → styles.d.ts} +9 -10
  349. package/build-types/alignment-matrix-control/styles.d.ts.map +1 -0
  350. package/build-types/alignment-matrix-control/types.d.ts +12 -1
  351. package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
  352. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
  353. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  354. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  355. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  356. package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
  357. package/build-types/circular-option-picker/types.d.ts +2 -2
  358. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  359. package/build-types/color-palette/utils.d.ts.map +1 -1
  360. package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
  361. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  362. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  363. package/build-types/color-picker/styles.d.ts.map +1 -1
  364. package/build-types/combobox-control/types.d.ts +1 -0
  365. package/build-types/combobox-control/types.d.ts.map +1 -1
  366. package/build-types/composite/context.d.ts.map +1 -1
  367. package/build-types/composite/group-label.d.ts +3 -0
  368. package/build-types/composite/group-label.d.ts.map +1 -0
  369. package/build-types/composite/group.d.ts +3 -0
  370. package/build-types/composite/group.d.ts.map +1 -0
  371. package/build-types/composite/hover.d.ts +3 -0
  372. package/build-types/composite/hover.d.ts.map +1 -0
  373. package/build-types/composite/index.d.ts +63 -47
  374. package/build-types/composite/index.d.ts.map +1 -1
  375. package/build-types/composite/item.d.ts +3 -0
  376. package/build-types/composite/item.d.ts.map +1 -0
  377. package/build-types/composite/legacy/index.d.ts +23 -3
  378. package/build-types/composite/legacy/index.d.ts.map +1 -1
  379. package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
  380. package/build-types/composite/row.d.ts +3 -0
  381. package/build-types/composite/row.d.ts.map +1 -0
  382. package/build-types/composite/stories/index.story.d.ts +9 -8
  383. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  384. package/build-types/composite/typeahead.d.ts +3 -0
  385. package/build-types/composite/typeahead.d.ts.map +1 -0
  386. package/build-types/composite/types.d.ts +12 -11
  387. package/build-types/composite/types.d.ts.map +1 -1
  388. package/build-types/date-time/date/index.d.ts +0 -3
  389. package/build-types/date-time/date/index.d.ts.map +1 -1
  390. package/build-types/date-time/date/styles.d.ts.map +1 -1
  391. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  392. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  393. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  394. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  395. package/build-types/date-time/time/time-input/index.d.ts.map +1 -1
  396. package/build-types/dimension-control/index.d.ts +1 -1
  397. package/build-types/dimension-control/index.d.ts.map +1 -1
  398. package/build-types/dimension-control/stories/index.story.d.ts +5 -0
  399. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
  400. package/build-types/dropdown-menu-v2/checkbox-item.d.ts +3 -0
  401. package/build-types/dropdown-menu-v2/checkbox-item.d.ts.map +1 -0
  402. package/build-types/dropdown-menu-v2/context.d.ts +6 -0
  403. package/build-types/dropdown-menu-v2/context.d.ts.map +1 -0
  404. package/build-types/dropdown-menu-v2/group-label.d.ts +3 -0
  405. package/build-types/dropdown-menu-v2/group-label.d.ts.map +1 -0
  406. package/build-types/dropdown-menu-v2/group.d.ts +3 -0
  407. package/build-types/dropdown-menu-v2/group.d.ts.map +1 -0
  408. package/build-types/dropdown-menu-v2/index.d.ts +39 -18
  409. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
  410. package/build-types/dropdown-menu-v2/item-help-text.d.ts +6 -0
  411. package/build-types/dropdown-menu-v2/item-help-text.d.ts.map +1 -0
  412. package/build-types/dropdown-menu-v2/item-label.d.ts +6 -0
  413. package/build-types/dropdown-menu-v2/item-label.d.ts.map +1 -0
  414. package/build-types/dropdown-menu-v2/item.d.ts +3 -0
  415. package/build-types/dropdown-menu-v2/item.d.ts.map +1 -0
  416. package/build-types/dropdown-menu-v2/radio-item.d.ts +3 -0
  417. package/build-types/dropdown-menu-v2/radio-item.d.ts.map +1 -0
  418. package/build-types/dropdown-menu-v2/separator.d.ts +3 -0
  419. package/build-types/dropdown-menu-v2/separator.d.ts.map +1 -0
  420. package/build-types/dropdown-menu-v2/stories/index.story.d.ts +10 -10
  421. package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
  422. package/build-types/dropdown-menu-v2/styles.d.ts +14 -6
  423. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
  424. package/build-types/dropdown-menu-v2/types.d.ts +6 -0
  425. package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
  426. package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts +8 -0
  427. package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts.map +1 -0
  428. package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -1
  429. package/build-types/form-token-field/types.d.ts +1 -0
  430. package/build-types/form-token-field/types.d.ts.map +1 -1
  431. package/build-types/index.d.ts +4 -1
  432. package/build-types/index.d.ts.map +1 -1
  433. package/build-types/input-control/input-base.d.ts.map +1 -1
  434. package/build-types/input-control/input-prefix-wrapper.d.ts +2 -2
  435. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
  436. package/build-types/input-control/input-suffix-wrapper.d.ts +2 -2
  437. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
  438. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  439. package/build-types/input-control/stories/index.story.d.ts +9 -0
  440. package/build-types/input-control/stories/index.story.d.ts.map +1 -1
  441. package/build-types/input-control/styles/input-control-styles.d.ts +15 -9
  442. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  443. package/build-types/input-control/types.d.ts +23 -6
  444. package/build-types/input-control/types.d.ts.map +1 -1
  445. package/build-types/modal/index.d.ts.map +1 -1
  446. package/build-types/modal/stories/index.story.d.ts +3 -0
  447. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  448. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  449. package/build-types/navigator/index.d.ts +6 -6
  450. package/build-types/navigator/index.d.ts.map +1 -1
  451. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  452. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  453. package/build-types/navigator/stories/index.story.d.ts +1 -1
  454. package/build-types/navigator/stories/index.story.d.ts.map +1 -1
  455. package/build-types/navigator/types.d.ts +3 -1
  456. package/build-types/navigator/types.d.ts.map +1 -1
  457. package/build-types/navigator/use-navigator.d.ts +1 -2
  458. package/build-types/navigator/use-navigator.d.ts.map +1 -1
  459. package/build-types/private-apis.d.ts.map +1 -1
  460. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  461. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  462. package/build-types/select-control/styles/select-control-styles.d.ts +1 -1
  463. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  464. package/build-types/slot-fill/index.d.ts +3 -0
  465. package/build-types/slot-fill/index.d.ts.map +1 -1
  466. package/build-types/tabs/index.d.ts.map +1 -1
  467. package/build-types/tabs/styles.d.ts.map +1 -1
  468. package/build-types/tabs/tablist.d.ts.map +1 -1
  469. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  470. package/build-types/utils/config-values.d.ts +3 -3
  471. package/build-types/utils/element-rect.d.ts +32 -74
  472. package/build-types/utils/element-rect.d.ts.map +1 -1
  473. package/package.json +19 -20
  474. package/src/alignment-matrix-control/README.md +1 -5
  475. package/src/alignment-matrix-control/cell.tsx +3 -9
  476. package/src/alignment-matrix-control/icon.tsx +48 -30
  477. package/src/alignment-matrix-control/index.tsx +60 -50
  478. package/src/alignment-matrix-control/stories/index.story.tsx +3 -12
  479. package/src/alignment-matrix-control/styles.ts +113 -0
  480. package/src/alignment-matrix-control/types.ts +12 -1
  481. package/src/angle-picker-control/angle-circle.tsx +11 -9
  482. package/src/border-control/border-control/component.tsx +23 -16
  483. package/src/circular-option-picker/circular-option-picker-option.tsx +16 -19
  484. package/src/circular-option-picker/circular-option-picker.tsx +26 -12
  485. package/src/circular-option-picker/types.ts +2 -2
  486. package/src/clipboard-button/index.tsx +6 -6
  487. package/src/color-palette/test/utils.ts +21 -2
  488. package/src/color-palette/utils.ts +1 -3
  489. package/src/color-picker/color-copy-button.tsx +10 -8
  490. package/src/color-picker/hex-input.tsx +6 -10
  491. package/src/color-picker/input-with-slider.tsx +6 -10
  492. package/src/color-picker/styles.ts +1 -1
  493. package/src/combobox-control/types.ts +1 -0
  494. package/src/composite/README.md +5 -24
  495. package/src/composite/{context.ts → context.tsx} +1 -2
  496. package/src/composite/group-label.tsx +30 -0
  497. package/src/composite/group.tsx +30 -0
  498. package/src/composite/hover.tsx +30 -0
  499. package/src/composite/index.tsx +71 -166
  500. package/src/composite/item.tsx +30 -0
  501. package/src/composite/legacy/index.tsx +73 -11
  502. package/src/composite/legacy/stories/index.story.tsx +2 -1
  503. package/src/composite/legacy/test/index.tsx +57 -1
  504. package/src/composite/row.tsx +30 -0
  505. package/src/composite/stories/index.story.tsx +254 -365
  506. package/src/composite/typeahead.tsx +30 -0
  507. package/src/composite/types.ts +14 -16
  508. package/src/custom-gradient-picker/gradient-bar/control-points.tsx +10 -10
  509. package/src/custom-gradient-picker/style.scss +2 -21
  510. package/src/custom-select-control-v2/styles.ts +4 -4
  511. package/src/date-time/date/index.tsx +1 -1
  512. package/src/date-time/date/styles.ts +33 -13
  513. package/src/date-time/date/test/use-lilius.ts +417 -0
  514. package/src/date-time/date/use-lilius/index.ts +394 -0
  515. package/src/date-time/time/test/index.tsx +3 -6
  516. package/src/date-time/time/time-input/index.tsx +25 -25
  517. package/src/date-time/time/time-input/test/index.tsx +6 -7
  518. package/src/dimension-control/README.md +4 -0
  519. package/src/dimension-control/index.tsx +7 -1
  520. package/src/dimension-control/stories/index.story.tsx +7 -2
  521. package/src/dimension-control/test/__snapshots__/index.test.js.snap +16 -16
  522. package/src/dimension-control/test/index.test.js +1 -0
  523. package/src/draggable/index.tsx +4 -4
  524. package/src/dropdown-menu-v2/README.md +73 -60
  525. package/src/dropdown-menu-v2/checkbox-item.tsx +63 -0
  526. package/src/dropdown-menu-v2/context.tsx +13 -0
  527. package/src/dropdown-menu-v2/group-label.tsx +37 -0
  528. package/src/dropdown-menu-v2/group.tsx +26 -0
  529. package/src/dropdown-menu-v2/index.tsx +57 -197
  530. package/src/dropdown-menu-v2/item-help-text.tsx +23 -0
  531. package/src/dropdown-menu-v2/item-label.tsx +23 -0
  532. package/src/dropdown-menu-v2/item.tsx +50 -0
  533. package/src/dropdown-menu-v2/radio-item.tsx +70 -0
  534. package/src/dropdown-menu-v2/separator.tsx +27 -0
  535. package/src/dropdown-menu-v2/stories/index.story.tsx +295 -262
  536. package/src/dropdown-menu-v2/styles.ts +102 -66
  537. package/src/dropdown-menu-v2/test/index.tsx +159 -132
  538. package/src/dropdown-menu-v2/types.ts +7 -0
  539. package/src/dropdown-menu-v2/use-temporary-focus-visible-fix.ts +22 -0
  540. package/src/focal-point-picker/styles/focal-point-style.ts +6 -1
  541. package/src/form-toggle/style.scss +1 -1
  542. package/src/form-token-field/style.scss +2 -3
  543. package/src/form-token-field/types.ts +1 -0
  544. package/src/index.ts +6 -1
  545. package/src/input-control/index.tsx +2 -2
  546. package/src/input-control/input-base.tsx +4 -14
  547. package/src/input-control/input-prefix-wrapper.tsx +8 -4
  548. package/src/input-control/input-suffix-wrapper.tsx +4 -6
  549. package/src/input-control/reducer/reducer.ts +13 -10
  550. package/src/input-control/stories/index.story.tsx +31 -12
  551. package/src/input-control/styles/input-control-styles.tsx +42 -11
  552. package/src/input-control/types.ts +23 -7
  553. package/src/input-control/utils.ts +3 -3
  554. package/src/item-group/styles.ts +3 -3
  555. package/src/item-group/test/__snapshots__/index.js.snap +3 -3
  556. package/src/modal/index.tsx +21 -12
  557. package/src/modal/stories/index.story.tsx +8 -14
  558. package/src/modal/style.scss +5 -9
  559. package/src/navigation/index.tsx +4 -4
  560. package/src/navigation/styles/navigation-styles.tsx +3 -3
  561. package/src/navigator/index.ts +6 -6
  562. package/src/navigator/navigator-back-button/hook.ts +1 -1
  563. package/src/navigator/navigator-button/hook.ts +1 -1
  564. package/src/navigator/navigator-provider/README.md +2 -3
  565. package/src/navigator/navigator-provider/component.tsx +97 -82
  566. package/src/navigator/navigator-screen/component.tsx +7 -0
  567. package/src/navigator/navigator-to-parent-button/component.tsx +1 -1
  568. package/src/navigator/stories/index.story.tsx +82 -253
  569. package/src/navigator/test/index.tsx +8 -0
  570. package/src/navigator/types.ts +3 -1
  571. package/src/navigator/use-navigator.ts +1 -3
  572. package/src/palette-edit/index.tsx +2 -2
  573. package/src/private-apis.ts +1 -23
  574. package/src/range-control/styles/range-control-styles.ts +7 -7
  575. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -2
  576. package/src/resizable-box/style.scss +2 -2
  577. package/src/select-control/README.md +2 -2
  578. package/src/select-control/styles/select-control-styles.ts +5 -5
  579. package/src/slot-fill/bubbles-virtually/fill.tsx +4 -4
  580. package/src/slot-fill/index.tsx +1 -0
  581. package/src/snackbar/index.tsx +4 -4
  582. package/src/tab-panel/style.scss +0 -1
  583. package/src/tabs/index.tsx +8 -4
  584. package/src/tabs/styles.ts +42 -14
  585. package/src/tabs/tablist.tsx +5 -4
  586. package/src/text-control/style.scss +3 -2
  587. package/src/toggle-group-control/toggle-group-control/utils.ts +7 -7
  588. package/src/tools-panel/tools-panel/hook.ts +6 -6
  589. package/src/unit-control/styles/unit-control-styles.ts +2 -1
  590. package/src/utils/config-values.js +6 -4
  591. package/src/utils/element-rect.ts +93 -130
  592. package/src/utils/hooks/use-update-effect.js +4 -4
  593. package/tsconfig.tsbuildinfo +1 -1
  594. package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +0 -66
  595. package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +0 -1
  596. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +0 -77
  597. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +0 -1
  598. package/build/navigator/navigator-back-button/index.js +0 -14
  599. package/build/navigator/navigator-back-button/index.js.map +0 -1
  600. package/build/navigator/navigator-button/index.js +0 -14
  601. package/build/navigator/navigator-button/index.js.map +0 -1
  602. package/build/navigator/navigator-provider/index.js +0 -14
  603. package/build/navigator/navigator-provider/index.js.map +0 -1
  604. package/build/navigator/navigator-screen/index.js +0 -14
  605. package/build/navigator/navigator-screen/index.js.map +0 -1
  606. package/build/navigator/navigator-to-parent-button/index.js +0 -14
  607. package/build/navigator/navigator-to-parent-button/index.js.map +0 -1
  608. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +0 -63
  609. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +0 -1
  610. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +0 -72
  611. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +0 -1
  612. package/build-module/navigator/navigator-back-button/index.js +0 -2
  613. package/build-module/navigator/navigator-back-button/index.js.map +0 -1
  614. package/build-module/navigator/navigator-button/index.js +0 -2
  615. package/build-module/navigator/navigator-button/index.js.map +0 -1
  616. package/build-module/navigator/navigator-provider/index.js +0 -2
  617. package/build-module/navigator/navigator-provider/index.js.map +0 -1
  618. package/build-module/navigator/navigator-screen/index.js +0 -2
  619. package/build-module/navigator/navigator-screen/index.js.map +0 -1
  620. package/build-module/navigator/navigator-to-parent-button/index.js +0 -2
  621. package/build-module/navigator/navigator-to-parent-button/index.js.map +0 -1
  622. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +0 -18
  623. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +0 -1
  624. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +0 -1
  625. package/build-types/composite/stories/utils.d.ts +0 -29
  626. package/build-types/composite/stories/utils.d.ts.map +0 -1
  627. package/build-types/navigator/navigator-back-button/index.d.ts +0 -2
  628. package/build-types/navigator/navigator-back-button/index.d.ts.map +0 -1
  629. package/build-types/navigator/navigator-button/index.d.ts +0 -2
  630. package/build-types/navigator/navigator-button/index.d.ts.map +0 -1
  631. package/build-types/navigator/navigator-provider/index.d.ts +0 -2
  632. package/build-types/navigator/navigator-provider/index.d.ts.map +0 -1
  633. package/build-types/navigator/navigator-screen/index.d.ts +0 -2
  634. package/build-types/navigator/navigator-screen/index.d.ts.map +0 -1
  635. package/build-types/navigator/navigator-to-parent-button/index.d.ts +0 -2
  636. package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +0 -1
  637. package/src/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.ts +0 -77
  638. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +0 -102
  639. package/src/composite/stories/utils.tsx +0 -76
  640. package/src/navigator/navigator-back-button/index.ts +0 -1
  641. package/src/navigator/navigator-button/index.ts +0 -1
  642. package/src/navigator/navigator-provider/index.ts +0 -1
  643. package/src/navigator/navigator-screen/index.ts +0 -1
  644. package/src/navigator/navigator-to-parent-button/index.ts +0 -1
@@ -9,7 +9,7 @@ var _element = require("@wordpress/element");
9
9
  var _escapeHtml = require("@wordpress/escape-html");
10
10
  var _context = require("../../context");
11
11
  var _button = _interopRequireDefault(require("../../button"));
12
- var _useNavigator = _interopRequireDefault(require("../use-navigator"));
12
+ var _useNavigator = require("../use-navigator");
13
13
  /**
14
14
  * WordPress dependencies
15
15
  */
@@ -30,7 +30,7 @@ function useNavigatorButton(props) {
30
30
  const escapedPath = (0, _escapeHtml.escapeAttribute)(path);
31
31
  const {
32
32
  goTo
33
- } = (0, _useNavigator.default)();
33
+ } = (0, _useNavigator.useNavigator)();
34
34
  const handleClick = (0, _element.useCallback)(e => {
35
35
  e.preventDefault();
36
36
  goTo(escapedPath, {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_escapeHtml","_context","_button","_interopRequireDefault","_useNavigator","cssSelectorForAttribute","attrName","attrValue","useNavigatorButton","props","path","onClick","as","Button","attributeName","otherProps","useContextSystem","escapedPath","escapeAttribute","goTo","useNavigator","handleClick","useCallback","e","preventDefault","focusTargetSelector"],"sources":["@wordpress/components/src/navigator/navigator-button/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { escapeAttribute } from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport Button from '../../button';\nimport useNavigator from '../use-navigator';\nimport type { NavigatorButtonProps } from '../types';\n\nconst cssSelectorForAttribute = ( attrName: string, attrValue: string ) =>\n\t`[${ attrName }=\"${ attrValue }\"]`;\n\nexport function useNavigatorButton(\n\tprops: WordPressComponentProps< NavigatorButtonProps, 'button' >\n) {\n\tconst {\n\t\tpath,\n\t\tonClick,\n\t\tas = Button,\n\t\tattributeName = 'id',\n\t\t...otherProps\n\t} = useContextSystem( props, 'NavigatorButton' );\n\n\tconst escapedPath = escapeAttribute( path );\n\n\tconst { goTo } = useNavigator();\n\tconst handleClick: React.MouseEventHandler< HTMLButtonElement > =\n\t\tuseCallback(\n\t\t\t( e ) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tgoTo( escapedPath, {\n\t\t\t\t\tfocusTargetSelector: cssSelectorForAttribute(\n\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\tescapedPath\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t\tonClick?.( e );\n\t\t\t},\n\t\t\t[ goTo, onClick, attributeName, escapedPath ]\n\t\t);\n\n\treturn {\n\t\tas,\n\t\tonClick: handleClick,\n\t\t...otherProps,\n\t\t[ attributeName ]: escapedPath,\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAOA,MAAMM,uBAAuB,GAAGA,CAAEC,QAAgB,EAAEC,SAAiB,KACnE,IAAID,QAAU,KAAKC,SAAW,IAAG;AAE5B,SAASC,kBAAkBA,CACjCC,KAAgE,EAC/D;EACD,MAAM;IACLC,IAAI;IACJC,OAAO;IACPC,EAAE,GAAGC,eAAM;IACXC,aAAa,GAAG,IAAI;IACpB,GAAGC;EACJ,CAAC,GAAG,IAAAC,yBAAgB,EAAEP,KAAK,EAAE,iBAAkB,CAAC;EAEhD,MAAMQ,WAAW,GAAG,IAAAC,2BAAe,EAAER,IAAK,CAAC;EAE3C,MAAM;IAAES;EAAK,CAAC,GAAG,IAAAC,qBAAY,EAAC,CAAC;EAC/B,MAAMC,WAAyD,GAC9D,IAAAC,oBAAW,EACRC,CAAC,IAAM;IACRA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClBL,IAAI,CAAEF,WAAW,EAAE;MAClBQ,mBAAmB,EAAEpB,uBAAuB,CAC3CS,aAAa,EACbG,WACD;IACD,CAAE,CAAC;IACHN,OAAO,GAAIY,CAAE,CAAC;EACf,CAAC,EACD,CAAEJ,IAAI,EAAER,OAAO,EAAEG,aAAa,EAAEG,WAAW,CAC5C,CAAC;EAEF,OAAO;IACNL,EAAE;IACFD,OAAO,EAAEU,WAAW;IACpB,GAAGN,UAAU;IACb,CAAED,aAAa,GAAIG;EACpB,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_escapeHtml","_context","_button","_interopRequireDefault","_useNavigator","cssSelectorForAttribute","attrName","attrValue","useNavigatorButton","props","path","onClick","as","Button","attributeName","otherProps","useContextSystem","escapedPath","escapeAttribute","goTo","useNavigator","handleClick","useCallback","e","preventDefault","focusTargetSelector"],"sources":["@wordpress/components/src/navigator/navigator-button/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { escapeAttribute } from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport Button from '../../button';\nimport { useNavigator } from '../use-navigator';\nimport type { NavigatorButtonProps } from '../types';\n\nconst cssSelectorForAttribute = ( attrName: string, attrValue: string ) =>\n\t`[${ attrName }=\"${ attrValue }\"]`;\n\nexport function useNavigatorButton(\n\tprops: WordPressComponentProps< NavigatorButtonProps, 'button' >\n) {\n\tconst {\n\t\tpath,\n\t\tonClick,\n\t\tas = Button,\n\t\tattributeName = 'id',\n\t\t...otherProps\n\t} = useContextSystem( props, 'NavigatorButton' );\n\n\tconst escapedPath = escapeAttribute( path );\n\n\tconst { goTo } = useNavigator();\n\tconst handleClick: React.MouseEventHandler< HTMLButtonElement > =\n\t\tuseCallback(\n\t\t\t( e ) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tgoTo( escapedPath, {\n\t\t\t\t\tfocusTargetSelector: cssSelectorForAttribute(\n\t\t\t\t\t\tattributeName,\n\t\t\t\t\t\tescapedPath\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t\tonClick?.( e );\n\t\t\t},\n\t\t\t[ goTo, onClick, attributeName, escapedPath ]\n\t\t);\n\n\treturn {\n\t\tas,\n\t\tonClick: handleClick,\n\t\t...otherProps,\n\t\t[ attributeName ]: escapedPath,\n\t};\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAOA,MAAMM,uBAAuB,GAAGA,CAAEC,QAAgB,EAAEC,SAAiB,KACnE,IAAID,QAAU,KAAKC,SAAW,IAAG;AAE5B,SAASC,kBAAkBA,CACjCC,KAAgE,EAC/D;EACD,MAAM;IACLC,IAAI;IACJC,OAAO;IACPC,EAAE,GAAGC,eAAM;IACXC,aAAa,GAAG,IAAI;IACpB,GAAGC;EACJ,CAAC,GAAG,IAAAC,yBAAgB,EAAEP,KAAK,EAAE,iBAAkB,CAAC;EAEhD,MAAMQ,WAAW,GAAG,IAAAC,2BAAe,EAAER,IAAK,CAAC;EAE3C,MAAM;IAAES;EAAK,CAAC,GAAG,IAAAC,0BAAY,EAAC,CAAC;EAC/B,MAAMC,WAAyD,GAC9D,IAAAC,oBAAW,EACRC,CAAC,IAAM;IACRA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClBL,IAAI,CAAEF,WAAW,EAAE;MAClBQ,mBAAmB,EAAEpB,uBAAuB,CAC3CS,aAAa,EACbG,WACD;IACD,CAAE,CAAC;IACHN,OAAO,GAAIY,CAAE,CAAC;EACf,CAAC,EACD,CAAEJ,IAAI,EAAER,OAAO,EAAEG,aAAa,EAAEG,WAAW,CAC5C,CAAC;EAEF,OAAO;IACNL,EAAE;IACFD,OAAO,EAAEU,WAAW;IACpB,GAAGN,UAAU;IACb,CAAED,aAAa,GAAIG;EACpB,CAAC;AACF","ignoreList":[]}
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.NavigatorProvider = void 0;
8
8
  var _element = require("@wordpress/element");
9
9
  var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
10
+ var _warning = _interopRequireDefault(require("@wordpress/warning"));
10
11
  var _context = require("../../context");
11
12
  var _useCx = require("../../utils/hooks/use-cx");
12
13
  var _router = require("../utils/router");
@@ -29,10 +30,14 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
29
30
  * Internal dependencies
30
31
  */
31
32
 
32
- const MAX_HISTORY_LENGTH = 50;
33
33
  function addScreen({
34
34
  screens
35
35
  }, screen) {
36
+ if (screens.some(s => s.path === screen.path)) {
37
+ globalThis.SCRIPT_DEBUG === true ? (0, _warning.default)(`Navigator: a screen with path ${screen.path} already exists.
38
+ The screen with id ${screen.id} will not be added.`) : void 0;
39
+ return screens;
40
+ }
36
41
  return [...screens, screen];
37
42
  }
38
43
  function removeScreen({
@@ -40,72 +45,89 @@ function removeScreen({
40
45
  }, screen) {
41
46
  return screens.filter(s => s.id !== screen.id);
42
47
  }
43
- function goBack({
44
- locationHistory
45
- }) {
46
- if (locationHistory.length <= 1) {
47
- return locationHistory;
48
- }
49
- return [...locationHistory.slice(0, -2), {
50
- ...locationHistory[locationHistory.length - 2],
51
- isBack: true,
52
- hasRestoredFocus: false
53
- }];
54
- }
55
48
  function goTo(state, path, options = {}) {
49
+ var _focusSelectorsCopy2;
56
50
  const {
57
- locationHistory
51
+ focusSelectors
58
52
  } = state;
53
+ const currentLocation = {
54
+ ...state.currentLocation,
55
+ isInitial: false
56
+ };
59
57
  const {
60
- focusTargetSelector,
58
+ // Default assignments
61
59
  isBack = false,
62
60
  skipFocus = false,
63
- replace = false,
61
+ // Extract to avoid forwarding
62
+ replace,
63
+ focusTargetSelector,
64
+ // Rest
64
65
  ...restOptions
65
66
  } = options;
66
- const isNavigatingToSamePath = locationHistory.length > 0 && locationHistory[locationHistory.length - 1].path === path;
67
- if (isNavigatingToSamePath) {
68
- return locationHistory;
67
+ if (currentLocation.path === path) {
68
+ return {
69
+ currentLocation,
70
+ focusSelectors
71
+ };
69
72
  }
70
- const isNavigatingToPreviousPath = isBack && locationHistory.length > 1 && locationHistory[locationHistory.length - 2].path === path;
71
- if (isNavigatingToPreviousPath) {
72
- return goBack(state);
73
+ let focusSelectorsCopy;
74
+ function getFocusSelectorsCopy() {
75
+ var _focusSelectorsCopy;
76
+ focusSelectorsCopy = (_focusSelectorsCopy = focusSelectorsCopy) !== null && _focusSelectorsCopy !== void 0 ? _focusSelectorsCopy : new Map(state.focusSelectors);
77
+ return focusSelectorsCopy;
73
78
  }
74
- const newLocation = {
75
- ...restOptions,
76
- path,
77
- isBack,
78
- hasRestoredFocus: false,
79
- skipFocus
80
- };
81
- if (locationHistory.length === 0) {
82
- return replace ? [] : [newLocation];
79
+
80
+ // Set a focus selector that will be used when navigating
81
+ // back to the current location.
82
+ if (focusTargetSelector && currentLocation.path) {
83
+ getFocusSelectorsCopy().set(currentLocation.path, focusTargetSelector);
83
84
  }
84
- const newLocationHistory = locationHistory.slice(locationHistory.length > MAX_HISTORY_LENGTH - 1 ? 1 : 0, -1);
85
- if (!replace) {
86
- newLocationHistory.push(
87
- // Assign `focusTargetSelector` to the previous location in history
88
- // (the one we just navigated from).
89
- {
90
- ...locationHistory[locationHistory.length - 1],
91
- focusTargetSelector
92
- });
85
+
86
+ // Get the focus selector for the new location.
87
+ let currentFocusSelector;
88
+ if (focusSelectors.get(path)) {
89
+ if (isBack) {
90
+ // Use the found focus selector only when navigating back.
91
+ currentFocusSelector = focusSelectors.get(path);
92
+ }
93
+ // Make a copy of the focusSelectors map to remove the focus selector
94
+ // only if necessary (ie. a focus selector was found).
95
+ getFocusSelectorsCopy().delete(path);
93
96
  }
94
- newLocationHistory.push(newLocation);
95
- return newLocationHistory;
97
+ return {
98
+ currentLocation: {
99
+ ...restOptions,
100
+ path,
101
+ isBack,
102
+ hasRestoredFocus: false,
103
+ focusTargetSelector: currentFocusSelector,
104
+ skipFocus
105
+ },
106
+ focusSelectors: (_focusSelectorsCopy2 = focusSelectorsCopy) !== null && _focusSelectorsCopy2 !== void 0 ? _focusSelectorsCopy2 : focusSelectors
107
+ };
96
108
  }
97
109
  function goToParent(state, options = {}) {
98
110
  const {
99
- locationHistory,
100
- screens
111
+ screens,
112
+ focusSelectors
101
113
  } = state;
102
- const currentPath = locationHistory[locationHistory.length - 1].path;
114
+ const currentLocation = {
115
+ ...state.currentLocation,
116
+ isInitial: false
117
+ };
118
+ const currentPath = currentLocation.path;
103
119
  if (currentPath === undefined) {
104
- return locationHistory;
120
+ return {
121
+ currentLocation,
122
+ focusSelectors
123
+ };
105
124
  }
106
125
  const parentPath = (0, _router.findParent)(currentPath, screens);
107
126
  if (parentPath === undefined) {
108
- return locationHistory;
127
+ return {
128
+ currentLocation,
129
+ focusSelectors
130
+ };
109
131
  }
110
132
  return goTo(state, parentPath, {
111
133
  ...options,
@@ -115,8 +137,10 @@ function goToParent(state, options = {}) {
115
137
  function routerReducer(state, action) {
116
138
  let {
117
139
  screens,
118
- locationHistory,
119
- matchedPath
140
+ currentLocation,
141
+ matchedPath,
142
+ focusSelectors,
143
+ ...restState
120
144
  } = state;
121
145
  switch (action.type) {
122
146
  case 'add':
@@ -126,20 +150,26 @@ function routerReducer(state, action) {
126
150
  screens = removeScreen(state, action.screen);
127
151
  break;
128
152
  case 'goto':
129
- locationHistory = goTo(state, action.path, action.options);
153
+ ({
154
+ currentLocation,
155
+ focusSelectors
156
+ } = goTo(state, action.path, action.options));
130
157
  break;
131
158
  case 'gotoparent':
132
- locationHistory = goToParent(state, action.options);
159
+ ({
160
+ currentLocation,
161
+ focusSelectors
162
+ } = goToParent(state, action.options));
133
163
  break;
134
164
  }
135
165
 
136
166
  // Return early in case there is no change
137
- if (screens === state.screens && locationHistory === state.locationHistory) {
167
+ if (screens === state.screens && currentLocation === state.currentLocation) {
138
168
  return state;
139
169
  }
140
170
 
141
171
  // Compute the matchedPath
142
- const currentPath = locationHistory.length > 0 ? locationHistory[locationHistory.length - 1].path : undefined;
172
+ const currentPath = currentLocation.path;
143
173
  matchedPath = currentPath !== undefined ? (0, _router.patternMatch)(currentPath, screens) : undefined;
144
174
 
145
175
  // If the new match is the same as the previous match,
@@ -148,24 +178,29 @@ function routerReducer(state, action) {
148
178
  matchedPath = state.matchedPath;
149
179
  }
150
180
  return {
181
+ ...restState,
151
182
  screens,
152
- locationHistory,
153
- matchedPath
183
+ currentLocation,
184
+ matchedPath,
185
+ focusSelectors
154
186
  };
155
187
  }
156
188
  function UnconnectedNavigatorProvider(props, forwardedRef) {
157
189
  const {
158
- initialPath,
190
+ initialPath: initialPathProp,
159
191
  children,
160
192
  className,
161
193
  ...otherProps
162
194
  } = (0, _context.useContextSystem)(props, 'NavigatorProvider');
163
- const [routerState, dispatch] = (0, _element.useReducer)(routerReducer, initialPath, path => ({
195
+ const [routerState, dispatch] = (0, _element.useReducer)(routerReducer, initialPathProp, path => ({
164
196
  screens: [],
165
- locationHistory: [{
166
- path
167
- }],
168
- matchedPath: undefined
197
+ currentLocation: {
198
+ path,
199
+ isInitial: true
200
+ },
201
+ matchedPath: undefined,
202
+ focusSelectors: new Map(),
203
+ initialPath: initialPathProp
169
204
  }));
170
205
 
171
206
  // The methods are constant forever, create stable references to them.
@@ -202,21 +237,18 @@ function UnconnectedNavigatorProvider(props, forwardedRef) {
202
237
  })
203
238
  }), []);
204
239
  const {
205
- locationHistory,
240
+ currentLocation,
206
241
  matchedPath
207
242
  } = routerState;
208
243
  const navigatorContextValue = (0, _element.useMemo)(() => {
209
244
  var _matchedPath$params;
210
245
  return {
211
- location: {
212
- ...locationHistory[locationHistory.length - 1],
213
- isInitial: locationHistory.length === 1
214
- },
246
+ location: currentLocation,
215
247
  params: (_matchedPath$params = matchedPath?.params) !== null && _matchedPath$params !== void 0 ? _matchedPath$params : {},
216
248
  match: matchedPath?.id,
217
249
  ...methods
218
250
  };
219
- }, [locationHistory, matchedPath, methods]);
251
+ }, [currentLocation, matchedPath, methods]);
220
252
  const cx = (0, _useCx.useCx)();
221
253
  const classes = (0, _element.useMemo)(() => cx(styles.navigatorProviderWrapper, className), [className, cx]);
222
254
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_view.View, {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_context","_useCx","_router","_view","_context2","styles","_interopRequireWildcard","_deprecated","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","MAX_HISTORY_LENGTH","addScreen","screens","screen","removeScreen","filter","s","id","goBack","locationHistory","length","slice","isBack","hasRestoredFocus","goTo","state","path","options","focusTargetSelector","skipFocus","replace","restOptions","isNavigatingToSamePath","isNavigatingToPreviousPath","newLocation","newLocationHistory","push","goToParent","currentPath","undefined","parentPath","findParent","routerReducer","action","matchedPath","type","patternMatch","isShallowEqual","params","UnconnectedNavigatorProvider","props","forwardedRef","initialPath","children","className","otherProps","useContextSystem","routerState","dispatch","useReducer","methods","useMemo","deprecated","since","alternative","navigatorContextValue","_matchedPath$params","location","isInitial","match","cx","useCx","classes","navigatorProviderWrapper","jsx","View","ref","NavigatorContext","Provider","value","NavigatorProvider","exports","contextConnect","_default"],"sources":["@wordpress/components/src/navigator/navigator-provider/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useReducer } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { patternMatch, findParent } from '../utils/router';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport * as styles from '../styles';\nimport type {\n\tNavigatorProviderProps,\n\tNavigatorLocation,\n\tNavigatorContext as NavigatorContextType,\n\tNavigateOptions,\n\tScreen,\n\tNavigateToParentOptions,\n} from '../types';\nimport deprecated from '@wordpress/deprecated';\n\ntype MatchedPath = ReturnType< typeof patternMatch >;\n\ntype RouterAction =\n\t| { type: 'add' | 'remove'; screen: Screen }\n\t| { type: 'goto'; path: string; options?: NavigateOptions }\n\t| { type: 'gotoparent'; options?: NavigateToParentOptions };\n\ntype RouterState = {\n\tscreens: Screen[];\n\tlocationHistory: NavigatorLocation[];\n\tmatchedPath: MatchedPath;\n};\n\nconst MAX_HISTORY_LENGTH = 50;\n\nfunction addScreen( { screens }: RouterState, screen: Screen ) {\n\treturn [ ...screens, screen ];\n}\n\nfunction removeScreen( { screens }: RouterState, screen: Screen ) {\n\treturn screens.filter( ( s ) => s.id !== screen.id );\n}\n\nfunction goBack( { locationHistory }: RouterState ) {\n\tif ( locationHistory.length <= 1 ) {\n\t\treturn locationHistory;\n\t}\n\treturn [\n\t\t...locationHistory.slice( 0, -2 ),\n\t\t{\n\t\t\t...locationHistory[ locationHistory.length - 2 ],\n\t\t\tisBack: true,\n\t\t\thasRestoredFocus: false,\n\t\t},\n\t];\n}\n\nfunction goTo(\n\tstate: RouterState,\n\tpath: string,\n\toptions: NavigateOptions = {}\n) {\n\tconst { locationHistory } = state;\n\tconst {\n\t\tfocusTargetSelector,\n\t\tisBack = false,\n\t\tskipFocus = false,\n\t\treplace = false,\n\t\t...restOptions\n\t} = options;\n\n\tconst isNavigatingToSamePath =\n\t\tlocationHistory.length > 0 &&\n\t\tlocationHistory[ locationHistory.length - 1 ].path === path;\n\tif ( isNavigatingToSamePath ) {\n\t\treturn locationHistory;\n\t}\n\n\tconst isNavigatingToPreviousPath =\n\t\tisBack &&\n\t\tlocationHistory.length > 1 &&\n\t\tlocationHistory[ locationHistory.length - 2 ].path === path;\n\n\tif ( isNavigatingToPreviousPath ) {\n\t\treturn goBack( state );\n\t}\n\n\tconst newLocation = {\n\t\t...restOptions,\n\t\tpath,\n\t\tisBack,\n\t\thasRestoredFocus: false,\n\t\tskipFocus,\n\t};\n\n\tif ( locationHistory.length === 0 ) {\n\t\treturn replace ? [] : [ newLocation ];\n\t}\n\n\tconst newLocationHistory = locationHistory.slice(\n\t\tlocationHistory.length > MAX_HISTORY_LENGTH - 1 ? 1 : 0,\n\t\t-1\n\t);\n\n\tif ( ! replace ) {\n\t\tnewLocationHistory.push(\n\t\t\t// Assign `focusTargetSelector` to the previous location in history\n\t\t\t// (the one we just navigated from).\n\t\t\t{\n\t\t\t\t...locationHistory[ locationHistory.length - 1 ],\n\t\t\t\tfocusTargetSelector,\n\t\t\t}\n\t\t);\n\t}\n\n\tnewLocationHistory.push( newLocation );\n\n\treturn newLocationHistory;\n}\n\nfunction goToParent(\n\tstate: RouterState,\n\toptions: NavigateToParentOptions = {}\n) {\n\tconst { locationHistory, screens } = state;\n\tconst currentPath = locationHistory[ locationHistory.length - 1 ].path;\n\tif ( currentPath === undefined ) {\n\t\treturn locationHistory;\n\t}\n\tconst parentPath = findParent( currentPath, screens );\n\tif ( parentPath === undefined ) {\n\t\treturn locationHistory;\n\t}\n\treturn goTo( state, parentPath, {\n\t\t...options,\n\t\tisBack: true,\n\t} );\n}\n\nfunction routerReducer(\n\tstate: RouterState,\n\taction: RouterAction\n): RouterState {\n\tlet { screens, locationHistory, matchedPath } = state;\n\tswitch ( action.type ) {\n\t\tcase 'add':\n\t\t\tscreens = addScreen( state, action.screen );\n\t\t\tbreak;\n\t\tcase 'remove':\n\t\t\tscreens = removeScreen( state, action.screen );\n\t\t\tbreak;\n\t\tcase 'goto':\n\t\t\tlocationHistory = goTo( state, action.path, action.options );\n\t\t\tbreak;\n\t\tcase 'gotoparent':\n\t\t\tlocationHistory = goToParent( state, action.options );\n\t\t\tbreak;\n\t}\n\n\t// Return early in case there is no change\n\tif (\n\t\tscreens === state.screens &&\n\t\tlocationHistory === state.locationHistory\n\t) {\n\t\treturn state;\n\t}\n\n\t// Compute the matchedPath\n\tconst currentPath =\n\t\tlocationHistory.length > 0\n\t\t\t? locationHistory[ locationHistory.length - 1 ].path\n\t\t\t: undefined;\n\tmatchedPath =\n\t\tcurrentPath !== undefined\n\t\t\t? patternMatch( currentPath, screens )\n\t\t\t: undefined;\n\n\t// If the new match is the same as the previous match,\n\t// return the previous one to keep immutability.\n\tif (\n\t\tmatchedPath &&\n\t\tstate.matchedPath &&\n\t\tmatchedPath.id === state.matchedPath.id &&\n\t\tisShallowEqual( matchedPath.params, state.matchedPath.params )\n\t) {\n\t\tmatchedPath = state.matchedPath;\n\t}\n\n\treturn { screens, locationHistory, matchedPath };\n}\n\nfunction UnconnectedNavigatorProvider(\n\tprops: WordPressComponentProps< NavigatorProviderProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst { initialPath, children, className, ...otherProps } =\n\t\tuseContextSystem( props, 'NavigatorProvider' );\n\n\tconst [ routerState, dispatch ] = useReducer(\n\t\trouterReducer,\n\t\tinitialPath,\n\t\t( path ) => ( {\n\t\t\tscreens: [],\n\t\t\tlocationHistory: [ { path } ],\n\t\t\tmatchedPath: undefined,\n\t\t} )\n\t);\n\n\t// The methods are constant forever, create stable references to them.\n\tconst methods = useMemo(\n\t\t() => ( {\n\t\t\t// Note: calling goBack calls `goToParent` internally, as it was established\n\t\t\t// that `goBack` should behave like `goToParent`, and `goToParent` should\n\t\t\t// be marked as deprecated.\n\t\t\tgoBack: ( options: NavigateToParentOptions | undefined ) =>\n\t\t\t\tdispatch( { type: 'gotoparent', options } ),\n\t\t\tgoTo: ( path: string, options?: NavigateOptions ) =>\n\t\t\t\tdispatch( { type: 'goto', path, options } ),\n\t\t\tgoToParent: ( options: NavigateToParentOptions | undefined ) => {\n\t\t\t\tdeprecated( `wp.components.useNavigator().goToParent`, {\n\t\t\t\t\tsince: '6.7',\n\t\t\t\t\talternative: 'wp.components.useNavigator().goBack',\n\t\t\t\t} );\n\t\t\t\tdispatch( { type: 'gotoparent', options } );\n\t\t\t},\n\t\t\taddScreen: ( screen: Screen ) =>\n\t\t\t\tdispatch( { type: 'add', screen } ),\n\t\t\tremoveScreen: ( screen: Screen ) =>\n\t\t\t\tdispatch( { type: 'remove', screen } ),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { locationHistory, matchedPath } = routerState;\n\n\tconst navigatorContextValue: NavigatorContextType = useMemo(\n\t\t() => ( {\n\t\t\tlocation: {\n\t\t\t\t...locationHistory[ locationHistory.length - 1 ],\n\t\t\t\tisInitial: locationHistory.length === 1,\n\t\t\t},\n\t\t\tparams: matchedPath?.params ?? {},\n\t\t\tmatch: matchedPath?.id,\n\t\t\t...methods,\n\t\t} ),\n\t\t[ locationHistory, matchedPath, methods ]\n\t);\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() => cx( styles.navigatorProviderWrapper, className ),\n\t\t[ className, cx ]\n\t);\n\n\treturn (\n\t\t<View ref={ forwardedRef } className={ classes } { ...otherProps }>\n\t\t\t<NavigatorContext.Provider value={ navigatorContextValue }>\n\t\t\t\t{ children }\n\t\t\t</NavigatorContext.Provider>\n\t\t</View>\n\t);\n}\n\n/**\n * The `NavigatorProvider` component allows rendering nested views/panels/menus\n * (via the `NavigatorScreen` component and navigate between these different\n * view (via the `NavigatorButton` and `NavigatorBackButton` components or the\n * `useNavigator` hook).\n *\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorProvider = contextConnect(\n\tUnconnectedNavigatorProvider,\n\t'NavigatorProvider'\n);\n\nexport default NavigatorProvider;\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAC,uBAAA,CAAAT,OAAA;AASA,IAAAU,WAAA,GAAAR,sBAAA,CAAAF,OAAA;AAA+C,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAY,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,C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C;EAClB,MAAMC,OAAO,GAAG,IAAAX,gBAAO,EACtB,MAAMS,EAAE,CAAEpF,MAAM,CAACuF,wBAAwB,EAAEnB,SAAU,CAAC,EACtD,CAAEA,SAAS,EAAEgB,EAAE,CAChB,CAAC;EAED,oBACC,IAAAjF,WAAA,CAAAqF,GAAA,EAAC1F,KAAA,CAAA2F,IAAI;IAACC,GAAG,EAAGzB,YAAc;IAACG,SAAS,EAAGkB,OAAS;IAAA,GAAMjB,UAAU;IAAAF,QAAA,eAC/D,IAAAhE,WAAA,CAAAqF,GAAA,EAACzF,SAAA,CAAA4F,gBAAgB,CAACC,QAAQ;MAACC,KAAK,EAAGd,qBAAuB;MAAAZ,QAAA,EACvDA;IAAQ,CACgB;EAAC,CACvB,CAAC;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM2B,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,uBAAc,EAC9CjC,4BAA4B,EAC5B,mBACD,CAAC;AAAC,IAAAkC,QAAA,GAAAF,OAAA,CAAArF,OAAA,GAEaoF,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_isShallowEqual","_interopRequireDefault","_warning","_context","_useCx","_router","_view","_context2","styles","_interopRequireWildcard","_deprecated","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","addScreen","screens","screen","some","s","path","globalThis","SCRIPT_DEBUG","warning","id","removeScreen","filter","goTo","state","options","_focusSelectorsCopy2","focusSelectors","currentLocation","isInitial","isBack","skipFocus","replace","focusTargetSelector","restOptions","focusSelectorsCopy","getFocusSelectorsCopy","_focusSelectorsCopy","Map","currentFocusSelector","delete","hasRestoredFocus","goToParent","currentPath","undefined","parentPath","findParent","routerReducer","action","matchedPath","restState","type","patternMatch","isShallowEqual","params","UnconnectedNavigatorProvider","props","forwardedRef","initialPath","initialPathProp","children","className","otherProps","useContextSystem","routerState","dispatch","useReducer","methods","useMemo","goBack","deprecated","since","alternative","navigatorContextValue","_matchedPath$params","location","match","cx","useCx","classes","navigatorProviderWrapper","jsx","View","ref","NavigatorContext","Provider","value","NavigatorProvider","exports","contextConnect","_default"],"sources":["@wordpress/components/src/navigator/navigator-provider/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useReducer } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { patternMatch, findParent } from '../utils/router';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport * as styles from '../styles';\nimport type {\n\tNavigatorProviderProps,\n\tNavigatorLocation,\n\tNavigatorContext as NavigatorContextType,\n\tNavigateOptions,\n\tScreen,\n\tNavigateToParentOptions,\n} from '../types';\nimport deprecated from '@wordpress/deprecated';\n\ntype MatchedPath = ReturnType< typeof patternMatch >;\n\ntype RouterAction =\n\t| { type: 'add' | 'remove'; screen: Screen }\n\t| { type: 'goto'; path: string; options?: NavigateOptions }\n\t| { type: 'gotoparent'; options?: NavigateToParentOptions };\n\ntype RouterState = {\n\tinitialPath: string;\n\tscreens: Screen[];\n\tcurrentLocation: NavigatorLocation;\n\tmatchedPath: MatchedPath;\n\tfocusSelectors: Map< string, string >;\n};\n\nfunction addScreen( { screens }: RouterState, screen: Screen ) {\n\tif ( screens.some( ( s ) => s.path === screen.path ) ) {\n\t\twarning(\n\t\t\t`Navigator: a screen with path ${ screen.path } already exists.\nThe screen with id ${ screen.id } will not be added.`\n\t\t);\n\t\treturn screens;\n\t}\n\treturn [ ...screens, screen ];\n}\n\nfunction removeScreen( { screens }: RouterState, screen: Screen ) {\n\treturn screens.filter( ( s ) => s.id !== screen.id );\n}\n\nfunction goTo(\n\tstate: RouterState,\n\tpath: string,\n\toptions: NavigateOptions = {}\n) {\n\tconst { focusSelectors } = state;\n\tconst currentLocation = { ...state.currentLocation, isInitial: false };\n\n\tconst {\n\t\t// Default assignments\n\t\tisBack = false,\n\t\tskipFocus = false,\n\t\t// Extract to avoid forwarding\n\t\treplace,\n\t\tfocusTargetSelector,\n\t\t// Rest\n\t\t...restOptions\n\t} = options;\n\n\tif ( currentLocation.path === path ) {\n\t\treturn { currentLocation, focusSelectors };\n\t}\n\n\tlet focusSelectorsCopy: typeof focusSelectors | undefined;\n\tfunction getFocusSelectorsCopy() {\n\t\tfocusSelectorsCopy =\n\t\t\tfocusSelectorsCopy ?? new Map( state.focusSelectors );\n\t\treturn focusSelectorsCopy;\n\t}\n\n\t// Set a focus selector that will be used when navigating\n\t// back to the current location.\n\tif ( focusTargetSelector && currentLocation.path ) {\n\t\tgetFocusSelectorsCopy().set(\n\t\t\tcurrentLocation.path,\n\t\t\tfocusTargetSelector\n\t\t);\n\t}\n\n\t// Get the focus selector for the new location.\n\tlet currentFocusSelector;\n\tif ( focusSelectors.get( path ) ) {\n\t\tif ( isBack ) {\n\t\t\t// Use the found focus selector only when navigating back.\n\t\t\tcurrentFocusSelector = focusSelectors.get( path );\n\t\t}\n\t\t// Make a copy of the focusSelectors map to remove the focus selector\n\t\t// only if necessary (ie. a focus selector was found).\n\t\tgetFocusSelectorsCopy().delete( path );\n\t}\n\n\treturn {\n\t\tcurrentLocation: {\n\t\t\t...restOptions,\n\t\t\tpath,\n\t\t\tisBack,\n\t\t\thasRestoredFocus: false,\n\t\t\tfocusTargetSelector: currentFocusSelector,\n\t\t\tskipFocus,\n\t\t},\n\t\tfocusSelectors: focusSelectorsCopy ?? focusSelectors,\n\t};\n}\n\nfunction goToParent(\n\tstate: RouterState,\n\toptions: NavigateToParentOptions = {}\n) {\n\tconst { screens, focusSelectors } = state;\n\tconst currentLocation = { ...state.currentLocation, isInitial: false };\n\tconst currentPath = currentLocation.path;\n\tif ( currentPath === undefined ) {\n\t\treturn { currentLocation, focusSelectors };\n\t}\n\tconst parentPath = findParent( currentPath, screens );\n\tif ( parentPath === undefined ) {\n\t\treturn { currentLocation, focusSelectors };\n\t}\n\treturn goTo( state, parentPath, {\n\t\t...options,\n\t\tisBack: true,\n\t} );\n}\n\nfunction routerReducer(\n\tstate: RouterState,\n\taction: RouterAction\n): RouterState {\n\tlet {\n\t\tscreens,\n\t\tcurrentLocation,\n\t\tmatchedPath,\n\t\tfocusSelectors,\n\t\t...restState\n\t} = state;\n\tswitch ( action.type ) {\n\t\tcase 'add':\n\t\t\tscreens = addScreen( state, action.screen );\n\t\t\tbreak;\n\t\tcase 'remove':\n\t\t\tscreens = removeScreen( state, action.screen );\n\t\t\tbreak;\n\t\tcase 'goto':\n\t\t\t( { currentLocation, focusSelectors } = goTo(\n\t\t\t\tstate,\n\t\t\t\taction.path,\n\t\t\t\taction.options\n\t\t\t) );\n\t\t\tbreak;\n\t\tcase 'gotoparent':\n\t\t\t( { currentLocation, focusSelectors } = goToParent(\n\t\t\t\tstate,\n\t\t\t\taction.options\n\t\t\t) );\n\t\t\tbreak;\n\t}\n\n\t// Return early in case there is no change\n\tif (\n\t\tscreens === state.screens &&\n\t\tcurrentLocation === state.currentLocation\n\t) {\n\t\treturn state;\n\t}\n\n\t// Compute the matchedPath\n\tconst currentPath = currentLocation.path;\n\tmatchedPath =\n\t\tcurrentPath !== undefined\n\t\t\t? patternMatch( currentPath, screens )\n\t\t\t: undefined;\n\n\t// If the new match is the same as the previous match,\n\t// return the previous one to keep immutability.\n\tif (\n\t\tmatchedPath &&\n\t\tstate.matchedPath &&\n\t\tmatchedPath.id === state.matchedPath.id &&\n\t\tisShallowEqual( matchedPath.params, state.matchedPath.params )\n\t) {\n\t\tmatchedPath = state.matchedPath;\n\t}\n\n\treturn {\n\t\t...restState,\n\t\tscreens,\n\t\tcurrentLocation,\n\t\tmatchedPath,\n\t\tfocusSelectors,\n\t};\n}\n\nfunction UnconnectedNavigatorProvider(\n\tprops: WordPressComponentProps< NavigatorProviderProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tinitialPath: initialPathProp,\n\t\tchildren,\n\t\tclassName,\n\t\t...otherProps\n\t} = useContextSystem( props, 'NavigatorProvider' );\n\n\tconst [ routerState, dispatch ] = useReducer(\n\t\trouterReducer,\n\t\tinitialPathProp,\n\t\t( path ) => ( {\n\t\t\tscreens: [],\n\t\t\tcurrentLocation: { path, isInitial: true },\n\t\t\tmatchedPath: undefined,\n\t\t\tfocusSelectors: new Map(),\n\t\t\tinitialPath: initialPathProp,\n\t\t} )\n\t);\n\n\t// The methods are constant forever, create stable references to them.\n\tconst methods = useMemo(\n\t\t() => ( {\n\t\t\t// Note: calling goBack calls `goToParent` internally, as it was established\n\t\t\t// that `goBack` should behave like `goToParent`, and `goToParent` should\n\t\t\t// be marked as deprecated.\n\t\t\tgoBack: ( options: NavigateToParentOptions | undefined ) =>\n\t\t\t\tdispatch( { type: 'gotoparent', options } ),\n\t\t\tgoTo: ( path: string, options?: NavigateOptions ) =>\n\t\t\t\tdispatch( { type: 'goto', path, options } ),\n\t\t\tgoToParent: ( options: NavigateToParentOptions | undefined ) => {\n\t\t\t\tdeprecated( `wp.components.useNavigator().goToParent`, {\n\t\t\t\t\tsince: '6.7',\n\t\t\t\t\talternative: 'wp.components.useNavigator().goBack',\n\t\t\t\t} );\n\t\t\t\tdispatch( { type: 'gotoparent', options } );\n\t\t\t},\n\t\t\taddScreen: ( screen: Screen ) =>\n\t\t\t\tdispatch( { type: 'add', screen } ),\n\t\t\tremoveScreen: ( screen: Screen ) =>\n\t\t\t\tdispatch( { type: 'remove', screen } ),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { currentLocation, matchedPath } = routerState;\n\n\tconst navigatorContextValue: NavigatorContextType = useMemo(\n\t\t() => ( {\n\t\t\tlocation: currentLocation,\n\t\t\tparams: matchedPath?.params ?? {},\n\t\t\tmatch: matchedPath?.id,\n\t\t\t...methods,\n\t\t} ),\n\t\t[ currentLocation, matchedPath, methods ]\n\t);\n\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() => cx( styles.navigatorProviderWrapper, className ),\n\t\t[ className, cx ]\n\t);\n\n\treturn (\n\t\t<View ref={ forwardedRef } className={ classes } { ...otherProps }>\n\t\t\t<NavigatorContext.Provider value={ navigatorContextValue }>\n\t\t\t\t{ children }\n\t\t\t</NavigatorContext.Provider>\n\t\t</View>\n\t);\n}\n\n/**\n * The `NavigatorProvider` component allows rendering nested views/panels/menus\n * (via the `NavigatorScreen` component and navigate between these different\n * view (via the `NavigatorButton` and `NavigatorBackButton` components or the\n * `useNavigator` hook).\n *\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorProvider = contextConnect(\n\tUnconnectedNavigatorProvider,\n\t'NavigatorProvider'\n);\n\nexport default NavigatorProvider;\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA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,QAAA,eAC/D,IAAAtE,WAAA,CAAA2F,GAAA,EAAC/F,SAAA,CAAAkG,gBAAgB,CAACC,QAAQ;MAACC,KAAK,EAAGb,qBAAuB;MAAAb,QAAA,EACvDA;IAAQ,CACgB;EAAC,CACvB,CAAC;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM2B,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAAE,uBAAc,EAC9ClC,4BAA4B,EAC5B,mBACD,CAAC;AAAC,IAAAmC,QAAA,GAAAF,OAAA,CAAA3F,OAAA,GAEa0F,iBAAiB","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -9,6 +10,7 @@ var _element = require("@wordpress/element");
9
10
  var _compose = require("@wordpress/compose");
10
11
  var _i18n = require("@wordpress/i18n");
11
12
  var _escapeHtml = require("@wordpress/escape-html");
13
+ var _warning = _interopRequireDefault(require("@wordpress/warning"));
12
14
  var _context = require("../../context");
13
15
  var _useCx = require("../../utils/hooks/use-cx");
14
16
  var _view = require("../../view");
@@ -30,6 +32,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
30
32
  */
31
33
 
32
34
  function UnconnectedNavigatorScreen(props, forwardedRef) {
35
+ if (!/^\//.test(props.path)) {
36
+ globalThis.SCRIPT_DEBUG === true ? (0, _warning.default)('wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.') : void 0;
37
+ }
33
38
  const screenId = (0, _element.useId)();
34
39
  const {
35
40
  children,
@@ -1 +1 @@
1
- {"version":3,"names":["_dom","require","_element","_compose","_i18n","_escapeHtml","_context","_useCx","_view","_context2","styles","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnconnectedNavigatorScreen","props","forwardedRef","screenId","useId","children","className","path","otherProps","useContextSystem","location","match","addScreen","removeScreen","useContext","NavigatorContext","isMatch","wrapperRef","useRef","useEffect","screen","id","escapeAttribute","isRTL","isRTLFn","isInitial","isBack","cx","useCx","classes","useMemo","navigatorScreen","locationRef","current","isInitialLocation","hasRestoredFocus","skipFocus","activeElement","ownerDocument","contains","elementToFocus","focusTargetSelector","querySelector","firstTabbable","focus","tabbable","find","mergedWrapperRef","useMergeRefs","jsx","View","ref","NavigatorScreen","exports","contextConnect","_default"],"sources":["@wordpress/components/src/navigator/navigator-screen/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseId,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { isRTL as isRTLFn } from '@wordpress/i18n';\nimport { escapeAttribute } from '@wordpress/escape-html';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport * as styles from '../styles';\nimport type { NavigatorScreenProps } from '../types';\n\nfunction UnconnectedNavigatorScreen(\n\tprops: WordPressComponentProps< NavigatorScreenProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst screenId = useId();\n\tconst { children, className, path, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'NavigatorScreen'\n\t);\n\n\tconst { location, match, addScreen, removeScreen } =\n\t\tuseContext( NavigatorContext );\n\tconst isMatch = match === screenId;\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tuseEffect( () => {\n\t\tconst screen = {\n\t\t\tid: screenId,\n\t\t\tpath: escapeAttribute( path ),\n\t\t};\n\t\taddScreen( screen );\n\t\treturn () => removeScreen( screen );\n\t}, [ screenId, path, addScreen, removeScreen ] );\n\n\tconst isRTL = isRTLFn();\n\tconst { isInitial, isBack } = location;\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.navigatorScreen( {\n\t\t\t\t\tisInitial,\n\t\t\t\t\tisBack,\n\t\t\t\t\tisRTL,\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isInitial, isBack, isRTL ]\n\t);\n\n\tconst locationRef = useRef( location );\n\n\tuseEffect( () => {\n\t\tlocationRef.current = location;\n\t}, [ location ] );\n\n\t// Focus restoration\n\tconst isInitialLocation = location.isInitial && ! location.isBack;\n\tuseEffect( () => {\n\t\t// Only attempt to restore focus:\n\t\t// - if the current location is not the initial one (to avoid moving focus on page load)\n\t\t// - when the screen becomes visible\n\t\t// - if the wrapper ref has been assigned\n\t\t// - if focus hasn't already been restored for the current location\n\t\t// - if the `skipFocus` option is not set to `true`. This is useful when we trigger the navigation outside of NavigatorScreen.\n\t\tif (\n\t\t\tisInitialLocation ||\n\t\t\t! isMatch ||\n\t\t\t! wrapperRef.current ||\n\t\t\tlocationRef.current.hasRestoredFocus ||\n\t\t\tlocation.skipFocus\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeElement = wrapperRef.current.ownerDocument.activeElement;\n\n\t\t// If an element is already focused within the wrapper do not focus the\n\t\t// element. This prevents inputs or buttons from losing focus unnecessarily.\n\t\tif ( wrapperRef.current.contains( activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet elementToFocus: HTMLElement | null = null;\n\n\t\t// When navigating back, if a selector is provided, use it to look for the\n\t\t// target element (assumed to be a node inside the current NavigatorScreen)\n\t\tif ( location.isBack && location.focusTargetSelector ) {\n\t\t\telementToFocus = wrapperRef.current.querySelector(\n\t\t\t\tlocation.focusTargetSelector\n\t\t\t);\n\t\t}\n\n\t\t// If the previous query didn't run or find any element to focus, fallback\n\t\t// to the first tabbable element in the screen (or the screen itself).\n\t\tif ( ! elementToFocus ) {\n\t\t\tconst [ firstTabbable ] = focus.tabbable.find( wrapperRef.current );\n\t\t\telementToFocus = firstTabbable ?? wrapperRef.current;\n\t\t}\n\n\t\tlocationRef.current.hasRestoredFocus = true;\n\t\telementToFocus.focus();\n\t}, [\n\t\tisInitialLocation,\n\t\tisMatch,\n\t\tlocation.isBack,\n\t\tlocation.focusTargetSelector,\n\t\tlocation.skipFocus,\n\t] );\n\n\tconst mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );\n\n\treturn isMatch ? (\n\t\t<View ref={ mergedWrapperRef } className={ classes } { ...otherProps }>\n\t\t\t{ children }\n\t\t</View>\n\t) : null;\n}\n\n/**\n * The `NavigatorScreen` component represents a single view/screen/panel and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */\nexport const NavigatorScreen =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AACC,QAAQ,CAACC,IAAI,CAAE7B,UAAU,CAACgB,OAAQ,CAAC;MACnEO,cAAc,GAAGG,aAAa,aAAbA,aAAa,cAAbA,aAAa,GAAI1B,UAAU,CAACgB,OAAO;IACrD;IAEAD,WAAW,CAACC,OAAO,CAACE,gBAAgB,GAAG,IAAI;IAC3CK,cAAc,CAACI,KAAK,CAAC,CAAC;EACvB,CAAC,EAAE,CACFV,iBAAiB,EACjBlB,OAAO,EACPN,QAAQ,CAACgB,MAAM,EACfhB,QAAQ,CAAC+B,mBAAmB,EAC5B/B,QAAQ,CAAC0B,SAAS,CACjB,CAAC;EAEH,MAAMW,gBAAgB,GAAG,IAAAC,qBAAY,EAAE,CAAE9C,YAAY,EAAEe,UAAU,CAAG,CAAC;EAErE,OAAOD,OAAO,gBACb,IAAArC,WAAA,CAAAsE,GAAA,EAAC1E,KAAA,CAAA2E,IAAI;IAACC,GAAG,EAAGJ,gBAAkB;IAACzC,SAAS,EAAGuB,OAAS;IAAA,GAAMrB,UAAU;IAAAH,QAAA,EACjEA;EAAQ,CACL,CAAC,GACJ,IAAI;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM+C,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,uBAAc,EAC5CtD,0BAA0B,EAC1B,iBACD,CAAC;AAAC,IAAAuD,QAAA,GAAAF,OAAA,CAAAnE,OAAA,GAEakE,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["_dom","require","_element","_compose","_i18n","_escapeHtml","_warning","_interopRequireDefault","_context","_useCx","_view","_context2","styles","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","UnconnectedNavigatorScreen","props","forwardedRef","test","path","globalThis","SCRIPT_DEBUG","warning","screenId","useId","children","className","otherProps","useContextSystem","location","match","addScreen","removeScreen","useContext","NavigatorContext","isMatch","wrapperRef","useRef","useEffect","screen","id","escapeAttribute","isRTL","isRTLFn","isInitial","isBack","cx","useCx","classes","useMemo","navigatorScreen","locationRef","current","isInitialLocation","hasRestoredFocus","skipFocus","activeElement","ownerDocument","contains","elementToFocus","focusTargetSelector","querySelector","firstTabbable","focus","tabbable","find","mergedWrapperRef","useMergeRefs","jsx","View","ref","NavigatorScreen","exports","contextConnect","_default"],"sources":["@wordpress/components/src/navigator/navigator-screen/component.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { focus } from '@wordpress/dom';\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseId,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { isRTL as isRTLFn } from '@wordpress/i18n';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect, useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport { View } from '../../view';\nimport { NavigatorContext } from '../context';\nimport * as styles from '../styles';\nimport type { NavigatorScreenProps } from '../types';\n\nfunction UnconnectedNavigatorScreen(\n\tprops: WordPressComponentProps< NavigatorScreenProps, 'div', false >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tif ( ! /^\\//.test( props.path ) ) {\n\t\twarning(\n\t\t\t'wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.'\n\t\t);\n\t}\n\n\tconst screenId = useId();\n\tconst { children, className, path, ...otherProps } = useContextSystem(\n\t\tprops,\n\t\t'NavigatorScreen'\n\t);\n\n\tconst { location, match, addScreen, removeScreen } =\n\t\tuseContext( NavigatorContext );\n\tconst isMatch = match === screenId;\n\tconst wrapperRef = useRef< HTMLDivElement >( null );\n\n\tuseEffect( () => {\n\t\tconst screen = {\n\t\t\tid: screenId,\n\t\t\tpath: escapeAttribute( path ),\n\t\t};\n\t\taddScreen( screen );\n\t\treturn () => removeScreen( screen );\n\t}, [ screenId, path, addScreen, removeScreen ] );\n\n\tconst isRTL = isRTLFn();\n\tconst { isInitial, isBack } = location;\n\tconst cx = useCx();\n\tconst classes = useMemo(\n\t\t() =>\n\t\t\tcx(\n\t\t\t\tstyles.navigatorScreen( {\n\t\t\t\t\tisInitial,\n\t\t\t\t\tisBack,\n\t\t\t\t\tisRTL,\n\t\t\t\t} ),\n\t\t\t\tclassName\n\t\t\t),\n\t\t[ className, cx, isInitial, isBack, isRTL ]\n\t);\n\n\tconst locationRef = useRef( location );\n\n\tuseEffect( () => {\n\t\tlocationRef.current = location;\n\t}, [ location ] );\n\n\t// Focus restoration\n\tconst isInitialLocation = location.isInitial && ! location.isBack;\n\tuseEffect( () => {\n\t\t// Only attempt to restore focus:\n\t\t// - if the current location is not the initial one (to avoid moving focus on page load)\n\t\t// - when the screen becomes visible\n\t\t// - if the wrapper ref has been assigned\n\t\t// - if focus hasn't already been restored for the current location\n\t\t// - if the `skipFocus` option is not set to `true`. This is useful when we trigger the navigation outside of NavigatorScreen.\n\t\tif (\n\t\t\tisInitialLocation ||\n\t\t\t! isMatch ||\n\t\t\t! wrapperRef.current ||\n\t\t\tlocationRef.current.hasRestoredFocus ||\n\t\t\tlocation.skipFocus\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst activeElement = wrapperRef.current.ownerDocument.activeElement;\n\n\t\t// If an element is already focused within the wrapper do not focus the\n\t\t// element. This prevents inputs or buttons from losing focus unnecessarily.\n\t\tif ( wrapperRef.current.contains( activeElement ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet elementToFocus: HTMLElement | null = null;\n\n\t\t// When navigating back, if a selector is provided, use it to look for the\n\t\t// target element (assumed to be a node inside the current NavigatorScreen)\n\t\tif ( location.isBack && location.focusTargetSelector ) {\n\t\t\telementToFocus = wrapperRef.current.querySelector(\n\t\t\t\tlocation.focusTargetSelector\n\t\t\t);\n\t\t}\n\n\t\t// If the previous query didn't run or find any element to focus, fallback\n\t\t// to the first tabbable element in the screen (or the screen itself).\n\t\tif ( ! elementToFocus ) {\n\t\t\tconst [ firstTabbable ] = focus.tabbable.find( wrapperRef.current );\n\t\t\telementToFocus = firstTabbable ?? wrapperRef.current;\n\t\t}\n\n\t\tlocationRef.current.hasRestoredFocus = true;\n\t\telementToFocus.focus();\n\t}, [\n\t\tisInitialLocation,\n\t\tisMatch,\n\t\tlocation.isBack,\n\t\tlocation.focusTargetSelector,\n\t\tlocation.skipFocus,\n\t] );\n\n\tconst mergedWrapperRef = useMergeRefs( [ forwardedRef, wrapperRef ] );\n\n\treturn isMatch ? (\n\t\t<View ref={ mergedWrapperRef } className={ classes } { ...otherProps }>\n\t\t\t{ children }\n\t\t</View>\n\t) : null;\n}\n\n/**\n * The `NavigatorScreen` component represents a single view/screen/panel and\n * should be used in combination with the `NavigatorProvider`, the\n * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`\n * hook).\n *\n * @example\n * ```jsx\n * import {\n * __experimentalNavigatorProvider as NavigatorProvider,\n * __experimentalNavigatorScreen as NavigatorScreen,\n * __experimentalNavigatorButton as NavigatorButton,\n * __experimentalNavigatorBackButton as NavigatorBackButton,\n * } from '@wordpress/components';\n *\n * const MyNavigation = () => (\n * <NavigatorProvider initialPath=\"/\">\n * <NavigatorScreen path=\"/\">\n * <p>This is the home screen.</p>\n * <NavigatorButton path=\"/child\">\n * Navigate to child screen.\n * </NavigatorButton>\n * </NavigatorScreen>\n *\n * <NavigatorScreen path=\"/child\">\n * <p>This is the child screen.</p>\n * <NavigatorBackButton>\n * Go back\n * </NavigatorBackButton>\n * </NavigatorScreen>\n * </NavigatorProvider>\n * );\n * ```\n */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ignoreList":[]}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = exports.NavigatorToParentButton = void 0;
8
8
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
9
- var _navigatorBackButton = require("../navigator-back-button");
9
+ var _component = require("../navigator-back-button/component");
10
10
  var _context = require("../../context");
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  /**
@@ -22,7 +22,7 @@ function UnconnectedNavigatorToParentButton(props, forwardedRef) {
22
22
  since: '6.7',
23
23
  alternative: 'wp.components.NavigatorBackButton'
24
24
  });
25
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_navigatorBackButton.NavigatorBackButton, {
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_component.NavigatorBackButton, {
26
26
  ref: forwardedRef,
27
27
  ...props
28
28
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_deprecated","_interopRequireDefault","require","_navigatorBackButton","_context","_jsxRuntime","UnconnectedNavigatorToParentButton","props","forwardedRef","deprecated","since","alternative","jsx","NavigatorBackButton","ref","NavigatorToParentButton","exports","contextConnect","_default","default"],"sources":["@wordpress/components/src/navigator/navigator-to-parent-button/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { NavigatorBackButton } from '../navigator-back-button';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport type { NavigatorBackButtonProps } from '../types';\n\nfunction UnconnectedNavigatorToParentButton(\n\tprops: WordPressComponentProps< NavigatorBackButtonProps, 'button' >,\n\tforwardedRef: React.ForwardedRef< any >\n) {\n\tdeprecated( 'wp.components.NavigatorToParentButton', {\n\t\tsince: '6.7',\n\t\talternative: 'wp.components.NavigatorBackButton',\n\t} );\n\n\treturn <NavigatorBackButton ref={ forwardedRef } { ...props } />;\n}\n\n/**\n * _Note: this component is deprecated. Please use the `NavigatorBackButton`\n * component instead._\n *\n * @deprecated\n */\nexport const NavigatorToParentButton = contextConnect(\n\tUnconnectedNavigatorToParentButton,\n\t'NavigatorToParentButton'\n);\n\nexport default NavigatorToParentButton;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAA+C,IAAAG,WAAA,GAAAH,OAAA;AAV/C;AACA;AACA;;AAGA;AACA;AACA;;AAMA,SAASI,kCAAkCA,CAC1CC,KAAoE,EACpEC,YAAuC,EACtC;EACD,IAAAC,mBAAU,EAAE,uCAAuC,EAAE;IACpDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EAEH,oBAAO,IAAAN,WAAA,CAAAO,GAAA,EAACT,oBAAA,CAAAU,mBAAmB;IAACC,GAAG,EAAGN,YAAc;IAAA,GAAMD;EAAK,CAAI,CAAC;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAAE,uBAAc,EACpDX,kCAAkC,EAClC,yBACD,CAAC;AAAC,IAAAY,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAEaJ,uBAAuB","ignoreList":[]}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","_component","_context","_jsxRuntime","UnconnectedNavigatorToParentButton","props","forwardedRef","deprecated","since","alternative","jsx","NavigatorBackButton","ref","NavigatorToParentButton","exports","contextConnect","_default","default"],"sources":["@wordpress/components/src/navigator/navigator-to-parent-button/component.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { NavigatorBackButton } from '../navigator-back-button/component';\nimport type { WordPressComponentProps } from '../../context';\nimport { contextConnect } from '../../context';\nimport type { NavigatorBackButtonProps } from '../types';\n\nfunction UnconnectedNavigatorToParentButton(\n\tprops: WordPressComponentProps< NavigatorBackButtonProps, 'button' >,\n\tforwardedRef: React.ForwardedRef< any >\n) {\n\tdeprecated( 'wp.components.NavigatorToParentButton', {\n\t\tsince: '6.7',\n\t\talternative: 'wp.components.NavigatorBackButton',\n\t} );\n\n\treturn <NavigatorBackButton ref={ forwardedRef } { ...props } />;\n}\n\n/**\n * _Note: this component is deprecated. Please use the `NavigatorBackButton`\n * component instead._\n *\n * @deprecated\n */\nexport const NavigatorToParentButton = contextConnect(\n\tUnconnectedNavigatorToParentButton,\n\t'NavigatorToParentButton'\n);\n\nexport default NavigatorToParentButton;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAA+C,IAAAG,WAAA,GAAAH,OAAA;AAV/C;AACA;AACA;;AAGA;AACA;AACA;;AAMA,SAASI,kCAAkCA,CAC1CC,KAAoE,EACpEC,YAAuC,EACtC;EACD,IAAAC,mBAAU,EAAE,uCAAuC,EAAE;IACpDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EAEH,oBAAO,IAAAN,WAAA,CAAAO,GAAA,EAACT,UAAA,CAAAU,mBAAmB;IAACC,GAAG,EAAGN,YAAc;IAAA,GAAMD;EAAK,CAAI,CAAC;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMQ,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAAE,uBAAc,EACpDX,kCAAkC,EAClC,yBACD,CAAC;AAAC,IAAAY,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAEaJ,uBAAuB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["@wordpress/components/src/navigator/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\n\nexport type MatchParams = Record< string, string | string[] >;\n\nexport type NavigateOptions = {\n\t/**\n\t * Specify the CSS selector used to restore focus on an given element when\n\t * navigating back. When not provided, the component will attempt to restore\n\t * focus on the element that originated the forward navigation.\n\t */\n\tfocusTargetSelector?: string;\n\t/**\n\t * Whether the navigation is a backwards navigation. This enables focus\n\t * restoration (when possible), and causes the animation to be backwards.\n\t */\n\tisBack?: boolean;\n\t/**\n\t * Opt out of focus management. Useful when the consumer of the component\n\t * wants to manage focus themselves.\n\t */\n\tskipFocus?: boolean;\n\t/**\n\t * Whether the navigation should replace the current location in the stack.\n\t */\n\treplace?: boolean;\n};\n\nexport type NavigateToParentOptions = Omit< NavigateOptions, 'isBack' >;\n\nexport type NavigatorLocation = NavigateOptions & {\n\t/**\n\t * Whether the current location is the initial one (ie. first in the stack).\n\t */\n\tisInitial?: boolean;\n\t/**\n\t * The path associated to the location.\n\t */\n\tpath?: string;\n\t/**\n\t * Whether focus was already restored for this location (in case of\n\t * backwards navigation).\n\t */\n\thasRestoredFocus?: boolean;\n};\n\n// Returned by the `useNavigator` hook.\nexport type Navigator = {\n\t/**\n\t * The current location.\n\t */\n\tlocation: NavigatorLocation;\n\t/**\n\t * Params associated with the current location\n\t */\n\tparams: MatchParams;\n\t/**\n\t * Navigate to a new location.\n\t */\n\tgoTo: ( path: string, options?: NavigateOptions ) => void;\n\t/**\n\t * Go back to the parent location (ie. \"/some/path\" will navigate back\n\t * to \"/some\")\n\t */\n\tgoBack: ( options?: NavigateToParentOptions ) => void;\n\t/**\n\t * _Note: This function is deprecated. Please use `goBack` instead._\n\t * @deprecated\n\t * @ignore\n\t */\n\tgoToParent: ( options?: NavigateToParentOptions ) => void;\n};\n\nexport type NavigatorContext = Navigator & {\n\taddScreen: ( screen: Screen ) => void;\n\tremoveScreen: ( screen: Screen ) => void;\n\tmatch?: string;\n};\n\nexport type NavigatorProviderProps = {\n\t/**\n\t * The initial active path.\n\t */\n\tinitialPath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorScreenProps = {\n\t/**\n\t * The screen's path, matched against the current path stored in the navigator.\n\t */\n\tpath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorBackButtonProps = ButtonAsButtonProps;\n\nexport type NavigatorToParentButtonProps = NavigatorBackButtonProps;\n\nexport type NavigatorButtonProps = NavigatorBackButtonProps & {\n\t/**\n\t * The path of the screen to navigate to. The value of this prop needs to be\n\t * a valid value for an HTML attribute.\n\t */\n\tpath: string;\n\t/**\n\t * The HTML attribute used to identify the `NavigatorButton`, which is used\n\t * by `Navigator` to restore focus.\n\t *\n\t * @default 'id'\n\t */\n\tattributeName?: string;\n};\n\nexport type Screen = {\n\tid: string;\n\tpath: string;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["@wordpress/components/src/navigator/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { ButtonAsButtonProps } from '../button/types';\n\nexport type MatchParams = Record< string, string | string[] >;\n\nexport type NavigateOptions = {\n\t/**\n\t * Specify the CSS selector used to restore focus on an given element when\n\t * navigating back. When not provided, the component will attempt to restore\n\t * focus on the element that originated the forward navigation.\n\t */\n\tfocusTargetSelector?: string;\n\t/**\n\t * Whether the navigation is a backwards navigation. This enables focus\n\t * restoration (when possible), and causes the animation to be backwards.\n\t */\n\tisBack?: boolean;\n\t/**\n\t * Opt out of focus management. Useful when the consumer of the component\n\t * wants to manage focus themselves.\n\t */\n\tskipFocus?: boolean;\n\t/**\n\t * Note: this option is deprecated and currently doesn't have any effect.\n\t * @deprecated\n\t * @ignore\n\t */\n\treplace?: boolean;\n};\n\nexport type NavigateToParentOptions = Omit< NavigateOptions, 'isBack' >;\n\nexport type NavigatorLocation = NavigateOptions & {\n\t/**\n\t * Whether the current location is the initial one (ie. first in the stack).\n\t */\n\tisInitial?: boolean;\n\t/**\n\t * The path associated to the location.\n\t */\n\tpath?: string;\n\t/**\n\t * Whether focus was already restored for this location (in case of\n\t * backwards navigation).\n\t */\n\thasRestoredFocus?: boolean;\n};\n\n// Returned by the `useNavigator` hook.\nexport type Navigator = {\n\t/**\n\t * The current location.\n\t */\n\tlocation: NavigatorLocation;\n\t/**\n\t * Params associated with the current location\n\t */\n\tparams: MatchParams;\n\t/**\n\t * Navigate to a new location.\n\t */\n\tgoTo: ( path: string, options?: NavigateOptions ) => void;\n\t/**\n\t * Go back to the parent location (ie. \"/some/path\" will navigate back\n\t * to \"/some\")\n\t */\n\tgoBack: ( options?: NavigateToParentOptions ) => void;\n\t/**\n\t * _Note: This function is deprecated. Please use `goBack` instead._\n\t * @deprecated\n\t * @ignore\n\t */\n\tgoToParent: ( options?: NavigateToParentOptions ) => void;\n};\n\nexport type NavigatorContext = Navigator & {\n\taddScreen: ( screen: Screen ) => void;\n\tremoveScreen: ( screen: Screen ) => void;\n\tmatch?: string;\n};\n\nexport type NavigatorProviderProps = {\n\t/**\n\t * The initial active path.\n\t */\n\tinitialPath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorScreenProps = {\n\t/**\n\t * The screen's path, matched against the current path stored in the navigator.\n\t */\n\tpath: string;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n\nexport type NavigatorBackButtonProps = ButtonAsButtonProps;\n\nexport type NavigatorToParentButtonProps = NavigatorBackButtonProps;\n\nexport type NavigatorButtonProps = NavigatorBackButtonProps & {\n\t/**\n\t * The path of the screen to navigate to. The value of this prop needs to be\n\t * a valid value for an HTML attribute.\n\t */\n\tpath: string;\n\t/**\n\t * The HTML attribute used to identify the `NavigatorButton`, which is used\n\t * by `Navigator` to restore focus.\n\t *\n\t * @default 'id'\n\t */\n\tattributeName?: string;\n};\n\nexport type Screen = {\n\tid: string;\n\tpath: string;\n};\n"],"mappings":"","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.useNavigator = useNavigator;
7
7
  var _element = require("@wordpress/element");
8
8
  var _context = require("./context");
9
9
  /**
@@ -33,5 +33,4 @@ function useNavigator() {
33
33
  params
34
34
  };
35
35
  }
36
- var _default = exports.default = useNavigator;
37
36
  //# sourceMappingURL=use-navigator.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_context","useNavigator","location","params","goTo","goBack","goToParent","useContext","NavigatorContext","_default","exports","default"],"sources":["@wordpress/components/src/navigator/use-navigator.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { NavigatorContext } from './context';\nimport type { Navigator } from './types';\n\n/**\n * Retrieves a `navigator` instance.\n */\nfunction useNavigator(): Navigator {\n\tconst { location, params, goTo, goBack, goToParent } =\n\t\tuseContext( NavigatorContext );\n\n\treturn {\n\t\tlocation,\n\t\tgoTo,\n\t\tgoBack,\n\t\tgoToParent,\n\t\tparams,\n\t};\n}\n\nexport default useNavigator;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA,SAASE,YAAYA,CAAA,EAAc;EAClC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC;EAAW,CAAC,GACnD,IAAAC,mBAAU,EAAEC,yBAAiB,CAAC;EAE/B,OAAO;IACNN,QAAQ;IACRE,IAAI;IACJC,MAAM;IACNC,UAAU;IACVH;EACD,CAAC;AACF;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcV,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_context","useNavigator","location","params","goTo","goBack","goToParent","useContext","NavigatorContext"],"sources":["@wordpress/components/src/navigator/use-navigator.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { NavigatorContext } from './context';\nimport type { Navigator } from './types';\n\n/**\n * Retrieves a `navigator` instance.\n */\nexport function useNavigator(): Navigator {\n\tconst { location, params, goTo, goBack, goToParent } =\n\t\tuseContext( NavigatorContext );\n\n\treturn {\n\t\tlocation,\n\t\tgoTo,\n\t\tgoBack,\n\t\tgoToParent,\n\t\tparams,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACO,SAASE,YAAYA,CAAA,EAAc;EACzC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC;EAAW,CAAC,GACnD,IAAAC,mBAAU,EAAEC,yBAAiB,CAAC;EAE/B,OAAO;IACNN,QAAQ;IACRE,IAAI;IACJC,MAAM;IACNC,UAAU;IACVH;EACD,CAAC;AACF","ignoreList":[]}
@@ -210,9 +210,9 @@ function PaletteEditListView({
210
210
  addColorRef
211
211
  }) {
212
212
  // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.
213
- const elementsReference = (0, _element.useRef)();
213
+ const elementsReferenceRef = (0, _element.useRef)();
214
214
  (0, _element.useEffect)(() => {
215
- elementsReference.current = elements;
215
+ elementsReferenceRef.current = elements;
216
216
  }, [elements]);
217
217
  const debounceOnChange = (0, _compose.useDebounce)(onChange, 100);
218
218
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_vStack.VStack, {