@nectary/components 0.8.1 → 0.10.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 +5 -1
- package/accordion-item/index.js +7 -7
- package/alert/index.js +2 -2
- package/alert-button/index.js +1 -1
- package/alert-close/index.js +2 -2
- package/button/index.d.ts +2 -1
- package/button/index.js +7 -3
- package/checkbox/index.d.ts +3 -0
- package/checkbox/index.js +27 -18
- package/dropdown/index.d.ts +34 -0
- package/dropdown/index.js +451 -0
- package/dropdown-option/index.d.ts +44 -0
- package/dropdown-option/index.js +116 -0
- package/help-tooltip/index.js +5 -1
- package/icon/arrow-back-ios/index.d.ts +11 -0
- package/icon/arrow-back-ios/index.js +4 -0
- package/icon/arrow-forward-ios/index.d.ts +11 -0
- package/icon/arrow-forward-ios/index.js +4 -0
- package/icon/cancel/index.js +1 -1
- package/icon/chevron-left/index.d.ts +11 -0
- package/icon/chevron-left/index.js +4 -0
- package/icon/chevron-right/index.d.ts +11 -0
- package/icon/chevron-right/index.js +4 -0
- package/icon/close/index.js +1 -1
- package/icon/create-icon-class.js +1 -1
- package/icon/east/index.js +1 -1
- package/icon/expand-less/index.d.ts +11 -0
- package/icon/expand-less/index.js +4 -0
- package/icon/expand-more/index.d.ts +11 -0
- package/icon/expand-more/index.js +4 -0
- package/icon/help-outline/index.js +1 -1
- package/icon/keyboard-arrow-down/index.d.ts +11 -0
- package/icon/keyboard-arrow-down/index.js +4 -0
- package/icon/keyboard-arrow-left/index.d.ts +11 -0
- package/icon/keyboard-arrow-left/index.js +4 -0
- package/icon/keyboard-arrow-right/index.d.ts +11 -0
- package/icon/keyboard-arrow-right/index.js +4 -0
- package/icon/keyboard-arrow-up/index.d.ts +11 -0
- package/icon/keyboard-arrow-up/index.js +4 -0
- package/icon/more-horiz/index.js +1 -1
- package/icon/more-vert/index.js +1 -1
- package/icon/north/index.js +1 -1
- package/icon/north-east/index.js +1 -1
- package/icon/north-west/index.js +1 -1
- package/icon/open-in-new/index.js +1 -1
- package/icon/south/index.js +1 -1
- package/icon/south-east/index.js +1 -1
- package/icon/south-west/index.js +1 -1
- package/icon/west/index.js +1 -1
- package/icon-branded/barchart-down/index.js +1 -1
- package/icon-branded/barchart-up/index.js +1 -1
- package/icon-branded/campaigns/index.js +1 -1
- package/icon-branded/chatbot/index.js +1 -1
- package/icon-branded/contact/index.js +1 -1
- package/icon-branded/create-icon-class.js +1 -1
- package/icon-branded/home/index.js +1 -1
- package/icon-branded/multiple-channels/index.js +1 -1
- package/icon-branded/rocket/index.js +1 -1
- package/icon-branded/settings/index.js +1 -1
- package/icon-branded/user/index.js +1 -1
- package/icon-branded/users/index.js +1 -1
- package/index.d.ts +13 -0
- package/index.js +13 -0
- package/input/index.d.ts +3 -1
- package/input/index.js +59 -11
- package/link/index.js +2 -2
- package/logo/create-logo-class.js +1 -1
- package/logo/sinch-icon/index.js +1 -1
- package/logo/sinch-icon-wordmark/index.js +1 -1
- package/package.json +1 -1
- package/pagination/index.d.ts +27 -0
- package/pagination/index.js +219 -0
- package/radio/index.d.ts +1 -0
- package/radio/index.js +97 -71
- package/radio-option/index.d.ts +1 -0
- package/radio-option/index.js +4 -1
- package/select/index.d.ts +4 -1
- package/select/index.js +72 -265
- package/select-option/index.d.ts +3 -17
- package/select-option/index.js +4 -103
- package/spinner/index.js +1 -1
- package/table/index.js +1 -1
- package/table-body/index.js +1 -1
- package/table-cell/index.js +1 -1
- package/table-head/index.js +1 -1
- package/table-head-cell/index.js +3 -2
- package/table-head-sort/index.d.ts +1 -0
- package/table-head-sort/index.js +3 -1
- package/table-row/index.js +1 -1
- package/tabs/index.d.ts +1 -0
- package/tabs/index.js +96 -66
- package/tabs-option/index.d.ts +1 -0
- package/tabs-option/index.js +4 -2
- package/tag/index.js +1 -1
- package/tag-close/index.js +2 -2
- package/textarea/index.d.ts +3 -1
- package/textarea/index.js +58 -11
- package/theme.css +3 -0
- package/toggle/index.d.ts +1 -0
- package/toggle/index.js +4 -5
- package/tooltip/index.d.ts +2 -1
- package/tooltip/index.js +7 -3
- package/types.d.ts +7 -0
- package/utils.d.ts +3 -0
- package/utils.js +17 -0
package/link/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
|
9
9
|
|
|
10
10
|
import '../icon/cancel';
|
|
11
11
|
import { defineCustomElement, getBooleanAttribute, getAttribute, updateBooleanAttribute, updateAttribute } from '../utils';
|
|
12
|
-
const templateHTML = '<style>:host{display:inline;outline:0}a{font:var(--sinch-font-body);font-size:inherit;line-height:inherit;color:var(--sinch-color-text-link);fill:var(--sinch-color-text-link)}svg{display:none;transform:translateY(.15em);margin-left:.4em;width:.8em;pointer-events:none}a:hover{color:var(--sinch-color-tropical-600);fill:var(--sinch-color-tropical-600)}:host([disabled]:not([disabled=false])) a{color:var(--sinch-color-tropical-200);pointer-events:none;cursor:initial;fill:var(--sinch-color-tropical-200)}:host([external]:not([external=false])) svg{display:inline-block}</style><a><span></span><svg viewBox="0 0 16 16"><path d="M14.222 14.222H1.778V1.778H8V0H1.778C.79 0 0 .8 0 1.778v12.444C0 15.2.791 16 1.778 16h12.444C15.2 16 16 15.2 16 14.222V8h-1.778v6.222ZM9.778 0v1.778h3.19l-8.737 8.738 1.253 1.253 8.738-8.738v3.191H16V0H9.778Z"/></svg></a>';
|
|
12
|
+
const templateHTML = '<style>:host{display:inline;outline:0}a{font:var(--sinch-font-body);font-size:inherit;line-height:inherit;color:var(--sinch-color-text-link);fill:var(--sinch-color-text-link)}svg{display:none;transform:translateY(.15em);margin-left:.4em;width:.8em;pointer-events:none}a:hover{color:var(--sinch-color-tropical-600);fill:var(--sinch-color-tropical-600)}:host([disabled]:not([disabled=false])) a{color:var(--sinch-color-tropical-200);pointer-events:none;cursor:initial;fill:var(--sinch-color-tropical-200)}:host([external]:not([external=false])) svg{display:inline-block}</style><a><span></span><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M14.222 14.222H1.778V1.778H8V0H1.778C.79 0 0 .8 0 1.778v12.444C0 15.2.791 16 1.778 16h12.444C15.2 16 16 15.2 16 14.222V8h-1.778v6.222ZM9.778 0v1.778h3.19l-8.737 8.738 1.253 1.253 8.738-8.738v3.191H16V0H9.778Z"/></svg></a>';
|
|
13
13
|
const template = document.createElement('template');
|
|
14
14
|
template.innerHTML = templateHTML;
|
|
15
15
|
defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMap(), _onClick = new WeakMap(), class extends HTMLElement {
|
|
@@ -37,7 +37,7 @@ defineCustomElement('sinch-link', (_$anchor = new WeakMap(), _$text = new WeakMa
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const shadowRoot = this.attachShadow({
|
|
40
|
-
mode: '
|
|
40
|
+
mode: 'closed',
|
|
41
41
|
delegatesFocus: true
|
|
42
42
|
});
|
|
43
43
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
@@ -10,7 +10,7 @@ export const createLogoClass = templateHTML => {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super();
|
|
12
12
|
const shadowRoot = this.attachShadow({
|
|
13
|
-
mode: '
|
|
13
|
+
mode: 'closed'
|
|
14
14
|
});
|
|
15
15
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
16
16
|
this.$svg = shadowRoot.querySelector('svg');
|
package/logo/sinch-icon/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { defineCustomElement } from '../../utils';
|
|
2
2
|
import { createLogoClass } from '../create-logo-class';
|
|
3
|
-
const templateHTML = '<svg viewBox="0 0 93 48"
|
|
3
|
+
const templateHTML = '<svg viewBox="0 0 93 48" aria-hidden="true"><path d="M92.298 25.271a17.167 17.167 0 0 1-.814 5.312c-1.51 4.734-5.27 8.678-10.06 10.549-5.64 2.202-12.252 1.416-18.624-2.21l-4.649-2.67a16.424 16.424 0 0 1-3.563 3.064l-14.817 8.679-.027.015v-7.501l.027-.014 22.29-13.057a16.017 16.017 0 0 1-.713 3.206l4.656 2.65c5.95 3.386 10.388 2.85 13.065 1.806 2.991-1.167 5.323-3.59 6.245-6.483.692-2.15.679-4.467-.04-6.609-.955-2.88-3.319-5.275-6.324-6.41-2.688-1.014-7.132-1.494-13.04 1.962L29.7 38.747l-.043.028c-4.017 2.35-8.14 3.556-12.065 3.58a18.162 18.162 0 0 1-6.53-1.145C6.247 39.396 2.44 35.498.874 30.783A17.116 17.116 0 0 1 .81 20.166c1.51-4.733 5.272-8.676 10.063-10.548 5.64-2.202 12.252-1.416 18.623 2.212l4.649 2.67a16.377 16.377 0 0 1 3.563-3.067l.281-.163 1.726-1.011-7.37-4.197A3.238 3.238 0 0 1 35.551.437l10.591 6.06L56.52.457a3.238 3.238 0 0 1 3.27 5.588l-29.528 17.05c.132-1.017.36-2.019.683-2.992l-4.656-2.65c-5.946-3.383-10.384-2.847-13.061-1.803-2.991 1.167-5.325 3.59-6.247 6.481a10.623 10.623 0 0 0 .039 6.608c.956 2.882 3.321 5.277 6.324 6.41 2.689 1.012 7.136 1.495 13.042-1.966l36.256-21.208c4.017-2.349 8.14-3.555 12.067-3.579a18.112 18.112 0 0 1 6.53 1.145c4.812 1.813 8.62 5.712 10.187 10.426a17.23 17.23 0 0 1 .872 5.304Z"/></svg>';
|
|
4
4
|
defineCustomElement('sinch-logo-sinch-icon', createLogoClass(templateHTML));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { defineCustomElement } from '../../utils';
|
|
2
2
|
import { createLogoClass } from '../create-logo-class';
|
|
3
|
-
const templateHTML = '<svg viewBox="0 0 236 48"
|
|
3
|
+
const templateHTML = '<svg viewBox="0 0 236 48" aria-hidden="true"><path d="m100.82 36.72 6.606-3.801c1.299 2.603 3.5 3.903 6.602 3.9 2.914 0 4.704-1.299 4.704-3.201 0-1.902-2.498-2.498-6.806-3.401-5.903-1.303-9.703-3.7-9.703-8.704 0-5.412 5.503-9.108 11.605-9.108 5.204 0 8.804 1.403 12.006 5.411l-6.303 3.605c-1.199-2.081-3.001-3.101-5.603-3.101-2.701 0-4.2 1.199-4.2 2.802 0 1.998 3.001 2.397 7.002 3.4 5.503 1.4 9.707 3.301 9.707 8.805 0 5.702-5.603 9.603-12.609 9.603-5.802-.008-10.207-1.607-13.008-6.21Zm29.618 5.41V16.739l7.405-4.333v29.717l-7.405.009Zm12.608 0V26.517c0-8.004 5.903-14.111 14.108-14.111 8.325 0 14.107 6.506 14.107 14.111v15.606h-7.493V27.016c0-4.604-2.801-7.306-6.602-7.306-4.104 0-6.606 2.914-6.606 7.306v15.106l-7.514.009Zm32.203-14.515c0-8.904 6.402-15.21 15.402-15.21 5.603 0 10.602 2.914 13.004 7.405l-6.402 3.805a7.36 7.36 0 0 0-6.702-4.005c-4.404 0-7.705 3.302-7.705 8.005 0 4.604 3.101 8.105 7.705 8.105 3.001 0 5.603-1.503 6.802-4.004l6.402 3.704a14.887 14.887 0 0 1-13.104 7.493c-8.883.009-15.402-6.394-15.402-15.298Zm32.519 14.507V4.304L215.186 0v14.607a12.584 12.584 0 0 1 6.902-2.202c8.204 0 13.907 5.603 13.907 13.907v15.819h-7.493V27.016c0-4.604-2.801-7.306-6.602-7.306-4.104 0-6.606 2.914-6.606 7.306v15.106h-7.526ZM82.892 27.578a15.068 15.068 0 0 1-9.766 14.244C68.06 43.8 62.124 43.072 56.4 39.837l-4.162-2.398a14.752 14.752 0 0 1-3.197 2.752l-13.32 7.792h-.026v-6.722h.025l20.02-11.735a14.647 14.647 0 0 1-.641 2.876l4.162 2.381c5.345 3.04 9.333 2.56 11.735 1.624a9.484 9.484 0 0 0 5.607-5.828 9.67 9.67 0 0 0 .458-2.972 9.257 9.257 0 0 0-6.17-8.717c-2.418-.911-6.406-1.344-11.713 1.761L26.675 39.679l-.038.025c-3.605 2.11-7.31 3.197-10.823 3.217-2.001.02-3.99-.328-5.865-1.028a15.185 15.185 0 0 1-9.22-18.898 15.352 15.352 0 0 1 9.037-9.475c5.066-1.977 11.002-1.274 16.725 1.986l4.163 2.398a14.678 14.678 0 0 1 3.201-2.752l.28-.166 1.552-.908-6.619-3.746a2.915 2.915 0 0 1 2.86-5.058l9.512 5.44 9.32-5.41a2.914 2.914 0 0 1 2.939 5.007l-26.52 15.31a14.67 14.67 0 0 1 .616-2.68l-4.163-2.382c-5.341-3.038-9.325-2.56-11.73-1.619a9.317 9.317 0 0 0 .103 17.508c2.415.912 6.407 1.345 11.714-1.76l32.557-19.053c3.604-2.11 7.31-3.193 10.823-3.214 2-.02 3.987.329 5.86 1.029a15.077 15.077 0 0 1 9.937 14.128"/></svg>';
|
|
4
4
|
defineCustomElement('sinch-logo-sinch-icon-wordmark', createLogoClass(templateHTML));
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '../icon/keyboard-arrow-left';
|
|
2
|
+
import '../icon/keyboard-arrow-right';
|
|
3
|
+
import type { TSinchElementReact } from '../types';
|
|
4
|
+
import type { FocusEvent, SyntheticEvent } from 'react';
|
|
5
|
+
export declare type TSinchPaginationElement = HTMLElement & {
|
|
6
|
+
value: number;
|
|
7
|
+
max: number;
|
|
8
|
+
focus(): void;
|
|
9
|
+
blur(): void;
|
|
10
|
+
};
|
|
11
|
+
export declare type TSinchPaginationReact = TSinchElementReact<TSinchPaginationElement> & {
|
|
12
|
+
value: number;
|
|
13
|
+
max: number;
|
|
14
|
+
onChange: (event: SyntheticEvent<TSinchPaginationElement, CustomEvent<number>>) => void;
|
|
15
|
+
onFocus?: (e: FocusEvent<TSinchPaginationElement>) => void;
|
|
16
|
+
onBlur?: (e: FocusEvent<TSinchPaginationElement>) => void;
|
|
17
|
+
};
|
|
18
|
+
declare global {
|
|
19
|
+
namespace JSX {
|
|
20
|
+
interface IntrinsicElements {
|
|
21
|
+
'sinch-pagination': TSinchPaginationReact;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
'sinch-pagination': TSinchPaginationElement;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
2
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
3
|
+
|
|
4
|
+
var _$left, _$right, _$buttons, _$wrapper, _onValueChange, _onButtonClick, _clamp, _dispatchChangeEvent;
|
|
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
|
+
import '../icon/keyboard-arrow-left';
|
|
15
|
+
import '../icon/keyboard-arrow-right';
|
|
16
|
+
import { defineCustomElement, updateAttribute, getIntegerAttribute, setClass } from '../utils';
|
|
17
|
+
const templateHTML = '<style>:host{display:inline-block;vertical-align:middle;outline:0}#wrapper{display:flex;justify-content:center;gap:8px;width:100%;box-sizing:border-box}button{all:initial;width:28px;height:28px;box-sizing:border-box;cursor:pointer;text-align:center;contain:strict;--sinch-color-icon:var(--sinch-color-stormy-500)}button:disabled{--sinch-color-icon:var(--sinch-color-stormy-100);cursor:initial}button>*{pointer-events:none}.page{border-radius:50%;font:var(--sinch-font-body);color:var(--sinch-color-stormy-500)}.page.dots>span{display:none}.page.dots::after{content:"..."}.page.active{font:var(--sinch-font-emphasized-body);background-color:var(--sinch-color-snow-600);pointer-events:none;cursor:initial}.page.hidden{display:none}</style><div id="wrapper"><button id="left"><sinch-icon-keyboard-arrow-left></sinch-icon-keyboard-arrow-left></button> <button class="page"><span>1</span></button> <button class="page active"><span>2</span></button> <button class="page"><span>3</span></button> <button class="page"><span>4</span></button> <button class="page"><span>5</span></button> <button class="page dots"><span>6</span></button> <button class="page"><span>20</span></button> <button id="right"><sinch-icon-keyboard-arrow-right></sinch-icon-keyboard-arrow-right></button></div>';
|
|
18
|
+
const NUM_BUTTONS = 7;
|
|
19
|
+
const MIDDLE_BTN_INDEX = Math.floor(NUM_BUTTONS / 2);
|
|
20
|
+
const FIRST_BTN_INDEX = 0;
|
|
21
|
+
const LAST_BTN_INDEX = NUM_BUTTONS - 1;
|
|
22
|
+
const DOTS_LEFT_INDEX = 1;
|
|
23
|
+
const DOTS_RIGHT_INDEX = LAST_BTN_INDEX - 1;
|
|
24
|
+
const template = document.createElement('template');
|
|
25
|
+
template.innerHTML = templateHTML;
|
|
26
|
+
defineCustomElement('sinch-pagination', (_$left = new WeakMap(), _$right = new WeakMap(), _$buttons = new WeakMap(), _$wrapper = new WeakMap(), _onValueChange = new WeakSet(), _onButtonClick = new WeakMap(), _clamp = new WeakSet(), _dispatchChangeEvent = new WeakSet(), class extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
|
|
30
|
+
_classPrivateMethodInitSpec(this, _dispatchChangeEvent);
|
|
31
|
+
|
|
32
|
+
_classPrivateMethodInitSpec(this, _clamp);
|
|
33
|
+
|
|
34
|
+
_classPrivateMethodInitSpec(this, _onValueChange);
|
|
35
|
+
|
|
36
|
+
_classPrivateFieldInitSpec(this, _$left, {
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
_classPrivateFieldInitSpec(this, _$right, {
|
|
42
|
+
writable: true,
|
|
43
|
+
value: void 0
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
_classPrivateFieldInitSpec(this, _$buttons, {
|
|
47
|
+
writable: true,
|
|
48
|
+
value: void 0
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
_classPrivateFieldInitSpec(this, _$wrapper, {
|
|
52
|
+
writable: true,
|
|
53
|
+
value: void 0
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
_classPrivateFieldInitSpec(this, _onButtonClick, {
|
|
57
|
+
writable: true,
|
|
58
|
+
value: e => {
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
const value = getIntegerAttribute(this, 'value', 0) - 1;
|
|
61
|
+
const max = Math.max(0, getIntegerAttribute(this, 'max', 0));
|
|
62
|
+
|
|
63
|
+
if (e.target === _classPrivateFieldGet(this, _$left)) {
|
|
64
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, value - 1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (e.target === _classPrivateFieldGet(this, _$right)) {
|
|
68
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, value + 1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const btnIndex = Array.prototype.indexOf.call(_classPrivateFieldGet(this, _$wrapper).children, e.target) - 1;
|
|
72
|
+
|
|
73
|
+
if (btnIndex >= 0 && btnIndex < _classPrivateFieldGet(this, _$buttons).length) {
|
|
74
|
+
if (btnIndex === FIRST_BTN_INDEX) {
|
|
75
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, 0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (btnIndex === _classPrivateFieldGet(this, _$buttons).length - 1) {
|
|
79
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, max - 1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (btnIndex === DOTS_LEFT_INDEX && max > NUM_BUTTONS && value > MIDDLE_BTN_INDEX) {
|
|
83
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, Math.floor(value / 2));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (btnIndex === DOTS_RIGHT_INDEX && max > NUM_BUTTONS && value <= max - DOTS_RIGHT_INDEX) {
|
|
87
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, Math.floor((max - value) / 2 + value));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, btnIndex + Math.min(Math.max(0, value - MIDDLE_BTN_INDEX), Math.max(0, max - NUM_BUTTONS)));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const shadowRoot = this.attachShadow({
|
|
96
|
+
mode: 'production' === 'development' ? 'open' : 'closed',
|
|
97
|
+
delegatesFocus: true
|
|
98
|
+
});
|
|
99
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
100
|
+
|
|
101
|
+
_classPrivateFieldSet(this, _$left, shadowRoot.querySelector('#left'));
|
|
102
|
+
|
|
103
|
+
_classPrivateFieldSet(this, _$right, shadowRoot.querySelector('#right'));
|
|
104
|
+
|
|
105
|
+
_classPrivateFieldSet(this, _$buttons, shadowRoot.querySelectorAll('.page'));
|
|
106
|
+
|
|
107
|
+
_classPrivateFieldSet(this, _$wrapper, shadowRoot.querySelector('#wrapper'));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
connectedCallback() {
|
|
111
|
+
_classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
|
|
112
|
+
|
|
113
|
+
_classPrivateFieldGet(this, _$wrapper).addEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
disconnectedCallback() {
|
|
117
|
+
_classPrivateFieldGet(this, _$wrapper).removeEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
static get observedAttributes() {
|
|
121
|
+
return ['max', 'value'];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
attributeChangedCallback(name, _) {
|
|
125
|
+
switch (name) {
|
|
126
|
+
case 'value':
|
|
127
|
+
{
|
|
128
|
+
_classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
case 'max':
|
|
134
|
+
{
|
|
135
|
+
_classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
|
|
136
|
+
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
get nodeName() {
|
|
143
|
+
return 'select';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
set value(val) {
|
|
147
|
+
updateAttribute(this, 'value', val);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
get value() {
|
|
151
|
+
return getIntegerAttribute(this, 'value', 0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
set max(val) {
|
|
155
|
+
updateAttribute(this, 'max', val);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
get max() {
|
|
159
|
+
return getIntegerAttribute(this, 'value', 0);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
focus() {
|
|
163
|
+
_classPrivateFieldGet(this, _$left).focus();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
blur() {
|
|
167
|
+
_classPrivateFieldGet(this, _$left).blur();
|
|
168
|
+
|
|
169
|
+
_classPrivateFieldGet(this, _$right).blur();
|
|
170
|
+
|
|
171
|
+
_classPrivateFieldGet(this, _$buttons).forEach($b => $b.blur());
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
}));
|
|
175
|
+
|
|
176
|
+
function _onValueChange2() {
|
|
177
|
+
const value = getIntegerAttribute(this, 'value', 0) - 1;
|
|
178
|
+
const max = Math.max(0, getIntegerAttribute(this, 'max', 0));
|
|
179
|
+
const valueOffset = Math.min(Math.max(0, value - MIDDLE_BTN_INDEX), Math.max(0, max - NUM_BUTTONS));
|
|
180
|
+
|
|
181
|
+
for (let i = 0; i < _classPrivateFieldGet(this, _$buttons).length; i++) {
|
|
182
|
+
const $b = _classPrivateFieldGet(this, _$buttons)[i];
|
|
183
|
+
|
|
184
|
+
if (value < 3) {
|
|
185
|
+
setClass($b, 'active', value === i);
|
|
186
|
+
} else if (value >= max - MIDDLE_BTN_INDEX) {
|
|
187
|
+
setClass($b, 'active', i + valueOffset === value);
|
|
188
|
+
} else {
|
|
189
|
+
setClass($b, 'active', i === MIDDLE_BTN_INDEX);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (max > NUM_BUTTONS) {
|
|
193
|
+
setClass($b, 'dots', i === DOTS_LEFT_INDEX && value > MIDDLE_BTN_INDEX || i === DOTS_RIGHT_INDEX && value <= max - DOTS_RIGHT_INDEX);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
setClass($b, 'hidden', i >= max);
|
|
197
|
+
const btnText = $b.firstElementChild;
|
|
198
|
+
|
|
199
|
+
if (btnText != null) {
|
|
200
|
+
btnText.textContent = i === FIRST_BTN_INDEX ? '1' : i === LAST_BTN_INDEX ? String(max) : String(i + 1 + valueOffset);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const isValueBad = value < 0 || value >= max;
|
|
205
|
+
_classPrivateFieldGet(this, _$left).disabled = isValueBad || value === 0;
|
|
206
|
+
_classPrivateFieldGet(this, _$right).disabled = isValueBad || value === max - 1;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function _clamp2(value, max) {
|
|
210
|
+
return Math.max(0, Math.min(max - 1, value));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function _dispatchChangeEvent2(value) {
|
|
214
|
+
const max = getIntegerAttribute(this, 'max', 0);
|
|
215
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
216
|
+
detail: _classPrivateMethodGet(this, _clamp, _clamp2).call(this, value, max) + 1,
|
|
217
|
+
bubbles: true
|
|
218
|
+
}));
|
|
219
|
+
}
|
package/radio/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare type TSinchRadioElement = HTMLElement & {
|
|
|
5
5
|
};
|
|
6
6
|
export declare type TSinchRadioReact = TSinchElementReact<TSinchRadioElement> & {
|
|
7
7
|
value: string;
|
|
8
|
+
'aria-label': string;
|
|
8
9
|
onChange: (event: SyntheticEvent<TSinchRadioElement, CustomEvent<boolean>>) => void;
|
|
9
10
|
};
|
|
10
11
|
declare global {
|
package/radio/index.js
CHANGED
|
@@ -1,73 +1,43 @@
|
|
|
1
1
|
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
|
|
2
2
|
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
|
|
3
3
|
|
|
4
|
-
var _$slot, _onOptionKeyDown, _onSlotChange, _onOptionChange;
|
|
4
|
+
var _$slot, _onOptionKeyDown, _onSlotChange, _onOptionChange, _onValueChange, _dispatchChangeEvent, _getFirstOption, _getLastOption, _getNextOption, _getPrevOption, _getEnabledRadioElements;
|
|
5
|
+
|
|
6
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
5
7
|
|
|
6
8
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
7
9
|
|
|
8
10
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
|
9
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
|
+
|
|
10
14
|
import { isRadioOptionElement } from '../radio-option';
|
|
11
15
|
import { defineCustomElement, getAttribute, updateAttribute } from '../utils';
|
|
12
16
|
const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:column;gap:8px;box-sizing:border-box;width:100%}</style><div id="wrapper"><slot></slot></div>';
|
|
13
17
|
|
|
14
|
-
const getEnabledRadioElements = $slot => {
|
|
15
|
-
return $slot.assignedElements().filter(opt => isRadioOptionElement(opt) && opt.disabled !== true);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
18
|
const findSelectedOption = elements => {
|
|
19
19
|
return elements.find(el => el.checked) ?? null;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getLastOption = $slot => {
|
|
33
|
-
for (const $option of $slot.assignedElements().reverse()) {
|
|
34
|
-
if (isRadioOptionElement($option) && $option.disabled !== true) {
|
|
35
|
-
return $option;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return null;
|
|
40
|
-
};
|
|
22
|
+
const template = document.createElement('template');
|
|
23
|
+
template.innerHTML = templateHTML;
|
|
24
|
+
defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), _onValueChange = new WeakSet(), _dispatchChangeEvent = new WeakSet(), _getFirstOption = new WeakSet(), _getLastOption = new WeakSet(), _getNextOption = new WeakSet(), _getPrevOption = new WeakSet(), _getEnabledRadioElements = new WeakSet(), class extends HTMLElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
41
27
|
|
|
42
|
-
|
|
43
|
-
const $options = getEnabledRadioElements($slot);
|
|
44
|
-
const $selectedOption = findSelectedOption($options);
|
|
45
|
-
const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
|
|
28
|
+
_classPrivateMethodInitSpec(this, _getEnabledRadioElements);
|
|
46
29
|
|
|
47
|
-
|
|
48
|
-
return getFirstOption($slot);
|
|
49
|
-
}
|
|
30
|
+
_classPrivateMethodInitSpec(this, _getPrevOption);
|
|
50
31
|
|
|
51
|
-
|
|
52
|
-
};
|
|
32
|
+
_classPrivateMethodInitSpec(this, _getNextOption);
|
|
53
33
|
|
|
54
|
-
|
|
55
|
-
const $options = getEnabledRadioElements($slot);
|
|
56
|
-
const $selectedOption = findSelectedOption($options);
|
|
57
|
-
const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
|
|
34
|
+
_classPrivateMethodInitSpec(this, _getLastOption);
|
|
58
35
|
|
|
59
|
-
|
|
60
|
-
return getLastOption($slot);
|
|
61
|
-
}
|
|
36
|
+
_classPrivateMethodInitSpec(this, _getFirstOption);
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
};
|
|
38
|
+
_classPrivateMethodInitSpec(this, _dispatchChangeEvent);
|
|
65
39
|
|
|
66
|
-
|
|
67
|
-
template.innerHTML = templateHTML;
|
|
68
|
-
defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = new WeakMap(), _onSlotChange = new WeakMap(), _onOptionChange = new WeakMap(), class extends HTMLElement {
|
|
69
|
-
constructor() {
|
|
70
|
-
super();
|
|
40
|
+
_classPrivateMethodInitSpec(this, _onValueChange);
|
|
71
41
|
|
|
72
42
|
_classPrivateFieldInitSpec(this, _$slot, {
|
|
73
43
|
writable: true,
|
|
@@ -82,11 +52,13 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
|
|
|
82
52
|
case 'ArrowLeft':
|
|
83
53
|
{
|
|
84
54
|
e.preventDefault();
|
|
85
|
-
|
|
55
|
+
|
|
56
|
+
const $option = _classPrivateMethodGet(this, _getPrevOption, _getPrevOption2).call(this);
|
|
86
57
|
|
|
87
58
|
if ($option !== null) {
|
|
88
59
|
$option.focus();
|
|
89
|
-
|
|
60
|
+
|
|
61
|
+
_classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $option.value);
|
|
90
62
|
}
|
|
91
63
|
|
|
92
64
|
break;
|
|
@@ -96,11 +68,13 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
|
|
|
96
68
|
case 'ArrowRight':
|
|
97
69
|
{
|
|
98
70
|
e.preventDefault();
|
|
99
|
-
|
|
71
|
+
|
|
72
|
+
const $option = _classPrivateMethodGet(this, _getNextOption, _getNextOption2).call(this);
|
|
100
73
|
|
|
101
74
|
if ($option !== null) {
|
|
102
75
|
$option.focus();
|
|
103
|
-
|
|
76
|
+
|
|
77
|
+
_classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, $option.value);
|
|
104
78
|
}
|
|
105
79
|
|
|
106
80
|
break;
|
|
@@ -112,7 +86,7 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
|
|
|
112
86
|
_classPrivateFieldInitSpec(this, _onSlotChange, {
|
|
113
87
|
writable: true,
|
|
114
88
|
value: () => {
|
|
115
|
-
this.
|
|
89
|
+
_classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, this.value);
|
|
116
90
|
}
|
|
117
91
|
});
|
|
118
92
|
|
|
@@ -120,12 +94,13 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
|
|
|
120
94
|
writable: true,
|
|
121
95
|
value: e => {
|
|
122
96
|
e.stopPropagation();
|
|
123
|
-
|
|
97
|
+
|
|
98
|
+
_classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, e.detail);
|
|
124
99
|
}
|
|
125
100
|
});
|
|
126
101
|
|
|
127
102
|
const shadowRoot = this.attachShadow({
|
|
128
|
-
mode: '
|
|
103
|
+
mode: 'closed',
|
|
129
104
|
delegatesFocus: true
|
|
130
105
|
});
|
|
131
106
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
@@ -137,16 +112,16 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
|
|
|
137
112
|
_classPrivateFieldGet(this, _$slot).addEventListener('slotchange', _classPrivateFieldGet(this, _onSlotChange));
|
|
138
113
|
}
|
|
139
114
|
|
|
140
|
-
|
|
141
|
-
|
|
115
|
+
connectedCallback() {
|
|
116
|
+
this.setAttribute('role', 'radiogroup');
|
|
142
117
|
}
|
|
143
118
|
|
|
144
|
-
get
|
|
145
|
-
return '
|
|
119
|
+
static get observedAttributes() {
|
|
120
|
+
return ['value'];
|
|
146
121
|
}
|
|
147
122
|
|
|
148
123
|
get nodeName() {
|
|
149
|
-
return '
|
|
124
|
+
return 'select';
|
|
150
125
|
}
|
|
151
126
|
|
|
152
127
|
set value(value) {
|
|
@@ -161,25 +136,76 @@ defineCustomElement('sinch-radio', (_$slot = new WeakMap(), _onOptionKeyDown = n
|
|
|
161
136
|
switch (name) {
|
|
162
137
|
case 'value':
|
|
163
138
|
{
|
|
164
|
-
this.
|
|
139
|
+
_classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this, newVal ?? '');
|
|
140
|
+
|
|
165
141
|
break;
|
|
166
142
|
}
|
|
167
143
|
}
|
|
168
144
|
}
|
|
169
145
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
146
|
+
}));
|
|
147
|
+
|
|
148
|
+
function _onValueChange2(value) {
|
|
149
|
+
for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements()) {
|
|
150
|
+
if (isRadioOptionElement($option)) {
|
|
151
|
+
$option.checked = $option.disabled !== true && $option.value === value;
|
|
175
152
|
}
|
|
176
153
|
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function _dispatchChangeEvent2(value) {
|
|
157
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
158
|
+
detail: value,
|
|
159
|
+
bubbles: true
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
177
162
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
163
|
+
function _getFirstOption2() {
|
|
164
|
+
for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements()) {
|
|
165
|
+
if (isRadioOptionElement($option) && $option.disabled !== true) {
|
|
166
|
+
return $option;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function _getLastOption2() {
|
|
174
|
+
for (const $option of _classPrivateFieldGet(this, _$slot).assignedElements().reverse()) {
|
|
175
|
+
if (isRadioOptionElement($option) && $option.disabled !== true) {
|
|
176
|
+
return $option;
|
|
177
|
+
}
|
|
183
178
|
}
|
|
184
179
|
|
|
185
|
-
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function _getNextOption2() {
|
|
184
|
+
const $options = _classPrivateMethodGet(this, _getEnabledRadioElements, _getEnabledRadioElements2).call(this);
|
|
185
|
+
|
|
186
|
+
const $selectedOption = findSelectedOption($options);
|
|
187
|
+
const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
|
|
188
|
+
|
|
189
|
+
if (currentIndex < 0) {
|
|
190
|
+
return _classPrivateMethodGet(this, _getFirstOption, _getFirstOption2).call(this);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return $options[(currentIndex + 1) % $options.length];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function _getPrevOption2() {
|
|
197
|
+
const $options = _classPrivateMethodGet(this, _getEnabledRadioElements, _getEnabledRadioElements2).call(this);
|
|
198
|
+
|
|
199
|
+
const $selectedOption = findSelectedOption($options);
|
|
200
|
+
const currentIndex = $selectedOption !== null ? $options.indexOf($selectedOption) : -1;
|
|
201
|
+
|
|
202
|
+
if (currentIndex < 0) {
|
|
203
|
+
return _classPrivateMethodGet(this, _getLastOption, _getLastOption2).call(this);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return $options[(currentIndex - 1 + $options.length) % $options.length];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function _getEnabledRadioElements2() {
|
|
210
|
+
return _classPrivateFieldGet(this, _$slot).assignedElements().filter(opt => isRadioOptionElement(opt) && opt.disabled !== true);
|
|
211
|
+
}
|
package/radio-option/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare type TSinchRadioOptionReact = TSinchElementReact<TSinchRadioOptio
|
|
|
13
13
|
value: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
text: string;
|
|
16
|
+
'aria-label': string;
|
|
16
17
|
onFocus?: (e: FocusEvent<TSinchRadioOptionElement>) => void;
|
|
17
18
|
onBlur?: (e: FocusEvent<TSinchRadioOptionElement>) => void;
|
|
18
19
|
};
|
package/radio-option/index.js
CHANGED
|
@@ -41,7 +41,7 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
const shadowRoot = this.attachShadow({
|
|
44
|
-
mode: '
|
|
44
|
+
mode: 'closed',
|
|
45
45
|
delegatesFocus: true
|
|
46
46
|
});
|
|
47
47
|
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
@@ -52,6 +52,8 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
connectedCallback() {
|
|
55
|
+
this.setAttribute('role', 'radio');
|
|
56
|
+
|
|
55
57
|
_classPrivateFieldGet(this, _$input).addEventListener('input', _classPrivateFieldGet(this, _onInput));
|
|
56
58
|
}
|
|
57
59
|
|
|
@@ -106,6 +108,7 @@ defineCustomElement('sinch-radio-option', (_$input = new WeakMap(), _$label = ne
|
|
|
106
108
|
case 'checked':
|
|
107
109
|
{
|
|
108
110
|
_classPrivateFieldGet(this, _$input).checked = isAttrTrue(newVal);
|
|
111
|
+
updateAttribute(this, 'aria-checked', isAttrTrue(newVal));
|
|
109
112
|
break;
|
|
110
113
|
}
|
|
111
114
|
|
package/select/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../select-option';
|
|
2
|
+
import type { TRect, TSinchElementReact } from '../types';
|
|
2
3
|
import type { FocusEvent, SyntheticEvent } from 'react';
|
|
3
4
|
export declare type TSinchSelectElement = HTMLElement & {
|
|
4
5
|
value: string;
|
|
@@ -9,6 +10,7 @@ export declare type TSinchSelectElement = HTMLElement & {
|
|
|
9
10
|
additionalText: string | null;
|
|
10
11
|
disabled: boolean;
|
|
11
12
|
maxVisibleItems: number | null;
|
|
13
|
+
readonly dropdownRect: TRect;
|
|
12
14
|
focus(): void;
|
|
13
15
|
blur(): void;
|
|
14
16
|
};
|
|
@@ -21,6 +23,7 @@ export declare type TSinchSelectReact = TSinchElementReact<TSinchSelectElement>
|
|
|
21
23
|
additionalText?: string;
|
|
22
24
|
disabled?: boolean;
|
|
23
25
|
maxVisibleItems?: number;
|
|
26
|
+
'aria-label': string;
|
|
24
27
|
onChange: (e: SyntheticEvent<TSinchSelectElement, CustomEvent<string>>) => void;
|
|
25
28
|
onFocus?: (e: FocusEvent<TSinchSelectElement>) => void;
|
|
26
29
|
onBlur?: (e: FocusEvent<TSinchSelectElement>) => void;
|