tinkiet 0.11.2 → 0.11.8
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/accordion/index.js +72 -62
- package/box/index.js +58 -58
- package/button/button.d.ts +10 -3
- package/button/index.js +127 -92
- package/checkbox/checkbox.d.ts +2 -4
- package/checkbox/index.js +99 -86
- package/chip/chip.d.ts +1 -1
- package/chip/index.js +30 -8
- package/dialog/dialog.d.ts +6 -2
- package/dialog/index.js +29 -9
- package/drawer/drawer.d.ts +11 -6
- package/drawer/index.js +79 -49
- package/icon/icon.d.ts +2 -1
- package/icon/index.js +90 -76
- package/index.js +431 -296
- package/list-item/index.js +94 -88
- package/list-item/list-item.d.ts +4 -4
- package/loading/index.js +58 -58
- package/notie/index.js +58 -58
- package/package.json +1 -1
- package/radio/index.js +79 -79
- package/radio/radio.d.ts +2 -2
- package/router/index.d.ts +6 -0
- package/router/index.js +52 -40
- package/select/index.js +58 -58
- package/switch/index.js +75 -75
- package/switch/switch.d.ts +2 -2
- package/theme/index.js +23 -26
- package/theme/theme.d.ts +2 -1
- package/topbar/index.js +58 -58
- package/umd/tinkiet.min.js +87 -53
package/list-item/index.js
CHANGED
|
@@ -47,63 +47,69 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
|
|
|
47
47
|
return (0,external_lit_.html) `
|
|
48
48
|
<slot name="before" @click=${this.handleClick}></slot>
|
|
49
49
|
<div id="content">
|
|
50
|
-
<slot></slot>
|
|
50
|
+
<slot @slotchange=${this.ensureAriaLabel}></slot>
|
|
51
51
|
</div>
|
|
52
52
|
<slot name="after" @click=${this.handleClick}></slot>
|
|
53
53
|
${this.href
|
|
54
54
|
? (0,external_lit_.html) `
|
|
55
|
-
<a tabindex="-1" id="ahref" href
|
|
55
|
+
<a tabindex="-1" id="ahref" href=${this.href} target=${(0,if_defined_js_.ifDefined)(this.target)} rel="noreferrer" aria-label=${this.ariaLabel}></a>
|
|
56
56
|
`
|
|
57
|
-
:
|
|
57
|
+
: external_lit_.nothing}
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
60
|
constructor() {
|
|
61
61
|
super();
|
|
62
62
|
this.href = "";
|
|
63
63
|
this.target = "";
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
this.ariaLabel = "";
|
|
65
|
+
this.onKeyDown = (e) => {
|
|
66
|
+
if (e.code === "Space" || e.code === "Enter") {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
this.click();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.handleClick = (e) => {
|
|
73
|
+
const target = e.target;
|
|
74
|
+
// In case click cames from a slotted element with href attribute we stop propagation
|
|
75
|
+
if (target.tagName == "BUTTON" || target.tagName == "TK-BUTTON" || target.tagName == "TK-SWITCH" || target.tagName == "TK-CHECKBOX") {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (this.href && e.isTrusted && this.$ahref) {
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
this.$ahref.click();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
68
84
|
}
|
|
69
85
|
connectedCallback() {
|
|
70
86
|
super.connectedCallback();
|
|
71
|
-
this.
|
|
72
|
-
this.addEventListener("
|
|
87
|
+
this.ensureAriaLabel();
|
|
88
|
+
this.addEventListener("keydown", this.onKeyDown);
|
|
89
|
+
this.addEventListener("click", this.handleClick);
|
|
73
90
|
}
|
|
74
91
|
disconnectedCallback() {
|
|
75
92
|
super.disconnectedCallback();
|
|
76
93
|
this.removeEventListener("click", this.handleClick);
|
|
77
94
|
this.removeEventListener("keydown", this.onKeyDown);
|
|
78
95
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
e.stopPropagation();
|
|
83
|
-
this.click();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
handleClick(e) {
|
|
87
|
-
const target = e.target;
|
|
88
|
-
// In case click cames from a slotted element with href attribute we stop propagation
|
|
89
|
-
if (target.tagName == "BUTTON" || target.tagName == "TK-BUTTON" || target.tagName == "TK-SWITCH" || target.tagName == "TK-CHECKBOX") {
|
|
96
|
+
ensureAriaLabel() {
|
|
97
|
+
var _a;
|
|
98
|
+
if (this.ariaLabel)
|
|
90
99
|
return;
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
this.$ahref.click();
|
|
96
|
-
}
|
|
100
|
+
const text = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
|
101
|
+
if (text)
|
|
102
|
+
this.ariaLabel = text;
|
|
97
103
|
}
|
|
98
104
|
};
|
|
99
105
|
__decorate([
|
|
100
|
-
(0,decorators_js_.property)({
|
|
106
|
+
(0,decorators_js_.property)({ type: String, reflect: true })
|
|
101
107
|
], TkListItem.prototype, "href", void 0);
|
|
102
108
|
__decorate([
|
|
103
|
-
(0,decorators_js_.property)({
|
|
109
|
+
(0,decorators_js_.property)({ type: String, reflect: true })
|
|
104
110
|
], TkListItem.prototype, "target", void 0);
|
|
105
111
|
__decorate([
|
|
106
|
-
(0,decorators_js_.property)({ attribute: "aria-label" })
|
|
112
|
+
(0,decorators_js_.property)({ attribute: "aria-label", reflect: true })
|
|
107
113
|
], TkListItem.prototype, "ariaLabel", void 0);
|
|
108
114
|
__decorate([
|
|
109
115
|
(0,decorators_js_.query)("#ahref")
|
|
@@ -220,6 +226,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
220
226
|
* Activate ripple
|
|
221
227
|
*/
|
|
222
228
|
this.ripple = false;
|
|
229
|
+
this.showRipple = (event) => {
|
|
230
|
+
const x = event.clientX;
|
|
231
|
+
const y = event.clientY;
|
|
232
|
+
const { offsetWidth, offsetHeight } = this;
|
|
233
|
+
const container = document.createElement("span");
|
|
234
|
+
container.classList.add("ripple", "open");
|
|
235
|
+
const element = document.createElement("span");
|
|
236
|
+
container.appendChild(element);
|
|
237
|
+
this.shadowRoot.appendChild(container);
|
|
238
|
+
const rect = this.getBoundingClientRect();
|
|
239
|
+
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
240
|
+
element.style.width = element.style.height = diameter + "px";
|
|
241
|
+
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
242
|
+
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
243
|
+
const inAnimation = element.animate({
|
|
244
|
+
transform: [`scale(0)`, `scale(1)`]
|
|
245
|
+
}, {
|
|
246
|
+
easing: "ease-out",
|
|
247
|
+
fill: "both",
|
|
248
|
+
duration: 500
|
|
249
|
+
});
|
|
250
|
+
inAnimation.onfinish = () => {
|
|
251
|
+
container.classList.remove("open");
|
|
252
|
+
const outAnimation = element.animate({
|
|
253
|
+
opacity: ["0.5", "0"]
|
|
254
|
+
}, {
|
|
255
|
+
easing: "ease-in",
|
|
256
|
+
fill: "both",
|
|
257
|
+
duration: 300
|
|
258
|
+
});
|
|
259
|
+
outAnimation.onfinish = () => {
|
|
260
|
+
requestAnimationFrame(() => {
|
|
261
|
+
container.remove();
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
this.hideRipple = (event) => {
|
|
267
|
+
var _a;
|
|
268
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
269
|
+
const element = container.querySelector("span");
|
|
270
|
+
const outAnimation = element.animate({
|
|
271
|
+
opacity: ["0.5", "0"]
|
|
272
|
+
}, {
|
|
273
|
+
easing: "ease-out",
|
|
274
|
+
fill: "both",
|
|
275
|
+
duration: 300
|
|
276
|
+
});
|
|
277
|
+
outAnimation.onfinish = () => {
|
|
278
|
+
requestAnimationFrame(() => {
|
|
279
|
+
container.remove();
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
};
|
|
223
284
|
}
|
|
224
285
|
static get styles() {
|
|
225
286
|
return [
|
|
@@ -235,14 +296,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
235
296
|
}
|
|
236
297
|
connectedCallback() {
|
|
237
298
|
if (this.ripple) {
|
|
238
|
-
this.addEventListener("mousedown", this.showRipple
|
|
239
|
-
this.addEventListener("mouseup", this.hideRipple
|
|
299
|
+
this.addEventListener("mousedown", this.showRipple, { passive: true });
|
|
300
|
+
this.addEventListener("mouseup", this.hideRipple, { passive: true });
|
|
240
301
|
}
|
|
241
302
|
super.connectedCallback();
|
|
242
303
|
}
|
|
243
304
|
disconnectedCallback() {
|
|
244
305
|
this.removeEventListener("mousedown", this.showRipple);
|
|
245
|
-
this.
|
|
306
|
+
this.removeEventListener("mouseup", this.hideRipple);
|
|
246
307
|
super.disconnectedCallback();
|
|
247
308
|
}
|
|
248
309
|
updated(props) {
|
|
@@ -252,61 +313,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
252
313
|
// this.style.setProperty("color", this.color.toString());
|
|
253
314
|
super.updated(props);
|
|
254
315
|
}
|
|
255
|
-
showRipple(event) {
|
|
256
|
-
const x = event.clientX;
|
|
257
|
-
const y = event.clientY;
|
|
258
|
-
const { offsetWidth, offsetHeight } = this;
|
|
259
|
-
const container = document.createElement("span");
|
|
260
|
-
container.classList.add("ripple", "open");
|
|
261
|
-
const element = document.createElement("span");
|
|
262
|
-
container.appendChild(element);
|
|
263
|
-
this.shadowRoot.appendChild(container);
|
|
264
|
-
const rect = this.getBoundingClientRect();
|
|
265
|
-
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
266
|
-
element.style.width = element.style.height = diameter + "px";
|
|
267
|
-
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
268
|
-
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
269
|
-
const inAnimation = element.animate({
|
|
270
|
-
transform: [`scale(0)`, `scale(1)`]
|
|
271
|
-
}, {
|
|
272
|
-
easing: "ease-out",
|
|
273
|
-
fill: "both",
|
|
274
|
-
duration: 500
|
|
275
|
-
});
|
|
276
|
-
inAnimation.onfinish = () => {
|
|
277
|
-
container.classList.remove("open");
|
|
278
|
-
const outAnimation = element.animate({
|
|
279
|
-
opacity: ["0.5", "0"]
|
|
280
|
-
}, {
|
|
281
|
-
easing: "ease-in",
|
|
282
|
-
fill: "both",
|
|
283
|
-
duration: 300
|
|
284
|
-
});
|
|
285
|
-
outAnimation.onfinish = () => {
|
|
286
|
-
requestAnimationFrame(() => {
|
|
287
|
-
container.remove();
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
hideRipple(event) {
|
|
293
|
-
var _a;
|
|
294
|
-
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
295
|
-
const element = container.querySelector("span");
|
|
296
|
-
const outAnimation = element.animate({
|
|
297
|
-
opacity: ["0.5", "0"]
|
|
298
|
-
}, {
|
|
299
|
-
easing: "ease-out",
|
|
300
|
-
fill: "both",
|
|
301
|
-
duration: 300
|
|
302
|
-
});
|
|
303
|
-
outAnimation.onfinish = () => {
|
|
304
|
-
requestAnimationFrame(() => {
|
|
305
|
-
container.remove();
|
|
306
|
-
});
|
|
307
|
-
};
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
316
|
};
|
|
311
317
|
__decorate([
|
|
312
318
|
(0,decorators_js_.property)({ type: Boolean })
|
|
@@ -332,7 +338,7 @@ var x = (y) => {
|
|
|
332
338
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
333
339
|
}
|
|
334
340
|
var y = (x) => (() => (x))
|
|
335
|
-
module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
|
|
341
|
+
module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["nothing"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.nothing), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
|
|
336
342
|
|
|
337
343
|
/***/ }),
|
|
338
344
|
|
package/list-item/list-item.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ export declare class TkListItem extends TkBox {
|
|
|
4
4
|
href: string;
|
|
5
5
|
target: string;
|
|
6
6
|
ariaLabel: string;
|
|
7
|
-
protected $ahref
|
|
7
|
+
protected $ahref?: HTMLAnchorElement;
|
|
8
8
|
render(): import("lit").TemplateResult<1>;
|
|
9
9
|
constructor();
|
|
10
|
-
firstUpdated(): void;
|
|
11
10
|
connectedCallback(): void;
|
|
12
11
|
disconnectedCallback(): void;
|
|
13
|
-
protected onKeyDown(e: KeyboardEvent)
|
|
14
|
-
protected handleClick(e: Event)
|
|
12
|
+
protected onKeyDown: (e: KeyboardEvent) => void;
|
|
13
|
+
protected handleClick: (e: Event) => void;
|
|
14
|
+
private ensureAriaLabel;
|
|
15
15
|
}
|
|
16
16
|
declare global {
|
|
17
17
|
interface HTMLElementTagNameMap {
|
package/loading/index.js
CHANGED
|
@@ -108,6 +108,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
108
108
|
* Activate ripple
|
|
109
109
|
*/
|
|
110
110
|
this.ripple = false;
|
|
111
|
+
this.showRipple = (event) => {
|
|
112
|
+
const x = event.clientX;
|
|
113
|
+
const y = event.clientY;
|
|
114
|
+
const { offsetWidth, offsetHeight } = this;
|
|
115
|
+
const container = document.createElement("span");
|
|
116
|
+
container.classList.add("ripple", "open");
|
|
117
|
+
const element = document.createElement("span");
|
|
118
|
+
container.appendChild(element);
|
|
119
|
+
this.shadowRoot.appendChild(container);
|
|
120
|
+
const rect = this.getBoundingClientRect();
|
|
121
|
+
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
122
|
+
element.style.width = element.style.height = diameter + "px";
|
|
123
|
+
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
124
|
+
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
125
|
+
const inAnimation = element.animate({
|
|
126
|
+
transform: [`scale(0)`, `scale(1)`]
|
|
127
|
+
}, {
|
|
128
|
+
easing: "ease-out",
|
|
129
|
+
fill: "both",
|
|
130
|
+
duration: 500
|
|
131
|
+
});
|
|
132
|
+
inAnimation.onfinish = () => {
|
|
133
|
+
container.classList.remove("open");
|
|
134
|
+
const outAnimation = element.animate({
|
|
135
|
+
opacity: ["0.5", "0"]
|
|
136
|
+
}, {
|
|
137
|
+
easing: "ease-in",
|
|
138
|
+
fill: "both",
|
|
139
|
+
duration: 300
|
|
140
|
+
});
|
|
141
|
+
outAnimation.onfinish = () => {
|
|
142
|
+
requestAnimationFrame(() => {
|
|
143
|
+
container.remove();
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
this.hideRipple = (event) => {
|
|
149
|
+
var _a;
|
|
150
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
151
|
+
const element = container.querySelector("span");
|
|
152
|
+
const outAnimation = element.animate({
|
|
153
|
+
opacity: ["0.5", "0"]
|
|
154
|
+
}, {
|
|
155
|
+
easing: "ease-out",
|
|
156
|
+
fill: "both",
|
|
157
|
+
duration: 300
|
|
158
|
+
});
|
|
159
|
+
outAnimation.onfinish = () => {
|
|
160
|
+
requestAnimationFrame(() => {
|
|
161
|
+
container.remove();
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
};
|
|
111
166
|
}
|
|
112
167
|
static get styles() {
|
|
113
168
|
return [
|
|
@@ -123,14 +178,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
123
178
|
}
|
|
124
179
|
connectedCallback() {
|
|
125
180
|
if (this.ripple) {
|
|
126
|
-
this.addEventListener("mousedown", this.showRipple
|
|
127
|
-
this.addEventListener("mouseup", this.hideRipple
|
|
181
|
+
this.addEventListener("mousedown", this.showRipple, { passive: true });
|
|
182
|
+
this.addEventListener("mouseup", this.hideRipple, { passive: true });
|
|
128
183
|
}
|
|
129
184
|
super.connectedCallback();
|
|
130
185
|
}
|
|
131
186
|
disconnectedCallback() {
|
|
132
187
|
this.removeEventListener("mousedown", this.showRipple);
|
|
133
|
-
this.
|
|
188
|
+
this.removeEventListener("mouseup", this.hideRipple);
|
|
134
189
|
super.disconnectedCallback();
|
|
135
190
|
}
|
|
136
191
|
updated(props) {
|
|
@@ -140,61 +195,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
140
195
|
// this.style.setProperty("color", this.color.toString());
|
|
141
196
|
super.updated(props);
|
|
142
197
|
}
|
|
143
|
-
showRipple(event) {
|
|
144
|
-
const x = event.clientX;
|
|
145
|
-
const y = event.clientY;
|
|
146
|
-
const { offsetWidth, offsetHeight } = this;
|
|
147
|
-
const container = document.createElement("span");
|
|
148
|
-
container.classList.add("ripple", "open");
|
|
149
|
-
const element = document.createElement("span");
|
|
150
|
-
container.appendChild(element);
|
|
151
|
-
this.shadowRoot.appendChild(container);
|
|
152
|
-
const rect = this.getBoundingClientRect();
|
|
153
|
-
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
154
|
-
element.style.width = element.style.height = diameter + "px";
|
|
155
|
-
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
156
|
-
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
157
|
-
const inAnimation = element.animate({
|
|
158
|
-
transform: [`scale(0)`, `scale(1)`]
|
|
159
|
-
}, {
|
|
160
|
-
easing: "ease-out",
|
|
161
|
-
fill: "both",
|
|
162
|
-
duration: 500
|
|
163
|
-
});
|
|
164
|
-
inAnimation.onfinish = () => {
|
|
165
|
-
container.classList.remove("open");
|
|
166
|
-
const outAnimation = element.animate({
|
|
167
|
-
opacity: ["0.5", "0"]
|
|
168
|
-
}, {
|
|
169
|
-
easing: "ease-in",
|
|
170
|
-
fill: "both",
|
|
171
|
-
duration: 300
|
|
172
|
-
});
|
|
173
|
-
outAnimation.onfinish = () => {
|
|
174
|
-
requestAnimationFrame(() => {
|
|
175
|
-
container.remove();
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
hideRipple(event) {
|
|
181
|
-
var _a;
|
|
182
|
-
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
183
|
-
const element = container.querySelector("span");
|
|
184
|
-
const outAnimation = element.animate({
|
|
185
|
-
opacity: ["0.5", "0"]
|
|
186
|
-
}, {
|
|
187
|
-
easing: "ease-out",
|
|
188
|
-
fill: "both",
|
|
189
|
-
duration: 300
|
|
190
|
-
});
|
|
191
|
-
outAnimation.onfinish = () => {
|
|
192
|
-
requestAnimationFrame(() => {
|
|
193
|
-
container.remove();
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
198
|
};
|
|
199
199
|
__decorate([
|
|
200
200
|
(0,decorators_js_.property)({ type: Boolean })
|
package/notie/index.js
CHANGED
|
@@ -275,6 +275,61 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
275
275
|
* Activate ripple
|
|
276
276
|
*/
|
|
277
277
|
this.ripple = false;
|
|
278
|
+
this.showRipple = (event) => {
|
|
279
|
+
const x = event.clientX;
|
|
280
|
+
const y = event.clientY;
|
|
281
|
+
const { offsetWidth, offsetHeight } = this;
|
|
282
|
+
const container = document.createElement("span");
|
|
283
|
+
container.classList.add("ripple", "open");
|
|
284
|
+
const element = document.createElement("span");
|
|
285
|
+
container.appendChild(element);
|
|
286
|
+
this.shadowRoot.appendChild(container);
|
|
287
|
+
const rect = this.getBoundingClientRect();
|
|
288
|
+
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
289
|
+
element.style.width = element.style.height = diameter + "px";
|
|
290
|
+
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
291
|
+
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
292
|
+
const inAnimation = element.animate({
|
|
293
|
+
transform: [`scale(0)`, `scale(1)`]
|
|
294
|
+
}, {
|
|
295
|
+
easing: "ease-out",
|
|
296
|
+
fill: "both",
|
|
297
|
+
duration: 500
|
|
298
|
+
});
|
|
299
|
+
inAnimation.onfinish = () => {
|
|
300
|
+
container.classList.remove("open");
|
|
301
|
+
const outAnimation = element.animate({
|
|
302
|
+
opacity: ["0.5", "0"]
|
|
303
|
+
}, {
|
|
304
|
+
easing: "ease-in",
|
|
305
|
+
fill: "both",
|
|
306
|
+
duration: 300
|
|
307
|
+
});
|
|
308
|
+
outAnimation.onfinish = () => {
|
|
309
|
+
requestAnimationFrame(() => {
|
|
310
|
+
container.remove();
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
this.hideRipple = (event) => {
|
|
316
|
+
var _a;
|
|
317
|
+
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
318
|
+
const element = container.querySelector("span");
|
|
319
|
+
const outAnimation = element.animate({
|
|
320
|
+
opacity: ["0.5", "0"]
|
|
321
|
+
}, {
|
|
322
|
+
easing: "ease-out",
|
|
323
|
+
fill: "both",
|
|
324
|
+
duration: 300
|
|
325
|
+
});
|
|
326
|
+
outAnimation.onfinish = () => {
|
|
327
|
+
requestAnimationFrame(() => {
|
|
328
|
+
container.remove();
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
});
|
|
332
|
+
};
|
|
278
333
|
}
|
|
279
334
|
static get styles() {
|
|
280
335
|
return [
|
|
@@ -290,14 +345,14 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
290
345
|
}
|
|
291
346
|
connectedCallback() {
|
|
292
347
|
if (this.ripple) {
|
|
293
|
-
this.addEventListener("mousedown", this.showRipple
|
|
294
|
-
this.addEventListener("mouseup", this.hideRipple
|
|
348
|
+
this.addEventListener("mousedown", this.showRipple, { passive: true });
|
|
349
|
+
this.addEventListener("mouseup", this.hideRipple, { passive: true });
|
|
295
350
|
}
|
|
296
351
|
super.connectedCallback();
|
|
297
352
|
}
|
|
298
353
|
disconnectedCallback() {
|
|
299
354
|
this.removeEventListener("mousedown", this.showRipple);
|
|
300
|
-
this.
|
|
355
|
+
this.removeEventListener("mouseup", this.hideRipple);
|
|
301
356
|
super.disconnectedCallback();
|
|
302
357
|
}
|
|
303
358
|
updated(props) {
|
|
@@ -307,61 +362,6 @@ let TkBox = class TkBox extends external_lit_.LitElement {
|
|
|
307
362
|
// this.style.setProperty("color", this.color.toString());
|
|
308
363
|
super.updated(props);
|
|
309
364
|
}
|
|
310
|
-
showRipple(event) {
|
|
311
|
-
const x = event.clientX;
|
|
312
|
-
const y = event.clientY;
|
|
313
|
-
const { offsetWidth, offsetHeight } = this;
|
|
314
|
-
const container = document.createElement("span");
|
|
315
|
-
container.classList.add("ripple", "open");
|
|
316
|
-
const element = document.createElement("span");
|
|
317
|
-
container.appendChild(element);
|
|
318
|
-
this.shadowRoot.appendChild(container);
|
|
319
|
-
const rect = this.getBoundingClientRect();
|
|
320
|
-
const diameter = Math.max(offsetWidth, offsetWidth) * 2;
|
|
321
|
-
element.style.width = element.style.height = diameter + "px";
|
|
322
|
-
element.style.left = x - rect.left - diameter / 2 + "px";
|
|
323
|
-
element.style.top = y - rect.top - diameter / 2 + "px";
|
|
324
|
-
const inAnimation = element.animate({
|
|
325
|
-
transform: [`scale(0)`, `scale(1)`]
|
|
326
|
-
}, {
|
|
327
|
-
easing: "ease-out",
|
|
328
|
-
fill: "both",
|
|
329
|
-
duration: 500
|
|
330
|
-
});
|
|
331
|
-
inAnimation.onfinish = () => {
|
|
332
|
-
container.classList.remove("open");
|
|
333
|
-
const outAnimation = element.animate({
|
|
334
|
-
opacity: ["0.5", "0"]
|
|
335
|
-
}, {
|
|
336
|
-
easing: "ease-in",
|
|
337
|
-
fill: "both",
|
|
338
|
-
duration: 300
|
|
339
|
-
});
|
|
340
|
-
outAnimation.onfinish = () => {
|
|
341
|
-
requestAnimationFrame(() => {
|
|
342
|
-
container.remove();
|
|
343
|
-
});
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
hideRipple(event) {
|
|
348
|
-
var _a;
|
|
349
|
-
(_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".ripple:not([open])").forEach(container => {
|
|
350
|
-
const element = container.querySelector("span");
|
|
351
|
-
const outAnimation = element.animate({
|
|
352
|
-
opacity: ["0.5", "0"]
|
|
353
|
-
}, {
|
|
354
|
-
easing: "ease-out",
|
|
355
|
-
fill: "both",
|
|
356
|
-
duration: 300
|
|
357
|
-
});
|
|
358
|
-
outAnimation.onfinish = () => {
|
|
359
|
-
requestAnimationFrame(() => {
|
|
360
|
-
container.remove();
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
365
|
};
|
|
366
366
|
__decorate([
|
|
367
367
|
(0,decorators_js_.property)({ type: Boolean })
|