@nectary/components 0.41.0 → 0.42.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/accordion/index.js +0 -16
- package/accordion/types.d.ts +9 -1
- package/accordion-item/index.js +0 -24
- package/accordion-item/types.d.ts +18 -3
- package/action-menu/index.js +1 -45
- package/action-menu-option/index.js +0 -18
- package/alert/index.js +0 -10
- package/alert/types.d.ts +6 -0
- package/avatar/index.js +57 -20
- package/avatar/types.d.ts +25 -7
- package/avatar/utils.d.ts +10 -2
- package/avatar/utils.js +23 -2
- package/badge/index.d.ts +11 -0
- package/badge/index.js +140 -0
- package/badge/types.d.ts +38 -0
- package/badge/utils.d.ts +11 -0
- package/badge/utils.js +23 -0
- package/button/index.js +0 -18
- package/card/index.js +0 -16
- package/card/types.d.ts +15 -3
- package/card-container/index.js +0 -1
- package/chat/index.js +0 -1
- package/chat-block/index.js +0 -19
- package/chat-block/types.d.ts +16 -4
- package/chat-bubble/index.js +0 -9
- package/chat-bubble/types.d.ts +6 -0
- package/checkbox/index.js +0 -23
- package/chip/index.js +16 -25
- package/chip/utils.d.ts +3 -0
- package/chip/utils.js +11 -0
- package/color-menu/index.js +8 -86
- package/color-menu/utils.js +0 -4
- package/color-swatch/index.js +17 -17
- package/color-swatch/types.d.ts +2 -2
- package/color-swatch/utils.d.ts +3 -0
- package/color-swatch/utils.js +11 -0
- package/date-picker/index.js +1 -50
- package/date-picker/utils.js +0 -7
- package/dialog/index.js +1 -17
- package/field/index.js +0 -19
- package/file-drop/index.js +0 -40
- package/file-drop/utils.js +0 -6
- package/file-picker/index.js +0 -17
- package/file-picker/utils.js +0 -1
- package/file-status/index.js +0 -12
- package/grid/index.js +0 -1
- package/grid-item/index.js +0 -9
- package/help-tooltip/index.js +0 -14
- package/horizontal-stepper/index.js +0 -12
- package/horizontal-stepper-item/index.js +0 -14
- package/icon-button/index.js +0 -15
- package/icons/create-icon-class.js +0 -2
- package/icons-branded/create-icon-class.js +0 -8
- package/icons-channel/create-icon-class.js +0 -6
- package/illustrations/create-illustration-class.js +0 -11
- package/inline-alert/index.js +0 -14
- package/input/index.js +0 -37
- package/link/index.js +0 -25
- package/list/index.js +0 -2
- package/list-item/index.js +0 -2
- package/logo/create-logo-class.js +0 -9
- package/package.json +1 -1
- package/pagination/index.js +0 -31
- package/pop/index.js +64 -68
- package/pop/utils.js +0 -1
- package/popover/index.js +0 -33
- package/popover/utils.js +0 -2
- package/progress/index.js +0 -10
- package/radio/index.js +0 -30
- package/radio-option/index.js +0 -20
- package/segment/index.js +0 -15
- package/segment-collapse/index.js +0 -13
- package/segmented-control/index.js +0 -12
- package/segmented-control-option/index.js +0 -18
- package/segmented-icon-control/index.js +0 -16
- package/segmented-icon-control-option/index.js +0 -14
- package/select-button/index.js +0 -23
- package/select-menu/index.js +1 -63
- package/select-menu-option/index.js +0 -14
- package/spinner/index.js +0 -4
- package/stop-events/index.js +0 -5
- package/table/index.js +0 -2
- package/table-body/index.js +0 -2
- package/table-cell/index.js +0 -4
- package/table-head/index.js +0 -2
- package/table-head-cell/index.js +0 -11
- package/table-row/index.js +0 -6
- package/tabs/index.js +0 -30
- package/tabs-option/index.js +0 -19
- package/tag/index.js +18 -21
- package/tag/utils.d.ts +3 -0
- package/tag/utils.js +11 -0
- package/text/index.js +1 -12
- package/textarea/index.js +0 -40
- package/{utils → theme}/colors.d.ts +0 -1
- package/{utils → theme}/colors.js +0 -1
- package/theme.css +13 -209
- package/tile-control/index.js +0 -24
- package/tile-control-option/index.js +0 -18
- package/time-picker/index.js +2 -51
- package/time-picker/utils.js +0 -18
- package/title/index.js +1 -12
- package/title/utils.js +0 -5
- package/toast/index.js +0 -19
- package/toast-manager/index.js +0 -27
- package/toggle/index.js +0 -23
- package/tooltip/index.js +0 -27
- package/tooltip/utils.js +0 -4
- package/utils/animation.js +0 -20
- package/utils/context.js +0 -6
- package/utils/index.d.ts +1 -0
- package/utils/index.js +11 -52
- package/vertical-stepper/index.js +0 -12
- package/vertical-stepper-item/index.js +0 -14
- package/avatar-badge/index.d.ts +0 -11
- package/avatar-badge/index.js +0 -38
- package/avatar-badge/types.d.ts +0 -8
- package/avatar-status/index.d.ts +0 -11
- package/avatar-status/index.js +0 -37
- package/avatar-status/types.d.ts +0 -9
- package/avatar-status/types.js +0 -1
- package/avatar-status/utils.d.ts +0 -5
- package/avatar-status/utils.js +0 -6
- package/chat-avatar/index.d.ts +0 -12
- package/chat-avatar/index.js +0 -52
- package/chat-avatar/types.d.ts +0 -12
- package/chat-avatar/types.js +0 -1
- /package/{avatar-badge → badge}/types.js +0 -0
package/textarea/index.js
CHANGED
|
@@ -6,14 +6,12 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
6
6
|
#$input;
|
|
7
7
|
#cursorPos = null;
|
|
8
8
|
#isPendingDk = false;
|
|
9
|
-
|
|
10
9
|
constructor() {
|
|
11
10
|
super();
|
|
12
11
|
const shadowRoot = this.attachShadow();
|
|
13
12
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
14
13
|
this.#$input = shadowRoot.querySelector('#input');
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
connectedCallback() {
|
|
18
16
|
this.setAttribute('role', 'textbox');
|
|
19
17
|
this.setAttribute('aria-multiline', 'true');
|
|
@@ -27,7 +25,6 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
27
25
|
this.addEventListener('-focus', this.#onFocusReactHandler);
|
|
28
26
|
this.addEventListener('-blur', this.#onBlurReactHandler);
|
|
29
27
|
}
|
|
30
|
-
|
|
31
28
|
disconnectedCallback() {
|
|
32
29
|
this.#$input.removeEventListener('input', this.#onInput);
|
|
33
30
|
this.#$input.removeEventListener('compositionstart', this.#onCompositionStart);
|
|
@@ -39,48 +36,39 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
39
36
|
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
40
37
|
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
static get observedAttributes() {
|
|
44
40
|
return ['value', 'placeholder', 'invalid', 'disabled', 'rows'];
|
|
45
41
|
}
|
|
46
|
-
|
|
47
42
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
48
43
|
if (oldVal === newVal) {
|
|
49
44
|
return;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
switch (name) {
|
|
53
47
|
case 'value':
|
|
54
48
|
{
|
|
55
49
|
const nextVal = newVal ?? '';
|
|
56
50
|
const prevVal = this.#$input.value;
|
|
57
|
-
|
|
58
51
|
if (nextVal !== prevVal) {
|
|
59
52
|
const prevCursorPos = this.#$input.selectionEnd;
|
|
60
53
|
const isPrevCursorEnd = prevCursorPos === prevVal.length;
|
|
61
54
|
this.#$input.value = nextVal;
|
|
62
|
-
|
|
63
55
|
if (!isPrevCursorEnd) {
|
|
64
56
|
this.#$input.setSelectionRange(this.#cursorPos, this.#cursorPos);
|
|
65
57
|
}
|
|
66
58
|
}
|
|
67
|
-
|
|
68
59
|
break;
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
case 'placeholder':
|
|
72
62
|
{
|
|
73
63
|
this.#$input.placeholder = newVal ?? '';
|
|
74
64
|
updateAttribute(this, 'aria-placeholder', newVal);
|
|
75
65
|
break;
|
|
76
66
|
}
|
|
77
|
-
|
|
78
67
|
case 'invalid':
|
|
79
68
|
{
|
|
80
69
|
updateExplicitBooleanAttribute(this, 'aria-invalid', isAttrTrue(newVal));
|
|
81
70
|
break;
|
|
82
71
|
}
|
|
83
|
-
|
|
84
72
|
case 'disabled':
|
|
85
73
|
{
|
|
86
74
|
const isDisabled = isAttrTrue(newVal);
|
|
@@ -88,7 +76,6 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
88
76
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
89
77
|
break;
|
|
90
78
|
}
|
|
91
|
-
|
|
92
79
|
case 'rows':
|
|
93
80
|
{
|
|
94
81
|
updateAttribute(this.#$input, 'rows', newVal);
|
|
@@ -96,95 +83,72 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
96
83
|
}
|
|
97
84
|
}
|
|
98
85
|
}
|
|
99
|
-
|
|
100
86
|
get nodeName() {
|
|
101
87
|
return 'textarea';
|
|
102
88
|
}
|
|
103
|
-
|
|
104
89
|
set value(value) {
|
|
105
90
|
updateAttribute(this, 'value', value);
|
|
106
91
|
}
|
|
107
|
-
|
|
108
92
|
get value() {
|
|
109
93
|
return getAttribute(this, 'value', '');
|
|
110
94
|
}
|
|
111
|
-
|
|
112
95
|
set placeholder(value) {
|
|
113
96
|
updateAttribute(this, 'placeholder', value);
|
|
114
97
|
}
|
|
115
|
-
|
|
116
98
|
get placeholder() {
|
|
117
99
|
return getAttribute(this, 'placeholder');
|
|
118
100
|
}
|
|
119
|
-
|
|
120
101
|
set invalid(value) {
|
|
121
102
|
updateBooleanAttribute(this, 'invalid', value);
|
|
122
103
|
}
|
|
123
|
-
|
|
124
104
|
get invalid() {
|
|
125
105
|
return getBooleanAttribute(this, 'invalid');
|
|
126
106
|
}
|
|
127
|
-
|
|
128
107
|
set disabled(isDisabled) {
|
|
129
108
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
130
109
|
}
|
|
131
|
-
|
|
132
110
|
get disabled() {
|
|
133
111
|
return getBooleanAttribute(this, 'disabled');
|
|
134
112
|
}
|
|
135
|
-
|
|
136
113
|
set resizable(isResizable) {
|
|
137
114
|
updateBooleanAttribute(this, 'resizable', isResizable);
|
|
138
115
|
}
|
|
139
|
-
|
|
140
116
|
get resizable() {
|
|
141
117
|
return getBooleanAttribute(this, 'resizable');
|
|
142
118
|
}
|
|
143
|
-
|
|
144
119
|
set rows(value) {
|
|
145
120
|
updateAttribute(this, 'rows', value);
|
|
146
121
|
}
|
|
147
|
-
|
|
148
122
|
get rows() {
|
|
149
123
|
return getIntegerAttribute(this, 'rows', 0);
|
|
150
124
|
}
|
|
151
|
-
|
|
152
125
|
get selectionStart() {
|
|
153
126
|
return this.#$input.selectionStart;
|
|
154
127
|
}
|
|
155
|
-
|
|
156
128
|
set selectionStart(value) {
|
|
157
129
|
this.#$input.selectionStart = value;
|
|
158
130
|
}
|
|
159
|
-
|
|
160
131
|
get selectionEnd() {
|
|
161
132
|
return this.#$input.selectionEnd;
|
|
162
133
|
}
|
|
163
|
-
|
|
164
134
|
set selectionEnd(value) {
|
|
165
135
|
this.#$input.selectionEnd = value;
|
|
166
136
|
}
|
|
167
|
-
|
|
168
137
|
get selectionDirection() {
|
|
169
138
|
return this.#$input.selectionDirection;
|
|
170
139
|
}
|
|
171
|
-
|
|
172
140
|
set selectionDirection(value) {
|
|
173
141
|
this.#$input.selectionDirection = value;
|
|
174
142
|
}
|
|
175
|
-
|
|
176
143
|
get focusable() {
|
|
177
144
|
return true;
|
|
178
145
|
}
|
|
179
|
-
|
|
180
146
|
focus() {
|
|
181
147
|
this.#$input.focus();
|
|
182
148
|
}
|
|
183
|
-
|
|
184
149
|
blur() {
|
|
185
150
|
this.#$input.blur();
|
|
186
151
|
}
|
|
187
|
-
|
|
188
152
|
#onCompositionStart = () => {
|
|
189
153
|
this.#isPendingDk = true;
|
|
190
154
|
};
|
|
@@ -195,20 +159,16 @@ defineCustomElement('sinch-textarea', class extends NectaryElement {
|
|
|
195
159
|
e.stopPropagation();
|
|
196
160
|
const nextValue = this.#$input.value;
|
|
197
161
|
const prevValue = this.value;
|
|
198
|
-
|
|
199
162
|
if (prevValue !== nextValue) {
|
|
200
163
|
const nextCursorPos = this.#$input.selectionEnd;
|
|
201
|
-
|
|
202
164
|
if (!this.#isPendingDk) {
|
|
203
165
|
this.#$input.value = prevValue;
|
|
204
166
|
const prevCursorPos = this.#cursorPos;
|
|
205
167
|
const isPrevCursorEnd = prevCursorPos === null || prevCursorPos === prevValue.length;
|
|
206
|
-
|
|
207
168
|
if (!isPrevCursorEnd) {
|
|
208
169
|
this.#$input.setSelectionRange(prevCursorPos, prevCursorPos);
|
|
209
170
|
}
|
|
210
171
|
}
|
|
211
|
-
|
|
212
172
|
this.#isPendingDk = false;
|
|
213
173
|
this.#cursorPos = nextCursorPos;
|
|
214
174
|
this.dispatchEvent(new CustomEvent('change', {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export const NO_COLOR = '';
|
|
2
1
|
export const lightColorNames = ['light-violet', 'light-blue', 'light-green', 'light-yellow', 'light-orange', 'light-pink', 'light-brown', 'light-gray'].join(',');
|
|
3
2
|
export const darkColorNames = ['dark-violet', 'dark-blue', 'dark-green', 'dark-yellow', 'dark-orange', 'dark-pink', 'dark-brown', 'dark-gray'].join(',');
|
|
4
3
|
export const vibrantColorNames = ['violet', 'blue', 'green', 'yellow', 'orange', 'pink', 'brown', 'gray'].join(',');
|
package/theme.css
CHANGED
|
@@ -1,96 +1,20 @@
|
|
|
1
|
+
@import "theme/palette.css";
|
|
2
|
+
@import "theme/fonts.css";
|
|
3
|
+
@import "theme/typography.css";
|
|
4
|
+
@import "theme/shapes.css";
|
|
5
|
+
@import "theme/elevation.css";
|
|
6
|
+
|
|
7
|
+
/* Components */
|
|
8
|
+
@import "theme/avatar.css";
|
|
9
|
+
@import "theme/badge.css";
|
|
10
|
+
@import "theme/chip.css";
|
|
11
|
+
@import "theme/color-swatch.css";
|
|
12
|
+
@import "theme/tag.css";
|
|
13
|
+
|
|
1
14
|
:root,
|
|
2
15
|
:host {
|
|
3
16
|
--sinch-theme: 1;
|
|
4
17
|
|
|
5
|
-
/* Colors */
|
|
6
|
-
--sinch-color-honey-700: #CC8800;
|
|
7
|
-
--sinch-color-honey-600: #FFAA00;
|
|
8
|
-
--sinch-color-honey-500: #FFBE3C;
|
|
9
|
-
--sinch-color-honey-400: #FFCC66;
|
|
10
|
-
--sinch-color-honey-300: #FFDF9E;
|
|
11
|
-
--sinch-color-honey-200: #FCECCB;
|
|
12
|
-
--sinch-color-honey-100: #FFF7E6;
|
|
13
|
-
--sinch-color-tropical-700: #003D3D;
|
|
14
|
-
--sinch-color-tropical-600: #005757;
|
|
15
|
-
--sinch-color-tropical-500: #007171;
|
|
16
|
-
--sinch-color-tropical-400: #059688;
|
|
17
|
-
--sinch-color-tropical-300: #66AAAA;
|
|
18
|
-
--sinch-color-tropical-200: #A7D5C2;
|
|
19
|
-
--sinch-color-tropical-100: #DCEDE1;
|
|
20
|
-
--sinch-color-tropical-50: #E5F1F1;
|
|
21
|
-
--sinch-color-stormy-700: #000000;
|
|
22
|
-
--sinch-color-stormy-600: #171717;
|
|
23
|
-
--sinch-color-stormy-500: #242424;
|
|
24
|
-
--sinch-color-stormy-400: #595959;
|
|
25
|
-
--sinch-color-stormy-300: #767676;
|
|
26
|
-
--sinch-color-stormy-200: #8C8C8C;
|
|
27
|
-
--sinch-color-stormy-100: #A6A6A6;
|
|
28
|
-
--sinch-color-ocean-700: #1B3E65;
|
|
29
|
-
--sinch-color-ocean-600: #1686CB;
|
|
30
|
-
--sinch-color-ocean-500: #3AA7EA;
|
|
31
|
-
--sinch-color-ocean-400: #6EBBEE;
|
|
32
|
-
--sinch-color-ocean-300: #A1D5F5;
|
|
33
|
-
--sinch-color-ocean-200: #C8E6F9;
|
|
34
|
-
--sinch-color-ocean-100: #DEF2FF;
|
|
35
|
-
--sinch-color-ocean-50: #F3FAFE;
|
|
36
|
-
--sinch-color-snow-700: #CCCCCC;
|
|
37
|
-
--sinch-color-snow-600: #D9D9D9;
|
|
38
|
-
--sinch-color-snow-500: #E0E0E0;
|
|
39
|
-
--sinch-color-snow-400: #F2F2F2;
|
|
40
|
-
--sinch-color-snow-200: #F8F8F8;
|
|
41
|
-
--sinch-color-snow-100: #FFFFFF;
|
|
42
|
-
--sinch-color-raspberry-700: #882024;
|
|
43
|
-
--sinch-color-raspberry-600: #D13D42;
|
|
44
|
-
--sinch-color-raspberry-500: #EF5858;
|
|
45
|
-
--sinch-color-raspberry-400: #F38686;
|
|
46
|
-
--sinch-color-raspberry-300: #FFB8B8;
|
|
47
|
-
--sinch-color-raspberry-200: #FBD5D5;
|
|
48
|
-
--sinch-color-raspberry-100: #FFE8E4;
|
|
49
|
-
--sinch-color-raspberry-50: #FFF6F5;
|
|
50
|
-
--sinch-color-night-700: #1223a1;
|
|
51
|
-
--sinch-color-night-400: #3247E9;
|
|
52
|
-
--sinch-color-night-200: #D1D6FA;
|
|
53
|
-
--sinch-color-grass-700: #006602;
|
|
54
|
-
--sinch-color-grass-400: #39B93D;
|
|
55
|
-
--sinch-color-grass-200: #B4E4B5;
|
|
56
|
-
--sinch-color-dirt-700: #363230;
|
|
57
|
-
--sinch-color-dirt-400: #828282;
|
|
58
|
-
--sinch-color-dirt-200: #E0DDDC;
|
|
59
|
-
--sinch-color-candy-700: #981b77;
|
|
60
|
-
--sinch-color-candy-400: #E467C3;
|
|
61
|
-
--sinch-color-candy-200: #F6CBEA;
|
|
62
|
-
--sinch-color-mud-700: #6d4e46;
|
|
63
|
-
--sinch-color-mud-400: #8B6559;
|
|
64
|
-
--sinch-color-mud-200: #D7C6C1;
|
|
65
|
-
--sinch-color-orange-700: #974302;
|
|
66
|
-
--sinch-color-orange-400: #FF8C34;
|
|
67
|
-
--sinch-color-orange-200: #FFD4B3;
|
|
68
|
-
--sinch-color-bolt-700: #805500;
|
|
69
|
-
--sinch-color-bolt-400: #FFBE3C;
|
|
70
|
-
--sinch-color-bolt-200: #FFE6B3;
|
|
71
|
-
--sinch-color-violet-700: #4F1B98;
|
|
72
|
-
--sinch-color-violet-400: #9E67E4;
|
|
73
|
-
--sinch-color-violet-200: #DECBF6;
|
|
74
|
-
--sinch-color-error-700: #882024;
|
|
75
|
-
--sinch-color-error-500: #D13D42;
|
|
76
|
-
--sinch-color-error-200: #FBD5D5;
|
|
77
|
-
--sinch-color-success-700: #275D33;
|
|
78
|
-
--sinch-color-success-500: #46A65A;
|
|
79
|
-
--sinch-color-success-200: #D7F1D8;
|
|
80
|
-
--sinch-color-informative-700: #003B7E;
|
|
81
|
-
--sinch-color-informative-500: #2071CE;
|
|
82
|
-
--sinch-color-informative-200: #D5E5F8;
|
|
83
|
-
--sinch-color-warning-700: #9C2E00;
|
|
84
|
-
--sinch-color-warning-500: #F35B1C;
|
|
85
|
-
--sinch-color-warning-200: #FFE8D6;
|
|
86
|
-
--sinch-color-skin-tone-0: #FFCC4D;
|
|
87
|
-
--sinch-color-skin-tone-10: #F7DECE;
|
|
88
|
-
--sinch-color-skin-tone-20: #F3D2A2;
|
|
89
|
-
--sinch-color-skin-tone-30: #D4AB88;
|
|
90
|
-
--sinch-color-skin-tone-40: #AF7E57;
|
|
91
|
-
--sinch-color-skin-tone-50: #7C533E;
|
|
92
|
-
--sinch-color-transparent: transparent;
|
|
93
|
-
|
|
94
18
|
/* Contextual */
|
|
95
19
|
--sinch-color-bg-primary-light: var(--sinch-color-snow-100);
|
|
96
20
|
--sinch-color-bg-primary-contrast: var(--sinch-color-snow-200);
|
|
@@ -114,93 +38,6 @@
|
|
|
114
38
|
--sinch-color-border-focus: var(--sinch-color-ocean-500);
|
|
115
39
|
--sinch-color-border-invalid: var(--sinch-color-raspberry-600);
|
|
116
40
|
|
|
117
|
-
/* Color Map */
|
|
118
|
-
--sinch-color-map-light-blue-bg: var(--sinch-color-night-200);
|
|
119
|
-
--sinch-color-map-light-blue-fg: var(--sinch-color-night-700);
|
|
120
|
-
--sinch-color-map-light-brown-bg: var(--sinch-color-mud-200);
|
|
121
|
-
--sinch-color-map-light-brown-fg: var(--sinch-color-mud-700);
|
|
122
|
-
--sinch-color-map-light-gray-bg: var(--sinch-color-dirt-200);
|
|
123
|
-
--sinch-color-map-light-gray-fg: var(--sinch-color-dirt-700);
|
|
124
|
-
--sinch-color-map-light-green-bg: var(--sinch-color-grass-200);
|
|
125
|
-
--sinch-color-map-light-green-fg: var(--sinch-color-grass-700);
|
|
126
|
-
--sinch-color-map-light-orange-bg: var(--sinch-color-orange-200);
|
|
127
|
-
--sinch-color-map-light-orange-fg: var(--sinch-color-orange-700);
|
|
128
|
-
--sinch-color-map-light-pink-bg: var(--sinch-color-candy-200);
|
|
129
|
-
--sinch-color-map-light-pink-fg: var(--sinch-color-candy-700);
|
|
130
|
-
--sinch-color-map-light-violet-bg: var(--sinch-color-violet-200);
|
|
131
|
-
--sinch-color-map-light-violet-fg: var(--sinch-color-violet-700);
|
|
132
|
-
--sinch-color-map-light-yellow-bg: var(--sinch-color-bolt-200);
|
|
133
|
-
--sinch-color-map-light-yellow-fg: var(--sinch-color-bolt-700);
|
|
134
|
-
--sinch-color-map-dark-blue-bg: var(--sinch-color-night-700);
|
|
135
|
-
--sinch-color-map-dark-blue-fg: var(--sinch-color-night-200);
|
|
136
|
-
--sinch-color-map-dark-brown-bg: var(--sinch-color-mud-700);
|
|
137
|
-
--sinch-color-map-dark-brown-fg: var(--sinch-color-mud-200);
|
|
138
|
-
--sinch-color-map-dark-gray-bg: var(--sinch-color-dirt-700);
|
|
139
|
-
--sinch-color-map-dark-gray-fg: var(--sinch-color-dirt-200);
|
|
140
|
-
--sinch-color-map-dark-green-bg: var(--sinch-color-grass-700);
|
|
141
|
-
--sinch-color-map-dark-green-fg: var(--sinch-color-grass-200);
|
|
142
|
-
--sinch-color-map-dark-orange-bg: var(--sinch-color-orange-700);
|
|
143
|
-
--sinch-color-map-dark-orange-fg: var(--sinch-color-orange-200);
|
|
144
|
-
--sinch-color-map-dark-pink-bg: var(--sinch-color-candy-700);
|
|
145
|
-
--sinch-color-map-dark-pink-fg: var(--sinch-color-candy-200);
|
|
146
|
-
--sinch-color-map-dark-violet-bg: var(--sinch-color-violet-700);
|
|
147
|
-
--sinch-color-map-dark-violet-fg: var(--sinch-color-violet-200);
|
|
148
|
-
--sinch-color-map-dark-yellow-bg: var(--sinch-color-bolt-700);
|
|
149
|
-
--sinch-color-map-dark-yellow-fg: var(--sinch-color-bolt-200);
|
|
150
|
-
--sinch-color-map-blue-bg: var(--sinch-color-night-400);
|
|
151
|
-
--sinch-color-map-blue-fg: var(--sinch-color-snow-100);
|
|
152
|
-
--sinch-color-map-brown-bg: var(--sinch-color-mud-400);
|
|
153
|
-
--sinch-color-map-brown-fg: var(--sinch-color-snow-100);
|
|
154
|
-
--sinch-color-map-gray-bg: var(--sinch-color-dirt-400);
|
|
155
|
-
--sinch-color-map-gray-fg: var(--sinch-color-snow-100);
|
|
156
|
-
--sinch-color-map-green-bg: var(--sinch-color-grass-400);
|
|
157
|
-
--sinch-color-map-green-fg: var(--sinch-color-stormy-500);
|
|
158
|
-
--sinch-color-map-orange-bg: var(--sinch-color-orange-400);
|
|
159
|
-
--sinch-color-map-orange-fg: var(--sinch-color-stormy-500);
|
|
160
|
-
--sinch-color-map-pink-bg: var(--sinch-color-candy-400);
|
|
161
|
-
--sinch-color-map-pink-fg: var(--sinch-color-stormy-500);
|
|
162
|
-
--sinch-color-map-violet-bg: var(--sinch-color-violet-400);
|
|
163
|
-
--sinch-color-map-violet-fg: var(--sinch-color-stormy-500);
|
|
164
|
-
--sinch-color-map-yellow-bg: var(--sinch-color-bolt-400);
|
|
165
|
-
--sinch-color-map-yellow-fg: var(--sinch-color-stormy-500);
|
|
166
|
-
--sinch-color-map-skin-tone-0-bg: var(--sinch-color-skin-tone-0);
|
|
167
|
-
--sinch-color-map-skin-tone-0-fg: var(--sinch-color-stormy-500);
|
|
168
|
-
--sinch-color-map-skin-tone-10-bg: var(--sinch-color-skin-tone-10);
|
|
169
|
-
--sinch-color-map-skin-tone-10-fg: var(--sinch-color-stormy-500);
|
|
170
|
-
--sinch-color-map-skin-tone-20-bg: var(--sinch-color-skin-tone-20);
|
|
171
|
-
--sinch-color-map-skin-tone-20-fg: var(--sinch-color-stormy-500);
|
|
172
|
-
--sinch-color-map-skin-tone-30-bg: var(--sinch-color-skin-tone-30);
|
|
173
|
-
--sinch-color-map-skin-tone-30-fg: var(--sinch-color-stormy-500);
|
|
174
|
-
--sinch-color-map-skin-tone-40-bg: var(--sinch-color-skin-tone-40);
|
|
175
|
-
--sinch-color-map-skin-tone-40-fg: var(--sinch-color-stormy-500);
|
|
176
|
-
--sinch-color-map-skin-tone-50-bg: var(--sinch-color-skin-tone-50);
|
|
177
|
-
--sinch-color-map-skin-tone-50-fg: var(--sinch-color-snow-100);
|
|
178
|
-
|
|
179
|
-
/* Typography */
|
|
180
|
-
--sinch-font-family: "Gilroy", "Arial", "sans-serif";
|
|
181
|
-
--sinch-font-weight-emphasized: 600;
|
|
182
|
-
--sinch-font-title-xl: 600 40px/48px var(--sinch-font-family);
|
|
183
|
-
--sinch-font-title-l: 600 24px/32px var(--sinch-font-family);
|
|
184
|
-
--sinch-font-title-m: 600 20px/24px var(--sinch-font-family);
|
|
185
|
-
--sinch-font-title-s: 600 16px/24px var(--sinch-font-family);
|
|
186
|
-
--sinch-font-title-xs: 600 14px/22px var(--sinch-font-family);
|
|
187
|
-
--sinch-font-text-m: 400 16px/24px var(--sinch-font-family);
|
|
188
|
-
--sinch-font-text-s: 400 14px/22px var(--sinch-font-family);
|
|
189
|
-
--sinch-font-text-xs: 400 12px/20px var(--sinch-font-family);
|
|
190
|
-
--sinch-font-text-xxs: 400 10px/16px var(--sinch-font-family);
|
|
191
|
-
|
|
192
|
-
/* Shapes */
|
|
193
|
-
--sinch-shape-radius-xs: 2px;
|
|
194
|
-
--sinch-shape-radius-s: 4px;
|
|
195
|
-
--sinch-shape-radius-m: 8px;
|
|
196
|
-
--sinch-shape-radius-l: 12px;
|
|
197
|
-
|
|
198
|
-
/* Elevation */
|
|
199
|
-
--sinch-elevation-level-0: 0 0 0 0 rgba(10, 39, 61, 0.1);
|
|
200
|
-
--sinch-elevation-level-1: 1px 2px 6px rgba(10, 39, 61, 0.1);
|
|
201
|
-
--sinch-elevation-level-2: 1px 4px 8px rgba(10, 39, 61, 0.1);
|
|
202
|
-
--sinch-elevation-level-3: 1px 6px 12px rgba(10, 39, 61, 0.15);
|
|
203
|
-
|
|
204
41
|
/* Deprecated */
|
|
205
42
|
--sinch-font-hero: 700 56px/72px var(--sinch-font-family);
|
|
206
43
|
--sinch-font-body: 400 16px/24px var(--sinch-font-family);
|
|
@@ -209,36 +46,3 @@
|
|
|
209
46
|
--sinch-font-extra-small-text: 400 12px/20px var(--sinch-font-family);
|
|
210
47
|
--sinch-font-monospace: 400 16px/24px "monospace";
|
|
211
48
|
}
|
|
212
|
-
|
|
213
|
-
@font-face {
|
|
214
|
-
font-family: "Gilroy";
|
|
215
|
-
font-weight: 400;
|
|
216
|
-
font-style: normal;
|
|
217
|
-
font-display: swap;
|
|
218
|
-
src:
|
|
219
|
-
local("Gilroy-Regular"),
|
|
220
|
-
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff2") format("woff2"),
|
|
221
|
-
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff") format("woff");
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
@font-face {
|
|
225
|
-
font-family: "Gilroy";
|
|
226
|
-
font-weight: 600;
|
|
227
|
-
font-style: normal;
|
|
228
|
-
font-display: swap;
|
|
229
|
-
src:
|
|
230
|
-
local("Gilroy-SemiBold"),
|
|
231
|
-
url("https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff2") format("woff2"),
|
|
232
|
-
url("https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff") format("woff");
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
@font-face {
|
|
236
|
-
font-family: "Gilroy";
|
|
237
|
-
font-weight: 700;
|
|
238
|
-
font-style: normal;
|
|
239
|
-
font-display: swap;
|
|
240
|
-
src:
|
|
241
|
-
local("Gilroy-Bold"),
|
|
242
|
-
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff2") format("woff2"),
|
|
243
|
-
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff") format("woff");
|
|
244
|
-
}
|
package/tile-control/index.js
CHANGED
|
@@ -4,92 +4,74 @@ const template = document.createElement('template');
|
|
|
4
4
|
template.innerHTML = templateHTML;
|
|
5
5
|
defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
6
6
|
#$slot;
|
|
7
|
-
|
|
8
7
|
constructor() {
|
|
9
8
|
super();
|
|
10
9
|
const shadowRoot = this.attachShadow();
|
|
11
10
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
12
11
|
this.#$slot = shadowRoot.querySelector('slot');
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
connectedCallback() {
|
|
16
14
|
this.setAttribute('role', 'tablist');
|
|
17
15
|
this.#$slot.addEventListener('option-change', this.#onOptionChange);
|
|
18
16
|
this.#$slot.addEventListener('slotchange', this.#onSlotChange);
|
|
19
17
|
this.addEventListener('-change', this.#onChangeReactHandler);
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
disconnectedCallback() {
|
|
23
20
|
this.#$slot.removeEventListener('option-change', this.#onOptionChange);
|
|
24
21
|
this.#$slot.removeEventListener('slotchange', this.#onSlotChange);
|
|
25
22
|
this.removeEventListener('-change', this.#onChangeReactHandler);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
static get observedAttributes() {
|
|
29
25
|
return ['value', 'small', 'multiple'];
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
get nodeName() {
|
|
33
28
|
return 'select';
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
set value(value) {
|
|
37
31
|
updateAttribute(this, 'value', value);
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
get value() {
|
|
41
34
|
return getAttribute(this, 'value', '');
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
set small(isSmall) {
|
|
45
37
|
updateBooleanAttribute(this, 'small', isSmall);
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
get small() {
|
|
49
40
|
return getBooleanAttribute(this, 'small');
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
set multiple(isMultiple) {
|
|
53
43
|
updateBooleanAttribute(this, 'multiple', isMultiple);
|
|
54
44
|
}
|
|
55
|
-
|
|
56
45
|
get multiple() {
|
|
57
46
|
return getBooleanAttribute(this, 'multiple');
|
|
58
47
|
}
|
|
59
|
-
|
|
60
48
|
set cols(value) {
|
|
61
49
|
updateIntegerAttribute(this, 'cols', value);
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
get cols() {
|
|
65
52
|
return getIntegerAttribute(this, 'cols', 1);
|
|
66
53
|
}
|
|
67
|
-
|
|
68
54
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
69
55
|
if (oldVal === newVal) {
|
|
70
56
|
return;
|
|
71
57
|
}
|
|
72
|
-
|
|
73
58
|
switch (name) {
|
|
74
59
|
case 'value':
|
|
75
60
|
{
|
|
76
61
|
this.#onValueChange(newVal ?? '');
|
|
77
62
|
break;
|
|
78
63
|
}
|
|
79
|
-
|
|
80
64
|
case 'small':
|
|
81
65
|
{
|
|
82
66
|
this.#onSmallChange();
|
|
83
67
|
break;
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
case 'multiple':
|
|
87
70
|
{
|
|
88
71
|
this.#onValueChange(this.value);
|
|
89
72
|
}
|
|
90
73
|
}
|
|
91
74
|
}
|
|
92
|
-
|
|
93
75
|
#onSlotChange = () => {
|
|
94
76
|
this.#onValueChange(this.value);
|
|
95
77
|
this.#onSmallChange();
|
|
@@ -107,33 +89,27 @@ defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
|
107
89
|
detail
|
|
108
90
|
}));
|
|
109
91
|
};
|
|
110
|
-
|
|
111
92
|
#onValueChange(csv) {
|
|
112
93
|
if (this.multiple) {
|
|
113
94
|
const values = getCsvSet(csv);
|
|
114
|
-
|
|
115
95
|
for (const $option of this.#$slot.assignedElements()) {
|
|
116
96
|
const isChecked = !getBooleanAttribute($option, 'disabled') && values.has(getAttribute($option, 'value', ''));
|
|
117
97
|
updateBooleanAttribute($option, 'data-checked', isChecked);
|
|
118
98
|
}
|
|
119
99
|
} else {
|
|
120
100
|
const value = getFirstCsvValue(csv);
|
|
121
|
-
|
|
122
101
|
for (const $option of this.#$slot.assignedElements()) {
|
|
123
102
|
const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
|
|
124
103
|
updateBooleanAttribute($option, 'data-checked', isChecked);
|
|
125
104
|
}
|
|
126
105
|
}
|
|
127
106
|
}
|
|
128
|
-
|
|
129
107
|
#onSmallChange() {
|
|
130
108
|
const isSmall = this.small;
|
|
131
|
-
|
|
132
109
|
for (const $opt of this.#$slot.assignedElements()) {
|
|
133
110
|
updateBooleanAttribute($opt, 'data-small', isSmall);
|
|
134
111
|
}
|
|
135
112
|
}
|
|
136
|
-
|
|
137
113
|
#onChangeReactHandler = e => {
|
|
138
114
|
getReactEventHandler(this, 'on-change')?.(e);
|
|
139
115
|
};
|
|
@@ -5,7 +5,6 @@ template.innerHTML = templateHTML;
|
|
|
5
5
|
defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|
|
6
6
|
#$button;
|
|
7
7
|
#$text;
|
|
8
|
-
|
|
9
8
|
constructor() {
|
|
10
9
|
super();
|
|
11
10
|
const shadowRoot = this.attachShadow();
|
|
@@ -13,7 +12,6 @@ defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|
|
|
13
12
|
this.#$button = shadowRoot.querySelector('button');
|
|
14
13
|
this.#$text = shadowRoot.querySelector('#text');
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
connectedCallback() {
|
|
18
16
|
this.setAttribute('role', 'tab');
|
|
19
17
|
this.#$button.addEventListener('click', this.#onButtonClick);
|
|
@@ -22,7 +20,6 @@ defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|
|
|
22
20
|
this.addEventListener('-focus', this.#onFocusReactHandler);
|
|
23
21
|
this.addEventListener('-blur', this.#onBlurReactHandler);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
disconnectedCallback() {
|
|
27
24
|
this.#$button.removeEventListener('click', this.#onButtonClick);
|
|
28
25
|
this.#$button.removeEventListener('focus', this.#onButtonFocus);
|
|
@@ -30,29 +27,24 @@ defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|
|
|
30
27
|
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
31
28
|
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
static get observedAttributes() {
|
|
35
31
|
return ['data-checked', 'text', 'disabled'];
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
attributeChangedCallback(name, oldVal, newVal) {
|
|
39
34
|
if (oldVal === newVal) {
|
|
40
35
|
return;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
switch (name) {
|
|
44
38
|
case 'text':
|
|
45
39
|
{
|
|
46
40
|
this.#$text.textContent = newVal;
|
|
47
41
|
break;
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
case 'data-checked':
|
|
51
44
|
{
|
|
52
45
|
updateExplicitBooleanAttribute(this, 'aria-selected', isAttrTrue(newVal));
|
|
53
46
|
break;
|
|
54
47
|
}
|
|
55
|
-
|
|
56
48
|
case 'disabled':
|
|
57
49
|
{
|
|
58
50
|
this.#$button.disabled = isAttrTrue(newVal);
|
|
@@ -60,43 +52,33 @@ defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|
|
|
60
52
|
}
|
|
61
53
|
}
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
set value(value) {
|
|
65
56
|
updateAttribute(this, 'value', value);
|
|
66
57
|
}
|
|
67
|
-
|
|
68
58
|
get value() {
|
|
69
59
|
return getAttribute(this, 'value', '');
|
|
70
60
|
}
|
|
71
|
-
|
|
72
61
|
set disabled(isDisabled) {
|
|
73
62
|
updateBooleanAttribute(this, 'disabled', isDisabled);
|
|
74
63
|
}
|
|
75
|
-
|
|
76
64
|
get disabled() {
|
|
77
65
|
return getBooleanAttribute(this, 'disabled');
|
|
78
66
|
}
|
|
79
|
-
|
|
80
67
|
set text(value) {
|
|
81
68
|
updateAttribute(this, 'text', value);
|
|
82
69
|
}
|
|
83
|
-
|
|
84
70
|
get text() {
|
|
85
71
|
return getAttribute(this, 'text', '');
|
|
86
72
|
}
|
|
87
|
-
|
|
88
73
|
get focusable() {
|
|
89
74
|
return true;
|
|
90
75
|
}
|
|
91
|
-
|
|
92
76
|
focus() {
|
|
93
77
|
this.#$button.focus();
|
|
94
78
|
}
|
|
95
|
-
|
|
96
79
|
blur() {
|
|
97
80
|
this.#$button.blur();
|
|
98
81
|
}
|
|
99
|
-
|
|
100
82
|
#onButtonClick = e => {
|
|
101
83
|
e.stopPropagation();
|
|
102
84
|
this.dispatchEvent(new CustomEvent('option-change', {
|