@vollowx/seele 0.13.5 → 0.13.6
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 +56 -0
- package/src/base/autocomplete.js +75 -87
- 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 +76 -0
- package/src/base/menu.js +135 -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/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 +8 -0
- package/src/m3/autocomplete/autocomplete.js +10 -10
- package/src/m3/badge/badge.d.ts +12 -0
- package/src/m3/badge/badge.js +24 -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-spring.d.ts +45 -0
- package/src/m3/dialog/dialog-spring.js +83 -86
- 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 +22 -0
- package/src/m3/list/list-item.js +18 -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 +13 -0
- package/src/m3/select/select.js +16 -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/win98/button/radio.d.ts +3 -0
- package/src/win98/button/radio.js +5 -4
- package/src/win98/radio/radio.d.ts +3 -0
- package/src/win98/radio/radio.js +5 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ToggleButton } from '../../base/toggle-button.js';
|
|
2
|
+
import '../focus-ring/focus-ring.js';
|
|
3
|
+
import { M3Ripple } from '../ripple/ripple.js';
|
|
4
|
+
/**
|
|
5
|
+
* @tag md-switch
|
|
6
|
+
*
|
|
7
|
+
* @csspart thumb
|
|
8
|
+
* @csspart label
|
|
9
|
+
*/
|
|
10
|
+
export declare class M3Switch extends ToggleButton {
|
|
11
|
+
#private;
|
|
12
|
+
$ripple: M3Ripple;
|
|
13
|
+
$thumb: HTMLSpanElement;
|
|
14
|
+
static styles: any[];
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
renderOnIcon(): import("lit-html").TemplateResult<1>;
|
|
17
|
+
renderOffIcon(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
icons: boolean;
|
|
21
|
+
checkedIconOnly: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface HTMLElementTagNameMap {
|
|
25
|
+
'md-switch': M3Switch;
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/m3/switch/switch.js
CHANGED
|
@@ -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 { ToggleButton } from '../../base/toggle-button.js';
|
|
@@ -8,25 +8,67 @@ import { targetStyles } from '../target-styles.css.js';
|
|
|
8
8
|
function isRTL() {
|
|
9
9
|
return document.documentElement.dir === 'rtl';
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @tag md-switch
|
|
13
|
+
*
|
|
14
|
+
* @csspart thumb
|
|
15
|
+
* @csspart label
|
|
16
|
+
*/
|
|
17
|
+
let M3Switch = class M3Switch extends ToggleButton {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.icons = false;
|
|
21
|
+
this.checkedIconOnly = false;
|
|
22
|
+
this.#pointerDownX = 0;
|
|
23
|
+
this.#handlePointerDown = (e) => {
|
|
24
|
+
this._ignoreClick = false;
|
|
25
|
+
if (e.button !== 0)
|
|
26
|
+
return;
|
|
27
|
+
this.#pointerDownX = e.clientX;
|
|
28
|
+
this.setPointerCapture(e.pointerId);
|
|
29
|
+
this.addEventListener('pointermove', this.#handlePointerMove);
|
|
30
|
+
};
|
|
31
|
+
this.#handlePointerMove = (e) => {
|
|
32
|
+
const diff = (isRTL() ? -1 : 1) * (e.clientX - this.#pointerDownX);
|
|
33
|
+
this._ignoreClick = true;
|
|
34
|
+
const limitedDiff = this.checked
|
|
35
|
+
? Math.min(0, Math.max(-20, diff))
|
|
36
|
+
: Math.min(20, Math.max(0, diff));
|
|
37
|
+
this.$thumb.style.setProperty('--_thumb-diff-pointer', `${2 * limitedDiff}px`);
|
|
38
|
+
// Thumb loses its `:active` status before pointer up event
|
|
39
|
+
this.$thumb.style.setProperty('--_thumb-diameter', '28px');
|
|
40
|
+
this.$thumb.style.transitionDuration = '0s';
|
|
41
|
+
};
|
|
42
|
+
this.#handlePointerUp = (e) => {
|
|
43
|
+
this.removeEventListener('pointermove', this.#handlePointerMove);
|
|
44
|
+
this.releasePointerCapture(e.pointerId);
|
|
45
|
+
const trackRect = this.getBoundingClientRect();
|
|
46
|
+
const thumbRect = this.$thumb.getBoundingClientRect();
|
|
47
|
+
const diff = thumbRect.left +
|
|
48
|
+
thumbRect.width / 2 -
|
|
49
|
+
trackRect.left -
|
|
50
|
+
trackRect.width / 2;
|
|
51
|
+
const shouldBeChecked = (diff >= 0 && !isRTL()) || (diff < 0 && isRTL());
|
|
52
|
+
this.$thumb.style.setProperty('--_thumb-diff-pointer', '');
|
|
53
|
+
this.$thumb.style.setProperty('--_thumb-diameter', '');
|
|
54
|
+
this.$thumb.style.transitionDuration = '';
|
|
55
|
+
if (this.checked != shouldBeChecked)
|
|
56
|
+
this.toggleChecked();
|
|
57
|
+
};
|
|
17
58
|
}
|
|
59
|
+
static { this.styles = [targetStyles, switchStyles]; }
|
|
18
60
|
render() {
|
|
19
|
-
return html`<md-focus-ring></md-focus-ring><div part="thumb"><md-ripple spacebehavior="always"></md-ripple><span part="target"></span> ${this.renderOffIcon()}${this.renderOnIcon()}</div>`;
|
|
61
|
+
return html `<md-focus-ring></md-focus-ring><div part="thumb"><md-ripple spacebehavior="always"></md-ripple><span part="target"></span> ${this.renderOffIcon()}${this.renderOnIcon()}</div>`;
|
|
20
62
|
}
|
|
21
63
|
renderOnIcon() {
|
|
22
|
-
return html`<svg part="icons icon-on" viewBox="0 0 24 24" aria-hidden="true"><path d="M9.55 18.2 3.65 12.3 5.275 10.675 9.55 14.95 18.725 5.775 20.35 7.4Z"/></svg>`;
|
|
64
|
+
return html `<svg part="icons icon-on" viewBox="0 0 24 24" aria-hidden="true"><path d="M9.55 18.2 3.65 12.3 5.275 10.675 9.55 14.95 18.725 5.775 20.35 7.4Z"/></svg>`;
|
|
23
65
|
}
|
|
24
66
|
renderOffIcon() {
|
|
25
|
-
return html`<svg part="icons icon-off" viewBox="0 0 24 24" aria-hidden="true"><path d="M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z"/></svg>`;
|
|
67
|
+
return html `<svg part="icons icon-off" viewBox="0 0 24 24" aria-hidden="true"><path d="M6.4 19.2 4.8 17.6 10.4 12 4.8 6.4 6.4 4.8 12 10.4 17.6 4.8 19.2 6.4 13.6 12 19.2 17.6 17.6 19.2 12 13.6Z"/></svg>`;
|
|
26
68
|
}
|
|
27
69
|
connectedCallback() {
|
|
28
70
|
super.connectedCallback();
|
|
29
|
-
this.updateComplete.then(()=>{
|
|
71
|
+
this.updateComplete.then(() => {
|
|
30
72
|
this.$ripple.attach(this);
|
|
31
73
|
});
|
|
32
74
|
this.addEventListener('pointerdown', this.#handlePointerDown);
|
|
@@ -41,53 +83,20 @@ export class M3Switch extends ToggleButton {
|
|
|
41
83
|
#handlePointerDown;
|
|
42
84
|
#handlePointerMove;
|
|
43
85
|
#handlePointerUp;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this._ignoreClick = false;
|
|
47
|
-
if (e.button !== 0) return;
|
|
48
|
-
this.#pointerDownX = e.clientX;
|
|
49
|
-
this.setPointerCapture(e.pointerId);
|
|
50
|
-
this.addEventListener('pointermove', this.#handlePointerMove);
|
|
51
|
-
}, this.#handlePointerMove = (e)=>{
|
|
52
|
-
const diff = (isRTL() ? -1 : 1) * (e.clientX - this.#pointerDownX);
|
|
53
|
-
this._ignoreClick = true;
|
|
54
|
-
const limitedDiff = this.checked ? Math.min(0, Math.max(-20, diff)) : Math.min(20, Math.max(0, diff));
|
|
55
|
-
this.$thumb.style.setProperty('--_thumb-diff-pointer', `${2 * limitedDiff}px`);
|
|
56
|
-
// Thumb loses its `:active` status before pointer up event
|
|
57
|
-
this.$thumb.style.setProperty('--_thumb-diameter', '28px');
|
|
58
|
-
this.$thumb.style.transitionDuration = '0s';
|
|
59
|
-
}, this.#handlePointerUp = (e)=>{
|
|
60
|
-
this.removeEventListener('pointermove', this.#handlePointerMove);
|
|
61
|
-
this.releasePointerCapture(e.pointerId);
|
|
62
|
-
const trackRect = this.getBoundingClientRect();
|
|
63
|
-
const thumbRect = this.$thumb.getBoundingClientRect();
|
|
64
|
-
const diff = thumbRect.left + thumbRect.width / 2 - trackRect.left - trackRect.width / 2;
|
|
65
|
-
const shouldBeChecked = diff >= 0 && !isRTL() || diff < 0 && isRTL();
|
|
66
|
-
this.$thumb.style.setProperty('--_thumb-diff-pointer', '');
|
|
67
|
-
this.$thumb.style.setProperty('--_thumb-diameter', '');
|
|
68
|
-
this.$thumb.style.transitionDuration = '';
|
|
69
|
-
if (this.checked != shouldBeChecked) this.toggleChecked();
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
_ts_decorate([
|
|
86
|
+
};
|
|
87
|
+
__decorate([
|
|
74
88
|
query('md-ripple')
|
|
75
89
|
], M3Switch.prototype, "$ripple", void 0);
|
|
76
|
-
|
|
90
|
+
__decorate([
|
|
77
91
|
query('[part~="thumb"]')
|
|
78
92
|
], M3Switch.prototype, "$thumb", void 0);
|
|
79
|
-
|
|
80
|
-
property({
|
|
81
|
-
type: Boolean,
|
|
82
|
-
reflect: true
|
|
83
|
-
})
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Boolean, reflect: true })
|
|
84
95
|
], M3Switch.prototype, "icons", void 0);
|
|
85
|
-
|
|
86
|
-
property({
|
|
87
|
-
type: Boolean,
|
|
88
|
-
reflect: true
|
|
89
|
-
})
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Boolean, reflect: true })
|
|
90
98
|
], M3Switch.prototype, "checkedIconOnly", void 0);
|
|
91
|
-
M3Switch =
|
|
99
|
+
M3Switch = __decorate([
|
|
92
100
|
customElement('md-switch')
|
|
93
101
|
], M3Switch);
|
|
102
|
+
export { M3Switch };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workaround for `CSSNumericValue.parse()` not being supported by Firefox
|
|
3
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/parse_static
|
|
4
|
+
*/
|
|
5
|
+
export declare const parseCSSNum: (css: string) => number;
|
|
6
|
+
/**
|
|
7
|
+
* https://m3.material.io/styles/motion/overview/specs
|
|
8
|
+
*/
|
|
9
|
+
export declare const getSpring: (element: HTMLElement, type: 'spatial' | 'effects', duration: 'fast' | 'default' | 'slow') => {
|
|
10
|
+
easing: string;
|
|
11
|
+
duration: number;
|
|
12
|
+
};
|
package/src/m3/system/motion.js
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Workaround for `CSSNumericValue.parse()` not being supported by Firefox
|
|
3
3
|
* https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/parse_static
|
|
4
|
-
*/
|
|
4
|
+
*/
|
|
5
|
+
export const parseCSSNum = (css) => {
|
|
5
6
|
if (typeof CSSNumericValue !== 'undefined') {
|
|
6
7
|
try {
|
|
7
8
|
return CSSNumericValue.parse(css).to('ms').value;
|
|
8
|
-
}
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
9
11
|
return 0;
|
|
10
12
|
}
|
|
11
|
-
}
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
12
15
|
css = css.trim().toLowerCase();
|
|
13
|
-
if (css.endsWith('ms'))
|
|
14
|
-
|
|
15
|
-
else
|
|
16
|
+
if (css.endsWith('ms'))
|
|
17
|
+
return parseFloat(css.substring(0, css.length - 2)) | 0;
|
|
18
|
+
else if (css.endsWith('s'))
|
|
19
|
+
return (parseFloat(css.substring(0, css.length - 1)) * 1000) | 0;
|
|
20
|
+
else
|
|
21
|
+
return 0;
|
|
16
22
|
}
|
|
17
23
|
};
|
|
18
24
|
/**
|
|
19
25
|
* https://m3.material.io/styles/motion/overview/specs
|
|
20
|
-
*/
|
|
26
|
+
*/
|
|
27
|
+
export const getSpring = (element, type, duration) => {
|
|
21
28
|
const styles = getComputedStyle(element);
|
|
22
|
-
const get = (suffix)=>styles.getPropertyValue(`--md-sys-motion-${type}-${duration}${suffix}`);
|
|
29
|
+
const get = (suffix) => styles.getPropertyValue(`--md-sys-motion-${type}-${duration}${suffix}`);
|
|
23
30
|
return {
|
|
24
31
|
easing: get('') || 'ease',
|
|
25
|
-
duration: parseCSSNum(get('-duration'))
|
|
32
|
+
duration: parseCSSNum(get('-duration')),
|
|
26
33
|
};
|
|
27
34
|
};
|
package/src/m3/tab/tab-panel.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { customElement } from 'lit/decorators.js';
|
|
3
3
|
import { TabPanel } from '../../base/tab-panel.js';
|
|
4
4
|
import { tabPanelStyles } from './tab-panel-styles.css.js';
|
|
5
|
-
|
|
6
|
-
static{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
M3TabPanel = _ts_decorate([
|
|
5
|
+
let M3TabPanel = class M3TabPanel extends TabPanel {
|
|
6
|
+
static { this.styles = [tabPanelStyles]; }
|
|
7
|
+
};
|
|
8
|
+
M3TabPanel = __decorate([
|
|
13
9
|
customElement('md-tab-panel')
|
|
14
10
|
], M3TabPanel);
|
|
11
|
+
export { M3TabPanel };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tab } from '../../base/tab.js';
|
|
2
|
+
import '../focus-ring/focus-ring.js';
|
|
3
|
+
import '../ripple/ripple.js';
|
|
4
|
+
/**
|
|
5
|
+
* @tag md-tab
|
|
6
|
+
*
|
|
7
|
+
* @slot icon - icon
|
|
8
|
+
* @slot - label
|
|
9
|
+
*/
|
|
10
|
+
export declare class M3Tab extends Tab {
|
|
11
|
+
$content: HTMLDivElement;
|
|
12
|
+
static styles: any[];
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'md-tab': M3Tab;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/m3/tab/tab.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, query } from 'lit/decorators.js';
|
|
4
4
|
import { Tab } from '../../base/tab.js';
|
|
@@ -6,20 +6,22 @@ import '../focus-ring/focus-ring.js';
|
|
|
6
6
|
import '../ripple/ripple.js';
|
|
7
7
|
import { targetStyles } from '../target-styles.css.js';
|
|
8
8
|
import { tabStyles } from './tab-styles.css.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @tag md-tab
|
|
11
|
+
*
|
|
12
|
+
* @slot icon - icon
|
|
13
|
+
* @slot - label
|
|
14
|
+
*/
|
|
15
|
+
let M3Tab = class M3Tab extends Tab {
|
|
16
|
+
static { this.styles = [targetStyles, tabStyles]; }
|
|
16
17
|
render() {
|
|
17
|
-
return html`<md-focus-ring inward></md-focus-ring><md-ripple inward></md-ripple><span part="target"></span><div part="content"><slot part="icon" name="icon" aria-hidden="true"></slot><slot part="label"></slot></div>`;
|
|
18
|
+
return html `<md-focus-ring inward></md-focus-ring><md-ripple inward></md-ripple><span part="target"></span><div part="content"><slot part="icon" name="icon" aria-hidden="true"></slot><slot part="label"></slot></div>`;
|
|
18
19
|
}
|
|
19
|
-
}
|
|
20
|
-
|
|
20
|
+
};
|
|
21
|
+
__decorate([
|
|
21
22
|
query('[part="content"]')
|
|
22
23
|
], M3Tab.prototype, "$content", void 0);
|
|
23
|
-
M3Tab =
|
|
24
|
+
M3Tab = __decorate([
|
|
24
25
|
customElement('md-tab')
|
|
25
26
|
], M3Tab);
|
|
27
|
+
export { M3Tab };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tabs } from '../../base/tabs.js';
|
|
2
|
+
import type { M3Tab } from './tab.js';
|
|
3
|
+
/**
|
|
4
|
+
* TODO: vertical tabs, tablist placement
|
|
5
|
+
*
|
|
6
|
+
* @tag md-tabs
|
|
7
|
+
*
|
|
8
|
+
* @csspart indicator
|
|
9
|
+
*
|
|
10
|
+
* @slot - tabs
|
|
11
|
+
*/
|
|
12
|
+
export declare class M3Tabs extends Tabs {
|
|
13
|
+
#private;
|
|
14
|
+
$indicator: HTMLElement;
|
|
15
|
+
secondary: boolean;
|
|
16
|
+
iconsAbove: boolean;
|
|
17
|
+
static styles: any[];
|
|
18
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
19
|
+
selectTab(selectedTab: M3Tab): void;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'md-tabs': M3Tabs;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/m3/tab/tabs.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
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 { computePosition, autoUpdate } from '@floating-ui/dom';
|
|
5
5
|
import { Tabs } from '../../base/tabs.js';
|
|
6
6
|
import { tabsStyles } from './tabs-styles.css.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* TODO: vertical tabs, tablist placement
|
|
9
|
+
*
|
|
10
|
+
* @tag md-tabs
|
|
11
|
+
*
|
|
12
|
+
* @csspart indicator
|
|
13
|
+
*
|
|
14
|
+
* @slot - tabs
|
|
15
|
+
*/
|
|
16
|
+
let M3Tabs = class M3Tabs extends Tabs {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.secondary = false;
|
|
20
|
+
this.iconsAbove = false;
|
|
13
21
|
}
|
|
22
|
+
#cleanup;
|
|
23
|
+
static { this.styles = [tabsStyles]; }
|
|
14
24
|
render() {
|
|
15
|
-
return html`${super.render()}<div part="indicator" role="presentation"></div>`;
|
|
25
|
+
return html `${super.render()}<div part="indicator" role="presentation"></div>`;
|
|
16
26
|
}
|
|
17
27
|
selectTab(selectedTab) {
|
|
18
28
|
super.selectTab(selectedTab);
|
|
@@ -21,40 +31,34 @@ export class M3Tabs extends Tabs {
|
|
|
21
31
|
// Another solution is using CSS anchor, which does not work across Shadow
|
|
22
32
|
// DOM for now.
|
|
23
33
|
this.#cleanup?.();
|
|
24
|
-
const updatePosition = ()=>{
|
|
34
|
+
const updatePosition = () => {
|
|
25
35
|
computePosition(selectedTab, this.$indicator, {
|
|
26
36
|
placement: 'bottom',
|
|
27
|
-
strategy: 'absolute'
|
|
28
|
-
}).then(({ x })=>{
|
|
29
|
-
const left = this.secondary ? x : x + 2;
|
|
30
|
-
const width = this.secondary
|
|
37
|
+
strategy: 'absolute',
|
|
38
|
+
}).then(({ x }) => {
|
|
39
|
+
const left = (this.secondary ? x : (x + 2));
|
|
40
|
+
const width = this.secondary
|
|
41
|
+
? selectedTab.offsetWidth
|
|
42
|
+
: (selectedTab.$content.offsetWidth - 4);
|
|
31
43
|
Object.assign(this.$indicator.style, {
|
|
32
44
|
left: `${left}px`,
|
|
33
|
-
width: `${width}px
|
|
45
|
+
width: `${width}px`,
|
|
34
46
|
});
|
|
35
47
|
});
|
|
36
48
|
};
|
|
37
49
|
this.#cleanup = autoUpdate(selectedTab, this.$indicator, updatePosition);
|
|
38
50
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
_ts_decorate([
|
|
51
|
+
};
|
|
52
|
+
__decorate([
|
|
44
53
|
query('[part="indicator"]')
|
|
45
54
|
], M3Tabs.prototype, "$indicator", void 0);
|
|
46
|
-
|
|
47
|
-
property({
|
|
48
|
-
type: Boolean,
|
|
49
|
-
reflect: true
|
|
50
|
-
})
|
|
55
|
+
__decorate([
|
|
56
|
+
property({ type: Boolean, reflect: true })
|
|
51
57
|
], M3Tabs.prototype, "secondary", void 0);
|
|
52
|
-
|
|
53
|
-
property({
|
|
54
|
-
type: Boolean,
|
|
55
|
-
reflect: true
|
|
56
|
-
})
|
|
58
|
+
__decorate([
|
|
59
|
+
property({ type: Boolean, reflect: true })
|
|
57
60
|
], M3Tabs.prototype, "iconsAbove", void 0);
|
|
58
|
-
M3Tabs =
|
|
61
|
+
M3Tabs = __decorate([
|
|
59
62
|
customElement('md-tabs')
|
|
60
63
|
], M3Tabs);
|
|
64
|
+
export { M3Tabs };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Input } from '../../base/input.js';
|
|
2
|
+
import '../field/filled-field.js';
|
|
3
|
+
export declare class M3FilledTextField extends Input {
|
|
4
|
+
label: string;
|
|
5
|
+
supportingText: string;
|
|
6
|
+
static styles: any[];
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'md-filled-text-field': M3FilledTextField;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,32 +1,27 @@
|
|
|
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 { Input } from '../../base/input.js';
|
|
5
5
|
import '../field/filled-field.js';
|
|
6
6
|
import { textFieldStyles } from './text-field-styles.css.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
let M3FilledTextField = class M3FilledTextField extends Input {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.label = '';
|
|
11
|
+
this.supportingText = '';
|
|
12
12
|
}
|
|
13
|
+
static { this.styles = [textFieldStyles]; }
|
|
13
14
|
render() {
|
|
14
|
-
return html`<md-filled-field label="${this.label}" supportingtext="${this.supportingText}" ?populated="${!!this.value}" ?disabled="${this.disabled}" ?focused="${this.focused}" ?error="${this.checkValidity() === false}">${super.render()}</md-filled-field>`;
|
|
15
|
+
return html `<md-filled-field label="${this.label}" supportingtext="${this.supportingText}" ?populated="${!!this.value}" ?disabled="${this.disabled}" ?focused="${this.focused}" ?error="${this.checkValidity() === false}">${super.render()}</md-filled-field>`;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
_ts_decorate([
|
|
21
|
-
property({
|
|
22
|
-
reflect: true
|
|
23
|
-
})
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
property({ reflect: true })
|
|
24
20
|
], M3FilledTextField.prototype, "label", void 0);
|
|
25
|
-
|
|
26
|
-
property({
|
|
27
|
-
reflect: true
|
|
28
|
-
})
|
|
21
|
+
__decorate([
|
|
22
|
+
property({ reflect: true })
|
|
29
23
|
], M3FilledTextField.prototype, "supportingText", void 0);
|
|
30
|
-
M3FilledTextField =
|
|
24
|
+
M3FilledTextField = __decorate([
|
|
31
25
|
customElement('md-filled-text-field')
|
|
32
26
|
], M3FilledTextField);
|
|
27
|
+
export { M3FilledTextField };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Input } from '../../base/input.js';
|
|
2
|
+
import '../field/outlined-field.js';
|
|
3
|
+
export declare class M3OutlinedTextField extends Input {
|
|
4
|
+
label: string;
|
|
5
|
+
supportingText: string;
|
|
6
|
+
static styles: any[];
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'md-outlined-text-field': M3OutlinedTextField;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,32 +1,27 @@
|
|
|
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 { Input } from '../../base/input.js';
|
|
5
5
|
import '../field/outlined-field.js';
|
|
6
6
|
import { textFieldStyles } from './text-field-styles.css.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
let M3OutlinedTextField = class M3OutlinedTextField extends Input {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.label = '';
|
|
11
|
+
this.supportingText = '';
|
|
12
12
|
}
|
|
13
|
+
static { this.styles = [textFieldStyles]; }
|
|
13
14
|
render() {
|
|
14
|
-
return html`<md-outlined-field label="${this.label}" supportingtext="${this.supportingText}" ?populated="${!!this.value}" ?disabled="${this.disabled}" ?focused="${this.focused}" ?error="${this.checkValidity() === false}">${super.render()}<slot slot="start" name="start"></slot><slot slot="end" name="end"></slot></md-outlined-field>`;
|
|
15
|
+
return html `<md-outlined-field label="${this.label}" supportingtext="${this.supportingText}" ?populated="${!!this.value}" ?disabled="${this.disabled}" ?focused="${this.focused}" ?error="${this.checkValidity() === false}">${super.render()}<slot slot="start" name="start"></slot><slot slot="end" name="end"></slot></md-outlined-field>`;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
_ts_decorate([
|
|
21
|
-
property({
|
|
22
|
-
reflect: true
|
|
23
|
-
})
|
|
17
|
+
};
|
|
18
|
+
__decorate([
|
|
19
|
+
property({ reflect: true })
|
|
24
20
|
], M3OutlinedTextField.prototype, "label", void 0);
|
|
25
|
-
|
|
26
|
-
property({
|
|
27
|
-
reflect: true
|
|
28
|
-
})
|
|
21
|
+
__decorate([
|
|
22
|
+
property({ reflect: true })
|
|
29
23
|
], M3OutlinedTextField.prototype, "supportingText", void 0);
|
|
30
|
-
M3OutlinedTextField =
|
|
24
|
+
M3OutlinedTextField = __decorate([
|
|
31
25
|
customElement('md-outlined-text-field')
|
|
32
26
|
], M3OutlinedTextField);
|
|
27
|
+
export { M3OutlinedTextField };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const M3Toolbar_base: Constructor<import("../../base/mixins/internals-attached.js").InternalsAttachedInterface> & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* @tag md-toolbar
|
|
5
|
+
*
|
|
6
|
+
* @csspart container
|
|
7
|
+
* @csspart fab-slot
|
|
8
|
+
*
|
|
9
|
+
* @slot - toolbar contents
|
|
10
|
+
* @slot fab - FAB element
|
|
11
|
+
*/
|
|
12
|
+
export declare class M3Toolbar extends M3Toolbar_base {
|
|
13
|
+
type: 'docked' | 'floating';
|
|
14
|
+
color: 'standard' | 'vibrant';
|
|
15
|
+
orientation: 'horizontal' | 'vertical';
|
|
16
|
+
static styles: any[];
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
constructor();
|
|
19
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'md-toolbar': M3Toolbar;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {};
|