@wordpress/dataviews 2.2.0 → 4.0.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 (298) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +23 -8
  3. package/build/components/dataform/index.js +78 -0
  4. package/build/components/dataform/index.js.map +1 -0
  5. package/build/components/dataviews/index.js +115 -0
  6. package/build/components/dataviews/index.js.map +1 -0
  7. package/build/{bulk-actions.js → components/dataviews-bulk-actions/index.js} +39 -16
  8. package/build/components/dataviews-bulk-actions/index.js.map +1 -0
  9. package/build/{bulk-actions-toolbar.js → components/dataviews-bulk-actions-toolbar/index.js} +36 -20
  10. package/build/components/dataviews-bulk-actions-toolbar/index.js.map +1 -0
  11. package/build/components/dataviews-context/index.js +36 -0
  12. package/build/components/dataviews-context/index.js.map +1 -0
  13. package/build/{add-filter.js → components/dataviews-filters/add-filter.js} +3 -3
  14. package/build/components/dataviews-filters/add-filter.js.map +1 -0
  15. package/build/{filter-summary.js → components/dataviews-filters/filter-summary.js} +15 -14
  16. package/build/components/dataviews-filters/filter-summary.js.map +1 -0
  17. package/build/{filters.js → components/dataviews-filters/index.js} +15 -16
  18. package/build/components/dataviews-filters/index.js.map +1 -0
  19. package/build/{reset-filters.js → components/dataviews-filters/reset-filters.js} +1 -1
  20. package/build/components/dataviews-filters/reset-filters.js.map +1 -0
  21. package/build/{search-widget.js → components/dataviews-filters/search-widget.js} +21 -19
  22. package/build/components/dataviews-filters/search-widget.js.map +1 -0
  23. package/build/{item-actions.js → components/dataviews-item-actions/index.js} +3 -3
  24. package/build/components/dataviews-item-actions/index.js.map +1 -0
  25. package/build/components/dataviews-layout/index.js +53 -0
  26. package/build/components/dataviews-layout/index.js.map +1 -0
  27. package/build/{pagination.js → components/dataviews-pagination/index.js} +18 -15
  28. package/build/components/dataviews-pagination/index.js.map +1 -0
  29. package/build/{search.js → components/dataviews-search/index.js} +10 -6
  30. package/build/components/dataviews-search/index.js.map +1 -0
  31. package/build/components/dataviews-selection-checkbox/index.js +52 -0
  32. package/build/components/dataviews-selection-checkbox/index.js.map +1 -0
  33. package/build/{view-actions.js → components/dataviews-view-config/index.js} +94 -80
  34. package/build/components/dataviews-view-config/index.js.map +1 -0
  35. package/build/filter-and-sort-data-view.js +4 -1
  36. package/build/filter-and-sort-data-view.js.map +1 -1
  37. package/build/index.js +8 -1
  38. package/build/index.js.map +1 -1
  39. package/build/layouts/grid/density-picker.js +143 -0
  40. package/build/layouts/grid/density-picker.js.map +1 -0
  41. package/build/{view-grid.js → layouts/grid/index.js} +40 -53
  42. package/build/layouts/grid/index.js.map +1 -0
  43. package/build/layouts/index.js +52 -0
  44. package/build/layouts/index.js.map +1 -0
  45. package/build/{view-list.js → layouts/list/index.js} +31 -27
  46. package/build/layouts/list/index.js.map +1 -0
  47. package/build/layouts/table/column-header-menu.js +196 -0
  48. package/build/layouts/table/column-header-menu.js.map +1 -0
  49. package/build/layouts/table/index.js +350 -0
  50. package/build/layouts/table/index.js.map +1 -0
  51. package/build/normalize-fields.js +1 -1
  52. package/build/normalize-fields.js.map +1 -1
  53. package/build/private-types.js +6 -0
  54. package/build/private-types.js.map +1 -0
  55. package/build/types.js.map +1 -1
  56. package/build/utils.js.map +1 -1
  57. package/build-module/components/dataform/index.js +72 -0
  58. package/build-module/components/dataform/index.js.map +1 -0
  59. package/build-module/components/dataviews/index.js +108 -0
  60. package/build-module/components/dataviews/index.js.map +1 -0
  61. package/build-module/{bulk-actions.js → components/dataviews-bulk-actions/index.js} +39 -17
  62. package/build-module/components/dataviews-bulk-actions/index.js.map +1 -0
  63. package/build-module/{bulk-actions-toolbar.js → components/dataviews-bulk-actions-toolbar/index.js} +35 -20
  64. package/build-module/components/dataviews-bulk-actions-toolbar/index.js.map +1 -0
  65. package/build-module/components/dataviews-context/index.js +30 -0
  66. package/build-module/components/dataviews-context/index.js.map +1 -0
  67. package/build-module/{add-filter.js → components/dataviews-filters/add-filter.js} +3 -3
  68. package/build-module/components/dataviews-filters/add-filter.js.map +1 -0
  69. package/build-module/{filter-summary.js → components/dataviews-filters/filter-summary.js} +15 -14
  70. package/build-module/components/dataviews-filters/filter-summary.js.map +1 -0
  71. package/build-module/{filters.js → components/dataviews-filters/index.js} +16 -17
  72. package/build-module/components/dataviews-filters/index.js.map +1 -0
  73. package/build-module/{reset-filters.js → components/dataviews-filters/reset-filters.js} +1 -1
  74. package/build-module/components/dataviews-filters/reset-filters.js.map +1 -0
  75. package/build-module/{search-widget.js → components/dataviews-filters/search-widget.js} +21 -19
  76. package/build-module/components/dataviews-filters/search-widget.js.map +1 -0
  77. package/build-module/{item-actions.js → components/dataviews-item-actions/index.js} +3 -3
  78. package/build-module/components/dataviews-item-actions/index.js.map +1 -0
  79. package/build-module/components/dataviews-layout/index.js +45 -0
  80. package/build-module/components/dataviews-layout/index.js.map +1 -0
  81. package/build-module/{pagination.js → components/dataviews-pagination/index.js} +19 -17
  82. package/build-module/components/dataviews-pagination/index.js.map +1 -0
  83. package/build-module/{search.js → components/dataviews-search/index.js} +10 -7
  84. package/build-module/components/dataviews-search/index.js.map +1 -0
  85. package/build-module/components/dataviews-selection-checkbox/index.js +45 -0
  86. package/build-module/components/dataviews-selection-checkbox/index.js.map +1 -0
  87. package/build-module/{view-actions.js → components/dataviews-view-config/index.js} +98 -84
  88. package/build-module/components/dataviews-view-config/index.js.map +1 -0
  89. package/build-module/filter-and-sort-data-view.js +4 -1
  90. package/build-module/filter-and-sort-data-view.js.map +1 -1
  91. package/build-module/index.js +2 -1
  92. package/build-module/index.js.map +1 -1
  93. package/build-module/layouts/grid/density-picker.js +138 -0
  94. package/build-module/layouts/grid/density-picker.js.map +1 -0
  95. package/build-module/{view-grid.js → layouts/grid/index.js} +37 -50
  96. package/build-module/layouts/grid/index.js.map +1 -0
  97. package/build-module/layouts/index.js +43 -0
  98. package/build-module/layouts/index.js.map +1 -0
  99. package/build-module/{view-list.js → layouts/list/index.js} +29 -25
  100. package/build-module/layouts/list/index.js.map +1 -0
  101. package/build-module/layouts/table/column-header-menu.js +190 -0
  102. package/build-module/layouts/table/column-header-menu.js.map +1 -0
  103. package/build-module/layouts/table/index.js +344 -0
  104. package/build-module/layouts/table/index.js.map +1 -0
  105. package/build-module/normalize-fields.js +1 -1
  106. package/build-module/normalize-fields.js.map +1 -1
  107. package/build-module/private-types.js +2 -0
  108. package/build-module/private-types.js.map +1 -0
  109. package/build-module/types.js.map +1 -1
  110. package/build-module/utils.js.map +1 -1
  111. package/build-style/style-rtl.css +607 -561
  112. package/build-style/style.css +607 -561
  113. package/build-types/components/dataform/index.d.ts +17 -0
  114. package/build-types/components/dataform/index.d.ts.map +1 -0
  115. package/build-types/components/dataform/stories/index.story.d.ts +11 -0
  116. package/build-types/components/dataform/stories/index.story.d.ts.map +1 -0
  117. package/build-types/components/dataviews/index.d.ts +33 -0
  118. package/build-types/components/dataviews/index.d.ts.map +1 -0
  119. package/build-types/{stories → components/dataviews/stories}/fixtures.d.ts +18 -17
  120. package/build-types/components/dataviews/stories/fixtures.d.ts.map +1 -0
  121. package/build-types/components/dataviews/stories/index.story.d.ts +46 -0
  122. package/build-types/components/dataviews/stories/index.story.d.ts.map +1 -0
  123. package/build-types/components/dataviews-bulk-actions/index.d.ts +5 -0
  124. package/build-types/components/dataviews-bulk-actions/index.d.ts.map +1 -0
  125. package/build-types/components/dataviews-bulk-actions-toolbar/index.d.ts +2 -0
  126. package/build-types/components/dataviews-bulk-actions-toolbar/index.d.ts.map +1 -0
  127. package/build-types/components/dataviews-context/index.d.ts +26 -0
  128. package/build-types/components/dataviews-context/index.d.ts.map +1 -0
  129. package/build-types/{add-filter.d.ts → components/dataviews-filters/add-filter.d.ts} +1 -2
  130. package/build-types/components/dataviews-filters/add-filter.d.ts.map +1 -0
  131. package/build-types/{filter-summary.d.ts → components/dataviews-filters/filter-summary.d.ts} +1 -1
  132. package/build-types/components/dataviews-filters/filter-summary.d.ts.map +1 -0
  133. package/build-types/components/dataviews-filters/index.d.ts +4 -0
  134. package/build-types/components/dataviews-filters/index.d.ts.map +1 -0
  135. package/build-types/{reset-filters.d.ts → components/dataviews-filters/reset-filters.d.ts} +1 -2
  136. package/build-types/components/dataviews-filters/reset-filters.d.ts.map +1 -0
  137. package/build-types/{search-widget.d.ts → components/dataviews-filters/search-widget.d.ts} +1 -2
  138. package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -0
  139. package/build-types/components/dataviews-item-actions/index.d.ts +35 -0
  140. package/build-types/components/dataviews-item-actions/index.d.ts.map +1 -0
  141. package/build-types/components/dataviews-layout/index.d.ts +2 -0
  142. package/build-types/components/dataviews-layout/index.d.ts.map +1 -0
  143. package/build-types/components/dataviews-pagination/index.d.ts +4 -0
  144. package/build-types/components/dataviews-pagination/index.d.ts.map +1 -0
  145. package/build-types/components/dataviews-search/index.d.ts +6 -0
  146. package/build-types/components/dataviews-search/index.d.ts.map +1 -0
  147. package/build-types/components/dataviews-selection-checkbox/index.d.ts +16 -0
  148. package/build-types/components/dataviews-selection-checkbox/index.d.ts.map +1 -0
  149. package/build-types/components/dataviews-view-config/index.d.ts +8 -0
  150. package/build-types/components/dataviews-view-config/index.d.ts.map +1 -0
  151. package/build-types/filter-and-sort-data-view.d.ts +2 -2
  152. package/build-types/filter-and-sort-data-view.d.ts.map +1 -1
  153. package/build-types/index.d.ts +2 -1
  154. package/build-types/index.d.ts.map +1 -1
  155. package/build-types/layouts/grid/density-picker.d.ts +5 -0
  156. package/build-types/layouts/grid/density-picker.d.ts.map +1 -0
  157. package/build-types/layouts/grid/index.d.ts +3 -0
  158. package/build-types/layouts/grid/index.d.ts.map +1 -0
  159. package/build-types/{layouts.d.ts → layouts/index.d.ts} +6 -5
  160. package/build-types/layouts/index.d.ts.map +1 -0
  161. package/build-types/layouts/list/index.d.ts +3 -0
  162. package/build-types/layouts/list/index.d.ts.map +1 -0
  163. package/build-types/layouts/table/column-header-menu.d.ts +17 -0
  164. package/build-types/layouts/table/column-header-menu.d.ts.map +1 -0
  165. package/build-types/layouts/table/index.d.ts +4 -0
  166. package/build-types/layouts/table/index.d.ts.map +1 -0
  167. package/build-types/normalize-fields.d.ts +2 -2
  168. package/build-types/normalize-fields.d.ts.map +1 -1
  169. package/build-types/private-types.d.ts +3 -0
  170. package/build-types/private-types.d.ts.map +1 -0
  171. package/build-types/types.d.ts +106 -46
  172. package/build-types/types.d.ts.map +1 -1
  173. package/build-types/utils.d.ts +2 -2
  174. package/build-types/utils.d.ts.map +1 -1
  175. package/package.json +10 -10
  176. package/src/components/dataform/index.tsx +106 -0
  177. package/src/components/dataform/stories/index.story.tsx +42 -0
  178. package/src/components/dataviews/index.tsx +149 -0
  179. package/src/{stories → components/dataviews/stories}/fixtures.js +23 -11
  180. package/src/components/dataviews/stories/index.story.js +65 -0
  181. package/src/components/dataviews/style.scss +97 -0
  182. package/src/{bulk-actions.tsx → components/dataviews-bulk-actions/index.tsx} +58 -36
  183. package/src/components/dataviews-bulk-actions/style.scss +7 -0
  184. package/src/{bulk-actions-toolbar.tsx → components/dataviews-bulk-actions-toolbar/index.tsx} +48 -36
  185. package/src/components/dataviews-bulk-actions-toolbar/style.scss +45 -0
  186. package/src/components/dataviews-context/index.ts +49 -0
  187. package/src/{add-filter.tsx → components/dataviews-filters/add-filter.tsx} +4 -4
  188. package/src/{filter-summary.tsx → components/dataviews-filters/filter-summary.tsx} +36 -22
  189. package/src/{filters.tsx → components/dataviews-filters/index.tsx} +11 -25
  190. package/src/{reset-filters.tsx → components/dataviews-filters/reset-filters.tsx} +2 -2
  191. package/src/{search-widget.tsx → components/dataviews-filters/search-widget.tsx} +20 -20
  192. package/src/components/dataviews-filters/style.scss +252 -0
  193. package/src/{item-actions.tsx → components/dataviews-item-actions/index.tsx} +16 -17
  194. package/src/components/dataviews-item-actions/style.scss +3 -0
  195. package/src/components/dataviews-layout/index.tsx +51 -0
  196. package/src/{pagination.tsx → components/dataviews-pagination/index.tsx} +15 -23
  197. package/src/components/dataviews-pagination/style.scss +26 -0
  198. package/src/{search.tsx → components/dataviews-search/index.tsx} +5 -10
  199. package/src/components/dataviews-selection-checkbox/index.tsx +65 -0
  200. package/src/components/dataviews-selection-checkbox/style.scss +14 -0
  201. package/src/{view-actions.tsx → components/dataviews-view-config/index.tsx} +116 -119
  202. package/src/filter-and-sort-data-view.ts +13 -3
  203. package/src/index.ts +2 -1
  204. package/src/layouts/grid/density-picker.tsx +136 -0
  205. package/src/{view-grid.tsx → layouts/grid/index.tsx} +45 -63
  206. package/src/layouts/grid/style.scss +140 -0
  207. package/src/layouts/index.ts +66 -0
  208. package/src/{view-list.tsx → layouts/list/index.tsx} +40 -30
  209. package/src/layouts/list/style.scss +189 -0
  210. package/src/layouts/table/column-header-menu.tsx +268 -0
  211. package/src/layouts/table/index.tsx +471 -0
  212. package/src/layouts/table/style.scss +201 -0
  213. package/src/normalize-fields.ts +6 -4
  214. package/src/private-types.tsx +2 -0
  215. package/src/style.scss +11 -919
  216. package/src/test/filter-and-sort-data-view.js +17 -2
  217. package/src/types.ts +113 -55
  218. package/src/utils.ts +2 -4
  219. package/tsconfig.tsbuildinfo +1 -1
  220. package/build/add-filter.js.map +0 -1
  221. package/build/bulk-actions-toolbar.js.map +0 -1
  222. package/build/bulk-actions.js.map +0 -1
  223. package/build/dataviews.js +0 -136
  224. package/build/dataviews.js.map +0 -1
  225. package/build/filter-summary.js.map +0 -1
  226. package/build/filters.js.map +0 -1
  227. package/build/item-actions.js.map +0 -1
  228. package/build/layouts.js +0 -38
  229. package/build/layouts.js.map +0 -1
  230. package/build/pagination.js.map +0 -1
  231. package/build/reset-filters.js.map +0 -1
  232. package/build/search-widget.js.map +0 -1
  233. package/build/search.js.map +0 -1
  234. package/build/single-selection-checkbox.js +0 -63
  235. package/build/single-selection-checkbox.js.map +0 -1
  236. package/build/view-actions.js.map +0 -1
  237. package/build/view-grid.js.map +0 -1
  238. package/build/view-list.js.map +0 -1
  239. package/build/view-table.js +0 -409
  240. package/build/view-table.js.map +0 -1
  241. package/build-module/add-filter.js.map +0 -1
  242. package/build-module/bulk-actions-toolbar.js.map +0 -1
  243. package/build-module/bulk-actions.js.map +0 -1
  244. package/build-module/dataviews.js +0 -129
  245. package/build-module/dataviews.js.map +0 -1
  246. package/build-module/filter-summary.js.map +0 -1
  247. package/build-module/filters.js.map +0 -1
  248. package/build-module/item-actions.js.map +0 -1
  249. package/build-module/layouts.js +0 -30
  250. package/build-module/layouts.js.map +0 -1
  251. package/build-module/pagination.js.map +0 -1
  252. package/build-module/reset-filters.js.map +0 -1
  253. package/build-module/search-widget.js.map +0 -1
  254. package/build-module/search.js.map +0 -1
  255. package/build-module/single-selection-checkbox.js +0 -56
  256. package/build-module/single-selection-checkbox.js.map +0 -1
  257. package/build-module/view-actions.js.map +0 -1
  258. package/build-module/view-grid.js.map +0 -1
  259. package/build-module/view-list.js.map +0 -1
  260. package/build-module/view-table.js +0 -402
  261. package/build-module/view-table.js.map +0 -1
  262. package/build-types/add-filter.d.ts.map +0 -1
  263. package/build-types/bulk-actions-toolbar.d.ts +0 -12
  264. package/build-types/bulk-actions-toolbar.d.ts.map +0 -1
  265. package/build-types/bulk-actions.d.ts +0 -14
  266. package/build-types/bulk-actions.d.ts.map +0 -1
  267. package/build-types/dataviews.d.ts +0 -24
  268. package/build-types/dataviews.d.ts.map +0 -1
  269. package/build-types/filter-summary.d.ts.map +0 -1
  270. package/build-types/filters.d.ts +0 -13
  271. package/build-types/filters.d.ts.map +0 -1
  272. package/build-types/item-actions.d.ts +0 -35
  273. package/build-types/item-actions.d.ts.map +0 -1
  274. package/build-types/layouts.d.ts.map +0 -1
  275. package/build-types/pagination.d.ts +0 -16
  276. package/build-types/pagination.d.ts.map +0 -1
  277. package/build-types/reset-filters.d.ts.map +0 -1
  278. package/build-types/search-widget.d.ts.map +0 -1
  279. package/build-types/search.d.ts +0 -13
  280. package/build-types/search.d.ts.map +0 -1
  281. package/build-types/single-selection-checkbox.d.ts +0 -17
  282. package/build-types/single-selection-checkbox.d.ts.map +0 -1
  283. package/build-types/stories/fixtures.d.ts.map +0 -1
  284. package/build-types/stories/index.story.d.ts +0 -15
  285. package/build-types/stories/index.story.d.ts.map +0 -1
  286. package/build-types/view-actions.d.ts +0 -12
  287. package/build-types/view-actions.d.ts.map +0 -1
  288. package/build-types/view-grid.d.ts +0 -4
  289. package/build-types/view-grid.d.ts.map +0 -1
  290. package/build-types/view-list.d.ts +0 -4
  291. package/build-types/view-list.d.ts.map +0 -1
  292. package/build-types/view-table.d.ts +0 -5
  293. package/build-types/view-table.d.ts.map +0 -1
  294. package/src/dataviews.tsx +0 -189
  295. package/src/layouts.ts +0 -39
  296. package/src/single-selection-checkbox.tsx +0 -80
  297. package/src/stories/index.story.js +0 -64
  298. package/src/view-table.tsx +0 -603
@@ -0,0 +1,252 @@
1
+ .dataviews-filters__button {
2
+ position: relative;
3
+ }
4
+
5
+ .dataviews-filters__reset-button.dataviews-filters__reset-button[aria-disabled="true"] {
6
+ &,
7
+ &:hover {
8
+ opacity: 0;
9
+ }
10
+
11
+ &:focus {
12
+ opacity: 1;
13
+ }
14
+ }
15
+
16
+ .dataviews-filters__summary-popover {
17
+ .components-popover__content {
18
+ width: 230px;
19
+ padding: 0;
20
+ border-radius: $grid-unit-05;
21
+ }
22
+ }
23
+
24
+ .dataviews-filters__summary-operators-container {
25
+ padding: $grid-unit-10 $grid-unit-10 0;
26
+
27
+ &:has(+ .dataviews-filters__search-widget-listbox) {
28
+ border-bottom: 1px solid $gray-200;
29
+ padding-bottom: $grid-unit-10;
30
+ }
31
+
32
+ &:empty {
33
+ display: none;
34
+ }
35
+
36
+ .dataviews-filters__summary-operators-filter-name {
37
+ color: $gray-700;
38
+ }
39
+ }
40
+
41
+ .dataviews-filters__summary-chip-container {
42
+ position: relative;
43
+ white-space: pre-wrap;
44
+
45
+ .dataviews-filters__summary-chip {
46
+ border-radius: $grid-unit-20;
47
+ border: 1px solid transparent;
48
+ cursor: pointer;
49
+ padding: $grid-unit-05 $grid-unit-15;
50
+ min-height: $grid-unit-40;
51
+ background: $gray-100;
52
+ color: $gray-800;
53
+ position: relative;
54
+ display: flex;
55
+ align-items: center;
56
+
57
+ &.has-reset {
58
+ padding-inline-end: $button-size-small + $grid-unit-05;
59
+ }
60
+
61
+ &:hover,
62
+ &:focus-visible,
63
+ &[aria-expanded="true"] {
64
+ background: $gray-200;
65
+ color: $gray-900;
66
+ }
67
+
68
+ &.has-values {
69
+ color: var(--wp-admin-theme-color);
70
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
71
+
72
+ &:hover,
73
+ &[aria-expanded="true"] {
74
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.12);
75
+ }
76
+ }
77
+
78
+ &:focus-visible {
79
+ outline: none;
80
+ box-shadow:
81
+ 0 0 0 var(--wp-admin-border-width-focus)
82
+ var(--wp-admin-theme-color);
83
+ }
84
+
85
+ .dataviews-filters-__summary-filter-text-name {
86
+ font-weight: 500;
87
+ }
88
+ }
89
+
90
+ .dataviews-filters__summary-chip-remove {
91
+ width: $icon-size;
92
+ height: $icon-size;
93
+ border-radius: 50%;
94
+ border: 0;
95
+ padding: 0;
96
+ position: absolute;
97
+ right: $grid-unit-05;
98
+ top: 50%;
99
+ transform: translateY(-50%);
100
+ display: flex;
101
+ align-items: center;
102
+ justify-content: center;
103
+ background: transparent;
104
+ cursor: pointer;
105
+
106
+ svg {
107
+ fill: $gray-700;
108
+ }
109
+
110
+ &:hover,
111
+ &:focus {
112
+ background: $gray-200;
113
+ svg {
114
+ fill: $gray-900;
115
+ }
116
+ }
117
+
118
+ &.has-values {
119
+ svg {
120
+ fill: var(--wp-admin-theme-color);
121
+ }
122
+ &:hover {
123
+ background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
124
+ }
125
+ }
126
+
127
+ &:focus-visible {
128
+ outline: none;
129
+ box-shadow:
130
+ 0 0 0 var(--wp-admin-border-width-focus)
131
+ var(--wp-admin-theme-color);
132
+ }
133
+ }
134
+ }
135
+
136
+ .dataviews-filters__search-widget-filter-combobox-list {
137
+ max-height: $grid-unit * 23;
138
+ padding: $grid-unit-05;
139
+ overflow: auto;
140
+ border-top: 1px solid $gray-200;
141
+
142
+ .dataviews-filters__search-widget-filter-combobox-item-value {
143
+ [data-user-value] {
144
+ font-weight: 600;
145
+ }
146
+ }
147
+ }
148
+
149
+ .dataviews-filters__search-widget-listbox {
150
+ max-height: $grid-unit * 23;
151
+ padding: $grid-unit-05;
152
+ overflow: auto;
153
+ }
154
+
155
+ .dataviews-filters__search-widget-listitem {
156
+ display: flex;
157
+ align-items: center;
158
+ gap: $grid-unit-10;
159
+ border-radius: $radius-block-ui;
160
+ box-sizing: border-box;
161
+ padding: $grid-unit-10 $grid-unit-15;
162
+ cursor: default;
163
+ margin-block-end: 2px;
164
+
165
+ &:last-child {
166
+ margin-block-end: 0;
167
+ }
168
+
169
+ &:hover,
170
+ &[data-active-item],
171
+ &:focus {
172
+ background-color: var(--wp-admin-theme-color);
173
+ color: $white;
174
+
175
+ .dataviews-filters__search-widget-listitem-check {
176
+ fill: $white;
177
+ }
178
+
179
+ .dataviews-filters__search-widget-listitem-description {
180
+ color: $white;
181
+ }
182
+ }
183
+
184
+ .dataviews-filters__search-widget-listitem-check {
185
+ width: 24px;
186
+ height: 24px;
187
+ flex-shrink: 0;
188
+ }
189
+
190
+ .dataviews-filters__search-widget-listitem-description {
191
+ display: block;
192
+ overflow: hidden;
193
+ text-overflow: ellipsis;
194
+ font-size: $helptext-font-size;
195
+ line-height: 16px;
196
+ color: $gray-700;
197
+ }
198
+ }
199
+
200
+ .dataviews-filters__search-widget-filter-combobox__wrapper {
201
+ position: relative;
202
+ padding: $grid-unit-10;
203
+
204
+ .dataviews-filters__search-widget-filter-combobox__input {
205
+ @include input-control;
206
+ display: block;
207
+ padding: 0 $grid-unit-40 0 $grid-unit-10;
208
+ background: $gray-100;
209
+ border: none;
210
+ width: 100%;
211
+ height: $grid-unit-40;
212
+
213
+ // Unset inherited values.
214
+ margin-left: 0;
215
+ margin-right: 0;
216
+
217
+ /* Fonts smaller than 16px causes mobile safari to zoom. */
218
+ font-size: $mobile-text-min-font-size;
219
+ @include break-small {
220
+ font-size: $default-font-size;
221
+ }
222
+
223
+ &:focus {
224
+ background: $white;
225
+ box-shadow:
226
+ inset 0 0 0 var(--wp-admin-border-width-focus)
227
+ var(--wp-admin-theme-color);
228
+ }
229
+
230
+ &::placeholder {
231
+ color: $gray-700;
232
+ }
233
+
234
+ &::-webkit-search-decoration,
235
+ &::-webkit-search-cancel-button,
236
+ &::-webkit-search-results-button,
237
+ &::-webkit-search-results-decoration {
238
+ -webkit-appearance: none;
239
+ }
240
+ }
241
+
242
+ .dataviews-filters__search-widget-filter-combobox__icon {
243
+ position: absolute;
244
+ right: $grid-unit-15;
245
+ top: 50%;
246
+ transform: translateY(-50%);
247
+ display: flex;
248
+ align-items: center;
249
+ justify-content: center;
250
+ width: $icon-size;
251
+ }
252
+ }
@@ -20,8 +20,8 @@ import { useRegistry } from '@wordpress/data';
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
23
- import { unlock } from './lock-unlock';
24
- import type { Action, ActionModal as ActionModalType, AnyItem } from './types';
23
+ import { unlock } from '../../lock-unlock';
24
+ import type { Action, ActionModal as ActionModalType } from '../../types';
25
25
 
26
26
  const {
27
27
  DropdownMenuV2: DropdownMenu,
@@ -31,42 +31,41 @@ const {
31
31
  kebabCase,
32
32
  } = unlock( componentsPrivateApis );
33
33
 
34
- export interface ActionTriggerProps< Item extends AnyItem > {
34
+ export interface ActionTriggerProps< Item > {
35
35
  action: Action< Item >;
36
36
  onClick: MouseEventHandler;
37
37
  isBusy?: boolean;
38
38
  items: Item[];
39
39
  }
40
40
 
41
- interface ActionModalProps< Item extends AnyItem > {
41
+ interface ActionModalProps< Item > {
42
42
  action: ActionModalType< Item >;
43
43
  items: Item[];
44
44
  closeModal?: () => void;
45
45
  }
46
46
 
47
- interface ActionWithModalProps< Item extends AnyItem >
48
- extends ActionModalProps< Item > {
47
+ interface ActionWithModalProps< Item > extends ActionModalProps< Item > {
49
48
  ActionTrigger: ( props: ActionTriggerProps< Item > ) => ReactElement;
50
49
  isBusy?: boolean;
51
50
  }
52
51
 
53
- interface ActionsDropdownMenuGroupProps< Item extends AnyItem > {
52
+ interface ActionsDropdownMenuGroupProps< Item > {
54
53
  actions: Action< Item >[];
55
54
  item: Item;
56
55
  }
57
56
 
58
- interface ItemActionsProps< Item extends AnyItem > {
57
+ interface ItemActionsProps< Item > {
59
58
  item: Item;
60
59
  actions: Action< Item >[];
61
60
  isCompact?: boolean;
62
61
  }
63
62
 
64
- interface CompactItemActionsProps< Item extends AnyItem > {
63
+ interface CompactItemActionsProps< Item > {
65
64
  item: Item;
66
65
  actions: Action< Item >[];
67
66
  }
68
67
 
69
- function ButtonTrigger< Item extends AnyItem >( {
68
+ function ButtonTrigger< Item >( {
70
69
  action,
71
70
  onClick,
72
71
  items,
@@ -84,7 +83,7 @@ function ButtonTrigger< Item extends AnyItem >( {
84
83
  );
85
84
  }
86
85
 
87
- function DropdownMenuItemTrigger< Item extends AnyItem >( {
86
+ function DropdownMenuItemTrigger< Item >( {
88
87
  action,
89
88
  onClick,
90
89
  items,
@@ -101,7 +100,7 @@ function DropdownMenuItemTrigger< Item extends AnyItem >( {
101
100
  );
102
101
  }
103
102
 
104
- export function ActionModal< Item extends AnyItem >( {
103
+ export function ActionModal< Item >( {
105
104
  action,
106
105
  items,
107
106
  closeModal,
@@ -124,7 +123,7 @@ export function ActionModal< Item extends AnyItem >( {
124
123
  );
125
124
  }
126
125
 
127
- export function ActionWithModal< Item extends AnyItem >( {
126
+ export function ActionWithModal< Item >( {
128
127
  action,
129
128
  items,
130
129
  ActionTrigger,
@@ -153,7 +152,7 @@ export function ActionWithModal< Item extends AnyItem >( {
153
152
  );
154
153
  }
155
154
 
156
- export function ActionsDropdownMenuGroup< Item extends AnyItem >( {
155
+ export function ActionsDropdownMenuGroup< Item >( {
157
156
  actions,
158
157
  item,
159
158
  }: ActionsDropdownMenuGroupProps< Item > ) {
@@ -186,7 +185,7 @@ export function ActionsDropdownMenuGroup< Item extends AnyItem >( {
186
185
  );
187
186
  }
188
187
 
189
- export default function ItemActions< Item extends AnyItem >( {
188
+ export default function ItemActions< Item >( {
190
189
  item,
191
190
  actions,
192
191
  isCompact,
@@ -247,7 +246,7 @@ export default function ItemActions< Item extends AnyItem >( {
247
246
  );
248
247
  }
249
248
 
250
- function CompactItemActions< Item extends AnyItem >( {
249
+ function CompactItemActions< Item >( {
251
250
  item,
252
251
  actions,
253
252
  }: CompactItemActionsProps< Item > ) {
@@ -258,7 +257,7 @@ function CompactItemActions< Item extends AnyItem >( {
258
257
  size="compact"
259
258
  icon={ moreVertical }
260
259
  label={ __( 'Actions' ) }
261
- __experimentalIsFocusable
260
+ accessibleWhenDisabled
262
261
  disabled={ ! actions.length }
263
262
  className="dataviews-all-actions-button"
264
263
  />
@@ -0,0 +1,3 @@
1
+ .dataviews-action-modal {
2
+ z-index: z-index(".dataviews-action-modal");
3
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentType } from 'react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useContext } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import DataViewsContext from '../dataviews-context';
15
+ import { VIEW_LAYOUTS } from '../../layouts';
16
+ import type { ViewBaseProps } from '../../types';
17
+
18
+ export default function DataViewsLayout() {
19
+ const {
20
+ actions = [],
21
+ data,
22
+ fields,
23
+ getItemId,
24
+ isLoading,
25
+ view,
26
+ onChangeView,
27
+ selection,
28
+ onChangeSelection,
29
+ setOpenedFilter,
30
+ density,
31
+ } = useContext( DataViewsContext );
32
+
33
+ const ViewComponent = VIEW_LAYOUTS.find( ( v ) => v.type === view.type )
34
+ ?.component as ComponentType< ViewBaseProps< any > >;
35
+
36
+ return (
37
+ <ViewComponent
38
+ actions={ actions }
39
+ data={ data }
40
+ fields={ fields }
41
+ getItemId={ getItemId }
42
+ isLoading={ isLoading }
43
+ onChangeView={ onChangeView }
44
+ onChangeSelection={ onChangeSelection }
45
+ selection={ selection }
46
+ setOpenedFilter={ setOpenedFilter }
47
+ view={ view }
48
+ density={ density }
49
+ />
50
+ );
51
+ }
@@ -6,29 +6,21 @@ import {
6
6
  __experimentalHStack as HStack,
7
7
  SelectControl,
8
8
  } from '@wordpress/components';
9
- import { createInterpolateElement, memo } from '@wordpress/element';
9
+ import { createInterpolateElement, memo, useContext } from '@wordpress/element';
10
10
  import { sprintf, __, _x } from '@wordpress/i18n';
11
- import { chevronRight, chevronLeft } from '@wordpress/icons';
11
+ import { next, previous } from '@wordpress/icons';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
- import type { View } from './types';
16
+ import DataViewsContext from '../dataviews-context';
17
17
 
18
- interface PaginationProps {
19
- view: View;
20
- onChangeView: ( view: View ) => void;
21
- paginationInfo: {
22
- totalItems: number;
23
- totalPages: number;
24
- };
25
- }
26
-
27
- const Pagination = memo( function Pagination( {
28
- view,
29
- onChangeView,
30
- paginationInfo: { totalItems = 0, totalPages },
31
- }: PaginationProps ) {
18
+ function DataViewsPagination() {
19
+ const {
20
+ view,
21
+ onChangeView,
22
+ paginationInfo: { totalItems = 0, totalPages },
23
+ } = useContext( DataViewsContext );
32
24
  if ( ! totalItems || ! totalPages ) {
33
25
  return null;
34
26
  }
@@ -90,9 +82,9 @@ const Pagination = memo( function Pagination( {
90
82
  } )
91
83
  }
92
84
  disabled={ currentPage === 1 }
93
- __experimentalIsFocusable
85
+ accessibleWhenDisabled
94
86
  label={ __( 'Previous page' ) }
95
- icon={ chevronLeft }
87
+ icon={ previous }
96
88
  showTooltip
97
89
  size="compact"
98
90
  tooltipPosition="top"
@@ -102,9 +94,9 @@ const Pagination = memo( function Pagination( {
102
94
  onChangeView( { ...view, page: currentPage + 1 } )
103
95
  }
104
96
  disabled={ currentPage >= totalPages }
105
- __experimentalIsFocusable
97
+ accessibleWhenDisabled
106
98
  label={ __( 'Next page' ) }
107
- icon={ chevronRight }
99
+ icon={ next }
108
100
  showTooltip
109
101
  size="compact"
110
102
  tooltipPosition="top"
@@ -113,6 +105,6 @@ const Pagination = memo( function Pagination( {
113
105
  </HStack>
114
106
  )
115
107
  );
116
- } );
108
+ }
117
109
 
118
- export default Pagination;
110
+ export default memo( DataViewsPagination );
@@ -0,0 +1,26 @@
1
+ .dataviews-pagination {
2
+ position: sticky;
3
+ bottom: 0;
4
+ left: 0;
5
+ background-color: $white;
6
+ padding: $grid-unit-15 $grid-unit-60;
7
+ border-top: $border-width solid $gray-100;
8
+ color: $gray-700;
9
+ flex-shrink: 0;
10
+ transition: padding ease-out 0.1s;
11
+ @include reduce-motion("transition");
12
+ }
13
+
14
+ .dataviews-pagination__page-selection {
15
+ font-size: 11px;
16
+ text-transform: uppercase;
17
+ font-weight: 500;
18
+ color: $gray-900;
19
+ }
20
+
21
+ /* stylelint-disable-next-line scss/at-rule-no-unknown -- '@container' not globally permitted */
22
+ @container (max-width: 430px) {
23
+ .dataviews-pagination {
24
+ padding: $grid-unit-15 $grid-unit-30;
25
+ }
26
+ }
@@ -2,26 +2,21 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { useEffect, useRef, memo } from '@wordpress/element';
5
+ import { useEffect, useRef, memo, useContext } from '@wordpress/element';
6
6
  import { SearchControl } from '@wordpress/components';
7
7
  import { useDebouncedInput } from '@wordpress/compose';
8
8
 
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
- import type { View } from './types';
12
+ import DataViewsContext from '../dataviews-context';
13
13
 
14
14
  interface SearchProps {
15
15
  label?: string;
16
- view: View;
17
- onChangeView: ( view: View ) => void;
18
16
  }
19
17
 
20
- const Search = memo( function Search( {
21
- label,
22
- view,
23
- onChangeView,
24
- }: SearchProps ) {
18
+ const DataViewsSearch = memo( function Search( { label }: SearchProps ) {
19
+ const { view, onChangeView } = useContext( DataViewsContext );
25
20
  const [ search, setSearch, debouncedSearch ] = useDebouncedInput(
26
21
  view.search
27
22
  );
@@ -54,4 +49,4 @@ const Search = memo( function Search( {
54
49
  );
55
50
  } );
56
51
 
57
- export default Search;
52
+ export default DataViewsSearch;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, sprintf } from '@wordpress/i18n';
5
+ import { CheckboxControl } from '@wordpress/components';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import type { Field } from '../../types';
11
+ import type { SetSelection } from '../../private-types';
12
+
13
+ interface DataViewsSelectionCheckboxProps< Item > {
14
+ selection: string[];
15
+ onChangeSelection: SetSelection;
16
+ item: Item;
17
+ getItemId: ( item: Item ) => string;
18
+ primaryField?: Field< Item >;
19
+ disabled: boolean;
20
+ }
21
+
22
+ export default function DataViewsSelectionCheckbox< Item >( {
23
+ selection,
24
+ onChangeSelection,
25
+ item,
26
+ getItemId,
27
+ primaryField,
28
+ disabled,
29
+ }: DataViewsSelectionCheckboxProps< Item > ) {
30
+ const id = getItemId( item );
31
+ const checked = ! disabled && selection.includes( id );
32
+ let selectionLabel;
33
+ if ( primaryField?.getValue && item ) {
34
+ // eslint-disable-next-line @wordpress/valid-sprintf
35
+ selectionLabel = sprintf(
36
+ /* translators: %s: item title. */
37
+ checked ? __( 'Deselect item: %s' ) : __( 'Select item: %s' ),
38
+ primaryField.getValue( { item } )
39
+ );
40
+ } else {
41
+ selectionLabel = checked
42
+ ? __( 'Select a new item' )
43
+ : __( 'Deselect item' );
44
+ }
45
+ return (
46
+ <CheckboxControl
47
+ className="dataviews-selection-checkbox"
48
+ __nextHasNoMarginBottom
49
+ aria-label={ selectionLabel }
50
+ aria-disabled={ disabled }
51
+ checked={ checked }
52
+ onChange={ () => {
53
+ if ( disabled ) {
54
+ return;
55
+ }
56
+
57
+ onChangeSelection(
58
+ selection.includes( id )
59
+ ? selection.filter( ( itemId ) => id !== itemId )
60
+ : [ ...selection, id ]
61
+ );
62
+ } }
63
+ />
64
+ );
65
+ }
@@ -0,0 +1,14 @@
1
+ .dataviews-selection-checkbox {
2
+ // Experimental override for CheckboxControl size (fragile)
3
+ --checkbox-input-size: 24px;
4
+ @include break-small() {
5
+ --checkbox-input-size: 16px;
6
+ }
7
+
8
+ line-height: 0;
9
+ flex-shrink: 0;
10
+
11
+ .components-checkbox-control__input-container {
12
+ margin: 0;
13
+ }
14
+ }