@fluid-topics/ftds-table 2.1.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.
@@ -0,0 +1,49 @@
1
+ import { TemplateResult } from "lit";
2
+ export type Getter<T> = (o: T) => any;
3
+ export declare enum FtColumnAlignment {
4
+ left = "left",
5
+ center = "center",
6
+ right = "right"
7
+ }
8
+ export interface ColumnConfiguration<T> {
9
+ title: string | TemplateResult;
10
+ titleText?: string;
11
+ getter: string | Getter<T>;
12
+ render?: (value: any, index: number) => string | TemplateResult;
13
+ styles?: FtColumnStyles;
14
+ sortable?: boolean;
15
+ defaultSortOrder?: "asc" | "desc";
16
+ comparator?: (a: any, b: any) => number;
17
+ textAlign?: FtColumnAlignment;
18
+ }
19
+ export interface FtColumnStyles {
20
+ headerCell: {
21
+ [key: string]: any;
22
+ };
23
+ }
24
+ export interface EmptyStateConfiguration {
25
+ noImage: boolean;
26
+ content: string | TemplateResult;
27
+ }
28
+ export interface Sort {
29
+ column: number;
30
+ order: "asc" | "desc";
31
+ }
32
+ export declare class RowClickEvent<T> extends CustomEvent<T> {
33
+ constructor(data: T);
34
+ }
35
+ export interface FtdsTableChangeEventDetail {
36
+ sort?: Sort;
37
+ }
38
+ export declare class FtdsTableChangeEvent extends CustomEvent<FtdsTableChangeEventDetail> {
39
+ constructor(detail: FtdsTableChangeEventDetail);
40
+ }
41
+ export interface FtdsTableProperties<T extends Record<string, any>> {
42
+ data: Array<T>;
43
+ columns: Array<ColumnConfiguration<T>>;
44
+ sort?: Sort;
45
+ stickyHeaders: boolean;
46
+ disableDataManipulation: boolean;
47
+ clickableRows: boolean;
48
+ ariaLabel: string | null;
49
+ }
@@ -0,0 +1,16 @@
1
+ export var FtColumnAlignment;
2
+ (function (FtColumnAlignment) {
3
+ FtColumnAlignment["left"] = "left";
4
+ FtColumnAlignment["center"] = "center";
5
+ FtColumnAlignment["right"] = "right";
6
+ })(FtColumnAlignment || (FtColumnAlignment = {}));
7
+ export class RowClickEvent extends CustomEvent {
8
+ constructor(data) {
9
+ super("row-click", { detail: data });
10
+ }
11
+ }
12
+ export class FtdsTableChangeEvent extends CustomEvent {
13
+ constructor(detail) {
14
+ super("change", { detail: detail });
15
+ }
16
+ }
@@ -0,0 +1,2 @@
1
+ export { table as FtdsTableCssVariables } from "@fluid-topics/design-system-variables";
2
+ export declare const designSystemStyles: import("lit").CSSResult;
@@ -0,0 +1,161 @@
1
+ import { css } from "lit";
2
+ import { table } from "@fluid-topics/design-system-variables";
3
+ export { table as FtdsTableCssVariables } from "@fluid-topics/design-system-variables";
4
+ // language=css
5
+ export const designSystemStyles = css `
6
+ :host {
7
+ display: block;
8
+ }
9
+
10
+ .table {
11
+ border-collapse: separate;
12
+ border-spacing: 0;
13
+ width: 100%;
14
+ }
15
+
16
+ .header {
17
+ color: ${table.headerRowColor};
18
+ }
19
+
20
+ .row {
21
+ color: ${table.dataRowColor};
22
+ position: relative;
23
+ background-color: ${table.dataRowBackgroundColor};
24
+ border-bottom: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
25
+ border-left: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
26
+ border-right: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
27
+ }
28
+
29
+ .row:hover {
30
+ background-color: ${table.dataRowDefaultHoverBackgroundColor};
31
+ }
32
+
33
+ .row.row--clickable:hover {
34
+ background-color: ${table.dataRowClickableHoverBackgroundColor};
35
+ cursor: pointer;
36
+ }
37
+
38
+ .row.row--highlighted,
39
+ .row.row--clickable:focus-within {
40
+ background-color: ${table.dataRowClickableFocusBackgroundColor};
41
+ outline: 1px solid ${table.dataRowClickableFocusBorderColor};
42
+ z-index: 15;
43
+ }
44
+
45
+ .row.row--clickable.row--active {
46
+ background-color: ${table.dataRowClickableActiveBackgroundColor};
47
+ }
48
+
49
+ .header {
50
+ background-color: ${table.headerRowBackgroundColor};
51
+ }
52
+
53
+ .header--sticky {
54
+ top: 0;
55
+ z-index: 2;
56
+ position: sticky;
57
+ }
58
+
59
+ .header-cell {
60
+ padding: ${table.headerCellVerticalPadding} ${table.headerCellHorizontalPadding};
61
+ vertical-align: baseline;
62
+ }
63
+
64
+ .header-cell--sticky {
65
+ top: 0;
66
+ z-index: 10;
67
+ position: sticky;
68
+
69
+ &:focus-within {
70
+ z-index: 11;
71
+ }
72
+
73
+ &:hover {
74
+ z-index: 12;
75
+ }
76
+ }
77
+
78
+ .header > .header-cell {
79
+ border-top: ${table.headerRowBorderWidth} solid ${table.headerRowBorderColor};
80
+ border-bottom: ${table.headerRowBorderWidth} solid ${table.headerRowBorderColor};
81
+ }
82
+
83
+ .header > .header-cell:first-of-type {
84
+ border-left: ${table.headerRowBorderWidth} solid ${table.headerRowBorderColor};
85
+ }
86
+
87
+ .header > .header-cell:last-of-type {
88
+ border-right: ${table.headerRowBorderWidth} solid ${table.headerRowBorderColor};
89
+ }
90
+
91
+ .column-title-container {
92
+ display: flex;
93
+ row-gap: ${table.headerCellHorizontalGap};
94
+ align-items: baseline;
95
+ }
96
+
97
+ .column-title-container--text-align-right {
98
+ justify-content: flex-end;
99
+ margin-right: -.5rem;
100
+ }
101
+
102
+ .column-title-container--text-align-center {
103
+ justify-content: center;
104
+ }
105
+
106
+ .column-title {
107
+ white-space: normal;
108
+ margin: 0 .5rem 0 0;
109
+ height: 100%;
110
+ display: flex;
111
+ align-items: center;
112
+ text-align: start;
113
+ }
114
+
115
+ .cell {
116
+ padding: ${table.dataCellVerticalPadding} ${table.dataCellHorizontalPadding};
117
+ overflow-x: auto;
118
+ position: relative;
119
+ }
120
+
121
+ .cell:not(.no-content) ftds-typography {
122
+ display: flex;
123
+ flex-wrap: wrap;
124
+ column-gap: ${table.dataCellVerticalGap};
125
+ }
126
+
127
+ .cell--text-align-right ftds-typography {
128
+ justify-content: flex-end;
129
+ }
130
+
131
+ .cell--text-align-center ftds-typography {
132
+ justify-content: center;
133
+ }
134
+
135
+ .row > .cell {
136
+ border-bottom: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
137
+ }
138
+
139
+ .row > .cell:first-of-type {
140
+ border-left: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
141
+ }
142
+
143
+ .row > .cell:last-of-type {
144
+ border-right: ${table.dataRowBorderWidth} solid ${table.dataRowBorderColor};
145
+ }
146
+
147
+ .no-content svg {
148
+ margin-bottom: 24px;
149
+ }
150
+
151
+ .no-content {
152
+ width: 100%;
153
+ text-align: center;
154
+ padding: 24px;
155
+ }
156
+
157
+ td.no-content > ftds-typography {
158
+ display: flex;
159
+ justify-content: center;
160
+ }
161
+ `;
@@ -0,0 +1,4 @@
1
+ export * from "./ftds-table.properties";
2
+ export * from "./ftds-table.styles";
3
+ export * from "./ftds-table";
4
+ import "./define";
package/build/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./ftds-table.properties";
2
+ export * from "./ftds-table.styles";
3
+ export * from "./ftds-table";
4
+ import "./define";
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@fluid-topics/ftds-table",
3
+ "version": "2.1.0",
4
+ "description": "The design system table component",
5
+ "keywords": [
6
+ "Lit"
7
+ ],
8
+ "author": "Fluid Topics <devtopics@antidot.net>",
9
+ "license": "ISC",
10
+ "main": "build/index.js",
11
+ "web": "build/ftds-table.min.js",
12
+ "typings": "build/index",
13
+ "files": [
14
+ "build/**/*.js",
15
+ "build/**/*.ts"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
+ },
21
+ "dependencies": {
22
+ "@fluid-topics/design-system-variables": "3.5.0",
23
+ "@fluid-topics/ft-assets": "2.1.0",
24
+ "@fluid-topics/ft-wc-utils": "2.1.0",
25
+ "@fluid-topics/ftds-button": "2.1.0",
26
+ "@fluid-topics/ftds-icon": "2.1.0",
27
+ "@fluid-topics/ftds-typography": "2.1.0",
28
+ "lit": "3.1.0"
29
+ },
30
+ "devDependencies": {
31
+ "@fluid-topics/ft-wc-test-utils": "2.1.0"
32
+ },
33
+ "gitHead": "4727cf19d04236ad1d2b2cb43ce1c46298834c7e"
34
+ }