@nectary/components 0.8.1 → 0.9.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.
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-arrow-back-ios': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-arrow-back-ios': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M16.62 2.99a1.25 1.25 0 0 0-1.77 0L6.54 11.3a.996.996 0 0 0 0 1.41l8.31 8.31c.49.49 1.28.49 1.77 0s.49-1.28 0-1.77L9.38 12l7.25-7.25c.48-.48.48-1.28-.01-1.76Z"/></svg>';
4
+ defineCustomElement('sinch-icon-arrow-back-ios', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-arrow-forward-ios': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-arrow-forward-ios': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M7.38 21.01c.49.49 1.28.49 1.77 0l8.31-8.31a.996.996 0 0 0 0-1.41L9.15 2.98a1.25 1.25 0 0 0-1.77 0 1.25 1.25 0 0 0 0 1.77L14.62 12l-7.25 7.25c-.48.48-.48 1.28.01 1.76Z"/></svg>';
4
+ defineCustomElement('sinch-icon-arrow-forward-ios', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-chevron-left': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-chevron-left': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M14.71 6.71a.996.996 0 0 0-1.41 0L8.71 11.3a.996.996 0 0 0 0 1.41l4.59 4.59a.996.996 0 1 0 1.41-1.41L10.83 12l3.88-3.88c.39-.39.38-1.03 0-1.41Z"/></svg>';
4
+ defineCustomElement('sinch-icon-chevron-left', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-chevron-right': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-chevron-right': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M9.29 6.71a.996.996 0 0 0 0 1.41L13.17 12l-3.88 3.88a.996.996 0 1 0 1.41 1.41l4.59-4.59a.996.996 0 0 0 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01Z"/></svg>';
4
+ defineCustomElement('sinch-icon-chevron-right', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-expand-less': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-expand-less': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M11.29 8.71 6.7 13.3a.996.996 0 1 0 1.41 1.41L12 10.83l3.88 3.88a.996.996 0 1 0 1.41-1.41L12.7 8.71a.996.996 0 0 0-1.41 0Z"/></svg>';
4
+ defineCustomElement('sinch-icon-expand-less', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-expand-more': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-expand-more': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M15.88 9.29 12 13.17 8.12 9.29a.996.996 0 1 0-1.41 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59a.996.996 0 0 0 0-1.41c-.39-.38-1.03-.39-1.42 0Z"/></svg>';
4
+ defineCustomElement('sinch-icon-expand-more', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-keyboard-arrow-down': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-keyboard-arrow-down': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M8.12 9.29 12 13.17l3.88-3.88a.996.996 0 1 1 1.41 1.41l-4.59 4.59a.996.996 0 0 1-1.41 0L6.7 10.7a.996.996 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0Z"/></svg>';
4
+ defineCustomElement('sinch-icon-keyboard-arrow-down', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-keyboard-arrow-left': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-keyboard-arrow-left': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M14.71 15.88 10.83 12l3.88-3.88a.996.996 0 1 0-1.41-1.41L8.71 11.3a.996.996 0 0 0 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0 .38-.39.39-1.03 0-1.42Z"/></svg>';
4
+ defineCustomElement('sinch-icon-keyboard-arrow-left', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-keyboard-arrow-right': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-keyboard-arrow-right': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M9.29 15.88 13.17 12 9.29 8.12a.996.996 0 1 1 1.41-1.41l4.59 4.59c.39.39.39 1.02 0 1.41L10.7 17.3a.996.996 0 0 1-1.41 0c-.38-.39-.39-1.03 0-1.42Z"/></svg>';
4
+ defineCustomElement('sinch-icon-keyboard-arrow-right', createIconClass(templateHTML));
@@ -0,0 +1,11 @@
1
+ import type { TSinchIconElement, TSinchIconReact } from '../types';
2
+ declare global {
3
+ namespace JSX {
4
+ interface IntrinsicElements {
5
+ 'sinch-icon-keyboard-arrow-up': TSinchIconReact;
6
+ }
7
+ }
8
+ interface HTMLElementTagNameMap {
9
+ 'sinch-icon-keyboard-arrow-up': TSinchIconElement;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ import { defineCustomElement } from '../../utils';
2
+ import { createIconClass } from '../create-icon-class';
3
+ const templateHTML = '<svg viewBox="0 0 24 24"><path d="M8.12 14.71 12 10.83l3.88 3.88a.996.996 0 1 0 1.41-1.41L12.7 8.71a.996.996 0 0 0-1.41 0L6.7 13.3a.996.996 0 0 0 0 1.41c.39.38 1.03.39 1.42 0Z"/></svg>';
4
+ defineCustomElement('sinch-icon-keyboard-arrow-up', createIconClass(templateHTML));
package/index.d.ts CHANGED
@@ -19,6 +19,16 @@ import './tag-close';
19
19
  import './textarea';
20
20
  import './toggle';
21
21
  import './tooltip';
22
+ import './icon/keyboard-arrow-down';
23
+ import './icon/keyboard-arrow-left';
24
+ import './icon/keyboard-arrow-right';
25
+ import './icon/keyboard-arrow-up';
26
+ import './icon/chevron-left';
27
+ import './icon/chevron-right';
28
+ import './icon/expand-less';
29
+ import './icon/expand-more';
30
+ import './icon/arrow-back-ios';
31
+ import './icon/arrow-forward-ios';
22
32
  import './icon/cancel';
23
33
  import './icon/close';
24
34
  import './icon/east';
@@ -33,6 +43,7 @@ import './icon/south';
33
43
  import './icon/south-east';
34
44
  import './icon/south-west';
35
45
  import './icon/west';
46
+ import './pagination';
36
47
  import './table';
37
48
  import './table-cell';
38
49
  import './table-head';
package/index.js CHANGED
@@ -19,6 +19,16 @@ import './tag-close';
19
19
  import './textarea';
20
20
  import './toggle';
21
21
  import './tooltip';
22
+ import './icon/keyboard-arrow-down';
23
+ import './icon/keyboard-arrow-left';
24
+ import './icon/keyboard-arrow-right';
25
+ import './icon/keyboard-arrow-up';
26
+ import './icon/chevron-left';
27
+ import './icon/chevron-right';
28
+ import './icon/expand-less';
29
+ import './icon/expand-more';
30
+ import './icon/arrow-back-ios';
31
+ import './icon/arrow-forward-ios';
22
32
  import './icon/cancel';
23
33
  import './icon/close';
24
34
  import './icon/east';
@@ -33,6 +43,7 @@ import './icon/south';
33
43
  import './icon/south-east';
34
44
  import './icon/south-west';
35
45
  import './icon/west';
46
+ import './pagination';
36
47
  import './table';
37
48
  import './table-cell';
38
49
  import './table-head';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "files": [
5
5
  "theme.css",
6
6
  "**/*/*.js",
@@ -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,224 @@
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 } 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
+
25
+ const setClass = (elem, name, isSet) => {
26
+ isSet ? elem.classList.add(name) : elem.classList.remove(name);
27
+ };
28
+
29
+ const template = document.createElement('template');
30
+ template.innerHTML = templateHTML;
31
+ 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 {
32
+ constructor() {
33
+ super();
34
+
35
+ _classPrivateMethodInitSpec(this, _dispatchChangeEvent);
36
+
37
+ _classPrivateMethodInitSpec(this, _clamp);
38
+
39
+ _classPrivateMethodInitSpec(this, _onValueChange);
40
+
41
+ _classPrivateFieldInitSpec(this, _$left, {
42
+ writable: true,
43
+ value: void 0
44
+ });
45
+
46
+ _classPrivateFieldInitSpec(this, _$right, {
47
+ writable: true,
48
+ value: void 0
49
+ });
50
+
51
+ _classPrivateFieldInitSpec(this, _$buttons, {
52
+ writable: true,
53
+ value: void 0
54
+ });
55
+
56
+ _classPrivateFieldInitSpec(this, _$wrapper, {
57
+ writable: true,
58
+ value: void 0
59
+ });
60
+
61
+ _classPrivateFieldInitSpec(this, _onButtonClick, {
62
+ writable: true,
63
+ value: e => {
64
+ e.stopPropagation();
65
+ const value = getIntegerAttribute(this, 'value', 0) - 1;
66
+ const max = Math.max(0, getIntegerAttribute(this, 'max', 0));
67
+
68
+ if (e.target === _classPrivateFieldGet(this, _$left)) {
69
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, value - 1);
70
+ }
71
+
72
+ if (e.target === _classPrivateFieldGet(this, _$right)) {
73
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, value + 1);
74
+ }
75
+
76
+ const btnIndex = Array.prototype.indexOf.call(_classPrivateFieldGet(this, _$wrapper).children, e.target) - 1;
77
+
78
+ if (btnIndex >= 0 && btnIndex < _classPrivateFieldGet(this, _$buttons).length) {
79
+ if (btnIndex === FIRST_BTN_INDEX) {
80
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, 0);
81
+ }
82
+
83
+ if (btnIndex === _classPrivateFieldGet(this, _$buttons).length - 1) {
84
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, max - 1);
85
+ }
86
+
87
+ if (btnIndex === DOTS_LEFT_INDEX && max > NUM_BUTTONS && value > MIDDLE_BTN_INDEX) {
88
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, Math.floor(value / 2));
89
+ }
90
+
91
+ if (btnIndex === DOTS_RIGHT_INDEX && max > NUM_BUTTONS && value <= max - DOTS_RIGHT_INDEX) {
92
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, Math.floor((max - value) / 2 + value));
93
+ }
94
+
95
+ return _classPrivateMethodGet(this, _dispatchChangeEvent, _dispatchChangeEvent2).call(this, btnIndex + Math.min(Math.max(0, value - MIDDLE_BTN_INDEX), Math.max(0, max - NUM_BUTTONS)));
96
+ }
97
+ }
98
+ });
99
+
100
+ const shadowRoot = this.attachShadow({
101
+ mode: 'production' === 'development' ? 'open' : 'closed',
102
+ delegatesFocus: true
103
+ });
104
+ shadowRoot.appendChild(template.content.cloneNode(true));
105
+
106
+ _classPrivateFieldSet(this, _$left, shadowRoot.querySelector('#left'));
107
+
108
+ _classPrivateFieldSet(this, _$right, shadowRoot.querySelector('#right'));
109
+
110
+ _classPrivateFieldSet(this, _$buttons, shadowRoot.querySelectorAll('.page'));
111
+
112
+ _classPrivateFieldSet(this, _$wrapper, shadowRoot.querySelector('#wrapper'));
113
+ }
114
+
115
+ connectedCallback() {
116
+ _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
117
+
118
+ _classPrivateFieldGet(this, _$wrapper).addEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
119
+ }
120
+
121
+ disconnectedCallback() {
122
+ _classPrivateFieldGet(this, _$wrapper).removeEventListener('click', _classPrivateFieldGet(this, _onButtonClick));
123
+ }
124
+
125
+ static get observedAttributes() {
126
+ return ['max', 'value'];
127
+ }
128
+
129
+ attributeChangedCallback(name, _) {
130
+ switch (name) {
131
+ case 'value':
132
+ {
133
+ _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
134
+
135
+ break;
136
+ }
137
+
138
+ case 'max':
139
+ {
140
+ _classPrivateMethodGet(this, _onValueChange, _onValueChange2).call(this);
141
+
142
+ break;
143
+ }
144
+ }
145
+ }
146
+
147
+ get nodeName() {
148
+ return 'select';
149
+ }
150
+
151
+ set value(val) {
152
+ updateAttribute(this, 'value', val);
153
+ }
154
+
155
+ get value() {
156
+ return getIntegerAttribute(this, 'value', 0);
157
+ }
158
+
159
+ set max(val) {
160
+ updateAttribute(this, 'max', val);
161
+ }
162
+
163
+ get max() {
164
+ return getIntegerAttribute(this, 'value', 0);
165
+ }
166
+
167
+ focus() {
168
+ _classPrivateFieldGet(this, _$left).focus();
169
+ }
170
+
171
+ blur() {
172
+ _classPrivateFieldGet(this, _$left).blur();
173
+
174
+ _classPrivateFieldGet(this, _$right).blur();
175
+
176
+ _classPrivateFieldGet(this, _$buttons).forEach($b => $b.blur());
177
+ }
178
+
179
+ }));
180
+
181
+ function _onValueChange2() {
182
+ const value = getIntegerAttribute(this, 'value', 0) - 1;
183
+ const max = Math.max(0, getIntegerAttribute(this, 'max', 0));
184
+ const valueOffset = Math.min(Math.max(0, value - MIDDLE_BTN_INDEX), Math.max(0, max - NUM_BUTTONS));
185
+
186
+ for (let i = 0; i < _classPrivateFieldGet(this, _$buttons).length; i++) {
187
+ const $b = _classPrivateFieldGet(this, _$buttons)[i];
188
+
189
+ if (value < 3) {
190
+ setClass($b, 'active', value === i);
191
+ } else if (value >= max - MIDDLE_BTN_INDEX) {
192
+ setClass($b, 'active', i + valueOffset === value);
193
+ } else {
194
+ setClass($b, 'active', i === MIDDLE_BTN_INDEX);
195
+ }
196
+
197
+ if (max > NUM_BUTTONS) {
198
+ setClass($b, 'dots', i === DOTS_LEFT_INDEX && value > MIDDLE_BTN_INDEX || i === DOTS_RIGHT_INDEX && value <= max - DOTS_RIGHT_INDEX);
199
+ }
200
+
201
+ setClass($b, 'hidden', i >= max);
202
+ const btnText = $b.firstElementChild;
203
+
204
+ if (btnText != null) {
205
+ btnText.textContent = i === FIRST_BTN_INDEX ? '1' : i === LAST_BTN_INDEX ? String(max) : String(i + 1 + valueOffset);
206
+ }
207
+ }
208
+
209
+ const isValueBad = value < 0 || value >= max;
210
+ _classPrivateFieldGet(this, _$left).disabled = isValueBad || value === 0;
211
+ _classPrivateFieldGet(this, _$right).disabled = isValueBad || value === max - 1;
212
+ }
213
+
214
+ function _clamp2(value, max) {
215
+ return Math.max(0, Math.min(max - 1, value));
216
+ }
217
+
218
+ function _dispatchChangeEvent2(value) {
219
+ const max = getIntegerAttribute(this, 'max', 0);
220
+ this.dispatchEvent(new CustomEvent('change', {
221
+ detail: _classPrivateMethodGet(this, _clamp, _clamp2).call(this, value, max) + 1,
222
+ bubbles: true
223
+ }));
224
+ }