tuix-webcomponents 0.0.22 → 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.
- package/README.md +103 -21
- package/dist/assets/tuix-styles.css +72 -0
- package/dist/src/index.d.ts +27 -1
- package/dist/src/index.js +19 -16
- package/dist/src/react/index.d.ts +42 -0
- package/dist/src/react/index.js +114 -0
- package/dist/src/tuix-button/TuixBaseButton.d.ts +17 -0
- package/dist/src/tuix-button/TuixBaseButton.js +60 -0
- package/dist/src/tuix-button/TuixButton.d.ts +7 -13
- package/dist/src/tuix-button/TuixButton.js +37 -61
- package/dist/src/tuix-button/TuixButton.styles.d.ts +1 -0
- package/dist/src/tuix-button/TuixButton.styles.js +78 -45
- package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +1 -1
- package/dist/src/tuix-button/enums/tuix-button.enums.js +4 -5
- package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +1 -0
- package/dist/src/tuix-button/interfaces/tuix-button.interface.js +1 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +17 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.js +108 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +4 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +132 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +21 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +23 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +5 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +1 -0
- package/dist/src/tuix-dropdown/TuixDropdown.d.ts +15 -5
- package/dist/src/tuix-dropdown/TuixDropdown.js +129 -43
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +61 -21
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +0 -6
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +0 -8
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +15 -1
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +0 -1
- package/dist/src/tuix-icon/TuixIcon.d.ts +6 -2
- package/dist/src/tuix-icon/TuixIcon.icons.d.ts +3 -3
- package/dist/src/tuix-icon/TuixIcon.icons.js +299 -7
- package/dist/src/tuix-icon/TuixIcon.js +39 -25
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +67 -21
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +66 -22
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +7 -12
- package/dist/src/tuix-icon-button/TuixIconButton.js +22 -51
- package/dist/src/tuix-input/TuixInput.d.ts +13 -7
- package/dist/src/tuix-input/TuixInput.js +98 -51
- package/dist/src/tuix-input/TuixInput.styles.js +101 -112
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +11 -9
- package/dist/src/tuix-input/enums/tuix-input.enums.js +11 -12
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +13 -8
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js +5 -2
- package/dist/src/tuix-link/TuixLink.d.ts +10 -6
- package/dist/src/tuix-link/TuixLink.js +39 -40
- package/dist/src/tuix-link/TuixLink.styles.d.ts +2 -0
- package/dist/src/tuix-link/TuixLink.styles.js +55 -0
- package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +4 -4
- package/dist/src/tuix-link/enums/linkTarget.enum.js +4 -5
- package/dist/src/tuix-modal/TuixModal.d.ts +11 -0
- package/dist/src/tuix-modal/TuixModal.js +65 -0
- package/dist/src/tuix-modal/TuixModal.styles.d.ts +2 -0
- package/dist/src/tuix-modal/TuixModal.styles.js +55 -0
- package/dist/src/tuix-paper/TuixPaper.d.ts +7 -4
- package/dist/src/tuix-paper/TuixPaper.js +29 -23
- package/dist/src/tuix-paper/TuixPaper.styles.d.ts +1 -0
- package/dist/src/tuix-paper/TuixPaper.styles.js +30 -0
- package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +12 -6
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js +15 -9
- package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +17 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.js +96 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +5 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +135 -0
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +3 -0
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +1 -0
- package/dist/src/tuix-table/TuixTable.d.ts +48 -0
- package/dist/src/tuix-table/TuixTable.js +369 -0
- package/dist/src/tuix-table/TuixTable.styles.d.ts +2 -0
- package/dist/src/tuix-table/TuixTable.styles.js +197 -0
- package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +45 -0
- package/dist/src/tuix-table/interfaces/tuix-table.interface.js +1 -0
- package/dist/src/tuix-text/TuixText.d.ts +7 -4
- package/dist/src/tuix-text/TuixText.js +44 -18
- package/dist/src/tuix-text/TuixText.styles.d.ts +1 -0
- package/dist/src/tuix-text/TuixText.styles.js +146 -65
- package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +25 -11
- package/dist/src/tuix-text/enums/tuix-text.enums.js +61 -14
- package/dist/src/tuix-toast/TuixToast.d.ts +18 -0
- package/dist/src/tuix-toast/TuixToast.js +103 -0
- package/dist/src/tuix-toast/TuixToast.styles.d.ts +3 -0
- package/dist/src/tuix-toast/TuixToast.styles.js +43 -0
- package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +20 -0
- package/dist/src/tuix-toast/enums/tuix-toast.enums.js +59 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +14 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.js +86 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +5 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +134 -0
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +2 -0
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +1 -0
- package/dist/src/utils/colors.d.ts +29 -11
- package/dist/src/utils/colors.js +31 -46
- package/dist/src/utils/darkColors.d.ts +32 -1
- package/dist/src/utils/darkColors.js +33 -11
- package/dist/src/utils/hex-rgb.js +0 -1
- package/dist/src/utils/interfaces/detail-value.interface.d.ts +3 -0
- package/dist/src/utils/interfaces/detail-value.interface.js +1 -0
- package/dist/src/utils/mainVariant.enum.js +0 -1
- package/dist/src/utils/screenSizes.enum.d.ts +2 -2
- package/dist/src/utils/screenSizes.enum.js +2 -4
- package/dist/src/utils/slottedClassName.d.ts +2 -0
- package/dist/src/utils/slottedClassName.js +1 -0
- package/package.json +107 -66
- package/dist/src/index.js.map +0 -1
- package/dist/src/tuix-button/TuixButton.js.map +0 -1
- package/dist/src/tuix-button/TuixButton.styles.js.map +0 -1
- package/dist/src/tuix-button/enums/tuix-button.enums.js.map +0 -1
- package/dist/src/tuix-dropdown/TuixDropdown.js.map +0 -1
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js.map +0 -1
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js.map +0 -1
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js.map +0 -1
- package/dist/src/tuix-icon/TuixIcon.icons.js.map +0 -1
- package/dist/src/tuix-icon/TuixIcon.js.map +0 -1
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js.map +0 -1
- package/dist/src/tuix-icon-button/TuixIconButton.js.map +0 -1
- package/dist/src/tuix-input/TuixInput.js.map +0 -1
- package/dist/src/tuix-input/TuixInput.styles.js.map +0 -1
- package/dist/src/tuix-input/enums/tuix-input.enums.js.map +0 -1
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js.map +0 -1
- package/dist/src/tuix-link/TuixLink.js.map +0 -1
- package/dist/src/tuix-link/enums/linkTarget.enum.js.map +0 -1
- package/dist/src/tuix-paper/TuixPaper.js.map +0 -1
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js.map +0 -1
- package/dist/src/tuix-text/TuixText.js.map +0 -1
- package/dist/src/tuix-text/TuixText.styles.js.map +0 -1
- package/dist/src/tuix-text/enums/tuix-text.enums.js.map +0 -1
- package/dist/src/utils/colors.js.map +0 -1
- package/dist/src/utils/darkColors.js.map +0 -1
- package/dist/src/utils/hex-rgb.js.map +0 -1
- package/dist/src/utils/mainVariant.enum.js.map +0 -1
- package/dist/src/utils/screenSizes.enum.js.map +0 -1
- package/dist/tsconfig.publish.tsbuildinfo +0 -1
|
@@ -24,29 +24,73 @@ export var IconName;
|
|
|
24
24
|
IconName["TRIANGLE_EXCLAMATION"] = "triangle-exclamation";
|
|
25
25
|
IconName["CIRCLE_X"] = "circle-x";
|
|
26
26
|
IconName["LOADER"] = "loader";
|
|
27
|
+
IconName["LOADER_CIRCLE"] = "loader-circle";
|
|
27
28
|
IconName["CIRCLE_CHECK"] = "circle-check";
|
|
28
29
|
IconName["CHEVRON_DOWN"] = "chevron-down";
|
|
29
30
|
IconName["CHEVRON_UP"] = "chevron-up";
|
|
31
|
+
IconName["CHEVRON_LEFT"] = "chevron-left";
|
|
32
|
+
IconName["CHEVRON_RIGHT"] = "chevron-right";
|
|
33
|
+
IconName["CHECK"] = "check";
|
|
34
|
+
IconName["NAV_HAMBURGUER"] = "nav-hamburguer";
|
|
35
|
+
IconName["SUN"] = "sun";
|
|
36
|
+
IconName["MOON"] = "moon";
|
|
37
|
+
IconName["BOOKMARK"] = "bookmark";
|
|
38
|
+
IconName["UPLOAD"] = "upload";
|
|
39
|
+
IconName["DOWNLOAD"] = "download";
|
|
40
|
+
IconName["MAP_PIN"] = "map-pin";
|
|
41
|
+
IconName["PHONE"] = "phone";
|
|
42
|
+
IconName["MAIL"] = "mail";
|
|
43
|
+
IconName["MAILS"] = "mails";
|
|
44
|
+
IconName["LAYERS"] = "layers";
|
|
45
|
+
IconName["SEND"] = "send";
|
|
46
|
+
IconName["FILE"] = "file";
|
|
47
|
+
IconName["FORMAT_LIST"] = "format-list";
|
|
48
|
+
IconName["SAVE"] = "save";
|
|
49
|
+
IconName["SQUARE_CODE"] = "square-code";
|
|
50
|
+
IconName["BRACES"] = "braces";
|
|
51
|
+
IconName["ADD_MAIL"] = "add-mail";
|
|
52
|
+
IconName["MAIL_LOGO"] = "mail-logo";
|
|
53
|
+
IconName["BUILDING"] = "building";
|
|
54
|
+
IconName["CODE"] = "code";
|
|
55
|
+
IconName["USER_PLUS"] = "user-plus";
|
|
56
|
+
IconName["FACEBOOK"] = "facebook";
|
|
57
|
+
IconName["TWITTER"] = "twitter";
|
|
58
|
+
IconName["LINKEDIN"] = "linkedin";
|
|
59
|
+
IconName["SHARE"] = "share";
|
|
60
|
+
IconName["COPY"] = "copy";
|
|
61
|
+
IconName["GOOGLE"] = "google";
|
|
62
|
+
IconName["BELL"] = "bell";
|
|
63
|
+
IconName["GEAR"] = "gear";
|
|
64
|
+
IconName["LOGOUT"] = "logout";
|
|
65
|
+
IconName["CIRCLE_EXCLAMATION"] = "circle-exclamation";
|
|
66
|
+
IconName["CAMERA"] = "camera";
|
|
67
|
+
IconName["PENCIL"] = "pencil";
|
|
68
|
+
IconName["X"] = "x";
|
|
69
|
+
IconName["PLUS"] = "plus";
|
|
70
|
+
IconName["INVOICE"] = "invoice";
|
|
71
|
+
IconName["DELETE"] = "delete";
|
|
72
|
+
IconName["TRIANGLE_ARROW_DOWN"] = "triangle-arrow-down";
|
|
73
|
+
IconName["USERS"] = "users";
|
|
74
|
+
IconName["CLOCK"] = "clock";
|
|
75
|
+
IconName["CHECK_CLOCK"] = "check-clock";
|
|
76
|
+
IconName["GLOBE"] = "globe";
|
|
77
|
+
IconName["CALENDAR"] = "calendar";
|
|
78
|
+
IconName["STATS"] = "stats";
|
|
79
|
+
IconName["HOLIDAYS"] = "holidays";
|
|
80
|
+
IconName["TRENDING_UP"] = "trending-up";
|
|
81
|
+
IconName["ARCHIVE"] = "archive";
|
|
82
|
+
IconName["ACCESS_TOKEN"] = "access-token";
|
|
83
|
+
IconName["RESIZE"] = "resize";
|
|
84
|
+
IconName["CHAT"] = "chat";
|
|
85
|
+
IconName["MESSAGE_CIRCLE"] = "message-circle";
|
|
86
|
+
IconName["BOOK"] = "book";
|
|
87
|
+
IconName["MORE_HORIZONTAL"] = "more-horizontal";
|
|
88
|
+
IconName["BOT"] = "bot";
|
|
89
|
+
IconName["SCROLL_DOWN"] = "scroll-down";
|
|
90
|
+
IconName["PLAY"] = "play";
|
|
91
|
+
IconName["EXTERNAL_LINK"] = "external-link";
|
|
92
|
+
IconName["TRIANGLE_RIGHT"] = "triangle-right";
|
|
93
|
+
IconName["FILE_PLUS"] = "file-plus";
|
|
94
|
+
IconName["FILE_TEXT"] = "file-text";
|
|
95
|
+
IconName["HIGHLIGHT"] = "highlight";
|
|
30
96
|
})(IconName || (IconName = {}));
|
|
31
|
-
export var IconColor;
|
|
32
|
-
(function (IconColor) {
|
|
33
|
-
IconColor["primary_50"] = "#F2F2F8";
|
|
34
|
-
IconColor["primary_100"] = "#D7D7EA";
|
|
35
|
-
IconColor["primary_200"] = "#BEC0DA";
|
|
36
|
-
IconColor["primary"] = "#585A9D";
|
|
37
|
-
IconColor["primary_700"] = "#494B83";
|
|
38
|
-
IconColor["primary_900"] = "#33355B";
|
|
39
|
-
IconColor["secondary"] = "#BBADFF";
|
|
40
|
-
IconColor["white"] = "#FFFFFF";
|
|
41
|
-
IconColor["black"] = "#000000";
|
|
42
|
-
IconColor["neutral_200"] = "#C9C8D3";
|
|
43
|
-
IconColor["neutral_600"] = "#8A8894";
|
|
44
|
-
IconColor["success"] = "#439F6E";
|
|
45
|
-
IconColor["validation"] = "#FFB82E";
|
|
46
|
-
IconColor["validation_50"] = "FFFBF4";
|
|
47
|
-
IconColor["validation_200"] = "FFEAC1";
|
|
48
|
-
IconColor["error"] = "#F93232";
|
|
49
|
-
IconColor["error_50"] = "#FFF5F5";
|
|
50
|
-
IconColor["error_200"] = "#FFD8D8";
|
|
51
|
-
})(IconColor || (IconColor = {}));
|
|
52
|
-
//# sourceMappingURL=tuix-icon.enums.js.map
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
|
|
3
|
-
import '../tuix-
|
|
4
|
-
|
|
5
|
-
export declare class TuixIconButton extends LitElement {
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { IconName } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
3
|
+
import { TuixBaseButton } from '../tuix-button/TuixBaseButton.js';
|
|
4
|
+
export declare class TuixIconButton extends TuixBaseButton {
|
|
6
5
|
static styles: import("lit").CSSResult[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
private _getIconColor;
|
|
11
|
-
private _handleClick;
|
|
12
|
-
private _iconTemplate;
|
|
13
|
-
protected render(): TemplateResult;
|
|
6
|
+
icon: IconName;
|
|
7
|
+
protected _updateIconColor(): void;
|
|
8
|
+
protected _buttonContent(): TemplateResult;
|
|
14
9
|
}
|
|
@@ -1,53 +1,21 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
-
import '../
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { buttonTextColor } from '../tuix-button/enums/tuix-button.enums';
|
|
10
|
-
import { MainVariant } from '../utils/mainVariant.enum';
|
|
11
|
-
let TuixIconButton = class TuixIconButton extends LitElement {
|
|
5
|
+
import { ScreenSizes } from '../utils/screenSizes.enum.js';
|
|
6
|
+
import { buttonColorStyles, hostButtonStyles, } from '../tuix-button/TuixButton.styles.js';
|
|
7
|
+
import { TuixBaseButton } from '../tuix-button/TuixBaseButton.js';
|
|
8
|
+
let TuixIconButton = class TuixIconButton extends TuixBaseButton {
|
|
12
9
|
constructor() {
|
|
13
10
|
super(...arguments);
|
|
14
|
-
this.
|
|
15
|
-
this.disabled = false;
|
|
11
|
+
this.icon = IconName.ARROW_DOWN;
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
iconColor = buttonTextColor[this.variant];
|
|
20
|
-
if (this.disabled)
|
|
21
|
-
iconColor = palette.primary_200;
|
|
22
|
-
return iconColor;
|
|
23
|
-
}
|
|
24
|
-
_handleClick() {
|
|
25
|
-
this.dispatchEvent(new CustomEvent('click', { bubbles: true }));
|
|
26
|
-
}
|
|
27
|
-
_iconTemplate(iconName) {
|
|
28
|
-
return html `<tuix-icon
|
|
29
|
-
size="${IconSizeVariant.MEDIUM}"
|
|
30
|
-
name="${iconName}"
|
|
31
|
-
color="${this._getIconColor()}"
|
|
32
|
-
></tuix-icon>`;
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
return html `
|
|
36
|
-
<button
|
|
37
|
-
@click=${this._handleClick}
|
|
38
|
-
class="button ${this.variant}"
|
|
39
|
-
?disabled="${this.disabled}"
|
|
40
|
-
>
|
|
41
|
-
${this.icon ? this._iconTemplate(this.icon) : nothing}
|
|
42
|
-
</button>
|
|
43
|
-
`;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
TuixIconButton.styles = [
|
|
47
|
-
css `
|
|
13
|
+
static { this.styles = [
|
|
14
|
+
css `
|
|
48
15
|
.button {
|
|
49
16
|
padding: 16px;
|
|
50
17
|
border-radius: 4px;
|
|
18
|
+
border: none;
|
|
51
19
|
}
|
|
52
20
|
|
|
53
21
|
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
@@ -62,14 +30,18 @@ TuixIconButton.styles = [
|
|
|
62
30
|
}
|
|
63
31
|
}
|
|
64
32
|
`,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
33
|
+
hostButtonStyles,
|
|
34
|
+
buttonColorStyles,
|
|
35
|
+
]; }
|
|
36
|
+
_updateIconColor() {
|
|
37
|
+
if (!this.icon)
|
|
38
|
+
return;
|
|
39
|
+
this.iconColor = this._getTextColor();
|
|
40
|
+
}
|
|
41
|
+
_buttonContent() {
|
|
42
|
+
return html `${this._iconTemplate(this.icon, IconSizeVariant.MEDIUM)}`;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
73
45
|
__decorate([
|
|
74
46
|
property({ type: IconName })
|
|
75
47
|
], TuixIconButton.prototype, "icon", void 0);
|
|
@@ -77,4 +49,3 @@ TuixIconButton = __decorate([
|
|
|
77
49
|
customElement('tuix-icon-button')
|
|
78
50
|
], TuixIconButton);
|
|
79
51
|
export { TuixIconButton };
|
|
80
|
-
//# sourceMappingURL=TuixIconButton.js.map
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
1
|
+
import { LitElement, type TemplateResult, CSSResult, type PropertyValueMap } from 'lit';
|
|
2
2
|
import '../tuix-icon/TuixIcon.js';
|
|
3
|
-
import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
|
|
3
|
+
import { IconName } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
4
4
|
import { DescriptionType, InputType } from './enums/tuix-input.enums.js';
|
|
5
5
|
export declare class TuixInput extends LitElement {
|
|
6
|
-
|
|
6
|
+
_inputId: string;
|
|
7
|
+
static styles: CSSResult[];
|
|
7
8
|
disabled: boolean;
|
|
8
9
|
iconRight?: IconName;
|
|
9
10
|
value: string;
|
|
10
11
|
placeholder: string;
|
|
11
12
|
title: string;
|
|
12
13
|
type: InputType;
|
|
13
|
-
maxlength
|
|
14
|
-
description
|
|
14
|
+
maxlength?: number;
|
|
15
|
+
description?: string;
|
|
15
16
|
descriptionType: DescriptionType;
|
|
16
17
|
dark: boolean;
|
|
17
18
|
readonly: boolean;
|
|
19
|
+
autofocus: boolean;
|
|
18
20
|
private _inputElement;
|
|
19
21
|
private _type;
|
|
20
22
|
private _letterCounter;
|
|
21
23
|
private _previousType;
|
|
22
|
-
private
|
|
24
|
+
private _previousValue;
|
|
23
25
|
private _generalIconColorsLight;
|
|
24
26
|
private _generalIconColorsDark;
|
|
25
27
|
private _handleInputBase;
|
|
28
|
+
private _handleClickOnInput;
|
|
26
29
|
private _handleInput;
|
|
27
|
-
private
|
|
30
|
+
private _handleBlur;
|
|
28
31
|
private _handlePasswordIconClick;
|
|
29
32
|
private _formatIconSet;
|
|
30
33
|
private _updateLetterCounter;
|
|
@@ -34,6 +37,8 @@ export declare class TuixInput extends LitElement {
|
|
|
34
37
|
private _getFeatureTemplateByInputType;
|
|
35
38
|
private _getInputElementClasses;
|
|
36
39
|
private _getInputContainerClasses;
|
|
40
|
+
private _getMainContainerClasses;
|
|
41
|
+
private _setIdInput;
|
|
37
42
|
private _getInputTemplate;
|
|
38
43
|
private _getLetterCounterTemplate;
|
|
39
44
|
private _hasLetterCounter;
|
|
@@ -43,4 +48,5 @@ export declare class TuixInput extends LitElement {
|
|
|
43
48
|
private _hasValidDescriptionType;
|
|
44
49
|
private _getDescriptionContainerTemplate;
|
|
45
50
|
protected render(): TemplateResult;
|
|
51
|
+
protected updated(changedProperties: PropertyValueMap<unknown>): void;
|
|
46
52
|
}
|
|
@@ -1,56 +1,80 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { LitElement, html, nothing, } from 'lit';
|
|
3
3
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import '../tuix-icon/TuixIcon.js';
|
|
6
|
-
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
7
|
+
import { Palette } from '../utils/colors.js';
|
|
8
|
+
import { DarkPalette } from '../utils/darkColors.js';
|
|
9
9
|
import { hostStyles, inputColorStyles, inputComponentStyles, inputDescriptionStyles, inputFontStyles, inputIconStyles, inputSearchStyles, inputTitleStyles, } from './TuixInput.styles.js';
|
|
10
10
|
import { DescriptionType, IconByDescriptionType, IconDescriptionColorDark, IconDescriptionColorLight, InputIconLocation, InputType, } from './enums/tuix-input.enums.js';
|
|
11
|
+
import { InputState, } from './interfaces/tuix-input.interface.js';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
13
|
let TuixInput = class TuixInput extends LitElement {
|
|
12
14
|
constructor() {
|
|
13
|
-
var _a;
|
|
14
15
|
super(...arguments);
|
|
16
|
+
this._inputId = this._setIdInput();
|
|
15
17
|
this.disabled = false;
|
|
16
18
|
this.value = '';
|
|
17
19
|
this.placeholder = '';
|
|
18
20
|
this.title = '';
|
|
19
21
|
this.type = InputType.TEXT;
|
|
20
|
-
this.maxlength = undefined;
|
|
21
|
-
this.description = undefined;
|
|
22
22
|
this.descriptionType = DescriptionType.TEXT;
|
|
23
23
|
this.dark = false;
|
|
24
24
|
this.readonly = false;
|
|
25
|
+
this.autofocus = false;
|
|
25
26
|
this._type = this.type;
|
|
26
|
-
this._letterCounter =
|
|
27
|
+
this._letterCounter = this.value?.length || 0;
|
|
27
28
|
this._previousType = this.type;
|
|
28
|
-
this.
|
|
29
|
+
this._previousValue = '';
|
|
29
30
|
this._generalIconColorsLight = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
[InputState.INACTIVE]: Palette.BLACK,
|
|
32
|
+
[InputState.ACTIVE]: Palette.MAIN,
|
|
33
|
+
[InputState.DISABLED]: Palette.PRIMARY_300,
|
|
33
34
|
};
|
|
34
35
|
this._generalIconColorsDark = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
[InputState.INACTIVE]: DarkPalette.PRIMARY_100,
|
|
37
|
+
[InputState.ACTIVE]: DarkPalette.MAIN,
|
|
38
|
+
[InputState.DISABLED]: DarkPalette.PRIMARY_800,
|
|
38
39
|
};
|
|
39
40
|
}
|
|
41
|
+
static { this.styles = [
|
|
42
|
+
hostStyles,
|
|
43
|
+
inputComponentStyles,
|
|
44
|
+
inputFontStyles,
|
|
45
|
+
inputColorStyles,
|
|
46
|
+
inputTitleStyles,
|
|
47
|
+
inputIconStyles,
|
|
48
|
+
inputSearchStyles,
|
|
49
|
+
inputDescriptionStyles,
|
|
50
|
+
]; }
|
|
40
51
|
_handleInputBase(e, eventName) {
|
|
41
52
|
this.dispatchEvent(new CustomEvent(eventName, {
|
|
42
53
|
detail: {
|
|
43
|
-
|
|
54
|
+
// The listener is on the input itself, so the target is always one
|
|
55
|
+
// of the two; the fallback keeps the detail a string, which is what
|
|
56
|
+
// `CustomEventTuixInput` promises, rather than `false`.
|
|
57
|
+
value: e.target instanceof HTMLInputElement ||
|
|
58
|
+
e.target instanceof HTMLTextAreaElement
|
|
59
|
+
? e.target.value
|
|
60
|
+
: '',
|
|
44
61
|
},
|
|
45
62
|
bubbles: true,
|
|
46
63
|
}));
|
|
47
64
|
}
|
|
65
|
+
_handleClickOnInput() {
|
|
66
|
+
if (this.disabled)
|
|
67
|
+
return;
|
|
68
|
+
this.dispatchEvent(new CustomEvent('on-click', {
|
|
69
|
+
bubbles: true,
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
48
72
|
_handleInput(e) {
|
|
49
|
-
this._handleInputBase(e, '
|
|
73
|
+
this._handleInputBase(e, 'on-change');
|
|
50
74
|
this._updateLetterCounter();
|
|
51
75
|
}
|
|
52
|
-
|
|
53
|
-
this._handleInputBase(e, '
|
|
76
|
+
_handleBlur(e) {
|
|
77
|
+
this._handleInputBase(e, 'on-blur');
|
|
54
78
|
}
|
|
55
79
|
_handlePasswordIconClick() {
|
|
56
80
|
if (this._type === InputType.PASSWORD) {
|
|
@@ -81,9 +105,8 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
81
105
|
</div>`;
|
|
82
106
|
}
|
|
83
107
|
_updateLetterCounter() {
|
|
84
|
-
var _a;
|
|
85
108
|
if (this.maxlength != undefined && this.type === InputType.TEXT_AREA) {
|
|
86
|
-
this._letterCounter = (
|
|
109
|
+
this._letterCounter = Number(this._inputElement.value?.length);
|
|
87
110
|
}
|
|
88
111
|
}
|
|
89
112
|
_getInputTextFeatureTemplate() {
|
|
@@ -98,14 +121,14 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
98
121
|
}
|
|
99
122
|
_getInputSearchFeatureTemplate() {
|
|
100
123
|
const searchIconColorsLight = {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
124
|
+
[InputState.INACTIVE]: Palette.BLACK,
|
|
125
|
+
[InputState.ACTIVE]: Palette.BLACK,
|
|
126
|
+
[InputState.DISABLED]: Palette.PRIMARY_300,
|
|
104
127
|
};
|
|
105
128
|
const searchIconColorsDark = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
129
|
+
[InputState.INACTIVE]: DarkPalette.PRIMARY_100,
|
|
130
|
+
[InputState.ACTIVE]: DarkPalette.PRIMARY_100,
|
|
131
|
+
[InputState.DISABLED]: DarkPalette.PRIMARY_800,
|
|
109
132
|
};
|
|
110
133
|
return html `${this._formatIconSet({
|
|
111
134
|
iconName: IconName.SEARCH,
|
|
@@ -142,6 +165,7 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
142
165
|
: false;
|
|
143
166
|
return {
|
|
144
167
|
't-input': true,
|
|
168
|
+
't-textarea': this.type === InputType.TEXT_AREA,
|
|
145
169
|
'with-title': !!this.title,
|
|
146
170
|
'with-icon-right': hasIconRight,
|
|
147
171
|
[`with-${this.descriptionType}`]: this.descriptionType !== DescriptionType.TEXT,
|
|
@@ -153,8 +177,17 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
153
177
|
't-textarea-container': this.type === InputType.TEXT_AREA,
|
|
154
178
|
};
|
|
155
179
|
}
|
|
180
|
+
_getMainContainerClasses() {
|
|
181
|
+
return {
|
|
182
|
+
't-textarea-main-container': this.type === InputType.TEXT_AREA,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
_setIdInput() {
|
|
186
|
+
return uuidv4();
|
|
187
|
+
}
|
|
156
188
|
_getInputTemplate() {
|
|
157
189
|
return html `<input
|
|
190
|
+
id=${this._inputId}
|
|
158
191
|
type="text"
|
|
159
192
|
class="${classMap(this._getInputElementClasses())}"
|
|
160
193
|
?disabled="${this.disabled}"
|
|
@@ -164,10 +197,14 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
164
197
|
placeholder="${this.placeholder || ' '}"
|
|
165
198
|
maxlength="${this.maxlength}"
|
|
166
199
|
@input="${this._handleInput}"
|
|
167
|
-
@
|
|
200
|
+
@blur="${this._handleBlur}"
|
|
168
201
|
>
|
|
169
202
|
</input>
|
|
170
|
-
${this.title
|
|
203
|
+
${this.title
|
|
204
|
+
? html `<label for=${this._inputId} class="t-title"
|
|
205
|
+
>${this.title}</label
|
|
206
|
+
>`
|
|
207
|
+
: nothing}
|
|
171
208
|
${this._getFeatureTemplateByInputType()}
|
|
172
209
|
`;
|
|
173
210
|
}
|
|
@@ -188,6 +225,7 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
188
225
|
}
|
|
189
226
|
_getTextAreaTemplate() {
|
|
190
227
|
return html `<textarea
|
|
228
|
+
id="${this._inputId}"
|
|
191
229
|
class="${classMap(this._getInputElementClasses())}"
|
|
192
230
|
?disabled="${this.disabled}"
|
|
193
231
|
?readonly="${this.readonly}"
|
|
@@ -195,10 +233,12 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
195
233
|
placeholder="${this.placeholder}"
|
|
196
234
|
maxlength="${this.maxlength}"
|
|
197
235
|
@input="${this._handleInput}"
|
|
198
|
-
@
|
|
236
|
+
@blur="${this._handleBlur}"
|
|
199
237
|
></textarea>
|
|
200
238
|
${this.title
|
|
201
|
-
? html `<
|
|
239
|
+
? html `<label for=${this._inputId} class="t-title"
|
|
240
|
+
>${this.title}</label
|
|
241
|
+
>`
|
|
202
242
|
: nothing} `;
|
|
203
243
|
}
|
|
204
244
|
_getIconDescriptionTemplate() {
|
|
@@ -216,7 +256,6 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
216
256
|
</tuix-icon>`;
|
|
217
257
|
}
|
|
218
258
|
_getDescriptionTemplate() {
|
|
219
|
-
var _a;
|
|
220
259
|
const isValidDescriptionType = this._hasValidDescriptionType();
|
|
221
260
|
if (!isValidDescriptionType) {
|
|
222
261
|
return html `<div></div>`;
|
|
@@ -231,7 +270,7 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
231
270
|
return html `<div class="t-input-description">
|
|
232
271
|
${this._getIconDescriptionTemplate()}
|
|
233
272
|
<span
|
|
234
|
-
>${
|
|
273
|
+
>${this.description ?? defaultDescription[this.descriptionType]}</span
|
|
235
274
|
>
|
|
236
275
|
</div>`;
|
|
237
276
|
}
|
|
@@ -256,30 +295,36 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
256
295
|
this._previousType = this.type;
|
|
257
296
|
this._type = this.type;
|
|
258
297
|
}
|
|
259
|
-
if (this.
|
|
260
|
-
this.
|
|
298
|
+
if (this._previousValue !== this.value) {
|
|
299
|
+
this._previousValue = this.value;
|
|
261
300
|
this._letterCounter = this.value.length;
|
|
262
301
|
}
|
|
263
|
-
return html `<div class="${classMap(this.
|
|
302
|
+
return html `<div class="${classMap(this._getMainContainerClasses())}">
|
|
303
|
+
<div
|
|
304
|
+
class="${classMap(this._getInputContainerClasses())}"
|
|
305
|
+
@click="${this._handleClickOnInput}"
|
|
306
|
+
>
|
|
264
307
|
${this.type === InputType.TEXT_AREA
|
|
265
308
|
? this._getTextAreaTemplate()
|
|
266
309
|
: this._getInputTemplate()}
|
|
267
310
|
</div>
|
|
268
|
-
${this._getDescriptionContainerTemplate()}
|
|
311
|
+
${this._getDescriptionContainerTemplate()}
|
|
312
|
+
</div>`;
|
|
313
|
+
}
|
|
314
|
+
updated(changedProperties) {
|
|
315
|
+
for (const [propName] of changedProperties) {
|
|
316
|
+
if (this.disabled || this.readonly)
|
|
317
|
+
break;
|
|
318
|
+
if (String(propName) !== 'autofocus')
|
|
319
|
+
continue;
|
|
320
|
+
if (this.autofocus) {
|
|
321
|
+
this._inputElement.focus();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
269
324
|
}
|
|
270
325
|
};
|
|
271
|
-
TuixInput.styles = [
|
|
272
|
-
hostStyles,
|
|
273
|
-
inputComponentStyles,
|
|
274
|
-
inputFontStyles,
|
|
275
|
-
inputColorStyles,
|
|
276
|
-
inputTitleStyles,
|
|
277
|
-
inputIconStyles,
|
|
278
|
-
inputSearchStyles,
|
|
279
|
-
inputDescriptionStyles,
|
|
280
|
-
];
|
|
281
326
|
__decorate([
|
|
282
|
-
property({ type: Boolean })
|
|
327
|
+
property({ type: Boolean, reflect: true })
|
|
283
328
|
], TuixInput.prototype, "disabled", void 0);
|
|
284
329
|
__decorate([
|
|
285
330
|
property({ type: IconName })
|
|
@@ -297,7 +342,7 @@ __decorate([
|
|
|
297
342
|
property({ type: InputType })
|
|
298
343
|
], TuixInput.prototype, "type", void 0);
|
|
299
344
|
__decorate([
|
|
300
|
-
property({ type: Number
|
|
345
|
+
property({ type: Number })
|
|
301
346
|
], TuixInput.prototype, "maxlength", void 0);
|
|
302
347
|
__decorate([
|
|
303
348
|
property({ type: String })
|
|
@@ -306,11 +351,14 @@ __decorate([
|
|
|
306
351
|
property({ type: DescriptionType })
|
|
307
352
|
], TuixInput.prototype, "descriptionType", void 0);
|
|
308
353
|
__decorate([
|
|
309
|
-
property({ type: Boolean })
|
|
354
|
+
property({ type: Boolean, reflect: true })
|
|
310
355
|
], TuixInput.prototype, "dark", void 0);
|
|
311
356
|
__decorate([
|
|
312
357
|
property({ type: Boolean })
|
|
313
358
|
], TuixInput.prototype, "readonly", void 0);
|
|
359
|
+
__decorate([
|
|
360
|
+
property({ type: Boolean, reflect: true })
|
|
361
|
+
], TuixInput.prototype, "autofocus", void 0);
|
|
314
362
|
__decorate([
|
|
315
363
|
query('.t-input-container .t-input')
|
|
316
364
|
], TuixInput.prototype, "_inputElement", void 0);
|
|
@@ -324,4 +372,3 @@ TuixInput = __decorate([
|
|
|
324
372
|
customElement('tuix-input')
|
|
325
373
|
], TuixInput);
|
|
326
374
|
export { TuixInput };
|
|
327
|
-
//# sourceMappingURL=TuixInput.js.map
|