tuix-webcomponents 0.64.0 → 0.66.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/src/index.d.ts +36 -0
- package/dist/src/index.js +42 -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 +11 -0
- package/dist/src/tuix-button/TuixButton.js +84 -0
- package/dist/src/tuix-button/TuixButton.styles.d.ts +3 -0
- package/dist/src/tuix-button/TuixButton.styles.js +107 -0
- package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +2 -0
- package/dist/src/tuix-button/enums/tuix-button.enums.js +6 -0
- 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 +15 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.js +106 -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 +55 -0
- package/dist/src/tuix-dropdown/TuixDropdown.js +360 -0
- package/dist/src/tuix-dropdown/TuixDropdown.styles.d.ts +3 -0
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +125 -0
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +4 -0
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +5 -0
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +15 -0
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +1 -0
- package/dist/src/tuix-icon/TuixIcon.d.ts +15 -0
- package/dist/src/tuix-icon/TuixIcon.icons.d.ts +6 -0
- package/dist/{assets/TuixIconButton-eQtxZNXh.js → src/tuix-icon/TuixIcon.icons.js} +125 -203
- package/dist/src/tuix-icon/TuixIcon.js +79 -0
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +62 -0
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +69 -0
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +9 -0
- package/dist/src/tuix-icon-button/TuixIconButton.js +51 -0
- package/dist/src/tuix-input/TuixInput.d.ts +52 -0
- package/dist/src/tuix-input/TuixInput.js +370 -0
- package/dist/src/tuix-input/TuixInput.styles.d.ts +8 -0
- package/dist/src/tuix-input/TuixInput.styles.js +295 -0
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +38 -0
- package/dist/src/tuix-input/enums/tuix-input.enums.js +41 -0
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +18 -0
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js +5 -0
- package/dist/src/tuix-link/TuixLink.d.ts +15 -0
- package/dist/src/tuix-link/TuixLink.js +71 -0
- 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 +6 -0
- package/dist/src/tuix-link/enums/linkTarget.enum.js +7 -0
- package/dist/src/tuix-modal/TuixModal.d.ts +9 -0
- package/dist/src/tuix-modal/TuixModal.js +63 -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 +10 -0
- package/dist/src/tuix-paper/TuixPaper.js +46 -0
- 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 +13 -0
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js +15 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +16 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.js +95 -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 +46 -0
- package/dist/src/tuix-table/TuixTable.js +367 -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 +12 -0
- package/dist/src/tuix-text/TuixText.js +66 -0
- package/dist/src/tuix-text/TuixText.styles.d.ts +2 -0
- package/dist/src/tuix-text/TuixText.styles.js +158 -0
- package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +31 -0
- package/dist/src/tuix-text/enums/tuix-text.enums.js +63 -0
- package/dist/src/tuix-toast/TuixToast.d.ts +15 -0
- package/dist/src/tuix-toast/TuixToast.js +100 -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 +13 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.js +85 -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 -0
- package/dist/src/utils/colors.js +30 -0
- package/dist/src/utils/darkColors.d.ts +31 -0
- package/dist/src/utils/darkColors.js +32 -0
- package/dist/src/utils/hex-rgb.d.ts +5 -0
- package/dist/src/utils/hex-rgb.js +15 -0
- 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.d.ts +4 -0
- package/dist/src/utils/mainVariant.enum.js +5 -0
- package/dist/src/utils/screenSizes.enum.d.ts +4 -0
- package/dist/src/utils/screenSizes.enum.js +5 -0
- package/dist/src/utils/slottedClassName.d.ts +2 -0
- package/dist/src/utils/slottedClassName.js +1 -0
- package/dist/tsconfig.publish.tsbuildinfo +1 -0
- package/package-build/src/index.js +42 -0
- package/package.json +5 -5
- package/dist/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
- package/dist/assets/Color-AVL7NMMY-IH_JbDEF.js +0 -1
- package/dist/assets/DocsRenderer-PQXLIZUC-C0ZKNA9m.js +0 -1286
- package/dist/assets/TuixModal-BZFIHTi_.js +0 -78
- package/dist/assets/TuixToast-BhxwZIGo.js +0 -62
- package/dist/assets/_commonjsHelpers-CqkleIqs.js +0 -1
- package/dist/assets/axe-C59a3kt3.js +0 -30
- package/dist/assets/iframe-ClsPaEIM.js +0 -1057
- package/dist/assets/index-DBzYXxxs.js +0 -1554
- package/dist/assets/index-TjhCmV-u.js +0 -1
- package/dist/assets/matchers-7Z3WT2CE-CcSi9QFY.js +0 -14
- package/dist/assets/screenSizes.enum-C1IhC_dy.js +0 -13
- package/dist/assets/state-CLjydI9z.js +0 -13
- package/dist/assets/tuix-button.stories-Dm_yifox.js +0 -30
- package/dist/assets/tuix-checkbox.stories-DmzoygjC.js +0 -44
- package/dist/assets/tuix-dropdown-object-list.stories-Neeajtj-.js +0 -56
- package/dist/assets/tuix-dropdown.stories-B7ea8QAz.js +0 -28
- package/dist/assets/tuix-icon-button.stories-CgbOSRO4.js +0 -21
- package/dist/assets/tuix-icon.enums-DYTtwLZl.js +0 -1
- package/dist/assets/tuix-icon.stories-CjN2XsKx.js +0 -19
- package/dist/assets/tuix-input.stories-CD7onvw2.js +0 -33
- package/dist/assets/tuix-link.stories-CT7pzGlx.js +0 -35
- package/dist/assets/tuix-modal.stories-B6v3cOPq.js +0 -39
- package/dist/assets/tuix-paper.enum-DhmlUJB7.js +0 -1
- package/dist/assets/tuix-paper.stories-CLnRPHNK.js +0 -31
- package/dist/assets/tuix-radio-button.stories-BwkKC3a9.js +0 -35
- package/dist/assets/tuix-table.stories-Bn-aZa0J.js +0 -65
- package/dist/assets/tuix-text.enums-Ck8cVqZZ.js +0 -1
- package/dist/assets/tuix-text.stories-BNIqPsGD.js +0 -29
- package/dist/assets/tuix-toast.stories-CRYiLiHK.js +0 -21
- package/dist/assets/tuix-toggle-button.stories-CY6wlDnA.js +0 -40
- package/dist/favicon-wrapper.svg +0 -46
- package/dist/favicon.svg +0 -1
- package/dist/iframe.html +0 -685
- package/dist/index.html +0 -160
- package/dist/index.json +0 -1
- 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 +0 -1
- package/dist/sb-addons/a11y-3/manager-bundle.js +0 -5
- package/dist/sb-addons/a11y-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js +0 -356
- package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js.LEGAL.txt +0 -40
- package/dist/sb-addons/docs-2/manager-bundle.js +0 -151
- 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 +0 -971
- 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 +0 -3
- package/dist/sb-addons/vitest-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/favicon-wrapper.svg +0 -46
- package/dist/sb-common-assets/favicon.svg +0 -1
- 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 +0 -797
- package/dist/sb-manager/globals-runtime.js +0 -69679
- package/dist/sb-manager/globals.js +0 -34
- package/dist/sb-manager/runtime.js +0 -13195
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, css, html } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
5
|
+
import { IconName, IconSizeVariant, iconSize } from './enums/tuix-icon.enums';
|
|
6
|
+
import { iconTemplate } from './TuixIcon.icons';
|
|
7
|
+
import { Palette } from '../utils/colors';
|
|
8
|
+
import { TextVariant, colorText, colorTextDark, } from '../tuix-text/enums/tuix-text.enums';
|
|
9
|
+
let TuixIcon = class TuixIcon extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.name = IconName.ARROW_DOWN;
|
|
13
|
+
this.size = IconSizeVariant.SMALL;
|
|
14
|
+
this.dark = false;
|
|
15
|
+
}
|
|
16
|
+
static { this.styles = css `
|
|
17
|
+
.icon-component {
|
|
18
|
+
width: 24px;
|
|
19
|
+
height: 24px;
|
|
20
|
+
display: block;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
svg {
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
`; }
|
|
29
|
+
_getSelectedColor(color) {
|
|
30
|
+
let selectedColor = color || this.color || TextVariant.PRIMARY;
|
|
31
|
+
if (Object.values(TextVariant).includes(selectedColor)) {
|
|
32
|
+
const colorMap = this.dark ? colorTextDark : colorText;
|
|
33
|
+
const nameColor = colorMap[selectedColor];
|
|
34
|
+
return nameColor;
|
|
35
|
+
}
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(Palette, selectedColor)) {
|
|
37
|
+
const nameColor = selectedColor;
|
|
38
|
+
selectedColor = Palette[nameColor];
|
|
39
|
+
}
|
|
40
|
+
return selectedColor;
|
|
41
|
+
}
|
|
42
|
+
_getSelectedFill() {
|
|
43
|
+
return this.fill ? this._getSelectedColor(this.fill) : undefined;
|
|
44
|
+
}
|
|
45
|
+
_getIconTemplate() {
|
|
46
|
+
return iconTemplate(this.name, this._getSelectedColor(), this._getSelectedFill());
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const selectedSize = iconSize[this.size] ?? iconSize[IconSizeVariant.SMALL];
|
|
50
|
+
const dynamicStyles = {
|
|
51
|
+
width: selectedSize,
|
|
52
|
+
height: selectedSize,
|
|
53
|
+
};
|
|
54
|
+
return html `
|
|
55
|
+
<div class="icon-component" style="${styleMap(dynamicStyles)}">
|
|
56
|
+
${this._getIconTemplate()}
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
__decorate([
|
|
62
|
+
property({ type: IconName })
|
|
63
|
+
], TuixIcon.prototype, "name", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property({ type: String })
|
|
66
|
+
], TuixIcon.prototype, "color", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ type: IconSizeVariant })
|
|
69
|
+
], TuixIcon.prototype, "size", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
property({ type: Boolean })
|
|
72
|
+
], TuixIcon.prototype, "dark", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ type: String })
|
|
75
|
+
], TuixIcon.prototype, "fill", void 0);
|
|
76
|
+
TuixIcon = __decorate([
|
|
77
|
+
customElement('tuix-icon')
|
|
78
|
+
], TuixIcon);
|
|
79
|
+
export { TuixIcon };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare enum IconSizeVariant {
|
|
2
|
+
SMALL = "small",
|
|
3
|
+
MEDIUM = "medium",
|
|
4
|
+
LARGE = "large",
|
|
5
|
+
FULL = "full"
|
|
6
|
+
}
|
|
7
|
+
export declare const iconSize: Record<IconSizeVariant, string>;
|
|
8
|
+
export declare enum IconName {
|
|
9
|
+
ARROW_DOWN = "arrow-down",
|
|
10
|
+
ARROW_LEFT = "arrow-left",
|
|
11
|
+
ARROW_UP = "arrow-up",
|
|
12
|
+
ARROW_RIGHT = "arrow-right",
|
|
13
|
+
SEARCH = "search",
|
|
14
|
+
EYE_ON = "eye-on",
|
|
15
|
+
EYE_OFF = "eye-off",
|
|
16
|
+
EYE_CLOSE_LINE = "eye-close-line",
|
|
17
|
+
TRIANGLE_EXCLAMATION = "triangle-exclamation",
|
|
18
|
+
CIRCLE_X = "circle-x",
|
|
19
|
+
LOADER = "loader",
|
|
20
|
+
CIRCLE_CHECK = "circle-check",
|
|
21
|
+
CHEVRON_DOWN = "chevron-down",
|
|
22
|
+
CHEVRON_UP = "chevron-up",
|
|
23
|
+
CHEVRON_LEFT = "chevron-left",
|
|
24
|
+
CHEVRON_RIGHT = "chevron-right",
|
|
25
|
+
CHECK = "check",
|
|
26
|
+
NAV_HAMBURGUER = "nav-hamburguer",
|
|
27
|
+
SUN = "sun",
|
|
28
|
+
MOON = "moon",
|
|
29
|
+
BOOKMARK = "bookmark",
|
|
30
|
+
UPLOAD = "upload",
|
|
31
|
+
DOWNLOAD = "download",
|
|
32
|
+
MAP_PIN = "map-pin",
|
|
33
|
+
PHONE = "phone",
|
|
34
|
+
MAIL = "mail",
|
|
35
|
+
FACEBOOK = "facebook",
|
|
36
|
+
TWITTER = "twitter",
|
|
37
|
+
LINKEDIN = "linkedin",
|
|
38
|
+
SHARE = "share",
|
|
39
|
+
COPY = "copy",
|
|
40
|
+
GOOGLE = "google",
|
|
41
|
+
BELL = "bell",
|
|
42
|
+
GEAR = "gear",
|
|
43
|
+
LOGOUT = "logout",
|
|
44
|
+
CIRCLE_EXCLAMATION = "circle-exclamation",
|
|
45
|
+
CAMERA = "camera",
|
|
46
|
+
PENCIL = "pencil",
|
|
47
|
+
X = "x",
|
|
48
|
+
PLUS = "plus",
|
|
49
|
+
INVOICE = "invoice",
|
|
50
|
+
DELETE = "delete",
|
|
51
|
+
TRIANGLE_ARROW_DOWN = "triangle-arrow-down",
|
|
52
|
+
USERS = "users",
|
|
53
|
+
CLOCK = "clock",
|
|
54
|
+
CHECK_CLOCK = "check-clock",
|
|
55
|
+
GLOBE = "globe",
|
|
56
|
+
CALENDAR = "calendar",
|
|
57
|
+
STATS = "stats",
|
|
58
|
+
HOLIDAYS = "holidays",
|
|
59
|
+
TRENDING_UP = "trending-up",
|
|
60
|
+
ARCHIVE = "archive",
|
|
61
|
+
ACCESS_TOKEN = "access-token"
|
|
62
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export var IconSizeVariant;
|
|
2
|
+
(function (IconSizeVariant) {
|
|
3
|
+
IconSizeVariant["SMALL"] = "small";
|
|
4
|
+
IconSizeVariant["MEDIUM"] = "medium";
|
|
5
|
+
IconSizeVariant["LARGE"] = "large";
|
|
6
|
+
IconSizeVariant["FULL"] = "full";
|
|
7
|
+
})(IconSizeVariant || (IconSizeVariant = {}));
|
|
8
|
+
export const iconSize = {
|
|
9
|
+
[IconSizeVariant.SMALL]: '16px',
|
|
10
|
+
[IconSizeVariant.MEDIUM]: '24px',
|
|
11
|
+
[IconSizeVariant.LARGE]: '32px',
|
|
12
|
+
[IconSizeVariant.FULL]: '100%',
|
|
13
|
+
};
|
|
14
|
+
export var IconName;
|
|
15
|
+
(function (IconName) {
|
|
16
|
+
IconName["ARROW_DOWN"] = "arrow-down";
|
|
17
|
+
IconName["ARROW_LEFT"] = "arrow-left";
|
|
18
|
+
IconName["ARROW_UP"] = "arrow-up";
|
|
19
|
+
IconName["ARROW_RIGHT"] = "arrow-right";
|
|
20
|
+
IconName["SEARCH"] = "search";
|
|
21
|
+
IconName["EYE_ON"] = "eye-on";
|
|
22
|
+
IconName["EYE_OFF"] = "eye-off";
|
|
23
|
+
IconName["EYE_CLOSE_LINE"] = "eye-close-line";
|
|
24
|
+
IconName["TRIANGLE_EXCLAMATION"] = "triangle-exclamation";
|
|
25
|
+
IconName["CIRCLE_X"] = "circle-x";
|
|
26
|
+
IconName["LOADER"] = "loader";
|
|
27
|
+
IconName["CIRCLE_CHECK"] = "circle-check";
|
|
28
|
+
IconName["CHEVRON_DOWN"] = "chevron-down";
|
|
29
|
+
IconName["CHEVRON_UP"] = "chevron-up";
|
|
30
|
+
IconName["CHEVRON_LEFT"] = "chevron-left";
|
|
31
|
+
IconName["CHEVRON_RIGHT"] = "chevron-right";
|
|
32
|
+
IconName["CHECK"] = "check";
|
|
33
|
+
IconName["NAV_HAMBURGUER"] = "nav-hamburguer";
|
|
34
|
+
IconName["SUN"] = "sun";
|
|
35
|
+
IconName["MOON"] = "moon";
|
|
36
|
+
IconName["BOOKMARK"] = "bookmark";
|
|
37
|
+
IconName["UPLOAD"] = "upload";
|
|
38
|
+
IconName["DOWNLOAD"] = "download";
|
|
39
|
+
IconName["MAP_PIN"] = "map-pin";
|
|
40
|
+
IconName["PHONE"] = "phone";
|
|
41
|
+
IconName["MAIL"] = "mail";
|
|
42
|
+
IconName["FACEBOOK"] = "facebook";
|
|
43
|
+
IconName["TWITTER"] = "twitter";
|
|
44
|
+
IconName["LINKEDIN"] = "linkedin";
|
|
45
|
+
IconName["SHARE"] = "share";
|
|
46
|
+
IconName["COPY"] = "copy";
|
|
47
|
+
IconName["GOOGLE"] = "google";
|
|
48
|
+
IconName["BELL"] = "bell";
|
|
49
|
+
IconName["GEAR"] = "gear";
|
|
50
|
+
IconName["LOGOUT"] = "logout";
|
|
51
|
+
IconName["CIRCLE_EXCLAMATION"] = "circle-exclamation";
|
|
52
|
+
IconName["CAMERA"] = "camera";
|
|
53
|
+
IconName["PENCIL"] = "pencil";
|
|
54
|
+
IconName["X"] = "x";
|
|
55
|
+
IconName["PLUS"] = "plus";
|
|
56
|
+
IconName["INVOICE"] = "invoice";
|
|
57
|
+
IconName["DELETE"] = "delete";
|
|
58
|
+
IconName["TRIANGLE_ARROW_DOWN"] = "triangle-arrow-down";
|
|
59
|
+
IconName["USERS"] = "users";
|
|
60
|
+
IconName["CLOCK"] = "clock";
|
|
61
|
+
IconName["CHECK_CLOCK"] = "check-clock";
|
|
62
|
+
IconName["GLOBE"] = "globe";
|
|
63
|
+
IconName["CALENDAR"] = "calendar";
|
|
64
|
+
IconName["STATS"] = "stats";
|
|
65
|
+
IconName["HOLIDAYS"] = "holidays";
|
|
66
|
+
IconName["TRENDING_UP"] = "trending-up";
|
|
67
|
+
IconName["ARCHIVE"] = "archive";
|
|
68
|
+
IconName["ACCESS_TOKEN"] = "access-token";
|
|
69
|
+
})(IconName || (IconName = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
|
|
3
|
+
import { TuixBaseButton } from '../tuix-button/TuixBaseButton';
|
|
4
|
+
export declare class TuixIconButton extends TuixBaseButton {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
icon: IconName;
|
|
7
|
+
protected _updateIconColor(): void;
|
|
8
|
+
protected _buttonContent(): TemplateResult;
|
|
9
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
6
|
+
import { buttonColorStyles, hostButtonStyles, } from '../tuix-button/TuixButton.styles';
|
|
7
|
+
import { TuixBaseButton } from '../tuix-button/TuixBaseButton';
|
|
8
|
+
let TuixIconButton = class TuixIconButton extends TuixBaseButton {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.icon = IconName.ARROW_DOWN;
|
|
12
|
+
}
|
|
13
|
+
static { this.styles = [
|
|
14
|
+
css `
|
|
15
|
+
.button {
|
|
16
|
+
padding: 16px;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
border: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
22
|
+
.button {
|
|
23
|
+
padding: 12px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
|
|
28
|
+
.button {
|
|
29
|
+
padding: 8px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,
|
|
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
|
+
};
|
|
45
|
+
__decorate([
|
|
46
|
+
property({ type: IconName })
|
|
47
|
+
], TuixIconButton.prototype, "icon", void 0);
|
|
48
|
+
TuixIconButton = __decorate([
|
|
49
|
+
customElement('tuix-icon-button')
|
|
50
|
+
], TuixIconButton);
|
|
51
|
+
export { TuixIconButton };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult, CSSResult, type PropertyValueMap } from 'lit';
|
|
2
|
+
import '../tuix-icon/TuixIcon.js';
|
|
3
|
+
import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
|
|
4
|
+
import { DescriptionType, InputType } from './enums/tuix-input.enums.js';
|
|
5
|
+
export declare class TuixInput extends LitElement {
|
|
6
|
+
_inputId: string;
|
|
7
|
+
static styles: CSSResult[];
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
iconRight?: IconName;
|
|
10
|
+
value: string;
|
|
11
|
+
placeholder: string;
|
|
12
|
+
title: string;
|
|
13
|
+
type: InputType;
|
|
14
|
+
maxlength?: number;
|
|
15
|
+
description?: string;
|
|
16
|
+
descriptionType: DescriptionType;
|
|
17
|
+
dark: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
|
+
autofocus: boolean;
|
|
20
|
+
private _inputElement;
|
|
21
|
+
private _type;
|
|
22
|
+
private _letterCounter;
|
|
23
|
+
private _previousType;
|
|
24
|
+
private _previousValue;
|
|
25
|
+
private _generalIconColorsLight;
|
|
26
|
+
private _generalIconColorsDark;
|
|
27
|
+
private _handleInputBase;
|
|
28
|
+
private _handleClickOnInput;
|
|
29
|
+
private _handleInput;
|
|
30
|
+
private _handleBlur;
|
|
31
|
+
private _handlePasswordIconClick;
|
|
32
|
+
private _formatIconSet;
|
|
33
|
+
private _updateLetterCounter;
|
|
34
|
+
private _getInputTextFeatureTemplate;
|
|
35
|
+
private _getInputSearchFeatureTemplate;
|
|
36
|
+
private _getInputPasswordFeatureTemplate;
|
|
37
|
+
private _getFeatureTemplateByInputType;
|
|
38
|
+
private _getInputElementClasses;
|
|
39
|
+
private _getInputContainerClasses;
|
|
40
|
+
private _getMainContainerClasses;
|
|
41
|
+
private _setIdInput;
|
|
42
|
+
private _getInputTemplate;
|
|
43
|
+
private _getLetterCounterTemplate;
|
|
44
|
+
private _hasLetterCounter;
|
|
45
|
+
private _getTextAreaTemplate;
|
|
46
|
+
private _getIconDescriptionTemplate;
|
|
47
|
+
private _getDescriptionTemplate;
|
|
48
|
+
private _hasValidDescriptionType;
|
|
49
|
+
private _getDescriptionContainerTemplate;
|
|
50
|
+
protected render(): TemplateResult;
|
|
51
|
+
protected updated(changedProperties: PropertyValueMap<unknown>): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, nothing, } from 'lit';
|
|
3
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import '../tuix-icon/TuixIcon.js';
|
|
6
|
+
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
7
|
+
import { Palette } from '../utils/colors.js';
|
|
8
|
+
import { DarkPalette } from '../utils/darkColors.js';
|
|
9
|
+
import { hostStyles, inputColorStyles, inputComponentStyles, inputDescriptionStyles, inputFontStyles, inputIconStyles, inputSearchStyles, inputTitleStyles, } from './TuixInput.styles.js';
|
|
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';
|
|
13
|
+
let TuixInput = class TuixInput extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this._inputId = this._setIdInput();
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
this.value = '';
|
|
19
|
+
this.placeholder = '';
|
|
20
|
+
this.title = '';
|
|
21
|
+
this.type = InputType.TEXT;
|
|
22
|
+
this.descriptionType = DescriptionType.TEXT;
|
|
23
|
+
this.dark = false;
|
|
24
|
+
this.readonly = false;
|
|
25
|
+
this.autofocus = false;
|
|
26
|
+
this._type = this.type;
|
|
27
|
+
this._letterCounter = this.value?.length || 0;
|
|
28
|
+
this._previousType = this.type;
|
|
29
|
+
this._previousValue = '';
|
|
30
|
+
this._generalIconColorsLight = {
|
|
31
|
+
[InputState.INACTIVE]: Palette.BLACK,
|
|
32
|
+
[InputState.ACTIVE]: Palette.MAIN,
|
|
33
|
+
[InputState.DISABLED]: Palette.PRIMARY_300,
|
|
34
|
+
};
|
|
35
|
+
this._generalIconColorsDark = {
|
|
36
|
+
[InputState.INACTIVE]: DarkPalette.PRIMARY_100,
|
|
37
|
+
[InputState.ACTIVE]: DarkPalette.MAIN,
|
|
38
|
+
[InputState.DISABLED]: DarkPalette.PRIMARY_800,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
static { this.styles = [
|
|
42
|
+
hostStyles,
|
|
43
|
+
inputComponentStyles,
|
|
44
|
+
inputFontStyles,
|
|
45
|
+
inputColorStyles,
|
|
46
|
+
inputTitleStyles,
|
|
47
|
+
inputIconStyles,
|
|
48
|
+
inputSearchStyles,
|
|
49
|
+
inputDescriptionStyles,
|
|
50
|
+
]; }
|
|
51
|
+
_handleInputBase(e, eventName) {
|
|
52
|
+
this.dispatchEvent(new CustomEvent(eventName, {
|
|
53
|
+
detail: {
|
|
54
|
+
value: (e.target instanceof HTMLInputElement ||
|
|
55
|
+
e.target instanceof HTMLTextAreaElement) &&
|
|
56
|
+
e.target.value,
|
|
57
|
+
},
|
|
58
|
+
bubbles: true,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
_handleClickOnInput() {
|
|
62
|
+
if (this.disabled)
|
|
63
|
+
return;
|
|
64
|
+
this.dispatchEvent(new CustomEvent('on-click', {
|
|
65
|
+
bubbles: true,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
_handleInput(e) {
|
|
69
|
+
this._handleInputBase(e, 'on-change');
|
|
70
|
+
this._updateLetterCounter();
|
|
71
|
+
}
|
|
72
|
+
_handleBlur(e) {
|
|
73
|
+
this._handleInputBase(e, 'on-blur');
|
|
74
|
+
}
|
|
75
|
+
_handlePasswordIconClick() {
|
|
76
|
+
if (this._type === InputType.PASSWORD) {
|
|
77
|
+
this._type = InputType.TEXT;
|
|
78
|
+
this._inputElement.setAttribute('type', InputType.TEXT);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this._type = InputType.PASSWORD;
|
|
82
|
+
this._inputElement.setAttribute('type', InputType.PASSWORD);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
_formatIconSet({ iconName, colorByState, location = InputIconLocation.RIGHT, clickHandler = undefined, }) {
|
|
86
|
+
const iconSetContainerClasses = {
|
|
87
|
+
't-icon-set-container': true,
|
|
88
|
+
't-icon-click': !!clickHandler,
|
|
89
|
+
[`t-icon-${location}`]: true,
|
|
90
|
+
};
|
|
91
|
+
return html `<div
|
|
92
|
+
class="${classMap(iconSetContainerClasses)}"
|
|
93
|
+
@click="${clickHandler}"
|
|
94
|
+
>
|
|
95
|
+
${Object.entries(colorByState).map(([state, color]) => html `<tuix-icon
|
|
96
|
+
size="${IconSizeVariant.FULL}"
|
|
97
|
+
name="${iconName}"
|
|
98
|
+
color="${color}"
|
|
99
|
+
class="t-icon-${state}"
|
|
100
|
+
></tuix-icon>`)}
|
|
101
|
+
</div>`;
|
|
102
|
+
}
|
|
103
|
+
_updateLetterCounter() {
|
|
104
|
+
if (this.maxlength != undefined && this.type === InputType.TEXT_AREA) {
|
|
105
|
+
this._letterCounter = Number(this._inputElement.value?.length);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
_getInputTextFeatureTemplate() {
|
|
109
|
+
return html `${this.iconRight
|
|
110
|
+
? this._formatIconSet({
|
|
111
|
+
iconName: this.iconRight,
|
|
112
|
+
colorByState: this.dark
|
|
113
|
+
? this._generalIconColorsDark
|
|
114
|
+
: this._generalIconColorsLight,
|
|
115
|
+
})
|
|
116
|
+
: nothing}`;
|
|
117
|
+
}
|
|
118
|
+
_getInputSearchFeatureTemplate() {
|
|
119
|
+
const searchIconColorsLight = {
|
|
120
|
+
[InputState.INACTIVE]: Palette.BLACK,
|
|
121
|
+
[InputState.ACTIVE]: Palette.BLACK,
|
|
122
|
+
[InputState.DISABLED]: Palette.PRIMARY_300,
|
|
123
|
+
};
|
|
124
|
+
const searchIconColorsDark = {
|
|
125
|
+
[InputState.INACTIVE]: DarkPalette.PRIMARY_100,
|
|
126
|
+
[InputState.ACTIVE]: DarkPalette.PRIMARY_100,
|
|
127
|
+
[InputState.DISABLED]: DarkPalette.PRIMARY_800,
|
|
128
|
+
};
|
|
129
|
+
return html `${this._formatIconSet({
|
|
130
|
+
iconName: IconName.SEARCH,
|
|
131
|
+
colorByState: this.dark ? searchIconColorsDark : searchIconColorsLight,
|
|
132
|
+
location: InputIconLocation.LEFT,
|
|
133
|
+
})}`;
|
|
134
|
+
}
|
|
135
|
+
_getInputPasswordFeatureTemplate() {
|
|
136
|
+
return html `${this._formatIconSet({
|
|
137
|
+
iconName: this._type === InputType.PASSWORD
|
|
138
|
+
? IconName.EYE_CLOSE_LINE
|
|
139
|
+
: IconName.EYE_ON,
|
|
140
|
+
colorByState: this.dark
|
|
141
|
+
? this._generalIconColorsDark
|
|
142
|
+
: this._generalIconColorsLight,
|
|
143
|
+
clickHandler: this._handlePasswordIconClick,
|
|
144
|
+
})} `;
|
|
145
|
+
}
|
|
146
|
+
_getFeatureTemplateByInputType() {
|
|
147
|
+
switch (this.type) {
|
|
148
|
+
case InputType.SEARCH:
|
|
149
|
+
return this._getInputSearchFeatureTemplate();
|
|
150
|
+
case InputType.TEXT:
|
|
151
|
+
return this._getInputTextFeatureTemplate();
|
|
152
|
+
case InputType.PASSWORD:
|
|
153
|
+
return this._getInputPasswordFeatureTemplate();
|
|
154
|
+
default:
|
|
155
|
+
return html `${nothing}`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
_getInputElementClasses() {
|
|
159
|
+
const hasIconRight = this.type === InputType.PASSWORD || this.type === InputType.TEXT
|
|
160
|
+
? !!this.iconRight
|
|
161
|
+
: false;
|
|
162
|
+
return {
|
|
163
|
+
't-input': true,
|
|
164
|
+
't-textarea': this.type === InputType.TEXT_AREA,
|
|
165
|
+
'with-title': !!this.title,
|
|
166
|
+
'with-icon-right': hasIconRight,
|
|
167
|
+
[`with-${this.descriptionType}`]: this.descriptionType !== DescriptionType.TEXT,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
_getInputContainerClasses() {
|
|
171
|
+
return {
|
|
172
|
+
't-input-container': true,
|
|
173
|
+
't-textarea-container': this.type === InputType.TEXT_AREA,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
_getMainContainerClasses() {
|
|
177
|
+
return {
|
|
178
|
+
't-textarea-main-container': this.type === InputType.TEXT_AREA,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
_setIdInput() {
|
|
182
|
+
return uuidv4();
|
|
183
|
+
}
|
|
184
|
+
_getInputTemplate() {
|
|
185
|
+
return html `<input
|
|
186
|
+
id=${this._inputId}
|
|
187
|
+
type="text"
|
|
188
|
+
class="${classMap(this._getInputElementClasses())}"
|
|
189
|
+
?disabled="${this.disabled}"
|
|
190
|
+
?readonly="${this.readonly}"
|
|
191
|
+
.value="${this.value}"
|
|
192
|
+
.type="${this.type}"
|
|
193
|
+
placeholder="${this.placeholder || ' '}"
|
|
194
|
+
maxlength="${this.maxlength}"
|
|
195
|
+
@input="${this._handleInput}"
|
|
196
|
+
@blur="${this._handleBlur}"
|
|
197
|
+
>
|
|
198
|
+
</input>
|
|
199
|
+
${this.title
|
|
200
|
+
? html `<label for=${this._inputId} class="t-title"
|
|
201
|
+
>${this.title}</label
|
|
202
|
+
>`
|
|
203
|
+
: nothing}
|
|
204
|
+
${this._getFeatureTemplateByInputType()}
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
_getLetterCounterTemplate() {
|
|
208
|
+
if (!this._hasLetterCounter()) {
|
|
209
|
+
return html `${nothing}`;
|
|
210
|
+
}
|
|
211
|
+
return html `<div class="t-letter-counter">
|
|
212
|
+
${this.maxlength
|
|
213
|
+
? html `${this._letterCounter}/${this.maxlength}`
|
|
214
|
+
: nothing}
|
|
215
|
+
</div> `;
|
|
216
|
+
}
|
|
217
|
+
_hasLetterCounter() {
|
|
218
|
+
return (this.type === InputType.TEXT_AREA &&
|
|
219
|
+
typeof this.maxlength === 'number' &&
|
|
220
|
+
this.maxlength >= 0);
|
|
221
|
+
}
|
|
222
|
+
_getTextAreaTemplate() {
|
|
223
|
+
return html `<textarea
|
|
224
|
+
id="${this._inputId}"
|
|
225
|
+
class="${classMap(this._getInputElementClasses())}"
|
|
226
|
+
?disabled="${this.disabled}"
|
|
227
|
+
?readonly="${this.readonly}"
|
|
228
|
+
.value="${this.value}"
|
|
229
|
+
placeholder="${this.placeholder}"
|
|
230
|
+
maxlength="${this.maxlength}"
|
|
231
|
+
@input="${this._handleInput}"
|
|
232
|
+
@blur="${this._handleBlur}"
|
|
233
|
+
></textarea>
|
|
234
|
+
${this.title
|
|
235
|
+
? html `<label for=${this._inputId} class="t-title"
|
|
236
|
+
>${this.title}</label
|
|
237
|
+
>`
|
|
238
|
+
: nothing} `;
|
|
239
|
+
}
|
|
240
|
+
_getIconDescriptionTemplate() {
|
|
241
|
+
if (!this.descriptionType ||
|
|
242
|
+
this.descriptionType === DescriptionType.TEXT) {
|
|
243
|
+
return html `${nothing}`;
|
|
244
|
+
}
|
|
245
|
+
return html `<tuix-icon
|
|
246
|
+
size="${IconSizeVariant.SMALL}"
|
|
247
|
+
name="${IconByDescriptionType[this.descriptionType]}"
|
|
248
|
+
color="${this.dark
|
|
249
|
+
? IconDescriptionColorDark[this.descriptionType]
|
|
250
|
+
: IconDescriptionColorLight[this.descriptionType]}"
|
|
251
|
+
>
|
|
252
|
+
</tuix-icon>`;
|
|
253
|
+
}
|
|
254
|
+
_getDescriptionTemplate() {
|
|
255
|
+
const isValidDescriptionType = this._hasValidDescriptionType();
|
|
256
|
+
if (!isValidDescriptionType) {
|
|
257
|
+
return html `<div></div>`;
|
|
258
|
+
}
|
|
259
|
+
const defaultDescription = {
|
|
260
|
+
[DescriptionType.WARNING]: 'Warning',
|
|
261
|
+
[DescriptionType.ERROR]: 'Error',
|
|
262
|
+
[DescriptionType.SUCCESS]: 'Success',
|
|
263
|
+
[DescriptionType.LOADING]: 'Loading',
|
|
264
|
+
[DescriptionType.TEXT]: '',
|
|
265
|
+
};
|
|
266
|
+
return html `<div class="t-input-description">
|
|
267
|
+
${this._getIconDescriptionTemplate()}
|
|
268
|
+
<span
|
|
269
|
+
>${this.description ?? defaultDescription[this.descriptionType]}</span
|
|
270
|
+
>
|
|
271
|
+
</div>`;
|
|
272
|
+
}
|
|
273
|
+
_hasValidDescriptionType() {
|
|
274
|
+
return Object.values(DescriptionType).includes(this.descriptionType);
|
|
275
|
+
}
|
|
276
|
+
_getDescriptionContainerTemplate() {
|
|
277
|
+
const hasLetterCounter = this._hasLetterCounter();
|
|
278
|
+
const hasDescription = this._hasValidDescriptionType() &&
|
|
279
|
+
(this.descriptionType === DescriptionType.TEXT
|
|
280
|
+
? !!this.description
|
|
281
|
+
: true);
|
|
282
|
+
if (!hasLetterCounter && !hasDescription) {
|
|
283
|
+
return html `${nothing}`;
|
|
284
|
+
}
|
|
285
|
+
return html `<div class="t-input-description-container">
|
|
286
|
+
${this._getDescriptionTemplate()} ${this._getLetterCounterTemplate()}
|
|
287
|
+
</div>`;
|
|
288
|
+
}
|
|
289
|
+
render() {
|
|
290
|
+
if (this._previousType !== this.type) {
|
|
291
|
+
this._previousType = this.type;
|
|
292
|
+
this._type = this.type;
|
|
293
|
+
}
|
|
294
|
+
if (this._previousValue !== this.value) {
|
|
295
|
+
this._previousValue = this.value;
|
|
296
|
+
this._letterCounter = this.value.length;
|
|
297
|
+
}
|
|
298
|
+
return html `<div class="${classMap(this._getMainContainerClasses())}">
|
|
299
|
+
<div
|
|
300
|
+
class="${classMap(this._getInputContainerClasses())}"
|
|
301
|
+
@click="${this._handleClickOnInput}"
|
|
302
|
+
>
|
|
303
|
+
${this.type === InputType.TEXT_AREA
|
|
304
|
+
? this._getTextAreaTemplate()
|
|
305
|
+
: this._getInputTemplate()}
|
|
306
|
+
</div>
|
|
307
|
+
${this._getDescriptionContainerTemplate()}
|
|
308
|
+
</div>`;
|
|
309
|
+
}
|
|
310
|
+
updated(changedProperties) {
|
|
311
|
+
for (const [propName] of changedProperties) {
|
|
312
|
+
if (this.disabled || this.readonly)
|
|
313
|
+
break;
|
|
314
|
+
if (String(propName) !== 'autofocus')
|
|
315
|
+
continue;
|
|
316
|
+
if (this.autofocus) {
|
|
317
|
+
this._inputElement.focus();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
__decorate([
|
|
323
|
+
property({ type: Boolean, reflect: true })
|
|
324
|
+
], TuixInput.prototype, "disabled", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
property({ type: IconName })
|
|
327
|
+
], TuixInput.prototype, "iconRight", void 0);
|
|
328
|
+
__decorate([
|
|
329
|
+
property({ type: String })
|
|
330
|
+
], TuixInput.prototype, "value", void 0);
|
|
331
|
+
__decorate([
|
|
332
|
+
property({ type: String })
|
|
333
|
+
], TuixInput.prototype, "placeholder", void 0);
|
|
334
|
+
__decorate([
|
|
335
|
+
property({ type: String })
|
|
336
|
+
], TuixInput.prototype, "title", void 0);
|
|
337
|
+
__decorate([
|
|
338
|
+
property({ type: InputType })
|
|
339
|
+
], TuixInput.prototype, "type", void 0);
|
|
340
|
+
__decorate([
|
|
341
|
+
property({ type: Number })
|
|
342
|
+
], TuixInput.prototype, "maxlength", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
property({ type: String })
|
|
345
|
+
], TuixInput.prototype, "description", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
property({ type: DescriptionType })
|
|
348
|
+
], TuixInput.prototype, "descriptionType", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
property({ type: Boolean, reflect: true })
|
|
351
|
+
], TuixInput.prototype, "dark", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
property({ type: Boolean })
|
|
354
|
+
], TuixInput.prototype, "readonly", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
property({ type: Boolean, reflect: true })
|
|
357
|
+
], TuixInput.prototype, "autofocus", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
query('.t-input-container .t-input')
|
|
360
|
+
], TuixInput.prototype, "_inputElement", void 0);
|
|
361
|
+
__decorate([
|
|
362
|
+
state()
|
|
363
|
+
], TuixInput.prototype, "_type", void 0);
|
|
364
|
+
__decorate([
|
|
365
|
+
state()
|
|
366
|
+
], TuixInput.prototype, "_letterCounter", void 0);
|
|
367
|
+
TuixInput = __decorate([
|
|
368
|
+
customElement('tuix-input')
|
|
369
|
+
], TuixInput);
|
|
370
|
+
export { TuixInput };
|