@vollowx/seele 0.13.5 → 0.13.7
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/custom-elements.json +1256 -115
- package/package.json +22 -14
- package/src/all.d.ts +34 -0
- package/src/base/autocomplete.d.ts +57 -0
- package/src/base/autocomplete.js +80 -98
- package/src/base/button.d.ts +13 -0
- package/src/base/button.js +21 -19
- package/src/base/checkbox.d.ts +18 -0
- package/src/base/checkbox.js +39 -34
- package/src/base/controllers/list-controller.d.ts +37 -0
- package/src/base/controllers/list-controller.js +23 -15
- package/src/base/controllers/popover-controller.d.ts +35 -0
- package/src/base/controllers/popover-controller.js +37 -29
- package/src/base/dialog.d.ts +20 -0
- package/src/base/dialog.js +11 -9
- package/src/base/field.d.ts +3 -0
- package/src/base/input.d.ts +44 -0
- package/src/base/input.js +57 -65
- package/src/base/item.d.ts +7 -0
- package/src/base/item.js +2 -1
- package/src/base/list-item.d.ts +15 -0
- package/src/base/list-item.js +22 -22
- package/src/base/list.d.ts +54 -0
- package/src/base/list.js +69 -55
- package/src/base/menu-item.d.ts +6 -0
- package/src/base/menu-item.js +4 -3
- package/src/base/menu.d.ts +78 -0
- package/src/base/menu.js +137 -143
- package/src/base/mixins/attachable.d.ts +9 -0
- package/src/base/mixins/attachable.js +22 -18
- package/src/base/mixins/focus-delegated.d.ts +5 -0
- package/src/base/mixins/focus-delegated.js +6 -8
- package/src/base/mixins/form-associated.d.ts +15 -0
- package/src/base/mixins/form-associated.js +11 -18
- package/src/base/mixins/internals-attached.d.ts +6 -0
- package/src/base/mixins/internals-attached.js +1 -1
- package/src/base/option.d.ts +9 -0
- package/src/base/option.js +7 -8
- package/src/base/radio.d.ts +13 -0
- package/src/base/radio.js +49 -42
- package/src/base/select.d.ts +116 -0
- package/src/base/select.js +130 -128
- package/src/base/slider.d.ts +75 -0
- package/src/base/slider.js +115 -118
- package/src/base/tab-panel.d.ts +9 -0
- package/src/base/tab-panel.js +11 -11
- package/src/base/tab.d.ts +18 -0
- package/src/base/tab.js +25 -24
- package/src/base/tabs.d.ts +19 -0
- package/src/base/tabs.js +84 -81
- package/src/base/toggle-button.d.ts +47 -0
- package/src/base/toggle-button.js +56 -52
- package/src/base/tooltip.d.ts +37 -0
- package/src/base/tooltip.js +70 -65
- package/src/core/decorators.d.ts +2 -0
- package/src/core/decorators.js +4 -3
- package/src/core/ensure-ready.d.ts +1 -0
- package/src/core/ensure-ready.js +15 -0
- package/src/core/focus-visible.d.ts +2 -0
- package/src/core/focus-visible.js +4 -4
- package/src/core/shared.d.ts +1 -0
- package/src/core/unique-id.d.ts +4 -0
- package/src/core/unique-id.js +2 -1
- package/src/m3/autocomplete/autocomplete.d.ts +9 -0
- package/src/m3/autocomplete/autocomplete.js +11 -10
- package/src/m3/badge/badge.d.ts +13 -0
- package/src/m3/badge/badge.js +28 -37
- package/src/m3/button/common-button-toggle.d.ts +31 -0
- package/src/m3/button/common-button-toggle.js +44 -41
- package/src/m3/button/common-button.d.ts +29 -0
- package/src/m3/button/common-button.js +40 -40
- package/src/m3/button/icon-button-toggle.d.ts +24 -0
- package/src/m3/button/icon-button-toggle.js +35 -32
- package/src/m3/button/icon-button.d.ts +23 -0
- package/src/m3/button/icon-button.js +33 -31
- package/src/m3/button-group/connected-button-group.d.ts +19 -0
- package/src/m3/button-group/connected-button-group.js +26 -24
- package/src/m3/button-group/standard-button-group.d.ts +24 -0
- package/src/m3/button-group/standard-button-group.js +71 -65
- package/src/m3/checkbox/checkbox.d.ts +25 -0
- package/src/m3/checkbox/checkbox.js +23 -22
- package/src/m3/dialog/dialog.d.ts +46 -0
- package/src/m3/dialog/dialog.js +90 -117
- package/src/m3/divider/divider.d.ts +13 -0
- package/src/m3/divider/divider.js +20 -33
- package/src/m3/fab/fab.d.ts +23 -0
- package/src/m3/fab/fab.js +24 -23
- package/src/m3/field/field.d.ts +28 -0
- package/src/m3/field/field.js +40 -55
- package/src/m3/field/filled-field.d.ts +11 -0
- package/src/m3/field/filled-field.js +7 -11
- package/src/m3/field/outlined-field.d.ts +11 -0
- package/src/m3/field/outlined-field.js +8 -12
- package/src/m3/focus-ring/focus-ring.d.ts +32 -0
- package/src/m3/focus-ring/focus-ring.js +38 -23
- package/src/m3/item/item.d.ts +31 -0
- package/src/m3/item/item.js +32 -17
- package/src/m3/list/list-item.d.ts +24 -0
- package/src/m3/list/list-item.js +20 -16
- package/src/m3/list/list.d.ts +15 -0
- package/src/m3/list/list.js +16 -15
- package/src/m3/loading-indicator/loading-indicator.d.ts +26 -0
- package/src/m3/loading-indicator/loading-indicator.js +113 -161
- package/src/m3/menu/menu-item.d.ts +15 -0
- package/src/m3/menu/menu-item.js +10 -4
- package/src/m3/menu/menu.d.ts +22 -0
- package/src/m3/menu/menu.js +20 -18
- package/src/m3/radio/radio-styles.css.js +1 -1
- package/src/m3/radio/radio.d.ts +17 -0
- package/src/m3/radio/radio.js +22 -11
- package/src/m3/ripple/ripple.d.ts +43 -0
- package/src/m3/ripple/ripple.js +82 -89
- package/src/m3/select/filled-select.d.ts +16 -0
- package/src/m3/select/filled-select.js +12 -10
- package/src/m3/select/option.d.ts +15 -0
- package/src/m3/select/option.js +10 -4
- package/src/m3/select/outlined-select.d.ts +16 -0
- package/src/m3/select/outlined-select.js +12 -10
- package/src/m3/select/select.d.ts +14 -0
- package/src/m3/select/select.js +17 -16
- package/src/m3/slider/slider.d.ts +20 -0
- package/src/m3/slider/slider.js +32 -26
- package/src/m3/switch/switch.d.ts +27 -0
- package/src/m3/switch/switch.js +62 -53
- package/src/m3/system/motion.d.ts +12 -0
- package/src/m3/system/motion.js +16 -9
- package/src/m3/tab/tab-panel.d.ts +9 -0
- package/src/m3/tab/tab-panel.js +6 -9
- package/src/m3/tab/tab.d.ts +19 -0
- package/src/m3/tab/tab.js +14 -12
- package/src/m3/tab/tabs.d.ts +25 -0
- package/src/m3/tab/tabs.js +34 -30
- package/src/m3/text-field/filled-text-field.d.ts +13 -0
- package/src/m3/text-field/filled-text-field.js +15 -20
- package/src/m3/text-field/outlined-text-field.d.ts +13 -0
- package/src/m3/text-field/outlined-text-field.js +15 -20
- package/src/m3/toolbar/toolbar.d.ts +26 -0
- package/src/m3/toolbar/toolbar.js +28 -25
- package/src/m3/tooltip/tooltip.d.ts +19 -0
- package/src/m3/tooltip/tooltip.js +15 -14
- package/src/win98/button/button.d.ts +13 -0
- package/src/win98/button/button.js +13 -11
- package/src/m3/dialog/dialog-spring.js +0 -179
- package/src/win98/button/radio.js +0 -8
- package/src/win98/radio/radio.js +0 -8
package/src/base/slider.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
1
|
/**
|
|
3
2
|
* @license
|
|
4
3
|
* Copyright 2018-2023 Google, Inc.
|
|
5
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
*/
|
|
5
|
+
*/
|
|
6
|
+
import { __decorate } from "tslib";
|
|
7
|
+
import { LitElement, html, nothing } from 'lit';
|
|
7
8
|
import { property, query, state } from 'lit/decorators.js';
|
|
8
9
|
import { classMap } from 'lit/directives/class-map.js';
|
|
9
10
|
import { InternalsAttached, internals } from './mixins/internals-attached.js';
|
|
@@ -24,36 +25,60 @@ export class Slider extends Base {
|
|
|
24
25
|
this.setAttribute('name-end', name);
|
|
25
26
|
}
|
|
26
27
|
get renderAriaLabelStart() {
|
|
27
|
-
return this.ariaLabelStart ||
|
|
28
|
+
return (this.ariaLabelStart ||
|
|
29
|
+
(this.ariaLabel && `${this.ariaLabel} start`) ||
|
|
30
|
+
this.valueLabelStart ||
|
|
31
|
+
String(this.valueStart));
|
|
28
32
|
}
|
|
29
33
|
get renderAriaValueTextStart() {
|
|
30
|
-
return this.ariaValueTextStart || this.valueLabelStart || String(this.valueStart);
|
|
34
|
+
return (this.ariaValueTextStart || this.valueLabelStart || String(this.valueStart));
|
|
31
35
|
}
|
|
32
36
|
get renderAriaLabelEnd() {
|
|
33
37
|
if (this.range) {
|
|
34
|
-
return this.ariaLabelEnd ||
|
|
38
|
+
return (this.ariaLabelEnd ||
|
|
39
|
+
(this.ariaLabel && `${this.ariaLabel} end`) ||
|
|
40
|
+
this.valueLabelEnd ||
|
|
41
|
+
String(this.valueEnd));
|
|
35
42
|
}
|
|
36
43
|
return this.ariaLabel || this.valueLabel || String(this.value);
|
|
37
44
|
}
|
|
38
45
|
get renderAriaValueTextEnd() {
|
|
39
46
|
if (this.range) {
|
|
40
|
-
return this.ariaValueTextEnd || this.valueLabelEnd || String(this.valueEnd);
|
|
47
|
+
return (this.ariaValueTextEnd || this.valueLabelEnd || String(this.valueEnd));
|
|
41
48
|
}
|
|
42
49
|
return this.ariaValueText || this.valueLabel || String(this.value);
|
|
43
50
|
}
|
|
44
|
-
renderInput({ start, value, ariaLabel, ariaValueText, ariaMin, ariaMax }) {
|
|
51
|
+
renderInput({ start, value, ariaLabel, ariaValueText, ariaMin, ariaMax, }) {
|
|
45
52
|
const name = start ? `start` : `end`;
|
|
46
|
-
return html`<input type="range" class="${classMap({
|
|
53
|
+
return html `<input type="range" class="${classMap({
|
|
47
54
|
start,
|
|
48
|
-
end: !start
|
|
55
|
+
end: !start,
|
|
49
56
|
})}" @focus="${this.handleFocus}" @pointerdown="${this.handleDown}" @pointerup="${this.handleUp}" @keydown="${this.handleKeydown}" @keyup="${this.handleKeyup}" @input="${this.handleInput}" @change="${this.handleChange}" id="${name}" .disabled="${this.disabled}" .min="${String(this.min)}" aria-valuemin="${ariaMin}" .max="${String(this.max)}" aria-valuemax="${ariaMax}" .step="${String(this.step)}" .value="${String(value)}" .tabIndex="${start ? 1 : 0}" aria-label="${ariaLabel || nothing}" aria-valuetext="${ariaValueText}">`;
|
|
50
57
|
}
|
|
51
|
-
constructor(){
|
|
52
|
-
super()
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.min = 0;
|
|
61
|
+
this.max = 100;
|
|
62
|
+
this.valueLabel = '';
|
|
63
|
+
this.valueLabelStart = '';
|
|
64
|
+
this.valueLabelEnd = '';
|
|
65
|
+
this.ariaLabelStart = '';
|
|
66
|
+
this.ariaValueTextStart = '';
|
|
67
|
+
this.ariaLabelEnd = '';
|
|
68
|
+
this.ariaValueTextEnd = '';
|
|
69
|
+
this.step = 1;
|
|
70
|
+
this.ticks = false;
|
|
71
|
+
this.labeled = false;
|
|
72
|
+
this.range = false;
|
|
73
|
+
this.startOnTop = false;
|
|
74
|
+
this.handlesOverlapping = false;
|
|
75
|
+
this.isRedispatchingEvent = false;
|
|
76
|
+
// @TODO: Delegate ARIA attributes to inputs, automatically convert from
|
|
53
77
|
// aria-* to data-aria-*.
|
|
54
|
-
this.ariaLabel = null
|
|
78
|
+
this.ariaLabel = null;
|
|
79
|
+
this.ariaValueText = null;
|
|
55
80
|
// Activation click handling usually goes here if needed
|
|
56
|
-
this.addEventListener('click', (event)=>{
|
|
81
|
+
this.addEventListener('click', (event) => {
|
|
57
82
|
if (!isActivationClick(event) || !this.inputEnd) {
|
|
58
83
|
return;
|
|
59
84
|
}
|
|
@@ -65,9 +90,15 @@ export class Slider extends Base {
|
|
|
65
90
|
this.inputEnd?.focus();
|
|
66
91
|
}
|
|
67
92
|
willUpdate(changed) {
|
|
68
|
-
this.renderValueStart = changed.has('valueStart')
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
this.renderValueStart = changed.has('valueStart')
|
|
94
|
+
? this.valueStart
|
|
95
|
+
: this.inputStart?.valueAsNumber;
|
|
96
|
+
const endValueChanged = (changed.has('valueEnd') && this.range) || changed.has('value');
|
|
97
|
+
this.renderValueEnd = endValueChanged
|
|
98
|
+
? this.range
|
|
99
|
+
? this.valueEnd
|
|
100
|
+
: this.value
|
|
101
|
+
: this.inputEnd?.valueAsNumber;
|
|
71
102
|
}
|
|
72
103
|
updated(changed) {
|
|
73
104
|
if (this.range) {
|
|
@@ -86,10 +117,14 @@ export class Slider extends Base {
|
|
|
86
117
|
const v = this.inputEnd.valueAsNumber;
|
|
87
118
|
this.valueEnd = this.renderValueEnd = v;
|
|
88
119
|
}
|
|
89
|
-
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
90
122
|
this.value ??= this.renderValueEnd;
|
|
91
123
|
}
|
|
92
|
-
if (changed.has('range') ||
|
|
124
|
+
if (changed.has('range') ||
|
|
125
|
+
changed.has('renderValueStart') ||
|
|
126
|
+
changed.has('renderValueEnd') ||
|
|
127
|
+
this.isUpdatePending) {
|
|
93
128
|
const startNub = this.handleStart?.querySelector('.handleNub');
|
|
94
129
|
const endNub = this.handleEnd?.querySelector('.handleNub');
|
|
95
130
|
this.handlesOverlapping = isOverlapping(startNub, endNub);
|
|
@@ -119,9 +154,7 @@ export class Slider extends Base {
|
|
|
119
154
|
if (target !== undefined) {
|
|
120
155
|
target.focus();
|
|
121
156
|
if (flipped && target.valueAsNumber !== values.get(target)) {
|
|
122
|
-
target.dispatchEvent(new Event('change', {
|
|
123
|
-
bubbles: true
|
|
124
|
-
}));
|
|
157
|
+
target.dispatchEvent(new Event('change', { bubbles: true }));
|
|
125
158
|
}
|
|
126
159
|
}
|
|
127
160
|
this.finishAction(event);
|
|
@@ -147,7 +180,8 @@ export class Slider extends Base {
|
|
|
147
180
|
if (this.range) {
|
|
148
181
|
this.valueStart = this.inputStart.valueAsNumber;
|
|
149
182
|
this.valueEnd = this.inputEnd.valueAsNumber;
|
|
150
|
-
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
151
185
|
this.value = this.inputEnd.valueAsNumber;
|
|
152
186
|
}
|
|
153
187
|
if (stopPropagation) {
|
|
@@ -178,15 +212,9 @@ export class Slider extends Base {
|
|
|
178
212
|
target,
|
|
179
213
|
fixed,
|
|
180
214
|
values: new Map([
|
|
181
|
-
[
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
],
|
|
185
|
-
[
|
|
186
|
-
fixed,
|
|
187
|
-
fixed?.valueAsNumber
|
|
188
|
-
]
|
|
189
|
-
])
|
|
215
|
+
[target, target.valueAsNumber],
|
|
216
|
+
[fixed, fixed?.valueAsNumber],
|
|
217
|
+
]),
|
|
190
218
|
};
|
|
191
219
|
}
|
|
192
220
|
finishAction(event) {
|
|
@@ -201,7 +229,9 @@ export class Slider extends Base {
|
|
|
201
229
|
}
|
|
202
230
|
const { target, fixed } = this.action;
|
|
203
231
|
const isStart = target === this.inputStart;
|
|
204
|
-
return isStart
|
|
232
|
+
return isStart
|
|
233
|
+
? target.valueAsNumber > fixed.valueAsNumber
|
|
234
|
+
: target.valueAsNumber < fixed.valueAsNumber;
|
|
205
235
|
}
|
|
206
236
|
isActionFlipped() {
|
|
207
237
|
const { action } = this;
|
|
@@ -268,126 +298,89 @@ export class Slider extends Base {
|
|
|
268
298
|
data.append(this.nameStart, String(this.valueStart));
|
|
269
299
|
data.append(this.nameEnd, String(this.valueEnd));
|
|
270
300
|
this[internals].setFormValue(data);
|
|
271
|
-
}
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
272
303
|
this[internals].setFormValue(String(this.value));
|
|
273
304
|
}
|
|
274
305
|
}
|
|
275
306
|
}
|
|
276
|
-
|
|
277
|
-
property({
|
|
278
|
-
type: Number
|
|
279
|
-
})
|
|
307
|
+
__decorate([
|
|
308
|
+
property({ type: Number })
|
|
280
309
|
], Slider.prototype, "min", void 0);
|
|
281
|
-
|
|
282
|
-
property({
|
|
283
|
-
type: Number
|
|
284
|
-
})
|
|
310
|
+
__decorate([
|
|
311
|
+
property({ type: Number })
|
|
285
312
|
], Slider.prototype, "max", void 0);
|
|
286
|
-
|
|
287
|
-
property({
|
|
288
|
-
type: Number
|
|
289
|
-
})
|
|
313
|
+
__decorate([
|
|
314
|
+
property({ type: Number })
|
|
290
315
|
], Slider.prototype, "value", void 0);
|
|
291
|
-
|
|
292
|
-
property({
|
|
293
|
-
type: Number,
|
|
294
|
-
attribute: 'value-start'
|
|
295
|
-
})
|
|
316
|
+
__decorate([
|
|
317
|
+
property({ type: Number, attribute: 'value-start' })
|
|
296
318
|
], Slider.prototype, "valueStart", void 0);
|
|
297
|
-
|
|
298
|
-
property({
|
|
299
|
-
type: Number,
|
|
300
|
-
attribute: 'value-end'
|
|
301
|
-
})
|
|
319
|
+
__decorate([
|
|
320
|
+
property({ type: Number, attribute: 'value-end' })
|
|
302
321
|
], Slider.prototype, "valueEnd", void 0);
|
|
303
|
-
|
|
304
|
-
property({
|
|
305
|
-
attribute: 'value-label'
|
|
306
|
-
})
|
|
322
|
+
__decorate([
|
|
323
|
+
property({ attribute: 'value-label' })
|
|
307
324
|
], Slider.prototype, "valueLabel", void 0);
|
|
308
|
-
|
|
309
|
-
property({
|
|
310
|
-
attribute: 'value-label-start'
|
|
311
|
-
})
|
|
325
|
+
__decorate([
|
|
326
|
+
property({ attribute: 'value-label-start' })
|
|
312
327
|
], Slider.prototype, "valueLabelStart", void 0);
|
|
313
|
-
|
|
314
|
-
property({
|
|
315
|
-
attribute: 'value-label-end'
|
|
316
|
-
})
|
|
328
|
+
__decorate([
|
|
329
|
+
property({ attribute: 'value-label-end' })
|
|
317
330
|
], Slider.prototype, "valueLabelEnd", void 0);
|
|
318
|
-
|
|
319
|
-
property({
|
|
320
|
-
attribute: 'aria-label-start'
|
|
321
|
-
})
|
|
331
|
+
__decorate([
|
|
332
|
+
property({ attribute: 'aria-label-start' })
|
|
322
333
|
], Slider.prototype, "ariaLabelStart", void 0);
|
|
323
|
-
|
|
324
|
-
property({
|
|
325
|
-
attribute: 'aria-valuetext-start'
|
|
326
|
-
})
|
|
334
|
+
__decorate([
|
|
335
|
+
property({ attribute: 'aria-valuetext-start' })
|
|
327
336
|
], Slider.prototype, "ariaValueTextStart", void 0);
|
|
328
|
-
|
|
329
|
-
property({
|
|
330
|
-
attribute: 'aria-label-end'
|
|
331
|
-
})
|
|
337
|
+
__decorate([
|
|
338
|
+
property({ attribute: 'aria-label-end' })
|
|
332
339
|
], Slider.prototype, "ariaLabelEnd", void 0);
|
|
333
|
-
|
|
334
|
-
property({
|
|
335
|
-
attribute: 'aria-valuetext-end'
|
|
336
|
-
})
|
|
340
|
+
__decorate([
|
|
341
|
+
property({ attribute: 'aria-valuetext-end' })
|
|
337
342
|
], Slider.prototype, "ariaValueTextEnd", void 0);
|
|
338
|
-
|
|
339
|
-
property({
|
|
340
|
-
type: Number
|
|
341
|
-
})
|
|
343
|
+
__decorate([
|
|
344
|
+
property({ type: Number })
|
|
342
345
|
], Slider.prototype, "step", void 0);
|
|
343
|
-
|
|
344
|
-
property({
|
|
345
|
-
type: Boolean
|
|
346
|
-
})
|
|
346
|
+
__decorate([
|
|
347
|
+
property({ type: Boolean })
|
|
347
348
|
], Slider.prototype, "ticks", void 0);
|
|
348
|
-
|
|
349
|
-
property({
|
|
350
|
-
type: Boolean
|
|
351
|
-
})
|
|
349
|
+
__decorate([
|
|
350
|
+
property({ type: Boolean })
|
|
352
351
|
], Slider.prototype, "labeled", void 0);
|
|
353
|
-
|
|
354
|
-
property({
|
|
355
|
-
type: Boolean
|
|
356
|
-
})
|
|
352
|
+
__decorate([
|
|
353
|
+
property({ type: Boolean })
|
|
357
354
|
], Slider.prototype, "range", void 0);
|
|
358
|
-
|
|
355
|
+
__decorate([
|
|
359
356
|
query('input.start')
|
|
360
357
|
], Slider.prototype, "inputStart", void 0);
|
|
361
|
-
|
|
358
|
+
__decorate([
|
|
362
359
|
query('input.end')
|
|
363
360
|
], Slider.prototype, "inputEnd", void 0);
|
|
364
|
-
|
|
361
|
+
__decorate([
|
|
365
362
|
query('.handle.start')
|
|
366
363
|
], Slider.prototype, "handleStart", void 0);
|
|
367
|
-
|
|
364
|
+
__decorate([
|
|
368
365
|
query('.handle.end')
|
|
369
366
|
], Slider.prototype, "handleEnd", void 0);
|
|
370
|
-
|
|
367
|
+
__decorate([
|
|
371
368
|
state()
|
|
372
369
|
], Slider.prototype, "startOnTop", void 0);
|
|
373
|
-
|
|
370
|
+
__decorate([
|
|
374
371
|
state()
|
|
375
372
|
], Slider.prototype, "handlesOverlapping", void 0);
|
|
376
|
-
|
|
373
|
+
__decorate([
|
|
377
374
|
state()
|
|
378
375
|
], Slider.prototype, "renderValueStart", void 0);
|
|
379
|
-
|
|
376
|
+
__decorate([
|
|
380
377
|
state()
|
|
381
378
|
], Slider.prototype, "renderValueEnd", void 0);
|
|
382
|
-
|
|
383
|
-
property({
|
|
384
|
-
attribute: 'data-aria-label'
|
|
385
|
-
})
|
|
379
|
+
__decorate([
|
|
380
|
+
property({ attribute: 'data-aria-label' })
|
|
386
381
|
], Slider.prototype, "ariaLabel", void 0);
|
|
387
|
-
|
|
388
|
-
property({
|
|
389
|
-
attribute: 'data-aria-valuetext'
|
|
390
|
-
})
|
|
382
|
+
__decorate([
|
|
383
|
+
property({ attribute: 'data-aria-valuetext' })
|
|
391
384
|
], Slider.prototype, "ariaValueText", void 0);
|
|
392
385
|
function isOverlapping(elA, elB) {
|
|
393
386
|
if (!(elA && elB)) {
|
|
@@ -395,7 +388,10 @@ function isOverlapping(elA, elB) {
|
|
|
395
388
|
}
|
|
396
389
|
const a = elA.getBoundingClientRect();
|
|
397
390
|
const b = elB.getBoundingClientRect();
|
|
398
|
-
return !(a.top > b.bottom ||
|
|
391
|
+
return !(a.top > b.bottom ||
|
|
392
|
+
a.right < b.left ||
|
|
393
|
+
a.bottom < b.top ||
|
|
394
|
+
a.left > b.right);
|
|
399
395
|
}
|
|
400
396
|
function isActivationClick(event) {
|
|
401
397
|
// Simple check for now, simplified version of material web's check
|
|
@@ -408,7 +404,7 @@ function dispatchActivationClick(element) {
|
|
|
408
404
|
const event = new MouseEvent('click', {
|
|
409
405
|
bubbles: true,
|
|
410
406
|
cancelable: true,
|
|
411
|
-
view: window
|
|
407
|
+
view: window,
|
|
412
408
|
});
|
|
413
409
|
element.dispatchEvent(event);
|
|
414
410
|
}
|
|
@@ -421,7 +417,8 @@ function redispatchEvent(element, event) {
|
|
|
421
417
|
const copy = new event.constructor(event.type, {
|
|
422
418
|
bubbles: event.bubbles,
|
|
423
419
|
cancelable: event.cancelable,
|
|
424
|
-
composed: event.composed
|
|
420
|
+
composed: event.composed,
|
|
421
|
+
// detail: (event as any).detail,
|
|
425
422
|
});
|
|
426
423
|
element.dispatchEvent(copy);
|
|
427
424
|
return true;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const TabPanel_base: Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
|
|
3
|
+
export declare class TabPanel extends TabPanel_base {
|
|
4
|
+
protected _role: string;
|
|
5
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
6
|
+
value: string;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
package/src/base/tab-panel.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { InternalsAttached, internals } from './mixins/internals-attached.js';
|
|
5
5
|
import { genUniqueId } from '../core/unique-id.js';
|
|
6
6
|
export class TabPanel extends InternalsAttached(LitElement) {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this._role = 'tabpanel';
|
|
10
|
+
this.value = '';
|
|
11
|
+
}
|
|
7
12
|
render() {
|
|
8
|
-
return html`<slot></slot>`;
|
|
13
|
+
return html `<slot></slot>`;
|
|
9
14
|
}
|
|
10
15
|
connectedCallback() {
|
|
11
16
|
super.connectedCallback();
|
|
12
17
|
this.setAttribute('seele-base', 'tabpanel');
|
|
13
18
|
this[internals].role = this._role;
|
|
14
|
-
if (!this.id)
|
|
15
|
-
|
|
16
|
-
constructor(...args){
|
|
17
|
-
super(...args), this._role = 'tabpanel', this.value = '';
|
|
19
|
+
if (!this.id)
|
|
20
|
+
this.id = genUniqueId('tabpanel');
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
property({
|
|
22
|
-
type: String,
|
|
23
|
-
reflect: true
|
|
24
|
-
})
|
|
23
|
+
__decorate([
|
|
24
|
+
property({ type: String, reflect: true })
|
|
25
25
|
], TabPanel.prototype, "value", void 0);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const Tab_base: Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* TODO: disabled
|
|
5
|
+
*/
|
|
6
|
+
export declare class Tab extends Tab_base {
|
|
7
|
+
#private;
|
|
8
|
+
protected _role: string;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
focused: boolean;
|
|
11
|
+
value: string;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
protected updated(changed: Map<string, any>): void;
|
|
15
|
+
focus(): void;
|
|
16
|
+
blur(): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
package/src/base/tab.js
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { InternalsAttached, internals } from './mixins/internals-attached.js';
|
|
5
5
|
import { genUniqueId } from '../core/unique-id.js';
|
|
6
6
|
/**
|
|
7
7
|
* TODO: disabled
|
|
8
|
-
*/
|
|
8
|
+
*/
|
|
9
|
+
export class Tab extends InternalsAttached(LitElement) {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._role = 'tab';
|
|
13
|
+
this.selected = false;
|
|
14
|
+
this.focused = false;
|
|
15
|
+
this.value = '';
|
|
16
|
+
}
|
|
9
17
|
render() {
|
|
10
|
-
return html`<slot></slot>`;
|
|
18
|
+
return html `<slot></slot>`;
|
|
11
19
|
}
|
|
12
20
|
connectedCallback() {
|
|
13
21
|
super.connectedCallback();
|
|
14
22
|
this.setAttribute('seele-base', 'tab');
|
|
15
23
|
this[internals].role = this._role;
|
|
16
|
-
if (!this.id)
|
|
24
|
+
if (!this.id)
|
|
25
|
+
this.id = genUniqueId('tab');
|
|
17
26
|
this.#updateInternals();
|
|
18
27
|
}
|
|
19
28
|
updated(changed) {
|
|
@@ -24,8 +33,12 @@ import { genUniqueId } from '../core/unique-id.js';
|
|
|
24
33
|
}
|
|
25
34
|
#updateInternals() {
|
|
26
35
|
this[internals].ariaSelected = this.selected ? 'true' : 'false';
|
|
27
|
-
this.focused
|
|
28
|
-
|
|
36
|
+
this.focused
|
|
37
|
+
? this[internals].states.add('focused')
|
|
38
|
+
: this[internals].states.delete('focused');
|
|
39
|
+
this.selected
|
|
40
|
+
? this[internals].states.add('selected')
|
|
41
|
+
: this[internals].states.delete('selected');
|
|
29
42
|
}
|
|
30
43
|
focus() {
|
|
31
44
|
this.focused = true;
|
|
@@ -35,25 +48,13 @@ import { genUniqueId } from '../core/unique-id.js';
|
|
|
35
48
|
this.focused = false;
|
|
36
49
|
super.blur();
|
|
37
50
|
}
|
|
38
|
-
constructor(...args){
|
|
39
|
-
super(...args), this._role = 'tab', this.selected = false, this.focused = false, this.value = '';
|
|
40
|
-
}
|
|
41
51
|
}
|
|
42
|
-
|
|
43
|
-
property({
|
|
44
|
-
type: Boolean,
|
|
45
|
-
reflect: true
|
|
46
|
-
})
|
|
52
|
+
__decorate([
|
|
53
|
+
property({ type: Boolean, reflect: true })
|
|
47
54
|
], Tab.prototype, "selected", void 0);
|
|
48
|
-
|
|
49
|
-
property({
|
|
50
|
-
type: Boolean,
|
|
51
|
-
reflect: true
|
|
52
|
-
})
|
|
55
|
+
__decorate([
|
|
56
|
+
property({ type: Boolean, reflect: true })
|
|
53
57
|
], Tab.prototype, "focused", void 0);
|
|
54
|
-
|
|
55
|
-
property({
|
|
56
|
-
type: String,
|
|
57
|
-
reflect: true
|
|
58
|
-
})
|
|
58
|
+
__decorate([
|
|
59
|
+
property({ type: String, reflect: true })
|
|
59
60
|
], Tab.prototype, "value", void 0);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { Tab } from './tab.js';
|
|
3
|
+
/**
|
|
4
|
+
* @fires {CustomEvent} tab-select
|
|
5
|
+
*/
|
|
6
|
+
export declare class Tabs extends LitElement {
|
|
7
|
+
#private;
|
|
8
|
+
protected _role: string;
|
|
9
|
+
switch: 'auto' | 'manual';
|
|
10
|
+
selected: string;
|
|
11
|
+
$slotItems: Array<HTMLElement>;
|
|
12
|
+
get $tabs(): Tab[];
|
|
13
|
+
get $parent(): HTMLElement;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
protected updated(changed: Map<string, any>): void;
|
|
17
|
+
focusTab(tab: Tab): void;
|
|
18
|
+
selectTab(selectedTab: Tab): void;
|
|
19
|
+
}
|