@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { Button } from '../../base/button.js';
|
|
@@ -7,42 +7,44 @@ import '../ripple/ripple.js';
|
|
|
7
7
|
import { targetStyles } from '../target-styles.css.js';
|
|
8
8
|
import { sharedButtonStyles } from './shared-button-styles.css.js';
|
|
9
9
|
import { iconButtonStyles } from './icon-button-styles.css.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @tag md-icon-button
|
|
12
|
+
*
|
|
13
|
+
* @csspart icon
|
|
14
|
+
*
|
|
15
|
+
* @slot - icon
|
|
16
|
+
*/
|
|
17
|
+
let M3IconButton = class M3IconButton extends Button {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.size = 's';
|
|
21
|
+
this.color = 'primary';
|
|
22
|
+
this.variant = 'text';
|
|
23
|
+
this.width = 'standard';
|
|
18
24
|
}
|
|
25
|
+
static { this.styles = [
|
|
26
|
+
...super.styles,
|
|
27
|
+
targetStyles,
|
|
28
|
+
sharedButtonStyles,
|
|
29
|
+
iconButtonStyles,
|
|
30
|
+
]; }
|
|
19
31
|
render() {
|
|
20
|
-
return html`<md-focus-ring></md-focus-ring><md-ripple></md-ripple><span part="target"></span><slot part="icon"></slot>`;
|
|
32
|
+
return html `<md-focus-ring></md-focus-ring><md-ripple></md-ripple><span part="target"></span><slot part="icon"></slot>`;
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
_ts_decorate([
|
|
27
|
-
property({
|
|
28
|
-
reflect: true
|
|
29
|
-
})
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
property({ reflect: true })
|
|
30
37
|
], M3IconButton.prototype, "size", void 0);
|
|
31
|
-
|
|
32
|
-
property({
|
|
33
|
-
reflect: true
|
|
34
|
-
})
|
|
38
|
+
__decorate([
|
|
39
|
+
property({ reflect: true })
|
|
35
40
|
], M3IconButton.prototype, "color", void 0);
|
|
36
|
-
|
|
37
|
-
property({
|
|
38
|
-
reflect: true
|
|
39
|
-
})
|
|
41
|
+
__decorate([
|
|
42
|
+
property({ reflect: true })
|
|
40
43
|
], M3IconButton.prototype, "variant", void 0);
|
|
41
|
-
|
|
42
|
-
property({
|
|
43
|
-
reflect: true
|
|
44
|
-
})
|
|
44
|
+
__decorate([
|
|
45
|
+
property({ reflect: true })
|
|
45
46
|
], M3IconButton.prototype, "width", void 0);
|
|
46
|
-
M3IconButton =
|
|
47
|
+
M3IconButton = __decorate([
|
|
47
48
|
customElement('md-icon-button')
|
|
48
49
|
], M3IconButton);
|
|
50
|
+
export { M3IconButton };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { ToggleButton } from '../../base/toggle-button.js';
|
|
3
|
+
/**
|
|
4
|
+
* @tag md-connected-button-group
|
|
5
|
+
*
|
|
6
|
+
* @slot - toggle buttons
|
|
7
|
+
*/
|
|
8
|
+
export declare class M3ConnectedButtonGroup extends LitElement {
|
|
9
|
+
#private;
|
|
10
|
+
multiple: boolean;
|
|
11
|
+
$buttons: Array<ToggleButton>;
|
|
12
|
+
static styles: any[];
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'md-connected-button-group': M3ConnectedButtonGroup;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../core/decorators.js';
|
|
5
5
|
import { connectedButtonGroupStyles } from './connected-button-group-styles.css.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @tag md-connected-button-group
|
|
8
|
+
*
|
|
9
|
+
* @slot - toggle buttons
|
|
10
|
+
*/
|
|
11
|
+
let M3ConnectedButtonGroup = class M3ConnectedButtonGroup extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.multiple = false;
|
|
15
|
+
this.#handleChange = (e) => {
|
|
16
|
+
this.$buttons.forEach((btn, _) => {
|
|
17
|
+
if (btn !== e.target && !this.multiple)
|
|
18
|
+
// NOTE: there will not be an event dispatched and user should listen on
|
|
19
|
+
// the button group directly.
|
|
20
|
+
btn.checked = false;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
11
23
|
}
|
|
24
|
+
static { this.styles = [connectedButtonGroupStyles]; }
|
|
12
25
|
render() {
|
|
13
|
-
return html`<slot @change="${this.#handleChange}"></slot>`;
|
|
26
|
+
return html `<slot @change="${this.#handleChange}"></slot>`;
|
|
14
27
|
}
|
|
15
28
|
#handleChange;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.$buttons.forEach((btn, _)=>{
|
|
20
|
-
if (btn !== e.target && !this.multiple) // NOTE: there will not be an event dispatched and user should listen on
|
|
21
|
-
// the button group directly.
|
|
22
|
-
btn.checked = false;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
_ts_decorate([
|
|
28
|
-
property({
|
|
29
|
-
type: Boolean
|
|
30
|
-
})
|
|
29
|
+
};
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: Boolean })
|
|
31
32
|
], M3ConnectedButtonGroup.prototype, "multiple", void 0);
|
|
32
|
-
|
|
33
|
+
__decorate([
|
|
33
34
|
queryAssignedElements()
|
|
34
35
|
], M3ConnectedButtonGroup.prototype, "$buttons", void 0);
|
|
35
|
-
M3ConnectedButtonGroup =
|
|
36
|
+
M3ConnectedButtonGroup = __decorate([
|
|
36
37
|
customElement('md-connected-button-group')
|
|
37
38
|
], M3ConnectedButtonGroup);
|
|
39
|
+
export { M3ConnectedButtonGroup };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @tag md-button-group
|
|
4
|
+
*
|
|
5
|
+
* @slot - buttons
|
|
6
|
+
*/
|
|
7
|
+
export declare class M3StandardButtonGroup extends LitElement {
|
|
8
|
+
#private;
|
|
9
|
+
size: 'xs' | 's' | '';
|
|
10
|
+
$buttons: Array<HTMLElement>;
|
|
11
|
+
static styles: any[];
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Passing no element resets all shape changes
|
|
17
|
+
*/
|
|
18
|
+
updateLayout(target?: HTMLElement | null): void;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'md-button-group': M3StandardButtonGroup;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement, html } from 'lit';
|
|
3
3
|
import { property, queryAssignedElements } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../core/decorators.js';
|
|
@@ -6,46 +6,76 @@ import { getSpring } from '../system/motion.js';
|
|
|
6
6
|
import { standardButtonGroupStyles } from './standard-button-group-styles.css.js';
|
|
7
7
|
const EXPAND_FACTOR = 1.15;
|
|
8
8
|
const shapeAnimation = Symbol('shapeAnimation');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @tag md-button-group
|
|
11
|
+
*
|
|
12
|
+
* @slot - buttons
|
|
13
|
+
*/
|
|
14
|
+
let M3StandardButtonGroup = class M3StandardButtonGroup extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.size = '';
|
|
18
|
+
this.#activeIndex = -1;
|
|
19
|
+
this.#baseWidths = [];
|
|
20
|
+
this.#handleSlotChange = () => {
|
|
21
|
+
this.#resizeObserver.disconnect();
|
|
22
|
+
this.$buttons.forEach((btn, i) => {
|
|
23
|
+
this.#baseWidths[i] = btn.getBoundingClientRect().width;
|
|
24
|
+
this.#resizeObserver.observe(btn);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
this.#handlePointerDown = (e) => {
|
|
28
|
+
if (this === e.target)
|
|
29
|
+
return;
|
|
30
|
+
this.updateLayout(e.target);
|
|
31
|
+
};
|
|
32
|
+
this.#handleKeyDown = (e) => {
|
|
33
|
+
if (e.key !== ' ' && e.key !== 'Enter')
|
|
34
|
+
return;
|
|
35
|
+
this.updateLayout(e.target);
|
|
36
|
+
};
|
|
37
|
+
this.#reset = (e) => {
|
|
38
|
+
if (e && e.type === 'keyup' && e.key !== ' ' && e.key !== 'Enter')
|
|
39
|
+
return;
|
|
40
|
+
if (this.#activeIndex !== -1) {
|
|
41
|
+
this.#activeIndex = -1;
|
|
42
|
+
this.updateLayout();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
14
45
|
}
|
|
46
|
+
static { this.styles = [standardButtonGroupStyles]; }
|
|
15
47
|
render() {
|
|
16
|
-
return html`<slot @slotchange="${this.#handleSlotChange}"></slot>`;
|
|
48
|
+
return html `<slot @slotchange="${this.#handleSlotChange}"></slot>`;
|
|
17
49
|
}
|
|
18
50
|
connectedCallback() {
|
|
19
51
|
super.connectedCallback();
|
|
20
52
|
this.addEventListener('pointerdown', this.#handlePointerDown);
|
|
21
|
-
this.addEventListener('keydown', this.#handleKeyDown, {
|
|
22
|
-
capture: true
|
|
23
|
-
});
|
|
53
|
+
this.addEventListener('keydown', this.#handleKeyDown, { capture: true });
|
|
24
54
|
window.addEventListener('pointerup', this.#reset);
|
|
25
55
|
window.addEventListener('pointercancel', this.#reset);
|
|
26
|
-
window.addEventListener('keyup', this.#reset, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
entries.forEach((entry)=>{
|
|
56
|
+
window.addEventListener('keyup', this.#reset, { capture: true });
|
|
57
|
+
this.#resizeObserver = new ResizeObserver((entries) => {
|
|
58
|
+
if (this.#activeIndex !== -1)
|
|
59
|
+
return; // Skip if animating
|
|
60
|
+
entries.forEach((entry) => {
|
|
32
61
|
const target = entry.target;
|
|
33
62
|
const index = this.$buttons.indexOf(target);
|
|
34
63
|
if (index !== -1) {
|
|
35
64
|
const currentWidth = target.style.width;
|
|
36
65
|
target.style.width = '';
|
|
37
66
|
this.#baseWidths[index] = entry.target.getBoundingClientRect().width;
|
|
38
|
-
if (currentWidth)
|
|
67
|
+
if (currentWidth)
|
|
68
|
+
target.style.width = currentWidth;
|
|
39
69
|
}
|
|
40
70
|
});
|
|
41
71
|
});
|
|
72
|
+
queueMicrotask(this.#handleSlotChange);
|
|
73
|
+
// Which is not called on a SSR'd element
|
|
42
74
|
}
|
|
43
75
|
disconnectedCallback() {
|
|
44
76
|
window.removeEventListener('pointerup', this.#reset);
|
|
45
77
|
window.removeEventListener('pointercancel', this.#reset);
|
|
46
|
-
window.removeEventListener('keyup', this.#reset, {
|
|
47
|
-
capture: true
|
|
48
|
-
});
|
|
78
|
+
window.removeEventListener('keyup', this.#reset, { capture: true });
|
|
49
79
|
this.#resizeObserver.disconnect();
|
|
50
80
|
super.disconnectedCallback();
|
|
51
81
|
}
|
|
@@ -57,38 +87,36 @@ export class M3StandardButtonGroup extends LitElement {
|
|
|
57
87
|
#handleKeyDown;
|
|
58
88
|
#reset;
|
|
59
89
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
90
|
+
* Passing no element resets all shape changes
|
|
91
|
+
*/
|
|
92
|
+
updateLayout(target = null) {
|
|
62
93
|
const pressedIndex = target ? this.$buttons.indexOf(target) : -1;
|
|
63
94
|
this.#activeIndex = pressedIndex;
|
|
64
95
|
const pressedBaseWidth = pressedIndex !== -1 ? this.#baseWidths[pressedIndex] : 0;
|
|
65
96
|
const expansionDelta = pressedBaseWidth * (EXPAND_FACTOR - 1);
|
|
66
97
|
const isPressedAtEdge = pressedIndex === 0 || pressedIndex === this.$buttons.length - 1;
|
|
67
|
-
this.$buttons.forEach((btn, i)=>{
|
|
98
|
+
this.$buttons.forEach((btn, i) => {
|
|
68
99
|
const currentWidth = btn.getBoundingClientRect().width;
|
|
69
100
|
let targetWidth = this.#baseWidths[i];
|
|
70
101
|
if (pressedIndex !== -1) {
|
|
71
102
|
if (i === pressedIndex) {
|
|
72
103
|
targetWidth = pressedBaseWidth * EXPAND_FACTOR;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
104
|
+
}
|
|
105
|
+
else if (Math.abs(i - pressedIndex) === 1) {
|
|
106
|
+
if (isPressedAtEdge)
|
|
107
|
+
targetWidth = this.#baseWidths[i] - expansionDelta;
|
|
108
|
+
else
|
|
109
|
+
targetWidth = this.#baseWidths[i] - expansionDelta / 2;
|
|
76
110
|
}
|
|
77
111
|
}
|
|
78
112
|
const spring = getSpring(this, 'spatial', 'fast');
|
|
79
|
-
if (btn[shapeAnimation])
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
width: `${currentWidth}px`
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
width: `${targetWidth}px`
|
|
86
|
-
}
|
|
87
|
-
], {
|
|
113
|
+
if (btn[shapeAnimation])
|
|
114
|
+
btn[shapeAnimation].cancel();
|
|
115
|
+
btn[shapeAnimation] = btn.animate([{ width: `${currentWidth}px` }, { width: `${targetWidth}px` }], {
|
|
88
116
|
...spring,
|
|
89
|
-
fill: 'forwards'
|
|
117
|
+
fill: 'forwards',
|
|
90
118
|
});
|
|
91
|
-
btn[shapeAnimation].onfinish = ()=>{
|
|
119
|
+
btn[shapeAnimation].onfinish = () => {
|
|
92
120
|
if (pressedIndex === -1) {
|
|
93
121
|
btn.style.width = '';
|
|
94
122
|
btn[shapeAnimation].cancel();
|
|
@@ -96,36 +124,14 @@ export class M3StandardButtonGroup extends LitElement {
|
|
|
96
124
|
};
|
|
97
125
|
});
|
|
98
126
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.$buttons.forEach((btn, i)=>{
|
|
103
|
-
this.#baseWidths[i] = btn.getBoundingClientRect().width;
|
|
104
|
-
this.#resizeObserver.observe(btn);
|
|
105
|
-
});
|
|
106
|
-
}, this.#handlePointerDown = (e)=>{
|
|
107
|
-
if (this === e.target) return;
|
|
108
|
-
this.updateLayout(e.target);
|
|
109
|
-
}, this.#handleKeyDown = (e)=>{
|
|
110
|
-
if (e.key !== ' ' && e.key !== 'Enter') return;
|
|
111
|
-
this.updateLayout(e.target);
|
|
112
|
-
}, this.#reset = (e)=>{
|
|
113
|
-
if (e && e.type === 'keyup' && e.key !== ' ' && e.key !== 'Enter') return;
|
|
114
|
-
if (this.#activeIndex !== -1) {
|
|
115
|
-
this.#activeIndex = -1;
|
|
116
|
-
this.updateLayout();
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
_ts_decorate([
|
|
122
|
-
property({
|
|
123
|
-
reflect: true
|
|
124
|
-
})
|
|
127
|
+
};
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ reflect: true })
|
|
125
130
|
], M3StandardButtonGroup.prototype, "size", void 0);
|
|
126
|
-
|
|
131
|
+
__decorate([
|
|
127
132
|
queryAssignedElements()
|
|
128
133
|
], M3StandardButtonGroup.prototype, "$buttons", void 0);
|
|
129
|
-
M3StandardButtonGroup =
|
|
134
|
+
M3StandardButtonGroup = __decorate([
|
|
130
135
|
customElement('md-button-group')
|
|
131
136
|
], M3StandardButtonGroup);
|
|
137
|
+
export { M3StandardButtonGroup };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Checkbox } from '../../base/checkbox.js';
|
|
2
|
+
import '../focus-ring/focus-ring.js';
|
|
3
|
+
import '../ripple/ripple.js';
|
|
4
|
+
import type { M3Ripple } from '../ripple/ripple.js';
|
|
5
|
+
/**
|
|
6
|
+
* @tag md-checkbox
|
|
7
|
+
*
|
|
8
|
+
* @csspart icon
|
|
9
|
+
* @csspart mark
|
|
10
|
+
* @csspart mark-short
|
|
11
|
+
* @csspart mark-long
|
|
12
|
+
*/
|
|
13
|
+
export declare class M3Checkbox extends Checkbox {
|
|
14
|
+
error: boolean;
|
|
15
|
+
$ripple: M3Ripple;
|
|
16
|
+
static styles: any[];
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
renderIcon(): import("lit-html").TemplateResult<1>;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'md-checkbox': M3Checkbox;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
4
|
import { Checkbox } from '../../base/checkbox.js';
|
|
@@ -6,40 +6,41 @@ import '../focus-ring/focus-ring.js';
|
|
|
6
6
|
import '../ripple/ripple.js';
|
|
7
7
|
import { checkboxStyles } from './checkbox-styles.css.js';
|
|
8
8
|
import { targetStyles } from '../target-styles.css.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @tag md-checkbox
|
|
11
|
+
*
|
|
12
|
+
* @csspart icon
|
|
13
|
+
* @csspart mark
|
|
14
|
+
* @csspart mark-short
|
|
15
|
+
* @csspart mark-long
|
|
16
|
+
*/
|
|
17
|
+
let M3Checkbox = class M3Checkbox extends Checkbox {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.error = false;
|
|
16
21
|
}
|
|
22
|
+
static { this.styles = [...super.styles, targetStyles, checkboxStyles]; }
|
|
17
23
|
render() {
|
|
18
|
-
return html`<md-focus-ring></md-focus-ring><md-ripple enterbehavior="none"></md-ripple><span part="target"></span> ${this.renderIcon()}`;
|
|
24
|
+
return html `<md-focus-ring></md-focus-ring><md-ripple enterbehavior="none"></md-ripple><span part="target"></span> ${this.renderIcon()}`;
|
|
19
25
|
}
|
|
20
26
|
renderIcon() {
|
|
21
|
-
return html`<svg part="icon" viewBox="0 0 18 18" aria-hidden="true"><rect part="mark mark-short"></rect><rect part="mark mark-long"></rect></svg>`;
|
|
27
|
+
return html `<svg part="icon" viewBox="0 0 18 18" aria-hidden="true"><rect part="mark mark-short"></rect><rect part="mark mark-long"></rect></svg>`;
|
|
22
28
|
}
|
|
23
29
|
connectedCallback() {
|
|
24
30
|
super.connectedCallback();
|
|
25
31
|
// SSR'd <md-checkbox> components don't have their labels set up on time
|
|
26
|
-
this.updateComplete.then(()=>{
|
|
32
|
+
this.updateComplete.then(() => {
|
|
27
33
|
this.$ripple.attach(this, true);
|
|
28
34
|
});
|
|
29
35
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
_ts_decorate([
|
|
35
|
-
property({
|
|
36
|
-
type: Boolean,
|
|
37
|
-
reflect: true
|
|
38
|
-
})
|
|
36
|
+
};
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ type: Boolean, reflect: true })
|
|
39
39
|
], M3Checkbox.prototype, "error", void 0);
|
|
40
|
-
|
|
40
|
+
__decorate([
|
|
41
41
|
query('md-ripple')
|
|
42
42
|
], M3Checkbox.prototype, "$ripple", void 0);
|
|
43
|
-
M3Checkbox =
|
|
43
|
+
M3Checkbox = __decorate([
|
|
44
44
|
customElement('md-checkbox')
|
|
45
45
|
], M3Checkbox);
|
|
46
|
+
export { M3Checkbox };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Dialog } from '../../base/dialog.js';
|
|
2
|
+
/**
|
|
3
|
+
* TODO: test if form actions `cancel` and other things related work - no,
|
|
4
|
+
* event listener needed
|
|
5
|
+
*
|
|
6
|
+
* @tag md-dialog
|
|
7
|
+
*
|
|
8
|
+
* @csspart container
|
|
9
|
+
* @csspart headline
|
|
10
|
+
* @csspart content
|
|
11
|
+
* @csspart actions
|
|
12
|
+
*
|
|
13
|
+
* @slot icon
|
|
14
|
+
* @slot headline
|
|
15
|
+
* @slot - content
|
|
16
|
+
* @slot actions
|
|
17
|
+
*/
|
|
18
|
+
export declare class M3Dialog extends Dialog {
|
|
19
|
+
#private;
|
|
20
|
+
_config: {
|
|
21
|
+
openEase: string;
|
|
22
|
+
closeEase: string;
|
|
23
|
+
vertSlide: number;
|
|
24
|
+
openDur: number;
|
|
25
|
+
closeDur: number;
|
|
26
|
+
bodyFadeInDur: number;
|
|
27
|
+
bodyFadeOutDur: number;
|
|
28
|
+
};
|
|
29
|
+
private hasIcon;
|
|
30
|
+
$container: HTMLDivElement;
|
|
31
|
+
$body: HTMLDivElement;
|
|
32
|
+
$icon: HTMLSlotElement;
|
|
33
|
+
$actions: HTMLDivElement;
|
|
34
|
+
$actionsPlaceholder: HTMLDivElement;
|
|
35
|
+
$scrim: HTMLDivElement;
|
|
36
|
+
static styles: any[];
|
|
37
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
38
|
+
connectedCallback(): void;
|
|
39
|
+
show(): void;
|
|
40
|
+
close(): void;
|
|
41
|
+
}
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
'md-dialog': M3Dialog;
|
|
45
|
+
}
|
|
46
|
+
}
|