@wordpress/dataviews 16.0.1 → 17.0.1-next.v.202606191442.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 +25 -0
- package/README.md +2 -2
- package/build/components/dataform-layouts/panel/summary-button.cjs.map +2 -2
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs.map +2 -2
- package/build/components/dataviews-filters/filter.cjs.map +2 -2
- package/build/components/dataviews-layouts/grid/composite-grid.cjs.map +2 -2
- package/build/components/dataviews-layouts/list/index.cjs.map +1 -1
- package/build/components/dataviews-layouts/table/column-primary.cjs +2 -2
- package/build/components/dataviews-layouts/table/column-primary.cjs.map +2 -2
- package/build/components/dataviews-pagination/index.cjs.map +1 -1
- package/build/components/dataviews-picker-footer/index.cjs +72 -33
- package/build/components/dataviews-picker-footer/index.cjs.map +2 -2
- package/build/constants.cjs +1 -1
- package/build/constants.cjs.map +2 -2
- package/build/dataviews-picker/index.cjs +2 -1
- package/build/dataviews-picker/index.cjs.map +2 -2
- package/build/field-types/password.cjs +1 -1
- package/build/field-types/password.cjs.map +2 -2
- package/build/hooks/use-form-validity.cjs +2 -2
- package/build/hooks/use-form-validity.cjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/summary-button.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs.map +2 -2
- package/build-module/components/dataviews-filters/filter.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/list/index.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/table/column-primary.mjs +2 -2
- package/build-module/components/dataviews-layouts/table/column-primary.mjs.map +2 -2
- package/build-module/components/dataviews-pagination/index.mjs.map +1 -1
- package/build-module/components/dataviews-picker-footer/index.mjs +71 -33
- package/build-module/components/dataviews-picker-footer/index.mjs.map +2 -2
- package/build-module/constants.mjs +1 -1
- package/build-module/constants.mjs.map +2 -2
- package/build-module/dataviews-picker/index.mjs +6 -2
- package/build-module/dataviews-picker/index.mjs.map +2 -2
- package/build-module/field-types/password.mjs +1 -1
- package/build-module/field-types/password.mjs.map +2 -2
- package/build-module/hooks/use-form-validity.mjs +2 -2
- package/build-module/hooks/use-form-validity.mjs.map +2 -2
- package/build-style/style-rtl.css +164 -176
- package/build-style/style.css +164 -176
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/grid/composite-grid.d.ts.map +1 -1
- package/build-types/components/dataviews-picker-footer/index.d.ts +3 -2
- package/build-types/components/dataviews-picker-footer/index.d.ts.map +1 -1
- package/build-types/dataviews-picker/index.d.ts +3 -2
- package/build-types/dataviews-picker/index.d.ts.map +1 -1
- package/build-wp/index.js +324 -282
- package/package.json +26 -21
- package/src/components/dataform-controls/style.scss +1 -1
- package/src/components/dataform-layouts/card/style.scss +1 -1
- package/src/components/dataform-layouts/details/style.scss +1 -1
- package/src/components/dataform-layouts/panel/style.scss +18 -31
- package/src/components/dataform-layouts/panel/summary-button.tsx +0 -1
- package/src/components/dataform-layouts/panel/utils/get-label-content.tsx +0 -1
- package/src/components/dataform-layouts/regular/style.scss +4 -4
- package/src/components/dataviews-bulk-actions/style.scss +2 -2
- package/src/components/dataviews-filters/filter.tsx +0 -1
- package/src/components/dataviews-filters/style.scss +44 -45
- package/src/components/dataviews-layouts/activity/style.scss +11 -11
- package/src/components/dataviews-layouts/grid/composite-grid.tsx +0 -1
- package/src/components/dataviews-layouts/grid/style.scss +12 -12
- package/src/components/dataviews-layouts/list/style.scss +20 -21
- package/src/components/dataviews-layouts/picker-activity/style.scss +10 -10
- package/src/components/dataviews-layouts/picker-grid/style.scss +10 -10
- package/src/components/dataviews-layouts/picker-table/style.scss +4 -4
- package/src/components/dataviews-layouts/table/style.scss +17 -17
- package/src/components/dataviews-picker-footer/index.tsx +94 -31
- package/src/components/dataviews-picker-footer/style.scss +1 -1
- package/src/components/dataviews-view-config/style.scss +1 -1
- package/src/dataviews/style.scss +8 -8
- package/src/dataviews-picker/index.tsx +9 -3
|
@@ -22,7 +22,10 @@ export function useIsMultiselectPicker< Item >(
|
|
|
22
22
|
actions: Action< Item >[] | undefined
|
|
23
23
|
) {
|
|
24
24
|
return useMemo( () => {
|
|
25
|
-
return
|
|
25
|
+
return (
|
|
26
|
+
!! actions?.length &&
|
|
27
|
+
actions?.every( ( action ) => action.supportsBulk )
|
|
28
|
+
);
|
|
26
29
|
}, [ actions ] );
|
|
27
30
|
}
|
|
28
31
|
|
|
@@ -145,7 +148,7 @@ function ActionButtons< Item >( {
|
|
|
145
148
|
);
|
|
146
149
|
}
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
function PickerBulkSelectionInfo() {
|
|
149
152
|
const {
|
|
150
153
|
data,
|
|
151
154
|
selection,
|
|
@@ -158,6 +161,17 @@ export function DataViewsPickerFooter() {
|
|
|
158
161
|
|
|
159
162
|
const isMultiselect = useIsMultiselectPicker( actions );
|
|
160
163
|
|
|
164
|
+
const selectedItems = useMemo(
|
|
165
|
+
() =>
|
|
166
|
+
data.filter( ( item ) => selection.includes( getItemId( item ) ) ),
|
|
167
|
+
[ selection, getItemId, data ]
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// The count and the selection checkbox belong with the actions, mirroring `DataViews`.
|
|
171
|
+
if ( ! actions.length ) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
|
|
161
175
|
const message = getFooterMessage(
|
|
162
176
|
selection.length,
|
|
163
177
|
data.length,
|
|
@@ -165,12 +179,88 @@ export function DataViewsPickerFooter() {
|
|
|
165
179
|
!! view.infiniteScrollEnabled
|
|
166
180
|
);
|
|
167
181
|
|
|
182
|
+
return (
|
|
183
|
+
<Stack
|
|
184
|
+
direction="row"
|
|
185
|
+
className="dataviews-picker-footer__bulk-selection"
|
|
186
|
+
gap="md"
|
|
187
|
+
align="center"
|
|
188
|
+
>
|
|
189
|
+
{ isMultiselect && (
|
|
190
|
+
<BulkSelectionCheckbox
|
|
191
|
+
selection={ selection }
|
|
192
|
+
selectedItems={ selectedItems }
|
|
193
|
+
onChangeSelection={ onChangeSelection }
|
|
194
|
+
data={ data }
|
|
195
|
+
getItemId={ getItemId }
|
|
196
|
+
disableSelectAll={ !! view.infiniteScrollEnabled }
|
|
197
|
+
/>
|
|
198
|
+
) }
|
|
199
|
+
<span className="dataviews-bulk-actions-footer__item-count">
|
|
200
|
+
{ message }
|
|
201
|
+
</span>
|
|
202
|
+
</Stack>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function PickerActions() {
|
|
207
|
+
const {
|
|
208
|
+
data,
|
|
209
|
+
selection,
|
|
210
|
+
getItemId,
|
|
211
|
+
actions = EMPTY_ARRAY,
|
|
212
|
+
} = useContext( DataViewsContext );
|
|
213
|
+
|
|
168
214
|
const selectedItems = useMemo(
|
|
169
215
|
() =>
|
|
170
216
|
data.filter( ( item ) => selection.includes( getItemId( item ) ) ),
|
|
171
217
|
[ selection, getItemId, data ]
|
|
172
218
|
);
|
|
173
219
|
|
|
220
|
+
if ( ! actions.length ) {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<div className="dataviews-picker-footer__actions">
|
|
226
|
+
<ActionButtons
|
|
227
|
+
actions={ actions }
|
|
228
|
+
items={ selectedItems }
|
|
229
|
+
selection={ selection }
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// The bulk-selection info and action buttons without pagination — the picker
|
|
236
|
+
// counterpart to `DataViews.BulkActionToolbar`, for free composition.
|
|
237
|
+
export function DataViewsPickerBulkActionToolbar() {
|
|
238
|
+
return (
|
|
239
|
+
<Stack direction="row" gap="md" align="center">
|
|
240
|
+
<PickerBulkSelectionInfo />
|
|
241
|
+
<PickerActions />
|
|
242
|
+
</Stack>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// The full picker footer: bulk-selection info, pagination, and actions — the
|
|
247
|
+
// picker counterpart to `DataViews.Footer`.
|
|
248
|
+
export function DataViewsPickerFooter() {
|
|
249
|
+
const {
|
|
250
|
+
actions = EMPTY_ARRAY,
|
|
251
|
+
paginationInfo,
|
|
252
|
+
view,
|
|
253
|
+
} = useContext( DataViewsContext );
|
|
254
|
+
|
|
255
|
+
const hasPagination =
|
|
256
|
+
! view.infiniteScrollEnabled &&
|
|
257
|
+
!! paginationInfo.totalItems &&
|
|
258
|
+
paginationInfo.totalPages > 1;
|
|
259
|
+
|
|
260
|
+
if ( ! actions.length && ! hasPagination ) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
|
|
174
264
|
return (
|
|
175
265
|
<Stack
|
|
176
266
|
direction="row"
|
|
@@ -179,36 +269,9 @@ export function DataViewsPickerFooter() {
|
|
|
179
269
|
className="dataviews-footer"
|
|
180
270
|
gap="sm"
|
|
181
271
|
>
|
|
182
|
-
<
|
|
183
|
-
direction="row"
|
|
184
|
-
className="dataviews-picker-footer__bulk-selection"
|
|
185
|
-
gap="md"
|
|
186
|
-
align="center"
|
|
187
|
-
>
|
|
188
|
-
{ isMultiselect && (
|
|
189
|
-
<BulkSelectionCheckbox
|
|
190
|
-
selection={ selection }
|
|
191
|
-
selectedItems={ selectedItems }
|
|
192
|
-
onChangeSelection={ onChangeSelection }
|
|
193
|
-
data={ data }
|
|
194
|
-
getItemId={ getItemId }
|
|
195
|
-
disableSelectAll={ !! view.infiniteScrollEnabled }
|
|
196
|
-
/>
|
|
197
|
-
) }
|
|
198
|
-
<span className="dataviews-bulk-actions-footer__item-count">
|
|
199
|
-
{ message }
|
|
200
|
-
</span>
|
|
201
|
-
</Stack>
|
|
272
|
+
<PickerBulkSelectionInfo />
|
|
202
273
|
<DataViewsPagination />
|
|
203
|
-
|
|
204
|
-
<div className="dataviews-picker-footer__actions">
|
|
205
|
-
<ActionButtons
|
|
206
|
-
actions={ actions }
|
|
207
|
-
items={ selectedItems }
|
|
208
|
-
selection={ selection }
|
|
209
|
-
/>
|
|
210
|
-
</div>
|
|
211
|
-
) }
|
|
274
|
+
<PickerActions />
|
|
212
275
|
</Stack>
|
|
213
276
|
);
|
|
214
277
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// - align footer actions to the right.
|
|
4
4
|
.dataviews-picker-footer__bulk-selection {
|
|
5
5
|
align-self: flex-start;
|
|
6
|
-
height:
|
|
6
|
+
height: var(--wpds-dimension-size-md);
|
|
7
7
|
}
|
|
8
8
|
.dataviews-picker-footer__actions {
|
|
9
9
|
align-self: flex-end;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
right: var(--wpds-dimension-gap-xs);
|
|
76
76
|
width: var(--wpds-dimension-gap-xs);
|
|
77
77
|
height: var(--wpds-dimension-gap-xs);
|
|
78
|
-
background: var(--wpds-color-
|
|
78
|
+
background: var(--wpds-color-background-interactive-brand-strong);
|
|
79
79
|
border-radius: 50%;
|
|
80
80
|
pointer-events: none;
|
|
81
81
|
}
|
package/src/dataviews/style.scss
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
flex-direction: column;
|
|
24
24
|
font-size: var(--wpds-typography-font-size-md);
|
|
25
25
|
line-height: var(--wpds-typography-line-height-sm);
|
|
26
|
-
background-color: var(--wp-dataviews-color-background, var(--wpds-color-
|
|
26
|
+
background-color: var(--wp-dataviews-color-background, var(--wpds-color-background-surface-neutral-strong));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
.dataviews__view-actions,
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
.dataviews-title-field {
|
|
83
83
|
font-size: var(--wpds-typography-font-size-md);
|
|
84
84
|
font-weight: var(--wpds-typography-font-weight-medium);
|
|
85
|
-
color: var(--wpds-color-
|
|
85
|
+
color: var(--wpds-color-foreground-content-neutral);
|
|
86
86
|
text-overflow: ellipsis;
|
|
87
87
|
white-space: nowrap;
|
|
88
88
|
width: 100%;
|
|
@@ -94,10 +94,10 @@
|
|
|
94
94
|
overflow: hidden;
|
|
95
95
|
display: block;
|
|
96
96
|
flex-grow: 0;
|
|
97
|
-
color: var(--wpds-color-
|
|
97
|
+
color: var(--wpds-color-foreground-interactive-neutral);
|
|
98
98
|
|
|
99
99
|
&:hover {
|
|
100
|
-
color: var(--wpds-color-
|
|
100
|
+
color: var(--wpds-color-foreground-interactive-brand);
|
|
101
101
|
}
|
|
102
102
|
@include link-reset();
|
|
103
103
|
}
|
|
@@ -110,18 +110,18 @@
|
|
|
110
110
|
overflow: hidden;
|
|
111
111
|
display: block;
|
|
112
112
|
width: 100%;
|
|
113
|
-
color: var(--wpds-color-
|
|
113
|
+
color: var(--wpds-color-foreground-interactive-neutral-active);
|
|
114
114
|
&:hover {
|
|
115
|
-
color: var(--wpds-color-
|
|
115
|
+
color: var(--wpds-color-foreground-interactive-brand);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
.dataviews-title-field--clickable {
|
|
121
121
|
cursor: var(--wpds-cursor-control);
|
|
122
|
-
color: var(--wpds-color-
|
|
122
|
+
color: var(--wpds-color-foreground-interactive-neutral);
|
|
123
123
|
&:hover {
|
|
124
|
-
color: var(--wpds-color-
|
|
124
|
+
color: var(--wpds-color-foreground-interactive-brand);
|
|
125
125
|
}
|
|
126
126
|
@include link-reset();
|
|
127
127
|
}
|
|
@@ -29,7 +29,10 @@ import {
|
|
|
29
29
|
FiltersToggle,
|
|
30
30
|
} from '../components/dataviews-filters';
|
|
31
31
|
import DataViewsLayout from '../components/dataviews-layout';
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
DataViewsPickerFooter,
|
|
34
|
+
DataViewsPickerBulkActionToolbar,
|
|
35
|
+
} from '../components/dataviews-picker-footer';
|
|
33
36
|
import DataViewsSearch from '../components/dataviews-search';
|
|
34
37
|
import { DataViewsPagination } from '../components/dataviews-pagination';
|
|
35
38
|
import DataViewsViewConfig, {
|
|
@@ -269,7 +272,8 @@ function DataViewsPicker< Item >( {
|
|
|
269
272
|
// Populate the DataViews sub components
|
|
270
273
|
const DataViewsPickerSubComponents =
|
|
271
274
|
DataViewsPicker as typeof DataViewsPicker & {
|
|
272
|
-
BulkActionToolbar: typeof
|
|
275
|
+
BulkActionToolbar: typeof DataViewsPickerBulkActionToolbar;
|
|
276
|
+
Footer: typeof DataViewsPickerFooter;
|
|
273
277
|
Filters: typeof Filters;
|
|
274
278
|
FiltersToggled: typeof FiltersToggled;
|
|
275
279
|
FiltersToggle: typeof FiltersToggle;
|
|
@@ -280,7 +284,9 @@ const DataViewsPickerSubComponents =
|
|
|
280
284
|
ViewConfig: typeof DataviewsViewConfigDropdown;
|
|
281
285
|
};
|
|
282
286
|
|
|
283
|
-
DataViewsPickerSubComponents.BulkActionToolbar =
|
|
287
|
+
DataViewsPickerSubComponents.BulkActionToolbar =
|
|
288
|
+
DataViewsPickerBulkActionToolbar;
|
|
289
|
+
DataViewsPickerSubComponents.Footer = DataViewsPickerFooter;
|
|
284
290
|
DataViewsPickerSubComponents.Filters = Filters;
|
|
285
291
|
DataViewsPickerSubComponents.FiltersToggled = FiltersToggled;
|
|
286
292
|
DataViewsPickerSubComponents.FiltersToggle = FiltersToggle;
|