tinkiet 0.11.4 → 0.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +14 -4
- package/button/button.d.ts +8 -1
- package/button/index.js +49 -15
- package/checkbox/checkbox.d.ts +2 -4
- package/checkbox/index.js +41 -28
- package/chip/chip.d.ts +1 -1
- package/chip/index.js +30 -8
- package/dialog/dialog.d.ts +3 -2
- package/dialog/index.js +17 -9
- package/drawer/drawer.d.ts +9 -5
- package/drawer/index.js +69 -44
- package/icon/icon.d.ts +2 -1
- package/icon/index.js +32 -18
- package/index.js +275 -158
- package/list-item/index.js +18 -12
- package/list-item/list-item.d.ts +2 -2
- package/package.json +1 -1
- package/theme/index.js +23 -26
- package/theme/theme.d.ts +2 -1
- package/umd/tinkiet.min.js +80 -46
package/list-item/index.js
CHANGED
|
@@ -47,20 +47,21 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
|
|
|
47
47
|
return (0,external_lit_.html) `
|
|
48
48
|
<slot name="before" @click=${this.handleClick}></slot>
|
|
49
49
|
<div id="content">
|
|
50
|
-
<slot></slot>
|
|
50
|
+
<slot @slotchange=${this.ensureAriaLabel}></slot>
|
|
51
51
|
</div>
|
|
52
52
|
<slot name="after" @click=${this.handleClick}></slot>
|
|
53
53
|
${this.href
|
|
54
54
|
? (0,external_lit_.html) `
|
|
55
|
-
<a tabindex="-1" id="ahref" href
|
|
55
|
+
<a tabindex="-1" id="ahref" href=${this.href} target=${(0,if_defined_js_.ifDefined)(this.target)} rel="noreferrer" aria-label=${this.ariaLabel}></a>
|
|
56
56
|
`
|
|
57
|
-
:
|
|
57
|
+
: external_lit_.nothing}
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
60
|
constructor() {
|
|
61
61
|
super();
|
|
62
62
|
this.href = "";
|
|
63
63
|
this.target = "";
|
|
64
|
+
this.ariaLabel = "";
|
|
64
65
|
this.onKeyDown = (e) => {
|
|
65
66
|
if (e.code === "Space" || e.code === "Enter") {
|
|
66
67
|
e.preventDefault();
|
|
@@ -74,19 +75,16 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
|
|
|
74
75
|
if (target.tagName == "BUTTON" || target.tagName == "TK-BUTTON" || target.tagName == "TK-SWITCH" || target.tagName == "TK-CHECKBOX") {
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
|
-
if (this.href && e.isTrusted) {
|
|
78
|
+
if (this.href && e.isTrusted && this.$ahref) {
|
|
78
79
|
e.stopPropagation();
|
|
79
80
|
e.preventDefault();
|
|
80
81
|
this.$ahref.click();
|
|
81
82
|
}
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
|
-
firstUpdated() {
|
|
85
|
-
if (!this.ariaLabel && this.innerText)
|
|
86
|
-
this.ariaLabel = this.innerText;
|
|
87
|
-
}
|
|
88
85
|
connectedCallback() {
|
|
89
86
|
super.connectedCallback();
|
|
87
|
+
this.ensureAriaLabel();
|
|
90
88
|
this.addEventListener("keydown", this.onKeyDown);
|
|
91
89
|
this.addEventListener("click", this.handleClick);
|
|
92
90
|
}
|
|
@@ -95,15 +93,23 @@ let TkListItem = class TkListItem extends box/* TkBox */.P {
|
|
|
95
93
|
this.removeEventListener("click", this.handleClick);
|
|
96
94
|
this.removeEventListener("keydown", this.onKeyDown);
|
|
97
95
|
}
|
|
96
|
+
ensureAriaLabel() {
|
|
97
|
+
var _a;
|
|
98
|
+
if (this.ariaLabel)
|
|
99
|
+
return;
|
|
100
|
+
const text = (_a = this.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
|
101
|
+
if (text)
|
|
102
|
+
this.ariaLabel = text;
|
|
103
|
+
}
|
|
98
104
|
};
|
|
99
105
|
__decorate([
|
|
100
|
-
(0,decorators_js_.property)({
|
|
106
|
+
(0,decorators_js_.property)({ type: String, reflect: true })
|
|
101
107
|
], TkListItem.prototype, "href", void 0);
|
|
102
108
|
__decorate([
|
|
103
|
-
(0,decorators_js_.property)({
|
|
109
|
+
(0,decorators_js_.property)({ type: String, reflect: true })
|
|
104
110
|
], TkListItem.prototype, "target", void 0);
|
|
105
111
|
__decorate([
|
|
106
|
-
(0,decorators_js_.property)({ attribute: "aria-label" })
|
|
112
|
+
(0,decorators_js_.property)({ attribute: "aria-label", reflect: true })
|
|
107
113
|
], TkListItem.prototype, "ariaLabel", void 0);
|
|
108
114
|
__decorate([
|
|
109
115
|
(0,decorators_js_.query)("#ahref")
|
|
@@ -332,7 +338,7 @@ var x = (y) => {
|
|
|
332
338
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
333
339
|
}
|
|
334
340
|
var y = (x) => (() => (x))
|
|
335
|
-
module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
|
|
341
|
+
module.exports = x({ ["LitElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.LitElement), ["css"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.css), ["html"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.html), ["nothing"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.nothing), ["unsafeCSS"]: () => (__WEBPACK_EXTERNAL_MODULE_lit__.unsafeCSS) });
|
|
336
342
|
|
|
337
343
|
/***/ }),
|
|
338
344
|
|
package/list-item/list-item.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ export declare class TkListItem extends TkBox {
|
|
|
4
4
|
href: string;
|
|
5
5
|
target: string;
|
|
6
6
|
ariaLabel: string;
|
|
7
|
-
protected $ahref
|
|
7
|
+
protected $ahref?: HTMLAnchorElement;
|
|
8
8
|
render(): import("lit").TemplateResult<1>;
|
|
9
9
|
constructor();
|
|
10
|
-
firstUpdated(): void;
|
|
11
10
|
connectedCallback(): void;
|
|
12
11
|
disconnectedCallback(): void;
|
|
13
12
|
protected onKeyDown: (e: KeyboardEvent) => void;
|
|
14
13
|
protected handleClick: (e: Event) => void;
|
|
14
|
+
private ensureAriaLabel;
|
|
15
15
|
}
|
|
16
16
|
declare global {
|
|
17
17
|
interface HTMLElementTagNameMap {
|
package/package.json
CHANGED
package/theme/index.js
CHANGED
|
@@ -47,8 +47,13 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
|
|
|
47
47
|
this.error = "#B3261E";
|
|
48
48
|
this.neutral = "#5E5F5C";
|
|
49
49
|
this.neutralVariant = "#5c6057";
|
|
50
|
-
this.forceBody = false;
|
|
51
50
|
this.inverted = false;
|
|
51
|
+
this.primary_hsl = [];
|
|
52
|
+
this.secondary_hsl = [];
|
|
53
|
+
this.tertiary_hsl = [];
|
|
54
|
+
this.error_hsl = [];
|
|
55
|
+
this.neutral_hsl = [];
|
|
56
|
+
this.neutral_variant_hsl = [];
|
|
52
57
|
}
|
|
53
58
|
render() {
|
|
54
59
|
return (0,external_lit_.html) `
|
|
@@ -58,6 +63,17 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
|
|
|
58
63
|
firstUpdated(_changedProperties) {
|
|
59
64
|
this.setThemeColor();
|
|
60
65
|
}
|
|
66
|
+
updated(changedProps) {
|
|
67
|
+
if (changedProps.has("primary") ||
|
|
68
|
+
changedProps.has("secondary") ||
|
|
69
|
+
changedProps.has("tertiary") ||
|
|
70
|
+
changedProps.has("error") ||
|
|
71
|
+
changedProps.has("neutral") ||
|
|
72
|
+
changedProps.has("neutralVariant")) {
|
|
73
|
+
this.setThemeColor();
|
|
74
|
+
}
|
|
75
|
+
super.updated(changedProps);
|
|
76
|
+
}
|
|
61
77
|
hexToHSL(hex) {
|
|
62
78
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex);
|
|
63
79
|
if (result == null)
|
|
@@ -94,8 +110,11 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
|
|
|
94
110
|
this.error_hsl = this.hexToHSL(this.error);
|
|
95
111
|
this.neutral_hsl = this.hexToHSL(this.neutral);
|
|
96
112
|
this.neutral_variant_hsl = this.hexToHSL(this.neutralVariant);
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
if (!this.styleEl) {
|
|
114
|
+
this.styleEl = document.createElement("style");
|
|
115
|
+
document.body.appendChild(this.styleEl);
|
|
116
|
+
}
|
|
117
|
+
this.styleEl.innerHTML = `
|
|
99
118
|
:root {
|
|
100
119
|
--primary-h: ${this.primary_hsl[0]};
|
|
101
120
|
--primary-s: ${this.primary_hsl[1]};
|
|
@@ -117,7 +136,6 @@ let TkTheme = class TkTheme extends external_lit_.LitElement {
|
|
|
117
136
|
--neutral-variant-l: ${this.neutral_variant_hsl[2]};
|
|
118
137
|
}
|
|
119
138
|
`;
|
|
120
|
-
document.body.appendChild(style);
|
|
121
139
|
}
|
|
122
140
|
};
|
|
123
141
|
TkTheme.styles = (0,external_lit_.css) `
|
|
@@ -141,30 +159,9 @@ __decorate([
|
|
|
141
159
|
__decorate([
|
|
142
160
|
(0,decorators_js_.property)()
|
|
143
161
|
], TkTheme.prototype, "neutralVariant", void 0);
|
|
144
|
-
__decorate([
|
|
145
|
-
(0,decorators_js_.property)({ type: Boolean, attribute: "force-body", reflect: true })
|
|
146
|
-
], TkTheme.prototype, "forceBody", void 0);
|
|
147
162
|
__decorate([
|
|
148
163
|
(0,decorators_js_.property)({ type: Boolean, attribute: true, reflect: true })
|
|
149
164
|
], TkTheme.prototype, "inverted", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
(0,decorators_js_.state)()
|
|
152
|
-
], TkTheme.prototype, "primary_hsl", void 0);
|
|
153
|
-
__decorate([
|
|
154
|
-
(0,decorators_js_.state)()
|
|
155
|
-
], TkTheme.prototype, "secondary_hsl", void 0);
|
|
156
|
-
__decorate([
|
|
157
|
-
(0,decorators_js_.state)()
|
|
158
|
-
], TkTheme.prototype, "tertiary_hsl", void 0);
|
|
159
|
-
__decorate([
|
|
160
|
-
(0,decorators_js_.state)()
|
|
161
|
-
], TkTheme.prototype, "error_hsl", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
(0,decorators_js_.state)()
|
|
164
|
-
], TkTheme.prototype, "neutral_hsl", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0,decorators_js_.state)()
|
|
167
|
-
], TkTheme.prototype, "neutral_variant_hsl", void 0);
|
|
168
165
|
TkTheme = __decorate([
|
|
169
166
|
(0,decorators_js_.customElement)("tk-theme")
|
|
170
167
|
], TkTheme);
|
|
@@ -180,7 +177,7 @@ var x = (y) => {
|
|
|
180
177
|
var x = {}; __webpack_require__.d(x, y); return x
|
|
181
178
|
}
|
|
182
179
|
var y = (x) => (() => (x))
|
|
183
|
-
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property)
|
|
180
|
+
module.exports = x({ ["customElement"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.customElement), ["property"]: () => (__WEBPACK_EXTERNAL_MODULE_lit_decorators_js_226d44c5__.property) });
|
|
184
181
|
|
|
185
182
|
/***/ })
|
|
186
183
|
|
package/theme/theme.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export declare class TkTheme extends LitElement {
|
|
|
7
7
|
error: string;
|
|
8
8
|
neutral: string;
|
|
9
9
|
neutralVariant: string;
|
|
10
|
-
forceBody: boolean;
|
|
11
10
|
inverted: boolean;
|
|
12
11
|
private primary_hsl;
|
|
13
12
|
private secondary_hsl;
|
|
@@ -15,8 +14,10 @@ export declare class TkTheme extends LitElement {
|
|
|
15
14
|
private error_hsl;
|
|
16
15
|
private neutral_hsl;
|
|
17
16
|
private neutral_variant_hsl;
|
|
17
|
+
private styleEl?;
|
|
18
18
|
render(): import("lit").TemplateResult<1>;
|
|
19
19
|
protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
20
|
+
protected updated(changedProps: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
20
21
|
private hexToHSL;
|
|
21
22
|
private setThemeColor;
|
|
22
23
|
}
|