@wordpress/edit-site 5.3.4 → 5.3.6

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 (178) hide show
  1. package/build/components/add-new-template/add-custom-template-modal.js +12 -3
  2. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  3. package/build/components/add-new-template/new-template-part.js +8 -7
  4. package/build/components/add-new-template/new-template-part.js.map +1 -1
  5. package/build/components/add-new-template/new-template.js +3 -6
  6. package/build/components/add-new-template/new-template.js.map +1 -1
  7. package/build/components/editor/index.js +3 -3
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/screen-border.js +1 -1
  10. package/build/components/global-styles/screen-border.js.map +1 -1
  11. package/build/components/global-styles/screen-variations.js +1 -1
  12. package/build/components/global-styles/screen-variations.js.map +1 -1
  13. package/build/components/global-styles/shadow-panel.js +6 -4
  14. package/build/components/global-styles/shadow-panel.js.map +1 -1
  15. package/build/components/global-styles/ui.js +1 -1
  16. package/build/components/global-styles/ui.js.map +1 -1
  17. package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
  18. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  19. package/build/components/keyboard-shortcuts/global.js +48 -0
  20. package/build/components/keyboard-shortcuts/global.js.map +1 -0
  21. package/build/components/keyboard-shortcuts/register.js +153 -0
  22. package/build/components/keyboard-shortcuts/register.js.map +1 -0
  23. package/build/components/layout/index.js +5 -1
  24. package/build/components/layout/index.js.map +1 -1
  25. package/build/components/list/added-by.js +41 -42
  26. package/build/components/list/added-by.js.map +1 -1
  27. package/build/components/list/table.js +3 -2
  28. package/build/components/list/table.js.map +1 -1
  29. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  30. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  31. package/build/components/save-button/index.js +5 -2
  32. package/build/components/save-button/index.js.map +1 -1
  33. package/build/components/save-panel/index.js +11 -1
  34. package/build/components/save-panel/index.js.map +1 -1
  35. package/build/components/sidebar/index.js +28 -35
  36. package/build/components/sidebar/index.js.map +1 -1
  37. package/build/components/sidebar-button/index.js +30 -0
  38. package/build/components/sidebar-button/index.js.map +1 -0
  39. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  40. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen/index.js +10 -10
  42. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-main/index.js +3 -3
  44. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  45. package/build/components/sidebar-navigation-screen-navigation-item/index.js +17 -16
  46. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  47. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
  48. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  49. package/build/components/sidebar-navigation-screen-template/index.js +9 -19
  50. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  51. package/build/components/sidebar-navigation-screen-templates/index.js +25 -15
  52. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  53. package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
  54. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  55. package/build/components/style-book/index.js +17 -2
  56. package/build/components/style-book/index.js.map +1 -1
  57. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  58. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  59. package/build/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
  60. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  61. package/build/components/template-details/index.js +7 -9
  62. package/build/components/template-details/index.js.map +1 -1
  63. package/build/index.js +10 -22
  64. package/build/index.js.map +1 -1
  65. package/build/utils/get-is-list-page.js +1 -1
  66. package/build/utils/get-is-list-page.js.map +1 -1
  67. package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
  68. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  69. package/build-module/components/add-new-template/new-template-part.js +8 -7
  70. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  71. package/build-module/components/add-new-template/new-template.js +3 -6
  72. package/build-module/components/add-new-template/new-template.js.map +1 -1
  73. package/build-module/components/editor/index.js +3 -3
  74. package/build-module/components/editor/index.js.map +1 -1
  75. package/build-module/components/global-styles/screen-border.js +1 -1
  76. package/build-module/components/global-styles/screen-border.js.map +1 -1
  77. package/build-module/components/global-styles/screen-variations.js +1 -1
  78. package/build-module/components/global-styles/screen-variations.js.map +1 -1
  79. package/build-module/components/global-styles/shadow-panel.js +6 -4
  80. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  81. package/build-module/components/global-styles/ui.js +1 -1
  82. package/build-module/components/global-styles/ui.js.map +1 -1
  83. package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
  84. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  85. package/build-module/components/keyboard-shortcuts/global.js +37 -0
  86. package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
  87. package/build-module/components/keyboard-shortcuts/register.js +141 -0
  88. package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
  89. package/build-module/components/layout/index.js +3 -1
  90. package/build-module/components/layout/index.js.map +1 -1
  91. package/build-module/components/list/added-by.js +43 -44
  92. package/build-module/components/list/added-by.js.map +1 -1
  93. package/build-module/components/list/table.js +3 -2
  94. package/build-module/components/list/table.js.map +1 -1
  95. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  96. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  97. package/build-module/components/save-button/index.js +5 -2
  98. package/build-module/components/save-button/index.js.map +1 -1
  99. package/build-module/components/save-panel/index.js +8 -1
  100. package/build-module/components/save-panel/index.js.map +1 -1
  101. package/build-module/components/sidebar/index.js +25 -35
  102. package/build-module/components/sidebar/index.js.map +1 -1
  103. package/build-module/components/sidebar-button/index.js +18 -0
  104. package/build-module/components/sidebar-button/index.js.map +1 -0
  105. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  106. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  107. package/build-module/components/sidebar-navigation-screen/index.js +8 -11
  108. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  109. package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
  110. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  111. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +16 -17
  112. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  113. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
  114. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  115. package/build-module/components/sidebar-navigation-screen-template/index.js +8 -18
  116. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  117. package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -16
  118. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  119. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -7
  120. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  121. package/build-module/components/style-book/index.js +17 -3
  122. package/build-module/components/style-book/index.js.map +1 -1
  123. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  124. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  125. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +63 -18
  126. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  127. package/build-module/components/template-details/index.js +7 -8
  128. package/build-module/components/template-details/index.js.map +1 -1
  129. package/build-module/index.js +12 -22
  130. package/build-module/index.js.map +1 -1
  131. package/build-module/utils/get-is-list-page.js +1 -1
  132. package/build-module/utils/get-is-list-page.js.map +1 -1
  133. package/build-style/style-rtl.css +41 -38
  134. package/build-style/style.css +41 -38
  135. package/package.json +21 -21
  136. package/src/components/add-new-template/add-custom-template-modal.js +14 -10
  137. package/src/components/add-new-template/new-template-part.js +7 -9
  138. package/src/components/add-new-template/new-template.js +3 -6
  139. package/src/components/add-new-template/style.scss +0 -5
  140. package/src/components/block-editor/style.scss +1 -1
  141. package/src/components/editor/index.js +4 -3
  142. package/src/components/editor/style.scss +0 -6
  143. package/src/components/global-styles/screen-border.js +1 -1
  144. package/src/components/global-styles/screen-variations.js +0 -1
  145. package/src/components/global-styles/shadow-panel.js +4 -3
  146. package/src/components/global-styles/ui.js +1 -1
  147. package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
  148. package/src/components/keyboard-shortcuts/global.js +35 -0
  149. package/src/components/keyboard-shortcuts/register.js +157 -0
  150. package/src/components/layout/index.js +4 -0
  151. package/src/components/layout/style.scss +8 -1
  152. package/src/components/list/added-by.js +48 -55
  153. package/src/components/list/style.scss +5 -13
  154. package/src/components/list/table.js +4 -5
  155. package/src/components/navigation-inspector/navigation-menu.js +8 -2
  156. package/src/components/save-button/index.js +2 -2
  157. package/src/components/save-panel/index.js +8 -1
  158. package/src/components/sidebar/index.js +34 -29
  159. package/src/components/sidebar-button/index.js +21 -0
  160. package/src/components/sidebar-button/style.scss +23 -0
  161. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
  162. package/src/components/sidebar-edit-mode/style.scss +16 -0
  163. package/src/components/sidebar-navigation-screen/index.js +31 -38
  164. package/src/components/sidebar-navigation-screen/style.scss +1 -9
  165. package/src/components/sidebar-navigation-screen-main/index.js +3 -3
  166. package/src/components/sidebar-navigation-screen-navigation-item/index.js +24 -20
  167. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +0 -2
  168. package/src/components/sidebar-navigation-screen-template/index.js +7 -19
  169. package/src/components/sidebar-navigation-screen-templates/index.js +22 -14
  170. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
  171. package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
  172. package/src/components/style-book/index.js +25 -1
  173. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
  174. package/src/components/sync-state-with-url/use-sync-path-with-url.js +72 -17
  175. package/src/components/template-details/index.js +5 -6
  176. package/src/index.js +6 -21
  177. package/src/style.scss +1 -0
  178. package/src/utils/get-is-list-page.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","isStyleBookOpened","setIsStyleBookOpened","editorMode","select","editSiteStore","getEditorMode","styles","seen"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;AACA,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,aAAxB,EADI,EAElB,EAFkB,CAAnB;AAKA,0BAAW,MAAM;AAChB,QAAKH,UAAU,KAAK,QAApB,EAA+B;AAC9BD,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AACD,GAJD,EAIG,CAAEC,UAAF,CAJH;AAKA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGI,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,sBAAJ,CALd;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4CAAU,cAAI,QAAJ,CAAV,CADD,CADD,EAIC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,WADR;AAEC,MAAA,KAAK,EACJP,iBAAiB,GACd,cAAI,kBAAJ,CADc,GAEd,cAAI,iBAAJ,CALL;AAOC,MAAA,SAAS,EAAGA,iBAPb;AAQC,MAAA,QAAQ,EAAGE,UAAU,KAAK,QAR3B;AASC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,oBAAoB,CAAE,CAAED,iBAAJ,CAApB;AACA;AAXF,MADD,CAJD,EAmBC,4BAAC,oBAAD,QACC,4BAAC,wBAAD,OADD,CAnBD;AARF,KAiCC,4BAAC,4BAAD;AACC,IAAA,iBAAiB,EAAGA,iBADrB;AAEC,IAAA,gBAAgB,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AAF9C,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FlexItem, FlexBlock, Flex, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, seen } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesMenuSlot } from '../global-styles/ui';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst editorMode = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditorMode(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'visual' ) {\n\t\t\tsetIsStyleBookOpened( false );\n\t\t}\n\t}, [ editorMode ] );\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close Styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisStyleBookOpened\n\t\t\t\t\t\t\t\t\t? __( 'Close Style Book' )\n\t\t\t\t\t\t\t\t\t: __( 'Open Style Book' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\tdisabled={ editorMode !== 'visual' }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<GlobalStylesMenuSlot />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI\n\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\tonCloseStyleBook={ () => setIsStyleBookOpened( false ) }\n\t\t\t/>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","isStyleBookOpened","setIsStyleBookOpened","editorMode","select","editSiteStore","getEditorMode","styles","minWidth","seen"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;AACA,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,aAAxB,EADI,EAElB,EAFkB,CAAnB;AAKA,0BAAW,MAAM;AAChB,QAAKH,UAAU,KAAK,QAApB,EAA+B;AAC9BD,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AACD,GAJD,EAIG,CAAEC,UAAF,CAJH;AAKA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGI,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,sBAAJ,CALd;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,4BAAC,gBAAD;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,4BAAC,qBAAD;AAAW,MAAA,KAAK,EAAG;AAAEC,QAAAA,QAAQ,EAAE;AAAZ;AAAnB,OACC,4CAAU,cAAI,QAAJ,CAAV,CADD,CADD,EAIC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,WADR;AAEC,MAAA,KAAK,EAAG,cAAI,YAAJ,CAFT;AAGC,MAAA,SAAS,EAAGR,iBAHb;AAIC,MAAA,QAAQ,EAAGE,UAAU,KAAK,QAJ3B;AAKC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,oBAAoB,CAAE,CAAED,iBAAJ,CAApB;AACA;AAPF,MADD,CAJD,EAeC,4BAAC,oBAAD,QACC,4BAAC,wBAAD,OADD,CAfD;AARF,KA6BC,4BAAC,4BAAD;AACC,IAAA,iBAAiB,EAAGA,iBADrB;AAEC,IAAA,gBAAgB,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AAF9C,IA7BD,CADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FlexItem, FlexBlock, Flex, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, seen } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesMenuSlot } from '../global-styles/ui';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst editorMode = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditorMode(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'visual' ) {\n\t\t\tsetIsStyleBookOpened( false );\n\t\t}\n\t}, [ editorMode ] );\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close Styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex className=\"edit-site-global-styles-sidebar__header\">\n\t\t\t\t\t<FlexBlock style={ { minWidth: 'min-content' } }>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\tdisabled={ editorMode !== 'visual' }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<GlobalStylesMenuSlot />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI\n\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\tonCloseStyleBook={ () => setIsStyleBookOpened( false ) }\n\t\t\t/>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -19,6 +21,8 @@ var _store = require("../../store");
19
21
 
20
22
  var _privateApis = require("../../private-apis");
21
23
 
24
+ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
25
+
22
26
  /**
23
27
  * WordPress dependencies
24
28
  */
@@ -28,7 +32,7 @@ var _privateApis = require("../../private-apis");
28
32
  */
29
33
  function SidebarNavigationScreen(_ref) {
30
34
  let {
31
- path,
35
+ isRoot,
32
36
  title,
33
37
  actions,
34
38
  content
@@ -43,21 +47,17 @@ function SidebarNavigationScreen(_ref) {
43
47
  dashboardLink: getSettings().__experimentalDashboardLink
44
48
  };
45
49
  }, []);
46
- return (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
47
- className: "edit-site-sidebar-navigation-screen",
48
- path: path
49
- }, (0, _element.createElement)(_components.__experimentalVStack, {
50
+ return (0, _element.createElement)(_components.__experimentalVStack, {
50
51
  spacing: 2
51
52
  }, (0, _element.createElement)(_components.__experimentalHStack, {
52
53
  spacing: 4,
53
54
  justify: "flex-start",
54
55
  className: "edit-site-sidebar-navigation-screen__title-icon"
55
- }, path !== '/' ? (0, _element.createElement)(_components.__experimentalNavigatorToParentButton, {
56
- className: "edit-site-sidebar-navigation-screen__back",
56
+ }, !isRoot ? (0, _element.createElement)(_components.__experimentalNavigatorToParentButton, {
57
+ as: _sidebarButton.default,
57
58
  icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
58
59
  "aria-label": (0, _i18n.__)('Back')
59
- }) : (0, _element.createElement)(_components.Button, {
60
- className: "edit-site-sidebar-navigation-screen__back",
60
+ }) : (0, _element.createElement)(_sidebarButton.default, {
61
61
  icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
62
62
  "aria-label": (0, _i18n.__)('Navigate to the Dashboard'),
63
63
  href: dashboardLink || 'index.php',
@@ -66,6 +66,6 @@ function SidebarNavigationScreen(_ref) {
66
66
  className: "edit-site-sidebar-navigation-screen__title"
67
67
  }, title), actions), (0, _element.createElement)("nav", {
68
68
  className: "edit-site-sidebar-navigation-screen__content"
69
- }, content)));
69
+ }, content));
70
70
  }
71
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["SidebarNavigationScreen","path","title","actions","content","dashboardLink","select","getSettings","editSiteStore","__experimentalDashboardLink","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAYA;AACA;AACA;AAIe,SAASA,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,IADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoB,qBAAaC,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkB,yBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,WAAO;AACNH,MAAAA,aAAa,EAAEE,WAAW,GAAGE;AADvB,KAAP;AAGA,GALyB,EAKvB,EALuB,CAA1B;AAOA,SACC,4BAAC,yCAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,IAAI,EAAGR;AAFR,KAIC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGA,IAAI,KAAK,GAAT,GACD,4BAAC,iDAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,qBAAUS,mBAAV,GAAyBC,kBAFjC;AAGC,kBAAa,cAAI,MAAJ;AAHd,IADC,GAOD,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,qBAAUD,mBAAV,GAAyBC,kBAFjC;AAGC,kBAAa,cAAI,2BAAJ,CAHd;AAIC,IAAA,IAAI,EAAGN,aAAa,IAAI,WAJzB;AAKC,IAAA,KAAK,EAAG,cAAI,WAAJ;AALT,IAZF,EAoBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGH,KADH,CApBD,EAuBGC,OAvBH,CADD,EA2BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA3BD,CAJD,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n\tButton,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nexport default function SidebarNavigationScreen( {\n\tpath,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen\"\n\t\t\tpath={ path }\n\t\t>\n\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ path !== '/' ? (\n\t\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h2>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\n\t\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ content }\n\t\t\t\t</nav>\n\t\t\t</VStack>\n\t\t</NavigatorScreen>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["SidebarNavigationScreen","isRoot","title","actions","content","dashboardLink","select","getSettings","editSiteStore","__experimentalDashboardLink","SidebarButton","chevronRight","chevronLeft"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAUA;AACA;AACA;AAKe,SAASA,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoB,qBAAaC,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkB,yBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,WAAO;AACNH,MAAAA,aAAa,EAAEE,WAAW,GAAGE;AADvB,KAAP;AAGA,GALyB,EAKvB,EALuB,CAA1B;AAOA,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG,CAAER,MAAF,GACD,4BAAC,iDAAD;AACC,IAAA,EAAE,EAAGS,sBADN;AAEC,IAAA,IAAI,EAAG,qBAAUC,mBAAV,GAAyBC,kBAFjC;AAGC,kBAAa,cAAI,MAAJ;AAHd,IADC,GAOD,4BAAC,sBAAD;AACC,IAAA,IAAI,EAAG,qBAAUD,mBAAV,GAAyBC,kBADjC;AAEC,kBAAa,cAAI,2BAAJ,CAFd;AAGC,IAAA,IAAI,EAAGP,aAAa,IAAI,WAHzB;AAIC,IAAA,KAAK,EAAG,cAAI,WAAJ;AAJT,IAZF,EAmBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGH,KADH,CAnBD,EAsBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA1BD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t>\n\t\t\t\t{ ! isRoot ? (\n\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\tas={ SidebarButton }\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</h2>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\n\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -45,7 +45,7 @@ function SidebarNavigationScreenMain() {
45
45
  };
46
46
  });
47
47
  return (0, _element.createElement)(_sidebarNavigationScreen.default, {
48
- path: "/",
48
+ isRoot: true,
49
49
  title: (0, _i18n.__)('Design'),
50
50
  content: (0, _element.createElement)(_components.__experimentalItemGroup, null, !!navigationMenus && navigationMenus.length > 0 && (0, _element.createElement)(_components.__experimentalNavigatorButton, {
51
51
  as: _sidebarNavigationItem.default,
@@ -54,12 +54,12 @@ function SidebarNavigationScreenMain() {
54
54
  icon: _icons.navigation
55
55
  }, (0, _i18n.__)('Navigation')), (0, _element.createElement)(_components.__experimentalNavigatorButton, {
56
56
  as: _sidebarNavigationItem.default,
57
- path: "/templates",
57
+ path: "/wp_template",
58
58
  withChevron: true,
59
59
  icon: _icons.layout
60
60
  }, (0, _i18n.__)('Templates')), (0, _element.createElement)(_components.__experimentalNavigatorButton, {
61
61
  as: _sidebarNavigationItem.default,
62
- path: "/template-parts",
62
+ path: "/wp_template_part",
63
63
  withChevron: true,
64
64
  icon: _icons.symbolFilled
65
65
  }, (0, _i18n.__)('Template Parts')))
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","coreStore","per_page","status","length","SidebarNavigationItem","navigation","layout","symbolFilled"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsB,qBAAaC,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,eAAF,CAAnC;AACA,WAAO;AACNH,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DE,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GAR2B,CAA5B;AAUA,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAC,GADN;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EACN,4BAAC,mCAAD,QACG,CAAC,CAAEL,eAAH,IAAsBA,eAAe,CAACM,MAAhB,GAAyB,CAA/C,IACD,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGC,8BADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGC;AAJR,OAMG,cAAI,YAAJ,CANH,CAFF,EAWC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGD,8BADN;AAEC,MAAA,IAAI,EAAC,YAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGE;AAJR,OAMG,cAAI,WAAJ,CANH,CAXD,EAmBC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGF,8BADN;AAEC,MAAA,IAAI,EAAC,iBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGG;AAJR,OAMG,cAAI,gBAAJ,CANH,CAnBD;AAJF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/\"\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/templates\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/template-parts\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","coreStore","per_page","status","length","SidebarNavigationItem","navigation","layout","symbolFilled"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsB,qBAAaC,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,eAAF,CAAnC;AACA,WAAO;AACNH,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DE,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GAR2B,CAA5B;AAUA,SACC,4BAAC,gCAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EACN,4BAAC,mCAAD,QACG,CAAC,CAAEL,eAAH,IAAsBA,eAAe,CAACM,MAAhB,GAAyB,CAA/C,IACD,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGC,8BADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGC;AAJR,OAMG,cAAI,YAAJ,CANH,CAFF,EAWC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGD,8BADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGE;AAJR,OAMG,cAAI,WAAJ,CANH,CAXD,EAmBC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGF,8BADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGG;AAJR,OAMG,cAAI,gBAAJ,CANH,CAnBD;AAJF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template_part\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -19,12 +19,16 @@ var _coreData = require("@wordpress/core-data");
19
19
 
20
20
  var _htmlEntities = require("@wordpress/html-entities");
21
21
 
22
+ var _icons = require("@wordpress/icons");
23
+
22
24
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
23
25
 
24
26
  var _privateApis = require("../../private-apis");
25
27
 
26
28
  var _store = require("../../store");
27
29
 
30
+ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
31
+
28
32
  /**
29
33
  * WordPress dependencies
30
34
  */
@@ -38,34 +42,31 @@ function SidebarNavigationScreenNavigationItem() {
38
42
  const {
39
43
  setCanvasMode
40
44
  } = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
45
+ const {
46
+ params: {
47
+ postType,
48
+ postId
49
+ }
50
+ } = (0, _components.__experimentalUseNavigator)();
41
51
  const {
42
52
  post
43
53
  } = (0, _data.useSelect)(select => {
44
- var _getEditedPostContext;
45
-
46
- const {
47
- getEditedPostContext
48
- } = select(_store.store);
49
54
  const {
50
55
  getEntityRecord
51
- } = select(_coreData.store);
52
- const {
53
- postType,
54
- postId
55
- } = (_getEditedPostContext = getEditedPostContext()) !== null && _getEditedPostContext !== void 0 ? _getEditedPostContext : {}; // The currently selected entity to display.
56
+ } = select(_coreData.store); // The currently selected entity to display.
56
57
  // Typically template or template part in the site editor.
57
58
 
58
59
  return {
59
60
  post: postId && postType ? getEntityRecord('postType', postType, postId) : null
60
61
  };
61
- }, []);
62
+ }, [postType, postId]);
62
63
  return (0, _element.createElement)(_sidebarNavigationScreen.default, {
63
- path: "/navigation/single",
64
64
  title: post ? (0, _htmlEntities.decodeEntities)(post === null || post === void 0 ? void 0 : (_post$title = post.title) === null || _post$title === void 0 ? void 0 : _post$title.rendered) : null,
65
- actions: (0, _element.createElement)(_components.Button, {
66
- variant: "primary",
67
- onClick: () => setCanvasMode('edit')
68
- }, (0, _i18n.__)('Edit')),
65
+ actions: (0, _element.createElement)(_sidebarButton.default, {
66
+ onClick: () => setCanvasMode('edit'),
67
+ label: (0, _i18n.__)('Edit'),
68
+ icon: _icons.pencil
69
+ }),
69
70
  content: post ? (0, _htmlEntities.decodeEntities)(post === null || post === void 0 ? void 0 : (_post$description = post.description) === null || _post$description === void 0 ? void 0 : _post$description.rendered) : null
70
71
  });
71
72
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["SidebarNavigationScreenNavigationItem","setCanvasMode","editSiteStore","post","select","getEditedPostContext","getEntityRecord","coreStore","postType","postId","title","rendered","description"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAdA;AACA;AACA;;AAOA;AACA;AACA;AAKe,SAASA,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAW,qBAAaC,MAAF,IAAc;AAAA;;AACzC,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,MAAM,CAAEF,YAAF,CAAvC;AACA,UAAM;AAAEI,MAAAA;AAAF,QAAsBF,MAAM,CAAEG,eAAF,CAAlC;AACA,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,iCAAuBJ,oBAAoB,EAA3C,yEAAiD,EAAvD,CAHyC,CAKzC;AACA;;AACA,WAAO;AACNF,MAAAA,IAAI,EACHM,MAAM,IAAID,QAAV,GACGF,eAAe,CAAE,UAAF,EAAcE,QAAd,EAAwBC,MAAxB,CADlB,GAEG;AAJE,KAAP;AAMA,GAbgB,EAad,EAbc,CAAjB;AAeA,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAC,oBADN;AAEC,IAAA,KAAK,EAAGN,IAAI,GAAG,kCAAgBA,IAAhB,aAAgBA,IAAhB,sCAAgBA,IAAI,CAAEO,KAAtB,gDAAgB,YAAaC,QAA7B,CAAH,GAA6C,IAF1D;AAGC,IAAA,OAAO,EACN,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMV,aAAa,CAAE,MAAF;AAF9B,OAIG,cAAI,MAAJ,CAJH,CAJF;AAWC,IAAA,OAAO,EACNE,IAAI,GAAG,kCAAgBA,IAAhB,aAAgBA,IAAhB,4CAAgBA,IAAI,CAAES,WAAtB,sDAAgB,kBAAmBD,QAAnC,CAAH,GAAmD;AAZzD,IADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst { post } = useSelect( ( select ) => {\n\t\tconst { getEditedPostContext } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst { postType, postId } = getEditedPostContext() ?? {};\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tpost:\n\t\t\t\tpostId && postType\n\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation/single\"\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["SidebarNavigationScreenNavigationItem","setCanvasMode","editSiteStore","params","postType","postId","post","select","getEntityRecord","coreStore","title","rendered","pencil","description"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMe,SAASA,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AACA,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEF,6CAFJ;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAW,qBACdC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC,CADa,CAGb;AACA;;AACA,WAAO;AACNH,MAAAA,IAAI,EACHD,MAAM,IAAID,QAAV,GACGI,eAAe,CAAE,UAAF,EAAcJ,QAAd,EAAwBC,MAAxB,CADlB,GAEG;AAJE,KAAP;AAMA,GAZe,EAahB,CAAED,QAAF,EAAYC,MAAZ,CAbgB,CAAjB;AAgBA,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGC,IAAI,GAAG,kCAAgBA,IAAhB,aAAgBA,IAAhB,sCAAgBA,IAAI,CAAEI,KAAtB,gDAAgB,YAAaC,QAA7B,CAAH,GAA6C,IAD1D;AAEC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMV,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGW;AAHR,MAHF;AASC,IAAA,OAAO,EACNN,IAAI,GAAG,kCAAgBA,IAAhB,aAAgBA,IAAhB,4CAAgBA,IAAI,CAAEO,WAAtB,sDAAgB,kBAAmBF,QAAnC,CAAH,GAAmD;AAVzD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\n\tconst { post } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tpost:\n\t\t\t\t\tpostId && postType\n\t\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -34,13 +34,11 @@ function SidebarNavigationScreenNavigationMenus() {
34
34
  if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
35
35
  history.push({
36
36
  postType: attributes.type,
37
- postId: attributes.id,
38
- path: '/navigation/single'
37
+ postId: attributes.id
39
38
  });
40
39
  }
41
40
  }, [history]);
42
41
  return (0, _element.createElement)(_sidebarNavigationScreen.default, {
43
- path: "/navigation",
44
42
  title: (0, _i18n.__)('Navigation'),
45
43
  content: (0, _element.createElement)("div", {
46
44
  className: "edit-site-sidebar-navigation-screen-navigation-menus"
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId","path"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAMC,QAAQ,GAAG,0BACdC,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE,EAFN;AAGbK,QAAAA,IAAI,EAAE;AAHO,OAAd;AAKA;AACD,GAfe,EAgBhB,CAAEV,OAAF,CAhBgB,CAAjB;AAkBA,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAC,aADN;AAEC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAFT;AAGC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD;AAAqB,MAAA,QAAQ,EAAGC;AAAhC,MADD;AAJF,IADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\tpath: '/navigation/single',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation\"\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAMC,QAAQ,GAAG,0BACdC,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE;AAFN,OAAd;AAIA;AACD,GAde,EAehB,CAAEL,OAAF,CAfgB,CAAjB;AAiBA,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAG,cAAI,YAAJ,CADT;AAEC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD;AAAqB,MAAA,QAAQ,EAAGC;AAAhC,MADD;AAHF,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -13,7 +13,7 @@ var _i18n = require("@wordpress/i18n");
13
13
 
14
14
  var _data = require("@wordpress/data");
15
15
 
16
- var _components = require("@wordpress/components");
16
+ var _icons = require("@wordpress/icons");
17
17
 
18
18
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
19
19
 
@@ -23,6 +23,8 @@ var _privateApis = require("../../private-apis");
23
23
 
24
24
  var _store = require("../../store");
25
25
 
26
+ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
27
+
26
28
  /**
27
29
  * WordPress dependencies
28
30
  */
@@ -30,19 +32,7 @@ var _store = require("../../store");
30
32
  /**
31
33
  * Internal dependencies
32
34
  */
33
- const config = {
34
- wp_template: {
35
- path: '/templates/single'
36
- },
37
- wp_template_part: {
38
- path: '/template-parts/single'
39
- }
40
- };
41
-
42
- function SidebarNavigationScreenTemplate(_ref) {
43
- let {
44
- postType = 'wp_template'
45
- } = _ref;
35
+ function SidebarNavigationScreenTemplate() {
46
36
  const {
47
37
  setCanvasMode
48
38
  } = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
@@ -58,12 +48,12 @@ function SidebarNavigationScreenTemplate(_ref) {
58
48
  }
59
49
 
60
50
  return (0, _element.createElement)(_sidebarNavigationScreen.default, {
61
- path: config[postType].path,
62
51
  title: getTitle(),
63
- actions: (0, _element.createElement)(_components.Button, {
64
- variant: "primary",
65
- onClick: () => setCanvasMode('edit')
66
- }, (0, _i18n.__)('Edit')),
52
+ actions: (0, _element.createElement)(_sidebarButton.default, {
53
+ onClick: () => setCanvasMode('edit'),
54
+ label: (0, _i18n.__)('Edit'),
55
+ icon: _icons.pencil
56
+ }),
67
57
  content: description ? (0, _element.createElement)("p", null, description) : undefined
68
58
  });
69
59
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["config","wp_template","path","wp_template_part","SidebarNavigationScreenTemplate","postType","setCanvasMode","editSiteStore","getDescription","getTitle","record","description","is_custom","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAKA;AACA;AACA;AAMA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE;AADM,GADC;AAIdC,EAAAA,gBAAgB,EAAE;AACjBD,IAAAA,IAAI,EAAE;AADW;AAJJ,CAAf;;AASe,SAASE,+BAAT,OAEX;AAAA,MAFqD;AACxDC,IAAAA,QAAQ,GAAG;AAD6C,GAErD;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuC,qCAA7C;AACA,MAAIC,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAG,cACb,6EADa,CAAd;AAGA;;AAED,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAGX,MAAM,CAAEK,QAAF,CAAN,CAAmBH,IAD3B;AAEC,IAAA,KAAK,EAAGO,QAAQ,EAFjB;AAGC,IAAA,OAAO,EACN,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMH,aAAa,CAAE,MAAF;AAF9B,OAIG,cAAI,MAAJ,CAJH,CAJF;AAWC,IAAA,OAAO,EAAGK,WAAW,GAAG,uCAAKA,WAAL,CAAH,GAA4BE;AAXlD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates/single',\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts/single',\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplate( {\n\tpostType = 'wp_template',\n} ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord();\n\tlet description = getDescription();\n\tif ( ! description && record.is_custom ) {\n\t\tdescription = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["SidebarNavigationScreenTemplate","setCanvasMode","editSiteStore","getDescription","getTitle","record","description","is_custom","pencil","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOe,SAASA,+BAAT,GAA2C;AACzD,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuC,qCAA7C;AACA,MAAIC,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAG,cACb,6EADa,CAAd;AAGA;;AAED,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGF,QAAQ,EADjB;AAEC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMH,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGO;AAHR,MAHF;AASC,IAAA,OAAO,EAAGF,WAAW,GAAG,uCAAKA,WAAL,CAAH,GAA4BG;AATlD,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord();\n\tlet description = getDescription();\n\tif ( ! description && record.is_custom ) {\n\t\tdescription = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
@@ -17,6 +17,8 @@ var _i18n = require("@wordpress/i18n");
17
17
 
18
18
  var _coreData = require("@wordpress/core-data");
19
19
 
20
+ var _data = require("@wordpress/data");
21
+
20
22
  var _htmlEntities = require("@wordpress/html-entities");
21
23
 
22
24
  var _compose = require("@wordpress/compose");
@@ -29,6 +31,10 @@ var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigati
29
31
 
30
32
  var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
31
33
 
34
+ var _store = require("../../store");
35
+
36
+ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
37
+
32
38
  /**
33
39
  * WordPress dependencies
34
40
  */
@@ -38,7 +44,6 @@ var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
38
44
  */
39
45
  const config = {
40
46
  wp_template: {
41
- path: '/templates',
42
47
  labels: {
43
48
  title: (0, _i18n.__)('Templates'),
44
49
  loading: (0, _i18n.__)('Loading templates'),
@@ -47,7 +52,6 @@ const config = {
47
52
  }
48
53
  },
49
54
  wp_template_part: {
50
- path: '/template-parts',
51
55
  labels: {
52
56
  title: (0, _i18n.__)('Template parts'),
53
57
  loading: (0, _i18n.__)('Loading template parts'),
@@ -65,38 +69,44 @@ const TemplateItem = _ref => {
65
69
  } = _ref;
66
70
  const linkInfo = (0, _link.useLink)({
67
71
  postType,
68
- postId,
69
- path: config[postType].path + '/single'
72
+ postId
70
73
  });
71
74
  return (0, _element.createElement)(_sidebarNavigationItem.default, (0, _extends2.default)({}, linkInfo, props));
72
75
  };
73
76
 
74
- function SidebarNavigationScreenTemplates(_ref2) {
75
- let {
76
- postType = 'wp_template'
77
- } = _ref2;
77
+ function SidebarNavigationScreenTemplates() {
78
+ const {
79
+ params: {
80
+ postType
81
+ }
82
+ } = (0, _components.__experimentalUseNavigator)();
78
83
  const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
84
+ const isTemplatePartsMode = (0, _data.useSelect)(select => {
85
+ const settings = select(_store.store).getSettings();
86
+ return !!settings.supportsTemplatePartsMode;
87
+ }, []);
79
88
  const {
80
89
  records: templates,
81
90
  isResolving: isLoading
82
91
  } = (0, _coreData.useEntityRecords)('postType', postType, {
83
92
  per_page: -1
84
93
  });
94
+ const sortedTemplates = templates ? [...templates] : [];
95
+ sortedTemplates.sort((a, b) => a.slug.localeCompare(b.slug));
85
96
  const browseAllLink = (0, _link.useLink)({
86
- postType,
87
- postId: undefined,
88
- path: config[postType].path + '/all'
97
+ path: '/' + postType + '/all'
89
98
  });
99
+ const canCreate = !isMobileViewport && !isTemplatePartsMode;
90
100
  return (0, _element.createElement)(_sidebarNavigationScreen.default, {
91
- path: config[postType].path,
101
+ isRoot: isTemplatePartsMode,
92
102
  title: config[postType].labels.title,
93
- actions: !isMobileViewport && (0, _element.createElement)(_addNewTemplate.default, {
103
+ actions: canCreate && (0, _element.createElement)(_addNewTemplate.default, {
94
104
  templateType: postType,
95
105
  toggleProps: {
96
- className: 'edit-site-sidebar-navigation-screen-templates__add-button'
106
+ as: _sidebarButton.default
97
107
  }
98
108
  }),
99
- content: (0, _element.createElement)(_element.Fragment, null, isLoading && config[postType].labels.loading, !isLoading && (0, _element.createElement)(_components.__experimentalItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && (0, _element.createElement)(_components.__experimentalItem, null, config[postType].labels.notFound), (templates !== null && templates !== void 0 ? templates : []).map(template => {
109
+ content: (0, _element.createElement)(_element.Fragment, null, isLoading && config[postType].labels.loading, !isLoading && (0, _element.createElement)(_components.__experimentalItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && (0, _element.createElement)(_components.__experimentalItem, null, config[postType].labels.notFound), sortedTemplates.map(template => {
100
110
  var _template$title;
101
111
 
102
112
  return (0, _element.createElement)(TemplateItem, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","path","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","isMobileViewport","records","templates","isResolving","isLoading","per_page","browseAllLink","undefined","className","length","map","template","id","rendered","slug"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates',\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts',\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t\tpath: config[ postType ].path + '/single',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates( {\n\tpostType = 'wp_template',\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst browseAllLink = useLink( {\n\t\tpostType,\n\t\tpostId: undefined,\n\t\tpath: config[ postType ].path + '/all',\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( templates ?? [] ).map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","SidebarButton","length","map","template","id","rendered"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _i18n = require("@wordpress/i18n");
13
13
 
14
+ var _components = require("@wordpress/components");
15
+
14
16
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
15
17
 
16
18
  /**
@@ -22,21 +24,20 @@ var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-naviga
22
24
  */
23
25
  const config = {
24
26
  wp_template: {
25
- path: '/templates/all',
26
27
  title: (0, _i18n.__)('All templates')
27
28
  },
28
29
  wp_template_part: {
29
- path: '/template-parts/all',
30
30
  title: (0, _i18n.__)('All template parts')
31
31
  }
32
32
  };
33
33
 
34
- function SidebarNavigationScreenTemplatesBrowse(_ref) {
35
- let {
36
- postType = 'wp_template'
37
- } = _ref;
34
+ function SidebarNavigationScreenTemplatesBrowse() {
35
+ const {
36
+ params: {
37
+ postType
38
+ }
39
+ } = (0, _components.__experimentalUseNavigator)();
38
40
  return (0, _element.createElement)(_sidebarNavigationScreen.default, {
39
- path: config[postType].path,
40
41
  title: config[postType].title
41
42
  });
42
43
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["config","wp_template","path","title","wp_template_part","SidebarNavigationScreenTemplatesBrowse","postType"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE,gBADM;AAEZC,IAAAA,KAAK,EAAE,cAAI,eAAJ;AAFK,GADC;AAKdC,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,IAAI,EAAE,qBADW;AAEjBC,IAAAA,KAAK,EAAE,cAAI,oBAAJ;AAFU;AALJ,CAAf;;AAWe,SAASE,sCAAT,OAEX;AAAA,MAF4D;AAC/DC,IAAAA,QAAQ,GAAG;AADoD,GAE5D;AACH,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAGN,MAAM,CAAEM,QAAF,CAAN,CAAmBJ,IAD3B;AAEC,IAAA,KAAK,EAAGF,MAAM,CAAEM,QAAF,CAAN,CAAmBH;AAF5B,IADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates/all',\n\t\ttitle: __( 'All templates' ),\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts/all',\n\t\ttitle: __( 'All template parts' ),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse( {\n\tpostType = 'wp_template',\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ config[ postType ].title }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["config","wp_template","title","wp_template_part","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAE,cAAI,eAAJ;AADK,GADC;AAIdC,EAAAA,gBAAgB,EAAE;AACjBD,IAAAA,KAAK,EAAE,cAAI,oBAAJ;AADU;AAJJ,CAAf;;AASe,SAASE,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEF,6CAFJ;AAGA,SAAO,4BAAC,gCAAD;AAAyB,IAAA,KAAK,EAAGN,MAAM,CAAEM,QAAF,CAAN,CAAmBJ;AAApD,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\ttitle: __( 'All templates' ),\n\t},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\treturn <SidebarNavigationScreen title={ config[ postType ].title } />;\n}\n"]}
@@ -24,6 +24,8 @@ var _icons = require("@wordpress/icons");
24
24
 
25
25
  var _compose = require("@wordpress/compose");
26
26
 
27
+ var _keycodes = require("@wordpress/keycodes");
28
+
27
29
  var _privateApis = require("../../private-apis");
28
30
 
29
31
  /**
@@ -93,6 +95,8 @@ function StyleBook(_ref) {
93
95
  onClose
94
96
  } = _ref;
95
97
  const [resizeObserver, sizes] = (0, _compose.useResizeObserver)();
98
+ const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
99
+ const sectionFocusReturnRef = (0, _compose.useFocusReturn)();
96
100
  const [textColor] = useGlobalStyle('color.text');
97
101
  const [backgroundColor] = useGlobalStyle('color.background');
98
102
  const examples = (0, _element.useMemo)(getExamples, []);
@@ -101,6 +105,14 @@ function StyleBook(_ref) {
101
105
  title: category.title,
102
106
  icon: category.icon
103
107
  })), [examples]);
108
+
109
+ function closeOnEscape(event) {
110
+ if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
111
+ event.preventDefault();
112
+ onClose();
113
+ }
114
+ }
115
+
104
116
  return (0, _element.createElement)(StyleBookFill, null, (0, _element.createElement)("section", {
105
117
  className: (0, _classnames.default)('edit-site-style-book', {
106
118
  'is-wide': sizes.width > 600
@@ -109,12 +121,15 @@ function StyleBook(_ref) {
109
121
  color: textColor,
110
122
  background: backgroundColor
111
123
  },
112
- "aria-label": (0, _i18n.__)('Style Book')
124
+ "aria-label": (0, _i18n.__)('Style Book'),
125
+ onKeyDown: closeOnEscape,
126
+ ref: (0, _compose.useMergeRefs)([sectionFocusReturnRef, focusOnMountRef])
113
127
  }, resizeObserver, (0, _element.createElement)(_components.Button, {
114
128
  className: "edit-site-style-book__close-button",
115
129
  icon: _icons.closeSmall,
116
130
  label: (0, _i18n.__)('Close Style Book'),
117
- onClick: onClose
131
+ onClick: onClose,
132
+ showTooltip: false
118
133
  }), (0, _element.createElement)(_components.TabPanel, {
119
134
  className: "edit-site-style-book__tab-panel",
120
135
  tabs: tabs