@krumio/trailhand-ui 1.6.0 → 1.8.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/dist/components/action-menu/action-menu.d.ts.map +1 -1
- package/dist/components/action-menu/action-menu.js +2 -0
- package/dist/components/action-menu/action-menu.js.map +1 -1
- package/dist/components/data-table/data-table.d.ts +1 -11
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/data-table.js +9 -82
- package/dist/components/data-table/data-table.js.map +1 -1
- package/dist/components/icon/icon.d.ts +16 -0
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +30 -2
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/progress-bar/index.d.ts +2 -0
- package/dist/components/progress-bar/index.d.ts.map +1 -0
- package/dist/components/progress-bar/index.js +2 -0
- package/dist/components/progress-bar/index.js.map +1 -0
- package/dist/components/progress-bar/progress-bar.d.ts +27 -0
- package/dist/components/progress-bar/progress-bar.d.ts.map +1 -0
- package/dist/components/progress-bar/progress-bar.js +124 -0
- package/dist/components/progress-bar/progress-bar.js.map +1 -0
- package/dist/components/th-card/index.d.ts +3 -0
- package/dist/components/th-card/index.d.ts.map +1 -0
- package/dist/components/th-card/index.js +2 -0
- package/dist/components/th-card/index.js.map +1 -0
- package/dist/components/th-card/th-card.d.ts +40 -0
- package/dist/components/th-card/th-card.d.ts.map +1 -0
- package/dist/components/th-card/th-card.js +376 -0
- package/dist/components/th-card/th-card.js.map +1 -0
- package/dist/components/th-tag/index.d.ts +3 -0
- package/dist/components/th-tag/index.d.ts.map +1 -0
- package/dist/components/th-tag/index.js +2 -0
- package/dist/components/th-tag/index.js.map +1 -0
- package/dist/components/th-tag/th-tag.d.ts +67 -0
- package/dist/components/th-tag/th-tag.d.ts.map +1 -0
- package/dist/components/th-tag/th-tag.js +287 -0
- package/dist/components/th-tag/th-tag.js.map +1 -0
- package/dist/components/toggle-switch/toggle-switch.d.ts.map +1 -1
- package/dist/components/toggle-switch/toggle-switch.js +2 -0
- package/dist/components/toggle-switch/toggle-switch.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/colors.css +34 -4
- package/dist/utils/formatters.d.ts +9 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +66 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +11 -22
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import '../icon/icon';
|
|
10
|
+
/**
|
|
11
|
+
* A flexible card component for displaying content in a contained box.
|
|
12
|
+
*
|
|
13
|
+
* @fires card-dismiss - Fired when the dismiss button is clicked
|
|
14
|
+
* @fires card-click - Fired when card is clicked (if clickable)
|
|
15
|
+
*
|
|
16
|
+
* @slot icon - Slot for an icon in the header
|
|
17
|
+
* @slot title - Slot for the card title
|
|
18
|
+
* @slot subtitle - Slot for a subtitle
|
|
19
|
+
* @slot - Default slot for main body content
|
|
20
|
+
* @slot action - Slot for action buttons
|
|
21
|
+
* @slot footer - Slot for footer content
|
|
22
|
+
*/
|
|
23
|
+
export class ThCard extends LitElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.variant = 'default';
|
|
27
|
+
this.dismissible = false;
|
|
28
|
+
this.cardId = '';
|
|
29
|
+
this.cardTitle = '';
|
|
30
|
+
this.subtitle = '';
|
|
31
|
+
this.description = '';
|
|
32
|
+
this.iconSrc = '';
|
|
33
|
+
this.iconName = '';
|
|
34
|
+
this.loading = false;
|
|
35
|
+
this.clickable = false;
|
|
36
|
+
this.href = '';
|
|
37
|
+
this.target = '';
|
|
38
|
+
}
|
|
39
|
+
_hasIcon() {
|
|
40
|
+
return !!(this.iconName || this.iconSrc || this.querySelector('[slot="icon"]'));
|
|
41
|
+
}
|
|
42
|
+
_renderIcon() {
|
|
43
|
+
if (this.iconName) {
|
|
44
|
+
return html `<div class="card__icon"><trailhand-icon name=${this.iconName}></trailhand-icon></div>`;
|
|
45
|
+
}
|
|
46
|
+
if (this.iconSrc) {
|
|
47
|
+
return html `<div class="card__icon"><img src=${this.iconSrc} alt="" /></div>`;
|
|
48
|
+
}
|
|
49
|
+
return html `<div class="card__icon"><slot name="icon"></slot></div>`;
|
|
50
|
+
}
|
|
51
|
+
_handleDismiss(e) {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
this.dispatchEvent(new CustomEvent('card-dismiss', {
|
|
54
|
+
bubbles: true,
|
|
55
|
+
composed: true,
|
|
56
|
+
detail: { id: this.cardId },
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
_handleCardClick(e) {
|
|
60
|
+
if (!this.clickable && !this.href)
|
|
61
|
+
return;
|
|
62
|
+
const path = e.composedPath();
|
|
63
|
+
if (path.some((el) => ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT'].includes(el.tagName))) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.dispatchEvent(new CustomEvent('card-click', { bubbles: true, composed: true }));
|
|
67
|
+
if (this.href) {
|
|
68
|
+
window.open(this.href, this.target || '_self');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
_handleKeyDown(e) {
|
|
72
|
+
if (!this.clickable && !this.href)
|
|
73
|
+
return;
|
|
74
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
this._handleCardClick(e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
_onFooterSlotChange(e) {
|
|
80
|
+
const slot = e.target;
|
|
81
|
+
const footer = slot.parentElement;
|
|
82
|
+
if (footer) {
|
|
83
|
+
footer.classList.toggle('card__footer--has-content', slot.assignedNodes().length > 0);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_renderContent() {
|
|
87
|
+
const isInfo = this.variant === 'info';
|
|
88
|
+
return html `
|
|
89
|
+
${isInfo && this._hasIcon() ? this._renderIcon() : nothing}
|
|
90
|
+
|
|
91
|
+
<div class="card__header">
|
|
92
|
+
${!isInfo && this._hasIcon() ? this._renderIcon() : nothing}
|
|
93
|
+
|
|
94
|
+
<div class="card__title-group">
|
|
95
|
+
<h3 class="card__title" part="title">
|
|
96
|
+
<slot name="title">${this.cardTitle}</slot>
|
|
97
|
+
</h3>
|
|
98
|
+
${this.subtitle || this.querySelector('[slot="subtitle"]')
|
|
99
|
+
? html `<p class="card__subtitle" part="subtitle">
|
|
100
|
+
<slot name="subtitle">${this.subtitle}</slot>
|
|
101
|
+
</p>`
|
|
102
|
+
: nothing}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
${this.dismissible
|
|
106
|
+
? html `<button class="card__dismiss" @click=${this._handleDismiss} aria-label="Dismiss">
|
|
107
|
+
<trailhand-icon name="close"></trailhand-icon>
|
|
108
|
+
</button>`
|
|
109
|
+
: nothing}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
${!isInfo
|
|
113
|
+
? html `
|
|
114
|
+
<div class="card__body" part="body">
|
|
115
|
+
<slot name="description">${this.description}</slot>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="card__action" part="action">
|
|
118
|
+
<slot name="action"></slot>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="card__footer" part="footer">
|
|
121
|
+
<slot name="footer" @slotchange=${this._onFooterSlotChange}></slot>
|
|
122
|
+
</div>
|
|
123
|
+
`
|
|
124
|
+
: nothing}
|
|
125
|
+
`;
|
|
126
|
+
}
|
|
127
|
+
render() {
|
|
128
|
+
const classes = `card card--${this.variant}${this.loading ? ' card--loading' : ''}`;
|
|
129
|
+
if (this.loading) {
|
|
130
|
+
return html `<div class=${classes}><div class="card__spinner"></div></div>`;
|
|
131
|
+
}
|
|
132
|
+
if (this.href) {
|
|
133
|
+
return html `
|
|
134
|
+
<a
|
|
135
|
+
class=${classes}
|
|
136
|
+
part="card"
|
|
137
|
+
href=${this.href}
|
|
138
|
+
target=${this.target || nothing}
|
|
139
|
+
@click=${this._handleCardClick}
|
|
140
|
+
>
|
|
141
|
+
${this._renderContent()}
|
|
142
|
+
</a>
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
return html `
|
|
146
|
+
<div
|
|
147
|
+
class=${classes}
|
|
148
|
+
part="card"
|
|
149
|
+
tabindex=${this.clickable ? '0' : nothing}
|
|
150
|
+
role=${this.clickable ? 'button' : nothing}
|
|
151
|
+
@click=${this._handleCardClick}
|
|
152
|
+
@keydown=${this._handleKeyDown}
|
|
153
|
+
>
|
|
154
|
+
${this._renderContent()}
|
|
155
|
+
</div>
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
ThCard.styles = css `
|
|
160
|
+
:host {
|
|
161
|
+
display: block;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.card {
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
font-family: var(--font-family, 'Poppins', sans-serif);
|
|
168
|
+
background: var(--th-card-bg);
|
|
169
|
+
border-radius: var(--th-card-radius, 8px);
|
|
170
|
+
border: 1px solid var(--th-card-border, #e5e7eb);
|
|
171
|
+
transition: box-shadow 0.2s ease;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.card--default,
|
|
175
|
+
.card--outlined {
|
|
176
|
+
padding: var(--th-card-padding, 20px);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.card--info {
|
|
180
|
+
padding: 16px 20px;
|
|
181
|
+
flex-direction: row;
|
|
182
|
+
align-items: center;
|
|
183
|
+
gap: 12px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.card:hover {
|
|
187
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* Clickable */
|
|
191
|
+
:host([clickable]) .card,
|
|
192
|
+
a.card {
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
text-decoration: none;
|
|
195
|
+
color: inherit;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Header */
|
|
199
|
+
.card__header {
|
|
200
|
+
display: flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
gap: 12px;
|
|
203
|
+
margin-bottom: 12px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.card--info .card__header {
|
|
207
|
+
margin-bottom: 0;
|
|
208
|
+
flex: 1;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Icon */
|
|
212
|
+
.card__icon {
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
flex-shrink: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.card__icon img {
|
|
220
|
+
width: 40px;
|
|
221
|
+
height: 40px;
|
|
222
|
+
object-fit: contain;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.card__icon trailhand-icon {
|
|
226
|
+
font-size: 40px;
|
|
227
|
+
color: var(--th-card-icon-color, var(--th-card-title-color, inherit));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.card--info .card__icon img {
|
|
231
|
+
width: 48px;
|
|
232
|
+
height: 48px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.card--info .card__icon trailhand-icon {
|
|
236
|
+
font-size: 48px;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Title */
|
|
240
|
+
.card__title-group {
|
|
241
|
+
flex: 1;
|
|
242
|
+
min-width: 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.card__title {
|
|
246
|
+
margin: 0;
|
|
247
|
+
font-size: 18px;
|
|
248
|
+
font-weight: 600;
|
|
249
|
+
color: var(--th-card-title-color, inherit);
|
|
250
|
+
line-height: 1.3;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.card--info .card__title {
|
|
254
|
+
font-size: 16px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.card__subtitle {
|
|
258
|
+
margin: 4px 0 0 0;
|
|
259
|
+
font-size: 14px;
|
|
260
|
+
color: var(--th-card-subtitle-color, inherit);
|
|
261
|
+
line-height: 1.4;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Body */
|
|
265
|
+
.card__body {
|
|
266
|
+
flex: 1;
|
|
267
|
+
font-size: 14px;
|
|
268
|
+
line-height: 1.6;
|
|
269
|
+
color: var(--th-card-text-color, inherit);
|
|
270
|
+
margin-bottom: 16px;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.card--info .card__body {
|
|
274
|
+
display: none;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Action & Footer */
|
|
278
|
+
.card__action {
|
|
279
|
+
margin-bottom: 16px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.card__action:empty,
|
|
283
|
+
.card__footer:empty {
|
|
284
|
+
display: none;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.card__footer {
|
|
288
|
+
display: none;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.card__footer--has-content {
|
|
292
|
+
display: block;
|
|
293
|
+
padding-top: 16px;
|
|
294
|
+
margin-top: auto;
|
|
295
|
+
border-top: 1px solid var(--th-card-border, #e5e7eb);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* Dismiss */
|
|
299
|
+
.card__dismiss {
|
|
300
|
+
background: none;
|
|
301
|
+
border: none;
|
|
302
|
+
padding: 4px;
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
color: var(--th-card-dismiss-color, var(--th-card-text-color, inherit));
|
|
305
|
+
opacity: 0.7;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.card__dismiss:hover {
|
|
309
|
+
opacity: 1;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.card__dismiss trailhand-icon {
|
|
313
|
+
font-size: 20px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* Loading */
|
|
317
|
+
.card--loading {
|
|
318
|
+
min-height: 200px;
|
|
319
|
+
display: flex;
|
|
320
|
+
align-items: center;
|
|
321
|
+
justify-content: center;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.card__spinner {
|
|
325
|
+
width: 32px;
|
|
326
|
+
height: 32px;
|
|
327
|
+
border: 3px solid #e5e7eb;
|
|
328
|
+
border-top-color: #3b82f6;
|
|
329
|
+
border-radius: 50%;
|
|
330
|
+
animation: spin 0.8s linear infinite;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@keyframes spin {
|
|
334
|
+
to {
|
|
335
|
+
transform: rotate(360deg);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
`;
|
|
339
|
+
__decorate([
|
|
340
|
+
property({ type: String })
|
|
341
|
+
], ThCard.prototype, "variant", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
property({ type: Boolean })
|
|
344
|
+
], ThCard.prototype, "dismissible", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
property({ type: String, attribute: 'card-id' })
|
|
347
|
+
], ThCard.prototype, "cardId", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
property({ type: String, attribute: 'card-title' })
|
|
350
|
+
], ThCard.prototype, "cardTitle", void 0);
|
|
351
|
+
__decorate([
|
|
352
|
+
property({ type: String })
|
|
353
|
+
], ThCard.prototype, "subtitle", void 0);
|
|
354
|
+
__decorate([
|
|
355
|
+
property({ type: String })
|
|
356
|
+
], ThCard.prototype, "description", void 0);
|
|
357
|
+
__decorate([
|
|
358
|
+
property({ type: String, attribute: 'icon-src' })
|
|
359
|
+
], ThCard.prototype, "iconSrc", void 0);
|
|
360
|
+
__decorate([
|
|
361
|
+
property({ type: String, attribute: 'icon-name' })
|
|
362
|
+
], ThCard.prototype, "iconName", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
property({ type: Boolean })
|
|
365
|
+
], ThCard.prototype, "loading", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
property({ type: Boolean, reflect: true })
|
|
368
|
+
], ThCard.prototype, "clickable", void 0);
|
|
369
|
+
__decorate([
|
|
370
|
+
property({ type: String })
|
|
371
|
+
], ThCard.prototype, "href", void 0);
|
|
372
|
+
__decorate([
|
|
373
|
+
property({ type: String })
|
|
374
|
+
], ThCard.prototype, "target", void 0);
|
|
375
|
+
customElements.define('trailhand-card', ThCard);
|
|
376
|
+
//# sourceMappingURL=th-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"th-card.js","sourceRoot":"","sources":["../../../src/components/th-card/th-card.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,CAAC;AAQtB;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QAC8B,YAAO,GAAgB,SAAS,CAAC;QAChC,gBAAW,GAAG,KAAK,CAAC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O,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAmB;AAClC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAa;AA8T1C,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/th-tag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/th-tag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import '../icon/icon';
|
|
3
|
+
import type { IconProps } from '../icon/icon';
|
|
4
|
+
/**
|
|
5
|
+
* Tag variant types for different visual styles
|
|
6
|
+
*/
|
|
7
|
+
export type TagVariant = 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
8
|
+
/**
|
|
9
|
+
* Tag size options
|
|
10
|
+
*/
|
|
11
|
+
export type TagSize = 'sm' | 'md' | 'lg';
|
|
12
|
+
/**
|
|
13
|
+
* A tag/badge component for displaying labels, statuses, or categories.
|
|
14
|
+
* Can be used for status indicators, category labels, or dismissible chips.
|
|
15
|
+
*
|
|
16
|
+
* @fires tag-dismiss - Fired when the dismiss button is clicked (if dismissible)
|
|
17
|
+
*
|
|
18
|
+
* @slot - Default slot for tag content (alternative to label prop)
|
|
19
|
+
*/
|
|
20
|
+
export declare class ThTag extends LitElement {
|
|
21
|
+
/**
|
|
22
|
+
* The text label to display in the tag
|
|
23
|
+
*/
|
|
24
|
+
label: string;
|
|
25
|
+
/**
|
|
26
|
+
* Visual variant/color scheme
|
|
27
|
+
*/
|
|
28
|
+
variant: TagVariant;
|
|
29
|
+
/**
|
|
30
|
+
* Size of the tag
|
|
31
|
+
*/
|
|
32
|
+
size: TagSize;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the tag can be dismissed/closed
|
|
35
|
+
*/
|
|
36
|
+
dismissible: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the tag is disabled
|
|
39
|
+
*/
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to use outlined style (border instead of filled background)
|
|
43
|
+
*/
|
|
44
|
+
outlined: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Optional icon to display before the label (trailhand-icon name)
|
|
47
|
+
*/
|
|
48
|
+
icon: IconProps['name'] | '';
|
|
49
|
+
/**
|
|
50
|
+
* Value passed in the dismiss event (useful for identifying which tag was dismissed)
|
|
51
|
+
*/
|
|
52
|
+
value: string;
|
|
53
|
+
static styles: import("lit").CSSResult;
|
|
54
|
+
/**
|
|
55
|
+
* Handle dismiss button click
|
|
56
|
+
*/
|
|
57
|
+
private _handleDismiss;
|
|
58
|
+
/**
|
|
59
|
+
* Render the dismiss button icon
|
|
60
|
+
*/
|
|
61
|
+
private _renderDismissIcon;
|
|
62
|
+
/**
|
|
63
|
+
* Render the component
|
|
64
|
+
*/
|
|
65
|
+
render(): TemplateResult;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=th-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"th-tag.d.ts","sourceRoot":"","sources":["../../../src/components/th-tag/th-tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAW,MAAM,KAAK,CAAC;AAErE,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AASzC;;;;;;;GAOG;AACH,qBAAa,KAAM,SAAQ,UAAU;IACnC;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,OAAO,EAAE,UAAU,CAAa;IAEhC;;OAEG;IAEH,IAAI,EAAE,OAAO,CAAQ;IAErB;;OAEG;IAEH,WAAW,UAAS;IAEpB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAM;IAElC;;OAEG;IAEH,KAAK,SAAM;IAEX,OAAgB,MAAM,0BAuJpB;IAEF;;OAEG;IACH,OAAO,CAAC,cAAc;IAWtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACM,MAAM,IAAI,cAAc;CAkClC"}
|