@wordpress/dataviews 1.0.0 → 1.2.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 (153) hide show
  1. package/CHANGELOG.md +13 -5
  2. package/build/bulk-actions-toolbar.js +182 -0
  3. package/build/bulk-actions-toolbar.js.map +1 -0
  4. package/build/bulk-actions.js +8 -8
  5. package/build/bulk-actions.js.map +1 -1
  6. package/build/constants.js +1 -26
  7. package/build/constants.js.map +1 -1
  8. package/build/dataviews.js +13 -5
  9. package/build/dataviews.js.map +1 -1
  10. package/build/filter-and-sort-data-view.js +72 -65
  11. package/build/filter-and-sort-data-view.js.map +1 -1
  12. package/build/filter-summary.js +3 -3
  13. package/build/filter-summary.js.map +1 -1
  14. package/build/index.js +2 -2
  15. package/build/index.js.map +1 -1
  16. package/build/item-actions.js +41 -22
  17. package/build/item-actions.js.map +1 -1
  18. package/build/layouts.js +38 -0
  19. package/build/layouts.js.map +1 -0
  20. package/build/lock-unlock.js.map +1 -1
  21. package/build/normalize-fields.js +7 -2
  22. package/build/normalize-fields.js.map +1 -1
  23. package/build/pagination.js +13 -7
  24. package/build/pagination.js.map +1 -1
  25. package/build/single-selection-checkbox.js +4 -0
  26. package/build/single-selection-checkbox.js.map +1 -1
  27. package/build/types.js +6 -0
  28. package/build/types.js.map +1 -0
  29. package/build/view-actions.js +2 -1
  30. package/build/view-actions.js.map +1 -1
  31. package/build/view-grid.js +9 -10
  32. package/build/view-grid.js.map +1 -1
  33. package/build/view-list.js +134 -21
  34. package/build/view-list.js.map +1 -1
  35. package/build/view-table.js +9 -9
  36. package/build/view-table.js.map +1 -1
  37. package/build-module/bulk-actions-toolbar.js +175 -0
  38. package/build-module/bulk-actions-toolbar.js.map +1 -0
  39. package/build-module/bulk-actions.js +8 -8
  40. package/build-module/bulk-actions.js.map +1 -1
  41. package/build-module/constants.js +1 -25
  42. package/build-module/constants.js.map +1 -1
  43. package/build-module/dataviews.js +13 -5
  44. package/build-module/dataviews.js.map +1 -1
  45. package/build-module/filter-and-sort-data-view.js +72 -65
  46. package/build-module/filter-and-sort-data-view.js.map +1 -1
  47. package/build-module/filter-summary.js +3 -3
  48. package/build-module/filter-summary.js.map +1 -1
  49. package/build-module/index.js +1 -1
  50. package/build-module/index.js.map +1 -1
  51. package/build-module/item-actions.js +40 -24
  52. package/build-module/item-actions.js.map +1 -1
  53. package/build-module/layouts.js +30 -0
  54. package/build-module/layouts.js.map +1 -0
  55. package/build-module/lock-unlock.js.map +1 -1
  56. package/build-module/normalize-fields.js +7 -2
  57. package/build-module/normalize-fields.js.map +1 -1
  58. package/build-module/pagination.js +14 -7
  59. package/build-module/pagination.js.map +1 -1
  60. package/build-module/single-selection-checkbox.js +5 -0
  61. package/build-module/single-selection-checkbox.js.map +1 -1
  62. package/build-module/types.js +2 -0
  63. package/build-module/types.js.map +1 -0
  64. package/build-module/view-actions.js +2 -1
  65. package/build-module/view-actions.js.map +1 -1
  66. package/build-module/view-grid.js +9 -10
  67. package/build-module/view-grid.js.map +1 -1
  68. package/build-module/view-list.js +135 -23
  69. package/build-module/view-list.js.map +1 -1
  70. package/build-module/view-table.js +9 -9
  71. package/build-module/view-table.js.map +1 -1
  72. package/build-style/style-rtl.css +82 -44
  73. package/build-style/style.css +82 -44
  74. package/build-types/add-filter.d.ts +8 -0
  75. package/build-types/add-filter.d.ts.map +1 -0
  76. package/build-types/bulk-actions-toolbar.d.ts +8 -0
  77. package/build-types/bulk-actions-toolbar.d.ts.map +1 -0
  78. package/build-types/bulk-actions.d.ts +14 -0
  79. package/build-types/bulk-actions.d.ts.map +1 -0
  80. package/build-types/constants.d.ts +45 -0
  81. package/build-types/constants.d.ts.map +1 -0
  82. package/build-types/dataviews.d.ts +15 -0
  83. package/build-types/dataviews.d.ts.map +1 -0
  84. package/build-types/dropdown-menu-helper.d.ts +6 -0
  85. package/build-types/dropdown-menu-helper.d.ts.map +1 -0
  86. package/build-types/filter-and-sort-data-view.d.ts +18 -0
  87. package/build-types/filter-and-sort-data-view.d.ts.map +1 -0
  88. package/build-types/filter-summary.d.ts +6 -0
  89. package/build-types/filter-summary.d.ts.map +1 -0
  90. package/build-types/filters.d.ts +3 -0
  91. package/build-types/filters.d.ts.map +1 -0
  92. package/build-types/index.d.ts +4 -0
  93. package/build-types/index.d.ts.map +1 -0
  94. package/build-types/item-actions.d.ts +37 -0
  95. package/build-types/item-actions.d.ts.map +1 -0
  96. package/build-types/layouts.d.ts +20 -0
  97. package/build-types/layouts.d.ts.map +1 -0
  98. package/build-types/lock-unlock.d.ts +2 -0
  99. package/build-types/lock-unlock.d.ts.map +1 -0
  100. package/build-types/normalize-fields.d.ts +12 -0
  101. package/build-types/normalize-fields.d.ts.map +1 -0
  102. package/build-types/pagination.d.ts +16 -0
  103. package/build-types/pagination.d.ts.map +1 -0
  104. package/build-types/reset-filters.d.ts +6 -0
  105. package/build-types/reset-filters.d.ts.map +1 -0
  106. package/build-types/search-widget.d.ts +2 -0
  107. package/build-types/search-widget.d.ts.map +1 -0
  108. package/build-types/search.d.ts +3 -0
  109. package/build-types/search.d.ts.map +1 -0
  110. package/build-types/single-selection-checkbox.d.ts +17 -0
  111. package/build-types/single-selection-checkbox.d.ts.map +1 -0
  112. package/build-types/stories/fixtures.d.ts +114 -0
  113. package/build-types/stories/fixtures.d.ts.map +1 -0
  114. package/build-types/stories/index.story.d.ts +15 -0
  115. package/build-types/stories/index.story.d.ts.map +1 -0
  116. package/build-types/types.d.ts +254 -0
  117. package/build-types/types.d.ts.map +1 -0
  118. package/build-types/utils.d.ts +2 -0
  119. package/build-types/utils.d.ts.map +1 -0
  120. package/build-types/view-actions.d.ts +3 -0
  121. package/build-types/view-actions.d.ts.map +1 -0
  122. package/build-types/view-grid.d.ts +15 -0
  123. package/build-types/view-grid.d.ts.map +1 -0
  124. package/build-types/view-list.d.ts +16 -0
  125. package/build-types/view-list.d.ts.map +1 -0
  126. package/build-types/view-table.d.ts +14 -0
  127. package/build-types/view-table.d.ts.map +1 -0
  128. package/package.json +12 -12
  129. package/src/bulk-actions-toolbar.js +244 -0
  130. package/src/{bulk-actions.js → bulk-actions.tsx} +73 -17
  131. package/src/{constants.js → constants.ts} +1 -35
  132. package/src/dataviews.js +16 -4
  133. package/src/filter-and-sort-data-view.ts +169 -0
  134. package/src/filter-summary.js +3 -3
  135. package/src/index.js +1 -1
  136. package/src/{item-actions.js → item-actions.tsx} +112 -28
  137. package/src/layouts.js +39 -0
  138. package/src/normalize-fields.ts +25 -0
  139. package/src/{pagination.js → pagination.tsx} +28 -7
  140. package/src/{single-selection-checkbox.js → single-selection-checkbox.tsx} +17 -2
  141. package/src/stories/fixtures.js +0 -2
  142. package/src/style.scss +100 -44
  143. package/src/types.ts +314 -0
  144. package/src/view-actions.js +2 -1
  145. package/src/{view-grid.js → view-grid.tsx} +45 -16
  146. package/src/view-list.tsx +421 -0
  147. package/src/view-table.js +8 -8
  148. package/tsconfig.json +22 -0
  149. package/tsconfig.tsbuildinfo +1 -0
  150. package/src/filter-and-sort-data-view.js +0 -154
  151. package/src/normalize-fields.js +0 -17
  152. package/src/view-list.js +0 -207
  153. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -0,0 +1,114 @@
1
+ export const data: {
2
+ id: number;
3
+ title: string;
4
+ description: string;
5
+ image: string;
6
+ type: string;
7
+ categories: string[];
8
+ }[];
9
+ export namespace DEFAULT_VIEW {
10
+ export { LAYOUT_TABLE as type };
11
+ export let search: string;
12
+ export let page: number;
13
+ export let perPage: number;
14
+ export let hiddenFields: string[];
15
+ export let layout: {};
16
+ export let filters: never[];
17
+ }
18
+ export const actions: ({
19
+ id: string;
20
+ label: string;
21
+ isPrimary: boolean;
22
+ icon: import("react").JSX.Element;
23
+ hideModalHeader: boolean;
24
+ RenderModal: ({ item, closeModal }: {
25
+ item: any;
26
+ closeModal: any;
27
+ }) => import("react").JSX.Element;
28
+ callback?: undefined;
29
+ } | {
30
+ id: string;
31
+ label: string;
32
+ callback(): void;
33
+ isPrimary?: undefined;
34
+ icon?: undefined;
35
+ hideModalHeader?: undefined;
36
+ RenderModal?: undefined;
37
+ })[];
38
+ export const fields: ({
39
+ header: string;
40
+ id: string;
41
+ render: ({ item }: {
42
+ item: any;
43
+ }) => import("react").JSX.Element;
44
+ width: number;
45
+ enableSorting: boolean;
46
+ maxWidth?: undefined;
47
+ enableHiding?: undefined;
48
+ enableGlobalSearch?: undefined;
49
+ elements?: undefined;
50
+ filterBy?: undefined;
51
+ getValue?: undefined;
52
+ } | {
53
+ header: string;
54
+ id: string;
55
+ maxWidth: number;
56
+ enableHiding: boolean;
57
+ enableGlobalSearch: boolean;
58
+ render?: undefined;
59
+ width?: undefined;
60
+ enableSorting?: undefined;
61
+ elements?: undefined;
62
+ filterBy?: undefined;
63
+ getValue?: undefined;
64
+ } | {
65
+ header: string;
66
+ id: string;
67
+ maxWidth: number;
68
+ enableHiding: boolean;
69
+ elements: {
70
+ value: string;
71
+ label: string;
72
+ }[];
73
+ render?: undefined;
74
+ width?: undefined;
75
+ enableSorting?: undefined;
76
+ enableGlobalSearch?: undefined;
77
+ filterBy?: undefined;
78
+ getValue?: undefined;
79
+ } | {
80
+ header: string;
81
+ id: string;
82
+ maxWidth: number;
83
+ enableSorting: boolean;
84
+ enableGlobalSearch: boolean;
85
+ render?: undefined;
86
+ width?: undefined;
87
+ enableHiding?: undefined;
88
+ elements?: undefined;
89
+ filterBy?: undefined;
90
+ getValue?: undefined;
91
+ } | {
92
+ header: string;
93
+ id: string;
94
+ elements: {
95
+ value: string;
96
+ label: string;
97
+ }[];
98
+ filterBy: {
99
+ operators: string[];
100
+ };
101
+ getValue: ({ item }: {
102
+ item: any;
103
+ }) => any;
104
+ render: ({ item }: {
105
+ item: any;
106
+ }) => any;
107
+ enableSorting: boolean;
108
+ width?: undefined;
109
+ maxWidth?: undefined;
110
+ enableHiding?: undefined;
111
+ enableGlobalSearch?: undefined;
112
+ })[];
113
+ import { LAYOUT_TABLE } from '../constants';
114
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/stories/fixtures.js"],"names":[],"mappings":"AAgBA;;;;;;;IAyFE;;;;;;;;;;AAYF;;;;;;;;;;;;;;;;;;;KA8BE;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2DE;6BAlM2B,cAAc"}
@@ -0,0 +1,15 @@
1
+ export default meta;
2
+ export function Default(props: any): import("react").JSX.Element;
3
+ export namespace Default {
4
+ namespace args {
5
+ export { actions };
6
+ export let supportedLayouts: string[];
7
+ }
8
+ }
9
+ declare namespace meta {
10
+ export let title: string;
11
+ export { DataViews as component };
12
+ }
13
+ import { actions } from './fixtures';
14
+ import { DataViews } from '../index';
15
+ //# sourceMappingURL=index.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../src/stories/index.story.js"],"names":[],"mappings":";AA6BO,iEA8BN;;;;;;;;;;;wBAlDmD,YAAY;0BADtC,UAAU"}
@@ -0,0 +1,254 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ReactElement, ReactNode } from 'react';
5
+ export type SortDirection = 'asc' | 'desc';
6
+ /**
7
+ * Generic option type.
8
+ */
9
+ interface Option<Value extends any = any> {
10
+ value: Value;
11
+ label: string;
12
+ }
13
+ interface FilterByConfig {
14
+ /**
15
+ * The list of operators supported by the field.
16
+ */
17
+ operators?: Operator[];
18
+ /**
19
+ * Whether it is a primary filter.
20
+ *
21
+ * A primary filter is always visible and is not listed in the "Add filter" component,
22
+ * except for the list layout where it behaves like a secondary filter.
23
+ */
24
+ isPrimary?: boolean;
25
+ }
26
+ type Operator = 'is' | 'isNot' | 'isAny' | 'isNone' | 'isAll' | 'isNotAll';
27
+ export type AnyItem = Record<string, any>;
28
+ /**
29
+ * A dataview field for a specific property of a data type.
30
+ */
31
+ export interface Field<Item extends AnyItem> {
32
+ /**
33
+ * The unique identifier of the field.
34
+ */
35
+ id: string;
36
+ /**
37
+ * The label of the field. Defaults to the id.
38
+ */
39
+ header?: string;
40
+ /**
41
+ * Callback used to retrieve the value of the field from the item.
42
+ * Defaults to `item[ field.id ]`.
43
+ */
44
+ getValue?: (args: {
45
+ item: Item;
46
+ }) => any;
47
+ /**
48
+ * Callback used to render the field. Defaults to `field.getValue`.
49
+ */
50
+ render?: (args: {
51
+ item: Item;
52
+ }) => ReactNode;
53
+ /**
54
+ * The width of the field column.
55
+ */
56
+ width?: string | number;
57
+ /**
58
+ * The minimum width of the field column.
59
+ */
60
+ maxWidth?: string | number;
61
+ /**
62
+ * The maximum width of the field column.
63
+ */
64
+ minWidth?: string | number;
65
+ /**
66
+ * Whether the field is sortable.
67
+ */
68
+ enableSorting?: boolean;
69
+ /**
70
+ * Whether the field is searchable.
71
+ */
72
+ enableGlobalSearch?: boolean;
73
+ /**
74
+ * Whether the field is filterable.
75
+ */
76
+ enableHiding?: boolean;
77
+ /**
78
+ * The list of options to pick from when using the field as a filter.
79
+ */
80
+ elements?: Option[];
81
+ /**
82
+ * Filter config for the field.
83
+ */
84
+ filterBy?: FilterByConfig | undefined;
85
+ }
86
+ export type NormalizedField<Item extends AnyItem> = Field<Item> & Required<Pick<Field<Item>, 'header' | 'getValue' | 'render'>>;
87
+ /**
88
+ * A collection of dataview fields for a data type.
89
+ */
90
+ export type Fields<Item extends AnyItem> = Field<Item>[];
91
+ export type Data<Item extends AnyItem> = Item[];
92
+ /**
93
+ * The filters applied to the dataset.
94
+ */
95
+ export interface Filter {
96
+ /**
97
+ * The field to filter by.
98
+ */
99
+ field: string;
100
+ /**
101
+ * The operator to use.
102
+ */
103
+ operator: Operator;
104
+ /**
105
+ * The value to filter by.
106
+ */
107
+ value: any;
108
+ }
109
+ interface ViewBase {
110
+ /**
111
+ * The layout of the view.
112
+ */
113
+ type: string;
114
+ /**
115
+ * The global search term.
116
+ */
117
+ search?: string;
118
+ /**
119
+ * The filters to apply.
120
+ */
121
+ filters: Filter[];
122
+ /**
123
+ * The sorting configuration.
124
+ */
125
+ sort?: {
126
+ /**
127
+ * The field to sort by.
128
+ */
129
+ field: string;
130
+ /**
131
+ * The direction to sort by.
132
+ */
133
+ direction: SortDirection;
134
+ };
135
+ /**
136
+ * The active page
137
+ */
138
+ page?: number;
139
+ /**
140
+ * The number of items per page
141
+ */
142
+ perPage?: number;
143
+ /**
144
+ * The hidden fields.
145
+ */
146
+ hiddenFields: string[];
147
+ }
148
+ export interface ViewList extends ViewBase {
149
+ type: 'list';
150
+ layout: {
151
+ /**
152
+ * The field to use as the primary field.
153
+ */
154
+ primaryField: string;
155
+ /**
156
+ * The field to use as the media field.
157
+ */
158
+ mediaField: string;
159
+ };
160
+ }
161
+ export interface ViewGrid extends ViewBase {
162
+ type: 'grid';
163
+ layout: {
164
+ /**
165
+ * The field to use as the primary field.
166
+ */
167
+ primaryField: string;
168
+ /**
169
+ * The field to use as the media field.
170
+ */
171
+ mediaField: string;
172
+ /**
173
+ * The fields to use as columns.
174
+ */
175
+ columnFields: string[];
176
+ /**
177
+ * The fields to use as badge fields.
178
+ */
179
+ badgeFields: string[];
180
+ };
181
+ }
182
+ export type View = ViewList | ViewGrid | ViewBase;
183
+ interface ActionBase<Item extends AnyItem> {
184
+ /**
185
+ * The unique identifier of the action.
186
+ */
187
+ id: string;
188
+ /**
189
+ * The label of the action.
190
+ */
191
+ label: string;
192
+ /**
193
+ * The icon of the action. (Either a string or an SVG element)
194
+ * This should be IconType from the components package
195
+ * but that import is breaking typescript build for the moment.
196
+ */
197
+ icon?: any;
198
+ /**
199
+ * Whether the action is disabled.
200
+ */
201
+ disabled?: boolean;
202
+ /**
203
+ * Whether the action is destructive.
204
+ */
205
+ isDestructive?: boolean;
206
+ /**
207
+ * Whether the action is a primary action.
208
+ */
209
+ isPrimary?: boolean;
210
+ /**
211
+ * Whether the item passed as an argument supports the current action.
212
+ */
213
+ isEligible?: (item: Item) => boolean;
214
+ /**
215
+ * Whether the action can be used as a bulk action.
216
+ */
217
+ supportsBulk?: boolean;
218
+ }
219
+ export interface ActionModal<Item extends AnyItem> extends ActionBase<Item> {
220
+ /**
221
+ * The callback to execute when the action has finished.
222
+ */
223
+ onActionPerformed: ((items: Item[]) => void) | undefined;
224
+ /**
225
+ * The callback to execute when the action is triggered.
226
+ */
227
+ onActionStart: ((items: Item[]) => void) | undefined;
228
+ /**
229
+ * Modal to render when the action is triggered.
230
+ */
231
+ RenderModal: ({ items, closeModal, onActionStart, onActionPerformed, }: {
232
+ items: Item[];
233
+ closeModal?: () => void;
234
+ onActionStart?: (items: Item[]) => void;
235
+ onActionPerformed?: (items: Item[]) => void;
236
+ }) => ReactElement;
237
+ /**
238
+ * Whether to hide the modal header.
239
+ */
240
+ hideModalHeader?: boolean;
241
+ /**
242
+ * The header of the modal.
243
+ */
244
+ modalHeader?: string;
245
+ }
246
+ export interface ActionButton<Item extends AnyItem> extends ActionBase<AnyItem> {
247
+ /**
248
+ * The callback to execute when the action is triggered.
249
+ */
250
+ callback: (items: Item[]) => void;
251
+ }
252
+ export type Action<Item extends AnyItem> = ActionModal<Item> | ActionButton<Item>;
253
+ export {};
254
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C;;GAEG;AACH,UAAU,MAAM,CAAE,KAAK,SAAS,GAAG,GAAG,GAAG;IACxC,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACd;AAED,UAAU,cAAc;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEvB;;;;;OAKG;IACH,SAAS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AE1B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY,CAAE,IAAI,SAAS,OAAO,CAClD,SAAQ,UAAU,CAAE,OAAO,CAAE;IAC7B;;OAEG;IACH,QAAQ,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE,KAAM,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,MAAM,CAAE,IAAI,SAAS,OAAO,IACrC,WAAW,CAAE,IAAI,CAAE,GACnB,YAAY,CAAE,IAAI,CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export function sanitizeOperators(field: any): any;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAWO,mDAoCN"}
@@ -0,0 +1,3 @@
1
+ export default ViewActions;
2
+ declare const ViewActions: import("react").NamedExoticComponent<object>;
3
+ //# sourceMappingURL=view-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-actions.d.ts","sourceRoot":"","sources":["../src/view-actions.js"],"names":[],"mappings":";AA4PA,wEAoCI"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import type { Action, AnyItem, NormalizedField, ViewGrid as ViewGridType } from './types';
3
+ interface ViewGridProps<Item extends AnyItem> {
4
+ actions: Action<Item>[];
5
+ data: Item[];
6
+ fields: NormalizedField<Item>[];
7
+ getItemId: (item: Item) => string;
8
+ isLoading: boolean;
9
+ onSelectionChange: (items: Item[]) => void;
10
+ selection: string[];
11
+ view: ViewGridType;
12
+ }
13
+ export default function ViewGrid<Item extends AnyItem>({ actions, data, fields, getItemId, isLoading, onSelectionChange, selection, view, }: ViewGridProps<Item>): import("react").JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=view-grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-grid.d.ts","sourceRoot":"","sources":["../src/view-grid.tsx"],"names":[],"mappings":";AAwBA,OAAO,KAAK,EACX,MAAM,EACN,OAAO,EACP,eAAe,EACf,QAAQ,IAAI,YAAY,EACxB,MAAM,SAAS,CAAC;AAgBjB,UAAU,aAAa,CAAE,IAAI,SAAS,OAAO;IAC5C,OAAO,EAAE,MAAM,CAAE,IAAI,CAAE,EAAE,CAAC;IAC1B,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,MAAM,EAAE,eAAe,CAAE,IAAI,CAAE,EAAE,CAAC;IAClC,SAAS,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE,KAAM,IAAI,CAAC;IAC7C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,YAAY,CAAC;CACnB;AAuJD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,SAAS,OAAO,EAAI,EACzD,OAAO,EACP,IAAI,EACJ,MAAM,EACN,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,IAAI,GACJ,EAAE,aAAa,CAAE,IAAI,CAAE,+BAsEvB"}
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import type { Action, AnyItem, NormalizedField, ViewList as ViewListType } from './types';
3
+ interface ListViewProps<Item extends AnyItem> {
4
+ actions: Action<Item>[];
5
+ data: Item[];
6
+ fields: NormalizedField<Item>[];
7
+ getItemId: (item: Item) => string;
8
+ id: string;
9
+ isLoading: boolean;
10
+ onSelectionChange: (selection: Item[]) => void;
11
+ selection: string[];
12
+ view: ViewListType;
13
+ }
14
+ export default function ViewList<Item extends AnyItem>(props: ListViewProps<Item>): import("react").JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=view-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-list.d.ts","sourceRoot":"","sources":["../src/view-list.tsx"],"names":[],"mappings":";AAkCA,OAAO,KAAK,EACX,MAAM,EACN,OAAO,EACP,eAAe,EACf,QAAQ,IAAI,YAAY,EACxB,MAAM,SAAS,CAAC;AAIjB,UAAU,aAAa,CAAE,IAAI,SAAS,OAAO;IAC5C,OAAO,EAAE,MAAM,CAAE,IAAI,CAAE,EAAE,CAAC;IAC1B,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,MAAM,EAAE,eAAe,CAAE,IAAI,CAAE,EAAE,CAAC;IAClC,SAAS,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,MAAM,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,CAAE,SAAS,EAAE,IAAI,EAAE,KAAM,IAAI,CAAC;IACjD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,YAAY,CAAC;CACnB;AAmQD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAE,IAAI,SAAS,OAAO,EACrD,KAAK,EAAE,aAAa,CAAE,IAAI,CAAE,+BA2G5B"}
@@ -0,0 +1,14 @@
1
+ export default ViewTable;
2
+ declare function ViewTable({ actions, data, fields, getItemId, isLoading, onChangeView, onSelectionChange, selection, setOpenedFilter, view, }: {
3
+ actions: any;
4
+ data: any;
5
+ fields: any;
6
+ getItemId: any;
7
+ isLoading?: boolean | undefined;
8
+ onChangeView: any;
9
+ onSelectionChange: any;
10
+ selection: any;
11
+ setOpenedFilter: any;
12
+ view: any;
13
+ }): import("react").JSX.Element | undefined;
14
+ //# sourceMappingURL=view-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-table.d.ts","sourceRoot":"","sources":["../src/view-table.js"],"names":[],"mappings":";AA2WA;;;;;;;;;;;4CAuKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/dataviews",
3
- "version": "1.0.0",
3
+ "version": "1.2.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",
@@ -29,16 +29,16 @@
29
29
  "dependencies": {
30
30
  "@ariakit/react": "^0.3.12",
31
31
  "@babel/runtime": "^7.16.0",
32
- "@wordpress/a11y": "^3.56.0",
33
- "@wordpress/components": "^27.4.0",
34
- "@wordpress/compose": "^6.33.0",
35
- "@wordpress/element": "^5.33.0",
36
- "@wordpress/i18n": "^4.56.0",
37
- "@wordpress/icons": "^9.47.0",
38
- "@wordpress/keycodes": "^3.56.0",
39
- "@wordpress/primitives": "^3.54.0",
40
- "@wordpress/private-apis": "^0.38.0",
41
- "classnames": "^2.3.1",
32
+ "@wordpress/a11y": "^3.58.0",
33
+ "@wordpress/components": "^27.6.0",
34
+ "@wordpress/compose": "^6.35.0",
35
+ "@wordpress/element": "^5.35.0",
36
+ "@wordpress/i18n": "^4.58.0",
37
+ "@wordpress/icons": "^9.49.0",
38
+ "@wordpress/keycodes": "^3.58.0",
39
+ "@wordpress/primitives": "^3.56.0",
40
+ "@wordpress/private-apis": "^0.40.0",
41
+ "clsx": "^2.1.1",
42
42
  "remove-accents": "^0.5.0"
43
43
  },
44
44
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "280403b4c1cf6cc2c55a6c4d56f9ef91145e4191"
50
+ "gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
51
51
  }