tinkiet 0.9.14 → 0.10.0
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/accordion.d.ts +3 -4
- package/accordion/index.d.ts +1 -1
- package/accordion/index.js +491 -1
- package/badge/badge.d.ts +2 -3
- package/badge/index.d.ts +1 -1
- package/badge/index.js +134 -1
- package/box/box.d.ts +3 -3
- package/box/focusable-box.d.ts +2 -3
- package/box/index.d.ts +1 -1
- package/box/index.js +289 -1
- package/button/button.d.ts +3 -4
- package/button/index.d.ts +1 -1
- package/button/index.js +502 -1
- package/checkbox/checkbox.d.ts +3 -3
- package/checkbox/index.d.ts +1 -1
- package/checkbox/index.js +450 -1
- package/chip/chip.d.ts +2 -3
- package/chip/index.d.ts +1 -1
- package/chip/index.js +123 -1
- package/dialog/dialog.d.ts +2 -3
- package/dialog/index.d.ts +1 -1
- package/dialog/index.js +162 -1
- package/drawer/drawer.d.ts +2 -3
- package/drawer/index.d.ts +1 -1
- package/drawer/index.js +272 -1
- package/form/form.d.ts +1 -2
- package/form/index.d.ts +1 -1
- package/form/index.js +149 -1
- package/icon/icon.d.ts +3 -4
- package/icon/icons.d.ts +1 -2
- package/icon/index.d.ts +2 -2
- package/icon/index.js +457 -2
- package/index.d.ts +52 -26
- package/index.js +3682 -52
- package/list-item/index.d.ts +1 -1
- package/list-item/index.js +414 -1
- package/list-item/list-item.d.ts +3 -4
- package/loading/index.d.ts +1 -1
- package/loading/index.js +389 -1
- package/loading/loading.d.ts +3 -4
- package/navigation/index.d.ts +2 -2
- package/navigation/index.js +201 -2
- package/navigation/navigation-bar.d.ts +2 -3
- package/navigation/navigation-item.d.ts +2 -3
- package/notie/index.d.ts +1 -1
- package/notie/index.js +744 -1
- package/notie/notie.d.ts +12 -11
- package/package.json +8 -5
- package/pages/index.d.ts +1 -1
- package/pages/index.js +178 -1
- package/pages/pages.d.ts +2 -3
- package/radio/index.d.ts +1 -1
- package/radio/index.js +466 -1
- package/radio/radio.d.ts +3 -3
- package/select/index.d.ts +1 -1
- package/select/index.js +493 -1
- package/select/select.d.ts +3 -3
- package/slider/index.d.ts +1 -1
- package/slider/index.js +274 -1
- package/slider/slider.d.ts +2 -3
- package/snackbar/index.d.ts +1 -0
- package/snackbar/snackbar.d.ts +34 -0
- package/switch/index.d.ts +1 -1
- package/switch/index.js +462 -1
- package/switch/switch.d.ts +3 -3
- package/tab-group/index.d.ts +1 -1
- package/tab-group/index.js +182 -1
- package/tab-group/tab-group.d.ts +2 -3
- package/tab-group/tab-item.d.ts +7 -0
- package/textarea/index.d.ts +1 -1
- package/textarea/index.js +272 -1
- package/textarea/textarea.d.ts +2 -3
- package/textfield/index.d.ts +1 -1
- package/textfield/index.js +278 -1
- package/textfield/textfield.d.ts +2 -3
- package/theme/index.d.ts +1 -1
- package/theme/index.js +240 -1
- package/theme/theme.d.ts +2 -3
- package/tooltip/index.d.ts +1 -1
- package/tooltip/index.js +136 -1
- package/tooltip/tooltip.d.ts +2 -3
- package/topbar/index.d.ts +1 -1
- package/topbar/index.js +358 -1
- package/topbar/topbar.d.ts +3 -4
- package/umd/tinkiet.min.js +420 -1
- package/utils/aria.d.ts +11 -0
- package/utils/unique.d.ts +1 -2
- package/accordion/accordion.js +0 -94
- package/accordion/accordion.scss.js +0 -4
- package/badge/badge.js +0 -31
- package/badge/badge.scss.js +0 -4
- package/box/box.js +0 -186
- package/box/box.scss.js +0 -4
- package/box/focusable-box.js +0 -30
- package/button/button.js +0 -141
- package/button/button.scss.js +0 -4
- package/checkbox/checkbox.js +0 -89
- package/checkbox/checkbox.scss.js +0 -4
- package/chip/chip.js +0 -20
- package/chip/chip.scss.js +0 -4
- package/dialog/dialog.js +0 -59
- package/dialog/dialog.scss.js +0 -4
- package/drawer/drawer.js +0 -168
- package/drawer/drawer.scss.js +0 -4
- package/form/form.js +0 -54
- package/icon/icon.js +0 -77
- package/icon/icon.scss.js +0 -4
- package/icon/icons.js +0 -24
- package/index.d.ts.map +0 -1
- package/list-item/list-item.js +0 -86
- package/list-item/list-item.scss.js +0 -4
- package/loading/loading.js +0 -61
- package/loading/loading.scss.js +0 -4
- package/navigation/navigation-bar.js +0 -20
- package/navigation/navigation-bar.scss.js +0 -4
- package/navigation/navigation-item.js +0 -51
- package/navigation/navigation-item.scss.js +0 -4
- package/notie/notie.js +0 -201
- package/notie/notie.scss.js +0 -4
- package/pages/pages.js +0 -75
- package/pages/pages.scss.js +0 -4
- package/radio/radio.js +0 -105
- package/radio/radio.scss.js +0 -4
- package/select/select.js +0 -132
- package/select/select.scss.js +0 -4
- package/slider/slider.js +0 -135
- package/slider/slider.scss.js +0 -4
- package/switch/switch.js +0 -101
- package/switch/switch.scss.js +0 -4
- package/tab-group/tab-group.js +0 -79
- package/tab-group/tab-group.scss.js +0 -4
- package/textarea/textarea.js +0 -133
- package/textarea/textarea.scss.js +0 -4
- package/textfield/textfield.js +0 -138
- package/textfield/textfield.scss.js +0 -4
- package/theme/theme.js +0 -137
- package/theme/theme.scss.js +0 -4
- package/tooltip/tooltip.js +0 -33
- package/tooltip/tooltip.scss.js +0 -4
- package/topbar/topbar.js +0 -33
- package/topbar/topbar.scss.js +0 -4
- package/umd/tinkiet.min.d.ts +0 -660
- package/umd/tinkiet.min.d.ts.map +0 -1
- package/utils/unique.js +0 -12
package/select/select.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
3
|
-
import { property, state, eventOptions, customElement } from 'lit/decorators.js';
|
|
4
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import '../box/index.js';
|
|
6
|
-
import { uniqueID } from '../utils/unique.js';
|
|
7
|
-
import css_248z from './select.scss.js';
|
|
8
|
-
|
|
9
|
-
let TkSelect = class TkSelect extends LitElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this._id = uniqueID();
|
|
13
|
-
this.type = "text";
|
|
14
|
-
this.required = false;
|
|
15
|
-
this.disabled = false;
|
|
16
|
-
this.readonly = false;
|
|
17
|
-
}
|
|
18
|
-
set value(value) {
|
|
19
|
-
if (!this.$select) {
|
|
20
|
-
this.initialValue = value;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.$select.value = value;
|
|
24
|
-
this.refreshAttributes();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
get value() {
|
|
28
|
-
return this.$select != null ? this.$select.value : this.initialValue || "";
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
return html `
|
|
32
|
-
<div id="container">
|
|
33
|
-
<slot id="before" name="before"></slot>
|
|
34
|
-
<div id="wrapper">
|
|
35
|
-
<div id="label">${this.label}</div>
|
|
36
|
-
<slot id="slot"></slot>
|
|
37
|
-
<select
|
|
38
|
-
id="${this._id}"
|
|
39
|
-
@keydown=${this.handleChange.bind(this)}
|
|
40
|
-
@input=${this.handleChange.bind(this)}
|
|
41
|
-
@focusout=${this.handleChange.bind(this)}
|
|
42
|
-
@change=${this.handleChange.bind(this)}
|
|
43
|
-
.value="${this.initialValue}"
|
|
44
|
-
?required="${this.required}"
|
|
45
|
-
?disabled="${this.disabled}"
|
|
46
|
-
?readonly="${this.readonly}"
|
|
47
|
-
name="${ifDefined(this.name)}"
|
|
48
|
-
autocomplete="${ifDefined(this.autocomplete)}"
|
|
49
|
-
tabindex="${this.disabled ? -1 : 0}"
|
|
50
|
-
></select>
|
|
51
|
-
<svg id="arrow" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 25" preserveAspectRatio="none">
|
|
52
|
-
<polygon points="0,0 50,0 25,25" />
|
|
53
|
-
</svg>
|
|
54
|
-
</div>
|
|
55
|
-
<slot id="after" name="after"></slot>
|
|
56
|
-
</div>
|
|
57
|
-
`;
|
|
58
|
-
}
|
|
59
|
-
handleChange() {
|
|
60
|
-
this.refreshAttributes();
|
|
61
|
-
}
|
|
62
|
-
firstUpdated() {
|
|
63
|
-
var _a;
|
|
64
|
-
this.$select = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("select");
|
|
65
|
-
this.appendChild(this.$select);
|
|
66
|
-
const options = this.querySelectorAll("option");
|
|
67
|
-
options.forEach(option => this.$select.appendChild(option));
|
|
68
|
-
if (this.initialValue)
|
|
69
|
-
this.value = this.initialValue;
|
|
70
|
-
}
|
|
71
|
-
refreshAttributes() {
|
|
72
|
-
this.$select.value ? this.setAttribute("dirty", "") : this.removeAttribute("dirty");
|
|
73
|
-
this.$select.checkValidity() ? this.removeAttribute("invalid") : this.setAttribute("invalid", "");
|
|
74
|
-
setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
TkSelect.styles = css `
|
|
78
|
-
${unsafeCSS(css_248z)}
|
|
79
|
-
`;
|
|
80
|
-
__decorate([
|
|
81
|
-
property({ type: String })
|
|
82
|
-
], TkSelect.prototype, "value", null);
|
|
83
|
-
__decorate([
|
|
84
|
-
property({ attribute: true, type: String })
|
|
85
|
-
], TkSelect.prototype, "name", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
property({ type: String })
|
|
88
|
-
], TkSelect.prototype, "list", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
property({ type: String })
|
|
91
|
-
], TkSelect.prototype, "type", void 0);
|
|
92
|
-
__decorate([
|
|
93
|
-
property({ type: Boolean })
|
|
94
|
-
], TkSelect.prototype, "required", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
property({ type: Boolean })
|
|
97
|
-
], TkSelect.prototype, "disabled", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
property({ type: Boolean })
|
|
100
|
-
], TkSelect.prototype, "readonly", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
property({ type: String })
|
|
103
|
-
], TkSelect.prototype, "autocomplete", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
property({ type: String })
|
|
106
|
-
], TkSelect.prototype, "pattern", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
state()
|
|
109
|
-
], TkSelect.prototype, "initialValue", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
property({ type: String })
|
|
112
|
-
], TkSelect.prototype, "label", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
property({ type: Number })
|
|
115
|
-
], TkSelect.prototype, "min", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
property({ type: Number })
|
|
118
|
-
], TkSelect.prototype, "max", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
property({ type: Number })
|
|
121
|
-
], TkSelect.prototype, "minLength", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
property({ type: Number })
|
|
124
|
-
], TkSelect.prototype, "maxLength", void 0);
|
|
125
|
-
__decorate([
|
|
126
|
-
eventOptions({ passive: true })
|
|
127
|
-
], TkSelect.prototype, "handleChange", null);
|
|
128
|
-
TkSelect = __decorate([
|
|
129
|
-
customElement("tk-select")
|
|
130
|
-
], TkSelect);
|
|
131
|
-
|
|
132
|
-
export { TkSelect };
|
package/select/select.scss.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:block;outline:none;transform:translateZ(0)}:host #container{align-items:center;background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface-variant));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));display:flex;font-size:var(--input-font-size,1rem);height:56px;overflow:hidden;padding:8px 16px;position:relative;transition:var(--input-transition,border-color var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease),background var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease))}:host #wrapper{flex-grow:1;position:relative}:host #label{color:hsl(var(--on-surface-variant));font-size:inherit;font-weight:400;line-height:64px;line-height:1;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%);transition:var(--input-label-transition,top var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),font-size var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:1}:host([disabled]){opacity:.38;pointer-events:none}:host(:hover) #container{background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));font-size:var(--input-font-size,1rem)}:host(:focus-within) #container{background-color:hsla(var(--on-surface),.3);border-bottom:2px solid hsl(var(--primary));padding:8px 16px 7px}:host([outlined]) #container{background-color:initial;border:1px solid hsl(var(--outline));border-radius:4px}:host([outlined]:focus-within) #container{border:2px solid hsl(var(--primary));padding:7px 15px}:host(:focus-within) #label,:host([dirty]) #label,:host([type=color]) #label,:host([type=date]) #label,:host([type=file]) #label,:host([type=range]) #label{color:hsl(var(--primary));font-size:var(--input-label-font-size,.75rem);top:0;transform:translateY(0)}#slot-wrapper,::slotted(input),::slotted(select),::slotted(textarea){-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--_input-color);-webkit-overflow-scrolling:touch;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#0000;border:none;box-sizing:border-box;caret-color:hsl(var(--primary));color:inherit;display:block;font-size:var(--input-font-size,1rem);margin:0;outline:none;padding:var(--input-padding-top-bottom,.5rem) var(--_input-padding-left-right);position:relative;text-align:var(--input-text-align,inherit);width:100%}:host([label]) #slot-wrapper,:host([label]) ::slotted(input),:host([label]) ::slotted(select),:host([label]) ::slotted(textarea){padding-top:16px}:host([invalid]){color:hsl(var(--error))}::slotted(input[type=color]){cursor:pointer;height:3.75rem}::slotted([slot=after]),::slotted([slot=before]){color:var(--input-before-after-color,hsl(var(--shadow)))}:host(:not([outlined]):not([filled])) ::slotted([slot=before]){margin-right:var(--input-padding-left-right-outlined,.75rem)}:host(:not([outlined]):not([filled])) ::slotted([slot=after]),:host([filled]) ::slotted([slot=before]),:host([outlined]) ::slotted([slot=before]){margin-left:var(--input-padding-left-right-outlined,.75rem)}:host([filled]) ::slotted([slot=after]),:host([outlined]) ::slotted([slot=after]){margin-right:var(--input-padding-left-right-outlined,.75rem)}#arrow{fill:var(--_input-state-color);height:8px;position:absolute;right:0;top:50%;transform:translate(-100%,-50%);z-index:-1}::slotted(option){display:none}:host(:not([dirty])) ::slotted(select){opacity:0}";
|
|
2
|
-
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:block;outline:none;transform:translateZ(0)}:host #container{align-items:center;background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface-variant));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));display:flex;font-size:var(--input-font-size,1rem);height:56px;overflow:hidden;padding:8px 16px;position:relative;transition:var(--input-transition,border-color var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease),background var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease))}:host #wrapper{flex-grow:1;position:relative}:host #label{color:hsl(var(--on-surface-variant));font-size:inherit;font-weight:400;line-height:64px;line-height:1;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%);transition:var(--input-label-transition,top var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),font-size var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:1}:host([disabled]){opacity:.38;pointer-events:none}:host(:hover) #container{background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));font-size:var(--input-font-size,1rem)}:host(:focus-within) #container{background-color:hsla(var(--on-surface),.3);border-bottom:2px solid hsl(var(--primary));padding:8px 16px 7px}:host([outlined]) #container{background-color:initial;border:1px solid hsl(var(--outline));border-radius:4px}:host([outlined]:focus-within) #container{border:2px solid hsl(var(--primary));padding:7px 15px}:host(:focus-within) #label,:host([dirty]) #label,:host([type=color]) #label,:host([type=date]) #label,:host([type=file]) #label,:host([type=range]) #label{color:hsl(var(--primary));font-size:var(--input-label-font-size,.75rem);top:0;transform:translateY(0)}#slot-wrapper,::slotted(input),::slotted(select),::slotted(textarea){-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--_input-color);-webkit-overflow-scrolling:touch;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#0000;border:none;box-sizing:border-box;caret-color:hsl(var(--primary));color:inherit;display:block;font-size:var(--input-font-size,1rem);margin:0;outline:none;padding:var(--input-padding-top-bottom,.5rem) var(--_input-padding-left-right);position:relative;text-align:var(--input-text-align,inherit);width:100%}:host([label]) #slot-wrapper,:host([label]) ::slotted(input),:host([label]) ::slotted(select),:host([label]) ::slotted(textarea){padding-top:16px}:host([invalid]){color:hsl(var(--error))}::slotted(input[type=color]){cursor:pointer;height:3.75rem}::slotted([slot=after]),::slotted([slot=before]){color:var(--input-before-after-color,hsl(var(--shadow)))}:host(:not([outlined]):not([filled])) ::slotted([slot=before]){margin-right:var(--input-padding-left-right-outlined,.75rem)}:host(:not([outlined]):not([filled])) ::slotted([slot=after]),:host([filled]) ::slotted([slot=before]),:host([outlined]) ::slotted([slot=before]){margin-left:var(--input-padding-left-right-outlined,.75rem)}:host([filled]) ::slotted([slot=after]),:host([outlined]) ::slotted([slot=after]){margin-right:var(--input-padding-left-right-outlined,.75rem)}#arrow{fill:var(--_input-state-color);height:8px;position:absolute;right:0;top:50%;transform:translate(-100%,-50%);z-index:-1}::slotted(option){display:none}:host(:not([dirty])) ::slotted(select){opacity:0}";
|
|
3
|
-
|
|
4
|
-
export { css_248z as default, stylesheet };
|
package/slider/slider.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
3
|
-
import { property, query, customElement } from 'lit/decorators.js';
|
|
4
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import { uniqueID } from '../utils/unique.js';
|
|
6
|
-
import css_248z from './slider.scss.js';
|
|
7
|
-
|
|
8
|
-
let TkSlider = class TkSlider extends LitElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this._id = uniqueID();
|
|
12
|
-
this.required = false;
|
|
13
|
-
this.disabled = false;
|
|
14
|
-
this.readonly = false;
|
|
15
|
-
this.thumbLabel = false;
|
|
16
|
-
this.thumbLabelPersist = false;
|
|
17
|
-
this.min = 0;
|
|
18
|
-
this.value = this.min;
|
|
19
|
-
this.max = 100;
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
return html `
|
|
23
|
-
<div id="container">
|
|
24
|
-
<slot id="before" name="before"></slot>
|
|
25
|
-
<div id="wrapper">
|
|
26
|
-
<div id="label">${this.label}</div>
|
|
27
|
-
<div id="slot-wrapper">
|
|
28
|
-
<input
|
|
29
|
-
@input="${this.handleChange.bind(this)}"
|
|
30
|
-
id="slider"
|
|
31
|
-
type="range"
|
|
32
|
-
.value="${this.value.toString()}"
|
|
33
|
-
?required="${this.required}"
|
|
34
|
-
?disabled="${this.disabled}"
|
|
35
|
-
?readonly="${this.readonly}"
|
|
36
|
-
aria-label="${ifDefined(this.label)}"
|
|
37
|
-
name="${ifDefined(this.name)}"
|
|
38
|
-
autocomplete="${ifDefined(this.autocomplete)}"
|
|
39
|
-
min="${ifDefined(this.min)}"
|
|
40
|
-
max="${ifDefined(this.max)}"
|
|
41
|
-
step="${ifDefined(this.step)}"
|
|
42
|
-
tabindex="0"
|
|
43
|
-
/>
|
|
44
|
-
${this.thumbLabel || this.thumbLabelPersist
|
|
45
|
-
? html `
|
|
46
|
-
<div id="thumb-container">
|
|
47
|
-
<div id="thumb-label"><slot name="thumb-label">${this.value}</slot></div>
|
|
48
|
-
</div>
|
|
49
|
-
`
|
|
50
|
-
: ''}
|
|
51
|
-
</div>
|
|
52
|
-
<input
|
|
53
|
-
id=${this._id}
|
|
54
|
-
class="hidden-input"
|
|
55
|
-
type="hidden"
|
|
56
|
-
value="${this.value.toString()}"
|
|
57
|
-
?required="${this.required}"
|
|
58
|
-
?disabled="${this.disabled}"
|
|
59
|
-
?readonly="${this.readonly}"
|
|
60
|
-
aria-label="${ifDefined(this.label)}"
|
|
61
|
-
name="${ifDefined(this.name)}"
|
|
62
|
-
/>
|
|
63
|
-
</div>
|
|
64
|
-
<slot id="after" name="after"></slot>
|
|
65
|
-
</div>
|
|
66
|
-
`;
|
|
67
|
-
}
|
|
68
|
-
handleChange(e) {
|
|
69
|
-
e.target.checkValidity() ? this.removeAttribute("invalid") : this.setAttribute("invalid", "");
|
|
70
|
-
this.value = e.target.value.toString();
|
|
71
|
-
setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
|
|
72
|
-
}
|
|
73
|
-
firstUpdated() {
|
|
74
|
-
this.appendChild(this.$input);
|
|
75
|
-
this.setAttribute("dirty", "");
|
|
76
|
-
}
|
|
77
|
-
updated() {
|
|
78
|
-
requestAnimationFrame(() => {
|
|
79
|
-
this.style.setProperty("--_perc", ((Number(this.value) - this.min) / (this.max - this.min)).toString());
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
TkSlider.styles = css `
|
|
84
|
-
${unsafeCSS(css_248z)}
|
|
85
|
-
`;
|
|
86
|
-
__decorate([
|
|
87
|
-
property({ attribute: true, type: String })
|
|
88
|
-
], TkSlider.prototype, "name", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
property({ type: String })
|
|
91
|
-
], TkSlider.prototype, "list", void 0);
|
|
92
|
-
__decorate([
|
|
93
|
-
property({ type: Boolean })
|
|
94
|
-
], TkSlider.prototype, "required", void 0);
|
|
95
|
-
__decorate([
|
|
96
|
-
property({ type: Boolean })
|
|
97
|
-
], TkSlider.prototype, "disabled", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
property({ type: Boolean })
|
|
100
|
-
], TkSlider.prototype, "readonly", void 0);
|
|
101
|
-
__decorate([
|
|
102
|
-
property({ type: String })
|
|
103
|
-
], TkSlider.prototype, "autocomplete", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
property({ type: Boolean, attribute: "thumblabel" })
|
|
106
|
-
], TkSlider.prototype, "thumbLabel", void 0);
|
|
107
|
-
__decorate([
|
|
108
|
-
property({ type: Boolean, attribute: "thumblabel-persist" })
|
|
109
|
-
], TkSlider.prototype, "thumbLabelPersist", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
property({ type: String })
|
|
112
|
-
], TkSlider.prototype, "label", void 0);
|
|
113
|
-
__decorate([
|
|
114
|
-
property({ type: Number })
|
|
115
|
-
], TkSlider.prototype, "min", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
property({ type: Number, reflect: true })
|
|
118
|
-
], TkSlider.prototype, "value", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
property({ type: Number })
|
|
121
|
-
], TkSlider.prototype, "max", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
property({ type: Number })
|
|
124
|
-
], TkSlider.prototype, "step", void 0);
|
|
125
|
-
__decorate([
|
|
126
|
-
query("#slider")
|
|
127
|
-
], TkSlider.prototype, "$slider", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
query(".hidden-input")
|
|
130
|
-
], TkSlider.prototype, "$input", void 0);
|
|
131
|
-
TkSlider = __decorate([
|
|
132
|
-
customElement("tk-slider")
|
|
133
|
-
], TkSlider);
|
|
134
|
-
|
|
135
|
-
export { TkSlider };
|
package/slider/slider.scss.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:block;outline:none;transform:translateZ(0)}:host #container{align-items:center;background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface-variant));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));display:flex;font-size:var(--input-font-size,1rem);height:56px;overflow:hidden;padding:8px 16px;position:relative;transition:var(--input-transition,border-color var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease),background var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease))}:host #wrapper{flex-grow:1;position:relative}:host #label{color:hsl(var(--on-surface-variant));font-size:inherit;font-weight:400;line-height:64px;line-height:1;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%);transition:var(--input-label-transition,top var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),font-size var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:1}:host([disabled]){opacity:.38;pointer-events:none}:host(:hover) #container{background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));font-size:var(--input-font-size,1rem)}:host(:focus-within) #container{background-color:hsla(var(--on-surface),.3);border-bottom:2px solid hsl(var(--primary));padding:8px 16px 7px}:host([outlined]) #container{background-color:initial;border:1px solid hsl(var(--outline));border-radius:4px}:host([outlined]:focus-within) #container{border:2px solid hsl(var(--primary));padding:7px 15px}:host(:focus-within) #label,:host([dirty]) #label,:host([type=color]) #label,:host([type=date]) #label,:host([type=file]) #label,:host([type=range]) #label{color:hsl(var(--primary));font-size:var(--input-label-font-size,.75rem);top:0;transform:translateY(0)}#slot-wrapper,::slotted(input),::slotted(select),::slotted(textarea){-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--_input-color);-webkit-overflow-scrolling:touch;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#0000;border:none;box-sizing:border-box;caret-color:hsl(var(--primary));color:inherit;display:block;font-size:var(--input-font-size,1rem);margin:0;outline:none;padding:var(--input-padding-top-bottom,.5rem) var(--_input-padding-left-right);position:relative;text-align:var(--input-text-align,inherit);width:100%}:host([label]) #slot-wrapper,:host([label]) ::slotted(input),:host([label]) ::slotted(select),:host([label]) ::slotted(textarea){padding-top:16px}:host([invalid]){color:hsl(var(--error))}::slotted(input[type=color]){cursor:pointer;height:3.75rem}::slotted([slot=after]),::slotted([slot=before]){color:var(--input-before-after-color,hsl(var(--shadow)))}:host(:not([outlined]):not([filled])) ::slotted([slot=before]){margin-right:var(--input-padding-left-right-outlined,.75rem)}:host(:not([outlined]):not([filled])) ::slotted([slot=after]),:host([filled]) ::slotted([slot=before]),:host([outlined]) ::slotted([slot=before]){margin-left:var(--input-padding-left-right-outlined,.75rem)}:host([filled]) ::slotted([slot=after]),:host([outlined]) ::slotted([slot=after]){margin-right:var(--input-padding-left-right-outlined,.75rem)}:host{--_perc:0;--_slider-track-bg:var(--slider-bg,hsl(var(--shadow)));--_slider-track-bg-active:var(--slider-bg-active,hsl(var(--primary)));--_slider-thumb-bg:var(--slider-thumb-bg,hsl(var(--on-primary)));--_slider-thumb-border:var(--slider-thumb-bg,hsl(var(--primary)))}:host([disabled]){--_slider-track-bg:var(--slider-bg-disabled,hsl(var(--shadow)));--_slider-track-bg-active:var(--slider-bg-active-disabled,hsl(var(--shadow)));--_slider-thumb-bg:var(--slider-thumb-bg-disabled,hsl(var(--shadow)));--_slider-thumb-border:var(--slider-thumb-bg,hsl(var(--shadow)))}:host([thumblabel-persist]) #container,:host([thumblabel]) #container{padding-top:33px}#container{border:none;overflow:visible}#slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(90deg,var(--_slider-track-bg-active) 0,var(--_slider-track-bg-active) calc(var(--_perc)*100%),var(--_slider-track-bg) calc(var(--_perc)*100%),var(--_slider-track-bg));border:none;border-radius:0;box-sizing:border-box;cursor:grab;height:var(--slider-height,.3125rem);margin:0;outline:none;top:calc(var(--slider-height, .3125rem)*-1/2)}#slider,#thumb-container{position:relative;width:100%}#thumb-label{--_thumb-label-transform-y:0.625rem;-webkit-text-fill-color:var(--slider-thumb-label-color,hsl(var(--on-primary)));align-items:center;border-radius:var(--slider-thumb-label-border-radius,100%);bottom:calc(100% + var(--slider-thumb-size, .75rem) + var(--slider-height, .3125rem) + var(--slider-thumb-space, .75rem));color:var(--slider-thumb-label-color,hsl(var(--on-primary)));display:flex;font-size:var(--slider-thumb-label-font-size,.75rem);height:var(--slider-thumb-label-size,1.875rem);justify-content:center;left:calc(var(--_perc)*100% - var(--slider-thumb-size, 1.2rem)*var(--_perc));opacity:0;pointer-events:none;text-overflow:ellipsis;transform:translate(calc(-50% + var(--slider-thumb-size, 1.2rem)/2),var(--_thumb-label-transform-y));transition:var(--slider-thumb-label-transition,opacity var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:var(--slider-thumb-label-size,1.875rem)}#thumb-label,#thumb-label:before{background:var(--slider-thumb-label-bg,hsl(var(--primary)));position:absolute}#thumb-label:before{border-radius:0 50% 50% 50%;content:\"\";height:100%;left:0;top:0;transform:rotate(225deg);width:100%;z-index:-1}#slider:focus+#thumb-container #thumb-label,:host([thumblabel-persist]) #thumb-label,:host:focus #thumb-label{--_thumb-label-transform-y:0;opacity:1}#slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:var(--_slider-thumb-bg);border:4px solid var(--_slider-thumb-border);border-radius:var(--slider-thumb-border-radius,100%);box-shadow:0 0 0 0 var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));cursor:grab;height:var(--slider-thumb-size,1.2rem);position:relative;-webkit-transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:var(--slider-thumb-size,1.2rem)}#slider::-moz-range-thumb{-moz-appearance:none;appearance:none;background:var(--_slider-thumb-bg);border:none;border-radius:var(--slider-thumb-border-radius,100%);box-shadow:0 0 0 0 var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));cursor:grab;height:var(--slider-thumb-size,1.2rem);position:relative;-moz-transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:var(--slider-thumb-size,1.2rem)}#slider:focus::-webkit-slider-thumb{box-shadow:0 0 0 var(--slider-thumb-focus-ring-size,.75rem) var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));transform:var(--slider-thumb-transform-focus,scale(1.2))}#slider:focus::-moz-range-thumb{box-shadow:0 0 0 var(--slider-thumb-focus-ring-size,.75rem) var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));transform:var(--slider-thumb-transform-focus,scale(1.2))}";
|
|
2
|
-
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:block;outline:none;transform:translateZ(0)}:host #container{align-items:center;background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface-variant));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));display:flex;font-size:var(--input-font-size,1rem);height:56px;overflow:hidden;padding:8px 16px;position:relative;transition:var(--input-transition,border-color var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease),background var(--transition-duration-medium,.18s) var(--transition-timing-function-ease,ease))}:host #wrapper{flex-grow:1;position:relative}:host #label{color:hsl(var(--on-surface-variant));font-size:inherit;font-weight:400;line-height:64px;line-height:1;pointer-events:none;position:absolute;top:50%;transform:translateY(-50%);transition:var(--input-label-transition,top var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),font-size var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-linear,linear));-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:1}:host([disabled]){opacity:.38;pointer-events:none}:host(:hover) #container{background-color:hsla(var(--surface-container-highest),.5);border-bottom:1px solid hsl(var(--on-surface));border-radius:4px 4px 0 0;color:hsl(var(--on-surface));font-size:var(--input-font-size,1rem)}:host(:focus-within) #container{background-color:hsla(var(--on-surface),.3);border-bottom:2px solid hsl(var(--primary));padding:8px 16px 7px}:host([outlined]) #container{background-color:initial;border:1px solid hsl(var(--outline));border-radius:4px}:host([outlined]:focus-within) #container{border:2px solid hsl(var(--primary));padding:7px 15px}:host(:focus-within) #label,:host([dirty]) #label,:host([type=color]) #label,:host([type=date]) #label,:host([type=file]) #label,:host([type=range]) #label{color:hsl(var(--primary));font-size:var(--input-label-font-size,.75rem);top:0;transform:translateY(0)}#slot-wrapper,::slotted(input),::slotted(select),::slotted(textarea){-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--_input-color);-webkit-overflow-scrolling:touch;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:#0000;border:none;box-sizing:border-box;caret-color:hsl(var(--primary));color:inherit;display:block;font-size:var(--input-font-size,1rem);margin:0;outline:none;padding:var(--input-padding-top-bottom,.5rem) var(--_input-padding-left-right);position:relative;text-align:var(--input-text-align,inherit);width:100%}:host([label]) #slot-wrapper,:host([label]) ::slotted(input),:host([label]) ::slotted(select),:host([label]) ::slotted(textarea){padding-top:16px}:host([invalid]){color:hsl(var(--error))}::slotted(input[type=color]){cursor:pointer;height:3.75rem}::slotted([slot=after]),::slotted([slot=before]){color:var(--input-before-after-color,hsl(var(--shadow)))}:host(:not([outlined]):not([filled])) ::slotted([slot=before]){margin-right:var(--input-padding-left-right-outlined,.75rem)}:host(:not([outlined]):not([filled])) ::slotted([slot=after]),:host([filled]) ::slotted([slot=before]),:host([outlined]) ::slotted([slot=before]){margin-left:var(--input-padding-left-right-outlined,.75rem)}:host([filled]) ::slotted([slot=after]),:host([outlined]) ::slotted([slot=after]){margin-right:var(--input-padding-left-right-outlined,.75rem)}:host{--_perc:0;--_slider-track-bg:var(--slider-bg,hsl(var(--shadow)));--_slider-track-bg-active:var(--slider-bg-active,hsl(var(--primary)));--_slider-thumb-bg:var(--slider-thumb-bg,hsl(var(--on-primary)));--_slider-thumb-border:var(--slider-thumb-bg,hsl(var(--primary)))}:host([disabled]){--_slider-track-bg:var(--slider-bg-disabled,hsl(var(--shadow)));--_slider-track-bg-active:var(--slider-bg-active-disabled,hsl(var(--shadow)));--_slider-thumb-bg:var(--slider-thumb-bg-disabled,hsl(var(--shadow)));--_slider-thumb-border:var(--slider-thumb-bg,hsl(var(--shadow)))}:host([thumblabel-persist]) #container,:host([thumblabel]) #container{padding-top:33px}#container{border:none;overflow:visible}#slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:linear-gradient(90deg,var(--_slider-track-bg-active) 0,var(--_slider-track-bg-active) calc(var(--_perc)*100%),var(--_slider-track-bg) calc(var(--_perc)*100%),var(--_slider-track-bg));border:none;border-radius:0;box-sizing:border-box;cursor:grab;height:var(--slider-height,.3125rem);margin:0;outline:none;top:calc(var(--slider-height, .3125rem)*-1/2)}#slider,#thumb-container{position:relative;width:100%}#thumb-label{--_thumb-label-transform-y:0.625rem;-webkit-text-fill-color:var(--slider-thumb-label-color,hsl(var(--on-primary)));align-items:center;border-radius:var(--slider-thumb-label-border-radius,100%);bottom:calc(100% + var(--slider-thumb-size, .75rem) + var(--slider-height, .3125rem) + var(--slider-thumb-space, .75rem));color:var(--slider-thumb-label-color,hsl(var(--on-primary)));display:flex;font-size:var(--slider-thumb-label-font-size,.75rem);height:var(--slider-thumb-label-size,1.875rem);justify-content:center;left:calc(var(--_perc)*100% - var(--slider-thumb-size, 1.2rem)*var(--_perc));opacity:0;pointer-events:none;text-overflow:ellipsis;transform:translate(calc(-50% + var(--slider-thumb-size, 1.2rem)/2),var(--_thumb-label-transform-y));transition:var(--slider-thumb-label-transition,opacity var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:var(--slider-thumb-label-size,1.875rem)}#thumb-label,#thumb-label:before{background:var(--slider-thumb-label-bg,hsl(var(--primary)));position:absolute}#thumb-label:before{border-radius:0 50% 50% 50%;content:\"\";height:100%;left:0;top:0;transform:rotate(225deg);width:100%;z-index:-1}#slider:focus+#thumb-container #thumb-label,:host([thumblabel-persist]) #thumb-label,:host:focus #thumb-label{--_thumb-label-transform-y:0;opacity:1}#slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background:var(--_slider-thumb-bg);border:4px solid var(--_slider-thumb-border);border-radius:var(--slider-thumb-border-radius,100%);box-shadow:0 0 0 0 var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));cursor:grab;height:var(--slider-thumb-size,1.2rem);position:relative;-webkit-transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:var(--slider-thumb-size,1.2rem)}#slider::-moz-range-thumb{-moz-appearance:none;appearance:none;background:var(--_slider-thumb-bg);border:none;border-radius:var(--slider-thumb-border-radius,100%);box-shadow:0 0 0 0 var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));cursor:grab;height:var(--slider-thumb-size,1.2rem);position:relative;-moz-transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));transition:var(--slider-thumb-transition,transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),box-shadow var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:var(--slider-thumb-size,1.2rem)}#slider:focus::-webkit-slider-thumb{box-shadow:0 0 0 var(--slider-thumb-focus-ring-size,.75rem) var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));transform:var(--slider-thumb-transform-focus,scale(1.2))}#slider:focus::-moz-range-thumb{box-shadow:0 0 0 var(--slider-thumb-focus-ring-size,.75rem) var(--slider-thumb-focus-ring-bg,rgba(0,0,0,.082));transform:var(--slider-thumb-transform-focus,scale(1.2))}";
|
|
3
|
-
|
|
4
|
-
export { css_248z as default, stylesheet };
|
package/switch/switch.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
3
|
-
import { property, query, customElement } from 'lit/decorators.js';
|
|
4
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import '../box/index.js';
|
|
6
|
-
import { uniqueID } from '../utils/unique.js';
|
|
7
|
-
import css_248z from './switch.scss.js';
|
|
8
|
-
|
|
9
|
-
let TkSwitch = class TkSwitch extends LitElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this._id = uniqueID();
|
|
13
|
-
this.checked = false;
|
|
14
|
-
this.required = false;
|
|
15
|
-
this.disabled = false;
|
|
16
|
-
this.readonly = false;
|
|
17
|
-
}
|
|
18
|
-
render() {
|
|
19
|
-
return html `
|
|
20
|
-
<tk-box direction="row" align-items="center">
|
|
21
|
-
<span class="switch">
|
|
22
|
-
<tk-box ripple tabindex="${this.disabled ? -1 : 0}" class="state">
|
|
23
|
-
<span id="knob"></span>
|
|
24
|
-
</tk-box>
|
|
25
|
-
</span>
|
|
26
|
-
<span class="label"><slot></slot></span>
|
|
27
|
-
</tk-box>
|
|
28
|
-
<input
|
|
29
|
-
id=${this._id}
|
|
30
|
-
slot="none"
|
|
31
|
-
style="display: none;"
|
|
32
|
-
type="radio"
|
|
33
|
-
?checked="${this.checked}"
|
|
34
|
-
?required="${this.required}"
|
|
35
|
-
?disabled="${this.disabled}"
|
|
36
|
-
?readonly="${this.readonly}"
|
|
37
|
-
value="${ifDefined(this.value)}"
|
|
38
|
-
name="${ifDefined(this.name)}"
|
|
39
|
-
aria-hidden="true"
|
|
40
|
-
tabindex="-1"
|
|
41
|
-
/>
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
connectedCallback() {
|
|
45
|
-
super.connectedCallback();
|
|
46
|
-
this.addEventListener("click", this.handleClick.bind(this));
|
|
47
|
-
this.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
48
|
-
}
|
|
49
|
-
disconnectedCallback() {
|
|
50
|
-
super.disconnectedCallback();
|
|
51
|
-
this.removeEventListener("click", this.handleClick);
|
|
52
|
-
this.removeEventListener("keydown", this.onKeyDown);
|
|
53
|
-
}
|
|
54
|
-
firstUpdated() {
|
|
55
|
-
this.appendChild(this.$input);
|
|
56
|
-
}
|
|
57
|
-
onKeyDown(e) {
|
|
58
|
-
if (e.code === "Space" || e.code === "Enter") {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
e.stopPropagation();
|
|
61
|
-
this.click();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
handleClick() {
|
|
65
|
-
this.checked = !this.checked;
|
|
66
|
-
if (this.checked && this.name)
|
|
67
|
-
this.getRootNode()
|
|
68
|
-
.querySelectorAll(`tk-radio[name="${this.name}"]`)
|
|
69
|
-
.forEach(el => (el != this ? (el.checked = false) : null));
|
|
70
|
-
setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
TkSwitch.styles = css `
|
|
74
|
-
${unsafeCSS(css_248z)}
|
|
75
|
-
`;
|
|
76
|
-
__decorate([
|
|
77
|
-
property({ attribute: true, type: String })
|
|
78
|
-
], TkSwitch.prototype, "name", void 0);
|
|
79
|
-
__decorate([
|
|
80
|
-
property({ attribute: true, type: Boolean, reflect: true })
|
|
81
|
-
], TkSwitch.prototype, "checked", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
property({ type: Boolean })
|
|
84
|
-
], TkSwitch.prototype, "required", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
property({ type: Boolean })
|
|
87
|
-
], TkSwitch.prototype, "disabled", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
property({ type: Boolean })
|
|
90
|
-
], TkSwitch.prototype, "readonly", void 0);
|
|
91
|
-
__decorate([
|
|
92
|
-
property({ type: String, reflect: true })
|
|
93
|
-
], TkSwitch.prototype, "value", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
query("input")
|
|
96
|
-
], TkSwitch.prototype, "$input", void 0);
|
|
97
|
-
TkSwitch = __decorate([
|
|
98
|
-
customElement("tk-switch")
|
|
99
|
-
], TkSwitch);
|
|
100
|
-
|
|
101
|
-
export { TkSwitch };
|
package/switch/switch.scss.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host .switch{align-items:center;background:hsl(var(--surface-container-highest));border:2px solid hsl(var(--outline));border-radius:9999px;display:inline-flex;flex-shrink:0;height:32px;position:relative;transition:var(--switch-transition,background var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));-webkit-user-select:none;user-select:none;width:52px;will-change:background-color}:host .switch .state{align-items:center;border-radius:100%;display:flex;height:40px;justify-content:center;margin-left:-5px;outline:none;overflow:hidden;transition:var(--switch-knob-transition,background var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:40px;will-change:background-color,transform}:host .switch .state #knob{background:hsl(var(--outline));border-radius:100%;height:16px;position:absolute;width:16px;will-change:background-color}:host .label{margin-left:10px}:host(:not([disabled])){cursor:pointer}:host([checked]) .switch{background:hsl(var(--primary));border:none}:host([checked]) .switch .state{transform:translateX(18px)}:host([checked]) .switch .state #knob{background:hsl(var(--on-primary));height:24px;width:24px}:host(:focus) .switch .state,:host(:hover) .switch .state{background:hsla(var(--surface-container-highest),.8)}:host([checked]:focus) .switch .state,:host([checked]:hover) .switch .state{background:hsla(var(--primary),.3)}:host([disabled]){pointer-events:none}:host([disabled]) .switch{background:hsla(var(--surface-container-highest),.12);border-color:hsla(var(--on-surface),.12)}:host([disabled]) .switch .state #knob{background:hsla(var(--on-surface),.38)}:host([disabled]) .label{opacity:.6}:host([disabled][checked]) .switch{background:hsla(var(--on-surface),.12);border:none}:host([disabled][checked]) .switch .state #knob{background:hsla(var(--surface),1)}";
|
|
2
|
-
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host .switch{align-items:center;background:hsl(var(--surface-container-highest));border:2px solid hsl(var(--outline));border-radius:9999px;display:inline-flex;flex-shrink:0;height:32px;position:relative;transition:var(--switch-transition,background var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));-webkit-user-select:none;user-select:none;width:52px;will-change:background-color}:host .switch .state{align-items:center;border-radius:100%;display:flex;height:40px;justify-content:center;margin-left:-5px;outline:none;overflow:hidden;transition:var(--switch-knob-transition,background var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),transform var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)));width:40px;will-change:background-color,transform}:host .switch .state #knob{background:hsl(var(--outline));border-radius:100%;height:16px;position:absolute;width:16px;will-change:background-color}:host .label{margin-left:10px}:host(:not([disabled])){cursor:pointer}:host([checked]) .switch{background:hsl(var(--primary));border:none}:host([checked]) .switch .state{transform:translateX(18px)}:host([checked]) .switch .state #knob{background:hsl(var(--on-primary));height:24px;width:24px}:host(:focus) .switch .state,:host(:hover) .switch .state{background:hsla(var(--surface-container-highest),.8)}:host([checked]:focus) .switch .state,:host([checked]:hover) .switch .state{background:hsla(var(--primary),.3)}:host([disabled]){pointer-events:none}:host([disabled]) .switch{background:hsla(var(--surface-container-highest),.12);border-color:hsla(var(--on-surface),.12)}:host([disabled]) .switch .state #knob{background:hsla(var(--on-surface),.38)}:host([disabled]) .label{opacity:.6}:host([disabled][checked]) .switch{background:hsla(var(--on-surface),.12);border:none}:host([disabled][checked]) .switch .state #knob{background:hsla(var(--surface),1)}";
|
|
3
|
-
|
|
4
|
-
export { css_248z as default, stylesheet };
|
package/tab-group/tab-group.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
3
|
-
import { property, query, customElement } from 'lit/decorators.js';
|
|
4
|
-
import css_248z from './tab-group.scss.js';
|
|
5
|
-
|
|
6
|
-
let TkTabGroup = class TkTabGroup extends LitElement {
|
|
7
|
-
render() {
|
|
8
|
-
return html `
|
|
9
|
-
<div class="tabs">
|
|
10
|
-
<slot @click=${(e) => this.clickOnTab(e.target)} @slotchange=${() => this.updateUnderline()}></slot>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="underline"></div>
|
|
13
|
-
`;
|
|
14
|
-
}
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
this.secondary = false;
|
|
18
|
-
this.observe = "";
|
|
19
|
-
this.selected = "";
|
|
20
|
-
}
|
|
21
|
-
firstUpdated() {
|
|
22
|
-
if (IntersectionObserver) {
|
|
23
|
-
const observer = new IntersectionObserver(this.updateUnderline.bind(this));
|
|
24
|
-
observer.observe(this);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this.updateUnderline.bind(this);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
updated(props) {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
if (props.has("selected") && this.selected !== "") {
|
|
33
|
-
this.querySelectorAll("*").forEach(node => node.removeAttribute("selected"));
|
|
34
|
-
(_a = this.querySelector(`[tab="${this.selected}"]`)) === null || _a === void 0 ? void 0 : _a.setAttribute("selected", "");
|
|
35
|
-
}
|
|
36
|
-
if (props.has("observe")) {
|
|
37
|
-
(_b = this.querySelector(`[tab="${this.selected}"]`)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
38
|
-
this.updateUnderline();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
clickOnTab(tab) {
|
|
42
|
-
this.querySelectorAll("*").forEach(node => node.removeAttribute("selected"));
|
|
43
|
-
tab.setAttribute("selected", "");
|
|
44
|
-
this.updateUnderline();
|
|
45
|
-
this.dispatchEvent(new CustomEvent("change", { detail: tab.getAttribute("tab"), composed: true, bubbles: true }));
|
|
46
|
-
}
|
|
47
|
-
updateUnderline() {
|
|
48
|
-
const selected = this.querySelector("[selected]");
|
|
49
|
-
if (selected) {
|
|
50
|
-
setTimeout(() => {
|
|
51
|
-
this.$underline.style.width = selected.clientWidth + "px";
|
|
52
|
-
this.$underline.style.transform = `translateX(${selected.offsetLeft}px)`;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
TkTabGroup.styles = css `
|
|
58
|
-
${unsafeCSS(css_248z)}
|
|
59
|
-
`;
|
|
60
|
-
__decorate([
|
|
61
|
-
property({ attribute: true, type: Boolean })
|
|
62
|
-
], TkTabGroup.prototype, "secondary", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
property({ attribute: true, type: String })
|
|
65
|
-
], TkTabGroup.prototype, "observe", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
property({ attribute: true, type: String })
|
|
68
|
-
], TkTabGroup.prototype, "selected", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
query(".underline")
|
|
71
|
-
], TkTabGroup.prototype, "$underline", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
query(".circle")
|
|
74
|
-
], TkTabGroup.prototype, "$circle", void 0);
|
|
75
|
-
TkTabGroup = __decorate([
|
|
76
|
-
customElement("tk-tab-group")
|
|
77
|
-
], TkTabGroup);
|
|
78
|
-
|
|
79
|
-
export { TkTabGroup };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:inline-block;overflow-x:hidden;position:relative}:host([overflow]){overflow-x:auto}.tabs{display:flex}:host(:not([circle])) .tabs{border-bottom:2px solid hsl(var(--primary-container))}.underline{height:2px;margin-top:-2px;transition:transform .2s ease;width:0;will-change:transform}.circle,.underline{background-color:hsl(var(--primary))}.circle{border-radius:var(--border-radius-circle,50%);height:8px;transition:transform .3s ease;width:8px}";
|
|
2
|
-
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:inline-block;overflow-x:hidden;position:relative}:host([overflow]){overflow-x:auto}.tabs{display:flex}:host(:not([circle])) .tabs{border-bottom:2px solid hsl(var(--primary-container))}.underline{height:2px;margin-top:-2px;transition:transform .2s ease;width:0;will-change:transform}.circle,.underline{background-color:hsl(var(--primary))}.circle{border-radius:var(--border-radius-circle,50%);height:8px;transition:transform .3s ease;width:8px}";
|
|
3
|
-
|
|
4
|
-
export { css_248z as default, stylesheet };
|
package/textarea/textarea.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
3
|
-
import { property, state, eventOptions, customElement } from 'lit/decorators.js';
|
|
4
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import { uniqueID } from '../utils/unique.js';
|
|
6
|
-
import css_248z from './textarea.scss.js';
|
|
7
|
-
|
|
8
|
-
let TkTextarea = class TkTextarea extends LitElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this._id = uniqueID();
|
|
12
|
-
this.type = "text";
|
|
13
|
-
this.required = false;
|
|
14
|
-
this.disabled = false;
|
|
15
|
-
this.readonly = false;
|
|
16
|
-
this.rows = 1;
|
|
17
|
-
}
|
|
18
|
-
set value(value) {
|
|
19
|
-
if (!this.$input) {
|
|
20
|
-
this.initialValue = value;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
this.$input.value = value;
|
|
24
|
-
this.refreshAttributes();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
get value() {
|
|
28
|
-
return this.$input != null ? this.$input.value : this.initialValue || "";
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
return html `
|
|
32
|
-
<div id="container">
|
|
33
|
-
<slot id="before" name="before"></slot>
|
|
34
|
-
<div id="wrapper">
|
|
35
|
-
<div id="label">${this.label}</div>
|
|
36
|
-
<slot id="slot"></slot>
|
|
37
|
-
<textarea
|
|
38
|
-
id=${this._id}
|
|
39
|
-
@keydown=${this.handleChange.bind(this)}
|
|
40
|
-
@input=${this.handleChange.bind(this)}
|
|
41
|
-
@focusout=${this.handleChange.bind(this)}
|
|
42
|
-
?required="${this.required}"
|
|
43
|
-
?disabled="${this.disabled}"
|
|
44
|
-
?readonly="${this.readonly}"
|
|
45
|
-
aria-label="${ifDefined(this.label)}"
|
|
46
|
-
name="${ifDefined(this.name)}"
|
|
47
|
-
pattern="${ifDefined(this.pattern)}"
|
|
48
|
-
autocomplete="${ifDefined(this.autocomplete)}"
|
|
49
|
-
autocapitalize="${ifDefined(this.autocapitalize)}"
|
|
50
|
-
minlength="${ifDefined(this.minLength)}"
|
|
51
|
-
maxlength="${ifDefined(this.maxLength)}"
|
|
52
|
-
rows="${this.rows}"
|
|
53
|
-
tabindex="${this.disabled ? -1 : 0}"
|
|
54
|
-
></textarea>
|
|
55
|
-
</div>
|
|
56
|
-
<slot id="after" name="after"></slot>
|
|
57
|
-
</div>
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
handleChange() {
|
|
61
|
-
this.refreshAttributes();
|
|
62
|
-
}
|
|
63
|
-
firstUpdated() {
|
|
64
|
-
var _a;
|
|
65
|
-
this.$input = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("textarea");
|
|
66
|
-
this.appendChild(this.$input);
|
|
67
|
-
if (this.initialValue)
|
|
68
|
-
this.value = this.initialValue;
|
|
69
|
-
}
|
|
70
|
-
refreshAttributes() {
|
|
71
|
-
this.$input.value ? this.setAttribute("dirty", "") : this.removeAttribute("dirty");
|
|
72
|
-
this.$input.checkValidity() ? this.removeAttribute("invalid") : this.setAttribute("invalid", "");
|
|
73
|
-
}
|
|
74
|
-
focus() {
|
|
75
|
-
this.$input.focus();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
TkTextarea.styles = css `
|
|
79
|
-
${unsafeCSS(css_248z)}
|
|
80
|
-
`;
|
|
81
|
-
__decorate([
|
|
82
|
-
property({ type: String })
|
|
83
|
-
], TkTextarea.prototype, "value", null);
|
|
84
|
-
__decorate([
|
|
85
|
-
property({ attribute: true, type: String })
|
|
86
|
-
], TkTextarea.prototype, "name", void 0);
|
|
87
|
-
__decorate([
|
|
88
|
-
property({ type: String })
|
|
89
|
-
], TkTextarea.prototype, "list", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
property({ type: String })
|
|
92
|
-
], TkTextarea.prototype, "type", void 0);
|
|
93
|
-
__decorate([
|
|
94
|
-
property({ type: Boolean })
|
|
95
|
-
], TkTextarea.prototype, "required", void 0);
|
|
96
|
-
__decorate([
|
|
97
|
-
property({ type: Boolean, reflect: true })
|
|
98
|
-
], TkTextarea.prototype, "disabled", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
property({ type: Boolean })
|
|
101
|
-
], TkTextarea.prototype, "readonly", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
property({ type: String })
|
|
104
|
-
], TkTextarea.prototype, "autocomplete", void 0);
|
|
105
|
-
__decorate([
|
|
106
|
-
property({ type: String })
|
|
107
|
-
], TkTextarea.prototype, "autocapitalize", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
property({ type: String })
|
|
110
|
-
], TkTextarea.prototype, "pattern", void 0);
|
|
111
|
-
__decorate([
|
|
112
|
-
state()
|
|
113
|
-
], TkTextarea.prototype, "initialValue", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
property({ type: String })
|
|
116
|
-
], TkTextarea.prototype, "label", void 0);
|
|
117
|
-
__decorate([
|
|
118
|
-
property({ type: Number })
|
|
119
|
-
], TkTextarea.prototype, "minLength", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
property({ type: Number })
|
|
122
|
-
], TkTextarea.prototype, "maxLength", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
property({ type: Number })
|
|
125
|
-
], TkTextarea.prototype, "rows", void 0);
|
|
126
|
-
__decorate([
|
|
127
|
-
eventOptions({ passive: true })
|
|
128
|
-
], TkTextarea.prototype, "handleChange", null);
|
|
129
|
-
TkTextarea = __decorate([
|
|
130
|
-
customElement("tk-textarea")
|
|
131
|
-
], TkTextarea);
|
|
132
|
-
|
|
133
|
-
export { TkTextarea };
|