@wordpress/dataviews 4.16.0 → 4.18.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/README.md +18 -1
- package/build/components/dataviews-item-actions/index.js +2 -1
- package/build/components/dataviews-item-actions/index.js.map +1 -1
- package/build/types.js.map +1 -1
- package/build-module/components/dataviews-item-actions/index.js +2 -1
- package/build-module/components/dataviews-item-actions/index.js.map +1 -1
- package/build-module/types.js.map +1 -1
- package/build-style/style-rtl.css +25 -10
- package/build-style/style.css +25 -10
- package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -1
- package/build-types/types.d.ts +8 -0
- package/build-types/types.d.ts.map +1 -1
- package/build-wp/index.js +32 -14
- package/package.json +11 -11
- package/src/components/dataviews/stories/fixtures.tsx +1 -0
- package/src/components/dataviews-item-actions/index.tsx +1 -1
- package/src/dataviews-layouts/grid/style.scss +5 -0
- package/src/dataviews-layouts/list/style.scss +23 -11
- package/src/types.ts +12 -0
- package/tsconfig.tsbuildinfo +1 -1
package/build-wp/index.js
CHANGED
|
@@ -4896,13 +4896,15 @@ function clamp(value, min, max) {
|
|
|
4896
4896
|
const baseValue = getNumber(value);
|
|
4897
4897
|
return Math.max(min, Math.min(baseValue, max));
|
|
4898
4898
|
}
|
|
4899
|
-
function
|
|
4899
|
+
function ensureValidStep(value, min, step) {
|
|
4900
4900
|
const baseValue = getNumber(value);
|
|
4901
4901
|
const stepValue = getNumber(step);
|
|
4902
|
-
const precision = getPrecision(step);
|
|
4903
|
-
const
|
|
4904
|
-
const
|
|
4905
|
-
|
|
4902
|
+
const precision = Math.max(getPrecision(step), getPrecision(min));
|
|
4903
|
+
const realMin = Math.abs(min) === Infinity ? 0 : min;
|
|
4904
|
+
const tare = realMin % stepValue ? realMin : 0;
|
|
4905
|
+
const rounded2 = Math.round((baseValue - tare) / stepValue) * stepValue;
|
|
4906
|
+
const fromMin = rounded2 + tare;
|
|
4907
|
+
return precision ? getNumber(fromMin.toFixed(precision)) : fromMin;
|
|
4906
4908
|
}
|
|
4907
4909
|
|
|
4908
4910
|
// ../components/build-module/h-stack/utils.js
|
|
@@ -5113,10 +5115,13 @@ function UnforwardedNumberControl(props, forwardedRef) {
|
|
|
5113
5115
|
const isStepAny = step === "any";
|
|
5114
5116
|
const baseStep = isStepAny ? 1 : ensureNumber(step);
|
|
5115
5117
|
const baseSpin = ensureNumber(spinFactor) * baseStep;
|
|
5116
|
-
const baseValue = roundClamp(0, min, max, baseStep);
|
|
5117
5118
|
const constrainValue = (value, stepOverride) => {
|
|
5118
|
-
|
|
5119
|
+
if (!isStepAny) {
|
|
5120
|
+
value = ensureValidStep(value, min, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep);
|
|
5121
|
+
}
|
|
5122
|
+
return `${clamp(value, min, max)}`;
|
|
5119
5123
|
};
|
|
5124
|
+
const baseValue = constrainValue(0);
|
|
5120
5125
|
const autoComplete = typeProp === "number" ? "off" : void 0;
|
|
5121
5126
|
const classes = clsx6("components-number-control", className);
|
|
5122
5127
|
const cx = useCx();
|
|
@@ -6022,19 +6027,32 @@ var UnforwardedPopover = (props, forwardedRef) => {
|
|
|
6022
6027
|
}), content]
|
|
6023
6028
|
});
|
|
6024
6029
|
};
|
|
6025
|
-
var
|
|
6026
|
-
function PopoverSlot({
|
|
6030
|
+
var PopoverSlot = forwardRef(({
|
|
6027
6031
|
name = SLOT_NAME
|
|
6028
|
-
}, ref) {
|
|
6032
|
+
}, ref) => {
|
|
6029
6033
|
return /* @__PURE__ */ _jsx70(Slot3, {
|
|
6030
6034
|
bubblesVirtually: true,
|
|
6031
6035
|
name,
|
|
6032
6036
|
className: "popover-slot",
|
|
6033
6037
|
ref
|
|
6034
6038
|
});
|
|
6035
|
-
}
|
|
6036
|
-
Popover
|
|
6037
|
-
|
|
6039
|
+
});
|
|
6040
|
+
var Popover = Object.assign(contextConnect(UnforwardedPopover, "Popover"), {
|
|
6041
|
+
/**
|
|
6042
|
+
* Renders a slot that is used internally by Popover for rendering content.
|
|
6043
|
+
*/
|
|
6044
|
+
Slot: Object.assign(PopoverSlot, {
|
|
6045
|
+
displayName: "Popover.Slot"
|
|
6046
|
+
}),
|
|
6047
|
+
/**
|
|
6048
|
+
* Provides a context to manage popover slot names.
|
|
6049
|
+
*
|
|
6050
|
+
* This is marked as unstable and should not be used directly.
|
|
6051
|
+
*/
|
|
6052
|
+
__unstableSlotNameProvider: Object.assign(slotNameContext.Provider, {
|
|
6053
|
+
displayName: "Popover.__unstableSlotNameProvider"
|
|
6054
|
+
})
|
|
6055
|
+
});
|
|
6038
6056
|
var popover_default = Popover;
|
|
6039
6057
|
|
|
6040
6058
|
// ../components/build-module/toggle-group-control/toggle-group-control/styles.js
|
|
@@ -11522,7 +11540,7 @@ function ActionModal({
|
|
|
11522
11540
|
title: action.modalHeader || label,
|
|
11523
11541
|
__experimentalHideHeader: !!action.hideModalHeader,
|
|
11524
11542
|
onRequestClose: closeModal,
|
|
11525
|
-
focusOnMount:
|
|
11543
|
+
focusOnMount: action.modalFocusOnMount ?? true,
|
|
11526
11544
|
size: action.modalSize || "medium",
|
|
11527
11545
|
overlayClassName: `dataviews-action-modal dataviews-action-modal__${kebabCase3(
|
|
11528
11546
|
action.id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/dataviews",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.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",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@ariakit/react": "^0.4.15",
|
|
48
48
|
"@babel/runtime": "7.25.7",
|
|
49
|
-
"@wordpress/components": "^29.
|
|
50
|
-
"@wordpress/compose": "^7.
|
|
51
|
-
"@wordpress/data": "^10.
|
|
52
|
-
"@wordpress/element": "^6.
|
|
53
|
-
"@wordpress/i18n": "^5.
|
|
54
|
-
"@wordpress/icons": "^10.
|
|
55
|
-
"@wordpress/primitives": "^4.
|
|
56
|
-
"@wordpress/private-apis": "^1.
|
|
57
|
-
"@wordpress/warning": "^3.
|
|
49
|
+
"@wordpress/components": "^29.8.0",
|
|
50
|
+
"@wordpress/compose": "^7.22.0",
|
|
51
|
+
"@wordpress/data": "^10.22.0",
|
|
52
|
+
"@wordpress/element": "^6.22.0",
|
|
53
|
+
"@wordpress/i18n": "^5.22.0",
|
|
54
|
+
"@wordpress/icons": "^10.22.0",
|
|
55
|
+
"@wordpress/primitives": "^4.22.0",
|
|
56
|
+
"@wordpress/private-apis": "^1.22.0",
|
|
57
|
+
"@wordpress/warning": "^3.22.0",
|
|
58
58
|
"clsx": "^2.1.1",
|
|
59
59
|
"remove-accents": "^0.5.0"
|
|
60
60
|
},
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build:wp": "node build"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "01a314d7e46a50101e328fdb11959c441e49372d"
|
|
71
71
|
}
|
|
@@ -110,7 +110,7 @@ export function ActionModal< Item >( {
|
|
|
110
110
|
title={ action.modalHeader || label }
|
|
111
111
|
__experimentalHideHeader={ !! action.hideModalHeader }
|
|
112
112
|
onRequestClose={ closeModal }
|
|
113
|
-
focusOnMount=
|
|
113
|
+
focusOnMount={ action.modalFocusOnMount ?? true }
|
|
114
114
|
size={ action.modalSize || 'medium' }
|
|
115
115
|
overlayClassName={ `dataviews-action-modal dataviews-action-modal__${ kebabCase(
|
|
116
116
|
action.id
|
|
@@ -150,6 +150,11 @@
|
|
|
150
150
|
top: -9999em;
|
|
151
151
|
left: $grid-unit-10;
|
|
152
152
|
z-index: z-index(".dataviews-view-grid__card .dataviews-selection-checkbox");
|
|
153
|
+
|
|
154
|
+
@media (hover: none) {
|
|
155
|
+
// Show checkboxes on devices that do not support hover.
|
|
156
|
+
top: $grid-unit-10;
|
|
157
|
+
}
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
.dataviews-view-grid__card:hover .dataviews-selection-checkbox,
|
|
@@ -16,29 +16,41 @@ div.dataviews-view-list {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.dataviews-view-list__item-actions {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
display: flex;
|
|
20
|
+
width: max-content;
|
|
21
|
+
flex: 0 0 auto;
|
|
22
|
+
gap: $grid-unit-05;
|
|
23
|
+
|
|
24
|
+
.components-button {
|
|
25
|
+
position: relative;
|
|
26
|
+
z-index: 1;
|
|
27
|
+
}
|
|
21
28
|
|
|
22
29
|
> div {
|
|
23
30
|
height: $button-size-small;
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
> :not(:last-child) {
|
|
34
|
+
flex: 0;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
width: 0;
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
&:where(.is-selected, .is-hovered, :focus-within) {
|
|
34
|
-
.dataviews-view-list__item-actions {
|
|
41
|
+
.dataviews-view-list__item-actions > :not(:last-child) {
|
|
35
42
|
flex-basis: min-content;
|
|
43
|
+
width: auto;
|
|
36
44
|
overflow: unset;
|
|
37
|
-
|
|
45
|
+
}
|
|
46
|
+
}
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
@media (hover: none) {
|
|
49
|
+
// Show primary action on devices that do not support hover.
|
|
50
|
+
.dataviews-view-list__item-actions > :not(:last-child) {
|
|
51
|
+
flex-basis: min-content;
|
|
52
|
+
width: auto;
|
|
53
|
+
overflow: unset;
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
|
package/src/types.ts
CHANGED
|
@@ -8,6 +8,11 @@ import type { ReactElement, ComponentType } from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
import type { SetSelection } from './private-types';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
import type { useFocusOnMount } from '@wordpress/compose';
|
|
15
|
+
|
|
11
16
|
export type SortDirection = 'asc' | 'desc';
|
|
12
17
|
|
|
13
18
|
/**
|
|
@@ -470,6 +475,13 @@ export interface ActionModal< Item > extends ActionBase< Item > {
|
|
|
470
475
|
* @default 'medium'
|
|
471
476
|
*/
|
|
472
477
|
modalSize?: 'small' | 'medium' | 'large' | 'fill';
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* The focus on mount property of the modal.
|
|
481
|
+
*/
|
|
482
|
+
modalFocusOnMount?:
|
|
483
|
+
| Parameters< typeof useFocusOnMount >[ 0 ]
|
|
484
|
+
| 'firstContentElement';
|
|
473
485
|
}
|
|
474
486
|
|
|
475
487
|
export interface ActionButton< Item > extends ActionBase< Item > {
|