diff --git a/public/globals.js b/public/globals.js
index 3aab16aff..0bc3d1468 100644
--- a/public/globals.js
+++ b/public/globals.js
@@ -20,6 +20,14 @@ window.pkp = {
preferredName: 'Daniel Barnes',
},
+ /**
+ *
+ *
+ */
+ context: {
+ apiBaseUrl: 'https://mock/index.php/publicknowledge/api/v1/',
+ },
+
/**
* Dummy constants required by components
*/
diff --git a/src/components/TableNext/Table.mdx b/src/components/TableNext/Table.mdx
index dce889e9b..dec749af7 100644
--- a/src/components/TableNext/Table.mdx
+++ b/src/components/TableNext/Table.mdx
@@ -1,6 +1,8 @@
import {Primary, Controls, Stories, Meta, ArgTypes} from '@storybook/blocks';
import * as TableStories from './Table.stories.js';
+import TableColumn from './TableColumn.vue';
+import TableCell from './TableCell.vue';
@@ -8,85 +10,24 @@ import * as TableStories from './Table.stories.js';
## Usage
-WIP Some informations are inaccurate.
+Use the `Table` component to display tabular data when the user will sort, search, filter, or if interactive elements such as a button appear within the table.
-## Usage
-
-Use the `Table` component to display tabular data when the user will sort, search, filter or edit the rows in the table, or if interactive elements such as a button appear within the table.
-
-## Datagrid
-
-This component implements a [Data Grid](https://www.w3.org/TR/wai-aria-practices/examples/grid/dataGrids.html), which provides accessible keyboard controls and markup for managing the data in the table. All interactions in the table rows, including buttons or fields to edit a row, must be accessible by keyboard.
-
-## <TableCell>
-
-All cells in the table must use the `` component in order to support the accessible keyboard navigation features. Use a `` inside of a `
` in the same way that a `
` element would be used.
-
-```html
-
-
- dbarnes
- Daniel Barnes
-
-
- sminotue
- Stephanie Minotue
-
-
-```
-
-When writing a `` in a Smarty template, you must use a `
` with with the `is` attribute.
+## Accessibility
-```html
-
-
-
dbarnes
-
Daniel Barnes
-
-
-
sminotue
-
Stephanie Minotue
-
-
-```
+Table component requires aria-label attribute to describe content of table.
-This is because templates written in Smarty are parsed by the browser before they are parsed by Vue. Learn more about Vue's [DOM Template Parsing Caveats](https://v2.vuejs.org/v2/guide/components.html#DOM-Template-Parsing-Caveats).
+One column should be [rowheader](https://www.w3.org/TR/wai-aria-1.1/#rowheader) to improve screen reader experience. Its prop on TableCell, not on TableColumn as one would expect as it allows for significantly easier implementation.
-## Sorting
+## Table Props
-When a table can be sorted, you must [announce the changes](#/pages/announcer). When a sort is performed by making a request to the server, announce at both the start and end of the process.
-
-```js
-methods: {
- sort(col) {
- this.$announcer.set('Loading');
- $.ajax({
-
- // ...
-
- success(r) {
-
- // ...
-
- this.$announcer.set('Sorted by ' + col);
- }
- });
- }
-}
-```
+
-## Accessible Caption
+## TableColumn Props
-Every table needs an accessible caption. Use the `caption` slot to provide a title with the correct `` heading according to the page hierarchy. The description is optional.
+
-```html
-
-
-
Example Table
-
-
-```
+# TableCell Props
-If you do not use the `caption` slot, you must use the `labelledBy` prop to provide an accessible label for the table. See the [Labelled By](#/component/Table/with-labelledby) example.
+
-
+
diff --git a/src/components/TableNext/Table.stories.js b/src/components/TableNext/Table.stories.js
index 108c85342..9ec8952bc 100644
--- a/src/components/TableNext/Table.stories.js
+++ b/src/components/TableNext/Table.stories.js
@@ -1,12 +1,20 @@
-import {ref, computed} from 'vue';
+import {ref, watch} from 'vue';
import PkpTable from './Table.vue';
-import TableCell from './TableCell.vue';
import TableHeader from './TableHeader.vue';
+import TableBody from './TableBody.vue';
+import TableColumn from './TableColumn.vue';
+import TableCell from './TableCell.vue';
+import TableRow from './TableRow.vue';
import ButtonRow from '@/components/ButtonRow/ButtonRow.vue';
import Pagination from '@/components/Pagination/Pagination.vue';
+import {http, HttpResponse} from 'msw';
import articleStats from '@/components/Table/mocks/articleStats.js';
import {useSorting} from '@/composables/useSorting';
+
+import {useFetchPaginated} from '@/composables/useFetchPaginated';
+import {useApiUrl} from '@/composables/useApiUrl';
+
export default {
title: 'Components/Table',
component: PkpTable,
@@ -14,37 +22,41 @@ export default {
export const Default = {
render: (args) => ({
- components: {PkpTable, TableCell, TableHeader},
+ components: {
+ PkpTable,
+ TableHeader,
+ TableBody,
+ TableRow,
+ TableColumn,
+ TableCell,
+ },
setup() {
const rows = articleStats.slice(0, 10);
return {args, rows};
},
template: `
-
-
-
-
Example Table
-
-
-
- ID
- Title
- Views
- Downloads
- Total
-
-