@wordpress/edit-site 5.28.3 → 5.28.5
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/build/components/global-styles/font-library-modal/collection-font-variant.js +2 -2
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +51 -58
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +10 -15
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +115 -62
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +29 -8
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +17 -4
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +151 -79
- 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 +2 -2
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +8 -14
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +11 -4
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +2 -2
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/ui.js +27 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/index.js +1 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/page-patterns/index.js +14 -14
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +2 -1
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +2 -0
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +2 -0
- package/build/components/style-book/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +4 -4
- 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/context.js +51 -58
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +11 -16
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +118 -65
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -9
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +17 -4
- 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 +151 -79
- 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 +4 -4
- 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/upload-fonts.js +9 -15
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +11 -4
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +2 -2
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/ui.js +27 -2
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +1 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +14 -14
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +2 -1
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +3 -1
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +2 -0
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-style/style-rtl.css +36 -23
- package/build-style/style.css +36 -23
- package/package.json +18 -18
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +4 -4
- package/src/components/global-styles/font-library-modal/context.js +92 -104
- package/src/components/global-styles/font-library-modal/font-card.js +11 -26
- package/src/components/global-styles/font-library-modal/font-collection.js +307 -211
- package/src/components/global-styles/font-library-modal/font-demo.js +38 -4
- package/src/components/global-styles/font-library-modal/index.js +21 -14
- package/src/components/global-styles/font-library-modal/installed-fonts.js +243 -114
- package/src/components/global-styles/font-library-modal/library-font-variant.js +4 -4
- package/src/components/global-styles/font-library-modal/style.scss +15 -8
- package/src/components/global-styles/font-library-modal/upload-fonts.js +16 -18
- package/src/components/global-styles/font-library-modal/utils/index.js +10 -4
- package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +7 -18
- package/src/components/global-styles/screen-revisions/index.js +5 -2
- package/src/components/global-styles/ui.js +26 -2
- package/src/components/header-edit-mode/index.js +3 -1
- package/src/components/page-patterns/index.js +20 -20
- package/src/components/resizable-frame/index.js +1 -0
- package/src/components/sidebar/index.js +2 -1
- package/src/components/sidebar-dataviews/default-views.js +3 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +5 -3
- package/src/components/style-book/index.js +5 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js +0 -50
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -30
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js +0 -39
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js +0 -67
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js +0 -42
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -23
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js +0 -31
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +0 -60
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
- package/src/components/global-styles/font-library-modal/collection-font-details.js +0 -56
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -33
- package/src/components/global-styles/font-library-modal/library-font-card.js +0 -34
- package/src/components/global-styles/font-library-modal/tab-panel-layout.js +0 -85
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
-
Button,
|
|
7
|
-
DropZone,
|
|
8
6
|
__experimentalSpacer as Spacer,
|
|
9
7
|
__experimentalText as Text,
|
|
10
8
|
__experimentalVStack as VStack,
|
|
9
|
+
Button,
|
|
10
|
+
DropZone,
|
|
11
|
+
Notice,
|
|
11
12
|
FormFileUpload,
|
|
12
13
|
FlexItem,
|
|
13
14
|
privateApis as componentsPrivateApis,
|
|
@@ -22,13 +23,13 @@ import { FontLibraryContext } from './context';
|
|
|
22
23
|
import { Font } from '../../../../lib/lib-font.browser';
|
|
23
24
|
import makeFamiliesFromFaces from './utils/make-families-from-faces';
|
|
24
25
|
import { loadFontFaceInBrowser } from './utils';
|
|
25
|
-
import TabPanelLayout from './tab-panel-layout';
|
|
26
26
|
import { unlock } from '../../../lock-unlock';
|
|
27
27
|
|
|
28
28
|
const { ProgressBar } = unlock( componentsPrivateApis );
|
|
29
29
|
|
|
30
30
|
function UploadFonts() {
|
|
31
|
-
const {
|
|
31
|
+
const { installFonts, notice, setNotice } =
|
|
32
|
+
useContext( FontLibraryContext );
|
|
32
33
|
const [ isUploading, setIsUploading ] = useState( false );
|
|
33
34
|
|
|
34
35
|
const handleDropZone = ( files ) => {
|
|
@@ -143,19 +144,8 @@ function UploadFonts() {
|
|
|
143
144
|
const handleInstall = async ( fontFaces ) => {
|
|
144
145
|
const fontFamilies = makeFamiliesFromFaces( fontFaces );
|
|
145
146
|
|
|
146
|
-
if ( fontFamilies.length > 1 ) {
|
|
147
|
-
setNotice( {
|
|
148
|
-
type: 'error',
|
|
149
|
-
message: __(
|
|
150
|
-
'Variants from only one font family can be uploaded at a time.'
|
|
151
|
-
),
|
|
152
|
-
} );
|
|
153
|
-
setIsUploading( false );
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
147
|
try {
|
|
158
|
-
await
|
|
148
|
+
await installFonts( fontFamilies );
|
|
159
149
|
setNotice( {
|
|
160
150
|
type: 'success',
|
|
161
151
|
message: __( 'Fonts were installed successfully.' ),
|
|
@@ -171,9 +161,17 @@ function UploadFonts() {
|
|
|
171
161
|
};
|
|
172
162
|
|
|
173
163
|
return (
|
|
174
|
-
<
|
|
164
|
+
<div className="font-library-modal__tabpanel-layout">
|
|
175
165
|
<DropZone onFilesDrop={ handleDropZone } />
|
|
176
166
|
<VStack className="font-library-modal__local-fonts">
|
|
167
|
+
{ notice && (
|
|
168
|
+
<Notice
|
|
169
|
+
status={ notice.type }
|
|
170
|
+
onRemove={ () => setNotice( null ) }
|
|
171
|
+
>
|
|
172
|
+
{ notice.message }
|
|
173
|
+
</Notice>
|
|
174
|
+
) }
|
|
177
175
|
{ isUploading && (
|
|
178
176
|
<FlexItem>
|
|
179
177
|
<div className="font-library-modal__upload-area">
|
|
@@ -205,7 +203,7 @@ function UploadFonts() {
|
|
|
205
203
|
) }
|
|
206
204
|
</Text>
|
|
207
205
|
</VStack>
|
|
208
|
-
</
|
|
206
|
+
</div>
|
|
209
207
|
);
|
|
210
208
|
}
|
|
211
209
|
|
|
@@ -121,7 +121,13 @@ export async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Retrieves the display source from a font face src.
|
|
126
|
+
*
|
|
127
|
+
* @param {string|string[]} input - The font face src.
|
|
128
|
+
* @return {string|undefined} The display source or undefined if the input is invalid.
|
|
129
|
+
*/
|
|
130
|
+
export function getDisplaySrcFromFontFace( input ) {
|
|
125
131
|
if ( ! input ) {
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
@@ -132,9 +138,9 @@ export function getDisplaySrcFromFontFace( input, urlPrefix ) {
|
|
|
132
138
|
} else {
|
|
133
139
|
src = input;
|
|
134
140
|
}
|
|
135
|
-
//
|
|
136
|
-
if ( src.startsWith( 'file:.' )
|
|
137
|
-
|
|
141
|
+
// It's expected theme fonts will already be loaded in the browser.
|
|
142
|
+
if ( src.startsWith( 'file:.' ) ) {
|
|
143
|
+
return;
|
|
138
144
|
}
|
|
139
145
|
if ( ! isUrlEncoded( src ) ) {
|
|
140
146
|
src = encodeURI( src );
|
package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js
CHANGED
|
@@ -21,33 +21,22 @@ describe( 'getDisplaySrcFromFontFace', () => {
|
|
|
21
21
|
);
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
|
-
it( '
|
|
25
|
-
const input = 'file:./font1';
|
|
26
|
-
|
|
27
|
-
expect( getDisplaySrcFromFontFace( input, urlPrefix ) ).toBe(
|
|
28
|
-
'http://example.com/font1'
|
|
29
|
-
);
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
it( 'does not modify URL if it does not start with file:.', () => {
|
|
33
|
-
const input = [ 'http://some-other-place.com/font1' ];
|
|
34
|
-
const urlPrefix = 'http://example.com';
|
|
35
|
-
expect( getDisplaySrcFromFontFace( input, urlPrefix ) ).toBe(
|
|
36
|
-
'http://some-other-place.com/font1'
|
|
37
|
-
);
|
|
24
|
+
it( 'return undefined when the url starts with file:', () => {
|
|
25
|
+
const input = 'file:./theme/assets/font1.ttf';
|
|
26
|
+
expect( getDisplaySrcFromFontFace( input ) ).toBe( undefined );
|
|
38
27
|
} );
|
|
39
28
|
|
|
40
29
|
it( 'encodes the URL if it is not encoded', () => {
|
|
41
|
-
const input = '
|
|
30
|
+
const input = 'https://example.org/font one with spaces.ttf';
|
|
42
31
|
expect( getDisplaySrcFromFontFace( input ) ).toBe(
|
|
43
|
-
'
|
|
32
|
+
'https://example.org/font%20one%20with%20spaces.ttf'
|
|
44
33
|
);
|
|
45
34
|
} );
|
|
46
35
|
|
|
47
36
|
it( 'does not encode the URL if it is already encoded', () => {
|
|
48
|
-
const input = '
|
|
37
|
+
const input = 'https://example.org/fonts/font%20one.ttf';
|
|
49
38
|
expect( getDisplaySrcFromFontFace( input ) ).toBe(
|
|
50
|
-
'
|
|
39
|
+
'https://example.org/fonts/font%20one.ttf'
|
|
51
40
|
);
|
|
52
41
|
} );
|
|
53
42
|
} );
|
|
@@ -73,7 +73,11 @@ function ScreenRevisions() {
|
|
|
73
73
|
|
|
74
74
|
const onCloseRevisions = () => {
|
|
75
75
|
goTo( '/' ); // Return to global styles main panel.
|
|
76
|
-
|
|
76
|
+
const canvasContainerView =
|
|
77
|
+
editorCanvasContainerView === 'global-styles-revisions:style-book'
|
|
78
|
+
? 'style-book'
|
|
79
|
+
: undefined;
|
|
80
|
+
setEditorCanvasContainerView( canvasContainerView );
|
|
77
81
|
};
|
|
78
82
|
|
|
79
83
|
const restoreRevision = ( revision ) => {
|
|
@@ -99,7 +103,6 @@ function ScreenRevisions() {
|
|
|
99
103
|
! editorCanvasContainerView.startsWith( 'global-styles-revisions' )
|
|
100
104
|
) {
|
|
101
105
|
goTo( '/' ); // Return to global styles main panel.
|
|
102
|
-
setEditorCanvasContainerView( editorCanvasContainerView );
|
|
103
106
|
}
|
|
104
107
|
}, [ editorCanvasContainerView ] );
|
|
105
108
|
|
|
@@ -230,12 +230,14 @@ function GlobalStylesBlockLink() {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
function GlobalStylesEditorCanvasContainerLink() {
|
|
233
|
-
const { goTo } = useNavigator();
|
|
233
|
+
const { goTo, location } = useNavigator();
|
|
234
234
|
const editorCanvasContainerView = useSelect(
|
|
235
235
|
( select ) =>
|
|
236
236
|
unlock( select( editSiteStore ) ).getEditorCanvasContainerView(),
|
|
237
237
|
[]
|
|
238
238
|
);
|
|
239
|
+
const path = location?.path;
|
|
240
|
+
const isRevisionsOpen = path === '/revisions';
|
|
239
241
|
|
|
240
242
|
// If the user switches the editor canvas container view, redirect
|
|
241
243
|
// to the appropriate screen. This effectively allows deep linking to the
|
|
@@ -249,11 +251,33 @@ function GlobalStylesEditorCanvasContainerLink() {
|
|
|
249
251
|
case 'global-styles-css':
|
|
250
252
|
goTo( '/css' );
|
|
251
253
|
break;
|
|
254
|
+
case 'style-book':
|
|
255
|
+
/*
|
|
256
|
+
* The stand-alone style book is open
|
|
257
|
+
* and the revisions panel is open,
|
|
258
|
+
* close the revisions panel.
|
|
259
|
+
* Otherwise keep the style book open while
|
|
260
|
+
* browsing global styles panel.
|
|
261
|
+
*/
|
|
262
|
+
if ( isRevisionsOpen ) {
|
|
263
|
+
goTo( '/' );
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
252
266
|
default:
|
|
267
|
+
/*
|
|
268
|
+
* Example: the user has navigated to "Browse styles" or elsewhere
|
|
269
|
+
* and changes the editorCanvasContainerView, e.g., closes the style book.
|
|
270
|
+
* The panel should not be affected.
|
|
271
|
+
* Exclude revisions panel from this behavior,
|
|
272
|
+
* as it should close when the editorCanvasContainerView doesn't correspond.
|
|
273
|
+
*/
|
|
274
|
+
if ( path !== '/' && ! isRevisionsOpen ) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
253
277
|
goTo( '/' );
|
|
254
278
|
break;
|
|
255
279
|
}
|
|
256
|
-
}, [ editorCanvasContainerView, goTo ] );
|
|
280
|
+
}, [ editorCanvasContainerView, isRevisionsOpen, goTo ] );
|
|
257
281
|
}
|
|
258
282
|
|
|
259
283
|
function GlobalStylesUI() {
|
|
@@ -134,7 +134,9 @@ export default function HeaderEditMode() {
|
|
|
134
134
|
className={ classnames(
|
|
135
135
|
'selected-block-tools-wrapper',
|
|
136
136
|
{
|
|
137
|
-
'is-collapsed':
|
|
137
|
+
'is-collapsed':
|
|
138
|
+
isBlockToolsCollapsed ||
|
|
139
|
+
! hasBlockSelected,
|
|
138
140
|
}
|
|
139
141
|
) }
|
|
140
142
|
>
|
|
@@ -210,6 +210,26 @@ function Title( { item, categoryId } ) {
|
|
|
210
210
|
}
|
|
211
211
|
return (
|
|
212
212
|
<HStack alignment="center" justify="flex-start" spacing={ 2 }>
|
|
213
|
+
<Flex
|
|
214
|
+
as="div"
|
|
215
|
+
gap={ 0 }
|
|
216
|
+
justify="left"
|
|
217
|
+
className="edit-site-patterns__pattern-title"
|
|
218
|
+
>
|
|
219
|
+
{ item.type === PATTERN_TYPES.theme ? (
|
|
220
|
+
item.title
|
|
221
|
+
) : (
|
|
222
|
+
<Button
|
|
223
|
+
variant="link"
|
|
224
|
+
onClick={ onClick }
|
|
225
|
+
// Required for the grid's roving tab index system.
|
|
226
|
+
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
|
|
227
|
+
tabIndex="-1"
|
|
228
|
+
>
|
|
229
|
+
{ item.title || item.name }
|
|
230
|
+
</Button>
|
|
231
|
+
) }
|
|
232
|
+
</Flex>
|
|
213
233
|
{ itemIcon && ! isNonUserPattern && (
|
|
214
234
|
<Tooltip
|
|
215
235
|
placement="top"
|
|
@@ -235,26 +255,6 @@ function Title( { item, categoryId } ) {
|
|
|
235
255
|
/>
|
|
236
256
|
</Tooltip>
|
|
237
257
|
) }
|
|
238
|
-
<Flex
|
|
239
|
-
as="div"
|
|
240
|
-
gap={ 0 }
|
|
241
|
-
justify="left"
|
|
242
|
-
className="edit-site-patterns__pattern-title"
|
|
243
|
-
>
|
|
244
|
-
{ item.type === PATTERN_TYPES.theme ? (
|
|
245
|
-
item.title
|
|
246
|
-
) : (
|
|
247
|
-
<Button
|
|
248
|
-
variant="link"
|
|
249
|
-
onClick={ onClick }
|
|
250
|
-
// Required for the grid's roving tab index system.
|
|
251
|
-
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
|
|
252
|
-
tabIndex="-1"
|
|
253
|
-
>
|
|
254
|
-
{ item.title || item.name }
|
|
255
|
-
</Button>
|
|
256
|
-
) }
|
|
257
|
-
</Flex>
|
|
258
258
|
</HStack>
|
|
259
259
|
);
|
|
260
260
|
}
|
|
@@ -300,6 +300,7 @@ function ResizableFrame( {
|
|
|
300
300
|
className={ classnames( 'edit-site-resizable-frame__inner', {
|
|
301
301
|
'is-resizing': isResizing,
|
|
302
302
|
} ) }
|
|
303
|
+
showHandle={ false } // Do not show the default handle, as we're using a custom one.
|
|
303
304
|
>
|
|
304
305
|
<motion.div
|
|
305
306
|
className="edit-site-resizable-frame__inner-content"
|
|
@@ -74,8 +74,9 @@ function SidebarScreens() {
|
|
|
74
74
|
</SidebarScreenWrapper>
|
|
75
75
|
<SidebarScreenWrapper path="/pages">
|
|
76
76
|
<SidebarNavigationScreen
|
|
77
|
-
title={ __( '
|
|
77
|
+
title={ __( 'Manage pages' ) }
|
|
78
78
|
content={ <DataViewsSidebarContent /> }
|
|
79
|
+
backPath="/page"
|
|
79
80
|
/>
|
|
80
81
|
</SidebarScreenWrapper>
|
|
81
82
|
<SidebarScreenWrapper path="/page/:postId">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { trash } from '@wordpress/icons';
|
|
5
|
+
import { trash, pages, drafts } from '@wordpress/icons';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -51,11 +51,13 @@ export const DEFAULT_VIEWS = {
|
|
|
51
51
|
{
|
|
52
52
|
title: __( 'All pages' ),
|
|
53
53
|
slug: 'all',
|
|
54
|
+
icon: pages,
|
|
54
55
|
view: DEFAULT_PAGE_BASE,
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
title: __( 'Drafts' ),
|
|
58
59
|
slug: 'drafts',
|
|
60
|
+
icon: drafts,
|
|
59
61
|
view: {
|
|
60
62
|
...DEFAULT_PAGE_BASE,
|
|
61
63
|
filters: [
|
|
@@ -31,7 +31,7 @@ function TemplateDataviewItem( { template, isActive } ) {
|
|
|
31
31
|
export default function DataviewsTemplatesSidebarContent( {
|
|
32
32
|
activeView,
|
|
33
33
|
postType,
|
|
34
|
-
|
|
34
|
+
title,
|
|
35
35
|
} ) {
|
|
36
36
|
const { records } = useEntityRecords( 'postType', postType, {
|
|
37
37
|
per_page: -1,
|
|
@@ -54,7 +54,7 @@ export default function DataviewsTemplatesSidebarContent( {
|
|
|
54
54
|
<ItemGroup>
|
|
55
55
|
<DataViewItem
|
|
56
56
|
slug={ 'all' }
|
|
57
|
-
title={
|
|
57
|
+
title={ title }
|
|
58
58
|
icon={ layout }
|
|
59
59
|
isActive={ activeView === 'all' }
|
|
60
60
|
isCustom="false"
|
|
@@ -21,17 +21,19 @@ import DataviewsTemplatesSidebarContent from './content';
|
|
|
21
21
|
|
|
22
22
|
const config = {
|
|
23
23
|
[ TEMPLATE_POST_TYPE ]: {
|
|
24
|
-
title: __( '
|
|
24
|
+
title: __( 'Manage templates' ),
|
|
25
25
|
description: __(
|
|
26
26
|
'Create new templates, or reset any customizations made to the templates supplied by your theme.'
|
|
27
27
|
),
|
|
28
|
+
contentTitle: __( 'All templates' ),
|
|
28
29
|
},
|
|
29
30
|
[ TEMPLATE_PART_POST_TYPE ]: {
|
|
30
|
-
title: __( '
|
|
31
|
+
title: __( 'Manage template parts' ),
|
|
31
32
|
description: __(
|
|
32
33
|
'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'
|
|
33
34
|
),
|
|
34
35
|
backPath: '/patterns',
|
|
36
|
+
contentTitle: __( 'All template parts' ),
|
|
35
37
|
},
|
|
36
38
|
};
|
|
37
39
|
|
|
@@ -62,7 +64,7 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
62
64
|
<DataviewsTemplatesSidebarContent
|
|
63
65
|
activeView={ activeView }
|
|
64
66
|
postType={ postType }
|
|
65
|
-
|
|
67
|
+
title={ config[ postType ].contentTitle }
|
|
66
68
|
/>
|
|
67
69
|
}
|
|
68
70
|
/>
|
|
@@ -425,7 +425,11 @@ const Example = ( { id, title, blocks, isSelected, onClick } ) => {
|
|
|
425
425
|
[]
|
|
426
426
|
);
|
|
427
427
|
const settings = useMemo(
|
|
428
|
-
() => ( {
|
|
428
|
+
() => ( {
|
|
429
|
+
...originalSettings,
|
|
430
|
+
focusMode: false, // Disable "Spotlight mode".
|
|
431
|
+
__unstableIsPreviewMode: true,
|
|
432
|
+
} ),
|
|
429
433
|
[ originalSettings ]
|
|
430
434
|
);
|
|
431
435
|
|
|
@@ -1,50 +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 = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _collectionFontVariant = _interopRequireDefault(require("./collection-font-variant"));
|
|
11
|
-
var _fontsOutline = require("./utils/fonts-outline");
|
|
12
|
-
var _sortFontFaces = require("./utils/sort-font-faces");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function CollectionFontDetails({
|
|
22
|
-
font,
|
|
23
|
-
handleToggleVariant,
|
|
24
|
-
fontToInstallOutline
|
|
25
|
-
}) {
|
|
26
|
-
const fontFaces = font.fontFace && font.fontFace.length ? (0, _sortFontFaces.sortFontFaces)(font.fontFace) : [{
|
|
27
|
-
fontFamily: font.fontFamily,
|
|
28
|
-
fontStyle: 'normal',
|
|
29
|
-
fontWeight: '400'
|
|
30
|
-
}];
|
|
31
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.__experimentalSpacer, {
|
|
32
|
-
margin: 4
|
|
33
|
-
}), (0, _react.createElement)(_components.__experimentalVStack, {
|
|
34
|
-
spacing: 0
|
|
35
|
-
}, (0, _react.createElement)(_components.__experimentalSpacer, {
|
|
36
|
-
margin: 8
|
|
37
|
-
}), fontFaces.map((face, i) => (0, _react.createElement)(_collectionFontVariant.default, {
|
|
38
|
-
font: font,
|
|
39
|
-
face: face,
|
|
40
|
-
key: `face${i}`,
|
|
41
|
-
handleToggleVariant: handleToggleVariant,
|
|
42
|
-
selected: (0, _fontsOutline.isFontFontFaceInOutline)(font.slug, font.fontFace ? face : null,
|
|
43
|
-
// If the font has no fontFace, we want to check if the font is in the outline
|
|
44
|
-
fontToInstallOutline)
|
|
45
|
-
}))), (0, _react.createElement)(_components.__experimentalSpacer, {
|
|
46
|
-
margin: 16
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
var _default = exports.default = CollectionFontDetails;
|
|
50
|
-
//# sourceMappingURL=collection-font-details.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_collectionFontVariant","_interopRequireDefault","_fontsOutline","_sortFontFaces","CollectionFontDetails","font","handleToggleVariant","fontToInstallOutline","fontFaces","fontFace","length","sortFontFaces","fontFamily","fontStyle","fontWeight","_react","createElement","Fragment","__experimentalSpacer","margin","__experimentalVStack","spacing","map","face","i","default","key","selected","isFontFontFaceInOutline","slug","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport CollectionFontVariant from './collection-font-variant';\nimport { isFontFontFaceInOutline } from './utils/fonts-outline';\nimport { sortFontFaces } from './utils/sort-font-faces';\n\nfunction CollectionFontDetails( {\n\tfont,\n\thandleToggleVariant,\n\tfontToInstallOutline,\n} ) {\n\tconst fontFaces =\n\t\tfont.fontFace && font.fontFace.length\n\t\t\t? sortFontFaces( font.fontFace )\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfontFamily: font.fontFamily,\n\t\t\t\t\t\tfontStyle: 'normal',\n\t\t\t\t\t\tfontWeight: '400',\n\t\t\t\t\t},\n\t\t\t ];\n\n\treturn (\n\t\t<>\n\t\t\t<Spacer margin={ 4 } />\n\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t<Spacer margin={ 8 } />\n\t\t\t\t{ fontFaces.map( ( face, i ) => (\n\t\t\t\t\t<CollectionFontVariant\n\t\t\t\t\t\tfont={ font }\n\t\t\t\t\t\tface={ face }\n\t\t\t\t\t\tkey={ `face${ i }` }\n\t\t\t\t\t\thandleToggleVariant={ handleToggleVariant }\n\t\t\t\t\t\tselected={ isFontFontFaceInOutline(\n\t\t\t\t\t\t\tfont.slug,\n\t\t\t\t\t\t\tfont.fontFace ? face : null, // If the font has no fontFace, we want to check if the font is in the outline\n\t\t\t\t\t\t\tfontToInstallOutline\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</VStack>\n\t\t\t<Spacer margin={ 16 } />\n\t\t</>\n\t);\n}\n\nexport default CollectionFontDetails;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAQA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAbA;AACA;AACA;;AAMA;AACA;AACA;;AAKA,SAASK,qBAAqBA,CAAE;EAC/BC,IAAI;EACJC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GACdH,IAAI,CAACI,QAAQ,IAAIJ,IAAI,CAACI,QAAQ,CAACC,MAAM,GAClC,IAAAC,4BAAa,EAAEN,IAAI,CAACI,QAAS,CAAC,GAC9B,CACA;IACCG,UAAU,EAAEP,IAAI,CAACO,UAAU;IAC3BC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE;EACb,CAAC,CACA;EAEL,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAoB,oBAAM;IAACC,MAAM,EAAG;EAAG,CAAE,CAAC,EACvB,IAAAJ,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAsB,oBAAM;IAACC,OAAO,EAAG;EAAG,GACpB,IAAAN,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAoB,oBAAM;IAACC,MAAM,EAAG;EAAG,CAAE,CAAC,EACrBX,SAAS,CAACc,GAAG,CAAE,CAAEC,IAAI,EAAEC,CAAC,KACzB,IAAAT,MAAA,CAAAC,aAAA,EAAChB,sBAAA,CAAAyB,OAAqB;IACrBpB,IAAI,EAAGA,IAAM;IACbkB,IAAI,EAAGA,IAAM;IACbG,GAAG,EAAI,OAAOF,CAAG,EAAG;IACpBlB,mBAAmB,EAAGA,mBAAqB;IAC3CqB,QAAQ,EAAG,IAAAC,qCAAuB,EACjCvB,IAAI,CAACwB,IAAI,EACTxB,IAAI,CAACI,QAAQ,GAAGc,IAAI,GAAG,IAAI;IAAE;IAC7BhB,oBACD;EAAG,CACH,CACA,CACK,CAAC,EACT,IAAAQ,MAAA,CAAAC,aAAA,EAAClB,WAAA,CAAAoB,oBAAM;IAACC,MAAM,EAAG;EAAI,CAAE,CACtB,CAAC;AAEL;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAN,OAAA,GAEcrB,qBAAqB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
function ConfirmDeleteDialog({
|
|
15
|
-
font,
|
|
16
|
-
isConfirmDeleteOpen,
|
|
17
|
-
handleConfirmUninstall,
|
|
18
|
-
handleCancelUninstall
|
|
19
|
-
}) {
|
|
20
|
-
return (0, _react.createElement)(_components.__experimentalConfirmDialog, {
|
|
21
|
-
isOpen: isConfirmDeleteOpen,
|
|
22
|
-
cancelButtonText: (0, _i18n.__)('Cancel'),
|
|
23
|
-
confirmButtonText: (0, _i18n.__)('Delete'),
|
|
24
|
-
onCancel: handleCancelUninstall,
|
|
25
|
-
onConfirm: handleConfirmUninstall
|
|
26
|
-
}, font && (0, _i18n.sprintf)( /* translators: %s: Name of the font. */
|
|
27
|
-
(0, _i18n.__)('Are you sure you want to delete "%s" font and all its variants and assets?'), font.name));
|
|
28
|
-
}
|
|
29
|
-
var _default = exports.default = ConfirmDeleteDialog;
|
|
30
|
-
//# sourceMappingURL=confirm-delete-dialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","ConfirmDeleteDialog","font","isConfirmDeleteOpen","handleConfirmUninstall","handleCancelUninstall","_react","createElement","__experimentalConfirmDialog","isOpen","cancelButtonText","__","confirmButtonText","onCancel","onConfirm","sprintf","name","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/confirm-delete-dialog.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\nfunction ConfirmDeleteDialog( {\n\tfont,\n\tisConfirmDeleteOpen,\n\thandleConfirmUninstall,\n\thandleCancelUninstall,\n} ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isConfirmDeleteOpen }\n\t\t\tcancelButtonText={ __( 'Cancel' ) }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\tonCancel={ handleCancelUninstall }\n\t\t\tonConfirm={ handleConfirmUninstall }\n\t\t>\n\t\t\t{ font &&\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: Name of the font. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'Are you sure you want to delete \"%s\" font and all its variants and assets?'\n\t\t\t\t\t),\n\t\t\t\t\tfont.name\n\t\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n\nexport default ConfirmDeleteDialog;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,SAASE,mBAAmBA,CAAE;EAC7BC,IAAI;EACJC,mBAAmB;EACnBC,sBAAsB;EACtBC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,WAAA,CAAAQ,2BAAa;IACbC,MAAM,EAAGN,mBAAqB;IAC9BO,gBAAgB,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IACnCC,iBAAiB,EAAG,IAAAD,QAAE,EAAE,QAAS,CAAG;IACpCE,QAAQ,EAAGR,qBAAuB;IAClCS,SAAS,EAAGV;EAAwB,GAElCF,IAAI,IACL,IAAAa,aAAO,GACN;EACA,IAAAJ,QAAE,EACD,4EACD,CAAC,EACDT,IAAI,CAACc,IACN,CACa,CAAC;AAElB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEclB,mBAAmB"}
|
|
@@ -1,39 +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 = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
var _fontCard = _interopRequireDefault(require("./font-card"));
|
|
12
|
-
var _context = require("./context");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function LibraryFontCard({
|
|
22
|
-
font,
|
|
23
|
-
...props
|
|
24
|
-
}) {
|
|
25
|
-
const {
|
|
26
|
-
getFontFacesActivated
|
|
27
|
-
} = (0, _element.useContext)(_context.FontLibraryContext);
|
|
28
|
-
const variantsInstalled = font?.fontFace?.length > 0 ? font.fontFace.length : 1;
|
|
29
|
-
const variantsActive = getFontFacesActivated(font.slug, font.source).length;
|
|
30
|
-
const variantsText = (0, _i18n.sprintf)( /* translators: 1: Active font variants, 2: Total font variants. */
|
|
31
|
-
(0, _i18n.__)('%1$s/%2$s variants active'), variantsActive, variantsInstalled);
|
|
32
|
-
return (0, _react.createElement)(_fontCard.default, {
|
|
33
|
-
font: font,
|
|
34
|
-
variantsText: variantsText,
|
|
35
|
-
...props
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
var _default = exports.default = LibraryFontCard;
|
|
39
|
-
//# sourceMappingURL=library-font-card.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_fontCard","_interopRequireDefault","_context","LibraryFontCard","font","props","getFontFacesActivated","useContext","FontLibraryContext","variantsInstalled","fontFace","length","variantsActive","slug","source","variantsText","sprintf","__","_react","createElement","default","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/library-font-card.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport FontCard from './font-card';\nimport { FontLibraryContext } from './context';\n\nfunction LibraryFontCard( { font, ...props } ) {\n\tconst { getFontFacesActivated } = useContext( FontLibraryContext );\n\n\tconst variantsInstalled =\n\t\tfont?.fontFace?.length > 0 ? font.fontFace.length : 1;\n\tconst variantsActive = getFontFacesActivated(\n\t\tfont.slug,\n\t\tfont.source\n\t).length;\n\tconst variantsText = sprintf(\n\t\t/* translators: 1: Active font variants, 2: Total font variants. */\n\t\t__( '%1$s/%2$s variants active' ),\n\t\tvariantsActive,\n\t\tvariantsInstalled\n\t);\n\n\treturn (\n\t\t<FontCard font={ font } variantsText={ variantsText } { ...props } />\n\t);\n}\n\nexport default LibraryFontCard;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,SAASK,eAAeA,CAAE;EAAEC,IAAI;EAAE,GAAGC;AAAM,CAAC,EAAG;EAC9C,MAAM;IAAEC;EAAsB,CAAC,GAAG,IAAAC,mBAAU,EAAEC,2BAAmB,CAAC;EAElE,MAAMC,iBAAiB,GACtBL,IAAI,EAAEM,QAAQ,EAAEC,MAAM,GAAG,CAAC,GAAGP,IAAI,CAACM,QAAQ,CAACC,MAAM,GAAG,CAAC;EACtD,MAAMC,cAAc,GAAGN,qBAAqB,CAC3CF,IAAI,CAACS,IAAI,EACTT,IAAI,CAACU,MACN,CAAC,CAACH,MAAM;EACR,MAAMI,YAAY,GAAG,IAAAC,aAAO,GAC3B;EACA,IAAAC,QAAE,EAAE,2BAA4B,CAAC,EACjCL,cAAc,EACdH,iBACD,CAAC;EAED,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACnB,SAAA,CAAAoB,OAAQ;IAAChB,IAAI,EAAGA,IAAM;IAACW,YAAY,EAAGA,YAAc;IAAA,GAAMV;EAAK,CAAI,CAAC;AAEvE;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEcjB,eAAe"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _context = require("./context");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function TabPanelLayout({
|
|
22
|
-
title,
|
|
23
|
-
description,
|
|
24
|
-
notice,
|
|
25
|
-
handleBack,
|
|
26
|
-
children,
|
|
27
|
-
footer
|
|
28
|
-
}) {
|
|
29
|
-
const {
|
|
30
|
-
setNotice
|
|
31
|
-
} = (0, _element.useContext)(_context.FontLibraryContext);
|
|
32
|
-
return (0, _react.createElement)("div", {
|
|
33
|
-
className: "font-library-modal__tabpanel-layout"
|
|
34
|
-
}, (0, _react.createElement)(_components.__experimentalSpacer, {
|
|
35
|
-
margin: 4
|
|
36
|
-
}), (0, _react.createElement)(_components.__experimentalVStack, {
|
|
37
|
-
spacing: 4,
|
|
38
|
-
justify: "space-between"
|
|
39
|
-
}, (0, _react.createElement)(_components.__experimentalVStack, {
|
|
40
|
-
spacing: 2
|
|
41
|
-
}, (0, _react.createElement)(_components.__experimentalHStack, {
|
|
42
|
-
justify: "flex-start"
|
|
43
|
-
}, !!handleBack && (0, _react.createElement)(_components.Button, {
|
|
44
|
-
variant: "tertiary",
|
|
45
|
-
onClick: handleBack,
|
|
46
|
-
icon: _icons.chevronLeft,
|
|
47
|
-
size: "small",
|
|
48
|
-
label: (0, _i18n.__)('Back')
|
|
49
|
-
}), title && (0, _react.createElement)(_components.__experimentalHeading, {
|
|
50
|
-
level: 2,
|
|
51
|
-
size: 13,
|
|
52
|
-
className: "edit-site-global-styles-header"
|
|
53
|
-
}, title)), description && (0, _react.createElement)(_components.__experimentalText, null, description), notice && (0, _react.createElement)(_components.FlexBlock, null, (0, _react.createElement)(_components.__experimentalSpacer, {
|
|
54
|
-
margin: 1
|
|
55
|
-
}), (0, _react.createElement)(_components.Notice, {
|
|
56
|
-
status: notice.type,
|
|
57
|
-
onRemove: () => setNotice(null)
|
|
58
|
-
}, notice.message), (0, _react.createElement)(_components.__experimentalSpacer, {
|
|
59
|
-
margin: 1
|
|
60
|
-
}))), (0, _react.createElement)("div", {
|
|
61
|
-
className: "font-library-modal__tabpanel-layout__main"
|
|
62
|
-
}, children), footer && (0, _react.createElement)("div", {
|
|
63
|
-
className: "font-library-modal__tabpanel-layout__footer"
|
|
64
|
-
}, footer)));
|
|
65
|
-
}
|
|
66
|
-
var _default = exports.default = TabPanelLayout;
|
|
67
|
-
//# sourceMappingURL=tab-panel-layout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_icons","_i18n","_context","TabPanelLayout","title","description","notice","handleBack","children","footer","setNotice","useContext","FontLibraryContext","_react","createElement","className","__experimentalSpacer","margin","__experimentalVStack","spacing","justify","__experimentalHStack","Button","variant","onClick","icon","chevronLeft","size","label","__","__experimentalHeading","level","__experimentalText","FlexBlock","Notice","status","type","onRemove","message","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/tab-panel-layout.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\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\tNotice,\n\tFlexBlock,\n} from '@wordpress/components';\nimport { chevronLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { FontLibraryContext } from './context';\n\nfunction TabPanelLayout( {\n\ttitle,\n\tdescription,\n\tnotice,\n\thandleBack,\n\tchildren,\n\tfooter,\n} ) {\n\tconst { setNotice } = useContext( FontLibraryContext );\n\n\treturn (\n\t\t<div className=\"font-library-modal__tabpanel-layout\">\n\t\t\t<Spacer margin={ 4 } />\n\t\t\t<VStack spacing={ 4 } justify=\"space-between\">\n\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t{ !! handleBack && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\tonClick={ handleBack }\n\t\t\t\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ title && (\n\t\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-header\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HStack>\n\t\t\t\t\t{ description && <Text>{ description }</Text> }\n\t\t\t\t\t{ notice && (\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<Spacer margin={ 1 } />\n\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\tstatus={ notice.type }\n\t\t\t\t\t\t\t\tonRemove={ () => setNotice( null ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ notice.message }\n\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t<Spacer margin={ 1 } />\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t\t<div className=\"font-library-modal__tabpanel-layout__main\">\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t\t{ footer && (\n\t\t\t\t\t<div className=\"font-library-modal__tabpanel-layout__footer\">\n\t\t\t\t\t\t{ footer }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default TabPanelLayout;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAUA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AApBA;AACA;AACA;;AAeA;AACA;AACA;;AAGA,SAASK,cAAcA,CAAE;EACxBC,KAAK;EACLC,WAAW;EACXC,MAAM;EACNC,UAAU;EACVC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,mBAAU,EAAEC,2BAAmB,CAAC;EAEtD,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAAqC,GACnD,IAAAF,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiB,oBAAM;IAACC,MAAM,EAAG;EAAG,CAAE,CAAC,EACvB,IAAAJ,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAmB,oBAAM;IAACC,OAAO,EAAG,CAAG;IAACC,OAAO,EAAC;EAAe,GAC5C,IAAAP,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAmB,oBAAM;IAACC,OAAO,EAAG;EAAG,GACpB,IAAAN,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAsB,oBAAM;IAACD,OAAO,EAAC;EAAY,GACzB,CAAC,CAAEb,UAAU,IACd,IAAAM,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAuB,MAAM;IACNC,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGjB,UAAY;IACtBkB,IAAI,EAAGC,kBAAa;IACpBC,IAAI,EAAC,OAAO;IACZC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO;EAAG,CACtB,CACD,EACCzB,KAAK,IACN,IAAAS,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAA+B,qBAAO;IACPC,KAAK,EAAG,CAAG;IACXJ,IAAI,EAAG,EAAI;IACXZ,SAAS,EAAC;EAAgC,GAExCX,KACM,CAEH,CAAC,EACPC,WAAW,IAAI,IAAAQ,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiC,kBAAI,QAAG3B,WAAmB,CAAC,EAC3CC,MAAM,IACP,IAAAO,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAkC,SAAS,QACT,IAAApB,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiB,oBAAM;IAACC,MAAM,EAAG;EAAG,CAAE,CAAC,EACvB,IAAAJ,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAmC,MAAM;IACNC,MAAM,EAAG7B,MAAM,CAAC8B,IAAM;IACtBC,QAAQ,EAAGA,CAAA,KAAM3B,SAAS,CAAE,IAAK;EAAG,GAElCJ,MAAM,CAACgC,OACF,CAAC,EACT,IAAAzB,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAiB,oBAAM;IAACC,MAAM,EAAG;EAAG,CAAE,CACZ,CAEL,CAAC,EACT,IAAAJ,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA2C,GACvDP,QACE,CAAC,EACJC,MAAM,IACP,IAAAI,MAAA,CAAAC,aAAA;IAAKC,SAAS,EAAC;EAA6C,GACzDN,MACE,CAEC,CACJ,CAAC;AAER;AAAC,IAAA8B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctC,cAAc"}
|