@transcodes/ui-components 0.3.0 → 0.3.2
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/CHANGELOG.md +83 -0
- package/README.md +124 -79
- package/dist/controllers/animation.controller.js +32 -0
- package/dist/controllers/base.controller.js +8 -0
- package/dist/controllers/form-validation.controller.js +49 -0
- package/dist/controllers/history.controller.js +26 -0
- package/dist/controllers/index.d.ts +11 -0
- package/dist/controllers/index.js +18 -0
- package/dist/controllers/loading.controller.js +27 -0
- package/dist/controllers/match-media.controller.js +20 -0
- package/dist/controllers/message-bus.controller.js +45 -0
- package/dist/controllers/storage.controller.js +40 -0
- package/dist/index.d.ts +0 -696
- package/dist/index.js +80 -0
- package/dist/primitives/index.d.ts +21 -0
- package/dist/primitives/index.js +42 -0
- package/dist/primitives/tc-box.js +38 -0
- package/dist/primitives/tc-button.js +167 -0
- package/dist/primitives/tc-callout.js +86 -0
- package/dist/primitives/tc-card.js +76 -0
- package/dist/primitives/tc-chip.js +79 -0
- package/dist/primitives/tc-container.js +62 -0
- package/dist/primitives/tc-divider.js +76 -0
- package/dist/primitives/tc-error-message.js +74 -0
- package/dist/primitives/tc-form-header.js +120 -0
- package/dist/primitives/tc-icon.js +95 -0
- package/dist/primitives/tc-input-with-chip.js +242 -0
- package/dist/primitives/tc-input.js +262 -0
- package/dist/primitives/tc-item-button.js +168 -0
- package/dist/primitives/tc-item.js +93 -0
- package/dist/primitives/tc-otp-input.js +230 -0
- package/dist/primitives/tc-section.js +48 -0
- package/dist/primitives/tc-spinner.js +87 -0
- package/dist/primitives/tc-symbol.js +56 -0
- package/dist/primitives/tc-text.js +145 -0
- package/dist/primitives/tc-toast.js +189 -0
- package/dist/screens/index.d.ts +4 -0
- package/dist/screens/index.js +8 -0
- package/dist/screens/tc-error-screen.js +119 -0
- package/dist/screens/tc-loading-screen.js +77 -0
- package/dist/screens/tc-success-screen.js +192 -0
- package/dist/styles/shared.js +7 -0
- package/dist/widgets/index.d.ts +9 -0
- package/dist/widgets/index.js +18 -0
- package/dist/widgets/tc-authenticator-card.js +213 -0
- package/dist/widgets/tc-floating-button.js +132 -0
- package/dist/widgets/tc-iframe-modal.js +263 -0
- package/dist/widgets/tc-installation-banner.js +234 -0
- package/dist/widgets/tc-ios-installation-guide.js +240 -0
- package/dist/widgets/tc-notification-modal.js +230 -0
- package/dist/widgets/tc-offline-modal.js +202 -0
- package/dist/widgets/tc-page-decoration.js +126 -0
- package/package.json +25 -7
- package/dist/ui-components.css +0 -1
- package/dist/ui-components.js +0 -4981
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LitElement as c, html as p, css as v } from "lit";
|
|
2
|
+
import { property as l, customElement as h } from "lit/decorators.js";
|
|
3
|
+
var g = Object.defineProperty, m = Object.getOwnPropertyDescriptor, n = (e, t, o, s) => {
|
|
4
|
+
for (var r = s > 1 ? void 0 : s ? m(t, o) : t, d = e.length - 1, a; d >= 0; d--)
|
|
5
|
+
(a = e[d]) && (r = (s ? a(t, o, r) : a(r)) || r);
|
|
6
|
+
return s && r && g(t, o, r), r;
|
|
7
|
+
};
|
|
8
|
+
let i = class extends c {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.color = "var(--ink-faint)", this.spacing = "var(--space-md)", this.text = "";
|
|
11
|
+
}
|
|
12
|
+
render() {
|
|
13
|
+
const e = `--divider-color: ${this.color}; --divider-spacing: ${this.spacing};`;
|
|
14
|
+
return this.text ? p`
|
|
15
|
+
<div part="container" class="divider-container" style=${e}>
|
|
16
|
+
<hr part="line" class="divider-line" />
|
|
17
|
+
<span part="text" class="divider-text">${this.text}</span>
|
|
18
|
+
<hr part="line" class="divider-line" />
|
|
19
|
+
</div>
|
|
20
|
+
` : p`
|
|
21
|
+
<hr part="divider" class="divider" style=${e} />
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
i.styles = v`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Simple divider (no text) */
|
|
32
|
+
.divider {
|
|
33
|
+
border: none;
|
|
34
|
+
height: 1px;
|
|
35
|
+
background-color: var(--divider-color);
|
|
36
|
+
margin: var(--divider-spacing) 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Divider with text */
|
|
40
|
+
.divider-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: var(--space-md);
|
|
44
|
+
margin: var(--divider-spacing) 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.divider-line {
|
|
48
|
+
flex: 1;
|
|
49
|
+
border: none;
|
|
50
|
+
height: 1px;
|
|
51
|
+
background-color: var(--divider-color);
|
|
52
|
+
margin: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.divider-text {
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
font-size: var(--font-size-sm);
|
|
58
|
+
color: var(--ink-light);
|
|
59
|
+
font-family: var(--font-body);
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
n([
|
|
63
|
+
l({ type: String })
|
|
64
|
+
], i.prototype, "color", 2);
|
|
65
|
+
n([
|
|
66
|
+
l({ type: String })
|
|
67
|
+
], i.prototype, "spacing", 2);
|
|
68
|
+
n([
|
|
69
|
+
l({ type: String })
|
|
70
|
+
], i.prototype, "text", 2);
|
|
71
|
+
i = n([
|
|
72
|
+
h("tc-divider")
|
|
73
|
+
], i);
|
|
74
|
+
export {
|
|
75
|
+
i as TcDivider
|
|
76
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { LitElement as m, html as p, css as g } from "lit";
|
|
2
|
+
import { property as l, customElement as u } from "lit/decorators.js";
|
|
3
|
+
var h = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (c, r, a, s) => {
|
|
4
|
+
for (var t = s > 1 ? void 0 : s ? v(r, a) : r, n = c.length - 1, i; n >= 0; n--)
|
|
5
|
+
(i = c[n]) && (t = (s ? i(r, a, t) : i(t)) || t);
|
|
6
|
+
return s && t && h(r, a, t), t;
|
|
7
|
+
};
|
|
8
|
+
let e = class extends m {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this.variant = "error", this.message = "";
|
|
11
|
+
}
|
|
12
|
+
getIconName() {
|
|
13
|
+
switch (this.variant) {
|
|
14
|
+
case "warning":
|
|
15
|
+
return "alert-triangle";
|
|
16
|
+
case "info":
|
|
17
|
+
return "info";
|
|
18
|
+
default:
|
|
19
|
+
return "alert-circle";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getIconColor() {
|
|
23
|
+
switch (this.variant) {
|
|
24
|
+
case "warning":
|
|
25
|
+
return "var(--semantic-warning)";
|
|
26
|
+
case "info":
|
|
27
|
+
return "var(--semantic-info)";
|
|
28
|
+
default:
|
|
29
|
+
return "var(--error-base)";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return this.message ? p`
|
|
34
|
+
<tc-callout part="callout" variant=${this.variant}>
|
|
35
|
+
<tc-icon
|
|
36
|
+
slot="icon"
|
|
37
|
+
part="icon"
|
|
38
|
+
name=${this.getIconName()}
|
|
39
|
+
size="1.25rem"
|
|
40
|
+
color=${this.getIconColor()}
|
|
41
|
+
></tc-icon>
|
|
42
|
+
<tc-text part="message" class="message-text" size="sm">
|
|
43
|
+
${this.message}
|
|
44
|
+
</tc-text>
|
|
45
|
+
</tc-callout>
|
|
46
|
+
` : null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
e.styles = g`
|
|
50
|
+
:host {
|
|
51
|
+
display: block;
|
|
52
|
+
width: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tc-callout::part(callout) {
|
|
56
|
+
padding: var(--space-sm) var(--space-md);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.message-text {
|
|
60
|
+
line-height: 1.4;
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
o([
|
|
64
|
+
l({ type: String })
|
|
65
|
+
], e.prototype, "variant", 2);
|
|
66
|
+
o([
|
|
67
|
+
l({ type: String })
|
|
68
|
+
], e.prototype, "message", 2);
|
|
69
|
+
e = o([
|
|
70
|
+
u("tc-error-message")
|
|
71
|
+
], e);
|
|
72
|
+
export {
|
|
73
|
+
e as TcErrorMessage
|
|
74
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { LitElement as p, html as n, css as c } from "lit";
|
|
2
|
+
import { property as r, customElement as f } from "lit/decorators.js";
|
|
3
|
+
import { styleMap as u } from "lit/directives/style-map.js";
|
|
4
|
+
import { sharedStyles as h } from "../styles/shared.js";
|
|
5
|
+
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, a = (i, o, m, s) => {
|
|
6
|
+
for (var e = s > 1 ? void 0 : s ? b(o, m) : o, l = i.length - 1, d; l >= 0; l--)
|
|
7
|
+
(d = i[l]) && (e = (s ? d(o, m, e) : d(e)) || e);
|
|
8
|
+
return s && e && v(o, m, e), e;
|
|
9
|
+
};
|
|
10
|
+
let t = class extends p {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.title = "", this.subtitle = "", this.notice = "", this.noAnimation = !1, this.sx = {};
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const i = !this.noAnimation;
|
|
16
|
+
return n`
|
|
17
|
+
<header part="header" class="header" style=${u(this.sx)}>
|
|
18
|
+
${this.title ? n`<h1 part="title" class="form-title ${i ? "form-title--animated" : ""}">
|
|
19
|
+
${this.title}
|
|
20
|
+
</h1>` : ""}
|
|
21
|
+
${this.subtitle ? n`<p part="subtitle" class="form-subtitle ${i ? "form-subtitle--animated" : ""}">
|
|
22
|
+
${this.subtitle}
|
|
23
|
+
</p>` : ""}
|
|
24
|
+
${this.notice ? n`<div part="notice" class="notice ${i ? "notice--animated" : ""}">
|
|
25
|
+
${this.notice}
|
|
26
|
+
</div>` : ""}
|
|
27
|
+
</header>
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
t.styles = [
|
|
32
|
+
h,
|
|
33
|
+
c`
|
|
34
|
+
:host {
|
|
35
|
+
display: block;
|
|
36
|
+
text-align: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.header {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: var(--space-sm);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Extend design-tokens .form-title */
|
|
47
|
+
.form-title {
|
|
48
|
+
margin: 0;
|
|
49
|
+
line-height: 1.2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.form-title--animated {
|
|
53
|
+
animation: slideDown var(--duration-fast) var(--easing-ease-in-out) backwards;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Extend design-tokens .form-subtitle */
|
|
57
|
+
.form-subtitle {
|
|
58
|
+
margin: 0;
|
|
59
|
+
max-width: 28ch;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.form-subtitle--animated {
|
|
63
|
+
animation: slideUp var(--duration-smooth) var(--easing-ease-in-out) 100ms backwards;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.notice {
|
|
67
|
+
margin-top: var(--space-sm);
|
|
68
|
+
padding: var(--space-sm) var(--space-md);
|
|
69
|
+
background: var(--paper-warm);
|
|
70
|
+
border-radius: var(--radius-md);
|
|
71
|
+
font-size: var(--font-size-sm);
|
|
72
|
+
color: var(--ink-medium);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.notice--animated {
|
|
76
|
+
animation: noticeReveal 500ms var(--easing-ease-in-out) 200ms backwards;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@keyframes noticeReveal {
|
|
80
|
+
from {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
transform: scale(0.95);
|
|
83
|
+
}
|
|
84
|
+
to {
|
|
85
|
+
opacity: 1;
|
|
86
|
+
transform: scale(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Reduced motion */
|
|
91
|
+
@media (prefers-reduced-motion: reduce) {
|
|
92
|
+
.form-title--animated,
|
|
93
|
+
.form-subtitle--animated,
|
|
94
|
+
.notice--animated {
|
|
95
|
+
animation: none;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`
|
|
99
|
+
];
|
|
100
|
+
a([
|
|
101
|
+
r({ type: String })
|
|
102
|
+
], t.prototype, "title", 2);
|
|
103
|
+
a([
|
|
104
|
+
r({ type: String })
|
|
105
|
+
], t.prototype, "subtitle", 2);
|
|
106
|
+
a([
|
|
107
|
+
r({ type: String })
|
|
108
|
+
], t.prototype, "notice", 2);
|
|
109
|
+
a([
|
|
110
|
+
r({ type: Boolean, attribute: "no-animation" })
|
|
111
|
+
], t.prototype, "noAnimation", 2);
|
|
112
|
+
a([
|
|
113
|
+
r({ type: Object })
|
|
114
|
+
], t.prototype, "sx", 2);
|
|
115
|
+
t = a([
|
|
116
|
+
f("tc-form-header")
|
|
117
|
+
], t);
|
|
118
|
+
export {
|
|
119
|
+
t as TcFormHeader
|
|
120
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { LitElement as a, html as o, css as p } from "lit";
|
|
2
|
+
import { property as h, customElement as g } from "lit/decorators.js";
|
|
3
|
+
var d = Object.defineProperty, x = Object.getOwnPropertyDescriptor, n = (r, t, s, i) => {
|
|
4
|
+
for (var e = i > 1 ? void 0 : i ? x(t, s) : t, v = r.length - 1, c; v >= 0; v--)
|
|
5
|
+
(c = r[v]) && (e = (i ? c(t, s, e) : c(e)) || e);
|
|
6
|
+
return i && e && d(t, s, e), e;
|
|
7
|
+
};
|
|
8
|
+
const z = {
|
|
9
|
+
"arrow-left": o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>`,
|
|
10
|
+
"arrow-right": o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/></svg>`,
|
|
11
|
+
check: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>`,
|
|
12
|
+
x: o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`,
|
|
13
|
+
close: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>`,
|
|
14
|
+
"chevron-right": o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>`,
|
|
15
|
+
"chevron-left": o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"></polyline></svg>`,
|
|
16
|
+
error: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>`,
|
|
17
|
+
"alert-circle": o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>`,
|
|
18
|
+
info: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>`,
|
|
19
|
+
warning: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></svg>`,
|
|
20
|
+
loading: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/></svg>`,
|
|
21
|
+
loader: o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="2" x2="12" y2="6"></line><line x1="12" y1="18" x2="12" y2="22"></line><line x1="4.93" y1="4.93" x2="7.76" y2="7.76"></line><line x1="16.24" y1="16.24" x2="19.07" y2="19.07"></line><line x1="2" y1="12" x2="6" y2="12"></line><line x1="18" y1="12" x2="22" y2="12"></line><line x1="4.93" y1="19.07" x2="7.76" y2="16.24"></line><line x1="16.24" y1="7.76" x2="19.07" y2="4.93"></line></svg>`,
|
|
22
|
+
biometric: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2-.13-.24-.04-.55.2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67-.09.18-.26.28-.44.28zM3.5 9.72c-.1 0-.2-.03-.29-.09-.23-.16-.28-.47-.12-.7.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25.16.22.11.54-.12.7-.23.16-.54.11-.7-.12-.9-1.26-2.04-2.25-3.39-2.94-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21zm6.25 12.07c-.13 0-.26-.05-.35-.15-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39-2.57 0-4.66 1.97-4.66 4.39 0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15zm7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12zM14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1-1.4-1.39-2.17-3.24-2.17-5.22 0-1.62 1.38-2.94 3.08-2.94 1.7 0 3.08 1.32 3.08 2.94 0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29-.49-1.31-.73-2.61-.73-3.96 0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38z"/></svg>`,
|
|
23
|
+
email: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>`,
|
|
24
|
+
passkey: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 2-2.93-2-2.07zm-14 2c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/></svg>`,
|
|
25
|
+
bell: o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg>`,
|
|
26
|
+
download: o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>`,
|
|
27
|
+
"wifi-off": o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M16.72 11.06A10.94 10.94 0 0 1 19 12.55"></path><path d="M5 12.55a10.94 10.94 0 0 1 5.17-2.39"></path><path d="M10.71 5.05A16 16 0 0 1 22.58 9"></path><path d="M1.42 9a15.91 15.91 0 0 1 4.7-2.88"></path><path d="M8.53 16.11a6 6 0 0 1 6.95 0"></path><line x1="12" y1="20" x2="12.01" y2="20"></line></svg>`,
|
|
28
|
+
// Brand icons
|
|
29
|
+
apple: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>`,
|
|
30
|
+
google: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/></svg>`,
|
|
31
|
+
windows: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 12V6.75l6-1.32v6.48L3 12zm17-9v8.75l-10 .15V5.21L20 3zM3 13l6 .09v6.81l-6-1.15V13zm17 .25V22l-10-1.91V13.1l10 .15z"/></svg>`,
|
|
32
|
+
samsung: o`<svg viewBox="0 0 24 24"><text x="12" y="17" font-size="18" font-weight="700" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif" text-anchor="middle" fill="currentColor">S</text></svg>`,
|
|
33
|
+
// General icons
|
|
34
|
+
phone: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"/></svg>`,
|
|
35
|
+
success: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>`,
|
|
36
|
+
lock: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>`,
|
|
37
|
+
person: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>`,
|
|
38
|
+
device: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M15 7v4h1v2h-3V5h2l-3-4-3 4h2v8H8v-2.07c.7-.37 1.2-1.08 1.2-1.93 0-1.21-.99-2.2-2.2-2.2-1.21 0-2.2.99-2.2 2.2 0 .85.5 1.56 1.2 1.93V13c0 1.11.89 2 2 2h3v3.05c-.71.37-1.2 1.1-1.2 1.95 0 1.22.99 2.2 2.2 2.2 1.21 0 2.2-.98 2.2-2.2 0-.85-.49-1.58-1.2-1.95V15h3c1.11 0 2-.89 2-2v-2h1V7h-4z"/></svg>`,
|
|
39
|
+
// Auth icons
|
|
40
|
+
totp: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/></svg>`,
|
|
41
|
+
"email-otp": o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/></svg>`,
|
|
42
|
+
qrcode: o`<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 11h8V3H3v8zm2-6h4v4H5V5zM3 21h8v-8H3v8zm2-6h4v4H5v-4zM13 3v8h8V3h-8zm6 6h-4V5h4v4zM13 13h2v2h-2zM15 15h2v2h-2zM13 17h2v2h-2zM15 19h2v2h-2zM17 17h2v2h-2zM17 13h2v2h-2zM19 15h2v2h-2zM19 19h2v2h-2z"/><path d="M6 6h2v2H6zM6 16h2v2H6zM16 6h2v2h-2z"/></svg>`,
|
|
43
|
+
key: o`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"/></svg>`
|
|
44
|
+
};
|
|
45
|
+
let l = class extends a {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments), this.name = "info", this.size = "1.5rem", this.color = "currentColor";
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const r = z[this.name];
|
|
51
|
+
return r ? o`
|
|
52
|
+
<span
|
|
53
|
+
part="icon"
|
|
54
|
+
class="icon"
|
|
55
|
+
style="--icon-size: ${this.size}; --icon-color: ${this.color};"
|
|
56
|
+
>
|
|
57
|
+
${r}
|
|
58
|
+
</span>
|
|
59
|
+
` : (console.warn(`Icon "${this.name}" not found`), o``);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
l.styles = p`
|
|
63
|
+
:host {
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.icon {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
svg {
|
|
76
|
+
width: var(--icon-size);
|
|
77
|
+
height: var(--icon-size);
|
|
78
|
+
color: var(--icon-color);
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
n([
|
|
82
|
+
h({ type: String })
|
|
83
|
+
], l.prototype, "name", 2);
|
|
84
|
+
n([
|
|
85
|
+
h({ type: String })
|
|
86
|
+
], l.prototype, "size", 2);
|
|
87
|
+
n([
|
|
88
|
+
h({ type: String })
|
|
89
|
+
], l.prototype, "color", 2);
|
|
90
|
+
l = n([
|
|
91
|
+
g("tc-icon")
|
|
92
|
+
], l);
|
|
93
|
+
export {
|
|
94
|
+
l as TcIcon
|
|
95
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { LitElement as h, html as n, css as b } from "lit";
|
|
2
|
+
import { property as a, state as u, customElement as v } from "lit/decorators.js";
|
|
3
|
+
import { classMap as d } from "lit/directives/class-map.js";
|
|
4
|
+
import { sharedStyles as f } from "../styles/shared.js";
|
|
5
|
+
var m = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (t, i, s, p) => {
|
|
6
|
+
for (var o = p > 1 ? void 0 : p ? y(i, s) : i, l = t.length - 1, c; l >= 0; l--)
|
|
7
|
+
(c = t[l]) && (o = (p ? c(i, s, o) : c(o)) || o);
|
|
8
|
+
return p && o && m(i, s, o), o;
|
|
9
|
+
};
|
|
10
|
+
let e = class extends h {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.label = "", this.placeholder = "", this.value = "", this.error = "", this.disabled = !1, this.readonly = !1, this.chipLabel = "", this.chipIcon = "", this.chipVariant = "default", this.inputId = `tc-input-chip-${Math.random().toString(36).slice(2)}`, this.isFocused = !1;
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const t = this.error.length > 0, i = {
|
|
16
|
+
"field-group": !0,
|
|
17
|
+
focused: this.isFocused,
|
|
18
|
+
"has-error": t
|
|
19
|
+
}, s = {
|
|
20
|
+
"input-container": !0,
|
|
21
|
+
"has-error": t
|
|
22
|
+
};
|
|
23
|
+
return n`
|
|
24
|
+
<div class=${d(i)}>
|
|
25
|
+
${this.label ? n`<label part="label" class="field-label" for=${this.inputId}>${this.label}</label>` : ""}
|
|
26
|
+
<div part="wrapper" class=${d(s)}>
|
|
27
|
+
<input
|
|
28
|
+
part="input"
|
|
29
|
+
id=${this.inputId}
|
|
30
|
+
class="input"
|
|
31
|
+
type="text"
|
|
32
|
+
placeholder=${this.placeholder}
|
|
33
|
+
.value=${this.value}
|
|
34
|
+
?disabled=${this.disabled}
|
|
35
|
+
?readonly=${this.readonly}
|
|
36
|
+
aria-invalid=${t ? "true" : "false"}
|
|
37
|
+
aria-describedby=${t ? `${this.inputId}-error` : ""}
|
|
38
|
+
@input=${this.handleInput}
|
|
39
|
+
@focus=${this.handleFocus}
|
|
40
|
+
@blur=${this.handleBlur}
|
|
41
|
+
@keydown=${this.handleKeydown}
|
|
42
|
+
/>
|
|
43
|
+
${this.chipLabel ? n`
|
|
44
|
+
<div class="chip-container">
|
|
45
|
+
<tc-chip part="chip" variant=${this.chipVariant} size="sm">
|
|
46
|
+
<span class="chip-content">
|
|
47
|
+
${this.chipIcon ? n`<tc-icon name=${this.chipIcon} size="0.875rem"></tc-icon>` : ""}
|
|
48
|
+
${this.chipLabel}
|
|
49
|
+
</span>
|
|
50
|
+
</tc-chip>
|
|
51
|
+
</div>
|
|
52
|
+
` : ""}
|
|
53
|
+
</div>
|
|
54
|
+
${t ? n`<p part="error" id="${this.inputId}-error" class="error-text" role="alert">
|
|
55
|
+
${this.error}
|
|
56
|
+
</p>` : ""}
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
handleInput(t) {
|
|
61
|
+
const i = t.target;
|
|
62
|
+
this.value = i.value, this.dispatchEvent(
|
|
63
|
+
new CustomEvent("tc-input", {
|
|
64
|
+
bubbles: !0,
|
|
65
|
+
composed: !0,
|
|
66
|
+
detail: { value: i.value }
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
handleFocus() {
|
|
71
|
+
this.isFocused = !0;
|
|
72
|
+
}
|
|
73
|
+
handleBlur(t) {
|
|
74
|
+
const i = t.target;
|
|
75
|
+
this.isFocused = !1, this.dispatchEvent(
|
|
76
|
+
new CustomEvent("tc-blur", {
|
|
77
|
+
bubbles: !0,
|
|
78
|
+
composed: !0,
|
|
79
|
+
detail: { value: i.value }
|
|
80
|
+
})
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
handleKeydown(t) {
|
|
84
|
+
this.dispatchEvent(
|
|
85
|
+
new CustomEvent("tc-keydown", {
|
|
86
|
+
bubbles: !0,
|
|
87
|
+
composed: !0,
|
|
88
|
+
detail: { key: t.key, value: this.value, originalEvent: t }
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
focus() {
|
|
93
|
+
this.shadowRoot?.querySelector("input")?.focus();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
e.styles = [
|
|
97
|
+
f,
|
|
98
|
+
b`
|
|
99
|
+
:host {
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.field-group {
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.field-group.focused .field-label {
|
|
108
|
+
color: var(--accent-primary);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.field-group.has-error .field-label {
|
|
112
|
+
color: var(--error-base);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.input-container {
|
|
116
|
+
position: relative;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
width: 100%;
|
|
120
|
+
background: var(--paper-white);
|
|
121
|
+
border: 1px solid var(--ink-faint);
|
|
122
|
+
border-radius: var(--form-input-radius);
|
|
123
|
+
transition: var(--transition-fast);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.input-container:focus-within {
|
|
127
|
+
border-color: var(--accent-primary);
|
|
128
|
+
box-shadow: 0 0 0 3px var(--alpha-primary10);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.input-container.has-error {
|
|
132
|
+
border-color: var(--error-base);
|
|
133
|
+
background: var(--error-bg);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.input-container.has-error:focus-within {
|
|
137
|
+
box-shadow: 0 0 0 3px var(--error-border);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.input {
|
|
141
|
+
flex: 1;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
padding: var(--form-input-padding-y) var(--form-input-padding-x);
|
|
144
|
+
font-family: var(--font-body);
|
|
145
|
+
font-size: var(--form-input-font-size);
|
|
146
|
+
color: var(--ink-black);
|
|
147
|
+
background: transparent;
|
|
148
|
+
border: none;
|
|
149
|
+
outline: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.input::placeholder {
|
|
153
|
+
color: var(--ink-light);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.input:disabled {
|
|
157
|
+
opacity: var(--opacity-disabled);
|
|
158
|
+
cursor: not-allowed;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.input:read-only {
|
|
162
|
+
cursor: default;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.chip-container {
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
padding-right: var(--space-sm);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.chip-content {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
gap: var(--space-xs);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.error-text {
|
|
178
|
+
font-size: var(--font-size-sm);
|
|
179
|
+
color: var(--error-base);
|
|
180
|
+
margin: var(--space-xs) 0 0;
|
|
181
|
+
animation: slideDown 300ms ease backwards;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@keyframes slideDown {
|
|
185
|
+
from {
|
|
186
|
+
opacity: 0;
|
|
187
|
+
transform: translateY(-0.25rem);
|
|
188
|
+
}
|
|
189
|
+
to {
|
|
190
|
+
opacity: 1;
|
|
191
|
+
transform: translateY(0);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@media (prefers-reduced-motion: reduce) {
|
|
196
|
+
.input-container,
|
|
197
|
+
.error-text {
|
|
198
|
+
transition-duration: 0.01ms !important;
|
|
199
|
+
animation-duration: 0.01ms !important;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
`
|
|
203
|
+
];
|
|
204
|
+
r([
|
|
205
|
+
a({ type: String })
|
|
206
|
+
], e.prototype, "label", 2);
|
|
207
|
+
r([
|
|
208
|
+
a({ type: String })
|
|
209
|
+
], e.prototype, "placeholder", 2);
|
|
210
|
+
r([
|
|
211
|
+
a({ type: String })
|
|
212
|
+
], e.prototype, "value", 2);
|
|
213
|
+
r([
|
|
214
|
+
a({ type: String })
|
|
215
|
+
], e.prototype, "error", 2);
|
|
216
|
+
r([
|
|
217
|
+
a({ type: Boolean })
|
|
218
|
+
], e.prototype, "disabled", 2);
|
|
219
|
+
r([
|
|
220
|
+
a({ type: Boolean })
|
|
221
|
+
], e.prototype, "readonly", 2);
|
|
222
|
+
r([
|
|
223
|
+
a({ type: String, attribute: "chip-label" })
|
|
224
|
+
], e.prototype, "chipLabel", 2);
|
|
225
|
+
r([
|
|
226
|
+
a({ type: String, attribute: "chip-icon" })
|
|
227
|
+
], e.prototype, "chipIcon", 2);
|
|
228
|
+
r([
|
|
229
|
+
a({ type: String, attribute: "chip-variant" })
|
|
230
|
+
], e.prototype, "chipVariant", 2);
|
|
231
|
+
r([
|
|
232
|
+
u()
|
|
233
|
+
], e.prototype, "inputId", 2);
|
|
234
|
+
r([
|
|
235
|
+
u()
|
|
236
|
+
], e.prototype, "isFocused", 2);
|
|
237
|
+
e = r([
|
|
238
|
+
v("tc-input-with-chip")
|
|
239
|
+
], e);
|
|
240
|
+
export {
|
|
241
|
+
e as TcInputWithChip
|
|
242
|
+
};
|