@nitramburesh/wcds 0.3.10
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/README.md +110 -0
- package/custom-elements.json +1211 -0
- package/dist/components/avatar.d.ts +31 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/badge.d.ts +22 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/button.d.ts +35 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/card.d.ts +23 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/color.d.ts +13 -0
- package/dist/components/color.d.ts.map +1 -0
- package/dist/components/icon.d.ts +15 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/input.d.ts +38 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/styles/base.d.ts +10 -0
- package/dist/styles/base.d.ts.map +1 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.d.ts.map +1 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/randomators.d.ts +2 -0
- package/dist/utils/randomators.d.ts.map +1 -0
- package/dist/utils/validators.d.ts +7 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/wcds.css +1 -0
- package/dist/wcds.js +809 -0
- package/package.json +87 -0
package/dist/wcds.js
ADDED
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
import { css as b, html as d, LitElement as g } from "lit";
|
|
2
|
+
import { property as s, customElement as h, state as $ } from "lit/decorators.js";
|
|
3
|
+
const f = b`
|
|
4
|
+
:host {
|
|
5
|
+
font-family: var(
|
|
6
|
+
--wcds-font-family-sans,
|
|
7
|
+
'Plus Jakarta Sans',
|
|
8
|
+
system-ui,
|
|
9
|
+
-apple-system,
|
|
10
|
+
BlinkMacSystemFont,
|
|
11
|
+
'Segoe UI',
|
|
12
|
+
Roboto,
|
|
13
|
+
sans-serif
|
|
14
|
+
);
|
|
15
|
+
font-weight: var(--wcds-font-weight-regular, 400);
|
|
16
|
+
line-height: var(--wcds-font-line-height-normal, 1.5);
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
-moz-osx-font-smoothing: grayscale;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
*,
|
|
22
|
+
*::before,
|
|
23
|
+
*::after {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
}
|
|
26
|
+
`, C = (r) => typeof r != "string" || r === "", S = (r) => {
|
|
27
|
+
const o = Math.floor(Math.random() * 1e4);
|
|
28
|
+
return `wcds-${r}-${o}`;
|
|
29
|
+
};
|
|
30
|
+
var O = Object.defineProperty, j = Object.getOwnPropertyDescriptor, x = (r, o, a, e) => {
|
|
31
|
+
for (var t = e > 1 ? void 0 : e ? j(o, a) : o, n = r.length - 1, i; n >= 0; n--)
|
|
32
|
+
(i = r[n]) && (t = (e ? i(o, a, t) : i(t)) || t);
|
|
33
|
+
return e && t && O(o, a, t), t;
|
|
34
|
+
};
|
|
35
|
+
const k = {
|
|
36
|
+
"arrow-left": d` <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
37
|
+
<path
|
|
38
|
+
stroke="currentColor"
|
|
39
|
+
stroke-linecap="round"
|
|
40
|
+
stroke-linejoin="round"
|
|
41
|
+
stroke-width="2"
|
|
42
|
+
d="M20 12H4m0 0 6-6m-6 6 6 6"
|
|
43
|
+
/>
|
|
44
|
+
</svg>`,
|
|
45
|
+
"arrow-right": d` <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
46
|
+
<path
|
|
47
|
+
stroke="currentColor"
|
|
48
|
+
stroke-linecap="round"
|
|
49
|
+
stroke-linejoin="round"
|
|
50
|
+
stroke-width="2"
|
|
51
|
+
d="M5 12h14m0 0-6-6m6 6-6 6"
|
|
52
|
+
/>
|
|
53
|
+
</svg>`,
|
|
54
|
+
check: d`
|
|
55
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
56
|
+
<path
|
|
57
|
+
d="M4 12.6111L8.92308 17.5L20 6.5"
|
|
58
|
+
stroke="currentColor"
|
|
59
|
+
stroke-width="2"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
stroke-linejoin="round"
|
|
62
|
+
></path>
|
|
63
|
+
</svg>
|
|
64
|
+
`,
|
|
65
|
+
close: d`
|
|
66
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
67
|
+
<path
|
|
68
|
+
fill="currentColor"
|
|
69
|
+
d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6L6.4 19Z"
|
|
70
|
+
/>
|
|
71
|
+
</svg>
|
|
72
|
+
`,
|
|
73
|
+
menu: d`
|
|
74
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
75
|
+
<path fill="currentColor" d="M3 18v-2h18v2H3Zm0-5v-2h18v2H3Zm0-5V6h18v2H3Z" />
|
|
76
|
+
</svg>
|
|
77
|
+
`,
|
|
78
|
+
search: d`
|
|
79
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
80
|
+
<path
|
|
81
|
+
d="M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z"
|
|
82
|
+
stroke="currentColor"
|
|
83
|
+
stroke-width="2"
|
|
84
|
+
stroke-linecap="round"
|
|
85
|
+
stroke-linejoin="round"
|
|
86
|
+
/>
|
|
87
|
+
</svg>
|
|
88
|
+
`,
|
|
89
|
+
location: d` <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
90
|
+
<path
|
|
91
|
+
stroke="currentColor"
|
|
92
|
+
stroke-linecap="round"
|
|
93
|
+
stroke-linejoin="round"
|
|
94
|
+
stroke-width="2"
|
|
95
|
+
d="M12 21c3.5-3.6 7-6.8 7-10.8 0-4-3.1-7.2-7-7.2s-7 3.2-7 7.2 3.5 7.2 7 10.8Z"
|
|
96
|
+
/>
|
|
97
|
+
<path
|
|
98
|
+
stroke="currentColor"
|
|
99
|
+
stroke-linecap="round"
|
|
100
|
+
stroke-linejoin="round"
|
|
101
|
+
stroke-width="2"
|
|
102
|
+
d="M12 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"
|
|
103
|
+
/>
|
|
104
|
+
</svg>`
|
|
105
|
+
};
|
|
106
|
+
let m = class extends g {
|
|
107
|
+
constructor() {
|
|
108
|
+
super(...arguments), this.size = "md";
|
|
109
|
+
}
|
|
110
|
+
render() {
|
|
111
|
+
const r = k[this.icon];
|
|
112
|
+
return r ? d` <span class="wcds-icon" role="img" aria-hidden="true"> ${r} </span> ` : null;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
m.styles = [
|
|
116
|
+
f,
|
|
117
|
+
b`
|
|
118
|
+
:host {
|
|
119
|
+
--wcds-icon-size: var(--wcds-icon-size-md);
|
|
120
|
+
--wcds-icon-color: var(--wcds-icon-color-neutral);
|
|
121
|
+
|
|
122
|
+
display: inline-flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
width: var(--wcds-icon-size);
|
|
126
|
+
height: var(--wcds-icon-size);
|
|
127
|
+
line-height: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.wcds-icon {
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
width: 100%;
|
|
133
|
+
height: 100%;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
svg path {
|
|
137
|
+
width: 100%;
|
|
138
|
+
height: 100%;
|
|
139
|
+
}
|
|
140
|
+
`
|
|
141
|
+
];
|
|
142
|
+
x([
|
|
143
|
+
s({ type: String, reflect: !0 })
|
|
144
|
+
], m.prototype, "icon", 2);
|
|
145
|
+
x([
|
|
146
|
+
s({ type: String })
|
|
147
|
+
], m.prototype, "size", 2);
|
|
148
|
+
m = x([
|
|
149
|
+
h("wcds-icon")
|
|
150
|
+
], m);
|
|
151
|
+
var P = Object.defineProperty, E = Object.getOwnPropertyDescriptor, v = (r, o, a, e) => {
|
|
152
|
+
for (var t = e > 1 ? void 0 : e ? E(o, a) : o, n = r.length - 1, i; n >= 0; n--)
|
|
153
|
+
(i = r[n]) && (t = (e ? i(o, a, t) : i(t)) || t);
|
|
154
|
+
return e && t && P(o, a, t), t;
|
|
155
|
+
};
|
|
156
|
+
let c = class extends g {
|
|
157
|
+
constructor() {
|
|
158
|
+
super(...arguments), this.id = S("button"), this.size = "md", this.variant = "solid", this.colorScheme = "primary", this.type = "button", this.disabled = !1;
|
|
159
|
+
}
|
|
160
|
+
handleClick(r) {
|
|
161
|
+
this.dispatchEvent(
|
|
162
|
+
new CustomEvent("click", {
|
|
163
|
+
detail: r,
|
|
164
|
+
bubbles: !0,
|
|
165
|
+
composed: !0
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
render() {
|
|
170
|
+
return d`
|
|
171
|
+
<button @click=${this.handleClick} type=${this.type} ?disabled=${this.disabled}>
|
|
172
|
+
${this.iconLeft && d`<wcds-icon .icon=${this.iconLeft} />`}
|
|
173
|
+
<slot></slot>
|
|
174
|
+
${this.iconRight && d`<wcds-icon .icon=${this.iconRight} />`}
|
|
175
|
+
</button>
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
c.styles = [
|
|
180
|
+
f,
|
|
181
|
+
b`
|
|
182
|
+
button {
|
|
183
|
+
display: inline-flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: center;
|
|
186
|
+
padding: var(--wcds-button-padding);
|
|
187
|
+
border-radius: var(--wcds-button-radius);
|
|
188
|
+
font-size: var(--wcds-button-font-size);
|
|
189
|
+
font-weight: 500;
|
|
190
|
+
background-color: var(--wcds-button-bg-color);
|
|
191
|
+
color: var(--wcds-button-fg-color);
|
|
192
|
+
border: 1px solid var(--wcds-button-border-color);
|
|
193
|
+
gap: var(--wcds-spacing-xs);
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
transition: all 0.15s ease-out;
|
|
196
|
+
box-sizing: border-box;
|
|
197
|
+
text-transform: uppercase;
|
|
198
|
+
letter-spacing: 0.02em;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
button:disabled {
|
|
202
|
+
cursor: not-allowed;
|
|
203
|
+
opacity: 0.5;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
button:not([disabled]):hover {
|
|
207
|
+
filter: brightness(1.1);
|
|
208
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
button:not([disabled]):active {
|
|
212
|
+
transform: scale(0.98);
|
|
213
|
+
box-shadow: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Solid variant */
|
|
217
|
+
:host([variant='solid'][colorScheme='primary']),
|
|
218
|
+
:host([variant='solid']:not([colorScheme])),
|
|
219
|
+
:host(:not([variant])[colorScheme='primary']),
|
|
220
|
+
:host(:not([variant]):not([colorScheme])) {
|
|
221
|
+
--wcds-button-bg-color: var(--wcds-button-solid-primary-bg);
|
|
222
|
+
--wcds-button-fg-color: var(--wcds-button-solid-primary-fg);
|
|
223
|
+
--wcds-button-border-color: var(--wcds-button-solid-primary-border);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
:host([variant='solid'][colorScheme='secondary']),
|
|
227
|
+
:host(:not([variant])[colorScheme='secondary']) {
|
|
228
|
+
--wcds-button-bg-color: var(--wcds-button-solid-secondary-bg);
|
|
229
|
+
--wcds-button-fg-color: var(--wcds-button-solid-secondary-fg);
|
|
230
|
+
--wcds-button-border-color: var(--wcds-button-solid-secondary-border);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
:host([variant='solid'][colorScheme='neutral']),
|
|
234
|
+
:host(:not([variant])[colorScheme='neutral']) {
|
|
235
|
+
--wcds-button-bg-color: var(--wcds-button-solid-neutral-bg);
|
|
236
|
+
--wcds-button-fg-color: var(--wcds-button-solid-neutral-fg);
|
|
237
|
+
--wcds-button-border-color: var(--wcds-button-solid-neutral-border);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Outlined variant */
|
|
241
|
+
:host([variant='outlined'][colorScheme='primary']),
|
|
242
|
+
:host([variant='outlined']:not([colorScheme])) {
|
|
243
|
+
--wcds-button-bg-color: var(--wcds-button-outlined-primary-bg);
|
|
244
|
+
--wcds-button-fg-color: var(--wcds-button-outlined-primary-fg);
|
|
245
|
+
--wcds-button-border-color: var(--wcds-button-outlined-primary-border);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
:host([variant='outlined'][colorScheme='primary']) button:not([disabled]):hover,
|
|
249
|
+
:host([variant='outlined']:not([colorScheme])) button:not([disabled]):hover {
|
|
250
|
+
background-color: var(--wcds-button-outlined-primary-bg-hover);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
:host([variant='outlined'][colorScheme='secondary']) {
|
|
254
|
+
--wcds-button-bg-color: var(--wcds-button-outlined-secondary-bg);
|
|
255
|
+
--wcds-button-fg-color: var(--wcds-button-outlined-secondary-fg);
|
|
256
|
+
--wcds-button-border-color: var(--wcds-button-outlined-secondary-border);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
:host([variant='outlined'][colorScheme='secondary']) button:not([disabled]):hover {
|
|
260
|
+
background-color: var(--wcds-button-outlined-secondary-bg-hover);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
:host([variant='outlined'][colorScheme='neutral']) {
|
|
264
|
+
--wcds-button-bg-color: var(--wcds-button-outlined-neutral-bg);
|
|
265
|
+
--wcds-button-fg-color: var(--wcds-button-outlined-neutral-fg);
|
|
266
|
+
--wcds-button-border-color: var(--wcds-button-outlined-neutral-border);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
:host([variant='outlined'][colorScheme='neutral']) button:not([disabled]):hover {
|
|
270
|
+
background-color: var(--wcds-button-outlined-neutral-bg-hover);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* Ghost variant */
|
|
274
|
+
:host([variant='ghost'][colorScheme='primary']),
|
|
275
|
+
:host([variant='ghost']:not([colorScheme])) {
|
|
276
|
+
--wcds-button-bg-color: var(--wcds-button-ghost-primary-bg);
|
|
277
|
+
--wcds-button-fg-color: var(--wcds-button-ghost-primary-fg);
|
|
278
|
+
--wcds-button-border-color: var(--wcds-button-ghost-primary-border);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
:host([variant='ghost'][colorScheme='primary']) button:not([disabled]):hover,
|
|
282
|
+
:host([variant='ghost']:not([colorScheme])) button:not([disabled]):hover {
|
|
283
|
+
background-color: var(--wcds-button-ghost-primary-bg-hover);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
:host([variant='ghost'][colorScheme='secondary']) {
|
|
287
|
+
--wcds-button-bg-color: var(--wcds-button-ghost-secondary-bg);
|
|
288
|
+
--wcds-button-fg-color: var(--wcds-button-ghost-secondary-fg);
|
|
289
|
+
--wcds-button-border-color: var(--wcds-button-ghost-secondary-border);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
:host([variant='ghost'][colorScheme='secondary']) button:not([disabled]):hover {
|
|
293
|
+
background-color: var(--wcds-button-ghost-secondary-bg-hover);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
:host([variant='ghost'][colorScheme='neutral']) {
|
|
297
|
+
--wcds-button-bg-color: var(--wcds-button-ghost-neutral-bg);
|
|
298
|
+
--wcds-button-fg-color: var(--wcds-button-ghost-neutral-fg);
|
|
299
|
+
--wcds-button-border-color: var(--wcds-button-ghost-neutral-border);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
:host([variant='ghost'][colorScheme='neutral']) button:not([disabled]):hover {
|
|
303
|
+
background-color: var(--wcds-button-ghost-neutral-bg-hover);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* Icon styling */
|
|
307
|
+
wcds-icon {
|
|
308
|
+
--wcds-icon-size: var(--wcds-button-icon-size, 1em);
|
|
309
|
+
color: inherit;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Size: sm */
|
|
313
|
+
:host([size='sm']) {
|
|
314
|
+
--wcds-button-padding: var(--wcds-button-size-sm-padding)
|
|
315
|
+
calc(var(--wcds-button-size-sm-padding) * 2);
|
|
316
|
+
--wcds-button-radius: var(--wcds-button-size-sm-radius);
|
|
317
|
+
--wcds-button-font-size: var(--wcds-button-size-sm-font-size);
|
|
318
|
+
--wcds-button-icon-size: var(--wcds-button-size-sm-icon-size);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* Size: md */
|
|
322
|
+
:host([size='md']) {
|
|
323
|
+
--wcds-button-padding: var(--wcds-button-size-md-padding);
|
|
324
|
+
--wcds-button-radius: var(--wcds-button-size-md-radius);
|
|
325
|
+
--wcds-button-font-size: var(--wcds-button-size-md-font-size);
|
|
326
|
+
--wcds-button-icon-size: var(--wcds-button-size-md-icon-size);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* Size: lg */
|
|
330
|
+
:host([size='lg']) {
|
|
331
|
+
--wcds-button-padding: var(--wcds-button-size-lg-padding);
|
|
332
|
+
--wcds-button-radius: var(--wcds-button-size-lg-radius);
|
|
333
|
+
--wcds-button-font-size: var(--wcds-button-size-lg-font-size);
|
|
334
|
+
--wcds-button-icon-size: var(--wcds-button-size-lg-icon-size);
|
|
335
|
+
}
|
|
336
|
+
`
|
|
337
|
+
];
|
|
338
|
+
v([
|
|
339
|
+
s({ type: String, reflect: !0 })
|
|
340
|
+
], c.prototype, "id", 2);
|
|
341
|
+
v([
|
|
342
|
+
s({ type: String, reflect: !0 })
|
|
343
|
+
], c.prototype, "size", 2);
|
|
344
|
+
v([
|
|
345
|
+
s({ type: String, reflect: !0 })
|
|
346
|
+
], c.prototype, "variant", 2);
|
|
347
|
+
v([
|
|
348
|
+
s({ type: String, reflect: !0, attribute: "colorScheme" })
|
|
349
|
+
], c.prototype, "colorScheme", 2);
|
|
350
|
+
v([
|
|
351
|
+
s({ type: String, reflect: !0 })
|
|
352
|
+
], c.prototype, "type", 2);
|
|
353
|
+
v([
|
|
354
|
+
s({ type: String })
|
|
355
|
+
], c.prototype, "iconLeft", 2);
|
|
356
|
+
v([
|
|
357
|
+
s({ type: String })
|
|
358
|
+
], c.prototype, "iconRight", 2);
|
|
359
|
+
v([
|
|
360
|
+
s({ type: Boolean, reflect: !0 })
|
|
361
|
+
], c.prototype, "disabled", 2);
|
|
362
|
+
c = v([
|
|
363
|
+
h("wcds-button")
|
|
364
|
+
], c);
|
|
365
|
+
const D = [
|
|
366
|
+
"arrow-left",
|
|
367
|
+
"arrow-right",
|
|
368
|
+
"check",
|
|
369
|
+
"close",
|
|
370
|
+
"menu",
|
|
371
|
+
"search",
|
|
372
|
+
"location"
|
|
373
|
+
], W = ["sm", "md", "lg"], H = ["solid", "outlined", "ghost"], q = ["primary", "secondary", "neutral"], U = ["button", "submit", "reset"], Y = ["plain", "outlined", "elevated"], F = ["circular", "rounded", "square"];
|
|
374
|
+
var I = Object.defineProperty, B = Object.getOwnPropertyDescriptor, w = (r, o, a, e) => {
|
|
375
|
+
for (var t = e > 1 ? void 0 : e ? B(o, a) : o, n = r.length - 1, i; n >= 0; n--)
|
|
376
|
+
(i = r[n]) && (t = (e ? i(o, a, t) : i(t)) || t);
|
|
377
|
+
return e && t && I(o, a, t), t;
|
|
378
|
+
};
|
|
379
|
+
let l = class extends g {
|
|
380
|
+
constructor() {
|
|
381
|
+
super(...arguments), this.id = S("input"), this.value = "", this.size = "md", this.disabled = !1;
|
|
382
|
+
}
|
|
383
|
+
_hasIcon() {
|
|
384
|
+
return this.icon !== void 0 && !C(this.icon) && D.includes(this.icon);
|
|
385
|
+
}
|
|
386
|
+
_onInput(r) {
|
|
387
|
+
const o = r.target;
|
|
388
|
+
this.value = o.value, this.dispatchEvent(
|
|
389
|
+
new CustomEvent("input", {
|
|
390
|
+
detail: { value: this.value },
|
|
391
|
+
bubbles: !0,
|
|
392
|
+
composed: !0
|
|
393
|
+
})
|
|
394
|
+
), this.error && this.dispatchEvent(new CustomEvent("clear-error"));
|
|
395
|
+
}
|
|
396
|
+
_onChange() {
|
|
397
|
+
this.dispatchEvent(
|
|
398
|
+
new CustomEvent("change", {
|
|
399
|
+
detail: { value: this.value },
|
|
400
|
+
bubbles: !0,
|
|
401
|
+
composed: !0
|
|
402
|
+
})
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
updated(r) {
|
|
406
|
+
super.updated(r);
|
|
407
|
+
const o = this.shadowRoot?.querySelector("input");
|
|
408
|
+
o && (r.has("value") && o.value !== this.value && (o.value = this.value), r.has("error") && (this.error ? o.setCustomValidity(this.error) : o.setCustomValidity("")));
|
|
409
|
+
}
|
|
410
|
+
render() {
|
|
411
|
+
try {
|
|
412
|
+
return d`
|
|
413
|
+
<div class="field">
|
|
414
|
+
<span class="input-wrapper">
|
|
415
|
+
${this._hasIcon() && this.icon ? d`<span class="icon"><wcds-icon .icon=${this.icon} /></span>` : null}
|
|
416
|
+
<input
|
|
417
|
+
@input=${this._onInput}
|
|
418
|
+
@change=${this._onChange}
|
|
419
|
+
.value=${this.value}
|
|
420
|
+
?disabled=${this.disabled}
|
|
421
|
+
.id=${this.id}
|
|
422
|
+
.placeholder=${this.placeholder ?? " "}
|
|
423
|
+
aria-invalid=${this.error ? "true" : "false"}
|
|
424
|
+
type="text"
|
|
425
|
+
/>
|
|
426
|
+
</span>
|
|
427
|
+
|
|
428
|
+
<label for=${this.id}>${this.label}</label>
|
|
429
|
+
|
|
430
|
+
<span class="error-text">${this.error ?? ""}</span>
|
|
431
|
+
</div>
|
|
432
|
+
`;
|
|
433
|
+
} catch (r) {
|
|
434
|
+
return console.error(r), d`<div class="error-box">Error: ${r.message}</div>`;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
l.styles = [
|
|
439
|
+
f,
|
|
440
|
+
b`
|
|
441
|
+
:host {
|
|
442
|
+
--wcds-input-padding: var(--wcds-input-text-size-md-padding);
|
|
443
|
+
--wcds-input-border-radius: var(--wcds-input-text-border-radius);
|
|
444
|
+
--wcds-input-border-color-default: var(--wcds-input-text-border-color-default);
|
|
445
|
+
--wcds-input-border-color-focus: var(--wcds-input-text-border-color-focus);
|
|
446
|
+
--wcds-input-box-shadow: 5px 5px 14px #ced8d7, -2px -2px 14px white;
|
|
447
|
+
--wcds-icon-size: var(--wcds-icon-size-md);
|
|
448
|
+
--wcds-icon-color: var(--wcds-icon-color-neutral);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
input {
|
|
452
|
+
padding: calc(1.2 * var(--wcds-input-padding));
|
|
453
|
+
border-radius: var(--wcds-input-border-radius);
|
|
454
|
+
border: var(--wcds-input-text-border-width-default) solid
|
|
455
|
+
var(--wcds-input-border-color-default);
|
|
456
|
+
box-shadow: none;
|
|
457
|
+
transition: box-shadow 0.3s ease-out, border-color 0.3s ease-out;
|
|
458
|
+
width: 100%;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
input:focus {
|
|
462
|
+
outline: none;
|
|
463
|
+
border-color: var(--wcds-input-border-color-focus);
|
|
464
|
+
box-shadow: var(--wcds-input-box-shadow);
|
|
465
|
+
transition: box-shadow 0.3s ease-out, border-color 0.3s ease-in-out;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
input:invalid {
|
|
469
|
+
border-color: var(--wcds-color-error-content);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
:host([size='sm']) {
|
|
473
|
+
--wcds-input-padding: var(--wcds-input-text-size-sm-padding);
|
|
474
|
+
--wcds-icon-size: var(--wcds-icon-size-sm);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
:host([size='lg']) {
|
|
478
|
+
--wcds-input-padding: var(--wcds-input-text-size-lg-padding);
|
|
479
|
+
--wcds-icon-size: var(--wcds-icon-size-lg);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
:host([size='sm']) wcds-icon {
|
|
483
|
+
--wcds-icon-size: var(--wcds-icon-size-sm);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
:host([size='lg']) wcds-icon {
|
|
487
|
+
--wcds-icon-size: var(--wcds-icon-size-lg);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
:host([icon]) input {
|
|
491
|
+
padding-left: calc(2 * var(--wcds-input-padding) + var(--wcds-icon-size));
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
label {
|
|
495
|
+
display: none;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.field {
|
|
499
|
+
position: relative;
|
|
500
|
+
display: flex;
|
|
501
|
+
flex-direction: column;
|
|
502
|
+
gap: var(--wcds-spacing-xs);
|
|
503
|
+
width: 100%;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.input-wrapper {
|
|
507
|
+
position: relative;
|
|
508
|
+
display: flex;
|
|
509
|
+
align-items: center;
|
|
510
|
+
width: 100%;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.error-text {
|
|
514
|
+
color: var(--wcds-color-error-content);
|
|
515
|
+
font-size: var(--wcds-text-size-sm);
|
|
516
|
+
margin-left: var(--wcds-spacing-md);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
wcds-icon {
|
|
520
|
+
position: absolute;
|
|
521
|
+
top: 50%;
|
|
522
|
+
left: var(--wcds-input-padding);
|
|
523
|
+
transform: translateY(-50%);
|
|
524
|
+
color: var(--wcds-input-icon-color, var(--wcds-icon-color-neutral));
|
|
525
|
+
}
|
|
526
|
+
`
|
|
527
|
+
];
|
|
528
|
+
w([
|
|
529
|
+
s({ type: String, reflect: !0 })
|
|
530
|
+
], l.prototype, "id", 2);
|
|
531
|
+
w([
|
|
532
|
+
s({ type: String, reflect: !0 })
|
|
533
|
+
], l.prototype, "value", 2);
|
|
534
|
+
w([
|
|
535
|
+
s({ type: String, reflect: !0 })
|
|
536
|
+
], l.prototype, "size", 2);
|
|
537
|
+
w([
|
|
538
|
+
s({ type: String })
|
|
539
|
+
], l.prototype, "label", 2);
|
|
540
|
+
w([
|
|
541
|
+
s({ type: String })
|
|
542
|
+
], l.prototype, "placeholder", 2);
|
|
543
|
+
w([
|
|
544
|
+
s({ type: String, reflect: !0 })
|
|
545
|
+
], l.prototype, "icon", 2);
|
|
546
|
+
w([
|
|
547
|
+
s({ type: Boolean, reflect: !0 })
|
|
548
|
+
], l.prototype, "disabled", 2);
|
|
549
|
+
w([
|
|
550
|
+
s({ type: String, reflect: !0 })
|
|
551
|
+
], l.prototype, "error", 2);
|
|
552
|
+
l = w([
|
|
553
|
+
h("wcds-input")
|
|
554
|
+
], l);
|
|
555
|
+
var L = Object.getOwnPropertyDescriptor, M = (r, o, a, e) => {
|
|
556
|
+
for (var t = e > 1 ? void 0 : e ? L(o, a) : o, n = r.length - 1, i; n >= 0; n--)
|
|
557
|
+
(i = r[n]) && (t = i(t) || t);
|
|
558
|
+
return t;
|
|
559
|
+
};
|
|
560
|
+
let z = class extends g {
|
|
561
|
+
render() {
|
|
562
|
+
return d`
|
|
563
|
+
<slot name="header"></slot>
|
|
564
|
+
<slot></slot>
|
|
565
|
+
<slot name="footer"></slot>
|
|
566
|
+
`;
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
z.styles = [
|
|
570
|
+
f,
|
|
571
|
+
b`
|
|
572
|
+
:host {
|
|
573
|
+
display: block;
|
|
574
|
+
box-sizing: border-box;
|
|
575
|
+
transition: box-shadow 0.3s ease-in-out;
|
|
576
|
+
display: flex;
|
|
577
|
+
align-items: center;
|
|
578
|
+
gap: var(--wcds-spacing-lg);
|
|
579
|
+
padding: var(--wcds-card-padding);
|
|
580
|
+
box-sizing: border-box;
|
|
581
|
+
background-color: var(--wcds-card-bg-color);
|
|
582
|
+
border: 1px solid var(--wcds-card-border-color);
|
|
583
|
+
border-radius: var(--wcds-card-radius);
|
|
584
|
+
box-shadow: var(--wcds-card-shadow);
|
|
585
|
+
min-height: 64px;
|
|
586
|
+
|
|
587
|
+
--wcds-card-padding: var(--wcds-card-padding-default);
|
|
588
|
+
--wcds-card-radius: var(--wcds-card-border-radius-default);
|
|
589
|
+
--wcds-card-bg-color: var(--wcds-card-background-color-default);
|
|
590
|
+
--wcds-card-border-color: var(--wcds-card-border-color-default);
|
|
591
|
+
--wcds-card-shadow: var(--wcds-card-shadow-plain);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
slot[name='header'],
|
|
595
|
+
slot[name='footer'] {
|
|
596
|
+
display: block;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
slot:not([name]) {
|
|
600
|
+
display: flex;
|
|
601
|
+
flex: 1;
|
|
602
|
+
}
|
|
603
|
+
`
|
|
604
|
+
];
|
|
605
|
+
z = M([
|
|
606
|
+
h("wcds-card")
|
|
607
|
+
], z);
|
|
608
|
+
var A = Object.defineProperty, R = Object.getOwnPropertyDescriptor, _ = (r, o, a, e) => {
|
|
609
|
+
for (var t = e > 1 ? void 0 : e ? R(o, a) : o, n = r.length - 1, i; n >= 0; n--)
|
|
610
|
+
(i = r[n]) && (t = (e ? i(o, a, t) : i(t)) || t);
|
|
611
|
+
return e && t && A(o, a, t), t;
|
|
612
|
+
};
|
|
613
|
+
let y = class extends g {
|
|
614
|
+
constructor() {
|
|
615
|
+
super(...arguments), this.variant = "info";
|
|
616
|
+
}
|
|
617
|
+
render() {
|
|
618
|
+
return d` <span class="badge">
|
|
619
|
+
<slot></slot>
|
|
620
|
+
</span>`;
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
y.styles = [
|
|
624
|
+
f,
|
|
625
|
+
b`
|
|
626
|
+
:host {
|
|
627
|
+
display: inline-flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
justify-content: center;
|
|
630
|
+
box-sizing: border-box;
|
|
631
|
+
|
|
632
|
+
--wcds-badge-padding: var(--wcds-badge-appearance-padding-vertical)
|
|
633
|
+
var(--wcds-badge-appearance-padding-horizontal);
|
|
634
|
+
--wcds-badge-radius: var(--wcds-badge-appearance-radius);
|
|
635
|
+
--wcds-badge-font-size: var(--wcds-badge-appearance-font-size);
|
|
636
|
+
--wcds-badge-bg: var(--wcds-badge-variant-info-bg);
|
|
637
|
+
--wcds-badge-fg: var(--wcds-badge-variant-info-fg);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
:host([variant='success']) {
|
|
641
|
+
--wcds-badge-bg: var(--wcds-badge-variant-success-bg);
|
|
642
|
+
--wcds-badge-fg: var(--wcds-badge-variant-success-fg);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
:host([variant='warning']) {
|
|
646
|
+
--wcds-badge-bg: var(--wcds-badge-variant-warning-bg);
|
|
647
|
+
--wcds-badge-fg: var(--wcds-badge-variant-warning-fg);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
:host([variant='error']) {
|
|
651
|
+
--wcds-badge-bg: var(--wcds-badge-variant-error-bg);
|
|
652
|
+
--wcds-badge-fg: var(--wcds-badge-variant-error-fg);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.badge {
|
|
656
|
+
padding: var(--wcds-badge-padding);
|
|
657
|
+
border-radius: var(--wcds-badge-radius);
|
|
658
|
+
font-size: var(--wcds-badge-font-size);
|
|
659
|
+
background: var(--wcds-badge-bg);
|
|
660
|
+
color: var(--wcds-badge-fg);
|
|
661
|
+
border: 1px solid color-mix(in srgb, var(--wcds-badge-fg) 25%, transparent);
|
|
662
|
+
font-weight: 600;
|
|
663
|
+
line-height: 1;
|
|
664
|
+
letter-spacing: 0.01em;
|
|
665
|
+
white-space: nowrap;
|
|
666
|
+
}
|
|
667
|
+
`
|
|
668
|
+
];
|
|
669
|
+
_([
|
|
670
|
+
s({ type: String, reflect: !0 })
|
|
671
|
+
], y.prototype, "variant", 2);
|
|
672
|
+
y = _([
|
|
673
|
+
h("wcds-badge")
|
|
674
|
+
], y);
|
|
675
|
+
var T = Object.defineProperty, N = Object.getOwnPropertyDescriptor, p = (r, o, a, e) => {
|
|
676
|
+
for (var t = e > 1 ? void 0 : e ? N(o, a) : o, n = r.length - 1, i; n >= 0; n--)
|
|
677
|
+
(i = r[n]) && (t = (e ? i(o, a, t) : i(t)) || t);
|
|
678
|
+
return e && t && T(o, a, t), t;
|
|
679
|
+
};
|
|
680
|
+
let u = class extends g {
|
|
681
|
+
constructor() {
|
|
682
|
+
super(...arguments), this.variant = "circular", this.size = "md", this.imageError = !1;
|
|
683
|
+
}
|
|
684
|
+
handleError() {
|
|
685
|
+
this.imageError = !0;
|
|
686
|
+
}
|
|
687
|
+
get fallbackText() {
|
|
688
|
+
const r = this.name ?? this.alt;
|
|
689
|
+
return r && r.trim().split(/\s+/).map((a) => a[0] ?? "").join("").slice(0, 2).toUpperCase() || "?";
|
|
690
|
+
}
|
|
691
|
+
render() {
|
|
692
|
+
const r = !!this.src && !this.imageError, o = this.alt ?? this.name ?? "Avatar";
|
|
693
|
+
return d`
|
|
694
|
+
<div class="avatar" aria-label=${o} role="img">
|
|
695
|
+
${r ? d`<img src=${this.src} alt=${o} @error=${this.handleError} />` : d`<div class="fallback"><slot>${this.fallbackText}</slot></div>`}
|
|
696
|
+
</div>
|
|
697
|
+
`;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
u.styles = [
|
|
701
|
+
f,
|
|
702
|
+
b`
|
|
703
|
+
:host {
|
|
704
|
+
--wcds-avatar-size: var(--wcds-avatar-size-md);
|
|
705
|
+
--wcds-avatar-radius: var(--wcds-avatar-shape-circular);
|
|
706
|
+
--wcds-avatar-bg: var(--wcds-avatar-bg-default);
|
|
707
|
+
--wcds-avatar-fg: var(--wcds-avatar-fg-default);
|
|
708
|
+
--wcds-avatar-font-size: var(--wcds-avatar-font-size-md);
|
|
709
|
+
|
|
710
|
+
display: inline-flex;
|
|
711
|
+
align-items: center;
|
|
712
|
+
justify-content: center;
|
|
713
|
+
box-sizing: border-box;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
:host([variant='rounded']) {
|
|
717
|
+
--wcds-avatar-radius: var(--wcds-avatar-shape-rounded);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
:host([variant='square']) {
|
|
721
|
+
--wcds-avatar-radius: var(--wcds-avatar-shape-square);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
:host([size='sm']) {
|
|
725
|
+
--wcds-avatar-size: var(--wcds-avatar-size-sm);
|
|
726
|
+
--wcds-avatar-font-size: var(--wcds-avatar-font-size-sm);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
:host([size='md']) {
|
|
730
|
+
--wcds-avatar-size: var(--wcds-avatar-size-md);
|
|
731
|
+
--wcds-avatar-font-size: var(--wcds-avatar-font-size-md);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
:host([size='lg']) {
|
|
735
|
+
--wcds-avatar-size: var(--wcds-avatar-size-lg);
|
|
736
|
+
--wcds-avatar-font-size: var(--wcds-avatar-font-size-lg);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.avatar {
|
|
740
|
+
width: var(--wcds-avatar-size);
|
|
741
|
+
height: var(--wcds-avatar-size);
|
|
742
|
+
border-radius: var(--wcds-avatar-radius);
|
|
743
|
+
background: var(--wcds-avatar-bg);
|
|
744
|
+
color: var(--wcds-avatar-fg);
|
|
745
|
+
font-size: var(--wcds-avatar-font-size);
|
|
746
|
+
font-weight: 600;
|
|
747
|
+
letter-spacing: 0.02em;
|
|
748
|
+
text-transform: uppercase;
|
|
749
|
+
display: inline-flex;
|
|
750
|
+
align-items: center;
|
|
751
|
+
justify-content: center;
|
|
752
|
+
overflow: hidden;
|
|
753
|
+
user-select: none;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.avatar img {
|
|
757
|
+
width: 100%;
|
|
758
|
+
height: 100%;
|
|
759
|
+
display: block;
|
|
760
|
+
object-fit: cover;
|
|
761
|
+
border-radius: inherit;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
.fallback {
|
|
765
|
+
width: 100%;
|
|
766
|
+
height: 100%;
|
|
767
|
+
display: inline-flex;
|
|
768
|
+
align-items: center;
|
|
769
|
+
justify-content: center;
|
|
770
|
+
}
|
|
771
|
+
`
|
|
772
|
+
];
|
|
773
|
+
p([
|
|
774
|
+
s({ type: String })
|
|
775
|
+
], u.prototype, "src", 2);
|
|
776
|
+
p([
|
|
777
|
+
s({ type: String })
|
|
778
|
+
], u.prototype, "alt", 2);
|
|
779
|
+
p([
|
|
780
|
+
s({ type: String })
|
|
781
|
+
], u.prototype, "name", 2);
|
|
782
|
+
p([
|
|
783
|
+
s({ type: String, reflect: !0 })
|
|
784
|
+
], u.prototype, "variant", 2);
|
|
785
|
+
p([
|
|
786
|
+
s({ type: String, reflect: !0 })
|
|
787
|
+
], u.prototype, "size", 2);
|
|
788
|
+
p([
|
|
789
|
+
$()
|
|
790
|
+
], u.prototype, "imageError", 2);
|
|
791
|
+
u = p([
|
|
792
|
+
h("wcds-avatar")
|
|
793
|
+
], u);
|
|
794
|
+
export {
|
|
795
|
+
F as AVATAR_VARIANT,
|
|
796
|
+
U as BUTTON_TYPE,
|
|
797
|
+
H as BUTTON_VARIANT,
|
|
798
|
+
Y as CARD_VARIANT,
|
|
799
|
+
q as COLOR_SCHEME,
|
|
800
|
+
D as ICONS,
|
|
801
|
+
W as SIZE,
|
|
802
|
+
u as WCDSAvatar,
|
|
803
|
+
y as WCDSBadge,
|
|
804
|
+
c as WCDSButton,
|
|
805
|
+
z as WCDSCard,
|
|
806
|
+
m as WCDSIcon,
|
|
807
|
+
l as WCDSInput,
|
|
808
|
+
f as baseStyles
|
|
809
|
+
};
|