@wordpress/edit-site 5.21.0 → 5.21.1-next.f8d8eceb.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.
Files changed (107) hide show
  1. package/build/components/actions/index.js +121 -0
  2. package/build/components/actions/index.js.map +1 -0
  3. package/build/components/block-editor/use-site-editor-settings.js +12 -4
  4. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  5. package/build/components/dataviews/context.js +15 -0
  6. package/build/components/dataviews/context.js.map +1 -0
  7. package/build/components/dataviews/dataviews.js +10 -2
  8. package/build/components/dataviews/dataviews.js.map +1 -1
  9. package/build/components/dataviews/filters.js +30 -17
  10. package/build/components/dataviews/filters.js.map +1 -1
  11. package/build/components/dataviews/in-filter.js +5 -7
  12. package/build/components/dataviews/in-filter.js.map +1 -1
  13. package/build/components/dataviews/item-actions.js +62 -0
  14. package/build/components/dataviews/item-actions.js.map +1 -0
  15. package/build/components/dataviews/pagination.js +31 -50
  16. package/build/components/dataviews/pagination.js.map +1 -1
  17. package/build/components/dataviews/{text-filter.js → search.js} +10 -10
  18. package/build/components/dataviews/search.js.map +1 -0
  19. package/build/components/dataviews/view-grid.js +3 -3
  20. package/build/components/dataviews/view-grid.js.map +1 -1
  21. package/build/components/dataviews/view-list.js +2 -2
  22. package/build/components/dataviews/view-list.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/font-collection.js +1 -1
  24. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  25. package/build/components/global-styles/screen-block.js +1 -8
  26. package/build/components/global-styles/screen-block.js.map +1 -1
  27. package/build/components/page-pages/default-views.js +60 -0
  28. package/build/components/page-pages/default-views.js.map +1 -0
  29. package/build/components/page-pages/index.js +73 -52
  30. package/build/components/page-pages/index.js.map +1 -1
  31. package/build/components/sidebar/index.js +3 -1
  32. package/build/components/sidebar/index.js.map +1 -1
  33. package/build/components/sidebar-dataviews/index.js +72 -0
  34. package/build/components/sidebar-dataviews/index.js.map +1 -0
  35. package/build/hooks/commands/use-edit-mode-commands.js +3 -2
  36. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  37. package/build-module/components/actions/index.js +108 -0
  38. package/build-module/components/actions/index.js.map +1 -0
  39. package/build-module/components/block-editor/use-site-editor-settings.js +12 -4
  40. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  41. package/build-module/components/dataviews/context.js +7 -0
  42. package/build-module/components/dataviews/context.js.map +1 -0
  43. package/build-module/components/dataviews/dataviews.js +10 -2
  44. package/build-module/components/dataviews/dataviews.js.map +1 -1
  45. package/build-module/components/dataviews/filters.js +30 -17
  46. package/build-module/components/dataviews/filters.js.map +1 -1
  47. package/build-module/components/dataviews/in-filter.js +5 -7
  48. package/build-module/components/dataviews/in-filter.js.map +1 -1
  49. package/build-module/components/dataviews/item-actions.js +55 -0
  50. package/build-module/components/dataviews/item-actions.js.map +1 -0
  51. package/build-module/components/dataviews/pagination.js +32 -51
  52. package/build-module/components/dataviews/pagination.js.map +1 -1
  53. package/build-module/components/dataviews/{text-filter.js → search.js} +9 -9
  54. package/build-module/components/dataviews/search.js.map +1 -0
  55. package/build-module/components/dataviews/view-grid.js +3 -3
  56. package/build-module/components/dataviews/view-grid.js.map +1 -1
  57. package/build-module/components/dataviews/view-list.js +2 -2
  58. package/build-module/components/dataviews/view-list.js.map +1 -1
  59. package/build-module/components/global-styles/font-library-modal/font-collection.js +1 -1
  60. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  61. package/build-module/components/global-styles/screen-block.js +1 -8
  62. package/build-module/components/global-styles/screen-block.js.map +1 -1
  63. package/build-module/components/page-pages/default-views.js +53 -0
  64. package/build-module/components/page-pages/default-views.js.map +1 -0
  65. package/build-module/components/page-pages/index.js +71 -52
  66. package/build-module/components/page-pages/index.js.map +1 -1
  67. package/build-module/components/sidebar/index.js +3 -1
  68. package/build-module/components/sidebar/index.js.map +1 -1
  69. package/build-module/components/sidebar-dataviews/index.js +64 -0
  70. package/build-module/components/sidebar-dataviews/index.js.map +1 -0
  71. package/build-module/hooks/commands/use-edit-mode-commands.js +4 -3
  72. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  73. package/build-style/style-rtl.css +9 -5
  74. package/build-style/style.css +9 -5
  75. package/package.json +40 -40
  76. package/src/components/actions/index.js +123 -0
  77. package/src/components/block-editor/use-site-editor-settings.js +21 -13
  78. package/src/components/dataviews/README.md +134 -47
  79. package/src/components/dataviews/context.js +7 -0
  80. package/src/components/dataviews/dataviews.js +11 -1
  81. package/src/components/dataviews/filters.js +35 -17
  82. package/src/components/dataviews/in-filter.js +5 -7
  83. package/src/components/dataviews/item-actions.js +69 -0
  84. package/src/components/dataviews/pagination.js +53 -74
  85. package/src/components/dataviews/{text-filter.js → search.js} +7 -7
  86. package/src/components/dataviews/style.scss +10 -5
  87. package/src/components/dataviews/view-grid.js +7 -2
  88. package/src/components/dataviews/view-list.js +2 -2
  89. package/src/components/global-styles/font-library-modal/font-collection.js +1 -1
  90. package/src/components/global-styles/screen-block.js +1 -7
  91. package/src/components/page-pages/default-views.js +58 -0
  92. package/src/components/page-pages/index.js +85 -60
  93. package/src/components/sidebar/index.js +2 -0
  94. package/src/components/sidebar-dataviews/index.js +65 -0
  95. package/src/hooks/commands/use-edit-mode-commands.js +3 -1
  96. package/build/components/actions/trash-post.js +0 -48
  97. package/build/components/actions/trash-post.js.map +0 -1
  98. package/build/components/dataviews/field-actions.js +0 -30
  99. package/build/components/dataviews/field-actions.js.map +0 -1
  100. package/build/components/dataviews/text-filter.js.map +0 -1
  101. package/build-module/components/actions/trash-post.js +0 -41
  102. package/build-module/components/actions/trash-post.js.map +0 -1
  103. package/build-module/components/dataviews/field-actions.js +0 -22
  104. package/build-module/components/dataviews/field-actions.js.map +0 -1
  105. package/build-module/components/dataviews/text-filter.js.map +0 -1
  106. package/src/components/actions/trash-post.js +0 -55
  107. package/src/components/dataviews/field-actions.js +0 -28
@@ -1,55 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useDispatch } from '@wordpress/data';
5
- import { decodeEntities } from '@wordpress/html-entities';
6
- import { store as coreStore } from '@wordpress/core-data';
7
- import { __, sprintf } from '@wordpress/i18n';
8
- import { store as noticesStore } from '@wordpress/notices';
9
- import { useMemo } from '@wordpress/element';
10
-
11
- export default function useMoveToTrashAction() {
12
- const { createSuccessNotice, createErrorNotice } =
13
- useDispatch( noticesStore );
14
- const { deleteEntityRecord } = useDispatch( coreStore );
15
-
16
- return useMemo(
17
- () => ( {
18
- id: 'move-to-trash',
19
- label: __( 'Move to Trash' ),
20
- async perform( post ) {
21
- try {
22
- await deleteEntityRecord(
23
- 'postType',
24
- post.type,
25
- post.id,
26
- {},
27
- { throwOnError: true }
28
- );
29
- createSuccessNotice(
30
- sprintf(
31
- /* translators: The page's title. */
32
- __( '"%s" moved to the Trash.' ),
33
- decodeEntities( post.title.rendered )
34
- ),
35
- {
36
- type: 'snackbar',
37
- id: 'edit-site-page-trashed',
38
- }
39
- );
40
- } catch ( error ) {
41
- const errorMessage =
42
- error.message && error.code !== 'unknown_error'
43
- ? error.message
44
- : __(
45
- 'An error occurred while moving the page to the trash.'
46
- );
47
-
48
- createErrorNotice( errorMessage, { type: 'snackbar' } );
49
- }
50
- },
51
- isDesctructive: true,
52
- } ),
53
- [ createSuccessNotice, createErrorNotice, deleteEntityRecord ]
54
- );
55
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
5
- import { __ } from '@wordpress/i18n';
6
- import { moreVertical } from '@wordpress/icons';
7
-
8
- function FieldActions( { item, actions } ) {
9
- return (
10
- <DropdownMenu icon={ moreVertical } label={ __( 'Actions' ) }>
11
- { () => (
12
- <MenuGroup>
13
- { actions.map( ( action ) => (
14
- <MenuItem
15
- key={ action.id }
16
- onClick={ () => action.perform( item ) }
17
- isDestructive={ action.isDesctructive }
18
- >
19
- { action.label }
20
- </MenuItem>
21
- ) ) }
22
- </MenuGroup>
23
- ) }
24
- </DropdownMenu>
25
- );
26
- }
27
-
28
- export default FieldActions;