@nectary/components 0.39.0 → 0.41.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 +47 -84
- package/accordion-item/index.js +30 -53
- package/action-menu/index.d.ts +0 -1
- package/action-menu/index.js +177 -223
- package/action-menu/types.d.ts +8 -18
- package/action-menu-option/index.d.ts +1 -0
- package/action-menu-option/index.js +52 -62
- package/action-menu-option/types.d.ts +9 -0
- package/action-menu-option/utils.d.ts +2 -0
- package/action-menu-option/utils.js +3 -0
- package/alert/index.js +6 -20
- package/avatar/index.js +12 -31
- package/avatar-badge/index.js +8 -22
- package/avatar-status/index.js +1 -1
- package/button/index.js +46 -92
- package/button/types.d.ts +1 -1
- package/card/index.js +21 -59
- package/chat-avatar/index.js +8 -22
- package/chat-block/index.js +29 -69
- package/chat-bubble/index.js +6 -20
- package/checkbox/index.js +59 -107
- package/chip/index.d.ts +13 -0
- package/chip/index.js +140 -0
- package/chip/types.d.ts +37 -0
- package/color-menu/index.d.ts +14 -0
- package/color-menu/index.js +450 -0
- package/color-menu/types.d.ts +36 -0
- package/color-menu/utils.d.ts +1 -0
- package/color-menu/utils.js +15 -0
- package/color-swatch/index.d.ts +13 -0
- package/color-swatch/index.js +60 -0
- package/color-swatch/types.d.ts +11 -0
- package/colors.json +61 -49
- package/date-picker/index.js +162 -293
- package/dialog/index.js +70 -142
- package/field/index.js +44 -65
- package/file-drop/index.js +123 -200
- package/file-picker/index.d.ts +0 -1
- package/file-picker/index.js +55 -108
- package/file-status/index.js +15 -39
- package/help-tooltip/index.js +11 -28
- package/horizontal-stepper/index.js +33 -59
- package/horizontal-stepper-item/index.js +13 -37
- package/icon-button/index.d.ts +1 -0
- package/icon-button/index.js +51 -85
- package/icon-button/types.d.ts +16 -2
- package/icons-channel/notify/index.d.ts +11 -0
- package/icons-channel/notify/index.js +4 -0
- package/illustrations/create-illustration-class.js +1 -1
- package/inline-alert/index.js +29 -81
- package/input/index.js +117 -222
- package/link/index.js +51 -97
- package/list-item/index.js +1 -1
- package/package.json +12 -14
- package/pagination/index.js +113 -163
- package/pop/index.d.ts +11 -0
- package/pop/index.js +391 -0
- package/pop/types.d.ts +35 -0
- package/pop/utils.d.ts +7 -0
- package/pop/utils.js +18 -0
- package/popover/index.d.ts +1 -0
- package/popover/index.js +105 -314
- package/popover/types.d.ts +8 -1
- package/popover/utils.d.ts +5 -0
- package/popover/utils.js +17 -1
- package/progress/index.js +9 -28
- package/radio/index.js +103 -169
- package/radio-option/index.js +28 -48
- package/segment/index.js +49 -130
- package/segment-collapse/index.js +28 -49
- package/segmented-control/index.js +36 -73
- package/segmented-control-option/index.js +45 -87
- package/segmented-icon-control/index.js +47 -84
- package/segmented-icon-control-option/index.js +42 -79
- package/select-button/index.d.ts +13 -0
- package/select-button/index.js +158 -0
- package/select-button/types.d.ts +43 -0
- package/select-menu/index.d.ts +11 -0
- package/select-menu/index.js +345 -0
- package/select-menu/types.d.ts +29 -0
- package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
- package/select-menu-option/index.js +76 -0
- package/{select-option → select-menu-option}/types.d.ts +8 -9
- package/stop-events/index.js +7 -20
- package/table-head-cell/index.js +7 -21
- package/tabs/index.js +103 -165
- package/tabs-option/index.js +24 -44
- package/tag/index.d.ts +0 -1
- package/tag/index.js +35 -38
- package/tag/types.d.ts +12 -7
- package/textarea/index.js +96 -167
- package/theme.css +146 -49
- package/tile-control/index.js +55 -96
- package/tile-control-option/index.js +45 -87
- package/time-picker/index.js +216 -368
- package/title/index.js +6 -20
- package/toast/index.js +32 -70
- package/toast-manager/index.js +141 -217
- package/toggle/index.js +59 -107
- package/tooltip/index.d.ts +2 -0
- package/tooltip/index.js +160 -17
- package/tooltip/types.d.ts +13 -0
- package/tooltip/utils.d.ts +5 -0
- package/tooltip/utils.js +25 -1
- package/utils/animation.d.ts +17 -0
- package/utils/animation.js +142 -0
- package/utils/colors.d.ts +5 -0
- package/utils/colors.js +5 -0
- package/utils/context.d.ts +15 -0
- package/utils/context.js +57 -0
- package/{utils.d.ts → utils/index.d.ts} +15 -11
- package/{utils.js → utils/index.js} +104 -48
- package/vertical-stepper/index.js +29 -50
- package/vertical-stepper-item/index.js +13 -37
- package/dropdown/index.d.ts +0 -12
- package/dropdown/index.js +0 -415
- package/dropdown/types.d.ts +0 -32
- package/dropdown-checkbox-option/index.d.ts +0 -11
- package/dropdown-checkbox-option/index.js +0 -88
- package/dropdown-checkbox-option/types.d.ts +0 -15
- package/dropdown-radio-option/index.d.ts +0 -11
- package/dropdown-radio-option/index.js +0 -88
- package/dropdown-radio-option/types.d.ts +0 -15
- package/dropdown-text-option/index.js +0 -104
- package/dropdown-text-option/types.d.ts +0 -16
- package/select/index.d.ts +0 -13
- package/select/index.js +0 -316
- package/select/types.d.ts +0 -53
- package/select-option/index.d.ts +0 -11
- package/select-option/index.js +0 -8
- package/tag/utils.d.ts +0 -5
- package/tag/utils.js +0 -6
- package/tag-close/index.d.ts +0 -12
- package/tag-close/index.js +0 -42
- package/tag-close/types.d.ts +0 -5
- /package/{dropdown-checkbox-option → chip}/types.js +0 -0
- /package/{dropdown-radio-option → color-menu}/types.js +0 -0
- /package/{dropdown-text-option → color-swatch}/types.js +0 -0
- /package/{dropdown → pop}/types.js +0 -0
- /package/{select-option → select-button}/types.js +0 -0
- /package/{tag-close → select-menu}/types.js +0 -0
- /package/{select → select-menu-option}/types.js +0 -0
package/tile-control/index.js
CHANGED
|
@@ -1,88 +1,28 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$slot, _onSlotChange, _onOptionChange, _onValueChange, _onSmallChange, _onChangeReactHandler;
|
|
5
|
-
|
|
6
|
-
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
7
|
-
|
|
8
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
9
|
-
|
|
10
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
11
|
-
|
|
12
|
-
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
|
13
|
-
|
|
14
1
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getCsvSet, getFirstCsvValue, getIntegerAttribute, getReactEventHandler, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute } from '../utils';
|
|
15
2
|
const templateHTML = '<style>:host{display:block;outline:0;--sinch-grid-num-columns:1}#wrapper{display:grid;grid-template-columns:repeat(var(--sinch-grid-num-columns),auto);gap:16px;width:fit-content}:host([small]:not([small=false])) #wrapper{gap:8px}:host([cols="2"]){--sinch-grid-num-columns:2}:host([cols="3"]){--sinch-grid-num-columns:3}:host([cols="4"]){--sinch-grid-num-columns:4}:host([cols="5"]){--sinch-grid-num-columns:5}:host([cols="6"]){--sinch-grid-num-columns:6}:host([cols="7"]){--sinch-grid-num-columns:7}:host([cols="8"]){--sinch-grid-num-columns:8}</style><div id="wrapper"><slot></slot></div>';
|
|
16
3
|
const template = document.createElement('template');
|
|
17
4
|
template.innerHTML = templateHTML;
|
|
18
|
-
defineCustomElement('sinch-tile-control',
|
|
5
|
+
defineCustomElement('sinch-tile-control', class extends NectaryElement {
|
|
6
|
+
#$slot;
|
|
7
|
+
|
|
19
8
|
constructor() {
|
|
20
9
|
super();
|
|
21
|
-
|
|
22
|
-
_classPrivateMethodInitSpec(this, _onSmallChange);
|
|
23
|
-
|
|
24
|
-
_classPrivateMethodInitSpec(this, _onValueChange);
|
|
25
|
-
|
|
26
|
-
_classPrivateFieldInitSpec(this, _$slot, {
|
|
27
|
-
writable: true,
|
|
28
|
-
value: void 0
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
_classPrivateFieldInitSpec(this, _onSlotChange, {
|
|
32
|
-
writable: true,
|
|
33
|
-
value: () => {
|
|
34
|
-
_classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
|
|
35
|
-
|
|
36
|
-
_classPrivateMethodGet(this, _onSmallChange, _onSmallChange2).call(this);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
_classPrivateFieldInitSpec(this, _onOptionChange, {
|
|
41
|
-
writable: true,
|
|
42
|
-
value: e => {
|
|
43
|
-
e.stopPropagation();
|
|
44
|
-
const $elem = e.target;
|
|
45
|
-
const value = e.detail;
|
|
46
|
-
const detail = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : value;
|
|
47
|
-
this.dispatchEvent(new CustomEvent('change', {
|
|
48
|
-
detail,
|
|
49
|
-
bubbles: true
|
|
50
|
-
}));
|
|
51
|
-
this.dispatchEvent(new CustomEvent('-change', {
|
|
52
|
-
detail
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
_classPrivateFieldInitSpec(this, _onChangeReactHandler, {
|
|
58
|
-
writable: true,
|
|
59
|
-
value: e => {
|
|
60
|
-
getReactEventHandler(this, 'on-change')?.(e);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
10
|
const shadowRoot = this.attachShadow();
|
|
65
11
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
66
|
-
|
|
67
|
-
_classPrivateFieldSet(this, _$slot, shadowRoot.querySelector('slot'));
|
|
12
|
+
this.#$slot = shadowRoot.querySelector('slot');
|
|
68
13
|
}
|
|
69
14
|
|
|
70
15
|
connectedCallback() {
|
|
71
16
|
this.setAttribute('role', 'tablist');
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
_classPrivateFieldGet(this, _$slot).addEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
|
|
76
|
-
|
|
77
|
-
this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
|
|
17
|
+
this.#$slot.addEventListener('option-change', this.#onOptionChange);
|
|
18
|
+
this.#$slot.addEventListener('slotchange', this.#onSlotChange);
|
|
19
|
+
this.addEventListener('-change', this.#onChangeReactHandler);
|
|
78
20
|
}
|
|
79
21
|
|
|
80
22
|
disconnectedCallback() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
|
|
23
|
+
this.#$slot.removeEventListener('option-change', this.#onOptionChange);
|
|
24
|
+
this.#$slot.removeEventListener('slotchange', this.#onSlotChange);
|
|
25
|
+
this.removeEventListener('-change', this.#onChangeReactHandler);
|
|
86
26
|
}
|
|
87
27
|
|
|
88
28
|
static get observedAttributes() {
|
|
@@ -133,49 +73,68 @@ defineCustomElement('sinch-tile-control', (_$slot = new WeakMap(), _onSlotChange
|
|
|
133
73
|
switch (name) {
|
|
134
74
|
case 'value':
|
|
135
75
|
{
|
|
136
|
-
|
|
137
|
-
|
|
76
|
+
this.#onValueChange(newVal ?? '');
|
|
138
77
|
break;
|
|
139
78
|
}
|
|
140
79
|
|
|
141
80
|
case 'small':
|
|
142
81
|
{
|
|
143
|
-
|
|
144
|
-
|
|
82
|
+
this.#onSmallChange();
|
|
145
83
|
break;
|
|
146
84
|
}
|
|
147
85
|
|
|
148
86
|
case 'multiple':
|
|
149
87
|
{
|
|
150
|
-
|
|
88
|
+
this.#onValueChange(this.value);
|
|
151
89
|
}
|
|
152
90
|
}
|
|
153
91
|
}
|
|
154
92
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
93
|
+
#onSlotChange = () => {
|
|
94
|
+
this.#onValueChange(this.value);
|
|
95
|
+
this.#onSmallChange();
|
|
96
|
+
};
|
|
97
|
+
#onOptionChange = e => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
const $elem = e.target;
|
|
100
|
+
const value = e.detail;
|
|
101
|
+
const detail = this.multiple ? updateCsv(this.value, value, !getBooleanAttribute($elem, 'data-checked')) : value;
|
|
102
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
103
|
+
detail,
|
|
104
|
+
bubbles: true
|
|
105
|
+
}));
|
|
106
|
+
this.dispatchEvent(new CustomEvent('-change', {
|
|
107
|
+
detail
|
|
108
|
+
}));
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
#onValueChange(csv) {
|
|
112
|
+
if (this.multiple) {
|
|
113
|
+
const values = getCsvSet(csv);
|
|
114
|
+
|
|
115
|
+
for (const $option of this.#$slot.assignedElements()) {
|
|
116
|
+
const isChecked = !getBooleanAttribute($option, 'disabled') && values.has(getAttribute($option, 'value', ''));
|
|
117
|
+
updateBooleanAttribute($option, 'data-checked', isChecked);
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
const value = getFirstCsvValue(csv);
|
|
167
121
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
122
|
+
for (const $option of this.#$slot.assignedElements()) {
|
|
123
|
+
const isChecked = !getBooleanAttribute($option, 'disabled') && value === getAttribute($option, 'value', '');
|
|
124
|
+
updateBooleanAttribute($option, 'data-checked', isChecked);
|
|
125
|
+
}
|
|
171
126
|
}
|
|
172
127
|
}
|
|
173
|
-
}
|
|
174
128
|
|
|
175
|
-
|
|
176
|
-
|
|
129
|
+
#onSmallChange() {
|
|
130
|
+
const isSmall = this.small;
|
|
177
131
|
|
|
178
|
-
|
|
179
|
-
|
|
132
|
+
for (const $opt of this.#$slot.assignedElements()) {
|
|
133
|
+
updateBooleanAttribute($opt, 'data-small', isSmall);
|
|
134
|
+
}
|
|
180
135
|
}
|
|
181
|
-
|
|
136
|
+
|
|
137
|
+
#onChangeReactHandler = e => {
|
|
138
|
+
getReactEventHandler(this, 'on-change')?.(e);
|
|
139
|
+
};
|
|
140
|
+
});
|
|
@@ -1,99 +1,34 @@
|
|
|
1
|
-
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
-
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
-
|
|
4
|
-
var _$button, _$text, _onButtonClick, _onButtonFocus, _onButtonBlur, _onFocusReactHandler, _onBlurReactHandler;
|
|
5
|
-
|
|
6
|
-
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
|
-
|
|
8
|
-
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
|
-
|
|
10
1
|
import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateExplicitBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:88px;height:88px;padding:16px 8px 8px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-leve-1);cursor:pointer}:host([data-small])>button{width:64px;height:64px;border-radius:var(--sinch-shape-radius-m);padding:12px 4px 4px}button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);pointer-events:none}:host([data-small])>button::before{border-radius:var(--sinch-shape-radius-m)}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-
|
|
2
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;flex-direction:column;justify-content:space-between;box-sizing:border-box;width:88px;height:88px;padding:16px 8px 8px;border-radius:var(--sinch-shape-radius-l);background-color:var(--sinch-color-snow-100);box-shadow:var(--sinch-elevation-leve-1);cursor:pointer}:host([data-small])>button{width:64px;height:64px;border-radius:var(--sinch-shape-radius-m);padding:12px 4px 4px}button::before{content:"";position:absolute;left:0;top:0;bottom:0;right:0;border:1px solid var(--sinch-color-snow-700);border-radius:var(--sinch-shape-radius-l);pointer-events:none}:host([data-small])>button::before{border-radius:var(--sinch-shape-radius-m)}button:focus-visible::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px);pointer-events:none}:host([data-small])>button:focus-visible::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}@supports not selector(:focus-visible){button:focus::after{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:2px solid var(--sinch-color-border-focus);border-radius:calc(var(--sinch-shape-radius-l) + 4px)}:host([data-small])>button:focus::after{border-radius:calc(var(--sinch-shape-radius-m) + 4px)}}button:enabled:hover{background-color:var(--sinch-color-tropical-100)}button:enabled:hover::before{border-color:var(--sinch-color-tropical-100)}:host([data-checked])>button:enabled,button:enabled:active{box-shadow:var(--sinch-elevation-level-0)}:host([data-checked])>button:enabled::before,button:enabled:active::before{border-width:2px;border-color:var(--sinch-color-stormy-500)}button:disabled{cursor:initial}button:disabled>#icon,button:disabled>#text{opacity:.5}#text{display:inline-block;min-height:20px;text-align:center;font:var(--sinch-font-text-xs);color:var(--sinch-color-stormy-500);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#icon{width:32px;height:32px;align-self:center;--sinch-size-icon:32px;--sinch-color-icon:var(--sinch-color-stormy-500)}:host([data-small]) #icon{width:24px;height:24px;--sinch-size-icon:24px}button>*{pointer-events:none}</style><button><div id="icon"><slot name="icon"></slot></div><span id="text"></span></button>';
|
|
12
3
|
const template = document.createElement('template');
|
|
13
4
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-tile-control-option',
|
|
5
|
+
defineCustomElement('sinch-tile-control-option', class extends NectaryElement {
|
|
6
|
+
#$button;
|
|
7
|
+
#$text;
|
|
8
|
+
|
|
15
9
|
constructor() {
|
|
16
10
|
super();
|
|
17
|
-
|
|
18
|
-
_classPrivateFieldInitSpec(this, _$button, {
|
|
19
|
-
writable: true,
|
|
20
|
-
value: void 0
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
_classPrivateFieldInitSpec(this, _$text, {
|
|
24
|
-
writable: true,
|
|
25
|
-
value: void 0
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
_classPrivateFieldInitSpec(this, _onButtonClick, {
|
|
29
|
-
writable: true,
|
|
30
|
-
value: e => {
|
|
31
|
-
e.stopPropagation();
|
|
32
|
-
this.dispatchEvent(new CustomEvent('option-change', {
|
|
33
|
-
detail: this.value,
|
|
34
|
-
bubbles: true
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
_classPrivateFieldInitSpec(this, _onButtonFocus, {
|
|
40
|
-
writable: true,
|
|
41
|
-
value: () => {
|
|
42
|
-
this.dispatchEvent(new CustomEvent('-focus'));
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
_classPrivateFieldInitSpec(this, _onButtonBlur, {
|
|
47
|
-
writable: true,
|
|
48
|
-
value: () => {
|
|
49
|
-
this.dispatchEvent(new CustomEvent('-blur'));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
_classPrivateFieldInitSpec(this, _onFocusReactHandler, {
|
|
54
|
-
writable: true,
|
|
55
|
-
value: () => {
|
|
56
|
-
getReactEventHandler(this, 'on-focus')?.();
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
_classPrivateFieldInitSpec(this, _onBlurReactHandler, {
|
|
61
|
-
writable: true,
|
|
62
|
-
value: () => {
|
|
63
|
-
getReactEventHandler(this, 'on-blur')?.();
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
11
|
const shadowRoot = this.attachShadow();
|
|
68
12
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_classPrivateFieldSet(this, _$text, shadowRoot.querySelector('#text'));
|
|
13
|
+
this.#$button = shadowRoot.querySelector('button');
|
|
14
|
+
this.#$text = shadowRoot.querySelector('#text');
|
|
73
15
|
}
|
|
74
16
|
|
|
75
17
|
connectedCallback() {
|
|
76
18
|
this.setAttribute('role', 'tab');
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_classPrivateFieldGet(this, _$button).addEventListener('blur', _classPrivateFieldGet(this, _onButtonBlur));
|
|
83
|
-
|
|
84
|
-
this.addEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
85
|
-
this.addEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
19
|
+
this.#$button.addEventListener('click', this.#onButtonClick);
|
|
20
|
+
this.#$button.addEventListener('focus', this.#onButtonFocus);
|
|
21
|
+
this.#$button.addEventListener('blur', this.#onButtonBlur);
|
|
22
|
+
this.addEventListener('-focus', this.#onFocusReactHandler);
|
|
23
|
+
this.addEventListener('-blur', this.#onBlurReactHandler);
|
|
86
24
|
}
|
|
87
25
|
|
|
88
26
|
disconnectedCallback() {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.removeEventListener('-focus', _classPrivateFieldGet(this, _onFocusReactHandler));
|
|
96
|
-
this.removeEventListener('-blur', _classPrivateFieldGet(this, _onBlurReactHandler));
|
|
27
|
+
this.#$button.removeEventListener('click', this.#onButtonClick);
|
|
28
|
+
this.#$button.removeEventListener('focus', this.#onButtonFocus);
|
|
29
|
+
this.#$button.removeEventListener('blur', this.#onButtonBlur);
|
|
30
|
+
this.removeEventListener('-focus', this.#onFocusReactHandler);
|
|
31
|
+
this.removeEventListener('-blur', this.#onBlurReactHandler);
|
|
97
32
|
}
|
|
98
33
|
|
|
99
34
|
static get observedAttributes() {
|
|
@@ -108,7 +43,7 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
|
|
|
108
43
|
switch (name) {
|
|
109
44
|
case 'text':
|
|
110
45
|
{
|
|
111
|
-
|
|
46
|
+
this.#$text.textContent = newVal;
|
|
112
47
|
break;
|
|
113
48
|
}
|
|
114
49
|
|
|
@@ -120,7 +55,7 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
|
|
|
120
55
|
|
|
121
56
|
case 'disabled':
|
|
122
57
|
{
|
|
123
|
-
|
|
58
|
+
this.#$button.disabled = isAttrTrue(newVal);
|
|
124
59
|
break;
|
|
125
60
|
}
|
|
126
61
|
}
|
|
@@ -150,12 +85,35 @@ defineCustomElement('sinch-tile-control-option', (_$button = new WeakMap(), _$te
|
|
|
150
85
|
return getAttribute(this, 'text', '');
|
|
151
86
|
}
|
|
152
87
|
|
|
88
|
+
get focusable() {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
153
92
|
focus() {
|
|
154
|
-
|
|
93
|
+
this.#$button.focus();
|
|
155
94
|
}
|
|
156
95
|
|
|
157
96
|
blur() {
|
|
158
|
-
|
|
97
|
+
this.#$button.blur();
|
|
159
98
|
}
|
|
160
99
|
|
|
161
|
-
|
|
100
|
+
#onButtonClick = e => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
this.dispatchEvent(new CustomEvent('option-change', {
|
|
103
|
+
detail: this.value,
|
|
104
|
+
bubbles: true
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
#onButtonFocus = () => {
|
|
108
|
+
this.dispatchEvent(new CustomEvent('-focus'));
|
|
109
|
+
};
|
|
110
|
+
#onButtonBlur = () => {
|
|
111
|
+
this.dispatchEvent(new CustomEvent('-blur'));
|
|
112
|
+
};
|
|
113
|
+
#onFocusReactHandler = () => {
|
|
114
|
+
getReactEventHandler(this, 'on-focus')?.();
|
|
115
|
+
};
|
|
116
|
+
#onBlurReactHandler = () => {
|
|
117
|
+
getReactEventHandler(this, 'on-blur')?.();
|
|
118
|
+
};
|
|
119
|
+
});
|