@wordpress/edit-site 5.14.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 +2 -0
- package/build/components/add-new-page/index.js +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +21 -7
- package/build/components/add-new-pattern/index.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/use-site-editor-settings.js +87 -13
- package/build/components/block-editor/use-site-editor-settings.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 +7 -3
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +13 -9
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +8 -3
- package/build/components/layout/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 -16
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- 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-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 +83 -58
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +5 -18
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- 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 +95 -30
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- 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/use-patterns.js +102 -121
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- 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 +2 -23
- package/build/components/page-template-parts/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-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-navigation-screen/index.js +14 -8
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- 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/index.js +4 -4
- 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/single-navigation-menu.js +3 -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 +4 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- 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-page/index.js +2 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
- 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 +9 -7
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- 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 +5 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +72 -51
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +24 -11
- 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 +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +3 -1
- 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/hooks/commands/use-common-commands.js +78 -20
- package/build/hooks/commands/use-common-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/store/private-actions.js +7 -1
- package/build/store/private-actions.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/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 +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +19 -7
- package/build-module/components/add-new-pattern/index.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/use-site-editor-settings.js +89 -14
- package/build-module/components/block-editor/use-site-editor-settings.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 +6 -3
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +13 -9
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +8 -3
- package/build-module/components/layout/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 -17
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- 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-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 +84 -64
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +5 -17
- package/build-module/components/page-patterns/grid.js.map +1 -1
- 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-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- 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 +96 -33
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- 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/use-patterns.js +103 -122
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- 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 +3 -22
- package/build-module/components/page-template-parts/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-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-navigation-screen/index.js +15 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- 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/index.js +4 -4
- 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/single-navigation-menu.js +3 -3
- 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 +4 -3
- 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/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-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/status-label.js +1 -32
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +8 -7
- 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 +3 -2
- 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 +4 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +76 -53
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +24 -11
- 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 +16 -12
- 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 +2 -1
- 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/hooks/commands/use-common-commands.js +74 -20
- package/build-module/hooks/commands/use-common-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/store/private-actions.js +7 -1
- package/build-module/store/private-actions.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/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +221 -63
- package/build-style/style.css +221 -63
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +23 -12
- 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 +1 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +99 -20
- package/src/components/canvas-spinner/style.scss +14 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +5 -2
- package/src/components/editor/index.js +2 -2
- package/src/components/header-edit-mode/document-actions/style.scss +4 -0
- package/src/components/header-edit-mode/index.js +29 -22
- package/src/components/layout/index.js +16 -2
- package/src/components/layout/style.scss +2 -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 -22
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +189 -133
- package/src/components/page-patterns/grid.js +3 -20
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +160 -72
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +140 -30
- package/src/components/page-patterns/use-patterns.js +102 -172
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -22
- 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-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-navigation-item/style.scss +5 -12
- package/src/components/sidebar-navigation-screen/index.js +14 -7
- package/src/components/sidebar-navigation-screen/style.scss +14 -0
- 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/index.js +4 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +15 -5
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
- package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
- package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- 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 +5 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +103 -98
- package/src/components/sidebar-navigation-screen-patterns/style.scss +20 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/site-hub/index.js +45 -28
- package/src/components/site-hub/style.scss +13 -0
- 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 +2 -1
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/hooks/commands/use-common-commands.js +56 -23
- package/src/hooks/push-changes-to-global-styles/index.js +63 -9
- package/src/store/private-actions.js +5 -1
- package/src/style.scss +10 -12
- package/src/utils/normalize-record-key.js +11 -0
- 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-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/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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createElement
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
@@ -9,31 +9,38 @@ import classnames from 'classnames';
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { BlockPreview } from '@wordpress/block-editor';
|
|
12
|
-
import { __experimentalConfirmDialog as ConfirmDialog, DropdownMenu, MenuGroup, MenuItem,
|
|
12
|
+
import { Button, __experimentalConfirmDialog as ConfirmDialog, DropdownMenu, MenuGroup, MenuItem, __experimentalHeading as Heading, __experimentalHStack as HStack, Tooltip, Flex } from '@wordpress/components';
|
|
13
13
|
import { useDispatch } from '@wordpress/data';
|
|
14
|
-
import { useState, useId } from '@wordpress/element';
|
|
14
|
+
import { useState, useId, memo } from '@wordpress/element';
|
|
15
15
|
import { __, sprintf } from '@wordpress/i18n';
|
|
16
|
-
import { Icon, header, footer, symbolFilled, moreHorizontal, lockSmall } from '@wordpress/icons';
|
|
16
|
+
import { Icon, header, footer, symbolFilled as uncategorized, symbol, moreHorizontal, lockSmall } from '@wordpress/icons';
|
|
17
17
|
import { store as noticesStore } from '@wordpress/notices';
|
|
18
18
|
import { store as reusableBlocksStore } from '@wordpress/reusable-blocks';
|
|
19
|
-
import { DELETE, BACKSPACE } from '@wordpress/keycodes';
|
|
20
19
|
/**
|
|
21
20
|
* Internal dependencies
|
|
22
21
|
*/
|
|
23
22
|
|
|
24
|
-
import
|
|
23
|
+
import RenameMenuItem from './rename-menu-item';
|
|
24
|
+
import DuplicateMenuItem from './duplicate-menu-item';
|
|
25
|
+
import { PATTERNS, TEMPLATE_PARTS, USER_PATTERNS, SYNC_TYPES } from './utils';
|
|
26
|
+
import { store as editSiteStore } from '../../store';
|
|
25
27
|
import { useLink } from '../routes/link';
|
|
28
|
+
const templatePartIcons = {
|
|
29
|
+
header,
|
|
30
|
+
footer,
|
|
31
|
+
uncategorized
|
|
32
|
+
};
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export default function GridItem({
|
|
34
|
+
function GridItem({
|
|
30
35
|
categoryId,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
item
|
|
36
|
+
item,
|
|
37
|
+
...props
|
|
34
38
|
}) {
|
|
35
39
|
const descriptionId = useId();
|
|
36
40
|
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
|
|
41
|
+
const {
|
|
42
|
+
removeTemplate
|
|
43
|
+
} = useDispatch(editSiteStore);
|
|
37
44
|
const {
|
|
38
45
|
__experimentalDeleteReusableBlock
|
|
39
46
|
} = useDispatch(reusableBlocksStore);
|
|
@@ -41,76 +48,74 @@ export default function GridItem({
|
|
|
41
48
|
createErrorNotice,
|
|
42
49
|
createSuccessNotice
|
|
43
50
|
} = useDispatch(noticesStore);
|
|
51
|
+
const isUserPattern = item.type === USER_PATTERNS;
|
|
52
|
+
const isNonUserPattern = item.type === PATTERNS;
|
|
53
|
+
const isTemplatePart = item.type === TEMPLATE_PARTS;
|
|
44
54
|
const {
|
|
45
55
|
onClick
|
|
46
56
|
} = useLink({
|
|
47
57
|
postType: item.type,
|
|
48
|
-
postId:
|
|
58
|
+
postId: isUserPattern ? item.id : item.name,
|
|
49
59
|
categoryId,
|
|
50
60
|
categoryType: item.type
|
|
51
61
|
});
|
|
52
|
-
|
|
53
|
-
const onKeyDown = event => {
|
|
54
|
-
if (DELETE === event.keyCode || BACKSPACE === event.keyCode) {
|
|
55
|
-
setIsDeleteDialogOpen(true);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
62
|
const isEmpty = !item.blocks?.length;
|
|
60
63
|
const patternClassNames = classnames('edit-site-patterns__pattern', {
|
|
61
64
|
'is-placeholder': isEmpty
|
|
62
65
|
});
|
|
63
66
|
const previewClassNames = classnames('edit-site-patterns__preview', {
|
|
64
|
-
'is-inactive':
|
|
67
|
+
'is-inactive': isNonUserPattern
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
const deletePattern = async () => {
|
|
68
71
|
try {
|
|
69
72
|
await __experimentalDeleteReusableBlock(item.id);
|
|
70
|
-
createSuccessNotice(
|
|
71
|
-
|
|
73
|
+
createSuccessNotice(sprintf( // translators: %s: The pattern's title e.g. 'Call to action'.
|
|
74
|
+
__('"%s" deleted.'), item.title), {
|
|
75
|
+
type: 'snackbar',
|
|
76
|
+
id: 'edit-site-patterns-success'
|
|
72
77
|
});
|
|
73
78
|
} catch (error) {
|
|
74
79
|
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while deleting the pattern.');
|
|
75
80
|
createErrorNotice(errorMessage, {
|
|
76
|
-
type: 'snackbar'
|
|
81
|
+
type: 'snackbar',
|
|
82
|
+
id: 'edit-site-patterns-error'
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
85
|
};
|
|
80
86
|
|
|
81
|
-
const
|
|
87
|
+
const deleteItem = () => isTemplatePart ? removeTemplate(item) : deletePattern(); // Only custom patterns or custom template parts can be renamed or deleted.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
const isCustomPattern = isUserPattern || isTemplatePart && item.isCustom;
|
|
91
|
+
const hasThemeFile = isTemplatePart && item.templatePart.has_theme_file;
|
|
82
92
|
const ariaDescriptions = [];
|
|
83
93
|
|
|
84
|
-
if (
|
|
94
|
+
if (isCustomPattern) {
|
|
85
95
|
// User patterns don't have descriptions, but can be edited and deleted, so include some help text.
|
|
86
96
|
ariaDescriptions.push(__('Press Enter to edit, or Delete to delete the pattern.'));
|
|
87
97
|
} else if (item.description) {
|
|
88
98
|
ariaDescriptions.push(item.description);
|
|
89
99
|
}
|
|
90
100
|
|
|
91
|
-
if (
|
|
92
|
-
ariaDescriptions.push(
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let itemIcon = icon;
|
|
96
|
-
|
|
97
|
-
if (categoryId === 'header') {
|
|
98
|
-
itemIcon = header;
|
|
99
|
-
} else if (categoryId === 'footer') {
|
|
100
|
-
itemIcon = footer;
|
|
101
|
-
} else if (categoryId === 'uncategorized') {
|
|
102
|
-
itemIcon = symbolFilled;
|
|
101
|
+
if (isNonUserPattern) {
|
|
102
|
+
ariaDescriptions.push(__('Theme & plugin patterns cannot be edited.'));
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
const itemIcon = templatePartIcons[categoryId] || (item.syncStatus === SYNC_TYPES.full ? symbol : undefined);
|
|
106
|
+
const confirmButtonText = hasThemeFile ? __('Clear') : __('Delete');
|
|
107
|
+
const confirmPrompt = hasThemeFile ? __('Are you sure you want to clear these customizations?') : sprintf( // translators: %s: The pattern or template part's title e.g. 'Call to action'.
|
|
108
|
+
__('Are you sure you want to delete "%s"?'), item.title);
|
|
109
|
+
return createElement("li", {
|
|
106
110
|
className: patternClassNames
|
|
107
|
-
}, createElement(
|
|
108
|
-
className: previewClassNames,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
}, createElement("button", {
|
|
112
|
+
className: previewClassNames // Even though still incomplete, passing ids helps performance.
|
|
113
|
+
// @see https://reakit.io/docs/composite/#performance.
|
|
114
|
+
,
|
|
115
|
+
id: `edit-site-patterns-${item.name}`,
|
|
116
|
+
...props,
|
|
112
117
|
onClick: item.type !== PATTERNS ? onClick : undefined,
|
|
113
|
-
|
|
118
|
+
"aria-disabled": item.type !== PATTERNS ? 'false' : 'true',
|
|
114
119
|
"aria-label": item.title,
|
|
115
120
|
"aria-describedby": ariaDescriptions.length ? ariaDescriptions.map((_, index) => `${descriptionId}-${index}`).join(' ') : undefined
|
|
116
121
|
}, isEmpty && __('Empty pattern'), !isEmpty && createElement(BlockPreview, {
|
|
@@ -120,7 +125,6 @@ export default function GridItem({
|
|
|
120
125
|
hidden: true,
|
|
121
126
|
id: `${descriptionId}-${index}`
|
|
122
127
|
}, ariaDescription)), createElement(HStack, {
|
|
123
|
-
"aria-hidden": "true",
|
|
124
128
|
className: "edit-site-patterns__footer",
|
|
125
129
|
justify: "space-between"
|
|
126
130
|
}, createElement(HStack, {
|
|
@@ -128,25 +132,33 @@ export default function GridItem({
|
|
|
128
132
|
justify: "left",
|
|
129
133
|
spacing: 3,
|
|
130
134
|
className: "edit-site-patterns__pattern-title"
|
|
131
|
-
},
|
|
135
|
+
}, itemIcon && !isNonUserPattern && createElement(Tooltip, {
|
|
136
|
+
position: "top center",
|
|
137
|
+
text: __('Editing this pattern will also update anywhere it is used')
|
|
138
|
+
}, createElement("span", null, createElement(Icon, {
|
|
132
139
|
className: "edit-site-patterns__pattern-icon",
|
|
133
140
|
icon: itemIcon
|
|
134
|
-
}), createElement(Flex, {
|
|
141
|
+
}))), createElement(Flex, {
|
|
135
142
|
as: "span",
|
|
136
143
|
gap: 0,
|
|
137
144
|
justify: "left"
|
|
138
|
-
}, item.
|
|
145
|
+
}, item.type === PATTERNS ? item.title : createElement(Heading, {
|
|
146
|
+
level: 5
|
|
147
|
+
}, createElement(Button, {
|
|
148
|
+
variant: "link",
|
|
149
|
+
onClick: onClick // Required for the grid's roving tab index system.
|
|
150
|
+
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
|
|
151
|
+
,
|
|
152
|
+
tabIndex: "-1"
|
|
153
|
+
}, item.title)), item.type === PATTERNS && createElement(Tooltip, {
|
|
139
154
|
position: "top center",
|
|
140
|
-
text: __('
|
|
155
|
+
text: __('This pattern cannot be edited.')
|
|
141
156
|
}, createElement("span", {
|
|
142
157
|
className: "edit-site-patterns__pattern-lock-icon"
|
|
143
158
|
}, createElement(Icon, {
|
|
144
|
-
style: {
|
|
145
|
-
fill: 'currentcolor'
|
|
146
|
-
},
|
|
147
159
|
icon: lockSmall,
|
|
148
160
|
size: 24
|
|
149
|
-
}))))),
|
|
161
|
+
}))))), createElement(DropdownMenu, {
|
|
150
162
|
icon: moreHorizontal,
|
|
151
163
|
label: __('Actions'),
|
|
152
164
|
className: "edit-site-patterns__dropdown",
|
|
@@ -158,18 +170,26 @@ export default function GridItem({
|
|
|
158
170
|
isSmall: true,
|
|
159
171
|
describedBy: sprintf(
|
|
160
172
|
/* translators: %s: pattern name */
|
|
161
|
-
__('Action menu for %s pattern'), item.title)
|
|
162
|
-
// The dropdown menu is not focusable using the
|
|
163
|
-
// keyboard as this would interfere with the grid's
|
|
164
|
-
// roving tab index system. Instead, keyboard users
|
|
165
|
-
// use keyboard shortcuts to trigger actions.
|
|
166
|
-
tabIndex: -1
|
|
173
|
+
__('Action menu for %s pattern'), item.title)
|
|
167
174
|
}
|
|
168
|
-
}, (
|
|
175
|
+
}, ({
|
|
176
|
+
onClose
|
|
177
|
+
}) => createElement(MenuGroup, null, isCustomPattern && !hasThemeFile && createElement(RenameMenuItem, {
|
|
178
|
+
item: item,
|
|
179
|
+
onClose: onClose
|
|
180
|
+
}), createElement(DuplicateMenuItem, {
|
|
181
|
+
categoryId: categoryId,
|
|
182
|
+
item: item,
|
|
183
|
+
onClose: onClose,
|
|
184
|
+
label: isNonUserPattern ? __('Copy to My patterns') : __('Duplicate')
|
|
185
|
+
}), isCustomPattern && createElement(MenuItem, {
|
|
169
186
|
onClick: () => setIsDeleteDialogOpen(true)
|
|
170
|
-
}, __('Delete')))))
|
|
171
|
-
|
|
187
|
+
}, hasThemeFile ? __('Clear customizations') : __('Delete'))))), isDeleteDialogOpen && createElement(ConfirmDialog, {
|
|
188
|
+
confirmButtonText: confirmButtonText,
|
|
189
|
+
onConfirm: deleteItem,
|
|
172
190
|
onCancel: () => setIsDeleteDialogOpen(false)
|
|
173
|
-
},
|
|
191
|
+
}, confirmPrompt));
|
|
174
192
|
}
|
|
193
|
+
|
|
194
|
+
export default memo(GridItem);
|
|
175
195
|
//# sourceMappingURL=grid-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"names":["classnames","BlockPreview","__experimentalConfirmDialog","ConfirmDialog","DropdownMenu","MenuGroup","MenuItem","__experimentalHStack","HStack","__unstableCompositeItem","CompositeItem","Tooltip","Flex","useDispatch","useState","useId","__","sprintf","Icon","header","footer","symbolFilled","moreHorizontal","lockSmall","store","noticesStore","reusableBlocksStore","DELETE","BACKSPACE","PATTERNS","USER_PATTERNS","useLink","THEME_PATTERN_TOOLTIP","GridItem","categoryId","composite","icon","item","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","__experimentalDeleteReusableBlock","createErrorNotice","createSuccessNotice","onClick","postType","type","postId","id","name","categoryType","onKeyDown","event","keyCode","isEmpty","blocks","length","patternClassNames","previewClassNames","deletePattern","error","errorMessage","message","code","isUserPattern","ariaDescriptions","push","description","itemIcon","undefined","title","map","_","index","join","ariaDescription","fill","placement","className","isSmall","describedBy","tabIndex"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,yBAA7B;AACA,SACCC,2BAA2B,IAAIC,aADhC,EAECC,YAFD,EAGCC,SAHD,EAICC,QAJD,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,uBAAuB,IAAIC,aAN5B,EAOCC,OAPD,EAQCC,IARD,QASO,uBATP;AAUA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,KAAnB,QAAgC,oBAAhC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,IADD,EAECC,MAFD,EAGCC,MAHD,EAICC,YAJD,EAKCC,cALD,EAMCC,SAND,QAOO,kBAPP;AAQA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oB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O,EAAG,MACTzC,qBAAqB,CAAE,IAAF;AAFvB,KAKGxB,EAAE,CAAE,QAAF,CALL,CADD,CArBF,CAtCF,CAhCD,CADD,EA0GGuB,kBAAkB,IACnB,cAAC,aAAD;AACC,IAAA,SAAS,EAAGoB,aADb;AAEC,IAAA,QAAQ,EAAG,MAAMnB,qBAAqB,CAAE,KAAF;AAFvC,KAIGxB,EAAE,CAAE,+CAAF,CAJL,CA3GF,CADD;AAqHA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport {\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__unstableCompositeItem as CompositeItem,\n\tTooltip,\n\tFlex,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useId } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tIcon,\n\theader,\n\tfooter,\n\tsymbolFilled,\n\tmoreHorizontal,\n\tlockSmall,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { PATTERNS, USER_PATTERNS } from './utils';\nimport { useLink } from '../routes/link';\n\nconst THEME_PATTERN_TOOLTIP = __( 'Theme patterns cannot be edited.' );\n\nexport default function GridItem( { categoryId, composite, icon, item } ) {\n\tconst descriptionId = useId();\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: item.type === USER_PATTERNS ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: item.type,\n\t} );\n\n\tconst onKeyDown = ( event ) => {\n\t\tif ( DELETE === event.keyCode || BACKSPACE === event.keyCode ) {\n\t\t\tsetIsDeleteDialogOpen( true );\n\t\t}\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': item.type === PATTERNS,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice( __( 'Pattern successfully deleted.' ), {\n\t\t\t\ttype: 'snackbar',\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, { type: 'snackbar' } );\n\t\t}\n\t};\n\n\tconst isUserPattern = item.type === USER_PATTERNS;\n\tconst ariaDescriptions = [];\n\tif ( isUserPattern ) {\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\tif ( item.type === PATTERNS ) {\n\t\tariaDescriptions.push( THEME_PATTERN_TOOLTIP );\n\t}\n\n\tlet itemIcon = icon;\n\tif ( categoryId === 'header' ) {\n\t\titemIcon = header;\n\t} else if ( categoryId === 'footer' ) {\n\t\titemIcon = footer;\n\t} else if ( categoryId === 'uncategorized' ) {\n\t\titemIcon = symbolFilled;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className={ patternClassNames }>\n\t\t\t\t<CompositeItem\n\t\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tas=\"div\"\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\tonClick={ item.type !== PATTERNS ? onClick : undefined }\n\t\t\t\t\tonKeyDown={ isUserPattern ? onKeyDown : undefined }\n\t\t\t\t\taria-label={ item.title }\n\t\t\t\t\taria-describedby={\n\t\t\t\t\t\tariaDescriptions.length\n\t\t\t\t\t\t\t? ariaDescriptions\n\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t( _, index ) =>\n\t\t\t\t\t\t\t\t\t\t\t`${ descriptionId }-${ index }`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.join( ' ' )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEmpty && __( 'Empty pattern' ) }\n\t\t\t\t\t{ ! isEmpty && <BlockPreview blocks={ item.blocks } /> }\n\t\t\t\t</CompositeItem>\n\t\t\t\t{ ariaDescriptions.map( ( ariaDescription, index ) => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\thidden\n\t\t\t\t\t\tid={ `${ descriptionId }-${ index }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ariaDescription }\n\t\t\t\t\t</div>\n\t\t\t\t) ) }\n\t\t\t\t<HStack\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName=\"edit-site-patterns__footer\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Flex as=\"span\" gap={ 0 } justify=\"left\">\n\t\t\t\t\t\t\t{ item.title }\n\t\t\t\t\t\t\t{ item.type === PATTERNS && (\n\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t\t\t'Theme patterns cannot be edited.'\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<span className=\"edit-site-patterns__pattern-lock-icon\">\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\tstyle={ { fill: 'currentcolor' } }\n\t\t\t\t\t\t\t\t\t\t\ticon={ lockSmall }\n\t\t\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t{ item.type === USER_PATTERNS && (\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreHorizontal }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__dropdown\"\n\t\t\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t// The dropdown menu is not focusable using the\n\t\t\t\t\t\t\t\t// keyboard as this would interfere with the grid's\n\t\t\t\t\t\t\t\t// roving tab index system. Instead, keyboard users\n\t\t\t\t\t\t\t\t// use keyboard shortcuts to trigger actions.\n\t\t\t\t\t\t\t\ttabIndex: -1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tonConfirm={ deletePattern }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Are you sure you want to delete this pattern?' ) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/grid-item.js"],"names":["classnames","BlockPreview","Button","__experimentalConfirmDialog","ConfirmDialog","DropdownMenu","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalHStack","HStack","Tooltip","Flex","useDispatch","useState","useId","memo","__","sprintf","Icon","header","footer","symbolFilled","uncategorized","symbol","moreHorizontal","lockSmall","store","noticesStore","reusableBlocksStore","RenameMenuItem","DuplicateMenuItem","PATTERNS","TEMPLATE_PARTS","USER_PATTERNS","SYNC_TYPES","editSiteStore","useLink","templatePartIcons","GridItem","categoryId","item","props","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","removeTemplate","__experimentalDeleteReusableBlock","createErrorNotice","createSuccessNotice","isUserPattern","type","isNonUserPattern","isTemplatePart","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","full","undefined","confirmButtonText","confirmPrompt","map","_","index","join","ariaDescription","placement","className","isSmall","describedBy","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,yBAA7B;AACA,SACCC,MADD,EAECC,2BAA2B,IAAIC,aAFhC,EAGCC,YAHD,EAICC,SAJD,EAKCC,QALD,EAMCC,qBAAqB,IAAIC,OAN1B,EAOCC,oBAAoB,IAAIC,MAPzB,EAQCC,OARD,EASCC,IATD,QAUO,uBAVP;AAWA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,QAAT,EAAmBC,KAAnB,EAA0BC,IAA1B,QAAsC,oBAAtC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,IADD,EAECC,MAFD,EAGCC,MAHD,EAICC,YAAY,IAAIC,aAJjB,EAKCC,MALD,EAMCC,cAND,EAOCC,SAPD,QAQO,kBARP;AASA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,mBAAlB,QAA6C,4BAA7C;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,QAAT,EAAmBC,cAAnB,EAAmCC,aAAnC,EAAkDC,UAAlD,QAAoE,SAApE;AACA,SAASR,KAAK,IAAIS,aAAlB,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KGwC,aALH,CAxIF,CADD;AAmJA;;AAED,eAAerE,IAAI,CAAEuB,QAAF,CAAnB","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"]}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState } from '@wordpress/components';
|
|
7
3
|
/**
|
|
8
4
|
* Internal dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
6
|
import GridItem from './grid-item';
|
|
12
7
|
export default function Grid({
|
|
13
8
|
categoryId,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
items
|
|
9
|
+
items,
|
|
10
|
+
...props
|
|
17
11
|
}) {
|
|
18
|
-
const composite = useCompositeState({
|
|
19
|
-
orientation: 'vertical'
|
|
20
|
-
});
|
|
21
|
-
|
|
22
12
|
if (!items?.length) {
|
|
23
13
|
return null;
|
|
24
14
|
}
|
|
25
15
|
|
|
26
|
-
return createElement(
|
|
16
|
+
return createElement("ul", {
|
|
27
17
|
role: "listbox",
|
|
28
18
|
className: "edit-site-patterns__grid",
|
|
29
|
-
|
|
19
|
+
...props
|
|
30
20
|
}, items.map(item => createElement(GridItem, {
|
|
31
21
|
key: item.name,
|
|
32
|
-
icon: icon,
|
|
33
22
|
item: item,
|
|
34
|
-
categoryId: categoryId
|
|
35
|
-
composite: composite
|
|
23
|
+
categoryId: categoryId
|
|
36
24
|
})));
|
|
37
25
|
}
|
|
38
26
|
//# sourceMappingURL=grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/grid.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/grid.js"],"names":["GridItem","Grid","categoryId","items","props","length","map","item","name"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,aAArB;AAEA,eAAe,SAASC,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,cAAC,QAAD;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,54 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalVStack as VStack, __experimentalHeading as Heading, __experimentalText as Text } from '@wordpress/components';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';
|
|
15
|
+
import { USER_PATTERN_CATEGORY, USER_PATTERNS, TEMPLATE_PARTS, PATTERNS } from './utils';
|
|
16
|
+
export default function PatternsHeader({
|
|
17
|
+
categoryId,
|
|
18
|
+
type,
|
|
19
|
+
titleId,
|
|
20
|
+
descriptionId
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
patternCategories
|
|
24
|
+
} = usePatternCategories();
|
|
25
|
+
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
26
|
+
let title, description;
|
|
27
|
+
|
|
28
|
+
if (categoryId === USER_PATTERN_CATEGORY && type === USER_PATTERNS) {
|
|
29
|
+
title = __('My Patterns');
|
|
30
|
+
description = '';
|
|
31
|
+
} else if (type === TEMPLATE_PARTS) {
|
|
32
|
+
const templatePartArea = templatePartAreas.find(area => area.area === categoryId);
|
|
33
|
+
title = templatePartArea?.label;
|
|
34
|
+
description = templatePartArea?.description;
|
|
35
|
+
} else if (type === PATTERNS) {
|
|
36
|
+
const patternCategory = patternCategories.find(category => category.name === categoryId);
|
|
37
|
+
title = patternCategory?.label;
|
|
38
|
+
description = patternCategory?.description;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!title) return null;
|
|
42
|
+
return createElement(VStack, {
|
|
43
|
+
className: "edit-site-patterns__section-header"
|
|
44
|
+
}, createElement(Heading, {
|
|
45
|
+
as: "h2",
|
|
46
|
+
level: 4,
|
|
47
|
+
id: titleId
|
|
48
|
+
}, title), description ? createElement(Text, {
|
|
49
|
+
variant: "muted",
|
|
50
|
+
as: "p",
|
|
51
|
+
id: descriptionId
|
|
52
|
+
}, description) : null);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/header.js"],"names":["__experimentalVStack","VStack","__experimentalHeading","Heading","__experimentalText","Text","__","store","editorStore","useSelect","usePatternCategories","USER_PATTERN_CATEGORY","USER_PATTERNS","TEMPLATE_PARTS","PATTERNS","PatternsHeader","categoryId","type","titleId","descriptionId","patternCategories","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","title","description","templatePartArea","find","area","label","patternCategory","category","name"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,qBAAqB,IAAIC,OAF1B,EAGCC,kBAAkB,IAAIC,IAHvB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,8DAAjC;AACA,SACCC,qBADD,EAECC,aAFD,EAGCC,cAHD,EAICC,QAJD,QAKO,SALP;AAOA,eAAe,SAASC,c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CADD,EAIGC,WAAW,GACZ,cAAC,IAAD;AAAM,IAAA,OAAO,EAAC,OAAd;AAAsB,IAAA,EAAE,EAAC,GAAzB;AAA6B,IAAA,EAAE,EAAGN;AAAlC,KACGM,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"]}
|
|
@@ -35,7 +35,9 @@ export default function PagePatterns() {
|
|
|
35
35
|
className: "edit-site-patterns",
|
|
36
36
|
title: __('Patterns content'),
|
|
37
37
|
hideTitleFromUI: true
|
|
38
|
-
}, createElement(PatternsList
|
|
38
|
+
}, createElement(PatternsList // Reset the states when switching between categories and types.
|
|
39
|
+
, {
|
|
40
|
+
key: `${type}-${category}`,
|
|
39
41
|
type: type,
|
|
40
42
|
categoryId: category
|
|
41
43
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/index.js"],"names":["__","privateApis","blockEditorPrivateApis","getQueryArgs","DEFAULT_CATEGORY","DEFAULT_TYPE","Page","PatternsList","usePatternSettings","unlock","ExperimentalBlockEditorProvider","PagePatterns","categoryType","categoryId","window","location","href","type","category","settings"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,EAA2BC,YAA3B,QAA+C,SAA/C;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAsCD,MAAM,CAAEP,sBAAF,CAAlD;AAEA,eAAe,SAASS,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+BV,YAAY,CAAEW,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAAjD;AACA,QAAMC,IAAI,GAAGL,YAAY,IAAIP,YAA7B;AACA,QAAMa,QAAQ,GAAGL,UAAU,IAAIT,gBAA/B;AACA,QAAMe,QAAQ,GAAGX,kBAAkB,EAAnC,CAJsC,CAMtC;AACA;AACA;;AACA,SACC,cAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAGW;AAA5C,KACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,oBADX;AAEC,IAAA,KAAK,EAAGnB,EAAE,CAAE,kBAAF,CAFX;AAGC,IAAA,eAAe;AAHhB,KAKC,cAAC,YAAD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/index.js"],"names":["__","privateApis","blockEditorPrivateApis","getQueryArgs","DEFAULT_CATEGORY","DEFAULT_TYPE","Page","PatternsList","usePatternSettings","unlock","ExperimentalBlockEditorProvider","PagePatterns","categoryType","categoryId","window","location","href","type","category","settings"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,EAA2BC,YAA3B,QAA+C,SAA/C;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAsCD,MAAM,CAAEP,sBAAF,CAAlD;AAEA,eAAe,SAASS,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+BV,YAAY,CAAEW,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAAjD;AACA,QAAMC,IAAI,GAAGL,YAAY,IAAIP,YAA7B;AACA,QAAMa,QAAQ,GAAGL,UAAU,IAAIT,gBAA/B;AACA,QAAMe,QAAQ,GAAGX,kBAAkB,EAAnC,CAJsC,CAMtC;AACA;AACA;;AACA,SACC,cAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAGW;AAA5C,KACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,oBADX;AAEC,IAAA,KAAK,EAAGnB,EAAE,CAAE,kBAAF,CAFX;AAGC,IAAA,eAAe;AAHhB,KAKC,cAAC,YAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAI,GAAGiB,IAAM,IAAIC,QAAU,EAF/B;AAGC,IAAA,IAAI,EAAGD,IAHR;AAIC,IAAA,UAAU,EAAGC;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"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalHStack as HStack, __experimentalText as Text, Button } from '@wordpress/components';
|
|
7
|
+
import { __, _x, _n, sprintf } from '@wordpress/i18n';
|
|
8
|
+
export default function Pagination({
|
|
9
|
+
currentPage,
|
|
10
|
+
numPages,
|
|
11
|
+
changePage,
|
|
12
|
+
totalItems
|
|
13
|
+
}) {
|
|
14
|
+
return createElement(HStack, {
|
|
15
|
+
expanded: false,
|
|
16
|
+
spacing: 3,
|
|
17
|
+
justify: "flex-start",
|
|
18
|
+
className: "edit-site-patterns__grid-pagination"
|
|
19
|
+
}, createElement(Text, {
|
|
20
|
+
variant: "muted"
|
|
21
|
+
}, // translators: %s: Total number of patterns.
|
|
22
|
+
sprintf( // translators: %s: Total number of patterns.
|
|
23
|
+
_n('%s item', '%s items', totalItems), totalItems)), createElement(HStack, {
|
|
24
|
+
expanded: false,
|
|
25
|
+
spacing: 1
|
|
26
|
+
}, createElement(Button, {
|
|
27
|
+
variant: "tertiary",
|
|
28
|
+
onClick: () => changePage(1),
|
|
29
|
+
disabled: currentPage === 1,
|
|
30
|
+
"aria-label": __('First page')
|
|
31
|
+
}, "\xAB"), createElement(Button, {
|
|
32
|
+
variant: "tertiary",
|
|
33
|
+
onClick: () => changePage(currentPage - 1),
|
|
34
|
+
disabled: currentPage === 1,
|
|
35
|
+
"aria-label": __('Previous page')
|
|
36
|
+
}, "\u2039")), createElement(Text, {
|
|
37
|
+
variant: "muted"
|
|
38
|
+
}, sprintf( // translators: %1$s: Current page number, %2$s: Total number of pages.
|
|
39
|
+
_x('%1$s of %2$s', 'paging'), currentPage, numPages)), createElement(HStack, {
|
|
40
|
+
expanded: false,
|
|
41
|
+
spacing: 1
|
|
42
|
+
}, createElement(Button, {
|
|
43
|
+
variant: "tertiary",
|
|
44
|
+
onClick: () => changePage(currentPage + 1),
|
|
45
|
+
disabled: currentPage === numPages,
|
|
46
|
+
"aria-label": __('Next page')
|
|
47
|
+
}, "\u203A"), createElement(Button, {
|
|
48
|
+
variant: "tertiary",
|
|
49
|
+
onClick: () => changePage(numPages),
|
|
50
|
+
disabled: currentPage === numPages,
|
|
51
|
+
"aria-label": __('Last page')
|
|
52
|
+
}, "\xBB")));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/pagination.js"],"names":["__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","Pagination","currentPage","numPages","changePage","totalItems"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,MAHD,QAIO,uBAJP;AAKA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,EAAjB,EAAqBC,OAArB,QAAoC,iBAApC;AAEA,eAAe,SAASC,UAAT,CAAqB;AACnCC,EAAAA,WADmC;AAEnCC,EAAAA,QAFmC;AAGnCC,EAAAA,UAHmC;AAInCC,EAAAA;AAJmC,CAArB,EAKX;AACH,SACC,cAAC,MAAD;AACC,IAAA,QAAQ,EAAG,KADZ;AAEC,IAAA,OAAO,EAAG,CAFX;AAGC,IAAA,OAAO,EAAC,YAHT;AAIC,IAAA,SAAS,EAAC;AAJX,KAMC,cAAC,IAAD;AAAM,IAAA,OAAO,EAAC;AAAd,KAEE;AACAL,EAAAA,OAAO,EACN;AACAD,EAAAA,EAAE,CAAE,SAAF,EAAa,UAAb,EAAyBM,UAAzB,CAFI,EAGNA,UAHM,CAHT,CAND,EAgBC,cAAC,MAAD;AAAQ,IAAA,QAAQ,EAAG,KAAnB;AAA2B,IAAA,OAAO,EAAG;AAArC,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAMD,UAAU,CAAE,CAAF,CAF3B;AAGC,IAAA,QAAQ,EAAGF,WAAW,KAAK,CAH5B;AAIC,kBAAaL,EAAE,CAAE,YAAF;AAJhB,YADD,EASC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAMO,UAAU,CAAEF,WAAW,GAAG,CAAhB,CAF3B;AAGC,IAAA,QAAQ,EAAGA,WAAW,KAAK,CAH5B;AAIC,kBAAaL,EAAE,CAAE,eAAF;AAJhB,cATD,CAhBD,EAkCC,cAAC,IAAD;AAAM,IAAA,OAAO,EAAC;AAAd,KACGG,OAAO,EACR;AACAF,EAAAA,EAAE,CAAE,cAAF,EAAkB,QAAlB,CAFM,EAGRI,WAHQ,EAIRC,QAJQ,CADV,CAlCD,EA0CC,cAAC,MAAD;AAAQ,IAAA,QAAQ,EAAG,KAAnB;AAA2B,IAAA,OAAO,EAAG;AAArC,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAMC,UAAU,CAAEF,WAAW,GAAG,CAAhB,CAF3B;AAGC,IAAA,QAAQ,EAAGA,WAAW,KAAKC,QAH5B;AAIC,kBAAaN,EAAE,CAAE,WAAF;AAJhB,cADD,EASC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAMO,UAAU,CAAED,QAAF,CAF3B;AAGC,IAAA,QAAQ,EAAGD,WAAW,KAAKC,QAH5B;AAIC,kBAAaN,EAAE,CAAE,WAAF;AAJhB,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"]}
|