tuix-webcomponents 0.0.21 → 0.0.24

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 (116) hide show
  1. package/README.md +110 -4
  2. package/dist/assets/tuix-styles.css +72 -0
  3. package/dist/src/index.d.ts +34 -1
  4. package/dist/src/index.js +26 -16
  5. package/dist/src/react/index.d.ts +42 -0
  6. package/dist/src/react/index.js +114 -0
  7. package/dist/src/tuix-button/TuixBaseButton.d.ts +17 -0
  8. package/dist/src/tuix-button/TuixBaseButton.js +60 -0
  9. package/dist/src/tuix-button/TuixButton.d.ts +11 -0
  10. package/dist/src/tuix-button/TuixButton.js +84 -0
  11. package/dist/src/tuix-button/TuixButton.styles.d.ts +3 -0
  12. package/dist/src/tuix-button/TuixButton.styles.js +107 -0
  13. package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +2 -0
  14. package/dist/src/tuix-button/enums/tuix-button.enums.js +6 -0
  15. package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +1 -0
  16. package/dist/src/tuix-button/interfaces/tuix-button.interface.js +1 -0
  17. package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +17 -0
  18. package/dist/src/tuix-checkbox/TuixCheckbox.js +108 -0
  19. package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +4 -0
  20. package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +132 -0
  21. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +21 -0
  22. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +23 -0
  23. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +5 -0
  24. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +1 -0
  25. package/dist/src/tuix-dropdown/TuixDropdown.d.ts +56 -0
  26. package/dist/src/tuix-dropdown/TuixDropdown.js +361 -0
  27. package/dist/src/tuix-dropdown/TuixDropdown.styles.d.ts +3 -0
  28. package/dist/src/tuix-dropdown/TuixDropdown.styles.js +125 -0
  29. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +4 -0
  30. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +5 -0
  31. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +15 -0
  32. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +1 -0
  33. package/dist/src/tuix-icon/TuixIcon.d.ts +15 -0
  34. package/dist/src/tuix-icon/TuixIcon.icons.d.ts +6 -0
  35. package/dist/src/tuix-icon/TuixIcon.icons.js +395 -0
  36. package/dist/src/tuix-icon/TuixIcon.js +79 -0
  37. package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +89 -0
  38. package/dist/src/tuix-icon/enums/tuix-icon.enums.js +96 -0
  39. package/dist/src/tuix-icon-button/TuixIconButton.d.ts +9 -0
  40. package/dist/src/tuix-icon-button/TuixIconButton.js +51 -0
  41. package/dist/src/tuix-input/TuixInput.d.ts +52 -0
  42. package/dist/src/tuix-input/TuixInput.js +374 -0
  43. package/dist/src/tuix-input/TuixInput.styles.d.ts +8 -0
  44. package/dist/src/tuix-input/TuixInput.styles.js +296 -0
  45. package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +38 -0
  46. package/dist/src/tuix-input/enums/tuix-input.enums.js +41 -0
  47. package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +18 -0
  48. package/dist/src/tuix-input/interfaces/tuix-input.interface.js +5 -0
  49. package/dist/src/tuix-link/TuixLink.d.ts +15 -0
  50. package/dist/src/tuix-link/TuixLink.js +71 -0
  51. package/dist/src/tuix-link/TuixLink.styles.d.ts +2 -0
  52. package/dist/src/tuix-link/TuixLink.styles.js +55 -0
  53. package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +6 -0
  54. package/dist/src/tuix-link/enums/linkTarget.enum.js +7 -0
  55. package/dist/src/tuix-modal/TuixModal.d.ts +11 -0
  56. package/dist/src/tuix-modal/TuixModal.js +65 -0
  57. package/dist/src/tuix-modal/TuixModal.styles.d.ts +2 -0
  58. package/dist/src/tuix-modal/TuixModal.styles.js +55 -0
  59. package/dist/src/tuix-paper/TuixPaper.d.ts +10 -0
  60. package/dist/src/tuix-paper/TuixPaper.js +46 -0
  61. package/dist/src/tuix-paper/TuixPaper.styles.d.ts +1 -0
  62. package/dist/src/tuix-paper/TuixPaper.styles.js +30 -0
  63. package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +13 -0
  64. package/dist/src/tuix-paper/enums/tuix-paper.enum.js +15 -0
  65. package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +17 -0
  66. package/dist/src/tuix-radio-button/TuixRadioButton.js +96 -0
  67. package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +5 -0
  68. package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +135 -0
  69. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +3 -0
  70. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +1 -0
  71. package/dist/src/tuix-table/TuixTable.d.ts +48 -0
  72. package/dist/src/tuix-table/TuixTable.js +369 -0
  73. package/dist/src/tuix-table/TuixTable.styles.d.ts +2 -0
  74. package/dist/src/tuix-table/TuixTable.styles.js +197 -0
  75. package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +45 -0
  76. package/dist/src/tuix-table/interfaces/tuix-table.interface.js +1 -0
  77. package/dist/src/tuix-text/TuixText.d.ts +7 -5
  78. package/dist/src/tuix-text/TuixText.js +45 -137
  79. package/dist/src/tuix-text/TuixText.styles.d.ts +2 -0
  80. package/dist/src/tuix-text/TuixText.styles.js +195 -0
  81. package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +36 -0
  82. package/dist/src/tuix-text/enums/tuix-text.enums.js +72 -0
  83. package/dist/src/tuix-toast/TuixToast.d.ts +18 -0
  84. package/dist/src/tuix-toast/TuixToast.js +103 -0
  85. package/dist/src/tuix-toast/TuixToast.styles.d.ts +3 -0
  86. package/dist/src/tuix-toast/TuixToast.styles.js +43 -0
  87. package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +20 -0
  88. package/dist/src/tuix-toast/enums/tuix-toast.enums.js +59 -0
  89. package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +14 -0
  90. package/dist/src/tuix-toggle-button/TuixToggleButton.js +86 -0
  91. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +5 -0
  92. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +134 -0
  93. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +2 -0
  94. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +1 -0
  95. package/dist/src/utils/colors.d.ts +30 -10
  96. package/dist/src/utils/colors.js +31 -11
  97. package/dist/src/utils/darkColors.d.ts +32 -0
  98. package/dist/src/utils/darkColors.js +33 -0
  99. package/dist/src/utils/hex-rgb.d.ts +5 -0
  100. package/dist/src/utils/hex-rgb.js +15 -0
  101. package/dist/src/utils/interfaces/detail-value.interface.d.ts +3 -0
  102. package/dist/src/utils/interfaces/detail-value.interface.js +1 -0
  103. package/dist/src/utils/mainVariant.enum.d.ts +4 -0
  104. package/dist/src/utils/mainVariant.enum.js +5 -0
  105. package/dist/src/utils/screenSizes.enum.d.ts +4 -0
  106. package/dist/src/utils/screenSizes.enum.js +5 -0
  107. package/dist/src/utils/slottedClassName.d.ts +2 -0
  108. package/dist/src/utils/slottedClassName.js +1 -0
  109. package/package.json +118 -66
  110. package/dist/src/enums/tuix-text.enums.d.ts +0 -24
  111. package/dist/src/enums/tuix-text.enums.js +0 -29
  112. package/dist/src/enums/tuix-text.enums.js.map +0 -1
  113. package/dist/src/index.js.map +0 -1
  114. package/dist/src/tuix-text/TuixText.js.map +0 -1
  115. package/dist/src/utils/colors.js.map +0 -1
  116. package/dist/tsconfig.publish.tsbuildinfo +0 -1
@@ -0,0 +1,369 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { styleMap } from 'lit/directives/style-map.js';
5
+ import { repeat } from 'lit/directives/repeat.js';
6
+ import '../tuix-icon/TuixIcon.js';
7
+ import '../tuix-text/TuixText.js';
8
+ import { tableStyles, threeDots } from './TuixTable.styles.js';
9
+ import { TextSize, TextVariant } from '../tuix-text/enums/tuix-text.enums.js';
10
+ import { IconName } from '../tuix-icon/enums/tuix-icon.enums.js';
11
+ import { Palette } from '../utils/colors.js';
12
+ import { ScreenSizes } from '../utils/screenSizes.enum.js';
13
+ let TuixTable = class TuixTable extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.paginated = false;
17
+ this.disableMobileTable = false;
18
+ this.showMobileTableInTablet = false;
19
+ this.data = [];
20
+ this.headers = [];
21
+ this.pageSizeOptions = [5, 10, 20];
22
+ this.isLoadingData = false;
23
+ this._isTabletView = false;
24
+ this._isMobileView = false;
25
+ this._headerPercents = [];
26
+ this._onScreenSizeChange = () => {
27
+ this._isTabletView = !!this._mqTablet?.matches;
28
+ this._isMobileView = !!this._mqMobile?.matches;
29
+ };
30
+ this._nextPage = () => {
31
+ if (this.currentPage === this.totalPages)
32
+ return;
33
+ const next = Math.min(this.totalPages, this._effectiveCurrentPage + 1);
34
+ const detail = {
35
+ page: next,
36
+ pageSize: this._effectivePageSize,
37
+ };
38
+ this.dispatchEvent(new CustomEvent('next-page', {
39
+ detail,
40
+ bubbles: true,
41
+ composed: true,
42
+ }));
43
+ };
44
+ this._prevPage = () => {
45
+ if (this.currentPage === 1)
46
+ return;
47
+ const prev = Math.max(1, this._effectiveCurrentPage - 1);
48
+ const detail = {
49
+ page: prev,
50
+ pageSize: this._effectivePageSize,
51
+ };
52
+ this.dispatchEvent(new CustomEvent('previous-page', {
53
+ detail,
54
+ bubbles: true,
55
+ composed: true,
56
+ }));
57
+ };
58
+ this._setPageSize = (value) => {
59
+ const newSize = Math.max(1, Math.floor(value));
60
+ const newPage = 1;
61
+ const detail = { page: newPage, pageSize: newSize };
62
+ this.dispatchEvent(new CustomEvent('page-size-change', {
63
+ detail,
64
+ bubbles: true,
65
+ composed: true,
66
+ }));
67
+ };
68
+ }
69
+ static { this.styles = [tableStyles, threeDots]; }
70
+ connectedCallback() {
71
+ super.connectedCallback();
72
+ this._mqTablet = window.matchMedia(`(max-width:${ScreenSizes.TABLET}px)`);
73
+ this._mqMobile = window.matchMedia(`(max-width:${ScreenSizes.MOBILE}px)`);
74
+ this._onScreenSizeChange();
75
+ this._mqTablet.addEventListener('change', this._onScreenSizeChange);
76
+ this._mqMobile.addEventListener('change', this._onScreenSizeChange);
77
+ this._computeHeaderPercents();
78
+ }
79
+ disconnectedCallback() {
80
+ super.disconnectedCallback();
81
+ this._mqTablet?.removeEventListener('change', this._onScreenSizeChange);
82
+ this._mqMobile?.removeEventListener('change', this._onScreenSizeChange);
83
+ }
84
+ updated(changedProps) {
85
+ if (changedProps.has('headers'))
86
+ this._computeHeaderPercents();
87
+ }
88
+ get _effectiveTotalItems() {
89
+ return this.totalItems ?? this.data.length;
90
+ }
91
+ get _effectiveCurrentPage() {
92
+ return this.currentPage ?? 1;
93
+ }
94
+ get _effectivePageSize() {
95
+ return this.currentSize ?? this.pageSizeOptions[0];
96
+ }
97
+ get totalPages() {
98
+ const denom = this._effectivePageSize;
99
+ return Math.max(1, Math.ceil(this._effectiveTotalItems / denom));
100
+ }
101
+ get _paginationProps() {
102
+ const totalItems = this._effectiveTotalItems;
103
+ const itemsPerPage = this._effectivePageSize;
104
+ const startItem = totalItems
105
+ ? (this._effectiveCurrentPage - 1) * itemsPerPage + 1
106
+ : 0;
107
+ const endItem = Math.min(this._effectiveCurrentPage * itemsPerPage, totalItems);
108
+ return {
109
+ totalItems,
110
+ currentPage: this._effectiveCurrentPage,
111
+ itemsPerPage,
112
+ startItem,
113
+ endItem,
114
+ onNextPage: this._nextPage,
115
+ onPreviousPage: this._prevPage,
116
+ onItemsPerPageChange: this._setPageSize,
117
+ isLoading: this.isLoadingData,
118
+ };
119
+ }
120
+ _computeHeaderPercents() {
121
+ const total = this.headers.reduce((acum, header) => acum + header.width, 0);
122
+ this._headerPercents =
123
+ total === 0
124
+ ? this.headers.map(() => 100 / this.headers.length)
125
+ : this.headers.map(header => (header.width / total) * 100);
126
+ }
127
+ _cellStyleString() {
128
+ return `border-bottom:1px solid ${Palette.NEUTRAL_200};`;
129
+ }
130
+ _textVariantColor(header, row) {
131
+ const color = header.cellColor
132
+ ? header.cellColor(row)
133
+ : TextVariant.PRIMARY;
134
+ return color;
135
+ }
136
+ _renderHeaderCells() {
137
+ return html `<tr>
138
+ ${this.headers.map((header, idx) => html `<th
139
+ style=${styleMap({
140
+ width: `${this._headerPercents[idx]}%`,
141
+ color: Palette.WHITE,
142
+ })}
143
+ >
144
+ <tuix-text size=${TextSize.Body1} color=${TextVariant.SECONDARY}
145
+ >${header.name}</tuix-text
146
+ >
147
+ </th>`)}
148
+ </tr>`;
149
+ }
150
+ _renderCell(header, row) {
151
+ if (header.isSlot) {
152
+ const slotName = `${header.slotName}-${row.id}`;
153
+ return html `<td style="${this._cellStyleString()}">
154
+ <slot name=${slotName}></slot>
155
+ </td>`;
156
+ }
157
+ const content = row[header.dataKey];
158
+ return html `<td style="${this._cellStyleString()}">
159
+ <tuix-text
160
+ size=${TextSize.Body1}
161
+ color=${this._textVariantColor(header, row)}
162
+ >${content}</tuix-text
163
+ >
164
+ </td>`;
165
+ }
166
+ _renderRows() {
167
+ const rows = this.data;
168
+ return repeat(rows, row => row.id, row => html `<tr>
169
+ ${this.headers.map(header => this._renderCell(header, row))}
170
+ </tr>`);
171
+ }
172
+ _onPageSizeChange(e) {
173
+ const selectedValue = parseInt(e.target.value);
174
+ this._setPageSize(selectedValue);
175
+ }
176
+ _renderPageSizeOptions() {
177
+ return this.pageSizeOptions.map(size => html `<option value=${size}>${size}</option>`);
178
+ }
179
+ _renderSpinner() {
180
+ const threeDotsConfiguration = {
181
+ size: '14px',
182
+ color: Palette.MAIN,
183
+ visible: true,
184
+ ariaLabel: 'Loading',
185
+ wrapperStyle: {
186
+ width: '100%',
187
+ display: 'flex',
188
+ justifyContent: 'center',
189
+ padding: '48px 0',
190
+ },
191
+ ...this.loader,
192
+ };
193
+ if (!threeDotsConfiguration.visible)
194
+ return null;
195
+ const wrapperVars = {
196
+ '--dot-size': threeDotsConfiguration.size,
197
+ '--dot-color': threeDotsConfiguration.color,
198
+ ...threeDotsConfiguration.wrapperStyle,
199
+ };
200
+ const aria = threeDotsConfiguration.ariaLabel;
201
+ return html `<div class="tuix-spinner-wrapper">
202
+ <div
203
+ class="three-dots-wrapper"
204
+ role="status"
205
+ aria-label=${aria}
206
+ style=${styleMap(wrapperVars)}
207
+ >
208
+ <span class="dot" aria-hidden="true"></span>
209
+ <span class="dot" aria-hidden="true"></span>
210
+ <span class="dot" aria-hidden="true"></span>
211
+ <span class="sr-only">${aria}</span>
212
+ </div>
213
+ </div>`;
214
+ }
215
+ _renderPagination() {
216
+ const { totalItems, startItem, endItem, itemsPerPage, isLoading } = this._paginationProps;
217
+ return html `<footer
218
+ style="background-color:${Palette.SECTION_BG};"
219
+ class="table_footer sticky"
220
+ >
221
+ <div class="items-per-page">
222
+ <tuix-text size=${TextSize.Body2}>Items per page</tuix-text>
223
+ <div
224
+ style="outline: 1px solid ${Palette.NEUTRAL_200};"
225
+ class="dropdown_container"
226
+ >
227
+ <select
228
+ class="items-per-page-dropdown"
229
+ .value=${String(itemsPerPage)}
230
+ @change=${this._onPageSizeChange}
231
+ ?disabled=${isLoading}
232
+ >
233
+ ${this._renderPageSizeOptions()}
234
+ </select>
235
+ <tuix-icon
236
+ class="arrow-icon"
237
+ name=${IconName.CHEVRON_DOWN}
238
+ ></tuix-icon>
239
+ </div>
240
+ </div>
241
+
242
+ <div class="navigation">
243
+ <tuix-text size=${TextSize.Body2}
244
+ >${startItem} - ${endItem} of ${totalItems}</tuix-text
245
+ >
246
+ <div class="buttons">
247
+ <tuix-icon
248
+ class="arrow-icon"
249
+ name=${IconName.CHEVRON_LEFT}
250
+ @click=${this._prevPage}
251
+ ></tuix-icon>
252
+ <tuix-icon
253
+ class="arrow-icon"
254
+ name=${IconName.CHEVRON_RIGHT}
255
+ @click=${this._nextPage}
256
+ ></tuix-icon>
257
+ </div>
258
+ </div>
259
+ </footer>`;
260
+ }
261
+ _renderTable() {
262
+ return html `<table>
263
+ <thead style="background-color: ${Palette.MAIN}">
264
+ ${this._renderHeaderCells()}
265
+ </thead>
266
+ ${this.isLoadingData
267
+ ? html `<tbody>
268
+ <tr>
269
+ <td colspan=${this.headers.length}>${this._renderSpinner()}</td>
270
+ </tr>
271
+ </tbody>`
272
+ : html `<tbody>
273
+ ${this._renderRows()}
274
+ </tbody>`}
275
+ </table>
276
+ ${this.paginated ? this._renderPagination() : null}`;
277
+ }
278
+ _renderCards() {
279
+ const rows = this.data;
280
+ return html `<div class="mobile_table">
281
+ ${this.isLoadingData
282
+ ? this._renderSpinner()
283
+ : rows.map(row => html `<div
284
+ style="border-bottom: 2px solid ${Palette.MAIN};"
285
+ class="table_entity"
286
+ >
287
+ ${this.headers.map(header => html `<div
288
+ class="table_row"
289
+ style="border-bottom:1px solid ${Palette.NEUTRAL_200};"
290
+ >
291
+ <div
292
+ class="header"
293
+ style="background-color:${Palette.SECTION_BG};"
294
+ >
295
+ <tuix-text
296
+ size=${TextSize.Body1}
297
+ color=${TextVariant.PRIMARY}
298
+ >${header.name}</tuix-text
299
+ >
300
+ </div>
301
+ <div class="content">
302
+ ${header.isSlot
303
+ ? html `<slot
304
+ name="${header.slotName}-${row.id}"
305
+ ></slot>`
306
+ : html `<tuix-text size=${TextSize.Body1}
307
+ >${row[header.dataKey]}</tuix-text
308
+ >`}
309
+ </div>
310
+ </div>`)}
311
+ </div>`)}
312
+ </div>
313
+ ${this.paginated ? this._renderPagination() : null}`;
314
+ }
315
+ render() {
316
+ const shouldRenderCards = !this.disableMobileTable &&
317
+ (this._isMobileView ||
318
+ (this._isTabletView && this.showMobileTableInTablet));
319
+ return shouldRenderCards
320
+ ? html `${this._renderCards()}`
321
+ : html `${this._renderTable()}`;
322
+ }
323
+ };
324
+ __decorate([
325
+ property({ type: Boolean })
326
+ ], TuixTable.prototype, "paginated", void 0);
327
+ __decorate([
328
+ property({ type: Boolean })
329
+ ], TuixTable.prototype, "disableMobileTable", void 0);
330
+ __decorate([
331
+ property({ type: Boolean })
332
+ ], TuixTable.prototype, "showMobileTableInTablet", void 0);
333
+ __decorate([
334
+ property({ type: Object })
335
+ ], TuixTable.prototype, "loader", void 0);
336
+ __decorate([
337
+ property({ type: Array })
338
+ ], TuixTable.prototype, "data", void 0);
339
+ __decorate([
340
+ property({ type: Array })
341
+ ], TuixTable.prototype, "headers", void 0);
342
+ __decorate([
343
+ property({ type: Array })
344
+ ], TuixTable.prototype, "pageSizeOptions", void 0);
345
+ __decorate([
346
+ property({ type: Number })
347
+ ], TuixTable.prototype, "totalItems", void 0);
348
+ __decorate([
349
+ property({ type: Number })
350
+ ], TuixTable.prototype, "currentPage", void 0);
351
+ __decorate([
352
+ property({ type: Number })
353
+ ], TuixTable.prototype, "currentSize", void 0);
354
+ __decorate([
355
+ property({ type: Boolean })
356
+ ], TuixTable.prototype, "isLoadingData", void 0);
357
+ __decorate([
358
+ state()
359
+ ], TuixTable.prototype, "_isTabletView", void 0);
360
+ __decorate([
361
+ state()
362
+ ], TuixTable.prototype, "_isMobileView", void 0);
363
+ __decorate([
364
+ state()
365
+ ], TuixTable.prototype, "_headerPercents", void 0);
366
+ TuixTable = __decorate([
367
+ customElement('tuix-table')
368
+ ], TuixTable);
369
+ export { TuixTable };
@@ -0,0 +1,2 @@
1
+ export declare const tableStyles: import("lit").CSSResult;
2
+ export declare const threeDots: import("lit").CSSResult;
@@ -0,0 +1,197 @@
1
+ import { css } from 'lit';
2
+ import { ScreenSizes } from '../utils/screenSizes.enum.js';
3
+ export const tableStyles = css `
4
+ :host {
5
+ display: block;
6
+ width: 100%;
7
+ }
8
+
9
+ .table_wrapper {
10
+ width: 100%;
11
+ overflow-x: auto;
12
+ }
13
+
14
+ table {
15
+ min-width: 650px;
16
+ table-layout: fixed;
17
+ width: 100%;
18
+ border-collapse: collapse;
19
+ }
20
+
21
+ thead th {
22
+ box-sizing: border-box;
23
+ padding: 8px;
24
+ text-align: left;
25
+ overflow: hidden;
26
+ text-overflow: ellipsis;
27
+ white-space: nowrap;
28
+ }
29
+
30
+ tbody tr td {
31
+ box-sizing: border-box;
32
+ height: 52px;
33
+ padding: 6px 8px;
34
+ text-align: left;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ white-space: nowrap;
38
+ }
39
+
40
+ ::slotted(*) {
41
+ display: inline-flex;
42
+ align-items: center;
43
+ margin-right: 8px;
44
+ gap: 10px;
45
+ }
46
+
47
+ .dropdown_container {
48
+ position: relative;
49
+ border-radius: 4px;
50
+ }
51
+
52
+ .dropdown_container .items-per-page-dropdown {
53
+ width: 55px;
54
+ border: none;
55
+ background-color: transparent;
56
+ padding: 8px;
57
+ cursor: pointer;
58
+ -webkit-appearance: none;
59
+ -moz-appearance: none;
60
+ appearance: none;
61
+ }
62
+
63
+ .dropdown_container .items-per-page-dropdown:focus-visible {
64
+ border: none;
65
+ outline: none;
66
+ }
67
+
68
+ .dropdown_container .arrow-icon {
69
+ position: absolute;
70
+ right: 8px;
71
+ bottom: 8px;
72
+ cursor: pointer;
73
+ pointer-events: none;
74
+ }
75
+
76
+ footer.table_footer {
77
+ height: 48px;
78
+ padding: 8px;
79
+ width: 100%;
80
+ display: flex;
81
+ justify-content: space-between;
82
+ align-items: center;
83
+ box-sizing: border-box;
84
+ }
85
+
86
+ footer.table_footer .items-per-page {
87
+ display: flex;
88
+ align-items: center;
89
+ gap: 8px;
90
+ }
91
+
92
+ footer.table_footer .navigation {
93
+ display: flex;
94
+ align-items: center;
95
+ gap: 8px;
96
+ }
97
+
98
+ footer.table_footer .navigation .buttons {
99
+ display: flex;
100
+ gap: 8px;
101
+ cursor: pointer;
102
+ }
103
+
104
+ .mobile_table {
105
+ display: none;
106
+ }
107
+
108
+ @media only screen and (max-width: ${ScreenSizes.TABLET}px) {
109
+ .mobile_table {
110
+ display: block;
111
+ }
112
+
113
+ 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;
121
+ }
122
+
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;
130
+ }
131
+ }
132
+ `;
133
+ export const threeDots = css `
134
+ .tuix-spinner-wrapper {
135
+ display: flex;
136
+ justify-content: center;
137
+ align-items: center;
138
+ padding: 24px 0;
139
+ }
140
+
141
+ .three-dots-wrapper {
142
+ display: inline-flex;
143
+ gap: calc(var(--dot-size) * 0.5);
144
+ align-items: center;
145
+ justify-content: center;
146
+ position: relative;
147
+ }
148
+ .three-dots-wrapper .dot {
149
+ width: var(--dot-size);
150
+ height: var(--dot-size);
151
+ background: var(--dot-color);
152
+ border-radius: 50%;
153
+ display: inline-block;
154
+ animation: threeDots 0.9s infinite ease-in-out both;
155
+ }
156
+ .three-dots-wrapper .dot:nth-child(2) {
157
+ animation-delay: 0.15s;
158
+ }
159
+ .three-dots-wrapper .dot:nth-child(3) {
160
+ animation-delay: 0.3s;
161
+ }
162
+
163
+ @keyframes threeDots {
164
+ 0%,
165
+ 80%,
166
+ 100% {
167
+ transform: scale(0.6);
168
+ opacity: 0.6;
169
+ }
170
+ 40% {
171
+ transform: scale(1);
172
+ opacity: 1;
173
+ }
174
+ }
175
+
176
+ .sr-only {
177
+ border: 0;
178
+ clip: rect(1px, 1px, 1px, 1px);
179
+ -webkit-clip-path: inset(50%);
180
+ clip-path: inset(50%);
181
+ height: 1px;
182
+ margin: -1px;
183
+ overflow: hidden;
184
+ padding: 0;
185
+ position: absolute;
186
+ width: 1px;
187
+ white-space: nowrap;
188
+ }
189
+
190
+ .clientsLoader,
191
+ .mobileClientsLoader,
192
+ .tabletClientsLoader {
193
+ display: flex;
194
+ justify-content: center;
195
+ padding: 16px 0;
196
+ }
197
+ `;
@@ -0,0 +1,45 @@
1
+ export interface IDataTableHeader<TRowData = Record<string, unknown>> {
2
+ cellColor?: (rowData: TRowData) => string | undefined;
3
+ isSlot?: boolean;
4
+ slotName?: string;
5
+ name?: string;
6
+ dataKey: Extract<keyof TRowData, string>;
7
+ width: number;
8
+ }
9
+ export interface TablePaginationProps {
10
+ totalItems: number;
11
+ currentPage: number;
12
+ itemsPerPage: number;
13
+ startItem: number;
14
+ endItem: number;
15
+ onNextPage: () => void;
16
+ onPreviousPage: () => void;
17
+ onItemsPerPageChange: (newPageSize: number) => void;
18
+ isLoading?: boolean;
19
+ stickyInTablet?: boolean;
20
+ }
21
+ export interface ThreeDotsLoaderConfig {
22
+ size?: string;
23
+ color?: string;
24
+ visible?: boolean;
25
+ ariaLabel?: string;
26
+ wrapperStyle?: Record<string, string | number>;
27
+ }
28
+ export interface TuixTableElement<TRowData = any> extends HTMLElement {
29
+ data: TRowData[];
30
+ headers: IDataTableHeader<TRowData>[];
31
+ totalItems?: number;
32
+ currentPage?: number;
33
+ currentSize?: number;
34
+ isLoadingData?: boolean;
35
+ paginated?: boolean;
36
+ showMobileTableInTablet?: boolean;
37
+ disableMobileTable?: boolean;
38
+ pageSizeOptions?: number[];
39
+ loader?: ThreeDotsLoaderConfig;
40
+ }
41
+ export interface PaginationEventDetail {
42
+ page: number;
43
+ pageSize: number;
44
+ }
45
+ export type TuixPaginationEvent = CustomEvent<PaginationEventDetail>;
@@ -1,10 +1,12 @@
1
1
  import { LitElement } from 'lit';
2
- import { TextType, TextColor, TextSize } from '../enums/tuix-text.enums.js';
2
+ import { TextSize, TextVariant } from './enums/tuix-text.enums.js';
3
3
  export declare class TuixText extends LitElement {
4
- size?: TextSize;
5
- color?: TextColor;
6
- type?: TextType;
4
+ size: TextSize;
5
+ color?: TextVariant | undefined;
6
+ dark: boolean;
7
7
  static styles: import("lit").CSSResult[];
8
- getTextClass(): string;
8
+ private _getTextColor;
9
+ private _getStyleMap;
10
+ private _getClassMap;
9
11
  render(): import("lit-html").TemplateResult<1>;
10
12
  }