tuix-webcomponents 0.63.0 → 0.64.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.
- package/README.md +2 -2
- package/dist/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
- package/dist/assets/Color-AVL7NMMY-IH_JbDEF.js +1 -0
- package/dist/assets/DocsRenderer-PQXLIZUC-C0ZKNA9m.js +1286 -0
- package/dist/{src/tuix-icon/TuixIcon.icons.js → assets/TuixIconButton-eQtxZNXh.js} +203 -125
- package/dist/assets/TuixModal-BZFIHTi_.js +78 -0
- package/dist/assets/TuixToast-BhxwZIGo.js +62 -0
- package/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/assets/axe-C59a3kt3.js +30 -0
- package/dist/assets/iframe-ClsPaEIM.js +1057 -0
- package/dist/assets/index-DBzYXxxs.js +1554 -0
- package/dist/assets/index-TjhCmV-u.js +1 -0
- package/dist/assets/matchers-7Z3WT2CE-CcSi9QFY.js +14 -0
- package/dist/assets/screenSizes.enum-C1IhC_dy.js +13 -0
- package/dist/assets/state-CLjydI9z.js +13 -0
- package/dist/assets/tuix-button.stories-Dm_yifox.js +30 -0
- package/dist/assets/tuix-checkbox.stories-DmzoygjC.js +44 -0
- package/dist/assets/tuix-dropdown-object-list.stories-Neeajtj-.js +56 -0
- package/dist/assets/tuix-dropdown.stories-B7ea8QAz.js +28 -0
- package/dist/assets/tuix-icon-button.stories-CgbOSRO4.js +21 -0
- package/dist/assets/tuix-icon.enums-DYTtwLZl.js +1 -0
- package/dist/assets/tuix-icon.stories-CjN2XsKx.js +19 -0
- package/dist/assets/tuix-input.stories-CD7onvw2.js +33 -0
- package/dist/assets/tuix-link.stories-CT7pzGlx.js +35 -0
- package/dist/assets/tuix-modal.stories-B6v3cOPq.js +39 -0
- package/dist/assets/tuix-paper.enum-DhmlUJB7.js +1 -0
- package/dist/assets/tuix-paper.stories-CLnRPHNK.js +31 -0
- package/dist/assets/tuix-radio-button.stories-BwkKC3a9.js +35 -0
- package/dist/assets/tuix-table.stories-Bn-aZa0J.js +65 -0
- package/dist/assets/tuix-text.enums-Ck8cVqZZ.js +1 -0
- package/dist/assets/tuix-text.stories-BNIqPsGD.js +29 -0
- package/dist/assets/tuix-toast.stories-CRYiLiHK.js +21 -0
- package/dist/assets/tuix-toggle-button.stories-CY6wlDnA.js +40 -0
- package/dist/favicon-wrapper.svg +46 -0
- package/dist/favicon.svg +1 -0
- package/dist/iframe.html +685 -0
- package/dist/index.html +160 -0
- package/dist/index.json +1 -0
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/a11y-3/manager-bundle.js +5 -0
- package/dist/sb-addons/a11y-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js +356 -0
- package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js.LEGAL.txt +40 -0
- package/dist/sb-addons/docs-2/manager-bundle.js +151 -0
- package/dist/sb-addons/docs-2/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/vitest-4/manager-bundle.js +3 -0
- package/dist/sb-addons/vitest-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/favicon-wrapper.svg +46 -0
- package/dist/sb-common-assets/favicon.svg +1 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +797 -0
- package/dist/sb-manager/globals-runtime.js +69679 -0
- package/dist/sb-manager/globals.js +34 -0
- package/dist/sb-manager/runtime.js +13195 -0
- package/package.json +6 -6
- package/dist/src/index.d.ts +0 -36
- package/dist/src/index.js +0 -42
- package/dist/src/tuix-button/TuixBaseButton.d.ts +0 -17
- package/dist/src/tuix-button/TuixBaseButton.js +0 -60
- package/dist/src/tuix-button/TuixButton.d.ts +0 -11
- package/dist/src/tuix-button/TuixButton.js +0 -84
- package/dist/src/tuix-button/TuixButton.styles.d.ts +0 -3
- package/dist/src/tuix-button/TuixButton.styles.js +0 -107
- package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +0 -2
- package/dist/src/tuix-button/enums/tuix-button.enums.js +0 -6
- package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +0 -1
- package/dist/src/tuix-button/interfaces/tuix-button.interface.js +0 -1
- package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +0 -15
- package/dist/src/tuix-checkbox/TuixCheckbox.js +0 -106
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +0 -4
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +0 -132
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +0 -21
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +0 -23
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +0 -5
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +0 -1
- package/dist/src/tuix-dropdown/TuixDropdown.d.ts +0 -55
- package/dist/src/tuix-dropdown/TuixDropdown.js +0 -360
- package/dist/src/tuix-dropdown/TuixDropdown.styles.d.ts +0 -3
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +0 -125
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +0 -4
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +0 -5
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +0 -15
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +0 -1
- package/dist/src/tuix-icon/TuixIcon.d.ts +0 -15
- package/dist/src/tuix-icon/TuixIcon.icons.d.ts +0 -6
- package/dist/src/tuix-icon/TuixIcon.js +0 -79
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +0 -62
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +0 -69
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +0 -9
- package/dist/src/tuix-icon-button/TuixIconButton.js +0 -51
- package/dist/src/tuix-input/TuixInput.d.ts +0 -52
- package/dist/src/tuix-input/TuixInput.js +0 -370
- package/dist/src/tuix-input/TuixInput.styles.d.ts +0 -8
- package/dist/src/tuix-input/TuixInput.styles.js +0 -295
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +0 -38
- package/dist/src/tuix-input/enums/tuix-input.enums.js +0 -41
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +0 -18
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js +0 -5
- package/dist/src/tuix-link/TuixLink.d.ts +0 -15
- package/dist/src/tuix-link/TuixLink.js +0 -71
- package/dist/src/tuix-link/TuixLink.styles.d.ts +0 -2
- package/dist/src/tuix-link/TuixLink.styles.js +0 -55
- package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +0 -6
- package/dist/src/tuix-link/enums/linkTarget.enum.js +0 -7
- package/dist/src/tuix-modal/TuixModal.d.ts +0 -9
- package/dist/src/tuix-modal/TuixModal.js +0 -63
- package/dist/src/tuix-modal/TuixModal.styles.d.ts +0 -2
- package/dist/src/tuix-modal/TuixModal.styles.js +0 -55
- package/dist/src/tuix-paper/TuixPaper.d.ts +0 -10
- package/dist/src/tuix-paper/TuixPaper.js +0 -46
- package/dist/src/tuix-paper/TuixPaper.styles.d.ts +0 -1
- package/dist/src/tuix-paper/TuixPaper.styles.js +0 -30
- package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +0 -13
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js +0 -15
- package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +0 -16
- package/dist/src/tuix-radio-button/TuixRadioButton.js +0 -95
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +0 -5
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +0 -135
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +0 -3
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +0 -1
- package/dist/src/tuix-table/TuixTable.d.ts +0 -46
- package/dist/src/tuix-table/TuixTable.js +0 -367
- package/dist/src/tuix-table/TuixTable.styles.d.ts +0 -2
- package/dist/src/tuix-table/TuixTable.styles.js +0 -197
- package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +0 -45
- package/dist/src/tuix-table/interfaces/tuix-table.interface.js +0 -1
- package/dist/src/tuix-text/TuixText.d.ts +0 -12
- package/dist/src/tuix-text/TuixText.js +0 -66
- package/dist/src/tuix-text/TuixText.styles.d.ts +0 -2
- package/dist/src/tuix-text/TuixText.styles.js +0 -158
- package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +0 -31
- package/dist/src/tuix-text/enums/tuix-text.enums.js +0 -63
- package/dist/src/tuix-toast/TuixToast.d.ts +0 -15
- package/dist/src/tuix-toast/TuixToast.js +0 -100
- package/dist/src/tuix-toast/TuixToast.styles.d.ts +0 -3
- package/dist/src/tuix-toast/TuixToast.styles.js +0 -43
- package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +0 -20
- package/dist/src/tuix-toast/enums/tuix-toast.enums.js +0 -59
- package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +0 -13
- package/dist/src/tuix-toggle-button/TuixToggleButton.js +0 -85
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +0 -5
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +0 -134
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +0 -2
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +0 -1
- package/dist/src/utils/colors.d.ts +0 -29
- package/dist/src/utils/colors.js +0 -30
- package/dist/src/utils/darkColors.d.ts +0 -31
- package/dist/src/utils/darkColors.js +0 -32
- package/dist/src/utils/hex-rgb.d.ts +0 -5
- package/dist/src/utils/hex-rgb.js +0 -15
- package/dist/src/utils/interfaces/detail-value.interface.d.ts +0 -3
- package/dist/src/utils/interfaces/detail-value.interface.js +0 -1
- package/dist/src/utils/mainVariant.enum.d.ts +0 -4
- package/dist/src/utils/mainVariant.enum.js +0 -5
- package/dist/src/utils/screenSizes.enum.d.ts +0 -4
- package/dist/src/utils/screenSizes.enum.js +0 -5
- package/dist/src/utils/slottedClassName.d.ts +0 -2
- package/dist/src/utils/slottedClassName.js +0 -1
- package/dist/tsconfig.publish.tsbuildinfo +0 -1
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { css, unsafeCSS } from 'lit';
|
|
2
|
-
import { hostStyles } from '../tuix-checkbox/TuixCheckbox.styles';
|
|
3
|
-
import { Palette } from '../utils/colors';
|
|
4
|
-
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
5
|
-
export const radioHostStyles = css `
|
|
6
|
-
${hostStyles}
|
|
7
|
-
:host {
|
|
8
|
-
--t-margin-between-radio-buttons: 1rem;
|
|
9
|
-
--t-radio-button-inner-color-disabled: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
export const radioButtonContainerStyles = css `
|
|
13
|
-
.t-radio-button-full-container {
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: var(--t-label-right-default-justify, flex-start);
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
-webkit-user-select: none;
|
|
18
|
-
-moz-user-select: none;
|
|
19
|
-
-ms-user-select: none;
|
|
20
|
-
user-select: none;
|
|
21
|
-
}
|
|
22
|
-
:host([disabled]) .t-radio-button-full-container {
|
|
23
|
-
cursor: not-allowed;
|
|
24
|
-
}
|
|
25
|
-
.t-radio-button-container {
|
|
26
|
-
--t-radio-button-size-box: 1.5rem;
|
|
27
|
-
--t-radio-button-shadow-width: 2px;
|
|
28
|
-
display: block;
|
|
29
|
-
position: relative;
|
|
30
|
-
height: var(--t-radio-button-size-box);
|
|
31
|
-
width: var(--t-radio-button-size-box);
|
|
32
|
-
min-width: var(--t-radio-button-size-box);
|
|
33
|
-
}
|
|
34
|
-
.t-radio-button-container .t-radio-button {
|
|
35
|
-
position: absolute;
|
|
36
|
-
opacity: 0;
|
|
37
|
-
height: 0;
|
|
38
|
-
width: 0;
|
|
39
|
-
}
|
|
40
|
-
@media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
|
|
41
|
-
.t-radio-button-container {
|
|
42
|
-
--t-radio-button-size-box: 1rem;
|
|
43
|
-
--t-radio-button-shadow-width: 1px;
|
|
44
|
-
margin-top: 1px;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
export const radioButtonStyles = css `
|
|
49
|
-
.t-radio-button-full-container.t-multiple-options {
|
|
50
|
-
margin-bottom: var(--t-margin-between-radio-buttons);
|
|
51
|
-
}
|
|
52
|
-
.t-radio-button-container .t-radio-button-checkmark {
|
|
53
|
-
position: absolute;
|
|
54
|
-
top: 0;
|
|
55
|
-
left: 0;
|
|
56
|
-
display: flex;
|
|
57
|
-
height: var(--t-radio-button-size-box);
|
|
58
|
-
width: var(--t-radio-button-size-box);
|
|
59
|
-
background-color: var(--t-bg-color-primary);
|
|
60
|
-
border: 1px solid var(--t-stroke-color-grey);
|
|
61
|
-
box-sizing: border-box;
|
|
62
|
-
border-radius: 50%;
|
|
63
|
-
}
|
|
64
|
-
.t-radio-button-container
|
|
65
|
-
.t-radio-button:checked
|
|
66
|
-
~ .t-radio-button-checkmark {
|
|
67
|
-
border: 1px solid var(--t-main-color-tuix);
|
|
68
|
-
}
|
|
69
|
-
.t-radio-button-container .t-radio-button:focus ~ .t-radio-button-checkmark {
|
|
70
|
-
box-shadow: 0 0 0px var(--t-radio-button-shadow-width)
|
|
71
|
-
var(--t-stroke-color-focus);
|
|
72
|
-
}
|
|
73
|
-
.t-radio-button-full-container:hover
|
|
74
|
-
.t-radio-button-container
|
|
75
|
-
.t-radio-button-checkmark {
|
|
76
|
-
border: 1px solid var(--t-main-color-tuix);
|
|
77
|
-
}
|
|
78
|
-
.t-radio-button-full-container.t-with-error
|
|
79
|
-
.t-radio-button-container
|
|
80
|
-
.t-radio-button-checkmark {
|
|
81
|
-
border: 1px solid var(--t-text-color-error);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.t-radio-button-container
|
|
85
|
-
.t-radio-button:disabled
|
|
86
|
-
~ .t-radio-button-checkmark {
|
|
87
|
-
background-color: var(--t-bg-color-disabled);
|
|
88
|
-
border: none;
|
|
89
|
-
box-shadow: none;
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
export const radioButtonInnerStyles = css `
|
|
93
|
-
.t-radio-button-container .t-radio-button-checkmark .t-radio-button-inner {
|
|
94
|
-
background-color: var(--t-main-color-tuix);
|
|
95
|
-
margin: auto;
|
|
96
|
-
height: calc(var(--t-radio-button-size-box) / 2 - 2px);
|
|
97
|
-
width: calc(var(--t-radio-button-size-box) / 2 - 2px);
|
|
98
|
-
border-radius: 50%;
|
|
99
|
-
display: none;
|
|
100
|
-
}
|
|
101
|
-
.t-radio-button-container
|
|
102
|
-
.t-radio-button:checked
|
|
103
|
-
~ .t-radio-button-checkmark
|
|
104
|
-
.t-radio-button-inner {
|
|
105
|
-
display: block;
|
|
106
|
-
}
|
|
107
|
-
:host([error])
|
|
108
|
-
.t-radio-button-container
|
|
109
|
-
.t-radio-button-checkmark
|
|
110
|
-
.t-radio-button-inner {
|
|
111
|
-
background-color: var(--t-text-color-error);
|
|
112
|
-
}
|
|
113
|
-
:host([disabled])
|
|
114
|
-
.t-radio-button-container
|
|
115
|
-
.t-radio-button-checkmark
|
|
116
|
-
.t-radio-button-inner {
|
|
117
|
-
background-color: var(--t-radio-button-inner-color-disabled);
|
|
118
|
-
cursor: not-allowed;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
export const radioButtonLabelStyles = css `
|
|
122
|
-
.t-radio-button-label {
|
|
123
|
-
display: block;
|
|
124
|
-
color: var(--t-text-color-label);
|
|
125
|
-
margin-left: 0.625rem;
|
|
126
|
-
}
|
|
127
|
-
.t-radio-button-full-container.t-with-label-left {
|
|
128
|
-
flex-direction: row-reverse;
|
|
129
|
-
justify-content: var(--t-label-left-default-justify, space-between);
|
|
130
|
-
}
|
|
131
|
-
.t-radio-button-full-container.t-with-label-left .t-radio-button-label {
|
|
132
|
-
margin-right: 0.625rem;
|
|
133
|
-
margin-left: 0;
|
|
134
|
-
}
|
|
135
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import type { IDataTableHeader, ThreeDotsLoaderConfig } from './interfaces/tuix-table.interface.js';
|
|
3
|
-
export declare class TuixTable extends LitElement {
|
|
4
|
-
static styles: import("lit").CSSResult[];
|
|
5
|
-
paginated: boolean;
|
|
6
|
-
disableMobileTable: boolean;
|
|
7
|
-
showMobileTableInTablet: boolean;
|
|
8
|
-
loader?: ThreeDotsLoaderConfig;
|
|
9
|
-
data: Record<string, any>[];
|
|
10
|
-
headers: IDataTableHeader<any>[];
|
|
11
|
-
pageSizeOptions: number[];
|
|
12
|
-
totalItems?: number;
|
|
13
|
-
currentPage?: number;
|
|
14
|
-
currentSize?: number;
|
|
15
|
-
isLoadingData: boolean;
|
|
16
|
-
private _isTabletView;
|
|
17
|
-
private _isMobileView;
|
|
18
|
-
private _headerPercents;
|
|
19
|
-
private _mqTablet?;
|
|
20
|
-
private _mqMobile?;
|
|
21
|
-
private _onScreenSizeChange;
|
|
22
|
-
connectedCallback(): void;
|
|
23
|
-
disconnectedCallback(): void;
|
|
24
|
-
updated(changedProps: Map<string, any>): void;
|
|
25
|
-
private get _effectiveTotalItems();
|
|
26
|
-
private get _effectiveCurrentPage();
|
|
27
|
-
private get _effectivePageSize();
|
|
28
|
-
private get totalPages();
|
|
29
|
-
private get _paginationProps();
|
|
30
|
-
private _nextPage;
|
|
31
|
-
private _prevPage;
|
|
32
|
-
private _setPageSize;
|
|
33
|
-
private _computeHeaderPercents;
|
|
34
|
-
private _cellStyleString;
|
|
35
|
-
private _textVariantColor;
|
|
36
|
-
private _renderHeaderCells;
|
|
37
|
-
private _renderCell;
|
|
38
|
-
private _renderRows;
|
|
39
|
-
private _onPageSizeChange;
|
|
40
|
-
private _renderPageSizeOptions;
|
|
41
|
-
private _renderSpinner;
|
|
42
|
-
private _renderPagination;
|
|
43
|
-
private _renderTable;
|
|
44
|
-
private _renderCards;
|
|
45
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
46
|
-
}
|
|
@@ -1,367 +0,0 @@
|
|
|
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 { tableStyles, threeDots } from './TuixTable.styles';
|
|
7
|
-
import { TextSize, TextVariant } from '../tuix-text/enums/tuix-text.enums';
|
|
8
|
-
import { IconName } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
9
|
-
import { Palette } from '../utils/colors';
|
|
10
|
-
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
11
|
-
let TuixTable = class TuixTable extends LitElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.paginated = false;
|
|
15
|
-
this.disableMobileTable = false;
|
|
16
|
-
this.showMobileTableInTablet = false;
|
|
17
|
-
this.data = [];
|
|
18
|
-
this.headers = [];
|
|
19
|
-
this.pageSizeOptions = [5, 10, 20];
|
|
20
|
-
this.isLoadingData = false;
|
|
21
|
-
this._isTabletView = false;
|
|
22
|
-
this._isMobileView = false;
|
|
23
|
-
this._headerPercents = [];
|
|
24
|
-
this._onScreenSizeChange = () => {
|
|
25
|
-
this._isTabletView = !!this._mqTablet?.matches;
|
|
26
|
-
this._isMobileView = !!this._mqMobile?.matches;
|
|
27
|
-
};
|
|
28
|
-
this._nextPage = () => {
|
|
29
|
-
if (this.currentPage === this.totalPages)
|
|
30
|
-
return;
|
|
31
|
-
const next = Math.min(this.totalPages, this._effectiveCurrentPage + 1);
|
|
32
|
-
const detail = {
|
|
33
|
-
page: next,
|
|
34
|
-
pageSize: this._effectivePageSize,
|
|
35
|
-
};
|
|
36
|
-
this.dispatchEvent(new CustomEvent('next-page', {
|
|
37
|
-
detail,
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
this._prevPage = () => {
|
|
43
|
-
if (this.currentPage === 1)
|
|
44
|
-
return;
|
|
45
|
-
const prev = Math.max(1, this._effectiveCurrentPage - 1);
|
|
46
|
-
const detail = {
|
|
47
|
-
page: prev,
|
|
48
|
-
pageSize: this._effectivePageSize,
|
|
49
|
-
};
|
|
50
|
-
this.dispatchEvent(new CustomEvent('previous-page', {
|
|
51
|
-
detail,
|
|
52
|
-
bubbles: true,
|
|
53
|
-
composed: true,
|
|
54
|
-
}));
|
|
55
|
-
};
|
|
56
|
-
this._setPageSize = (value) => {
|
|
57
|
-
const newSize = Math.max(1, Math.floor(value));
|
|
58
|
-
const newPage = 1;
|
|
59
|
-
const detail = { page: newPage, pageSize: newSize };
|
|
60
|
-
this.dispatchEvent(new CustomEvent('page-size-change', {
|
|
61
|
-
detail,
|
|
62
|
-
bubbles: true,
|
|
63
|
-
composed: true,
|
|
64
|
-
}));
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
static { this.styles = [tableStyles, threeDots]; }
|
|
68
|
-
connectedCallback() {
|
|
69
|
-
super.connectedCallback();
|
|
70
|
-
this._mqTablet = window.matchMedia(`(max-width:${ScreenSizes.TABLET}px)`);
|
|
71
|
-
this._mqMobile = window.matchMedia(`(max-width:${ScreenSizes.MOBILE}px)`);
|
|
72
|
-
this._onScreenSizeChange();
|
|
73
|
-
this._mqTablet.addEventListener('change', this._onScreenSizeChange);
|
|
74
|
-
this._mqMobile.addEventListener('change', this._onScreenSizeChange);
|
|
75
|
-
this._computeHeaderPercents();
|
|
76
|
-
}
|
|
77
|
-
disconnectedCallback() {
|
|
78
|
-
super.disconnectedCallback();
|
|
79
|
-
this._mqTablet?.removeEventListener('change', this._onScreenSizeChange);
|
|
80
|
-
this._mqMobile?.removeEventListener('change', this._onScreenSizeChange);
|
|
81
|
-
}
|
|
82
|
-
updated(changedProps) {
|
|
83
|
-
if (changedProps.has('headers'))
|
|
84
|
-
this._computeHeaderPercents();
|
|
85
|
-
}
|
|
86
|
-
get _effectiveTotalItems() {
|
|
87
|
-
return this.totalItems ?? this.data.length;
|
|
88
|
-
}
|
|
89
|
-
get _effectiveCurrentPage() {
|
|
90
|
-
return this.currentPage ?? 1;
|
|
91
|
-
}
|
|
92
|
-
get _effectivePageSize() {
|
|
93
|
-
return this.currentSize ?? this.pageSizeOptions[0];
|
|
94
|
-
}
|
|
95
|
-
get totalPages() {
|
|
96
|
-
const denom = this._effectivePageSize;
|
|
97
|
-
return Math.max(1, Math.ceil(this._effectiveTotalItems / denom));
|
|
98
|
-
}
|
|
99
|
-
get _paginationProps() {
|
|
100
|
-
const totalItems = this._effectiveTotalItems;
|
|
101
|
-
const itemsPerPage = this._effectivePageSize;
|
|
102
|
-
const startItem = totalItems
|
|
103
|
-
? (this._effectiveCurrentPage - 1) * itemsPerPage + 1
|
|
104
|
-
: 0;
|
|
105
|
-
const endItem = Math.min(this._effectiveCurrentPage * itemsPerPage, totalItems);
|
|
106
|
-
return {
|
|
107
|
-
totalItems,
|
|
108
|
-
currentPage: this._effectiveCurrentPage,
|
|
109
|
-
itemsPerPage,
|
|
110
|
-
startItem,
|
|
111
|
-
endItem,
|
|
112
|
-
onNextPage: this._nextPage,
|
|
113
|
-
onPreviousPage: this._prevPage,
|
|
114
|
-
onItemsPerPageChange: this._setPageSize,
|
|
115
|
-
isLoading: this.isLoadingData,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
_computeHeaderPercents() {
|
|
119
|
-
const total = this.headers.reduce((acum, header) => acum + header.width, 0);
|
|
120
|
-
this._headerPercents =
|
|
121
|
-
total === 0
|
|
122
|
-
? this.headers.map(() => 100 / this.headers.length)
|
|
123
|
-
: this.headers.map(header => (header.width / total) * 100);
|
|
124
|
-
}
|
|
125
|
-
_cellStyleString() {
|
|
126
|
-
return `border-bottom:1px solid ${Palette.NEUTRAL_200};`;
|
|
127
|
-
}
|
|
128
|
-
_textVariantColor(header, row) {
|
|
129
|
-
const color = header.cellColor
|
|
130
|
-
? header.cellColor(row)
|
|
131
|
-
: TextVariant.PRIMARY;
|
|
132
|
-
return color;
|
|
133
|
-
}
|
|
134
|
-
_renderHeaderCells() {
|
|
135
|
-
return html `<tr>
|
|
136
|
-
${this.headers.map((header, idx) => html `<th
|
|
137
|
-
style=${styleMap({
|
|
138
|
-
width: `${this._headerPercents[idx]}%`,
|
|
139
|
-
color: Palette.WHITE,
|
|
140
|
-
})}
|
|
141
|
-
>
|
|
142
|
-
<tuix-text size=${TextSize.Body1} color=${TextVariant.SECONDARY}
|
|
143
|
-
>${header.name}</tuix-text
|
|
144
|
-
>
|
|
145
|
-
</th>`)}
|
|
146
|
-
</tr>`;
|
|
147
|
-
}
|
|
148
|
-
_renderCell(header, row) {
|
|
149
|
-
if (header.isSlot) {
|
|
150
|
-
const slotName = `${header.slotName}-${row.id}`;
|
|
151
|
-
return html `<td style="${this._cellStyleString()}">
|
|
152
|
-
<slot name=${slotName}></slot>
|
|
153
|
-
</td>`;
|
|
154
|
-
}
|
|
155
|
-
const content = row[header.dataKey];
|
|
156
|
-
return html `<td style="${this._cellStyleString()}">
|
|
157
|
-
<tuix-text
|
|
158
|
-
size=${TextSize.Body1}
|
|
159
|
-
color=${this._textVariantColor(header, row)}
|
|
160
|
-
>${content}</tuix-text
|
|
161
|
-
>
|
|
162
|
-
</td>`;
|
|
163
|
-
}
|
|
164
|
-
_renderRows() {
|
|
165
|
-
const rows = this.data;
|
|
166
|
-
return repeat(rows, row => row.id, row => html `<tr>
|
|
167
|
-
${this.headers.map(header => this._renderCell(header, row))}
|
|
168
|
-
</tr>`);
|
|
169
|
-
}
|
|
170
|
-
_onPageSizeChange(e) {
|
|
171
|
-
const selectedValue = parseInt(e.target.value);
|
|
172
|
-
this._setPageSize(selectedValue);
|
|
173
|
-
}
|
|
174
|
-
_renderPageSizeOptions() {
|
|
175
|
-
return this.pageSizeOptions.map(size => html `<option value=${size}>${size}</option>`);
|
|
176
|
-
}
|
|
177
|
-
_renderSpinner() {
|
|
178
|
-
const threeDotsConfiguration = {
|
|
179
|
-
size: '14px',
|
|
180
|
-
color: Palette.MAIN,
|
|
181
|
-
visible: true,
|
|
182
|
-
ariaLabel: 'Loading',
|
|
183
|
-
wrapperStyle: {
|
|
184
|
-
width: '100%',
|
|
185
|
-
display: 'flex',
|
|
186
|
-
justifyContent: 'center',
|
|
187
|
-
padding: '48px 0',
|
|
188
|
-
},
|
|
189
|
-
...this.loader,
|
|
190
|
-
};
|
|
191
|
-
if (!threeDotsConfiguration.visible)
|
|
192
|
-
return null;
|
|
193
|
-
const wrapperVars = {
|
|
194
|
-
'--dot-size': threeDotsConfiguration.size,
|
|
195
|
-
'--dot-color': threeDotsConfiguration.color,
|
|
196
|
-
...threeDotsConfiguration.wrapperStyle,
|
|
197
|
-
};
|
|
198
|
-
const aria = threeDotsConfiguration.ariaLabel;
|
|
199
|
-
return html `<div class="tuix-spinner-wrapper">
|
|
200
|
-
<div
|
|
201
|
-
class="three-dots-wrapper"
|
|
202
|
-
role="status"
|
|
203
|
-
aria-label=${aria}
|
|
204
|
-
style=${styleMap(wrapperVars)}
|
|
205
|
-
>
|
|
206
|
-
<span class="dot" aria-hidden="true"></span>
|
|
207
|
-
<span class="dot" aria-hidden="true"></span>
|
|
208
|
-
<span class="dot" aria-hidden="true"></span>
|
|
209
|
-
<span class="sr-only">${aria}</span>
|
|
210
|
-
</div>
|
|
211
|
-
</div>`;
|
|
212
|
-
}
|
|
213
|
-
_renderPagination() {
|
|
214
|
-
const { totalItems, startItem, endItem, itemsPerPage, isLoading } = this._paginationProps;
|
|
215
|
-
return html `<footer
|
|
216
|
-
style="background-color:${Palette.SECTION_BG};"
|
|
217
|
-
class="table_footer sticky"
|
|
218
|
-
>
|
|
219
|
-
<div class="items-per-page">
|
|
220
|
-
<tuix-text size=${TextSize.Body2}>Items per page</tuix-text>
|
|
221
|
-
<div
|
|
222
|
-
style="outline: 1px solid ${Palette.NEUTRAL_200};"
|
|
223
|
-
class="dropdown_container"
|
|
224
|
-
>
|
|
225
|
-
<select
|
|
226
|
-
class="items-per-page-dropdown"
|
|
227
|
-
.value=${String(itemsPerPage)}
|
|
228
|
-
@change=${this._onPageSizeChange}
|
|
229
|
-
?disabled=${isLoading}
|
|
230
|
-
>
|
|
231
|
-
${this._renderPageSizeOptions()}
|
|
232
|
-
</select>
|
|
233
|
-
<tuix-icon
|
|
234
|
-
class="arrow-icon"
|
|
235
|
-
name=${IconName.CHEVRON_DOWN}
|
|
236
|
-
></tuix-icon>
|
|
237
|
-
</div>
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
<div class="navigation">
|
|
241
|
-
<tuix-text size=${TextSize.Body2}
|
|
242
|
-
>${startItem} - ${endItem} of ${totalItems}</tuix-text
|
|
243
|
-
>
|
|
244
|
-
<div class="buttons">
|
|
245
|
-
<tuix-icon
|
|
246
|
-
class="arrow-icon"
|
|
247
|
-
name=${IconName.CHEVRON_LEFT}
|
|
248
|
-
@click=${this._prevPage}
|
|
249
|
-
></tuix-icon>
|
|
250
|
-
<tuix-icon
|
|
251
|
-
class="arrow-icon"
|
|
252
|
-
name=${IconName.CHEVRON_RIGHT}
|
|
253
|
-
@click=${this._nextPage}
|
|
254
|
-
></tuix-icon>
|
|
255
|
-
</div>
|
|
256
|
-
</div>
|
|
257
|
-
</footer>`;
|
|
258
|
-
}
|
|
259
|
-
_renderTable() {
|
|
260
|
-
return html `<table>
|
|
261
|
-
<thead style="background-color: ${Palette.MAIN}">
|
|
262
|
-
${this._renderHeaderCells()}
|
|
263
|
-
</thead>
|
|
264
|
-
${this.isLoadingData
|
|
265
|
-
? html `<tbody>
|
|
266
|
-
<tr>
|
|
267
|
-
<td colspan=${this.headers.length}>${this._renderSpinner()}</td>
|
|
268
|
-
</tr>
|
|
269
|
-
</tbody>`
|
|
270
|
-
: html `<tbody>
|
|
271
|
-
${this._renderRows()}
|
|
272
|
-
</tbody>`}
|
|
273
|
-
</table>
|
|
274
|
-
${this.paginated ? this._renderPagination() : null}`;
|
|
275
|
-
}
|
|
276
|
-
_renderCards() {
|
|
277
|
-
const rows = this.data;
|
|
278
|
-
return html `<div class="mobile_table">
|
|
279
|
-
${this.isLoadingData
|
|
280
|
-
? this._renderSpinner()
|
|
281
|
-
: rows.map(row => html `<div
|
|
282
|
-
style="border-bottom: 2px solid ${Palette.MAIN};"
|
|
283
|
-
class="table_entity"
|
|
284
|
-
>
|
|
285
|
-
${this.headers.map(header => html `<div
|
|
286
|
-
class="table_row"
|
|
287
|
-
style="border-bottom:1px solid ${Palette.NEUTRAL_200};"
|
|
288
|
-
>
|
|
289
|
-
<div
|
|
290
|
-
class="header"
|
|
291
|
-
style="background-color:${Palette.SECTION_BG};"
|
|
292
|
-
>
|
|
293
|
-
<tuix-text
|
|
294
|
-
size=${TextSize.Body1}
|
|
295
|
-
color=${TextVariant.PRIMARY}
|
|
296
|
-
>${header.name}</tuix-text
|
|
297
|
-
>
|
|
298
|
-
</div>
|
|
299
|
-
<div class="content">
|
|
300
|
-
${header.isSlot
|
|
301
|
-
? html `<slot
|
|
302
|
-
name="${header.slotName}-${row.id}"
|
|
303
|
-
></slot>`
|
|
304
|
-
: html `<tuix-text size=${TextSize.Body1}
|
|
305
|
-
>${row[header.dataKey]}</tuix-text
|
|
306
|
-
>`}
|
|
307
|
-
</div>
|
|
308
|
-
</div>`)}
|
|
309
|
-
</div>`)}
|
|
310
|
-
</div>
|
|
311
|
-
${this.paginated ? this._renderPagination() : null}`;
|
|
312
|
-
}
|
|
313
|
-
render() {
|
|
314
|
-
const shouldRenderCards = !this.disableMobileTable &&
|
|
315
|
-
(this._isMobileView ||
|
|
316
|
-
(this._isTabletView && this.showMobileTableInTablet));
|
|
317
|
-
return shouldRenderCards
|
|
318
|
-
? html `${this._renderCards()}`
|
|
319
|
-
: html `${this._renderTable()}`;
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
__decorate([
|
|
323
|
-
property({ type: Boolean })
|
|
324
|
-
], TuixTable.prototype, "paginated", void 0);
|
|
325
|
-
__decorate([
|
|
326
|
-
property({ type: Boolean })
|
|
327
|
-
], TuixTable.prototype, "disableMobileTable", void 0);
|
|
328
|
-
__decorate([
|
|
329
|
-
property({ type: Boolean })
|
|
330
|
-
], TuixTable.prototype, "showMobileTableInTablet", void 0);
|
|
331
|
-
__decorate([
|
|
332
|
-
property({ type: Object })
|
|
333
|
-
], TuixTable.prototype, "loader", void 0);
|
|
334
|
-
__decorate([
|
|
335
|
-
property({ type: Array })
|
|
336
|
-
], TuixTable.prototype, "data", void 0);
|
|
337
|
-
__decorate([
|
|
338
|
-
property({ type: Array })
|
|
339
|
-
], TuixTable.prototype, "headers", void 0);
|
|
340
|
-
__decorate([
|
|
341
|
-
property({ type: Array })
|
|
342
|
-
], TuixTable.prototype, "pageSizeOptions", void 0);
|
|
343
|
-
__decorate([
|
|
344
|
-
property({ type: Number })
|
|
345
|
-
], TuixTable.prototype, "totalItems", void 0);
|
|
346
|
-
__decorate([
|
|
347
|
-
property({ type: Number })
|
|
348
|
-
], TuixTable.prototype, "currentPage", void 0);
|
|
349
|
-
__decorate([
|
|
350
|
-
property({ type: Number })
|
|
351
|
-
], TuixTable.prototype, "currentSize", void 0);
|
|
352
|
-
__decorate([
|
|
353
|
-
property({ type: Boolean })
|
|
354
|
-
], TuixTable.prototype, "isLoadingData", void 0);
|
|
355
|
-
__decorate([
|
|
356
|
-
state()
|
|
357
|
-
], TuixTable.prototype, "_isTabletView", void 0);
|
|
358
|
-
__decorate([
|
|
359
|
-
state()
|
|
360
|
-
], TuixTable.prototype, "_isMobileView", void 0);
|
|
361
|
-
__decorate([
|
|
362
|
-
state()
|
|
363
|
-
], TuixTable.prototype, "_headerPercents", void 0);
|
|
364
|
-
TuixTable = __decorate([
|
|
365
|
-
customElement('tuix-table')
|
|
366
|
-
], TuixTable);
|
|
367
|
-
export { TuixTable };
|