@purpurds/table 0.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.
- package/dist/LICENSE.txt +213 -0
- package/dist/cell-types/badge-cell.d.ts +8 -0
- package/dist/cell-types/badge-cell.d.ts.map +1 -0
- package/dist/cell-types/body-text-cell.d.ts +8 -0
- package/dist/cell-types/body-text-cell.d.ts.map +1 -0
- package/dist/cell-types/button-cell.d.ts +8 -0
- package/dist/cell-types/button-cell.d.ts.map +1 -0
- package/dist/cell-types/button-group-cell.d.ts +16 -0
- package/dist/cell-types/button-group-cell.d.ts.map +1 -0
- package/dist/cell-types/cta-link-cell.d.ts +8 -0
- package/dist/cell-types/cta-link-cell.d.ts.map +1 -0
- package/dist/cell-types/date-cell.d.ts +8 -0
- package/dist/cell-types/date-cell.d.ts.map +1 -0
- package/dist/cell-types/empty-cell.d.ts +4 -0
- package/dist/cell-types/empty-cell.d.ts.map +1 -0
- package/dist/cell-types/error-message-cell.d.ts +8 -0
- package/dist/cell-types/error-message-cell.d.ts.map +1 -0
- package/dist/cell-types/icon-text-cell.d.ts +8 -0
- package/dist/cell-types/icon-text-cell.d.ts.map +1 -0
- package/dist/cell-types/lead-text-cell.d.ts +8 -0
- package/dist/cell-types/lead-text-cell.d.ts.map +1 -0
- package/dist/cell-types/link-cell.d.ts +8 -0
- package/dist/cell-types/link-cell.d.ts.map +1 -0
- package/dist/cell-types/number-cell.d.ts +8 -0
- package/dist/cell-types/number-cell.d.ts.map +1 -0
- package/dist/cell-types/row-selection-cell.d.ts +8 -0
- package/dist/cell-types/row-selection-cell.d.ts.map +1 -0
- package/dist/cell-types/row-toggle-cell.d.ts +8 -0
- package/dist/cell-types/row-toggle-cell.d.ts.map +1 -0
- package/dist/cell-types/toggle-cell.d.ts +8 -0
- package/dist/cell-types/toggle-cell.d.ts.map +1 -0
- package/dist/cell-types/warning-message-cell.d.ts +8 -0
- package/dist/cell-types/warning-message-cell.d.ts.map +1 -0
- package/dist/metadata.js +17 -0
- package/dist/story-utils/column-def.d.ts +5 -0
- package/dist/story-utils/column-def.d.ts.map +1 -0
- package/dist/story-utils/table-data.d.ts +35 -0
- package/dist/story-utils/table-data.d.ts.map +1 -0
- package/dist/story-utils/use-fetch-table-data-hook.d.ts +11 -0
- package/dist/story-utils/use-fetch-table-data-hook.d.ts.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/table-action-bar.d.ts +26 -0
- package/dist/table-action-bar.d.ts.map +1 -0
- package/dist/table-body.d.ts +10 -0
- package/dist/table-body.d.ts.map +1 -0
- package/dist/table-column-header-cell.d.ts +28 -0
- package/dist/table-column-header-cell.d.ts.map +1 -0
- package/dist/table-export-drawer.d.ts +17 -0
- package/dist/table-export-drawer.d.ts.map +1 -0
- package/dist/table-header.d.ts +11 -0
- package/dist/table-header.d.ts.map +1 -0
- package/dist/table-row-cell-skeleton.d.ts +14 -0
- package/dist/table-row-cell-skeleton.d.ts.map +1 -0
- package/dist/table-row-cell.d.ts +25 -0
- package/dist/table-row-cell.d.ts.map +1 -0
- package/dist/table-row.d.ts +11 -0
- package/dist/table-row.d.ts.map +1 -0
- package/dist/table-settings-drawer.d.ts +41 -0
- package/dist/table-settings-drawer.d.ts.map +1 -0
- package/dist/table-toolbar.d.ts +37 -0
- package/dist/table-toolbar.d.ts.map +1 -0
- package/dist/table.cjs.js +259 -0
- package/dist/table.cjs.js.map +1 -0
- package/dist/table.d.ts +20 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.es.js +13585 -0
- package/dist/table.es.js.map +1 -0
- package/dist/test-utils/column-def.d.ts +6 -0
- package/dist/test-utils/column-def.d.ts.map +1 -0
- package/dist/test-utils/helpers.d.ts +138 -0
- package/dist/test-utils/helpers.d.ts.map +1 -0
- package/dist/test-utils/table-data.d.ts +33 -0
- package/dist/test-utils/table-data.d.ts.map +1 -0
- package/dist/types.d.ts +420 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/use-screen-size.hook.d.ts +7 -0
- package/dist/use-screen-size.hook.d.ts.map +1 -0
- package/dist/use-truncated-hook.d.ts +10 -0
- package/dist/use-truncated-hook.d.ts.map +1 -0
- package/dist/utils/custom-functions.d.ts +9 -0
- package/dist/utils/custom-functions.d.ts.map +1 -0
- package/dist/utils/unit-conversions.d.ts +19 -0
- package/dist/utils/unit-conversions.d.ts.map +1 -0
- package/dist/utils/unit-conversions.spec.d.ts +2 -0
- package/dist/utils/unit-conversions.spec.d.ts.map +1 -0
- package/eslint.config.mjs +2 -0
- package/package.json +82 -0
- package/src/cell-types/badge-cell.tsx +25 -0
- package/src/cell-types/body-text-cell.tsx +54 -0
- package/src/cell-types/button-cell.tsx +26 -0
- package/src/cell-types/button-group-cell.tsx +54 -0
- package/src/cell-types/cta-link-cell.tsx +25 -0
- package/src/cell-types/date-cell.tsx +33 -0
- package/src/cell-types/empty-cell.tsx +6 -0
- package/src/cell-types/error-message-cell.tsx +30 -0
- package/src/cell-types/icon-text-cell.tsx +30 -0
- package/src/cell-types/lead-text-cell.tsx +19 -0
- package/src/cell-types/link-cell.tsx +58 -0
- package/src/cell-types/number-cell.tsx +27 -0
- package/src/cell-types/row-selection-cell.tsx +22 -0
- package/src/cell-types/row-toggle-cell.tsx +23 -0
- package/src/cell-types/toggle-cell.tsx +19 -0
- package/src/cell-types/warning-message-cell.tsx +30 -0
- package/src/global.d.ts +4 -0
- package/src/story-utils/column-def.ts +148 -0
- package/src/story-utils/table-data.tsx +262 -0
- package/src/story-utils/use-fetch-table-data-hook.tsx +30 -0
- package/src/table-action-bar.module.scss +106 -0
- package/src/table-action-bar.test.tsx +111 -0
- package/src/table-action-bar.tsx +104 -0
- package/src/table-body.tsx +25 -0
- package/src/table-column-header-cell.tsx +305 -0
- package/src/table-export-drawer.module.scss +9 -0
- package/src/table-export-drawer.test.tsx +75 -0
- package/src/table-export-drawer.tsx +59 -0
- package/src/table-header.tsx +35 -0
- package/src/table-kitchen-sink.test.tsx +1196 -0
- package/src/table-row-cell-skeleton.tsx +61 -0
- package/src/table-row-cell.test.tsx +360 -0
- package/src/table-row-cell.tsx +188 -0
- package/src/table-row.tsx +30 -0
- package/src/table-settings-drawer.module.scss +25 -0
- package/src/table-settings-drawer.test.tsx +350 -0
- package/src/table-settings-drawer.tsx +254 -0
- package/src/table-toolbar.module.scss +17 -0
- package/src/table-toolbar.test.tsx +95 -0
- package/src/table-toolbar.tsx +136 -0
- package/src/table.module.scss +367 -0
- package/src/table.stories.tsx +1246 -0
- package/src/table.story.css +11 -0
- package/src/table.test.tsx +318 -0
- package/src/table.tsx +501 -0
- package/src/test-utils/column-def.ts +152 -0
- package/src/test-utils/helpers.ts +234 -0
- package/src/test-utils/table-data.tsx +318 -0
- package/src/types.ts +496 -0
- package/src/use-screen-size.hook.ts +23 -0
- package/src/use-truncated-hook.tsx +74 -0
- package/src/utils/custom-functions.ts +52 -0
- package/src/utils/unit-conversions.spec.ts +92 -0
- package/src/utils/unit-conversions.ts +30 -0
- package/vitest.setup.ts +60 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { axe } from "vitest-axe";
|
|
6
|
+
|
|
7
|
+
import { TableToolbar } from "./table-toolbar";
|
|
8
|
+
import { copy, Selectors } from "./test-utils/helpers";
|
|
9
|
+
|
|
10
|
+
const setDrawerIsOpenMock = vi.fn();
|
|
11
|
+
const resetColumnFiltersMock = vi.fn();
|
|
12
|
+
const toggleExpandMock = vi.fn();
|
|
13
|
+
const exportDataMock = vi.fn();
|
|
14
|
+
|
|
15
|
+
describe("Data table - Tool bar", () => {
|
|
16
|
+
let container: HTMLElement;
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
container = render(
|
|
20
|
+
// Needs an element with id purpur-table for the ally tests to not fail with "ARIA attributes must conform to valid values (aria-valid-attr-value)" rule
|
|
21
|
+
<div id="purpur-table">
|
|
22
|
+
<TableToolbar
|
|
23
|
+
onResetColumnFilters={resetColumnFiltersMock}
|
|
24
|
+
onSetDrawerIsOpen={setDrawerIsOpenMock}
|
|
25
|
+
onToggleExpand={toggleExpandMock}
|
|
26
|
+
onExportData={exportDataMock}
|
|
27
|
+
visibleRowCount={10}
|
|
28
|
+
totalRowCount={14}
|
|
29
|
+
toolbarCopy={copy.toolbar}
|
|
30
|
+
isSettingsDrawerOpen={false}
|
|
31
|
+
isExportDrawerOpen={false}
|
|
32
|
+
hasExportsDrawer={true}
|
|
33
|
+
showFilters={true}
|
|
34
|
+
disableClearFilters={false}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
).container;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should display 'Showing 10 of 14 rows'", () => {
|
|
41
|
+
const tableRowsCount = screen.getByTestId(Selectors.TOOLBAR.TABLE_ROWS_COUNT);
|
|
42
|
+
expect(tableRowsCount).toHaveTextContent("Showing 10 of 14 rows");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("should have a clear filters button", () => {
|
|
46
|
+
const clearFiltersButton = screen.getByTestId(Selectors.TOOLBAR.CLEAR_FILTERS_BUTTON);
|
|
47
|
+
expect(clearFiltersButton).toHaveTextContent("Clear filters");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("should have export button", () => {
|
|
51
|
+
const exportButton = screen.getByTestId(Selectors.TOOLBAR.EXPORT_BUTTON);
|
|
52
|
+
expect(exportButton).toHaveTextContent("Export");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("should have settings button", () => {
|
|
56
|
+
const settingsButton = screen.getByTestId(Selectors.TOOLBAR.SETTINGS_BUTTON);
|
|
57
|
+
expect(settingsButton).toHaveTextContent("Settings");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("should have expand button", () => {
|
|
61
|
+
const expandButton = screen.getByTestId(Selectors.TOOLBAR.EXPAND_BUTTON);
|
|
62
|
+
expect(expandButton).toHaveTextContent("Expand");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("should send 'resetColumnFilters' event when clicking on 'Clear filters' button", async () => {
|
|
66
|
+
const clearFiltersButton = screen.getByTestId(Selectors.TOOLBAR.CLEAR_FILTERS_BUTTON);
|
|
67
|
+
await userEvent.click(clearFiltersButton);
|
|
68
|
+
expect(resetColumnFiltersMock).toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("should send 'setDrawerIsOpen' event when clicking on 'Settings' button", async () => {
|
|
72
|
+
const settingsButton = screen.getByTestId(Selectors.TOOLBAR.SETTINGS_BUTTON);
|
|
73
|
+
await userEvent.click(settingsButton);
|
|
74
|
+
expect(setDrawerIsOpenMock).toHaveBeenCalled();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("should send 'exportData' event when clicking on export", async () => {
|
|
78
|
+
const exportButton = screen.getByTestId(Selectors.TOOLBAR.EXPORT_BUTTON);
|
|
79
|
+
await userEvent.click(exportButton);
|
|
80
|
+
expect(exportDataMock).toHaveBeenCalled();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("should send an event when clicking on expand", async () => {
|
|
84
|
+
const expandButton = screen.getByTestId(Selectors.TOOLBAR.EXPAND_BUTTON);
|
|
85
|
+
await userEvent.click(expandButton);
|
|
86
|
+
expect(toggleExpandMock).toHaveBeenCalled();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("should be accessible", async () => {
|
|
90
|
+
const results = await axe(container);
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
expect(results).toHaveNoViolations();
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "@purpurds/button";
|
|
3
|
+
import { IconDownload } from "@purpurds/icon/download";
|
|
4
|
+
import { IconMaximize } from "@purpurds/icon/maximize";
|
|
5
|
+
import { IconSettings } from "@purpurds/icon/settings";
|
|
6
|
+
import { Paragraph } from "@purpurds/paragraph";
|
|
7
|
+
import c from "classnames/bind";
|
|
8
|
+
|
|
9
|
+
import styles from "./table-toolbar.module.scss";
|
|
10
|
+
|
|
11
|
+
export type TableToolbarCopyProps = {
|
|
12
|
+
buttons?: {
|
|
13
|
+
export?: string;
|
|
14
|
+
settings?: string;
|
|
15
|
+
expand?: string;
|
|
16
|
+
clearFilters?: string;
|
|
17
|
+
};
|
|
18
|
+
ariaLabels?: {
|
|
19
|
+
export?: string;
|
|
20
|
+
settings?: string;
|
|
21
|
+
expand?: string;
|
|
22
|
+
clearFilters?: string;
|
|
23
|
+
};
|
|
24
|
+
rowCount?: {
|
|
25
|
+
showing: string;
|
|
26
|
+
of: string;
|
|
27
|
+
rows: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type TableToolbarProps = {
|
|
32
|
+
onSetDrawerIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
33
|
+
onResetColumnFilters: () => void;
|
|
34
|
+
onToggleExpand?: () => void;
|
|
35
|
+
onExportData?: () => void;
|
|
36
|
+
visibleRowCount: number;
|
|
37
|
+
totalRowCount: number;
|
|
38
|
+
toolbarCopy?: TableToolbarCopyProps;
|
|
39
|
+
isSettingsDrawerOpen: boolean;
|
|
40
|
+
isExportDrawerOpen: boolean;
|
|
41
|
+
hasExportsDrawer: boolean;
|
|
42
|
+
showFilters: boolean;
|
|
43
|
+
disableClearFilters: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const rootClassName = "purpur-table-toolbar";
|
|
47
|
+
const cx = c.bind(styles);
|
|
48
|
+
const rootTestId = "purpur-table-toolbar";
|
|
49
|
+
|
|
50
|
+
export const TableToolbar = ({
|
|
51
|
+
onExportData,
|
|
52
|
+
onResetColumnFilters,
|
|
53
|
+
onSetDrawerIsOpen,
|
|
54
|
+
onToggleExpand,
|
|
55
|
+
disableClearFilters,
|
|
56
|
+
hasExportsDrawer,
|
|
57
|
+
isExportDrawerOpen,
|
|
58
|
+
isSettingsDrawerOpen,
|
|
59
|
+
showFilters,
|
|
60
|
+
toolbarCopy: copy,
|
|
61
|
+
totalRowCount,
|
|
62
|
+
visibleRowCount,
|
|
63
|
+
}: TableToolbarProps) => {
|
|
64
|
+
return (
|
|
65
|
+
<div data-testid={rootTestId} className={cx(rootClassName)}>
|
|
66
|
+
<div className={cx(`${rootClassName}__content`)}>
|
|
67
|
+
{copy?.rowCount && (
|
|
68
|
+
<Paragraph data-testid={`${rootTestId}-table-rows-count`}>
|
|
69
|
+
{`${copy.rowCount.showing} ${visibleRowCount} ${copy.rowCount.of} ${totalRowCount} ${copy.rowCount.rows}`}
|
|
70
|
+
</Paragraph>
|
|
71
|
+
)}
|
|
72
|
+
{copy?.buttons?.clearFilters && showFilters && (
|
|
73
|
+
<Button
|
|
74
|
+
data-testid={`${rootTestId}-clear-filters-button`}
|
|
75
|
+
variant="text"
|
|
76
|
+
onClick={onResetColumnFilters}
|
|
77
|
+
type="button"
|
|
78
|
+
aria-label={copy?.ariaLabels?.clearFilters}
|
|
79
|
+
aria-controls="purpur-table"
|
|
80
|
+
disabled={disableClearFilters}
|
|
81
|
+
>
|
|
82
|
+
{copy.buttons.clearFilters}
|
|
83
|
+
</Button>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div className={cx(`${rootClassName}__content`)}>
|
|
88
|
+
{copy?.buttons?.export && (
|
|
89
|
+
<Button
|
|
90
|
+
data-testid={`${rootTestId}-export-button`}
|
|
91
|
+
variant="text"
|
|
92
|
+
type="button"
|
|
93
|
+
onClick={onExportData}
|
|
94
|
+
aria-label={copy?.ariaLabels?.export}
|
|
95
|
+
{...(hasExportsDrawer && {
|
|
96
|
+
"aria-expanded": isExportDrawerOpen,
|
|
97
|
+
"aria-controls": "purpur-table-export-drawer",
|
|
98
|
+
"aria-haspopup": "dialog",
|
|
99
|
+
})}
|
|
100
|
+
>
|
|
101
|
+
<IconDownload size="xs" />
|
|
102
|
+
{copy.buttons.export}
|
|
103
|
+
</Button>
|
|
104
|
+
)}
|
|
105
|
+
{copy?.buttons?.settings && (
|
|
106
|
+
<Button
|
|
107
|
+
data-testid={`${rootTestId}-settings-button`}
|
|
108
|
+
variant="text"
|
|
109
|
+
onClick={() => onSetDrawerIsOpen(true)}
|
|
110
|
+
type="button"
|
|
111
|
+
aria-label={copy?.ariaLabels?.settings}
|
|
112
|
+
aria-expanded={isSettingsDrawerOpen}
|
|
113
|
+
aria-controls="purpur-table-settings-drawer"
|
|
114
|
+
aria-haspopup="dialog"
|
|
115
|
+
>
|
|
116
|
+
<IconSettings size="xs" />
|
|
117
|
+
{copy.buttons.settings}
|
|
118
|
+
</Button>
|
|
119
|
+
)}
|
|
120
|
+
{onToggleExpand && copy?.buttons?.expand && (
|
|
121
|
+
<Button
|
|
122
|
+
data-testid={`${rootTestId}-expand-button`}
|
|
123
|
+
variant="text"
|
|
124
|
+
onClick={() => onToggleExpand()}
|
|
125
|
+
type="button"
|
|
126
|
+
aria-label={copy?.ariaLabels?.expand}
|
|
127
|
+
aria-controls="purpur-table"
|
|
128
|
+
>
|
|
129
|
+
<IconMaximize size="xs" />
|
|
130
|
+
{copy.buttons.expand}
|
|
131
|
+
</Button>
|
|
132
|
+
)}
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
@use "@purpurds/tokens/breakpoint/variables" as *;
|
|
2
|
+
|
|
3
|
+
.purpur-table {
|
|
4
|
+
--table-border: var(--purpur-border-width-xs) solid var(--purpur-color-border-weak);
|
|
5
|
+
--table-border-radius: var(--purpur-border-radius-lg);
|
|
6
|
+
display: flex;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: var(--purpur-spacing-200);
|
|
10
|
+
z-index: 1;
|
|
11
|
+
max-width: fit-content;
|
|
12
|
+
background-color: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.purpur-table__container {
|
|
16
|
+
overflow-x: scroll;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
|
|
19
|
+
&:has(.purpur-table-column-header-cell__first-header-visible) {
|
|
20
|
+
border-top-left-radius: var(--table-border-radius);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:has(.purpur-table-column-header-cell__last-header-visible) {
|
|
24
|
+
border-top-right-radius: var(--table-border-radius);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:has(.purpur-table-row-cell__last-row-first-cell-visible) {
|
|
28
|
+
border-bottom-left-radius: var(--table-border-radius);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:has(.purpur-table-row-cell__last-row-last-cell-visible) {
|
|
32
|
+
border-bottom-right-radius: var(--table-border-radius);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.purpur-table__table {
|
|
37
|
+
table-layout: auto;
|
|
38
|
+
border-collapse: separate;
|
|
39
|
+
border-spacing: 0;
|
|
40
|
+
position: relative;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.purpur-table-header {
|
|
44
|
+
.purpur-table-column-header-cell {
|
|
45
|
+
border-top: var(--table-border);
|
|
46
|
+
|
|
47
|
+
&:first-of-type {
|
|
48
|
+
border-left: var(--table-border);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:last-of-type {
|
|
52
|
+
border-right: var(--table-border);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&__sticky-header {
|
|
56
|
+
position: sticky;
|
|
57
|
+
top: 0;
|
|
58
|
+
z-index: 4;
|
|
59
|
+
background-color: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__sticky-column {
|
|
63
|
+
z-index: 5;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&--has-filters {
|
|
68
|
+
.purpur-table-row {
|
|
69
|
+
vertical-align: baseline;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.purpur-table-column-header-cell {
|
|
75
|
+
padding: var(--purpur-spacing-150) var(--purpur-spacing-150) var(--purpur-spacing-150)
|
|
76
|
+
var(--purpur-spacing-300);
|
|
77
|
+
border-bottom: var(--table-border);
|
|
78
|
+
text-align: left;
|
|
79
|
+
|
|
80
|
+
&__checkbox {
|
|
81
|
+
vertical-align: middle;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&__border-radius-first-cell {
|
|
85
|
+
border-top-left-radius: var(--table-border-radius);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__border-radius-last-cell {
|
|
89
|
+
border-top-right-radius: var(--table-border-radius);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&__content {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
align-items: flex-start;
|
|
96
|
+
gap: var(--purpur-spacing-100);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&__title {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
gap: var(--purpur-spacing-50);
|
|
103
|
+
align-self: stretch;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__sortable-title {
|
|
107
|
+
padding-left: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&__filter-wrapper {
|
|
111
|
+
display: flex;
|
|
112
|
+
padding-right: var(--purpur-spacing-150);
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
align-items: flex-start;
|
|
115
|
+
gap: var(--purpur-spacing-100);
|
|
116
|
+
align-self: stretch;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.purpur-table-row {
|
|
121
|
+
.purpur-table-row-cell {
|
|
122
|
+
&:first-of-type {
|
|
123
|
+
border-left: var(--table-border);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&:last-of-type {
|
|
127
|
+
border-right: var(--table-border);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&.purpur-table-row-cell__border-radius-first-cell {
|
|
131
|
+
border-bottom-left-radius: var(--table-border-radius);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.purpur-table-row-cell__border-radius-last-cell {
|
|
135
|
+
border-bottom-right-radius: var(--table-border-radius);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:last-of-type {
|
|
140
|
+
.purpur-table-row-cell {
|
|
141
|
+
border-bottom: var(--table-border);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&:has(.purpur-table-row-cell__row-selection),
|
|
146
|
+
&:has(.purpur-table-row-cell__row-toggle) {
|
|
147
|
+
.purpur-table-row-cell:hover {
|
|
148
|
+
&:first-of-type {
|
|
149
|
+
&::before {
|
|
150
|
+
content: "";
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: calc(-1 * var(--purpur-border-width-xs));
|
|
153
|
+
top: 0;
|
|
154
|
+
bottom: 0;
|
|
155
|
+
width: var(--purpur-border-width-md);
|
|
156
|
+
background-color: var(--purpur-color-border-weak);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&--selected td:first-of-type {
|
|
163
|
+
&::before {
|
|
164
|
+
content: "";
|
|
165
|
+
position: absolute;
|
|
166
|
+
left: calc(-1 * var(--purpur-border-width-xs));
|
|
167
|
+
top: 0;
|
|
168
|
+
bottom: 0;
|
|
169
|
+
width: var(--purpur-border-width-md);
|
|
170
|
+
background-color: var(--purpur-color-border-interactive-primary);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.purpur-table-column-header-cell,
|
|
176
|
+
.purpur-table-row-cell {
|
|
177
|
+
&__sticky-column {
|
|
178
|
+
position: sticky;
|
|
179
|
+
left: 0;
|
|
180
|
+
z-index: 3;
|
|
181
|
+
background-color: inherit;
|
|
182
|
+
|
|
183
|
+
& + .purpur-table-column-header-cell__sticky-column,
|
|
184
|
+
& + .purpur-table-row-cell__sticky-column {
|
|
185
|
+
left: 73px; // 73px is the width of the first column when row selection/toggle is enabled. This rule is only applied when the row selection/toggle is enabled.
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__with-sticky-border {
|
|
189
|
+
border-right: var(--purpur-border-width-sm) solid var(--purpur-color-border-base);
|
|
190
|
+
box-shadow: var(--purpur-border-width-sm) 0 calc(2 * var(--purpur-border-width-sm))
|
|
191
|
+
rgba(0, 0, 0, 0.05);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.purpur-table-row-cell {
|
|
197
|
+
height: var(--purpur-spacing-1200);
|
|
198
|
+
padding: var(--purpur-spacing-0) var(--purpur-spacing-300);
|
|
199
|
+
align-items: center;
|
|
200
|
+
align-self: stretch;
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
text-overflow: ellipsis;
|
|
203
|
+
|
|
204
|
+
&__date {
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
gap: var(--purpur-spacing-100);
|
|
208
|
+
flex: 1 0 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&__icon-text {
|
|
212
|
+
display: flex;
|
|
213
|
+
padding: var(--purpur-spacing-0) var(--purpur-spacing-300);
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: var(--purpur-spacing-100);
|
|
216
|
+
flex-shrink: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&__error-message,
|
|
220
|
+
&__warning-message {
|
|
221
|
+
display: flex;
|
|
222
|
+
padding: var(--purpur-spacing-0) var(--purpur-spacing-300);
|
|
223
|
+
align-items: center;
|
|
224
|
+
gap: var(--purpur-spacing-100);
|
|
225
|
+
flex-shrink: 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&__row-toggle {
|
|
229
|
+
$target-area-size: calc(var(--purpur-spacing-400) + var(--purpur-spacing-150));
|
|
230
|
+
$radio-size: var(--purpur-spacing-300);
|
|
231
|
+
|
|
232
|
+
display: inline-flex;
|
|
233
|
+
padding: calc(calc($target-area-size - $radio-size) / 2);
|
|
234
|
+
margin: 0;
|
|
235
|
+
align-items: center;
|
|
236
|
+
background: var(--purpur-color-background-primary);
|
|
237
|
+
width: var(--purpur-spacing-300);
|
|
238
|
+
height: var(--purpur-spacing-300);
|
|
239
|
+
aspect-ratio: 1/1;
|
|
240
|
+
accent-color: var(--purpur-color-background-interactive-primary);
|
|
241
|
+
|
|
242
|
+
&:hover {
|
|
243
|
+
border-left: var(--purpur-border-width-md) solid var(--purpur-color-border-weak);
|
|
244
|
+
accent-color: var(--purpur-color-background-interactive-primary);
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
|
|
247
|
+
&:disabled,
|
|
248
|
+
&[aria-checked="true"] {
|
|
249
|
+
cursor: default;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&:active {
|
|
254
|
+
outline: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&:focus {
|
|
258
|
+
outline: none;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&__right-align {
|
|
263
|
+
text-align: right;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
&__truncate {
|
|
267
|
+
position: relative;
|
|
268
|
+
max-width: 100%;
|
|
269
|
+
width: 100%;
|
|
270
|
+
|
|
271
|
+
a,
|
|
272
|
+
p,
|
|
273
|
+
span,
|
|
274
|
+
div {
|
|
275
|
+
display: block;
|
|
276
|
+
overflow: hidden;
|
|
277
|
+
white-space: nowrap;
|
|
278
|
+
text-overflow: ellipsis;
|
|
279
|
+
max-width: 100%;
|
|
280
|
+
width: inherit;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
&__skeleton {
|
|
285
|
+
height: 30%;
|
|
286
|
+
width: 100%;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&__tooltip-content {
|
|
290
|
+
z-index: 10;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.purpur-table--primary {
|
|
295
|
+
.purpur-table-header {
|
|
296
|
+
.purpur-table-row {
|
|
297
|
+
background: var(--purpur-color-background-primary);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.purpur-table-body {
|
|
302
|
+
.purpur-table-row {
|
|
303
|
+
background: var(--purpur-color-background-primary);
|
|
304
|
+
|
|
305
|
+
&:nth-of-type(odd) {
|
|
306
|
+
background: var(--purpur-color-background-secondary);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.purpur-table--secondary {
|
|
313
|
+
.purpur-table-header {
|
|
314
|
+
.purpur-table-row {
|
|
315
|
+
background: var(--purpur-color-background-secondary);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.purpur-table-body {
|
|
320
|
+
.purpur-table-row {
|
|
321
|
+
background: var(--purpur-color-background-secondary);
|
|
322
|
+
|
|
323
|
+
&:nth-of-type(odd) {
|
|
324
|
+
background: var(--purpur-color-background-primary);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.purpur-table__empty-section {
|
|
331
|
+
display: flex;
|
|
332
|
+
padding: var(--purpur-spacing-250) var(--purpur-spacing-400) var(--purpur-spacing-400)
|
|
333
|
+
var(--purpur-spacing-400);
|
|
334
|
+
flex-direction: column;
|
|
335
|
+
justify-content: center;
|
|
336
|
+
align-items: center;
|
|
337
|
+
gap: var(--purpur-spacing-150);
|
|
338
|
+
align-self: stretch;
|
|
339
|
+
|
|
340
|
+
&__icon {
|
|
341
|
+
width: var(--purpur-spacing-1600);
|
|
342
|
+
height: var(--purpur-spacing-1600);
|
|
343
|
+
aspect-ratio: 1/1;
|
|
344
|
+
opacity: 0.9;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&__texts {
|
|
348
|
+
display: flex;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
align-items: center;
|
|
351
|
+
gap: var(--purpur-spacing-100);
|
|
352
|
+
align-self: stretch;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
&--primary {
|
|
356
|
+
background: var(--purpur-color-background-secondary);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&--secondary {
|
|
360
|
+
background: var(--purpur-color-background-primary);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@media (min-width: $purpur-breakpoint-md) {
|
|
364
|
+
padding: var(--purpur-spacing-250) var(--purpur-spacing-0) var(--purpur-spacing-400)
|
|
365
|
+
var(--purpur-spacing-0);
|
|
366
|
+
}
|
|
367
|
+
}
|