@hyvor/design 2.1.20-beta.1 → 2.1.20
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/Dropdown/Dropdown.svelte +4 -5
- package/dist/components/Dropdown/Dropdown.svelte.d.ts +0 -1
- package/dist/components/Dropdown/DropdownContent.svelte +1 -7
- package/dist/components/Tooltip/Tooltip.svelte +1 -4
- package/dist/components/directives/clickOutside.d.ts +1 -2
- package/dist/components/directives/clickOutside.js +7 -25
- package/dist/marketing/Testimonials/Testimonials.svelte +27 -3
- package/dist/marketing/Testimonials/Testimonials.svelte.d.ts +1 -0
- package/package.json +1 -2
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
trigger?: Snippet;
|
|
14
14
|
content?: Snippet;
|
|
15
15
|
contentPadding?: number;
|
|
16
|
-
keepInDom?: boolean;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
let {
|
|
@@ -25,18 +24,18 @@
|
|
|
25
24
|
position = 'bottom',
|
|
26
25
|
trigger,
|
|
27
26
|
content,
|
|
28
|
-
contentPadding
|
|
29
|
-
keepInDom = false
|
|
27
|
+
contentPadding
|
|
30
28
|
}: Props = $props();
|
|
31
29
|
|
|
32
30
|
let triggerEl: HTMLElement | undefined = $state();
|
|
33
31
|
</script>
|
|
34
32
|
|
|
35
33
|
<span class="dropdown" class:relative>
|
|
36
|
-
<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_static_element_interactions -->
|
|
37
34
|
<span
|
|
38
35
|
class="trigger"
|
|
39
36
|
onclick={() => (show = !show)}
|
|
37
|
+
role="listbox"
|
|
38
|
+
tabindex="0"
|
|
40
39
|
onkeyup={(e) => {
|
|
41
40
|
if (e.key === 'Escape') {
|
|
42
41
|
show = false;
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
{@render trigger?.()}
|
|
48
47
|
</span>
|
|
49
48
|
|
|
50
|
-
{#if show
|
|
49
|
+
{#if show}
|
|
51
50
|
<DropdownContent
|
|
52
51
|
bind:show
|
|
53
52
|
{width}
|
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
$effect(() => {
|
|
102
102
|
position;
|
|
103
103
|
align;
|
|
104
|
-
show;
|
|
105
104
|
positionWrap();
|
|
106
105
|
});
|
|
107
106
|
|
|
@@ -130,9 +129,8 @@
|
|
|
130
129
|
|
|
131
130
|
<div
|
|
132
131
|
class="content-wrap {align} {position}"
|
|
133
|
-
class:visually-hidden={!show}
|
|
134
132
|
use:clickOutside={{
|
|
135
|
-
enabled: closeOnOutsideClick
|
|
133
|
+
enabled: closeOnOutsideClick,
|
|
136
134
|
callback: () => (show = false)
|
|
137
135
|
}}
|
|
138
136
|
bind:this={contentWrap}
|
|
@@ -152,10 +150,6 @@
|
|
|
152
150
|
flex-direction: column;
|
|
153
151
|
}
|
|
154
152
|
|
|
155
|
-
.content-wrap.visually-hidden {
|
|
156
|
-
display: none;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
153
|
.content {
|
|
160
154
|
overflow-y: auto;
|
|
161
155
|
min-height: 0;
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
let wrap: HTMLDivElement | undefined = $state();
|
|
34
34
|
let tooltipEl: HTMLDivElement | undefined = $state();
|
|
35
35
|
let showTimeout: ReturnType<typeof setTimeout>;
|
|
36
|
-
const tooltipId = $props.id();
|
|
37
36
|
|
|
38
37
|
function positionTooltip() {
|
|
39
38
|
if (wrap && tooltipEl && show) {
|
|
@@ -102,7 +101,7 @@
|
|
|
102
101
|
class="tooltip-wrap {color}"
|
|
103
102
|
onmouseenter={handleMouseEnter}
|
|
104
103
|
onmouseleave={handleMouseLeave}
|
|
105
|
-
|
|
104
|
+
role="tooltip"
|
|
106
105
|
bind:this={wrap}
|
|
107
106
|
{...wrapperProps}
|
|
108
107
|
>
|
|
@@ -110,11 +109,9 @@
|
|
|
110
109
|
|
|
111
110
|
{#if !disabled && show}
|
|
112
111
|
<div
|
|
113
|
-
id={tooltipId}
|
|
114
112
|
class="tooltip {position}"
|
|
115
113
|
style:max-width={maxWidth + 'px'}
|
|
116
114
|
bind:this={tooltipEl}
|
|
117
|
-
role="tooltip"
|
|
118
115
|
transition:fade={{ duration: 100 }}
|
|
119
116
|
>
|
|
120
117
|
{#if tooltip}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
function normalize(input) {
|
|
2
|
-
return typeof input === 'function' ? { callback: input } : input;
|
|
3
|
-
}
|
|
4
1
|
export function clickOutside(node, input) {
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const options = typeof input === 'function' ? { callback: input } : input;
|
|
3
|
+
const enabled = options.enabled === undefined ? true : options.enabled;
|
|
4
|
+
if (!enabled)
|
|
5
|
+
return;
|
|
7
6
|
const handleClick = (event) => {
|
|
8
7
|
if (!node.contains(event.target)) {
|
|
9
8
|
if (options.stopPropagation)
|
|
@@ -11,28 +10,11 @@ export function clickOutside(node, input) {
|
|
|
11
10
|
options.callback();
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
listening = true;
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
if (listening)
|
|
20
|
-
document.addEventListener('click', handleClick);
|
|
21
|
-
}, 0);
|
|
22
|
-
}
|
|
23
|
-
else if (!enabled && listening) {
|
|
24
|
-
listening = false;
|
|
25
|
-
document.removeEventListener('click', handleClick);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
sync();
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
document.addEventListener('click', handleClick);
|
|
15
|
+
}, 0);
|
|
29
16
|
return {
|
|
30
|
-
update(newInput) {
|
|
31
|
-
options = normalize(newInput);
|
|
32
|
-
sync();
|
|
33
|
-
},
|
|
34
17
|
destroy() {
|
|
35
|
-
listening = false;
|
|
36
18
|
document.removeEventListener('click', handleClick);
|
|
37
19
|
}
|
|
38
20
|
};
|
|
@@ -28,9 +28,15 @@
|
|
|
28
28
|
label?: string;
|
|
29
29
|
title?: string;
|
|
30
30
|
reviews: Review[];
|
|
31
|
+
handwrittenNames?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
let {
|
|
34
|
+
let {
|
|
35
|
+
label = 'Testimonials',
|
|
36
|
+
title = 'Loved by our customers.',
|
|
37
|
+
reviews,
|
|
38
|
+
handwrittenNames = true
|
|
39
|
+
}: Props = $props();
|
|
34
40
|
|
|
35
41
|
let started: boolean[] = $state(reviews.map(() => false));
|
|
36
42
|
let playing: boolean[] = $state(reviews.map(() => false));
|
|
@@ -126,6 +132,12 @@
|
|
|
126
132
|
}
|
|
127
133
|
</script>
|
|
128
134
|
|
|
135
|
+
<svelte:head>
|
|
136
|
+
{#if handwrittenNames}
|
|
137
|
+
<link href="https://fonts.bunny.net/css?family=caveat:600,700" rel="stylesheet" />
|
|
138
|
+
{/if}
|
|
139
|
+
</svelte:head>
|
|
140
|
+
|
|
129
141
|
{#snippet meta(review: Review)}
|
|
130
142
|
<div class="role">
|
|
131
143
|
{review.role}, <br />
|
|
@@ -144,7 +156,7 @@
|
|
|
144
156
|
</div>
|
|
145
157
|
{/snippet}
|
|
146
158
|
|
|
147
|
-
<section class="hds-testimonials">
|
|
159
|
+
<section class="hds-testimonials" class:handwritten={handwrittenNames}>
|
|
148
160
|
<div class="hds-container head">
|
|
149
161
|
<p class="label">{label}</p>
|
|
150
162
|
<h2>{@html title}</h2>
|
|
@@ -414,16 +426,24 @@
|
|
|
414
426
|
}
|
|
415
427
|
|
|
416
428
|
.name {
|
|
417
|
-
font-size:
|
|
429
|
+
font-size: 16px;
|
|
418
430
|
font-weight: 600;
|
|
419
431
|
color: var(--text);
|
|
420
432
|
line-height: 1.3;
|
|
421
433
|
}
|
|
422
434
|
|
|
435
|
+
.handwritten .name {
|
|
436
|
+
font-family: 'Caveat', cursive;
|
|
437
|
+
font-size: 28px;
|
|
438
|
+
font-weight: 600;
|
|
439
|
+
line-height: 1.15;
|
|
440
|
+
}
|
|
441
|
+
|
|
423
442
|
.role {
|
|
424
443
|
font-size: 14px;
|
|
425
444
|
line-height: 1.35;
|
|
426
445
|
color: var(--text-light);
|
|
446
|
+
margin-top: 4px;
|
|
427
447
|
font-family: var(--font-serif);
|
|
428
448
|
}
|
|
429
449
|
|
|
@@ -440,6 +460,10 @@
|
|
|
440
460
|
text-decoration: underline;
|
|
441
461
|
}
|
|
442
462
|
|
|
463
|
+
.handwritten .company {
|
|
464
|
+
font-weight: 600;
|
|
465
|
+
}
|
|
466
|
+
|
|
443
467
|
.video-card {
|
|
444
468
|
overflow: hidden;
|
|
445
469
|
padding: 0;
|