@wordpress/dataviews 16.0.0 → 16.0.1

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 (47) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/build/components/dataviews-layouts/index.cjs +9 -0
  3. package/build/components/dataviews-layouts/index.cjs.map +3 -3
  4. package/build/components/dataviews-layouts/picker-activity/index.cjs +304 -0
  5. package/build/components/dataviews-layouts/picker-activity/index.cjs.map +7 -0
  6. package/build/components/dataviews-view-config/index.cjs +1 -0
  7. package/build/components/dataviews-view-config/index.cjs.map +2 -2
  8. package/build/constants.cjs +3 -0
  9. package/build/constants.cjs.map +2 -2
  10. package/build/types/dataviews.cjs.map +1 -1
  11. package/build-module/components/dataviews-layouts/index.mjs +11 -1
  12. package/build-module/components/dataviews-layouts/index.mjs.map +2 -2
  13. package/build-module/components/dataviews-layouts/picker-activity/index.mjs +273 -0
  14. package/build-module/components/dataviews-layouts/picker-activity/index.mjs.map +7 -0
  15. package/build-module/components/dataviews-view-config/index.mjs +1 -0
  16. package/build-module/components/dataviews-view-config/index.mjs.map +2 -2
  17. package/build-module/constants.mjs +2 -0
  18. package/build-module/constants.mjs.map +2 -2
  19. package/build-style/style-rtl.css +199 -13
  20. package/build-style/style.css +199 -13
  21. package/build-types/components/dataviews-layouts/index.d.ts +8 -0
  22. package/build-types/components/dataviews-layouts/index.d.ts.map +1 -1
  23. package/build-types/components/dataviews-layouts/picker-activity/index.d.ts +3 -0
  24. package/build-types/components/dataviews-layouts/picker-activity/index.d.ts.map +1 -0
  25. package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
  26. package/build-types/constants.d.ts +1 -0
  27. package/build-types/constants.d.ts.map +1 -1
  28. package/build-types/dataform/stories/index.story.d.ts +1 -0
  29. package/build-types/dataform/stories/index.story.d.ts.map +1 -1
  30. package/build-types/dataviews/stories/index.story.d.ts.map +1 -1
  31. package/build-types/dataviews-picker/stories/index.story.d.ts.map +1 -1
  32. package/build-types/types/dataviews.d.ts +16 -2
  33. package/build-types/types/dataviews.d.ts.map +1 -1
  34. package/build-wp/index.js +928 -648
  35. package/package.json +22 -19
  36. package/src/components/dataviews-layouts/index.ts +10 -0
  37. package/src/components/dataviews-layouts/picker-activity/index.tsx +359 -0
  38. package/src/components/dataviews-layouts/picker-activity/style.scss +227 -0
  39. package/src/components/dataviews-view-config/index.tsx +1 -0
  40. package/src/constants.ts +1 -0
  41. package/src/dataform/stories/content.story.tsx +1 -1
  42. package/src/dataform/stories/index.story.tsx +1 -0
  43. package/src/dataviews/stories/index.story.tsx +1 -0
  44. package/src/dataviews-picker/stories/index.story.tsx +6 -0
  45. package/src/dataviews-picker/test/dataviews-picker.tsx +5 -0
  46. package/src/style.scss +1 -0
  47. package/src/types/dataviews.ts +21 -1
@@ -18,7 +18,7 @@ const meta: Meta< typeof DataForm > = {
18
18
  parameters: {
19
19
  controls: { disable: true },
20
20
  },
21
- tags: [ '!dev' /* Hide individual story pages from sidebar */ ],
21
+ tags: [ '!dev' /* Hide individual story pages from sidebar */, 'manifest' ],
22
22
  };
23
23
  export default meta;
24
24
 
@@ -13,6 +13,7 @@ import ValidationComponent from './validation';
13
13
  import VisibilityComponent from './visibility';
14
14
 
15
15
  const meta = {
16
+ tags: [ 'manifest' ],
16
17
  title: 'DataViews/DataForm',
17
18
  component: DataForm,
18
19
  };
@@ -21,6 +21,7 @@ import EmptyComponent from './empty';
21
21
  import './style.css';
22
22
 
23
23
  const meta = {
24
+ tags: [ 'manifest' ],
24
25
  title: 'DataViews/DataViews',
25
26
  component: DataViews,
26
27
  args: {
@@ -20,6 +20,7 @@ import type { ActionButton, View } from '../../types';
20
20
  import { data, fields, type SpaceObject } from './fixtures';
21
21
 
22
22
  const meta = {
23
+ tags: [ 'manifest' ],
23
24
  title: 'DataViews/DataViewsPicker',
24
25
  component: DataViewsPicker,
25
26
  } as Meta< typeof DataViewsPicker >;
@@ -186,6 +187,11 @@ const DataViewsPickerContent = ( {
186
187
  fields={ fields }
187
188
  onChangeView={ setView }
188
189
  config={ { perPageSizes } }
190
+ defaultLayouts={ {
191
+ pickerGrid: true,
192
+ pickerTable: true,
193
+ pickerActivity: true,
194
+ } }
189
195
  itemListLabel="Galactic Bodies"
190
196
  />
191
197
  </>
@@ -543,6 +543,11 @@ describe( 'DataViews Picker', () => {
543
543
  screen.getByRole( 'menuitemradio', { name: 'Table' } )
544
544
  ).toBeInTheDocument();
545
545
 
546
+ // The Activity layout is opt-in and must not appear by default.
547
+ expect(
548
+ screen.queryByRole( 'menuitemradio', { name: 'Activity' } )
549
+ ).not.toBeInTheDocument();
550
+
546
551
  // The grid layout is active by default.
547
552
  expect(
548
553
  screen.getByRole( 'menuitemradio', { name: 'Grid' } )
package/src/style.scss CHANGED
@@ -13,6 +13,7 @@
13
13
  @use "./components/dataviews-layouts/picker-grid/style.scss" as *;
14
14
  @use "./components/dataviews-layouts/picker-table/style.scss" as *;
15
15
  @use "./components/dataviews-layouts/activity/style.scss" as *;
16
+ @use "./components/dataviews-layouts/picker-activity/style.scss" as *;
16
17
  @use "./components/dataviews-picker-footer/style.scss" as *;
17
18
 
18
19
  @use "./components/dataform-controls/style.scss" as *;
@@ -342,12 +342,24 @@ export interface ViewPickerTable extends ViewBase {
342
342
  };
343
343
  }
344
344
 
345
+ export interface ViewPickerActivity extends ViewBase {
346
+ type: 'pickerActivity';
347
+
348
+ layout?: {
349
+ /**
350
+ * The density of the view.
351
+ */
352
+ density?: Density;
353
+ };
354
+ }
355
+
345
356
  export type View =
346
357
  | ViewList
347
358
  | ViewGrid
348
359
  | ViewTable
349
360
  | ViewPickerGrid
350
361
  | ViewPickerTable
362
+ | ViewPickerActivity
351
363
  | ViewActivity;
352
364
 
353
365
  interface ActionBase< Item > {
@@ -516,6 +528,11 @@ export interface ViewPickerTableProps< Item >
516
528
  view: ViewPickerTable;
517
529
  }
518
530
 
531
+ export interface ViewPickerActivityProps< Item >
532
+ extends Omit< ViewPickerBaseProps< Item >, 'view' > {
533
+ view: ViewPickerActivity;
534
+ }
535
+
519
536
  export type ViewProps< Item > =
520
537
  | ViewTableProps< Item >
521
538
  | ViewGridProps< Item >
@@ -524,7 +541,8 @@ export type ViewProps< Item > =
524
541
 
525
542
  export type ViewPickerProps< Item > =
526
543
  | ViewPickerGridProps< Item >
527
- | ViewPickerTableProps< Item >;
544
+ | ViewPickerTableProps< Item >
545
+ | ViewPickerActivityProps< Item >;
528
546
 
529
547
  export interface SupportedLayouts {
530
548
  list?: Omit< ViewList, 'type' > | true;
@@ -533,6 +551,7 @@ export interface SupportedLayouts {
533
551
  activity?: Omit< ViewActivity, 'type' > | true;
534
552
  pickerGrid?: Omit< ViewPickerGrid, 'type' > | true;
535
553
  pickerTable?: Omit< ViewPickerTable, 'type' > | true;
554
+ pickerActivity?: Omit< ViewPickerActivity, 'type' > | true;
536
555
  }
537
556
 
538
557
  export interface NormalizedSupportedLayouts {
@@ -542,4 +561,5 @@ export interface NormalizedSupportedLayouts {
542
561
  activity?: Omit< ViewActivity, 'type' >;
543
562
  pickerGrid?: Omit< ViewPickerGrid, 'type' >;
544
563
  pickerTable?: Omit< ViewPickerTable, 'type' >;
564
+ pickerActivity?: Omit< ViewPickerActivity, 'type' >;
545
565
  }