@wordpress/dataviews 4.16.0 → 4.17.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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.17.0 (2025-03-27)
6
+
5
7
  ## 4.16.0 (2025-03-13)
6
8
 
7
9
  ## 4.15.0 (2025-02-28)
package/README.md CHANGED
@@ -296,7 +296,7 @@ const actions = [
296
296
  label: 'View',
297
297
  isPrimary: true,
298
298
  icon: <Icon icon={ view } />,
299
- isEligible: ( item ) => item.status === 'published'
299
+ isEligible: ( item ) => item.status === 'published',
300
300
  callback: ( items ) => {
301
301
  console.log( 'Viewing item:', items[0] );
302
302
  },
@@ -811,6 +811,11 @@
811
811
  right: 8px;
812
812
  z-index: 1;
813
813
  }
814
+ @media (hover: none) {
815
+ .dataviews-view-grid__card .dataviews-selection-checkbox {
816
+ top: 8px;
817
+ }
818
+ }
814
819
 
815
820
  .dataviews-view-grid__card:hover .dataviews-selection-checkbox,
816
821
  .dataviews-view-grid__card:focus-within .dataviews-selection-checkbox,
@@ -811,6 +811,11 @@
811
811
  left: 8px;
812
812
  z-index: 1;
813
813
  }
814
+ @media (hover: none) {
815
+ .dataviews-view-grid__card .dataviews-selection-checkbox {
816
+ top: 8px;
817
+ }
818
+ }
814
819
 
815
820
  .dataviews-view-grid__card:hover .dataviews-selection-checkbox,
816
821
  .dataviews-view-grid__card:focus-within .dataviews-selection-checkbox,
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 roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) {
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 rounded2 = Math.round(baseValue / stepValue) * stepValue;
4904
- const clampedValue = clamp(rounded2, min, max);
4905
- return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
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
- return isStepAny ? "" + Math.min(max, Math.max(min, ensureNumber(value))) : "" + roundClamp(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep);
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dataviews",
3
- "version": "4.16.0",
3
+ "version": "4.17.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.6.0",
50
- "@wordpress/compose": "^7.20.0",
51
- "@wordpress/data": "^10.20.0",
52
- "@wordpress/element": "^6.20.0",
53
- "@wordpress/i18n": "^5.20.0",
54
- "@wordpress/icons": "^10.20.0",
55
- "@wordpress/primitives": "^4.20.0",
56
- "@wordpress/private-apis": "^1.20.0",
57
- "@wordpress/warning": "^3.20.0",
49
+ "@wordpress/components": "^29.7.0",
50
+ "@wordpress/compose": "^7.21.0",
51
+ "@wordpress/data": "^10.21.0",
52
+ "@wordpress/element": "^6.21.0",
53
+ "@wordpress/i18n": "^5.21.0",
54
+ "@wordpress/icons": "^10.21.0",
55
+ "@wordpress/primitives": "^4.21.0",
56
+ "@wordpress/private-apis": "^1.21.0",
57
+ "@wordpress/warning": "^3.21.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": "72476970386146d450c375e5c71a96dda7c9aaa8"
70
+ "gitHead": "104af00f9abcd7a4d36b87e648f148c72cc4ea5f"
71
71
  }
@@ -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,