@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/m3/dialog/dialog.js
CHANGED
|
@@ -1,20 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { query, state, customElement } from 'lit/decorators.js';
|
|
4
4
|
import { Dialog } from '../../base/dialog.js';
|
|
5
5
|
import { dialogStyles } from './dialog-styles.css.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* TODO: test if form actions `cancel` and other things related work - no,
|
|
8
|
+
* event listener needed
|
|
9
|
+
*
|
|
10
|
+
* @tag md-dialog
|
|
11
|
+
*
|
|
12
|
+
* @csspart container
|
|
13
|
+
* @csspart headline
|
|
14
|
+
* @csspart content
|
|
15
|
+
* @csspart actions
|
|
16
|
+
*
|
|
17
|
+
* @slot icon
|
|
18
|
+
* @slot headline
|
|
19
|
+
* @slot - content
|
|
20
|
+
* @slot actions
|
|
21
|
+
*/
|
|
22
|
+
let M3Dialog = class M3Dialog extends Dialog {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
// Was based on https://m3.material.io/styles/motion/easing-and-duration/applying-easing-and-duration#e5b958f0-435d-4e84-aed4-8d1ea395fa5c
|
|
26
|
+
// TODO: use curves and durations from motion physics
|
|
27
|
+
this._config = {
|
|
28
|
+
openEase: 'cubic-bezier(0, 0, 0, 1)',
|
|
29
|
+
closeEase: 'cubic-bezier(0.3, 0, 1, 1)',
|
|
30
|
+
vertSlide: 40,
|
|
31
|
+
openDur: 500,
|
|
32
|
+
closeDur: 200,
|
|
33
|
+
bodyFadeInDur: 200,
|
|
34
|
+
bodyFadeOutDur: 100,
|
|
35
|
+
};
|
|
36
|
+
this.hasIcon = false;
|
|
37
|
+
this.#activeAnimations = [];
|
|
38
|
+
this.#handleClick = (e) => {
|
|
39
|
+
const target = e.target;
|
|
40
|
+
if (!this.$container.contains(target) && !this.contains(target))
|
|
41
|
+
this.close();
|
|
42
|
+
};
|
|
43
|
+
this.#handleIconSlotChange = () => {
|
|
44
|
+
this.hasIcon = this.$icon.assignedElements({ flatten: true }).length > 0;
|
|
45
|
+
};
|
|
46
|
+
this.#opening = false;
|
|
47
|
+
this.#closing = false;
|
|
11
48
|
}
|
|
49
|
+
static { this.styles = [dialogStyles]; }
|
|
12
50
|
render() {
|
|
13
|
-
return html`<dialog part="dialog" @click="${this.#handleClick}" @cancel="${this._handleCancel}"><div part="container"><div part="body"><div part="headline" class="${this.hasIcon ? 'has-icon' : ''}"><slot name="icon" @slotchange="${this.#handleIconSlotChange}"></slot><slot name="headline"></slot></div><div part="content"><slot></slot></div><div class="actions-placeholder"></div></div><div part="actions"><slot name="actions"></slot></div></div></dialog><div part="scrim"></div>`;
|
|
51
|
+
return html `<dialog part="dialog" @click="${this.#handleClick}" @cancel="${this._handleCancel}"><div part="container"><div part="body"><div part="headline" class="${this.hasIcon ? 'has-icon' : ''}"><slot name="icon" @slotchange="${this.#handleIconSlotChange}"></slot><slot name="headline"></slot></div><div part="content"><slot></slot></div><div class="actions-placeholder"></div></div><div part="actions"><slot name="actions"></slot></div></div></dialog><div part="scrim"></div>`;
|
|
52
|
+
}
|
|
53
|
+
connectedCallback() {
|
|
54
|
+
super.connectedCallback();
|
|
55
|
+
queueMicrotask(this.#handleIconSlotChange);
|
|
56
|
+
// Which is not called on a SSR'd element
|
|
14
57
|
}
|
|
15
58
|
#activeAnimations;
|
|
16
59
|
#clearAnimations() {
|
|
17
|
-
this.#activeAnimations.forEach((anim)=>anim.cancel());
|
|
60
|
+
this.#activeAnimations.forEach((anim) => anim.cancel());
|
|
18
61
|
this.#activeAnimations = [];
|
|
19
62
|
this.#opening = this.#closing = false;
|
|
20
63
|
}
|
|
@@ -22,7 +65,8 @@ export class M3Dialog extends Dialog {
|
|
|
22
65
|
#handleIconSlotChange;
|
|
23
66
|
#opening;
|
|
24
67
|
show() {
|
|
25
|
-
if (this.#opening)
|
|
68
|
+
if (this.#opening)
|
|
69
|
+
return;
|
|
26
70
|
this.#clearAnimations();
|
|
27
71
|
this.#opening = true;
|
|
28
72
|
// Reset margins to allow browser centering
|
|
@@ -42,175 +86,104 @@ export class M3Dialog extends Dialog {
|
|
|
42
86
|
const container = this.$container.animate([
|
|
43
87
|
{
|
|
44
88
|
height: `${startHeight}px`,
|
|
45
|
-
transform: `translateY(-${this._config.vertSlide}px)
|
|
89
|
+
transform: `translateY(-${this._config.vertSlide}px)`,
|
|
46
90
|
},
|
|
47
91
|
{
|
|
48
92
|
height: `${endHeight}px`,
|
|
49
|
-
transform: 'translateY(0px)'
|
|
50
|
-
}
|
|
51
|
-
], {
|
|
52
|
-
duration: this._config.openDur,
|
|
53
|
-
easing: this._config.openEase
|
|
54
|
-
});
|
|
55
|
-
const scrim = this.$scrim.animate([
|
|
56
|
-
{
|
|
57
|
-
opacity: 0
|
|
93
|
+
transform: 'translateY(0px)',
|
|
58
94
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
], {
|
|
95
|
+
], { duration: this._config.openDur, easing: this._config.openEase });
|
|
96
|
+
const scrim = this.$scrim.animate([{ opacity: 0 }, { opacity: 0.32 }], {
|
|
63
97
|
duration: this._config.openDur,
|
|
64
98
|
easing: this._config.openEase,
|
|
65
|
-
fill: 'forwards'
|
|
99
|
+
fill: 'forwards',
|
|
66
100
|
});
|
|
67
|
-
const body = this.$body.animate([
|
|
68
|
-
{
|
|
69
|
-
opacity: 0.2
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
opacity: 1
|
|
73
|
-
}
|
|
74
|
-
], {
|
|
101
|
+
const body = this.$body.animate([{ opacity: 0.2 }, { opacity: 1 }], {
|
|
75
102
|
duration: this._config.bodyFadeInDur,
|
|
76
103
|
easing: 'linear',
|
|
77
|
-
fill: 'forwards'
|
|
104
|
+
fill: 'forwards',
|
|
78
105
|
});
|
|
79
|
-
const actions = this.$actions.animate([
|
|
80
|
-
{
|
|
81
|
-
opacity: 0.5
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
opacity: 1
|
|
85
|
-
}
|
|
86
|
-
], {
|
|
106
|
+
const actions = this.$actions.animate([{ opacity: 0.5 }, { opacity: 1 }], {
|
|
87
107
|
duration: this._config.bodyFadeInDur,
|
|
88
108
|
easing: 'linear',
|
|
89
|
-
fill: 'forwards'
|
|
109
|
+
fill: 'forwards',
|
|
90
110
|
});
|
|
91
111
|
this.#activeAnimations.push(container, scrim, body, actions);
|
|
92
|
-
container.onfinish = ()=>{
|
|
112
|
+
container.onfinish = () => {
|
|
93
113
|
this.$container.style.minHeight = '';
|
|
94
114
|
this.#clearAnimations();
|
|
95
115
|
};
|
|
96
116
|
}
|
|
97
117
|
#closing;
|
|
98
118
|
close() {
|
|
99
|
-
if (this.#closing)
|
|
119
|
+
if (this.#closing)
|
|
120
|
+
return;
|
|
100
121
|
this.#clearAnimations();
|
|
101
122
|
this.#closing = true;
|
|
102
123
|
const startHeight = this.$container.offsetHeight;
|
|
103
124
|
const endHeight = startHeight * 0.35;
|
|
104
125
|
this.$container.style.minHeight = '0px';
|
|
105
126
|
const containerSpatial = this.$container.animate([
|
|
106
|
-
{
|
|
107
|
-
height: `${startHeight}px`,
|
|
108
|
-
transform: 'translateY(0px)'
|
|
109
|
-
},
|
|
127
|
+
{ height: `${startHeight}px`, transform: 'translateY(0px)' },
|
|
110
128
|
{
|
|
111
129
|
height: `${endHeight}px`,
|
|
112
|
-
transform: `translateY(-${this._config.vertSlide}px)
|
|
113
|
-
}
|
|
130
|
+
transform: `translateY(-${this._config.vertSlide}px)`,
|
|
131
|
+
},
|
|
114
132
|
], {
|
|
115
133
|
duration: this._config.closeDur,
|
|
116
|
-
easing: this._config.closeEase
|
|
134
|
+
easing: this._config.closeEase,
|
|
117
135
|
});
|
|
118
|
-
const containerEffects = this.$container.animate([
|
|
119
|
-
{
|
|
120
|
-
opacity: 1
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
opacity: 0
|
|
124
|
-
}
|
|
125
|
-
], {
|
|
136
|
+
const containerEffects = this.$container.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
126
137
|
duration: this._config.closeDur - this._config.bodyFadeOutDur,
|
|
127
138
|
delay: this._config.bodyFadeOutDur,
|
|
128
139
|
easing: 'linear',
|
|
129
|
-
fill: 'forwards'
|
|
140
|
+
fill: 'forwards',
|
|
130
141
|
});
|
|
131
|
-
const scrim = this.$scrim.animate([
|
|
132
|
-
{
|
|
133
|
-
opacity: 0.32
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
opacity: 0
|
|
137
|
-
}
|
|
138
|
-
], {
|
|
142
|
+
const scrim = this.$scrim.animate([{ opacity: 0.32 }, { opacity: 0 }], {
|
|
139
143
|
duration: this._config.closeDur,
|
|
140
144
|
easing: this._config.closeEase,
|
|
141
|
-
fill: 'forwards'
|
|
145
|
+
fill: 'forwards',
|
|
142
146
|
});
|
|
143
|
-
const body = this.$body.animate([
|
|
144
|
-
{
|
|
145
|
-
opacity: 1
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
opacity: 0
|
|
149
|
-
}
|
|
150
|
-
], {
|
|
147
|
+
const body = this.$body.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
151
148
|
duration: this._config.bodyFadeOutDur,
|
|
152
149
|
easing: 'linear',
|
|
153
|
-
fill: 'forwards'
|
|
150
|
+
fill: 'forwards',
|
|
154
151
|
});
|
|
155
|
-
const actions = this.$actions.animate([
|
|
156
|
-
{
|
|
157
|
-
opacity: 1
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
opacity: 0
|
|
161
|
-
}
|
|
162
|
-
], {
|
|
152
|
+
const actions = this.$actions.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
163
153
|
duration: this._config.bodyFadeOutDur,
|
|
164
154
|
easing: 'linear',
|
|
165
|
-
fill: 'forwards'
|
|
155
|
+
fill: 'forwards',
|
|
166
156
|
});
|
|
167
157
|
this.#activeAnimations.push(containerSpatial, containerEffects, scrim, body, actions);
|
|
168
|
-
containerSpatial.onfinish = ()=>{
|
|
158
|
+
containerSpatial.onfinish = () => {
|
|
169
159
|
this.$container.style.minHeight = '';
|
|
170
160
|
super.close();
|
|
171
161
|
this.#clearAnimations();
|
|
172
162
|
};
|
|
173
163
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// TODO: use curves and durations from motion physics
|
|
177
|
-
this._config = {
|
|
178
|
-
openEase: 'cubic-bezier(0, 0, 0, 1)',
|
|
179
|
-
closeEase: 'cubic-bezier(0.3, 0, 1, 1)',
|
|
180
|
-
vertSlide: 40,
|
|
181
|
-
openDur: 500,
|
|
182
|
-
closeDur: 200,
|
|
183
|
-
bodyFadeInDur: 200,
|
|
184
|
-
bodyFadeOutDur: 100
|
|
185
|
-
}, this.hasIcon = false, this.#activeAnimations = [], this.#handleClick = (e)=>{
|
|
186
|
-
const target = e.target;
|
|
187
|
-
if (!this.$container.contains(target) && !this.contains(target)) this.close();
|
|
188
|
-
}, this.#handleIconSlotChange = (e)=>{
|
|
189
|
-
const slot = e.target;
|
|
190
|
-
this.hasIcon = slot.assignedElements({
|
|
191
|
-
flatten: true
|
|
192
|
-
}).length > 0;
|
|
193
|
-
}, this.#opening = false, this.#closing = false;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
_ts_decorate([
|
|
164
|
+
};
|
|
165
|
+
__decorate([
|
|
197
166
|
state()
|
|
198
167
|
], M3Dialog.prototype, "hasIcon", void 0);
|
|
199
|
-
|
|
168
|
+
__decorate([
|
|
200
169
|
query('[part=container]')
|
|
201
170
|
], M3Dialog.prototype, "$container", void 0);
|
|
202
|
-
|
|
171
|
+
__decorate([
|
|
203
172
|
query('[part=body]')
|
|
204
173
|
], M3Dialog.prototype, "$body", void 0);
|
|
205
|
-
|
|
174
|
+
__decorate([
|
|
175
|
+
query('[name=icon]')
|
|
176
|
+
], M3Dialog.prototype, "$icon", void 0);
|
|
177
|
+
__decorate([
|
|
206
178
|
query('[part=actions]')
|
|
207
179
|
], M3Dialog.prototype, "$actions", void 0);
|
|
208
|
-
|
|
180
|
+
__decorate([
|
|
209
181
|
query('.actions-placeholder')
|
|
210
182
|
], M3Dialog.prototype, "$actionsPlaceholder", void 0);
|
|
211
|
-
|
|
183
|
+
__decorate([
|
|
212
184
|
query('[part=scrim]')
|
|
213
185
|
], M3Dialog.prototype, "$scrim", void 0);
|
|
214
|
-
M3Dialog =
|
|
186
|
+
M3Dialog = __decorate([
|
|
215
187
|
customElement('md-dialog')
|
|
216
188
|
], M3Dialog);
|
|
189
|
+
export { M3Dialog };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class M3Divider extends LitElement {
|
|
3
|
+
vertical: boolean;
|
|
4
|
+
inset: boolean;
|
|
5
|
+
insetStart: boolean;
|
|
6
|
+
insetEnd: boolean;
|
|
7
|
+
static styles: any[];
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'md-divider': M3Divider;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { dividerStyles } from './divider-styles.css.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
let M3Divider = class M3Divider extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.vertical = false;
|
|
9
|
+
this.inset = false;
|
|
10
|
+
this.insetStart = false;
|
|
11
|
+
this.insetEnd = false;
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
_ts_decorate([
|
|
16
|
-
property({
|
|
17
|
-
type: Boolean,
|
|
18
|
-
reflect: false
|
|
19
|
-
})
|
|
13
|
+
static { this.styles = [dividerStyles]; }
|
|
14
|
+
};
|
|
15
|
+
__decorate([
|
|
16
|
+
property({ type: Boolean, reflect: false })
|
|
20
17
|
], M3Divider.prototype, "vertical", void 0);
|
|
21
|
-
|
|
22
|
-
property({
|
|
23
|
-
type: Boolean,
|
|
24
|
-
reflect: false
|
|
25
|
-
})
|
|
18
|
+
__decorate([
|
|
19
|
+
property({ type: Boolean, reflect: false })
|
|
26
20
|
], M3Divider.prototype, "inset", void 0);
|
|
27
|
-
|
|
28
|
-
property({
|
|
29
|
-
type: Boolean,
|
|
30
|
-
reflect: false,
|
|
31
|
-
attribute: 'inset-start'
|
|
32
|
-
})
|
|
21
|
+
__decorate([
|
|
22
|
+
property({ type: Boolean, reflect: false, attribute: 'inset-start' })
|
|
33
23
|
], M3Divider.prototype, "insetStart", void 0);
|
|
34
|
-
|
|
35
|
-
property({
|
|
36
|
-
type: Boolean,
|
|
37
|
-
reflect: false,
|
|
38
|
-
attribute: 'inset-end'
|
|
39
|
-
})
|
|
24
|
+
__decorate([
|
|
25
|
+
property({ type: Boolean, reflect: false, attribute: 'inset-end' })
|
|
40
26
|
], M3Divider.prototype, "insetEnd", void 0);
|
|
41
|
-
M3Divider =
|
|
27
|
+
M3Divider = __decorate([
|
|
42
28
|
customElement('md-divider')
|
|
43
29
|
], M3Divider);
|
|
30
|
+
export { M3Divider };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Button } from '../../base/button.js';
|
|
2
|
+
import '../focus-ring/focus-ring.js';
|
|
3
|
+
import '../ripple/ripple.js';
|
|
4
|
+
/**
|
|
5
|
+
* @tag md-fab
|
|
6
|
+
*
|
|
7
|
+
* @csspart icon
|
|
8
|
+
* @csspart label
|
|
9
|
+
*
|
|
10
|
+
* @slot - icon
|
|
11
|
+
* @slot label - label
|
|
12
|
+
*/
|
|
13
|
+
export declare class M3Fab extends Button {
|
|
14
|
+
size: 's' | 'm' | 'l';
|
|
15
|
+
color: 'surface' | 'primary-container' | 'secondary-container' | 'tertiary-container' | 'primary' | 'secondary' | 'tertiary';
|
|
16
|
+
static styles: any[];
|
|
17
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
declare global {
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
'md-fab': M3Fab;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/m3/fab/fab.js
CHANGED
|
@@ -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';
|
|
@@ -6,32 +6,33 @@ import '../focus-ring/focus-ring.js';
|
|
|
6
6
|
import '../ripple/ripple.js';
|
|
7
7
|
import { fabStyles } from './fab-styles.css.js';
|
|
8
8
|
import { targetStyles } from '../target-styles.css.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @tag md-fab
|
|
11
|
+
*
|
|
12
|
+
* @csspart icon
|
|
13
|
+
* @csspart label
|
|
14
|
+
*
|
|
15
|
+
* @slot - icon
|
|
16
|
+
* @slot label - label
|
|
17
|
+
*/
|
|
18
|
+
let M3Fab = class M3Fab extends Button {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.size = 's'; // s for default
|
|
22
|
+
this.color = 'primary';
|
|
16
23
|
}
|
|
24
|
+
static { this.styles = [...super.styles, targetStyles, fabStyles]; }
|
|
17
25
|
render() {
|
|
18
|
-
return html`<md-focus-ring></md-focus-ring><md-ripple></md-ripple><span part="target"></span><slot part="icon" aria-hidden="true"></slot><slot part="label" name="label"></slot>`;
|
|
26
|
+
return html `<md-focus-ring></md-focus-ring><md-ripple></md-ripple><span part="target"></span><slot part="icon" aria-hidden="true"></slot><slot part="label" name="label"></slot>`;
|
|
19
27
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
_ts_decorate([
|
|
26
|
-
property({
|
|
27
|
-
reflect: true
|
|
28
|
-
})
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
property({ reflect: true })
|
|
29
31
|
], M3Fab.prototype, "size", void 0);
|
|
30
|
-
|
|
31
|
-
property({
|
|
32
|
-
reflect: true
|
|
33
|
-
})
|
|
32
|
+
__decorate([
|
|
33
|
+
property({ reflect: true })
|
|
34
34
|
], M3Fab.prototype, "color", void 0);
|
|
35
|
-
M3Fab =
|
|
35
|
+
M3Fab = __decorate([
|
|
36
36
|
customElement('md-fab')
|
|
37
37
|
], M3Fab);
|
|
38
|
+
export { M3Fab };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
|
+
import { Field } from '../../base/field.js';
|
|
3
|
+
/**
|
|
4
|
+
* @fires {Event} change - Fired when the selected value has changed.
|
|
5
|
+
* @fires {Event} input - Fired when the selected value has changed.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class M3Field extends Field {
|
|
8
|
+
label: string;
|
|
9
|
+
supportingText: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
error: boolean;
|
|
12
|
+
focused: boolean;
|
|
13
|
+
populated: boolean;
|
|
14
|
+
hasLabel: boolean;
|
|
15
|
+
hasStart: boolean;
|
|
16
|
+
hasEnd: boolean;
|
|
17
|
+
static styles: any[];
|
|
18
|
+
render(): TemplateResult<1>;
|
|
19
|
+
/**
|
|
20
|
+
* Should be implemented by subclasses.
|
|
21
|
+
*/
|
|
22
|
+
protected abstract renderContainerContent(): TemplateResult;
|
|
23
|
+
protected renderSupportingText(): "" | TemplateResult<1>;
|
|
24
|
+
protected renderStart(): TemplateResult<1>;
|
|
25
|
+
protected renderEnd(): TemplateResult<1>;
|
|
26
|
+
update(changedProperties: PropertyValues): void;
|
|
27
|
+
protected handleSlotChange(e: Event): void;
|
|
28
|
+
}
|
package/src/m3/field/field.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { property, state } from 'lit/decorators.js';
|
|
4
4
|
import { Field } from '../../base/field.js';
|
|
@@ -6,26 +6,35 @@ import { fieldStyles } from './field-styles.css.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* @fires {Event} change - Fired when the selected value has changed.
|
|
8
8
|
* @fires {Event} input - Fired when the selected value has changed.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
*/
|
|
10
|
+
export class M3Field extends Field {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.label = '';
|
|
14
|
+
this.supportingText = '';
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
this.error = false;
|
|
17
|
+
this.focused = false;
|
|
18
|
+
this.populated = false;
|
|
19
|
+
this.hasLabel = false;
|
|
20
|
+
this.hasStart = false;
|
|
21
|
+
this.hasEnd = false;
|
|
14
22
|
}
|
|
23
|
+
static { this.styles = [fieldStyles]; }
|
|
15
24
|
render() {
|
|
16
|
-
return html`<div class="container">${this.renderContainerContent()}</div>${this.renderSupportingText()}`;
|
|
25
|
+
return html `<div class="container">${this.renderContainerContent()}</div>${this.renderSupportingText()}`;
|
|
17
26
|
}
|
|
18
27
|
renderSupportingText() {
|
|
19
28
|
if (!this.supportingText) {
|
|
20
29
|
return '';
|
|
21
30
|
}
|
|
22
|
-
return html`<div class="supporting-text">${this.supportingText}</div>`;
|
|
31
|
+
return html `<div class="supporting-text">${this.supportingText}</div>`;
|
|
23
32
|
}
|
|
24
33
|
renderStart() {
|
|
25
|
-
return html`<slot name="start" class="start" ?hidden="${!this.hasStart}" @slotchange="${this.handleSlotChange}"></slot>`;
|
|
34
|
+
return html `<slot name="start" class="start" ?hidden="${!this.hasStart}" @slotchange="${this.handleSlotChange}"></slot>`;
|
|
26
35
|
}
|
|
27
36
|
renderEnd() {
|
|
28
|
-
return html`<slot name="end" class="end" ?hidden="${!this.hasEnd}" @slotchange="${this.handleSlotChange}"></slot>`;
|
|
37
|
+
return html `<slot name="end" class="end" ?hidden="${!this.hasEnd}" @slotchange="${this.handleSlotChange}"></slot>`;
|
|
29
38
|
}
|
|
30
39
|
update(changedProperties) {
|
|
31
40
|
if (changedProperties.has('label')) {
|
|
@@ -35,61 +44,37 @@ import { fieldStyles } from './field-styles.css.js';
|
|
|
35
44
|
}
|
|
36
45
|
handleSlotChange(e) {
|
|
37
46
|
const slot = e.target;
|
|
38
|
-
const hasContent = slot.assignedNodes({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (slot.name === '
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
constructor(...args){
|
|
45
|
-
super(...args), this.label = '', this.supportingText = '', this.disabled = false, this.error = false, this.focused = false, this.populated = false, this.hasLabel = false, this.hasStart = false, this.hasEnd = false;
|
|
47
|
+
const hasContent = slot.assignedNodes({ flatten: true }).length > 0;
|
|
48
|
+
if (slot.name === 'start')
|
|
49
|
+
this.hasStart = hasContent;
|
|
50
|
+
if (slot.name === 'end')
|
|
51
|
+
this.hasEnd = hasContent;
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
|
-
|
|
49
|
-
property({
|
|
50
|
-
type: String,
|
|
51
|
-
reflect: true
|
|
52
|
-
})
|
|
54
|
+
__decorate([
|
|
55
|
+
property({ type: String, reflect: true })
|
|
53
56
|
], M3Field.prototype, "label", void 0);
|
|
54
|
-
|
|
55
|
-
property({
|
|
56
|
-
type: String,
|
|
57
|
-
reflect: true
|
|
58
|
-
})
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ type: String, reflect: true })
|
|
59
59
|
], M3Field.prototype, "supportingText", void 0);
|
|
60
|
-
|
|
61
|
-
property({
|
|
62
|
-
type: Boolean,
|
|
63
|
-
reflect: true
|
|
64
|
-
})
|
|
60
|
+
__decorate([
|
|
61
|
+
property({ type: Boolean, reflect: true })
|
|
65
62
|
], M3Field.prototype, "disabled", void 0);
|
|
66
|
-
|
|
67
|
-
property({
|
|
68
|
-
type: Boolean,
|
|
69
|
-
reflect: true
|
|
70
|
-
})
|
|
63
|
+
__decorate([
|
|
64
|
+
property({ type: Boolean, reflect: true })
|
|
71
65
|
], M3Field.prototype, "error", void 0);
|
|
72
|
-
|
|
73
|
-
property({
|
|
74
|
-
type: Boolean,
|
|
75
|
-
reflect: true
|
|
76
|
-
})
|
|
66
|
+
__decorate([
|
|
67
|
+
property({ type: Boolean, reflect: true })
|
|
77
68
|
], M3Field.prototype, "focused", void 0);
|
|
78
|
-
|
|
79
|
-
property({
|
|
80
|
-
type: Boolean,
|
|
81
|
-
reflect: true
|
|
82
|
-
})
|
|
69
|
+
__decorate([
|
|
70
|
+
property({ type: Boolean, reflect: true })
|
|
83
71
|
], M3Field.prototype, "populated", void 0);
|
|
84
|
-
|
|
85
|
-
property({
|
|
86
|
-
type: Boolean,
|
|
87
|
-
reflect: true
|
|
88
|
-
})
|
|
72
|
+
__decorate([
|
|
73
|
+
property({ type: Boolean, reflect: true })
|
|
89
74
|
], M3Field.prototype, "hasLabel", void 0);
|
|
90
|
-
|
|
75
|
+
__decorate([
|
|
91
76
|
state()
|
|
92
77
|
], M3Field.prototype, "hasStart", void 0);
|
|
93
|
-
|
|
78
|
+
__decorate([
|
|
94
79
|
state()
|
|
95
80
|
], M3Field.prototype, "hasEnd", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { M3Field } from './field.js';
|
|
2
|
+
import '../ripple/ripple.js';
|
|
3
|
+
export declare class M3FilledField extends M3Field {
|
|
4
|
+
static styles: any[];
|
|
5
|
+
protected renderContainerContent(): import("lit-html").TemplateResult<1>;
|
|
6
|
+
}
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'md-filled-field': M3FilledField;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { M3Field } from './field.js';
|
|
5
5
|
import '../ripple/ripple.js';
|
|
6
6
|
import { filledFieldStyles } from './filled-field-styles.css.js';
|
|
7
|
-
|
|
8
|
-
static{
|
|
9
|
-
this.styles = [
|
|
10
|
-
...super.styles,
|
|
11
|
-
filledFieldStyles
|
|
12
|
-
];
|
|
13
|
-
}
|
|
7
|
+
let M3FilledField = class M3FilledField extends M3Field {
|
|
8
|
+
static { this.styles = [...super.styles, filledFieldStyles]; }
|
|
14
9
|
renderContainerContent() {
|
|
15
|
-
return html`<md-ripple clickbehavior="none" enterbehavior="none" spacebehavior="none"></md-ripple>${this.renderStart()}<div class="middle"><span class="label">${this.label}</span><div class="input-wrapper"><slot></slot></div></div>${this.renderEnd()}`;
|
|
10
|
+
return html `<md-ripple clickbehavior="none" enterbehavior="none" spacebehavior="none"></md-ripple>${this.renderStart()}<div class="middle"><span class="label">${this.label}</span><div class="input-wrapper"><slot></slot></div></div>${this.renderEnd()}`;
|
|
16
11
|
}
|
|
17
|
-
}
|
|
18
|
-
M3FilledField =
|
|
12
|
+
};
|
|
13
|
+
M3FilledField = __decorate([
|
|
19
14
|
customElement('md-filled-field')
|
|
20
15
|
], M3FilledField);
|
|
16
|
+
export { M3FilledField };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { M3Field } from './field.js';
|
|
2
|
+
export declare class M3OutlinedField extends M3Field {
|
|
3
|
+
static styles: any[];
|
|
4
|
+
protected renderContainerContent(): import("lit-html").TemplateResult<1>;
|
|
5
|
+
protected renderOutline(): import("lit-html").TemplateResult<1>;
|
|
6
|
+
}
|
|
7
|
+
declare global {
|
|
8
|
+
interface HTMLElementTagNameMap {
|
|
9
|
+
'md-outlined-field': M3OutlinedField;
|
|
10
|
+
}
|
|
11
|
+
}
|