@wordpress/dataviews 2.2.0 → 4.0.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 +23 -0
- package/README.md +23 -8
- package/build/components/dataform/index.js +78 -0
- package/build/components/dataform/index.js.map +1 -0
- package/build/components/dataviews/index.js +115 -0
- package/build/components/dataviews/index.js.map +1 -0
- package/build/{bulk-actions.js → components/dataviews-bulk-actions/index.js} +39 -16
- package/build/components/dataviews-bulk-actions/index.js.map +1 -0
- package/build/{bulk-actions-toolbar.js → components/dataviews-bulk-actions-toolbar/index.js} +36 -20
- package/build/components/dataviews-bulk-actions-toolbar/index.js.map +1 -0
- package/build/components/dataviews-context/index.js +36 -0
- package/build/components/dataviews-context/index.js.map +1 -0
- package/build/{add-filter.js → components/dataviews-filters/add-filter.js} +3 -3
- package/build/components/dataviews-filters/add-filter.js.map +1 -0
- package/build/{filter-summary.js → components/dataviews-filters/filter-summary.js} +15 -14
- package/build/components/dataviews-filters/filter-summary.js.map +1 -0
- package/build/{filters.js → components/dataviews-filters/index.js} +15 -16
- package/build/components/dataviews-filters/index.js.map +1 -0
- package/build/{reset-filters.js → components/dataviews-filters/reset-filters.js} +1 -1
- package/build/components/dataviews-filters/reset-filters.js.map +1 -0
- package/build/{search-widget.js → components/dataviews-filters/search-widget.js} +21 -19
- package/build/components/dataviews-filters/search-widget.js.map +1 -0
- package/build/{item-actions.js → components/dataviews-item-actions/index.js} +3 -3
- package/build/components/dataviews-item-actions/index.js.map +1 -0
- package/build/components/dataviews-layout/index.js +53 -0
- package/build/components/dataviews-layout/index.js.map +1 -0
- package/build/{pagination.js → components/dataviews-pagination/index.js} +18 -15
- package/build/components/dataviews-pagination/index.js.map +1 -0
- package/build/{search.js → components/dataviews-search/index.js} +10 -6
- package/build/components/dataviews-search/index.js.map +1 -0
- package/build/components/dataviews-selection-checkbox/index.js +52 -0
- package/build/components/dataviews-selection-checkbox/index.js.map +1 -0
- package/build/{view-actions.js → components/dataviews-view-config/index.js} +94 -80
- package/build/components/dataviews-view-config/index.js.map +1 -0
- package/build/filter-and-sort-data-view.js +4 -1
- package/build/filter-and-sort-data-view.js.map +1 -1
- package/build/index.js +8 -1
- package/build/index.js.map +1 -1
- package/build/layouts/grid/density-picker.js +143 -0
- package/build/layouts/grid/density-picker.js.map +1 -0
- package/build/{view-grid.js → layouts/grid/index.js} +40 -53
- package/build/layouts/grid/index.js.map +1 -0
- package/build/layouts/index.js +52 -0
- package/build/layouts/index.js.map +1 -0
- package/build/{view-list.js → layouts/list/index.js} +31 -27
- package/build/layouts/list/index.js.map +1 -0
- package/build/layouts/table/column-header-menu.js +196 -0
- package/build/layouts/table/column-header-menu.js.map +1 -0
- package/build/layouts/table/index.js +350 -0
- package/build/layouts/table/index.js.map +1 -0
- package/build/normalize-fields.js +1 -1
- package/build/normalize-fields.js.map +1 -1
- package/build/private-types.js +6 -0
- package/build/private-types.js.map +1 -0
- package/build/types.js.map +1 -1
- package/build/utils.js.map +1 -1
- package/build-module/components/dataform/index.js +72 -0
- package/build-module/components/dataform/index.js.map +1 -0
- package/build-module/components/dataviews/index.js +108 -0
- package/build-module/components/dataviews/index.js.map +1 -0
- package/build-module/{bulk-actions.js → components/dataviews-bulk-actions/index.js} +39 -17
- package/build-module/components/dataviews-bulk-actions/index.js.map +1 -0
- package/build-module/{bulk-actions-toolbar.js → components/dataviews-bulk-actions-toolbar/index.js} +35 -20
- package/build-module/components/dataviews-bulk-actions-toolbar/index.js.map +1 -0
- package/build-module/components/dataviews-context/index.js +30 -0
- package/build-module/components/dataviews-context/index.js.map +1 -0
- package/build-module/{add-filter.js → components/dataviews-filters/add-filter.js} +3 -3
- package/build-module/components/dataviews-filters/add-filter.js.map +1 -0
- package/build-module/{filter-summary.js → components/dataviews-filters/filter-summary.js} +15 -14
- package/build-module/components/dataviews-filters/filter-summary.js.map +1 -0
- package/build-module/{filters.js → components/dataviews-filters/index.js} +16 -17
- package/build-module/components/dataviews-filters/index.js.map +1 -0
- package/build-module/{reset-filters.js → components/dataviews-filters/reset-filters.js} +1 -1
- package/build-module/components/dataviews-filters/reset-filters.js.map +1 -0
- package/build-module/{search-widget.js → components/dataviews-filters/search-widget.js} +21 -19
- package/build-module/components/dataviews-filters/search-widget.js.map +1 -0
- package/build-module/{item-actions.js → components/dataviews-item-actions/index.js} +3 -3
- package/build-module/components/dataviews-item-actions/index.js.map +1 -0
- package/build-module/components/dataviews-layout/index.js +45 -0
- package/build-module/components/dataviews-layout/index.js.map +1 -0
- package/build-module/{pagination.js → components/dataviews-pagination/index.js} +19 -17
- package/build-module/components/dataviews-pagination/index.js.map +1 -0
- package/build-module/{search.js → components/dataviews-search/index.js} +10 -7
- package/build-module/components/dataviews-search/index.js.map +1 -0
- package/build-module/components/dataviews-selection-checkbox/index.js +45 -0
- package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -0
- package/build-module/{view-actions.js → components/dataviews-view-config/index.js} +98 -84
- package/build-module/components/dataviews-view-config/index.js.map +1 -0
- package/build-module/filter-and-sort-data-view.js +4 -1
- package/build-module/filter-and-sort-data-view.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/grid/density-picker.js +138 -0
- package/build-module/layouts/grid/density-picker.js.map +1 -0
- package/build-module/{view-grid.js → layouts/grid/index.js} +37 -50
- package/build-module/layouts/grid/index.js.map +1 -0
- package/build-module/layouts/index.js +43 -0
- package/build-module/layouts/index.js.map +1 -0
- package/build-module/{view-list.js → layouts/list/index.js} +29 -25
- package/build-module/layouts/list/index.js.map +1 -0
- package/build-module/layouts/table/column-header-menu.js +190 -0
- package/build-module/layouts/table/column-header-menu.js.map +1 -0
- package/build-module/layouts/table/index.js +344 -0
- package/build-module/layouts/table/index.js.map +1 -0
- package/build-module/normalize-fields.js +1 -1
- package/build-module/normalize-fields.js.map +1 -1
- package/build-module/private-types.js +2 -0
- package/build-module/private-types.js.map +1 -0
- package/build-module/types.js.map +1 -1
- package/build-module/utils.js.map +1 -1
- package/build-style/style-rtl.css +607 -561
- package/build-style/style.css +607 -561
- package/build-types/components/dataform/index.d.ts +17 -0
- package/build-types/components/dataform/index.d.ts.map +1 -0
- package/build-types/components/dataform/stories/index.story.d.ts +11 -0
- package/build-types/components/dataform/stories/index.story.d.ts.map +1 -0
- package/build-types/components/dataviews/index.d.ts +33 -0
- package/build-types/components/dataviews/index.d.ts.map +1 -0
- package/build-types/{stories → components/dataviews/stories}/fixtures.d.ts +18 -17
- package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -0
- package/build-types/components/dataviews/stories/index.story.d.ts +46 -0
- package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -0
- package/build-types/components/dataviews-bulk-actions/index.d.ts +5 -0
- package/build-types/components/dataviews-bulk-actions/index.d.ts.map +1 -0
- package/build-types/components/dataviews-bulk-actions-toolbar/index.d.ts +2 -0
- package/build-types/components/dataviews-bulk-actions-toolbar/index.d.ts.map +1 -0
- package/build-types/components/dataviews-context/index.d.ts +26 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -0
- package/build-types/{add-filter.d.ts → components/dataviews-filters/add-filter.d.ts} +1 -2
- package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -0
- package/build-types/{filter-summary.d.ts → components/dataviews-filters/filter-summary.d.ts} +1 -1
- package/build-types/components/dataviews-filters/filter-summary.d.ts.map +1 -0
- package/build-types/components/dataviews-filters/index.d.ts +4 -0
- package/build-types/components/dataviews-filters/index.d.ts.map +1 -0
- package/build-types/{reset-filters.d.ts → components/dataviews-filters/reset-filters.d.ts} +1 -2
- package/build-types/components/dataviews-filters/reset-filters.d.ts.map +1 -0
- package/build-types/{search-widget.d.ts → components/dataviews-filters/search-widget.d.ts} +1 -2
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -0
- package/build-types/components/dataviews-item-actions/index.d.ts +35 -0
- package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -0
- package/build-types/components/dataviews-layout/index.d.ts +2 -0
- package/build-types/components/dataviews-layout/index.d.ts.map +1 -0
- package/build-types/components/dataviews-pagination/index.d.ts +4 -0
- package/build-types/components/dataviews-pagination/index.d.ts.map +1 -0
- package/build-types/components/dataviews-search/index.d.ts +6 -0
- package/build-types/components/dataviews-search/index.d.ts.map +1 -0
- package/build-types/components/dataviews-selection-checkbox/index.d.ts +16 -0
- package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -0
- package/build-types/components/dataviews-view-config/index.d.ts +8 -0
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -0
- package/build-types/filter-and-sort-data-view.d.ts +2 -2
- package/build-types/filter-and-sort-data-view.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/layouts/grid/density-picker.d.ts +5 -0
- package/build-types/layouts/grid/density-picker.d.ts.map +1 -0
- package/build-types/layouts/grid/index.d.ts +3 -0
- package/build-types/layouts/grid/index.d.ts.map +1 -0
- package/build-types/{layouts.d.ts → layouts/index.d.ts} +6 -5
- package/build-types/layouts/index.d.ts.map +1 -0
- package/build-types/layouts/list/index.d.ts +3 -0
- package/build-types/layouts/list/index.d.ts.map +1 -0
- package/build-types/layouts/table/column-header-menu.d.ts +17 -0
- package/build-types/layouts/table/column-header-menu.d.ts.map +1 -0
- package/build-types/layouts/table/index.d.ts +4 -0
- package/build-types/layouts/table/index.d.ts.map +1 -0
- package/build-types/normalize-fields.d.ts +2 -2
- package/build-types/normalize-fields.d.ts.map +1 -1
- package/build-types/private-types.d.ts +3 -0
- package/build-types/private-types.d.ts.map +1 -0
- package/build-types/types.d.ts +106 -46
- package/build-types/types.d.ts.map +1 -1
- package/build-types/utils.d.ts +2 -2
- package/build-types/utils.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/components/dataform/index.tsx +106 -0
- package/src/components/dataform/stories/index.story.tsx +42 -0
- package/src/components/dataviews/index.tsx +149 -0
- package/src/{stories → components/dataviews/stories}/fixtures.js +23 -11
- package/src/components/dataviews/stories/index.story.js +65 -0
- package/src/components/dataviews/style.scss +97 -0
- package/src/{bulk-actions.tsx → components/dataviews-bulk-actions/index.tsx} +58 -36
- package/src/components/dataviews-bulk-actions/style.scss +7 -0
- package/src/{bulk-actions-toolbar.tsx → components/dataviews-bulk-actions-toolbar/index.tsx} +48 -36
- package/src/components/dataviews-bulk-actions-toolbar/style.scss +45 -0
- package/src/components/dataviews-context/index.ts +49 -0
- package/src/{add-filter.tsx → components/dataviews-filters/add-filter.tsx} +4 -4
- package/src/{filter-summary.tsx → components/dataviews-filters/filter-summary.tsx} +36 -22
- package/src/{filters.tsx → components/dataviews-filters/index.tsx} +11 -25
- package/src/{reset-filters.tsx → components/dataviews-filters/reset-filters.tsx} +2 -2
- package/src/{search-widget.tsx → components/dataviews-filters/search-widget.tsx} +20 -20
- package/src/components/dataviews-filters/style.scss +252 -0
- package/src/{item-actions.tsx → components/dataviews-item-actions/index.tsx} +16 -17
- package/src/components/dataviews-item-actions/style.scss +3 -0
- package/src/components/dataviews-layout/index.tsx +51 -0
- package/src/{pagination.tsx → components/dataviews-pagination/index.tsx} +15 -23
- package/src/components/dataviews-pagination/style.scss +26 -0
- package/src/{search.tsx → components/dataviews-search/index.tsx} +5 -10
- package/src/components/dataviews-selection-checkbox/index.tsx +65 -0
- package/src/components/dataviews-selection-checkbox/style.scss +14 -0
- package/src/{view-actions.tsx → components/dataviews-view-config/index.tsx} +116 -119
- package/src/filter-and-sort-data-view.ts +13 -3
- package/src/index.ts +2 -1
- package/src/layouts/grid/density-picker.tsx +136 -0
- package/src/{view-grid.tsx → layouts/grid/index.tsx} +45 -63
- package/src/layouts/grid/style.scss +140 -0
- package/src/layouts/index.ts +66 -0
- package/src/{view-list.tsx → layouts/list/index.tsx} +40 -30
- package/src/layouts/list/style.scss +189 -0
- package/src/layouts/table/column-header-menu.tsx +268 -0
- package/src/layouts/table/index.tsx +471 -0
- package/src/layouts/table/style.scss +201 -0
- package/src/normalize-fields.ts +6 -4
- package/src/private-types.tsx +2 -0
- package/src/style.scss +11 -919
- package/src/test/filter-and-sort-data-view.js +17 -2
- package/src/types.ts +113 -55
- package/src/utils.ts +2 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/build/add-filter.js.map +0 -1
- package/build/bulk-actions-toolbar.js.map +0 -1
- package/build/bulk-actions.js.map +0 -1
- package/build/dataviews.js +0 -136
- package/build/dataviews.js.map +0 -1
- package/build/filter-summary.js.map +0 -1
- package/build/filters.js.map +0 -1
- package/build/item-actions.js.map +0 -1
- package/build/layouts.js +0 -38
- package/build/layouts.js.map +0 -1
- package/build/pagination.js.map +0 -1
- package/build/reset-filters.js.map +0 -1
- package/build/search-widget.js.map +0 -1
- package/build/search.js.map +0 -1
- package/build/single-selection-checkbox.js +0 -63
- package/build/single-selection-checkbox.js.map +0 -1
- package/build/view-actions.js.map +0 -1
- package/build/view-grid.js.map +0 -1
- package/build/view-list.js.map +0 -1
- package/build/view-table.js +0 -409
- package/build/view-table.js.map +0 -1
- package/build-module/add-filter.js.map +0 -1
- package/build-module/bulk-actions-toolbar.js.map +0 -1
- package/build-module/bulk-actions.js.map +0 -1
- package/build-module/dataviews.js +0 -129
- package/build-module/dataviews.js.map +0 -1
- package/build-module/filter-summary.js.map +0 -1
- package/build-module/filters.js.map +0 -1
- package/build-module/item-actions.js.map +0 -1
- package/build-module/layouts.js +0 -30
- package/build-module/layouts.js.map +0 -1
- package/build-module/pagination.js.map +0 -1
- package/build-module/reset-filters.js.map +0 -1
- package/build-module/search-widget.js.map +0 -1
- package/build-module/search.js.map +0 -1
- package/build-module/single-selection-checkbox.js +0 -56
- package/build-module/single-selection-checkbox.js.map +0 -1
- package/build-module/view-actions.js.map +0 -1
- package/build-module/view-grid.js.map +0 -1
- package/build-module/view-list.js.map +0 -1
- package/build-module/view-table.js +0 -402
- package/build-module/view-table.js.map +0 -1
- package/build-types/add-filter.d.ts.map +0 -1
- package/build-types/bulk-actions-toolbar.d.ts +0 -12
- package/build-types/bulk-actions-toolbar.d.ts.map +0 -1
- package/build-types/bulk-actions.d.ts +0 -14
- package/build-types/bulk-actions.d.ts.map +0 -1
- package/build-types/dataviews.d.ts +0 -24
- package/build-types/dataviews.d.ts.map +0 -1
- package/build-types/filter-summary.d.ts.map +0 -1
- package/build-types/filters.d.ts +0 -13
- package/build-types/filters.d.ts.map +0 -1
- package/build-types/item-actions.d.ts +0 -35
- package/build-types/item-actions.d.ts.map +0 -1
- package/build-types/layouts.d.ts.map +0 -1
- package/build-types/pagination.d.ts +0 -16
- package/build-types/pagination.d.ts.map +0 -1
- package/build-types/reset-filters.d.ts.map +0 -1
- package/build-types/search-widget.d.ts.map +0 -1
- package/build-types/search.d.ts +0 -13
- package/build-types/search.d.ts.map +0 -1
- package/build-types/single-selection-checkbox.d.ts +0 -17
- package/build-types/single-selection-checkbox.d.ts.map +0 -1
- package/build-types/stories/fixtures.d.ts.map +0 -1
- package/build-types/stories/index.story.d.ts +0 -15
- package/build-types/stories/index.story.d.ts.map +0 -1
- package/build-types/view-actions.d.ts +0 -12
- package/build-types/view-actions.d.ts.map +0 -1
- package/build-types/view-grid.d.ts +0 -4
- package/build-types/view-grid.d.ts.map +0 -1
- package/build-types/view-list.d.ts +0 -4
- package/build-types/view-list.d.ts.map +0 -1
- package/build-types/view-table.d.ts +0 -5
- package/build-types/view-table.d.ts.map +0 -1
- package/src/dataviews.tsx +0 -189
- package/src/layouts.ts +0 -39
- package/src/single-selection-checkbox.tsx +0 -80
- package/src/stories/index.story.js +0 -64
- package/src/view-table.tsx +0 -603
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
.dataviews-filters__button {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dataviews-filters__reset-button.dataviews-filters__reset-button[aria-disabled="true"] {
|
|
6
|
+
&,
|
|
7
|
+
&:hover {
|
|
8
|
+
opacity: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&:focus {
|
|
12
|
+
opacity: 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dataviews-filters__summary-popover {
|
|
17
|
+
.components-popover__content {
|
|
18
|
+
width: 230px;
|
|
19
|
+
padding: 0;
|
|
20
|
+
border-radius: $grid-unit-05;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dataviews-filters__summary-operators-container {
|
|
25
|
+
padding: $grid-unit-10 $grid-unit-10 0;
|
|
26
|
+
|
|
27
|
+
&:has(+ .dataviews-filters__search-widget-listbox) {
|
|
28
|
+
border-bottom: 1px solid $gray-200;
|
|
29
|
+
padding-bottom: $grid-unit-10;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:empty {
|
|
33
|
+
display: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dataviews-filters__summary-operators-filter-name {
|
|
37
|
+
color: $gray-700;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dataviews-filters__summary-chip-container {
|
|
42
|
+
position: relative;
|
|
43
|
+
white-space: pre-wrap;
|
|
44
|
+
|
|
45
|
+
.dataviews-filters__summary-chip {
|
|
46
|
+
border-radius: $grid-unit-20;
|
|
47
|
+
border: 1px solid transparent;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
padding: $grid-unit-05 $grid-unit-15;
|
|
50
|
+
min-height: $grid-unit-40;
|
|
51
|
+
background: $gray-100;
|
|
52
|
+
color: $gray-800;
|
|
53
|
+
position: relative;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
|
|
57
|
+
&.has-reset {
|
|
58
|
+
padding-inline-end: $button-size-small + $grid-unit-05;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:hover,
|
|
62
|
+
&:focus-visible,
|
|
63
|
+
&[aria-expanded="true"] {
|
|
64
|
+
background: $gray-200;
|
|
65
|
+
color: $gray-900;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&.has-values {
|
|
69
|
+
color: var(--wp-admin-theme-color);
|
|
70
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
|
|
71
|
+
|
|
72
|
+
&:hover,
|
|
73
|
+
&[aria-expanded="true"] {
|
|
74
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.12);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:focus-visible {
|
|
79
|
+
outline: none;
|
|
80
|
+
box-shadow:
|
|
81
|
+
0 0 0 var(--wp-admin-border-width-focus)
|
|
82
|
+
var(--wp-admin-theme-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.dataviews-filters-__summary-filter-text-name {
|
|
86
|
+
font-weight: 500;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dataviews-filters__summary-chip-remove {
|
|
91
|
+
width: $icon-size;
|
|
92
|
+
height: $icon-size;
|
|
93
|
+
border-radius: 50%;
|
|
94
|
+
border: 0;
|
|
95
|
+
padding: 0;
|
|
96
|
+
position: absolute;
|
|
97
|
+
right: $grid-unit-05;
|
|
98
|
+
top: 50%;
|
|
99
|
+
transform: translateY(-50%);
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
background: transparent;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
|
|
106
|
+
svg {
|
|
107
|
+
fill: $gray-700;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:hover,
|
|
111
|
+
&:focus {
|
|
112
|
+
background: $gray-200;
|
|
113
|
+
svg {
|
|
114
|
+
fill: $gray-900;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&.has-values {
|
|
119
|
+
svg {
|
|
120
|
+
fill: var(--wp-admin-theme-color);
|
|
121
|
+
}
|
|
122
|
+
&:hover {
|
|
123
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:focus-visible {
|
|
128
|
+
outline: none;
|
|
129
|
+
box-shadow:
|
|
130
|
+
0 0 0 var(--wp-admin-border-width-focus)
|
|
131
|
+
var(--wp-admin-theme-color);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.dataviews-filters__search-widget-filter-combobox-list {
|
|
137
|
+
max-height: $grid-unit * 23;
|
|
138
|
+
padding: $grid-unit-05;
|
|
139
|
+
overflow: auto;
|
|
140
|
+
border-top: 1px solid $gray-200;
|
|
141
|
+
|
|
142
|
+
.dataviews-filters__search-widget-filter-combobox-item-value {
|
|
143
|
+
[data-user-value] {
|
|
144
|
+
font-weight: 600;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.dataviews-filters__search-widget-listbox {
|
|
150
|
+
max-height: $grid-unit * 23;
|
|
151
|
+
padding: $grid-unit-05;
|
|
152
|
+
overflow: auto;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.dataviews-filters__search-widget-listitem {
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: $grid-unit-10;
|
|
159
|
+
border-radius: $radius-block-ui;
|
|
160
|
+
box-sizing: border-box;
|
|
161
|
+
padding: $grid-unit-10 $grid-unit-15;
|
|
162
|
+
cursor: default;
|
|
163
|
+
margin-block-end: 2px;
|
|
164
|
+
|
|
165
|
+
&:last-child {
|
|
166
|
+
margin-block-end: 0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&:hover,
|
|
170
|
+
&[data-active-item],
|
|
171
|
+
&:focus {
|
|
172
|
+
background-color: var(--wp-admin-theme-color);
|
|
173
|
+
color: $white;
|
|
174
|
+
|
|
175
|
+
.dataviews-filters__search-widget-listitem-check {
|
|
176
|
+
fill: $white;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.dataviews-filters__search-widget-listitem-description {
|
|
180
|
+
color: $white;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.dataviews-filters__search-widget-listitem-check {
|
|
185
|
+
width: 24px;
|
|
186
|
+
height: 24px;
|
|
187
|
+
flex-shrink: 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.dataviews-filters__search-widget-listitem-description {
|
|
191
|
+
display: block;
|
|
192
|
+
overflow: hidden;
|
|
193
|
+
text-overflow: ellipsis;
|
|
194
|
+
font-size: $helptext-font-size;
|
|
195
|
+
line-height: 16px;
|
|
196
|
+
color: $gray-700;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.dataviews-filters__search-widget-filter-combobox__wrapper {
|
|
201
|
+
position: relative;
|
|
202
|
+
padding: $grid-unit-10;
|
|
203
|
+
|
|
204
|
+
.dataviews-filters__search-widget-filter-combobox__input {
|
|
205
|
+
@include input-control;
|
|
206
|
+
display: block;
|
|
207
|
+
padding: 0 $grid-unit-40 0 $grid-unit-10;
|
|
208
|
+
background: $gray-100;
|
|
209
|
+
border: none;
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: $grid-unit-40;
|
|
212
|
+
|
|
213
|
+
// Unset inherited values.
|
|
214
|
+
margin-left: 0;
|
|
215
|
+
margin-right: 0;
|
|
216
|
+
|
|
217
|
+
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
218
|
+
font-size: $mobile-text-min-font-size;
|
|
219
|
+
@include break-small {
|
|
220
|
+
font-size: $default-font-size;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&:focus {
|
|
224
|
+
background: $white;
|
|
225
|
+
box-shadow:
|
|
226
|
+
inset 0 0 0 var(--wp-admin-border-width-focus)
|
|
227
|
+
var(--wp-admin-theme-color);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&::placeholder {
|
|
231
|
+
color: $gray-700;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&::-webkit-search-decoration,
|
|
235
|
+
&::-webkit-search-cancel-button,
|
|
236
|
+
&::-webkit-search-results-button,
|
|
237
|
+
&::-webkit-search-results-decoration {
|
|
238
|
+
-webkit-appearance: none;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.dataviews-filters__search-widget-filter-combobox__icon {
|
|
243
|
+
position: absolute;
|
|
244
|
+
right: $grid-unit-15;
|
|
245
|
+
top: 50%;
|
|
246
|
+
transform: translateY(-50%);
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: center;
|
|
250
|
+
width: $icon-size;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -20,8 +20,8 @@ import { useRegistry } from '@wordpress/data';
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
|
-
import { unlock } from '
|
|
24
|
-
import type { Action, ActionModal as ActionModalType
|
|
23
|
+
import { unlock } from '../../lock-unlock';
|
|
24
|
+
import type { Action, ActionModal as ActionModalType } from '../../types';
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
DropdownMenuV2: DropdownMenu,
|
|
@@ -31,42 +31,41 @@ const {
|
|
|
31
31
|
kebabCase,
|
|
32
32
|
} = unlock( componentsPrivateApis );
|
|
33
33
|
|
|
34
|
-
export interface ActionTriggerProps< Item
|
|
34
|
+
export interface ActionTriggerProps< Item > {
|
|
35
35
|
action: Action< Item >;
|
|
36
36
|
onClick: MouseEventHandler;
|
|
37
37
|
isBusy?: boolean;
|
|
38
38
|
items: Item[];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
interface ActionModalProps< Item
|
|
41
|
+
interface ActionModalProps< Item > {
|
|
42
42
|
action: ActionModalType< Item >;
|
|
43
43
|
items: Item[];
|
|
44
44
|
closeModal?: () => void;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
interface ActionWithModalProps< Item extends
|
|
48
|
-
extends ActionModalProps< Item > {
|
|
47
|
+
interface ActionWithModalProps< Item > extends ActionModalProps< Item > {
|
|
49
48
|
ActionTrigger: ( props: ActionTriggerProps< Item > ) => ReactElement;
|
|
50
49
|
isBusy?: boolean;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
interface ActionsDropdownMenuGroupProps< Item
|
|
52
|
+
interface ActionsDropdownMenuGroupProps< Item > {
|
|
54
53
|
actions: Action< Item >[];
|
|
55
54
|
item: Item;
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
interface ItemActionsProps< Item
|
|
57
|
+
interface ItemActionsProps< Item > {
|
|
59
58
|
item: Item;
|
|
60
59
|
actions: Action< Item >[];
|
|
61
60
|
isCompact?: boolean;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
interface CompactItemActionsProps< Item
|
|
63
|
+
interface CompactItemActionsProps< Item > {
|
|
65
64
|
item: Item;
|
|
66
65
|
actions: Action< Item >[];
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
function ButtonTrigger< Item
|
|
68
|
+
function ButtonTrigger< Item >( {
|
|
70
69
|
action,
|
|
71
70
|
onClick,
|
|
72
71
|
items,
|
|
@@ -84,7 +83,7 @@ function ButtonTrigger< Item extends AnyItem >( {
|
|
|
84
83
|
);
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
function DropdownMenuItemTrigger< Item
|
|
86
|
+
function DropdownMenuItemTrigger< Item >( {
|
|
88
87
|
action,
|
|
89
88
|
onClick,
|
|
90
89
|
items,
|
|
@@ -101,7 +100,7 @@ function DropdownMenuItemTrigger< Item extends AnyItem >( {
|
|
|
101
100
|
);
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
export function ActionModal< Item
|
|
103
|
+
export function ActionModal< Item >( {
|
|
105
104
|
action,
|
|
106
105
|
items,
|
|
107
106
|
closeModal,
|
|
@@ -124,7 +123,7 @@ export function ActionModal< Item extends AnyItem >( {
|
|
|
124
123
|
);
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
export function ActionWithModal< Item
|
|
126
|
+
export function ActionWithModal< Item >( {
|
|
128
127
|
action,
|
|
129
128
|
items,
|
|
130
129
|
ActionTrigger,
|
|
@@ -153,7 +152,7 @@ export function ActionWithModal< Item extends AnyItem >( {
|
|
|
153
152
|
);
|
|
154
153
|
}
|
|
155
154
|
|
|
156
|
-
export function ActionsDropdownMenuGroup< Item
|
|
155
|
+
export function ActionsDropdownMenuGroup< Item >( {
|
|
157
156
|
actions,
|
|
158
157
|
item,
|
|
159
158
|
}: ActionsDropdownMenuGroupProps< Item > ) {
|
|
@@ -186,7 +185,7 @@ export function ActionsDropdownMenuGroup< Item extends AnyItem >( {
|
|
|
186
185
|
);
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
export default function ItemActions< Item
|
|
188
|
+
export default function ItemActions< Item >( {
|
|
190
189
|
item,
|
|
191
190
|
actions,
|
|
192
191
|
isCompact,
|
|
@@ -247,7 +246,7 @@ export default function ItemActions< Item extends AnyItem >( {
|
|
|
247
246
|
);
|
|
248
247
|
}
|
|
249
248
|
|
|
250
|
-
function CompactItemActions< Item
|
|
249
|
+
function CompactItemActions< Item >( {
|
|
251
250
|
item,
|
|
252
251
|
actions,
|
|
253
252
|
}: CompactItemActionsProps< Item > ) {
|
|
@@ -258,7 +257,7 @@ function CompactItemActions< Item extends AnyItem >( {
|
|
|
258
257
|
size="compact"
|
|
259
258
|
icon={ moreVertical }
|
|
260
259
|
label={ __( 'Actions' ) }
|
|
261
|
-
|
|
260
|
+
accessibleWhenDisabled
|
|
262
261
|
disabled={ ! actions.length }
|
|
263
262
|
className="dataviews-all-actions-button"
|
|
264
263
|
/>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentType } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useContext } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import DataViewsContext from '../dataviews-context';
|
|
15
|
+
import { VIEW_LAYOUTS } from '../../layouts';
|
|
16
|
+
import type { ViewBaseProps } from '../../types';
|
|
17
|
+
|
|
18
|
+
export default function DataViewsLayout() {
|
|
19
|
+
const {
|
|
20
|
+
actions = [],
|
|
21
|
+
data,
|
|
22
|
+
fields,
|
|
23
|
+
getItemId,
|
|
24
|
+
isLoading,
|
|
25
|
+
view,
|
|
26
|
+
onChangeView,
|
|
27
|
+
selection,
|
|
28
|
+
onChangeSelection,
|
|
29
|
+
setOpenedFilter,
|
|
30
|
+
density,
|
|
31
|
+
} = useContext( DataViewsContext );
|
|
32
|
+
|
|
33
|
+
const ViewComponent = VIEW_LAYOUTS.find( ( v ) => v.type === view.type )
|
|
34
|
+
?.component as ComponentType< ViewBaseProps< any > >;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<ViewComponent
|
|
38
|
+
actions={ actions }
|
|
39
|
+
data={ data }
|
|
40
|
+
fields={ fields }
|
|
41
|
+
getItemId={ getItemId }
|
|
42
|
+
isLoading={ isLoading }
|
|
43
|
+
onChangeView={ onChangeView }
|
|
44
|
+
onChangeSelection={ onChangeSelection }
|
|
45
|
+
selection={ selection }
|
|
46
|
+
setOpenedFilter={ setOpenedFilter }
|
|
47
|
+
view={ view }
|
|
48
|
+
density={ density }
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -6,29 +6,21 @@ import {
|
|
|
6
6
|
__experimentalHStack as HStack,
|
|
7
7
|
SelectControl,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
|
-
import { createInterpolateElement, memo } from '@wordpress/element';
|
|
9
|
+
import { createInterpolateElement, memo, useContext } from '@wordpress/element';
|
|
10
10
|
import { sprintf, __, _x } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
11
|
+
import { next, previous } from '@wordpress/icons';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import DataViewsContext from '../dataviews-context';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const Pagination = memo( function Pagination( {
|
|
28
|
-
view,
|
|
29
|
-
onChangeView,
|
|
30
|
-
paginationInfo: { totalItems = 0, totalPages },
|
|
31
|
-
}: PaginationProps ) {
|
|
18
|
+
function DataViewsPagination() {
|
|
19
|
+
const {
|
|
20
|
+
view,
|
|
21
|
+
onChangeView,
|
|
22
|
+
paginationInfo: { totalItems = 0, totalPages },
|
|
23
|
+
} = useContext( DataViewsContext );
|
|
32
24
|
if ( ! totalItems || ! totalPages ) {
|
|
33
25
|
return null;
|
|
34
26
|
}
|
|
@@ -90,9 +82,9 @@ const Pagination = memo( function Pagination( {
|
|
|
90
82
|
} )
|
|
91
83
|
}
|
|
92
84
|
disabled={ currentPage === 1 }
|
|
93
|
-
|
|
85
|
+
accessibleWhenDisabled
|
|
94
86
|
label={ __( 'Previous page' ) }
|
|
95
|
-
icon={
|
|
87
|
+
icon={ previous }
|
|
96
88
|
showTooltip
|
|
97
89
|
size="compact"
|
|
98
90
|
tooltipPosition="top"
|
|
@@ -102,9 +94,9 @@ const Pagination = memo( function Pagination( {
|
|
|
102
94
|
onChangeView( { ...view, page: currentPage + 1 } )
|
|
103
95
|
}
|
|
104
96
|
disabled={ currentPage >= totalPages }
|
|
105
|
-
|
|
97
|
+
accessibleWhenDisabled
|
|
106
98
|
label={ __( 'Next page' ) }
|
|
107
|
-
icon={
|
|
99
|
+
icon={ next }
|
|
108
100
|
showTooltip
|
|
109
101
|
size="compact"
|
|
110
102
|
tooltipPosition="top"
|
|
@@ -113,6 +105,6 @@ const Pagination = memo( function Pagination( {
|
|
|
113
105
|
</HStack>
|
|
114
106
|
)
|
|
115
107
|
);
|
|
116
|
-
}
|
|
108
|
+
}
|
|
117
109
|
|
|
118
|
-
export default
|
|
110
|
+
export default memo( DataViewsPagination );
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.dataviews-pagination {
|
|
2
|
+
position: sticky;
|
|
3
|
+
bottom: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
background-color: $white;
|
|
6
|
+
padding: $grid-unit-15 $grid-unit-60;
|
|
7
|
+
border-top: $border-width solid $gray-100;
|
|
8
|
+
color: $gray-700;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
transition: padding ease-out 0.1s;
|
|
11
|
+
@include reduce-motion("transition");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dataviews-pagination__page-selection {
|
|
15
|
+
font-size: 11px;
|
|
16
|
+
text-transform: uppercase;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: $gray-900;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
|
|
22
|
+
@container (max-width: 430px) {
|
|
23
|
+
.dataviews-pagination {
|
|
24
|
+
padding: $grid-unit-15 $grid-unit-30;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -2,26 +2,21 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useEffect, useRef, memo } from '@wordpress/element';
|
|
5
|
+
import { useEffect, useRef, memo, useContext } from '@wordpress/element';
|
|
6
6
|
import { SearchControl } from '@wordpress/components';
|
|
7
7
|
import { useDebouncedInput } from '@wordpress/compose';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
import
|
|
12
|
+
import DataViewsContext from '../dataviews-context';
|
|
13
13
|
|
|
14
14
|
interface SearchProps {
|
|
15
15
|
label?: string;
|
|
16
|
-
view: View;
|
|
17
|
-
onChangeView: ( view: View ) => void;
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
view,
|
|
23
|
-
onChangeView,
|
|
24
|
-
}: SearchProps ) {
|
|
18
|
+
const DataViewsSearch = memo( function Search( { label }: SearchProps ) {
|
|
19
|
+
const { view, onChangeView } = useContext( DataViewsContext );
|
|
25
20
|
const [ search, setSearch, debouncedSearch ] = useDebouncedInput(
|
|
26
21
|
view.search
|
|
27
22
|
);
|
|
@@ -54,4 +49,4 @@ const Search = memo( function Search( {
|
|
|
54
49
|
);
|
|
55
50
|
} );
|
|
56
51
|
|
|
57
|
-
export default
|
|
52
|
+
export default DataViewsSearch;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
|
+
import { CheckboxControl } from '@wordpress/components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import type { Field } from '../../types';
|
|
11
|
+
import type { SetSelection } from '../../private-types';
|
|
12
|
+
|
|
13
|
+
interface DataViewsSelectionCheckboxProps< Item > {
|
|
14
|
+
selection: string[];
|
|
15
|
+
onChangeSelection: SetSelection;
|
|
16
|
+
item: Item;
|
|
17
|
+
getItemId: ( item: Item ) => string;
|
|
18
|
+
primaryField?: Field< Item >;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function DataViewsSelectionCheckbox< Item >( {
|
|
23
|
+
selection,
|
|
24
|
+
onChangeSelection,
|
|
25
|
+
item,
|
|
26
|
+
getItemId,
|
|
27
|
+
primaryField,
|
|
28
|
+
disabled,
|
|
29
|
+
}: DataViewsSelectionCheckboxProps< Item > ) {
|
|
30
|
+
const id = getItemId( item );
|
|
31
|
+
const checked = ! disabled && selection.includes( id );
|
|
32
|
+
let selectionLabel;
|
|
33
|
+
if ( primaryField?.getValue && item ) {
|
|
34
|
+
// eslint-disable-next-line @wordpress/valid-sprintf
|
|
35
|
+
selectionLabel = sprintf(
|
|
36
|
+
/* translators: %s: item title. */
|
|
37
|
+
checked ? __( 'Deselect item: %s' ) : __( 'Select item: %s' ),
|
|
38
|
+
primaryField.getValue( { item } )
|
|
39
|
+
);
|
|
40
|
+
} else {
|
|
41
|
+
selectionLabel = checked
|
|
42
|
+
? __( 'Select a new item' )
|
|
43
|
+
: __( 'Deselect item' );
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<CheckboxControl
|
|
47
|
+
className="dataviews-selection-checkbox"
|
|
48
|
+
__nextHasNoMarginBottom
|
|
49
|
+
aria-label={ selectionLabel }
|
|
50
|
+
aria-disabled={ disabled }
|
|
51
|
+
checked={ checked }
|
|
52
|
+
onChange={ () => {
|
|
53
|
+
if ( disabled ) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onChangeSelection(
|
|
58
|
+
selection.includes( id )
|
|
59
|
+
? selection.filter( ( itemId ) => id !== itemId )
|
|
60
|
+
: [ ...selection, id ]
|
|
61
|
+
);
|
|
62
|
+
} }
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.dataviews-selection-checkbox {
|
|
2
|
+
// Experimental override for CheckboxControl size (fragile)
|
|
3
|
+
--checkbox-input-size: 24px;
|
|
4
|
+
@include break-small() {
|
|
5
|
+
--checkbox-input-size: 16px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
line-height: 0;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
|
|
11
|
+
.components-checkbox-control__input-container {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|