ui-svelte 0.2.4 → 0.2.6
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/assets/country-flags.d.ts +1 -0
- package/dist/assets/country-flags.js +1612 -0
- package/dist/charts/ArcChart.svelte +291 -48
- package/dist/charts/ArcChart.svelte.d.ts +32 -1
- package/dist/charts/Candlestick.svelte +663 -115
- package/dist/charts/Candlestick.svelte.d.ts +40 -0
- package/dist/charts/css/arc-chart.css +76 -6
- package/dist/charts/css/candlestick.css +234 -11
- package/dist/control/Button.svelte +3 -1
- package/dist/control/Button.svelte.d.ts +1 -0
- package/dist/control/IconButton.svelte +3 -1
- package/dist/control/IconButton.svelte.d.ts +1 -0
- package/dist/control/ToggleGroup.svelte +82 -0
- package/dist/control/ToggleGroup.svelte.d.ts +20 -0
- package/dist/control/css/toggle-group.css +85 -0
- package/dist/css/base.css +23 -43
- package/dist/css/utilities.css +45 -0
- package/dist/display/AvatarGroup.svelte +59 -0
- package/dist/display/AvatarGroup.svelte.d.ts +17 -0
- package/dist/display/Code.svelte +14 -7
- package/dist/display/Code.svelte.d.ts +1 -0
- package/dist/display/Section.svelte +1 -1
- package/dist/display/css/avatar-group.css +46 -0
- package/dist/display/css/avatar.css +1 -10
- package/dist/display/css/badge.css +14 -11
- package/dist/form/ComboBox.svelte.d.ts +1 -1
- package/dist/form/PhoneField.svelte +8 -4
- package/dist/form/Select.svelte.d.ts +1 -1
- package/dist/index.css +43 -21
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/navigation/BottomNav.svelte +43 -16
- package/dist/navigation/NavMenu.svelte +25 -4
- package/dist/navigation/SideNav.svelte +20 -2
- package/dist/navigation/SideNav.svelte.d.ts +2 -0
- package/dist/navigation/css/bottom-nav.css +139 -15
- package/dist/navigation/css/nav-menu.css +192 -7
- package/dist/navigation/css/side-nav.css +80 -0
- package/dist/navigation/css/tabs.css +4 -4
- package/dist/utils/popover.js +6 -6
- package/package.json +2 -2
- /package/dist/{form/js → assets}/countries.d.ts +0 -0
- /package/dist/{form/js → assets}/countries.js +0 -0
- /package/dist/{form/js → assets}/phone-examples.d.ts +0 -0
- /package/dist/{form/js → assets}/phone-examples.js +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.toggle-group {
|
|
3
|
+
@apply flex w-fit rounded-ui bg-muted p-1;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.toggle-group.is-vertical {
|
|
7
|
+
@apply flex-col;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.toggle-group-item {
|
|
11
|
+
@apply relative flex items-center justify-center flex-nowrap;
|
|
12
|
+
@apply font-medium whitespace-nowrap;
|
|
13
|
+
@apply rounded-ui outline-none;
|
|
14
|
+
@apply cursor-pointer select-none;
|
|
15
|
+
@apply transition-all duration-200;
|
|
16
|
+
@apply disabled:cursor-not-allowed disabled:opacity-50;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.toggle-group-item.is-xs {
|
|
20
|
+
@apply h-6 gap-2 px-2 text-xs;
|
|
21
|
+
|
|
22
|
+
.icon {
|
|
23
|
+
@apply h-4 w-auto;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.toggle-group-item.is-sm {
|
|
28
|
+
@apply h-8 gap-2 px-2 text-xs;
|
|
29
|
+
|
|
30
|
+
.icon {
|
|
31
|
+
@apply h-4 w-auto;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.toggle-group-item.is-md {
|
|
36
|
+
@apply h-10 gap-3 px-3 text-sm;
|
|
37
|
+
|
|
38
|
+
.icon {
|
|
39
|
+
@apply h-5 w-auto;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.toggle-group-item.is-lg {
|
|
44
|
+
@apply h-12 gap-3 px-4 text-lg;
|
|
45
|
+
|
|
46
|
+
.icon {
|
|
47
|
+
@apply h-6 w-auto;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.toggle-group-item.is-active {
|
|
52
|
+
@apply bg-background text-on-background shadow-sm;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.toggle-group-item:not(.is-active) {
|
|
56
|
+
@apply text-on-muted hover:text-on-background;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.toggle-group.is-wide {
|
|
60
|
+
@apply w-full;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.toggle-group.is-wide .toggle-group-item {
|
|
64
|
+
@apply flex-1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Primary variant */
|
|
68
|
+
.toggle-group.is-primary .toggle-group-item.is-active {
|
|
69
|
+
@apply bg-primary text-on-primary;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Secondary variant */
|
|
73
|
+
.toggle-group.is-secondary .toggle-group-item.is-active {
|
|
74
|
+
@apply bg-secondary text-on-secondary;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Outlined variant */
|
|
78
|
+
.toggle-group.is-outlined {
|
|
79
|
+
@apply bg-transparent inset-ring inset-ring-muted;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.toggle-group.is-outlined .toggle-group-item.is-active {
|
|
83
|
+
@apply bg-muted text-on-muted;
|
|
84
|
+
}
|
|
85
|
+
}
|
package/dist/css/base.css
CHANGED
|
@@ -4,13 +4,6 @@
|
|
|
4
4
|
@apply bg-background text-on-background;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
body:has(#popover) {
|
|
8
|
-
overflow: hidden !important;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
body:has(#popover).had-scroll {
|
|
12
|
-
padding-right: var(--scrollbar-size, 6px) !important;
|
|
13
|
-
}
|
|
14
7
|
|
|
15
8
|
::-webkit-scrollbar {
|
|
16
9
|
width: var(--scrollbar-size, 6px);
|
|
@@ -30,15 +23,16 @@
|
|
|
30
23
|
@supports not selector(::-webkit-scrollbar) {
|
|
31
24
|
* {
|
|
32
25
|
scrollbar-width: thin;
|
|
33
|
-
scrollbar-color: color-mix(in oklch, currentColor 80%, transparent)
|
|
26
|
+
scrollbar-color: color-mix(in oklch, currentColor 80%, transparent)
|
|
27
|
+
color-mix(in oklch, currentColor 20%, transparent);
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
body {
|
|
37
|
-
scrollbar-color: color-mix(in oklch, currentColor 80%, transparent)
|
|
31
|
+
scrollbar-color: color-mix(in oklch, currentColor 80%, transparent)
|
|
32
|
+
color-mix(in oklch, currentColor 20%, transparent);
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
/* Base headings - responsive typography without margins */
|
|
42
36
|
h1 {
|
|
43
37
|
@apply font-extrabold tracking-tight;
|
|
44
38
|
@apply text-[1.875rem] md:text-4xl lg:text-5xl;
|
|
@@ -75,7 +69,6 @@
|
|
|
75
69
|
@apply leading-4 md:leading-5 lg:leading-6;
|
|
76
70
|
}
|
|
77
71
|
|
|
78
|
-
/* Text formatting */
|
|
79
72
|
strong {
|
|
80
73
|
@apply font-semibold;
|
|
81
74
|
}
|
|
@@ -84,7 +77,6 @@
|
|
|
84
77
|
@apply italic;
|
|
85
78
|
}
|
|
86
79
|
|
|
87
|
-
/* Utility classes */
|
|
88
80
|
.snippet {
|
|
89
81
|
@apply relative rounded bg-muted text-on-muted font-mono font-semibold;
|
|
90
82
|
@apply px-[0.3rem] py-[0.2rem];
|
|
@@ -121,18 +113,21 @@
|
|
|
121
113
|
@apply text-lg md:text-xl lg:text-2xl;
|
|
122
114
|
}
|
|
123
115
|
|
|
124
|
-
/* Blockquote - keeping minimal spacing */
|
|
125
116
|
blockquote {
|
|
126
117
|
@apply border-l-2 border-muted italic;
|
|
127
118
|
@apply pl-4 md:pl-5 lg:pl-6;
|
|
128
119
|
}
|
|
129
120
|
|
|
121
|
+
p code {
|
|
122
|
+
@apply relative rounded bg-muted text-on-muted font-mono font-semibold;
|
|
123
|
+
@apply px-[0.3rem] py-[0.2rem];
|
|
124
|
+
@apply text-[0.75rem] md:text-[0.875rem] lg:text-base;
|
|
125
|
+
}
|
|
126
|
+
|
|
130
127
|
.prose {
|
|
131
|
-
/* Base font size and line height - responsive */
|
|
132
128
|
@apply text-sm md:text-base lg:text-lg;
|
|
133
129
|
@apply leading-6 md:leading-7 lg:leading-8;
|
|
134
130
|
|
|
135
|
-
/* Headings */
|
|
136
131
|
h1 {
|
|
137
132
|
@apply scroll-m-20 font-extrabold tracking-tight;
|
|
138
133
|
@apply text-[1.875rem] md:text-4xl lg:text-5xl;
|
|
@@ -180,27 +175,23 @@
|
|
|
180
175
|
@apply mt-3 md:mt-3 lg:mt-4 mb-1.5;
|
|
181
176
|
}
|
|
182
177
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
h4+* {
|
|
178
|
+
h2 + *,
|
|
179
|
+
h3 + *,
|
|
180
|
+
h4 + * {
|
|
187
181
|
@apply mt-0;
|
|
188
182
|
}
|
|
189
183
|
|
|
190
|
-
/* Paragraphs */
|
|
191
184
|
p {
|
|
192
185
|
@apply text-on-muted;
|
|
193
186
|
@apply mt-4 md:mt-5 lg:mt-6 mb-4 md:mb-5 lg:mb-6;
|
|
194
187
|
}
|
|
195
188
|
|
|
196
|
-
/* Lead paragraph */
|
|
197
189
|
[class~='lead'] {
|
|
198
190
|
@apply text-base md:text-lg lg:text-xl;
|
|
199
191
|
@apply leading-7 md:leading-8 lg:leading-8;
|
|
200
192
|
@apply mt-4 md:mt-6 lg:mt-6 mb-4 md:mb-6 lg:mb-6;
|
|
201
193
|
}
|
|
202
194
|
|
|
203
|
-
/* Lists */
|
|
204
195
|
ul,
|
|
205
196
|
ol {
|
|
206
197
|
@apply mt-4 md:mt-5 lg:mt-6 mb-4 md:mb-5 lg:mb-6;
|
|
@@ -220,18 +211,18 @@
|
|
|
220
211
|
@apply pl-1.5 md:pl-1.5 lg:pl-1.5;
|
|
221
212
|
}
|
|
222
213
|
|
|
223
|
-
>ul>li p,
|
|
224
|
-
>ol>li p {
|
|
214
|
+
> ul > li p,
|
|
215
|
+
> ol > li p {
|
|
225
216
|
@apply mt-2 md:mt-3 lg:mt-3 mb-2 md:mb-3 lg:mb-3;
|
|
226
217
|
}
|
|
227
218
|
|
|
228
|
-
>ul>li>p:first-child,
|
|
229
|
-
>ol>li>p:first-child {
|
|
219
|
+
> ul > li > p:first-child,
|
|
220
|
+
> ol > li > p:first-child {
|
|
230
221
|
@apply mt-4 md:mt-5 lg:mt-5;
|
|
231
222
|
}
|
|
232
223
|
|
|
233
|
-
>ul>li>p:last-child,
|
|
234
|
-
>ol>li>p:last-child {
|
|
224
|
+
> ul > li > p:last-child,
|
|
225
|
+
> ol > li > p:last-child {
|
|
235
226
|
@apply mb-4 md:mb-5 lg:mb-5;
|
|
236
227
|
}
|
|
237
228
|
|
|
@@ -256,13 +247,11 @@
|
|
|
256
247
|
@apply pl-5.5 md:pl-6.5 lg:pl-6.5;
|
|
257
248
|
}
|
|
258
249
|
|
|
259
|
-
/* Links */
|
|
260
250
|
a {
|
|
261
251
|
@apply font-medium text-primary underline underline-offset-4;
|
|
262
252
|
@apply hover:text-primary/80 transition-colors;
|
|
263
253
|
}
|
|
264
254
|
|
|
265
|
-
/* Inline code */
|
|
266
255
|
code {
|
|
267
256
|
@apply relative rounded bg-muted text-on-muted font-mono font-semibold;
|
|
268
257
|
@apply px-[0.3rem] py-[0.2rem];
|
|
@@ -277,7 +266,6 @@
|
|
|
277
266
|
@apply text-base md:text-[1.125rem] lg:text-[1.3125rem];
|
|
278
267
|
}
|
|
279
268
|
|
|
280
|
-
/* Code blocks */
|
|
281
269
|
pre {
|
|
282
270
|
@apply overflow-x-auto rounded-lg bg-muted text-on-muted;
|
|
283
271
|
@apply mt-5 md:mt-6 lg:mt-8 mb-5 md:mb-6 lg:mb-8;
|
|
@@ -291,24 +279,21 @@
|
|
|
291
279
|
}
|
|
292
280
|
}
|
|
293
281
|
|
|
294
|
-
/* Blockquotes */
|
|
295
282
|
blockquote {
|
|
296
283
|
@apply border-l-4 border-muted italic text-on-muted;
|
|
297
284
|
@apply mt-6 md:mt-8 lg:mt-10 mb-6 md:mb-8 lg:mb-10;
|
|
298
285
|
@apply pl-5 md:pl-5 lg:pl-6;
|
|
299
286
|
}
|
|
300
287
|
|
|
301
|
-
/* Horizontal rules */
|
|
302
288
|
hr {
|
|
303
289
|
@apply border-muted;
|
|
304
290
|
@apply my-10 md:my-12 lg:my-12;
|
|
305
291
|
}
|
|
306
292
|
|
|
307
|
-
hr
|
|
293
|
+
hr + * {
|
|
308
294
|
@apply mt-0;
|
|
309
295
|
}
|
|
310
296
|
|
|
311
|
-
/* Images and media */
|
|
312
297
|
img,
|
|
313
298
|
video,
|
|
314
299
|
picture {
|
|
@@ -316,16 +301,15 @@
|
|
|
316
301
|
@apply rounded-ui;
|
|
317
302
|
}
|
|
318
303
|
|
|
319
|
-
picture>img {
|
|
304
|
+
picture > img {
|
|
320
305
|
@apply mt-0 mb-0;
|
|
321
306
|
}
|
|
322
307
|
|
|
323
|
-
/* Figures */
|
|
324
308
|
figure {
|
|
325
309
|
@apply mt-6 md:mt-8 lg:mt-8 mb-6 md:mb-8 lg:mb-8;
|
|
326
310
|
}
|
|
327
311
|
|
|
328
|
-
figure
|
|
312
|
+
figure > * {
|
|
329
313
|
@apply mt-0 mb-0;
|
|
330
314
|
}
|
|
331
315
|
|
|
@@ -335,7 +319,6 @@
|
|
|
335
319
|
@apply mt-2 md:mt-3 lg:mt-3;
|
|
336
320
|
}
|
|
337
321
|
|
|
338
|
-
/* Tables */
|
|
339
322
|
table {
|
|
340
323
|
@apply w-full text-left;
|
|
341
324
|
@apply text-[0.75rem] md:text-[0.875rem] lg:text-base;
|
|
@@ -371,7 +354,6 @@
|
|
|
371
354
|
@apply pr-0;
|
|
372
355
|
}
|
|
373
356
|
|
|
374
|
-
/* Keyboard input */
|
|
375
357
|
kbd {
|
|
376
358
|
@apply font-mono font-semibold;
|
|
377
359
|
@apply rounded bg-muted text-on-muted;
|
|
@@ -380,7 +362,6 @@
|
|
|
380
362
|
@apply py-0.5 md:py-0.75 lg:py-1;
|
|
381
363
|
}
|
|
382
364
|
|
|
383
|
-
/* Text formatting */
|
|
384
365
|
strong {
|
|
385
366
|
@apply font-semibold;
|
|
386
367
|
}
|
|
@@ -389,7 +370,6 @@
|
|
|
389
370
|
@apply italic;
|
|
390
371
|
}
|
|
391
372
|
|
|
392
|
-
/* Reset first and last child margins */
|
|
393
373
|
> :first-child {
|
|
394
374
|
@apply mt-0;
|
|
395
375
|
}
|
|
@@ -406,4 +386,4 @@
|
|
|
406
386
|
.boxed {
|
|
407
387
|
@apply container mx-auto;
|
|
408
388
|
}
|
|
409
|
-
}
|
|
389
|
+
}
|
package/dist/css/utilities.css
CHANGED
|
@@ -60,10 +60,55 @@
|
|
|
60
60
|
@apply grid grid-cols-12;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
@utility span-2 {
|
|
64
|
+
@apply col-span-2;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@utility span-3 {
|
|
68
|
+
@apply col-span-3;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@utility span-4 {
|
|
72
|
+
@apply col-span-4;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@utility span-5 {
|
|
76
|
+
@apply col-span-5;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@utility span-6 {
|
|
80
|
+
@apply col-span-6;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@utility span-7 {
|
|
84
|
+
@apply col-span-7;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@utility span-8 {
|
|
88
|
+
@apply col-span-8;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@utility span-9 {
|
|
92
|
+
@apply col-span-9;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@utility span-10 {
|
|
96
|
+
@apply col-span-10;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@utility span-11 {
|
|
100
|
+
@apply col-span-11;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@utility span-12 {
|
|
104
|
+
@apply col-span-12;
|
|
105
|
+
}
|
|
106
|
+
|
|
63
107
|
/* Grid auto-fit (responsive) */
|
|
64
108
|
@utility grid-auto-fit {
|
|
65
109
|
@apply grid grid-cols-[repeat(auto-fit,minmax(250px,1fr))];
|
|
66
110
|
}
|
|
111
|
+
|
|
67
112
|
@utility grid-auto-fill {
|
|
68
113
|
@apply grid grid-cols-[repeat(auto-fill,minmax(250px,1fr))];
|
|
69
114
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../utils/class-names.js';
|
|
3
|
+
import Avatar from './Avatar.svelte';
|
|
4
|
+
|
|
5
|
+
type AvatarItem = {
|
|
6
|
+
src?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
items: AvatarItem[];
|
|
13
|
+
variant?:
|
|
14
|
+
| 'primary'
|
|
15
|
+
| 'secondary'
|
|
16
|
+
| 'muted'
|
|
17
|
+
| 'success'
|
|
18
|
+
| 'warning'
|
|
19
|
+
| 'danger'
|
|
20
|
+
| 'info'
|
|
21
|
+
| 'transparent';
|
|
22
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
23
|
+
max?: number;
|
|
24
|
+
stacked?: boolean;
|
|
25
|
+
isBordered?: boolean;
|
|
26
|
+
class?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
items,
|
|
31
|
+
variant = 'primary',
|
|
32
|
+
size = 'lg',
|
|
33
|
+
max,
|
|
34
|
+
stacked = true,
|
|
35
|
+
isBordered = false,
|
|
36
|
+
class: className
|
|
37
|
+
}: Props = $props();
|
|
38
|
+
|
|
39
|
+
const visibleItems = $derived(max && max < items.length ? items.slice(0, max) : items);
|
|
40
|
+
const remainingCount = $derived(max && max < items.length ? items.length - max : 0);
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div class={cn('avatar-group', stacked && 'is-stacked', className)}>
|
|
44
|
+
{#each visibleItems as item, i}
|
|
45
|
+
<Avatar
|
|
46
|
+
src={item.src}
|
|
47
|
+
name={item.name}
|
|
48
|
+
alt={item.alt || `Avatar ${i + 1}`}
|
|
49
|
+
{variant}
|
|
50
|
+
{size}
|
|
51
|
+
{isBordered}
|
|
52
|
+
/>
|
|
53
|
+
{/each}
|
|
54
|
+
{#if remainingCount > 0}
|
|
55
|
+
<div class={cn('avatar-group-counter', `is-${size}`)}>
|
|
56
|
+
+{remainingCount}
|
|
57
|
+
</div>
|
|
58
|
+
{/if}
|
|
59
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type AvatarItem = {
|
|
2
|
+
src?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
};
|
|
6
|
+
type Props = {
|
|
7
|
+
items: AvatarItem[];
|
|
8
|
+
variant?: 'primary' | 'secondary' | 'muted' | 'success' | 'warning' | 'danger' | 'info' | 'transparent';
|
|
9
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
max?: number;
|
|
11
|
+
stacked?: boolean;
|
|
12
|
+
isBordered?: boolean;
|
|
13
|
+
class?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const AvatarGroup: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type AvatarGroup = ReturnType<typeof AvatarGroup>;
|
|
17
|
+
export default AvatarGroup;
|
package/dist/display/Code.svelte
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { codeToHtml } from 'shiki';
|
|
3
3
|
import { useClipboard } from '../hooks/use-clipboard.svelte.js';
|
|
4
|
-
import { IconButton } from '../index.js';
|
|
4
|
+
import { Chip, IconButton } from '../index.js';
|
|
5
5
|
import { Checkmark24RegularIcon, Copy24RegularIcon } from '../icons/index.js';
|
|
6
6
|
import { theme } from '../stores/theme.svelte.js';
|
|
7
|
+
import { cn } from '../utils/class-names.js';
|
|
7
8
|
|
|
8
9
|
type Props = {
|
|
9
10
|
code: string;
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
darkTheme?: string;
|
|
13
14
|
disableCopy?: boolean;
|
|
14
15
|
hideLang?: boolean;
|
|
16
|
+
class?: string;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
let {
|
|
@@ -20,7 +22,8 @@
|
|
|
20
22
|
lightTheme = 'catppuccin-latte',
|
|
21
23
|
darkTheme = 'catppuccin-frappe',
|
|
22
24
|
disableCopy,
|
|
23
|
-
hideLang
|
|
25
|
+
hideLang,
|
|
26
|
+
class: className
|
|
24
27
|
}: Props = $props();
|
|
25
28
|
|
|
26
29
|
let html: string = $state('');
|
|
@@ -48,18 +51,22 @@
|
|
|
48
51
|
</script>
|
|
49
52
|
|
|
50
53
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
51
|
-
<div
|
|
54
|
+
<div
|
|
55
|
+
class={cn('code', className)}
|
|
56
|
+
onmouseenter={() => (hover = true)}
|
|
57
|
+
onmouseleave={() => (hover = false)}
|
|
58
|
+
>
|
|
52
59
|
{#if open}
|
|
53
|
-
{#if !hover && !hideLang}
|
|
60
|
+
{#if (!hover && !hideLang && !clipboard.copied) || (disableCopy && !hideLang)}
|
|
54
61
|
<div class="code-info">
|
|
55
|
-
<
|
|
62
|
+
<Chip variant="muted">{lang}</Chip>
|
|
56
63
|
</div>
|
|
57
64
|
{/if}
|
|
58
|
-
{#if hover && !disableCopy}
|
|
65
|
+
{#if (hover && !disableCopy) || clipboard.copied || (!disableCopy && hideLang)}
|
|
59
66
|
<div class="code-info">
|
|
60
67
|
<IconButton
|
|
61
68
|
onclick={handleCopy}
|
|
62
|
-
variant="
|
|
69
|
+
variant="muted"
|
|
63
70
|
size="sm"
|
|
64
71
|
icon={clipboard.copied ? Checkmark24RegularIcon : Copy24RegularIcon}
|
|
65
72
|
/>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.avatar-group {
|
|
3
|
+
@apply inline-flex items-center gap-2;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.avatar-group.is-stacked {
|
|
7
|
+
@apply gap-0;
|
|
8
|
+
|
|
9
|
+
&>.avatar {
|
|
10
|
+
@apply -ml-2 first:ml-0;
|
|
11
|
+
@apply outline-2 outline-background rounded-ui;
|
|
12
|
+
@apply transition-transform hover:z-10 hover:scale-110;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&>.avatar-group-counter {
|
|
16
|
+
@apply -ml-2;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.avatar-group-counter {
|
|
21
|
+
@apply flex items-center justify-center;
|
|
22
|
+
@apply bg-muted text-on-muted;
|
|
23
|
+
@apply rounded-ui font-medium;
|
|
24
|
+
@apply outline-2 outline-background;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.avatar-group-counter.is-xs {
|
|
28
|
+
@apply size-5 text-[10px];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.avatar-group-counter.is-sm {
|
|
32
|
+
@apply size-6 text-xs;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.avatar-group-counter.is-md {
|
|
36
|
+
@apply size-7 text-sm;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.avatar-group-counter.is-lg {
|
|
40
|
+
@apply size-10 text-base;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.avatar-group-counter.is-xl {
|
|
44
|
+
@apply size-14 text-lg;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -146,13 +146,4 @@
|
|
|
146
146
|
@apply size-3;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
.avatar-group {
|
|
151
|
-
@apply inline-flex;
|
|
152
|
-
& > .avatar {
|
|
153
|
-
@apply -ml-2 first:ml-0;
|
|
154
|
-
@apply outline-2 outline-muted;
|
|
155
|
-
@apply transition-transform hover:z-10 hover:scale-110;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
149
|
+
}
|
|
@@ -10,38 +10,41 @@
|
|
|
10
10
|
.badge-text {
|
|
11
11
|
@apply text-xs leading-none;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
/* Position styles */
|
|
15
|
+
.is-top-left .badge-content {
|
|
14
16
|
@apply top-0 left-0 translate-x-[-50%] translate-y-[-50%];
|
|
15
17
|
}
|
|
16
|
-
.is-top-right .badge-
|
|
18
|
+
.is-top-right .badge-content {
|
|
17
19
|
@apply top-0 right-0 translate-x-[50%] translate-y-[-50%];
|
|
18
20
|
}
|
|
19
|
-
.is-bottom-left .badge-
|
|
21
|
+
.is-bottom-left .badge-content {
|
|
20
22
|
@apply bottom-0 left-0 translate-x-[-50%] translate-y-[50%];
|
|
21
23
|
}
|
|
22
|
-
.is-bottom-right .badge-
|
|
24
|
+
.is-bottom-right .badge-content {
|
|
23
25
|
@apply bottom-0 right-0 translate-x-[50%] translate-y-[50%];
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
/* Variant styles */
|
|
29
|
+
.is-primary .badge-content {
|
|
27
30
|
@apply bg-primary text-on-primary;
|
|
28
31
|
}
|
|
29
|
-
.is-secondary .badge-
|
|
32
|
+
.is-secondary .badge-content {
|
|
30
33
|
@apply bg-secondary text-on-secondary;
|
|
31
34
|
}
|
|
32
|
-
.is-muted .badge-
|
|
35
|
+
.is-muted .badge-content {
|
|
33
36
|
@apply bg-muted text-on-muted;
|
|
34
37
|
}
|
|
35
|
-
.is-success .badge-
|
|
38
|
+
.is-success .badge-content {
|
|
36
39
|
@apply bg-success text-on-success;
|
|
37
40
|
}
|
|
38
|
-
.is-warning .badge-
|
|
41
|
+
.is-warning .badge-content {
|
|
39
42
|
@apply bg-warning text-on-warning;
|
|
40
43
|
}
|
|
41
|
-
.is-danger .badge-
|
|
44
|
+
.is-danger .badge-content {
|
|
42
45
|
@apply bg-danger text-on-danger;
|
|
43
46
|
}
|
|
44
|
-
.is-info .badge-
|
|
47
|
+
.is-info .badge-content {
|
|
45
48
|
@apply bg-info text-on-info;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -24,6 +24,6 @@ type Props = {
|
|
|
24
24
|
isDisabled?: boolean;
|
|
25
25
|
arrowIcon?: IconData;
|
|
26
26
|
};
|
|
27
|
-
declare const ComboBox: import("svelte").Component<Props, {}, "
|
|
27
|
+
declare const ComboBox: import("svelte").Component<Props, {}, "selected" | "value">;
|
|
28
28
|
type ComboBox = ReturnType<typeof ComboBox>;
|
|
29
29
|
export default ComboBox;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Avatar, Icon, Item } from '../index.js';
|
|
2
|
+
import { Avatar, Icon, Item, type IconData } from '../index.js';
|
|
3
3
|
import { cn } from '../utils/class-names.js';
|
|
4
4
|
import { onMount, tick } from 'svelte';
|
|
5
|
-
import { normalizedCountries, type Country } from './js/countries.js';
|
|
6
|
-
import type { IconName } from '../types.js';
|
|
7
5
|
import { ChevronDown24RegularIcon, DotsMoveIcon, Search24RegularIcon } from '../icons/index.js';
|
|
6
|
+
import { countryFlagsIcons } from '../assets/country-flags.js';
|
|
7
|
+
import { normalizedCountries, type Country } from '../assets/countries.js';
|
|
8
8
|
|
|
9
9
|
type Props = {
|
|
10
10
|
value?: string;
|
|
@@ -395,7 +395,10 @@
|
|
|
395
395
|
aria-label="Select country"
|
|
396
396
|
>
|
|
397
397
|
{#if selectedCountry}
|
|
398
|
-
<
|
|
398
|
+
<Icon
|
|
399
|
+
icon={countryFlagsIcons[`country-flags:${countryCode}`] as IconData}
|
|
400
|
+
class="h-5 w-5"
|
|
401
|
+
/>
|
|
399
402
|
<span class="phone-dial-code">+{dialCode}</span>
|
|
400
403
|
{:else}
|
|
401
404
|
<Avatar name="Select country" {size} variant="transparent" />
|
|
@@ -444,6 +447,7 @@
|
|
|
444
447
|
<li>
|
|
445
448
|
<Item
|
|
446
449
|
label={item.name}
|
|
450
|
+
icon={countryFlagsIcons[`country-flags:${item.id}`] as IconData}
|
|
447
451
|
description="+{item.dialCode}"
|
|
448
452
|
id={item.id}
|
|
449
453
|
onclick={() => handleSelect(item)}
|
|
@@ -21,6 +21,6 @@ type Props = {
|
|
|
21
21
|
isFloatLabel?: boolean;
|
|
22
22
|
isSolid?: boolean;
|
|
23
23
|
};
|
|
24
|
-
declare const Select: import("svelte").Component<Props, {}, "
|
|
24
|
+
declare const Select: import("svelte").Component<Props, {}, "selected" | "value">;
|
|
25
25
|
type Select = ReturnType<typeof Select>;
|
|
26
26
|
export default Select;
|