tuix-webcomponents 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -21
- package/dist/assets/tuix-styles.css +72 -0
- package/dist/src/index.d.ts +27 -1
- package/dist/src/index.js +19 -16
- package/dist/src/react/index.d.ts +42 -0
- package/dist/src/react/index.js +114 -0
- package/dist/src/tuix-button/TuixBaseButton.d.ts +17 -0
- package/dist/src/tuix-button/TuixBaseButton.js +60 -0
- package/dist/src/tuix-button/TuixButton.d.ts +7 -13
- package/dist/src/tuix-button/TuixButton.js +37 -61
- package/dist/src/tuix-button/TuixButton.styles.d.ts +1 -0
- package/dist/src/tuix-button/TuixButton.styles.js +78 -45
- package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +1 -1
- package/dist/src/tuix-button/enums/tuix-button.enums.js +4 -5
- package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +1 -0
- package/dist/src/tuix-button/interfaces/tuix-button.interface.js +1 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +17 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.js +108 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +4 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +132 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +21 -0
- package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +23 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +5 -0
- package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +1 -0
- package/dist/src/tuix-dropdown/TuixDropdown.d.ts +15 -5
- package/dist/src/tuix-dropdown/TuixDropdown.js +129 -43
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +61 -21
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +0 -6
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +0 -8
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +15 -1
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +0 -1
- package/dist/src/tuix-icon/TuixIcon.d.ts +6 -2
- package/dist/src/tuix-icon/TuixIcon.icons.d.ts +3 -3
- package/dist/src/tuix-icon/TuixIcon.icons.js +299 -7
- package/dist/src/tuix-icon/TuixIcon.js +39 -25
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +67 -21
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +66 -22
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +7 -12
- package/dist/src/tuix-icon-button/TuixIconButton.js +22 -51
- package/dist/src/tuix-input/TuixInput.d.ts +13 -7
- package/dist/src/tuix-input/TuixInput.js +98 -51
- package/dist/src/tuix-input/TuixInput.styles.js +101 -112
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +11 -9
- package/dist/src/tuix-input/enums/tuix-input.enums.js +11 -12
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +13 -8
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js +5 -2
- package/dist/src/tuix-link/TuixLink.d.ts +10 -6
- package/dist/src/tuix-link/TuixLink.js +39 -40
- package/dist/src/tuix-link/TuixLink.styles.d.ts +2 -0
- package/dist/src/tuix-link/TuixLink.styles.js +55 -0
- package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +4 -4
- package/dist/src/tuix-link/enums/linkTarget.enum.js +4 -5
- package/dist/src/tuix-modal/TuixModal.d.ts +11 -0
- package/dist/src/tuix-modal/TuixModal.js +65 -0
- package/dist/src/tuix-modal/TuixModal.styles.d.ts +2 -0
- package/dist/src/tuix-modal/TuixModal.styles.js +55 -0
- package/dist/src/tuix-paper/TuixPaper.d.ts +7 -4
- package/dist/src/tuix-paper/TuixPaper.js +29 -23
- package/dist/src/tuix-paper/TuixPaper.styles.d.ts +1 -0
- package/dist/src/tuix-paper/TuixPaper.styles.js +30 -0
- package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +12 -6
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js +15 -9
- package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +17 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.js +96 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +5 -0
- package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +135 -0
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +3 -0
- package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +1 -0
- package/dist/src/tuix-table/TuixTable.d.ts +48 -0
- package/dist/src/tuix-table/TuixTable.js +369 -0
- package/dist/src/tuix-table/TuixTable.styles.d.ts +2 -0
- package/dist/src/tuix-table/TuixTable.styles.js +197 -0
- package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +45 -0
- package/dist/src/tuix-table/interfaces/tuix-table.interface.js +1 -0
- package/dist/src/tuix-text/TuixText.d.ts +7 -4
- package/dist/src/tuix-text/TuixText.js +44 -18
- package/dist/src/tuix-text/TuixText.styles.d.ts +1 -0
- package/dist/src/tuix-text/TuixText.styles.js +146 -65
- package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +25 -11
- package/dist/src/tuix-text/enums/tuix-text.enums.js +61 -14
- package/dist/src/tuix-toast/TuixToast.d.ts +18 -0
- package/dist/src/tuix-toast/TuixToast.js +103 -0
- package/dist/src/tuix-toast/TuixToast.styles.d.ts +3 -0
- package/dist/src/tuix-toast/TuixToast.styles.js +43 -0
- package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +20 -0
- package/dist/src/tuix-toast/enums/tuix-toast.enums.js +59 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +14 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.js +86 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +5 -0
- package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +134 -0
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +2 -0
- package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +1 -0
- package/dist/src/utils/colors.d.ts +29 -11
- package/dist/src/utils/colors.js +31 -46
- package/dist/src/utils/darkColors.d.ts +32 -1
- package/dist/src/utils/darkColors.js +33 -11
- package/dist/src/utils/hex-rgb.js +0 -1
- package/dist/src/utils/interfaces/detail-value.interface.d.ts +3 -0
- package/dist/src/utils/interfaces/detail-value.interface.js +1 -0
- package/dist/src/utils/mainVariant.enum.js +0 -1
- package/dist/src/utils/screenSizes.enum.d.ts +2 -2
- package/dist/src/utils/screenSizes.enum.js +2 -4
- package/dist/src/utils/slottedClassName.d.ts +2 -0
- package/dist/src/utils/slottedClassName.js +1 -0
- package/package.json +107 -66
- package/dist/src/index.js.map +0 -1
- package/dist/src/tuix-button/TuixButton.js.map +0 -1
- package/dist/src/tuix-button/TuixButton.styles.js.map +0 -1
- package/dist/src/tuix-button/enums/tuix-button.enums.js.map +0 -1
- package/dist/src/tuix-dropdown/TuixDropdown.js.map +0 -1
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js.map +0 -1
- package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js.map +0 -1
- package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js.map +0 -1
- package/dist/src/tuix-icon/TuixIcon.icons.js.map +0 -1
- package/dist/src/tuix-icon/TuixIcon.js.map +0 -1
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js.map +0 -1
- package/dist/src/tuix-icon-button/TuixIconButton.js.map +0 -1
- package/dist/src/tuix-input/TuixInput.js.map +0 -1
- package/dist/src/tuix-input/TuixInput.styles.js.map +0 -1
- package/dist/src/tuix-input/enums/tuix-input.enums.js.map +0 -1
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js.map +0 -1
- package/dist/src/tuix-link/TuixLink.js.map +0 -1
- package/dist/src/tuix-link/enums/linkTarget.enum.js.map +0 -1
- package/dist/src/tuix-paper/TuixPaper.js.map +0 -1
- package/dist/src/tuix-paper/enums/tuix-paper.enum.js.map +0 -1
- package/dist/src/tuix-text/TuixText.js.map +0 -1
- package/dist/src/tuix-text/TuixText.styles.js.map +0 -1
- package/dist/src/tuix-text/enums/tuix-text.enums.js.map +0 -1
- package/dist/src/utils/colors.js.map +0 -1
- package/dist/src/utils/darkColors.js.map +0 -1
- package/dist/src/utils/hex-rgb.js.map +0 -1
- package/dist/src/utils/mainVariant.enum.js.map +0 -1
- package/dist/src/utils/screenSizes.enum.js.map +0 -1
- package/dist/tsconfig.publish.tsbuildinfo +0 -1
|
@@ -1,63 +1,25 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
|
|
4
|
-
import { buttonSizeStyles, buttonColorStyles } from './TuixButton.styles';
|
|
2
|
+
import { css, html, nothing } from 'lit';
|
|
3
|
+
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
4
|
+
import { buttonSizeStyles, buttonColorStyles, hostButtonStyles, } from './TuixButton.styles.js';
|
|
5
5
|
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
-
import '../
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { buttonTextColor } from './enums/tuix-button.enums';
|
|
10
|
-
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
11
|
-
let TuixButton = class TuixButton extends LitElement {
|
|
6
|
+
import { ScreenSizes } from '../utils/screenSizes.enum.js';
|
|
7
|
+
import { TuixBaseButton } from './TuixBaseButton.js';
|
|
8
|
+
let TuixButton = class TuixButton extends TuixBaseButton {
|
|
12
9
|
constructor() {
|
|
13
10
|
super(...arguments);
|
|
14
|
-
this.
|
|
15
|
-
this.variant = MainVariant.PRIMARY;
|
|
16
|
-
this.disabled = false;
|
|
11
|
+
this.full = false;
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
_handleClick() {
|
|
25
|
-
this.dispatchEvent(new CustomEvent('click', { bubbles: true }));
|
|
26
|
-
}
|
|
27
|
-
_iconTemplate(iconName) {
|
|
28
|
-
let iconSize = IconSizeVariant.MEDIUM;
|
|
29
|
-
if (screen.width <= ScreenSizes.TABLET) {
|
|
30
|
-
iconSize = IconSizeVariant.SMALL;
|
|
31
|
-
}
|
|
32
|
-
return html `<tuix-icon
|
|
33
|
-
size="${iconSize}"
|
|
34
|
-
name="${iconName}"
|
|
35
|
-
color="${this._getIconColor()}"
|
|
36
|
-
></tuix-icon>`;
|
|
37
|
-
}
|
|
38
|
-
getButtonStyles() {
|
|
39
|
-
return `${this.variant}`;
|
|
40
|
-
}
|
|
41
|
-
render() {
|
|
42
|
-
return html `<button
|
|
43
|
-
@click=${this._handleClick}
|
|
44
|
-
class="button ${this.getButtonStyles()}"
|
|
45
|
-
?disabled="${this.disabled}"
|
|
46
|
-
>
|
|
47
|
-
<div class="container">
|
|
48
|
-
${this.iconLeft ? this._iconTemplate(this.iconLeft) : nothing}
|
|
49
|
-
<slot></slot>
|
|
50
|
-
${this.iconRight ? this._iconTemplate(this.iconRight) : nothing}
|
|
51
|
-
</div>
|
|
52
|
-
</button>`;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
TuixButton.styles = [
|
|
56
|
-
css `
|
|
13
|
+
static { this.styles = [
|
|
14
|
+
css `
|
|
15
|
+
:host([full]) .button {
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
57
18
|
.button {
|
|
58
19
|
padding: 16px 32px;
|
|
59
20
|
border-radius: 4px;
|
|
60
|
-
|
|
21
|
+
border: none;
|
|
22
|
+
font-family: 'Rubik', sans-serif;
|
|
61
23
|
}
|
|
62
24
|
|
|
63
25
|
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
@@ -86,15 +48,30 @@ TuixButton.styles = [
|
|
|
86
48
|
}
|
|
87
49
|
}
|
|
88
50
|
`,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
51
|
+
hostButtonStyles,
|
|
52
|
+
buttonColorStyles,
|
|
53
|
+
buttonSizeStyles,
|
|
54
|
+
]; }
|
|
55
|
+
_updateIconColor() {
|
|
56
|
+
if (!this.iconLeft && !this.iconRight)
|
|
57
|
+
return;
|
|
58
|
+
this.iconColor = this._getTextColor();
|
|
59
|
+
}
|
|
60
|
+
_buttonContent() {
|
|
61
|
+
let iconSize = IconSizeVariant.MEDIUM;
|
|
62
|
+
if (screen.width <= ScreenSizes.TABLET) {
|
|
63
|
+
iconSize = IconSizeVariant.SMALL;
|
|
64
|
+
}
|
|
65
|
+
return html ` <div class="container">
|
|
66
|
+
${this.iconLeft ? this._iconTemplate(this.iconLeft, iconSize) : nothing}
|
|
67
|
+
<slot></slot>
|
|
68
|
+
${this.iconRight ? this._iconTemplate(this.iconRight, iconSize) : nothing}
|
|
69
|
+
</div>`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
95
72
|
__decorate([
|
|
96
|
-
property({ type: Boolean })
|
|
97
|
-
], TuixButton.prototype, "
|
|
73
|
+
property({ type: Boolean, reflect: true })
|
|
74
|
+
], TuixButton.prototype, "full", void 0);
|
|
98
75
|
__decorate([
|
|
99
76
|
property({ type: IconName })
|
|
100
77
|
], TuixButton.prototype, "iconRight", void 0);
|
|
@@ -105,4 +82,3 @@ TuixButton = __decorate([
|
|
|
105
82
|
customElement('tuix-button')
|
|
106
83
|
], TuixButton);
|
|
107
84
|
export { TuixButton };
|
|
108
|
-
//# sourceMappingURL=TuixButton.js.map
|
|
@@ -1,74 +1,107 @@
|
|
|
1
1
|
import { css, unsafeCSS } from 'lit';
|
|
2
|
-
import {
|
|
3
|
-
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
2
|
+
import { Palette } from '../utils/colors.js';
|
|
3
|
+
import { ScreenSizes } from '../utils/screenSizes.enum.js';
|
|
4
|
+
import { DarkPalette } from '../utils/darkColors.js';
|
|
5
|
+
import { MainVariant } from '../utils/mainVariant.enum.js';
|
|
6
|
+
import slottedClassName from '../utils/slottedClassName.js';
|
|
7
|
+
import { TextSize } from '../tuix-text/enums/tuix-text.enums.js';
|
|
8
|
+
export const hostButtonStyles = css `
|
|
9
|
+
:host {
|
|
10
|
+
--t-button-primary-color: ${unsafeCSS(Palette.MAIN)};
|
|
11
|
+
--t-button-secondary-color: ${unsafeCSS(Palette.WHITE)};
|
|
12
|
+
--t-button-accent-color: ${unsafeCSS(Palette.SECONDARY)};
|
|
13
|
+
--t-button-text-color: ${unsafeCSS(Palette.WHITE)};
|
|
14
|
+
--t-button-text-secondary-color: ${unsafeCSS(Palette.MAIN)};
|
|
15
|
+
--t-button-text-muted-color: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
16
|
+
--t-button-disabled-bg-color: ${unsafeCSS(Palette.PRIMARY_100)};
|
|
17
|
+
--t-button-hover-primary-color: ${unsafeCSS(Palette.PRIMARY_600)};
|
|
18
|
+
--t-button-active-primary-color: ${unsafeCSS(Palette.PRIMARY_800)};
|
|
19
|
+
--t-button-hover-secondary-color: ${unsafeCSS(Palette.PRIMARY_100)};
|
|
20
|
+
--t-button-active-secondary-color: ${unsafeCSS(Palette.PRIMARY_200)};
|
|
21
|
+
}
|
|
22
|
+
:host([dark]) {
|
|
23
|
+
--t-button-primary-color: ${unsafeCSS(DarkPalette.MAIN)};
|
|
24
|
+
--t-button-text-color: ${unsafeCSS(DarkPalette.WHITE)};
|
|
25
|
+
--t-button-text-muted-color: ${unsafeCSS(Palette.PRIMARY_800)};
|
|
26
|
+
--t-button-disabled-bg-color: ${unsafeCSS(Palette.PRIMARY_950)};
|
|
27
|
+
--t-button-hover-primary-color: ${unsafeCSS(Palette.MAIN)};
|
|
28
|
+
--t-button-active-primary-color: ${unsafeCSS(Palette.PRIMARY_600)};
|
|
29
|
+
--t-button-secondary-color: ${unsafeCSS(Palette.BLACK)};
|
|
30
|
+
--t-button-hover-secondary-color: ${unsafeCSS(Palette.PRIMARY_950)};
|
|
31
|
+
--t-button-active-secondary-color: ${unsafeCSS(Palette.PRIMARY_800)};
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
4
34
|
export const buttonSizeStyles = css `
|
|
5
|
-
|
|
6
|
-
|
|
35
|
+
${unsafeCSS(`
|
|
36
|
+
${slottedClassName(TextSize.Button)} {
|
|
37
|
+
font-size: 1rem;
|
|
7
38
|
font-weight: 400;
|
|
8
|
-
line-height: 1.
|
|
39
|
+
line-height: 1.25rem;
|
|
9
40
|
}
|
|
10
41
|
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
11
|
-
.
|
|
12
|
-
font-size:
|
|
42
|
+
${slottedClassName(TextSize.Button)} {
|
|
43
|
+
font-size: 0.938rem;
|
|
13
44
|
font-weight: 400;
|
|
14
|
-
line-height: 1.
|
|
45
|
+
line-height: 1.125rem;
|
|
15
46
|
}
|
|
16
47
|
}
|
|
17
48
|
@media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
|
|
18
|
-
.
|
|
49
|
+
${slottedClassName(TextSize.Button)} {
|
|
19
50
|
font-size: 0.875rem;
|
|
20
51
|
font-weight: 400;
|
|
21
52
|
line-height: 1rem;
|
|
22
53
|
}
|
|
23
54
|
}
|
|
55
|
+
`)}
|
|
24
56
|
`;
|
|
25
57
|
export const buttonColorStyles = css `
|
|
26
|
-
.button
|
|
27
|
-
background-color:
|
|
28
|
-
|
|
29
|
-
color:
|
|
58
|
+
:host([variant='${unsafeCSS(MainVariant.PRIMARY)}']) .button {
|
|
59
|
+
background-color: var(--t-button-primary-color);
|
|
60
|
+
outline: none;
|
|
61
|
+
color: var(--t-button-text-color);
|
|
30
62
|
}
|
|
31
|
-
.button
|
|
32
|
-
background-color:
|
|
63
|
+
:host([variant='${unsafeCSS(MainVariant.PRIMARY)}']) .button:hover {
|
|
64
|
+
background-color: var(--t-button-hover-primary-color);
|
|
33
65
|
cursor: pointer;
|
|
34
66
|
}
|
|
35
|
-
.button
|
|
36
|
-
background-color:
|
|
37
|
-
|
|
67
|
+
:host([variant='${unsafeCSS(MainVariant.PRIMARY)}']) .button:focus {
|
|
68
|
+
background-color: var(--t-button-hover-primary-color);
|
|
69
|
+
outline: 2px solid var(--t-button-accent-color);
|
|
38
70
|
}
|
|
39
|
-
.button
|
|
40
|
-
background-color:
|
|
41
|
-
|
|
71
|
+
:host([variant='${unsafeCSS(MainVariant.PRIMARY)}']) .button:active {
|
|
72
|
+
background-color: var(--t-button-active-primary-color);
|
|
73
|
+
outline: none;
|
|
42
74
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
color:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.button.secondary {
|
|
49
|
-
background-color: ${unsafeCSS(palette.white)};
|
|
50
|
-
border: 2px solid ${unsafeCSS(palette.main)};
|
|
51
|
-
color: ${unsafeCSS(palette.main)};
|
|
75
|
+
|
|
76
|
+
:host([variant='${unsafeCSS(MainVariant.SECONDARY)}']) .button {
|
|
77
|
+
background-color: var(--t-button-secondary-color);
|
|
78
|
+
outline: 1px solid var(--t-button-hover-primary-color);
|
|
79
|
+
color: var(--t-button-text-secondary-color);
|
|
52
80
|
}
|
|
53
|
-
.button
|
|
54
|
-
background-color:
|
|
55
|
-
|
|
81
|
+
:host([variant='${unsafeCSS(MainVariant.SECONDARY)}']) .button:hover {
|
|
82
|
+
background-color: var(--t-button-hover-secondary-color);
|
|
83
|
+
outline: 1px solid var(--t-button-primary-color);
|
|
84
|
+
color: var(--t-button-primary-color);
|
|
56
85
|
cursor: pointer;
|
|
57
86
|
}
|
|
58
|
-
.button
|
|
59
|
-
background-color:
|
|
60
|
-
|
|
87
|
+
:host([variant='${unsafeCSS(MainVariant.SECONDARY)}']) .button:focus {
|
|
88
|
+
background-color: var(--t-button-hover-secondary-color);
|
|
89
|
+
outline: 2px solid var(--t-button-accent-color);
|
|
90
|
+
color: var(--t-button-primary-color);
|
|
91
|
+
}
|
|
92
|
+
:host([variant='${unsafeCSS(MainVariant.SECONDARY)}']) .button:active {
|
|
93
|
+
background-color: var(--t-button-active-secondary-color);
|
|
94
|
+
outline: 1px solid var(--t-button-primary-color);
|
|
95
|
+
color: var(--t-button-primary-color);
|
|
61
96
|
}
|
|
62
|
-
.button
|
|
63
|
-
|
|
64
|
-
border: none;
|
|
65
|
-
color: ${unsafeCSS(palette.main)};
|
|
97
|
+
:host([variant='${unsafeCSS(MainVariant.SECONDARY)}']) .button:disabled {
|
|
98
|
+
outline: 1px solid var(--t-button-text-muted-color);
|
|
66
99
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
color:
|
|
100
|
+
|
|
101
|
+
:host([variant='${unsafeCSS(MainVariant.SECONDARY)}'][disabled]) .button,
|
|
102
|
+
:host([variant='${unsafeCSS(MainVariant.PRIMARY)}'][disabled]) .button {
|
|
103
|
+
background-color: var(--t-button-disabled-bg-color);
|
|
104
|
+
color: var(--t-button-text-muted-color);
|
|
71
105
|
cursor: not-allowed;
|
|
72
106
|
}
|
|
73
107
|
`;
|
|
74
|
-
//# sourceMappingURL=TuixButton.styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MainVariant } from '../../utils/mainVariant.enum';
|
|
1
|
+
import { MainVariant } from '../../utils/mainVariant.enum.js';
|
|
2
2
|
export declare const buttonTextColor: Record<MainVariant, string>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MainVariant } from '../../utils/mainVariant.enum';
|
|
1
|
+
import { Palette } from '../../utils/colors.js';
|
|
2
|
+
import { MainVariant } from '../../utils/mainVariant.enum.js';
|
|
3
3
|
export const buttonTextColor = {
|
|
4
|
-
[MainVariant.PRIMARY]:
|
|
5
|
-
[MainVariant.SECONDARY]:
|
|
4
|
+
[MainVariant.PRIMARY]: Palette.WHITE,
|
|
5
|
+
[MainVariant.SECONDARY]: Palette.MAIN,
|
|
6
6
|
};
|
|
7
|
-
//# sourceMappingURL=tuix-button.enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CustomEventTuixButton = CustomEvent<undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '../tuix-icon/TuixIcon.js';
|
|
3
|
+
import '../tuix-text/TuixText.js';
|
|
4
|
+
import { CheckboxLabelSide } from './enums/tuix-checkbox.enums.js';
|
|
5
|
+
export declare class TuixCheckbox extends LitElement {
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
checked: boolean;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
dark: boolean;
|
|
10
|
+
error: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
labelSide: CheckboxLabelSide;
|
|
13
|
+
private _onCheckboxChange;
|
|
14
|
+
private _getIconMode;
|
|
15
|
+
private _getFullContainerClasses;
|
|
16
|
+
protected render(): TemplateResult;
|
|
17
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import '../tuix-icon/TuixIcon.js';
|
|
6
|
+
import '../tuix-text/TuixText.js';
|
|
7
|
+
import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums.js';
|
|
8
|
+
import { TextSize, TextVariant } from '../tuix-text/enums/tuix-text.enums.js';
|
|
9
|
+
import { checkboxCheckmarkStyles, checkboxContainerStyles, checkboxLabelStyles, hostStyles, } from './TuixCheckbox.styles.js';
|
|
10
|
+
import { CheckboxIconColorDark, CheckboxIconColorLight, CheckboxIconMode, CheckboxLabelSide, } from './enums/tuix-checkbox.enums.js';
|
|
11
|
+
let TuixCheckbox = class TuixCheckbox extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.checked = false;
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.dark = false;
|
|
17
|
+
this.error = false;
|
|
18
|
+
this.label = '';
|
|
19
|
+
this.labelSide = CheckboxLabelSide.RIGHT;
|
|
20
|
+
}
|
|
21
|
+
static { this.styles = [
|
|
22
|
+
hostStyles,
|
|
23
|
+
checkboxContainerStyles,
|
|
24
|
+
checkboxCheckmarkStyles,
|
|
25
|
+
checkboxLabelStyles,
|
|
26
|
+
]; }
|
|
27
|
+
_onCheckboxChange(event) {
|
|
28
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
29
|
+
detail: {
|
|
30
|
+
value: event.target.checked,
|
|
31
|
+
label: this.label,
|
|
32
|
+
},
|
|
33
|
+
bubbles: true,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
_getIconMode() {
|
|
37
|
+
if (this.disabled) {
|
|
38
|
+
return CheckboxIconMode.DISABLED;
|
|
39
|
+
}
|
|
40
|
+
if (this.error) {
|
|
41
|
+
return CheckboxIconMode.ERROR;
|
|
42
|
+
}
|
|
43
|
+
return CheckboxIconMode.DEFAULT;
|
|
44
|
+
}
|
|
45
|
+
_getFullContainerClasses() {
|
|
46
|
+
return {
|
|
47
|
+
't-checkbox-full-container': true,
|
|
48
|
+
't-with-error': this.error && !this.disabled,
|
|
49
|
+
't-with-label-left': this.labelSide === CheckboxLabelSide.LEFT,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return html `<label class="${classMap(this._getFullContainerClasses())}">
|
|
54
|
+
<div class="t-checkbox-container">
|
|
55
|
+
<input
|
|
56
|
+
type="checkbox"
|
|
57
|
+
class="t-checkbox"
|
|
58
|
+
.checked="${this.checked}"
|
|
59
|
+
?disabled="${this.disabled}"
|
|
60
|
+
@change="${this._onCheckboxChange}"
|
|
61
|
+
/>
|
|
62
|
+
<div class="t-checkbox-checkmark">
|
|
63
|
+
<tuix-icon
|
|
64
|
+
size="${IconSizeVariant.FULL}"
|
|
65
|
+
name="${IconName.CHECK}"
|
|
66
|
+
color="${this.dark
|
|
67
|
+
? CheckboxIconColorDark[this._getIconMode()]
|
|
68
|
+
: CheckboxIconColorLight[this._getIconMode()]}"
|
|
69
|
+
>
|
|
70
|
+
</tuix-icon>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="t-checkbox-label">
|
|
74
|
+
<slot>
|
|
75
|
+
<tuix-text
|
|
76
|
+
size="${TextSize.FieldPlaceholder}"
|
|
77
|
+
color="${TextVariant.PRIMARY}"
|
|
78
|
+
?dark="${this.dark}"
|
|
79
|
+
>
|
|
80
|
+
${this.label}
|
|
81
|
+
</tuix-text>
|
|
82
|
+
</slot>
|
|
83
|
+
</div>
|
|
84
|
+
</label>`;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
__decorate([
|
|
88
|
+
property({ type: Boolean })
|
|
89
|
+
], TuixCheckbox.prototype, "checked", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: Boolean, reflect: true })
|
|
92
|
+
], TuixCheckbox.prototype, "disabled", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Boolean, reflect: true })
|
|
95
|
+
], TuixCheckbox.prototype, "dark", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Boolean, reflect: true })
|
|
98
|
+
], TuixCheckbox.prototype, "error", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
property({ type: String })
|
|
101
|
+
], TuixCheckbox.prototype, "label", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
property({ type: String })
|
|
104
|
+
], TuixCheckbox.prototype, "labelSide", void 0);
|
|
105
|
+
TuixCheckbox = __decorate([
|
|
106
|
+
customElement('tuix-checkbox')
|
|
107
|
+
], TuixCheckbox);
|
|
108
|
+
export { TuixCheckbox };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { Palette } from '../utils/colors.js';
|
|
3
|
+
import { DarkPalette } from '../utils/darkColors.js';
|
|
4
|
+
import { ScreenSizes } from '../utils/screenSizes.enum.js';
|
|
5
|
+
export const hostStyles = css `
|
|
6
|
+
:host {
|
|
7
|
+
--t-main-color-tuix: ${unsafeCSS(Palette.MAIN)};
|
|
8
|
+
--t-bg-color-primary: ${unsafeCSS(Palette.WHITE)};
|
|
9
|
+
--t-bg-color-disabled: ${unsafeCSS(Palette.PRIMARY_100)};
|
|
10
|
+
--t-text-color-error: ${unsafeCSS(Palette.ERROR)};
|
|
11
|
+
--t-stroke-color-focus: ${unsafeCSS(Palette.SECONDARY)};
|
|
12
|
+
--t-stroke-color-grey: ${unsafeCSS(Palette.PRIMARY_300)};
|
|
13
|
+
--t-text-color-label: ${unsafeCSS(Palette.BLACK)};
|
|
14
|
+
--t-label-right-default-justify: flex-start;
|
|
15
|
+
--t-label-left-default-justify: space-between;
|
|
16
|
+
}
|
|
17
|
+
:host([dark]) {
|
|
18
|
+
--t-main-color-tuix: ${unsafeCSS(DarkPalette.MAIN)};
|
|
19
|
+
--t-bg-color-primary: ${unsafeCSS(DarkPalette.BLACK)};
|
|
20
|
+
--t-bg-color-disabled: ${unsafeCSS(DarkPalette.PRIMARY_800)};
|
|
21
|
+
--t-text-color-error: ${unsafeCSS(DarkPalette.ERROR)};
|
|
22
|
+
--t-stroke-color-focus: ${unsafeCSS(DarkPalette.SECONDARY)};
|
|
23
|
+
--t-stroke-color-grey: ${unsafeCSS(DarkPalette.PRIMARY_100)};
|
|
24
|
+
--t-text-color-label: ${unsafeCSS(DarkPalette.WHITE)};
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
export const checkboxContainerStyles = css `
|
|
28
|
+
.t-checkbox-full-container {
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: var(--t-label-right-default-justify, flex-start);
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
-webkit-user-select: none;
|
|
33
|
+
-moz-user-select: none;
|
|
34
|
+
-ms-user-select: none;
|
|
35
|
+
user-select: none;
|
|
36
|
+
}
|
|
37
|
+
:host([disabled]) .t-checkbox-full-container {
|
|
38
|
+
cursor: not-allowed;
|
|
39
|
+
}
|
|
40
|
+
.t-checkbox-container {
|
|
41
|
+
--t-checkbox-size-box: 1.5rem;
|
|
42
|
+
--t-checkbox-shadow-width: 2px;
|
|
43
|
+
--t-checkbox-border-radius: 0.25rem;
|
|
44
|
+
display: block;
|
|
45
|
+
position: relative;
|
|
46
|
+
height: var(--t-checkbox-size-box);
|
|
47
|
+
width: var(--t-checkbox-size-box);
|
|
48
|
+
min-width: var(--t-checkbox-size-box);
|
|
49
|
+
}
|
|
50
|
+
.t-checkbox-container .t-checkbox {
|
|
51
|
+
position: absolute;
|
|
52
|
+
opacity: 0;
|
|
53
|
+
height: 0;
|
|
54
|
+
width: 0;
|
|
55
|
+
}
|
|
56
|
+
@media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
|
|
57
|
+
.t-checkbox-container {
|
|
58
|
+
--t-checkbox-size-box: 1rem;
|
|
59
|
+
--t-checkbox-shadow-width: 1px;
|
|
60
|
+
--t-checkbox-border-radius: 0.125rem;
|
|
61
|
+
margin-top: 1px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
export const checkboxCheckmarkStyles = css `
|
|
66
|
+
.t-checkbox-container .t-checkbox-checkmark {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
display: flex;
|
|
71
|
+
height: var(--t-checkbox-size-box);
|
|
72
|
+
width: var(--t-checkbox-size-box);
|
|
73
|
+
border-radius: var(--t-checkbox-border-radius);
|
|
74
|
+
background-color: var(--t-bg-color-primary);
|
|
75
|
+
border: 1px solid var(--t-stroke-color-grey);
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
}
|
|
78
|
+
.t-checkbox-container .t-checkbox-checkmark tuix-icon {
|
|
79
|
+
margin: auto;
|
|
80
|
+
display: none;
|
|
81
|
+
width: calc(var(--t-checkbox-size-box) - 0.5rem);
|
|
82
|
+
height: calc(var(--t-checkbox-size-box) - 0.5rem);
|
|
83
|
+
}
|
|
84
|
+
.t-checkbox-container .t-checkbox:checked ~ .t-checkbox-checkmark {
|
|
85
|
+
background-color: var(--t-main-color-tuix);
|
|
86
|
+
border: none;
|
|
87
|
+
}
|
|
88
|
+
.t-checkbox-container .t-checkbox:focus ~ .t-checkbox-checkmark {
|
|
89
|
+
box-shadow: 0 0 0px var(--t-checkbox-shadow-width)
|
|
90
|
+
var(--t-stroke-color-focus);
|
|
91
|
+
border: 1px solid var(--t-main-color-tuix);
|
|
92
|
+
}
|
|
93
|
+
.t-checkbox-container .t-checkbox:checked ~ .t-checkbox-checkmark tuix-icon {
|
|
94
|
+
display: block;
|
|
95
|
+
}
|
|
96
|
+
.t-checkbox-full-container:hover .t-checkbox-container .t-checkbox-checkmark {
|
|
97
|
+
border: 1px solid var(--t-main-color-tuix);
|
|
98
|
+
}
|
|
99
|
+
.t-checkbox-full-container.t-with-error
|
|
100
|
+
.t-checkbox-container
|
|
101
|
+
.t-checkbox-checkmark {
|
|
102
|
+
border: 1px solid var(--t-text-color-error);
|
|
103
|
+
}
|
|
104
|
+
.t-checkbox-full-container.t-with-error
|
|
105
|
+
.t-checkbox-container
|
|
106
|
+
.t-checkbox:checked
|
|
107
|
+
~ .t-checkbox-checkmark {
|
|
108
|
+
background-color: var(--t-text-color-error);
|
|
109
|
+
border: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.t-checkbox-container .t-checkbox:disabled ~ .t-checkbox-checkmark {
|
|
113
|
+
background-color: var(--t-bg-color-disabled);
|
|
114
|
+
border: none;
|
|
115
|
+
box-shadow: none;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
export const checkboxLabelStyles = css `
|
|
119
|
+
.t-checkbox-label {
|
|
120
|
+
display: block;
|
|
121
|
+
color: var(--t-text-color-label);
|
|
122
|
+
margin-left: 0.625rem;
|
|
123
|
+
}
|
|
124
|
+
.t-checkbox-full-container.t-with-label-left {
|
|
125
|
+
flex-direction: row-reverse;
|
|
126
|
+
justify-content: var(--t-label-left-default-justify, space-between);
|
|
127
|
+
}
|
|
128
|
+
.t-checkbox-full-container.t-with-label-left .t-checkbox-label {
|
|
129
|
+
margin-right: 0.625rem;
|
|
130
|
+
margin-left: 0;
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Palette } from '../../utils/colors.js';
|
|
2
|
+
import { DarkPalette } from '../../utils/darkColors.js';
|
|
3
|
+
export declare enum CheckboxIconMode {
|
|
4
|
+
DEFAULT = "default",
|
|
5
|
+
DISABLED = "disabled",
|
|
6
|
+
ERROR = "error"
|
|
7
|
+
}
|
|
8
|
+
export declare enum CheckboxLabelSide {
|
|
9
|
+
LEFT = "left",
|
|
10
|
+
RIGHT = "right"
|
|
11
|
+
}
|
|
12
|
+
export declare const CheckboxIconColorLight: {
|
|
13
|
+
default: Palette;
|
|
14
|
+
disabled: Palette;
|
|
15
|
+
error: Palette;
|
|
16
|
+
};
|
|
17
|
+
export declare const CheckboxIconColorDark: {
|
|
18
|
+
default: DarkPalette;
|
|
19
|
+
disabled: DarkPalette;
|
|
20
|
+
error: DarkPalette;
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Palette } from '../../utils/colors.js';
|
|
2
|
+
import { DarkPalette } from '../../utils/darkColors.js';
|
|
3
|
+
export var CheckboxIconMode;
|
|
4
|
+
(function (CheckboxIconMode) {
|
|
5
|
+
CheckboxIconMode["DEFAULT"] = "default";
|
|
6
|
+
CheckboxIconMode["DISABLED"] = "disabled";
|
|
7
|
+
CheckboxIconMode["ERROR"] = "error";
|
|
8
|
+
})(CheckboxIconMode || (CheckboxIconMode = {}));
|
|
9
|
+
export var CheckboxLabelSide;
|
|
10
|
+
(function (CheckboxLabelSide) {
|
|
11
|
+
CheckboxLabelSide["LEFT"] = "left";
|
|
12
|
+
CheckboxLabelSide["RIGHT"] = "right";
|
|
13
|
+
})(CheckboxLabelSide || (CheckboxLabelSide = {}));
|
|
14
|
+
export const CheckboxIconColorLight = {
|
|
15
|
+
[CheckboxIconMode.DEFAULT]: Palette.WHITE,
|
|
16
|
+
[CheckboxIconMode.DISABLED]: Palette.PRIMARY_300,
|
|
17
|
+
[CheckboxIconMode.ERROR]: Palette.WHITE,
|
|
18
|
+
};
|
|
19
|
+
export const CheckboxIconColorDark = {
|
|
20
|
+
[CheckboxIconMode.DEFAULT]: DarkPalette.WHITE,
|
|
21
|
+
[CheckboxIconMode.DISABLED]: DarkPalette.PRIMARY_100,
|
|
22
|
+
[CheckboxIconMode.ERROR]: DarkPalette.WHITE,
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|