@wordpress/dataviews 11.1.1-next.76cff8c98.0 → 11.2.1-next.06ee73755.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 (52) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/build/components/dataviews-filters/input-widget.cjs +1 -1
  3. package/build/components/dataviews-filters/input-widget.cjs.map +1 -1
  4. package/build/components/dataviews-layouts/index.cjs +3 -2
  5. package/build/components/dataviews-layouts/index.cjs.map +2 -2
  6. package/build/components/dataviews-layouts/list/index.cjs +5 -1
  7. package/build/components/dataviews-layouts/list/index.cjs.map +2 -2
  8. package/build/components/dataviews-layouts/{table → utils}/density-picker.cjs +1 -1
  9. package/build/components/dataviews-layouts/{table → utils}/density-picker.cjs.map +2 -2
  10. package/build/components/dataviews-view-config/properties-section.cjs +11 -39
  11. package/build/components/dataviews-view-config/properties-section.cjs.map +2 -2
  12. package/build/hooks/use-form-validity.cjs +1 -1
  13. package/build/hooks/use-form-validity.cjs.map +1 -1
  14. package/build/types/dataviews.cjs.map +1 -1
  15. package/build-module/components/dataviews-filters/input-widget.mjs +1 -1
  16. package/build-module/components/dataviews-filters/input-widget.mjs.map +1 -1
  17. package/build-module/components/dataviews-layouts/index.mjs +3 -2
  18. package/build-module/components/dataviews-layouts/index.mjs.map +2 -2
  19. package/build-module/components/dataviews-layouts/list/index.mjs +5 -1
  20. package/build-module/components/dataviews-layouts/list/index.mjs.map +2 -2
  21. package/build-module/components/dataviews-layouts/{table → utils}/density-picker.mjs +1 -1
  22. package/build-module/components/dataviews-layouts/utils/density-picker.mjs.map +7 -0
  23. package/build-module/components/dataviews-view-config/properties-section.mjs +11 -39
  24. package/build-module/components/dataviews-view-config/properties-section.mjs.map +2 -2
  25. package/build-module/hooks/use-form-validity.mjs +1 -1
  26. package/build-module/hooks/use-form-validity.mjs.map +1 -1
  27. package/build-style/style-rtl.css +49 -5
  28. package/build-style/style.css +49 -5
  29. package/build-types/components/dataviews-layouts/index.d.ts +2 -2
  30. package/build-types/components/dataviews-layouts/index.d.ts.map +1 -1
  31. package/build-types/components/dataviews-layouts/list/index.d.ts.map +1 -1
  32. package/build-types/components/dataviews-layouts/{table → utils}/density-picker.d.ts.map +1 -1
  33. package/build-types/components/dataviews-view-config/properties-section.d.ts.map +1 -1
  34. package/build-types/dataform/stories/index.story.d.ts +1 -1
  35. package/build-types/dataform/stories/validation.d.ts +1 -1
  36. package/build-types/dataform/stories/validation.d.ts.map +1 -1
  37. package/build-types/types/dataviews.d.ts +6 -0
  38. package/build-types/types/dataviews.d.ts.map +1 -1
  39. package/build-wp/index.js +165 -188
  40. package/package.json +23 -20
  41. package/src/components/dataviews-filters/input-widget.tsx +1 -1
  42. package/src/components/dataviews-layouts/index.ts +2 -1
  43. package/src/components/dataviews-layouts/list/index.tsx +7 -1
  44. package/src/components/dataviews-layouts/list/style.scss +65 -0
  45. package/src/components/dataviews-layouts/{table → utils}/density-picker.tsx +2 -2
  46. package/src/components/dataviews-view-config/properties-section.tsx +24 -49
  47. package/src/dataform/stories/index.story.tsx +1 -1
  48. package/src/dataform/stories/validation.tsx +8 -1
  49. package/src/hooks/use-form-validity.ts +1 -1
  50. package/src/types/dataviews.ts +7 -0
  51. package/build-module/components/dataviews-layouts/table/density-picker.mjs.map +0 -7
  52. /package/build-types/components/dataviews-layouts/{table → utils}/density-picker.d.ts +0 -0
package/build-wp/index.js CHANGED
@@ -1210,6 +1210,142 @@ function useObservableValue(map, name) {
1210
1210
  return useSyncExternalStore(subscribe, getValue, getValue);
1211
1211
  }
1212
1212
 
1213
+ // ../dom-ready/build-module/index.mjs
1214
+ function domReady(callback) {
1215
+ if (typeof document === "undefined") {
1216
+ return;
1217
+ }
1218
+ if (document.readyState === "complete" || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly.
1219
+ document.readyState === "interactive") {
1220
+ return void callback();
1221
+ }
1222
+ document.addEventListener("DOMContentLoaded", callback);
1223
+ }
1224
+
1225
+ // ../a11y/build-module/script/add-container.mjs
1226
+ function addContainer(ariaLive = "polite") {
1227
+ const container = document.createElement("div");
1228
+ container.id = `a11y-speak-${ariaLive}`;
1229
+ container.className = "a11y-speak-region";
1230
+ container.setAttribute(
1231
+ "style",
1232
+ "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
1233
+ );
1234
+ container.setAttribute("aria-live", ariaLive);
1235
+ container.setAttribute("aria-relevant", "additions text");
1236
+ container.setAttribute("aria-atomic", "true");
1237
+ const { body } = document;
1238
+ if (body) {
1239
+ body.appendChild(container);
1240
+ }
1241
+ return container;
1242
+ }
1243
+
1244
+ // ../a11y/build-module/script/add-intro-text.mjs
1245
+ import { __ as __2 } from "@wordpress/i18n";
1246
+ function addIntroText() {
1247
+ const introText = document.createElement("p");
1248
+ introText.id = "a11y-speak-intro-text";
1249
+ introText.className = "a11y-speak-intro-text";
1250
+ introText.textContent = __2("Notifications");
1251
+ introText.setAttribute(
1252
+ "style",
1253
+ "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
1254
+ );
1255
+ introText.setAttribute("hidden", "");
1256
+ const { body } = document;
1257
+ if (body) {
1258
+ body.appendChild(introText);
1259
+ }
1260
+ return introText;
1261
+ }
1262
+
1263
+ // ../a11y/build-module/shared/clear.mjs
1264
+ function clear() {
1265
+ const regions = document.getElementsByClassName("a11y-speak-region");
1266
+ const introText = document.getElementById("a11y-speak-intro-text");
1267
+ for (let i = 0; i < regions.length; i++) {
1268
+ regions[i].textContent = "";
1269
+ }
1270
+ if (introText) {
1271
+ introText.setAttribute("hidden", "hidden");
1272
+ }
1273
+ }
1274
+
1275
+ // ../a11y/build-module/shared/filter-message.mjs
1276
+ var previousMessage = "";
1277
+ function filterMessage(message) {
1278
+ message = message.replace(/<[^<>]+>/g, " ");
1279
+ if (previousMessage === message) {
1280
+ message += "\xA0";
1281
+ }
1282
+ previousMessage = message;
1283
+ return message;
1284
+ }
1285
+
1286
+ // ../a11y/build-module/shared/index.mjs
1287
+ function speak(message, ariaLive) {
1288
+ clear();
1289
+ message = filterMessage(message);
1290
+ const introText = document.getElementById("a11y-speak-intro-text");
1291
+ const containerAssertive = document.getElementById(
1292
+ "a11y-speak-assertive"
1293
+ );
1294
+ const containerPolite = document.getElementById("a11y-speak-polite");
1295
+ if (containerAssertive && ariaLive === "assertive") {
1296
+ containerAssertive.textContent = message;
1297
+ } else if (containerPolite) {
1298
+ containerPolite.textContent = message;
1299
+ }
1300
+ if (introText) {
1301
+ introText.removeAttribute("hidden");
1302
+ }
1303
+ }
1304
+
1305
+ // ../a11y/build-module/index.mjs
1306
+ function setup() {
1307
+ const introText = document.getElementById("a11y-speak-intro-text");
1308
+ const containerAssertive = document.getElementById(
1309
+ "a11y-speak-assertive"
1310
+ );
1311
+ const containerPolite = document.getElementById("a11y-speak-polite");
1312
+ if (introText === null) {
1313
+ addIntroText();
1314
+ }
1315
+ if (containerAssertive === null) {
1316
+ addContainer("assertive");
1317
+ }
1318
+ if (containerPolite === null) {
1319
+ addContainer("polite");
1320
+ }
1321
+ }
1322
+ domReady(setup);
1323
+
1324
+ // ../primitives/build-module/svg/index.mjs
1325
+ import clsx from "clsx";
1326
+ import { jsx as jsx2 } from "react/jsx-runtime";
1327
+ var Circle = (props) => createElement("circle", props);
1328
+ var Path = (props) => createElement("path", props);
1329
+ var SVG = forwardRef(
1330
+ /**
1331
+ * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
1332
+ * Other props will be passed through to svg component.
1333
+ * @param {import('react').ForwardedRef<SVGSVGElement>} ref The forwarded ref to the SVG element.
1334
+ *
1335
+ * @return {JSX.Element} Stop component
1336
+ */
1337
+ ({ className: className2, isPressed, ...props }, ref) => {
1338
+ const appliedProps = {
1339
+ ...props,
1340
+ className: clsx(className2, { "is-pressed": isPressed }) || void 0,
1341
+ "aria-hidden": true,
1342
+ focusable: false
1343
+ };
1344
+ return /* @__PURE__ */ jsx2("svg", { ...appliedProps, ref });
1345
+ }
1346
+ );
1347
+ SVG.displayName = "SVG";
1348
+
1213
1349
  // ../ui/build-module/stack/stack.mjs
1214
1350
  import { useRender, mergeProps } from "@base-ui/react";
1215
1351
  var css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
@@ -1241,7 +1377,7 @@ var Stack = forwardRef(function Stack2({ direction, gap, align, justify, wrap, r
1241
1377
  });
1242
1378
 
1243
1379
  // src/constants.ts
1244
- import { __ as __2 } from "@wordpress/i18n";
1380
+ import { __ as __3 } from "@wordpress/i18n";
1245
1381
 
1246
1382
  // ../icons/build-module/icon/index.mjs
1247
1383
  var icon_default = forwardRef(
@@ -1255,31 +1391,6 @@ var icon_default = forwardRef(
1255
1391
  }
1256
1392
  );
1257
1393
 
1258
- // ../primitives/build-module/svg/index.mjs
1259
- import clsx from "clsx";
1260
- import { jsx as jsx2 } from "react/jsx-runtime";
1261
- var Circle = (props) => createElement("circle", props);
1262
- var Path = (props) => createElement("path", props);
1263
- var SVG = forwardRef(
1264
- /**
1265
- * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
1266
- * Other props will be passed through to svg component.
1267
- * @param {import('react').ForwardedRef<SVGSVGElement>} ref The forwarded ref to the SVG element.
1268
- *
1269
- * @return {JSX.Element} Stop component
1270
- */
1271
- ({ className: className2, isPressed, ...props }, ref) => {
1272
- const appliedProps = {
1273
- ...props,
1274
- className: clsx(className2, { "is-pressed": isPressed }) || void 0,
1275
- "aria-hidden": true,
1276
- focusable: false
1277
- };
1278
- return /* @__PURE__ */ jsx2("svg", { ...appliedProps, ref });
1279
- }
1280
- );
1281
- SVG.displayName = "SVG";
1282
-
1283
1394
  // ../icons/build-module/library/arrow-down.mjs
1284
1395
  import { jsx as jsx3 } from "react/jsx-runtime";
1285
1396
  var arrow_down_default = /* @__PURE__ */ jsx3(SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx3(Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) });
@@ -1495,8 +1606,8 @@ var SORTING_DIRECTIONS = ["asc", "desc"];
1495
1606
  var sortArrows = { asc: "\u2191", desc: "\u2193" };
1496
1607
  var sortValues = { asc: "ascending", desc: "descending" };
1497
1608
  var sortLabels = {
1498
- asc: __2("Sort ascending"),
1499
- desc: __2("Sort descending")
1609
+ asc: __3("Sort ascending"),
1610
+ desc: __3("Sort descending")
1500
1611
  };
1501
1612
  var sortIcons = {
1502
1613
  asc: arrow_up_default,
@@ -2595,7 +2706,7 @@ var tooltip_default = Tooltip2;
2595
2706
 
2596
2707
  // ../components/build-module/context/context-system-provider.mjs
2597
2708
  import deepmerge from "deepmerge";
2598
- import fastDeepEqual from "fast-deep-equal/es6";
2709
+ import fastDeepEqual from "fast-deep-equal/es6/index.js";
2599
2710
  import { isPlainObject } from "is-plain-object";
2600
2711
 
2601
2712
  // ../warning/build-module/utils.mjs
@@ -3141,7 +3252,7 @@ var component_default6 = Spacer;
3141
3252
 
3142
3253
  // ../components/build-module/number-control/index.mjs
3143
3254
  import clsx6 from "clsx";
3144
- import { isRTL as isRTL3, __ as __3 } from "@wordpress/i18n";
3255
+ import { isRTL as isRTL3, __ as __4 } from "@wordpress/i18n";
3145
3256
 
3146
3257
  // ../components/build-module/number-control/styles/number-control-styles.mjs
3147
3258
  import _styled4 from "@emotion/styled/base";
@@ -5334,13 +5445,13 @@ function UnforwardedNumberControl(props, forwardedRef) {
5334
5445
  className: spinButtonClasses,
5335
5446
  icon: plus_default,
5336
5447
  size: "small",
5337
- label: __3("Increment"),
5448
+ label: __4("Increment"),
5338
5449
  onClick: buildSpinButtonClickHandler("up")
5339
5450
  }), /* @__PURE__ */ _jsx31(SpinButton, {
5340
5451
  className: spinButtonClasses,
5341
5452
  icon: reset_default,
5342
5453
  size: "small",
5343
- label: __3("Decrement"),
5454
+ label: __4("Decrement"),
5344
5455
  onClick: buildSpinButtonClickHandler("down")
5345
5456
  })]
5346
5457
  })
@@ -5377,117 +5488,6 @@ function UnconnectedInputControlSuffixWrapper(props, forwardedRef) {
5377
5488
  var InputControlSuffixWrapper = contextConnect(UnconnectedInputControlSuffixWrapper, "InputControlSuffixWrapper");
5378
5489
  var input_suffix_wrapper_default = InputControlSuffixWrapper;
5379
5490
 
5380
- // ../dom-ready/build-module/index.mjs
5381
- function domReady(callback) {
5382
- if (typeof document === "undefined") {
5383
- return;
5384
- }
5385
- if (document.readyState === "complete" || // DOMContentLoaded + Images/Styles/etc loaded, so we call directly.
5386
- document.readyState === "interactive") {
5387
- return void callback();
5388
- }
5389
- document.addEventListener("DOMContentLoaded", callback);
5390
- }
5391
-
5392
- // ../a11y/build-module/script/add-container.mjs
5393
- function addContainer(ariaLive = "polite") {
5394
- const container = document.createElement("div");
5395
- container.id = `a11y-speak-${ariaLive}`;
5396
- container.className = "a11y-speak-region";
5397
- container.setAttribute(
5398
- "style",
5399
- "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
5400
- );
5401
- container.setAttribute("aria-live", ariaLive);
5402
- container.setAttribute("aria-relevant", "additions text");
5403
- container.setAttribute("aria-atomic", "true");
5404
- const { body } = document;
5405
- if (body) {
5406
- body.appendChild(container);
5407
- }
5408
- return container;
5409
- }
5410
-
5411
- // ../a11y/build-module/script/add-intro-text.mjs
5412
- import { __ as __4 } from "@wordpress/i18n";
5413
- function addIntroText() {
5414
- const introText = document.createElement("p");
5415
- introText.id = "a11y-speak-intro-text";
5416
- introText.className = "a11y-speak-intro-text";
5417
- introText.textContent = __4("Notifications");
5418
- introText.setAttribute(
5419
- "style",
5420
- "position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip-path:inset(50%);border:0;word-wrap:normal !important;"
5421
- );
5422
- introText.setAttribute("hidden", "");
5423
- const { body } = document;
5424
- if (body) {
5425
- body.appendChild(introText);
5426
- }
5427
- return introText;
5428
- }
5429
-
5430
- // ../a11y/build-module/shared/clear.mjs
5431
- function clear() {
5432
- const regions = document.getElementsByClassName("a11y-speak-region");
5433
- const introText = document.getElementById("a11y-speak-intro-text");
5434
- for (let i = 0; i < regions.length; i++) {
5435
- regions[i].textContent = "";
5436
- }
5437
- if (introText) {
5438
- introText.setAttribute("hidden", "hidden");
5439
- }
5440
- }
5441
-
5442
- // ../a11y/build-module/shared/filter-message.mjs
5443
- var previousMessage = "";
5444
- function filterMessage(message) {
5445
- message = message.replace(/<[^<>]+>/g, " ");
5446
- if (previousMessage === message) {
5447
- message += "\xA0";
5448
- }
5449
- previousMessage = message;
5450
- return message;
5451
- }
5452
-
5453
- // ../a11y/build-module/shared/index.mjs
5454
- function speak(message, ariaLive) {
5455
- clear();
5456
- message = filterMessage(message);
5457
- const introText = document.getElementById("a11y-speak-intro-text");
5458
- const containerAssertive = document.getElementById(
5459
- "a11y-speak-assertive"
5460
- );
5461
- const containerPolite = document.getElementById("a11y-speak-polite");
5462
- if (containerAssertive && ariaLive === "assertive") {
5463
- containerAssertive.textContent = message;
5464
- } else if (containerPolite) {
5465
- containerPolite.textContent = message;
5466
- }
5467
- if (introText) {
5468
- introText.removeAttribute("hidden");
5469
- }
5470
- }
5471
-
5472
- // ../a11y/build-module/index.mjs
5473
- function setup() {
5474
- const introText = document.getElementById("a11y-speak-intro-text");
5475
- const containerAssertive = document.getElementById(
5476
- "a11y-speak-assertive"
5477
- );
5478
- const containerPolite = document.getElementById("a11y-speak-polite");
5479
- if (introText === null) {
5480
- addIntroText();
5481
- }
5482
- if (containerAssertive === null) {
5483
- addContainer("assertive");
5484
- }
5485
- if (containerPolite === null) {
5486
- addContainer("polite");
5487
- }
5488
- }
5489
- domReady(setup);
5490
-
5491
5491
  // ../components/build-module/utils/strings.mjs
5492
5492
  import removeAccents from "remove-accents";
5493
5493
  import { paramCase } from "change-case";
@@ -11716,7 +11716,7 @@ function unlock(object) {
11716
11716
  return lockedData.get(_object[__private]);
11717
11717
  }
11718
11718
  var lockedData = /* @__PURE__ */ new WeakMap();
11719
- var __private = Symbol("Private API ID");
11719
+ var __private = /* @__PURE__ */ Symbol("Private API ID");
11720
11720
 
11721
11721
  // ../components/build-module/lock-unlock.mjs
11722
11722
  var {
@@ -13795,27 +13795,14 @@ function PropertiesSection({
13795
13795
  const visibleRegularFieldsCount = regularFields.filter(
13796
13796
  (f) => visibleFieldIds.includes(f.id)
13797
13797
  ).length;
13798
- let visibleLockedFields = lockedFields.filter(
13799
- ({ field, isVisibleFlag }) => (
13798
+ const visibleLockedFields = lockedFields.filter(
13799
+ ({ isVisibleFlag }) => (
13800
13800
  // @ts-expect-error
13801
- isDefined2(field) && (view[isVisibleFlag] ?? true)
13801
+ view[isVisibleFlag] ?? true
13802
13802
  )
13803
13803
  );
13804
13804
  const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount;
13805
- if (totalVisibleFields === 1) {
13806
- if (visibleLockedFields.length === 1) {
13807
- visibleLockedFields = visibleLockedFields.map((locked) => ({
13808
- ...locked,
13809
- field: { ...locked.field, enableHiding: false }
13810
- }));
13811
- }
13812
- }
13813
- const hiddenLockedFields = lockedFields.filter(
13814
- ({ field, isVisibleFlag }) => (
13815
- // @ts-expect-error
13816
- isDefined2(field) && !(view[isVisibleFlag] ?? true)
13817
- )
13818
- );
13805
+ const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1;
13819
13806
  return /* @__PURE__ */ jsxs5(Stack, { direction: "column", className: "dataviews-field-control", children: [
13820
13807
  showLabel && /* @__PURE__ */ jsx42(base_control_default.VisualLabel, { children: __18("Properties") }),
13821
13808
  /* @__PURE__ */ jsx42(
@@ -13824,32 +13811,18 @@ function PropertiesSection({
13824
13811
  direction: "column",
13825
13812
  className: "dataviews-view-config__properties",
13826
13813
  children: /* @__PURE__ */ jsxs5(component_default23, { isBordered: true, isSeparated: true, size: "medium", children: [
13827
- visibleLockedFields.map(({ field, isVisibleFlag }) => {
13828
- return /* @__PURE__ */ jsx42(
13829
- FieldItem,
13830
- {
13831
- field,
13832
- isVisible: true,
13833
- onToggleVisibility: () => {
13834
- onChangeView({
13835
- ...view,
13836
- [isVisibleFlag]: false
13837
- });
13838
- }
13839
- },
13840
- field.id
13841
- );
13842
- }),
13843
- hiddenLockedFields.map(({ field, isVisibleFlag }) => {
13814
+ lockedFields.map(({ field, isVisibleFlag }) => {
13815
+ const isVisible2 = view[isVisibleFlag] ?? true;
13816
+ const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field;
13844
13817
  return /* @__PURE__ */ jsx42(
13845
13818
  FieldItem,
13846
13819
  {
13847
- field,
13848
- isVisible: false,
13820
+ field: fieldToRender,
13821
+ isVisible: isVisible2,
13849
13822
  onToggleVisibility: () => {
13850
13823
  onChangeView({
13851
13824
  ...view,
13852
- [isVisibleFlag]: true
13825
+ [isVisibleFlag]: !isVisible2
13853
13826
  });
13854
13827
  }
13855
13828
  },
@@ -13858,8 +13831,7 @@ function PropertiesSection({
13858
13831
  }),
13859
13832
  regularFields.map((field) => {
13860
13833
  const isVisible2 = visibleFieldIds.includes(field.id);
13861
- const isLastVisible = totalVisibleFields === 1 && isVisible2;
13862
- const fieldToRender = isLastVisible ? { ...field, enableHiding: false } : field;
13834
+ const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field;
13863
13835
  return /* @__PURE__ */ jsx42(
13864
13836
  FieldItem,
13865
13837
  {
@@ -15298,7 +15270,11 @@ function ViewList(props) {
15298
15270
  {
15299
15271
  id: baseId,
15300
15272
  render: /* @__PURE__ */ jsx47("div", {}),
15301
- className: clsx32("dataviews-view-list", className2),
15273
+ className: clsx32("dataviews-view-list", className2, {
15274
+ [`has-${view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(
15275
+ view.layout.density
15276
+ )
15277
+ }),
15302
15278
  role: view.infiniteScrollEnabled ? "feed" : "grid",
15303
15279
  activeId: activeCompositeId,
15304
15280
  setActiveId: setActiveCompositeId,
@@ -16741,7 +16717,7 @@ function PreviewSizePicker() {
16741
16717
  );
16742
16718
  }
16743
16719
 
16744
- // src/components/dataviews-layouts/table/density-picker.tsx
16720
+ // src/components/dataviews-layouts/utils/density-picker.tsx
16745
16721
  import { __ as __30, _x as _x2 } from "@wordpress/i18n";
16746
16722
  import { jsx as jsx57, jsxs as jsxs17 } from "react/jsx-runtime";
16747
16723
  function DensityPicker() {
@@ -16816,7 +16792,8 @@ var VIEW_LAYOUTS = [
16816
16792
  type: LAYOUT_LIST,
16817
16793
  label: __31("List"),
16818
16794
  component: ViewList,
16819
- icon: isRTL10() ? format_list_bullets_rtl_default : format_list_bullets_default
16795
+ icon: isRTL10() ? format_list_bullets_rtl_default : format_list_bullets_default,
16796
+ viewConfigOptions: DensityPicker
16820
16797
  },
16821
16798
  {
16822
16799
  type: LAYOUT_ACTIVITY,
@@ -17198,7 +17175,7 @@ function SearchWidget(props) {
17198
17175
  }
17199
17176
 
17200
17177
  // src/components/dataviews-filters/input-widget.tsx
17201
- import fastDeepEqual2 from "fast-deep-equal/es6";
17178
+ import fastDeepEqual2 from "fast-deep-equal/es6/index.js";
17202
17179
  import { jsx as jsx59 } from "react/jsx-runtime";
17203
17180
  function InputWidget({
17204
17181
  filter,
@@ -22203,7 +22180,7 @@ import { __ as __55 } from "@wordpress/i18n";
22203
22180
 
22204
22181
  // src/hooks/use-form-validity.ts
22205
22182
  import deepMerge from "deepmerge";
22206
- import fastDeepEqual3 from "fast-deep-equal/es6";
22183
+ import fastDeepEqual3 from "fast-deep-equal/es6/index.js";
22207
22184
  import { __ as __54 } from "@wordpress/i18n";
22208
22185
  function isFormValid(formValidity) {
22209
22186
  if (!formValidity) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dataviews",
3
- "version": "11.1.1-next.76cff8c98.0",
3
+ "version": "11.2.1-next.06ee73755.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",
@@ -53,23 +53,23 @@
53
53
  "sideEffects": false,
54
54
  "dependencies": {
55
55
  "@ariakit/react": "^0.4.15",
56
- "@wordpress/base-styles": "^6.12.2-next.76cff8c98.0",
57
- "@wordpress/components": "^31.0.1-next.76cff8c98.0",
58
- "@wordpress/compose": "^7.36.1-next.76cff8c98.0",
59
- "@wordpress/data": "^10.36.1-next.76cff8c98.0",
60
- "@wordpress/date": "^5.36.2-next.76cff8c98.0",
61
- "@wordpress/deprecated": "^4.36.1-next.76cff8c98.0",
62
- "@wordpress/dom": "^4.36.1-next.76cff8c98.0",
63
- "@wordpress/element": "^6.36.1-next.76cff8c98.0",
64
- "@wordpress/i18n": "^6.9.1-next.76cff8c98.0",
65
- "@wordpress/icons": "^11.3.1-next.76cff8c98.0",
66
- "@wordpress/keycodes": "^4.36.1-next.76cff8c98.0",
67
- "@wordpress/primitives": "^4.36.1-next.76cff8c98.0",
68
- "@wordpress/private-apis": "^1.36.1-next.76cff8c98.0",
69
- "@wordpress/theme": "^0.4.1-next.76cff8c98.0",
70
- "@wordpress/ui": "^0.4.1-next.76cff8c98.0",
71
- "@wordpress/url": "^4.36.1-next.76cff8c98.0",
72
- "@wordpress/warning": "^3.36.1-next.76cff8c98.0",
56
+ "@wordpress/base-styles": "^6.13.2-next.06ee73755.0",
57
+ "@wordpress/components": "^32.0.1-next.06ee73755.0",
58
+ "@wordpress/compose": "^7.37.1-next.06ee73755.0",
59
+ "@wordpress/data": "^10.37.1-next.06ee73755.0",
60
+ "@wordpress/date": "^5.37.2-next.06ee73755.0",
61
+ "@wordpress/deprecated": "^4.37.1-next.06ee73755.0",
62
+ "@wordpress/dom": "^4.37.1-next.06ee73755.0",
63
+ "@wordpress/element": "^6.37.1-next.06ee73755.0",
64
+ "@wordpress/i18n": "^6.10.1-next.06ee73755.0",
65
+ "@wordpress/icons": "^11.4.1-next.06ee73755.0",
66
+ "@wordpress/keycodes": "^4.38.1-next.06ee73755.0",
67
+ "@wordpress/primitives": "^4.37.1-next.06ee73755.0",
68
+ "@wordpress/private-apis": "^1.37.1-next.06ee73755.0",
69
+ "@wordpress/theme": "^0.5.1-next.06ee73755.0",
70
+ "@wordpress/ui": "^0.5.1-next.06ee73755.0",
71
+ "@wordpress/url": "^4.37.1-next.06ee73755.0",
72
+ "@wordpress/warning": "^3.37.1-next.06ee73755.0",
73
73
  "clsx": "^2.1.1",
74
74
  "colord": "^2.7.0",
75
75
  "date-fns": "^4.1.0",
@@ -78,7 +78,10 @@
78
78
  "remove-accents": "^0.5.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@ariakit/test": "^0.4.7"
81
+ "@testing-library/jest-dom": "^6.6.3",
82
+ "@types/jest": "^29.5.14",
83
+ "esbuild": "^0.27.2",
84
+ "storybook": "^9.1.17"
82
85
  },
83
86
  "peerDependencies": {
84
87
  "react": "^18.0.0",
@@ -90,5 +93,5 @@
90
93
  "scripts": {
91
94
  "build:wp": "node build.cjs"
92
95
  },
93
- "gitHead": "368727f14b858e75179e140967c2d9ec965c8790"
96
+ "gitHead": "fd315436f44683a993d5f053789b5279d95b2872"
94
97
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import fastDeepEqual from 'fast-deep-equal/es6';
4
+ import fastDeepEqual from 'fast-deep-equal/es6/index.js';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -28,7 +28,7 @@ import {
28
28
  LAYOUT_PICKER_TABLE,
29
29
  } from '../../constants';
30
30
  import PreviewSizePicker from './utils/preview-size-picker';
31
- import DensityPicker from './table/density-picker';
31
+ import DensityPicker from './utils/density-picker';
32
32
 
33
33
  export const VIEW_LAYOUTS = [
34
34
  {
@@ -50,6 +50,7 @@ export const VIEW_LAYOUTS = [
50
50
  label: __( 'List' ),
51
51
  component: ViewList,
52
52
  icon: isRTL() ? formatListBulletsRTL : formatListBullets,
53
+ viewConfigOptions: DensityPicker,
53
54
  },
54
55
  {
55
56
  type: LAYOUT_ACTIVITY,
@@ -609,7 +609,13 @@ export default function ViewList< Item >( props: ViewListProps< Item > ) {
609
609
  <Composite
610
610
  id={ baseId }
611
611
  render={ <div /> }
612
- className={ clsx( 'dataviews-view-list', className ) }
612
+ className={ clsx( 'dataviews-view-list', className, {
613
+ [ `has-${ view.layout?.density }-density` ]:
614
+ view.layout?.density &&
615
+ [ 'compact', 'comfortable' ].includes(
616
+ view.layout.density
617
+ ),
618
+ } ) }
613
619
  role={ view.infiniteScrollEnabled ? 'feed' : 'grid' }
614
620
  activeId={ activeCompositeId }
615
621
  setActiveId={ setActiveCompositeId }
@@ -205,6 +205,71 @@ div.dataviews-view-list {
205
205
  & + .dataviews-pagination {
206
206
  justify-content: space-between;
207
207
  }
208
+
209
+ // Density style overrides.
210
+ &.has-compact-density {
211
+ div[role="row"] {
212
+ .dataviews-view-list__item-wrapper {
213
+ padding: $grid-unit-10 $grid-unit-30;
214
+ }
215
+
216
+ .dataviews-view-list__title-field {
217
+ min-height: $grid-unit-20;
218
+ line-height: $grid-unit-20;
219
+ }
220
+
221
+ .dataviews-view-list__media-wrapper {
222
+ width: $grid-unit-05 * 8;
223
+ height: $grid-unit-05 * 8;
224
+ }
225
+
226
+ .dataviews-view-list__field-wrapper {
227
+ min-height: $grid-unit-05 * 8;
228
+ }
229
+
230
+ .dataviews-view-list__fields {
231
+ gap: $grid-unit-10;
232
+ row-gap: $grid-unit-05;
233
+
234
+ .dataviews-view-list__field-value {
235
+ min-height: $grid-unit-20;
236
+ line-height: $grid-unit-05 * 4;
237
+ }
238
+ }
239
+ }
240
+ }
241
+
242
+ &.has-comfortable-density {
243
+ div[role="row"] {
244
+ .dataviews-view-list__item-wrapper {
245
+ padding: $grid-unit-30 $grid-unit-30;
246
+ }
247
+
248
+ .dataviews-view-list__title-field {
249
+ min-height: $grid-unit-40;
250
+ line-height: $grid-unit-40;
251
+ }
252
+
253
+ .dataviews-view-list__media-wrapper {
254
+ width: $grid-unit-05 * 16;
255
+ height: $grid-unit-05 * 16;
256
+ }
257
+
258
+ .dataviews-view-list__field-wrapper {
259
+ min-height: $grid-unit-05 * 16;
260
+ }
261
+
262
+ .dataviews-view-list__fields {
263
+ gap: $grid-unit-20;
264
+ row-gap: $grid-unit-10;
265
+
266
+ .dataviews-view-list__field-value {
267
+ min-height: $grid-unit-40;
268
+ line-height: $grid-unit-05 * 6;
269
+ }
270
+ }
271
+ }
272
+ }
208
273
  }
209
274
 
210
275
  .dataviews-view-list__group-header {
@@ -12,11 +12,11 @@ import { useContext } from '@wordpress/element';
12
12
  * Internal dependencies
13
13
  */
14
14
  import DataViewsContext from '../../dataviews-context';
15
- import type { ViewTable, Density } from '../../../types';
15
+ import type { ViewTable, ViewList, Density } from '../../../types';
16
16
 
17
17
  export default function DensityPicker() {
18
18
  const context = useContext( DataViewsContext );
19
- const view = context.view as ViewTable;
19
+ const view = context.view as ViewTable | ViewList;
20
20
  return (
21
21
  <ToggleGroupControl
22
22
  size="__unstable-large"