tuix-webcomponents 0.1.0 → 0.3.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/dist/src/index.d.ts +20 -0
- package/dist/src/index.js +13 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/tuix-button/TuixBaseButton.d.ts +17 -0
- package/dist/src/tuix-button/TuixBaseButton.js +63 -0
- package/dist/src/tuix-button/TuixBaseButton.js.map +1 -0
- package/dist/src/tuix-button/TuixButton.d.ts +5 -12
- package/dist/src/tuix-button/TuixButton.js +16 -49
- package/dist/src/tuix-button/TuixButton.js.map +1 -1
- package/dist/src/tuix-button/TuixButton.styles.d.ts +1 -0
- package/dist/src/tuix-button/TuixButton.styles.js +66 -36
- package/dist/src/tuix-button/TuixButton.styles.js.map +1 -1
- package/dist/src/tuix-button/enums/tuix-button.enums.js +3 -3
- package/dist/src/tuix-button/enums/tuix-button.enums.js.map +1 -1
- package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +1 -0
- package/dist/src/tuix-button/interfaces/tuix-button.interface.js +2 -0
- package/dist/src/tuix-button/interfaces/tuix-button.interface.js.map +1 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +15 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.js +96 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.js.map +1 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +4 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +117 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.js.map +1 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +21 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +24 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js.map +1 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +5 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +2 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js.map +1 -0
- package/dist/src/tuix-dropdown/TuixDropdown.d.ts +3 -1
- package/dist/src/tuix-dropdown/TuixDropdown.js +16 -6
- package/dist/src/tuix-dropdown/TuixDropdown.js.map +1 -1
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +26 -11
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js.map +1 -1
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +0 -6
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +0 -7
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js.map +1 -1
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +4 -0
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js.map +1 -1
- package/dist/src/tuix-icon/TuixIcon.d.ts +2 -1
- package/dist/src/tuix-icon/TuixIcon.icons.js +6 -2
- package/dist/src/tuix-icon/TuixIcon.icons.js.map +1 -1
- package/dist/src/tuix-icon/TuixIcon.js +10 -5
- package/dist/src/tuix-icon/TuixIcon.js.map +1 -1
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +2 -21
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +1 -21
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js.map +1 -1
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +6 -11
- package/dist/src/tuix-icon-button/TuixIconButton.js +13 -41
- package/dist/src/tuix-icon-button/TuixIconButton.js.map +1 -1
- package/dist/src/tuix-input/TuixInput.d.ts +3 -2
- package/dist/src/tuix-input/TuixInput.js +28 -20
- package/dist/src/tuix-input/TuixInput.js.map +1 -1
- package/dist/src/tuix-input/TuixInput.styles.js +40 -28
- package/dist/src/tuix-input/TuixInput.styles.js.map +1 -1
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +10 -8
- package/dist/src/tuix-input/enums/tuix-input.enums.js +10 -10
- package/dist/src/tuix-input/enums/tuix-input.enums.js.map +1 -1
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +2 -0
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js.map +1 -1
- package/dist/src/tuix-link/TuixLink.d.ts +2 -0
- package/dist/src/tuix-link/TuixLink.js +20 -8
- package/dist/src/tuix-link/TuixLink.js.map +1 -1
- package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +4 -4
- package/dist/src/tuix-link/enums/linkTarget.enum.js +4 -4
- package/dist/src/tuix-link/enums/linkTarget.enum.js.map +1 -1
- package/dist/src/tuix-paper/TuixPaper.d.ts +4 -2
- package/dist/src/tuix-paper/TuixPaper.js +23 -6
- package/dist/src/tuix-paper/TuixPaper.js.map +1 -1
- package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +6 -6
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js +8 -8
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js.map +1 -1
- package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +16 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.js +87 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.js.map +1 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +5 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +130 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.js.map +1 -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 +2 -0
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js.map +1 -0
- package/dist/src/tuix-text/TuixText.d.ts +5 -4
- package/dist/src/tuix-text/TuixText.js +17 -3
- package/dist/src/tuix-text/TuixText.js.map +1 -1
- package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +11 -9
- package/dist/src/tuix-text/enums/tuix-text.enums.js +29 -11
- package/dist/src/tuix-text/enums/tuix-text.enums.js.map +1 -1
- package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +13 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.js +77 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.js.map +1 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +5 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +116 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js.map +1 -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 +2 -0
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js.map +1 -0
- package/dist/src/utils/colors.d.ts +23 -11
- package/dist/src/utils/colors.js +25 -45
- package/dist/src/utils/colors.js.map +1 -1
- package/dist/src/utils/darkColors.d.ts +24 -1
- package/dist/src/utils/darkColors.js +25 -10
- package/dist/src/utils/darkColors.js.map +1 -1
- package/dist/src/utils/interfaces/detail-value.interface.d.ts +3 -0
- package/dist/src/utils/interfaces/detail-value.interface.js +2 -0
- package/dist/src/utils/interfaces/detail-value.interface.js.map +1 -0
- package/dist/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -4,18 +4,20 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
4
4
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
5
5
|
import { IconName, IconSizeVariant, iconSize } from './enums/tuix-icon.enums';
|
|
6
6
|
import { iconTemplate } from './TuixIcon.icons';
|
|
7
|
-
import {
|
|
7
|
+
import { Palette } from '../utils/colors';
|
|
8
8
|
let TuixIcon = class TuixIcon extends LitElement {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.name = IconName.ARROW_DOWN;
|
|
12
|
-
this.color = palette.black;
|
|
13
12
|
this.size = IconSizeVariant.SMALL;
|
|
13
|
+
this.dark = false;
|
|
14
14
|
}
|
|
15
15
|
_getSelectedColor() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const defaultValue = this.dark ? Palette.WHITE : Palette.BLACK;
|
|
17
|
+
let selectedColor = this.color || defaultValue;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(Palette, selectedColor)) {
|
|
19
|
+
const nameColor = selectedColor;
|
|
20
|
+
selectedColor = Palette[nameColor];
|
|
19
21
|
}
|
|
20
22
|
return selectedColor;
|
|
21
23
|
}
|
|
@@ -58,6 +60,9 @@ __decorate([
|
|
|
58
60
|
__decorate([
|
|
59
61
|
property({ type: IconSizeVariant })
|
|
60
62
|
], TuixIcon.prototype, "size", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: Boolean })
|
|
65
|
+
], TuixIcon.prototype, "dark", void 0);
|
|
61
66
|
TuixIcon = __decorate([
|
|
62
67
|
customElement('tuix-icon')
|
|
63
68
|
], TuixIcon);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TuixIcon.js","sourceRoot":"","sources":["../../../src/tuix-icon/TuixIcon.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,UAAU;IAAxC;;QAgBE,SAAI,GAAG,QAAQ,CAAC,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TuixIcon.js","sourceRoot":"","sources":["../../../src/tuix-icon/TuixIcon.ts"],"names":[],"mappings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,MAAM,aAAa,GAAG;YACpB,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,YAAY;SACrB,CAAC;QAEF,OAAO,IAAI,CAAA;2CAC4B,QAAQ,CAAC,aAAa,CAAC;UACxD,IAAI,CAAC,gBAAgB,EAAE;;KAE5B,CAAC;IACJ,CAAC;;AAtDM,eAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;GAYlB,AAZY,CAYX;AAGF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;sCACF;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;sCACP;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACf;AAzBF,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAwDpB;SAxDY,QAAQ","sourcesContent":["import { LitElement, TemplateResult, css, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { IconName, IconSizeVariant, iconSize } from './enums/tuix-icon.enums';\nimport { iconTemplate } from './TuixIcon.icons';\nimport { Palette } from '../utils/colors';\n\n@customElement('tuix-icon')\nexport class TuixIcon extends LitElement {\n static styles = css`\n .icon-component {\n width: 24px;\n height: 24px;\n display: block;\n }\n\n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n `;\n\n @property({ type: IconName })\n name = IconName.ARROW_DOWN;\n\n @property({ type: String })\n color?: string;\n\n @property({ type: IconSizeVariant })\n size = IconSizeVariant.SMALL;\n\n @property({ type: Boolean })\n dark = false;\n\n private _getSelectedColor() {\n const defaultValue = this.dark ? Palette.WHITE : Palette.BLACK;\n let selectedColor = this.color || defaultValue;\n if (Object.prototype.hasOwnProperty.call(Palette, selectedColor)) {\n const nameColor = selectedColor as keyof typeof Palette;\n selectedColor = Palette[nameColor];\n }\n\n return selectedColor;\n }\n\n private _getIconTemplate(): TemplateResult {\n return iconTemplate(this.name, this._getSelectedColor());\n }\n\n render() {\n const selectedSize = iconSize[this.size] ?? iconSize[IconSizeVariant.SMALL];\n\n const dynamicStyles = {\n width: selectedSize,\n height: selectedSize,\n };\n\n return html`\n <div class=\"icon-component\" style=\"${styleMap(dynamicStyles)}\">\n ${this._getIconTemplate()}\n </div>\n `;\n }\n}\n"]}
|
|
@@ -19,25 +19,6 @@ export declare enum IconName {
|
|
|
19
19
|
LOADER = "loader",
|
|
20
20
|
CIRCLE_CHECK = "circle-check",
|
|
21
21
|
CHEVRON_DOWN = "chevron-down",
|
|
22
|
-
CHEVRON_UP = "chevron-up"
|
|
23
|
-
|
|
24
|
-
export declare enum IconColor {
|
|
25
|
-
primary_50 = "#F2F2F8",
|
|
26
|
-
primary_100 = "#D7D7EA",
|
|
27
|
-
primary_200 = "#BEC0DA",
|
|
28
|
-
primary = "#585A9D",
|
|
29
|
-
primary_700 = "#494B83",
|
|
30
|
-
primary_900 = "#33355B",
|
|
31
|
-
secondary = "#BBADFF",
|
|
32
|
-
white = "#FFFFFF",
|
|
33
|
-
black = "#000000",
|
|
34
|
-
neutral_200 = "#C9C8D3",
|
|
35
|
-
neutral_600 = "#8A8894",
|
|
36
|
-
success = "#439F6E",
|
|
37
|
-
validation = "#FFB82E",
|
|
38
|
-
validation_50 = "FFFBF4",
|
|
39
|
-
validation_200 = "FFEAC1",
|
|
40
|
-
error = "#F93232",
|
|
41
|
-
error_50 = "#FFF5F5",
|
|
42
|
-
error_200 = "#FFD8D8"
|
|
22
|
+
CHEVRON_UP = "chevron-up",
|
|
23
|
+
CHECK = "check"
|
|
43
24
|
}
|
|
@@ -27,26 +27,6 @@ export var IconName;
|
|
|
27
27
|
IconName["CIRCLE_CHECK"] = "circle-check";
|
|
28
28
|
IconName["CHEVRON_DOWN"] = "chevron-down";
|
|
29
29
|
IconName["CHEVRON_UP"] = "chevron-up";
|
|
30
|
+
IconName["CHECK"] = "check";
|
|
30
31
|
})(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
32
|
//# sourceMappingURL=tuix-icon.enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuix-icon.enums.js","sourceRoot":"","sources":["../../../../src/tuix-icon/enums/tuix-icon.enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,CAAC,MAAM,QAAQ,GAAoC;IACvD,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM;IAC/B,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM;IAChC,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM;IAC/B,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM;CAC/B,CAAC;AAEF,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"tuix-icon.enums.js","sourceRoot":"","sources":["../../../../src/tuix-icon/enums/tuix-icon.enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,CAAC,MAAM,QAAQ,GAAoC;IACvD,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM;IAC/B,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM;IAChC,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,MAAM;IAC/B,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM;CAC/B,CAAC;AAEF,MAAM,CAAN,IAAY,QAgBX;AAhBD,WAAY,QAAQ;IAClB,qCAAyB,CAAA;IACzB,qCAAyB,CAAA;IACzB,iCAAqB,CAAA;IACrB,uCAA2B,CAAA;IAC3B,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,+BAAmB,CAAA;IACnB,6CAAiC,CAAA;IACjC,yDAA6C,CAAA;IAC7C,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,yCAA6B,CAAA;IAC7B,yCAA6B,CAAA;IAC7B,qCAAyB,CAAA;IACzB,2BAAe,CAAA;AACjB,CAAC,EAhBW,QAAQ,KAAR,QAAQ,QAgBnB","sourcesContent":["export enum IconSizeVariant {\n SMALL = 'small',\n MEDIUM = 'medium',\n LARGE = 'large',\n FULL = 'full',\n}\n\nexport const iconSize: Record<IconSizeVariant, string> = {\n [IconSizeVariant.SMALL]: '16px',\n [IconSizeVariant.MEDIUM]: '24px',\n [IconSizeVariant.LARGE]: '32px',\n [IconSizeVariant.FULL]: '100%',\n};\n\nexport enum IconName {\n ARROW_DOWN = 'arrow-down',\n ARROW_LEFT = 'arrow-left',\n ARROW_UP = 'arrow-up',\n ARROW_RIGHT = 'arrow-right',\n SEARCH = 'search',\n EYE_ON = 'eye-on',\n EYE_OFF = 'eye-off',\n EYE_CLOSE_LINE = 'eye-close-line',\n TRIANGLE_EXCLAMATION = 'triangle-exclamation',\n CIRCLE_X = 'circle-x',\n LOADER = 'loader',\n CIRCLE_CHECK = 'circle-check',\n CHEVRON_DOWN = 'chevron-down',\n CHEVRON_UP = 'chevron-up',\n CHECK = 'check',\n}\n"]}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
2
|
import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
|
|
3
|
-
import '../tuix-
|
|
4
|
-
|
|
5
|
-
export declare class TuixIconButton extends LitElement {
|
|
3
|
+
import { TuixBaseButton } from '../tuix-button/TuixBaseButton';
|
|
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,46 +1,22 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
3
|
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
-
import '../tuix-icon/TuixIcon.js';
|
|
6
|
-
import { palette } from '../utils/colors';
|
|
7
5
|
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
8
|
-
import { buttonColorStyles } from '../tuix-button/TuixButton.styles';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
let TuixIconButton = class TuixIconButton extends LitElement {
|
|
6
|
+
import { buttonColorStyles, hostButtonStyles, } from '../tuix-button/TuixButton.styles';
|
|
7
|
+
import { TuixBaseButton } from '../tuix-button/TuixBaseButton';
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
iconColor = palette.primary_200;
|
|
22
|
-
return iconColor;
|
|
13
|
+
_updateIconColor() {
|
|
14
|
+
if (!this.icon)
|
|
15
|
+
return;
|
|
16
|
+
this.iconColor = this._getTextColor();
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
this.
|
|
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
|
-
`;
|
|
18
|
+
_buttonContent() {
|
|
19
|
+
return html `${this._iconTemplate(this.icon, IconSizeVariant.MEDIUM)}`;
|
|
44
20
|
}
|
|
45
21
|
};
|
|
46
22
|
TuixIconButton.styles = [
|
|
@@ -48,6 +24,7 @@ TuixIconButton.styles = [
|
|
|
48
24
|
.button {
|
|
49
25
|
padding: 16px;
|
|
50
26
|
border-radius: 4px;
|
|
27
|
+
border: none;
|
|
51
28
|
}
|
|
52
29
|
|
|
53
30
|
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
@@ -62,14 +39,9 @@ TuixIconButton.styles = [
|
|
|
62
39
|
}
|
|
63
40
|
}
|
|
64
41
|
`,
|
|
42
|
+
hostButtonStyles,
|
|
65
43
|
buttonColorStyles,
|
|
66
44
|
];
|
|
67
|
-
__decorate([
|
|
68
|
-
property({ type: MainVariant })
|
|
69
|
-
], TuixIconButton.prototype, "variant", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
property({ type: Boolean })
|
|
72
|
-
], TuixIconButton.prototype, "disabled", void 0);
|
|
73
45
|
__decorate([
|
|
74
46
|
property({ type: IconName })
|
|
75
47
|
], TuixIconButton.prototype, "icon", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TuixIconButton.js","sourceRoot":"","sources":["../../../src/tuix-icon-button/TuixIconButton.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TuixIconButton.js","sourceRoot":"","sources":["../../../src/tuix-icon-button/TuixIconButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,cAAc;IAAlD;;QA0BE,SAAI,GAAG,QAAQ,CAAC,UAAU,CAAC;IAU7B,CAAC;IARoB,gBAAgB;QACjC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IAEkB,cAAc;QAC/B,OAAO,IAAI,CAAA,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IACxE,CAAC;;AAlCM,qBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;2CAOoC,WAAW,CAAC,MAAM;;;;;;2CAMlB,WAAW,CAAC,MAAM;;;;;KAKxD;IACD,gBAAgB;IAChB,iBAAiB;CAClB,AAtBY,CAsBX;AAGF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;4CACF;AA1BhB,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAoC1B;SApCY,cAAc","sourcesContent":["import { TemplateResult, css, html } from 'lit';\nimport { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ScreenSizes } from '../utils/screenSizes.enum';\nimport {\n buttonColorStyles,\n hostButtonStyles,\n} from '../tuix-button/TuixButton.styles';\nimport { TuixBaseButton } from '../tuix-button/TuixBaseButton';\n\n@customElement('tuix-icon-button')\nexport class TuixIconButton extends TuixBaseButton {\n static styles = [\n css`\n .button {\n padding: 16px;\n border-radius: 4px;\n border: none;\n }\n\n @media only screen and (max-width: ${ScreenSizes.TABLET}px) {\n .button {\n padding: 12px;\n }\n }\n\n @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {\n .button {\n padding: 8px;\n }\n }\n `,\n hostButtonStyles,\n buttonColorStyles,\n ];\n\n @property({ type: IconName })\n icon = IconName.ARROW_DOWN;\n\n protected override _updateIconColor() {\n if (!this.icon) return;\n this.iconColor = this._getTextColor();\n }\n\n protected override _buttonContent(): TemplateResult {\n return html`${this._iconTemplate(this.icon, IconSizeVariant.MEDIUM)}`;\n }\n}\n"]}
|
|
@@ -10,8 +10,8 @@ export declare class TuixInput extends LitElement {
|
|
|
10
10
|
placeholder: string;
|
|
11
11
|
title: string;
|
|
12
12
|
type: InputType;
|
|
13
|
-
maxlength
|
|
14
|
-
description
|
|
13
|
+
maxlength?: number;
|
|
14
|
+
description?: string;
|
|
15
15
|
descriptionType: DescriptionType;
|
|
16
16
|
dark: boolean;
|
|
17
17
|
readonly: boolean;
|
|
@@ -23,6 +23,7 @@ export declare class TuixInput extends LitElement {
|
|
|
23
23
|
private _generalIconColorsLight;
|
|
24
24
|
private _generalIconColorsDark;
|
|
25
25
|
private _handleInputBase;
|
|
26
|
+
private _handleClickOnInput;
|
|
26
27
|
private _handleInput;
|
|
27
28
|
private _handleChange;
|
|
28
29
|
private _handlePasswordIconClick;
|
|
@@ -4,8 +4,8 @@ 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
6
|
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
11
|
let TuixInput = class TuixInput extends LitElement {
|
|
@@ -17,8 +17,6 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
17
17
|
this.placeholder = '';
|
|
18
18
|
this.title = '';
|
|
19
19
|
this.type = InputType.TEXT;
|
|
20
|
-
this.maxlength = undefined;
|
|
21
|
-
this.description = undefined;
|
|
22
20
|
this.descriptionType = DescriptionType.TEXT;
|
|
23
21
|
this.dark = false;
|
|
24
22
|
this.readonly = false;
|
|
@@ -27,14 +25,14 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
27
25
|
this._previousType = this.type;
|
|
28
26
|
this._preivousValue = '';
|
|
29
27
|
this._generalIconColorsLight = {
|
|
30
|
-
inactive:
|
|
31
|
-
active:
|
|
32
|
-
disabled:
|
|
28
|
+
inactive: Palette.BLACK,
|
|
29
|
+
active: Palette.MAIN,
|
|
30
|
+
disabled: Palette.PRIMARY_300,
|
|
33
31
|
};
|
|
34
32
|
this._generalIconColorsDark = {
|
|
35
|
-
inactive:
|
|
36
|
-
active:
|
|
37
|
-
disabled:
|
|
33
|
+
inactive: DarkPalette.PRIMARY_100,
|
|
34
|
+
active: DarkPalette.MAIN,
|
|
35
|
+
disabled: DarkPalette.PRIMARY_800,
|
|
38
36
|
};
|
|
39
37
|
}
|
|
40
38
|
_handleInputBase(e, eventName) {
|
|
@@ -45,6 +43,13 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
45
43
|
bubbles: true,
|
|
46
44
|
}));
|
|
47
45
|
}
|
|
46
|
+
_handleClickOnInput() {
|
|
47
|
+
if (this.disabled)
|
|
48
|
+
return;
|
|
49
|
+
this.dispatchEvent(new CustomEvent('click-on-input', {
|
|
50
|
+
bubbles: true,
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
48
53
|
_handleInput(e) {
|
|
49
54
|
this._handleInputBase(e, 'input-single');
|
|
50
55
|
this._updateLetterCounter();
|
|
@@ -98,14 +103,14 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
98
103
|
}
|
|
99
104
|
_getInputSearchFeatureTemplate() {
|
|
100
105
|
const searchIconColorsLight = {
|
|
101
|
-
inactive:
|
|
102
|
-
active:
|
|
103
|
-
disabled:
|
|
106
|
+
inactive: Palette.BLACK,
|
|
107
|
+
active: Palette.BLACK,
|
|
108
|
+
disabled: Palette.PRIMARY_300,
|
|
104
109
|
};
|
|
105
110
|
const searchIconColorsDark = {
|
|
106
|
-
inactive:
|
|
107
|
-
active:
|
|
108
|
-
disabled:
|
|
111
|
+
inactive: DarkPalette.PRIMARY_100,
|
|
112
|
+
active: DarkPalette.PRIMARY_100,
|
|
113
|
+
disabled: DarkPalette.PRIMARY_800,
|
|
109
114
|
};
|
|
110
115
|
return html `${this._formatIconSet({
|
|
111
116
|
iconName: IconName.SEARCH,
|
|
@@ -260,7 +265,10 @@ let TuixInput = class TuixInput extends LitElement {
|
|
|
260
265
|
this._preivousValue = this.value;
|
|
261
266
|
this._letterCounter = this.value.length;
|
|
262
267
|
}
|
|
263
|
-
return html `<div
|
|
268
|
+
return html `<div
|
|
269
|
+
class="${classMap(this._getInputContainerClasses())}"
|
|
270
|
+
@click="${this._handleClickOnInput}"
|
|
271
|
+
>
|
|
264
272
|
${this.type === InputType.TEXT_AREA
|
|
265
273
|
? this._getTextAreaTemplate()
|
|
266
274
|
: this._getInputTemplate()}
|
|
@@ -279,7 +287,7 @@ TuixInput.styles = [
|
|
|
279
287
|
inputDescriptionStyles,
|
|
280
288
|
];
|
|
281
289
|
__decorate([
|
|
282
|
-
property({ type: Boolean })
|
|
290
|
+
property({ type: Boolean, reflect: true })
|
|
283
291
|
], TuixInput.prototype, "disabled", void 0);
|
|
284
292
|
__decorate([
|
|
285
293
|
property({ type: IconName })
|
|
@@ -297,7 +305,7 @@ __decorate([
|
|
|
297
305
|
property({ type: InputType })
|
|
298
306
|
], TuixInput.prototype, "type", void 0);
|
|
299
307
|
__decorate([
|
|
300
|
-
property({ type: Number
|
|
308
|
+
property({ type: Number })
|
|
301
309
|
], TuixInput.prototype, "maxlength", void 0);
|
|
302
310
|
__decorate([
|
|
303
311
|
property({ type: String })
|
|
@@ -306,7 +314,7 @@ __decorate([
|
|
|
306
314
|
property({ type: DescriptionType })
|
|
307
315
|
], TuixInput.prototype, "descriptionType", void 0);
|
|
308
316
|
__decorate([
|
|
309
|
-
property({ type: Boolean })
|
|
317
|
+
property({ type: Boolean, reflect: true })
|
|
310
318
|
], TuixInput.prototype, "dark", void 0);
|
|
311
319
|
__decorate([
|
|
312
320
|
property({ type: Boolean })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TuixInput.js","sourceRoot":"","sources":["../../../src/tuix-input/TuixInput.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,SAAS,GACV,MAAM,6BAA6B,CAAC;AAOrC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAAzC;;;QAaE,aAAQ,GAAG,KAAK,CAAC;QAMjB,UAAK,GAAG,EAAE,CAAC;QAGX,gBAAW,GAAG,EAAE,CAAC;QAGjB,UAAK,GAAG,EAAE,CAAC;QAGX,SAAI,GAAG,SAAS,CAAC,IAAI,CAAC;QAGtB,cAAS,GAAG,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AAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;uCACR;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACpB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CACH;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;kDACG;AAGvC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCACf;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CACX;AAGT;IADP,KAAK,CAAC,6BAA6B,CAAC;gDACI;AAGjC;IADP,KAAK,EAAE;wCACkB;AAGlB;IADP,KAAK,EAAE;iDACyC;AApDtC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA8UrB;SA9UY,SAAS","sourcesContent":["import { LitElement, TemplateResult, html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport '../tuix-icon/TuixIcon.js';\nimport { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';\nimport { palette } from '../utils/colors.js';\nimport { darkPalette } from '../utils/darkColors.js';\nimport {\n hostStyles,\n inputColorStyles,\n inputComponentStyles,\n inputDescriptionStyles,\n inputFontStyles,\n inputIconStyles,\n inputSearchStyles,\n inputTitleStyles,\n} from './TuixInput.styles.js';\nimport {\n DescriptionType,\n IconByDescriptionType,\n IconDescriptionColorDark,\n IconDescriptionColorLight,\n InputIconLocation,\n InputType,\n} from './enums/tuix-input.enums.js';\nimport {\n FormatIconSetParams,\n InputIconColors,\n} from './interfaces/tuix-input.interface.js';\n\n@customElement('tuix-input')\nexport class TuixInput extends LitElement {\n static styles = [\n hostStyles,\n inputComponentStyles,\n inputFontStyles,\n inputColorStyles,\n inputTitleStyles,\n inputIconStyles,\n inputSearchStyles,\n inputDescriptionStyles,\n ];\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: IconName })\n iconRight?: IconName;\n\n @property({ type: String })\n value = '';\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n title = '';\n\n @property({ type: InputType })\n type = InputType.TEXT;\n\n @property({ type: Number, reflect: true })\n maxlength = undefined;\n\n @property({ type: String })\n description = undefined;\n\n @property({ type: DescriptionType })\n descriptionType = DescriptionType.TEXT;\n\n @property({ type: Boolean })\n dark = false;\n\n @property({ type: Boolean })\n readonly = false;\n\n @query('.t-input-container .t-input')\n private _inputElement!: HTMLInputElement;\n\n @state()\n private _type = this.type;\n\n @state()\n private _letterCounter = this.value?.length || 0;\n\n private _previousType = this.type;\n\n private _preivousValue = '';\n\n private _generalIconColorsLight: InputIconColors = {\n inactive: palette.black,\n active: palette.main,\n disabled: palette.primary_300,\n };\n\n private _generalIconColorsDark: InputIconColors = {\n inactive: darkPalette.primary_100,\n active: darkPalette.main,\n disabled: darkPalette.primary_800,\n };\n\n private _handleInputBase(e: InputEvent, eventName: string) {\n this.dispatchEvent(\n new CustomEvent(eventName, {\n detail: {\n value: (e.target as HTMLInputElement).value,\n },\n bubbles: true,\n })\n );\n }\n\n private _handleInput(e: InputEvent) {\n this._handleInputBase(e, 'input-single');\n this._updateLetterCounter();\n }\n\n private _handleChange(e: InputEvent) {\n this._handleInputBase(e, 'change');\n }\n\n private _handlePasswordIconClick() {\n if (this._type === InputType.PASSWORD) {\n this._type = InputType.TEXT;\n this._inputElement.setAttribute('type', InputType.TEXT);\n } else {\n this._type = InputType.PASSWORD;\n this._inputElement.setAttribute('type', InputType.PASSWORD);\n }\n }\n\n private _formatIconSet({\n iconName,\n colorByState,\n location = InputIconLocation.RIGHT,\n clickHandler = undefined,\n }: FormatIconSetParams) {\n const iconSetContainerClasses = {\n 't-icon-set-container': true,\n 't-icon-click': !!clickHandler,\n [`t-icon-${location}`]: true,\n };\n return html`<div\n class=\"${classMap(iconSetContainerClasses)}\"\n @click=\"${clickHandler}\"\n >\n ${Object.entries(colorByState).map(\n ([state, color]) => html`<tuix-icon\n size=\"${IconSizeVariant.FULL}\"\n name=\"${iconName}\"\n color=\"${color}\"\n class=\"t-icon-${state}\"\n ></tuix-icon>`\n )}\n </div>`;\n }\n\n private _updateLetterCounter() {\n if (this.maxlength != undefined && this.type === InputType.TEXT_AREA) {\n this._letterCounter = this._inputElement.value?.length;\n }\n }\n\n private _getInputTextFeatureTemplate(): TemplateResult {\n return html`${this.iconRight\n ? this._formatIconSet({\n iconName: this.iconRight,\n colorByState: this.dark\n ? this._generalIconColorsDark\n : this._generalIconColorsLight,\n })\n : nothing}`;\n }\n\n private _getInputSearchFeatureTemplate(): TemplateResult {\n const searchIconColorsLight: InputIconColors = {\n inactive: palette.black,\n active: palette.black,\n disabled: palette.primary_300,\n };\n const searchIconColorsDark: InputIconColors = {\n inactive: darkPalette.primary_100,\n active: darkPalette.primary_100,\n disabled: darkPalette.primary_800,\n };\n return html`${this._formatIconSet({\n iconName: IconName.SEARCH,\n colorByState: this.dark ? searchIconColorsDark : searchIconColorsLight,\n location: InputIconLocation.LEFT,\n })}`;\n }\n\n private _getInputPasswordFeatureTemplate(): TemplateResult {\n return html`${this._formatIconSet({\n iconName:\n this._type === InputType.PASSWORD\n ? IconName.EYE_CLOSE_LINE\n : IconName.EYE_ON,\n colorByState: this.dark\n ? this._generalIconColorsDark\n : this._generalIconColorsLight,\n clickHandler: this._handlePasswordIconClick,\n })} `;\n }\n\n private _getFeatureTemplateByInputType(): TemplateResult {\n switch (this.type) {\n case InputType.SEARCH:\n return this._getInputSearchFeatureTemplate();\n case InputType.TEXT:\n return this._getInputTextFeatureTemplate();\n case InputType.PASSWORD:\n return this._getInputPasswordFeatureTemplate();\n default:\n return html`${nothing}`;\n }\n }\n\n private _getInputElementClasses() {\n const hasIconRight =\n this.type === InputType.PASSWORD || this.type === InputType.TEXT\n ? !!this.iconRight\n : false;\n return {\n 't-input': true,\n 'with-title': !!this.title,\n 'with-icon-right': hasIconRight,\n [`with-${this.descriptionType}`]:\n this.descriptionType !== DescriptionType.TEXT,\n };\n }\n\n private _getInputContainerClasses() {\n return {\n 't-input-container': true,\n 't-textarea-container': this.type === InputType.TEXT_AREA,\n };\n }\n\n private _getInputTemplate(): TemplateResult {\n return html`<input\n type=\"text\"\n class=\"${classMap(this._getInputElementClasses())}\"\n ?disabled=\"${this.disabled}\"\n ?readonly=\"${this.readonly}\"\n .value=\"${this.value}\"\n .type=\"${this.type}\"\n placeholder=\"${this.placeholder || ' '}\"\n maxlength=\"${this.maxlength}\"\n @input=\"${this._handleInput}\"\n @change=\"${this._handleChange}\"\n >\n </input>\n ${this.title ? html`<div class=\"t-title\">${this.title}</div>` : nothing}\n ${this._getFeatureTemplateByInputType()}\n `;\n }\n\n private _getLetterCounterTemplate(): TemplateResult {\n if (!this._hasLetterCounter()) {\n return html`${nothing}`;\n }\n return html`<div class=\"t-letter-counter\">\n ${this.maxlength\n ? html`${this._letterCounter}/${this.maxlength}`\n : nothing}\n </div> `;\n }\n\n private _hasLetterCounter(): boolean {\n return (\n this.type === InputType.TEXT_AREA &&\n typeof this.maxlength === 'number' &&\n this.maxlength >= 0\n );\n }\n\n private _getTextAreaTemplate(): TemplateResult {\n return html`<textarea\n class=\"${classMap(this._getInputElementClasses())}\"\n ?disabled=\"${this.disabled}\"\n ?readonly=\"${this.readonly}\"\n .value=\"${this.value}\"\n placeholder=\"${this.placeholder}\"\n maxlength=\"${this.maxlength}\"\n @input=\"${this._handleInput}\"\n @change=\"${this._handleChange}\"\n ></textarea>\n ${this.title\n ? html`<div class=\"t-title\">${this.title}</div>`\n : nothing} `;\n }\n\n private _getIconDescriptionTemplate(): TemplateResult {\n if (\n !this.descriptionType ||\n this.descriptionType === DescriptionType.TEXT\n ) {\n return html`${nothing}`;\n }\n return html`<tuix-icon\n size=\"${IconSizeVariant.SMALL}\"\n name=\"${IconByDescriptionType[this.descriptionType]}\"\n color=\"${this.dark\n ? IconDescriptionColorDark[this.descriptionType]\n : IconDescriptionColorLight[this.descriptionType]}\"\n >\n </tuix-icon>`;\n }\n\n private _getDescriptionTemplate(): TemplateResult {\n const isValidDescriptionType = this._hasValidDescriptionType();\n if (!isValidDescriptionType) {\n return html`<div></div>`;\n }\n const defaultDescription = {\n [DescriptionType.WARNING]: 'Warning',\n [DescriptionType.ERROR]: 'Error',\n [DescriptionType.SUCCESS]: 'Success',\n [DescriptionType.LOADING]: 'Loading',\n [DescriptionType.TEXT]: '',\n };\n return html`<div class=\"t-input-description\">\n ${this._getIconDescriptionTemplate()}\n <span\n >${this.description ?? defaultDescription[this.descriptionType]}</span\n >\n </div>`;\n }\n\n private _hasValidDescriptionType(): boolean {\n return Object.values(DescriptionType).includes(this.descriptionType);\n }\n\n private _getDescriptionContainerTemplate(): TemplateResult {\n const hasLetterCounter = this._hasLetterCounter();\n const hasDescription =\n this._hasValidDescriptionType() &&\n (this.descriptionType === DescriptionType.TEXT\n ? !!this.description\n : true);\n if (!hasLetterCounter && !hasDescription) {\n return html`${nothing}`;\n }\n return html`<div class=\"t-input-description-container\">\n ${this._getDescriptionTemplate()} ${this._getLetterCounterTemplate()}\n </div>`;\n }\n\n protected render(): TemplateResult {\n if (this._previousType !== this.type) {\n this._previousType = this.type;\n this._type = this.type;\n }\n if (this._preivousValue !== this.value) {\n this._preivousValue = this.value;\n this._letterCounter = this.value.length;\n }\n return html`<div class=\"${classMap(this._getInputContainerClasses())}\">\n ${this.type === InputType.TEXT_AREA\n ? this._getTextAreaTemplate()\n : this._getInputTemplate()}\n </div>\n ${this._getDescriptionContainerTemplate()} `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TuixInput.js","sourceRoot":"","sources":["../../../src/tuix-input/TuixInput.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,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ADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAC9B;AAGb;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CACX;AAGT;IADP,KAAK,CAAC,6BAA6B,CAAC;gDACI;AAGjC;IADP,KAAK,EAAE;wCACkB;AAGlB;IADP,KAAK,EAAE;iDACyC;AApDtC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA0VrB;SA1VY,SAAS","sourcesContent":["import { LitElement, TemplateResult, html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport '../tuix-icon/TuixIcon.js';\nimport { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';\nimport { Palette } from '../utils/colors.js';\nimport { DarkPalette } from '../utils/darkColors.js';\nimport {\n hostStyles,\n inputColorStyles,\n inputComponentStyles,\n inputDescriptionStyles,\n inputFontStyles,\n inputIconStyles,\n inputSearchStyles,\n inputTitleStyles,\n} from './TuixInput.styles.js';\nimport {\n DescriptionType,\n IconByDescriptionType,\n IconDescriptionColorDark,\n IconDescriptionColorLight,\n InputIconLocation,\n InputType,\n} from './enums/tuix-input.enums.js';\nimport {\n FormatIconSetParams,\n InputIconColors,\n} from './interfaces/tuix-input.interface.js';\n\n@customElement('tuix-input')\nexport class TuixInput extends LitElement {\n static styles = [\n hostStyles,\n inputComponentStyles,\n inputFontStyles,\n inputColorStyles,\n inputTitleStyles,\n inputIconStyles,\n inputSearchStyles,\n inputDescriptionStyles,\n ];\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: IconName })\n iconRight?: IconName;\n\n @property({ type: String })\n value = '';\n\n @property({ type: String })\n placeholder = '';\n\n @property({ type: String })\n title = '';\n\n @property({ type: InputType })\n type = InputType.TEXT;\n\n @property({ type: Number })\n maxlength?: number;\n\n @property({ type: String })\n description?: string;\n\n @property({ type: DescriptionType })\n descriptionType = DescriptionType.TEXT;\n\n @property({ type: Boolean, reflect: true })\n dark = false;\n\n @property({ type: Boolean })\n readonly = false;\n\n @query('.t-input-container .t-input')\n private _inputElement!: HTMLInputElement;\n\n @state()\n private _type = this.type;\n\n @state()\n private _letterCounter = this.value?.length || 0;\n\n private _previousType = this.type;\n\n private _preivousValue = '';\n\n private _generalIconColorsLight: InputIconColors = {\n inactive: Palette.BLACK,\n active: Palette.MAIN,\n disabled: Palette.PRIMARY_300,\n };\n\n private _generalIconColorsDark: InputIconColors = {\n inactive: DarkPalette.PRIMARY_100,\n active: DarkPalette.MAIN,\n disabled: DarkPalette.PRIMARY_800,\n };\n\n private _handleInputBase(e: InputEvent, eventName: string) {\n this.dispatchEvent(\n new CustomEvent(eventName, {\n detail: {\n value: (e.target as HTMLInputElement).value,\n },\n bubbles: true,\n })\n );\n }\n\n private _handleClickOnInput() {\n if (this.disabled) return;\n this.dispatchEvent(\n new CustomEvent('click-on-input', {\n bubbles: true,\n })\n );\n }\n\n private _handleInput(e: InputEvent) {\n this._handleInputBase(e, 'input-single');\n this._updateLetterCounter();\n }\n\n private _handleChange(e: InputEvent) {\n this._handleInputBase(e, 'change');\n }\n\n private _handlePasswordIconClick() {\n if (this._type === InputType.PASSWORD) {\n this._type = InputType.TEXT;\n this._inputElement.setAttribute('type', InputType.TEXT);\n } else {\n this._type = InputType.PASSWORD;\n this._inputElement.setAttribute('type', InputType.PASSWORD);\n }\n }\n\n private _formatIconSet({\n iconName,\n colorByState,\n location = InputIconLocation.RIGHT,\n clickHandler = undefined,\n }: FormatIconSetParams) {\n const iconSetContainerClasses = {\n 't-icon-set-container': true,\n 't-icon-click': !!clickHandler,\n [`t-icon-${location}`]: true,\n };\n return html`<div\n class=\"${classMap(iconSetContainerClasses)}\"\n @click=\"${clickHandler}\"\n >\n ${Object.entries(colorByState).map(\n ([state, color]) => html`<tuix-icon\n size=\"${IconSizeVariant.FULL}\"\n name=\"${iconName}\"\n color=\"${color}\"\n class=\"t-icon-${state}\"\n ></tuix-icon>`\n )}\n </div>`;\n }\n\n private _updateLetterCounter() {\n if (this.maxlength != undefined && this.type === InputType.TEXT_AREA) {\n this._letterCounter = this._inputElement.value?.length;\n }\n }\n\n private _getInputTextFeatureTemplate(): TemplateResult {\n return html`${this.iconRight\n ? this._formatIconSet({\n iconName: this.iconRight,\n colorByState: this.dark\n ? this._generalIconColorsDark\n : this._generalIconColorsLight,\n })\n : nothing}`;\n }\n\n private _getInputSearchFeatureTemplate(): TemplateResult {\n const searchIconColorsLight: InputIconColors = {\n inactive: Palette.BLACK,\n active: Palette.BLACK,\n disabled: Palette.PRIMARY_300,\n };\n const searchIconColorsDark: InputIconColors = {\n inactive: DarkPalette.PRIMARY_100,\n active: DarkPalette.PRIMARY_100,\n disabled: DarkPalette.PRIMARY_800,\n };\n return html`${this._formatIconSet({\n iconName: IconName.SEARCH,\n colorByState: this.dark ? searchIconColorsDark : searchIconColorsLight,\n location: InputIconLocation.LEFT,\n })}`;\n }\n\n private _getInputPasswordFeatureTemplate(): TemplateResult {\n return html`${this._formatIconSet({\n iconName:\n this._type === InputType.PASSWORD\n ? IconName.EYE_CLOSE_LINE\n : IconName.EYE_ON,\n colorByState: this.dark\n ? this._generalIconColorsDark\n : this._generalIconColorsLight,\n clickHandler: this._handlePasswordIconClick,\n })} `;\n }\n\n private _getFeatureTemplateByInputType(): TemplateResult {\n switch (this.type) {\n case InputType.SEARCH:\n return this._getInputSearchFeatureTemplate();\n case InputType.TEXT:\n return this._getInputTextFeatureTemplate();\n case InputType.PASSWORD:\n return this._getInputPasswordFeatureTemplate();\n default:\n return html`${nothing}`;\n }\n }\n\n private _getInputElementClasses() {\n const hasIconRight =\n this.type === InputType.PASSWORD || this.type === InputType.TEXT\n ? !!this.iconRight\n : false;\n return {\n 't-input': true,\n 'with-title': !!this.title,\n 'with-icon-right': hasIconRight,\n [`with-${this.descriptionType}`]:\n this.descriptionType !== DescriptionType.TEXT,\n };\n }\n\n private _getInputContainerClasses() {\n return {\n 't-input-container': true,\n 't-textarea-container': this.type === InputType.TEXT_AREA,\n };\n }\n\n private _getInputTemplate(): TemplateResult {\n return html`<input\n type=\"text\"\n class=\"${classMap(this._getInputElementClasses())}\"\n ?disabled=\"${this.disabled}\"\n ?readonly=\"${this.readonly}\"\n .value=\"${this.value}\"\n .type=\"${this.type}\"\n placeholder=\"${this.placeholder || ' '}\"\n maxlength=\"${this.maxlength}\"\n @input=\"${this._handleInput}\"\n @change=\"${this._handleChange}\"\n >\n </input>\n ${this.title ? html`<div class=\"t-title\">${this.title}</div>` : nothing}\n ${this._getFeatureTemplateByInputType()}\n `;\n }\n\n private _getLetterCounterTemplate(): TemplateResult {\n if (!this._hasLetterCounter()) {\n return html`${nothing}`;\n }\n return html`<div class=\"t-letter-counter\">\n ${this.maxlength\n ? html`${this._letterCounter}/${this.maxlength}`\n : nothing}\n </div> `;\n }\n\n private _hasLetterCounter(): boolean {\n return (\n this.type === InputType.TEXT_AREA &&\n typeof this.maxlength === 'number' &&\n this.maxlength >= 0\n );\n }\n\n private _getTextAreaTemplate(): TemplateResult {\n return html`<textarea\n class=\"${classMap(this._getInputElementClasses())}\"\n ?disabled=\"${this.disabled}\"\n ?readonly=\"${this.readonly}\"\n .value=\"${this.value}\"\n placeholder=\"${this.placeholder}\"\n maxlength=\"${this.maxlength}\"\n @input=\"${this._handleInput}\"\n @change=\"${this._handleChange}\"\n ></textarea>\n ${this.title\n ? html`<div class=\"t-title\">${this.title}</div>`\n : nothing} `;\n }\n\n private _getIconDescriptionTemplate(): TemplateResult {\n if (\n !this.descriptionType ||\n this.descriptionType === DescriptionType.TEXT\n ) {\n return html`${nothing}`;\n }\n return html`<tuix-icon\n size=\"${IconSizeVariant.SMALL}\"\n name=\"${IconByDescriptionType[this.descriptionType]}\"\n color=\"${this.dark\n ? IconDescriptionColorDark[this.descriptionType]\n : IconDescriptionColorLight[this.descriptionType]}\"\n >\n </tuix-icon>`;\n }\n\n private _getDescriptionTemplate(): TemplateResult {\n const isValidDescriptionType = this._hasValidDescriptionType();\n if (!isValidDescriptionType) {\n return html`<div></div>`;\n }\n const defaultDescription = {\n [DescriptionType.WARNING]: 'Warning',\n [DescriptionType.ERROR]: 'Error',\n [DescriptionType.SUCCESS]: 'Success',\n [DescriptionType.LOADING]: 'Loading',\n [DescriptionType.TEXT]: '',\n };\n return html`<div class=\"t-input-description\">\n ${this._getIconDescriptionTemplate()}\n <span\n >${this.description ?? defaultDescription[this.descriptionType]}</span\n >\n </div>`;\n }\n\n private _hasValidDescriptionType(): boolean {\n return Object.values(DescriptionType).includes(this.descriptionType);\n }\n\n private _getDescriptionContainerTemplate(): TemplateResult {\n const hasLetterCounter = this._hasLetterCounter();\n const hasDescription =\n this._hasValidDescriptionType() &&\n (this.descriptionType === DescriptionType.TEXT\n ? !!this.description\n : true);\n if (!hasLetterCounter && !hasDescription) {\n return html`${nothing}`;\n }\n return html`<div class=\"t-input-description-container\">\n ${this._getDescriptionTemplate()} ${this._getLetterCounterTemplate()}\n </div>`;\n }\n\n protected render(): TemplateResult {\n if (this._previousType !== this.type) {\n this._previousType = this.type;\n this._type = this.type;\n }\n if (this._preivousValue !== this.value) {\n this._preivousValue = this.value;\n this._letterCounter = this.value.length;\n }\n return html`<div\n class=\"${classMap(this._getInputContainerClasses())}\"\n @click=\"${this._handleClickOnInput}\"\n >\n ${this.type === InputType.TEXT_AREA\n ? this._getTextAreaTemplate()\n : this._getInputTemplate()}\n </div>\n ${this._getDescriptionContainerTemplate()} `;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css, unsafeCSS } from 'lit';
|
|
2
2
|
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Palette } from '../utils/colors';
|
|
4
|
+
import { DarkPalette } from '../utils/darkColors';
|
|
5
5
|
import { hexToRgb } from '../utils/hex-rgb';
|
|
6
6
|
const inputVars = {
|
|
7
7
|
gapX: '10px',
|
|
@@ -9,31 +9,31 @@ const inputVars = {
|
|
|
9
9
|
iconTabletSize: '1rem',
|
|
10
10
|
paddingX: '1.25rem',
|
|
11
11
|
};
|
|
12
|
-
const rgbDarkValidation = hexToRgb(
|
|
13
|
-
const rgbDarkError = hexToRgb(
|
|
12
|
+
const rgbDarkValidation = hexToRgb(DarkPalette.VALIDATION);
|
|
13
|
+
const rgbDarkError = hexToRgb(DarkPalette.ERROR);
|
|
14
14
|
export const hostStyles = css `
|
|
15
15
|
:host {
|
|
16
|
-
--t-field-color-form: ${unsafeCSS(
|
|
17
|
-
--t-field-color-title: ${unsafeCSS(
|
|
18
|
-
--t-field-color-text: ${unsafeCSS(
|
|
19
|
-
--t-field-color-description: ${unsafeCSS(
|
|
20
|
-
--t-field-color-stroke-hover: ${unsafeCSS(
|
|
21
|
-
--t-field-color-stroke-focus: ${unsafeCSS(
|
|
22
|
-
--t-field-color-text-disabled: ${unsafeCSS(
|
|
23
|
-
--t-field-color-stroke-validation: ${unsafeCSS(
|
|
24
|
-
--t-field-color-bg-validation: ${unsafeCSS(
|
|
25
|
-
--t-field-color-stroke-loading: ${unsafeCSS(
|
|
26
|
-
--t-field-color-bg-error: ${unsafeCSS(
|
|
27
|
-
--t-field-color-stroke-error: ${unsafeCSS(
|
|
16
|
+
--t-field-color-form: ${unsafeCSS(Palette.PRIMARY_50)};
|
|
17
|
+
--t-field-color-title: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
18
|
+
--t-field-color-text: ${unsafeCSS(Palette.BLACK)};
|
|
19
|
+
--t-field-color-description: ${unsafeCSS(Palette.NEUTRAL_600)};
|
|
20
|
+
--t-field-color-stroke-hover: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
21
|
+
--t-field-color-stroke-focus: ${unsafeCSS(Palette.MAIN)};
|
|
22
|
+
--t-field-color-text-disabled: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
23
|
+
--t-field-color-stroke-validation: ${unsafeCSS(Palette.VALIDATION_200)};
|
|
24
|
+
--t-field-color-bg-validation: ${unsafeCSS(Palette.VALIDATION_50)};
|
|
25
|
+
--t-field-color-stroke-loading: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
26
|
+
--t-field-color-bg-error: ${unsafeCSS(Palette.ERROR_50)};
|
|
27
|
+
--t-field-color-stroke-error: ${unsafeCSS(Palette.ERROR_200)};
|
|
28
28
|
--t-field-input-cursor: auto;
|
|
29
29
|
}
|
|
30
30
|
:host([dark]) {
|
|
31
|
-
--t-field-color-form: ${unsafeCSS(
|
|
32
|
-
--t-field-color-text: ${unsafeCSS(
|
|
33
|
-
--t-field-color-description: ${unsafeCSS(
|
|
34
|
-
--t-field-color-stroke-focus: ${unsafeCSS(
|
|
35
|
-
--t-field-color-text-disabled: ${unsafeCSS(
|
|
36
|
-
--t-field-color-stroke-validation: ${unsafeCSS(
|
|
31
|
+
--t-field-color-form: ${unsafeCSS(DarkPalette.PRIMARY_950)};
|
|
32
|
+
--t-field-color-text: ${unsafeCSS(DarkPalette.PRIMARY_100)};
|
|
33
|
+
--t-field-color-description: ${unsafeCSS(DarkPalette.NEUTRAL_200)};
|
|
34
|
+
--t-field-color-stroke-focus: ${unsafeCSS(DarkPalette.SECONDARY)};
|
|
35
|
+
--t-field-color-text-disabled: ${unsafeCSS(DarkPalette.PRIMARY_800)};
|
|
36
|
+
--t-field-color-stroke-validation: ${unsafeCSS(DarkPalette.VALIDATION_200)};
|
|
37
37
|
--t-field-color-bg-validation: rgba(
|
|
38
38
|
${rgbDarkValidation.r},
|
|
39
39
|
${rgbDarkValidation.g},
|
|
@@ -46,7 +46,7 @@ export const hostStyles = css `
|
|
|
46
46
|
${rgbDarkError.b},
|
|
47
47
|
0.2
|
|
48
48
|
);
|
|
49
|
-
--t-field-color-stroke-error: ${unsafeCSS(
|
|
49
|
+
--t-field-color-stroke-error: ${unsafeCSS(DarkPalette.ERROR_200)};
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
52
52
|
export const inputComponentStyles = css `
|
|
@@ -66,6 +66,8 @@ export const inputComponentStyles = css `
|
|
|
66
66
|
border-radius: 4px;
|
|
67
67
|
font-family: 'rubik', sans-serif;
|
|
68
68
|
cursor: var(--t-field-input-cursor);
|
|
69
|
+
width: 100%;
|
|
70
|
+
box-sizing: border-box;
|
|
69
71
|
}
|
|
70
72
|
.t-input.with-title {
|
|
71
73
|
padding-top: 1.5rem;
|
|
@@ -143,8 +145,9 @@ export const inputColorStyles = css `
|
|
|
143
145
|
border: 1px solid var(--t-field-color-stroke-focus);
|
|
144
146
|
outline: 1px solid var(--t-field-color-stroke-focus);
|
|
145
147
|
}
|
|
146
|
-
.t-input[disabled] {
|
|
147
|
-
|
|
148
|
+
.t-input[disabled]:disabled {
|
|
149
|
+
cursor: not-allowed;
|
|
150
|
+
border: none;
|
|
148
151
|
color: var(--t-field-color-text-disabled);
|
|
149
152
|
}
|
|
150
153
|
.t-input.with-title::placeholder {
|
|
@@ -176,6 +179,10 @@ export const inputTitleStyles = css `
|
|
|
176
179
|
transform: translateY(-50%);
|
|
177
180
|
transition-duration: 0.3s;
|
|
178
181
|
pointer-events: none;
|
|
182
|
+
-webkit-user-select: none;
|
|
183
|
+
-moz-user-select: none;
|
|
184
|
+
-ms-user-select: none;
|
|
185
|
+
user-select: none;
|
|
179
186
|
}
|
|
180
187
|
.t-textarea-container .t-title {
|
|
181
188
|
top: 1rem;
|
|
@@ -213,12 +220,13 @@ export const inputTitleStyles = css `
|
|
|
213
220
|
}
|
|
214
221
|
`;
|
|
215
222
|
export const inputIconStyles = css `
|
|
216
|
-
.t-icon-set-container.t-icon-click {
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
223
|
.t-input-container .t-icon-set-container {
|
|
220
224
|
height: ${unsafeCSS(inputVars.iconDesktopSize)};
|
|
221
225
|
width: ${unsafeCSS(inputVars.iconDesktopSize)};
|
|
226
|
+
cursor: var(--t-field-input-cursor);
|
|
227
|
+
}
|
|
228
|
+
.t-icon-set-container.t-icon-click {
|
|
229
|
+
cursor: pointer;
|
|
222
230
|
}
|
|
223
231
|
.t-input-container .t-icon-set-container.t-icon-right {
|
|
224
232
|
position: absolute;
|
|
@@ -251,11 +259,15 @@ export const inputIconStyles = css `
|
|
|
251
259
|
.t-input:focus ~ .t-icon-set-container .t-icon-active {
|
|
252
260
|
display: inline;
|
|
253
261
|
}
|
|
262
|
+
.t-input[disabled] ~ .t-icon-set-container .t-icon-active {
|
|
263
|
+
display: none;
|
|
264
|
+
}
|
|
254
265
|
.t-input[disabled] ~ .t-icon-set-container .t-icon-inactive {
|
|
255
266
|
display: none;
|
|
256
267
|
}
|
|
257
268
|
.t-input[disabled] ~ .t-icon-set-container .t-icon-disabled {
|
|
258
269
|
display: inline;
|
|
270
|
+
cursor: not-allowed;
|
|
259
271
|
}
|
|
260
272
|
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
261
273
|
.t-input-container .t-icon-set-container {
|