tinkiet 0.10.0 → 0.11.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 +4 -0
- package/accordion/index.js +30 -38
- package/badge/badge.d.ts +2 -2
- package/badge/index.js +25 -5
- package/box/box.d.ts +1 -1
- package/box/focusable-box.d.ts +1 -1
- package/checkbox/checkbox.d.ts +5 -3
- package/checkbox/index.js +55 -42
- package/chip/chip.d.ts +15 -0
- package/chip/index.js +52 -7
- package/index.js +347 -178
- package/loading/index.js +107 -12
- package/loading/loading.d.ts +1 -0
- package/package.json +12 -6
- package/pages/index.js +38 -22
- package/pages/pages.d.ts +2 -0
- package/router/index.d.ts +48 -0
- package/router/index.js +246 -0
- package/router/route-matcher.d.ts +4 -0
- package/umd/tinkiet.min.js +137 -124
package/accordion/accordion.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PropertyValues } from "lit";
|
|
1
2
|
import { TkFocusableBox } from "../box/focusable-box";
|
|
2
3
|
export declare class TkAccordion extends TkFocusableBox {
|
|
3
4
|
static get styles(): import("lit").CSSResult[];
|
|
@@ -5,10 +6,13 @@ export declare class TkAccordion extends TkFocusableBox {
|
|
|
5
6
|
checked: boolean;
|
|
6
7
|
rippleHeader: boolean;
|
|
7
8
|
protected $input: HTMLInputElement;
|
|
9
|
+
constructor();
|
|
8
10
|
render(): import("lit").TemplateResult<1>;
|
|
9
11
|
firstUpdated(): void;
|
|
12
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
10
13
|
protected onKeyDown(e: KeyboardEvent): void;
|
|
11
14
|
protected handleClick(): void;
|
|
15
|
+
private syncInput;
|
|
12
16
|
}
|
|
13
17
|
declare global {
|
|
14
18
|
interface HTMLElementTagNameMap {
|
package/accordion/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_lit__ from "lit";
|
|
2
|
-
import * as __WEBPACK_EXTERNAL_MODULE_lit_directives_if_defined_js_76c6050d__ from "lit/directives/if-defined.js";
|
|
3
2
|
import * as __WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__ from "lit/decorators.js";
|
|
4
3
|
/******/ var __webpack_modules__ = ({
|
|
5
4
|
|
|
@@ -16,8 +15,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16
15
|
var external_lit_ = __webpack_require__(2927);
|
|
17
16
|
// EXTERNAL MODULE: external "lit/decorators.js"
|
|
18
17
|
var decorators_js_ = __webpack_require__(8899);
|
|
19
|
-
// EXTERNAL MODULE: external "lit/directives/if-defined.js"
|
|
20
|
-
var if_defined_js_ = __webpack_require__(3517);
|
|
21
18
|
// EXTERNAL MODULE: ./tinkiet/box/index.ts
|
|
22
19
|
var box = __webpack_require__(3433);
|
|
23
20
|
// EXTERNAL MODULE: ./tinkiet/utils/unique.ts
|
|
@@ -59,7 +56,7 @@ __decorate([
|
|
|
59
56
|
], TkFocusableBox.prototype, "disabled", void 0);
|
|
60
57
|
|
|
61
58
|
;// ./tinkiet/accordion/accordion.scss
|
|
62
|
-
/* harmony default export */ const accordion = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host .header{color:hsl(var(--on-surface));background-color:hsl(var(--surface-container-
|
|
59
|
+
/* harmony default export */ const accordion = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host .header{position:relative;overflow:hidden;color:hsl(var(--on-surface));background-color:hsl(var(--surface-container-low));padding:16px;border:1px solid hsl(var(--outline-variant));border-radius:12px;box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 1px 3px 1px rgba(0,0,0,.15);gap:12px;cursor:pointer;transition:background-color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),box-shadow var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),border-color var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1))}:host .header:after{transition:transform .3s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));content:\"▼\";display:inline-block;font-size:12px;margin-inline-start:8px}:host .header:before{content:\"\";position:absolute;inset:0;background:hsl(var(--on-surface));opacity:0;transition:opacity var(--transition-duration-medium, 180ms) var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));pointer-events:none}:host .header .before{width:fit-content}:host .header .header-content{flex:1}:host .content{width:100%;margin:4px 0 0;padding:0 16px;opacity:0;visibility:hidden;max-height:0;overflow:hidden;transform:translateY(-8px);transition:max-height .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),opacity .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),transform .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1));background:hsl(var(--surface-container-lowest));border-radius:0 0 12px 12px}:host h3,:host h5{margin:0}:host .header:hover:before{opacity:.08}:host .header:active:before{opacity:.12}:host .header:focus-visible{outline:none;border-color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15),0 0 0 3px hsl(var(--primary)/0.2)}:host([checked]) .header{background-color:hsl(var(--primary-container));color:hsl(var(--on-primary-container));border-color:hsl(var(--primary));box-shadow:0px 1px 2px 0px rgba(0,0,0,.3),0px 2px 6px 2px rgba(0,0,0,.15)}:host([checked]) .header:after{transform:rotate(180deg)}:host([checked]) .header:before{background:hsl(var(--on-primary-container))}:host([checked]) .content{opacity:1;visibility:visible;max-height:var(--tk-accordion-max-height, 1000px);padding:12px 16px;transform:translateY(0);transition:max-height .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),opacity .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1)),transform .28s var(--transition-timing-function-deceleration-curve, cubic-bezier(0, 0, 0.2, 1))}:host([pill]) .header{border-radius:9999px}@media(prefers-reduced-motion: reduce){:host .header:after{transition:none}:host .header:before{transition:none}:host .header{transition:none}:host .content{transition:none}}");
|
|
63
60
|
;// ./tinkiet/accordion/accordion.ts
|
|
64
61
|
var accordion_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
65
62
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -72,13 +69,7 @@ var accordion_decorate = (undefined && undefined.__decorate) || function (decora
|
|
|
72
69
|
|
|
73
70
|
|
|
74
71
|
|
|
75
|
-
|
|
76
72
|
let TkAccordion = class TkAccordion extends TkFocusableBox {
|
|
77
|
-
constructor() {
|
|
78
|
-
super(...arguments);
|
|
79
|
-
this.checked = false;
|
|
80
|
-
this.rippleHeader = false;
|
|
81
|
-
}
|
|
82
73
|
static get styles() {
|
|
83
74
|
return [
|
|
84
75
|
...box/* TkBox */.P.styles,
|
|
@@ -87,11 +78,17 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
|
|
|
87
78
|
`
|
|
88
79
|
];
|
|
89
80
|
}
|
|
81
|
+
constructor() {
|
|
82
|
+
super();
|
|
83
|
+
this.checked = false;
|
|
84
|
+
this.rippleHeader = false;
|
|
85
|
+
this.handleClick = this.handleClick.bind(this);
|
|
86
|
+
}
|
|
90
87
|
render() {
|
|
91
88
|
return (0,external_lit_.html) `
|
|
92
89
|
<tk-box margin="small">
|
|
93
90
|
<tk-box
|
|
94
|
-
@click=${this.handleClick
|
|
91
|
+
@click=${this.handleClick}
|
|
95
92
|
?ripple=${this.rippleHeader}
|
|
96
93
|
class="header"
|
|
97
94
|
direction="row"
|
|
@@ -109,22 +106,22 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
|
|
|
109
106
|
<slot></slot>
|
|
110
107
|
</tk-box>
|
|
111
108
|
</tk-box>
|
|
112
|
-
<input
|
|
113
|
-
id=${this.id}
|
|
114
|
-
slot="none"
|
|
115
|
-
style="display: none;"
|
|
116
|
-
type="radio"
|
|
117
|
-
?checked="${this.checked}"
|
|
118
|
-
?disabled="${this.disabled}"
|
|
119
|
-
name="${(0,if_defined_js_.ifDefined)(this.name)}"
|
|
120
|
-
aria-hidden="true"
|
|
121
|
-
tabindex="-1"
|
|
122
|
-
/>
|
|
123
109
|
`;
|
|
124
110
|
}
|
|
125
111
|
firstUpdated() {
|
|
112
|
+
this.$input = document.createElement("input");
|
|
113
|
+
this.$input.type = "radio";
|
|
114
|
+
this.$input.slot = "none";
|
|
115
|
+
this.$input.style.display = "none";
|
|
116
|
+
this.$input.setAttribute("aria-hidden", "true");
|
|
117
|
+
this.$input.tabIndex = -1;
|
|
118
|
+
this.syncInput();
|
|
126
119
|
this.appendChild(this.$input);
|
|
127
120
|
}
|
|
121
|
+
updated(changed) {
|
|
122
|
+
super.updated(changed);
|
|
123
|
+
this.syncInput();
|
|
124
|
+
}
|
|
128
125
|
onKeyDown(e) {
|
|
129
126
|
if (e.code === "Space" || e.code === "Enter") {
|
|
130
127
|
e.preventDefault();
|
|
@@ -138,7 +135,16 @@ let TkAccordion = class TkAccordion extends TkFocusableBox {
|
|
|
138
135
|
this.getRootNode()
|
|
139
136
|
.querySelectorAll(`tk-accordion[name="${this.name}"]`)
|
|
140
137
|
.forEach(el => (el != this ? (el.checked = false) : null));
|
|
141
|
-
this.dispatchEvent(new Event("change"));
|
|
138
|
+
this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
|
|
139
|
+
}
|
|
140
|
+
syncInput() {
|
|
141
|
+
var _a;
|
|
142
|
+
if (!this.$input)
|
|
143
|
+
return;
|
|
144
|
+
this.$input.id = this.id;
|
|
145
|
+
this.$input.name = (_a = this.name) !== null && _a !== void 0 ? _a : "";
|
|
146
|
+
this.$input.checked = this.checked;
|
|
147
|
+
this.$input.disabled = this.disabled;
|
|
142
148
|
}
|
|
143
149
|
};
|
|
144
150
|
accordion_decorate([
|
|
@@ -150,9 +156,6 @@ accordion_decorate([
|
|
|
150
156
|
accordion_decorate([
|
|
151
157
|
(0,decorators_js_.property)({ attribute: "ripple-header", type: Boolean })
|
|
152
158
|
], TkAccordion.prototype, "rippleHeader", void 0);
|
|
153
|
-
accordion_decorate([
|
|
154
|
-
(0,decorators_js_.query)("input")
|
|
155
|
-
], TkAccordion.prototype, "$input", void 0);
|
|
156
159
|
TkAccordion = accordion_decorate([
|
|
157
160
|
(0,decorators_js_.customElement)("tk-accordion")
|
|
158
161
|
], TkAccordion);
|
|
@@ -391,17 +394,6 @@ module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitE
|
|
|
391
394
|
|
|
392
395
|
|
|
393
396
|
|
|
394
|
-
/***/ }),
|
|
395
|
-
|
|
396
|
-
/***/ 3517:
|
|
397
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
398
|
-
|
|
399
|
-
var x = (y) => {
|
|
400
|
-
var x = {}; __webpack_require__.d(x, y); return x
|
|
401
|
-
}
|
|
402
|
-
var y = (x) => (() => (x))
|
|
403
|
-
module.exports = x({ ["ifDefined"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_directives_if_defined_js_76c6050d__.ifDefined) });
|
|
404
|
-
|
|
405
397
|
/***/ }),
|
|
406
398
|
|
|
407
399
|
/***/ 3770:
|
|
@@ -431,7 +423,7 @@ var x = (y) => {
|
|
|
431
423
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
432
424
|
}
|
|
433
425
|
var y = (x) => (() => (x))
|
|
434
|
-
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property)
|
|
426
|
+
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property) });
|
|
435
427
|
|
|
436
428
|
/***/ })
|
|
437
429
|
|
package/badge/badge.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
3
|
* A badge WebComponent
|
|
4
|
-
* @cssprop --tk-badge-color -
|
|
5
|
-
* @cssprop --tk-badge-text-color -
|
|
4
|
+
* @cssprop --tk-badge-color - Badge background color (defaults to --primary)
|
|
5
|
+
* @cssprop --tk-badge-text-color - Badge text color (defaults to --on-primary)
|
|
6
6
|
*/
|
|
7
7
|
export declare class TkBadge extends LitElement {
|
|
8
8
|
static get styles(): import("lit").CSSResult;
|
package/badge/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_lit__ from "lit";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__ from "lit/directives/class-map.js";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__ from "lit/decorators.js";
|
|
3
4
|
/******/ var __webpack_modules__ = ({
|
|
4
5
|
|
|
@@ -15,8 +16,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
15
16
|
var external_lit_ = __webpack_require__(2927);
|
|
16
17
|
// EXTERNAL MODULE: external "lit/decorators.js"
|
|
17
18
|
var decorators_js_ = __webpack_require__(8899);
|
|
19
|
+
// EXTERNAL MODULE: external "lit/directives/class-map.js"
|
|
20
|
+
var class_map_js_ = __webpack_require__(4955);
|
|
18
21
|
;// ./tinkiet/badge/badge.scss
|
|
19
|
-
/* harmony default export */ const badge = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:inline-flex}:host .badge{background-color:hsl(var(--error));font-family:\"Trebuchet MS\",\"Lucida Sans Unicode\",\"Lucida Grande\",\"Lucida Sans\",Arial,sans-serif;color:hsl(var(--on-error));height:16px;min-width:16px;max-width:34px;border-radius:8px;padding:4px;font-size:10px;line-height:8px;text-align:center;white-space:nowrap;user-select:none;cursor:inherit}:host .badge.empty{height:6px;width:6px;min-width:6px;border-radius:100%}");
|
|
22
|
+
/* harmony default export */ const badge = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}:host{display:inline-flex}:host .badge{background-color:var(--tk-badge-color, hsl(var(--error)));font-family:\"Trebuchet MS\",\"Lucida Sans Unicode\",\"Lucida Grande\",\"Lucida Sans\",Arial,sans-serif;color:var(--tk-badge-text-color, hsl(var(--on-error)));height:16px;min-width:16px;max-width:34px;border-radius:8px;padding:4px;font-size:10px;line-height:8px;text-align:center;white-space:nowrap;user-select:none;cursor:inherit}:host .badge.empty{height:6px;width:6px;min-width:6px;border-radius:100%}");
|
|
20
23
|
;// ./tinkiet/badge/badge.ts
|
|
21
24
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
22
25
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -27,26 +30,32 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
|
|
33
|
+
|
|
30
34
|
/**
|
|
31
35
|
* A badge WebComponent
|
|
32
|
-
* @cssprop --tk-badge-color -
|
|
33
|
-
* @cssprop --tk-badge-text-color -
|
|
36
|
+
* @cssprop --tk-badge-color - Badge background color (defaults to --primary)
|
|
37
|
+
* @cssprop --tk-badge-text-color - Badge text color (defaults to --on-primary)
|
|
34
38
|
*/
|
|
35
39
|
let TkBadge = class TkBadge extends external_lit_.LitElement {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this.label = "";
|
|
43
|
+
}
|
|
36
44
|
static get styles() {
|
|
37
45
|
return (0,external_lit_.css) `
|
|
38
46
|
${(0,external_lit_.unsafeCSS)(badge)}
|
|
39
47
|
`;
|
|
40
48
|
}
|
|
41
49
|
render() {
|
|
50
|
+
const isEmpty = this.label.trim().length === 0;
|
|
42
51
|
return (0,external_lit_.html) `
|
|
43
52
|
<slot></slot>
|
|
44
|
-
<div class
|
|
53
|
+
<div class=${(0,class_map_js_.classMap)({ badge: true, empty: isEmpty })}>${this.label}</div>
|
|
45
54
|
`;
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
57
|
__decorate([
|
|
49
|
-
(0,decorators_js_.property)()
|
|
58
|
+
(0,decorators_js_.property)({ type: String })
|
|
50
59
|
], TkBadge.prototype, "label", void 0);
|
|
51
60
|
TkBadge = __decorate([
|
|
52
61
|
(0,decorators_js_.customElement)("tk-badge")
|
|
@@ -67,6 +76,17 @@ module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitE
|
|
|
67
76
|
|
|
68
77
|
/***/ }),
|
|
69
78
|
|
|
79
|
+
/***/ 4955:
|
|
80
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
81
|
+
|
|
82
|
+
var x = (y) => {
|
|
83
|
+
var x = {}; __webpack_require__.d(x, y); return x
|
|
84
|
+
}
|
|
85
|
+
var y = (x) => (() => (x))
|
|
86
|
+
module.exports = x({ ["classMap"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__.classMap) });
|
|
87
|
+
|
|
88
|
+
/***/ }),
|
|
89
|
+
|
|
70
90
|
/***/ 8899:
|
|
71
91
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
72
92
|
|
package/box/box.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare class TkBox extends LitElement {
|
|
|
48
48
|
render(): import("lit").TemplateResult<1>;
|
|
49
49
|
connectedCallback(): void;
|
|
50
50
|
disconnectedCallback(): void;
|
|
51
|
-
updated(props: any): void;
|
|
51
|
+
protected updated(props: any): void;
|
|
52
52
|
private showRipple;
|
|
53
53
|
private hideRipple;
|
|
54
54
|
}
|
package/box/focusable-box.d.ts
CHANGED
package/checkbox/checkbox.d.ts
CHANGED
|
@@ -7,13 +7,15 @@ export declare class TkCheckbox extends LitElement {
|
|
|
7
7
|
value: string;
|
|
8
8
|
checked: boolean;
|
|
9
9
|
disabled: boolean;
|
|
10
|
+
indeterminate: boolean;
|
|
10
11
|
private $input;
|
|
12
|
+
constructor();
|
|
11
13
|
render(): import("lit").TemplateResult<1>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
firstUpdated(): void;
|
|
14
|
+
protected firstUpdated(): void;
|
|
15
|
+
protected updated(): void;
|
|
15
16
|
protected onKeyDown(e: KeyboardEvent): void;
|
|
16
17
|
protected handleClick(): void;
|
|
18
|
+
private syncInput;
|
|
17
19
|
}
|
|
18
20
|
declare global {
|
|
19
21
|
interface HTMLElementTagNameMap {
|
package/checkbox/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_lit__ from "lit";
|
|
2
|
-
import * as
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__ from "lit/directives/class-map.js";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__ from "lit/decorators.js";
|
|
4
4
|
/******/ var __webpack_modules__ = ({
|
|
5
5
|
|
|
@@ -16,8 +16,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16
16
|
var external_lit_ = __webpack_require__(2927);
|
|
17
17
|
// EXTERNAL MODULE: external "lit/decorators.js"
|
|
18
18
|
var decorators_js_ = __webpack_require__(8899);
|
|
19
|
-
// EXTERNAL MODULE: external "lit/directives/
|
|
20
|
-
var
|
|
19
|
+
// EXTERNAL MODULE: external "lit/directives/class-map.js"
|
|
20
|
+
var class_map_js_ = __webpack_require__(4955);
|
|
21
21
|
// EXTERNAL MODULE: ./tinkiet/box/index.ts
|
|
22
22
|
var box = __webpack_require__(3433);
|
|
23
23
|
// EXTERNAL MODULE: ./tinkiet/utils/unique.ts
|
|
@@ -39,15 +39,22 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
39
39
|
|
|
40
40
|
let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
|
|
41
41
|
constructor() {
|
|
42
|
-
super(
|
|
42
|
+
super();
|
|
43
43
|
this._id = (0,unique/* uniqueID */.z)();
|
|
44
44
|
this.checked = false;
|
|
45
45
|
this.disabled = false;
|
|
46
|
+
this.indeterminate = false;
|
|
47
|
+
this.handleClick = this.handleClick.bind(this);
|
|
48
|
+
this.onKeyDown = this.onKeyDown.bind(this);
|
|
46
49
|
}
|
|
47
50
|
render() {
|
|
51
|
+
const containerClasses = {
|
|
52
|
+
state: true,
|
|
53
|
+
disabled: this.disabled
|
|
54
|
+
};
|
|
48
55
|
return (0,external_lit_.html) `
|
|
49
|
-
<tk-box direction="row" align-items="center">
|
|
50
|
-
<tk-box ripple tabindex="${this.disabled ? -1 : 0}" class
|
|
56
|
+
<tk-box direction="row" align-items="center" @click=${this.handleClick}>
|
|
57
|
+
<tk-box ripple tabindex="${this.disabled ? -1 : 0}" class=${(0,class_map_js_.classMap)(containerClasses)} @keydown=${this.onKeyDown}>
|
|
51
58
|
<div class="checkbox">
|
|
52
59
|
<svg id="checkmark" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="none" viewBox="0 0 24 24">
|
|
53
60
|
<path id="checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
|
|
@@ -57,33 +64,24 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
|
|
|
57
64
|
</tk-box>
|
|
58
65
|
<span class="label"><slot></slot></span>
|
|
59
66
|
</tk-box>
|
|
60
|
-
<input
|
|
61
|
-
id=${this._id}
|
|
62
|
-
slot="none"
|
|
63
|
-
style="display: none;"
|
|
64
|
-
?checked=${this.checked}
|
|
65
|
-
type="checkbox"
|
|
66
|
-
name="${(0,if_defined_js_.ifDefined)(this.name)}"
|
|
67
|
-
value="${(0,if_defined_js_.ifDefined)(this.value)}"
|
|
68
|
-
aria-hidden="true"
|
|
69
|
-
tabindex="-1"
|
|
70
|
-
/>
|
|
71
67
|
`;
|
|
72
68
|
}
|
|
73
|
-
connectedCallback() {
|
|
74
|
-
super.connectedCallback();
|
|
75
|
-
this.addEventListener("click", this.handleClick.bind(this));
|
|
76
|
-
this.addEventListener("keydown", this.onKeyDown.bind(this));
|
|
77
|
-
}
|
|
78
|
-
disconnectedCallback() {
|
|
79
|
-
super.disconnectedCallback();
|
|
80
|
-
this.removeEventListener("click", this.handleClick);
|
|
81
|
-
this.removeEventListener("keydown", this.onKeyDown);
|
|
82
|
-
}
|
|
83
69
|
firstUpdated() {
|
|
70
|
+
this.$input = document.createElement("input");
|
|
71
|
+
this.$input.type = "checkbox";
|
|
72
|
+
this.$input.slot = "none";
|
|
73
|
+
this.$input.style.display = "none";
|
|
74
|
+
this.$input.setAttribute("aria-hidden", "true");
|
|
75
|
+
this.$input.tabIndex = -1;
|
|
76
|
+
this.syncInput();
|
|
84
77
|
this.appendChild(this.$input);
|
|
85
78
|
}
|
|
79
|
+
updated() {
|
|
80
|
+
this.syncInput();
|
|
81
|
+
}
|
|
86
82
|
onKeyDown(e) {
|
|
83
|
+
if (this.disabled)
|
|
84
|
+
return;
|
|
87
85
|
if (e.code === "Space" || e.code === "Enter") {
|
|
88
86
|
e.preventDefault();
|
|
89
87
|
e.stopPropagation();
|
|
@@ -91,9 +89,24 @@ let TkCheckbox = class TkCheckbox extends external_lit_.LitElement {
|
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
handleClick() {
|
|
92
|
+
if (this.disabled)
|
|
93
|
+
return;
|
|
94
94
|
this.checked = !this.checked;
|
|
95
|
+
if (this.indeterminate)
|
|
96
|
+
this.indeterminate = false;
|
|
95
97
|
setTimeout(() => this.dispatchEvent(new Event("change", { bubbles: true, composed: true })));
|
|
96
98
|
}
|
|
99
|
+
syncInput() {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if (!this.$input)
|
|
102
|
+
return;
|
|
103
|
+
this.$input.id = this._id;
|
|
104
|
+
this.$input.name = (_a = this.name) !== null && _a !== void 0 ? _a : "";
|
|
105
|
+
this.$input.value = (_b = this.value) !== null && _b !== void 0 ? _b : "on";
|
|
106
|
+
this.$input.checked = this.checked;
|
|
107
|
+
this.$input.disabled = this.disabled;
|
|
108
|
+
this.$input.indeterminate = this.indeterminate;
|
|
109
|
+
}
|
|
97
110
|
};
|
|
98
111
|
TkCheckbox.styles = (0,external_lit_.css) `
|
|
99
112
|
${(0,external_lit_.unsafeCSS)(checkbox_checkbox)}
|
|
@@ -108,11 +121,11 @@ __decorate([
|
|
|
108
121
|
(0,decorators_js_.property)({ attribute: true, type: Boolean, reflect: true })
|
|
109
122
|
], TkCheckbox.prototype, "checked", void 0);
|
|
110
123
|
__decorate([
|
|
111
|
-
(0,decorators_js_.property)({ type: Boolean })
|
|
124
|
+
(0,decorators_js_.property)({ attribute: true, type: Boolean, reflect: true })
|
|
112
125
|
], TkCheckbox.prototype, "disabled", void 0);
|
|
113
126
|
__decorate([
|
|
114
|
-
(0,decorators_js_.
|
|
115
|
-
], TkCheckbox.prototype, "
|
|
127
|
+
(0,decorators_js_.property)({ attribute: true, type: Boolean, reflect: true })
|
|
128
|
+
], TkCheckbox.prototype, "indeterminate", void 0);
|
|
116
129
|
TkCheckbox = __decorate([
|
|
117
130
|
(0,decorators_js_.customElement)("tk-checkbox")
|
|
118
131
|
], TkCheckbox);
|
|
@@ -350,17 +363,6 @@ module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitE
|
|
|
350
363
|
|
|
351
364
|
|
|
352
365
|
|
|
353
|
-
/***/ }),
|
|
354
|
-
|
|
355
|
-
/***/ 3517:
|
|
356
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
357
|
-
|
|
358
|
-
var x = (y) => {
|
|
359
|
-
var x = {}; __webpack_require__.d(x, y); return x
|
|
360
|
-
}
|
|
361
|
-
var y = (x) => (() => (x))
|
|
362
|
-
module.exports = x({ ["ifDefined"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_directives_if_defined_js_76c6050d__.ifDefined) });
|
|
363
|
-
|
|
364
366
|
/***/ }),
|
|
365
367
|
|
|
366
368
|
/***/ 3770:
|
|
@@ -381,6 +383,17 @@ function uniqueID(length = 10) {
|
|
|
381
383
|
}
|
|
382
384
|
|
|
383
385
|
|
|
386
|
+
/***/ }),
|
|
387
|
+
|
|
388
|
+
/***/ 4955:
|
|
389
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
390
|
+
|
|
391
|
+
var x = (y) => {
|
|
392
|
+
var x = {}; __webpack_require__.d(x, y); return x
|
|
393
|
+
}
|
|
394
|
+
var y = (x) => (() => (x))
|
|
395
|
+
module.exports = x({ ["classMap"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_directives_class_map_js_2f88e643__.classMap) });
|
|
396
|
+
|
|
384
397
|
/***/ }),
|
|
385
398
|
|
|
386
399
|
/***/ 8899:
|
|
@@ -390,7 +403,7 @@ var x = (y) => {
|
|
|
390
403
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
391
404
|
}
|
|
392
405
|
var y = (x) => (() => (x))
|
|
393
|
-
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property)
|
|
406
|
+
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property) });
|
|
394
407
|
|
|
395
408
|
/***/ })
|
|
396
409
|
|
package/chip/chip.d.ts
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Material-style Chip component.
|
|
4
|
+
*
|
|
5
|
+
* Slots :
|
|
6
|
+
* • default <slot> → label text
|
|
7
|
+
* • <slot name="leading"> → leading icon / image
|
|
8
|
+
* • <slot name="trailing"> → trailing icon (remove / action)
|
|
9
|
+
*
|
|
10
|
+
* Attributes :
|
|
11
|
+
* • removable (boolean) → affiche un trailing icon automatique (ex: bouton X)
|
|
12
|
+
* • disabled (boolean)
|
|
13
|
+
*/
|
|
2
14
|
export declare class TkChip extends LitElement {
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
removable: boolean;
|
|
3
17
|
static styles: import("lit").CSSResult;
|
|
18
|
+
private onRemove;
|
|
4
19
|
render(): import("lit").TemplateResult<1>;
|
|
5
20
|
}
|
|
6
21
|
declare global {
|
package/chip/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var external_lit_ = __webpack_require__(2927);
|
|
|
27
27
|
// EXTERNAL MODULE: external "lit/decorators.js"
|
|
28
28
|
var decorators_js_ = __webpack_require__(8899);
|
|
29
29
|
;// ./tinkiet/chip/chip.scss
|
|
30
|
-
/* harmony default export */ const chip = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}
|
|
30
|
+
/* harmony default export */ const chip = ("*{-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box}.chip{display:inline-flex;align-items:center;border-radius:10px;padding:3px 10px;background:hsl(var(--surface-container-highest));border:1px solid hsl(var(--outline-variant));font-size:13px;height:30px;gap:6px;line-height:1;cursor:pointer}.chip.disabled{opacity:.4;pointer-events:none}.chip .leading{display:inline-flex;align-items:center}.chip .leading slot::slotted(*){display:inline-flex;align-items:center}.chip .label{white-space:nowrap;display:inline-flex;align-items:center;line-height:1}.chip .trailing{display:inline-flex;align-items:center}.chip .trailing slot::slotted(*){display:inline-flex;align-items:center}.chip .trailing .remove{background:none;border:none;cursor:pointer;font-size:13px;line-height:1;opacity:.7}.chip .trailing .remove:hover{opacity:1}");
|
|
31
31
|
;// ./tinkiet/chip/chip.ts
|
|
32
32
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
33
33
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -38,16 +38,61 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Material-style Chip component.
|
|
43
|
+
*
|
|
44
|
+
* Slots :
|
|
45
|
+
* • default <slot> → label text
|
|
46
|
+
* • <slot name="leading"> → leading icon / image
|
|
47
|
+
* • <slot name="trailing"> → trailing icon (remove / action)
|
|
48
|
+
*
|
|
49
|
+
* Attributes :
|
|
50
|
+
* • removable (boolean) → affiche un trailing icon automatique (ex: bouton X)
|
|
51
|
+
* • disabled (boolean)
|
|
52
|
+
*/
|
|
41
53
|
let TkChip = class TkChip extends external_lit_.LitElement {
|
|
54
|
+
constructor() {
|
|
55
|
+
super(...arguments);
|
|
56
|
+
this.disabled = false;
|
|
57
|
+
this.removable = false;
|
|
58
|
+
}
|
|
59
|
+
onRemove() {
|
|
60
|
+
this.dispatchEvent(new CustomEvent("remove", { bubbles: true, composed: true }));
|
|
61
|
+
}
|
|
42
62
|
render() {
|
|
43
63
|
return (0,external_lit_.html) `
|
|
44
|
-
|
|
45
|
-
|
|
64
|
+
<div class="chip ${this.disabled ? "disabled" : ""}">
|
|
65
|
+
|
|
66
|
+
<!-- 3. LEADING ICON (optional) -->
|
|
67
|
+
<span class="leading">
|
|
68
|
+
<slot name="leading"></slot>
|
|
69
|
+
</span>
|
|
70
|
+
|
|
71
|
+
<!-- 2. LABEL TEXT -->
|
|
72
|
+
<span class="label">
|
|
73
|
+
<slot></slot>
|
|
74
|
+
</span>
|
|
75
|
+
|
|
76
|
+
<!-- 4. TRAILING ICON -->
|
|
77
|
+
<span class="trailing">
|
|
78
|
+
<slot name="trailing">
|
|
79
|
+
${this.removable
|
|
80
|
+
? (0,external_lit_.html) `<button class="remove" @click=${this.onRemove}>✕</button>`
|
|
81
|
+
: ""}
|
|
82
|
+
</slot>
|
|
83
|
+
</span>
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
|
46
87
|
}
|
|
47
88
|
};
|
|
48
|
-
TkChip.styles = (0,external_lit_.css)
|
|
49
|
-
|
|
50
|
-
|
|
89
|
+
TkChip.styles = (0,external_lit_.css) `${(0,external_lit_.unsafeCSS)(chip)}`;
|
|
90
|
+
__decorate([
|
|
91
|
+
(0,decorators_js_.property)({ type: Boolean })
|
|
92
|
+
], TkChip.prototype, "disabled", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0,decorators_js_.property)({ type: Boolean })
|
|
95
|
+
], TkChip.prototype, "removable", void 0);
|
|
51
96
|
TkChip = __decorate([
|
|
52
97
|
(0,decorators_js_.customElement)("tk-chip")
|
|
53
98
|
], TkChip);
|
|
@@ -63,7 +108,7 @@ var x = (y) => {
|
|
|
63
108
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
64
109
|
}
|
|
65
110
|
var y = (x) => (() => (x))
|
|
66
|
-
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement) });
|
|
111
|
+
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property) });
|
|
67
112
|
|
|
68
113
|
/***/ })
|
|
69
114
|
|