tinkiet 0.7.6 → 0.7.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/accordion.d.ts +18 -0
- package/accordion/accordion.js +94 -0
- package/accordion/accordion.scss.js +4 -0
- package/accordion/index.d.ts +1 -0
- package/accordion/index.js +1 -0
- package/badge/badge.d.ts +15 -0
- package/badge/badge.js +27 -0
- package/badge/badge.scss.js +4 -0
- package/badge/index.d.ts +1 -0
- package/badge/index.js +1 -0
- package/box/box.d.ts +56 -0
- package/box/box.js +182 -0
- package/box/box.scss.js +4 -0
- package/box/focusable-box.d.ts +13 -0
- package/box/focusable-box.js +30 -0
- package/box/index.d.ts +1 -0
- package/box/index.js +1 -0
- package/button/button.d.ts +39 -0
- package/button/button.js +125 -0
- package/button/button.scss.js +4 -0
- package/button/index.d.ts +1 -0
- package/button/index.js +1 -0
- package/checkbox/checkbox.d.ts +21 -0
- package/checkbox/checkbox.js +83 -0
- package/checkbox/checkbox.scss.js +4 -0
- package/checkbox/index.d.ts +1 -0
- package/checkbox/index.js +1 -0
- package/dialog/dialog.d.ts +18 -0
- package/dialog/dialog.js +58 -0
- package/dialog/dialog.scss.js +4 -0
- package/dialog/index.d.ts +1 -0
- package/dialog/index.js +1 -0
- package/drawer/drawer.d.ts +29 -0
- package/drawer/drawer.js +152 -0
- package/drawer/drawer.scss.js +4 -0
- package/drawer/index.d.ts +1 -0
- package/drawer/index.js +1 -0
- package/form/form.d.ts +15 -0
- package/form/form.js +57 -0
- package/form/index.d.ts +1 -0
- package/form/index.js +1 -0
- package/icon/icon.d.ts +17 -0
- package/icon/icon.js +75 -0
- package/icon/icon.scss.js +4 -0
- package/icon/icons.d.ts +7 -0
- package/icon/icons.js +24 -0
- package/icon/index.d.ts +2 -0
- package/icon/index.js +2 -0
- package/index.d.ts +24 -0
- package/index.d.ts.map +1 -0
- package/index.js +47 -0
- package/list-item/index.d.ts +1 -0
- package/list-item/index.js +1 -0
- package/list-item/list-item.d.ts +20 -0
- package/list-item/list-item.js +72 -0
- package/list-item/list-item.scss.js +4 -0
- package/loading/index.d.ts +1 -0
- package/loading/index.js +1 -0
- package/loading/loading.d.ts +14 -0
- package/loading/loading.js +61 -0
- package/loading/loading.scss.js +4 -0
- package/navbar/index.d.ts +1 -0
- package/navbar/index.js +1 -0
- package/navbar/navbar.d.ts +11 -0
- package/navbar/navbar.js +33 -0
- package/navbar/navbar.scss.js +4 -0
- package/notie/index.d.ts +1 -0
- package/notie/index.js +1 -0
- package/notie/notie.d.ts +69 -0
- package/notie/notie.js +193 -0
- package/notie/notie.scss.js +4 -0
- package/package.json +1 -1
- package/pages/index.d.ts +1 -0
- package/pages/index.js +1 -0
- package/pages/pages.d.ts +18 -0
- package/pages/pages.js +75 -0
- package/pages/pages.scss.js +4 -0
- package/radio/index.d.ts +1 -0
- package/radio/index.js +1 -0
- package/radio/radio.d.ts +24 -0
- package/radio/radio.js +98 -0
- package/radio/radio.scss.js +4 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +1 -0
- package/select/select.d.ts +32 -0
- package/select/select.js +132 -0
- package/select/select.scss.js +4 -0
- package/slider/index.d.ts +1 -0
- package/slider/index.js +1 -0
- package/slider/slider.d.ts +30 -0
- package/slider/slider.js +135 -0
- package/slider/slider.scss.js +4 -0
- package/switch/index.d.ts +1 -0
- package/switch/index.js +1 -0
- package/switch/switch.d.ts +24 -0
- package/switch/switch.js +99 -0
- package/switch/switch.scss.js +4 -0
- package/tab-group/index.d.ts +1 -0
- package/tab-group/index.js +1 -0
- package/tab-group/tab-group.d.ts +21 -0
- package/tab-group/tab-group.js +97 -0
- package/tab-group/tab-group.scss.js +4 -0
- package/tag/index.d.ts +1 -0
- package/tag/index.js +1 -0
- package/tag/tag.d.ts +11 -0
- package/tag/tag.js +20 -0
- package/tag/tag.scss.js +4 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/index.js +1 -0
- package/textarea/textarea.d.ts +33 -0
- package/textarea/textarea.js +133 -0
- package/textarea/textarea.scss.js +4 -0
- package/textfield/index.d.ts +1 -0
- package/textfield/index.js +1 -0
- package/textfield/textfield.d.ts +34 -0
- package/textfield/textfield.js +136 -0
- package/textfield/textfield.scss.js +4 -0
- package/theme/index.d.ts +1 -0
- package/theme/index.js +1 -0
- package/theme/theme.d.ts +33 -0
- package/theme/theme.js +187 -0
- package/theme/theme.scss.js +4 -0
- package/umd/tinkiet.min.d.ts.map +1 -1
- package/utils/unique.d.ts +7 -0
- package/utils/unique.js +12 -0
package/button/button.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { css, unsafeCSS, html } 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 './button.scss.js';
|
|
8
|
+
import { TkBox } from '../box/box.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A button web component
|
|
12
|
+
*
|
|
13
|
+
* @cssprop --tk-badge-color - Color of widget
|
|
14
|
+
* @cssprop [--tk-badge-color=--primary]
|
|
15
|
+
* @cssprop --tk-badge-text-color - Text color of widget to --on-primary-color
|
|
16
|
+
*
|
|
17
|
+
* @attr {Boolean} accent - accent colors
|
|
18
|
+
* @attr {Boolean} disabled - Disable this element
|
|
19
|
+
* @attr {Boolean} inverted - color and text-color are inverted
|
|
20
|
+
* @attr {Boolean} outlined - outlined
|
|
21
|
+
* @attr {Boolean} pill - rounded corner
|
|
22
|
+
* @attr {Boolean} ripple - display ripple when active
|
|
23
|
+
* @attr {Boolean} small - mini button
|
|
24
|
+
*/
|
|
25
|
+
let TkButton = class TkButton extends TkBox {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this._id = uniqueID();
|
|
29
|
+
this.href = null;
|
|
30
|
+
this.type = "button";
|
|
31
|
+
this.disabled = false;
|
|
32
|
+
}
|
|
33
|
+
static get styles() {
|
|
34
|
+
return [
|
|
35
|
+
...TkBox.styles,
|
|
36
|
+
css `
|
|
37
|
+
${unsafeCSS(css_248z)}
|
|
38
|
+
`
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
render() {
|
|
42
|
+
return html `
|
|
43
|
+
<div class="before">
|
|
44
|
+
<slot name="before"></slot>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="content">
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="after">
|
|
50
|
+
<slot name="after"></slot>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="badge-in">
|
|
53
|
+
<slot name="badge-in"></slot>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="badge-out">
|
|
56
|
+
<slot name="badge-out"></slot>
|
|
57
|
+
</div>
|
|
58
|
+
${this.href
|
|
59
|
+
? html `
|
|
60
|
+
<a tabindex="-1" hidden id="ahref" href="${this.href}" target="${ifDefined(this.target)}" rel="noreferrer"></a>
|
|
61
|
+
`
|
|
62
|
+
: ""}
|
|
63
|
+
<button id=${this._id} hidden type="${ifDefined(this.type)}"></button>
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
super.connectedCallback();
|
|
68
|
+
this.addEventListener("click", this.handleClick.bind(this));
|
|
69
|
+
this.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
70
|
+
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
super.disconnectedCallback();
|
|
73
|
+
this.removeEventListener("click", this.handleClick);
|
|
74
|
+
this.removeEventListener("keydown", this.onKeyDown);
|
|
75
|
+
}
|
|
76
|
+
updated(props) {
|
|
77
|
+
this.tabIndex = this.disabled ? -1 : 0;
|
|
78
|
+
super.updated(props);
|
|
79
|
+
}
|
|
80
|
+
onKeyDown(e) {
|
|
81
|
+
if (e.code === "Space" || e.code === "Enter") {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
this.click();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
firstUpdated() {
|
|
88
|
+
if (this.type == "submit" || this.type == "reset")
|
|
89
|
+
this.appendChild(this.$button);
|
|
90
|
+
}
|
|
91
|
+
handleClick(e) {
|
|
92
|
+
var _a;
|
|
93
|
+
if (this.href && e.isTrusted) {
|
|
94
|
+
e.stopPropagation();
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
this.$ahref.click();
|
|
97
|
+
}
|
|
98
|
+
else if (e.isTrusted && this.type == "submit" || this.type == "reset") {
|
|
99
|
+
(_a = this.querySelector("button")) === null || _a === void 0 ? void 0 : _a.click();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
__decorate([
|
|
104
|
+
property()
|
|
105
|
+
], TkButton.prototype, "href", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
property()
|
|
108
|
+
], TkButton.prototype, "target", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property()
|
|
111
|
+
], TkButton.prototype, "type", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property({ type: Boolean })
|
|
114
|
+
], TkButton.prototype, "disabled", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
query("#ahref")
|
|
117
|
+
], TkButton.prototype, "$ahref", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
query("button")
|
|
120
|
+
], TkButton.prototype, "$button", void 0);
|
|
121
|
+
TkButton = __decorate([
|
|
122
|
+
customElement("tk-button")
|
|
123
|
+
], TkButton);
|
|
124
|
+
|
|
125
|
+
export { TkButton };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{--color:var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%)));--color-darker:var(--primary-darker,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),calc(var(--primary-l, 59.4118%)*0.7)));--text:var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%)));align-items:center;background-color:var(--color);border:1px solid var(--color);border-radius:var(--border-radius-medium,.25rem);box-sizing:border-box;color:var(--text);cursor:pointer;display:inline-flex;flex-direction:row;font-family:Roboto,sans-serif;justify-content:center;letter-spacing:.8px;padding:var(--spacing-s,.5rem) var(--spacing-m,1rem);position:relative;text-align:center;text-decoration:none;text-overflow:ellipsis;user-select:none;vertical-align:middle}:host .content{align-items:center;display:flex;pointer-events:none}:host .before{align-items:center;display:flex}:host .before ::slotted(*){margin-right:var(--spacing-s,.5rem)}:host .after{align-items:center;display:flex}:host .after ::slotted(*){margin-left:var(--spacing-s,.5rem)}:host .badge-out{display:flex;pointer-events:none;position:absolute;right:-.8em;top:-.7em}:host .badge-in{display:flex;pointer-events:none;position:absolute;right:2px;top:2px}:host(:focus){outline:none}:host(:focus),:host(:hover){--color:var(--primary-light,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),calc(var(--primary-l, 59.4118%)*1.15)))}:host(:active){--color:var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%)))}:host([inverted]){--color:var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%)));--text:var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%)))}:host([inverted]:focus),:host([inverted]:hover){--color:#0000001a}:host([inverted]:active){--color:var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%)))}:host([accent]){--color:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)));--color-darker:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)))}:host([accent]:focus),:host([accent]:hover){--color:var(--accent-light,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),calc(var(--accent-l, 72.7451%)*1.15)))}:host([accent]:active){--color:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)))}:host([accent][inverted]){--color:var(--on-accent,hsl(var(--on-accent-h,0),var(--on-accent-s,0%),var(--on-accent-l,100%)));--text:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)))}:host([accent][inverted]:focus),:host([accent][inverted]:hover){--color:#0000001a}:host([accent][inverted]:active){--color:var(--on-accent,hsl(var(--on-accent-h,0),var(--on-accent-s,0%),var(--on-accent-l,100%)))}:host([outlined]){background:var(--background,#f7f7f7) radial-gradient(circle,#0000 1%,var(--background,#f7f7f7) 1%) center/15000%;color:var(--color)}:host([pill]){border-radius:var(--border-radius-pill,9999px)}:host([small]){font-size:.8em;height:28px;line-height:.9em;padding:0 var(--spacing-s,.5rem)}:host([small]) .before ::slotted(*){margin-right:var(--spacing-xs,.25rem)}:host([small]) .after ::slotted(*){margin-left:var(--spacing-xs,.25rem)}:host([fab]){align-items:center;border-radius:50%;box-shadow:var(--elevation-1,0 1px 2px var(--shadow));height:40px;justify-content:center;line-height:normal;overflow:hidden;padding:0;width:40px}:host([fab]):hover{box-shadow:var(--elevation-3,0 4px 8px var(--shadow))}:host([fab][small]){font-size:.75em;height:30px;width:30px}:host([flat]){box-shadow:none}:host([flat]):hover{box-shadow:none}:host([disabled]),:host([disabled][accent]){--text:var(--button-color-disabled,var(--shade-lighter));--color:var(--button-bg-disabled,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));box-shadow:none;cursor:default;pointer-events:none}";
|
|
2
|
+
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{--color:var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%)));--color-darker:var(--primary-darker,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),calc(var(--primary-l, 59.4118%)*0.7)));--text:var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%)));align-items:center;background-color:var(--color);border:1px solid var(--color);border-radius:var(--border-radius-medium,.25rem);box-sizing:border-box;color:var(--text);cursor:pointer;display:inline-flex;flex-direction:row;font-family:Roboto,sans-serif;justify-content:center;letter-spacing:.8px;padding:var(--spacing-s,.5rem) var(--spacing-m,1rem);position:relative;text-align:center;text-decoration:none;text-overflow:ellipsis;user-select:none;vertical-align:middle}:host .content{align-items:center;display:flex;pointer-events:none}:host .before{align-items:center;display:flex}:host .before ::slotted(*){margin-right:var(--spacing-s,.5rem)}:host .after{align-items:center;display:flex}:host .after ::slotted(*){margin-left:var(--spacing-s,.5rem)}:host .badge-out{display:flex;pointer-events:none;position:absolute;right:-.8em;top:-.7em}:host .badge-in{display:flex;pointer-events:none;position:absolute;right:2px;top:2px}:host(:focus){outline:none}:host(:focus),:host(:hover){--color:var(--primary-light,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),calc(var(--primary-l, 59.4118%)*1.15)))}:host(:active){--color:var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%)))}:host([inverted]){--color:var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%)));--text:var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%)))}:host([inverted]:focus),:host([inverted]:hover){--color:#0000001a}:host([inverted]:active){--color:var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%)))}:host([accent]){--color:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)));--color-darker:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)))}:host([accent]:focus),:host([accent]:hover){--color:var(--accent-light,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),calc(var(--accent-l, 72.7451%)*1.15)))}:host([accent]:active){--color:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)))}:host([accent][inverted]){--color:var(--on-accent,hsl(var(--on-accent-h,0),var(--on-accent-s,0%),var(--on-accent-l,100%)));--text:var(--accent,hsl(var(--accent-h,8.76404),var(--accent-s,64.0288%),var(--accent-l,72.7451%)))}:host([accent][inverted]:focus),:host([accent][inverted]:hover){--color:#0000001a}:host([accent][inverted]:active){--color:var(--on-accent,hsl(var(--on-accent-h,0),var(--on-accent-s,0%),var(--on-accent-l,100%)))}:host([outlined]){background:var(--background,#f7f7f7) radial-gradient(circle,#0000 1%,var(--background,#f7f7f7) 1%) center/15000%;color:var(--color)}:host([pill]){border-radius:var(--border-radius-pill,9999px)}:host([small]){font-size:.8em;height:28px;line-height:.9em;padding:0 var(--spacing-s,.5rem)}:host([small]) .before ::slotted(*){margin-right:var(--spacing-xs,.25rem)}:host([small]) .after ::slotted(*){margin-left:var(--spacing-xs,.25rem)}:host([fab]){align-items:center;border-radius:50%;box-shadow:var(--elevation-1,0 1px 2px var(--shadow));height:40px;justify-content:center;line-height:normal;overflow:hidden;padding:0;width:40px}:host([fab]):hover{box-shadow:var(--elevation-3,0 4px 8px var(--shadow))}:host([fab][small]){font-size:.75em;height:30px;width:30px}:host([flat]){box-shadow:none}:host([flat]):hover{box-shadow:none}:host([disabled]),:host([disabled][accent]){--text:var(--button-color-disabled,var(--shade-lighter));--color:var(--button-bg-disabled,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));box-shadow:none;cursor:default;pointer-events:none}";
|
|
3
|
+
|
|
4
|
+
export { css_248z as default, stylesheet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./button";
|
package/button/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TkButton } from './button.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare class TkCheckbox extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
private _id;
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
checked: boolean;
|
|
8
|
+
private $input;
|
|
9
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
connectedCallback(): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
firstUpdated(): void;
|
|
13
|
+
protected onKeyDown(e: KeyboardEvent): void;
|
|
14
|
+
protected handleClick(): void;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
"tk-checkbox": TkCheckbox;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export { TkCheckbox };
|
|
@@ -0,0 +1,83 @@
|
|
|
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 './checkbox.scss.js';
|
|
8
|
+
|
|
9
|
+
let TkCheckbox = class TkCheckbox extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._id = uniqueID();
|
|
13
|
+
this.checked = false;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
return html `
|
|
17
|
+
<tk-box direction="row" align-items="center">
|
|
18
|
+
<div tabindex="0" class="checkbox">
|
|
19
|
+
<svg id="checkmark" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 24 24">
|
|
20
|
+
<path id="checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
|
|
21
|
+
<line id="indeterminate-path" fill="none" x1="0" y1="12.5" x2="24" y2="12.5" />
|
|
22
|
+
</svg>
|
|
23
|
+
</div>
|
|
24
|
+
<span class="label"><slot></slot></span>
|
|
25
|
+
</tk-box>
|
|
26
|
+
<input
|
|
27
|
+
id=${this._id}
|
|
28
|
+
slot="none"
|
|
29
|
+
style="display: none;"
|
|
30
|
+
?checked=${this.checked}
|
|
31
|
+
type="checkbox"
|
|
32
|
+
name="${ifDefined(this.name)}"
|
|
33
|
+
value="${ifDefined(this.value)}"
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
tabindex="-1"
|
|
36
|
+
/>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
super.connectedCallback();
|
|
41
|
+
this.addEventListener("click", this.handleClick.bind(this));
|
|
42
|
+
this.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
43
|
+
}
|
|
44
|
+
disconnectedCallback() {
|
|
45
|
+
super.disconnectedCallback();
|
|
46
|
+
this.removeEventListener("click", this.handleClick);
|
|
47
|
+
this.removeEventListener("keydown", this.onKeyDown);
|
|
48
|
+
}
|
|
49
|
+
firstUpdated() {
|
|
50
|
+
this.appendChild(this.$input);
|
|
51
|
+
}
|
|
52
|
+
onKeyDown(e) {
|
|
53
|
+
if (e.code === "Space" || e.code === "Enter") {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
this.click();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
handleClick() {
|
|
60
|
+
this.checked = !this.checked;
|
|
61
|
+
setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
TkCheckbox.styles = css `
|
|
65
|
+
${unsafeCSS(css_248z)}
|
|
66
|
+
`;
|
|
67
|
+
__decorate([
|
|
68
|
+
property({ attribute: true, type: String })
|
|
69
|
+
], TkCheckbox.prototype, "name", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
property({ attribute: true, type: String })
|
|
72
|
+
], TkCheckbox.prototype, "value", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
property({ attribute: true, type: Boolean, reflect: true })
|
|
75
|
+
], TkCheckbox.prototype, "checked", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
query("input")
|
|
78
|
+
], TkCheckbox.prototype, "$input", void 0);
|
|
79
|
+
TkCheckbox = __decorate([
|
|
80
|
+
customElement("tk-checkbox")
|
|
81
|
+
], TkCheckbox);
|
|
82
|
+
|
|
83
|
+
export { TkCheckbox };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{--_checkbox-bg:var(--checkbox-bg,#0000);--_checkbox-color:var(--checkbox-color,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));display:inline-flex}:host .checkbox{align-items:center;background:var(--_checkbox-bg);border:var(--checkbox-border-config,.125rem solid) currentColor;border-radius:var(--checkbox-border-radius,.375rem);color:var(--_checkbox-color);display:inline-flex;height:var(--checkbox-size,1.25rem);justify-content:center;margin:0 5px;min-width:var(--checkbox-size,1.25rem);outline:none;position:relative;transition:var(--checkbox-transition,background var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),border-color 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:var(--checkbox-size,1.25rem)}:host .label{font-size:1.1em}:host(:not([disabled])){cursor:pointer}:host([checked]),:host([indeterminate]){--_checkbox-bg:var(--checkbox-bg-checked,var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%))));--_checkbox-color:var(--checkbox-color-checked,var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%))))}:host([checked]:not([indeterminate])) #checkmark-path,:host([indeterminate]) #indeterminate-path{stroke-dashoffset:0}:host(:focus),:host(:hover){will-change:border,background}:host(:focus) #checkmark-path,:host(:hover) #checkmark-path{will-change:stroke-dashoffset}:host([disabled]){--_checkbox-bg:var(--checkbox-bg-disabled,#0000);--_checkbox-color:var(--checkbox-color-disabled,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));color:var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%)));pointer-events:none}:host([disabled][checked]),:host([disabled][indeterminate]){--_checkbox-bg:var(--checkbox-bg-disabled-checked,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));--_checkbox-color:var(--checkbox-color-disabled-checked,var(--shade-lighter,hsl(var(--shade-h,0),var(--shade-s,0%),calc(var(--shade-l, 66.6667%)*1.3))))}#checkmark{height:var(--checkbox-checkmark-size,.75rem);width:var(--checkbox-checkmark-size,.75rem)}#checkmark-path,#indeterminate-path{stroke-width:var(--checkbox-checkmark-path-width,.3rem);stroke:var(--checkbox-checkmark-stroke-color,var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%))));stroke-dasharray:var(--checkbox-checkmark-path-dasharray,30);stroke-dashoffset:var(--checkbox-checkmark-path-dasharray,30);transition:var(--checkbox-checkmark-transition,stroke-dashoffset var(--transition-duration-medium,.18s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)))}#checkmark-path{transition-delay:var(--checkbox-checkmark-path-delay,50ms)}#ripple{transform:var(--checkbox-ripple-transform,translate(-50%,-50%) scale(1.8))}";
|
|
2
|
+
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{--_checkbox-bg:var(--checkbox-bg,#0000);--_checkbox-color:var(--checkbox-color,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));display:inline-flex}:host .checkbox{align-items:center;background:var(--_checkbox-bg);border:var(--checkbox-border-config,.125rem solid) currentColor;border-radius:var(--checkbox-border-radius,.375rem);color:var(--_checkbox-color);display:inline-flex;height:var(--checkbox-size,1.25rem);justify-content:center;margin:0 5px;min-width:var(--checkbox-size,1.25rem);outline:none;position:relative;transition:var(--checkbox-transition,background var(--transition-duration-fast,.12s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)),border-color 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:var(--checkbox-size,1.25rem)}:host .label{font-size:1.1em}:host(:not([disabled])){cursor:pointer}:host([checked]),:host([indeterminate]){--_checkbox-bg:var(--checkbox-bg-checked,var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%))));--_checkbox-color:var(--checkbox-color-checked,var(--primary,hsl(var(--primary-h,258.987),var(--primary-s,38.1643%),var(--primary-l,59.4118%))))}:host([checked]:not([indeterminate])) #checkmark-path,:host([indeterminate]) #indeterminate-path{stroke-dashoffset:0}:host(:focus),:host(:hover){will-change:border,background}:host(:focus) #checkmark-path,:host(:hover) #checkmark-path{will-change:stroke-dashoffset}:host([disabled]){--_checkbox-bg:var(--checkbox-bg-disabled,#0000);--_checkbox-color:var(--checkbox-color-disabled,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));color:var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%)));pointer-events:none}:host([disabled][checked]),:host([disabled][indeterminate]){--_checkbox-bg:var(--checkbox-bg-disabled-checked,var(--shade,hsl(var(--shade-h,0),var(--shade-s,0%),var(--shade-l,66.6667%))));--_checkbox-color:var(--checkbox-color-disabled-checked,var(--shade-lighter,hsl(var(--shade-h,0),var(--shade-s,0%),calc(var(--shade-l, 66.6667%)*1.3))))}#checkmark{height:var(--checkbox-checkmark-size,.75rem);width:var(--checkbox-checkmark-size,.75rem)}#checkmark-path,#indeterminate-path{stroke-width:var(--checkbox-checkmark-path-width,.3rem);stroke:var(--checkbox-checkmark-stroke-color,var(--on-primary,hsl(var(--on-primary-h,0),var(--on-primary-s,0%),var(--on-primary-l,100%))));stroke-dasharray:var(--checkbox-checkmark-path-dasharray,30);stroke-dashoffset:var(--checkbox-checkmark-path-dasharray,30);transition:var(--checkbox-checkmark-transition,stroke-dashoffset var(--transition-duration-medium,.18s) var(--transition-timing-function-deceleration-curve,cubic-bezier(0,0,.2,1)))}#checkmark-path{transition-delay:var(--checkbox-checkmark-path-delay,50ms)}#ripple{transform:var(--checkbox-ripple-transform,translate(-50%,-50%) scale(1.8))}";
|
|
3
|
+
|
|
4
|
+
export { css_248z as default, stylesheet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TkCheckbox } from './checkbox.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare class TkDialog extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
modal: boolean;
|
|
5
|
+
open: boolean;
|
|
6
|
+
blurOverlay: boolean;
|
|
7
|
+
private resolve;
|
|
8
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
+
updated(props: any): void;
|
|
10
|
+
show(): Promise<string | boolean>;
|
|
11
|
+
hide(value?: boolean | string | null): void;
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface HTMLElementTagNameMap {
|
|
15
|
+
"tk-dialog": TkDialog;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export { TkDialog };
|
package/dialog/dialog.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { LitElement, html, css, unsafeCSS } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import css_248z from './dialog.scss.js';
|
|
5
|
+
|
|
6
|
+
let TkDialog = class TkDialog extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.modal = false;
|
|
10
|
+
this.open = false;
|
|
11
|
+
this.blurOverlay = false;
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return html `
|
|
15
|
+
${this.open
|
|
16
|
+
? html `
|
|
17
|
+
<div class="overlay ${this.blurOverlay ? "blur" : ""}" @click=${() => (this.modal ? null : this.hide())}></div>
|
|
18
|
+
<div class="container">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</div>
|
|
21
|
+
`
|
|
22
|
+
: ""}
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
updated(props) {
|
|
26
|
+
if (props.has("open") && this.open)
|
|
27
|
+
this.dispatchEvent(new Event("did-show"));
|
|
28
|
+
if (props.has("open") && !this.open)
|
|
29
|
+
this.dispatchEvent(new Event("did-close"));
|
|
30
|
+
}
|
|
31
|
+
show() {
|
|
32
|
+
this.open = true;
|
|
33
|
+
return new Promise(resolve => {
|
|
34
|
+
this.resolve = resolve;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
hide(value = null) {
|
|
38
|
+
this.open = false;
|
|
39
|
+
this.resolve(value);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
TkDialog.styles = css `
|
|
43
|
+
${unsafeCSS(css_248z)}
|
|
44
|
+
`;
|
|
45
|
+
__decorate([
|
|
46
|
+
property({ type: Boolean, attribute: true })
|
|
47
|
+
], TkDialog.prototype, "modal", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
property({ type: Boolean, attribute: true, reflect: true })
|
|
50
|
+
], TkDialog.prototype, "open", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
property({ type: Boolean, attribute: "blur-overlay" })
|
|
53
|
+
], TkDialog.prototype, "blurOverlay", void 0);
|
|
54
|
+
TkDialog = __decorate([
|
|
55
|
+
customElement("tk-dialog")
|
|
56
|
+
], TkDialog);
|
|
57
|
+
|
|
58
|
+
export { TkDialog };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = "*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:none;outline:none;position:relative}:host([open]){align-items:center;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%;z-index:var(--dialog-z-index,300)}:host([open]) .overlay{background-color:#00000080;bottom:0;left:0;position:absolute;right:0;top:0}:host([open]) .overlay.blur{backdrop-filter:blur(2px)}:host([open]) .container{animation:fade-in .3s forwards;border-radius:var(--border-radius-medium,.25rem);height:100%;margin:0;max-width:100%;overflow-y:auto;overscroll-behavior:contain;padding:1rem;position:fixed;width:fit-content;will-change:transform,opacity}@keyframes fade-in{0%{opacity:0}to{opacity:1}}";
|
|
2
|
+
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:none;outline:none;position:relative}:host([open]){align-items:center;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%;z-index:var(--dialog-z-index,300)}:host([open]) .overlay{background-color:#00000080;bottom:0;left:0;position:absolute;right:0;top:0}:host([open]) .overlay.blur{backdrop-filter:blur(2px)}:host([open]) .container{animation:fade-in .3s forwards;border-radius:var(--border-radius-medium,.25rem);height:100%;margin:0;max-width:100%;overflow-y:auto;overscroll-behavior:contain;padding:1rem;position:fixed;width:fit-content;will-change:transform,opacity}@keyframes fade-in{0%{opacity:0}to{opacity:1}}";
|
|
3
|
+
|
|
4
|
+
export { css_248z as default, stylesheet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dialog";
|
package/dialog/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TkDialog } from './dialog.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare class TkDrawer extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
_open: boolean;
|
|
5
|
+
set open(value: boolean);
|
|
6
|
+
get open(): boolean;
|
|
7
|
+
over: boolean;
|
|
8
|
+
openQuery: string;
|
|
9
|
+
overQuery: string;
|
|
10
|
+
right: boolean;
|
|
11
|
+
swipeable: boolean;
|
|
12
|
+
private $drawer;
|
|
13
|
+
private mql;
|
|
14
|
+
private pointerListener;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
updated(props: any): void;
|
|
17
|
+
protected overMediaQuery(): void;
|
|
18
|
+
private overMediaQueryListener;
|
|
19
|
+
hideIfOver(): void;
|
|
20
|
+
show(): void;
|
|
21
|
+
hide(): void;
|
|
22
|
+
toggle(): void;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
"tk-drawer": TkDrawer;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export { TkDrawer };
|
package/drawer/drawer.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
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 './drawer.scss.js';
|
|
5
|
+
import { Direction, Pan, PointerListener, Tap } from 'contactjs';
|
|
6
|
+
|
|
7
|
+
let TkDrawer = class TkDrawer extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this._open = false;
|
|
11
|
+
this.over = false;
|
|
12
|
+
this.right = false;
|
|
13
|
+
this.swipeable = false;
|
|
14
|
+
}
|
|
15
|
+
set open(value) {
|
|
16
|
+
if (value === this._open)
|
|
17
|
+
return;
|
|
18
|
+
const oldValue = this._open;
|
|
19
|
+
this._open = value;
|
|
20
|
+
this.requestUpdate("open", oldValue);
|
|
21
|
+
if (this._open)
|
|
22
|
+
this.dispatchEvent(new Event("did-show"));
|
|
23
|
+
if (!this._open)
|
|
24
|
+
this.dispatchEvent(new Event("did-close"));
|
|
25
|
+
}
|
|
26
|
+
get open() {
|
|
27
|
+
return this._open;
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
return html `
|
|
31
|
+
<div class="container fi">
|
|
32
|
+
<slot name="drawer-container"></slot>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="overlay" @click=${() => (this.open = false)}></div>
|
|
35
|
+
<div class="drawer">
|
|
36
|
+
<div class="drawer-header">
|
|
37
|
+
<slot name="drawer-header"></slot>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="drawer-content">
|
|
40
|
+
<slot name="drawer-content"></slot>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="drawer-footer">
|
|
43
|
+
<slot name="drawer-footer"></slot>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
updated(props) {
|
|
49
|
+
if (props.has("overQuery"))
|
|
50
|
+
this.overMediaQuery();
|
|
51
|
+
if (props.has("openQuery")) {
|
|
52
|
+
if (window.matchMedia(this.openQuery).matches)
|
|
53
|
+
this.show();
|
|
54
|
+
}
|
|
55
|
+
if (props.has("swipeable") && this.swipeable) {
|
|
56
|
+
var panOptions = {
|
|
57
|
+
supportedDirections: [Direction.Left, Direction.Right],
|
|
58
|
+
bubbles: false
|
|
59
|
+
};
|
|
60
|
+
var panRecognizer = new Pan(this.$drawer, panOptions);
|
|
61
|
+
this.pointerListener = new PointerListener(this.$drawer, {
|
|
62
|
+
DEBUG: true,
|
|
63
|
+
DEBUG_GESTURES: true,
|
|
64
|
+
// handleTouchEvents : false,
|
|
65
|
+
supportedGestures: [Tap, panRecognizer],
|
|
66
|
+
bubbles: false
|
|
67
|
+
});
|
|
68
|
+
this.$drawer.addEventListener("tap", (event) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const { x, y } = event.detail.live.srcEvent;
|
|
71
|
+
const el = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.elementFromPoint(x, y);
|
|
72
|
+
if (el)
|
|
73
|
+
el.click();
|
|
74
|
+
});
|
|
75
|
+
this.$drawer.addEventListener("panstart", (event) => {
|
|
76
|
+
this.$drawer.style.transition = "transform 0ms ease";
|
|
77
|
+
});
|
|
78
|
+
this.$drawer.addEventListener("pan", (event) => {
|
|
79
|
+
var x = event.detail.global.deltaX > 0 ? 0 : event.detail.global.deltaX;
|
|
80
|
+
var y = 0;
|
|
81
|
+
var transformString = "translate3d(" + x + "px, " + y + "px, 0)";
|
|
82
|
+
requestAnimationFrame(_ => {
|
|
83
|
+
this.$drawer.style.transform = transformString;
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
this.$drawer.addEventListener("panend", (event) => {
|
|
87
|
+
requestAnimationFrame(_ => {
|
|
88
|
+
this.$drawer.style.transition = "";
|
|
89
|
+
this.$drawer.style.transform = "";
|
|
90
|
+
this.open = event.detail.global.deltaX < -50 ? false : true;
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if (props.has("swipeable") && !this.swipeable) {
|
|
95
|
+
this.pointerListener && this.pointerListener.destroy();
|
|
96
|
+
this.pointerListener = null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
overMediaQuery() {
|
|
100
|
+
if (this.mql)
|
|
101
|
+
this.mql.removeEventListener("change", this.overMediaQueryListener.bind(this));
|
|
102
|
+
this.mql = window.matchMedia(this.overQuery);
|
|
103
|
+
this.mql.matches ? this.setAttribute("over", "") : this.removeAttribute("over");
|
|
104
|
+
this.mql.addEventListener("change", this.overMediaQueryListener.bind(this));
|
|
105
|
+
}
|
|
106
|
+
overMediaQueryListener(e) {
|
|
107
|
+
e.matches ? this.setAttribute("over", "") : this.removeAttribute("over");
|
|
108
|
+
}
|
|
109
|
+
hideIfOver() {
|
|
110
|
+
var _a;
|
|
111
|
+
if ((this.overQuery && ((_a = this.mql) === null || _a === void 0 ? void 0 : _a.matches)) || this.over)
|
|
112
|
+
this.open = false;
|
|
113
|
+
}
|
|
114
|
+
show() {
|
|
115
|
+
this.open = true;
|
|
116
|
+
}
|
|
117
|
+
hide() {
|
|
118
|
+
this.open = false;
|
|
119
|
+
}
|
|
120
|
+
toggle() {
|
|
121
|
+
this.open = !this.open;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
TkDrawer.styles = css `
|
|
125
|
+
${unsafeCSS(css_248z)}
|
|
126
|
+
`;
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: Boolean, reflect: true })
|
|
129
|
+
], TkDrawer.prototype, "open", null);
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ type: Boolean, reflect: true })
|
|
132
|
+
], TkDrawer.prototype, "over", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ type: String, attribute: "open-query" })
|
|
135
|
+
], TkDrawer.prototype, "openQuery", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: String, attribute: "over-query" })
|
|
138
|
+
], TkDrawer.prototype, "overQuery", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: Boolean, reflect: true })
|
|
141
|
+
], TkDrawer.prototype, "right", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: Boolean, reflect: true })
|
|
144
|
+
], TkDrawer.prototype, "swipeable", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
query("div.drawer")
|
|
147
|
+
], TkDrawer.prototype, "$drawer", void 0);
|
|
148
|
+
TkDrawer = __decorate([
|
|
149
|
+
customElement("tk-drawer")
|
|
150
|
+
], TkDrawer);
|
|
151
|
+
|
|
152
|
+
export { TkDrawer };
|
|
@@ -0,0 +1,4 @@
|
|
|
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;height:100%;overflow:hidden;position:relative;width:100%}.drawer{background-color:var(--background,#f7f7f7);color:var(--foreground,#454545);display:flex;flex-direction:column;height:100%;overflow:scroll;position:absolute;top:0;touch-action:pan-y;transform:translateX(-100%);transition:transform cubic-bezier(.4,0,.2,1) var(--transition-duration-medium,.18s);width:var(--drawer-width,256px);will-change:transform;z-index:var(--drawer-z-index,200)}.drawer .drawer-content{flex:1;overflow:scroll}:host([right]) .drawer{right:0;transform:translateX(100%)}.overlay{background-color:rgba(0,0,0,.502);bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:var(--drawer-overlay-z-index,200)}.container{background-color:var(--background,#f7f7f7);height:100%;overflow:scroll;transition:padding cubic-bezier(.4,0,.2,1) var(--transition-duration-slow,.25s)}:host([open]) .drawer{transform:none}:host([open]) .container{padding-left:var(--drawer-width,256px)}:host([open][over]) .container{padding-left:0}:host([open][over]) .overlay{display:block}@media (max-width:var(--drawer-trigger-width,400px)){:host([open]) .container{padding-left:0}:host([open]) .overlay{display:block}}";
|
|
2
|
+
var stylesheet="*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;box-sizing:border-box}:host{display:block;height:100%;overflow:hidden;position:relative;width:100%}.drawer{background-color:var(--background,#f7f7f7);color:var(--foreground,#454545);display:flex;flex-direction:column;height:100%;overflow:scroll;position:absolute;top:0;touch-action:pan-y;transform:translateX(-100%);transition:transform cubic-bezier(.4,0,.2,1) var(--transition-duration-medium,.18s);width:var(--drawer-width,256px);will-change:transform;z-index:var(--drawer-z-index,200)}.drawer .drawer-content{flex:1;overflow:scroll}:host([right]) .drawer{right:0;transform:translateX(100%)}.overlay{background-color:rgba(0,0,0,.502);bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:var(--drawer-overlay-z-index,200)}.container{background-color:var(--background,#f7f7f7);height:100%;overflow:scroll;transition:padding cubic-bezier(.4,0,.2,1) var(--transition-duration-slow,.25s)}:host([open]) .drawer{transform:none}:host([open]) .container{padding-left:var(--drawer-width,256px)}:host([open][over]) .container{padding-left:0}:host([open][over]) .overlay{display:block}@media (max-width:var(--drawer-trigger-width,400px)){:host([open]) .container{padding-left:0}:host([open]) .overlay{display:block}}";
|
|
3
|
+
|
|
4
|
+
export { css_248z as default, stylesheet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./drawer";
|
package/drawer/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TkDrawer } from './drawer.js';
|
package/form/form.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare class TkForm extends LitElement {
|
|
3
|
+
value: any;
|
|
4
|
+
protected createRenderRoot(): Element | ShadowRoot;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
submit(e: Event): void;
|
|
8
|
+
getFormDataAsObject(): any;
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"tk-form": TkForm;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export { TkForm };
|
package/form/form.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
|
|
5
|
+
let TkForm = class TkForm extends LitElement {
|
|
6
|
+
createRenderRoot() {
|
|
7
|
+
return this;
|
|
8
|
+
}
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
super.connectedCallback();
|
|
11
|
+
this.addEventListener("submit", this.submit);
|
|
12
|
+
}
|
|
13
|
+
disconnectedCallback() {
|
|
14
|
+
super.disconnectedCallback();
|
|
15
|
+
this.removeEventListener("submit", this.submit);
|
|
16
|
+
}
|
|
17
|
+
submit(e) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
const result = this.getFormDataAsObject();
|
|
20
|
+
this.dispatchEvent(new CustomEvent("fulfill", { detail: result }));
|
|
21
|
+
}
|
|
22
|
+
getFormDataAsObject() {
|
|
23
|
+
const $form = this.querySelector("form");
|
|
24
|
+
const result = {};
|
|
25
|
+
const data = new FormData($form);
|
|
26
|
+
data.forEach((value, key) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const $inputElement = this.querySelector(`[name=${key}]`);
|
|
29
|
+
if ($inputElement.tagName == "TK-SLIDER") {
|
|
30
|
+
value = Number(value);
|
|
31
|
+
}
|
|
32
|
+
if ($inputElement.tagName == "TK-CHECKBOX" && (value == "on" || value == "true")) {
|
|
33
|
+
value = true;
|
|
34
|
+
}
|
|
35
|
+
if ($inputElement.tagName == "TK-RADIO" && (value == "on" || value == "true")) {
|
|
36
|
+
value = true;
|
|
37
|
+
}
|
|
38
|
+
if (key.indexOf("-") > 0) {
|
|
39
|
+
const _ks = key.split("-");
|
|
40
|
+
result[_ks[0]] = (_a = result[_ks[0]]) !== null && _a !== void 0 ? _a : {};
|
|
41
|
+
result[_ks[0]][_ks[1]] = value;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
result[key] = value;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
__decorate([
|
|
51
|
+
property()
|
|
52
|
+
], TkForm.prototype, "value", void 0);
|
|
53
|
+
TkForm = __decorate([
|
|
54
|
+
customElement("tk-form")
|
|
55
|
+
], TkForm);
|
|
56
|
+
|
|
57
|
+
export { TkForm };
|
package/form/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TkForm } from "./form";
|
package/form/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TkForm } from './form.js';
|