@transcodes/ui-components 0.4.3 → 0.4.5
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 +12 -0
- package/dist/controllers/animation.controller.d.ts +48 -0
- package/dist/controllers/animation.controller.d.ts.map +1 -0
- package/dist/controllers/animation.controller.js +32 -0
- package/dist/controllers/base.controller.d.ts +14 -0
- package/dist/controllers/base.controller.d.ts.map +1 -0
- package/dist/controllers/base.controller.js +8 -0
- package/dist/controllers/history.controller.d.ts +34 -0
- package/dist/controllers/history.controller.d.ts.map +1 -0
- package/dist/controllers/history.controller.js +26 -0
- package/dist/controllers/index.d.ts +9 -0
- package/dist/controllers/index.d.ts.map +1 -0
- package/dist/controllers/index.js +16 -0
- package/dist/controllers/loading.controller.d.ts +36 -0
- package/dist/controllers/loading.controller.d.ts.map +1 -0
- package/dist/controllers/loading.controller.js +27 -0
- package/dist/controllers/match-media.controller.d.ts +32 -0
- package/dist/controllers/match-media.controller.d.ts.map +1 -0
- package/dist/controllers/match-media.controller.js +20 -0
- package/dist/controllers/message-bus.controller.d.ts +45 -0
- package/dist/controllers/message-bus.controller.d.ts.map +1 -0
- package/dist/controllers/message-bus.controller.js +45 -0
- package/dist/controllers/storage.controller.d.ts +40 -0
- package/dist/controllers/storage.controller.d.ts.map +1 -0
- package/dist/controllers/storage.controller.js +40 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/primitives/index.d.ts +22 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +44 -0
- package/dist/primitives/tc-box.d.ts +20 -0
- package/dist/primitives/tc-box.d.ts.map +1 -0
- package/dist/primitives/tc-box.js +38 -0
- package/dist/primitives/tc-button.d.ts +26 -0
- package/dist/primitives/tc-button.d.ts.map +1 -0
- package/dist/primitives/tc-button.js +168 -0
- package/dist/primitives/tc-callout.d.ts +24 -0
- package/dist/primitives/tc-callout.d.ts.map +1 -0
- package/dist/primitives/tc-callout.js +91 -0
- package/dist/primitives/tc-card.d.ts +21 -0
- package/dist/primitives/tc-card.d.ts.map +1 -0
- package/dist/primitives/tc-card.js +77 -0
- package/dist/primitives/tc-chip.d.ts +21 -0
- package/dist/primitives/tc-chip.d.ts.map +1 -0
- package/dist/primitives/tc-chip.js +90 -0
- package/dist/primitives/tc-container.d.ts +21 -0
- package/dist/primitives/tc-container.d.ts.map +1 -0
- package/dist/primitives/tc-container.js +64 -0
- package/dist/primitives/tc-divider.d.ts +22 -0
- package/dist/primitives/tc-divider.d.ts.map +1 -0
- package/dist/primitives/tc-divider.js +78 -0
- package/dist/primitives/tc-error-message.d.ts +25 -0
- package/dist/primitives/tc-error-message.d.ts.map +1 -0
- package/dist/primitives/tc-error-message.js +81 -0
- package/dist/primitives/tc-form-header.d.ts +26 -0
- package/dist/primitives/tc-form-header.d.ts.map +1 -0
- package/dist/primitives/tc-form-header.js +122 -0
- package/dist/primitives/tc-icon.d.ts +20 -0
- package/dist/primitives/tc-icon.d.ts.map +1 -0
- package/dist/primitives/tc-icon.js +95 -0
- package/dist/primitives/tc-input-with-chip.d.ts +40 -0
- package/dist/primitives/tc-input-with-chip.d.ts.map +1 -0
- package/dist/primitives/tc-input-with-chip.js +250 -0
- package/dist/primitives/tc-input.d.ts +46 -0
- package/dist/primitives/tc-input.d.ts.map +1 -0
- package/dist/primitives/tc-input.js +264 -0
- package/dist/primitives/tc-item-button.d.ts +29 -0
- package/dist/primitives/tc-item-button.d.ts.map +1 -0
- package/dist/primitives/tc-item-button.js +163 -0
- package/dist/primitives/tc-item.d.ts +24 -0
- package/dist/primitives/tc-item.d.ts.map +1 -0
- package/dist/primitives/tc-item.js +88 -0
- package/dist/primitives/tc-otp-input.d.ts +40 -0
- package/dist/primitives/tc-otp-input.d.ts.map +1 -0
- package/dist/primitives/tc-otp-input.js +236 -0
- package/dist/primitives/tc-page-decoration.d.ts +21 -0
- package/dist/primitives/tc-page-decoration.d.ts.map +1 -0
- package/dist/primitives/tc-page-decoration.js +130 -0
- package/dist/primitives/tc-section.d.ts +19 -0
- package/dist/primitives/tc-section.d.ts.map +1 -0
- package/dist/primitives/tc-section.js +47 -0
- package/dist/primitives/tc-spinner.d.ts +21 -0
- package/dist/primitives/tc-spinner.d.ts.map +1 -0
- package/dist/primitives/tc-spinner.js +90 -0
- package/dist/primitives/tc-symbol.d.ts +19 -0
- package/dist/primitives/tc-symbol.d.ts.map +1 -0
- package/dist/primitives/tc-symbol.js +54 -0
- package/dist/primitives/tc-text.d.ts +32 -0
- package/dist/primitives/tc-text.d.ts.map +1 -0
- package/dist/primitives/tc-text.js +145 -0
- package/dist/primitives/tc-toast.d.ts +36 -0
- package/dist/primitives/tc-toast.d.ts.map +1 -0
- package/dist/primitives/tc-toast.js +199 -0
- package/dist/screens/index.d.ts +4 -0
- package/dist/screens/index.d.ts.map +1 -0
- package/dist/screens/index.js +8 -0
- package/dist/screens/tc-error-screen.d.ts +34 -0
- package/dist/screens/tc-error-screen.d.ts.map +1 -0
- package/dist/screens/tc-error-screen.js +177 -0
- package/dist/screens/tc-loading-screen.d.ts +25 -0
- package/dist/screens/tc-loading-screen.d.ts.map +1 -0
- package/dist/screens/tc-loading-screen.js +85 -0
- package/dist/screens/tc-success-screen.d.ts +33 -0
- package/dist/screens/tc-success-screen.d.ts.map +1 -0
- package/dist/screens/tc-success-screen.js +201 -0
- package/dist/styles/shared.d.ts +20 -0
- package/dist/styles/shared.d.ts.map +1 -0
- package/dist/styles/shared.js +7 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { css as u, LitElement as v, html as n } from "lit";
|
|
2
|
+
import { property as a, state as h, customElement as b } from "lit/decorators.js";
|
|
3
|
+
import { classMap as d } from "lit/directives/class-map.js";
|
|
4
|
+
import { styleMap as y } from "lit/directives/style-map.js";
|
|
5
|
+
import { sharedStyles as f } from "../styles/shared.js";
|
|
6
|
+
import "./tc-chip.js";
|
|
7
|
+
import "./tc-icon.js";
|
|
8
|
+
var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor, r = (t, i, s, p) => {
|
|
9
|
+
for (var o = p > 1 ? void 0 : p ? g(i, s) : i, l = t.length - 1, c; l >= 0; l--)
|
|
10
|
+
(c = t[l]) && (o = (p ? c(i, s, o) : c(o)) || o);
|
|
11
|
+
return p && o && m(i, s, o), o;
|
|
12
|
+
};
|
|
13
|
+
let e = class extends v {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.label = "", this.placeholder = "", this.value = "", this.error = "", this.disabled = !1, this.readonly = !1, this.chipLabel = "", this.chipIcon = "", this.chipVariant = "default", this.sx = {}, this.inputId = `tc-input-chip-${Math.random().toString(36).slice(2)}`, this.isFocused = !1;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const t = this.error.length > 0, i = {
|
|
19
|
+
"field-group": !0,
|
|
20
|
+
focused: this.isFocused,
|
|
21
|
+
"has-error": t
|
|
22
|
+
}, s = {
|
|
23
|
+
"input-container": !0,
|
|
24
|
+
"has-error": t
|
|
25
|
+
};
|
|
26
|
+
return n`
|
|
27
|
+
<div class=${d(i)} style=${y(this.sx)}>
|
|
28
|
+
${this.label ? n`<label part="label" class="field-label" for=${this.inputId}>${this.label}</label>` : ""}
|
|
29
|
+
<div part="wrapper" class=${d(s)}>
|
|
30
|
+
<input
|
|
31
|
+
part="input"
|
|
32
|
+
id=${this.inputId}
|
|
33
|
+
class="input"
|
|
34
|
+
type="text"
|
|
35
|
+
placeholder=${this.placeholder}
|
|
36
|
+
.value=${this.value}
|
|
37
|
+
?disabled=${this.disabled}
|
|
38
|
+
?readonly=${this.readonly}
|
|
39
|
+
aria-invalid=${t ? "true" : "false"}
|
|
40
|
+
aria-describedby=${t ? `${this.inputId}-error` : ""}
|
|
41
|
+
@input=${this.handleInput}
|
|
42
|
+
@focus=${this.handleFocus}
|
|
43
|
+
@blur=${this.handleBlur}
|
|
44
|
+
@keydown=${this.handleKeydown}
|
|
45
|
+
/>
|
|
46
|
+
${this.chipLabel ? n`
|
|
47
|
+
<div class="chip-container">
|
|
48
|
+
<tc-chip part="chip" variant=${this.chipVariant} size="sm">
|
|
49
|
+
<span class="chip-content">
|
|
50
|
+
${this.chipIcon ? n`<tc-icon name=${this.chipIcon} .sx=${{ "--icon-size": "0.875rem" }}></tc-icon>` : ""}
|
|
51
|
+
${this.chipLabel}
|
|
52
|
+
</span>
|
|
53
|
+
</tc-chip>
|
|
54
|
+
</div>
|
|
55
|
+
` : ""}
|
|
56
|
+
</div>
|
|
57
|
+
${t ? n`<p part="error" id="${this.inputId}-error" class="error-text" role="alert">
|
|
58
|
+
${this.error}
|
|
59
|
+
</p>` : ""}
|
|
60
|
+
</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
handleInput(t) {
|
|
64
|
+
const i = t.target;
|
|
65
|
+
this.value = i.value, this.dispatchEvent(
|
|
66
|
+
new CustomEvent("tc-input", {
|
|
67
|
+
bubbles: !0,
|
|
68
|
+
composed: !0,
|
|
69
|
+
detail: { value: i.value }
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
handleFocus() {
|
|
74
|
+
this.isFocused = !0;
|
|
75
|
+
}
|
|
76
|
+
handleBlur(t) {
|
|
77
|
+
const i = t.target;
|
|
78
|
+
this.isFocused = !1, this.dispatchEvent(
|
|
79
|
+
new CustomEvent("tc-blur", {
|
|
80
|
+
bubbles: !0,
|
|
81
|
+
composed: !0,
|
|
82
|
+
detail: { value: i.value }
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
handleKeydown(t) {
|
|
87
|
+
this.dispatchEvent(
|
|
88
|
+
new CustomEvent("tc-keydown", {
|
|
89
|
+
bubbles: !0,
|
|
90
|
+
composed: !0,
|
|
91
|
+
detail: { key: t.key, value: this.value, originalEvent: t }
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
focus() {
|
|
96
|
+
this.shadowRoot?.querySelector("input")?.focus();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
e.styles = [
|
|
100
|
+
f,
|
|
101
|
+
u`
|
|
102
|
+
:host {
|
|
103
|
+
display: block;
|
|
104
|
+
width: 100%;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.field-group {
|
|
109
|
+
width: 100%;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.field-group.focused .field-label {
|
|
113
|
+
color: var(--accent-primary);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.field-group.has-error .field-label {
|
|
117
|
+
color: var(--error-base);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.input-container {
|
|
121
|
+
position: relative;
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
width: 100%;
|
|
125
|
+
background: var(--paper-white);
|
|
126
|
+
border: 1px solid var(--ink-faint);
|
|
127
|
+
border-radius: var(--input-radius);
|
|
128
|
+
transition: var(--transition-fast);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.input-container:focus-within {
|
|
132
|
+
border-color: var(--accent-primary);
|
|
133
|
+
box-shadow: 0 0 0 var(--shadow-focus-ring-width) var(--alpha-primary10);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.input-container.has-error {
|
|
137
|
+
border-color: var(--error-base);
|
|
138
|
+
background: var(--error-bg);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.input-container.has-error:focus-within {
|
|
142
|
+
box-shadow: 0 0 0 var(--shadow-focus-ring-width) var(--error-border);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.input {
|
|
146
|
+
flex: 1;
|
|
147
|
+
min-width: 0;
|
|
148
|
+
padding: var(--input-padding-y) var(--input-padding-x);
|
|
149
|
+
font-family: var(--font-body);
|
|
150
|
+
font-size: var(--input-font-size);
|
|
151
|
+
color: var(--ink-black);
|
|
152
|
+
background: transparent;
|
|
153
|
+
border: none;
|
|
154
|
+
outline: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.input::placeholder {
|
|
158
|
+
color: var(--ink-light);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.input:disabled {
|
|
162
|
+
opacity: var(--opacity-disabled);
|
|
163
|
+
cursor: not-allowed;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.input:read-only {
|
|
167
|
+
cursor: default;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.chip-container {
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
padding-right: var(--space-sm);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.chip-content {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
gap: var(--space-xs);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.error-text {
|
|
183
|
+
font-size: var(--font-size-sm);
|
|
184
|
+
color: var(--error-base);
|
|
185
|
+
margin: var(--space-xs) 0 0;
|
|
186
|
+
animation: slideDown 300ms ease backwards;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@keyframes slideDown {
|
|
190
|
+
from {
|
|
191
|
+
opacity: 0;
|
|
192
|
+
transform: translateY(calc(-1 * var(--offset-slide-up-sm)));
|
|
193
|
+
}
|
|
194
|
+
to {
|
|
195
|
+
opacity: 1;
|
|
196
|
+
transform: translateY(0);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@media (prefers-reduced-motion: reduce) {
|
|
201
|
+
.input-container,
|
|
202
|
+
.error-text {
|
|
203
|
+
transition-duration: 0.01ms !important;
|
|
204
|
+
animation-duration: 0.01ms !important;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
`
|
|
208
|
+
];
|
|
209
|
+
r([
|
|
210
|
+
a({ type: String })
|
|
211
|
+
], e.prototype, "label", 2);
|
|
212
|
+
r([
|
|
213
|
+
a({ type: String })
|
|
214
|
+
], e.prototype, "placeholder", 2);
|
|
215
|
+
r([
|
|
216
|
+
a({ type: String })
|
|
217
|
+
], e.prototype, "value", 2);
|
|
218
|
+
r([
|
|
219
|
+
a({ type: String })
|
|
220
|
+
], e.prototype, "error", 2);
|
|
221
|
+
r([
|
|
222
|
+
a({ type: Boolean })
|
|
223
|
+
], e.prototype, "disabled", 2);
|
|
224
|
+
r([
|
|
225
|
+
a({ type: Boolean })
|
|
226
|
+
], e.prototype, "readonly", 2);
|
|
227
|
+
r([
|
|
228
|
+
a({ type: String, attribute: "chip-label" })
|
|
229
|
+
], e.prototype, "chipLabel", 2);
|
|
230
|
+
r([
|
|
231
|
+
a({ type: String, attribute: "chip-icon" })
|
|
232
|
+
], e.prototype, "chipIcon", 2);
|
|
233
|
+
r([
|
|
234
|
+
a({ type: String, attribute: "chip-variant" })
|
|
235
|
+
], e.prototype, "chipVariant", 2);
|
|
236
|
+
r([
|
|
237
|
+
a({ type: Object })
|
|
238
|
+
], e.prototype, "sx", 2);
|
|
239
|
+
r([
|
|
240
|
+
h()
|
|
241
|
+
], e.prototype, "inputId", 2);
|
|
242
|
+
r([
|
|
243
|
+
h()
|
|
244
|
+
], e.prototype, "isFocused", 2);
|
|
245
|
+
e = r([
|
|
246
|
+
b("tc-input-with-chip")
|
|
247
|
+
], e);
|
|
248
|
+
export {
|
|
249
|
+
e as TcInputWithChip
|
|
250
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { SxProps } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Form input component with label and error states.
|
|
5
|
+
* Uses design-tokens classes (.input, .label, .field-group).
|
|
6
|
+
*
|
|
7
|
+
* @fires tc-input - Fired when input value changes
|
|
8
|
+
* @fires tc-blur - Fired when input loses focus
|
|
9
|
+
* @fires tc-keydown - Fired when a key is pressed
|
|
10
|
+
* @fires tc-paste - Fired when content is pasted
|
|
11
|
+
* @csspart wrapper - The input wrapper element
|
|
12
|
+
* @csspart input - The input element
|
|
13
|
+
* @csspart label - The label element
|
|
14
|
+
* @csspart ink-line - The animated ink line
|
|
15
|
+
* @csspart error - The error message element
|
|
16
|
+
*/
|
|
17
|
+
export declare class TcInput extends LitElement {
|
|
18
|
+
label: string;
|
|
19
|
+
type: string;
|
|
20
|
+
placeholder: string;
|
|
21
|
+
value: string;
|
|
22
|
+
error: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
required: boolean;
|
|
25
|
+
name: string;
|
|
26
|
+
autocomplete: string;
|
|
27
|
+
inputmode: string;
|
|
28
|
+
maxlength: number;
|
|
29
|
+
sx: SxProps;
|
|
30
|
+
private inputId;
|
|
31
|
+
private isFocused;
|
|
32
|
+
static styles: import('lit').CSSResult[];
|
|
33
|
+
render(): import('lit').TemplateResult<1>;
|
|
34
|
+
private handleInput;
|
|
35
|
+
private handleFocus;
|
|
36
|
+
private handleBlur;
|
|
37
|
+
private handleKeydown;
|
|
38
|
+
private handlePaste;
|
|
39
|
+
focus(): void;
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
'tc-input': TcInput;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=tc-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tc-input.d.ts","sourceRoot":"","sources":["../../src/primitives/tc-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAK5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,qBACa,OAAQ,SAAQ,UAAU;IACT,KAAK,SAAM;IACX,IAAI,SAAU;IACd,WAAW,SAAM;IACjB,KAAK,SAAM;IACX,KAAK,SAAM;IACV,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAClB,IAAI,SAAM;IACV,YAAY,SAAM;IAClB,SAAS,SAAM;IACf,SAAS,SAAK;IACd,EAAE,EAAE,OAAO,CAAM;IAEpC,OAAO,CAAC,OAAO,CAAqD;IACpE,OAAO,CAAC,SAAS,CAAS;IAEnC,OAAgB,MAAM,4BA6GpB;IAEO,MAAM;IA+Df,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,WAAW;IAUnB,KAAK;CAIN;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { css as c, LitElement as m, html as d } from "lit";
|
|
2
|
+
import { property as i, state as h, customElement as b } from "lit/decorators.js";
|
|
3
|
+
import { classMap as u } from "lit/directives/class-map.js";
|
|
4
|
+
import { styleMap as v } from "lit/directives/style-map.js";
|
|
5
|
+
import { sharedStyles as y } from "../styles/shared.js";
|
|
6
|
+
var f = Object.defineProperty, g = Object.getOwnPropertyDescriptor, r = (e, o, n, a) => {
|
|
7
|
+
for (var s = a > 1 ? void 0 : a ? g(o, n) : o, l = e.length - 1, p; l >= 0; l--)
|
|
8
|
+
(p = e[l]) && (s = (a ? p(o, n, s) : p(s)) || s);
|
|
9
|
+
return a && s && f(o, n, s), s;
|
|
10
|
+
};
|
|
11
|
+
let t = class extends m {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.label = "", this.type = "text", this.placeholder = "", this.value = "", this.error = "", this.disabled = !1, this.required = !1, this.name = "", this.autocomplete = "", this.inputmode = "", this.maxlength = 0, this.sx = {}, this.inputId = `tc-input-${Math.random().toString(36).slice(2)}`, this.isFocused = !1;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
const e = this.error.length > 0, o = {
|
|
17
|
+
"field-group": !0,
|
|
18
|
+
focused: this.isFocused,
|
|
19
|
+
"has-error": e
|
|
20
|
+
}, n = {
|
|
21
|
+
"input-wrapper": !0,
|
|
22
|
+
focused: this.isFocused,
|
|
23
|
+
"has-error": e
|
|
24
|
+
}, a = {
|
|
25
|
+
input: !0,
|
|
26
|
+
"has-error": e
|
|
27
|
+
};
|
|
28
|
+
return d`
|
|
29
|
+
<div class=${u(o)}>
|
|
30
|
+
${this.label ? d`<label part="label" class="field-label" for=${this.inputId}>${this.label}</label>` : ""}
|
|
31
|
+
<div part="wrapper" class=${u(n)}>
|
|
32
|
+
<input
|
|
33
|
+
part="input"
|
|
34
|
+
id=${this.inputId}
|
|
35
|
+
class=${u(a)}
|
|
36
|
+
type=${this.type}
|
|
37
|
+
name=${this.name}
|
|
38
|
+
placeholder=${this.placeholder}
|
|
39
|
+
.value=${this.value}
|
|
40
|
+
?disabled=${this.disabled}
|
|
41
|
+
?required=${this.required}
|
|
42
|
+
autocomplete=${this.autocomplete || "off"}
|
|
43
|
+
inputmode=${this.inputmode || ""}
|
|
44
|
+
maxlength=${this.maxlength || ""}
|
|
45
|
+
aria-invalid=${e ? "true" : "false"}
|
|
46
|
+
aria-describedby=${e ? `${this.inputId}-error` : ""}
|
|
47
|
+
style=${v(this.sx)}
|
|
48
|
+
@input=${this.handleInput}
|
|
49
|
+
@focus=${this.handleFocus}
|
|
50
|
+
@blur=${this.handleBlur}
|
|
51
|
+
@keydown=${this.handleKeydown}
|
|
52
|
+
@paste=${this.handlePaste}
|
|
53
|
+
/>
|
|
54
|
+
<div part="ink-line" class="ink-line"></div>
|
|
55
|
+
</div>
|
|
56
|
+
${e ? d`<p part="error" id="${this.inputId}-error" class="input-error-text" role="alert">
|
|
57
|
+
${this.error}
|
|
58
|
+
</p>` : ""}
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
handleInput(e) {
|
|
63
|
+
const o = e.target;
|
|
64
|
+
this.value = o.value, this.dispatchEvent(
|
|
65
|
+
new CustomEvent("tc-input", {
|
|
66
|
+
bubbles: !0,
|
|
67
|
+
composed: !0,
|
|
68
|
+
detail: { value: o.value }
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
handleFocus() {
|
|
73
|
+
this.isFocused = !0;
|
|
74
|
+
}
|
|
75
|
+
handleBlur(e) {
|
|
76
|
+
const o = e.target;
|
|
77
|
+
this.isFocused = !1, this.dispatchEvent(
|
|
78
|
+
new CustomEvent("tc-blur", {
|
|
79
|
+
bubbles: !0,
|
|
80
|
+
composed: !0,
|
|
81
|
+
detail: { value: o.value }
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
handleKeydown(e) {
|
|
86
|
+
this.dispatchEvent(
|
|
87
|
+
new CustomEvent("tc-keydown", {
|
|
88
|
+
bubbles: !0,
|
|
89
|
+
composed: !0,
|
|
90
|
+
detail: { key: e.key, value: this.value, originalEvent: e }
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
handlePaste(e) {
|
|
95
|
+
this.dispatchEvent(
|
|
96
|
+
new CustomEvent("tc-paste", {
|
|
97
|
+
bubbles: !0,
|
|
98
|
+
composed: !0,
|
|
99
|
+
detail: { data: e.clipboardData?.getData("text"), originalEvent: e }
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
focus() {
|
|
104
|
+
this.shadowRoot?.querySelector("input")?.focus();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
t.styles = [
|
|
108
|
+
y,
|
|
109
|
+
c`
|
|
110
|
+
:host {
|
|
111
|
+
display: block;
|
|
112
|
+
width: 100%;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Extend design-tokens .field-group */
|
|
117
|
+
.field-group {
|
|
118
|
+
width: 100%;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* Label color change on focus - extends design-tokens .field-label */
|
|
122
|
+
.field-group.focused .field-label {
|
|
123
|
+
color: var(--accent-primary);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.field-group.has-error .field-label {
|
|
127
|
+
color: var(--error-base);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.input-wrapper {
|
|
131
|
+
position: relative;
|
|
132
|
+
width: 100%;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Extend design-tokens .input */
|
|
136
|
+
.input {
|
|
137
|
+
width: 100%;
|
|
138
|
+
box-sizing: border-box;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.input:disabled {
|
|
142
|
+
opacity: var(--opacity-disabled);
|
|
143
|
+
cursor: not-allowed;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Ink line animation */
|
|
147
|
+
.ink-line {
|
|
148
|
+
position: absolute;
|
|
149
|
+
bottom: 0;
|
|
150
|
+
left: 50%;
|
|
151
|
+
transform: translateX(-50%);
|
|
152
|
+
width: 0;
|
|
153
|
+
height: 0.125rem;
|
|
154
|
+
background: linear-gradient(
|
|
155
|
+
90deg,
|
|
156
|
+
var(--accent-primary) 0%,
|
|
157
|
+
var(--accent-primary-hover) 100%
|
|
158
|
+
);
|
|
159
|
+
border-radius: 0.0625rem;
|
|
160
|
+
transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
161
|
+
pointer-events: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.input-wrapper.focused .ink-line {
|
|
165
|
+
width: 60%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Error states */
|
|
169
|
+
.input.has-error {
|
|
170
|
+
border-color: var(--error-base);
|
|
171
|
+
background: var(--error-bg);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.input.has-error:focus {
|
|
175
|
+
border-color: var(--error-base);
|
|
176
|
+
box-shadow: 0 0 0 var(--shadow-focus-ring-width) var(--error-border);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.input-wrapper.has-error .ink-line {
|
|
180
|
+
background: linear-gradient(
|
|
181
|
+
90deg,
|
|
182
|
+
var(--error-base) 0%,
|
|
183
|
+
var(--error-base) 100%
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.input-error-text {
|
|
188
|
+
font-size: var(--font-size-sm);
|
|
189
|
+
color: var(--error-base);
|
|
190
|
+
margin: 0;
|
|
191
|
+
animation: slideDown 300ms ease backwards;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@keyframes slideDown {
|
|
195
|
+
from {
|
|
196
|
+
opacity: 0;
|
|
197
|
+
transform: translateY(calc(-1 * var(--offset-slide-up-sm)));
|
|
198
|
+
}
|
|
199
|
+
to {
|
|
200
|
+
opacity: 1;
|
|
201
|
+
transform: translateY(0);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* Reduced motion */
|
|
206
|
+
@media (prefers-reduced-motion: reduce) {
|
|
207
|
+
.field-label,
|
|
208
|
+
.input,
|
|
209
|
+
.ink-line,
|
|
210
|
+
.input-error-text {
|
|
211
|
+
transition-duration: 0.01ms !important;
|
|
212
|
+
animation-duration: 0.01ms !important;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
`
|
|
216
|
+
];
|
|
217
|
+
r([
|
|
218
|
+
i({ type: String })
|
|
219
|
+
], t.prototype, "label", 2);
|
|
220
|
+
r([
|
|
221
|
+
i({ type: String })
|
|
222
|
+
], t.prototype, "type", 2);
|
|
223
|
+
r([
|
|
224
|
+
i({ type: String })
|
|
225
|
+
], t.prototype, "placeholder", 2);
|
|
226
|
+
r([
|
|
227
|
+
i({ type: String })
|
|
228
|
+
], t.prototype, "value", 2);
|
|
229
|
+
r([
|
|
230
|
+
i({ type: String })
|
|
231
|
+
], t.prototype, "error", 2);
|
|
232
|
+
r([
|
|
233
|
+
i({ type: Boolean })
|
|
234
|
+
], t.prototype, "disabled", 2);
|
|
235
|
+
r([
|
|
236
|
+
i({ type: Boolean })
|
|
237
|
+
], t.prototype, "required", 2);
|
|
238
|
+
r([
|
|
239
|
+
i({ type: String })
|
|
240
|
+
], t.prototype, "name", 2);
|
|
241
|
+
r([
|
|
242
|
+
i({ type: String })
|
|
243
|
+
], t.prototype, "autocomplete", 2);
|
|
244
|
+
r([
|
|
245
|
+
i({ type: String })
|
|
246
|
+
], t.prototype, "inputmode", 2);
|
|
247
|
+
r([
|
|
248
|
+
i({ type: Number })
|
|
249
|
+
], t.prototype, "maxlength", 2);
|
|
250
|
+
r([
|
|
251
|
+
i({ type: Object })
|
|
252
|
+
], t.prototype, "sx", 2);
|
|
253
|
+
r([
|
|
254
|
+
h()
|
|
255
|
+
], t.prototype, "inputId", 2);
|
|
256
|
+
r([
|
|
257
|
+
h()
|
|
258
|
+
], t.prototype, "isFocused", 2);
|
|
259
|
+
t = r([
|
|
260
|
+
b("tc-input")
|
|
261
|
+
], t);
|
|
262
|
+
export {
|
|
263
|
+
t as TcInput
|
|
264
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { SxProps } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A clickable item button with hover states and optional arrow indicator.
|
|
5
|
+
*
|
|
6
|
+
* @slot - Item content
|
|
7
|
+
* @slot prefix - Left side content (icon, symbol)
|
|
8
|
+
* @slot suffix - Right side content (replaces arrow if provided)
|
|
9
|
+
* @fires tc-click - Fired when the item is clicked
|
|
10
|
+
* @csspart button - The button element
|
|
11
|
+
* @csspart prefix - The prefix container
|
|
12
|
+
* @csspart content - The main content container
|
|
13
|
+
* @csspart suffix - The suffix container
|
|
14
|
+
* @csspart arrow - The arrow indicator
|
|
15
|
+
*/
|
|
16
|
+
export declare class TcItemButton extends LitElement {
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
showArrow: boolean;
|
|
19
|
+
sx: SxProps;
|
|
20
|
+
static styles: import('lit').CSSResult;
|
|
21
|
+
private handleClick;
|
|
22
|
+
render(): import('lit').TemplateResult<1>;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'tc-item-button': TcItemButton;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=tc-item-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tc-item-button.d.ts","sourceRoot":"","sources":["../../src/primitives/tc-item-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAG5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,qBACa,YAAa,SAAQ,UAAU;IACb,QAAQ,UAAS;IACQ,SAAS,UAAQ;IAC3C,EAAE,EAAE,OAAO,CAAM;IAE7C,OAAgB,MAAM,0BAsFpB;IAEF,OAAO,CAAC,WAAW;IAWV,MAAM;CA6ChB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
|