tuix-webcomponents 0.63.0 → 0.64.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.
Files changed (168) hide show
  1. package/README.md +2 -2
  2. package/dist/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
  3. package/dist/assets/Color-AVL7NMMY-IH_JbDEF.js +1 -0
  4. package/dist/assets/DocsRenderer-PQXLIZUC-C0ZKNA9m.js +1286 -0
  5. package/dist/{src/tuix-icon/TuixIcon.icons.js → assets/TuixIconButton-eQtxZNXh.js} +203 -125
  6. package/dist/assets/TuixModal-BZFIHTi_.js +78 -0
  7. package/dist/assets/TuixToast-BhxwZIGo.js +62 -0
  8. package/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  9. package/dist/assets/axe-C59a3kt3.js +30 -0
  10. package/dist/assets/iframe-ClsPaEIM.js +1057 -0
  11. package/dist/assets/index-DBzYXxxs.js +1554 -0
  12. package/dist/assets/index-TjhCmV-u.js +1 -0
  13. package/dist/assets/matchers-7Z3WT2CE-CcSi9QFY.js +14 -0
  14. package/dist/assets/screenSizes.enum-C1IhC_dy.js +13 -0
  15. package/dist/assets/state-CLjydI9z.js +13 -0
  16. package/dist/assets/tuix-button.stories-Dm_yifox.js +30 -0
  17. package/dist/assets/tuix-checkbox.stories-DmzoygjC.js +44 -0
  18. package/dist/assets/tuix-dropdown-object-list.stories-Neeajtj-.js +56 -0
  19. package/dist/assets/tuix-dropdown.stories-B7ea8QAz.js +28 -0
  20. package/dist/assets/tuix-icon-button.stories-CgbOSRO4.js +21 -0
  21. package/dist/assets/tuix-icon.enums-DYTtwLZl.js +1 -0
  22. package/dist/assets/tuix-icon.stories-CjN2XsKx.js +19 -0
  23. package/dist/assets/tuix-input.stories-CD7onvw2.js +33 -0
  24. package/dist/assets/tuix-link.stories-CT7pzGlx.js +35 -0
  25. package/dist/assets/tuix-modal.stories-B6v3cOPq.js +39 -0
  26. package/dist/assets/tuix-paper.enum-DhmlUJB7.js +1 -0
  27. package/dist/assets/tuix-paper.stories-CLnRPHNK.js +31 -0
  28. package/dist/assets/tuix-radio-button.stories-BwkKC3a9.js +35 -0
  29. package/dist/assets/tuix-table.stories-Bn-aZa0J.js +65 -0
  30. package/dist/assets/tuix-text.enums-Ck8cVqZZ.js +1 -0
  31. package/dist/assets/tuix-text.stories-BNIqPsGD.js +29 -0
  32. package/dist/assets/tuix-toast.stories-CRYiLiHK.js +21 -0
  33. package/dist/assets/tuix-toggle-button.stories-CY6wlDnA.js +40 -0
  34. package/dist/favicon-wrapper.svg +46 -0
  35. package/dist/favicon.svg +1 -0
  36. package/dist/iframe.html +685 -0
  37. package/dist/index.html +160 -0
  38. package/dist/index.json +1 -0
  39. package/dist/nunito-sans-bold-italic.woff2 +0 -0
  40. package/dist/nunito-sans-bold.woff2 +0 -0
  41. package/dist/nunito-sans-italic.woff2 +0 -0
  42. package/dist/nunito-sans-regular.woff2 +0 -0
  43. package/dist/project.json +1 -0
  44. package/dist/sb-addons/a11y-3/manager-bundle.js +5 -0
  45. package/dist/sb-addons/a11y-3/manager-bundle.js.LEGAL.txt +0 -0
  46. package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js +356 -0
  47. package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js.LEGAL.txt +40 -0
  48. package/dist/sb-addons/docs-2/manager-bundle.js +151 -0
  49. package/dist/sb-addons/docs-2/manager-bundle.js.LEGAL.txt +0 -0
  50. package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
  51. package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  52. package/dist/sb-addons/vitest-4/manager-bundle.js +3 -0
  53. package/dist/sb-addons/vitest-4/manager-bundle.js.LEGAL.txt +0 -0
  54. package/dist/sb-common-assets/favicon-wrapper.svg +46 -0
  55. package/dist/sb-common-assets/favicon.svg +1 -0
  56. package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  57. package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  58. package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  59. package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  60. package/dist/sb-manager/globals-module-info.js +797 -0
  61. package/dist/sb-manager/globals-runtime.js +69679 -0
  62. package/dist/sb-manager/globals.js +34 -0
  63. package/dist/sb-manager/runtime.js +13195 -0
  64. package/package.json +6 -6
  65. package/dist/src/index.d.ts +0 -36
  66. package/dist/src/index.js +0 -42
  67. package/dist/src/tuix-button/TuixBaseButton.d.ts +0 -17
  68. package/dist/src/tuix-button/TuixBaseButton.js +0 -60
  69. package/dist/src/tuix-button/TuixButton.d.ts +0 -11
  70. package/dist/src/tuix-button/TuixButton.js +0 -84
  71. package/dist/src/tuix-button/TuixButton.styles.d.ts +0 -3
  72. package/dist/src/tuix-button/TuixButton.styles.js +0 -107
  73. package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +0 -2
  74. package/dist/src/tuix-button/enums/tuix-button.enums.js +0 -6
  75. package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +0 -1
  76. package/dist/src/tuix-button/interfaces/tuix-button.interface.js +0 -1
  77. package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +0 -15
  78. package/dist/src/tuix-checkbox/TuixCheckbox.js +0 -106
  79. package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +0 -4
  80. package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +0 -132
  81. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +0 -21
  82. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +0 -23
  83. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +0 -5
  84. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +0 -1
  85. package/dist/src/tuix-dropdown/TuixDropdown.d.ts +0 -55
  86. package/dist/src/tuix-dropdown/TuixDropdown.js +0 -360
  87. package/dist/src/tuix-dropdown/TuixDropdown.styles.d.ts +0 -3
  88. package/dist/src/tuix-dropdown/TuixDropdown.styles.js +0 -125
  89. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +0 -4
  90. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +0 -5
  91. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +0 -15
  92. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +0 -1
  93. package/dist/src/tuix-icon/TuixIcon.d.ts +0 -15
  94. package/dist/src/tuix-icon/TuixIcon.icons.d.ts +0 -6
  95. package/dist/src/tuix-icon/TuixIcon.js +0 -79
  96. package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +0 -62
  97. package/dist/src/tuix-icon/enums/tuix-icon.enums.js +0 -69
  98. package/dist/src/tuix-icon-button/TuixIconButton.d.ts +0 -9
  99. package/dist/src/tuix-icon-button/TuixIconButton.js +0 -51
  100. package/dist/src/tuix-input/TuixInput.d.ts +0 -52
  101. package/dist/src/tuix-input/TuixInput.js +0 -370
  102. package/dist/src/tuix-input/TuixInput.styles.d.ts +0 -8
  103. package/dist/src/tuix-input/TuixInput.styles.js +0 -295
  104. package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +0 -38
  105. package/dist/src/tuix-input/enums/tuix-input.enums.js +0 -41
  106. package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +0 -18
  107. package/dist/src/tuix-input/interfaces/tuix-input.interface.js +0 -5
  108. package/dist/src/tuix-link/TuixLink.d.ts +0 -15
  109. package/dist/src/tuix-link/TuixLink.js +0 -71
  110. package/dist/src/tuix-link/TuixLink.styles.d.ts +0 -2
  111. package/dist/src/tuix-link/TuixLink.styles.js +0 -55
  112. package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +0 -6
  113. package/dist/src/tuix-link/enums/linkTarget.enum.js +0 -7
  114. package/dist/src/tuix-modal/TuixModal.d.ts +0 -9
  115. package/dist/src/tuix-modal/TuixModal.js +0 -63
  116. package/dist/src/tuix-modal/TuixModal.styles.d.ts +0 -2
  117. package/dist/src/tuix-modal/TuixModal.styles.js +0 -55
  118. package/dist/src/tuix-paper/TuixPaper.d.ts +0 -10
  119. package/dist/src/tuix-paper/TuixPaper.js +0 -46
  120. package/dist/src/tuix-paper/TuixPaper.styles.d.ts +0 -1
  121. package/dist/src/tuix-paper/TuixPaper.styles.js +0 -30
  122. package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +0 -13
  123. package/dist/src/tuix-paper/enums/tuix-paper.enum.js +0 -15
  124. package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +0 -16
  125. package/dist/src/tuix-radio-button/TuixRadioButton.js +0 -95
  126. package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +0 -5
  127. package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +0 -135
  128. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +0 -3
  129. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +0 -1
  130. package/dist/src/tuix-table/TuixTable.d.ts +0 -46
  131. package/dist/src/tuix-table/TuixTable.js +0 -367
  132. package/dist/src/tuix-table/TuixTable.styles.d.ts +0 -2
  133. package/dist/src/tuix-table/TuixTable.styles.js +0 -197
  134. package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +0 -45
  135. package/dist/src/tuix-table/interfaces/tuix-table.interface.js +0 -1
  136. package/dist/src/tuix-text/TuixText.d.ts +0 -12
  137. package/dist/src/tuix-text/TuixText.js +0 -66
  138. package/dist/src/tuix-text/TuixText.styles.d.ts +0 -2
  139. package/dist/src/tuix-text/TuixText.styles.js +0 -158
  140. package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +0 -31
  141. package/dist/src/tuix-text/enums/tuix-text.enums.js +0 -63
  142. package/dist/src/tuix-toast/TuixToast.d.ts +0 -15
  143. package/dist/src/tuix-toast/TuixToast.js +0 -100
  144. package/dist/src/tuix-toast/TuixToast.styles.d.ts +0 -3
  145. package/dist/src/tuix-toast/TuixToast.styles.js +0 -43
  146. package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +0 -20
  147. package/dist/src/tuix-toast/enums/tuix-toast.enums.js +0 -59
  148. package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +0 -13
  149. package/dist/src/tuix-toggle-button/TuixToggleButton.js +0 -85
  150. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +0 -5
  151. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +0 -134
  152. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +0 -2
  153. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +0 -1
  154. package/dist/src/utils/colors.d.ts +0 -29
  155. package/dist/src/utils/colors.js +0 -30
  156. package/dist/src/utils/darkColors.d.ts +0 -31
  157. package/dist/src/utils/darkColors.js +0 -32
  158. package/dist/src/utils/hex-rgb.d.ts +0 -5
  159. package/dist/src/utils/hex-rgb.js +0 -15
  160. package/dist/src/utils/interfaces/detail-value.interface.d.ts +0 -3
  161. package/dist/src/utils/interfaces/detail-value.interface.js +0 -1
  162. package/dist/src/utils/mainVariant.enum.d.ts +0 -4
  163. package/dist/src/utils/mainVariant.enum.js +0 -5
  164. package/dist/src/utils/screenSizes.enum.d.ts +0 -4
  165. package/dist/src/utils/screenSizes.enum.js +0 -5
  166. package/dist/src/utils/slottedClassName.d.ts +0 -2
  167. package/dist/src/utils/slottedClassName.js +0 -1
  168. package/dist/tsconfig.publish.tsbuildinfo +0 -1
@@ -1,370 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, html, nothing, } from 'lit';
3
- import { customElement, property, query, state } from 'lit/decorators.js';
4
- import { classMap } from 'lit/directives/class-map.js';
5
- import '../tuix-icon/TuixIcon.js';
6
- import { IconName, IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums';
7
- import { Palette } from '../utils/colors.js';
8
- import { DarkPalette } from '../utils/darkColors.js';
9
- import { hostStyles, inputColorStyles, inputComponentStyles, inputDescriptionStyles, inputFontStyles, inputIconStyles, inputSearchStyles, inputTitleStyles, } from './TuixInput.styles.js';
10
- import { DescriptionType, IconByDescriptionType, IconDescriptionColorDark, IconDescriptionColorLight, InputIconLocation, InputType, } from './enums/tuix-input.enums.js';
11
- import { InputState, } from './interfaces/tuix-input.interface.js';
12
- import { v4 as uuidv4 } from 'uuid';
13
- let TuixInput = class TuixInput extends LitElement {
14
- constructor() {
15
- super(...arguments);
16
- this._inputId = this._setIdInput();
17
- this.disabled = false;
18
- this.value = '';
19
- this.placeholder = '';
20
- this.title = '';
21
- this.type = InputType.TEXT;
22
- this.descriptionType = DescriptionType.TEXT;
23
- this.dark = false;
24
- this.readonly = false;
25
- this.autofocus = false;
26
- this._type = this.type;
27
- this._letterCounter = this.value?.length || 0;
28
- this._previousType = this.type;
29
- this._previousValue = '';
30
- this._generalIconColorsLight = {
31
- [InputState.INACTIVE]: Palette.BLACK,
32
- [InputState.ACTIVE]: Palette.MAIN,
33
- [InputState.DISABLED]: Palette.PRIMARY_300,
34
- };
35
- this._generalIconColorsDark = {
36
- [InputState.INACTIVE]: DarkPalette.PRIMARY_100,
37
- [InputState.ACTIVE]: DarkPalette.MAIN,
38
- [InputState.DISABLED]: DarkPalette.PRIMARY_800,
39
- };
40
- }
41
- static { this.styles = [
42
- hostStyles,
43
- inputComponentStyles,
44
- inputFontStyles,
45
- inputColorStyles,
46
- inputTitleStyles,
47
- inputIconStyles,
48
- inputSearchStyles,
49
- inputDescriptionStyles,
50
- ]; }
51
- _handleInputBase(e, eventName) {
52
- this.dispatchEvent(new CustomEvent(eventName, {
53
- detail: {
54
- value: (e.target instanceof HTMLInputElement ||
55
- e.target instanceof HTMLTextAreaElement) &&
56
- e.target.value,
57
- },
58
- bubbles: true,
59
- }));
60
- }
61
- _handleClickOnInput() {
62
- if (this.disabled)
63
- return;
64
- this.dispatchEvent(new CustomEvent('on-click', {
65
- bubbles: true,
66
- }));
67
- }
68
- _handleInput(e) {
69
- this._handleInputBase(e, 'on-change');
70
- this._updateLetterCounter();
71
- }
72
- _handleBlur(e) {
73
- this._handleInputBase(e, 'on-blur');
74
- }
75
- _handlePasswordIconClick() {
76
- if (this._type === InputType.PASSWORD) {
77
- this._type = InputType.TEXT;
78
- this._inputElement.setAttribute('type', InputType.TEXT);
79
- }
80
- else {
81
- this._type = InputType.PASSWORD;
82
- this._inputElement.setAttribute('type', InputType.PASSWORD);
83
- }
84
- }
85
- _formatIconSet({ iconName, colorByState, location = InputIconLocation.RIGHT, clickHandler = undefined, }) {
86
- const iconSetContainerClasses = {
87
- 't-icon-set-container': true,
88
- 't-icon-click': !!clickHandler,
89
- [`t-icon-${location}`]: true,
90
- };
91
- return html `<div
92
- class="${classMap(iconSetContainerClasses)}"
93
- @click="${clickHandler}"
94
- >
95
- ${Object.entries(colorByState).map(([state, color]) => html `<tuix-icon
96
- size="${IconSizeVariant.FULL}"
97
- name="${iconName}"
98
- color="${color}"
99
- class="t-icon-${state}"
100
- ></tuix-icon>`)}
101
- </div>`;
102
- }
103
- _updateLetterCounter() {
104
- if (this.maxlength != undefined && this.type === InputType.TEXT_AREA) {
105
- this._letterCounter = Number(this._inputElement.value?.length);
106
- }
107
- }
108
- _getInputTextFeatureTemplate() {
109
- return html `${this.iconRight
110
- ? this._formatIconSet({
111
- iconName: this.iconRight,
112
- colorByState: this.dark
113
- ? this._generalIconColorsDark
114
- : this._generalIconColorsLight,
115
- })
116
- : nothing}`;
117
- }
118
- _getInputSearchFeatureTemplate() {
119
- const searchIconColorsLight = {
120
- [InputState.INACTIVE]: Palette.BLACK,
121
- [InputState.ACTIVE]: Palette.BLACK,
122
- [InputState.DISABLED]: Palette.PRIMARY_300,
123
- };
124
- const searchIconColorsDark = {
125
- [InputState.INACTIVE]: DarkPalette.PRIMARY_100,
126
- [InputState.ACTIVE]: DarkPalette.PRIMARY_100,
127
- [InputState.DISABLED]: DarkPalette.PRIMARY_800,
128
- };
129
- return html `${this._formatIconSet({
130
- iconName: IconName.SEARCH,
131
- colorByState: this.dark ? searchIconColorsDark : searchIconColorsLight,
132
- location: InputIconLocation.LEFT,
133
- })}`;
134
- }
135
- _getInputPasswordFeatureTemplate() {
136
- return html `${this._formatIconSet({
137
- iconName: this._type === InputType.PASSWORD
138
- ? IconName.EYE_CLOSE_LINE
139
- : IconName.EYE_ON,
140
- colorByState: this.dark
141
- ? this._generalIconColorsDark
142
- : this._generalIconColorsLight,
143
- clickHandler: this._handlePasswordIconClick,
144
- })} `;
145
- }
146
- _getFeatureTemplateByInputType() {
147
- switch (this.type) {
148
- case InputType.SEARCH:
149
- return this._getInputSearchFeatureTemplate();
150
- case InputType.TEXT:
151
- return this._getInputTextFeatureTemplate();
152
- case InputType.PASSWORD:
153
- return this._getInputPasswordFeatureTemplate();
154
- default:
155
- return html `${nothing}`;
156
- }
157
- }
158
- _getInputElementClasses() {
159
- const hasIconRight = this.type === InputType.PASSWORD || this.type === InputType.TEXT
160
- ? !!this.iconRight
161
- : false;
162
- return {
163
- 't-input': true,
164
- 't-textarea': this.type === InputType.TEXT_AREA,
165
- 'with-title': !!this.title,
166
- 'with-icon-right': hasIconRight,
167
- [`with-${this.descriptionType}`]: this.descriptionType !== DescriptionType.TEXT,
168
- };
169
- }
170
- _getInputContainerClasses() {
171
- return {
172
- 't-input-container': true,
173
- 't-textarea-container': this.type === InputType.TEXT_AREA,
174
- };
175
- }
176
- _getMainContainerClasses() {
177
- return {
178
- 't-textarea-main-container': this.type === InputType.TEXT_AREA,
179
- };
180
- }
181
- _setIdInput() {
182
- return uuidv4();
183
- }
184
- _getInputTemplate() {
185
- return html `<input
186
- id=${this._inputId}
187
- type="text"
188
- class="${classMap(this._getInputElementClasses())}"
189
- ?disabled="${this.disabled}"
190
- ?readonly="${this.readonly}"
191
- .value="${this.value}"
192
- .type="${this.type}"
193
- placeholder="${this.placeholder || ' '}"
194
- maxlength="${this.maxlength}"
195
- @input="${this._handleInput}"
196
- @blur="${this._handleBlur}"
197
- >
198
- </input>
199
- ${this.title
200
- ? html `<label for=${this._inputId} class="t-title"
201
- >${this.title}</label
202
- >`
203
- : nothing}
204
- ${this._getFeatureTemplateByInputType()}
205
- `;
206
- }
207
- _getLetterCounterTemplate() {
208
- if (!this._hasLetterCounter()) {
209
- return html `${nothing}`;
210
- }
211
- return html `<div class="t-letter-counter">
212
- ${this.maxlength
213
- ? html `${this._letterCounter}/${this.maxlength}`
214
- : nothing}
215
- </div> `;
216
- }
217
- _hasLetterCounter() {
218
- return (this.type === InputType.TEXT_AREA &&
219
- typeof this.maxlength === 'number' &&
220
- this.maxlength >= 0);
221
- }
222
- _getTextAreaTemplate() {
223
- return html `<textarea
224
- id="${this._inputId}"
225
- class="${classMap(this._getInputElementClasses())}"
226
- ?disabled="${this.disabled}"
227
- ?readonly="${this.readonly}"
228
- .value="${this.value}"
229
- placeholder="${this.placeholder}"
230
- maxlength="${this.maxlength}"
231
- @input="${this._handleInput}"
232
- @blur="${this._handleBlur}"
233
- ></textarea>
234
- ${this.title
235
- ? html `<label for=${this._inputId} class="t-title"
236
- >${this.title}</label
237
- >`
238
- : nothing} `;
239
- }
240
- _getIconDescriptionTemplate() {
241
- if (!this.descriptionType ||
242
- this.descriptionType === DescriptionType.TEXT) {
243
- return html `${nothing}`;
244
- }
245
- return html `<tuix-icon
246
- size="${IconSizeVariant.SMALL}"
247
- name="${IconByDescriptionType[this.descriptionType]}"
248
- color="${this.dark
249
- ? IconDescriptionColorDark[this.descriptionType]
250
- : IconDescriptionColorLight[this.descriptionType]}"
251
- >
252
- </tuix-icon>`;
253
- }
254
- _getDescriptionTemplate() {
255
- const isValidDescriptionType = this._hasValidDescriptionType();
256
- if (!isValidDescriptionType) {
257
- return html `<div></div>`;
258
- }
259
- const defaultDescription = {
260
- [DescriptionType.WARNING]: 'Warning',
261
- [DescriptionType.ERROR]: 'Error',
262
- [DescriptionType.SUCCESS]: 'Success',
263
- [DescriptionType.LOADING]: 'Loading',
264
- [DescriptionType.TEXT]: '',
265
- };
266
- return html `<div class="t-input-description">
267
- ${this._getIconDescriptionTemplate()}
268
- <span
269
- >${this.description ?? defaultDescription[this.descriptionType]}</span
270
- >
271
- </div>`;
272
- }
273
- _hasValidDescriptionType() {
274
- return Object.values(DescriptionType).includes(this.descriptionType);
275
- }
276
- _getDescriptionContainerTemplate() {
277
- const hasLetterCounter = this._hasLetterCounter();
278
- const hasDescription = this._hasValidDescriptionType() &&
279
- (this.descriptionType === DescriptionType.TEXT
280
- ? !!this.description
281
- : true);
282
- if (!hasLetterCounter && !hasDescription) {
283
- return html `${nothing}`;
284
- }
285
- return html `<div class="t-input-description-container">
286
- ${this._getDescriptionTemplate()} ${this._getLetterCounterTemplate()}
287
- </div>`;
288
- }
289
- render() {
290
- if (this._previousType !== this.type) {
291
- this._previousType = this.type;
292
- this._type = this.type;
293
- }
294
- if (this._previousValue !== this.value) {
295
- this._previousValue = this.value;
296
- this._letterCounter = this.value.length;
297
- }
298
- return html `<div class="${classMap(this._getMainContainerClasses())}">
299
- <div
300
- class="${classMap(this._getInputContainerClasses())}"
301
- @click="${this._handleClickOnInput}"
302
- >
303
- ${this.type === InputType.TEXT_AREA
304
- ? this._getTextAreaTemplate()
305
- : this._getInputTemplate()}
306
- </div>
307
- ${this._getDescriptionContainerTemplate()}
308
- </div>`;
309
- }
310
- updated(changedProperties) {
311
- for (const [propName] of changedProperties) {
312
- if (this.disabled || this.readonly)
313
- break;
314
- if (String(propName) !== 'autofocus')
315
- continue;
316
- if (this.autofocus) {
317
- this._inputElement.focus();
318
- }
319
- }
320
- }
321
- };
322
- __decorate([
323
- property({ type: Boolean, reflect: true })
324
- ], TuixInput.prototype, "disabled", void 0);
325
- __decorate([
326
- property({ type: IconName })
327
- ], TuixInput.prototype, "iconRight", void 0);
328
- __decorate([
329
- property({ type: String })
330
- ], TuixInput.prototype, "value", void 0);
331
- __decorate([
332
- property({ type: String })
333
- ], TuixInput.prototype, "placeholder", void 0);
334
- __decorate([
335
- property({ type: String })
336
- ], TuixInput.prototype, "title", void 0);
337
- __decorate([
338
- property({ type: InputType })
339
- ], TuixInput.prototype, "type", void 0);
340
- __decorate([
341
- property({ type: Number })
342
- ], TuixInput.prototype, "maxlength", void 0);
343
- __decorate([
344
- property({ type: String })
345
- ], TuixInput.prototype, "description", void 0);
346
- __decorate([
347
- property({ type: DescriptionType })
348
- ], TuixInput.prototype, "descriptionType", void 0);
349
- __decorate([
350
- property({ type: Boolean, reflect: true })
351
- ], TuixInput.prototype, "dark", void 0);
352
- __decorate([
353
- property({ type: Boolean })
354
- ], TuixInput.prototype, "readonly", void 0);
355
- __decorate([
356
- property({ type: Boolean, reflect: true })
357
- ], TuixInput.prototype, "autofocus", void 0);
358
- __decorate([
359
- query('.t-input-container .t-input')
360
- ], TuixInput.prototype, "_inputElement", void 0);
361
- __decorate([
362
- state()
363
- ], TuixInput.prototype, "_type", void 0);
364
- __decorate([
365
- state()
366
- ], TuixInput.prototype, "_letterCounter", void 0);
367
- TuixInput = __decorate([
368
- customElement('tuix-input')
369
- ], TuixInput);
370
- export { TuixInput };
@@ -1,8 +0,0 @@
1
- export declare const hostStyles: import("lit").CSSResult;
2
- export declare const inputComponentStyles: import("lit").CSSResult;
3
- export declare const inputFontStyles: import("lit").CSSResult;
4
- export declare const inputColorStyles: import("lit").CSSResult;
5
- export declare const inputTitleStyles: import("lit").CSSResult;
6
- export declare const inputIconStyles: import("lit").CSSResult;
7
- export declare const inputSearchStyles: import("lit").CSSResult;
8
- export declare const inputDescriptionStyles: import("lit").CSSResult;
@@ -1,295 +0,0 @@
1
- import { css, unsafeCSS } from 'lit';
2
- import { ScreenSizes } from '../utils/screenSizes.enum';
3
- import { Palette } from '../utils/colors';
4
- import { DarkPalette } from '../utils/darkColors';
5
- import { hexToRgb } from '../utils/hex-rgb';
6
- const inputVars = {
7
- gapX: '10px',
8
- iconDesktopSize: '1.5rem',
9
- iconMobileSize: '1rem',
10
- paddingX: '1.25rem',
11
- };
12
- const rgbDarkValidation = hexToRgb(DarkPalette.VALIDATION);
13
- const rgbDarkError = hexToRgb(DarkPalette.ERROR);
14
- export const hostStyles = css `
15
- :host {
16
- --t-field-color-form: ${unsafeCSS(Palette.PRIMARY_50)};
17
- --t-field-color-title: ${unsafeCSS(Palette.PRIMARY_600)};
18
- --t-field-color-text: ${unsafeCSS(Palette.BLACK)};
19
- --t-field-color-description: ${unsafeCSS(Palette.NEUTRAL_600)};
20
- --t-field-color-stroke-hover: ${unsafeCSS(Palette.PRIMARY_300)};
21
- --t-field-color-stroke-focus: ${unsafeCSS(Palette.MAIN)};
22
- --t-field-color-text-disabled: ${unsafeCSS(Palette.PRIMARY_300)};
23
- --t-field-color-stroke-validation: ${unsafeCSS(Palette.VALIDATION_200)};
24
- --t-field-color-bg-validation: ${unsafeCSS(Palette.VALIDATION_50)};
25
- --t-field-color-stroke-loading: ${unsafeCSS(Palette.PRIMARY_300)};
26
- --t-field-color-bg-error: ${unsafeCSS(Palette.ERROR_50)};
27
- --t-field-color-stroke-error: ${unsafeCSS(Palette.ERROR_200)};
28
- --t-field-input-cursor: auto;
29
- --t-field-font-size: 1rem;
30
- --t-field-font-weight: 300;
31
- --t-field-line-height: 1.25rem;
32
- --t-field-padding-x: 1.25rem;
33
- --t-field-padding-y: 1.125rem;
34
- --t-field-padding-top: 1.625rem;
35
- --t-field-padding-bottom: 0.625rem;
36
- --t-field-title-left-position: 1.25rem;
37
- }
38
- :host([dark]) {
39
- --t-field-color-form: ${unsafeCSS(DarkPalette.PRIMARY_950)};
40
- --t-field-color-text: ${unsafeCSS(DarkPalette.PRIMARY_100)};
41
- --t-field-color-description: ${unsafeCSS(DarkPalette.NEUTRAL_200)};
42
- --t-field-color-stroke-focus: ${unsafeCSS(DarkPalette.SECONDARY)};
43
- --t-field-color-text-disabled: ${unsafeCSS(DarkPalette.PRIMARY_800)};
44
- --t-field-color-stroke-validation: ${unsafeCSS(DarkPalette.VALIDATION_200)};
45
- --t-field-color-bg-validation: rgba(
46
- ${rgbDarkValidation.r},
47
- ${rgbDarkValidation.g},
48
- ${rgbDarkValidation.b},
49
- 0.2
50
- );
51
- --t-field-color-bg-error: rgba(
52
- ${rgbDarkError.r},
53
- ${rgbDarkError.g},
54
- ${rgbDarkError.b},
55
- 0.2
56
- );
57
- --t-field-color-stroke-error: ${unsafeCSS(DarkPalette.ERROR_200)};
58
- }
59
- `;
60
- export const inputComponentStyles = css `
61
- .t-textarea-main-container {
62
- display: flex;
63
- flex-direction: column;
64
- width: 100%;
65
- height: 100%;
66
- }
67
- .t-input-container {
68
- position: relative;
69
- --t-padding-x-desktop-with-icon: calc(
70
- var(--t-field-padding-x) + ${unsafeCSS(inputVars.iconDesktopSize)} +
71
- ${unsafeCSS(inputVars.gapX)}
72
- );
73
- --t-padding-x-mobile-with-icon: calc(
74
- var(--t-field-padding-x) + ${unsafeCSS(inputVars.iconMobileSize)} +
75
- ${unsafeCSS(inputVars.gapX)}
76
- );
77
- --t-border-size: 1px;
78
- }
79
- .t-input-container.t-textarea-container {
80
- height: 100%;
81
- }
82
- .t-input {
83
- padding: calc(var(--t-field-padding-y) - var(--t-border-size))
84
- var(--t-field-padding-x);
85
- border-radius: 4px;
86
- font-family: 'Rubik', sans-serif;
87
- cursor: var(--t-field-input-cursor);
88
- width: 100%;
89
- box-sizing: border-box;
90
- }
91
- .t-input.t-textarea {
92
- height: 100%;
93
- display: block;
94
- }
95
- .t-input.with-title {
96
- padding-top: calc(var(--t-field-padding-top) - var(--t-border-size));
97
- padding-bottom: calc(var(--t-field-padding-bottom) - var(--t-border-size));
98
- }
99
- .t-input.with-icon-right {
100
- padding-right: var(--t-padding-x-desktop-with-icon);
101
- }
102
- @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
103
- .t-input.with-icon-right {
104
- padding-right: var(--t-padding-x-mobile-with-icon);
105
- }
106
- }
107
- `;
108
- export const inputFontStyles = css `
109
- .t-input::placeholder,
110
- .t-input,
111
- .t-title {
112
- font-size: var(--t-field-font-size);
113
- font-weight: var(--t-field-font-weight);
114
- line-height: var(--t-field-line-height);
115
- }
116
- @media only screen and (max-width: ${ScreenSizes.TABLET}px) {
117
- :host {
118
- --t-field-font-size: 0.813rem;
119
- --t-field-line-height: 1.125rem;
120
- --t-field-padding-y: 1.063rem;
121
- --t-field-padding-top: 1.5rem;
122
- }
123
- }
124
- @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
125
- :host {
126
- --t-field-font-size: 0.813rem;
127
- --t-field-line-height: 1rem;
128
- --t-field-padding-y: 1rem;
129
- --t-field-padding-top: 1.375rem;
130
- }
131
- }
132
- `;
133
- export const inputColorStyles = css `
134
- .t-input {
135
- background-color: var(--t-field-color-form);
136
- border: 1px solid var(--t-field-color-form);
137
- color: var(--t-field-color-text);
138
- }
139
- .t-input-container:hover .t-input,
140
- .t-input:hover {
141
- border: 1px solid var(--t-field-color-stroke-hover);
142
- }
143
- .t-input:focus {
144
- border: 1px solid var(--t-field-color-stroke-focus);
145
- outline: 1px solid var(--t-field-color-stroke-focus);
146
- }
147
- .t-input[disabled]:disabled {
148
- cursor: not-allowed;
149
- border: 1px solid var(--t-field-color-form);
150
- color: var(--t-field-color-text-disabled);
151
- }
152
- .t-input.with-title::placeholder {
153
- color: transparent;
154
- }
155
- .t-input::placeholder,
156
- .t-input.with-title:focus::placeholder {
157
- color: var(--t-field-color-title);
158
- }
159
- .t-input.with-warning {
160
- border: 1px solid var(--t-field-color-stroke-validation);
161
- background-color: var(--t-field-color-bg-validation);
162
- }
163
- .t-input.with-error {
164
- border: 1px solid var(--t-field-color-stroke-error);
165
- background-color: var(--t-field-color-bg-error);
166
- }
167
- .t-input.with-loading {
168
- border: 1px solid var(--t-field-color-stroke-loading);
169
- }
170
- `;
171
- export const inputTitleStyles = css `
172
- .t-title {
173
- position: absolute;
174
- top: 50%;
175
- left: var(--t-field-title-left-position);
176
- font-family: 'Rubik', sans-serif;
177
- color: var(--t-field-color-title);
178
- transform: translateY(-50%);
179
- transition-duration: 0.3s;
180
- pointer-events: none;
181
- -webkit-user-select: none;
182
- -moz-user-select: none;
183
- -ms-user-select: none;
184
- user-select: none;
185
- }
186
- .t-textarea-container .t-title {
187
- top: 1rem;
188
- transform: none;
189
- }
190
- .t-input.with-title:focus + .t-title,
191
- .t-input.with-title:not(:placeholder-shown) + .t-title {
192
- font-size: 0.75rem;
193
- font-weight: 300;
194
- line-height: 0.875rem;
195
- transform: translateY(0);
196
- top: 0.5rem;
197
- }
198
- `;
199
- export const inputIconStyles = css `
200
- .t-input-container .t-icon-set-container {
201
- height: ${unsafeCSS(inputVars.iconDesktopSize)};
202
- width: ${unsafeCSS(inputVars.iconDesktopSize)};
203
- cursor: var(--t-field-input-cursor);
204
- }
205
- .t-icon-set-container.t-icon-click {
206
- cursor: pointer;
207
- }
208
- .t-input-container .t-icon-set-container.t-icon-right {
209
- position: absolute;
210
- top: 50%;
211
- right: var(--t-field-padding-x);
212
- transform: translateY(-50%);
213
- }
214
- .t-input-container .t-icon-set-container.t-icon-left {
215
- position: absolute;
216
- top: 50%;
217
- left: var(--t-field-padding-x);
218
- transform: translateY(-50%);
219
- }
220
- .t-icon-inactive {
221
- display: inline;
222
- }
223
- .t-icon-active {
224
- display: none;
225
- }
226
- .t-icon-disabled {
227
- display: none;
228
- }
229
- .t-input-container:hover .t-icon-set-container .t-icon-inactive,
230
- .t-input:hover ~ .t-icon-set-container .t-icon-inactive,
231
- .t-input:focus ~ .t-icon-set-container .t-icon-inactive {
232
- display: none;
233
- }
234
- .t-input-container:hover .t-icon-set-container .t-icon-active,
235
- .t-input:hover ~ .t-icon-set-container .t-icon-active,
236
- .t-input:focus ~ .t-icon-set-container .t-icon-active {
237
- display: inline;
238
- }
239
- .t-input[disabled] ~ .t-icon-set-container .t-icon-active {
240
- display: none;
241
- }
242
- .t-input[disabled] ~ .t-icon-set-container .t-icon-inactive {
243
- display: none;
244
- }
245
- .t-input[disabled] ~ .t-icon-set-container .t-icon-disabled {
246
- display: inline;
247
- cursor: not-allowed;
248
- }
249
- @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
250
- .t-input-container .t-icon-set-container {
251
- height: ${unsafeCSS(inputVars.iconMobileSize)};
252
- width: ${unsafeCSS(inputVars.iconMobileSize)};
253
- }
254
- }
255
- `;
256
- export const inputSearchStyles = css `
257
- .t-input[type='search'] {
258
- padding-left: var(--t-padding-x-desktop-with-icon);
259
- }
260
- .t-input[type='search'] + .t-title {
261
- left: var(--t-padding-x-desktop-with-icon);
262
- }
263
- @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
264
- .t-input[type='search'] {
265
- padding-left: var(--t-padding-x-mobile-with-icon);
266
- }
267
- .t-input[type='search'] + .t-title {
268
- left: var(--t-padding-x-mobile-with-icon);
269
- }
270
- }
271
- input[type='search']::-webkit-search-decoration,
272
- input[type='search']::-webkit-search-cancel-button,
273
- input[type='search']::-webkit-search-results-button,
274
- input[type='search']::-webkit-search-results-decoration {
275
- display: none;
276
- }
277
- `;
278
- export const inputDescriptionStyles = css `
279
- .t-input-description-container {
280
- margin-top: 0.5rem;
281
- font-family: 'Rubik', sans-serif;
282
- font-size: 0.75rem;
283
- line-height: 1rem;
284
- color: var(--t-field-color-description);
285
- display: flex;
286
- justify-content: space-between;
287
- }
288
- .t-input-description-container .t-letter-counter {
289
- align-self: flex-end;
290
- }
291
- .t-input-description-container .t-input-description {
292
- display: flex;
293
- gap: 0.5rem;
294
- }
295
- `;