@wordpress/dataviews 0.6.0 → 0.7.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 (63) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/add-filter.js +0 -2
  3. package/build/add-filter.js.map +1 -1
  4. package/build/bulk-actions.js +41 -3
  5. package/build/bulk-actions.js.map +1 -1
  6. package/build/dataviews.js +23 -16
  7. package/build/dataviews.js.map +1 -1
  8. package/build/filters.js +8 -1
  9. package/build/filters.js.map +1 -1
  10. package/build/pagination.js +2 -1
  11. package/build/pagination.js.map +1 -1
  12. package/build/reset-filters.js +2 -1
  13. package/build/reset-filters.js.map +1 -1
  14. package/build/search-widget.js +89 -4
  15. package/build/search-widget.js.map +1 -1
  16. package/build/single-selection-checkbox.js +7 -2
  17. package/build/single-selection-checkbox.js.map +1 -1
  18. package/build/view-actions.js.map +1 -1
  19. package/build/view-grid.js +10 -14
  20. package/build/view-grid.js.map +1 -1
  21. package/build/view-list.js +1 -1
  22. package/build/view-list.js.map +1 -1
  23. package/build/view-table.js +78 -45
  24. package/build/view-table.js.map +1 -1
  25. package/build-module/add-filter.js +0 -2
  26. package/build-module/add-filter.js.map +1 -1
  27. package/build-module/bulk-actions.js +40 -4
  28. package/build-module/bulk-actions.js.map +1 -1
  29. package/build-module/dataviews.js +24 -17
  30. package/build-module/dataviews.js.map +1 -1
  31. package/build-module/filters.js +8 -1
  32. package/build-module/filters.js.map +1 -1
  33. package/build-module/pagination.js +2 -1
  34. package/build-module/pagination.js.map +1 -1
  35. package/build-module/reset-filters.js +2 -1
  36. package/build-module/reset-filters.js.map +1 -1
  37. package/build-module/search-widget.js +91 -6
  38. package/build-module/search-widget.js.map +1 -1
  39. package/build-module/single-selection-checkbox.js +7 -2
  40. package/build-module/single-selection-checkbox.js.map +1 -1
  41. package/build-module/view-actions.js.map +1 -1
  42. package/build-module/view-grid.js +11 -15
  43. package/build-module/view-grid.js.map +1 -1
  44. package/build-module/view-list.js +2 -2
  45. package/build-module/view-list.js.map +1 -1
  46. package/build-module/view-table.js +80 -47
  47. package/build-module/view-table.js.map +1 -1
  48. package/build-style/style-rtl.css +67 -43
  49. package/build-style/style.css +67 -43
  50. package/package.json +11 -11
  51. package/src/add-filter.js +0 -2
  52. package/src/bulk-actions.js +54 -4
  53. package/src/dataviews.js +55 -44
  54. package/src/filters.js +6 -1
  55. package/src/pagination.js +6 -1
  56. package/src/reset-filters.js +2 -1
  57. package/src/search-widget.js +131 -6
  58. package/src/single-selection-checkbox.js +7 -1
  59. package/src/style.scss +99 -70
  60. package/src/view-actions.js +1 -1
  61. package/src/view-grid.js +11 -13
  62. package/src/view-list.js +2 -1
  63. package/src/view-table.js +113 -78
@@ -96,6 +96,7 @@
96
96
  --wp-admin-border-width-focus: 2px;
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
+ --wp-bound-block-color: #9747ff;
99
100
  }
100
101
  @media (min-resolution: 192dpi) {
101
102
  :root {
@@ -110,26 +111,26 @@
110
111
  box-sizing: border-box;
111
112
  scroll-padding-bottom: 64px;
112
113
  }
113
- .dataviews-wrapper > div {
114
- min-height: 100%;
115
- }
116
114
 
117
115
  .dataviews-filters__view-actions {
118
116
  padding: 12px 32px 0;
119
- }
120
- .dataviews-filters__view-actions .components-search-control {
121
- flex-grow: 1;
117
+ margin-bottom: 12px;
118
+ flex-shrink: 0;
119
+ position: sticky;
120
+ left: 0;
122
121
  }
123
122
  .dataviews-filters__view-actions .components-search-control .components-base-control__field {
124
123
  max-width: 240px;
125
124
  }
126
125
 
127
126
  .dataviews-filters__container {
128
- padding: 0 32px;
127
+ padding-right: 32px;
129
128
  }
130
-
131
- .dataviews-filters__view-actions.components-h-stack {
132
- align-items: center;
129
+ .dataviews-filters__container .dataviews-filters__reset-button[aria-disabled=true], .dataviews-filters__container .dataviews-filters__reset-button[aria-disabled=true]:hover {
130
+ opacity: 0;
131
+ }
132
+ .dataviews-filters__container .dataviews-filters__reset-button[aria-disabled=true]:focus {
133
+ opacity: 1;
133
134
  }
134
135
 
135
136
  .dataviews-filters-button {
@@ -137,23 +138,25 @@
137
138
  }
138
139
 
139
140
  .dataviews-pagination {
140
- margin-top: auto;
141
141
  position: sticky;
142
142
  bottom: 0;
143
- background-color: rgba(255, 255, 255, 0.8);
144
- -webkit-backdrop-filter: blur(6px);
145
- backdrop-filter: blur(6px);
143
+ left: 0;
144
+ background-color: #fff;
146
145
  padding: 12px 32px;
147
146
  border-top: 1px solid #f0f0f0;
148
147
  color: #757575;
148
+ flex-shrink: 0;
149
149
  }
150
150
 
151
- .dataviews-filters-options {
152
- margin: 32px 0 16px;
151
+ .dataviews-pagination__page-selection {
152
+ font-size: 11px;
153
+ text-transform: uppercase;
154
+ font-weight: 500;
155
+ color: #1e1e1e;
153
156
  }
154
157
 
155
- .dataviews-view-table-wrapper {
156
- overflow-x: auto;
158
+ .dataviews-filters-options {
159
+ margin: 32px 0 16px;
157
160
  }
158
161
 
159
162
  .dataviews-view-table {
@@ -218,10 +221,10 @@
218
221
  .dataviews-view-table tr:hover {
219
222
  background-color: #f8f8f8;
220
223
  }
221
- .dataviews-view-table tr .components-checkbox-control__input {
224
+ .dataviews-view-table tr .components-checkbox-control__input.components-checkbox-control__input {
222
225
  opacity: 0;
223
226
  }
224
- .dataviews-view-table tr .components-checkbox-control__input:checked, .dataviews-view-table tr .components-checkbox-control__input:indeterminate, .dataviews-view-table tr .components-checkbox-control__input:focus {
227
+ .dataviews-view-table tr .components-checkbox-control__input.components-checkbox-control__input:checked, .dataviews-view-table tr .components-checkbox-control__input.components-checkbox-control__input:indeterminate, .dataviews-view-table tr .components-checkbox-control__input.components-checkbox-control__input:focus {
225
228
  opacity: 1;
226
229
  }
227
230
  .dataviews-view-table tr:focus-within .components-checkbox-control__input, .dataviews-view-table tr:hover .components-checkbox-control__input {
@@ -234,17 +237,19 @@
234
237
  .dataviews-view-table tr.is-selected:hover {
235
238
  background-color: rgba(var(--wp-admin-theme-color--rgb), 0.08);
236
239
  }
240
+ .dataviews-view-table thead {
241
+ position: sticky;
242
+ inset-block-start: 0;
243
+ z-index: 1;
244
+ }
237
245
  .dataviews-view-table thead tr {
238
246
  border: 0;
239
247
  }
240
248
  .dataviews-view-table thead th {
241
- position: sticky;
242
- top: -1px;
243
249
  background-color: #fff;
244
250
  box-shadow: inset 0 -1px 0 #f0f0f0;
245
251
  padding-top: 8px;
246
252
  padding-bottom: 8px;
247
- z-index: 1;
248
253
  font-size: 11px;
249
254
  text-transform: uppercase;
250
255
  font-weight: 500;
@@ -282,6 +287,9 @@
282
287
  .dataviews-view-table .dataviews-view-table__actions-column {
283
288
  width: 1%;
284
289
  }
290
+ .dataviews-view-table:has(tr.is-selected) .components-checkbox-control__input {
291
+ opacity: 1;
292
+ }
285
293
 
286
294
  .dataviews-view-list__primary-field,
287
295
  .dataviews-view-grid__primary-field,
@@ -291,7 +299,6 @@
291
299
  color: #1e1e1e;
292
300
  text-overflow: ellipsis;
293
301
  white-space: nowrap;
294
- overflow: hidden;
295
302
  display: block;
296
303
  width: 100%;
297
304
  }
@@ -311,6 +318,13 @@
311
318
  .dataviews-view-table__primary-field a:hover {
312
319
  color: #1e1e1e;
313
320
  }
321
+ .dataviews-view-list__primary-field a:focus,
322
+ .dataviews-view-grid__primary-field a:focus,
323
+ .dataviews-view-table__primary-field a:focus {
324
+ color: var(--wp-admin-theme-color--rgb);
325
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color, #007cba);
326
+ border-radius: 2px;
327
+ }
314
328
  .dataviews-view-list__primary-field button.components-button.is-link,
315
329
  .dataviews-view-grid__primary-field button.components-button.is-link,
316
330
  .dataviews-view-table__primary-field button.components-button.is-link {
@@ -512,6 +526,10 @@
512
526
  .dataviews-no-results,
513
527
  .dataviews-loading {
514
528
  padding: 0 32px;
529
+ flex-grow: 1;
530
+ display: flex;
531
+ align-items: center;
532
+ justify-content: center;
515
533
  }
516
534
 
517
535
  .dataviews-view-table-selection-checkbox label {
@@ -539,10 +557,6 @@
539
557
  margin-left: 8px;
540
558
  }
541
559
 
542
- .dataviews-view-grid__card.has-no-pointer-events * {
543
- pointer-events: none;
544
- }
545
-
546
560
  .dataviews-filter-summary__popover .components-popover__content {
547
561
  width: 230px;
548
562
  padding: 0;
@@ -555,7 +569,17 @@
555
569
  overflow: auto;
556
570
  border-top: 1px solid #e0e0e0;
557
571
  }
558
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item {
572
+ .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item-value [data-user-value] {
573
+ font-weight: 600;
574
+ }
575
+
576
+ .dataviews-search-widget-listbox {
577
+ max-height: 184px;
578
+ padding: 4px;
579
+ overflow: auto;
580
+ }
581
+
582
+ .dataviews-search-widget-listitem {
559
583
  display: flex;
560
584
  align-items: center;
561
585
  gap: 8px;
@@ -565,28 +589,25 @@
565
589
  cursor: default;
566
590
  margin-block-end: 2px;
567
591
  }
568
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:last-child {
592
+ .dataviews-search-widget-listitem:last-child {
569
593
  margin-block-end: 0;
570
594
  }
571
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:hover, .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item[data-active-item], .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:focus {
595
+ .dataviews-search-widget-listitem:hover, .dataviews-search-widget-listitem[data-active-item], .dataviews-search-widget-listitem:focus {
572
596
  background-color: var(--wp-admin-theme-color);
573
597
  color: #fff;
574
598
  }
575
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:hover .dataviews-search-widget-filter-combobox-item-check, .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item[data-active-item] .dataviews-search-widget-filter-combobox-item-check, .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:focus .dataviews-search-widget-filter-combobox-item-check {
599
+ .dataviews-search-widget-listitem:hover .dataviews-search-widget-listitem-check, .dataviews-search-widget-listitem[data-active-item] .dataviews-search-widget-listitem-check, .dataviews-search-widget-listitem:focus .dataviews-search-widget-listitem-check {
576
600
  fill: #fff;
577
601
  }
578
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:hover .dataviews-search-widget-filter-combobox-item-description, .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item[data-active-item] .dataviews-search-widget-filter-combobox-item-description, .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item:focus .dataviews-search-widget-filter-combobox-item-description {
602
+ .dataviews-search-widget-listitem:hover .dataviews-search-widget-listitem-description, .dataviews-search-widget-listitem[data-active-item] .dataviews-search-widget-listitem-description, .dataviews-search-widget-listitem:focus .dataviews-search-widget-listitem-description {
579
603
  color: #fff;
580
604
  }
581
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item .dataviews-search-widget-filter-combobox-item-check {
605
+ .dataviews-search-widget-listitem .dataviews-search-widget-listitem-check {
582
606
  width: 24px;
583
607
  height: 24px;
584
608
  flex-shrink: 0;
585
609
  }
586
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item .dataviews-search-widget-filter-combobox-item-value [data-user-value] {
587
- font-weight: 600;
588
- }
589
- .dataviews-search-widget-filter-combobox-list .dataviews-search-widget-filter-combobox-item .dataviews-search-widget-filter-combobox-item-description {
610
+ .dataviews-search-widget-listitem .dataviews-search-widget-listitem-description {
590
611
  display: block;
591
612
  overflow: hidden;
592
613
  text-overflow: ellipsis;
@@ -676,8 +697,11 @@
676
697
  }
677
698
 
678
699
  .dataviews-filter-summary__operators-container {
679
- padding: 8px 8px 4px;
680
- padding-bottom: 0;
700
+ padding: 8px 8px 0;
701
+ }
702
+ .dataviews-filter-summary__operators-container:has(+ .dataviews-search-widget-listbox) {
703
+ border-bottom: 1px solid #e0e0e0;
704
+ padding-bottom: 8px;
681
705
  }
682
706
  .dataviews-filter-summary__operators-container:empty {
683
707
  display: none;
@@ -705,7 +729,7 @@
705
729
  .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip.has-reset {
706
730
  padding-inline-end: 28px;
707
731
  }
708
- .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip:hover, .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip:focus-visible {
732
+ .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip:hover, .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip:focus-visible, .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip[aria-expanded=true] {
709
733
  background: #e0e0e0;
710
734
  color: #1e1e1e;
711
735
  }
@@ -713,8 +737,8 @@
713
737
  color: var(--wp-admin-theme-color);
714
738
  background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
715
739
  }
716
- .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip.has-values:hover {
717
- background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
740
+ .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip.has-values:hover, .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip.has-values[aria-expanded=true] {
741
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.12);
718
742
  }
719
743
  .dataviews-filter-summary__chip-container .dataviews-filter-summary__chip:focus-visible {
720
744
  outline: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dataviews",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,15 +29,15 @@
29
29
  "dependencies": {
30
30
  "@ariakit/react": "^0.3.12",
31
31
  "@babel/runtime": "^7.16.0",
32
- "@wordpress/a11y": "^3.52.0",
33
- "@wordpress/components": "^27.0.0",
34
- "@wordpress/compose": "^6.29.0",
35
- "@wordpress/element": "^5.29.0",
36
- "@wordpress/i18n": "^4.52.0",
37
- "@wordpress/icons": "^9.43.0",
38
- "@wordpress/keycodes": "^3.52.0",
39
- "@wordpress/primitives": "^3.50.0",
40
- "@wordpress/private-apis": "^0.34.0",
32
+ "@wordpress/a11y": "^3.53.0",
33
+ "@wordpress/components": "^27.1.0",
34
+ "@wordpress/compose": "^6.30.0",
35
+ "@wordpress/element": "^5.30.0",
36
+ "@wordpress/i18n": "^4.53.0",
37
+ "@wordpress/icons": "^9.44.0",
38
+ "@wordpress/keycodes": "^3.53.0",
39
+ "@wordpress/primitives": "^3.51.0",
40
+ "@wordpress/private-apis": "^0.35.0",
41
41
  "classnames": "^2.3.1",
42
42
  "remove-accents": "^0.5.0"
43
43
  },
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "c139588f4c668b38bafbc5431f2f4e3903dbe683"
50
+ "gitHead": "ac3c3e465a083081a86a4da6ee6fb817b41e5130"
51
51
  }
package/src/add-filter.js CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  privateApis as componentsPrivateApis,
6
6
  Button,
7
7
  } from '@wordpress/components';
8
- import { plus } from '@wordpress/icons';
9
8
  import { __ } from '@wordpress/i18n';
10
9
  import { forwardRef } from '@wordpress/element';
11
10
 
@@ -31,7 +30,6 @@ function AddFilter( { filters, view, onChangeView, setOpenedFilter }, ref ) {
31
30
  <Button
32
31
  __experimentalIsFocusable
33
32
  size="compact"
34
- icon={ plus }
35
33
  className="dataviews-filters-button"
36
34
  variant="tertiary"
37
35
  disabled={ ! inactiveFilters.length }
@@ -7,7 +7,7 @@ import {
7
7
  Modal,
8
8
  } from '@wordpress/components';
9
9
  import { __, sprintf, _n } from '@wordpress/i18n';
10
- import { useMemo, useState, useCallback } from '@wordpress/element';
10
+ import { useMemo, useState, useCallback, useEffect } from '@wordpress/element';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -21,6 +21,24 @@ const {
21
21
  DropdownMenuSeparatorV2: DropdownMenuSeparator,
22
22
  } = unlock( componentsPrivateApis );
23
23
 
24
+ export function useHasAPossibleBulkAction( actions, item ) {
25
+ return useMemo( () => {
26
+ return actions.some( ( action ) => {
27
+ return action.supportsBulk && action.isEligible( item );
28
+ } );
29
+ }, [ actions, item ] );
30
+ }
31
+
32
+ export function useSomeItemHasAPossibleBulkAction( actions, data ) {
33
+ return useMemo( () => {
34
+ return data.some( ( item ) => {
35
+ return actions.some( ( action ) => {
36
+ return action.supportsBulk && action.isEligible( item );
37
+ } );
38
+ } );
39
+ }, [ actions, data ] );
40
+ }
41
+
24
42
  function ActionWithModal( {
25
43
  action,
26
44
  selectedItems,
@@ -107,15 +125,47 @@ export default function BulkActions( {
107
125
  () => actions.filter( ( action ) => action.supportsBulk ),
108
126
  [ actions ]
109
127
  );
110
- const areAllSelected = selection && selection.length === data.length;
111
128
  const [ isMenuOpen, onMenuOpenChange ] = useState( false );
112
129
  const [ actionWithModal, setActionWithModal ] = useState();
130
+ const selectableItems = useMemo( () => {
131
+ return data.filter( ( item ) => {
132
+ return bulkActions.some( ( action ) => action.isEligible( item ) );
133
+ } );
134
+ }, [ data, bulkActions ] );
135
+
136
+ const numberSelectableItems = selectableItems.length;
137
+ const areAllSelected =
138
+ selection && selection.length === numberSelectableItems;
139
+
113
140
  const selectedItems = useMemo( () => {
114
141
  return data.filter( ( item ) =>
115
142
  selection.includes( getItemId( item ) )
116
143
  );
117
144
  }, [ selection, data, getItemId ] );
118
145
 
146
+ const hasNonSelectableItemSelected = useMemo( () => {
147
+ return selectedItems.some( ( item ) => {
148
+ return ! selectableItems.includes( item );
149
+ } );
150
+ }, [ selectedItems, selectableItems ] );
151
+ useEffect( () => {
152
+ if ( hasNonSelectableItemSelected ) {
153
+ onSelectionChange(
154
+ selectedItems.filter( ( selectedItem ) => {
155
+ return selectableItems.some( ( item ) => {
156
+ return getItemId( selectedItem ) === getItemId( item );
157
+ } );
158
+ } )
159
+ );
160
+ }
161
+ }, [
162
+ hasNonSelectableItemSelected,
163
+ selectedItems,
164
+ selectableItems,
165
+ getItemId,
166
+ onSelectionChange,
167
+ ] );
168
+
119
169
  if ( bulkActions.length === 0 ) {
120
170
  return null;
121
171
  }
@@ -157,9 +207,9 @@ export default function BulkActions( {
157
207
  disabled={ areAllSelected }
158
208
  hideOnClick={ false }
159
209
  onClick={ () => {
160
- onSelectionChange( data );
210
+ onSelectionChange( selectableItems );
161
211
  } }
162
- suffix={ data.length }
212
+ suffix={ numberSelectableItems }
163
213
  >
164
214
  { __( 'Select all' ) }
165
215
  </DropdownMenuItem>
package/src/dataviews.js CHANGED
@@ -1,10 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- __experimentalVStack as VStack,
6
- __experimentalHStack as HStack,
7
- } from '@wordpress/components';
4
+ import { __experimentalHStack as HStack } from '@wordpress/components';
8
5
  import { useMemo, useState, useCallback, useEffect } from '@wordpress/element';
9
6
 
10
7
  /**
@@ -20,6 +17,16 @@ import BulkActions from './bulk-actions';
20
17
  const defaultGetItemId = ( item ) => item.id;
21
18
  const defaultOnSelectionChange = () => {};
22
19
 
20
+ function useSomeItemHasAPossibleBulkAction( actions, data ) {
21
+ return useMemo( () => {
22
+ return data.some( ( item ) => {
23
+ return actions.some( ( action ) => {
24
+ return action.supportsBulk && action.isEligible( item );
25
+ } );
26
+ } );
27
+ }, [ actions, data ] );
28
+ }
29
+
23
30
  export default function DataViews( {
24
31
  view,
25
32
  onChangeView,
@@ -75,13 +82,22 @@ export default function DataViews( {
75
82
  render: field.render || field.getValue,
76
83
  } ) );
77
84
  }, [ fields ] );
85
+
86
+ const hasPossibleBulkAction = useSomeItemHasAPossibleBulkAction(
87
+ actions,
88
+ data
89
+ );
78
90
  return (
79
91
  <div className="dataviews-wrapper">
80
- <VStack spacing={ 3 } justify="flex-start">
92
+ <HStack
93
+ alignment="top"
94
+ justify="start"
95
+ className="dataviews-filters__view-actions"
96
+ >
81
97
  <HStack
82
- alignment="flex-start"
83
98
  justify="start"
84
- className="dataviews-filters__view-actions"
99
+ className="dataviews-filters__container"
100
+ wrap
85
101
  >
86
102
  { search && (
87
103
  <Search
@@ -90,27 +106,6 @@ export default function DataViews( {
90
106
  onChangeView={ onChangeView }
91
107
  />
92
108
  ) }
93
- { [ LAYOUT_TABLE, LAYOUT_GRID ].includes( view.type ) && (
94
- <BulkActions
95
- actions={ actions }
96
- data={ data }
97
- onSelectionChange={ onSetSelection }
98
- selection={ selection }
99
- getItemId={ getItemId }
100
- />
101
- ) }
102
- <ViewActions
103
- fields={ _fields }
104
- view={ view }
105
- onChangeView={ onChangeView }
106
- supportedLayouts={ supportedLayouts }
107
- />
108
- </HStack>
109
- <HStack
110
- justify="start"
111
- className="dataviews-filters__container"
112
- wrap
113
- >
114
109
  <Filters
115
110
  fields={ _fields }
116
111
  view={ view }
@@ -119,26 +114,42 @@ export default function DataViews( {
119
114
  setOpenedFilter={ setOpenedFilter }
120
115
  />
121
116
  </HStack>
122
- <ViewComponent
117
+ { [ LAYOUT_TABLE, LAYOUT_GRID ].includes( view.type ) &&
118
+ hasPossibleBulkAction && (
119
+ <BulkActions
120
+ actions={ actions }
121
+ data={ data }
122
+ onSelectionChange={ onSetSelection }
123
+ selection={ selection }
124
+ getItemId={ getItemId }
125
+ />
126
+ ) }
127
+ <ViewActions
123
128
  fields={ _fields }
124
129
  view={ view }
125
130
  onChangeView={ onChangeView }
126
- actions={ actions }
127
- data={ data }
128
- getItemId={ getItemId }
129
- isLoading={ isLoading }
130
- onSelectionChange={ onSetSelection }
131
- onDetailsChange={ onDetailsChange }
132
- selection={ selection }
133
- deferredRendering={ deferredRendering }
134
- setOpenedFilter={ setOpenedFilter }
135
- />
136
- <Pagination
137
- view={ view }
138
- onChangeView={ onChangeView }
139
- paginationInfo={ paginationInfo }
131
+ supportedLayouts={ supportedLayouts }
140
132
  />
141
- </VStack>
133
+ </HStack>
134
+ <ViewComponent
135
+ fields={ _fields }
136
+ view={ view }
137
+ onChangeView={ onChangeView }
138
+ actions={ actions }
139
+ data={ data }
140
+ getItemId={ getItemId }
141
+ isLoading={ isLoading }
142
+ onSelectionChange={ onSetSelection }
143
+ onDetailsChange={ onDetailsChange }
144
+ selection={ selection }
145
+ deferredRendering={ deferredRendering }
146
+ setOpenedFilter={ setOpenedFilter }
147
+ />
148
+ <Pagination
149
+ view={ view }
150
+ onChangeView={ onChangeView }
151
+ paginationInfo={ paginationInfo }
152
+ />
142
153
  </div>
143
154
  );
144
155
  }
package/src/filters.js CHANGED
@@ -11,6 +11,7 @@ import AddFilter from './add-filter';
11
11
  import ResetFilters from './reset-filters';
12
12
  import { sanitizeOperators } from './utils';
13
13
  import { ENUMERATION_TYPE, OPERATOR_IN, OPERATOR_NOT_IN } from './constants';
14
+ import { __experimentalHStack as HStack } from '@wordpress/components';
14
15
 
15
16
  const Filters = memo( function Filters( {
16
17
  fields,
@@ -108,7 +109,11 @@ const Filters = memo( function Filters( {
108
109
  );
109
110
  }
110
111
 
111
- return filterComponents;
112
+ return (
113
+ <HStack justify="flex-start" style={ { width: 'fit-content' } } wrap>
114
+ { filterComponents }
115
+ </HStack>
116
+ );
112
117
  } );
113
118
 
114
119
  export default Filters;
package/src/pagination.js CHANGED
@@ -27,7 +27,12 @@ const Pagination = memo( function Pagination( {
27
27
  justify="end"
28
28
  className="dataviews-pagination"
29
29
  >
30
- <HStack justify="flex-start" expanded={ false } spacing={ 2 }>
30
+ <HStack
31
+ justify="flex-start"
32
+ expanded={ false }
33
+ spacing={ 2 }
34
+ className="dataviews-pagination__page-selection"
35
+ >
31
36
  { createInterpolateElement(
32
37
  sprintf(
33
38
  // translators: %s: Total number of pages.
@@ -21,6 +21,7 @@ export default function ResetFilter( { filters, view, onChangeView } ) {
21
21
  __experimentalIsFocusable
22
22
  size="compact"
23
23
  variant="tertiary"
24
+ className="dataviews-filters__reset-button"
24
25
  onClick={ () => {
25
26
  onChangeView( {
26
27
  ...view,
@@ -30,7 +31,7 @@ export default function ResetFilter( { filters, view, onChangeView } ) {
30
31
  } );
31
32
  } }
32
33
  >
33
- { __( 'Reset filters' ) }
34
+ { __( 'Reset' ) }
34
35
  </Button>
35
36
  );
36
37
  }