@wordpress/edit-site 5.25.0 → 5.25.1-next.79a6196f.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/LICENSE.md +1 -1
- package/build/components/block-editor/back-button.js +3 -2
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +2 -2
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/use-post-link-props.js +27 -0
- package/build/components/block-editor/use-post-link-props.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +7 -24
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +15 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +15 -16
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +9 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +5 -2
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +5 -5
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +8 -4
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +38 -21
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +5 -2
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/local-fonts.js +26 -10
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +6 -6
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js +35 -38
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/preview.js +43 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +16 -12
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +52 -52
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -35
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/ui.js +13 -62
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +8 -106
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +7 -11
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +10 -7
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -36
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +6 -13
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-main/index.js +4 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +84 -37
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +305 -0
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build/components/page-patterns/dataviews-patterns.js +307 -0
- package/build/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +4 -3
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +2 -1
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +23 -13
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +312 -36
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/{page-patterns/pagination.js → pagination/index.js} +25 -12
- package/build/components/pagination/index.js.map +1 -0
- package/build/components/{page-pages/side-editor.js → post-preview/index.js} +8 -4
- package/build/components/post-preview/index.js.map +1 -0
- package/build/components/preferences-modal/enable-feature.js +3 -2
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/enable-panel-option.js +33 -0
- package/build/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build/components/preferences-modal/index.js +57 -9
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/revisions/index.js +3 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +6 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +6 -3
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -11
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +18 -5
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +3 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +62 -10
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +4 -13
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +69 -0
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +63 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/style-book/index.js +38 -8
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +12 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +39 -44
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +6 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +0 -46
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +32 -41
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +4 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/use-post-link-props.js +20 -0
- package/build-module/components/block-editor/use-post-link-props.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +8 -25
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +14 -7
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +16 -17
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +9 -7
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +5 -2
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +7 -7
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +8 -4
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +39 -22
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +5 -2
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/local-fonts.js +27 -11
- package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js +34 -36
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +17 -13
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +53 -53
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +27 -36
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/ui.js +15 -64
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +13 -110
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +7 -11
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +10 -7
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -36
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +6 -13
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-main/index.js +4 -4
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +83 -36
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +292 -0
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build-module/components/page-patterns/dataviews-patterns.js +299 -0
- package/build-module/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +4 -3
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +2 -1
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -13
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +314 -38
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/{page-patterns/pagination.js → pagination/index.js} +24 -12
- package/build-module/components/pagination/index.js.map +1 -0
- package/build-module/components/{page-pages/side-editor.js → post-preview/index.js} +7 -3
- package/build-module/components/post-preview/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-feature.js +3 -2
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel-option.js +26 -0
- package/build-module/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +57 -9
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/revisions/index.js +4 -8
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +6 -3
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -11
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +17 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +2 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +64 -12
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +6 -15
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +61 -0
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +64 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/style-book/index.js +40 -10
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +12 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +36 -41
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +6 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -44
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +30 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +366 -268
- package/build-style/style.css +366 -268
- package/package.json +42 -42
- package/src/components/add-new-template/style.scss +2 -1
- package/src/components/block-editor/back-button.js +4 -2
- package/src/components/block-editor/resizable-editor.js +1 -1
- package/src/components/block-editor/style.scss +1 -2
- package/src/components/block-editor/use-post-link-props.js +20 -0
- package/src/components/block-editor/use-site-editor-settings.js +10 -41
- package/src/components/code-editor/style.scss +0 -4
- package/src/components/create-template-part-modal/index.js +83 -82
- package/src/components/editor/index.js +24 -31
- package/src/components/editor-canvas-container/index.js +8 -6
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +7 -2
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/src/components/global-styles/font-library-modal/context.js +7 -7
- package/src/components/global-styles/font-library-modal/font-collection.js +10 -5
- package/src/components/global-styles/font-library-modal/index.js +44 -24
- package/src/components/global-styles/font-library-modal/installed-fonts.js +3 -3
- package/src/components/global-styles/font-library-modal/library-font-variant.js +7 -2
- package/src/components/global-styles/font-library-modal/local-fonts.js +53 -26
- package/src/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/src/components/global-styles/font-library-modal/style.scss +5 -2
- package/src/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +9 -3
- package/src/components/global-styles/font-library-modal/utils/index.js +21 -23
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +58 -0
- package/src/components/global-styles/preview.js +55 -3
- package/src/components/global-styles/screen-color-palette.js +16 -26
- package/src/components/global-styles/screen-revisions/index.js +91 -92
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +37 -38
- package/src/components/global-styles/screen-revisions/style.scss +77 -20
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +67 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +73 -46
- package/src/components/global-styles/ui.js +13 -74
- package/src/components/header-edit-mode/document-tools/index.js +33 -165
- package/src/components/header-edit-mode/index.js +6 -17
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -4
- package/src/components/header-edit-mode/more-menu/index.js +9 -7
- package/src/components/header-edit-mode/style.scss +0 -47
- package/src/components/keyboard-shortcuts/edit-mode.js +1 -26
- package/src/components/keyboard-shortcuts/register.js +0 -43
- package/src/components/layout/index.js +8 -27
- package/src/components/layout/style.scss +10 -3
- package/src/components/list/style.scss +0 -5
- package/src/components/page/style.scss +1 -1
- package/src/components/page-main/index.js +8 -8
- package/src/components/page-pages/index.js +112 -41
- package/src/components/page-pages/style.scss +3 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +329 -0
- package/src/components/page-patterns/dataviews-patterns.js +380 -0
- package/src/components/page-patterns/duplicate-menu-item.js +1 -1
- package/src/components/page-patterns/grid-item.js +3 -2
- package/src/components/page-patterns/patterns-list.js +2 -1
- package/src/components/page-patterns/style.scss +89 -26
- package/src/components/page-patterns/use-patterns.js +24 -15
- package/src/components/page-templates/index.js +399 -64
- package/src/components/{page-patterns/pagination.js → pagination/index.js} +21 -10
- package/src/components/pagination/style.scss +5 -0
- package/src/components/post-preview/index.js +16 -0
- package/src/components/preferences-modal/enable-feature.js +9 -5
- package/src/components/preferences-modal/enable-panel-option.js +23 -0
- package/src/components/preferences-modal/index.js +107 -22
- package/src/components/revisions/index.js +8 -15
- package/src/components/routes/link.js +11 -3
- package/src/components/save-button/index.js +16 -3
- package/src/components/sidebar/index.js +6 -13
- package/src/components/sidebar-dataviews/add-new-view.js +1 -1
- package/src/components/sidebar-dataviews/default-views.js +23 -6
- package/src/components/sidebar-dataviews/index.js +2 -2
- package/src/components/sidebar-edit-mode/default-sidebar.js +0 -12
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +85 -14
- package/src/components/sidebar-edit-mode/page-panels/index.js +15 -1
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -12
- package/src/components/sidebar-edit-mode/style.scss +0 -10
- package/src/components/sidebar-edit-mode/template-panel/index.js +44 -40
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +3 -2
- package/src/components/sidebar-navigation-screen-page/index.js +2 -1
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +77 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +85 -28
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/style.scss +5 -2
- package/src/components/style-book/index.js +65 -21
- package/src/components/style-book/style.scss +3 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
- package/src/hooks/commands/use-edit-mode-commands.js +8 -12
- package/src/index.js +11 -5
- package/src/store/actions.js +35 -45
- package/src/store/private-actions.js +7 -3
- package/src/store/reducer.js +0 -44
- package/src/store/selectors.js +32 -38
- package/src/store/test/actions.js +11 -39
- package/src/store/test/reducer.js +1 -82
- package/src/store/test/selectors.js +0 -24
- package/src/style.scss +2 -1
- package/src/utils/get-is-list-page.js +2 -3
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build/components/global-styles/screen-revisions/get-revision-changes.js +0 -146
- package/build/components/global-styles/screen-revisions/get-revision-changes.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/redo.js +0 -41
- package/build/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/undo.js +0 -40
- package/build/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build/components/page-pages/side-editor.js.map +0 -1
- package/build/components/page-patterns/pagination.js.map +0 -1
- package/build/components/page-templates/dataviews-templates.js +0 -317
- package/build/components/page-templates/dataviews-templates.js.map +0 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +0 -60
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -109
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -35
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js +0 -73
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -219
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build-module/components/global-styles/screen-revisions/get-revision-changes.js +0 -139
- package/build-module/components/global-styles/screen-revisions/get-revision-changes.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/redo.js +0 -33
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/undo.js +0 -32
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build-module/components/page-pages/side-editor.js.map +0 -1
- package/build-module/components/page-patterns/pagination.js.map +0 -1
- package/build-module/components/page-templates/dataviews-templates.js +0 -309
- package/build-module/components/page-templates/dataviews-templates.js.map +0 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -53
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -102
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -27
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +0 -65
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -209
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +0 -62
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +0 -28
- package/src/components/global-styles/screen-revisions/get-revision-changes.js +0 -171
- package/src/components/global-styles/screen-revisions/test/get-revision-changes.js +0 -191
- package/src/components/header-edit-mode/undo-redo/redo.js +0 -38
- package/src/components/header-edit-mode/undo-redo/undo.js +0 -34
- package/src/components/page-pages/side-editor.js +0 -14
- package/src/components/page-templates/dataviews-templates.js +0 -360
- package/src/components/secondary-sidebar/inserter-sidebar.js +0 -66
- package/src/components/secondary-sidebar/list-view-sidebar.js +0 -123
- package/src/components/secondary-sidebar/style.scss +0 -65
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -26
- package/src/components/sidebar-edit-mode/template-panel/last-revision.js +0 -82
- package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -279
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = InserterSidebar;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _compose = require("@wordpress/compose");
|
|
13
|
-
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
var _element = require("@wordpress/element");
|
|
15
|
-
var _store = require("../../store");
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function InserterSidebar() {
|
|
25
|
-
const {
|
|
26
|
-
setIsInserterOpened
|
|
27
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
28
|
-
const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint(), []);
|
|
29
|
-
const isMobile = (0, _compose.useViewportMatch)('medium', '<');
|
|
30
|
-
const TagName = !isMobile ? _components.VisuallyHidden : 'div';
|
|
31
|
-
const [inserterDialogRef, inserterDialogProps] = (0, _compose.__experimentalUseDialog)({
|
|
32
|
-
onClose: () => setIsInserterOpened(false),
|
|
33
|
-
focusOnMount: null
|
|
34
|
-
});
|
|
35
|
-
const libraryRef = (0, _element.useRef)();
|
|
36
|
-
(0, _element.useEffect)(() => {
|
|
37
|
-
libraryRef.current.focusSearch();
|
|
38
|
-
}, []);
|
|
39
|
-
return (0, _react.createElement)("div", {
|
|
40
|
-
ref: inserterDialogRef,
|
|
41
|
-
...inserterDialogProps,
|
|
42
|
-
className: "edit-site-editor__inserter-panel"
|
|
43
|
-
}, (0, _react.createElement)(TagName, {
|
|
44
|
-
className: "edit-site-editor__inserter-panel-header"
|
|
45
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
46
|
-
icon: _icons.close,
|
|
47
|
-
label: (0, _i18n.__)('Close block inserter'),
|
|
48
|
-
onClick: () => setIsInserterOpened(false)
|
|
49
|
-
})), (0, _react.createElement)("div", {
|
|
50
|
-
className: "edit-site-editor__inserter-panel-content"
|
|
51
|
-
}, (0, _react.createElement)(_blockEditor.__experimentalLibrary, {
|
|
52
|
-
showInserterHelpPanel: true,
|
|
53
|
-
shouldFocusBlock: isMobile,
|
|
54
|
-
rootClientId: insertionPoint.rootClientId,
|
|
55
|
-
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
56
|
-
__experimentalFilterValue: insertionPoint.filterValue,
|
|
57
|
-
ref: libraryRef
|
|
58
|
-
})));
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_components","_blockEditor","_icons","_compose","_i18n","_element","_store","InserterSidebar","setIsInserterOpened","useDispatch","editSiteStore","insertionPoint","useSelect","select","__experimentalGetInsertionPoint","isMobile","useViewportMatch","TagName","VisuallyHidden","inserterDialogRef","inserterDialogProps","useDialog","onClose","focusOnMount","libraryRef","useRef","useEffect","current","focusSearch","_react","createElement","ref","className","Button","icon","close","label","__","onClick","__experimentalLibrary","showInserterHelpPanel","shouldFocusBlock","rootClientId","__experimentalInsertionIndex","insertionIndex","__experimentalFilterValue","filterValue"],"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst insertionPoint = useSelect(\n\t\t( select ) => select( editSiteStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tconst TagName = ! isMobile ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-site-editor__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-site-editor__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobile }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAIA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAYA;AACA;AACA;;AAGe,SAASQ,eAAeA,CAAA,EAAG;EACzC,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC5D,MAAMC,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IAAMA,MAAM,CAAEH,YAAc,CAAC,CAACI,+BAA+B,CAAC,CAAC,EACvE,EACD,CAAC;EAED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
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = ListViewSidebar;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _compose = require("@wordpress/compose");
|
|
11
|
-
var _data = require("@wordpress/data");
|
|
12
|
-
var _element = require("@wordpress/element");
|
|
13
|
-
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
var _icons = require("@wordpress/icons");
|
|
15
|
-
var _keycodes = require("@wordpress/keycodes");
|
|
16
|
-
var _dom = require("@wordpress/dom");
|
|
17
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
18
|
-
var _store = require("../../store");
|
|
19
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
20
|
-
/**
|
|
21
|
-
* WordPress dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
PrivateListView
|
|
30
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
31
|
-
function ListViewSidebar({
|
|
32
|
-
listViewToggleElement
|
|
33
|
-
}) {
|
|
34
|
-
const {
|
|
35
|
-
setIsListViewOpened
|
|
36
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
37
|
-
|
|
38
|
-
// This hook handles focus when the sidebar first renders.
|
|
39
|
-
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
40
|
-
|
|
41
|
-
// When closing the list view, focus should return to the toggle button.
|
|
42
|
-
const closeListView = (0, _element.useCallback)(() => {
|
|
43
|
-
setIsListViewOpened(false);
|
|
44
|
-
listViewToggleElement?.focus();
|
|
45
|
-
}, [listViewToggleElement, setIsListViewOpened]);
|
|
46
|
-
const closeOnEscape = (0, _element.useCallback)(event => {
|
|
47
|
-
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
closeListView();
|
|
50
|
-
}
|
|
51
|
-
}, [closeListView]);
|
|
52
|
-
|
|
53
|
-
// Use internal state instead of a ref to make sure that the component
|
|
54
|
-
// re-renders when the dropZoneElement updates.
|
|
55
|
-
const [dropZoneElement, setDropZoneElement] = (0, _element.useState)(null);
|
|
56
|
-
|
|
57
|
-
// This ref refers to the sidebar as a whole.
|
|
58
|
-
const sidebarRef = (0, _element.useRef)();
|
|
59
|
-
// This ref refers to the close button.
|
|
60
|
-
const sidebarCloseButtonRef = (0, _element.useRef)();
|
|
61
|
-
// This ref refers to the list view application area.
|
|
62
|
-
const listViewRef = (0, _element.useRef)();
|
|
63
|
-
|
|
64
|
-
/*
|
|
65
|
-
* Callback function to handle list view or close button focus.
|
|
66
|
-
*
|
|
67
|
-
* @return void
|
|
68
|
-
*/
|
|
69
|
-
function handleSidebarFocus() {
|
|
70
|
-
// Either focus the list view or the sidebar close button. Must have a fallback because the list view does not render when there are no blocks.
|
|
71
|
-
const listViewApplicationFocus = _dom.focus.tabbable.find(listViewRef.current)[0];
|
|
72
|
-
const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : sidebarCloseButtonRef.current;
|
|
73
|
-
listViewFocusArea.focus();
|
|
74
|
-
}
|
|
75
|
-
const handleToggleListViewShortcut = (0, _element.useCallback)(() => {
|
|
76
|
-
// If the sidebar has focus, it is safe to close.
|
|
77
|
-
if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) {
|
|
78
|
-
closeListView();
|
|
79
|
-
} else {
|
|
80
|
-
// If the list view or close button does not have focus, focus should be moved to it.
|
|
81
|
-
handleSidebarFocus();
|
|
82
|
-
}
|
|
83
|
-
}, [closeListView]);
|
|
84
|
-
|
|
85
|
-
// This only fires when the sidebar is open because of the conditional rendering.
|
|
86
|
-
// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.
|
|
87
|
-
(0, _keyboardShortcuts.useShortcut)('core/edit-site/toggle-list-view', handleToggleListViewShortcut);
|
|
88
|
-
return (
|
|
89
|
-
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
90
|
-
(0, _react.createElement)("div", {
|
|
91
|
-
className: "edit-site-editor__list-view-panel",
|
|
92
|
-
onKeyDown: closeOnEscape,
|
|
93
|
-
ref: sidebarRef
|
|
94
|
-
}, (0, _react.createElement)("div", {
|
|
95
|
-
className: "edit-site-editor__list-view-panel-header"
|
|
96
|
-
}, (0, _react.createElement)("strong", null, (0, _i18n.__)('List View')), (0, _react.createElement)(_components.Button, {
|
|
97
|
-
icon: _icons.closeSmall,
|
|
98
|
-
label: (0, _i18n.__)('Close'),
|
|
99
|
-
onClick: closeListView,
|
|
100
|
-
ref: sidebarCloseButtonRef
|
|
101
|
-
})), (0, _react.createElement)("div", {
|
|
102
|
-
className: "edit-site-editor__list-view-panel-content",
|
|
103
|
-
ref: (0, _compose.useMergeRefs)([focusOnMountRef, setDropZoneElement, listViewRef])
|
|
104
|
-
}, (0, _react.createElement)(PrivateListView, {
|
|
105
|
-
dropZoneElement: dropZoneElement
|
|
106
|
-
})))
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=list-view-sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_dom","_keyboardShortcuts","_store","_lockUnlock","PrivateListView","unlock","blockEditorPrivateApis","ListViewSidebar","listViewToggleElement","setIsListViewOpened","useDispatch","editSiteStore","focusOnMountRef","useFocusOnMount","closeListView","useCallback","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","dropZoneElement","setDropZoneElement","useState","sidebarRef","useRef","sidebarCloseButtonRef","listViewRef","handleSidebarFocus","listViewApplicationFocus","tabbable","find","current","listViewFocusArea","contains","handleToggleListViewShortcut","ownerDocument","activeElement","useShortcut","_react","createElement","className","onKeyDown","ref","__","Button","icon","closeSmall","label","onClick","useMergeRefs"],"sources":["@wordpress/edit-site/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PrivateListView } = unlock( blockEditorPrivateApis );\n\nexport default function ListViewSidebar( { listViewToggleElement } ) {\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\n\t// This hook handles focus when the sidebar first renders.\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tlistViewToggleElement?.focus();\n\t}, [ listViewToggleElement, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\t// This ref refers to the sidebar as a whole.\n\tconst sidebarRef = useRef();\n\t// This ref refers to the close button.\n\tconst sidebarCloseButtonRef = useRef();\n\t// This ref refers to the list view application area.\n\tconst listViewRef = useRef();\n\n\t/*\n\t * Callback function to handle list view or close button focus.\n\t *\n\t * @return void\n\t */\n\tfunction handleSidebarFocus() {\n\t\t// Either focus the list view or the sidebar close button. Must have a fallback because the list view does not render when there are no blocks.\n\t\tconst listViewApplicationFocus = focus.tabbable.find(\n\t\t\tlistViewRef.current\n\t\t)[ 0 ];\n\t\tconst listViewFocusArea = sidebarRef.current.contains(\n\t\t\tlistViewApplicationFocus\n\t\t)\n\t\t\t? listViewApplicationFocus\n\t\t\t: sidebarCloseButtonRef.current;\n\t\tlistViewFocusArea.focus();\n\t}\n\n\tconst handleToggleListViewShortcut = useCallback( () => {\n\t\t// If the sidebar has focus, it is safe to close.\n\t\tif (\n\t\t\tsidebarRef.current.contains(\n\t\t\t\tsidebarRef.current.ownerDocument.activeElement\n\t\t\t)\n\t\t) {\n\t\t\tcloseListView();\n\t\t} else {\n\t\t\t// If the list view or close button does not have focus, focus should be moved to it.\n\t\t\thandleSidebarFocus();\n\t\t}\n\t}, [ closeListView ] );\n\n\t// This only fires when the sidebar is open because of the conditional rendering.\n\t// It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed.\n\tuseShortcut(\n\t\t'core/edit-site/toggle-list-view',\n\t\thandleToggleListViewShortcut\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-site-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t\tref={ sidebarRef }\n\t\t>\n\t\t\t<div className=\"edit-site-editor__list-view-panel-header\">\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ closeListView }\n\t\t\t\t\tref={ sidebarCloseButtonRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\tsetDropZoneElement,\n\t\t\t\t\tlistViewRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<PrivateListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AAlBA;AACA;AACA;;AAYA;AACA;AACA;;AAIA,MAAM;EAAEY;AAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE7C,SAASC,eAAeA,CAAE;EAAEC;AAAsB,CAAC,EAAG;EACpE,MAAM;IAAEC;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;;EAE5D;EACA,MAAMC,eAAe,GAAG,IAAAC,wBAAe,EAAE,cAAe,CAAC;;EAEzD;EACA,MAAMC,aAAa,GAAG,IAAAC,oBAAW,EAAE,MAAM;IACxCN,mBAAmB,CAAE,KAAM,CAAC;IAC5BD,qBAAqB,EAAEQ,KAAK,CAAC,CAAC;EAC/B,CAAC,EAAE,CAAER,qBAAqB,EAAEC,mBAAmB,CAAG,CAAC;EAEnD,MAAMQ,aAAa,GAAG,IAAAF,oBAAW,EAC9BG,KAAK,IAAM;IACZ,IAAKA,KAAK,CAAC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3B,aAAe;MAC3B4B,GAAG,EAAGnB;IAAY,GAElB,IAAAe,MAAA,CAAAC,aAAA;MAAKC,SAAS,EAAC;IAA0C,GACxD,IAAAF,MAAA,CAAAC,aAAA,kBAAU,IAAAI,QAAE,EAAE,WAAY,CAAW,CAAC,EACtC,IAAAL,MAAA,CAAAC,aAAA,EAACjD,WAAA,CAAAsD,MAAM;MACNC,IAAI,EAAGC,iBAAY;MACnBC,KAAK,EAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAG;MACvBK,OAAO,EAAGrC,aAAe;MACzB+B,GAAG,EAAGjB;IAAuB,CAC7B,CACG,CAAC,EACN,IAAAa,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,2CAA2C;MACrDE,GAAG,EAAG,IAAAO,qBAAY,EAAE,CACnBxC,eAAe,EACfY,kBAAkB,EAClBK,WAAW,CACV;IAAG,GAEL,IAAAY,MAAA,CAAAC,aAAA,EAACtC,eAAe;MAACmB,eAAe,EAAGA;IAAiB,CAAE,CAClD,CACD;EAAC;AAER"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SidebarFixedBottomSlot = void 0;
|
|
7
|
-
exports.default = SidebarFixedBottom;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
createPrivateSlotFill
|
|
21
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
22
|
-
const SIDEBAR_FIXED_BOTTOM_SLOT_FILL_NAME = 'SidebarFixedBottom';
|
|
23
|
-
const {
|
|
24
|
-
Slot: SidebarFixedBottomSlot,
|
|
25
|
-
Fill: SidebarFixedBottomFill
|
|
26
|
-
} = createPrivateSlotFill(SIDEBAR_FIXED_BOTTOM_SLOT_FILL_NAME);
|
|
27
|
-
exports.SidebarFixedBottomSlot = SidebarFixedBottomSlot;
|
|
28
|
-
function SidebarFixedBottom({
|
|
29
|
-
children
|
|
30
|
-
}) {
|
|
31
|
-
return (0, _react.createElement)(SidebarFixedBottomFill, null, (0, _react.createElement)("div", {
|
|
32
|
-
className: "edit-site-sidebar-fixed-bottom-slot"
|
|
33
|
-
}, children));
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=sidebar-fixed-bottom.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_lockUnlock","createPrivateSlotFill","unlock","componentsPrivateApis","SIDEBAR_FIXED_BOTTOM_SLOT_FILL_NAME","Slot","SidebarFixedBottomSlot","Fill","SidebarFixedBottomFill","exports","SidebarFixedBottom","children","_react","createElement","className"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { createPrivateSlotFill } = unlock( componentsPrivateApis );\nconst SIDEBAR_FIXED_BOTTOM_SLOT_FILL_NAME = 'SidebarFixedBottom';\nconst { Slot: SidebarFixedBottomSlot, Fill: SidebarFixedBottomFill } =\n\tcreatePrivateSlotFill( SIDEBAR_FIXED_BOTTOM_SLOT_FILL_NAME );\n\nexport default function SidebarFixedBottom( { children } ) {\n\treturn (\n\t\t<SidebarFixedBottomFill>\n\t\t\t<div className=\"edit-site-sidebar-fixed-bottom-slot\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</SidebarFixedBottomFill>\n\t);\n}\n\nexport { SidebarFixedBottomSlot };\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEE;AAAsB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AACjE,MAAMC,mCAAmC,GAAG,oBAAoB;AAChE,MAAM;EAAEC,IAAI,EAAEC,sBAAsB;EAAEC,IAAI,EAAEC;AAAuB,CAAC,GACnEP,qBAAqB,CAAEG,mCAAoC,CAAC;AAACK,OAAA,CAAAH,sBAAA,GAAAA,sBAAA;AAE/C,SAASI,kBAAkBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC1D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACL,sBAAsB,QACtB,IAAAI,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAqC,GACjDH,QACE,CACkB,CAAC;AAE3B"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = LastRevision;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _icons = require("@wordpress/icons");
|
|
12
|
-
var _url = require("@wordpress/url");
|
|
13
|
-
var _editor = require("@wordpress/editor");
|
|
14
|
-
var _useEditedEntityRecord = _interopRequireDefault(require("../../use-edited-entity-record"));
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const useRevisionData = () => {
|
|
24
|
-
var _currentTemplate$_lin, _currentTemplate$_lin2;
|
|
25
|
-
const {
|
|
26
|
-
record: currentTemplate
|
|
27
|
-
} = (0, _useEditedEntityRecord.default)();
|
|
28
|
-
const lastRevisionId = (_currentTemplate$_lin = currentTemplate?._links?.['predecessor-version']?.[0]?.id) !== null && _currentTemplate$_lin !== void 0 ? _currentTemplate$_lin : null;
|
|
29
|
-
const revisionsCount = (_currentTemplate$_lin2 = currentTemplate?._links?.['version-history']?.[0]?.count) !== null && _currentTemplate$_lin2 !== void 0 ? _currentTemplate$_lin2 : 0;
|
|
30
|
-
return {
|
|
31
|
-
currentTemplate,
|
|
32
|
-
lastRevisionId,
|
|
33
|
-
revisionsCount
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
function PostLastRevisionCheck({
|
|
37
|
-
children
|
|
38
|
-
}) {
|
|
39
|
-
const {
|
|
40
|
-
lastRevisionId,
|
|
41
|
-
revisionsCount
|
|
42
|
-
} = useRevisionData();
|
|
43
|
-
if (!process.env.IS_GUTENBERG_PLUGIN) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
if (!lastRevisionId || revisionsCount < 2) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return (0, _react.createElement)(_editor.PostTypeSupportCheck, {
|
|
50
|
-
supportKeys: "revisions"
|
|
51
|
-
}, children);
|
|
52
|
-
}
|
|
53
|
-
const PostLastRevision = () => {
|
|
54
|
-
const {
|
|
55
|
-
lastRevisionId,
|
|
56
|
-
revisionsCount
|
|
57
|
-
} = useRevisionData();
|
|
58
|
-
return (0, _react.createElement)(PostLastRevisionCheck, null, (0, _react.createElement)(_components.PanelRow, {
|
|
59
|
-
header: (0, _i18n.__)('Editing history'),
|
|
60
|
-
className: "edit-site-template-revisions"
|
|
61
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
62
|
-
href: (0, _url.addQueryArgs)('revision.php', {
|
|
63
|
-
revision: lastRevisionId
|
|
64
|
-
}),
|
|
65
|
-
className: "edit-site-template-last-revision__title",
|
|
66
|
-
icon: _icons.backup
|
|
67
|
-
}, (0, _i18n.sprintf)( /* translators: %d: number of revisions */
|
|
68
|
-
(0, _i18n._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount))));
|
|
69
|
-
};
|
|
70
|
-
function LastRevision() {
|
|
71
|
-
return (0, _react.createElement)(PostLastRevisionCheck, null, (0, _react.createElement)(PostLastRevision, null));
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=last-revision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_icons","_url","_editor","_useEditedEntityRecord","_interopRequireDefault","useRevisionData","_currentTemplate$_lin","_currentTemplate$_lin2","record","currentTemplate","useEditedEntityRecord","lastRevisionId","_links","id","revisionsCount","count","PostLastRevisionCheck","children","process","env","IS_GUTENBERG_PLUGIN","_react","createElement","PostTypeSupportCheck","supportKeys","PostLastRevision","PanelRow","header","__","className","Button","href","addQueryArgs","revision","icon","backup","sprintf","_n","LastRevision"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/last-revision.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, PanelRow } from '@wordpress/components';\nimport { sprintf, _n, __ } from '@wordpress/i18n';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { PostTypeSupportCheck } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../../use-edited-entity-record';\n\nconst useRevisionData = () => {\n\tconst { record: currentTemplate } = useEditedEntityRecord();\n\n\tconst lastRevisionId =\n\t\tcurrentTemplate?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\n\tconst revisionsCount =\n\t\tcurrentTemplate?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\n\treturn {\n\t\tcurrentTemplate,\n\t\tlastRevisionId,\n\t\trevisionsCount,\n\t};\n};\n\nfunction PostLastRevisionCheck( { children } ) {\n\tconst { lastRevisionId, revisionsCount } = useRevisionData();\n\n\tif ( ! process.env.IS_GUTENBERG_PLUGIN ) {\n\t\treturn null;\n\t}\n\n\tif ( ! lastRevisionId || revisionsCount < 2 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostTypeSupportCheck supportKeys=\"revisions\">\n\t\t\t{ children }\n\t\t</PostTypeSupportCheck>\n\t);\n}\n\nconst PostLastRevision = () => {\n\tconst { lastRevisionId, revisionsCount } = useRevisionData();\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PanelRow\n\t\t\t\theader={ __( 'Editing history' ) }\n\t\t\t\tclassName=\"edit-site-template-revisions\"\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\thref={ addQueryArgs( 'revision.php', {\n\t\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t\t} ) }\n\t\t\t\t\tclassName=\"edit-site-template-last-revision__title\"\n\t\t\t\t\ticon={ backup }\n\t\t\t\t>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t\t_n( '%d Revision', '%d Revisions', revisionsCount ),\n\t\t\t\t\t\trevisionsCount\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t</PanelRow>\n\t\t</PostLastRevisionCheck>\n\t);\n};\n\nexport default function LastRevision() {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostLastRevision />\n\t\t</PostLastRevisionCheck>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,sBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAMO,eAAe,GAAGA,CAAA,KAAM;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAC7B,MAAM;IAAEC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iBAAY,EAAE,cAAc,EAAE;MACpCC,QAAQ,EAAEtB;IACX,CAAE,CAAG;IACLkB,SAAS,EAAC,yCAAyC;IACnDK,IAAI,EAAGC;EAAQ,GAEb,IAAAC,aAAO,GACR;EACA,IAAAC,QAAE,EAAE,aAAa,EAAE,cAAc,EAAEvB,cAAe,CAAC,EACnDA,cACD,CACO,CACC,CACY,CAAC;AAE1B,CAAC;AAEc,SAASwB,YAAYA,CAAA,EAAG;EACtC,OACC,IAAAjB,MAAA,CAAAC,aAAA,EAACN,qBAAqB,QACrB,IAAAK,MAAA,CAAAC,aAAA,EAACG,gBAAgB,MAAE,CACG,CAAC;AAE1B"}
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = PatternCategories;
|
|
7
|
-
exports.unescapeTerm = exports.unescapeString = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
var _components = require("@wordpress/components");
|
|
12
|
-
var _data = require("@wordpress/data");
|
|
13
|
-
var _coreData = require("@wordpress/core-data");
|
|
14
|
-
var _compose = require("@wordpress/compose");
|
|
15
|
-
var _notices = require("@wordpress/notices");
|
|
16
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
17
|
-
var _constants = require("../../../utils/constants");
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const unescapeString = arg => {
|
|
27
|
-
return (0, _htmlEntities.decodeEntities)(arg);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Returns a term object with name unescaped.
|
|
32
|
-
*
|
|
33
|
-
* @param {Object} term The term object to unescape.
|
|
34
|
-
*
|
|
35
|
-
* @return {Object} Term object with name property unescaped.
|
|
36
|
-
*/
|
|
37
|
-
exports.unescapeString = unescapeString;
|
|
38
|
-
const unescapeTerm = term => {
|
|
39
|
-
return {
|
|
40
|
-
...term,
|
|
41
|
-
name: unescapeString(term.name)
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Shared reference to an empty array for cases where it is important to avoid
|
|
47
|
-
* returning a new array reference on every invocation.
|
|
48
|
-
*
|
|
49
|
-
* @type {Array<any>}
|
|
50
|
-
*/
|
|
51
|
-
exports.unescapeTerm = unescapeTerm;
|
|
52
|
-
const EMPTY_ARRAY = [];
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Module constants
|
|
56
|
-
*/
|
|
57
|
-
const MAX_TERMS_SUGGESTIONS = 20;
|
|
58
|
-
const DEFAULT_QUERY = {
|
|
59
|
-
per_page: MAX_TERMS_SUGGESTIONS,
|
|
60
|
-
_fields: 'id,name',
|
|
61
|
-
context: 'view'
|
|
62
|
-
};
|
|
63
|
-
const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
|
|
64
|
-
const termNamesToIds = (names, terms) => {
|
|
65
|
-
return names.map(termName => terms.find(term => isSameTermName(term.name, termName)).id);
|
|
66
|
-
};
|
|
67
|
-
function PatternCategories({
|
|
68
|
-
post
|
|
69
|
-
}) {
|
|
70
|
-
var _taxonomy$labels$sing;
|
|
71
|
-
const slug = 'wp_pattern_category';
|
|
72
|
-
const [values, setValues] = (0, _element.useState)([]);
|
|
73
|
-
const [search, setSearch] = (0, _element.useState)('');
|
|
74
|
-
const debouncedSearch = (0, _compose.useDebounce)(setSearch, 500);
|
|
75
|
-
const {
|
|
76
|
-
terms,
|
|
77
|
-
taxonomy,
|
|
78
|
-
hasAssignAction,
|
|
79
|
-
hasCreateAction,
|
|
80
|
-
hasResolvedTerms
|
|
81
|
-
} = (0, _data.useSelect)(select => {
|
|
82
|
-
var _post$_links, _post$_links2;
|
|
83
|
-
const {
|
|
84
|
-
getEntityRecords,
|
|
85
|
-
getTaxonomy,
|
|
86
|
-
hasFinishedResolution
|
|
87
|
-
} = select(_coreData.store);
|
|
88
|
-
const _taxonomy = getTaxonomy(slug);
|
|
89
|
-
const _termIds = post?.wp_pattern_category?.length > 0 ? post?.wp_pattern_category : EMPTY_ARRAY;
|
|
90
|
-
const query = {
|
|
91
|
-
...DEFAULT_QUERY,
|
|
92
|
-
include: _termIds?.join(','),
|
|
93
|
-
per_page: -1
|
|
94
|
-
};
|
|
95
|
-
return {
|
|
96
|
-
hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
|
|
97
|
-
hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
|
|
98
|
-
taxonomy: _taxonomy,
|
|
99
|
-
termIds: _termIds,
|
|
100
|
-
terms: _termIds?.length ? getEntityRecords('taxonomy', slug, query) : EMPTY_ARRAY,
|
|
101
|
-
hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
|
|
102
|
-
};
|
|
103
|
-
}, [slug, post]);
|
|
104
|
-
const {
|
|
105
|
-
searchResults
|
|
106
|
-
} = (0, _data.useSelect)(select => {
|
|
107
|
-
const {
|
|
108
|
-
getEntityRecords
|
|
109
|
-
} = select(_coreData.store);
|
|
110
|
-
return {
|
|
111
|
-
searchResults: !!search ? getEntityRecords('taxonomy', slug, {
|
|
112
|
-
...DEFAULT_QUERY,
|
|
113
|
-
search
|
|
114
|
-
}) : EMPTY_ARRAY
|
|
115
|
-
};
|
|
116
|
-
}, [search, slug]);
|
|
117
|
-
|
|
118
|
-
// Update terms state only after the selectors are resolved.
|
|
119
|
-
// We're using this to avoid terms temporarily disappearing on slow networks
|
|
120
|
-
// while core data makes REST API requests.
|
|
121
|
-
(0, _element.useEffect)(() => {
|
|
122
|
-
if (hasResolvedTerms) {
|
|
123
|
-
const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name));
|
|
124
|
-
setValues(newValues);
|
|
125
|
-
}
|
|
126
|
-
}, [terms, hasResolvedTerms]);
|
|
127
|
-
const suggestions = (0, _element.useMemo)(() => {
|
|
128
|
-
return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name));
|
|
129
|
-
}, [searchResults]);
|
|
130
|
-
const {
|
|
131
|
-
saveEntityRecord,
|
|
132
|
-
editEntityRecord,
|
|
133
|
-
invalidateResolution
|
|
134
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
135
|
-
const {
|
|
136
|
-
createErrorNotice
|
|
137
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
138
|
-
if (!hasAssignAction) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
async function findOrCreateTerm(term) {
|
|
142
|
-
try {
|
|
143
|
-
const newTerm = await saveEntityRecord('taxonomy', slug, term, {
|
|
144
|
-
throwOnError: true
|
|
145
|
-
});
|
|
146
|
-
invalidateResolution('getUserPatternCategories');
|
|
147
|
-
return unescapeTerm(newTerm);
|
|
148
|
-
} catch (error) {
|
|
149
|
-
if (error.code !== 'term_exists') {
|
|
150
|
-
throw error;
|
|
151
|
-
}
|
|
152
|
-
return {
|
|
153
|
-
id: error.data.term_id,
|
|
154
|
-
name: term.name
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function onUpdateTerms(newTermIds) {
|
|
159
|
-
editEntityRecord('postType', _constants.PATTERN_TYPES.user, post.id, {
|
|
160
|
-
wp_pattern_category: newTermIds
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function onChange(termNames) {
|
|
164
|
-
const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
|
|
165
|
-
const uniqueTerms = termNames.reduce((acc, name) => {
|
|
166
|
-
if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
|
|
167
|
-
acc.push(name);
|
|
168
|
-
}
|
|
169
|
-
return acc;
|
|
170
|
-
}, []);
|
|
171
|
-
const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName)));
|
|
172
|
-
|
|
173
|
-
// Optimistically update term values.
|
|
174
|
-
// The selector will always re-fetch terms later.
|
|
175
|
-
setValues(uniqueTerms);
|
|
176
|
-
if (newTermNames.length === 0) {
|
|
177
|
-
return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
|
|
178
|
-
}
|
|
179
|
-
if (!hasCreateAction) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
Promise.all(newTermNames.map(termName => findOrCreateTerm({
|
|
183
|
-
name: termName
|
|
184
|
-
}))).then(newTerms => {
|
|
185
|
-
const newAvailableTerms = availableTerms.concat(newTerms);
|
|
186
|
-
return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
|
|
187
|
-
}).catch(error => {
|
|
188
|
-
createErrorNotice(error.message, {
|
|
189
|
-
type: 'snackbar'
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
const singularName = (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : slug === 'post_tag' ? (0, _i18n.__)('Tag') : (0, _i18n.__)('Term');
|
|
194
|
-
const termAddedLabel = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
195
|
-
(0, _i18n._x)('%s added', 'term'), singularName);
|
|
196
|
-
const termRemovedLabel = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
197
|
-
(0, _i18n._x)('%s removed', 'term'), singularName);
|
|
198
|
-
const removeTermLabel = (0, _i18n.sprintf)( /* translators: %s: term name. */
|
|
199
|
-
(0, _i18n._x)('Remove %s', 'term'), singularName);
|
|
200
|
-
return (0, _react.createElement)(_components.PanelRow, {
|
|
201
|
-
initialOpen: true,
|
|
202
|
-
title: (0, _i18n.__)('Categories')
|
|
203
|
-
}, (0, _react.createElement)(_components.FlexBlock, null, (0, _react.createElement)(_components.FormTokenField, {
|
|
204
|
-
__next40pxDefaultSize: true,
|
|
205
|
-
value: values,
|
|
206
|
-
suggestions: suggestions,
|
|
207
|
-
onChange: onChange,
|
|
208
|
-
onInputChange: debouncedSearch,
|
|
209
|
-
maxSuggestions: MAX_TERMS_SUGGESTIONS,
|
|
210
|
-
label: (0, _i18n.__)('Pattern categories'),
|
|
211
|
-
messages: {
|
|
212
|
-
added: termAddedLabel,
|
|
213
|
-
removed: termRemovedLabel,
|
|
214
|
-
remove: removeTermLabel
|
|
215
|
-
},
|
|
216
|
-
tokenizeOnBlur: true
|
|
217
|
-
})));
|
|
218
|
-
}
|
|
219
|
-
//# sourceMappingURL=pattern-categories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_components","_data","_coreData","_compose","_notices","_htmlEntities","_constants","unescapeString","arg","decodeEntities","exports","unescapeTerm","term","name","EMPTY_ARRAY","MAX_TERMS_SUGGESTIONS","DEFAULT_QUERY","per_page","_fields","context","isSameTermName","termA","termB","toLowerCase","termNamesToIds","names","terms","map","termName","find","id","PatternCategories","post","_taxonomy$labels$sing","slug","values","setValues","useState","search","setSearch","debouncedSearch","useDebounce","taxonomy","hasAssignAction","hasCreateAction","hasResolvedTerms","useSelect","select","_post$_links","_post$_links2","getEntityRecords","getTaxonomy","hasFinishedResolution","coreStore","_taxonomy","_termIds","wp_pattern_category","length","query","include","join","_links","rest_base","termIds","searchResults","useEffect","newValues","suggestions","useMemo","saveEntityRecord","editEntityRecord","invalidateResolution","useDispatch","createErrorNotice","noticesStore","findOrCreateTerm","newTerm","throwOnError","error","code","data","term_id","onUpdateTerms","newTermIds","PATTERN_TYPES","user","onChange","termNames","availableTerms","uniqueTerms","reduce","acc","some","n","push","newTermNames","filter","Promise","all","then","newTerms","newAvailableTerms","concat","catch","message","type","singularName","labels","singular_name","__","termAddedLabel","sprintf","_x","termRemovedLabel","removeTermLabel","_react","createElement","PanelRow","initialOpen","title","FlexBlock","FormTokenField","__next40pxDefaultSize","value","onInputChange","maxSuggestions","label","messages","added","removed","remove","tokenizeOnBlur"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/pattern-categories.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport { FormTokenField, FlexBlock, PanelRow } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_TYPES } from '../../../utils/constants';\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation.\n *\n * @type {Array<any>}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Module constants\n */\nconst MAX_TERMS_SUGGESTIONS = 20;\nconst DEFAULT_QUERY = {\n\tper_page: MAX_TERMS_SUGGESTIONS,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nconst isSameTermName = ( termA, termB ) =>\n\tunescapeString( termA ).toLowerCase() ===\n\tunescapeString( termB ).toLowerCase();\n\nconst termNamesToIds = ( names, terms ) => {\n\treturn names.map(\n\t\t( termName ) =>\n\t\t\tterms.find( ( term ) => isSameTermName( term.name, termName ) ).id\n\t);\n};\n\nexport default function PatternCategories( { post } ) {\n\tconst slug = 'wp_pattern_category';\n\tconst [ values, setValues ] = useState( [] );\n\tconst [ search, setSearch ] = useState( '' );\n\tconst debouncedSearch = useDebounce( setSearch, 500 );\n\n\tconst {\n\t\tterms,\n\t\ttaxonomy,\n\t\thasAssignAction,\n\t\thasCreateAction,\n\t\thasResolvedTerms,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst _termIds =\n\t\t\t\tpost?.wp_pattern_category?.length > 0\n\t\t\t\t\t? post?.wp_pattern_category\n\t\t\t\t\t: EMPTY_ARRAY;\n\t\t\tconst query = {\n\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\tinclude: _termIds?.join( ',' ),\n\t\t\t\tper_page: -1,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t\ttermIds: _termIds,\n\t\t\t\tterms: _termIds?.length\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, query )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\thasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ slug, post ]\n\t);\n\n\tconst { searchResults } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tsearchResults: !! search\n\t\t\t\t\t? getEntityRecords( 'taxonomy', slug, {\n\t\t\t\t\t\t\t...DEFAULT_QUERY,\n\t\t\t\t\t\t\tsearch,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t};\n\t\t},\n\t\t[ search, slug ]\n\t);\n\n\t// Update terms state only after the selectors are resolved.\n\t// We're using this to avoid terms temporarily disappearing on slow networks\n\t// while core data makes REST API requests.\n\tuseEffect( () => {\n\t\tif ( hasResolvedTerms ) {\n\t\t\tconst newValues = ( terms ?? [] ).map( ( term ) =>\n\t\t\t\tunescapeString( term.name )\n\t\t\t);\n\n\t\t\tsetValues( newValues );\n\t\t}\n\t}, [ terms, hasResolvedTerms ] );\n\n\tconst suggestions = useMemo( () => {\n\t\treturn ( searchResults ?? [] ).map( ( term ) =>\n\t\t\tunescapeString( term.name )\n\t\t);\n\t}, [ searchResults ] );\n\n\tconst { saveEntityRecord, editEntityRecord, invalidateResolution } =\n\t\tuseDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\tasync function findOrCreateTerm( term ) {\n\t\ttry {\n\t\t\tconst newTerm = await saveEntityRecord( 'taxonomy', slug, term, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tinvalidateResolution( 'getUserPatternCategories' );\n\t\t\treturn unescapeTerm( newTerm );\n\t\t} catch ( error ) {\n\t\t\tif ( error.code !== 'term_exists' ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tid: error.data.term_id,\n\t\t\t\tname: term.name,\n\t\t\t};\n\t\t}\n\t}\n\n\tfunction onUpdateTerms( newTermIds ) {\n\t\teditEntityRecord( 'postType', PATTERN_TYPES.user, post.id, {\n\t\t\twp_pattern_category: newTermIds,\n\t\t} );\n\t}\n\n\tfunction onChange( termNames ) {\n\t\tconst availableTerms = [\n\t\t\t...( terms ?? [] ),\n\t\t\t...( searchResults ?? [] ),\n\t\t];\n\t\tconst uniqueTerms = termNames.reduce( ( acc, name ) => {\n\t\t\tif (\n\t\t\t\t! acc.some( ( n ) => n.toLowerCase() === name.toLowerCase() )\n\t\t\t) {\n\t\t\t\tacc.push( name );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\t\tconst newTermNames = uniqueTerms.filter(\n\t\t\t( termName ) =>\n\t\t\t\t! availableTerms.find( ( term ) =>\n\t\t\t\t\tisSameTermName( term.name, termName )\n\t\t\t\t)\n\t\t);\n\n\t\t// Optimistically update term values.\n\t\t// The selector will always re-fetch terms later.\n\t\tsetValues( uniqueTerms );\n\n\t\tif ( newTermNames.length === 0 ) {\n\t\t\treturn onUpdateTerms(\n\t\t\t\ttermNamesToIds( uniqueTerms, availableTerms )\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasCreateAction ) {\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.all(\n\t\t\tnewTermNames.map( ( termName ) =>\n\t\t\t\tfindOrCreateTerm( { name: termName } )\n\t\t\t)\n\t\t)\n\t\t\t.then( ( newTerms ) => {\n\t\t\t\tconst newAvailableTerms = availableTerms.concat( newTerms );\n\t\t\t\treturn onUpdateTerms(\n\t\t\t\t\ttermNamesToIds( uniqueTerms, newAvailableTerms )\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.catch( ( error ) => {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} );\n\t}\n\n\tconst singularName =\n\t\ttaxonomy?.labels?.singular_name ??\n\t\t( slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' ) );\n\tconst termAddedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s added', 'term' ),\n\t\tsingularName\n\t);\n\tconst termRemovedLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( '%s removed', 'term' ),\n\t\tsingularName\n\t);\n\tconst removeTermLabel = sprintf(\n\t\t/* translators: %s: term name. */\n\t\t_x( 'Remove %s', 'term' ),\n\t\tsingularName\n\t);\n\n\treturn (\n\t\t<PanelRow initialOpen={ true } title={ __( 'Categories' ) }>\n\t\t\t<FlexBlock>\n\t\t\t\t<FormTokenField\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvalue={ values }\n\t\t\t\t\tsuggestions={ suggestions }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\t\tmaxSuggestions={ MAX_TERMS_SUGGESTIONS }\n\t\t\t\t\tlabel={ __( 'Pattern categories' ) }\n\t\t\t\t\tmessages={ {\n\t\t\t\t\t\tadded: termAddedLabel,\n\t\t\t\t\t\tremoved: termRemovedLabel,\n\t\t\t\t\t\tremove: removeTermLabel,\n\t\t\t\t\t} }\n\t\t\t\t\ttokenizeOnBlur\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t</PanelRow>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAKA,IAAAQ,UAAA,GAAAR,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGO,MAAMS,cAAc,GAAKC,GAAG,IAAM;EACxC,OAAO,IAAAC,4BAAc,EAAED,GAAI,CAAC;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANAE,OAAA,CAAAH,cAAA,GAAAA,cAAA;AAOO,MAAMI,YAAY,GAA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,MAAA,CAAAC,aAAA,EAACpH,WAAA,CAAAqH,QAAQ;IAACC,WAAW,EAAG,IAAM;IAACC,KAAK,EAAG,IAAAV,QAAE,EAAE,YAAa;EAAG,GAC1D,IAAAM,MAAA,CAAAC,aAAA,EAACpH,WAAA,CAAAwH,SAAS,QACT,IAAAL,MAAA,CAAAC,aAAA,EAACpH,WAAA,CAAAyH,cAAc;IACdC,qBAAqB;IACrBC,KAAK,EAAGxF,MAAQ;IAChBgC,WAAW,EAAGA,WAAa;IAC3BmB,QAAQ,EAAGA,QAAU;IACrBsC,aAAa,EAAGpF,eAAiB;IACjCqF,cAAc,EAAG9G,qBAAuB;IACxC+G,KAAK,EAAG,IAAAjB,QAAE,EAAE,oBAAqB,CAAG;IACpCkB,QAAQ,EAAG;MACVC,KAAK,EAAElB,cAAc;MACrBmB,OAAO,EAAEhB,gBAAgB;MACzBiB,MAAM,EAAEhB;IACT,CAAG;IACHiB,cAAc;EAAA,CACd,CACS,CACF,CAAC;AAEb"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalText","Text","__experimentalHeading","Heading","__experimentalVStack","VStack","__experimentalSpacer","Spacer","__experimentalHStack","HStack","Button","chevronLeft","TabLayout","title","description","handleBack","children","footer","createElement","className","margin","spacing","justify","variant","onClick","icon","size","level"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/tab-layout.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalText as Text,\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalHStack as HStack,\n\tButton,\n} from '@wordpress/components';\nimport { chevronLeft } from '@wordpress/icons';\n\nfunction TabLayout( { title, description, handleBack, children, footer } ) {\n\treturn (\n\t\t<div className=\"font-library-modal__tab-layout\">\n\t\t\t<Spacer margin={ 4 } />\n\t\t\t<VStack spacing={ 4 } justify=\"space-between\">\n\t\t\t\t<header>\n\t\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t{ !! handleBack && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ handleBack }\n\t\t\t\t\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\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{ title && (\n\t\t\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-header\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t{ description && <Text>{ description }</Text> }\n\t\t\t\t\t</VStack>\n\t\t\t\t</header>\n\t\t\t\t<main>{ children }</main>\n\t\t\t\t{ footer && <footer>{ footer }</footer> }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default TabLayout;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,kBAAkB,IAAIC,IAAI,EAC1BC,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,SAASC,SAASA,CAAE;EAAEC,KAAK;EAAEC,WAAW;EAAEC,UAAU;EAAEC,QAAQ;EAAEC;AAAO,CAAC,EAAG;EAC1E,OACCC,aAAA;IAAKC,SAAS,EAAC;EAAgC,GAC9CD,aAAA,CAACX,MAAM;IAACa,MAAM,EAAG;EAAG,CAAE,CAAC,EACvBF,aAAA,CAACb,MAAM;IAACgB,OAAO,EAAG,CAAG;IAACC,OAAO,EAAC;EAAe,GAC5CJ,aAAA,iBACCA,aAAA,CAACb,MAAM;IAACgB,OAAO,EAAG;EAAG,GACpBH,aAAA,CAACT,MAAM;IAACa,OAAO,EAAC;EAAY,GACzB,CAAC,CAAEP,UAAU,IACdG,aAAA,CAACR,MAAM;IACNa,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGT,UAAY;IACtBU,IAAI,EAAGd,WAAa;IACpBe,IAAI,EAAC;EAAO,CACZ,CACD,EACCb,KAAK,IACNK,aAAA,CAACf,OAAO;IACPwB,KAAK,EAAG,CAAG;IACXD,IAAI,EAAG,EAAI;IACXP,SAAS,EAAC;EAAgC,GAExCN,KACM,CAEH,CAAC,EACPC,WAAW,IAAII,aAAA,CAACjB,IAAI,QAAGa,WAAmB,CACrC,CACD,CAAC,EACTI,aAAA,eAAQF,QAAgB,CAAC,EACvBC,MAAM,IAAIC,aAAA,iBAAUD,MAAgB,CAC/B,CACJ,CAAC;AAER;AAEA,eAAeL,SAAS"}
|