@nectary/components 0.31.0 → 0.33.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-item/types.d.ts +0 -2
- package/action-menu/index.js +40 -18
- package/action-menu/types.d.ts +3 -0
- package/action-menu-option/index.js +22 -14
- package/action-menu-option/types.d.ts +0 -2
- package/alert-button/types.d.ts +0 -2
- package/alert-close/types.d.ts +1 -4
- package/button/types.d.ts +0 -2
- package/card-button/types.d.ts +0 -2
- package/card-link/types.d.ts +0 -2
- package/checkbox/types.d.ts +0 -2
- package/date-picker/index.js +1 -1
- package/date-picker/types.d.ts +16 -1
- package/dialog/index.js +47 -40
- package/dialog/types.d.ts +2 -0
- package/dropdown/index.js +11 -13
- package/dropdown/types.d.ts +0 -2
- package/icon-button/index.js +1 -1
- package/icon-button/types.d.ts +0 -2
- package/input/index.js +111 -26
- package/input/types.d.ts +0 -2
- package/link/index.d.ts +1 -1
- package/link/index.js +1 -1
- package/package.json +1 -1
- package/pagination/types.d.ts +0 -2
- package/popover/index.js +127 -33
- package/popover/types.d.ts +17 -2
- package/popover/utils.js +1 -1
- package/radio-option/types.d.ts +0 -2
- package/search/types.d.ts +0 -2
- package/segment/index.js +30 -3
- package/segment-collapse/types.d.ts +0 -2
- package/segmented-control-option/index.js +1 -1
- package/segmented-control-option/types.d.ts +0 -2
- package/segmented-icon-control-option/types.d.ts +0 -2
- package/select/index.js +1 -1
- package/select/types.d.ts +0 -2
- package/tabs-option/types.d.ts +0 -2
- package/tag-close/types.d.ts +1 -4
- package/text/index.js +1 -3
- package/textarea/index.js +36 -28
- package/textarea/types.d.ts +0 -2
- package/time-picker/index.d.ts +17 -0
- package/time-picker/index.js +525 -0
- package/time-picker/types.d.ts +31 -0
- package/time-picker/types.js +1 -0
- package/time-picker/utils.d.ts +11 -0
- package/time-picker/utils.js +94 -0
- package/toggle/types.d.ts +0 -2
- package/utils.js +1 -1
|
@@ -6,8 +6,6 @@ export declare type TSinchAccordionItemElement = HTMLElement & {
|
|
|
6
6
|
optionalText: string | null;
|
|
7
7
|
disabled: boolean;
|
|
8
8
|
status: TSinchAccordionStatusType | null;
|
|
9
|
-
focus(): void;
|
|
10
|
-
blur(): void;
|
|
11
9
|
setAttribute(name: 'value', value: string): void;
|
|
12
10
|
setAttribute(name: 'label', value: string): void;
|
|
13
11
|
setAttribute(name: 'optionaltext', value: string): void;
|
package/action-menu/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$optionSlot, _$listbox, _$popover, _onListboxKeyDown, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _selectOption, _getOptionElements, _findSelectedOption, _getEnabledOptionElements,
|
|
4
|
+
var _$optionSlot, _$listbox, _$popover, _onListboxKeyDown, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _selectOption, _getOptionElements, _findSelectedOption, _getEnabledOptionElements, _onClose, _onReactClose;
|
|
5
5
|
|
|
6
6
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
7
7
|
|
|
@@ -14,16 +14,14 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
|
14
14
|
import { orientationValues } from '../popover/utils';
|
|
15
15
|
import '../popover';
|
|
16
16
|
import { attrValueToPixels, defineCustomElement, getBooleanAttribute, getIntegerAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateIntegerAttribute, updateLiteralAttribute } from '../utils';
|
|
17
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}sinch-popover{
|
|
17
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{width:100%;--sinch-popover-shape-radius:var(--sinch-shape-radius-s)}#listbox{overflow-y:auto}</style><sinch-popover id="wrapper"><slot name="target" slot="target"></slot><div id="listbox" slot="content"><slot name="option"></slot></div></sinch-popover>';
|
|
18
18
|
const ITEM_HEIGHT = 40;
|
|
19
19
|
const template = document.createElement('template');
|
|
20
20
|
template.innerHTML = templateHTML;
|
|
21
|
-
defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _$popover = new WeakMap(), _onListboxKeyDown = new WeakMap(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionElements = new WeakSet(), _findSelectedOption = new WeakSet(), _getEnabledOptionElements = new WeakSet(),
|
|
21
|
+
defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbox = new WeakMap(), _$popover = new WeakMap(), _onListboxKeyDown = new WeakMap(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _selectOption = new WeakSet(), _getOptionElements = new WeakSet(), _findSelectedOption = new WeakSet(), _getEnabledOptionElements = new WeakSet(), _onClose = new WeakMap(), _onReactClose = new WeakMap(), class extends NectaryElement {
|
|
22
22
|
constructor() {
|
|
23
23
|
super();
|
|
24
24
|
|
|
25
|
-
_classPrivateMethodInitSpec(this, _onOpen);
|
|
26
|
-
|
|
27
25
|
_classPrivateMethodInitSpec(this, _getEnabledOptionElements);
|
|
28
26
|
|
|
29
27
|
_classPrivateMethodInitSpec(this, _findSelectedOption);
|
|
@@ -59,8 +57,19 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
59
57
|
writable: true,
|
|
60
58
|
value: e => {
|
|
61
59
|
switch (e.code) {
|
|
60
|
+
case 'Enter':
|
|
61
|
+
{
|
|
62
|
+
const $opt = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this));
|
|
63
|
+
|
|
64
|
+
if ($opt !== null) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
$opt.click();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
|
|
62
72
|
case 'ArrowUp':
|
|
63
|
-
case 'ArrowLeft':
|
|
64
73
|
{
|
|
65
74
|
e.preventDefault();
|
|
66
75
|
|
|
@@ -70,7 +79,6 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
70
79
|
}
|
|
71
80
|
|
|
72
81
|
case 'ArrowDown':
|
|
73
|
-
case 'ArrowRight':
|
|
74
82
|
{
|
|
75
83
|
e.preventDefault();
|
|
76
84
|
|
|
@@ -118,7 +126,7 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
static get observedAttributes() {
|
|
121
|
-
return ['open', 'orientation', 'maxvisibleitems'];
|
|
129
|
+
return ['open', 'orientation', 'maxvisibleitems', 'modal'];
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
get nodeName() {
|
|
@@ -149,6 +157,14 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
149
157
|
return getBooleanAttribute(this, 'open');
|
|
150
158
|
}
|
|
151
159
|
|
|
160
|
+
set modal(isModal) {
|
|
161
|
+
updateBooleanAttribute(this, 'modal', isModal);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
get modal() {
|
|
165
|
+
return getBooleanAttribute(this, 'modal');
|
|
166
|
+
}
|
|
167
|
+
|
|
152
168
|
get dropdownRect() {
|
|
153
169
|
return _classPrivateFieldGet(this, _$popover).popoverRect;
|
|
154
170
|
}
|
|
@@ -160,8 +176,6 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
160
176
|
updateAttribute(_classPrivateFieldGet(this, _$popover), 'open', newVal);
|
|
161
177
|
|
|
162
178
|
if (isAttrTrue(newVal)) {
|
|
163
|
-
_classPrivateMethodGet(this, _onOpen, _onOpen2).call(this);
|
|
164
|
-
|
|
165
179
|
_classPrivateFieldGet(this, _$popover).addEventListener('keydown', _classPrivateFieldGet(this, _onListboxKeyDown));
|
|
166
180
|
|
|
167
181
|
_classPrivateFieldGet(this, _$popover).addEventListener('close', _classPrivateFieldGet(this, _onClose));
|
|
@@ -169,6 +183,8 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
169
183
|
_classPrivateFieldGet(this, _$popover).removeEventListener('keydown', _classPrivateFieldGet(this, _onListboxKeyDown));
|
|
170
184
|
|
|
171
185
|
_classPrivateFieldGet(this, _$popover).removeEventListener('close', _classPrivateFieldGet(this, _onClose));
|
|
186
|
+
|
|
187
|
+
_classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, null);
|
|
172
188
|
}
|
|
173
189
|
|
|
174
190
|
break;
|
|
@@ -193,6 +209,12 @@ defineCustomElement('sinch-action-menu', (_$optionSlot = new WeakMap(), _$listbo
|
|
|
193
209
|
|
|
194
210
|
break;
|
|
195
211
|
}
|
|
212
|
+
|
|
213
|
+
case 'modal':
|
|
214
|
+
{
|
|
215
|
+
updateBooleanAttribute(_classPrivateFieldGet(this, _$popover), 'modal', isAttrTrue(newVal));
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
196
218
|
}
|
|
197
219
|
}
|
|
198
220
|
|
|
@@ -235,12 +257,16 @@ function _getPrevOption2() {
|
|
|
235
257
|
}
|
|
236
258
|
|
|
237
259
|
function _selectOption2($option) {
|
|
260
|
+
const hasMaxVisibleItems = this.hasAttribute('maxvisibleitems');
|
|
261
|
+
|
|
238
262
|
for (const $op of _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this)) {
|
|
239
263
|
const isSelected = $op === $option;
|
|
240
|
-
updateBooleanAttribute($op, 'selected', isSelected);
|
|
264
|
+
updateBooleanAttribute($op, 'data-selected', isSelected);
|
|
241
265
|
|
|
242
|
-
if (isSelected) {
|
|
243
|
-
$op.
|
|
266
|
+
if (isSelected && hasMaxVisibleItems) {
|
|
267
|
+
$op.scrollIntoView?.({
|
|
268
|
+
block: 'nearest'
|
|
269
|
+
});
|
|
244
270
|
}
|
|
245
271
|
}
|
|
246
272
|
}
|
|
@@ -257,7 +283,7 @@ function _getOptionElements2() {
|
|
|
257
283
|
|
|
258
284
|
function _findSelectedOption2(elements) {
|
|
259
285
|
for (const el of elements) {
|
|
260
|
-
if (getBooleanAttribute(el, 'selected')) {
|
|
286
|
+
if (getBooleanAttribute(el, 'data-selected')) {
|
|
261
287
|
return el;
|
|
262
288
|
}
|
|
263
289
|
}
|
|
@@ -267,8 +293,4 @@ function _findSelectedOption2(elements) {
|
|
|
267
293
|
|
|
268
294
|
function _getEnabledOptionElements2() {
|
|
269
295
|
return _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this).filter(opt => opt.disabled !== true);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
function _onOpen2() {
|
|
273
|
-
_classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this));
|
|
274
296
|
}
|
package/action-menu/types.d.ts
CHANGED
|
@@ -5,16 +5,19 @@ export declare type TSinchActionMenuElement = HTMLElement & {
|
|
|
5
5
|
open: boolean;
|
|
6
6
|
orientation: TSinchPopoverOrientation;
|
|
7
7
|
maxVisibleItems: number | null;
|
|
8
|
+
modal: boolean;
|
|
8
9
|
readonly dropdownRect: TRect;
|
|
9
10
|
addEventListener(type: 'close', listener: (e: CustomEvent<void>) => void): void;
|
|
10
11
|
setAttribute(name: 'open', value: ''): void;
|
|
11
12
|
setAttribute(name: 'orientation', value: TSinchPopoverOrientation): void;
|
|
12
13
|
setAttribute(name: 'maxvisibleitems', value: string): void;
|
|
14
|
+
setAttribute(name: 'modal', value: boolean): void;
|
|
13
15
|
};
|
|
14
16
|
export declare type TSinchActionMenuReact = TSinchElementReact<TSinchActionMenuElement> & {
|
|
15
17
|
open: boolean;
|
|
16
18
|
orientation?: TSinchPopoverOrientation;
|
|
17
19
|
maxVisibleItems?: number;
|
|
20
|
+
modal?: boolean;
|
|
18
21
|
'aria-label': string;
|
|
19
22
|
onClose: (event: SyntheticEvent<TSinchActionMenuElement, CustomEvent<void>>) => void;
|
|
20
23
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
2
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
3
|
|
|
4
|
-
var _$
|
|
4
|
+
var _$wrapper, _$content, _onMouseDown;
|
|
5
5
|
|
|
6
6
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
7
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import { defineCustomElement, getAttribute, getBooleanAttribute, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:block}#wrapper{all:initial;display:flex;position:relative;box-sizing:border-box;height:40px;width:100%;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;font:inherit;color:inherit;--sinch-size-icon:24px}#content{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
|
|
11
|
+
const templateHTML = '<style>:host{display:block}#wrapper{all:initial;display:flex;position:relative;box-sizing:border-box;height:40px;width:100%;padding:8px 16px;align-items:center;gap:10px;user-select:none;cursor:pointer;font:inherit;color:inherit;--sinch-size-icon:24px}#content{flex-shrink:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:hover)>#wrapper,:host([data-selected])>#wrapper{background-color:var(--sinch-color-snow-500)}:host([disabled]:not([disabled=false]))>#wrapper{color:var(--sinch-color-stormy-100);cursor:initial;pointer-events:none;--sinch-color-icon:var(--sinch-color-stormy-100)}::slotted(*){margin-left:-6px}</style><div id="wrapper"><slot name="icon"></slot><span id="content"></span></div>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
|
-
defineCustomElement('sinch-action-menu-option', (_$
|
|
14
|
+
defineCustomElement('sinch-action-menu-option', (_$wrapper = new WeakMap(), _$content = new WeakMap(), _onMouseDown = new WeakMap(), class ActionMenuOption extends NectaryElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
|
|
18
|
-
_classPrivateFieldInitSpec(this, _$
|
|
18
|
+
_classPrivateFieldInitSpec(this, _$wrapper, {
|
|
19
19
|
writable: true,
|
|
20
20
|
value: void 0
|
|
21
21
|
});
|
|
@@ -25,16 +25,31 @@ defineCustomElement('sinch-action-menu-option', (_$button = new WeakMap(), _$con
|
|
|
25
25
|
value: void 0
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
_classPrivateFieldInitSpec(this, _onMouseDown, {
|
|
29
|
+
writable: true,
|
|
30
|
+
value: e => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
this.click();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
28
37
|
const shadowRoot = this.attachShadow();
|
|
29
38
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
30
39
|
|
|
31
|
-
_classPrivateFieldSet(this, _$
|
|
40
|
+
_classPrivateFieldSet(this, _$wrapper, shadowRoot.querySelector('#wrapper'));
|
|
32
41
|
|
|
33
42
|
_classPrivateFieldSet(this, _$content, shadowRoot.querySelector('#content'));
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
connectedCallback() {
|
|
37
46
|
this.setAttribute('role', 'option');
|
|
47
|
+
|
|
48
|
+
_classPrivateFieldGet(this, _$wrapper).addEventListener('mousedown', _classPrivateFieldGet(this, _onMouseDown));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
_classPrivateFieldGet(this, _$wrapper).removeEventListener('mousedown', _classPrivateFieldGet(this, _onMouseDown));
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
static get observedAttributes() {
|
|
@@ -55,7 +70,8 @@ defineCustomElement('sinch-action-menu-option', (_$button = new WeakMap(), _$con
|
|
|
55
70
|
|
|
56
71
|
case 'disabled':
|
|
57
72
|
{
|
|
58
|
-
|
|
73
|
+
updateBooleanAttribute(this, 'disabled', isAttrTrue(newVal));
|
|
74
|
+
break;
|
|
59
75
|
}
|
|
60
76
|
}
|
|
61
77
|
}
|
|
@@ -76,12 +92,4 @@ defineCustomElement('sinch-action-menu-option', (_$button = new WeakMap(), _$con
|
|
|
76
92
|
return getBooleanAttribute(this, 'disabled');
|
|
77
93
|
}
|
|
78
94
|
|
|
79
|
-
focus() {
|
|
80
|
-
_classPrivateFieldGet(this, _$button).focus();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
blur() {
|
|
84
|
-
_classPrivateFieldGet(this, _$button).blur();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
95
|
}));
|
|
@@ -2,8 +2,6 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export declare type TSinchActionMenuOptionElement = HTMLElement & {
|
|
3
3
|
text: string;
|
|
4
4
|
disabled: boolean;
|
|
5
|
-
focus(): void;
|
|
6
|
-
blur(): void;
|
|
7
5
|
setAttribute(name: 'text', value: string): void;
|
|
8
6
|
setAttribute(name: 'disabled', value: ''): void;
|
|
9
7
|
};
|
package/alert-button/types.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
2
|
export declare type TSinchAlertButtonElement = HTMLElement & {
|
|
3
3
|
text: string;
|
|
4
|
-
focus(): void;
|
|
5
|
-
blur(): void;
|
|
6
4
|
setAttribute(name: 'text', value: string): void;
|
|
7
5
|
};
|
|
8
6
|
export declare type TSinchAlertButtonReact = TSinchElementReact<TSinchAlertButtonElement> & {
|
package/alert-close/types.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { TSinchElementReact } from '../types';
|
|
2
|
-
export declare type TSinchAlertCloseElement = HTMLElement
|
|
3
|
-
focus(): void;
|
|
4
|
-
blur(): void;
|
|
5
|
-
};
|
|
2
|
+
export declare type TSinchAlertCloseElement = HTMLElement;
|
|
6
3
|
export declare type TSinchAlertCloseReact = TSinchElementReact<TSinchAlertCloseElement>;
|
package/button/types.d.ts
CHANGED
package/card-button/types.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export declare type TSinchCardButtonElement = HTMLElement & {
|
|
3
3
|
text: string;
|
|
4
4
|
disabled: boolean;
|
|
5
|
-
focus(): void;
|
|
6
|
-
blur(): void;
|
|
7
5
|
setAttribute(name: 'text', value: string): void;
|
|
8
6
|
setAttribute(name: 'disabled', value: ''): void;
|
|
9
7
|
};
|
package/card-link/types.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ export declare type TSinchCardLinkElement = HTMLElement & {
|
|
|
3
3
|
text: string;
|
|
4
4
|
href: string;
|
|
5
5
|
disabled: boolean;
|
|
6
|
-
focus(): void;
|
|
7
|
-
blur(): void;
|
|
8
6
|
setAttribute(name: 'text', value: string): void;
|
|
9
7
|
setAttribute(name: 'href', value: string): void;
|
|
10
8
|
setAttribute(name: 'disabled', value: ''): void;
|
package/checkbox/types.d.ts
CHANGED
|
@@ -6,8 +6,6 @@ export declare type TSinchCheckboxElement = HTMLElement & {
|
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
invalid: boolean;
|
|
8
8
|
text: string | null;
|
|
9
|
-
focus(): void;
|
|
10
|
-
blur(): void;
|
|
11
9
|
addEventListener(type: 'change', listener: (e: CustomEvent<boolean>) => void): void;
|
|
12
10
|
setAttribute(name: 'checked', value: ''): void;
|
|
13
11
|
setAttribute(name: 'indeterminate', value: ''): void;
|
package/date-picker/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import '../icons/delete-outline';
|
|
|
20
20
|
import '../icons/today';
|
|
21
21
|
import '../text';
|
|
22
22
|
import { defineCustomElement, getAttribute, getRect, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
|
|
23
|
-
const templateHTML = '<style>:host{display:block;outline:0}#content{width:fit-content;box-sizing:border-box;padding:16px;display:flex;flex-direction:column;gap:8px}#month{display:flex;flex-direction:column;row-gap:8px}.week{display:flex;flex-direction:row;column-gap:8px}.week.empty{display:none}.day{all:initial;font:var(--sinch-font-text-xs);color:var(--sinch-color-text-default);text-align:center;border-radius:var(--sinch-shape-radius-m);width:24px;height:24px;line-height:22px;cursor:pointer;border:1px solid transparent;background-color:transparent;box-sizing:border-box;user-select:none}.day.today{border:1px solid var(--sinch-color-stormy-500)}.day:disabled{cursor:initial;color:var(--sinch-color-snow-700)}.day:focus-visible{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}@supports not selector(:focus-visible){.day:focus{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}}.day.selected{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}.day:hover:not(:disabled):not(.selected){background-color:var(--sinch-color-snow-600)}#week-day-names{display:flex;flex-direction:row;gap:8px;height:24px}.week-day-name{font:var(--sinch-font-text-xs);font-weight:var(--sinch-font-weight-emphasized);color:var(--sinch-color-text-default);text-align:center;width:24px;height:24px;line-height:24px;user-select:none;text-transform:uppercase}#content-header{display:flex;flex-direction:row;height:32px;align-items:center}#date{flex:1;text-align:center;text-transform:capitalize}#prev-year{margin-left:-4px}#next-year{margin-right:-4px}</style><div id="content"
|
|
23
|
+
const templateHTML = '<style>:host{display:block;outline:0}#content{width:fit-content;box-sizing:border-box;padding:16px;display:flex;flex-direction:column;gap:8px}#month{display:flex;flex-direction:column;row-gap:8px}.week{display:flex;flex-direction:row;column-gap:8px}.week.empty{display:none}.day{all:initial;font:var(--sinch-font-text-xs);color:var(--sinch-color-text-default);text-align:center;border-radius:var(--sinch-shape-radius-m);width:24px;height:24px;line-height:22px;cursor:pointer;border:1px solid transparent;background-color:transparent;box-sizing:border-box;user-select:none}.day.today{border:1px solid var(--sinch-color-stormy-500)}.day:disabled{cursor:initial;color:var(--sinch-color-snow-700)}.day:focus-visible{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}@supports not selector(:focus-visible){.day:focus{outline:1px solid var(--sinch-color-aqua-400);outline-offset:1px}}.day.selected{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-snow-100)}.day:hover:not(:disabled):not(.selected){background-color:var(--sinch-color-snow-600)}#week-day-names{display:flex;flex-direction:row;gap:8px;height:24px}.week-day-name{font:var(--sinch-font-text-xs);font-weight:var(--sinch-font-weight-emphasized);color:var(--sinch-color-text-default);text-align:center;width:24px;height:24px;line-height:24px;user-select:none;text-transform:uppercase}#content-header{display:flex;flex-direction:row;height:32px;align-items:center}#date{flex:1;text-align:center;text-transform:capitalize}#prev-year{margin-left:-4px}#next-year{margin-right:-4px}</style><div id="content"><div id="content-header"><sinch-icon-button small id="prev-year"><sinch-icon-keyboard-double-arrow-left slot="icon"></sinch-icon-keyboard-double-arrow-left></sinch-icon-button><sinch-icon-button small id="prev-month"><sinch-icon-keyboard-arrow-left slot="icon"></sinch-icon-keyboard-arrow-left></sinch-icon-button><sinch-text type="m" emphasized id="date"></sinch-text><sinch-icon-button small id="next-month"><sinch-icon-keyboard-arrow-right slot="icon"></sinch-icon-keyboard-arrow-right></sinch-icon-button><sinch-icon-button small id="next-year"><sinch-icon-keyboard-double-arrow-right slot="icon"></sinch-icon-keyboard-double-arrow-right></sinch-icon-button></div><div id="week-day-names"><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div><div class="week-day-name"></div></div><div id="month"><div class="week"><button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button></div><div class="week"><button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button></div><div class="week"><button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button></div><div class="week"><button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button></div><div class="week"><button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button></div><div class="week"><button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button> <button class="day"></button></div></div></div>';
|
|
24
24
|
import { areDatesEqual, assertDate, assertLocale, assertMinMax, assertValue, canGoNextMonth, canGoNextYear, canGoPrevMonth, canGoPrevYear, clampMaxDate, clampMinDate, dateToIso, decMonth, decYear, getCalendarMonth, getDayNames, getMonthNames, incMonth, incYear, isDateBetween, isoToDate, isValidDate, today } from './utils';
|
|
25
25
|
const template = document.createElement('template');
|
|
26
26
|
template.innerHTML = templateHTML;
|
package/date-picker/types.d.ts
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
import type { TRect, TSinchElementReact } from '../types';
|
|
2
2
|
import type { SyntheticEvent } from 'react';
|
|
3
3
|
export declare type TSinchDatePickerElement = HTMLElement & {
|
|
4
|
+
/** Date value in ISO 8601 format */
|
|
4
5
|
value: string;
|
|
6
|
+
/** Date min limit in ISO 8601 format */
|
|
5
7
|
min: string;
|
|
8
|
+
/** Date max limit in ISO 8601 format */
|
|
6
9
|
max: string;
|
|
10
|
+
/** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
|
|
7
11
|
locale: string;
|
|
8
12
|
readonly prevYearButtonRect: TRect;
|
|
9
13
|
readonly nextYearButtonRect: TRect;
|
|
10
14
|
readonly prevMonthButtonRect: TRect;
|
|
11
15
|
readonly nextMonthButtonRect: TRect;
|
|
12
16
|
nthButtonRect(index: number): TRect | null;
|
|
17
|
+
/** Change value handler, return date in ISO 8601 format */
|
|
13
18
|
addEventListener(type: 'change', listener: (e: CustomEvent<string>) => void): void;
|
|
19
|
+
/** Date value in ISO 8601 format */
|
|
14
20
|
setAttribute(name: 'value', value: string): void;
|
|
21
|
+
/** Date min limit in ISO 8601 format */
|
|
15
22
|
setAttribute(name: 'min', value: string): void;
|
|
23
|
+
/** Date max limit in ISO 8601 format */
|
|
16
24
|
setAttribute(name: 'max', value: string): void;
|
|
25
|
+
/** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
|
|
17
26
|
setAttribute(name: 'locale', value: string): void;
|
|
18
27
|
};
|
|
19
28
|
export declare type TSinchDatePickerReact = TSinchElementReact<TSinchDatePickerElement> & {
|
|
20
|
-
|
|
29
|
+
/** Date value in ISO 8601 format */
|
|
21
30
|
value: string;
|
|
31
|
+
/** Date min limit in ISO 8601 format */
|
|
22
32
|
min: string;
|
|
33
|
+
/** Date max limit in ISO 8601 format */
|
|
23
34
|
max: string;
|
|
35
|
+
/** BCP 47 language tag (e.g. en-US), which changes day and month display names in the calendar */
|
|
36
|
+
locale: string;
|
|
37
|
+
/** Label that is used for a11y */
|
|
24
38
|
'aria-label': string;
|
|
39
|
+
/** Change value handler, return date in ISO 8601 format */
|
|
25
40
|
onChange: (e: SyntheticEvent<TSinchDatePickerElement, CustomEvent<string>>) => void;
|
|
26
41
|
};
|
package/dialog/index.js
CHANGED
|
@@ -14,7 +14,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
|
14
14
|
import dialogPolyfill from 'dialog-polyfill';
|
|
15
15
|
import '../icon-button';
|
|
16
16
|
import '../icons/close';
|
|
17
|
-
import { defineCustomElement, getAttribute, getBooleanAttribute, getRect, isAttrTrue, updateAttribute, getReactEventHandler, NectaryElement } from '../utils';
|
|
17
|
+
import { defineCustomElement, getAttribute, getBooleanAttribute, getRect, isAttrTrue, updateAttribute, getReactEventHandler, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
18
18
|
const templateHTML = '<style>dialog{position:fixed;left:0;right:0;margin:auto;display:flex;flex-direction:column;padding:24px;max-width:var(--sinch-dialog-max-width,512px);max-height:unset;border-radius:var(--sinch-shape-radius-l);box-sizing:border-box;contain:content;background-color:var(--sinch-color-snow-100);color:var(--sinch-color-text-default);font:var(--sinch-font-body);border:none;box-shadow:var(--sinch-elevation-level-3)}dialog:not([open]){display:none}dialog+.backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#000;opacity:.55}dialog::backdrop{background-color:#000;opacity:.55}._dialog_overlay{position:fixed;top:0;right:0;bottom:0;left:0}dialog.fixed{position:fixed;top:50%;transform:translate(0,-50%)}#header{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;margin-bottom:16px}#caption{font:var(--sinch-font-title-m);color:var(--sinch-color-text-default);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}#content-wrapper{min-height:0;overflow:auto;max-height:var(--sinch-dialog-max-height,50vh)}#buttons{display:flex;flex-direction:row;justify-content:flex-end;gap:16px;margin-top:24px}sinch-icon-button{transform:translate(4px,-4px)}</style><dialog><div id="header"><span id="caption"></span><sinch-icon-button id="close" small tabindex="0"><sinch-icon-close slot="icon"></sinch-icon-close></sinch-icon-button></div><div id="content-wrapper"><slot name="content"></slot></div><div id="buttons"><slot name="buttons"></slot></div></dialog>';
|
|
19
19
|
const template = document.createElement('template');
|
|
20
20
|
template.innerHTML = templateHTML;
|
|
@@ -106,8 +106,38 @@ defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = n
|
|
|
106
106
|
dialogPolyfill.registerDialog(_classPrivateFieldGet(this, _$dialog));
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
connectedCallback() {
|
|
110
|
+
this.setAttribute('role', 'dialog');
|
|
111
|
+
|
|
112
|
+
_classPrivateFieldGet(this, _$closeButton).addEventListener('click', _classPrivateFieldGet(this, _onCloseClick));
|
|
113
|
+
|
|
114
|
+
_classPrivateFieldGet(this, _$dialog).addEventListener('mousedown', _classPrivateFieldGet(this, _onBackdropClick));
|
|
115
|
+
|
|
116
|
+
_classPrivateFieldGet(this, _$dialog).addEventListener('cancel', _classPrivateFieldGet(this, _onCancel));
|
|
117
|
+
|
|
118
|
+
this.addEventListener('close', _classPrivateFieldGet(this, _onCloseReactHandler));
|
|
119
|
+
|
|
120
|
+
_classPrivateFieldSet(this, _isConnected, true);
|
|
121
|
+
|
|
122
|
+
_classPrivateMethodGet(this, _setOpen, _setOpen2).call(this, getBooleanAttribute(this, 'open'));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
disconnectedCallback() {
|
|
126
|
+
_classPrivateFieldGet(this, _$closeButton).removeEventListener('click', _classPrivateFieldGet(this, _onCloseClick));
|
|
127
|
+
|
|
128
|
+
_classPrivateFieldGet(this, _$dialog).removeEventListener('mousedown', _classPrivateFieldGet(this, _onBackdropClick));
|
|
129
|
+
|
|
130
|
+
_classPrivateFieldGet(this, _$dialog).removeEventListener('cancel', _classPrivateFieldGet(this, _onCancel));
|
|
131
|
+
|
|
132
|
+
this.removeEventListener('close', _classPrivateFieldGet(this, _onCloseReactHandler));
|
|
133
|
+
|
|
134
|
+
_classPrivateMethodGet(this, _setOpen, _setOpen2).call(this, false);
|
|
135
|
+
|
|
136
|
+
_classPrivateFieldSet(this, _isConnected, false);
|
|
137
|
+
}
|
|
138
|
+
|
|
109
139
|
static get observedAttributes() {
|
|
110
|
-
return ['caption', 'open'];
|
|
140
|
+
return ['caption', 'open', 'close-aria-label'];
|
|
111
141
|
}
|
|
112
142
|
|
|
113
143
|
attributeChangedCallback(name, _, newVal) {
|
|
@@ -120,10 +150,17 @@ defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = n
|
|
|
120
150
|
|
|
121
151
|
case 'open':
|
|
122
152
|
{
|
|
123
|
-
|
|
124
|
-
_classPrivateMethodGet(this, _setOpen, _setOpen2).call(this, isAttrTrue(newVal));
|
|
125
|
-
}
|
|
153
|
+
const shouldOpen = isAttrTrue(newVal);
|
|
126
154
|
|
|
155
|
+
_classPrivateMethodGet(this, _setOpen, _setOpen2).call(this, shouldOpen);
|
|
156
|
+
|
|
157
|
+
updateBooleanAttribute(this, 'open', shouldOpen);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
case 'close-aria-label':
|
|
162
|
+
{
|
|
163
|
+
updateAttribute(_classPrivateFieldGet(this, _$closeButton), 'aria-label', newVal);
|
|
127
164
|
break;
|
|
128
165
|
}
|
|
129
166
|
}
|
|
@@ -137,36 +174,6 @@ defineCustomElement('sinch-dialog', (_$dialog = new WeakMap(), _$closeButton = n
|
|
|
137
174
|
return getAttribute(this, 'caption', '');
|
|
138
175
|
}
|
|
139
176
|
|
|
140
|
-
connectedCallback() {
|
|
141
|
-
this.setAttribute('role', 'dialog');
|
|
142
|
-
|
|
143
|
-
_classPrivateFieldGet(this, _$closeButton).addEventListener('click', _classPrivateFieldGet(this, _onCloseClick));
|
|
144
|
-
|
|
145
|
-
this.addEventListener('close', _classPrivateFieldGet(this, _onCloseReactHandler));
|
|
146
|
-
|
|
147
|
-
_classPrivateFieldGet(this, _$dialog).addEventListener('click', _classPrivateFieldGet(this, _onBackdropClick));
|
|
148
|
-
|
|
149
|
-
_classPrivateFieldGet(this, _$dialog).addEventListener('cancel', _classPrivateFieldGet(this, _onCancel));
|
|
150
|
-
|
|
151
|
-
_classPrivateFieldSet(this, _isConnected, true);
|
|
152
|
-
|
|
153
|
-
if (getBooleanAttribute(this, 'open')) {
|
|
154
|
-
_classPrivateMethodGet(this, _setOpen, _setOpen2).call(this, true);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
disconnectedCallback() {
|
|
159
|
-
_classPrivateFieldGet(this, _$closeButton).removeEventListener('click', _classPrivateFieldGet(this, _onCloseClick));
|
|
160
|
-
|
|
161
|
-
this.removeEventListener('close', _classPrivateFieldGet(this, _onCloseReactHandler));
|
|
162
|
-
|
|
163
|
-
_classPrivateFieldGet(this, _$dialog).removeEventListener('click', _classPrivateFieldGet(this, _onBackdropClick));
|
|
164
|
-
|
|
165
|
-
_classPrivateFieldGet(this, _$dialog).removeEventListener('cancel', _classPrivateFieldGet(this, _onCancel));
|
|
166
|
-
|
|
167
|
-
_classPrivateFieldSet(this, _isConnected, false);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
177
|
get dialogRect() {
|
|
171
178
|
return getRect(_classPrivateFieldGet(this, _$dialog));
|
|
172
179
|
}
|
|
@@ -183,14 +190,14 @@ function _dispatchCloseEvent2() {
|
|
|
183
190
|
}));
|
|
184
191
|
}
|
|
185
192
|
|
|
186
|
-
function _setOpen2(
|
|
187
|
-
if (
|
|
188
|
-
if (!getBooleanAttribute(_classPrivateFieldGet(this, _$dialog), 'open')) {
|
|
189
|
-
_classPrivateFieldGet(this, _$dialog).showModal();
|
|
190
|
-
|
|
193
|
+
function _setOpen2(shouldOpen) {
|
|
194
|
+
if (shouldOpen) {
|
|
195
|
+
if (_classPrivateFieldGet(this, _isConnected) && !getBooleanAttribute(_classPrivateFieldGet(this, _$dialog), 'open')) {
|
|
191
196
|
_classPrivateFieldSet(this, _prevOverflowValue, document.body.style.overflow);
|
|
192
197
|
|
|
193
198
|
document.body.style.overflow = 'hidden';
|
|
199
|
+
|
|
200
|
+
_classPrivateFieldGet(this, _$dialog).showModal();
|
|
194
201
|
}
|
|
195
202
|
} else {
|
|
196
203
|
_classPrivateFieldGet(this, _$dialog).close?.();
|
package/dialog/types.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ export declare type TSinchDialogElement = HTMLElement & {
|
|
|
6
6
|
readonly closeButtonRect: TRect;
|
|
7
7
|
addEventListener(type: 'close', listener: (e: CustomEvent<void>) => void): void;
|
|
8
8
|
setAttribute(name: 'caption', value: string): void;
|
|
9
|
+
setAttribute(name: 'close-aria-label', value: string): void;
|
|
9
10
|
};
|
|
10
11
|
export declare type TSinchDialogReact = TSinchElementReact<TSinchDialogElement> & {
|
|
11
12
|
open: boolean;
|
|
12
13
|
caption: string;
|
|
13
14
|
'aria-label': string;
|
|
15
|
+
'close-aria-label': string;
|
|
14
16
|
onClose: (event: SyntheticEvent<TSinchDialogElement, CustomEvent<void>>) => void;
|
|
15
17
|
};
|
package/dropdown/index.js
CHANGED
|
@@ -14,7 +14,7 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
|
14
14
|
import { orientationValues } from '../popover/utils';
|
|
15
15
|
import '../popover';
|
|
16
16
|
import { attrValueToPixels, defineCustomElement, getAttribute, getBooleanAttribute, getCsvSet, getFirstCsvValue, getIntegerAttribute, getLiteralAttribute, getReactEventHandler, isAttrTrue, NectaryElement, updateAttribute, updateBooleanAttribute, updateCsv, updateIntegerAttribute, updateLiteralAttribute } from '../utils';
|
|
17
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}sinch-popover{
|
|
17
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{width:100%;--sinch-popover-shape-radius:var(--sinch-shape-radius-s)}#listbox{overflow-y:auto}</style><sinch-popover id="wrapper" modal><slot name="target" slot="target"></slot><div id="listbox" slot="content"><slot name="option"></slot></div></sinch-popover>';
|
|
18
18
|
const ITEM_HEIGHT = 40;
|
|
19
19
|
const template = document.createElement('template');
|
|
20
20
|
template.innerHTML = templateHTML;
|
|
@@ -81,9 +81,13 @@ defineCustomElement('sinch-dropdown', (_$optionSlot = new WeakMap(), _$listbox =
|
|
|
81
81
|
case 'Space':
|
|
82
82
|
case 'Enter':
|
|
83
83
|
{
|
|
84
|
-
|
|
84
|
+
const $option = _classPrivateMethodGet(this, _findSelectedOption, _findSelectedOption2).call(this, _classPrivateMethodGet(this, _getEnabledOptionElements, _getEnabledOptionElements2).call(this));
|
|
85
|
+
|
|
86
|
+
if ($option !== null) {
|
|
87
|
+
e.preventDefault();
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
_classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $option);
|
|
90
|
+
}
|
|
87
91
|
|
|
88
92
|
break;
|
|
89
93
|
}
|
|
@@ -323,11 +327,13 @@ function _getPrevOption2() {
|
|
|
323
327
|
}
|
|
324
328
|
|
|
325
329
|
function _selectOption2($option) {
|
|
330
|
+
const hasMaxVisibleItems = this.hasAttribute('maxvisibleitems');
|
|
331
|
+
|
|
326
332
|
for (const $op of _classPrivateMethodGet(this, _getOptionElements, _getOptionElements2).call(this)) {
|
|
327
333
|
const isSelected = $op === $option;
|
|
328
334
|
updateBooleanAttribute($op, 'data-selected', isSelected);
|
|
329
335
|
|
|
330
|
-
if (isSelected &&
|
|
336
|
+
if (isSelected && hasMaxVisibleItems) {
|
|
331
337
|
$op.scrollIntoView?.({
|
|
332
338
|
block: 'nearest'
|
|
333
339
|
});
|
|
@@ -389,13 +395,5 @@ function _dispatchChangeEvent2($opt) {
|
|
|
389
395
|
function _onOpen2() {
|
|
390
396
|
const $opt = _classPrivateMethodGet(this, _getOptionWithValue, _getOptionWithValue2).call(this, getFirstCsvValue(this.value));
|
|
391
397
|
|
|
392
|
-
|
|
393
|
-
_classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, $opt);
|
|
394
|
-
|
|
395
|
-
$opt.scrollIntoView?.({
|
|
396
|
-
block: 'nearest'
|
|
397
|
-
});
|
|
398
|
-
} else {
|
|
399
|
-
_classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this));
|
|
400
|
-
}
|
|
398
|
+
_classPrivateMethodGet(this, _selectOption, _selectOption2).call(this, $opt ?? _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this));
|
|
401
399
|
}
|
package/dropdown/types.d.ts
CHANGED
|
@@ -8,8 +8,6 @@ export declare type TSinchDropdownElement = HTMLElement & {
|
|
|
8
8
|
value: string;
|
|
9
9
|
maxVisibleItems: number | null;
|
|
10
10
|
readonly dropdownRect: TRect;
|
|
11
|
-
focus(): void;
|
|
12
|
-
blur(): void;
|
|
13
11
|
addEventListener(type: 'change', listener: (e: CustomEvent<string>) => void): void;
|
|
14
12
|
addEventListener(type: 'close', listener: (e: CustomEvent<void>) => void): void;
|
|
15
13
|
setAttribute(name: 'open', value: ''): void;
|
package/icon-button/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedec
|
|
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
9
|
|
|
10
10
|
import { defineCustomElement, getBooleanAttribute, isAttrTrue, NectaryElement, updateBooleanAttribute } from '../utils';
|
|
11
|
-
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:48px;height:48px;border-radius:var(--sinch-shape-radius-s);border:1px solid transparent;background-color:transparent;cursor:pointer;--sinch-size-icon:24px;--sinch-color-icon:var(--sinch-icon-button-color, var(--sinch-color-stormy-500))}button:focus{border-color:var(--sinch-color-
|
|
11
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}button{all:initial;position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:48px;height:48px;border-radius:var(--sinch-shape-radius-s);border:1px solid transparent;background-color:transparent;cursor:pointer;--sinch-size-icon:24px;--sinch-color-icon:var(--sinch-icon-button-color, var(--sinch-color-stormy-500))}button:focus-visible::before{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:1px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-shape-radius-s) + 2px)}@supports not selector(:focus-visible){button:focus::before{position:absolute;content:"";left:50%;top:50%;transform:translate(-50%,-50%);width:100%;height:100%;padding:2px;border:1px solid var(--sinch-color-aqua-400);border-radius:calc(var(--sinch-shape-radius-s) + 2px)}}button:hover{background-color:var(--sinch-color-snow-500)}button:active{background-color:var(--sinch-color-snow-600)}button:disabled{background-color:transparent;cursor:initial;--sinch-color-spinner-bg:var(--sinch-color-snow-200);--sinch-color-spinner-fg:var(--sinch-color-stormy-200);--sinch-color-icon:var(--sinch-color-stormy-100)}:host([small]:not([small=false]))>button{width:32px;height:32px}button>*{pointer-events:none}</style><button><slot name="icon"></slot></button>';
|
|
12
12
|
const template = document.createElement('template');
|
|
13
13
|
template.innerHTML = templateHTML;
|
|
14
14
|
defineCustomElement('sinch-icon-button', (_$button = new WeakMap(), class extends NectaryElement {
|
package/icon-button/types.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ import type { TSinchElementReact } from '../types';
|
|
|
2
2
|
export declare type TSinchIconButtonElement = HTMLElement & {
|
|
3
3
|
disabled: boolean;
|
|
4
4
|
small: boolean;
|
|
5
|
-
focus(): void;
|
|
6
|
-
blur(): void;
|
|
7
5
|
setAttribute(name: 'disabled', value: ''): void;
|
|
8
6
|
setAttribute(name: 'small', value: ''): void;
|
|
9
7
|
};
|