@wordpress/block-library 9.24.0 → 9.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/avatar/edit.js +84 -39
- package/build/avatar/edit.js.map +1 -1
- package/build/avatar/user-control.js +32 -17
- package/build/avatar/user-control.js.map +1 -1
- package/build/button/edit.js +29 -17
- package/build/button/edit.js.map +1 -1
- package/build/columns/edit.js +18 -22
- package/build/columns/edit.js.map +1 -1
- package/build/comment-author-name/edit.js +41 -12
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-date/edit.js +41 -12
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-edit-link/edit.js +27 -7
- package/build/comment-edit-link/edit.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +1 -3
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-pagination/edit.js +23 -9
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-title/edit.js +41 -12
- package/build/comments-title/edit.js.map +1 -1
- package/build/details/edit.js +27 -3
- package/build/details/edit.js.map +1 -1
- package/build/embed/edit.js +2 -4
- package/build/embed/edit.js.map +1 -1
- package/build/embed/embed-controls.js +41 -22
- package/build/embed/embed-controls.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/file/inspector.js +73 -30
- package/build/file/inspector.js.map +1 -1
- package/build/form/edit.js +67 -38
- package/build/form/edit.js.map +1 -1
- package/build/form/index.js +3 -3
- package/build/form/index.js.map +1 -1
- package/build/form-input/edit.js +47 -18
- package/build/form-input/edit.js.map +1 -1
- package/build/form-input/index.js +2 -1
- package/build/form-input/index.js.map +1 -1
- package/build/form-submission-notification/index.js +2 -1
- package/build/form-submission-notification/index.js.map +1 -1
- package/build/form-submit-button/index.js +2 -1
- package/build/form-submit-button/index.js.map +1 -1
- package/build/image/image.js +1 -0
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +0 -3
- package/build/image/view.js.map +1 -1
- package/build/latest-posts/edit.js +154 -82
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/ordered-list-settings.js +131 -52
- package/build/list/ordered-list-settings.js.map +1 -1
- package/build/navigation/edit/index.js +93 -51
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/overlay-menu-preview.js +43 -27
- package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build/navigation-link/edit.js +11 -0
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +3 -0
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-link/transforms.js +2 -0
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/navigation-link/update-attributes.js +1 -0
- package/build/navigation-link/update-attributes.js.map +1 -1
- package/build/navigation-submenu/index.js +3 -0
- package/build/navigation-submenu/index.js.map +1 -1
- package/build/post-author/edit.js +75 -18
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments-count/index.js +3 -1
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-count/transforms.js +26 -0
- package/build/post-comments-count/transforms.js.map +1 -0
- package/build/post-comments-link/index.js +3 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-comments-link/transforms.js +26 -0
- package/build/post-comments-link/transforms.js.map +1 -0
- package/build/post-navigation-link/edit.js +72 -33
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-title/edit.js +56 -18
- package/build/post-title/edit.js.map +1 -1
- package/build/query/edit/enhanced-pagination-modal.js +1 -1
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/rss/edit.js +120 -46
- package/build/rss/edit.js.map +1 -1
- package/build/separator/edit.js +52 -20
- package/build/separator/edit.js.map +1 -1
- package/build/shortcode/index.js +2 -1
- package/build/shortcode/index.js.map +1 -1
- package/build/site-logo/edit.js +53 -19
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-link/edit.js +21 -5
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/edit.native.js +13 -5
- package/build/social-link/edit.native.js.map +1 -1
- package/build/social-link/social-list.js +17 -25
- package/build/social-link/social-list.js.map +1 -1
- package/build/social-link/variations.js +53 -48
- package/build/social-link/variations.js.map +1 -1
- package/build/social-links/edit.js +38 -45
- package/build/social-links/edit.js.map +1 -1
- package/build/video/tracks-editor.js +63 -21
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/avatar/edit.js +83 -38
- package/build-module/avatar/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +33 -18
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/button/edit.js +30 -18
- package/build-module/button/edit.js.map +1 -1
- package/build-module/columns/edit.js +18 -22
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/comment-author-name/edit.js +42 -13
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-date/edit.js +42 -13
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-edit-link/edit.js +28 -8
- package/build-module/comment-edit-link/edit.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +1 -3
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-pagination/edit.js +24 -10
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +42 -13
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/details/edit.js +29 -5
- package/build-module/details/edit.js.map +1 -1
- package/build-module/embed/edit.js +2 -4
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/embed-controls.js +42 -23
- package/build-module/embed/embed-controls.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/inspector.js +74 -31
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/form/edit.js +68 -39
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form/index.js +3 -3
- package/build-module/form/index.js.map +1 -1
- package/build-module/form-input/edit.js +48 -19
- package/build-module/form-input/edit.js.map +1 -1
- package/build-module/form-input/index.js +2 -1
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-submission-notification/index.js +2 -1
- package/build-module/form-submission-notification/index.js.map +1 -1
- package/build-module/form-submit-button/index.js +2 -1
- package/build-module/form-submit-button/index.js.map +1 -1
- package/build-module/image/image.js +1 -0
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +0 -3
- package/build-module/image/view.js.map +1 -1
- package/build-module/latest-posts/edit.js +155 -83
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/ordered-list-settings.js +132 -53
- package/build-module/list/ordered-list-settings.js.map +1 -1
- package/build-module/navigation/edit/index.js +94 -52
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +44 -28
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation-link/edit.js +11 -0
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +3 -0
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-link/transforms.js +2 -0
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +1 -0
- package/build-module/navigation-link/update-attributes.js.map +1 -1
- package/build-module/navigation-submenu/index.js +3 -0
- package/build-module/navigation-submenu/index.js.map +1 -1
- package/build-module/post-author/edit.js +76 -19
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +3 -1
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-count/transforms.js +19 -0
- package/build-module/post-comments-count/transforms.js.map +1 -0
- package/build-module/post-comments-link/index.js +3 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-comments-link/transforms.js +19 -0
- package/build-module/post-comments-link/transforms.js.map +1 -0
- package/build-module/post-navigation-link/edit.js +73 -34
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-title/edit.js +57 -19
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/rss/edit.js +121 -47
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/separator/edit.js +54 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/shortcode/index.js +2 -1
- package/build-module/shortcode/index.js.map +1 -1
- package/build-module/site-logo/edit.js +54 -20
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-link/edit.js +24 -8
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/edit.native.js +15 -6
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/social-link/social-list.js +16 -21
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/social-link/variations.js +53 -48
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/social-links/edit.js +40 -47
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +65 -23
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/calendar/style-rtl.css +7 -7
- package/build-style/calendar/style.css +7 -7
- package/build-style/comments-pagination/editor-rtl.css +0 -12
- package/build-style/comments-pagination/editor.css +0 -14
- package/build-style/comments-pagination/style-rtl.css +0 -7
- package/build-style/comments-pagination/style.css +0 -9
- package/build-style/editor-rtl.css +9 -21
- package/build-style/editor.css +9 -23
- package/build-style/gallery/style-rtl.css +1 -0
- package/build-style/gallery/style.css +1 -0
- package/build-style/navigation/editor-rtl.css +8 -3
- package/build-style/navigation/editor.css +8 -3
- package/build-style/navigation/style-rtl.css +4 -0
- package/build-style/navigation/style.css +4 -0
- package/build-style/pullquote/editor-rtl.css +1 -1
- package/build-style/pullquote/editor.css +1 -1
- package/build-style/pullquote/style-rtl.css +2 -3
- package/build-style/pullquote/style.css +2 -3
- package/build-style/pullquote/theme-rtl.css +2 -2
- package/build-style/pullquote/theme.css +2 -2
- package/build-style/style-rtl.css +14 -17
- package/build-style/style.css +14 -19
- package/build-style/theme-rtl.css +2 -2
- package/build-style/theme.css +2 -2
- package/package.json +35 -35
- package/src/avatar/edit.js +99 -51
- package/src/avatar/user-control.js +34 -29
- package/src/button/edit.js +44 -29
- package/src/calendar/style.scss +10 -10
- package/src/columns/edit.js +20 -31
- package/src/comment-author-name/edit.js +54 -13
- package/src/comment-date/edit.js +50 -15
- package/src/comment-edit-link/edit.js +39 -11
- package/src/comments/edit/comments-inspector-controls.js +0 -2
- package/src/comments-pagination/edit.js +29 -9
- package/src/comments-pagination/editor.scss +0 -15
- package/src/comments-pagination/style.scss +0 -8
- package/src/comments-title/edit.js +53 -15
- package/src/details/edit.js +36 -4
- package/src/editor.scss +0 -1
- package/src/embed/edit.js +3 -5
- package/src/embed/embed-controls.js +55 -33
- package/src/embed/variations.js +0 -8
- package/src/file/inspector.js +99 -45
- package/src/form/block.json +1 -2
- package/src/form/edit.js +91 -47
- package/src/form/index.js +1 -0
- package/src/form-input/edit.js +56 -18
- package/src/form-input/index.js +1 -0
- package/src/form-submission-notification/index.js +1 -0
- package/src/form-submit-button/index.js +1 -0
- package/src/gallery/style.scss +1 -0
- package/src/image/image.js +1 -0
- package/src/image/index.php +4 -1
- package/src/image/view.js +0 -3
- package/src/latest-posts/edit.js +206 -98
- package/src/list/ordered-list-settings.js +172 -62
- package/src/navigation/edit/index.js +127 -64
- package/src/navigation/edit/overlay-menu-preview.js +43 -26
- package/src/navigation/editor.scss +8 -4
- package/src/navigation/style.scss +8 -0
- package/src/navigation-link/block.json +3 -0
- package/src/navigation-link/edit.js +14 -1
- package/src/navigation-link/index.php +4 -0
- package/src/navigation-link/transforms.js +2 -1
- package/src/navigation-link/update-attributes.js +1 -0
- package/src/navigation-submenu/block.json +3 -0
- package/src/navigation-submenu/index.php +4 -0
- package/src/post-author/edit.js +91 -27
- package/src/post-comments-count/index.js +2 -0
- package/src/post-comments-count/transforms.js +20 -0
- package/src/post-comments-link/index.js +2 -0
- package/src/post-comments-link/transforms.js +20 -0
- package/src/post-navigation-link/edit.js +96 -51
- package/src/post-title/edit.js +76 -24
- package/src/pullquote/editor.scss +1 -1
- package/src/pullquote/style.scss +2 -3
- package/src/pullquote/theme.scss +2 -2
- package/src/query/edit/enhanced-pagination-modal.js +1 -5
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -13
- package/src/rss/edit.js +141 -55
- package/src/separator/edit.js +66 -21
- package/src/shortcode/block.json +2 -1
- package/src/site-logo/edit.js +69 -26
- package/src/site-title/index.php +1 -1
- package/src/social-link/edit.js +18 -7
- package/src/social-link/edit.native.js +10 -4
- package/src/social-link/index.php +62 -49
- package/src/social-link/social-list.js +15 -20
- package/src/social-link/variations.js +53 -48
- package/src/social-links/edit.js +38 -60
- package/src/video/tracks-editor.js +75 -22
- package/build-style/post-author/editor-rtl.css +0 -140
- package/build-style/post-author/editor.css +0 -140
- package/src/post-author/editor.scss +0 -7
package/src/latest-posts/edit.js
CHANGED
|
@@ -7,7 +7,6 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
PanelBody,
|
|
11
10
|
Placeholder,
|
|
12
11
|
QueryControls,
|
|
13
12
|
RadioControl,
|
|
@@ -328,131 +327,240 @@ function Controls( { attributes, setAttributes, postCount } ) {
|
|
|
328
327
|
/>
|
|
329
328
|
</ToolsPanelItem>
|
|
330
329
|
</ToolsPanel>
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
330
|
+
<ToolsPanel
|
|
331
|
+
label={ __( 'Featured image' ) }
|
|
332
|
+
resetAll={ () =>
|
|
333
|
+
setAttributes( {
|
|
334
|
+
displayFeaturedImage: false,
|
|
335
|
+
featuredImageAlign: undefined,
|
|
336
|
+
featuredImageSizeSlug: 'thumbnail',
|
|
337
|
+
featuredImageSizeWidth: null,
|
|
338
|
+
featuredImageSizeHeight: null,
|
|
339
|
+
addLinkToFeaturedImage: false,
|
|
340
|
+
} )
|
|
341
|
+
}
|
|
342
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
343
|
+
>
|
|
344
|
+
<ToolsPanelItem
|
|
345
|
+
hasValue={ () => !! displayFeaturedImage }
|
|
334
346
|
label={ __( 'Display featured image' ) }
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
setAttributes( { displayFeaturedImage: value } )
|
|
347
|
+
onDeselect={ () =>
|
|
348
|
+
setAttributes( { displayFeaturedImage: false } )
|
|
338
349
|
}
|
|
339
|
-
|
|
350
|
+
isShownByDefault
|
|
351
|
+
>
|
|
352
|
+
<ToggleControl
|
|
353
|
+
__nextHasNoMarginBottom
|
|
354
|
+
label={ __( 'Display featured image' ) }
|
|
355
|
+
checked={ displayFeaturedImage }
|
|
356
|
+
onChange={ ( value ) =>
|
|
357
|
+
setAttributes( { displayFeaturedImage: value } )
|
|
358
|
+
}
|
|
359
|
+
/>
|
|
360
|
+
</ToolsPanelItem>
|
|
340
361
|
{ displayFeaturedImage && (
|
|
341
362
|
<>
|
|
342
|
-
<
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
newAttrs.featuredImageSizeHeight =
|
|
351
|
-
value.height;
|
|
352
|
-
}
|
|
353
|
-
setAttributes( newAttrs );
|
|
354
|
-
} }
|
|
355
|
-
slug={ featuredImageSizeSlug }
|
|
356
|
-
width={ featuredImageSizeWidth }
|
|
357
|
-
height={ featuredImageSizeHeight }
|
|
358
|
-
imageWidth={ defaultImageWidth }
|
|
359
|
-
imageHeight={ defaultImageHeight }
|
|
360
|
-
imageSizeOptions={ imageSizeOptions }
|
|
361
|
-
imageSizeHelp={ __(
|
|
362
|
-
'Select the size of the source image.'
|
|
363
|
-
) }
|
|
364
|
-
onChangeImage={ ( value ) =>
|
|
363
|
+
<ToolsPanelItem
|
|
364
|
+
hasValue={ () =>
|
|
365
|
+
featuredImageSizeSlug !== 'thumbnail' ||
|
|
366
|
+
featuredImageSizeWidth !== null ||
|
|
367
|
+
featuredImageSizeHeight !== null
|
|
368
|
+
}
|
|
369
|
+
label={ __( 'Image size' ) }
|
|
370
|
+
onDeselect={ () =>
|
|
365
371
|
setAttributes( {
|
|
366
|
-
featuredImageSizeSlug:
|
|
367
|
-
featuredImageSizeWidth:
|
|
368
|
-
featuredImageSizeHeight:
|
|
372
|
+
featuredImageSizeSlug: 'thumbnail',
|
|
373
|
+
featuredImageSizeWidth: null,
|
|
374
|
+
featuredImageSizeHeight: null,
|
|
369
375
|
} )
|
|
370
376
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
377
|
+
isShownByDefault
|
|
378
|
+
>
|
|
379
|
+
<ImageSizeControl
|
|
380
|
+
onChange={ ( value ) => {
|
|
381
|
+
const newAttrs = {};
|
|
382
|
+
if ( value.hasOwnProperty( 'width' ) ) {
|
|
383
|
+
newAttrs.featuredImageSizeWidth =
|
|
384
|
+
value.width;
|
|
385
|
+
}
|
|
386
|
+
if ( value.hasOwnProperty( 'height' ) ) {
|
|
387
|
+
newAttrs.featuredImageSizeHeight =
|
|
388
|
+
value.height;
|
|
389
|
+
}
|
|
390
|
+
setAttributes( newAttrs );
|
|
391
|
+
} }
|
|
392
|
+
slug={ featuredImageSizeSlug }
|
|
393
|
+
width={ featuredImageSizeWidth }
|
|
394
|
+
height={ featuredImageSizeHeight }
|
|
395
|
+
imageWidth={ defaultImageWidth }
|
|
396
|
+
imageHeight={ defaultImageHeight }
|
|
397
|
+
imageSizeOptions={ imageSizeOptions }
|
|
398
|
+
imageSizeHelp={ __(
|
|
399
|
+
'Select the size of the source image.'
|
|
400
|
+
) }
|
|
401
|
+
onChangeImage={ ( value ) =>
|
|
402
|
+
setAttributes( {
|
|
403
|
+
featuredImageSizeSlug: value,
|
|
404
|
+
featuredImageSizeWidth: undefined,
|
|
405
|
+
featuredImageSizeHeight: undefined,
|
|
406
|
+
} )
|
|
407
|
+
}
|
|
408
|
+
/>
|
|
409
|
+
</ToolsPanelItem>
|
|
410
|
+
<ToolsPanelItem
|
|
411
|
+
hasValue={ () => !! featuredImageAlign }
|
|
376
412
|
label={ __( 'Image alignment' ) }
|
|
377
|
-
|
|
378
|
-
onChange={ ( value ) =>
|
|
413
|
+
onDeselect={ () =>
|
|
379
414
|
setAttributes( {
|
|
380
|
-
featuredImageAlign:
|
|
381
|
-
value !== 'none' ? value : undefined,
|
|
415
|
+
featuredImageAlign: undefined,
|
|
382
416
|
} )
|
|
383
417
|
}
|
|
418
|
+
isShownByDefault
|
|
384
419
|
>
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
420
|
+
<ToggleGroupControl
|
|
421
|
+
className="editor-latest-posts-image-alignment-control"
|
|
422
|
+
__nextHasNoMarginBottom
|
|
423
|
+
__next40pxDefaultSize
|
|
424
|
+
label={ __( 'Image alignment' ) }
|
|
425
|
+
value={ featuredImageAlign || 'none' }
|
|
426
|
+
onChange={ ( value ) =>
|
|
427
|
+
setAttributes( {
|
|
428
|
+
featuredImageAlign:
|
|
429
|
+
value !== 'none'
|
|
430
|
+
? value
|
|
431
|
+
: undefined,
|
|
432
|
+
} )
|
|
395
433
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
434
|
+
>
|
|
435
|
+
{ imageAlignmentOptions.map(
|
|
436
|
+
( { value, icon, label } ) => {
|
|
437
|
+
return (
|
|
438
|
+
<ToggleGroupControlOptionIcon
|
|
439
|
+
key={ value }
|
|
440
|
+
value={ value }
|
|
441
|
+
icon={ icon }
|
|
442
|
+
label={ label }
|
|
443
|
+
/>
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
) }
|
|
447
|
+
</ToggleGroupControl>
|
|
448
|
+
</ToolsPanelItem>
|
|
449
|
+
<ToolsPanelItem
|
|
450
|
+
hasValue={ () => !! addLinkToFeaturedImage }
|
|
400
451
|
label={ __( 'Add link to featured image' ) }
|
|
401
|
-
|
|
402
|
-
onChange={ ( value ) =>
|
|
452
|
+
onDeselect={ () =>
|
|
403
453
|
setAttributes( {
|
|
404
|
-
addLinkToFeaturedImage:
|
|
454
|
+
addLinkToFeaturedImage: false,
|
|
405
455
|
} )
|
|
406
456
|
}
|
|
407
|
-
|
|
457
|
+
isShownByDefault
|
|
458
|
+
>
|
|
459
|
+
<ToggleControl
|
|
460
|
+
__nextHasNoMarginBottom
|
|
461
|
+
label={ __( 'Add link to featured image' ) }
|
|
462
|
+
checked={ addLinkToFeaturedImage }
|
|
463
|
+
onChange={ ( value ) =>
|
|
464
|
+
setAttributes( {
|
|
465
|
+
addLinkToFeaturedImage: value,
|
|
466
|
+
} )
|
|
467
|
+
}
|
|
468
|
+
/>
|
|
469
|
+
</ToolsPanelItem>
|
|
408
470
|
</>
|
|
409
471
|
) }
|
|
410
|
-
</
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
472
|
+
</ToolsPanel>
|
|
473
|
+
|
|
474
|
+
<ToolsPanel
|
|
475
|
+
label={ __( 'Sorting and filtering' ) }
|
|
476
|
+
resetAll={ () =>
|
|
477
|
+
setAttributes( {
|
|
478
|
+
order: 'desc',
|
|
479
|
+
orderBy: 'date',
|
|
480
|
+
postsToShow: 5,
|
|
481
|
+
categories: undefined,
|
|
482
|
+
selectedAuthor: undefined,
|
|
483
|
+
columns: 3,
|
|
484
|
+
} )
|
|
485
|
+
}
|
|
486
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
487
|
+
>
|
|
488
|
+
<ToolsPanelItem
|
|
489
|
+
hasValue={ () =>
|
|
490
|
+
order !== 'desc' ||
|
|
491
|
+
orderBy !== 'date' ||
|
|
492
|
+
postsToShow !== 5 ||
|
|
493
|
+
categories?.length > 0 ||
|
|
494
|
+
!! selectedAuthor
|
|
423
495
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
selectedCategories={ categories }
|
|
427
|
-
onAuthorChange={ ( value ) =>
|
|
496
|
+
label={ __( 'Sort and filter' ) }
|
|
497
|
+
onDeselect={ () =>
|
|
428
498
|
setAttributes( {
|
|
429
|
-
|
|
430
|
-
|
|
499
|
+
order: 'desc',
|
|
500
|
+
orderBy: 'date',
|
|
501
|
+
postsToShow: 5,
|
|
502
|
+
categories: undefined,
|
|
503
|
+
selectedAuthor: undefined,
|
|
431
504
|
} )
|
|
432
505
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
506
|
+
isShownByDefault
|
|
507
|
+
>
|
|
508
|
+
<QueryControls
|
|
509
|
+
{ ...{ order, orderBy } }
|
|
510
|
+
numberOfItems={ postsToShow }
|
|
511
|
+
onOrderChange={ ( value ) =>
|
|
512
|
+
setAttributes( { order: value } )
|
|
513
|
+
}
|
|
514
|
+
onOrderByChange={ ( value ) =>
|
|
515
|
+
setAttributes( { orderBy: value } )
|
|
516
|
+
}
|
|
517
|
+
onNumberOfItemsChange={ ( value ) =>
|
|
518
|
+
setAttributes( { postsToShow: value } )
|
|
519
|
+
}
|
|
520
|
+
categorySuggestions={ categorySuggestions }
|
|
521
|
+
onCategoryChange={ selectCategories }
|
|
522
|
+
selectedCategories={ categories }
|
|
523
|
+
onAuthorChange={ ( value ) =>
|
|
524
|
+
setAttributes( {
|
|
525
|
+
selectedAuthor:
|
|
526
|
+
'' !== value ? Number( value ) : undefined,
|
|
527
|
+
} )
|
|
528
|
+
}
|
|
529
|
+
authorList={ authorList ?? [] }
|
|
530
|
+
selectedAuthorId={ selectedAuthor }
|
|
531
|
+
/>
|
|
532
|
+
</ToolsPanelItem>
|
|
436
533
|
|
|
437
534
|
{ postLayout === 'grid' && (
|
|
438
|
-
<
|
|
439
|
-
|
|
440
|
-
__next40pxDefaultSize
|
|
535
|
+
<ToolsPanelItem
|
|
536
|
+
hasValue={ () => columns !== 3 }
|
|
441
537
|
label={ __( 'Columns' ) }
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
min={ 2 }
|
|
447
|
-
max={
|
|
448
|
-
! postCount
|
|
449
|
-
? MAX_POSTS_COLUMNS
|
|
450
|
-
: Math.min( MAX_POSTS_COLUMNS, postCount )
|
|
538
|
+
onDeselect={ () =>
|
|
539
|
+
setAttributes( {
|
|
540
|
+
columns: 3,
|
|
541
|
+
} )
|
|
451
542
|
}
|
|
452
|
-
|
|
453
|
-
|
|
543
|
+
isShownByDefault
|
|
544
|
+
>
|
|
545
|
+
<RangeControl
|
|
546
|
+
__nextHasNoMarginBottom
|
|
547
|
+
__next40pxDefaultSize
|
|
548
|
+
label={ __( 'Columns' ) }
|
|
549
|
+
value={ columns }
|
|
550
|
+
onChange={ ( value ) =>
|
|
551
|
+
setAttributes( { columns: value } )
|
|
552
|
+
}
|
|
553
|
+
min={ 2 }
|
|
554
|
+
max={
|
|
555
|
+
! postCount
|
|
556
|
+
? MAX_POSTS_COLUMNS
|
|
557
|
+
: Math.min( MAX_POSTS_COLUMNS, postCount )
|
|
558
|
+
}
|
|
559
|
+
required
|
|
560
|
+
/>
|
|
561
|
+
</ToolsPanelItem>
|
|
454
562
|
) }
|
|
455
|
-
</
|
|
563
|
+
</ToolsPanel>
|
|
456
564
|
</>
|
|
457
565
|
);
|
|
458
566
|
}
|
|
@@ -8,70 +8,180 @@ import {
|
|
|
8
8
|
PanelBody,
|
|
9
9
|
ToggleControl,
|
|
10
10
|
SelectControl,
|
|
11
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
12
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
11
13
|
} from '@wordpress/components';
|
|
14
|
+
import { Platform } from '@wordpress/element';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
20
|
+
|
|
21
|
+
const LIST_STYLE_OPTIONS = [
|
|
22
|
+
{
|
|
23
|
+
label: __( 'Numbers' ),
|
|
24
|
+
value: 'decimal',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: __( 'Uppercase letters' ),
|
|
28
|
+
value: 'upper-alpha',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: __( 'Lowercase letters' ),
|
|
32
|
+
value: 'lower-alpha',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: __( 'Uppercase Roman numerals' ),
|
|
36
|
+
value: 'upper-roman',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: __( 'Lowercase Roman numerals' ),
|
|
40
|
+
value: 'lower-roman',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => {
|
|
45
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<InspectorControls>
|
|
49
|
+
{ Platform.isNative ? (
|
|
50
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
51
|
+
<SelectControl
|
|
52
|
+
__next40pxDefaultSize
|
|
53
|
+
__nextHasNoMarginBottom
|
|
54
|
+
label={ __( 'List style' ) }
|
|
55
|
+
options={ LIST_STYLE_OPTIONS }
|
|
56
|
+
value={ type }
|
|
57
|
+
onChange={ ( newValue ) =>
|
|
58
|
+
setAttributes( { type: newValue } )
|
|
59
|
+
}
|
|
60
|
+
/>
|
|
61
|
+
<TextControl
|
|
62
|
+
__next40pxDefaultSize
|
|
63
|
+
__nextHasNoMarginBottom
|
|
64
|
+
label={ __( 'Start value' ) }
|
|
65
|
+
type="number"
|
|
66
|
+
onChange={ ( value ) => {
|
|
67
|
+
const int = parseInt( value, 10 );
|
|
68
|
+
|
|
69
|
+
setAttributes( {
|
|
70
|
+
// It should be possible to unset the value,
|
|
71
|
+
// e.g. with an empty string.
|
|
72
|
+
start: isNaN( int ) ? undefined : int,
|
|
73
|
+
} );
|
|
74
|
+
} }
|
|
75
|
+
value={
|
|
76
|
+
Number.isInteger( start )
|
|
77
|
+
? start.toString( 10 )
|
|
78
|
+
: ''
|
|
79
|
+
}
|
|
80
|
+
step="1"
|
|
81
|
+
/>
|
|
82
|
+
<ToggleControl
|
|
83
|
+
__nextHasNoMarginBottom
|
|
84
|
+
label={ __( 'Reverse order' ) }
|
|
85
|
+
checked={ reversed || false }
|
|
86
|
+
onChange={ ( value ) => {
|
|
87
|
+
setAttributes( {
|
|
88
|
+
// Unset the attribute if not reversed.
|
|
89
|
+
reversed: value || undefined,
|
|
90
|
+
} );
|
|
91
|
+
} }
|
|
92
|
+
/>
|
|
93
|
+
</PanelBody>
|
|
94
|
+
) : (
|
|
95
|
+
<ToolsPanel
|
|
96
|
+
label={ __( 'Settings' ) }
|
|
97
|
+
resetAll={ () => {
|
|
98
|
+
setAttributes( {
|
|
99
|
+
type: undefined,
|
|
100
|
+
start: undefined,
|
|
101
|
+
reversed: undefined,
|
|
102
|
+
} );
|
|
103
|
+
} }
|
|
104
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
105
|
+
>
|
|
106
|
+
<ToolsPanelItem
|
|
107
|
+
label={ __( 'List style' ) }
|
|
108
|
+
isShownByDefault
|
|
109
|
+
hasValue={ () => !! type }
|
|
110
|
+
onDeselect={ () =>
|
|
111
|
+
setAttributes( {
|
|
112
|
+
type: undefined,
|
|
113
|
+
} )
|
|
114
|
+
}
|
|
115
|
+
>
|
|
116
|
+
<SelectControl
|
|
117
|
+
__next40pxDefaultSize
|
|
118
|
+
__nextHasNoMarginBottom
|
|
119
|
+
label={ __( 'List style' ) }
|
|
120
|
+
options={ LIST_STYLE_OPTIONS }
|
|
121
|
+
value={ type || 'decimal' }
|
|
122
|
+
onChange={ ( newValue ) =>
|
|
123
|
+
setAttributes( { type: newValue } )
|
|
124
|
+
}
|
|
125
|
+
/>
|
|
126
|
+
</ToolsPanelItem>
|
|
127
|
+
<ToolsPanelItem
|
|
128
|
+
label={ __( 'Start value' ) }
|
|
129
|
+
isShownByDefault
|
|
130
|
+
hasValue={ () => !! start }
|
|
131
|
+
onDeselect={ () =>
|
|
132
|
+
setAttributes( {
|
|
133
|
+
start: undefined,
|
|
134
|
+
} )
|
|
135
|
+
}
|
|
136
|
+
>
|
|
137
|
+
<TextControl
|
|
138
|
+
__next40pxDefaultSize
|
|
139
|
+
__nextHasNoMarginBottom
|
|
140
|
+
label={ __( 'Start value' ) }
|
|
141
|
+
type="number"
|
|
142
|
+
onChange={ ( value ) => {
|
|
143
|
+
const int = parseInt( value, 10 );
|
|
52
144
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
145
|
+
setAttributes( {
|
|
146
|
+
// It should be possible to unset the value,
|
|
147
|
+
// e.g. with an empty string.
|
|
148
|
+
start: isNaN( int ) ? undefined : int,
|
|
149
|
+
} );
|
|
150
|
+
} }
|
|
151
|
+
value={
|
|
152
|
+
Number.isInteger( start )
|
|
153
|
+
? start.toString( 10 )
|
|
154
|
+
: ''
|
|
155
|
+
}
|
|
156
|
+
step="1"
|
|
157
|
+
/>
|
|
158
|
+
</ToolsPanelItem>
|
|
159
|
+
<ToolsPanelItem
|
|
160
|
+
label={ __( 'Reverse order' ) }
|
|
161
|
+
isShownByDefault
|
|
162
|
+
hasValue={ () => !! reversed }
|
|
163
|
+
onDeselect={ () =>
|
|
164
|
+
setAttributes( {
|
|
165
|
+
reversed: undefined,
|
|
166
|
+
} )
|
|
167
|
+
}
|
|
168
|
+
>
|
|
169
|
+
<ToggleControl
|
|
170
|
+
__nextHasNoMarginBottom
|
|
171
|
+
label={ __( 'Reverse order' ) }
|
|
172
|
+
checked={ reversed || false }
|
|
173
|
+
onChange={ ( value ) => {
|
|
174
|
+
setAttributes( {
|
|
175
|
+
// Unset the attribute if not reversed.
|
|
176
|
+
reversed: value || undefined,
|
|
177
|
+
} );
|
|
178
|
+
} }
|
|
179
|
+
/>
|
|
180
|
+
</ToolsPanelItem>
|
|
181
|
+
</ToolsPanel>
|
|
182
|
+
) }
|
|
183
|
+
</InspectorControls>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
76
186
|
|
|
77
187
|
export default OrderedListSettings;
|