@transcodes/ui-components 0.4.1 → 0.4.3
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 +14 -0
- package/package.json +2 -2
- package/dist/controllers/animation.controller.d.ts +0 -48
- package/dist/controllers/animation.controller.d.ts.map +0 -1
- package/dist/controllers/animation.controller.js +0 -32
- package/dist/controllers/base.controller.d.ts +0 -14
- package/dist/controllers/base.controller.d.ts.map +0 -1
- package/dist/controllers/base.controller.js +0 -8
- package/dist/controllers/history.controller.d.ts +0 -34
- package/dist/controllers/history.controller.d.ts.map +0 -1
- package/dist/controllers/history.controller.js +0 -26
- package/dist/controllers/index.d.ts +0 -9
- package/dist/controllers/index.d.ts.map +0 -1
- package/dist/controllers/index.js +0 -16
- package/dist/controllers/loading.controller.d.ts +0 -36
- package/dist/controllers/loading.controller.d.ts.map +0 -1
- package/dist/controllers/loading.controller.js +0 -27
- package/dist/controllers/match-media.controller.d.ts +0 -32
- package/dist/controllers/match-media.controller.d.ts.map +0 -1
- package/dist/controllers/match-media.controller.js +0 -20
- package/dist/controllers/message-bus.controller.d.ts +0 -45
- package/dist/controllers/message-bus.controller.d.ts.map +0 -1
- package/dist/controllers/message-bus.controller.js +0 -45
- package/dist/controllers/storage.controller.d.ts +0 -40
- package/dist/controllers/storage.controller.d.ts.map +0 -1
- package/dist/controllers/storage.controller.js +0 -40
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -64
- package/dist/primitives/index.d.ts +0 -22
- package/dist/primitives/index.d.ts.map +0 -1
- package/dist/primitives/index.js +0 -44
- package/dist/primitives/tc-box.d.ts +0 -20
- package/dist/primitives/tc-box.d.ts.map +0 -1
- package/dist/primitives/tc-box.js +0 -38
- package/dist/primitives/tc-button.d.ts +0 -26
- package/dist/primitives/tc-button.d.ts.map +0 -1
- package/dist/primitives/tc-button.js +0 -168
- package/dist/primitives/tc-callout.d.ts +0 -24
- package/dist/primitives/tc-callout.d.ts.map +0 -1
- package/dist/primitives/tc-callout.js +0 -91
- package/dist/primitives/tc-card.d.ts +0 -21
- package/dist/primitives/tc-card.d.ts.map +0 -1
- package/dist/primitives/tc-card.js +0 -77
- package/dist/primitives/tc-chip.d.ts +0 -21
- package/dist/primitives/tc-chip.d.ts.map +0 -1
- package/dist/primitives/tc-chip.js +0 -90
- package/dist/primitives/tc-container.d.ts +0 -21
- package/dist/primitives/tc-container.d.ts.map +0 -1
- package/dist/primitives/tc-container.js +0 -64
- package/dist/primitives/tc-divider.d.ts +0 -22
- package/dist/primitives/tc-divider.d.ts.map +0 -1
- package/dist/primitives/tc-divider.js +0 -78
- package/dist/primitives/tc-error-message.d.ts +0 -25
- package/dist/primitives/tc-error-message.d.ts.map +0 -1
- package/dist/primitives/tc-error-message.js +0 -81
- package/dist/primitives/tc-form-header.d.ts +0 -26
- package/dist/primitives/tc-form-header.d.ts.map +0 -1
- package/dist/primitives/tc-form-header.js +0 -122
- package/dist/primitives/tc-icon.d.ts +0 -20
- package/dist/primitives/tc-icon.d.ts.map +0 -1
- package/dist/primitives/tc-icon.js +0 -95
- package/dist/primitives/tc-input-with-chip.d.ts +0 -40
- package/dist/primitives/tc-input-with-chip.d.ts.map +0 -1
- package/dist/primitives/tc-input-with-chip.js +0 -250
- package/dist/primitives/tc-input.d.ts +0 -46
- package/dist/primitives/tc-input.d.ts.map +0 -1
- package/dist/primitives/tc-input.js +0 -264
- package/dist/primitives/tc-item-button.d.ts +0 -29
- package/dist/primitives/tc-item-button.d.ts.map +0 -1
- package/dist/primitives/tc-item-button.js +0 -163
- package/dist/primitives/tc-item.d.ts +0 -24
- package/dist/primitives/tc-item.d.ts.map +0 -1
- package/dist/primitives/tc-item.js +0 -88
- package/dist/primitives/tc-otp-input.d.ts +0 -40
- package/dist/primitives/tc-otp-input.d.ts.map +0 -1
- package/dist/primitives/tc-otp-input.js +0 -236
- package/dist/primitives/tc-page-decoration.d.ts +0 -21
- package/dist/primitives/tc-page-decoration.d.ts.map +0 -1
- package/dist/primitives/tc-page-decoration.js +0 -130
- package/dist/primitives/tc-section.d.ts +0 -19
- package/dist/primitives/tc-section.d.ts.map +0 -1
- package/dist/primitives/tc-section.js +0 -47
- package/dist/primitives/tc-spinner.d.ts +0 -21
- package/dist/primitives/tc-spinner.d.ts.map +0 -1
- package/dist/primitives/tc-spinner.js +0 -90
- package/dist/primitives/tc-symbol.d.ts +0 -19
- package/dist/primitives/tc-symbol.d.ts.map +0 -1
- package/dist/primitives/tc-symbol.js +0 -54
- package/dist/primitives/tc-text.d.ts +0 -32
- package/dist/primitives/tc-text.d.ts.map +0 -1
- package/dist/primitives/tc-text.js +0 -145
- package/dist/primitives/tc-toast.d.ts +0 -36
- package/dist/primitives/tc-toast.d.ts.map +0 -1
- package/dist/primitives/tc-toast.js +0 -199
- package/dist/screens/index.d.ts +0 -4
- package/dist/screens/index.d.ts.map +0 -1
- package/dist/screens/index.js +0 -8
- package/dist/screens/tc-error-screen.d.ts +0 -34
- package/dist/screens/tc-error-screen.d.ts.map +0 -1
- package/dist/screens/tc-error-screen.js +0 -178
- package/dist/screens/tc-loading-screen.d.ts +0 -25
- package/dist/screens/tc-loading-screen.d.ts.map +0 -1
- package/dist/screens/tc-loading-screen.js +0 -86
- package/dist/screens/tc-success-screen.d.ts +0 -33
- package/dist/screens/tc-success-screen.d.ts.map +0 -1
- package/dist/screens/tc-success-screen.js +0 -202
- package/dist/styles/shared.d.ts +0 -20
- package/dist/styles/shared.d.ts.map +0 -1
- package/dist/styles/shared.js +0 -7
- package/dist/types.d.ts +0 -34
- package/dist/types.d.ts.map +0 -1
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { css as c, LitElement as f, html as p } from "lit";
|
|
2
|
-
import { property as d, customElement as u } from "lit/decorators.js";
|
|
3
|
-
import { styleMap as b } from "lit/directives/style-map.js";
|
|
4
|
-
var h = Object.defineProperty, m = Object.getOwnPropertyDescriptor, s = (r, o, n, i) => {
|
|
5
|
-
for (var t = i > 1 ? void 0 : i ? m(o, n) : o, a = r.length - 1, l; a >= 0; a--)
|
|
6
|
-
(l = r[a]) && (t = (i ? l(o, n, t) : l(t)) || t);
|
|
7
|
-
return i && t && h(o, n, t), t;
|
|
8
|
-
};
|
|
9
|
-
let e = class extends f {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments), this.disabled = !1, this.showArrow = !0, this.sx = {};
|
|
12
|
-
}
|
|
13
|
-
handleClick() {
|
|
14
|
-
this.disabled || this.dispatchEvent(
|
|
15
|
-
new CustomEvent("tc-click", {
|
|
16
|
-
bubbles: !0,
|
|
17
|
-
composed: !0
|
|
18
|
-
})
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
const r = {
|
|
23
|
-
"--item-padding": "var(--space-md)",
|
|
24
|
-
"--item-gap": "var(--space-md)",
|
|
25
|
-
...this.sx
|
|
26
|
-
};
|
|
27
|
-
return p`
|
|
28
|
-
<button
|
|
29
|
-
part="button"
|
|
30
|
-
class="button"
|
|
31
|
-
?disabled=${this.disabled}
|
|
32
|
-
style=${b(r)}
|
|
33
|
-
@click=${this.handleClick}
|
|
34
|
-
>
|
|
35
|
-
<div part="prefix" class="prefix">
|
|
36
|
-
<slot name="prefix"></slot>
|
|
37
|
-
</div>
|
|
38
|
-
<div part="content" class="content">
|
|
39
|
-
<slot></slot>
|
|
40
|
-
</div>
|
|
41
|
-
<div part="suffix" class="suffix">
|
|
42
|
-
<slot name="suffix"></slot>
|
|
43
|
-
</div>
|
|
44
|
-
${this.showArrow ? p`
|
|
45
|
-
<svg
|
|
46
|
-
part="arrow"
|
|
47
|
-
class="arrow"
|
|
48
|
-
viewBox="0 0 24 24"
|
|
49
|
-
fill="none"
|
|
50
|
-
stroke="currentColor"
|
|
51
|
-
stroke-width="2"
|
|
52
|
-
stroke-linecap="round"
|
|
53
|
-
stroke-linejoin="round"
|
|
54
|
-
>
|
|
55
|
-
<polyline points="9 18 15 12 9 6"></polyline>
|
|
56
|
-
</svg>
|
|
57
|
-
` : ""}
|
|
58
|
-
</button>
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
e.styles = c`
|
|
63
|
-
:host {
|
|
64
|
-
display: block;
|
|
65
|
-
width: 100%;
|
|
66
|
-
min-width: 0;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.button {
|
|
70
|
-
display: flex;
|
|
71
|
-
align-items: center;
|
|
72
|
-
width: 100%;
|
|
73
|
-
padding: var(--item-padding);
|
|
74
|
-
gap: var(--item-gap);
|
|
75
|
-
background: var(--paper-cream);
|
|
76
|
-
border: none;
|
|
77
|
-
border-radius: var(--radius-md);
|
|
78
|
-
box-sizing: border-box;
|
|
79
|
-
cursor: pointer;
|
|
80
|
-
font-family: inherit;
|
|
81
|
-
text-align: left;
|
|
82
|
-
transition: var(--transition-fast);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.button:hover:not(:disabled) {
|
|
86
|
-
background: var(--paper-warm);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.button:active:not(:disabled) {
|
|
90
|
-
transform: scale(0.995);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.button:focus-visible {
|
|
94
|
-
outline: 2px solid var(--accent-primary);
|
|
95
|
-
outline-offset: 2px;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.button:disabled {
|
|
99
|
-
opacity: 0.6;
|
|
100
|
-
cursor: not-allowed;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.prefix {
|
|
104
|
-
flex-shrink: 0;
|
|
105
|
-
display: flex;
|
|
106
|
-
align-items: center;
|
|
107
|
-
justify-content: center;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.content {
|
|
111
|
-
flex: 1;
|
|
112
|
-
min-width: 0;
|
|
113
|
-
font-family: var(--font-body);
|
|
114
|
-
font-size: var(--font-size-base);
|
|
115
|
-
color: var(--ink-dark);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.suffix {
|
|
119
|
-
flex-shrink: 0;
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: center;
|
|
122
|
-
justify-content: center;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.arrow {
|
|
126
|
-
flex-shrink: 0;
|
|
127
|
-
width: var(--size-icon-action);
|
|
128
|
-
height: var(--size-icon-action);
|
|
129
|
-
color: var(--ink-light);
|
|
130
|
-
transition: var(--transition-fast);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.button:hover:not(:disabled) .arrow {
|
|
134
|
-
color: var(--ink-medium);
|
|
135
|
-
transform: translateX(2px);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/* Hide empty slots */
|
|
139
|
-
.prefix:not(:has(*)),
|
|
140
|
-
.suffix:not(:has(*)) {
|
|
141
|
-
display: none;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/* Hide arrow when suffix has content */
|
|
145
|
-
.suffix:has(*) + .arrow {
|
|
146
|
-
display: none;
|
|
147
|
-
}
|
|
148
|
-
`;
|
|
149
|
-
s([
|
|
150
|
-
d({ type: Boolean })
|
|
151
|
-
], e.prototype, "disabled", 2);
|
|
152
|
-
s([
|
|
153
|
-
d({ type: Boolean, attribute: "show-arrow" })
|
|
154
|
-
], e.prototype, "showArrow", 2);
|
|
155
|
-
s([
|
|
156
|
-
d({ type: Object })
|
|
157
|
-
], e.prototype, "sx", 2);
|
|
158
|
-
e = s([
|
|
159
|
-
u("tc-item-button")
|
|
160
|
-
], e);
|
|
161
|
-
export {
|
|
162
|
-
e as TcItemButton
|
|
163
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { SxProps } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* A non-clickable item container for displaying content.
|
|
5
|
-
*
|
|
6
|
-
* @slot - Item content
|
|
7
|
-
* @slot prefix - Left side content (icon, symbol)
|
|
8
|
-
* @slot suffix - Right side content (badge, action)
|
|
9
|
-
* @csspart item - The item container
|
|
10
|
-
* @csspart prefix - The prefix container
|
|
11
|
-
* @csspart content - The main content container
|
|
12
|
-
* @csspart suffix - The suffix container
|
|
13
|
-
*/
|
|
14
|
-
export declare class TcItem extends LitElement {
|
|
15
|
-
sx: SxProps;
|
|
16
|
-
static styles: import('lit').CSSResult;
|
|
17
|
-
render(): import('lit').TemplateResult<1>;
|
|
18
|
-
}
|
|
19
|
-
declare global {
|
|
20
|
-
interface HTMLElementTagNameMap {
|
|
21
|
-
'tc-item': TcItem;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=tc-item.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tc-item.d.ts","sourceRoot":"","sources":["../../src/primitives/tc-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,qBACa,MAAO,SAAQ,UAAU;IACR,EAAE,EAAE,OAAO,CAAM;IAE7C,OAAgB,MAAM,0BA6CpB;IAEO,MAAM;CAqBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { css as l, LitElement as f, html as d } from "lit";
|
|
2
|
-
import { property as m, customElement as c } from "lit/decorators.js";
|
|
3
|
-
import { styleMap as v } from "lit/directives/style-map.js";
|
|
4
|
-
var x = Object.defineProperty, u = Object.getOwnPropertyDescriptor, p = (e, s, a, i) => {
|
|
5
|
-
for (var t = i > 1 ? void 0 : i ? u(s, a) : s, n = e.length - 1, o; n >= 0; n--)
|
|
6
|
-
(o = e[n]) && (t = (i ? o(s, a, t) : o(t)) || t);
|
|
7
|
-
return i && t && x(s, a, t), t;
|
|
8
|
-
};
|
|
9
|
-
let r = class extends f {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments), this.sx = {};
|
|
12
|
-
}
|
|
13
|
-
render() {
|
|
14
|
-
const e = {
|
|
15
|
-
"--item-padding": "var(--space-md)",
|
|
16
|
-
"--item-gap": "var(--space-md)",
|
|
17
|
-
...this.sx
|
|
18
|
-
};
|
|
19
|
-
return d`
|
|
20
|
-
<div part="item" class="item" style=${v(e)}>
|
|
21
|
-
<div part="prefix" class="prefix">
|
|
22
|
-
<slot name="prefix"></slot>
|
|
23
|
-
</div>
|
|
24
|
-
<div part="content" class="content">
|
|
25
|
-
<slot></slot>
|
|
26
|
-
</div>
|
|
27
|
-
<div part="suffix" class="suffix">
|
|
28
|
-
<slot name="suffix"></slot>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
`;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
r.styles = l`
|
|
35
|
-
:host {
|
|
36
|
-
display: block;
|
|
37
|
-
width: 100%;
|
|
38
|
-
min-width: 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.item {
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
width: 100%;
|
|
45
|
-
padding: var(--item-padding);
|
|
46
|
-
gap: var(--item-gap);
|
|
47
|
-
background: var(--paper-cream);
|
|
48
|
-
border-radius: var(--radius-md);
|
|
49
|
-
box-sizing: border-box;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.prefix {
|
|
53
|
-
flex-shrink: 0;
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
justify-content: center;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.content {
|
|
60
|
-
flex: 1;
|
|
61
|
-
min-width: 0;
|
|
62
|
-
font-family: var(--font-body);
|
|
63
|
-
font-size: var(--font-size-base);
|
|
64
|
-
color: var(--ink-dark);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.suffix {
|
|
68
|
-
flex-shrink: 0;
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
justify-content: center;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* Hide empty slots */
|
|
75
|
-
.prefix:not(:has(*)),
|
|
76
|
-
.suffix:not(:has(*)) {
|
|
77
|
-
display: none;
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
p([
|
|
81
|
-
m({ type: Object })
|
|
82
|
-
], r.prototype, "sx", 2);
|
|
83
|
-
r = p([
|
|
84
|
-
c("tc-item")
|
|
85
|
-
], r);
|
|
86
|
-
export {
|
|
87
|
-
r as TcItem
|
|
88
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { SxProps } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* OTP (One-Time Password) input component with individual cells and progress indicator.
|
|
5
|
-
* Uses shake animation from design-tokens.
|
|
6
|
-
*
|
|
7
|
-
* @fires tc-complete - Fired when all cells are filled
|
|
8
|
-
* @fires tc-change - Fired when the OTP value changes
|
|
9
|
-
* @csspart cells - The cells container
|
|
10
|
-
* @csspart cell - Individual cell input
|
|
11
|
-
* @csspart progress - The progress bar container
|
|
12
|
-
* @csspart progress-bar - The progress bar fill
|
|
13
|
-
*/
|
|
14
|
-
export declare class TcOtpInput extends LitElement {
|
|
15
|
-
length: number;
|
|
16
|
-
error: boolean;
|
|
17
|
-
disabled: boolean;
|
|
18
|
-
showProgress: boolean;
|
|
19
|
-
sx: SxProps;
|
|
20
|
-
private values;
|
|
21
|
-
static styles: import('lit').CSSResult[];
|
|
22
|
-
connectedCallback(): void;
|
|
23
|
-
render(): import('lit').TemplateResult<1>;
|
|
24
|
-
private handleInput;
|
|
25
|
-
private handleKeydown;
|
|
26
|
-
private handlePaste;
|
|
27
|
-
private focusCell;
|
|
28
|
-
/** Focus the first empty cell or the last cell */
|
|
29
|
-
focus(): void;
|
|
30
|
-
/** Clear all values */
|
|
31
|
-
clear(): void;
|
|
32
|
-
/** Get the current OTP value */
|
|
33
|
-
getValue(): string;
|
|
34
|
-
}
|
|
35
|
-
declare global {
|
|
36
|
-
interface HTMLElementTagNameMap {
|
|
37
|
-
'tc-otp-input': TcOtpInput;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=tc-otp-input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tc-otp-input.d.ts","sourceRoot":"","sources":["../../src/primitives/tc-otp-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,qBACa,UAAW,SAAQ,UAAU;IACZ,MAAM,SAAK;IACV,KAAK,UAAS;IACd,QAAQ,UAAS;IACW,YAAY,UAAQ;IACjD,EAAE,EAAE,OAAO,CAAM;IAEpC,OAAO,CAAC,MAAM,CAAgB;IAEvC,OAAgB,MAAM,4BA2FpB;IAEO,iBAAiB;IAKjB,MAAM;IAoDf,OAAO,CAAC,WAAW;IAgCnB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,WAAW;IAoCnB,OAAO,CAAC,SAAS;IASjB,kDAAkD;IAClD,KAAK;IAML,uBAAuB;IACvB,KAAK;IAKL,gCAAgC;IAChC,QAAQ,IAAI,MAAM;CAGnB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,UAAU,CAAC;KAC5B;CACF"}
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { css as u, LitElement as p, html as h } from "lit";
|
|
2
|
-
import { property as c, state as d, customElement as v } from "lit/decorators.js";
|
|
3
|
-
import { styleMap as m } from "lit/directives/style-map.js";
|
|
4
|
-
import { sharedStyles as g } from "../styles/shared.js";
|
|
5
|
-
var f = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (t, e, s, r) => {
|
|
6
|
-
for (var a = r > 1 ? void 0 : r ? b(e, s) : e, o = t.length - 1, l; o >= 0; o--)
|
|
7
|
-
(l = t[o]) && (a = (r ? l(e, s, a) : l(a)) || a);
|
|
8
|
-
return r && a && f(e, s, a), a;
|
|
9
|
-
};
|
|
10
|
-
let i = class extends p {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments), this.length = 6, this.error = !1, this.disabled = !1, this.showProgress = !0, this.sx = {}, this.values = [];
|
|
13
|
-
}
|
|
14
|
-
connectedCallback() {
|
|
15
|
-
super.connectedCallback(), this.values = new Array(this.length).fill("");
|
|
16
|
-
}
|
|
17
|
-
render() {
|
|
18
|
-
const e = this.values.filter((s) => s.length > 0).length / this.length * 100;
|
|
19
|
-
return h`
|
|
20
|
-
<div class="container" style=${m(this.sx)}>
|
|
21
|
-
<div part="cells" class="cells" role="group" aria-label="OTP input">
|
|
22
|
-
${this.values.map((s, r) => {
|
|
23
|
-
const o = [
|
|
24
|
-
"cell",
|
|
25
|
-
s.length > 0 ? "cell--filled" : "",
|
|
26
|
-
this.error ? "cell--error" : ""
|
|
27
|
-
].filter(Boolean).join(" ");
|
|
28
|
-
return h`
|
|
29
|
-
<input
|
|
30
|
-
part="cell"
|
|
31
|
-
class=${o}
|
|
32
|
-
type="text"
|
|
33
|
-
inputmode="numeric"
|
|
34
|
-
maxlength="1"
|
|
35
|
-
pattern="[0-9]"
|
|
36
|
-
.value=${s}
|
|
37
|
-
?disabled=${this.disabled}
|
|
38
|
-
aria-label="Digit ${r + 1}"
|
|
39
|
-
@input=${(l) => this.handleInput(l, r)}
|
|
40
|
-
@keydown=${(l) => this.handleKeydown(l, r)}
|
|
41
|
-
@paste=${(l) => this.handlePaste(l)}
|
|
42
|
-
/>
|
|
43
|
-
`;
|
|
44
|
-
})}
|
|
45
|
-
</div>
|
|
46
|
-
${this.showProgress ? h`
|
|
47
|
-
<div part="progress" class="progress">
|
|
48
|
-
<div
|
|
49
|
-
part="progress-bar"
|
|
50
|
-
class="progress-bar"
|
|
51
|
-
style="width: ${e}%"
|
|
52
|
-
></div>
|
|
53
|
-
</div>
|
|
54
|
-
` : ""}
|
|
55
|
-
</div>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
handleInput(t, e) {
|
|
59
|
-
const r = t.target.value.replace(/\D/g, "").slice(0, 1);
|
|
60
|
-
this.values = [...this.values], this.values[e] = r, this.dispatchEvent(
|
|
61
|
-
new CustomEvent("tc-change", {
|
|
62
|
-
bubbles: !0,
|
|
63
|
-
composed: !0,
|
|
64
|
-
detail: { value: this.values.join(""), values: [...this.values] }
|
|
65
|
-
})
|
|
66
|
-
), r && e < this.length - 1 && this.focusCell(e + 1), this.values.every((a) => a.length > 0) && this.dispatchEvent(
|
|
67
|
-
new CustomEvent("tc-complete", {
|
|
68
|
-
bubbles: !0,
|
|
69
|
-
composed: !0,
|
|
70
|
-
detail: { value: this.values.join("") }
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
handleKeydown(t, e) {
|
|
75
|
-
t.key === "Backspace" && !this.values[e] && e > 0 ? (t.preventDefault(), this.values = [...this.values], this.values[e - 1] = "", this.focusCell(e - 1)) : t.key === "ArrowLeft" && e > 0 ? (t.preventDefault(), this.focusCell(e - 1)) : t.key === "ArrowRight" && e < this.length - 1 && (t.preventDefault(), this.focusCell(e + 1));
|
|
76
|
-
}
|
|
77
|
-
handlePaste(t) {
|
|
78
|
-
t.preventDefault();
|
|
79
|
-
const s = (t.clipboardData?.getData("text") || "").replace(/\D/g, "").slice(0, this.length);
|
|
80
|
-
if (s) {
|
|
81
|
-
this.values = new Array(this.length).fill(""), s.split("").forEach((a, o) => {
|
|
82
|
-
this.values[o] = a;
|
|
83
|
-
}), this.values = [...this.values];
|
|
84
|
-
const r = Math.min(s.length, this.length - 1);
|
|
85
|
-
this.focusCell(r), this.dispatchEvent(
|
|
86
|
-
new CustomEvent("tc-change", {
|
|
87
|
-
bubbles: !0,
|
|
88
|
-
composed: !0,
|
|
89
|
-
detail: { value: this.values.join(""), values: [...this.values] }
|
|
90
|
-
})
|
|
91
|
-
), s.length >= this.length && this.dispatchEvent(
|
|
92
|
-
new CustomEvent("tc-complete", {
|
|
93
|
-
bubbles: !0,
|
|
94
|
-
composed: !0,
|
|
95
|
-
detail: { value: this.values.join("") }
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
focusCell(t) {
|
|
101
|
-
requestAnimationFrame(() => {
|
|
102
|
-
this.shadowRoot?.querySelectorAll(
|
|
103
|
-
".cell"
|
|
104
|
-
)?.[t]?.focus();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/** Focus the first empty cell or the last cell */
|
|
108
|
-
focus() {
|
|
109
|
-
const t = this.values.findIndex((s) => !s), e = t >= 0 ? t : this.length - 1;
|
|
110
|
-
this.focusCell(e);
|
|
111
|
-
}
|
|
112
|
-
/** Clear all values */
|
|
113
|
-
clear() {
|
|
114
|
-
this.values = new Array(this.length).fill(""), this.focusCell(0);
|
|
115
|
-
}
|
|
116
|
-
/** Get the current OTP value */
|
|
117
|
-
getValue() {
|
|
118
|
-
return this.values.join("");
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
i.styles = [
|
|
122
|
-
g,
|
|
123
|
-
u`
|
|
124
|
-
:host {
|
|
125
|
-
display: block;
|
|
126
|
-
width: 100%;
|
|
127
|
-
min-width: 0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.container {
|
|
131
|
-
display: flex;
|
|
132
|
-
flex-direction: column;
|
|
133
|
-
align-items: center;
|
|
134
|
-
gap: var(--space-md);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.cells {
|
|
138
|
-
display: flex;
|
|
139
|
-
gap: var(--space-sm);
|
|
140
|
-
justify-content: center;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.cell {
|
|
144
|
-
width: clamp(2.625rem, 2.35rem + 1.36vw, 3rem);
|
|
145
|
-
height: clamp(3.125rem, 2.78rem + 1.74vw, 3.5rem);
|
|
146
|
-
border: var(--size-border-width-thick) solid transparent;
|
|
147
|
-
border-radius: var(--radius-md);
|
|
148
|
-
background: var(--paper-cream);
|
|
149
|
-
font-family: var(--font-body);
|
|
150
|
-
font-size: clamp(1.25rem, 1.14rem + 0.54vw, 1.5rem);
|
|
151
|
-
font-weight: 600;
|
|
152
|
-
text-align: center;
|
|
153
|
-
color: var(--ink-black);
|
|
154
|
-
transition: all var(--duration-instant) ease;
|
|
155
|
-
caret-color: var(--accent-primary);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.cell:focus {
|
|
159
|
-
outline: none;
|
|
160
|
-
background: var(--paper-white);
|
|
161
|
-
border-color: var(--accent-primary);
|
|
162
|
-
box-shadow: var(--shadow-otp-cell-focus);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.cell--filled {
|
|
166
|
-
background: var(--paper-white);
|
|
167
|
-
border-color: var(--ink-faint);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.cell--error {
|
|
171
|
-
border-color: var(--error-base) !important;
|
|
172
|
-
animation: shake var(--duration-smooth) ease;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.cell:disabled {
|
|
176
|
-
opacity: var(--opacity-disabled);
|
|
177
|
-
cursor: not-allowed;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/* Progress bar */
|
|
181
|
-
.progress {
|
|
182
|
-
width: 100%;
|
|
183
|
-
max-width: var(--size-progress-bar-width);
|
|
184
|
-
height: var(--size-border-width-heavy);
|
|
185
|
-
background: var(--paper-warm);
|
|
186
|
-
border-radius: var(--radius-full);
|
|
187
|
-
overflow: hidden;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.progress-bar {
|
|
191
|
-
height: 100%;
|
|
192
|
-
background: linear-gradient(
|
|
193
|
-
90deg,
|
|
194
|
-
var(--accent-primary) 0%,
|
|
195
|
-
var(--accent-primary-hover) 100%
|
|
196
|
-
);
|
|
197
|
-
transition: width var(--duration-instant) ease;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/* Reduced motion */
|
|
201
|
-
@media (prefers-reduced-motion: reduce) {
|
|
202
|
-
.cell,
|
|
203
|
-
.progress-bar {
|
|
204
|
-
transition-duration: 0.01ms !important;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.cell--error {
|
|
208
|
-
animation: none;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
`
|
|
212
|
-
];
|
|
213
|
-
n([
|
|
214
|
-
c({ type: Number })
|
|
215
|
-
], i.prototype, "length", 2);
|
|
216
|
-
n([
|
|
217
|
-
c({ type: Boolean })
|
|
218
|
-
], i.prototype, "error", 2);
|
|
219
|
-
n([
|
|
220
|
-
c({ type: Boolean })
|
|
221
|
-
], i.prototype, "disabled", 2);
|
|
222
|
-
n([
|
|
223
|
-
c({ type: Boolean, attribute: "show-progress" })
|
|
224
|
-
], i.prototype, "showProgress", 2);
|
|
225
|
-
n([
|
|
226
|
-
c({ type: Object })
|
|
227
|
-
], i.prototype, "sx", 2);
|
|
228
|
-
n([
|
|
229
|
-
d()
|
|
230
|
-
], i.prototype, "values", 2);
|
|
231
|
-
i = n([
|
|
232
|
-
v("tc-otp-input")
|
|
233
|
-
], i);
|
|
234
|
-
export {
|
|
235
|
-
i as TcOtpInput
|
|
236
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { SxProps } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Decorative floating blob background for pages.
|
|
5
|
-
* Uses CSS custom properties for color variants and inkFloat/inkDrift animations from design-tokens.
|
|
6
|
-
*
|
|
7
|
-
* @csspart decoration - The decoration container
|
|
8
|
-
* @csspart blob - Individual blob element
|
|
9
|
-
*/
|
|
10
|
-
export declare class TcPageDecoration extends LitElement {
|
|
11
|
-
variant: 'primary' | 'success' | 'error';
|
|
12
|
-
sx: SxProps;
|
|
13
|
-
static styles: import('lit').CSSResult[];
|
|
14
|
-
render(): import('lit').TemplateResult<1>;
|
|
15
|
-
}
|
|
16
|
-
declare global {
|
|
17
|
-
interface HTMLElementTagNameMap {
|
|
18
|
-
'tc-page-decoration': TcPageDecoration;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=tc-page-decoration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tc-page-decoration.d.ts","sourceRoot":"","sources":["../../src/primitives/tc-page-decoration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAI5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,qBACa,gBAAiB,SAAQ,UAAU;IAClB,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CACxD;IACgB,EAAE,EAAE,OAAO,CAAM;IAE7C,OAAgB,MAAM,4BA8FpB;IAEO,MAAM;CAShB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
|