tuix-webcomponents 0.0.21 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +110 -4
  2. package/dist/assets/tuix-styles.css +72 -0
  3. package/dist/src/index.d.ts +34 -1
  4. package/dist/src/index.js +26 -16
  5. package/dist/src/react/index.d.ts +42 -0
  6. package/dist/src/react/index.js +114 -0
  7. package/dist/src/tuix-button/TuixBaseButton.d.ts +17 -0
  8. package/dist/src/tuix-button/TuixBaseButton.js +60 -0
  9. package/dist/src/tuix-button/TuixButton.d.ts +11 -0
  10. package/dist/src/tuix-button/TuixButton.js +84 -0
  11. package/dist/src/tuix-button/TuixButton.styles.d.ts +3 -0
  12. package/dist/src/tuix-button/TuixButton.styles.js +107 -0
  13. package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +2 -0
  14. package/dist/src/tuix-button/enums/tuix-button.enums.js +6 -0
  15. package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +1 -0
  16. package/dist/src/tuix-button/interfaces/tuix-button.interface.js +1 -0
  17. package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +17 -0
  18. package/dist/src/tuix-checkbox/TuixCheckbox.js +108 -0
  19. package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +4 -0
  20. package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +132 -0
  21. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +21 -0
  22. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +23 -0
  23. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +5 -0
  24. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +1 -0
  25. package/dist/src/tuix-dropdown/TuixDropdown.d.ts +56 -0
  26. package/dist/src/tuix-dropdown/TuixDropdown.js +361 -0
  27. package/dist/src/tuix-dropdown/TuixDropdown.styles.d.ts +3 -0
  28. package/dist/src/tuix-dropdown/TuixDropdown.styles.js +125 -0
  29. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +4 -0
  30. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +5 -0
  31. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +15 -0
  32. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +1 -0
  33. package/dist/src/tuix-icon/TuixIcon.d.ts +15 -0
  34. package/dist/src/tuix-icon/TuixIcon.icons.d.ts +6 -0
  35. package/dist/src/tuix-icon/TuixIcon.icons.js +395 -0
  36. package/dist/src/tuix-icon/TuixIcon.js +79 -0
  37. package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +89 -0
  38. package/dist/src/tuix-icon/enums/tuix-icon.enums.js +96 -0
  39. package/dist/src/tuix-icon-button/TuixIconButton.d.ts +9 -0
  40. package/dist/src/tuix-icon-button/TuixIconButton.js +51 -0
  41. package/dist/src/tuix-input/TuixInput.d.ts +52 -0
  42. package/dist/src/tuix-input/TuixInput.js +374 -0
  43. package/dist/src/tuix-input/TuixInput.styles.d.ts +8 -0
  44. package/dist/src/tuix-input/TuixInput.styles.js +296 -0
  45. package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +38 -0
  46. package/dist/src/tuix-input/enums/tuix-input.enums.js +41 -0
  47. package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +18 -0
  48. package/dist/src/tuix-input/interfaces/tuix-input.interface.js +5 -0
  49. package/dist/src/tuix-link/TuixLink.d.ts +15 -0
  50. package/dist/src/tuix-link/TuixLink.js +71 -0
  51. package/dist/src/tuix-link/TuixLink.styles.d.ts +2 -0
  52. package/dist/src/tuix-link/TuixLink.styles.js +55 -0
  53. package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +6 -0
  54. package/dist/src/tuix-link/enums/linkTarget.enum.js +7 -0
  55. package/dist/src/tuix-modal/TuixModal.d.ts +11 -0
  56. package/dist/src/tuix-modal/TuixModal.js +65 -0
  57. package/dist/src/tuix-modal/TuixModal.styles.d.ts +2 -0
  58. package/dist/src/tuix-modal/TuixModal.styles.js +55 -0
  59. package/dist/src/tuix-paper/TuixPaper.d.ts +10 -0
  60. package/dist/src/tuix-paper/TuixPaper.js +46 -0
  61. package/dist/src/tuix-paper/TuixPaper.styles.d.ts +1 -0
  62. package/dist/src/tuix-paper/TuixPaper.styles.js +30 -0
  63. package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +13 -0
  64. package/dist/src/tuix-paper/enums/tuix-paper.enum.js +15 -0
  65. package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +17 -0
  66. package/dist/src/tuix-radio-button/TuixRadioButton.js +96 -0
  67. package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +5 -0
  68. package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +135 -0
  69. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +3 -0
  70. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +1 -0
  71. package/dist/src/tuix-table/TuixTable.d.ts +48 -0
  72. package/dist/src/tuix-table/TuixTable.js +369 -0
  73. package/dist/src/tuix-table/TuixTable.styles.d.ts +2 -0
  74. package/dist/src/tuix-table/TuixTable.styles.js +197 -0
  75. package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +45 -0
  76. package/dist/src/tuix-table/interfaces/tuix-table.interface.js +1 -0
  77. package/dist/src/tuix-text/TuixText.d.ts +7 -5
  78. package/dist/src/tuix-text/TuixText.js +45 -137
  79. package/dist/src/tuix-text/TuixText.styles.d.ts +2 -0
  80. package/dist/src/tuix-text/TuixText.styles.js +195 -0
  81. package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +36 -0
  82. package/dist/src/tuix-text/enums/tuix-text.enums.js +72 -0
  83. package/dist/src/tuix-toast/TuixToast.d.ts +18 -0
  84. package/dist/src/tuix-toast/TuixToast.js +103 -0
  85. package/dist/src/tuix-toast/TuixToast.styles.d.ts +3 -0
  86. package/dist/src/tuix-toast/TuixToast.styles.js +43 -0
  87. package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +20 -0
  88. package/dist/src/tuix-toast/enums/tuix-toast.enums.js +59 -0
  89. package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +14 -0
  90. package/dist/src/tuix-toggle-button/TuixToggleButton.js +86 -0
  91. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +5 -0
  92. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +134 -0
  93. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +2 -0
  94. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +1 -0
  95. package/dist/src/utils/colors.d.ts +30 -10
  96. package/dist/src/utils/colors.js +31 -11
  97. package/dist/src/utils/darkColors.d.ts +32 -0
  98. package/dist/src/utils/darkColors.js +33 -0
  99. package/dist/src/utils/hex-rgb.d.ts +5 -0
  100. package/dist/src/utils/hex-rgb.js +15 -0
  101. package/dist/src/utils/interfaces/detail-value.interface.d.ts +3 -0
  102. package/dist/src/utils/interfaces/detail-value.interface.js +1 -0
  103. package/dist/src/utils/mainVariant.enum.d.ts +4 -0
  104. package/dist/src/utils/mainVariant.enum.js +5 -0
  105. package/dist/src/utils/screenSizes.enum.d.ts +4 -0
  106. package/dist/src/utils/screenSizes.enum.js +5 -0
  107. package/dist/src/utils/slottedClassName.d.ts +2 -0
  108. package/dist/src/utils/slottedClassName.js +1 -0
  109. package/package.json +118 -66
  110. package/dist/src/enums/tuix-text.enums.d.ts +0 -24
  111. package/dist/src/enums/tuix-text.enums.js +0 -29
  112. package/dist/src/enums/tuix-text.enums.js.map +0 -1
  113. package/dist/src/index.js.map +0 -1
  114. package/dist/src/tuix-text/TuixText.js.map +0 -1
  115. package/dist/src/utils/colors.js.map +0 -1
  116. package/dist/tsconfig.publish.tsbuildinfo +0 -1
@@ -1,158 +1,66 @@
1
1
  import { __decorate } from "tslib";
2
- import { html, css, LitElement } from 'lit';
2
+ import { html, css, LitElement, unsafeCSS } from 'lit';
3
3
  import { styleMap } from 'lit/directives/style-map.js';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import { TextType, TextColor } from '../enums/tuix-text.enums.js';
6
- import { ColorText } from '../utils/colors.js';
5
+ import { TextSize, TextVariant, colorText, colorTextDark, } from './enums/tuix-text.enums.js';
6
+ import { linkFontStyles, textStyles } from './TuixText.styles.js';
7
+ import { buttonSizeStyles } from '../tuix-button/TuixButton.styles.js';
8
+ import slottedClassName from '../utils/slottedClassName.js';
9
+ import { classMap } from 'lit/directives/class-map.js';
10
+ import { LINK_TEXT_COLOR_VAR_NAME } from '../tuix-link/TuixLink.styles.js';
7
11
  let TuixText = class TuixText extends LitElement {
8
- getTextClass() {
9
- return `${this.type} ${this.size}`;
12
+ constructor() {
13
+ super(...arguments);
14
+ this.size = TextSize.Body1;
15
+ this.color = TextVariant.PRIMARY;
16
+ this.dark = false;
17
+ this._getStyleMap = () => {
18
+ return {
19
+ color: `var(${LINK_TEXT_COLOR_VAR_NAME}, ${this._getTextColor()})`,
20
+ };
21
+ };
22
+ this._getClassMap = () => {
23
+ return {
24
+ text: true,
25
+ [this.size]: true,
26
+ };
27
+ };
28
+ }
29
+ static { this.styles = [
30
+ css `
31
+ ${unsafeCSS(slottedClassName('text'))} {
32
+ font-family: 'Rubik', sans-serif;
33
+ display: inline;
34
+ margin: 0;
35
+ }
36
+ `,
37
+ textStyles,
38
+ linkFontStyles,
39
+ buttonSizeStyles,
40
+ ]; }
41
+ _getTextColor() {
42
+ const colorMap = this.dark ? colorTextDark : colorText;
43
+ return colorMap[this.color || TextVariant.PRIMARY];
10
44
  }
11
45
  render() {
12
46
  return html ` <div
13
- class="text ${this.getTextClass()}"
14
- style="${styleMap({
15
- color: ColorText[this.color || TextColor.Primary],
16
- })}"
47
+ class="${classMap(this._getClassMap())}"
48
+ style="${styleMap(this._getStyleMap())}"
17
49
  >
18
50
  <slot></slot>
19
51
  </div>`;
20
52
  }
21
53
  };
22
- TuixText.styles = [
23
- css `
24
- .text {
25
- font-family: 'Rubik', sans-serif;
26
- }
27
-
28
- .text.headline.xl {
29
- font-size: 4rem;
30
- font-weight: 600;
31
- line-height: 4.4rem;
32
- }
33
-
34
- .text.headline.l {
35
- font-size: 3.5rem;
36
- font-weight: 600;
37
- line-height: 4.2rem;
38
- }
39
-
40
- .text.headline.m {
41
- font-size: 2.25rem;
42
- font-weight: 500;
43
- line-height: 2.7rem;
44
- }
45
-
46
- .text.headline.s {
47
- font-size: 1.5rem;
48
- font-weight: 500;
49
- line-height: 1.8rem;
50
- }
51
-
52
- .text.headline.xs {
53
- font-size: 1.125rem;
54
- font-weight: 500;
55
- line-height: 1.35;
56
- }
57
-
58
- .text.body.m {
59
- font-size: 1rem;
60
- font-weight: 300;
61
- line-height: 1.4rem;
62
- }
63
-
64
- .text.body.s {
65
- font-size: 0.875rem;
66
- font-weight: 300;
67
- line-height: 1.225rem;
68
- }
69
-
70
- .text.button_link.xl {
71
- font-size: 1.25rem;
72
- font-weight: 400;
73
- line-height: 1.5rem;
74
- }
75
-
76
- .text.button_link.l {
77
- font-size: 1.25rem;
78
- font-weight: 400;
79
- line-height: 1.5rem;
80
- }
81
-
82
- @media only screen and (max-width: 40rem) {
83
- .text.button_link.m {
84
- font-size: 1rem;
85
- font-weight: 400;
86
- line-height: 1.25rem;
87
- }
88
-
89
- .text.body.m {
90
- line-height: 1.3rem;
91
- }
92
-
93
- .text.body.s {
94
- line-height: 1.1375rem;
95
- }
96
-
97
- .text.headline.xl {
98
- font-size: 3rem;
99
- line-height: 3.3rem;
100
- }
101
- .text.headline.l {
102
- font-size: 2rem;
103
- line-height: 2.4rem;
104
- }
105
- .text.headline.m {
106
- font-size: 1.5rem;
107
- line-height: 1.8rem;
108
- }
109
- .text.headline.s {
110
- font-size: 1.125rem;
111
- line-height: 1.35rem;
112
- }
113
- .text.headline.xs {
114
- font-size: 1rem;
115
- line-height: 1.2rem;
116
- }
117
- }
118
-
119
- @media only screen and (max-width: 20rem) {
120
- .text.button_link.s {
121
- font-size: 0.875rem;
122
- font-weight: 400;
123
- line-height: 1rem;
124
- }
125
- .text.button_link.xs {
126
- font-size: 0.875rem;
127
- font-weight: 400;
128
- line-height: 1rem;
129
- }
130
- .text.headline.xl {
131
- font-size: 1.5rem;
132
- line-height: 1.8rem;
133
- }
134
- .text.headline.l {
135
- font-size: 1.375rem;
136
- line-height: 1.65rem;
137
- }
138
- .text.headline.m {
139
- font-size: 1.25rem;
140
- line-height: 1.5rem;
141
- }
142
- }
143
- `,
144
- ];
145
54
  __decorate([
146
- property({ type: String })
55
+ property({ type: TextSize })
147
56
  ], TuixText.prototype, "size", void 0);
148
57
  __decorate([
149
- property({ type: TextColor })
58
+ property({ type: TextVariant })
150
59
  ], TuixText.prototype, "color", void 0);
151
60
  __decorate([
152
- property({ type: TextType })
153
- ], TuixText.prototype, "type", void 0);
61
+ property({ type: Boolean, reflect: true })
62
+ ], TuixText.prototype, "dark", void 0);
154
63
  TuixText = __decorate([
155
64
  customElement('tuix-text')
156
65
  ], TuixText);
157
66
  export { TuixText };
158
- //# sourceMappingURL=TuixText.js.map
@@ -0,0 +1,2 @@
1
+ export declare const linkFontStyles: import("lit").CSSResult;
2
+ export declare const textStyles: import("lit").CSSResult;
@@ -0,0 +1,195 @@
1
+ import { css, unsafeCSS } from 'lit';
2
+ import { ScreenSizes } from '../utils/screenSizes.enum.js';
3
+ import { TextSize } from './enums/tuix-text.enums.js';
4
+ import slottedClassName from '../utils/slottedClassName.js';
5
+ export const linkFontStyles = css `
6
+ ${unsafeCSS(`
7
+ ${slottedClassName(TextSize.Link)} {
8
+ font-family: 'Rubik', sans-serif;
9
+ font-size: 1rem;
10
+ font-weight: 400;
11
+ line-height: 1.25rem;
12
+ }
13
+ @media only screen and (max-width: ${ScreenSizes.TABLET}px) {
14
+ ${slottedClassName(TextSize.Link)} {
15
+ font-size: 0.938rem;
16
+ line-height: 1.125rem;
17
+ }
18
+ }
19
+ @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
20
+ ${slottedClassName(TextSize.Link)} {
21
+ font-size: 0.875rem;
22
+ line-height: 1rem;
23
+ }
24
+ }
25
+ `)}
26
+ `;
27
+ export const textStyles = css `
28
+ ${unsafeCSS(`
29
+ ${slottedClassName(TextSize.XXL)} {
30
+ font-size: 6rem;
31
+ font-weight: 600;
32
+ line-height: 6.25rem;
33
+ }
34
+ ${slottedClassName(TextSize.XL)} {
35
+ font-size: 3.375rem;
36
+ font-weight: 600;
37
+ line-height: 3.688rem;
38
+ }
39
+
40
+ ${slottedClassName(TextSize.L)} {
41
+ font-size: 2.813rem;
42
+ font-weight: 600;
43
+ line-height: 3.375rem;
44
+ }
45
+
46
+ ${slottedClassName(TextSize.M)} {
47
+ font-size: 2.313rem;
48
+ font-weight: 600;
49
+ line-height: 2.75rem;
50
+ }
51
+
52
+ ${slottedClassName(TextSize.S)} {
53
+ font-size: 1.938rem;
54
+ font-weight: 600;
55
+ line-height: 2.313rem;
56
+ }
57
+
58
+ ${slottedClassName(TextSize.XS)} {
59
+ font-size: 1.313rem;
60
+ font-weight: 600;
61
+ line-height: 1.563rem;
62
+ }
63
+
64
+ ${slottedClassName(TextSize.Body1)} {
65
+ font-size: 1.125rem;
66
+ font-weight: 300;
67
+ line-height: 1.688rem;
68
+ }
69
+
70
+ ${slottedClassName(TextSize.Body2)} {
71
+ font-size: 0.938rem;
72
+ font-weight: 300;
73
+ line-height: 1.313rem;
74
+ }
75
+
76
+ ${slottedClassName(TextSize.BulletList)} {
77
+ font-size: 1.125rem;
78
+ font-weight: 300;
79
+ line-height: 1.375rem;
80
+ }
81
+
82
+ ${slottedClassName(TextSize.FieldPlaceholder)} {
83
+ font-size: 1rem;
84
+ font-weight: 300;
85
+ line-height: 1.25rem;
86
+ }
87
+
88
+ ${slottedClassName(TextSize.FieldTitle)} {
89
+ font-size: 0.75rem;
90
+ font-weight: 300;
91
+ line-height: 0.875rem;
92
+ }
93
+
94
+ ${slottedClassName(TextSize.FieldDescription)} {
95
+ font-size: 0.75rem;
96
+ font-weight: 300;
97
+ line-height: 0.875rem;
98
+ }
99
+
100
+ @media only screen and (max-width: ${ScreenSizes.TABLET}px) {
101
+ ${slottedClassName(TextSize.XXL)} {
102
+ font-size: 3rem;
103
+ font-weight: 600;
104
+ line-height: 3.3125rem;
105
+ }
106
+ ${slottedClassName(TextSize.XL)} {
107
+ font-size: 3rem;
108
+ line-height: 3.313rem;
109
+ }
110
+ ${slottedClassName(TextSize.L)} {
111
+ font-size: 2.5rem;
112
+ line-height: 3rem;
113
+ }
114
+ ${slottedClassName(TextSize.M)} {
115
+ font-size: 2.063rem;
116
+ line-height: 2.5rem;
117
+ }
118
+ ${slottedClassName(TextSize.S)} {
119
+ font-size: 1.75rem;
120
+ line-height: 2.125rem;
121
+ }
122
+ ${slottedClassName(TextSize.XS)} {
123
+ font-size: 1.188rem;
124
+ line-height: 1.438rem;
125
+ }
126
+
127
+ ${slottedClassName(TextSize.Body1)} {
128
+ font-size: 1rem;
129
+ line-height: 1.5rem;
130
+ }
131
+
132
+ ${slottedClassName(TextSize.Body2)} {
133
+ font-size: 0.875rem;
134
+ line-height: 1.125rem;
135
+ }
136
+
137
+ ${slottedClassName(TextSize.BulletList)} {
138
+ font-size: 1rem;
139
+ line-height: 1.1875rem;
140
+ }
141
+
142
+ ${slottedClassName(TextSize.FieldPlaceholder)} {
143
+ font-size: 0.938rem;
144
+ line-height: 1.125rem;
145
+ }
146
+ }
147
+
148
+ @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
149
+ ${slottedClassName(TextSize.XXL)} {
150
+ font-size: 1.8125rem;
151
+ font-weight: 600;
152
+ line-height: 2rem;
153
+ }
154
+ ${slottedClassName(TextSize.XL)} {
155
+ font-size: 2.625rem;
156
+ line-height: 2.875rem;
157
+ }
158
+ ${slottedClassName(TextSize.L)} {
159
+ font-size: 2.188rem;
160
+ line-height: 2.4375rem;
161
+ }
162
+ ${slottedClassName(TextSize.M)} {
163
+ font-size: 1.813rem;
164
+ line-height: 2rem;
165
+ }
166
+ ${slottedClassName(TextSize.S)} {
167
+ font-size: 1.5rem;
168
+ line-height: 1.625rem;
169
+ }
170
+ ${slottedClassName(TextSize.XS)} {
171
+ font-size: 1.063rem;
172
+ line-height: 1.1875rem;
173
+ }
174
+ ${slottedClassName(TextSize.Body1)} {
175
+ font-size: 0.875rem;
176
+ font-weight: 300;
177
+ line-height: 1.313rem;
178
+ }
179
+ ${slottedClassName(TextSize.Body2)} {
180
+ font-size: 0.75rem;
181
+ line-height: 1rem;
182
+ }
183
+ ${slottedClassName(TextSize.BulletList)} {
184
+ font-size: 0.875rem;
185
+ font-weight: 300;
186
+ line-height: 1.0625rem;
187
+ }
188
+ ${slottedClassName(TextSize.FieldPlaceholder)} {
189
+ font-size: 0.875rem;
190
+ font-weight: 300;
191
+ line-height: 1rem;
192
+ }
193
+ }
194
+ `)}
195
+ `;
@@ -0,0 +1,36 @@
1
+ export declare enum TextSize {
2
+ XXL = "xxl",
3
+ XL = "xl",
4
+ L = "l",
5
+ M = "m",
6
+ S = "s",
7
+ XS = "xs",
8
+ Body1 = "body1",
9
+ Body2 = "body2",
10
+ BulletList = "bullet_list",
11
+ Link = "link",
12
+ Button = "button",
13
+ FieldPlaceholder = "field_placeholder",
14
+ FieldTitle = "field_title",
15
+ FieldDescription = "field_description"
16
+ }
17
+ export declare enum TextVariant {
18
+ PRIMARY = "primary",
19
+ SECONDARY = "secondary",
20
+ MAIN = "main",
21
+ DARK_MAIN = "dark_main",
22
+ GREY = "grey",
23
+ LIGHT_GREY = "light_grey",
24
+ DISABLED = "disabled",
25
+ VALIDATION = "validation",
26
+ ERROR = "error",
27
+ SUCCESS = "success",
28
+ LIGHT = "light",
29
+ DARK = "dark",
30
+ DARK_BLUE = "dark_blue",
31
+ TITLE_BLUE = "title_blue",
32
+ SECTION = "section",
33
+ STROKE = "stroke"
34
+ }
35
+ export declare const colorText: Record<TextVariant, string>;
36
+ export declare const colorTextDark: Record<TextVariant, string>;
@@ -0,0 +1,72 @@
1
+ import { Palette } from '../../utils/colors.js';
2
+ import { DarkPalette } from '../../utils/darkColors.js';
3
+ export var TextSize;
4
+ (function (TextSize) {
5
+ TextSize["XXL"] = "xxl";
6
+ TextSize["XL"] = "xl";
7
+ TextSize["L"] = "l";
8
+ TextSize["M"] = "m";
9
+ TextSize["S"] = "s";
10
+ TextSize["XS"] = "xs";
11
+ TextSize["Body1"] = "body1";
12
+ TextSize["Body2"] = "body2";
13
+ TextSize["BulletList"] = "bullet_list";
14
+ TextSize["Link"] = "link";
15
+ TextSize["Button"] = "button";
16
+ TextSize["FieldPlaceholder"] = "field_placeholder";
17
+ TextSize["FieldTitle"] = "field_title";
18
+ TextSize["FieldDescription"] = "field_description";
19
+ })(TextSize || (TextSize = {}));
20
+ export var TextVariant;
21
+ (function (TextVariant) {
22
+ TextVariant["PRIMARY"] = "primary";
23
+ TextVariant["SECONDARY"] = "secondary";
24
+ TextVariant["MAIN"] = "main";
25
+ TextVariant["DARK_MAIN"] = "dark_main";
26
+ TextVariant["GREY"] = "grey";
27
+ TextVariant["LIGHT_GREY"] = "light_grey";
28
+ TextVariant["DISABLED"] = "disabled";
29
+ TextVariant["VALIDATION"] = "validation";
30
+ TextVariant["ERROR"] = "error";
31
+ TextVariant["SUCCESS"] = "success";
32
+ TextVariant["LIGHT"] = "light";
33
+ TextVariant["DARK"] = "dark";
34
+ TextVariant["DARK_BLUE"] = "dark_blue";
35
+ TextVariant["TITLE_BLUE"] = "title_blue";
36
+ TextVariant["SECTION"] = "section";
37
+ TextVariant["STROKE"] = "stroke";
38
+ })(TextVariant || (TextVariant = {}));
39
+ export const colorText = {
40
+ [TextVariant.MAIN]: Palette.MAIN,
41
+ [TextVariant.DARK_MAIN]: Palette.DARK_MAIN,
42
+ [TextVariant.PRIMARY]: Palette.BLACK,
43
+ [TextVariant.SECONDARY]: Palette.WHITE,
44
+ [TextVariant.STROKE]: Palette.PRIMARY_400,
45
+ [TextVariant.GREY]: Palette.NEUTRAL_600,
46
+ [TextVariant.LIGHT_GREY]: Palette.NEUTRAL_200,
47
+ [TextVariant.DISABLED]: Palette.PRIMARY_100,
48
+ [TextVariant.SECTION]: Palette.PRIMARY_700,
49
+ [TextVariant.VALIDATION]: Palette.VALIDATION,
50
+ [TextVariant.ERROR]: Palette.ERROR,
51
+ [TextVariant.SUCCESS]: Palette.SUCCESS,
52
+ [TextVariant.LIGHT]: Palette.WHITE,
53
+ [TextVariant.DARK]: Palette.BLACK,
54
+ [TextVariant.DARK_BLUE]: Palette.DARK_MAIN,
55
+ [TextVariant.TITLE_BLUE]: Palette.DARK_MAIN,
56
+ };
57
+ export const colorTextDark = {
58
+ ...colorText,
59
+ [TextVariant.MAIN]: DarkPalette.MAIN,
60
+ [TextVariant.DARK_MAIN]: DarkPalette.NEUTRAL_600,
61
+ [TextVariant.PRIMARY]: DarkPalette.PRIMARY_50,
62
+ [TextVariant.SECONDARY]: Palette.BLACK,
63
+ [TextVariant.GREY]: DarkPalette.NEUTRAL_600,
64
+ [TextVariant.DISABLED]: Palette.PRIMARY_200,
65
+ [TextVariant.VALIDATION]: DarkPalette.VALIDATION,
66
+ [TextVariant.ERROR]: DarkPalette.ERROR,
67
+ [TextVariant.SUCCESS]: DarkPalette.SUCCESS,
68
+ [TextVariant.LIGHT]: DarkPalette.PRIMARY_50,
69
+ [TextVariant.DARK_BLUE]: DarkPalette.PRIMARY_800,
70
+ [TextVariant.TITLE_BLUE]: DarkPalette.PRIMARY_300,
71
+ [TextVariant.SECTION]: Palette.PRIMARY_300,
72
+ };
@@ -0,0 +1,18 @@
1
+ import { LitElement, type PropertyValueMap } from 'lit';
2
+ import '../tuix-icon/TuixIcon.js';
3
+ import '../tuix-paper/TuixPaper.js';
4
+ import '../tuix-text/TuixText.js';
5
+ import { ToastType, type ToastTypeExcludingNone } from './enums/tuix-toast.enums.js';
6
+ export declare class TuixToast extends LitElement {
7
+ static styles: import("lit").CSSResult[];
8
+ type: ToastType;
9
+ visibilityDuration: number;
10
+ dark: boolean;
11
+ lastType: ToastTypeExcludingNone;
12
+ updated(changedProperties: PropertyValueMap<unknown>): void;
13
+ private _handleOnClose;
14
+ private _saveType;
15
+ private _getStyleMap;
16
+ private _getIcon;
17
+ render(): import("lit-html").TemplateResult<1>;
18
+ }
@@ -0,0 +1,103 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { styleMap } from 'lit/directives/style-map.js';
5
+ import '../tuix-icon/TuixIcon.js';
6
+ import '../tuix-paper/TuixPaper.js';
7
+ import '../tuix-text/TuixText.js';
8
+ import { IconSizeVariant } from '../tuix-icon/enums/tuix-icon.enums.js';
9
+ import { BorderRadiusPaper, PaperElevation, } from '../tuix-paper/enums/tuix-paper.enum.js';
10
+ import { Palette } from '../utils/colors.js';
11
+ import { iconDarkPropertiesMap, iconPropertiesMap, toastBgColorMap, toastBgDarkColorMap, ToastType, } from './enums/tuix-toast.enums.js';
12
+ import { commonToastStyles, mobileToastStyles, tabletToastStyles, } from './TuixToast.styles.js';
13
+ let TuixToast = class TuixToast extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.type = ToastType.NONE;
17
+ this.visibilityDuration = 4000;
18
+ this.dark = false;
19
+ this.lastType = ToastType.SUCCESS;
20
+ this._saveType = () => {
21
+ if (this.type !== ToastType.NONE) {
22
+ this.lastType = this.type;
23
+ }
24
+ };
25
+ this._getStyleMap = () => {
26
+ this._saveType();
27
+ const bgColorMap = this.dark ? toastBgDarkColorMap : toastBgColorMap;
28
+ const backgroundColor = bgColorMap[this.lastType];
29
+ return { backgroundColor };
30
+ };
31
+ this._getIcon = () => {
32
+ this._saveType();
33
+ if (this.lastType === ToastType.TEXT)
34
+ return;
35
+ const { name: iconName, color: iconColor } = this.dark
36
+ ? iconDarkPropertiesMap[this.lastType]
37
+ : iconPropertiesMap[this.lastType];
38
+ return html `
39
+ <tuix-icon
40
+ size="${IconSizeVariant.MEDIUM}"
41
+ name="${iconName}"
42
+ color="${iconColor}"
43
+ ></tuix-icon>
44
+ `;
45
+ };
46
+ }
47
+ static { this.styles = [commonToastStyles, tabletToastStyles, mobileToastStyles]; }
48
+ updated(changedProperties) {
49
+ super.updated(changedProperties);
50
+ if (this.type === ToastType.NONE || this.visibilityDuration === 0)
51
+ return;
52
+ setTimeout(() => {
53
+ this.type = ToastType.NONE;
54
+ this._handleOnClose();
55
+ }, this.visibilityDuration);
56
+ }
57
+ _handleOnClose() {
58
+ if (this.visibilityDuration === 0)
59
+ return;
60
+ this.dispatchEvent(new CustomEvent('on-close', {
61
+ bubbles: true,
62
+ }));
63
+ }
64
+ render() {
65
+ return html `
66
+ <tuix-paper
67
+ elevation=${PaperElevation.VARIANT_4}
68
+ border-radius=${BorderRadiusPaper.SOFT}
69
+ ?dark=${this.dark}
70
+ >
71
+ <div
72
+ style="${styleMap({
73
+ backgroundColor: this.dark ? Palette.BLACK : Palette.WHITE,
74
+ borderRadius: BorderRadiusPaper.SOFT,
75
+ })}"
76
+ >
77
+ <div class="toast-container" style="${styleMap(this._getStyleMap())}">
78
+ ${this._getIcon()}
79
+ <tuix-text ?dark=${this.dark}>
80
+ <slot></slot>
81
+ </tuix-text>
82
+ </div>
83
+ </div>
84
+ </tuix-paper>
85
+ `;
86
+ }
87
+ };
88
+ __decorate([
89
+ property({ type: ToastType, reflect: true })
90
+ ], TuixToast.prototype, "type", void 0);
91
+ __decorate([
92
+ property({ type: Number, attribute: 'visibility-duration' })
93
+ ], TuixToast.prototype, "visibilityDuration", void 0);
94
+ __decorate([
95
+ property({ type: Boolean, reflect: true })
96
+ ], TuixToast.prototype, "dark", void 0);
97
+ __decorate([
98
+ state()
99
+ ], TuixToast.prototype, "lastType", void 0);
100
+ TuixToast = __decorate([
101
+ customElement('tuix-toast')
102
+ ], TuixToast);
103
+ export { TuixToast };
@@ -0,0 +1,3 @@
1
+ export declare const commonToastStyles: import("lit").CSSResult;
2
+ export declare const tabletToastStyles: import("lit").CSSResult;
3
+ export declare const mobileToastStyles: import("lit").CSSResult;
@@ -0,0 +1,43 @@
1
+ import { css } from 'lit';
2
+ import { ScreenSizes } from '../utils/screenSizes.enum.js';
3
+ export const commonToastStyles = css `
4
+ :host {
5
+ position: fixed;
6
+ bottom: -100%;
7
+ left: 50%;
8
+ transform: translateX(-50%);
9
+ transition: bottom 600ms linear;
10
+ width: 640px;
11
+ z-index: 99;
12
+ }
13
+
14
+ :host([type='text']),
15
+ :host([type='warning']),
16
+ :host([type='error']),
17
+ :host([type='success']) {
18
+ bottom: 1.5rem;
19
+ }
20
+
21
+ .toast-container {
22
+ padding: 12px 16px;
23
+ display: flex;
24
+ gap: 16px;
25
+ align-items: center;
26
+ border-radius: 4px;
27
+ }
28
+ `;
29
+ export const tabletToastStyles = css `
30
+ @media only screen and (max-width: ${ScreenSizes.TABLET}px) {
31
+ :host {
32
+ width: 520px;
33
+ }
34
+ }
35
+ `;
36
+ export const mobileToastStyles = css `
37
+ @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
38
+ :host {
39
+ max-width: 343px;
40
+ width: 90%;
41
+ }
42
+ }
43
+ `;
@@ -0,0 +1,20 @@
1
+ import { IconName } from '../../tuix-icon/enums/tuix-icon.enums.js';
2
+ import { Palette } from '../../utils/colors.js';
3
+ import { DarkPalette } from '../../utils/darkColors.js';
4
+ export declare enum ToastType {
5
+ NONE = "none",
6
+ TEXT = "text",
7
+ WARNING = "warning",
8
+ ERROR = "error",
9
+ SUCCESS = "success"
10
+ }
11
+ export type ToastTypeExcludingNone = Exclude<ToastType, ToastType.NONE>;
12
+ interface IconProperties {
13
+ name: IconName;
14
+ color: Palette | DarkPalette;
15
+ }
16
+ export declare const toastBgColorMap: Record<ToastTypeExcludingNone, string>;
17
+ export declare const toastBgDarkColorMap: Record<ToastTypeExcludingNone, string>;
18
+ export declare const iconPropertiesMap: Record<ToastTypeExcludingNone, IconProperties>;
19
+ export declare const iconDarkPropertiesMap: Record<ToastTypeExcludingNone, IconProperties>;
20
+ export {};