@transcodes/ui-components 0.3.5 → 0.4.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/CHANGELOG.md +54 -0
- package/README.md +8 -22
- package/dist/controllers/index.d.ts +0 -2
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +10 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -64
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +18 -16
- package/dist/primitives/tc-box.d.ts +2 -1
- package/dist/primitives/tc-box.d.ts.map +1 -1
- package/dist/primitives/tc-box.js +4 -4
- package/dist/primitives/tc-button.d.ts +2 -1
- package/dist/primitives/tc-button.d.ts.map +1 -1
- package/dist/primitives/tc-button.js +21 -20
- package/dist/primitives/tc-callout.d.ts +2 -0
- package/dist/primitives/tc-callout.d.ts.map +1 -1
- package/dist/primitives/tc-callout.js +22 -17
- package/dist/primitives/tc-card.d.ts +2 -1
- package/dist/primitives/tc-card.d.ts.map +1 -1
- package/dist/primitives/tc-card.js +11 -10
- package/dist/primitives/tc-chip.d.ts +2 -0
- package/dist/primitives/tc-chip.d.ts.map +1 -1
- package/dist/primitives/tc-chip.js +26 -16
- package/dist/primitives/tc-container.d.ts +2 -1
- package/dist/primitives/tc-container.d.ts.map +1 -1
- package/dist/primitives/tc-container.js +12 -10
- package/dist/primitives/tc-divider.d.ts +2 -2
- package/dist/primitives/tc-divider.d.ts.map +1 -1
- package/dist/primitives/tc-divider.js +25 -23
- package/dist/primitives/tc-error-message.d.ts +2 -0
- package/dist/primitives/tc-error-message.d.ts.map +1 -1
- package/dist/primitives/tc-error-message.js +23 -16
- package/dist/primitives/tc-form-header.d.ts +2 -1
- package/dist/primitives/tc-form-header.d.ts.map +1 -1
- package/dist/primitives/tc-form-header.js +9 -7
- package/dist/primitives/tc-icon.d.ts +2 -2
- package/dist/primitives/tc-icon.d.ts.map +1 -1
- package/dist/primitives/tc-icon.js +61 -61
- package/dist/primitives/tc-input-with-chip.d.ts +2 -0
- package/dist/primitives/tc-input-with-chip.d.ts.map +1 -1
- package/dist/primitives/tc-input-with-chip.js +26 -18
- package/dist/primitives/tc-input.d.ts +2 -1
- package/dist/primitives/tc-input.d.ts.map +1 -1
- package/dist/primitives/tc-input.js +11 -9
- package/dist/primitives/tc-item-button.d.ts +2 -3
- package/dist/primitives/tc-item-button.d.ts.map +1 -1
- package/dist/primitives/tc-item-button.js +31 -36
- package/dist/primitives/tc-item.d.ts +2 -3
- package/dist/primitives/tc-item.d.ts.map +1 -1
- package/dist/primitives/tc-item.js +21 -26
- package/dist/primitives/tc-otp-input.d.ts +2 -0
- package/dist/primitives/tc-otp-input.d.ts.map +1 -1
- package/dist/primitives/tc-otp-input.js +17 -11
- package/dist/{widgets → primitives}/tc-page-decoration.d.ts +2 -0
- package/dist/primitives/tc-page-decoration.d.ts.map +1 -0
- package/dist/{widgets → primitives}/tc-page-decoration.js +29 -25
- package/dist/primitives/tc-section.d.ts +2 -2
- package/dist/primitives/tc-section.d.ts.map +1 -1
- package/dist/primitives/tc-section.js +23 -24
- package/dist/primitives/tc-spinner.d.ts +2 -1
- package/dist/primitives/tc-spinner.d.ts.map +1 -1
- package/dist/primitives/tc-spinner.js +32 -29
- package/dist/primitives/tc-symbol.d.ts +2 -3
- package/dist/primitives/tc-symbol.d.ts.map +1 -1
- package/dist/primitives/tc-symbol.js +26 -28
- package/dist/primitives/tc-text.d.ts +2 -1
- package/dist/primitives/tc-text.d.ts.map +1 -1
- package/dist/primitives/tc-text.js +3 -3
- package/dist/primitives/tc-toast.d.ts +2 -0
- package/dist/primitives/tc-toast.d.ts.map +1 -1
- package/dist/primitives/tc-toast.js +35 -25
- package/dist/screens/tc-error-screen.d.ts +8 -1
- package/dist/screens/tc-error-screen.d.ts.map +1 -1
- package/dist/screens/tc-error-screen.js +91 -32
- package/dist/screens/tc-loading-screen.d.ts +3 -1
- package/dist/screens/tc-loading-screen.d.ts.map +1 -1
- package/dist/screens/tc-loading-screen.js +28 -19
- package/dist/screens/tc-success-screen.d.ts +2 -0
- package/dist/screens/tc-success-screen.d.ts.map +1 -1
- package/dist/screens/tc-success-screen.js +41 -31
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +13 -13
- package/dist/controllers/form-validation.controller.d.ts +0 -48
- package/dist/controllers/form-validation.controller.d.ts.map +0 -1
- package/dist/controllers/form-validation.controller.js +0 -49
- package/dist/widgets/index.d.ts +0 -9
- package/dist/widgets/index.d.ts.map +0 -1
- package/dist/widgets/index.js +0 -18
- package/dist/widgets/tc-authenticator-card.d.ts +0 -35
- package/dist/widgets/tc-authenticator-card.d.ts.map +0 -1
- package/dist/widgets/tc-authenticator-card.js +0 -213
- package/dist/widgets/tc-floating-button.d.ts +0 -25
- package/dist/widgets/tc-floating-button.d.ts.map +0 -1
- package/dist/widgets/tc-floating-button.js +0 -132
- package/dist/widgets/tc-iframe-modal.d.ts +0 -43
- package/dist/widgets/tc-iframe-modal.d.ts.map +0 -1
- package/dist/widgets/tc-iframe-modal.js +0 -263
- package/dist/widgets/tc-installation-banner.d.ts +0 -42
- package/dist/widgets/tc-installation-banner.d.ts.map +0 -1
- package/dist/widgets/tc-installation-banner.js +0 -234
- package/dist/widgets/tc-ios-installation-guide.d.ts +0 -34
- package/dist/widgets/tc-ios-installation-guide.d.ts.map +0 -1
- package/dist/widgets/tc-ios-installation-guide.js +0 -240
- package/dist/widgets/tc-notification-modal.d.ts +0 -42
- package/dist/widgets/tc-notification-modal.d.ts.map +0 -1
- package/dist/widgets/tc-notification-modal.js +0 -230
- package/dist/widgets/tc-offline-modal.d.ts +0 -39
- package/dist/widgets/tc-offline-modal.d.ts.map +0 -1
- package/dist/widgets/tc-offline-modal.js +0 -202
- package/dist/widgets/tc-page-decoration.d.ts.map +0 -1
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { LitElement as p, html as l, css as h } from "lit";
|
|
2
|
-
import { property as c, customElement as v } from "lit/decorators.js";
|
|
3
|
-
import { AnimationController as m } from "../controllers/animation.controller.js";
|
|
4
|
-
import { sharedStyles as u } from "../styles/shared.js";
|
|
5
|
-
var y = Object.defineProperty, g = Object.getOwnPropertyDescriptor, d = (t, e, a, s) => {
|
|
6
|
-
for (var i = s > 1 ? void 0 : s ? g(e, a) : e, o = t.length - 1, n; o >= 0; o--)
|
|
7
|
-
(n = t[o]) && (i = (s ? n(e, a, i) : n(i)) || i);
|
|
8
|
-
return s && i && y(e, a, i), i;
|
|
9
|
-
};
|
|
10
|
-
let r = class extends p {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments), this.title = "Install on iOS", this.steps = [
|
|
13
|
-
"Tap the Share button in Safari",
|
|
14
|
-
'Scroll down and tap "Add to Home Screen"',
|
|
15
|
-
'Tap "Add" in the top right corner'
|
|
16
|
-
], this.animation = new m(this, {
|
|
17
|
-
showDuration: 300,
|
|
18
|
-
hideDuration: 200
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
connectedCallback() {
|
|
22
|
-
super.connectedCallback(), this.updateDataState();
|
|
23
|
-
}
|
|
24
|
-
updateDataState() {
|
|
25
|
-
this.dataset.state = this.animation.state;
|
|
26
|
-
}
|
|
27
|
-
async show() {
|
|
28
|
-
await this.animation.show(), this.updateDataState();
|
|
29
|
-
}
|
|
30
|
-
async close() {
|
|
31
|
-
await this.animation.hide(), this.updateDataState(), this.dispatchEvent(
|
|
32
|
-
new CustomEvent("tc-close", {
|
|
33
|
-
bubbles: !0,
|
|
34
|
-
composed: !0
|
|
35
|
-
})
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
handleOverlayClick(t) {
|
|
39
|
-
t.target === t.currentTarget && this.close();
|
|
40
|
-
}
|
|
41
|
-
renderStep(t, e) {
|
|
42
|
-
const a = t.split("[share]"), s = a.length > 1 ? l`${a[0]}<svg class="share-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
43
|
-
<path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"></path>
|
|
44
|
-
<polyline points="16 6 12 2 8 6"></polyline>
|
|
45
|
-
<line x1="12" y1="2" x2="12" y2="15"></line>
|
|
46
|
-
</svg>${a[1]}` : t;
|
|
47
|
-
return l`
|
|
48
|
-
<div part="step" class="step">
|
|
49
|
-
<span part="step-number" class="step-number">${e + 1}</span>
|
|
50
|
-
<tc-text part="step-text" class="step-text" size="base">${s}</tc-text>
|
|
51
|
-
</div>
|
|
52
|
-
`;
|
|
53
|
-
}
|
|
54
|
-
render() {
|
|
55
|
-
return l`
|
|
56
|
-
<div part="overlay" class="overlay" @click=${this.handleOverlayClick}>
|
|
57
|
-
<div part="modal" class="modal" role="dialog" aria-modal="true" aria-labelledby="guide-title">
|
|
58
|
-
<div part="header" class="header">
|
|
59
|
-
<h2 id="guide-title" class="title">${this.title}</h2>
|
|
60
|
-
<button part="close" class="close" @click=${this.close} aria-label="Close">
|
|
61
|
-
<svg
|
|
62
|
-
viewBox="0 0 24 24"
|
|
63
|
-
fill="none"
|
|
64
|
-
stroke="currentColor"
|
|
65
|
-
stroke-width="2"
|
|
66
|
-
stroke-linecap="round"
|
|
67
|
-
stroke-linejoin="round"
|
|
68
|
-
>
|
|
69
|
-
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
70
|
-
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
71
|
-
</svg>
|
|
72
|
-
</button>
|
|
73
|
-
</div>
|
|
74
|
-
<div part="content" class="content">
|
|
75
|
-
<div part="steps" class="steps">
|
|
76
|
-
${this.steps.map((t, e) => this.renderStep(t, e))}
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
<div part="action" class="action">
|
|
80
|
-
<tc-button variant="primary" @tc-click=${this.close}>Got it</tc-button>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
`;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
r.styles = [
|
|
88
|
-
u,
|
|
89
|
-
h`
|
|
90
|
-
:host {
|
|
91
|
-
display: contents;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.overlay {
|
|
95
|
-
position: fixed;
|
|
96
|
-
inset: 0;
|
|
97
|
-
z-index: 1000;
|
|
98
|
-
display: flex;
|
|
99
|
-
align-items: flex-end;
|
|
100
|
-
justify-content: center;
|
|
101
|
-
background: var(--overlay-dim);
|
|
102
|
-
opacity: 0;
|
|
103
|
-
visibility: hidden;
|
|
104
|
-
transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
:host([data-state='showing']) .overlay,
|
|
108
|
-
:host([data-state='visible']) .overlay {
|
|
109
|
-
opacity: 1;
|
|
110
|
-
visibility: visible;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
:host([data-state='hiding']) .overlay {
|
|
114
|
-
opacity: 0;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
:host([data-state='hidden']) .overlay {
|
|
118
|
-
visibility: hidden;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.modal {
|
|
122
|
-
width: 100%;
|
|
123
|
-
max-width: 400px;
|
|
124
|
-
margin: var(--space-md);
|
|
125
|
-
padding: var(--space-lg);
|
|
126
|
-
background: var(--paper-white);
|
|
127
|
-
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
|
128
|
-
transform: translateY(100%);
|
|
129
|
-
transition: transform var(--transition-smooth);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
:host([data-state='showing']) .modal,
|
|
133
|
-
:host([data-state='visible']) .modal {
|
|
134
|
-
transform: translateY(0);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
:host([data-state='hiding']) .modal {
|
|
138
|
-
transform: translateY(100%);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.header {
|
|
142
|
-
display: flex;
|
|
143
|
-
align-items: center;
|
|
144
|
-
justify-content: space-between;
|
|
145
|
-
margin-bottom: var(--space-lg);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.title {
|
|
149
|
-
font-family: var(--font-body);
|
|
150
|
-
font-size: var(--font-size-lg);
|
|
151
|
-
font-weight: 600;
|
|
152
|
-
color: var(--ink-dark);
|
|
153
|
-
margin: 0;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.close {
|
|
157
|
-
display: flex;
|
|
158
|
-
align-items: center;
|
|
159
|
-
justify-content: center;
|
|
160
|
-
width: var(--size-close-button);
|
|
161
|
-
height: var(--size-close-button);
|
|
162
|
-
padding: 0;
|
|
163
|
-
border: none;
|
|
164
|
-
background: transparent;
|
|
165
|
-
color: var(--ink-medium);
|
|
166
|
-
cursor: pointer;
|
|
167
|
-
border-radius: var(--radius-sm);
|
|
168
|
-
transition: var(--transition-fast);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.close:hover {
|
|
172
|
-
background: var(--paper-warm);
|
|
173
|
-
color: var(--ink-dark);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.close svg {
|
|
177
|
-
width: 1.25rem;
|
|
178
|
-
height: 1.25rem;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.steps {
|
|
182
|
-
display: flex;
|
|
183
|
-
flex-direction: column;
|
|
184
|
-
gap: var(--space-md);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.step {
|
|
188
|
-
display: flex;
|
|
189
|
-
align-items: flex-start;
|
|
190
|
-
gap: var(--space-md);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.step-number {
|
|
194
|
-
flex-shrink: 0;
|
|
195
|
-
display: flex;
|
|
196
|
-
align-items: center;
|
|
197
|
-
justify-content: center;
|
|
198
|
-
width: 1.75rem;
|
|
199
|
-
height: 1.75rem;
|
|
200
|
-
background: var(--accent-primary);
|
|
201
|
-
color: white;
|
|
202
|
-
font-family: var(--font-body);
|
|
203
|
-
font-size: var(--font-size-sm);
|
|
204
|
-
font-weight: 600;
|
|
205
|
-
border-radius: var(--radius-full);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.step-text {
|
|
209
|
-
flex: 1;
|
|
210
|
-
padding-top: 2px;
|
|
211
|
-
color: var(--ink-dark);
|
|
212
|
-
line-height: 1.5;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
.share-icon {
|
|
216
|
-
display: inline-flex;
|
|
217
|
-
vertical-align: middle;
|
|
218
|
-
width: 1.25rem;
|
|
219
|
-
height: 1.25rem;
|
|
220
|
-
margin: 0 2px;
|
|
221
|
-
color: var(--accent-primary);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.action {
|
|
225
|
-
margin-top: var(--space-xl);
|
|
226
|
-
}
|
|
227
|
-
`
|
|
228
|
-
];
|
|
229
|
-
d([
|
|
230
|
-
c({ type: String })
|
|
231
|
-
], r.prototype, "title", 2);
|
|
232
|
-
d([
|
|
233
|
-
c({ type: Array })
|
|
234
|
-
], r.prototype, "steps", 2);
|
|
235
|
-
r = d([
|
|
236
|
-
v("tc-ios-installation-guide")
|
|
237
|
-
], r);
|
|
238
|
-
export {
|
|
239
|
-
r as TcIosInstallationGuide
|
|
240
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
/**
|
|
3
|
-
* A modal for requesting notification permission with storage-based dismissal tracking.
|
|
4
|
-
*
|
|
5
|
-
* @fires tc-allow - Fired when the user clicks allow
|
|
6
|
-
* @fires tc-deny - Fired when the user clicks deny
|
|
7
|
-
* @fires tc-close - Fired when the modal is closed
|
|
8
|
-
* @csspart overlay - The backdrop overlay
|
|
9
|
-
* @csspart modal - The modal container
|
|
10
|
-
* @csspart icon - The notification icon
|
|
11
|
-
* @csspart title - The modal title
|
|
12
|
-
* @csspart description - The modal description
|
|
13
|
-
* @csspart actions - The action buttons container
|
|
14
|
-
*/
|
|
15
|
-
export declare class TcNotificationModal extends LitElement {
|
|
16
|
-
title: string;
|
|
17
|
-
description: string;
|
|
18
|
-
allowLabel: string;
|
|
19
|
-
denyLabel: string;
|
|
20
|
-
storageKey: string;
|
|
21
|
-
private animation;
|
|
22
|
-
private storage;
|
|
23
|
-
static styles: import('lit').CSSResult[];
|
|
24
|
-
connectedCallback(): void;
|
|
25
|
-
private updateDataState;
|
|
26
|
-
/**
|
|
27
|
-
* Check if the modal should be shown based on stored state.
|
|
28
|
-
*/
|
|
29
|
-
shouldShow(): boolean;
|
|
30
|
-
show(): Promise<void>;
|
|
31
|
-
close(): Promise<void>;
|
|
32
|
-
private handleOverlayClick;
|
|
33
|
-
private handleAllow;
|
|
34
|
-
private handleDeny;
|
|
35
|
-
render(): import('lit').TemplateResult<1>;
|
|
36
|
-
}
|
|
37
|
-
declare global {
|
|
38
|
-
interface HTMLElementTagNameMap {
|
|
39
|
-
'tc-notification-modal': TcNotificationModal;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=tc-notification-modal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tc-notification-modal.d.ts","sourceRoot":"","sources":["../../src/widgets/tc-notification-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAK5C,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,6BAA6B,CAAC;AAErC;;;;;;;;;;;;GAYG;AACH,qBACa,mBAAoB,SAAQ,UAAU;IACrB,KAAK,SAA0B;IAC/B,WAAW,SACc;IACC,UAAU,SAAW;IACtB,SAAS,SAAa;IACrB,UAAU,SAChC;IAEhC,OAAO,CAAC,SAAS,CAGd;IAEH,OAAO,CAAC,OAAO,CAGW;IAE1B,OAAgB,MAAM,4BAqGpB;IAEO,iBAAiB;IAK1B,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,UAAU,IAAI,OAAO;IAOf,IAAI;IAMJ,KAAK;IAYX,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,UAAU;IAYT,MAAM;CA8ChB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,uBAAuB,EAAE,mBAAmB,CAAC;KAC9C;CACF"}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { LitElement as d, html as p, css as h } from "lit";
|
|
2
|
-
import { property as o, customElement as m } from "lit/decorators.js";
|
|
3
|
-
import { AnimationController as y } from "../controllers/animation.controller.js";
|
|
4
|
-
import { StorageController as u } from "../controllers/storage.controller.js";
|
|
5
|
-
import { sharedStyles as v } from "../styles/shared.js";
|
|
6
|
-
var b = Object.defineProperty, g = Object.getOwnPropertyDescriptor, i = (t, s, n, r) => {
|
|
7
|
-
for (var a = r > 1 ? void 0 : r ? g(s, n) : s, l = t.length - 1, c; l >= 0; l--)
|
|
8
|
-
(c = t[l]) && (a = (r ? c(s, n, a) : c(a)) || a);
|
|
9
|
-
return r && a && b(s, n, a), a;
|
|
10
|
-
};
|
|
11
|
-
let e = class extends d {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments), this.title = "Enable Notifications", this.description = "Stay updated with important alerts and messages.", this.allowLabel = "Allow", this.denyLabel = "Not Now", this.storageKey = "tc-notification-modal-state", this.animation = new y(this, {
|
|
14
|
-
showDuration: 300,
|
|
15
|
-
hideDuration: 200
|
|
16
|
-
}), this.storage = new u(this, this.storageKey);
|
|
17
|
-
}
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
super.connectedCallback(), this.updateDataState();
|
|
20
|
-
}
|
|
21
|
-
updateDataState() {
|
|
22
|
-
this.dataset.state = this.animation.state;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Check if the modal should be shown based on stored state.
|
|
26
|
-
*/
|
|
27
|
-
shouldShow() {
|
|
28
|
-
const t = this.storage.value;
|
|
29
|
-
return !(t?.dismissed || t?.permission === "granted");
|
|
30
|
-
}
|
|
31
|
-
async show() {
|
|
32
|
-
this.shouldShow() && (await this.animation.show(), this.updateDataState());
|
|
33
|
-
}
|
|
34
|
-
async close() {
|
|
35
|
-
await this.animation.hide(), this.updateDataState(), this.dispatchEvent(
|
|
36
|
-
new CustomEvent("tc-close", {
|
|
37
|
-
bubbles: !0,
|
|
38
|
-
composed: !0
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
handleOverlayClick(t) {
|
|
43
|
-
t.target === t.currentTarget && this.handleDeny();
|
|
44
|
-
}
|
|
45
|
-
handleAllow() {
|
|
46
|
-
this.storage.set({ dismissed: !0, permission: "granted" }), this.close(), this.dispatchEvent(
|
|
47
|
-
new CustomEvent("tc-allow", {
|
|
48
|
-
bubbles: !0,
|
|
49
|
-
composed: !0
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
handleDeny() {
|
|
54
|
-
this.storage.set({ dismissed: !0, permission: "denied" }), this.close(), this.dispatchEvent(
|
|
55
|
-
new CustomEvent("tc-deny", {
|
|
56
|
-
bubbles: !0,
|
|
57
|
-
composed: !0
|
|
58
|
-
})
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
return p`
|
|
63
|
-
<div part="overlay" class="overlay" @click=${this.handleOverlayClick}>
|
|
64
|
-
<div
|
|
65
|
-
part="modal"
|
|
66
|
-
class="modal"
|
|
67
|
-
role="dialog"
|
|
68
|
-
aria-modal="true"
|
|
69
|
-
aria-labelledby="notification-title"
|
|
70
|
-
aria-describedby="notification-description"
|
|
71
|
-
>
|
|
72
|
-
<div part="icon" class="icon-container">
|
|
73
|
-
<tc-icon name="bell" size="2rem"></tc-icon>
|
|
74
|
-
</div>
|
|
75
|
-
<tc-section part="content" class="content" gap="var(--space-sm)">
|
|
76
|
-
<tc-text
|
|
77
|
-
id="notification-title"
|
|
78
|
-
part="title"
|
|
79
|
-
class="title"
|
|
80
|
-
tag="h2"
|
|
81
|
-
size="lg"
|
|
82
|
-
weight="600"
|
|
83
|
-
>
|
|
84
|
-
${this.title}
|
|
85
|
-
</tc-text>
|
|
86
|
-
<tc-text
|
|
87
|
-
id="notification-description"
|
|
88
|
-
part="description"
|
|
89
|
-
size="base"
|
|
90
|
-
color="tertiary"
|
|
91
|
-
>
|
|
92
|
-
${this.description}
|
|
93
|
-
</tc-text>
|
|
94
|
-
</tc-section>
|
|
95
|
-
<div part="actions" class="actions">
|
|
96
|
-
<tc-button variant="primary" @tc-click=${this.handleAllow}>
|
|
97
|
-
${this.allowLabel}
|
|
98
|
-
</tc-button>
|
|
99
|
-
<button class="deny-button" @click=${this.handleDeny}>
|
|
100
|
-
${this.denyLabel}
|
|
101
|
-
</button>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</div>
|
|
105
|
-
`;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
e.styles = [
|
|
109
|
-
v,
|
|
110
|
-
h`
|
|
111
|
-
:host {
|
|
112
|
-
display: contents;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.overlay {
|
|
116
|
-
position: fixed;
|
|
117
|
-
inset: 0;
|
|
118
|
-
z-index: 1000;
|
|
119
|
-
display: flex;
|
|
120
|
-
align-items: center;
|
|
121
|
-
justify-content: center;
|
|
122
|
-
padding: var(--space-lg);
|
|
123
|
-
background: var(--overlay-dim);
|
|
124
|
-
opacity: 0;
|
|
125
|
-
visibility: hidden;
|
|
126
|
-
transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
:host([data-state='showing']) .overlay,
|
|
130
|
-
:host([data-state='visible']) .overlay {
|
|
131
|
-
opacity: 1;
|
|
132
|
-
visibility: visible;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
:host([data-state='hiding']) .overlay {
|
|
136
|
-
opacity: 0;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
:host([data-state='hidden']) .overlay {
|
|
140
|
-
visibility: hidden;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.modal {
|
|
144
|
-
display: flex;
|
|
145
|
-
flex-direction: column;
|
|
146
|
-
align-items: center;
|
|
147
|
-
width: 100%;
|
|
148
|
-
max-width: 320px;
|
|
149
|
-
padding: var(--space-xl);
|
|
150
|
-
background: var(--paper-white);
|
|
151
|
-
border-radius: var(--radius-lg);
|
|
152
|
-
box-shadow: 0 20px 60px var(--overlay-shadow-strong);
|
|
153
|
-
text-align: center;
|
|
154
|
-
transform: scale(0.95);
|
|
155
|
-
transition: transform var(--transition-smooth);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
:host([data-state='showing']) .modal,
|
|
159
|
-
:host([data-state='visible']) .modal {
|
|
160
|
-
transform: scale(1);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
:host([data-state='hiding']) .modal {
|
|
164
|
-
transform: scale(0.95);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.icon-container {
|
|
168
|
-
display: flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
justify-content: center;
|
|
171
|
-
width: 4rem;
|
|
172
|
-
height: 4rem;
|
|
173
|
-
margin-bottom: var(--space-lg);
|
|
174
|
-
background: var(--alpha-primary10);
|
|
175
|
-
border-radius: var(--radius-full);
|
|
176
|
-
color: var(--accent-primary);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.content {
|
|
180
|
-
margin-bottom: var(--space-xl);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.title {
|
|
184
|
-
margin-bottom: var(--space-sm);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.actions {
|
|
188
|
-
display: flex;
|
|
189
|
-
flex-direction: column;
|
|
190
|
-
gap: var(--space-sm);
|
|
191
|
-
width: 100%;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.deny-button {
|
|
195
|
-
background: transparent;
|
|
196
|
-
border: none;
|
|
197
|
-
padding: var(--space-sm);
|
|
198
|
-
font-family: var(--font-body);
|
|
199
|
-
font-size: var(--font-size-sm);
|
|
200
|
-
color: var(--ink-medium);
|
|
201
|
-
cursor: pointer;
|
|
202
|
-
transition: color var(--transition-fast);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.deny-button:hover {
|
|
206
|
-
color: var(--ink-dark);
|
|
207
|
-
}
|
|
208
|
-
`
|
|
209
|
-
];
|
|
210
|
-
i([
|
|
211
|
-
o({ type: String })
|
|
212
|
-
], e.prototype, "title", 2);
|
|
213
|
-
i([
|
|
214
|
-
o({ type: String })
|
|
215
|
-
], e.prototype, "description", 2);
|
|
216
|
-
i([
|
|
217
|
-
o({ type: String, attribute: "allow-label" })
|
|
218
|
-
], e.prototype, "allowLabel", 2);
|
|
219
|
-
i([
|
|
220
|
-
o({ type: String, attribute: "deny-label" })
|
|
221
|
-
], e.prototype, "denyLabel", 2);
|
|
222
|
-
i([
|
|
223
|
-
o({ type: String, attribute: "storage-key" })
|
|
224
|
-
], e.prototype, "storageKey", 2);
|
|
225
|
-
e = i([
|
|
226
|
-
m("tc-notification-modal")
|
|
227
|
-
], e);
|
|
228
|
-
export {
|
|
229
|
-
e as TcNotificationModal
|
|
230
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
/**
|
|
3
|
-
* A modal displayed when the device goes offline.
|
|
4
|
-
* Automatically shows/hides based on network status.
|
|
5
|
-
*
|
|
6
|
-
* @fires tc-retry - Fired when the retry button is clicked
|
|
7
|
-
* @fires tc-online - Fired when the device comes back online
|
|
8
|
-
* @fires tc-offline - Fired when the device goes offline
|
|
9
|
-
* @csspart overlay - The backdrop overlay
|
|
10
|
-
* @csspart modal - The modal container
|
|
11
|
-
* @csspart icon - The offline icon
|
|
12
|
-
* @csspart title - The modal title
|
|
13
|
-
* @csspart description - The modal description
|
|
14
|
-
* @csspart action - The action button container
|
|
15
|
-
*/
|
|
16
|
-
export declare class TcOfflineModal extends LitElement {
|
|
17
|
-
title: string;
|
|
18
|
-
description: string;
|
|
19
|
-
retryLabel: string;
|
|
20
|
-
autoDetect: boolean;
|
|
21
|
-
private isOffline;
|
|
22
|
-
private animation;
|
|
23
|
-
static styles: import('lit').CSSResult[];
|
|
24
|
-
connectedCallback(): void;
|
|
25
|
-
disconnectedCallback(): void;
|
|
26
|
-
private handleOnline;
|
|
27
|
-
private handleOffline;
|
|
28
|
-
private updateDataState;
|
|
29
|
-
show(): Promise<void>;
|
|
30
|
-
hide(): Promise<void>;
|
|
31
|
-
private handleRetry;
|
|
32
|
-
render(): import('lit').TemplateResult<1>;
|
|
33
|
-
}
|
|
34
|
-
declare global {
|
|
35
|
-
interface HTMLElementTagNameMap {
|
|
36
|
-
'tc-offline-modal': TcOfflineModal;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=tc-offline-modal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tc-offline-modal.d.ts","sourceRoot":"","sources":["../../src/widgets/tc-offline-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,0BAA0B,CAAC;AAClC,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,qBACa,cAAe,SAAQ,UAAU;IAChB,KAAK,SAAmB;IACxB,WAAW,SACkB;IACH,UAAU,SAClD;IACyC,UAAU,UAAQ;IAEhE,OAAO,CAAC,SAAS,CAAS;IAEnC,OAAO,CAAC,SAAS,CAGd;IAEH,OAAgB,MAAM,4BAmFpB;IAEO,iBAAiB;IAejB,oBAAoB;IAM7B,OAAO,CAAC,YAAY,CAUlB;IAEF,OAAO,CAAC,aAAa,CAUnB;IAEF,OAAO,CAAC,eAAe;IAIjB,IAAI;IAKJ,IAAI;IAKV,OAAO,CAAC,WAAW;IAcV,MAAM;CA2ChB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,cAAc,CAAC;KACpC;CACF"}
|