tuix-webcomponents 0.1.0 → 0.2.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 +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/tuix-button/TuixButton.d.ts +4 -3
- package/dist/src/tuix-button/TuixButton.js +29 -14
- 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 +63 -33
- package/dist/src/tuix-button/TuixButton.styles.js.map +1 -1
- package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +15 -0
- package/dist/src/tuix-checkbox/TuixCheckbox.js +95 -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 +19 -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-dropdown/TuixDropdown.styles.js +6 -2
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js.map +1 -1
- package/dist/src/tuix-icon/TuixIcon.d.ts +2 -1
- package/dist/src/tuix-icon/TuixIcon.icons.js +4 -0
- package/dist/src/tuix-icon/TuixIcon.icons.js.map +1 -1
- package/dist/src/tuix-icon/TuixIcon.js +8 -4
- package/dist/src/tuix-icon/TuixIcon.js.map +1 -1
- package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +2 -1
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js +1 -0
- package/dist/src/tuix-icon/enums/tuix-icon.enums.js.map +1 -1
- package/dist/src/tuix-icon-button/TuixIconButton.d.ts +4 -1
- package/dist/src/tuix-icon-button/TuixIconButton.js +29 -11
- package/dist/src/tuix-icon-button/TuixIconButton.js.map +1 -1
- package/dist/src/tuix-input/TuixInput.styles.js +7 -2
- package/dist/src/tuix-input/TuixInput.styles.js.map +1 -1
- package/dist/src/tuix-link/TuixLink.d.ts +2 -0
- package/dist/src/tuix-link/TuixLink.js +15 -1
- package/dist/src/tuix-link/TuixLink.js.map +1 -1
- package/dist/src/tuix-paper/TuixPaper.d.ts +2 -0
- package/dist/src/tuix-paper/TuixPaper.js +19 -1
- package/dist/src/tuix-paper/TuixPaper.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 +1 -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 +4 -3
- package/dist/src/tuix-text/TuixText.js +16 -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 +76 -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/utils/colors.d.ts +0 -11
- package/dist/src/utils/colors.js +0 -21
- package/dist/src/utils/colors.js.map +1 -1
- package/dist/src/utils/darkColors.js +2 -0
- package/dist/src/utils/darkColors.js.map +1 -1
- package/dist/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
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 { CheckboxLabelSide } from '../tuix-checkbox/enums/tuix-checkbox.enums';
|
|
6
|
+
import { radioButtonContainerStyles, radioButtonInnerStyles, radioButtonLabelStyles, radioButtonStyles, radioHostStyles, } from './TuixRadioButton.styles';
|
|
7
|
+
let TuixRadioButton = class TuixRadioButton extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.disabled = false;
|
|
11
|
+
this.dark = false;
|
|
12
|
+
this.error = false;
|
|
13
|
+
this.options = [];
|
|
14
|
+
this.labelSide = CheckboxLabelSide.RIGHT;
|
|
15
|
+
this.selectedOption = null;
|
|
16
|
+
}
|
|
17
|
+
_onRadioButtonChange(event) {
|
|
18
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
19
|
+
detail: {
|
|
20
|
+
value: event.target.value,
|
|
21
|
+
},
|
|
22
|
+
bubbles: true,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
_getFullContainerClasses() {
|
|
26
|
+
return {
|
|
27
|
+
't-radio-button-full-container': true,
|
|
28
|
+
't-with-error': this.error && !this.disabled,
|
|
29
|
+
't-with-label-left': this.labelSide === CheckboxLabelSide.LEFT,
|
|
30
|
+
't-multiple-options': this.options.length > 1,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
_formatTemplate(option, index) {
|
|
34
|
+
return html `<label class="${classMap(this._getFullContainerClasses())}">
|
|
35
|
+
<div class="t-radio-button-container">
|
|
36
|
+
<input
|
|
37
|
+
type="radio"
|
|
38
|
+
class="t-radio-button"
|
|
39
|
+
?disabled="${this.disabled}"
|
|
40
|
+
.value="${option}"
|
|
41
|
+
name="tuix-radio-button"
|
|
42
|
+
?checked="${this.selectedOption === option}"
|
|
43
|
+
@change="${this._onRadioButtonChange}"
|
|
44
|
+
/>
|
|
45
|
+
<div class="t-radio-button-checkmark">
|
|
46
|
+
<div class="t-radio-button-inner"></div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="t-radio-button-label">
|
|
50
|
+
<slot name="label-${index}">${option}</slot>
|
|
51
|
+
</div>
|
|
52
|
+
</label>`;
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
return html `${this.options.map((option, index) => this._formatTemplate(option, index))}`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
TuixRadioButton.styles = [
|
|
59
|
+
radioHostStyles,
|
|
60
|
+
radioButtonContainerStyles,
|
|
61
|
+
radioButtonStyles,
|
|
62
|
+
radioButtonInnerStyles,
|
|
63
|
+
radioButtonLabelStyles,
|
|
64
|
+
];
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ type: Boolean })
|
|
67
|
+
], TuixRadioButton.prototype, "disabled", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
property({ type: Boolean })
|
|
70
|
+
], TuixRadioButton.prototype, "dark", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
property({ type: Boolean })
|
|
73
|
+
], TuixRadioButton.prototype, "error", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
property({ type: Array })
|
|
76
|
+
], TuixRadioButton.prototype, "options", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
property({ type: String })
|
|
79
|
+
], TuixRadioButton.prototype, "labelSide", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ type: String })
|
|
82
|
+
], TuixRadioButton.prototype, "selectedOption", void 0);
|
|
83
|
+
TuixRadioButton = __decorate([
|
|
84
|
+
customElement('tuix-radio-button')
|
|
85
|
+
], TuixRadioButton);
|
|
86
|
+
export { TuixRadioButton };
|
|
87
|
+
//# sourceMappingURL=TuixRadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TuixRadioButton.js","sourceRoot":"","sources":["../../../src/tuix-radio-button/TuixRadioButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAIlC,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IAA/C;;QAUE,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAG,KAAK,CAAC;QAGb,UAAK,GAAG,KAAK,CAAC;QAGd,YAAO,GAA4B,EAAE,CAAC;QAGtC,cAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC;QAGpC,mBAAc,GAAiC,IAAI,CAAC;IAiDtD,CAAC;IA/CS,oBAAoB,CAAC,KAAiB;QAC5C,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE;gBACN,KAAK,EAAG,KAAK,CAAC,MAA2B,CAAC,KAAK;aAChD;YACD,OAAO,EAAE,IAAI;SACd,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,wBAAwB;QAC9B,OAAO;YACL,+BAA+B,EAAE,IAAI;Y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IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA0E3B;SA1EY,eAAe","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js';\nimport { CheckboxLabelSide } from '../tuix-checkbox/enums/tuix-checkbox.enums';\nimport {\n radioButtonContainerStyles,\n radioButtonInnerStyles,\n radioButtonLabelStyles,\n radioButtonStyles,\n radioHostStyles,\n} from './TuixRadioButton.styles';\nimport { TuixRadioButtonOption } from './interfaces/tuix-radio-button.interface';\n\n@customElement('tuix-radio-button')\nexport class TuixRadioButton extends LitElement {\n static styles = [\n radioHostStyles,\n radioButtonContainerStyles,\n radioButtonStyles,\n radioButtonInnerStyles,\n radioButtonLabelStyles,\n ];\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: Boolean })\n dark = false;\n\n @property({ type: Boolean })\n error = false;\n\n @property({ type: Array })\n options: TuixRadioButtonOption[] = [];\n\n @property({ type: String })\n labelSide = CheckboxLabelSide.RIGHT;\n\n @property({ type: String })\n selectedOption: TuixRadioButtonOption | null = null;\n\n private _onRadioButtonChange(event: InputEvent) {\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: {\n value: (event.target as HTMLInputElement).value,\n },\n bubbles: true,\n })\n );\n }\n\n private _getFullContainerClasses(): ClassInfo {\n return {\n 't-radio-button-full-container': true,\n 't-with-error': this.error && !this.disabled,\n 't-with-label-left': this.labelSide === CheckboxLabelSide.LEFT,\n 't-multiple-options': this.options.length > 1,\n };\n }\n\n private _formatTemplate(option: TuixRadioButtonOption, index: number) {\n return html`<label class=\"${classMap(this._getFullContainerClasses())}\">\n <div class=\"t-radio-button-container\">\n <input\n type=\"radio\"\n class=\"t-radio-button\"\n ?disabled=\"${this.disabled}\"\n .value=\"${option}\"\n name=\"tuix-radio-button\"\n ?checked=\"${this.selectedOption === option}\"\n @change=\"${this._onRadioButtonChange}\"\n />\n <div class=\"t-radio-button-checkmark\">\n <div class=\"t-radio-button-inner\"></div>\n </div>\n </div>\n <div class=\"t-radio-button-label\">\n <slot name=\"label-${index}\">${option}</slot>\n </div>\n </label>`;\n }\n\n render() {\n return html`${this.options.map((option, index) =>\n this._formatTemplate(option, index)\n )}`;\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const radioHostStyles: import("lit").CSSResult;
|
|
2
|
+
export declare const radioButtonContainerStyles: import("lit").CSSResult;
|
|
3
|
+
export declare const radioButtonStyles: import("lit").CSSResult;
|
|
4
|
+
export declare const radioButtonInnerStyles: import("lit").CSSResult;
|
|
5
|
+
export declare const radioButtonLabelStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { hostStyles } from '../tuix-checkbox/TuixCheckbox.styles';
|
|
3
|
+
import { palette } from '../utils/colors';
|
|
4
|
+
export const radioHostStyles = css `
|
|
5
|
+
${hostStyles}
|
|
6
|
+
:host {
|
|
7
|
+
--t-margin-between-radio-buttons: 1rem;
|
|
8
|
+
--t-radio-button-inner-color-disabled: ${unsafeCSS(palette.primary_300)};
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export const radioButtonContainerStyles = css `
|
|
12
|
+
.t-radio-button-full-container {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
-webkit-user-select: none;
|
|
17
|
+
-moz-user-select: none;
|
|
18
|
+
-ms-user-select: none;
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
:host([disabled]) .t-radio-button-full-container {
|
|
22
|
+
cursor: not-allowed;
|
|
23
|
+
}
|
|
24
|
+
.t-radio-button-container {
|
|
25
|
+
display: block;
|
|
26
|
+
position: relative;
|
|
27
|
+
height: 1.5rem;
|
|
28
|
+
width: 1.5rem;
|
|
29
|
+
}
|
|
30
|
+
.t-radio-button-container .t-radio-button {
|
|
31
|
+
position: absolute;
|
|
32
|
+
opacity: 0;
|
|
33
|
+
height: 0;
|
|
34
|
+
width: 0;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
export const radioButtonStyles = css `
|
|
38
|
+
.t-radio-button-full-container.t-multiple-options {
|
|
39
|
+
margin-bottom: var(--t-margin-between-radio-buttons);
|
|
40
|
+
}
|
|
41
|
+
.t-radio-button-full-container:not(.t-with-label-left) {
|
|
42
|
+
justify-content: flex-start;
|
|
43
|
+
}
|
|
44
|
+
.t-radio-button-container .t-radio-button-checkmark {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
display: flex;
|
|
49
|
+
height: 1.5rem;
|
|
50
|
+
width: 1.5rem;
|
|
51
|
+
border-radius: 0.25rem;
|
|
52
|
+
background-color: var(--t-bg-color-primary);
|
|
53
|
+
border: 2px solid var(--t-stroke-color-grey);
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
}
|
|
57
|
+
.t-radio-button-container
|
|
58
|
+
.t-radio-button:checked
|
|
59
|
+
~ .t-radio-button-checkmark {
|
|
60
|
+
border: 2px solid var(--t-main-color-tuix);
|
|
61
|
+
}
|
|
62
|
+
.t-radio-button-container .t-radio-button:focus ~ .t-radio-button-checkmark {
|
|
63
|
+
box-shadow: 0 0 0px 2px var(--t-stroke-color-focus);
|
|
64
|
+
}
|
|
65
|
+
.t-radio-button-full-container:hover
|
|
66
|
+
.t-radio-button-container
|
|
67
|
+
.t-radio-button-checkmark {
|
|
68
|
+
border: 2px solid var(--t-main-color-tuix);
|
|
69
|
+
}
|
|
70
|
+
.t-radio-button-full-container.t-with-error
|
|
71
|
+
.t-radio-button-container
|
|
72
|
+
.t-radio-button-checkmark {
|
|
73
|
+
border: 2px solid var(--t-text-color-error);
|
|
74
|
+
}
|
|
75
|
+
.t-radio-button-container
|
|
76
|
+
.t-radio-button:disabled
|
|
77
|
+
~ .t-radio-button-checkmark {
|
|
78
|
+
background-color: var(--t-bg-color-disabled);
|
|
79
|
+
border: none;
|
|
80
|
+
box-shadow: none;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
export const radioButtonInnerStyles = css `
|
|
84
|
+
.t-radio-button-container .t-radio-button-checkmark .t-radio-button-inner {
|
|
85
|
+
background-color: var(--t-main-color-tuix);
|
|
86
|
+
margin: auto;
|
|
87
|
+
height: 0.625rem;
|
|
88
|
+
width: 0.625rem;
|
|
89
|
+
border-radius: 50%;
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
.t-radio-button-container
|
|
93
|
+
.t-radio-button:checked
|
|
94
|
+
~ .t-radio-button-checkmark
|
|
95
|
+
.t-radio-button-inner {
|
|
96
|
+
display: block;
|
|
97
|
+
}
|
|
98
|
+
:host([error])
|
|
99
|
+
.t-radio-button-container
|
|
100
|
+
.t-radio-button-checkmark
|
|
101
|
+
.t-radio-button-inner {
|
|
102
|
+
background-color: var(--t-text-color-error);
|
|
103
|
+
}
|
|
104
|
+
:host([disabled])
|
|
105
|
+
.t-radio-button-container
|
|
106
|
+
.t-radio-button-checkmark
|
|
107
|
+
.t-radio-button-inner {
|
|
108
|
+
background-color: var(--t-radio-button-inner-color-disabled);
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
export const radioButtonLabelStyles = css `
|
|
113
|
+
.t-radio-button-label {
|
|
114
|
+
display: block;
|
|
115
|
+
font-size: 1rem;
|
|
116
|
+
line-height: 1.5rem;
|
|
117
|
+
font-weight: 300;
|
|
118
|
+
font-family: 'rubik', sans-serif;
|
|
119
|
+
color: var(--t-text-color-label);
|
|
120
|
+
margin-left: 0.625rem;
|
|
121
|
+
}
|
|
122
|
+
.t-radio-button-full-container.t-with-label-left {
|
|
123
|
+
flex-direction: row-reverse;
|
|
124
|
+
}
|
|
125
|
+
.t-radio-button-full-container.t-with-label-left .t-radio-button-label {
|
|
126
|
+
margin-right: 0.625rem;
|
|
127
|
+
margin-left: 0;
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
//# sourceMappingURL=TuixRadioButton.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TuixRadioButton.styles.js","sourceRoot":"","sources":["../../../src/tuix-radio-button/TuixRadioButton.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;IAC9B,UAAU;;;6CAG+B,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC;;CAE1E,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyB5C,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CnC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBxC,CAAC","sourcesContent":["import { css, unsafeCSS } from 'lit';\nimport { hostStyles } from '../tuix-checkbox/TuixCheckbox.styles';\nimport { palette } from '../utils/colors';\n\nexport const radioHostStyles = css`\n ${hostStyles}\n :host {\n --t-margin-between-radio-buttons: 1rem;\n --t-radio-button-inner-color-disabled: ${unsafeCSS(palette.primary_300)};\n }\n`;\n\nexport const radioButtonContainerStyles = css`\n .t-radio-button-full-container {\n display: flex;\n justify-content: space-between;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n :host([disabled]) .t-radio-button-full-container {\n cursor: not-allowed;\n }\n .t-radio-button-container {\n display: block;\n position: relative;\n height: 1.5rem;\n width: 1.5rem;\n }\n .t-radio-button-container .t-radio-button {\n position: absolute;\n opacity: 0;\n height: 0;\n width: 0;\n }\n`;\n\nexport const radioButtonStyles = css`\n .t-radio-button-full-container.t-multiple-options {\n margin-bottom: var(--t-margin-between-radio-buttons);\n }\n .t-radio-button-full-container:not(.t-with-label-left) {\n justify-content: flex-start;\n }\n .t-radio-button-container .t-radio-button-checkmark {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n height: 1.5rem;\n width: 1.5rem;\n border-radius: 0.25rem;\n background-color: var(--t-bg-color-primary);\n border: 2px solid var(--t-stroke-color-grey);\n box-sizing: border-box;\n border-radius: 50%;\n }\n .t-radio-button-container\n .t-radio-button:checked\n ~ .t-radio-button-checkmark {\n border: 2px solid var(--t-main-color-tuix);\n }\n .t-radio-button-container .t-radio-button:focus ~ .t-radio-button-checkmark {\n box-shadow: 0 0 0px 2px var(--t-stroke-color-focus);\n }\n .t-radio-button-full-container:hover\n .t-radio-button-container\n .t-radio-button-checkmark {\n border: 2px solid var(--t-main-color-tuix);\n }\n .t-radio-button-full-container.t-with-error\n .t-radio-button-container\n .t-radio-button-checkmark {\n border: 2px solid var(--t-text-color-error);\n }\n .t-radio-button-container\n .t-radio-button:disabled\n ~ .t-radio-button-checkmark {\n background-color: var(--t-bg-color-disabled);\n border: none;\n box-shadow: none;\n }\n`;\n\nexport const radioButtonInnerStyles = css`\n .t-radio-button-container .t-radio-button-checkmark .t-radio-button-inner {\n background-color: var(--t-main-color-tuix);\n margin: auto;\n height: 0.625rem;\n width: 0.625rem;\n border-radius: 50%;\n display: none;\n }\n .t-radio-button-container\n .t-radio-button:checked\n ~ .t-radio-button-checkmark\n .t-radio-button-inner {\n display: block;\n }\n :host([error])\n .t-radio-button-container\n .t-radio-button-checkmark\n .t-radio-button-inner {\n background-color: var(--t-text-color-error);\n }\n :host([disabled])\n .t-radio-button-container\n .t-radio-button-checkmark\n .t-radio-button-inner {\n background-color: var(--t-radio-button-inner-color-disabled);\n cursor: not-allowed;\n }\n`;\n\nexport const radioButtonLabelStyles = css`\n .t-radio-button-label {\n display: block;\n font-size: 1rem;\n line-height: 1.5rem;\n font-weight: 300;\n font-family: 'rubik', sans-serif;\n color: var(--t-text-color-label);\n margin-left: 0.625rem;\n }\n .t-radio-button-full-container.t-with-label-left {\n flex-direction: row-reverse;\n }\n .t-radio-button-full-container.t-with-label-left .t-radio-button-label {\n margin-right: 0.625rem;\n margin-left: 0;\n }\n`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type TuixRadioButtonOption = string | number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuix-radio-button.interface.js","sourceRoot":"","sources":["../../../../src/tuix-radio-button/interfaces/tuix-radio-button.interface.ts"],"names":[],"mappings":"","sourcesContent":["export type TuixRadioButtonOption = string | number;\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
import { TextSize } from './enums/tuix-text.enums.js';
|
|
3
|
-
import { TextVariant } from '../utils/colors.js';
|
|
2
|
+
import { TextSize, TextVariant } from './enums/tuix-text.enums.js';
|
|
4
3
|
export declare class TuixText extends LitElement {
|
|
5
4
|
size?: TextSize;
|
|
6
|
-
color?: TextVariant
|
|
5
|
+
color?: TextVariant;
|
|
6
|
+
dark: boolean;
|
|
7
7
|
static styles: import("lit").CSSResult[];
|
|
8
|
+
private _getTextColor;
|
|
8
9
|
render(): import("lit-html").TemplateResult<1>;
|
|
9
10
|
}
|
|
@@ -2,16 +2,26 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { html, css, LitElement } from 'lit';
|
|
3
3
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
-
import { TextSize } from './enums/tuix-text.enums.js';
|
|
5
|
+
import { TextSize, TextVariant, colorText, colorTextDark, } from './enums/tuix-text.enums.js';
|
|
6
6
|
import { textStyles } from './TuixText.styles.js';
|
|
7
|
-
import { TextVariant, colorText } from '../utils/colors.js';
|
|
8
7
|
import { buttonSizeStyles } from '../tuix-button/TuixButton.styles.js';
|
|
9
8
|
let TuixText = class TuixText extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.dark = false;
|
|
12
|
+
}
|
|
13
|
+
_getTextColor() {
|
|
14
|
+
const defaultColor = this.dark
|
|
15
|
+
? TextVariant.SECONDARY
|
|
16
|
+
: TextVariant.PRIMARY;
|
|
17
|
+
const colorMap = this.dark ? colorTextDark : colorText;
|
|
18
|
+
return colorMap[this.color || defaultColor];
|
|
19
|
+
}
|
|
10
20
|
render() {
|
|
11
21
|
return html ` <div
|
|
12
22
|
class="text ${this.size}"
|
|
13
23
|
style="${styleMap({
|
|
14
|
-
color:
|
|
24
|
+
color: this._getTextColor(),
|
|
15
25
|
})}"
|
|
16
26
|
>
|
|
17
27
|
<slot></slot>
|
|
@@ -33,6 +43,9 @@ __decorate([
|
|
|
33
43
|
__decorate([
|
|
34
44
|
property({ type: TextVariant })
|
|
35
45
|
], TuixText.prototype, "color", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ type: Boolean })
|
|
48
|
+
], TuixText.prototype, "dark", void 0);
|
|
36
49
|
TuixText = __decorate([
|
|
37
50
|
customElement('tuix-text')
|
|
38
51
|
], TuixText);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TuixText.js","sourceRoot":"","sources":["../../../src/tuix-text/TuixText.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAA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AAC;sCACb;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;uCACZ;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCACf;AARF,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAsCpB;SAtCY,QAAQ","sourcesContent":["import { html, css, LitElement } from 'lit';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { customElement, property } from 'lit/decorators.js';\nimport {\n TextSize,\n TextVariant,\n colorText,\n colorTextDark,\n} from './enums/tuix-text.enums.js';\nimport { textStyles } from './TuixText.styles.js';\nimport { buttonSizeStyles } from '../tuix-button/TuixButton.styles.js';\n\n@customElement('tuix-text')\nexport class TuixText extends LitElement {\n @property({ type: TextSize })\n size?: TextSize;\n\n @property({ type: TextVariant })\n color?: TextVariant;\n\n @property({ type: Boolean })\n dark = false;\n\n static styles = [\n css`\n .text {\n font-family: 'Rubik', sans-serif;\n }\n `,\n textStyles,\n buttonSizeStyles,\n ];\n\n private _getTextColor() {\n const defaultColor = this.dark\n ? TextVariant.SECONDARY\n : TextVariant.PRIMARY;\n const colorMap = this.dark ? colorTextDark : colorText;\n return colorMap[this.color || defaultColor];\n }\n\n render() {\n return html` <div\n class=\"text ${this.size}\"\n style=\"${styleMap({\n color: this._getTextColor(),\n })}\"\n >\n <slot></slot>\n </div>`;\n }\n}\n"]}
|
|
@@ -10,13 +10,15 @@ export declare enum TextSize {
|
|
|
10
10
|
Field1 = "field1",
|
|
11
11
|
Field2 = "field2"
|
|
12
12
|
}
|
|
13
|
-
export declare enum
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
export declare enum TextVariant {
|
|
14
|
+
PRIMARY = "primary",
|
|
15
|
+
SECONDARY = "secondary",
|
|
16
|
+
GREY = "grey",
|
|
17
|
+
LIGHT_GREY = "light_grey",
|
|
18
|
+
DISABLED = "disabled",
|
|
19
|
+
VALIDATION = "validation",
|
|
20
|
+
ERROR = "error",
|
|
21
|
+
SUCCESS = "success"
|
|
22
22
|
}
|
|
23
|
+
export declare const colorText: Record<TextVariant, string>;
|
|
24
|
+
export declare const colorTextDark: Record<TextVariant, string>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { palette } from '../../utils/colors';
|
|
2
|
+
import { darkPalette } from '../../utils/darkColors';
|
|
1
3
|
export var TextSize;
|
|
2
4
|
(function (TextSize) {
|
|
3
5
|
TextSize["XL"] = "xl";
|
|
@@ -11,15 +13,31 @@ export var TextSize;
|
|
|
11
13
|
TextSize["Field1"] = "field1";
|
|
12
14
|
TextSize["Field2"] = "field2";
|
|
13
15
|
})(TextSize || (TextSize = {}));
|
|
14
|
-
export var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})(
|
|
16
|
+
export var TextVariant;
|
|
17
|
+
(function (TextVariant) {
|
|
18
|
+
TextVariant["PRIMARY"] = "primary";
|
|
19
|
+
TextVariant["SECONDARY"] = "secondary";
|
|
20
|
+
TextVariant["GREY"] = "grey";
|
|
21
|
+
TextVariant["LIGHT_GREY"] = "light_grey";
|
|
22
|
+
TextVariant["DISABLED"] = "disabled";
|
|
23
|
+
TextVariant["VALIDATION"] = "validation";
|
|
24
|
+
TextVariant["ERROR"] = "error";
|
|
25
|
+
TextVariant["SUCCESS"] = "success";
|
|
26
|
+
})(TextVariant || (TextVariant = {}));
|
|
27
|
+
export const colorText = {
|
|
28
|
+
[TextVariant.PRIMARY]: palette.black,
|
|
29
|
+
[TextVariant.SECONDARY]: palette.white,
|
|
30
|
+
[TextVariant.GREY]: palette.neutral_600,
|
|
31
|
+
[TextVariant.LIGHT_GREY]: palette.neutral_200,
|
|
32
|
+
[TextVariant.DISABLED]: palette.primary_200,
|
|
33
|
+
[TextVariant.VALIDATION]: palette.validation,
|
|
34
|
+
[TextVariant.ERROR]: palette.error,
|
|
35
|
+
[TextVariant.SUCCESS]: palette.success,
|
|
36
|
+
};
|
|
37
|
+
export const colorTextDark = {
|
|
38
|
+
...colorText,
|
|
39
|
+
[TextVariant.VALIDATION]: darkPalette.validation,
|
|
40
|
+
[TextVariant.ERROR]: darkPalette.error,
|
|
41
|
+
[TextVariant.SUCCESS]: darkPalette.success,
|
|
42
|
+
};
|
|
25
43
|
//# sourceMappingURL=tuix-text.enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuix-text.enums.js","sourceRoot":"","sources":["../../../../src/tuix-text/enums/tuix-text.enums.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAWX;AAXD,WAAY,QAAQ;IAClB,qBAAS,CAAA;IACT,mBAAO,CAAA;IACP,mBAAO,CAAA;IACP,mBAAO,CAAA;IACP,qBAAS,CAAA;IACT,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;AACnB,CAAC,EAXW,QAAQ,KAAR,QAAQ,QAWnB;AAED,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"tuix-text.enums.js","sourceRoot":"","sources":["../../../../src/tuix-text/enums/tuix-text.enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,MAAM,CAAN,IAAY,QAWX;AAXD,WAAY,QAAQ;IAClB,qBAAS,CAAA;IACT,mBAAO,CAAA;IACP,mBAAO,CAAA;IACP,mBAAO,CAAA;IACP,qBAAS,CAAA;IACT,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;AACnB,CAAC,EAXW,QAAQ,KAAR,QAAQ,QAWnB;AAED,MAAM,CAAN,IAAY,WASX;AATD,WAAY,WAAW;IACrB,kCAA6B,CAAA;IAC7B,sCAAiC,CAAA;IACjC,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,wCAAyB,CAAA;IACzB,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EATW,WAAW,KAAX,WAAW,QAStB;AAED,MAAM,CAAC,MAAM,SAAS,GAAgC;IACpD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,KAAK;IACpC,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,KAAK;IACtC,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW;IACvC,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,WAAW;IAC7C,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,WAAW;IAC3C,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU;IAC5C,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK;IAClC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAgC;IACxD,GAAG,SAAS;IACZ,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,UAAU;IAChD,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,KAAK;IACtC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO;CAC3C,CAAC","sourcesContent":["import { palette } from '../../utils/colors';\nimport { darkPalette } from '../../utils/darkColors';\nimport { MainVariant } from '../../utils/mainVariant.enum';\n\nexport enum TextSize {\n XL = 'xl',\n L = 'l',\n M = 'm',\n S = 's',\n XS = 'xs',\n Body1 = 'body1',\n Body2 = 'body2',\n Button = 'button',\n Field1 = 'field1',\n Field2 = 'field2',\n}\n\nexport enum TextVariant {\n PRIMARY = MainVariant.PRIMARY,\n SECONDARY = MainVariant.SECONDARY,\n GREY = 'grey',\n LIGHT_GREY = 'light_grey',\n DISABLED = 'disabled',\n VALIDATION = 'validation',\n ERROR = 'error',\n SUCCESS = 'success',\n}\n\nexport const colorText: Record<TextVariant, string> = {\n [TextVariant.PRIMARY]: palette.black,\n [TextVariant.SECONDARY]: palette.white,\n [TextVariant.GREY]: palette.neutral_600,\n [TextVariant.LIGHT_GREY]: palette.neutral_200,\n [TextVariant.DISABLED]: palette.primary_200,\n [TextVariant.VALIDATION]: palette.validation,\n [TextVariant.ERROR]: palette.error,\n [TextVariant.SUCCESS]: palette.success,\n};\n\nexport const colorTextDark: Record<TextVariant, string> = {\n ...colorText,\n [TextVariant.VALIDATION]: darkPalette.validation,\n [TextVariant.ERROR]: darkPalette.error,\n [TextVariant.SUCCESS]: darkPalette.success,\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { CheckboxLabelSide } from '../tuix-checkbox/enums/tuix-checkbox.enums';
|
|
3
|
+
export declare class TuixToggleButton extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
checked: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
dark: boolean;
|
|
8
|
+
label: string;
|
|
9
|
+
labelSide: CheckboxLabelSide;
|
|
10
|
+
private _onToggleButtonChange;
|
|
11
|
+
private _getFullContainerClasses;
|
|
12
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { CheckboxLabelSide } from '../tuix-checkbox/enums/tuix-checkbox.enums';
|
|
6
|
+
import { toggleButtonCheckmarkStyles, toggleButtonContainerStyles, toggleButtonHostStyles, toggleButtonInnerStyles, toggleButtonLabelStyles, } from './TuixToggleButton.styles';
|
|
7
|
+
let TuixToggleButton = class TuixToggleButton extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.checked = false;
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.dark = false;
|
|
13
|
+
this.label = '';
|
|
14
|
+
this.labelSide = CheckboxLabelSide.RIGHT;
|
|
15
|
+
}
|
|
16
|
+
_onToggleButtonChange(event) {
|
|
17
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
18
|
+
detail: {
|
|
19
|
+
value: event.target.checked,
|
|
20
|
+
},
|
|
21
|
+
bubbles: true,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
_getFullContainerClasses() {
|
|
25
|
+
return {
|
|
26
|
+
't-toggle-button-full-container': true,
|
|
27
|
+
't-with-label-left': this.labelSide === CheckboxLabelSide.LEFT,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return html `<label class="${classMap(this._getFullContainerClasses())}">
|
|
32
|
+
<div class="t-toggle-button-container">
|
|
33
|
+
<input
|
|
34
|
+
type="checkbox"
|
|
35
|
+
class="t-toggle-button"
|
|
36
|
+
.checked="${this.checked}"
|
|
37
|
+
?disabled="${this.disabled}"
|
|
38
|
+
@change="${this._onToggleButtonChange}"
|
|
39
|
+
/>
|
|
40
|
+
<div class="t-toggle-button-checkmark">
|
|
41
|
+
<div class="t-toggle-button-inner"></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="t-toggle-button-label">
|
|
45
|
+
<slot>${this.label}</slot>
|
|
46
|
+
</div>
|
|
47
|
+
</label>`;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
TuixToggleButton.styles = [
|
|
51
|
+
toggleButtonHostStyles,
|
|
52
|
+
toggleButtonContainerStyles,
|
|
53
|
+
toggleButtonCheckmarkStyles,
|
|
54
|
+
toggleButtonInnerStyles,
|
|
55
|
+
toggleButtonLabelStyles,
|
|
56
|
+
];
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: Boolean })
|
|
59
|
+
], TuixToggleButton.prototype, "checked", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
property({ type: Boolean })
|
|
62
|
+
], TuixToggleButton.prototype, "disabled", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: Boolean })
|
|
65
|
+
], TuixToggleButton.prototype, "dark", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ type: String })
|
|
68
|
+
], TuixToggleButton.prototype, "label", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: String })
|
|
71
|
+
], TuixToggleButton.prototype, "labelSide", void 0);
|
|
72
|
+
TuixToggleButton = __decorate([
|
|
73
|
+
customElement('tuix-toggle-button')
|
|
74
|
+
], TuixToggleButton);
|
|
75
|
+
export { TuixToggleButton };
|
|
76
|
+
//# sourceMappingURL=TuixToggleButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TuixToggleButton.js","sourceRoot":"","sources":["../../../src/tuix-toggle-button/TuixToggleButton.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAa,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAGnC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,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mDACS;AAtBzB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA6D5B;SA7DY,gBAAgB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ClassInfo, classMap } from 'lit/directives/class-map.js';\nimport { CheckboxLabelSide } from '../tuix-checkbox/enums/tuix-checkbox.enums';\nimport {\n toggleButtonCheckmarkStyles,\n toggleButtonContainerStyles,\n toggleButtonHostStyles,\n toggleButtonInnerStyles,\n toggleButtonLabelStyles,\n} from './TuixToggleButton.styles';\n\n@customElement('tuix-toggle-button')\nexport class TuixToggleButton extends LitElement {\n static styles = [\n toggleButtonHostStyles,\n toggleButtonContainerStyles,\n toggleButtonCheckmarkStyles,\n toggleButtonInnerStyles,\n toggleButtonLabelStyles,\n ];\n\n @property({ type: Boolean })\n checked = false;\n\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: Boolean })\n dark = false;\n\n @property({ type: String })\n label = '';\n\n @property({ type: String })\n labelSide = CheckboxLabelSide.RIGHT;\n\n private _onToggleButtonChange(event: InputEvent) {\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: {\n value: (event.target as HTMLInputElement).checked,\n },\n bubbles: true,\n })\n );\n }\n\n private _getFullContainerClasses(): ClassInfo {\n return {\n 't-toggle-button-full-container': true,\n 't-with-label-left': this.labelSide === CheckboxLabelSide.LEFT,\n };\n }\n\n protected render() {\n return html`<label class=\"${classMap(this._getFullContainerClasses())}\">\n <div class=\"t-toggle-button-container\">\n <input\n type=\"checkbox\"\n class=\"t-toggle-button\"\n .checked=\"${this.checked}\"\n ?disabled=\"${this.disabled}\"\n @change=\"${this._onToggleButtonChange}\"\n />\n <div class=\"t-toggle-button-checkmark\">\n <div class=\"t-toggle-button-inner\"></div>\n </div>\n </div>\n <div class=\"t-toggle-button-label\">\n <slot>${this.label}</slot>\n </div>\n </label>`;\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const toggleButtonHostStyles: import("lit").CSSResult;
|
|
2
|
+
export declare const toggleButtonContainerStyles: import("lit").CSSResult;
|
|
3
|
+
export declare const toggleButtonCheckmarkStyles: import("lit").CSSResult;
|
|
4
|
+
export declare const toggleButtonInnerStyles: import("lit").CSSResult;
|
|
5
|
+
export declare const toggleButtonLabelStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { css, unsafeCSS } from 'lit';
|
|
2
|
+
import { hostStyles } from '../tuix-checkbox/TuixCheckbox.styles';
|
|
3
|
+
import { palette } from '../utils/colors';
|
|
4
|
+
import { darkPalette } from '../utils/darkColors';
|
|
5
|
+
export const toggleButtonHostStyles = css `
|
|
6
|
+
${hostStyles}
|
|
7
|
+
:host {
|
|
8
|
+
--t-bg-color-primary: ${unsafeCSS(palette.primary_300)};
|
|
9
|
+
--t-bg-color-disabled: ${unsafeCSS(palette.primary_100)};
|
|
10
|
+
--t-toggle-shadow-color-focus: rgba(142, 141, 208, 0.16);
|
|
11
|
+
--t-toggle-inner-radio: 1rem;
|
|
12
|
+
}
|
|
13
|
+
:host([dark]) {
|
|
14
|
+
--t-bg-color-primary: ${unsafeCSS(darkPalette.primary_800)};
|
|
15
|
+
--t-bg-color-disabled: ${unsafeCSS(darkPalette.neutral_200)};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const toggleButtonContainerStyles = css `
|
|
19
|
+
.t-toggle-button-full-container {
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
-webkit-user-select: none;
|
|
24
|
+
-moz-user-select: none;
|
|
25
|
+
-ms-user-select: none;
|
|
26
|
+
user-select: none;
|
|
27
|
+
}
|
|
28
|
+
:host([disabled]) .t-toggle-button-full-container {
|
|
29
|
+
cursor: not-allowed;
|
|
30
|
+
}
|
|
31
|
+
.t-toggle-button-container {
|
|
32
|
+
display: block;
|
|
33
|
+
position: relative;
|
|
34
|
+
height: 1.5rem;
|
|
35
|
+
width: 3rem;
|
|
36
|
+
}
|
|
37
|
+
.t-toggle-button-container .t-toggle-button {
|
|
38
|
+
position: absolute;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
height: 0;
|
|
41
|
+
width: 0;
|
|
42
|
+
}
|
|
43
|
+
.t-radio-button-full-container:not(.t-with-label-left) {
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
export const toggleButtonCheckmarkStyles = css `
|
|
48
|
+
.t-toggle-button-container .t-toggle-button-checkmark {
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 0;
|
|
51
|
+
left: 0;
|
|
52
|
+
display: flex;
|
|
53
|
+
height: 1.5rem;
|
|
54
|
+
width: 3rem;
|
|
55
|
+
border-radius: 0.75rem;
|
|
56
|
+
background-color: var(--t-bg-color-primary);
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
.t-toggle-button-container
|
|
60
|
+
.t-toggle-button:checked
|
|
61
|
+
~ .t-toggle-button-checkmark {
|
|
62
|
+
background-color: var(--t-main-color-tuix);
|
|
63
|
+
}
|
|
64
|
+
.t-toggle-button-full-container:hover
|
|
65
|
+
.t-toggle-button-container
|
|
66
|
+
.t-toggle-button-checkmark {
|
|
67
|
+
box-shadow: 0px 4px 4px 0px var(--t-toggle-shadow-color-focus);
|
|
68
|
+
}
|
|
69
|
+
.t-toggle-button-container
|
|
70
|
+
.t-toggle-button:focus
|
|
71
|
+
~ .t-toggle-button-checkmark {
|
|
72
|
+
box-shadow: 0 0 0px 2px var(--t-stroke-color-focus);
|
|
73
|
+
}
|
|
74
|
+
.t-toggle-button-container
|
|
75
|
+
.t-toggle-button:disabled
|
|
76
|
+
~ .t-toggle-button-checkmark {
|
|
77
|
+
background-color: var(--t-bg-color-disabled);
|
|
78
|
+
box-shadow: none;
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
export const toggleButtonInnerStyles = css `
|
|
82
|
+
.t-toggle-button-container .t-toggle-button-checkmark .t-toggle-button-inner {
|
|
83
|
+
background-color: ${unsafeCSS(palette.white)};
|
|
84
|
+
margin: auto auto auto 0.25rem;
|
|
85
|
+
height: var(--t-toggle-inner-radio);
|
|
86
|
+
width: var(--t-toggle-inner-radio);
|
|
87
|
+
border-radius: 50%;
|
|
88
|
+
display: block;
|
|
89
|
+
transition: 0.3s;
|
|
90
|
+
}
|
|
91
|
+
.t-toggle-button-container
|
|
92
|
+
.t-toggle-button:checked
|
|
93
|
+
~ .t-toggle-button-checkmark
|
|
94
|
+
.t-toggle-button-inner {
|
|
95
|
+
transform: translateX(calc(3rem - var(--t-toggle-inner-radio) - 0.5rem));
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
export const toggleButtonLabelStyles = css `
|
|
99
|
+
.t-toggle-button-label {
|
|
100
|
+
display: block;
|
|
101
|
+
font-size: 1rem;
|
|
102
|
+
line-height: 1.5rem;
|
|
103
|
+
font-weight: 300;
|
|
104
|
+
font-family: 'rubik', sans-serif;
|
|
105
|
+
color: var(--t-text-color-label);
|
|
106
|
+
margin-left: 0.625rem;
|
|
107
|
+
}
|
|
108
|
+
.t-toggle-button-full-container.t-with-label-left {
|
|
109
|
+
flex-direction: row-reverse;
|
|
110
|
+
}
|
|
111
|
+
.t-toggle-button-full-container.t-with-label-left .t-toggle-button-label {
|
|
112
|
+
margin-right: 0.625rem;
|
|
113
|
+
margin-left: 0;
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
//# sourceMappingURL=TuixToggleButton.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TuixToggleButton.styles.js","sourceRoot":"","sources":["../../../src/tuix-toggle-button/TuixToggleButton.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;IACrC,UAAU;;4BAEc,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC;6BAC7B,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC;;;;;4BAK/B,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC;6BACjC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC;;CAE9D,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B7C,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC7C,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;;wBAElB,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;;;;;;;;;;;;;;CAc/C,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBzC,CAAC","sourcesContent":["import { css, unsafeCSS } from 'lit';\nimport { hostStyles } from '../tuix-checkbox/TuixCheckbox.styles';\nimport { palette } from '../utils/colors';\nimport { darkPalette } from '../utils/darkColors';\n\nexport const toggleButtonHostStyles = css`\n ${hostStyles}\n :host {\n --t-bg-color-primary: ${unsafeCSS(palette.primary_300)};\n --t-bg-color-disabled: ${unsafeCSS(palette.primary_100)};\n --t-toggle-shadow-color-focus: rgba(142, 141, 208, 0.16);\n --t-toggle-inner-radio: 1rem;\n }\n :host([dark]) {\n --t-bg-color-primary: ${unsafeCSS(darkPalette.primary_800)};\n --t-bg-color-disabled: ${unsafeCSS(darkPalette.neutral_200)};\n }\n`;\n\nexport const toggleButtonContainerStyles = css`\n .t-toggle-button-full-container {\n display: flex;\n justify-content: space-between;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n :host([disabled]) .t-toggle-button-full-container {\n cursor: not-allowed;\n }\n .t-toggle-button-container {\n display: block;\n position: relative;\n height: 1.5rem;\n width: 3rem;\n }\n .t-toggle-button-container .t-toggle-button {\n position: absolute;\n opacity: 0;\n height: 0;\n width: 0;\n }\n .t-radio-button-full-container:not(.t-with-label-left) {\n justify-content: flex-start;\n }\n`;\n\nexport const toggleButtonCheckmarkStyles = css`\n .t-toggle-button-container .t-toggle-button-checkmark {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n height: 1.5rem;\n width: 3rem;\n border-radius: 0.75rem;\n background-color: var(--t-bg-color-primary);\n box-sizing: border-box;\n }\n .t-toggle-button-container\n .t-toggle-button:checked\n ~ .t-toggle-button-checkmark {\n background-color: var(--t-main-color-tuix);\n }\n .t-toggle-button-full-container:hover\n .t-toggle-button-container\n .t-toggle-button-checkmark {\n box-shadow: 0px 4px 4px 0px var(--t-toggle-shadow-color-focus);\n }\n .t-toggle-button-container\n .t-toggle-button:focus\n ~ .t-toggle-button-checkmark {\n box-shadow: 0 0 0px 2px var(--t-stroke-color-focus);\n }\n .t-toggle-button-container\n .t-toggle-button:disabled\n ~ .t-toggle-button-checkmark {\n background-color: var(--t-bg-color-disabled);\n box-shadow: none;\n }\n`;\n\nexport const toggleButtonInnerStyles = css`\n .t-toggle-button-container .t-toggle-button-checkmark .t-toggle-button-inner {\n background-color: ${unsafeCSS(palette.white)};\n margin: auto auto auto 0.25rem;\n height: var(--t-toggle-inner-radio);\n width: var(--t-toggle-inner-radio);\n border-radius: 50%;\n display: block;\n transition: 0.3s;\n }\n .t-toggle-button-container\n .t-toggle-button:checked\n ~ .t-toggle-button-checkmark\n .t-toggle-button-inner {\n transform: translateX(calc(3rem - var(--t-toggle-inner-radio) - 0.5rem));\n }\n`;\n\nexport const toggleButtonLabelStyles = css`\n .t-toggle-button-label {\n display: block;\n font-size: 1rem;\n line-height: 1.5rem;\n font-weight: 300;\n font-family: 'rubik', sans-serif;\n color: var(--t-text-color-label);\n margin-left: 0.625rem;\n }\n .t-toggle-button-full-container.t-with-label-left {\n flex-direction: row-reverse;\n }\n .t-toggle-button-full-container.t-with-label-left .t-toggle-button-label {\n margin-right: 0.625rem;\n margin-left: 0;\n }\n`;\n"]}
|