@vollowx/seele 0.14.0 → 0.14.2
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/README.md +3 -3
- package/custom-elements.json +195 -153
- package/package.json +4 -4
- package/src/all.d.ts +2 -1
- package/src/all.js +2 -1
- package/src/base/autocomplete.d.ts +1 -0
- package/src/base/autocomplete.js +17 -5
- package/src/base/composed-menu.d.ts +16 -0
- package/src/base/composed-menu.js +36 -0
- package/src/base/menu.js +26 -0
- package/src/base/popup-styles.css.js +1 -1
- package/src/base/popup.d.ts +22 -9
- package/src/base/popup.js +131 -83
- package/src/base/positioning.d.ts +2 -0
- package/src/base/positioning.js +23 -0
- package/src/base/progressbar.d.ts +13 -0
- package/src/base/progressbar.js +32 -0
- package/src/base/slider.d.ts +1 -0
- package/src/base/slider.js +1 -0
- package/src/base/tooltip-styles.css.js +2 -0
- package/src/base/tooltip.d.ts +9 -8
- package/src/base/tooltip.js +143 -56
- package/src/m3/autocomplete/autocomplete-styles.css.js +1 -1
- package/src/m3/autocomplete/autocomplete.js +1 -1
- package/src/m3/badge/badge-styles.css.js +1 -1
- package/src/m3/item/item-styles.css.js +1 -1
- package/src/m3/list/list-item-styles.css.js +1 -1
- package/src/m3/loading/loading-styles.css.js +2 -0
- package/src/m3/{loading-indicator/loading-indicator.d.ts → loading/loading.d.ts} +9 -3
- package/src/m3/{loading-indicator/loading-indicator.js → loading/loading.js} +15 -9
- package/src/m3/menu/composed-menu.d.ts +4 -9
- package/src/m3/menu/composed-menu.js +7 -27
- package/src/m3/menu/menu-styles.css.js +1 -1
- package/src/m3/navigation/navigation-rail-styles.css.js +1 -1
- package/src/m3/popup/popup-styles.css.js +1 -1
- package/src/m3/popup/popup.d.ts +1 -0
- package/src/m3/popup/popup.js +4 -0
- package/src/m3/progress/linear-progress-styles.css.js +2 -0
- package/src/m3/progress/linear-progress.d.ts +22 -0
- package/src/m3/progress/linear-progress.js +35 -0
- package/src/m3/radio/radio-styles.css.js +1 -1
- package/src/m3/select/select-styles.css.js +1 -1
- package/src/m3/slider/slider-styles.css.js +1 -1
- package/src/m3/styles/color-default-dark.css +51 -0
- package/src/m3/styles/color-default-light.css +51 -0
- package/src/m3/switch/switch-styles.css.js +1 -1
- package/src/m3/tooltip/tooltip-styles.css.js +1 -1
- package/src/m3/tooltip/tooltip.d.ts +0 -7
- package/src/m3/tooltip/tooltip.js +1 -8
- package/src/base/controllers/popover-controller.d.ts +0 -35
- package/src/base/controllers/popover-controller.js +0 -163
- package/src/m3/loading-indicator/loading-indicator-styles.css.js +0 -2
package/src/base/popup.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NOTE: demos at dev/pending.html
|
|
3
|
-
* TODO: hijack all `hidePopover()`s to allow more complex JS animations
|
|
4
|
-
*/
|
|
5
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
6
2
|
import { Placement, Strategy } from '@floating-ui/dom';
|
|
7
3
|
import { autoAttachToParent, handleControlChange } from './mixins/attachable.js';
|
|
8
4
|
declare const Popup_base: Constructor<import("./mixins/attachable.js").AttachableInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
|
|
5
|
+
/**
|
|
6
|
+
* TODO: use [popover=auto]
|
|
7
|
+
*
|
|
8
|
+
* Light dismiss closes a popup for a click outside, and normally ignores the
|
|
9
|
+
* trigger, yet non-button triggers are not recognized.
|
|
10
|
+
* That makes clicking the trigger do
|
|
11
|
+
* 1. light dismiss
|
|
12
|
+
* 2. .toggle()
|
|
13
|
+
* when the popup is open on mobile devices (tested on Safari mobile 26).
|
|
14
|
+
*
|
|
15
|
+
* I chose to use manual popovers, which effectively makes most of the benefits
|
|
16
|
+
* of the use of Popover API lost. The workarounds should be removed after
|
|
17
|
+
* custom elements can get button behavior natively.
|
|
18
|
+
*
|
|
19
|
+
* Ref:
|
|
20
|
+
* - https://github.com/openui/open-ui/issues/1088
|
|
21
|
+
* - https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PlatformProvidedBehaviors/explainer.md
|
|
22
|
+
* - https://github.com/whatwg/html/issues/12150
|
|
23
|
+
*/
|
|
9
24
|
/**
|
|
10
25
|
* When using popup with menu, you need to manually bind them using `aria-controls`
|
|
11
26
|
*/
|
|
@@ -26,11 +41,9 @@ export declare class Popup extends Popup_base {
|
|
|
26
41
|
protected updated(changedProperties: PropertyValues<this>): void;
|
|
27
42
|
[autoAttachToParent]: boolean;
|
|
28
43
|
[handleControlChange](prev: HTMLElement | null, next: HTMLElement | null): void;
|
|
29
|
-
toggle():
|
|
30
|
-
show():
|
|
31
|
-
hide():
|
|
32
|
-
_show(): Promise<void>;
|
|
33
|
-
_hide(): Promise<void>;
|
|
44
|
+
toggle(): void;
|
|
45
|
+
show(): void;
|
|
46
|
+
hide(): void;
|
|
34
47
|
_cleanup(): void;
|
|
35
48
|
}
|
|
36
49
|
export {};
|
package/src/base/popup.js
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NOTE: demos at dev/pending.html
|
|
3
|
-
* TODO: hijack all `hidePopover()`s to allow more complex JS animations
|
|
4
|
-
*/
|
|
5
1
|
var _a;
|
|
6
2
|
import { __decorate } from "tslib";
|
|
7
3
|
import { LitElement, html, isServer } from 'lit';
|
|
8
|
-
import {
|
|
4
|
+
import { property } from 'lit/decorators.js';
|
|
9
5
|
import { autoUpdate, computePosition, arrow, flip, offset, shift, } from '@floating-ui/dom';
|
|
10
6
|
import { getFirstTabbable } from '../core/focus.js';
|
|
11
7
|
import { InternalsAttached } from './mixins/internals-attached.js';
|
|
12
8
|
import { Attachable, autoAttachToParent, handleControlChange, } from './mixins/attachable.js';
|
|
13
|
-
import { transformOriginFromArrow } from './
|
|
9
|
+
import { transformOriginFromArrow } from './positioning.js';
|
|
14
10
|
import { popupStyles } from './popup-styles.css.js';
|
|
11
|
+
/**
|
|
12
|
+
* TODO: use [popover=auto]
|
|
13
|
+
*
|
|
14
|
+
* Light dismiss closes a popup for a click outside, and normally ignores the
|
|
15
|
+
* trigger, yet non-button triggers are not recognized.
|
|
16
|
+
* That makes clicking the trigger do
|
|
17
|
+
* 1. light dismiss
|
|
18
|
+
* 2. .toggle()
|
|
19
|
+
* when the popup is open on mobile devices (tested on Safari mobile 26).
|
|
20
|
+
*
|
|
21
|
+
* I chose to use manual popovers, which effectively makes most of the benefits
|
|
22
|
+
* of the use of Popover API lost. The workarounds should be removed after
|
|
23
|
+
* custom elements can get button behavior natively.
|
|
24
|
+
*
|
|
25
|
+
* Ref:
|
|
26
|
+
* - https://github.com/openui/open-ui/issues/1088
|
|
27
|
+
* - https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PlatformProvidedBehaviors/explainer.md
|
|
28
|
+
* - https://github.com/whatwg/html/issues/12150
|
|
29
|
+
*/
|
|
15
30
|
/**
|
|
16
31
|
* When using popup with menu, you need to manually bind them using `aria-controls`
|
|
17
32
|
*/
|
|
18
|
-
|
|
33
|
+
export class Popup extends Attachable(InternalsAttached(LitElement)) {
|
|
19
34
|
static { this.styles = [popupStyles]; }
|
|
20
35
|
render() {
|
|
21
36
|
return html `<slot></slot>`;
|
|
@@ -29,33 +44,24 @@ let Popup = class Popup extends Attachable(InternalsAttached(LitElement)) {
|
|
|
29
44
|
this.offset = 0;
|
|
30
45
|
this.windowPadding = 8;
|
|
31
46
|
this[_a] = false;
|
|
47
|
+
this.#$lastFocused = null;
|
|
48
|
+
this.#pointerType = null;
|
|
49
|
+
this.#pointerPath = [];
|
|
32
50
|
this.#handleRequestHide = () => {
|
|
33
|
-
this.
|
|
34
|
-
};
|
|
35
|
-
// #allowHidePopover = false;
|
|
36
|
-
// #handleBeforeToggle = (e: ToggleEvent) => {
|
|
37
|
-
// // Intercept browser light-dismiss (ESC, click outside) or external hidePopover() calls
|
|
38
|
-
// if (e.newState === 'closed' && !this.#allowHidePopover) {
|
|
39
|
-
// e.preventDefault();
|
|
40
|
-
// if (this.open) {
|
|
41
|
-
// this.hide();
|
|
42
|
-
// }
|
|
43
|
-
// }
|
|
44
|
-
// };
|
|
45
|
-
this.#handleToggle = (e) => {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
if (e.newState === 'closed' && this.open)
|
|
51
|
+
if (this.open) {
|
|
48
52
|
this.hide();
|
|
53
|
+
}
|
|
49
54
|
};
|
|
50
55
|
this.#handleFocusOut = (e) => {
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
if (this.noFocusControl ||
|
|
57
|
+
!this.open ||
|
|
58
|
+
this.#pointerPath.includes(this.$control))
|
|
53
59
|
return;
|
|
54
60
|
const target = e.relatedTarget;
|
|
55
|
-
if (
|
|
61
|
+
if (this.contains(target))
|
|
56
62
|
return;
|
|
57
|
-
}
|
|
58
63
|
if (target) {
|
|
64
|
+
this.#$lastFocused = null;
|
|
59
65
|
this.hide();
|
|
60
66
|
return;
|
|
61
67
|
}
|
|
@@ -64,66 +70,112 @@ let Popup = class Popup extends Attachable(InternalsAttached(LitElement)) {
|
|
|
64
70
|
this.hide();
|
|
65
71
|
});
|
|
66
72
|
};
|
|
67
|
-
this.#
|
|
73
|
+
this.#handleKeyDown = (e) => {
|
|
74
|
+
this.#pointerPath = [];
|
|
75
|
+
if (e.key !== 'Escape' || !this.open)
|
|
76
|
+
return;
|
|
77
|
+
const active = document.activeElement;
|
|
78
|
+
if (!this.contains(active) && !this.noFocusControl)
|
|
79
|
+
return;
|
|
68
80
|
e.preventDefault();
|
|
81
|
+
this.hide();
|
|
82
|
+
};
|
|
83
|
+
this.#handleTriggerClick = () => {
|
|
84
|
+
// Ignore it if the popup is already opened by a mouse or pen.
|
|
85
|
+
if (this.#pointerType && this.#pointerType !== 'touch') {
|
|
86
|
+
this.#pointerType = null;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.#pointerType = null;
|
|
90
|
+
this.toggle();
|
|
91
|
+
};
|
|
92
|
+
this.#handleTriggerPointerDown = (e) => {
|
|
93
|
+
if (e.pointerType === 'touch') {
|
|
94
|
+
this.#pointerType = null;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (e.button !== 0)
|
|
98
|
+
return;
|
|
99
|
+
this.#pointerType = e.pointerType;
|
|
69
100
|
this.toggle();
|
|
70
101
|
};
|
|
102
|
+
this.#handleGlobalClick = (e) => {
|
|
103
|
+
if (!this.open)
|
|
104
|
+
return;
|
|
105
|
+
const path = e.composedPath();
|
|
106
|
+
if (path.includes(this) || path.includes(this.$control))
|
|
107
|
+
return;
|
|
108
|
+
// 1. When a press started inside the popup is released outside of it
|
|
109
|
+
// 2. When a press started on the trigger is released inside the popup
|
|
110
|
+
if (this.#pointerPath.includes(this) ||
|
|
111
|
+
this.#pointerPath.includes(this.$control))
|
|
112
|
+
return;
|
|
113
|
+
this.hide();
|
|
114
|
+
};
|
|
115
|
+
this.#handleGlobalPointerDown = (event) => {
|
|
116
|
+
this.#pointerPath = event.composedPath();
|
|
117
|
+
if (!this.open || event.pointerType === 'touch')
|
|
118
|
+
return;
|
|
119
|
+
if (this.#pointerPath.includes(this) ||
|
|
120
|
+
this.#pointerPath.includes(this.$control))
|
|
121
|
+
return;
|
|
122
|
+
this.hide();
|
|
123
|
+
};
|
|
71
124
|
this.#dummyArrow = isServer ? null : document.createElement('div');
|
|
72
125
|
this.setAttribute('notransition', '');
|
|
73
126
|
if (!this.hasAttribute('popover'))
|
|
74
|
-
this.setAttribute('popover', '
|
|
127
|
+
this.setAttribute('popover', 'manual');
|
|
75
128
|
if (!isServer) {
|
|
76
129
|
this.addEventListener('request-popup-hide', this.#handleRequestHide);
|
|
77
|
-
// this.addEventListener('beforetoggle', this.#handleBeforeToggle);
|
|
78
|
-
this.addEventListener('toggle', this.#handleToggle);
|
|
79
130
|
this.addEventListener('focusout', this.#handleFocusOut);
|
|
131
|
+
this.addEventListener('keydown', this.#handleKeyDown);
|
|
80
132
|
}
|
|
81
133
|
}
|
|
82
134
|
connectedCallback() {
|
|
83
135
|
super.connectedCallback();
|
|
136
|
+
document.addEventListener('click', this.#handleGlobalClick, true);
|
|
137
|
+
window.addEventListener('pointerdown', this.#handleGlobalPointerDown);
|
|
84
138
|
requestAnimationFrame(() => requestAnimationFrame(() => this.removeAttribute('notransition')));
|
|
85
139
|
}
|
|
86
140
|
disconnectedCallback() {
|
|
87
141
|
this._cleanup();
|
|
142
|
+
document.removeEventListener('click', this.#handleGlobalClick, true);
|
|
143
|
+
window.removeEventListener('pointerdown', this.#handleGlobalPointerDown);
|
|
88
144
|
super.disconnectedCallback();
|
|
89
145
|
}
|
|
90
146
|
updated(changedProperties) {
|
|
91
|
-
if (changedProperties.has('open'))
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
147
|
+
if (!changedProperties.has('open'))
|
|
148
|
+
return;
|
|
149
|
+
this.#syncTriggerAria();
|
|
150
|
+
if (this.open)
|
|
151
|
+
this.#show();
|
|
152
|
+
else
|
|
153
|
+
this.#hide();
|
|
98
154
|
}
|
|
99
155
|
[(_a = autoAttachToParent, handleControlChange)](prev, next) {
|
|
100
156
|
if (prev) {
|
|
101
157
|
prev.removeEventListener('click', this.#handleTriggerClick);
|
|
102
|
-
prev.removeEventListener('
|
|
158
|
+
prev.removeEventListener('pointerdown', this.#handleTriggerPointerDown);
|
|
103
159
|
}
|
|
104
160
|
if (next) {
|
|
105
161
|
next.addEventListener('click', this.#handleTriggerClick);
|
|
106
|
-
next.addEventListener('
|
|
162
|
+
next.addEventListener('pointerdown', this.#handleTriggerPointerDown);
|
|
107
163
|
const ariaNext = this.$ariaControl ? this.$ariaControl : next;
|
|
108
164
|
if (!next.ariaHasPopup)
|
|
109
165
|
ariaNext.ariaHasPopup = 'true';
|
|
110
166
|
ariaNext.ariaExpanded = String(this.open);
|
|
111
167
|
}
|
|
112
168
|
}
|
|
169
|
+
#$lastFocused;
|
|
170
|
+
#pointerType;
|
|
171
|
+
#pointerPath;
|
|
113
172
|
#handleRequestHide;
|
|
114
|
-
// #allowHidePopover = false;
|
|
115
|
-
// #handleBeforeToggle = (e: ToggleEvent) => {
|
|
116
|
-
// // Intercept browser light-dismiss (ESC, click outside) or external hidePopover() calls
|
|
117
|
-
// if (e.newState === 'closed' && !this.#allowHidePopover) {
|
|
118
|
-
// e.preventDefault();
|
|
119
|
-
// if (this.open) {
|
|
120
|
-
// this.hide();
|
|
121
|
-
// }
|
|
122
|
-
// }
|
|
123
|
-
// };
|
|
124
|
-
#handleToggle;
|
|
125
173
|
#handleFocusOut;
|
|
174
|
+
#handleKeyDown;
|
|
126
175
|
#handleTriggerClick;
|
|
176
|
+
#handleTriggerPointerDown;
|
|
177
|
+
#handleGlobalClick;
|
|
178
|
+
#handleGlobalPointerDown;
|
|
127
179
|
#syncTriggerAria() {
|
|
128
180
|
if (this.$ariaControl)
|
|
129
181
|
this.$ariaControl.ariaExpanded = String(this.open);
|
|
@@ -142,53 +194,52 @@ let Popup = class Popup extends Attachable(InternalsAttached(LitElement)) {
|
|
|
142
194
|
firstTabbable?.focus();
|
|
143
195
|
}
|
|
144
196
|
}
|
|
145
|
-
|
|
197
|
+
toggle() {
|
|
146
198
|
this.open = !this.open;
|
|
147
199
|
}
|
|
148
|
-
|
|
149
|
-
this.open
|
|
200
|
+
show() {
|
|
201
|
+
if (!this.open)
|
|
202
|
+
this.open = true;
|
|
150
203
|
}
|
|
151
|
-
|
|
152
|
-
this.open
|
|
204
|
+
hide() {
|
|
205
|
+
if (this.open)
|
|
206
|
+
this.open = false;
|
|
153
207
|
}
|
|
154
|
-
async
|
|
155
|
-
|
|
156
|
-
this
|
|
208
|
+
async #show() {
|
|
209
|
+
this.#$lastFocused = this.$control
|
|
210
|
+
? this.$control
|
|
211
|
+
: document.activeElement instanceof HTMLElement
|
|
212
|
+
? document.activeElement
|
|
213
|
+
: null;
|
|
157
214
|
const trigger = this.$control;
|
|
215
|
+
if (this.isConnected && !this.matches(':popover-open'))
|
|
216
|
+
this.showPopover({ source: trigger ?? undefined });
|
|
158
217
|
if (trigger) {
|
|
159
218
|
this._cleanup();
|
|
160
219
|
this.#cleanupAutoUpdate = autoUpdate(trigger, this, () => this.#reposition());
|
|
161
220
|
await this.#reposition();
|
|
162
221
|
}
|
|
163
|
-
// await this._showing();
|
|
164
222
|
requestAnimationFrame(() => {
|
|
165
223
|
if (this.open)
|
|
166
224
|
this.#focusFirstInteractiveElement();
|
|
167
225
|
});
|
|
168
226
|
}
|
|
169
|
-
|
|
170
|
-
// await this._hiding();
|
|
227
|
+
#hide() {
|
|
171
228
|
this._cleanup();
|
|
172
229
|
if (this.matches(':popover-open'))
|
|
173
230
|
this.hidePopover();
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
// } finally {
|
|
179
|
-
// this.#allowHidePopover = false;
|
|
180
|
-
// }
|
|
181
|
-
// }
|
|
231
|
+
const lastFocused = this.#$lastFocused;
|
|
232
|
+
this.#$lastFocused = null;
|
|
233
|
+
if (!this.noFocusControl)
|
|
234
|
+
lastFocused?.focus?.();
|
|
182
235
|
}
|
|
183
|
-
// async _showing(): Promise<void> {}
|
|
184
|
-
// async _hiding(): Promise<void> {}
|
|
185
236
|
#cleanupAutoUpdate;
|
|
186
237
|
#dummyArrow;
|
|
187
238
|
async #reposition() {
|
|
188
239
|
const trigger = this.$control;
|
|
189
240
|
if (!trigger)
|
|
190
|
-
return;
|
|
191
|
-
|
|
241
|
+
return Promise.resolve();
|
|
242
|
+
return computePosition(trigger, this, {
|
|
192
243
|
placement: this.align,
|
|
193
244
|
strategy: this.strategy,
|
|
194
245
|
middleware: [
|
|
@@ -197,18 +248,19 @@ let Popup = class Popup extends Attachable(InternalsAttached(LitElement)) {
|
|
|
197
248
|
shift({ padding: this.windowPadding, crossAxis: true }),
|
|
198
249
|
arrow({ element: this.#dummyArrow }),
|
|
199
250
|
],
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
251
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
252
|
+
Object.assign(this.style, {
|
|
253
|
+
left: `${x}px`,
|
|
254
|
+
top: `${y}px`,
|
|
255
|
+
transformOrigin: transformOriginFromArrow(placement, middlewareData.arrow),
|
|
256
|
+
});
|
|
205
257
|
});
|
|
206
258
|
}
|
|
207
259
|
_cleanup() {
|
|
208
260
|
this.#cleanupAutoUpdate?.();
|
|
209
261
|
this.#cleanupAutoUpdate = undefined;
|
|
210
262
|
}
|
|
211
|
-
}
|
|
263
|
+
}
|
|
212
264
|
__decorate([
|
|
213
265
|
property({ type: Boolean, reflect: true })
|
|
214
266
|
], Popup.prototype, "open", void 0);
|
|
@@ -227,7 +279,3 @@ __decorate([
|
|
|
227
279
|
__decorate([
|
|
228
280
|
property({ type: Number, attribute: 'window-padding' })
|
|
229
281
|
], Popup.prototype, "windowPadding", void 0);
|
|
230
|
-
Popup = __decorate([
|
|
231
|
-
customElement('complementary-popup')
|
|
232
|
-
], Popup);
|
|
233
|
-
export { Popup };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function transformOriginFromArrow(placement, arrowData) {
|
|
2
|
+
const { x: arrowX, y: arrowY } = arrowData || {};
|
|
3
|
+
const [side] = placement.split('-');
|
|
4
|
+
let originX = '';
|
|
5
|
+
let originY = '';
|
|
6
|
+
if (side === 'top') {
|
|
7
|
+
originX = arrowX != null ? `${arrowX}px` : 'center';
|
|
8
|
+
originY = 'bottom';
|
|
9
|
+
}
|
|
10
|
+
else if (side === 'bottom') {
|
|
11
|
+
originX = arrowX != null ? `${arrowX}px` : 'center';
|
|
12
|
+
originY = 'top';
|
|
13
|
+
}
|
|
14
|
+
else if (side === 'left') {
|
|
15
|
+
originX = 'right';
|
|
16
|
+
originY = arrowY != null ? `${arrowY}px` : 'center';
|
|
17
|
+
}
|
|
18
|
+
else if (side === 'right') {
|
|
19
|
+
originX = 'left';
|
|
20
|
+
originY = arrowY != null ? `${arrowY}px` : 'center';
|
|
21
|
+
}
|
|
22
|
+
return `${originX} ${originY}`;
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
declare const ProgressBar_base: Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* Not suitable for purely indeterminate progress component. For example,
|
|
5
|
+
* loading indicator in Material Design 3 should not extend this.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ProgressBar extends ProgressBar_base {
|
|
8
|
+
value: number;
|
|
9
|
+
indeterminate: boolean;
|
|
10
|
+
constructor();
|
|
11
|
+
updated(changedProperties: PropertyValues): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { property } from 'lit/decorators.js';
|
|
4
|
+
import { InternalsAttached, internals } from './mixins/internals-attached.js';
|
|
5
|
+
/**
|
|
6
|
+
* Not suitable for purely indeterminate progress component. For example,
|
|
7
|
+
* loading indicator in Material Design 3 should not extend this.
|
|
8
|
+
*/
|
|
9
|
+
export class ProgressBar extends InternalsAttached(LitElement) {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.value = 0;
|
|
13
|
+
this.indeterminate = false;
|
|
14
|
+
this[internals].role = 'progressbar';
|
|
15
|
+
this[internals].ariaValueMin = '0';
|
|
16
|
+
this[internals].ariaValueMax = '100';
|
|
17
|
+
}
|
|
18
|
+
updated(changedProperties) {
|
|
19
|
+
if (changedProperties.has('value')) {
|
|
20
|
+
if (this.indeterminate)
|
|
21
|
+
this[internals].ariaValueNow = null;
|
|
22
|
+
else
|
|
23
|
+
this[internals].ariaValueNow = String(this.value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
__decorate([
|
|
28
|
+
property({ type: Number })
|
|
29
|
+
], ProgressBar.prototype, "value", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: Boolean, reflect: true })
|
|
32
|
+
], ProgressBar.prototype, "indeterminate", void 0);
|
package/src/base/slider.d.ts
CHANGED
package/src/base/slider.js
CHANGED
package/src/base/tooltip.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { handleControlChange } from './mixins/attachable.js';
|
|
3
3
|
declare const Base: Constructor<import("./mixins/attachable.js").AttachableInterface> & Constructor<import("./mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
|
|
4
4
|
/**
|
|
5
5
|
* TODO: Check if $control controls a menu/popover and keep hidden when it is open.
|
|
6
|
+
* TODO: Allow adding a real arrow
|
|
6
7
|
*/
|
|
7
8
|
export declare class Tooltip extends Base {
|
|
8
9
|
#private;
|
|
@@ -21,18 +22,18 @@ export declare class Tooltip extends Base {
|
|
|
21
22
|
};
|
|
22
23
|
recentlyShowed: number;
|
|
23
24
|
};
|
|
24
|
-
readonly _durations: {
|
|
25
|
-
show: number;
|
|
26
|
-
hide: number;
|
|
27
|
-
};
|
|
28
25
|
align: import('@floating-ui/dom').Placement;
|
|
29
26
|
offset: number;
|
|
27
|
+
windowPadding: number;
|
|
30
28
|
forceInvisible: boolean;
|
|
31
|
-
|
|
29
|
+
open: boolean;
|
|
30
|
+
static styles: any[];
|
|
32
31
|
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
-
private readonly popoverController;
|
|
34
32
|
constructor();
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
35
35
|
[handleControlChange](prev?: HTMLElement | null, next?: HTMLElement | null): void;
|
|
36
|
-
|
|
36
|
+
reposition(): Promise<void>;
|
|
37
|
+
_cleanup(): void;
|
|
37
38
|
}
|
|
38
39
|
export {};
|