tuix-webcomponents 0.0.22 → 0.0.25
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 +110 -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 +6 -12
- package/dist/src/tuix-button/TuixButton.js +35 -59
- package/dist/src/tuix-button/TuixButton.styles.d.ts +1 -0
- package/dist/src/tuix-button/TuixButton.styles.js +77 -44
- package/dist/src/tuix-button/enums/tuix-button.enums.js +3 -4
- 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 +13 -3
- package/dist/src/tuix-dropdown/TuixDropdown.js +125 -39
- package/dist/src/tuix-dropdown/TuixDropdown.styles.js +59 -19
- 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 +5 -1
- package/dist/src/tuix-icon/TuixIcon.icons.d.ts +2 -2
- package/dist/src/tuix-icon/TuixIcon.icons.js +299 -7
- package/dist/src/tuix-icon/TuixIcon.js +37 -23
- 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 +6 -11
- package/dist/src/tuix-icon-button/TuixIconButton.js +20 -49
- package/dist/src/tuix-input/TuixInput.d.ts +12 -6
- package/dist/src/tuix-input/TuixInput.js +97 -50
- package/dist/src/tuix-input/TuixInput.styles.js +99 -110
- package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +10 -8
- package/dist/src/tuix-input/enums/tuix-input.enums.js +10 -11
- package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +11 -6
- package/dist/src/tuix-input/interfaces/tuix-input.interface.js +5 -2
- package/dist/src/tuix-link/TuixLink.d.ts +8 -4
- package/dist/src/tuix-link/TuixLink.js +37 -38
- 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 +145 -64
- 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 +113 -68
- 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,7 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement, html } from 'lit';
|
|
2
|
+
import { LitElement, html, } from 'lit';
|
|
3
3
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import '../tuix-input/TuixInput.js';
|
|
5
6
|
import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
|
|
6
7
|
import { dropdownHostStyles, dropdownMainContainerStyles, dropdownOptionStyles, } from './TuixDropdown.styles';
|
|
7
8
|
import { DescriptionType } from '../tuix-input/enums/tuix-input.enums';
|
|
@@ -15,11 +16,12 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
15
16
|
this.title = '';
|
|
16
17
|
this.disabled = false;
|
|
17
18
|
this.dark = false;
|
|
18
|
-
this.description = undefined;
|
|
19
19
|
this.descriptionType = DescriptionType.TEXT;
|
|
20
20
|
this.type = DropdownType.SINGLE;
|
|
21
21
|
this._value = '';
|
|
22
22
|
this._isOptionsVisible = false;
|
|
23
|
+
this._searchingOption = false;
|
|
24
|
+
this._extendedOptions = [];
|
|
23
25
|
this._previousSelectedOption = null;
|
|
24
26
|
this._previousFocusedOption = null;
|
|
25
27
|
this._handleClickOutside = (event) => {
|
|
@@ -28,9 +30,15 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
28
30
|
}
|
|
29
31
|
};
|
|
30
32
|
}
|
|
33
|
+
static { this.styles = [
|
|
34
|
+
dropdownHostStyles,
|
|
35
|
+
dropdownMainContainerStyles,
|
|
36
|
+
dropdownOptionStyles,
|
|
37
|
+
]; }
|
|
31
38
|
connectedCallback() {
|
|
32
39
|
super.connectedCallback();
|
|
33
40
|
window.addEventListener('click', this._handleClickOutside);
|
|
41
|
+
this.addEventListener('blur', this._handleBlur.bind(this));
|
|
34
42
|
}
|
|
35
43
|
disconnectedCallback() {
|
|
36
44
|
window.removeEventListener('click', this._handleClickOutside);
|
|
@@ -78,39 +86,81 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
78
86
|
const selectedValue = this.options[Number(optionIndex)];
|
|
79
87
|
this.dispatchEvent(new CustomEvent('select', {
|
|
80
88
|
detail: {
|
|
81
|
-
value: selectedValue,
|
|
89
|
+
value: this._getOptionValue(selectedValue),
|
|
82
90
|
},
|
|
83
91
|
bubbles: true,
|
|
84
92
|
}));
|
|
93
|
+
if (this.type === DropdownType.SEARCH) {
|
|
94
|
+
this._extendOptionsList(this._getOptionName(selectedValue));
|
|
95
|
+
this._searchingOption = false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
_handleBlur() {
|
|
99
|
+
if (this.type === DropdownType.SEARCH && this._searchingOption) {
|
|
100
|
+
const optionIndex = this._previousSelectedOption?.getAttribute('data-value');
|
|
101
|
+
const selectedValue = typeof optionIndex === 'string'
|
|
102
|
+
? this.options[Number(optionIndex)]
|
|
103
|
+
: '';
|
|
104
|
+
this._value = this._getOptionName(selectedValue);
|
|
105
|
+
this._extendOptionsList();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
_getOptionName(option) {
|
|
109
|
+
return String(typeof option === 'object' ? option?.name : option);
|
|
110
|
+
}
|
|
111
|
+
_getOptionValue(option) {
|
|
112
|
+
return typeof option === 'object' ? option.value : option;
|
|
113
|
+
}
|
|
114
|
+
_findIndex(option) {
|
|
115
|
+
return this._extendedOptions.findIndex(opt => opt.value === this._getOptionValue(option));
|
|
85
116
|
}
|
|
86
117
|
_handleInputBase(e, eventName) {
|
|
87
|
-
|
|
118
|
+
if (!this._searchingOption) {
|
|
119
|
+
this._searchingOption = true;
|
|
120
|
+
}
|
|
121
|
+
this._extendOptionsList(e.detail.value);
|
|
122
|
+
this._isOptionsVisible = true;
|
|
88
123
|
this.dispatchEvent(new CustomEvent(eventName, {
|
|
89
124
|
detail: {
|
|
90
|
-
value:
|
|
125
|
+
value: e.detail.value,
|
|
91
126
|
},
|
|
92
127
|
bubbles: true,
|
|
93
128
|
}));
|
|
129
|
+
this._value = e.detail.value;
|
|
130
|
+
}
|
|
131
|
+
_extendOptionsList(value = '') {
|
|
132
|
+
value = value.trim();
|
|
133
|
+
this._extendedOptions = this.options.map(option => {
|
|
134
|
+
const optionName = this._getOptionName(option);
|
|
135
|
+
return {
|
|
136
|
+
name: optionName,
|
|
137
|
+
value: this._getOptionValue(option),
|
|
138
|
+
filtered: this.type === DropdownType.SEARCH &&
|
|
139
|
+
value !== '' &&
|
|
140
|
+
!optionName.toLowerCase().includes(value.toLowerCase()),
|
|
141
|
+
};
|
|
142
|
+
});
|
|
94
143
|
}
|
|
95
144
|
_handleArrowDown() {
|
|
96
|
-
|
|
97
|
-
|
|
145
|
+
const nextOption = this._previousFocusedOption
|
|
146
|
+
?.nextElementSibling;
|
|
98
147
|
if (nextOption) {
|
|
99
148
|
this._focusTargetOption(nextOption);
|
|
100
149
|
}
|
|
101
150
|
}
|
|
102
151
|
_handleArrowUp() {
|
|
103
|
-
|
|
104
|
-
|
|
152
|
+
const previousOption = this._previousFocusedOption
|
|
153
|
+
?.previousElementSibling;
|
|
105
154
|
if (previousOption) {
|
|
106
155
|
this._focusTargetOption(previousOption);
|
|
107
156
|
}
|
|
108
157
|
}
|
|
109
|
-
_focusTargetOption(targetOption) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
158
|
+
_focusTargetOption(targetOption, extrict = true) {
|
|
159
|
+
this._previousFocusedOption?.classList?.remove('t-option-hover');
|
|
160
|
+
targetOption?.classList.add('t-option-hover');
|
|
161
|
+
if (extrict) {
|
|
162
|
+
targetOption?.focus();
|
|
163
|
+
}
|
|
114
164
|
this._previousFocusedOption = targetOption;
|
|
115
165
|
}
|
|
116
166
|
_toggleOptions() {
|
|
@@ -118,11 +168,25 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
118
168
|
return;
|
|
119
169
|
}
|
|
120
170
|
this._isOptionsVisible = !this._isOptionsVisible;
|
|
171
|
+
if (this._isOptionsVisible &&
|
|
172
|
+
this.type === DropdownType.SEARCH &&
|
|
173
|
+
this._previousSelectedOption) {
|
|
174
|
+
this._optionsContainer?.scrollTo({
|
|
175
|
+
top: this._previousSelectedOption.offsetTop,
|
|
176
|
+
behavior: 'auto',
|
|
177
|
+
});
|
|
178
|
+
this._inputDropdown?.shadowRoot?.querySelector('input')?.select();
|
|
179
|
+
}
|
|
121
180
|
}
|
|
122
181
|
_focusOptionsContainer() {
|
|
123
|
-
|
|
182
|
+
if (this.type === DropdownType.SEARCH) {
|
|
183
|
+
if (this._previousSelectedOption) {
|
|
184
|
+
this._focusTargetOption(this._previousSelectedOption, false);
|
|
185
|
+
}
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
124
188
|
if (!this._isOptionsVisible || !this._optionsContainer) {
|
|
125
|
-
|
|
189
|
+
this._inputDropdown?.shadowRoot?.querySelector('input')?.focus();
|
|
126
190
|
return;
|
|
127
191
|
}
|
|
128
192
|
if (this._previousSelectedOption) {
|
|
@@ -137,41 +201,59 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
137
201
|
}
|
|
138
202
|
}
|
|
139
203
|
_unselectPreviousOption() {
|
|
140
|
-
var _a;
|
|
141
204
|
if (this._previousSelectedOption) {
|
|
142
|
-
|
|
205
|
+
this._previousSelectedOption.classList?.remove('t-option-selected');
|
|
143
206
|
this._previousSelectedOption = null;
|
|
144
207
|
}
|
|
145
208
|
}
|
|
209
|
+
_hasCompleteDescription() {
|
|
210
|
+
const isValidDescriptionType = Object.values(DescriptionType).includes(this.descriptionType);
|
|
211
|
+
return (isValidDescriptionType &&
|
|
212
|
+
(this.descriptionType === DescriptionType.TEXT
|
|
213
|
+
? !!this.description
|
|
214
|
+
: true));
|
|
215
|
+
}
|
|
146
216
|
_getOptionsContainerClasses() {
|
|
147
217
|
return {
|
|
148
218
|
't-options-container': true,
|
|
149
219
|
show: this._isOptionsVisible,
|
|
150
|
-
't-with-description':
|
|
220
|
+
't-with-description': this._hasCompleteDescription(),
|
|
151
221
|
};
|
|
152
222
|
}
|
|
153
223
|
_triggerUpdateByExternalValueChange() {
|
|
154
|
-
var _a;
|
|
155
224
|
this._unselectPreviousOption();
|
|
156
225
|
if (!this.value) {
|
|
226
|
+
this._value = '';
|
|
227
|
+
this._extendOptionsList();
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const index = this._findIndex(this.value);
|
|
231
|
+
if (this.type === DropdownType.SEARCH) {
|
|
232
|
+
this._extendOptionsList('');
|
|
233
|
+
}
|
|
234
|
+
if (index < 0) {
|
|
157
235
|
this._value = '';
|
|
158
236
|
return;
|
|
159
237
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
optionTarget === null || optionTarget === void 0 ? void 0 : optionTarget.classList.add('t-option-selected');
|
|
238
|
+
const optionTarget = this._optionsContainer?.children[index];
|
|
239
|
+
optionTarget?.classList.add('t-option-selected');
|
|
163
240
|
this._previousSelectedOption = optionTarget || null;
|
|
164
|
-
this._value = optionTarget ?
|
|
241
|
+
this._value = optionTarget ? this._getOptionName(this.options[index]) : '';
|
|
165
242
|
}
|
|
166
243
|
_resetPreviousSelection() {
|
|
167
244
|
this._value = '';
|
|
168
245
|
this._unselectPreviousOption();
|
|
169
246
|
}
|
|
170
247
|
_getOptionsTemplate() {
|
|
171
|
-
|
|
172
|
-
|
|
248
|
+
if (this.type === DropdownType.SINGLE || this._searchingOption === false) {
|
|
249
|
+
this._extendOptionsList();
|
|
250
|
+
}
|
|
251
|
+
return this._extendedOptions?.map((option, index) => {
|
|
173
252
|
return html `<div
|
|
174
|
-
class="
|
|
253
|
+
class="${classMap({
|
|
254
|
+
't-dropdown-option': true,
|
|
255
|
+
't-option-filtered': option.filtered,
|
|
256
|
+
})}"
|
|
175
257
|
@click="${this._onClickOption}"
|
|
176
258
|
data-value="${index}"
|
|
177
259
|
tabindex="0"
|
|
@@ -179,7 +261,7 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
179
261
|
@keypress="${this._onKeyPressOption}"
|
|
180
262
|
@mouseover="${this._onMouseOverOption}"
|
|
181
263
|
>
|
|
182
|
-
${option}
|
|
264
|
+
${option.name}
|
|
183
265
|
</div>`;
|
|
184
266
|
});
|
|
185
267
|
}
|
|
@@ -196,6 +278,10 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
196
278
|
this._resetPreviousSelection();
|
|
197
279
|
}
|
|
198
280
|
}
|
|
281
|
+
firstUpdated(changedProperties) {
|
|
282
|
+
super.firstUpdated(changedProperties);
|
|
283
|
+
this._triggerUpdateByExternalValueChange();
|
|
284
|
+
}
|
|
199
285
|
render() {
|
|
200
286
|
return html `<div class="t-dropdown-full-container">
|
|
201
287
|
<div class="t-dropdown-container">
|
|
@@ -212,9 +298,9 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
212
298
|
?disabled="${this.disabled}"
|
|
213
299
|
?dark="${this.dark}"
|
|
214
300
|
?readonly="${this.type !== DropdownType.SEARCH}"
|
|
215
|
-
@click="${this._toggleOptions}"
|
|
301
|
+
@on-click="${this._toggleOptions}"
|
|
216
302
|
@keypress="${this._onEnterPress}"
|
|
217
|
-
@
|
|
303
|
+
@on-change="${this._onInputSingle}"
|
|
218
304
|
>
|
|
219
305
|
</tuix-input>
|
|
220
306
|
</div>
|
|
@@ -224,13 +310,8 @@ let TuixDropdown = class TuixDropdown extends LitElement {
|
|
|
224
310
|
</div>`;
|
|
225
311
|
}
|
|
226
312
|
};
|
|
227
|
-
TuixDropdown.styles = [
|
|
228
|
-
dropdownHostStyles,
|
|
229
|
-
dropdownMainContainerStyles,
|
|
230
|
-
dropdownOptionStyles,
|
|
231
|
-
];
|
|
232
313
|
__decorate([
|
|
233
|
-
property({ type: Object
|
|
314
|
+
property({ type: Object })
|
|
234
315
|
], TuixDropdown.prototype, "value", void 0);
|
|
235
316
|
__decorate([
|
|
236
317
|
property({ type: Array })
|
|
@@ -242,10 +323,10 @@ __decorate([
|
|
|
242
323
|
property({ type: String })
|
|
243
324
|
], TuixDropdown.prototype, "title", void 0);
|
|
244
325
|
__decorate([
|
|
245
|
-
property({ type: Boolean })
|
|
326
|
+
property({ type: Boolean, reflect: true })
|
|
246
327
|
], TuixDropdown.prototype, "disabled", void 0);
|
|
247
328
|
__decorate([
|
|
248
|
-
property({ type: Boolean })
|
|
329
|
+
property({ type: Boolean, reflect: true })
|
|
249
330
|
], TuixDropdown.prototype, "dark", void 0);
|
|
250
331
|
__decorate([
|
|
251
332
|
property({ type: String })
|
|
@@ -262,6 +343,12 @@ __decorate([
|
|
|
262
343
|
__decorate([
|
|
263
344
|
state()
|
|
264
345
|
], TuixDropdown.prototype, "_isOptionsVisible", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
state()
|
|
348
|
+
], TuixDropdown.prototype, "_searchingOption", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
state()
|
|
351
|
+
], TuixDropdown.prototype, "_extendedOptions", void 0);
|
|
265
352
|
__decorate([
|
|
266
353
|
query('.t-options-container')
|
|
267
354
|
], TuixDropdown.prototype, "_optionsContainer", void 0);
|
|
@@ -272,4 +359,3 @@ TuixDropdown = __decorate([
|
|
|
272
359
|
customElement('tuix-dropdown')
|
|
273
360
|
], TuixDropdown);
|
|
274
361
|
export { TuixDropdown };
|
|
275
|
-
//# sourceMappingURL=TuixDropdown.js.map
|
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
import { css, unsafeCSS } from 'lit';
|
|
2
2
|
import { hostStyles } from '../tuix-input/TuixInput.styles';
|
|
3
|
-
import {
|
|
3
|
+
import { Palette } from '../utils/colors';
|
|
4
4
|
import { ScreenSizes } from '../utils/screenSizes.enum';
|
|
5
|
+
import { DarkPalette } from '../utils/darkColors';
|
|
5
6
|
export const dropdownHostStyles = css `
|
|
6
7
|
${hostStyles}
|
|
7
8
|
:host {
|
|
8
|
-
--t-field-color-option: ${unsafeCSS(
|
|
9
|
-
--t-field-color-main: ${unsafeCSS(
|
|
9
|
+
--t-field-color-option: ${unsafeCSS(Palette.WHITE)};
|
|
10
|
+
--t-field-color-main: ${unsafeCSS(Palette.MAIN)};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host .t-input-dropdown {
|
|
14
|
+
--t-field-font-weight: 300;
|
|
15
|
+
--t-field-font-size: 1rem;
|
|
16
|
+
--t-field-padding-x: 1rem;
|
|
17
|
+
--t-field-title-left-position: 1rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
21
|
+
:host .t-input-dropdown {
|
|
22
|
+
--t-field-font-size: 0.938rem;
|
|
23
|
+
--t-field-line-height: 1.125rem;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
|
|
28
|
+
:host .t-input-dropdown {
|
|
29
|
+
--t-field-font-size: 0.813rem;
|
|
30
|
+
--t-field-line-height: 1rem;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([dark]) {
|
|
35
|
+
--t-field-color-option: ${unsafeCSS(DarkPalette.ELEVATION_2)};
|
|
10
36
|
}
|
|
11
37
|
`;
|
|
12
38
|
export const dropdownMainContainerStyles = css `
|
|
13
39
|
.t-dropdown-full-container {
|
|
14
40
|
position: relative;
|
|
15
|
-
font-family: '
|
|
16
|
-
cursor: pointer;
|
|
41
|
+
font-family: 'Rubik', sans-serif;
|
|
17
42
|
}
|
|
18
43
|
.t-dropdown-container .t-input-dropdown {
|
|
19
44
|
--t-field-input-cursor: pointer;
|
|
@@ -25,15 +50,15 @@ export const dropdownOptionStyles = css `
|
|
|
25
50
|
position: absolute;
|
|
26
51
|
top: calc(100% + 2px);
|
|
27
52
|
left: 0;
|
|
28
|
-
border:
|
|
29
|
-
border-top: none;
|
|
53
|
+
border: none;
|
|
30
54
|
border-radius: 0 0 5px 5px;
|
|
31
55
|
background-color: var(--t-field-color-option);
|
|
32
|
-
|
|
56
|
+
visibility: collapse;
|
|
33
57
|
overflow-y: auto;
|
|
34
|
-
max-height:
|
|
58
|
+
max-height: 250px;
|
|
35
59
|
color: var(--t-field-color-text);
|
|
36
|
-
box-shadow: 0px 2px 8px 0px
|
|
60
|
+
box-shadow: 0px 2px 8px 0px ${unsafeCSS(Palette.SHADOW)};
|
|
61
|
+
z-index: 9999;
|
|
37
62
|
}
|
|
38
63
|
.t-options-container::-webkit-scrollbar {
|
|
39
64
|
width: 0.75rem;
|
|
@@ -42,23 +67,32 @@ export const dropdownOptionStyles = css `
|
|
|
42
67
|
background-color: transparent;
|
|
43
68
|
}
|
|
44
69
|
.t-options-container::-webkit-scrollbar-thumb {
|
|
45
|
-
background-color: ${unsafeCSS(
|
|
70
|
+
background-color: ${unsafeCSS(Palette.PRIMARY_100)};
|
|
46
71
|
border-radius: 0.25rem;
|
|
47
72
|
border: 0.188rem solid transparent;
|
|
48
73
|
background-clip: content-box;
|
|
49
74
|
}
|
|
50
75
|
.t-options-container.show {
|
|
51
|
-
|
|
76
|
+
visibility: visible;
|
|
52
77
|
}
|
|
53
78
|
.t-options-container.show.t-with-description {
|
|
54
79
|
top: calc(100% + 2px - 1.5rem);
|
|
55
80
|
}
|
|
81
|
+
@media only screen and (max-height: 500px) {
|
|
82
|
+
.t-options-container {
|
|
83
|
+
max-height: 50vh;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
56
86
|
.t-dropdown-option {
|
|
57
|
-
padding:
|
|
87
|
+
padding: var(--t-field-padding-y) 1rem;
|
|
58
88
|
cursor: pointer;
|
|
59
89
|
font-size: 1rem;
|
|
60
|
-
|
|
61
|
-
|
|
90
|
+
line-height: 1.25rem;
|
|
91
|
+
font-weight: 300;
|
|
92
|
+
-webkit-user-select: none;
|
|
93
|
+
-moz-user-select: none;
|
|
94
|
+
-ms-user-select: none;
|
|
95
|
+
user-select: none;
|
|
62
96
|
}
|
|
63
97
|
.t-dropdown-option.t-option-hover {
|
|
64
98
|
background-color: var(--t-field-color-form);
|
|
@@ -66,20 +100,26 @@ export const dropdownOptionStyles = css `
|
|
|
66
100
|
.t-dropdown-option.t-option-selected {
|
|
67
101
|
color: var(--t-field-color-main);
|
|
68
102
|
}
|
|
103
|
+
.t-dropdown-option.t-option-filtered {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
69
106
|
.t-dropdown-option:focus {
|
|
70
107
|
outline: none;
|
|
71
108
|
}
|
|
72
109
|
@media only screen and (max-width: ${ScreenSizes.TABLET}px) {
|
|
73
110
|
.t-dropdown-option {
|
|
74
|
-
font-size:
|
|
75
|
-
line-height: 1.
|
|
111
|
+
font-size: 0.938rem;
|
|
112
|
+
line-height: 1.125rem;
|
|
113
|
+
--t-field-padding-y: 1.063rem;
|
|
114
|
+
--t-field-padding-top: 1.5rem;
|
|
76
115
|
}
|
|
77
116
|
}
|
|
78
117
|
@media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
|
|
79
118
|
.t-dropdown-option {
|
|
80
|
-
font-size: 0.
|
|
119
|
+
font-size: 0.813rem;
|
|
81
120
|
line-height: 1rem;
|
|
121
|
+
--t-field-padding-y: 1rem;
|
|
122
|
+
--t-field-padding-top: 1.375rem;
|
|
82
123
|
}
|
|
83
124
|
}
|
|
84
125
|
`;
|
|
85
|
-
//# sourceMappingURL=TuixDropdown.styles.js.map
|
|
@@ -3,11 +3,3 @@ export var DropdownType;
|
|
|
3
3
|
DropdownType["SINGLE"] = "single";
|
|
4
4
|
DropdownType["SEARCH"] = "search";
|
|
5
5
|
})(DropdownType || (DropdownType = {}));
|
|
6
|
-
export var OptionVarType;
|
|
7
|
-
(function (OptionVarType) {
|
|
8
|
-
OptionVarType["STRING"] = "string";
|
|
9
|
-
OptionVarType["NUMBER"] = "number";
|
|
10
|
-
OptionVarType["BOOLEAN"] = "boolean";
|
|
11
|
-
OptionVarType["UNKNOW"] = "unknow";
|
|
12
|
-
})(OptionVarType || (OptionVarType = {}));
|
|
13
|
-
//# sourceMappingURL=tuix-dropdown.enums.js.map
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { type CustomEventTuixInput } from '../../tuix-input/interfaces/tuix-input.interface';
|
|
2
|
+
import { type DetailValue } from '../../utils/interfaces/detail-value.interface';
|
|
3
|
+
export type TuixDropdownPlainOption = string | number | boolean;
|
|
4
|
+
export interface TuixDropdownObjectOption {
|
|
5
|
+
name: string;
|
|
6
|
+
value: TuixDropdownPlainOption;
|
|
7
|
+
}
|
|
8
|
+
export type TuixDropdownOption = TuixDropdownPlainOption | TuixDropdownObjectOption;
|
|
9
|
+
export interface TuixDropdownExtendedOption {
|
|
10
|
+
name: string;
|
|
11
|
+
value: TuixDropdownPlainOption;
|
|
12
|
+
filtered: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type CustomEventTuixDropdownSelect<T extends TuixDropdownOption = TuixDropdownOption> = CustomEvent<DetailValue<T>>;
|
|
15
|
+
export type CustomEventTuixDropdownInput = CustomEventTuixInput;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { LitElement, TemplateResult } from 'lit';
|
|
2
2
|
import { IconName, IconSizeVariant } from './enums/tuix-icon.enums';
|
|
3
|
+
import { TextVariant } from '../tuix-text/enums/tuix-text.enums';
|
|
3
4
|
export declare class TuixIcon extends LitElement {
|
|
4
5
|
static styles: import("lit").CSSResult;
|
|
5
6
|
name: IconName;
|
|
6
|
-
color
|
|
7
|
+
color?: string | TextVariant;
|
|
7
8
|
size: IconSizeVariant;
|
|
9
|
+
dark: boolean;
|
|
10
|
+
fill?: string | TextVariant;
|
|
8
11
|
private _getSelectedColor;
|
|
12
|
+
private _getSelectedFill;
|
|
9
13
|
private _getIconTemplate;
|
|
10
14
|
render(): TemplateResult<1>;
|
|
11
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { html } from 'lit';
|
|
2
2
|
import { IconName } from './enums/tuix-icon.enums';
|
|
3
|
-
export declare const iconTemplate: (name?: IconName, color?: string) =>
|
|
3
|
+
export declare const iconTemplate: (name?: IconName, color?: string, fill?: string) => ReturnType<typeof html>;
|
|
4
4
|
type IconContentMapType = Record<IconName, string>;
|
|
5
5
|
export declare const iconContentMap: IconContentMapType;
|
|
6
6
|
export {};
|