@wordpress/edit-site 5.13.0 → 5.15.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.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-page/index.js +2 -13
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +29 -15
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +2 -2
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/new-template.js +69 -14
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +10 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/constants.js +1 -1
- package/build/components/block-editor/constants.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +1 -22
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +29 -32
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +90 -19
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/canvas-spinner/index.js +1 -18
- package/build/components/canvas-spinner/index.js.map +1 -1
- package/build/components/code-editor/index.js +60 -28
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +15 -11
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -1
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +11 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +49 -14
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +47 -17
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +9 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +110 -28
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -15
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +218 -0
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +6 -19
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +9 -7
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/page-patterns/pagination.js +63 -0
- package/build/components/page-patterns/pagination.js.map +1 -0
- package/build/components/page-patterns/patterns-list.js +175 -0
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +185 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +82 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/preferences-modal/enable-feature.js +5 -1
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/index.js +43 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +78 -36
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-panel/index.js +5 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +4 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +21 -11
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +69 -5
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +5 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +7 -16
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -10
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +9 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +29 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +27 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +11 -4
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +2 -35
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +20 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +28 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js +173 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +34 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -19
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +25 -12
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +16 -13
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +25 -7
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +12 -8
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -1
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +115 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +195 -44
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +56 -10
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +9 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/normalize-record-key.js +19 -0
- package/build/utils/normalize-record-key.js.map +1 -0
- package/build/utils/template-part-create.js +2 -2
- package/build/utils/template-part-create.js.map +1 -1
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -12
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +28 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +72 -17
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -6
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/constants.js +1 -1
- package/build-module/components/block-editor/constants.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +1 -22
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +29 -32
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +92 -20
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/canvas-spinner/index.js +1 -15
- package/build-module/components/canvas-spinner/index.js.map +1 -1
- package/build-module/components/code-editor/index.js +62 -30
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +14 -11
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -1
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +11 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/ui.js +8 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +51 -16
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +44 -20
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +9 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +110 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +195 -0
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/page-patterns/grid.js +26 -0
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +8 -6
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/page-patterns/pagination.js +54 -0
- package/build-module/components/page-patterns/pagination.js.map +1 -0
- package/build-module/components/page-patterns/patterns-list.js +152 -0
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +167 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +63 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/preferences-modal/enable-feature.js +5 -1
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +38 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +79 -39
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +5 -5
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +22 -12
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +67 -5
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +8 -17
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +9 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +8 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +20 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +26 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -4
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -33
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +34 -26
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +18 -12
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +148 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +25 -12
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +17 -13
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +26 -8
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +11 -8
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +3 -1
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +111 -21
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +193 -46
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +57 -10
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/normalize-record-key.js +12 -0
- package/build-module/utils/normalize-record-key.js.map +1 -0
- package/build-module/utils/template-part-create.js +1 -1
- package/build-module/utils/template-part-create.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +383 -109
- package/build-style/style.css +383 -109
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +1 -9
- package/src/components/add-new-pattern/index.js +30 -21
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
- package/src/components/add-new-template/new-template.js +120 -24
- package/src/components/add-new-template/style.scss +30 -2
- package/src/components/add-new-template/utils.js +9 -6
- package/src/components/block-editor/constants.js +5 -1
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/inserter-media-categories.js +1 -21
- package/src/components/block-editor/site-editor-canvas.js +7 -1
- package/src/components/block-editor/use-site-editor-settings.js +100 -25
- package/src/components/canvas-spinner/index.js +1 -11
- package/src/components/canvas-spinner/style.scss +18 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +15 -13
- package/src/components/create-template-part-modal/index.js +1 -1
- package/src/components/editor/index.js +16 -1
- package/src/components/editor/style.scss +4 -0
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/global-styles/stories/index.js +1 -0
- package/src/components/global-styles/ui.js +34 -24
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/header-edit-mode/document-actions/style.scss +12 -0
- package/src/components/header-edit-mode/index.js +136 -79
- package/src/components/header-edit-mode/more-menu/index.js +74 -30
- package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
- package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
- package/src/components/keyboard-shortcuts/register.js +10 -0
- package/src/components/layout/index.js +156 -78
- package/src/components/layout/style.scss +49 -2
- package/src/components/page/header.js +1 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -21
- package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-main/index.js +6 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +284 -0
- package/src/components/page-patterns/grid.js +22 -0
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/{page-library → page-patterns}/index.js +11 -6
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +206 -0
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +219 -0
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/page-patterns/use-patterns.js +177 -0
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +86 -0
- package/src/components/page-templates/index.js +1 -1
- package/src/components/preferences-modal/enable-feature.js +5 -2
- package/src/components/preferences-modal/index.js +35 -4
- package/src/components/resizable-frame/index.js +102 -34
- package/src/components/resizable-frame/style.scss +9 -9
- package/src/components/save-panel/index.js +10 -4
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/index.js +4 -2
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-item/style.scss +7 -13
- package/src/components/sidebar-navigation-screen/index.js +18 -9
- package/src/components/sidebar-navigation-screen/style.scss +21 -2
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +14 -35
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +13 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +16 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +20 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +24 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +39 -8
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/page-details.js +8 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +2 -36
- package/src/components/sidebar-navigation-screen-pages/index.js +40 -30
- package/src/components/sidebar-navigation-screen-pattern/index.js +18 -8
- package/src/components/sidebar-navigation-screen-pattern/style.scss +29 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +12 -2
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +48 -3
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/src/components/sidebar-navigation-screen-patterns/index.js +194 -0
- package/src/components/sidebar-navigation-screen-patterns/style.scss +23 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +9 -17
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +3 -2
- package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/site-hub/index.js +46 -29
- package/src/components/site-hub/style.scss +17 -3
- package/src/components/start-template-options/style.scss +0 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/template-actions/index.js +40 -9
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +88 -24
- package/src/hooks/commands/use-edit-mode-commands.js +182 -38
- package/src/hooks/push-changes-to-global-styles/index.js +63 -9
- package/src/index.js +4 -0
- package/src/store/actions.js +8 -1
- package/src/store/private-actions.js +5 -1
- package/src/store/selectors.js +5 -0
- package/src/store/test/selectors.js +2 -0
- package/src/style.scss +13 -14
- package/src/utils/get-is-list-page.js +4 -3
- package/src/utils/normalize-record-key.js +11 -0
- package/src/utils/template-part-create.js +1 -1
- package/src/utils/use-activate-theme.js +1 -1
- package/build/components/code-editor/code-editor-text-area.js +0 -96
- package/build/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build/components/keyboard-shortcuts/index.js +0 -148
- package/build/components/keyboard-shortcuts/index.js.map +0 -1
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build/components/page-library/grid-item.js +0 -165
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js +0 -108
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js +0 -194
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js +0 -112
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/code-editor/code-editor-text-area.js +0 -84
- package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -132
- package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-library/grid-item.js +0 -145
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js +0 -38
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js +0 -87
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js +0 -176
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/code-editor/code-editor-text-area.js +0 -84
- package/src/components/keyboard-shortcuts/index.js +0 -137
- package/src/components/page-content-focus-manager/constants.js +0 -5
- package/src/components/page-library/grid-item.js +0 -179
- package/src/components/page-library/grid.js +0 -39
- package/src/components/page-library/patterns-list.js +0 -114
- package/src/components/page-library/style.scss +0 -105
- package/src/components/page-library/use-patterns.js +0 -238
- package/src/components/sidebar-navigation-screen-library/index.js +0 -136
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -7
- package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
19
|
+
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
22
|
+
var _icons = require("@wordpress/icons");
|
|
23
|
+
|
|
24
|
+
var _notices = require("@wordpress/notices");
|
|
25
|
+
|
|
26
|
+
var _reusableBlocks = require("@wordpress/reusable-blocks");
|
|
27
|
+
|
|
28
|
+
var _renameMenuItem = _interopRequireDefault(require("./rename-menu-item"));
|
|
29
|
+
|
|
30
|
+
var _duplicateMenuItem = _interopRequireDefault(require("./duplicate-menu-item"));
|
|
31
|
+
|
|
32
|
+
var _utils = require("./utils");
|
|
33
|
+
|
|
34
|
+
var _store = require("../../store");
|
|
35
|
+
|
|
36
|
+
var _link = require("../routes/link");
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* External dependencies
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* WordPress dependencies
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Internal dependencies
|
|
48
|
+
*/
|
|
49
|
+
const templatePartIcons = {
|
|
50
|
+
header: _icons.header,
|
|
51
|
+
footer: _icons.footer,
|
|
52
|
+
uncategorized: _icons.symbolFilled
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function GridItem({
|
|
56
|
+
categoryId,
|
|
57
|
+
item,
|
|
58
|
+
...props
|
|
59
|
+
}) {
|
|
60
|
+
const descriptionId = (0, _element.useId)();
|
|
61
|
+
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = (0, _element.useState)(false);
|
|
62
|
+
const {
|
|
63
|
+
removeTemplate
|
|
64
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
65
|
+
const {
|
|
66
|
+
__experimentalDeleteReusableBlock
|
|
67
|
+
} = (0, _data.useDispatch)(_reusableBlocks.store);
|
|
68
|
+
const {
|
|
69
|
+
createErrorNotice,
|
|
70
|
+
createSuccessNotice
|
|
71
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
72
|
+
const isUserPattern = item.type === _utils.USER_PATTERNS;
|
|
73
|
+
const isNonUserPattern = item.type === _utils.PATTERNS;
|
|
74
|
+
const isTemplatePart = item.type === _utils.TEMPLATE_PARTS;
|
|
75
|
+
const {
|
|
76
|
+
onClick
|
|
77
|
+
} = (0, _link.useLink)({
|
|
78
|
+
postType: item.type,
|
|
79
|
+
postId: isUserPattern ? item.id : item.name,
|
|
80
|
+
categoryId,
|
|
81
|
+
categoryType: item.type
|
|
82
|
+
});
|
|
83
|
+
const isEmpty = !item.blocks?.length;
|
|
84
|
+
const patternClassNames = (0, _classnames.default)('edit-site-patterns__pattern', {
|
|
85
|
+
'is-placeholder': isEmpty
|
|
86
|
+
});
|
|
87
|
+
const previewClassNames = (0, _classnames.default)('edit-site-patterns__preview', {
|
|
88
|
+
'is-inactive': isNonUserPattern
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const deletePattern = async () => {
|
|
92
|
+
try {
|
|
93
|
+
await __experimentalDeleteReusableBlock(item.id);
|
|
94
|
+
createSuccessNotice((0, _i18n.sprintf)( // translators: %s: The pattern's title e.g. 'Call to action'.
|
|
95
|
+
(0, _i18n.__)('"%s" deleted.'), item.title), {
|
|
96
|
+
type: 'snackbar',
|
|
97
|
+
id: 'edit-site-patterns-success'
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while deleting the pattern.');
|
|
101
|
+
createErrorNotice(errorMessage, {
|
|
102
|
+
type: 'snackbar',
|
|
103
|
+
id: 'edit-site-patterns-error'
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const deleteItem = () => isTemplatePart ? removeTemplate(item) : deletePattern(); // Only custom patterns or custom template parts can be renamed or deleted.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const isCustomPattern = isUserPattern || isTemplatePart && item.isCustom;
|
|
112
|
+
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
|
|
113
|
+
const ariaDescriptions = [];
|
|
114
|
+
|
|
115
|
+
if (isCustomPattern) {
|
|
116
|
+
// User patterns don't have descriptions, but can be edited and deleted, so include some help text.
|
|
117
|
+
ariaDescriptions.push((0, _i18n.__)('Press Enter to edit, or Delete to delete the pattern.'));
|
|
118
|
+
} else if (item.description) {
|
|
119
|
+
ariaDescriptions.push(item.description);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (isNonUserPattern) {
|
|
123
|
+
ariaDescriptions.push((0, _i18n.__)('Theme & plugin patterns cannot be edited.'));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const itemIcon = templatePartIcons[categoryId] || (item.syncStatus === _utils.SYNC_TYPES.full ? _icons.symbol : undefined);
|
|
127
|
+
const confirmButtonText = hasThemeFile ? (0, _i18n.__)('Clear') : (0, _i18n.__)('Delete');
|
|
128
|
+
const confirmPrompt = hasThemeFile ? (0, _i18n.__)('Are you sure you want to clear these customizations?') : (0, _i18n.sprintf)( // translators: %s: The pattern or template part's title e.g. 'Call to action'.
|
|
129
|
+
(0, _i18n.__)('Are you sure you want to delete "%s"?'), item.title);
|
|
130
|
+
return (0, _element.createElement)("li", {
|
|
131
|
+
className: patternClassNames
|
|
132
|
+
}, (0, _element.createElement)("button", {
|
|
133
|
+
className: previewClassNames // Even though still incomplete, passing ids helps performance.
|
|
134
|
+
// @see https://reakit.io/docs/composite/#performance.
|
|
135
|
+
,
|
|
136
|
+
id: `edit-site-patterns-${item.name}`,
|
|
137
|
+
...props,
|
|
138
|
+
onClick: item.type !== _utils.PATTERNS ? onClick : undefined,
|
|
139
|
+
"aria-disabled": item.type !== _utils.PATTERNS ? 'false' : 'true',
|
|
140
|
+
"aria-label": item.title,
|
|
141
|
+
"aria-describedby": ariaDescriptions.length ? ariaDescriptions.map((_, index) => `${descriptionId}-${index}`).join(' ') : undefined
|
|
142
|
+
}, isEmpty && (0, _i18n.__)('Empty pattern'), !isEmpty && (0, _element.createElement)(_blockEditor.BlockPreview, {
|
|
143
|
+
blocks: item.blocks
|
|
144
|
+
})), ariaDescriptions.map((ariaDescription, index) => (0, _element.createElement)("div", {
|
|
145
|
+
key: index,
|
|
146
|
+
hidden: true,
|
|
147
|
+
id: `${descriptionId}-${index}`
|
|
148
|
+
}, ariaDescription)), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
149
|
+
className: "edit-site-patterns__footer",
|
|
150
|
+
justify: "space-between"
|
|
151
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
152
|
+
alignment: "center",
|
|
153
|
+
justify: "left",
|
|
154
|
+
spacing: 3,
|
|
155
|
+
className: "edit-site-patterns__pattern-title"
|
|
156
|
+
}, itemIcon && !isNonUserPattern && (0, _element.createElement)(_components.Tooltip, {
|
|
157
|
+
position: "top center",
|
|
158
|
+
text: (0, _i18n.__)('Editing this pattern will also update anywhere it is used')
|
|
159
|
+
}, (0, _element.createElement)("span", null, (0, _element.createElement)(_icons.Icon, {
|
|
160
|
+
className: "edit-site-patterns__pattern-icon",
|
|
161
|
+
icon: itemIcon
|
|
162
|
+
}))), (0, _element.createElement)(_components.Flex, {
|
|
163
|
+
as: "span",
|
|
164
|
+
gap: 0,
|
|
165
|
+
justify: "left"
|
|
166
|
+
}, item.type === _utils.PATTERNS ? item.title : (0, _element.createElement)(_components.__experimentalHeading, {
|
|
167
|
+
level: 5
|
|
168
|
+
}, (0, _element.createElement)(_components.Button, {
|
|
169
|
+
variant: "link",
|
|
170
|
+
onClick: onClick // Required for the grid's roving tab index system.
|
|
171
|
+
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
|
|
172
|
+
,
|
|
173
|
+
tabIndex: "-1"
|
|
174
|
+
}, item.title)), item.type === _utils.PATTERNS && (0, _element.createElement)(_components.Tooltip, {
|
|
175
|
+
position: "top center",
|
|
176
|
+
text: (0, _i18n.__)('This pattern cannot be edited.')
|
|
177
|
+
}, (0, _element.createElement)("span", {
|
|
178
|
+
className: "edit-site-patterns__pattern-lock-icon"
|
|
179
|
+
}, (0, _element.createElement)(_icons.Icon, {
|
|
180
|
+
icon: _icons.lockSmall,
|
|
181
|
+
size: 24
|
|
182
|
+
}))))), (0, _element.createElement)(_components.DropdownMenu, {
|
|
183
|
+
icon: _icons.moreHorizontal,
|
|
184
|
+
label: (0, _i18n.__)('Actions'),
|
|
185
|
+
className: "edit-site-patterns__dropdown",
|
|
186
|
+
popoverProps: {
|
|
187
|
+
placement: 'bottom-end'
|
|
188
|
+
},
|
|
189
|
+
toggleProps: {
|
|
190
|
+
className: 'edit-site-patterns__button',
|
|
191
|
+
isSmall: true,
|
|
192
|
+
describedBy: (0, _i18n.sprintf)(
|
|
193
|
+
/* translators: %s: pattern name */
|
|
194
|
+
(0, _i18n.__)('Action menu for %s pattern'), item.title)
|
|
195
|
+
}
|
|
196
|
+
}, ({
|
|
197
|
+
onClose
|
|
198
|
+
}) => (0, _element.createElement)(_components.MenuGroup, null, isCustomPattern && !hasThemeFile && (0, _element.createElement)(_renameMenuItem.default, {
|
|
199
|
+
item: item,
|
|
200
|
+
onClose: onClose
|
|
201
|
+
}), (0, _element.createElement)(_duplicateMenuItem.default, {
|
|
202
|
+
categoryId: categoryId,
|
|
203
|
+
item: item,
|
|
204
|
+
onClose: onClose,
|
|
205
|
+
label: isNonUserPattern ? (0, _i18n.__)('Copy to My patterns') : (0, _i18n.__)('Duplicate')
|
|
206
|
+
}), isCustomPattern && (0, _element.createElement)(_components.MenuItem, {
|
|
207
|
+
onClick: () => setIsDeleteDialogOpen(true)
|
|
208
|
+
}, hasThemeFile ? (0, _i18n.__)('Clear customizations') : (0, _i18n.__)('Delete'))))), isDeleteDialogOpen && (0, _element.createElement)(_components.__experimentalConfirmDialog, {
|
|
209
|
+
confirmButtonText: confirmButtonText,
|
|
210
|
+
onConfirm: deleteItem,
|
|
211
|
+
onCancel: () => setIsDeleteDialogOpen(false)
|
|
212
|
+
}, confirmPrompt));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
var _default = (0, _element.memo)(GridItem);
|
|
216
|
+
|
|
217
|
+
exports.default = _default;
|
|
218
|
+
//# sourceMappingURL=grid-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"names":["templatePartIcons","header","footer","uncategorized","GridItem","categoryId","item","props","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","removeTemplate","editSiteStore","__experimentalDeleteReusableBlock","reusableBlocksStore","createErrorNotice","createSuccessNotice","noticesStore","isUserPattern","type","USER_PATTERNS","isNonUserPattern","PATTERNS","isTemplatePart","TEMPLATE_PARTS","onClick","postType","postId","id","name","categoryType","isEmpty","blocks","length","patternClassNames","previewClassNames","deletePattern","title","error","errorMessage","message","code","deleteItem","isCustomPattern","isCustom","hasThemeFile","templatePart","has_theme_file","ariaDescriptions","push","description","itemIcon","syncStatus","SYNC_TYPES","full","symbol","undefined","confirmButtonText","confirmPrompt","map","_","index","join","ariaDescription","lockSmall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GgD,aALH,CAxIF,CADD;AAmJA;;eAEc,mBAAMtD,QAAN,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport {\n\tButton,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\tTooltip,\n\tFlex,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useId, memo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tIcon,\n\theader,\n\tfooter,\n\tsymbolFilled as uncategorized,\n\tsymbol,\n\tmoreHorizontal,\n\tlockSmall,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport RenameMenuItem from './rename-menu-item';\nimport DuplicateMenuItem from './duplicate-menu-item';\nimport { PATTERNS, TEMPLATE_PARTS, USER_PATTERNS, SYNC_TYPES } from './utils';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\n\nconst templatePartIcons = { header, footer, uncategorized };\n\nfunction GridItem( { categoryId, item, ...props } ) {\n\tconst descriptionId = useId();\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isUserPattern = item.type === USER_PATTERNS;\n\tconst isNonUserPattern = item.type === PATTERNS;\n\tconst isTemplatePart = item.type === TEMPLATE_PARTS;\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: isUserPattern ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: item.type,\n\t} );\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-patterns__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-patterns__preview', {\n\t\t'is-inactive': isNonUserPattern,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The pattern's title e.g. 'Call to action'.\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\titem.title\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'edit-site-patterns-error',\n\t\t\t} );\n\t\t}\n\t};\n\tconst deleteItem = () =>\n\t\tisTemplatePart ? removeTemplate( item ) : deletePattern();\n\n\t// Only custom patterns or custom template parts can be renamed or deleted.\n\tconst isCustomPattern =\n\t\tisUserPattern || ( isTemplatePart && item.isCustom );\n\tconst hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;\n\tconst ariaDescriptions = [];\n\n\tif ( isCustomPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescriptions.push(\n\t\t\t__( 'Press Enter to edit, or Delete to delete the pattern.' )\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescriptions.push( item.description );\n\t}\n\n\tif ( isNonUserPattern ) {\n\t\tariaDescriptions.push(\n\t\t\t__( 'Theme & plugin patterns cannot be edited.' )\n\t\t);\n\t}\n\n\tconst itemIcon =\n\t\ttemplatePartIcons[ categoryId ] ||\n\t\t( item.syncStatus === SYNC_TYPES.full ? symbol : undefined );\n\n\tconst confirmButtonText = hasThemeFile ? __( 'Clear' ) : __( 'Delete' );\n\tconst confirmPrompt = hasThemeFile\n\t\t? __( 'Are you sure you want to clear these customizations?' )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: The pattern or template part's title e.g. 'Call to action'.\n\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\titem.title\n\t\t );\n\n\treturn (\n\t\t<li className={ patternClassNames }>\n\t\t\t<button\n\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t// Even though still incomplete, passing ids helps performance.\n\t\t\t\t// @see https://reakit.io/docs/composite/#performance.\n\t\t\t\tid={ `edit-site-patterns-${ item.name }` }\n\t\t\t\t{ ...props }\n\t\t\t\tonClick={ item.type !== PATTERNS ? onClick : undefined }\n\t\t\t\taria-disabled={ item.type !== PATTERNS ? 'false' : 'true' }\n\t\t\t\taria-label={ item.title }\n\t\t\t\taria-describedby={\n\t\t\t\t\tariaDescriptions.length\n\t\t\t\t\t\t? ariaDescriptions\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( _, index ) =>\n\t\t\t\t\t\t\t\t\t\t`${ descriptionId }-${ index }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ isEmpty && __( 'Empty pattern' ) }\n\t\t\t\t{ ! isEmpty && <BlockPreview blocks={ item.blocks } /> }\n\t\t\t</button>\n\t\t\t{ ariaDescriptions.map( ( ariaDescription, index ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ index }\n\t\t\t\t\thidden\n\t\t\t\t\tid={ `${ descriptionId }-${ index }` }\n\t\t\t\t>\n\t\t\t\t\t{ ariaDescription }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t\t<HStack\n\t\t\t\tclassName=\"edit-site-patterns__footer\"\n\t\t\t\tjustify=\"space-between\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tclassName=\"edit-site-patterns__pattern-title\"\n\t\t\t\t>\n\t\t\t\t\t{ itemIcon && ! isNonUserPattern && (\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t'Editing this pattern will also update anywhere it is used'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t) }\n\t\t\t\t\t<Flex as=\"span\" gap={ 0 } justify=\"left\">\n\t\t\t\t\t\t{ item.type === PATTERNS ? (\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Heading level={ 5 }>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t\t\t// Required for the grid's roving tab index system.\n\t\t\t\t\t\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ item.type === PATTERNS && (\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\ttext={ __( 'This pattern cannot be edited.' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span className=\"edit-site-patterns__pattern-lock-icon\">\n\t\t\t\t\t\t\t\t\t<Icon icon={ lockSmall } size={ 24 } />\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t</HStack>\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreHorizontal }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tclassName=\"edit-site-patterns__dropdown\"\n\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t),\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ isCustomPattern && ! hasThemeFile && (\n\t\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<DuplicateMenuItem\n\t\t\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\tisNonUserPattern\n\t\t\t\t\t\t\t\t\t\t? __( 'Copy to My patterns' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Duplicate' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isCustomPattern && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\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\t\t{ hasThemeFile\n\t\t\t\t\t\t\t\t\t\t? __( 'Clear customizations' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Delete' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t</HStack>\n\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tconfirmButtonText={ confirmButtonText }\n\t\t\t\t\tonConfirm={ deleteItem }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ confirmPrompt }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</li>\n\t);\n}\n\nexport default memo( GridItem );\n"]}
|
|
@@ -9,41 +9,28 @@ exports.default = Grid;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
|
|
14
12
|
var _gridItem = _interopRequireDefault(require("./grid-item"));
|
|
15
13
|
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
14
|
/**
|
|
21
15
|
* Internal dependencies
|
|
22
16
|
*/
|
|
23
17
|
function Grid({
|
|
24
18
|
categoryId,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
items
|
|
19
|
+
items,
|
|
20
|
+
...props
|
|
28
21
|
}) {
|
|
29
|
-
const composite = (0, _components.__unstableUseCompositeState)({
|
|
30
|
-
orientation: 'vertical'
|
|
31
|
-
});
|
|
32
|
-
|
|
33
22
|
if (!items?.length) {
|
|
34
23
|
return null;
|
|
35
24
|
}
|
|
36
25
|
|
|
37
|
-
return (0, _element.createElement)(
|
|
26
|
+
return (0, _element.createElement)("ul", {
|
|
38
27
|
role: "listbox",
|
|
39
|
-
className: "edit-site-
|
|
40
|
-
|
|
28
|
+
className: "edit-site-patterns__grid",
|
|
29
|
+
...props
|
|
41
30
|
}, items.map(item => (0, _element.createElement)(_gridItem.default, {
|
|
42
31
|
key: item.name,
|
|
43
|
-
icon: icon,
|
|
44
32
|
item: item,
|
|
45
|
-
categoryId: categoryId
|
|
46
|
-
composite: composite
|
|
33
|
+
categoryId: categoryId
|
|
47
34
|
})));
|
|
48
35
|
}
|
|
49
36
|
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/grid.js"],"names":["Grid","categoryId","items","props","length","map","item","name"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,IAAT,CAAe;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqB,KAAGC;AAAxB,CAAf,EAAiD;AAC/D,MAAK,CAAED,KAAK,EAAEE,MAAd,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC;AAAI,IAAA,IAAI,EAAC,SAAT;AAAmB,IAAA,SAAS,EAAC,0BAA7B;AAAA,OAA6DD;AAA7D,KACGD,KAAK,CAACG,GAAN,CAAaC,IAAF,IACZ,4BAAC,iBAAD;AACC,IAAA,GAAG,EAAGA,IAAI,CAACC,IADZ;AAEC,IAAA,IAAI,EAAGD,IAFR;AAGC,IAAA,UAAU,EAAGL;AAHd,IADC,CADH,CADD;AAWA","sourcesContent":["/**\n * Internal dependencies\n */\nimport GridItem from './grid-item';\n\nexport default function Grid( { categoryId, items, ...props } ) {\n\tif ( ! items?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul role=\"listbox\" className=\"edit-site-patterns__grid\" { ...props }>\n\t\t\t{ items.map( ( item ) => (\n\t\t\t\t<GridItem\n\t\t\t\t\tkey={ item.name }\n\t\t\t\t\titem={ item }\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = PatternsHeader;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _editor = require("@wordpress/editor");
|
|
17
|
+
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
19
|
+
|
|
20
|
+
var _usePatternCategories = _interopRequireDefault(require("../sidebar-navigation-screen-patterns/use-pattern-categories"));
|
|
21
|
+
|
|
22
|
+
var _utils = require("./utils");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
function PatternsHeader({
|
|
32
|
+
categoryId,
|
|
33
|
+
type,
|
|
34
|
+
titleId,
|
|
35
|
+
descriptionId
|
|
36
|
+
}) {
|
|
37
|
+
const {
|
|
38
|
+
patternCategories
|
|
39
|
+
} = (0, _usePatternCategories.default)();
|
|
40
|
+
const templatePartAreas = (0, _data.useSelect)(select => select(_editor.store).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
41
|
+
let title, description;
|
|
42
|
+
|
|
43
|
+
if (categoryId === _utils.USER_PATTERN_CATEGORY && type === _utils.USER_PATTERNS) {
|
|
44
|
+
title = (0, _i18n.__)('My Patterns');
|
|
45
|
+
description = '';
|
|
46
|
+
} else if (type === _utils.TEMPLATE_PARTS) {
|
|
47
|
+
const templatePartArea = templatePartAreas.find(area => area.area === categoryId);
|
|
48
|
+
title = templatePartArea?.label;
|
|
49
|
+
description = templatePartArea?.description;
|
|
50
|
+
} else if (type === _utils.PATTERNS) {
|
|
51
|
+
const patternCategory = patternCategories.find(category => category.name === categoryId);
|
|
52
|
+
title = patternCategory?.label;
|
|
53
|
+
description = patternCategory?.description;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!title) return null;
|
|
57
|
+
return (0, _element.createElement)(_components.__experimentalVStack, {
|
|
58
|
+
className: "edit-site-patterns__section-header"
|
|
59
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
60
|
+
as: "h2",
|
|
61
|
+
level: 4,
|
|
62
|
+
id: titleId
|
|
63
|
+
}, title), description ? (0, _element.createElement)(_components.__experimentalText, {
|
|
64
|
+
variant: "muted",
|
|
65
|
+
as: "p",
|
|
66
|
+
id: descriptionId
|
|
67
|
+
}, description) : null);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/header.js"],"names":["PatternsHeader","categoryId","type","titleId","descriptionId","patternCategories","templatePartAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","title","description","USER_PATTERN_CATEGORY","USER_PATTERNS","TEMPLATE_PARTS","templatePartArea","find","area","label","PATTERNS","patternCategory","category","name"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AASe,SAASA,cAAT,CAAyB;AACvCC,EAAAA,UADuC;AAEvCC,EAAAA,IAFuC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IAAA,EAAE,EAAC,GAAzB;AAA6B,IAAA,EAAE,EAAGP;AAAlC,KACGO,WADH,CADY,GAIT,IARL,CADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport {\n\tUSER_PATTERN_CATEGORY,\n\tUSER_PATTERNS,\n\tTEMPLATE_PARTS,\n\tPATTERNS,\n} from './utils';\n\nexport default function PatternsHeader( {\n\tcategoryId,\n\ttype,\n\ttitleId,\n\tdescriptionId,\n} ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tlet title, description;\n\tif ( categoryId === USER_PATTERN_CATEGORY && type === USER_PATTERNS ) {\n\t\ttitle = __( 'My Patterns' );\n\t\tdescription = '';\n\t} else if ( type === TEMPLATE_PARTS ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label;\n\t\tdescription = templatePartArea?.description;\n\t} else if ( type === PATTERNS ) {\n\t\tconst patternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\tif ( ! title ) return null;\n\n\treturn (\n\t\t<VStack className=\"edit-site-patterns__section-header\">\n\t\t\t<Heading as=\"h2\" level={ 4 } id={ titleId }>\n\t\t\t\t{ title }\n\t\t\t</Heading>\n\t\t\t{ description ? (\n\t\t\t\t<Text variant=\"muted\" as=\"p\" id={ descriptionId }>\n\t\t\t\t\t{ description }\n\t\t\t\t</Text>\n\t\t\t) : null }\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default =
|
|
8
|
+
exports.default = PagePatterns;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ var _page = _interopRequireDefault(require("../page"));
|
|
|
21
21
|
|
|
22
22
|
var _patternsList = _interopRequireDefault(require("./patterns-list"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _usePatternSettings = _interopRequireDefault(require("./use-pattern-settings"));
|
|
25
25
|
|
|
26
26
|
var _lockUnlock = require("../../lock-unlock");
|
|
27
27
|
|
|
@@ -36,24 +36,26 @@ const {
|
|
|
36
36
|
ExperimentalBlockEditorProvider
|
|
37
37
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
38
38
|
|
|
39
|
-
function
|
|
39
|
+
function PagePatterns() {
|
|
40
40
|
const {
|
|
41
41
|
categoryType,
|
|
42
42
|
categoryId
|
|
43
43
|
} = (0, _url.getQueryArgs)(window.location.href);
|
|
44
44
|
const type = categoryType || _utils.DEFAULT_TYPE;
|
|
45
45
|
const category = categoryId || _utils.DEFAULT_CATEGORY;
|
|
46
|
-
const settings = (0,
|
|
46
|
+
const settings = (0, _usePatternSettings.default)(); // Wrap everything in a block editor provider.
|
|
47
47
|
// This ensures 'styles' that are needed for the previews are synced
|
|
48
48
|
// from the site editor store to the block editor store.
|
|
49
49
|
|
|
50
50
|
return (0, _element.createElement)(ExperimentalBlockEditorProvider, {
|
|
51
51
|
settings: settings
|
|
52
52
|
}, (0, _element.createElement)(_page.default, {
|
|
53
|
-
className: "edit-site-
|
|
54
|
-
title: (0, _i18n.__)('
|
|
53
|
+
className: "edit-site-patterns",
|
|
54
|
+
title: (0, _i18n.__)('Patterns content'),
|
|
55
55
|
hideTitleFromUI: true
|
|
56
|
-
}, (0, _element.createElement)(_patternsList.default
|
|
56
|
+
}, (0, _element.createElement)(_patternsList.default // Reset the states when switching between categories and types.
|
|
57
|
+
, {
|
|
58
|
+
key: `${type}-${category}`,
|
|
57
59
|
type: type,
|
|
58
60
|
categoryId: category
|
|
59
61
|
})));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","PagePatterns","categoryType","categoryId","window","location","href","type","DEFAULT_TYPE","category","DEFAULT_CATEGORY","settings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,wBAAQC,wBAAR,CAA5C;;AAEe,SAASC,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+B,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAArC;AACA,QAAMC,IAAI,GAAGL,YAAY,IAAIM,mBAA7B;AACA,QAAMC,QAAQ,GAAGN,UAAU,IAAIO,uBAA/B;AACA,QAAMC,QAAQ,GAAG,kCAAjB,CAJsC,CAMtC;AACA;AACA;;AACA,SACC,4BAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAGA;AAA5C,KACC,4BAAC,aAAD;AACC,IAAA,SAAS,EAAC,oBADX;AAEC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CAFT;AAGC,IAAA,eAAe;AAHhB,KAKC,4BAAC,qBAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAI,GAAGJ,IAAM,IAAIE,QAAU,EAF/B;AAGC,IAAA,IAAI,EAAGF,IAHR;AAIC,IAAA,UAAU,EAAGE;AAJd,IALD,CADD,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_CATEGORY, DEFAULT_TYPE } from './utils';\nimport Page from '../page';\nimport PatternsList from './patterns-list';\nimport usePatternSettings from './use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function PagePatterns() {\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst type = categoryType || DEFAULT_TYPE;\n\tconst category = categoryId || DEFAULT_CATEGORY;\n\tconst settings = usePatternSettings();\n\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\tclassName=\"edit-site-patterns\"\n\t\t\t\ttitle={ __( 'Patterns content' ) }\n\t\t\t\thideTitleFromUI\n\t\t\t>\n\t\t\t\t<PatternsList\n\t\t\t\t\t// Reset the states when switching between categories and types.\n\t\t\t\t\tkey={ `${ type }-${ category }` }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\tcategoryId={ category }\n\t\t\t\t/>\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -14,7 +14,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
14
14
|
*/
|
|
15
15
|
function NoPatterns() {
|
|
16
16
|
return (0, _element.createElement)("div", {
|
|
17
|
-
className: "edit-site-
|
|
17
|
+
className: "edit-site-patterns__no-results"
|
|
18
18
|
}, (0, _i18n.__)('No patterns found.'));
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=no-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/no-patterns.js"],"names":["NoPatterns"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,UAAT,GAAsB;AACpC,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,cAAI,oBAAJ,CADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport default function NoPatterns() {\n\treturn (\n\t\t<div className=\"edit-site-patterns__no-results\">\n\t\t\t{ __( 'No patterns found.' ) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Pagination;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
function Pagination({
|
|
18
|
+
currentPage,
|
|
19
|
+
numPages,
|
|
20
|
+
changePage,
|
|
21
|
+
totalItems
|
|
22
|
+
}) {
|
|
23
|
+
return (0, _element.createElement)(_components.__experimentalHStack, {
|
|
24
|
+
expanded: false,
|
|
25
|
+
spacing: 3,
|
|
26
|
+
justify: "flex-start",
|
|
27
|
+
className: "edit-site-patterns__grid-pagination"
|
|
28
|
+
}, (0, _element.createElement)(_components.__experimentalText, {
|
|
29
|
+
variant: "muted"
|
|
30
|
+
}, // translators: %s: Total number of patterns.
|
|
31
|
+
(0, _i18n.sprintf)( // translators: %s: Total number of patterns.
|
|
32
|
+
(0, _i18n._n)('%s item', '%s items', totalItems), totalItems)), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
33
|
+
expanded: false,
|
|
34
|
+
spacing: 1
|
|
35
|
+
}, (0, _element.createElement)(_components.Button, {
|
|
36
|
+
variant: "tertiary",
|
|
37
|
+
onClick: () => changePage(1),
|
|
38
|
+
disabled: currentPage === 1,
|
|
39
|
+
"aria-label": (0, _i18n.__)('First page')
|
|
40
|
+
}, "\xAB"), (0, _element.createElement)(_components.Button, {
|
|
41
|
+
variant: "tertiary",
|
|
42
|
+
onClick: () => changePage(currentPage - 1),
|
|
43
|
+
disabled: currentPage === 1,
|
|
44
|
+
"aria-label": (0, _i18n.__)('Previous page')
|
|
45
|
+
}, "\u2039")), (0, _element.createElement)(_components.__experimentalText, {
|
|
46
|
+
variant: "muted"
|
|
47
|
+
}, (0, _i18n.sprintf)( // translators: %1$s: Current page number, %2$s: Total number of pages.
|
|
48
|
+
(0, _i18n._x)('%1$s of %2$s', 'paging'), currentPage, numPages)), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
49
|
+
expanded: false,
|
|
50
|
+
spacing: 1
|
|
51
|
+
}, (0, _element.createElement)(_components.Button, {
|
|
52
|
+
variant: "tertiary",
|
|
53
|
+
onClick: () => changePage(currentPage + 1),
|
|
54
|
+
disabled: currentPage === numPages,
|
|
55
|
+
"aria-label": (0, _i18n.__)('Next page')
|
|
56
|
+
}, "\u203A"), (0, _element.createElement)(_components.Button, {
|
|
57
|
+
variant: "tertiary",
|
|
58
|
+
onClick: () => changePage(numPages),
|
|
59
|
+
disabled: currentPage === numPages,
|
|
60
|
+
"aria-label": (0, _i18n.__)('Last page')
|
|
61
|
+
}, "\xBB")));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/pagination.js"],"names":["Pagination","currentPage","numPages","changePage","totalItems"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;AAQe,SAASA,UAAT,CAAqB;AACnCC,EAAAA,WADmC;AAEnCC,EAAAA,QAFm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cAAI,WAAJ;AAJd,cADD,EASC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAMC,UAAU,CAAED,QAAF,CAF3B;AAGC,IAAA,QAAQ,EAAGD,WAAW,KAAKC,QAH5B;AAIC,kBAAa,cAAI,WAAJ;AAJd,YATD,CA1CD,CADD;AA+DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<HStack\n\t\t\texpanded={ false }\n\t\t\tspacing={ 3 }\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName=\"edit-site-patterns__grid-pagination\"\n\t\t>\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\t\ttotalItems\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Text>\n\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t>\n\t\t\t\t\t«\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t>\n\t\t\t\t\t‹\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\tcurrentPage,\n\t\t\t\t\tnumPages\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t\t<HStack expanded={ false } spacing={ 1 }>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t>\n\t\t\t\t\t›\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t>\n\t\t\t\t\t»\n\t\t\t\t</Button>\n\t\t\t</HStack>\n\t\t</HStack>\n\t);\n}\n"]}
|