tuix-webcomponents 0.93.0 → 0.95.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.
@@ -1,11 +1,43 @@
1
- import { css } from 'lit';
1
+ import { css, unsafeCSS } from 'lit';
2
2
  import { ScreenSizes } from '../utils/screenSizes.enum';
3
- export const tableStyles = css `
3
+ import { Palette } from '../utils/colors';
4
+ import { DarkPalette } from '../utils/darkColors';
5
+ import { LINK_TEXT_COLOR_VAR_NAME } from '../tuix-link/TuixLink.styles';
6
+ export const tableHostStyles = css `
4
7
  :host {
5
8
  display: block;
6
9
  width: 100%;
10
+
11
+ --t-table-header-bg: ${unsafeCSS(Palette.PRIMARY_100)};
12
+ --t-table-header-text-color: ${unsafeCSS(Palette.PRIMARY_700)};
13
+ --t-table-header-focus-color: ${unsafeCSS(Palette.MAIN)};
14
+ --t-table-cell-bg: ${unsafeCSS(Palette.WHITE)};
15
+ --t-table-cell-border-color: ${unsafeCSS(Palette.NEUTRAL_200)};
16
+ --t-table-entity-border-color: ${unsafeCSS(Palette.MAIN)};
17
+ --t-table-row-border-color: ${unsafeCSS(Palette.NEUTRAL_200)};
18
+ --t-table-mobile-header-bg: ${unsafeCSS(Palette.SECTION_BG)};
19
+ --t-table-footer-bg: ${unsafeCSS(Palette.WHITE)};
20
+ --t-table-dropdown-stroke: ${unsafeCSS(Palette.NEUTRAL_200)};
21
+ --t-table-dropdown-text-color: ${unsafeCSS(Palette.BLACK)};
22
+ --t-table-dropdown-option-bg: ${unsafeCSS(Palette.WHITE)};
7
23
  }
8
24
 
25
+ :host([dark]) {
26
+ --t-table-header-bg: ${unsafeCSS(DarkPalette.PRIMARY_800)};
27
+ --t-table-header-text-color: ${unsafeCSS(DarkPalette.WHITE)};
28
+ --t-table-header-focus-color: ${unsafeCSS(DarkPalette.PRIMARY_300)};
29
+ --t-table-cell-bg: ${unsafeCSS(DarkPalette.BLACK)};
30
+ --t-table-cell-border-color: ${unsafeCSS(DarkPalette.PRIMARY_800)};
31
+ --t-table-entity-border-color: ${unsafeCSS(DarkPalette.PRIMARY_800)};
32
+ --t-table-row-border-color: ${unsafeCSS(DarkPalette.ELEVATION_4)};
33
+ --t-table-mobile-header-bg: ${unsafeCSS(DarkPalette.PRIMARY_800)};
34
+ --t-table-footer-bg: ${unsafeCSS(DarkPalette.PRIMARY_900)};
35
+ --t-table-dropdown-stroke: ${unsafeCSS(DarkPalette.PRIMARY_800)};
36
+ --t-table-dropdown-text-color: ${unsafeCSS(DarkPalette.PRIMARY_50)};
37
+ --t-table-dropdown-option-bg: ${unsafeCSS(DarkPalette.ELEVATION_2)};
38
+ }
39
+ `;
40
+ export const tableStyles = css `
9
41
  .table_wrapper {
10
42
  width: 100%;
11
43
  overflow-x: auto;
@@ -18,23 +50,68 @@ export const tableStyles = css `
18
50
  border-collapse: collapse;
19
51
  }
20
52
 
53
+ thead {
54
+ background-color: var(--t-table-header-bg);
55
+ }
56
+
21
57
  thead th {
22
58
  box-sizing: border-box;
23
- padding: 8px;
59
+ padding: 8px 16px;
24
60
  text-align: left;
25
61
  overflow: hidden;
62
+ }
63
+
64
+ thead th.sortable {
65
+ cursor: pointer;
66
+ }
67
+
68
+ thead th.sortable:focus-visible {
69
+ outline: 2px solid var(--t-table-header-focus-color);
70
+ outline-offset: -2px;
71
+ }
72
+
73
+ thead th .header-cell {
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: space-between;
77
+ gap: 8px;
78
+
79
+ ${unsafeCSS(LINK_TEXT_COLOR_VAR_NAME)}: var(--t-table-header-text-color);
80
+ }
81
+
82
+ thead th .header-cell .header-name {
83
+ overflow: hidden;
26
84
  text-overflow: ellipsis;
27
85
  white-space: nowrap;
28
86
  }
29
87
 
88
+ thead th .sort-icons {
89
+ display: flex;
90
+ flex-direction: column;
91
+ flex-shrink: 0;
92
+ }
93
+
94
+ thead th .sort-icons tuix-icon {
95
+ height: 12px;
96
+ display: flex;
97
+ align-items: center;
98
+ }
99
+
30
100
  tbody tr td {
101
+ border-bottom: 1px solid var(--t-table-cell-border-color);
31
102
  box-sizing: border-box;
32
103
  height: 52px;
33
- padding: 6px 8px;
104
+ padding: 6px 16px;
34
105
  text-align: left;
35
- overflow: hidden;
36
- text-overflow: ellipsis;
37
- white-space: nowrap;
106
+ overflow-x: auto;
107
+ scrollbar-width: none;
108
+ background-color: var(--t-table-cell-bg);
109
+ }
110
+
111
+ tbody tr td::-webkit-scrollbar {
112
+ width: 0;
113
+ height: 0;
114
+ display: none;
38
115
  }
39
116
 
40
117
  ::slotted(*) {
@@ -47,12 +124,15 @@ export const tableStyles = css `
47
124
  .dropdown_container {
48
125
  position: relative;
49
126
  border-radius: 4px;
127
+ outline: 1px solid var(--t-table-dropdown-stroke);
50
128
  }
51
129
 
52
130
  .dropdown_container .items-per-page-dropdown {
53
131
  width: 55px;
54
132
  border: none;
55
133
  background-color: transparent;
134
+ color: var(--t-table-dropdown-text-color);
135
+ font-family: 'Rubik', sans-serif;
56
136
  padding: 8px;
57
137
  cursor: pointer;
58
138
  -webkit-appearance: none;
@@ -60,6 +140,10 @@ export const tableStyles = css `
60
140
  appearance: none;
61
141
  }
62
142
 
143
+ .dropdown_container .items-per-page-dropdown option {
144
+ background-color: var(--t-table-dropdown-option-bg);
145
+ }
146
+
63
147
  .dropdown_container .items-per-page-dropdown:focus-visible {
64
148
  border: none;
65
149
  outline: none;
@@ -80,6 +164,7 @@ export const tableStyles = css `
80
164
  display: flex;
81
165
  justify-content: space-between;
82
166
  align-items: center;
167
+ background-color: var(--t-table-footer-bg);
83
168
  box-sizing: border-box;
84
169
  }
85
170
 
@@ -98,35 +183,61 @@ export const tableStyles = css `
98
183
  footer.table_footer .navigation .buttons {
99
184
  display: flex;
100
185
  gap: 8px;
186
+ }
187
+
188
+ footer.table_footer .navigation .buttons .arrow {
101
189
  cursor: pointer;
102
190
  }
103
191
 
104
- .mobile_table {
105
- display: none;
192
+ .mobile_table .table_entity {
193
+ border-bottom: 2px solid var(--t-table-entity-border-color);
194
+ }
195
+
196
+ .mobile_table .table_row {
197
+ display: flex;
198
+ border-bottom: 1px solid var(--t-table-row-border-color);
199
+ min-height: 40px;
200
+ }
201
+
202
+ .mobile_table .table_row > * {
203
+ padding: 0 16px;
204
+ width: 50%;
205
+ text-overflow: ellipsis;
206
+ overflow: hidden;
207
+ display: flex;
208
+ align-items: center;
209
+ }
210
+
211
+ .mobile_table .table_row .content {
212
+ padding: 12px 16px;
213
+ }
214
+
215
+ .mobile_table .table_row .content > * {
216
+ min-width: 0;
217
+ max-width: 100%;
218
+ }
219
+
220
+ .mobile_table .table_row .header {
221
+ background-color: var(--t-table-mobile-header-bg);
222
+
223
+ ${unsafeCSS(LINK_TEXT_COLOR_VAR_NAME)}: var(--t-table-header-text-color);
106
224
  }
107
225
 
108
226
  @media only screen and (max-width: ${ScreenSizes.TABLET}px) {
109
- .mobile_table {
110
- display: block;
227
+ footer.table_footer.sticky {
228
+ position: sticky;
229
+ bottom: 0;
111
230
  }
231
+ }
112
232
 
233
+ @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
113
234
  footer.table_footer {
114
- align-items: flex-start;
115
- gap: 8px;
116
- }
117
-
118
- .mobile_table .table_row {
119
- display: flex;
120
- min-height: 40px;
235
+ position: sticky;
236
+ bottom: 0;
121
237
  }
122
238
 
123
- .mobile_table .table_row > * {
124
- padding: 0 16px;
125
- width: 50%;
126
- text-overflow: ellipsis;
127
- overflow: hidden;
128
- display: flex;
129
- align-items: center;
239
+ footer.table_footer .navigation .buttons {
240
+ gap: 4px;
130
241
  }
131
242
  }
132
243
  `;
@@ -186,12 +297,4 @@ export const threeDots = css `
186
297
  width: 1px;
187
298
  white-space: nowrap;
188
299
  }
189
-
190
- .clientsLoader,
191
- .mobileClientsLoader,
192
- .tabletClientsLoader {
193
- display: flex;
194
- justify-content: center;
195
- padding: 16px 0;
196
- }
197
300
  `;
@@ -1,9 +1,12 @@
1
+ export type SortDirection = 'asc' | 'desc';
1
2
  export interface IDataTableHeader<TRowData = Record<string, unknown>> {
2
3
  cellColor?: (rowData: TRowData) => string | undefined;
4
+ cellBackgroundColor?: (rowData: TRowData) => string | undefined;
3
5
  isSlot?: boolean;
4
6
  slotName?: string;
5
7
  name?: string;
6
8
  dataKey: Extract<keyof TRowData, string>;
9
+ sortKey?: Extract<keyof TRowData, string>;
7
10
  width: number;
8
11
  }
9
12
  export interface TablePaginationProps {
@@ -37,9 +40,17 @@ export interface TuixTableElement<TRowData = any> extends HTMLElement {
37
40
  disableMobileTable?: boolean;
38
41
  pageSizeOptions?: number[];
39
42
  loader?: ThreeDotsLoaderConfig;
43
+ dark?: boolean;
44
+ sortBy?: string;
45
+ sortDirection?: SortDirection;
40
46
  }
41
47
  export interface PaginationEventDetail {
42
48
  page: number;
43
49
  pageSize: number;
44
50
  }
51
+ export interface SortEventDetail {
52
+ sortKey: string;
53
+ sortDirection: SortDirection;
54
+ }
45
55
  export type TuixPaginationEvent = CustomEvent<PaginationEventDetail>;
56
+ export type TuixSortEvent = CustomEvent<SortEventDetail>;
package/package.json CHANGED
@@ -138,5 +138,5 @@
138
138
  "test": "echo \"No tests configured\""
139
139
  },
140
140
  "type": "module",
141
- "version": "0.93.0"
141
+ "version": "0.95.0"
142
142
  }