@hyvor/design 0.0.67 → 0.0.68
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/ActionList/ActionList.svelte +2 -7
- package/dist/components/ActionList/ActionListGroup.svelte +24 -29
- package/dist/components/ActionList/ActionListItem.svelte +86 -88
- package/dist/components/ActionList/Selected.svelte +17 -20
- package/dist/components/Avatar/Avatar.svelte +7 -11
- package/dist/components/Avatar/AvatarStack.svelte +16 -20
- package/dist/components/Base/Base.svelte +3 -3
- package/dist/components/Box/Box.svelte +8 -8
- package/dist/components/Button/Button.svelte +33 -42
- package/dist/components/Button/ButtonGroup.svelte +6 -6
- package/dist/components/Callout/Callout.svelte +88 -86
- package/dist/components/Callout/Callout.svelte.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.svelte +113 -121
- package/dist/components/CodeBlock/CodeBlock.svelte +26 -23
- package/dist/components/CodeBlock/getCode.js +6 -6
- package/dist/components/CodeBlock/hljs.scss +189 -191
- package/dist/components/CodeBlock/prism.scss +370 -7
- package/dist/components/ColorPicker/ColorPicker.svelte +42 -42
- package/dist/components/Dark/DarkProvider.svelte +9 -9
- package/dist/components/Dark/DarkToggle.svelte +7 -10
- package/dist/components/Divider/Divider.svelte +6 -7
- package/dist/components/Dropdown/Dropdown.svelte +33 -108
- package/dist/components/Dropdown/DropdownContent.svelte +120 -0
- package/dist/components/Dropdown/DropdownContent.svelte.d.ts +24 -0
- package/dist/components/FormControl/Caption.svelte +9 -9
- package/dist/components/FormControl/FormControl.svelte +18 -18
- package/dist/components/FormControl/InputGroup.svelte +7 -8
- package/dist/components/FormControl/Label.svelte +5 -5
- package/dist/components/FormControl/Validation.svelte +18 -16
- package/dist/components/FormControl/Validation.svelte.d.ts +1 -1
- package/dist/components/HyvorBar/BarProducts.svelte +52 -0
- package/dist/components/HyvorBar/BarProducts.svelte.d.ts +39 -0
- package/dist/components/HyvorBar/BarSupport.svelte +119 -0
- package/dist/components/HyvorBar/BarSupport.svelte.d.ts +19 -0
- package/dist/components/HyvorBar/BarUpdates.svelte +58 -0
- package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte +134 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/BarUser.svelte +60 -0
- package/dist/components/HyvorBar/BarUser.svelte.d.ts +16 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte +42 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +14 -0
- package/dist/components/HyvorBar/HyvorBar.svelte +150 -0
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +19 -0
- package/dist/components/HyvorBar/bar.d.ts +33 -0
- package/dist/components/HyvorBar/bar.js +74 -0
- package/dist/components/HyvorBar/img/G2.svelte +9 -0
- package/dist/components/HyvorBar/img/G2.svelte.d.ts +23 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +23 -0
- package/dist/components/IconButton/IconButton.svelte +19 -23
- package/dist/components/IconMessage/IconMessage.svelte +89 -38
- package/dist/components/IconMessage/IconMessage.svelte.d.ts +9 -1
- package/dist/components/Internationalization/InternationalizationProvider.svelte +2 -2
- package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +1 -1
- package/dist/components/Internationalization/LanguageToggle.svelte +33 -36
- package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +2 -2
- package/dist/components/Internationalization/T.svelte.d.ts +3 -3
- package/dist/components/Internationalization/i18n.d.ts +4 -4
- package/dist/components/Internationalization/i18n.js +13 -11
- package/dist/components/Internationalization/t.d.ts +3 -3
- package/dist/components/Internationalization/t.js +4 -4
- package/dist/components/Internationalization/types.d.ts +1 -1
- package/dist/components/Link/Link.svelte +53 -58
- package/dist/components/Loader/LoadButton.svelte +15 -29
- package/dist/components/Loader/Loader.svelte +56 -69
- package/dist/components/Modal/ConfirmModalProvider.svelte +18 -36
- package/dist/components/Modal/Modal.svelte +134 -164
- package/dist/components/Modal/ModalFooter.svelte +23 -26
- package/dist/components/Modal/confirm.d.ts +1 -1
- package/dist/components/Modal/confirm.js +4 -4
- package/dist/components/Modal/modal-types.d.ts +2 -2
- package/dist/components/NavLink/NavLink.svelte +78 -86
- package/dist/components/Radio/Radio.svelte +23 -31
- package/dist/components/Slider/Slider.svelte +71 -79
- package/dist/components/SplitControl/SplitControl.svelte +28 -42
- package/dist/components/Switch/Switch.svelte +60 -65
- package/dist/components/TabNav/TabNav.svelte +6 -10
- package/dist/components/TabNav/TabNavItem.svelte +36 -43
- package/dist/components/Table/Table.svelte +7 -4
- package/dist/components/Table/TableRow.svelte +23 -23
- package/dist/components/Tag/Tag.svelte +28 -36
- package/dist/components/Text/Text.svelte +15 -22
- package/dist/components/TextInput/TextInput.svelte +26 -26
- package/dist/components/Textarea/Textarea.svelte +38 -38
- package/dist/components/Toast/ToastIcon.svelte +29 -31
- package/dist/components/Toast/ToastMessage.svelte +33 -39
- package/dist/components/Toast/ToastProvider.svelte +16 -16
- package/dist/components/Toast/cleaner.js +5 -5
- package/dist/components/Toast/toast.d.ts +2 -2
- package/dist/components/Toast/toast.js +10 -10
- package/dist/components/Tooltip/Tooltip.svelte +82 -83
- package/dist/components/directives/clickOutside.js +4 -4
- package/dist/components/directives/debounce.d.ts +1 -0
- package/dist/components/directives/debounce.js +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.css +31 -33
- package/dist/marketing/Container/Container.svelte +8 -8
- package/dist/marketing/Docs/Content/Content.svelte +8 -7
- package/dist/marketing/Docs/Content/DocsImage.svelte +52 -62
- package/dist/marketing/Docs/Docs.svelte +21 -24
- package/dist/marketing/Docs/Nav/Nav.svelte +21 -22
- package/dist/marketing/Docs/Nav/NavCategory.svelte +28 -28
- package/dist/marketing/Docs/Nav/NavItem.svelte +21 -24
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
- package/dist/marketing/Docs/Toc.svelte +17 -19
- package/dist/marketing/Document/Document.svelte +5 -5
- package/dist/marketing/Document/DocumentTitle.svelte +49 -49
- package/dist/marketing/Footer/Footer.svelte +111 -119
- package/dist/marketing/Footer/FooterLinkList.svelte +24 -26
- package/dist/marketing/Header/Header.svelte +7 -15
- package/dist/marketing/Logo/LogoBlogs.svelte +41 -0
- package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +16 -0
- package/dist/marketing/Logo/LogoCore.svelte +41 -0
- package/dist/marketing/Logo/LogoCore.svelte.d.ts +16 -0
- package/dist/marketing/Logo/LogoFortguard.svelte +49 -0
- package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +16 -0
- package/dist/marketing/Logo/LogoTalk.svelte +27 -0
- package/dist/marketing/Logo/LogoTalk.svelte.d.ts +16 -0
- package/dist/stores/dark.js +8 -8
- package/dist/variables.scss +41 -48
- package/package.json +59 -58
|
@@ -9,49 +9,42 @@ function handleClick() {
|
|
|
9
9
|
}
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
<button
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
{/if}
|
|
25
|
-
<slot />
|
|
26
|
-
{#if $$slots.end}
|
|
27
|
-
<span class="end">
|
|
28
|
-
<slot name="end" />
|
|
29
|
-
</span>
|
|
30
|
-
{/if}
|
|
12
|
+
<button class="tab" class:active={isActive} on:click={handleClick} {...$$restProps} on:click>
|
|
13
|
+
{#if $$slots.start}
|
|
14
|
+
<span class="start">
|
|
15
|
+
<slot name="start" />
|
|
16
|
+
</span>
|
|
17
|
+
{/if}
|
|
18
|
+
<slot />
|
|
19
|
+
{#if $$slots.end}
|
|
20
|
+
<span class="end">
|
|
21
|
+
<slot name="end" />
|
|
22
|
+
</span>
|
|
23
|
+
{/if}
|
|
31
24
|
</button>
|
|
32
25
|
|
|
33
26
|
<style>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</style>
|
|
27
|
+
.tab {
|
|
28
|
+
position: relative;
|
|
29
|
+
padding: 10px 15px;
|
|
30
|
+
border-bottom: 3px solid #f1f1f1;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
.tab.active {
|
|
37
|
+
border-bottom-color: var(--accent);
|
|
38
|
+
color: var(--accent);
|
|
39
|
+
}
|
|
40
|
+
.start {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
margin-right: 7px;
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
.end {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
margin-left: 4px;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -3,9 +3,12 @@ export let hover = false;
|
|
|
3
3
|
const hoverCss = hover ? "--local-hover-color: var(--hover);" : "";
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<div
|
|
6
|
+
<div
|
|
7
|
+
class="table"
|
|
8
|
+
style="
|
|
7
9
|
--local-columns: {columns};
|
|
8
10
|
{hoverCss}
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</div>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<script>export let head = false;
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
+
<div class:head {...$$props}>
|
|
5
|
+
<slot />
|
|
6
|
+
</div>
|
|
7
|
+
|
|
4
8
|
<style>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
div {
|
|
10
|
+
display: grid;
|
|
11
|
+
padding: 8px 18px;
|
|
12
|
+
border-radius: 20px;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
grid-template-columns: var(--local-columns);
|
|
15
|
+
}
|
|
16
|
+
div.head {
|
|
17
|
+
font-weight: 600;
|
|
18
|
+
background: var(--accent-lightest);
|
|
19
|
+
margin-bottom: 5px;
|
|
20
|
+
}
|
|
21
|
+
div:hover:not(.head) {
|
|
22
|
+
background-color: var(--local-hover-color);
|
|
23
|
+
}
|
|
24
|
+
div > :global(*) {
|
|
25
|
+
padding-right: 5px;
|
|
26
|
+
word-wrap: break-word;
|
|
27
|
+
}
|
|
24
28
|
</style>
|
|
25
|
-
|
|
26
|
-
<div class:head={head} {...$$props}>
|
|
27
|
-
<slot />
|
|
28
|
-
</div>
|
|
@@ -13,47 +13,39 @@ if (outline) {
|
|
|
13
13
|
let tabindex = interactive ? 0 : void 0;
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
<svelte:element
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
style:background-color={bg}
|
|
39
|
-
style:color={fg}
|
|
17
|
+
this={as}
|
|
18
|
+
role={interactive ? 'button' : undefined}
|
|
19
|
+
{tabindex}
|
|
20
|
+
class="button color-{color} style-{styleClass} size-{size}"
|
|
21
|
+
class:interactive
|
|
22
|
+
class:has-start={$$slots.start}
|
|
23
|
+
class:has-end={$$slots.end}
|
|
24
|
+
{...$$restProps}
|
|
25
|
+
on:keyup
|
|
26
|
+
on:keydown
|
|
27
|
+
on:keypress
|
|
28
|
+
on:focus
|
|
29
|
+
on:blur
|
|
30
|
+
on:click
|
|
31
|
+
on:mouseover
|
|
32
|
+
on:mouseenter
|
|
33
|
+
on:mouseleave
|
|
34
|
+
on:change
|
|
35
|
+
style:background-color={bg}
|
|
36
|
+
style:color={fg}
|
|
40
37
|
>
|
|
38
|
+
{#if $$slots.start}
|
|
39
|
+
<slot name="start" />
|
|
40
|
+
{/if}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
<slot name="start" />
|
|
44
|
-
{/if}
|
|
45
|
-
|
|
46
|
-
<slot />
|
|
47
|
-
|
|
48
|
-
{#if $$slots.end}
|
|
49
|
-
<slot name="end" />
|
|
50
|
-
{/if}
|
|
42
|
+
<slot />
|
|
51
43
|
|
|
44
|
+
{#if $$slots.end}
|
|
45
|
+
<slot name="end" />
|
|
46
|
+
{/if}
|
|
52
47
|
</svelte:element>
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
49
|
<style>span {
|
|
58
50
|
vertical-align: middle;
|
|
59
51
|
border-radius: 20px;
|
|
@@ -183,4 +175,4 @@ span.style-outline-fill.color-orange {
|
|
|
183
175
|
opacity: 0.5 !important;
|
|
184
176
|
cursor: not-allowed;
|
|
185
177
|
box-shadow: none !important;
|
|
186
|
-
}</style>
|
|
178
|
+
}</style>
|
|
@@ -4,28 +4,21 @@ export let normal = false;
|
|
|
4
4
|
export let bold = false;
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<span
|
|
8
|
-
|
|
9
|
-
class:small
|
|
10
|
-
class:normal
|
|
11
|
-
class:bold
|
|
12
|
-
|
|
13
|
-
{...$$restProps}
|
|
14
|
-
>
|
|
15
|
-
<slot />
|
|
7
|
+
<span class:light class:small class:normal class:bold {...$$restProps}>
|
|
8
|
+
<slot />
|
|
16
9
|
</span>
|
|
17
10
|
|
|
18
11
|
<style>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</style>
|
|
12
|
+
span.light {
|
|
13
|
+
color: var(--text-light);
|
|
14
|
+
}
|
|
15
|
+
span.small {
|
|
16
|
+
font-size: 0.8em;
|
|
17
|
+
}
|
|
18
|
+
span.normal {
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
}
|
|
21
|
+
span.bold {
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -6,34 +6,34 @@ export let input = {};
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<label class="input-wrap state-{state} size-{size}" class:block>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
{#if $$slots.start}
|
|
10
|
+
<span class="slot start">
|
|
11
|
+
<slot name="start" />
|
|
12
|
+
</span>
|
|
13
|
+
{/if}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
<input
|
|
16
|
+
{...$$restProps}
|
|
17
|
+
bind:value
|
|
18
|
+
bind:this={input}
|
|
19
|
+
on:keyup
|
|
20
|
+
on:keydown
|
|
21
|
+
on:keypress
|
|
22
|
+
on:focus
|
|
23
|
+
on:blur
|
|
24
|
+
on:click
|
|
25
|
+
on:mouseover
|
|
26
|
+
on:mouseenter
|
|
27
|
+
on:mouseleave
|
|
28
|
+
on:change
|
|
29
|
+
on:input
|
|
30
|
+
/>
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
{#if $$slots.end}
|
|
33
|
+
<span class="slot end">
|
|
34
|
+
<slot name="end" />
|
|
35
|
+
</span>
|
|
36
|
+
{/if}
|
|
37
37
|
</label>
|
|
38
38
|
|
|
39
39
|
<style>.slot {
|
|
@@ -7,47 +7,47 @@ export let textarea = {};
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<span
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
class="input-wrap state-{state}"
|
|
11
|
+
class:block
|
|
12
|
+
on:click={() => textarea.focus()}
|
|
13
|
+
on:keydown={(e) => {
|
|
14
|
+
if (e.key === 'Enter') {
|
|
15
|
+
textarea.focus();
|
|
16
|
+
}
|
|
17
|
+
}}
|
|
18
|
+
role="textbox"
|
|
19
|
+
tabindex="0"
|
|
20
20
|
>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
{#if $$slots.start}
|
|
22
|
+
<span class="slot start">
|
|
23
|
+
<slot name="start" />
|
|
24
|
+
</span>
|
|
25
|
+
{/if}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
27
|
+
<textarea
|
|
28
|
+
bind:value
|
|
29
|
+
bind:this={textarea}
|
|
30
|
+
on:keyup
|
|
31
|
+
on:keydown
|
|
32
|
+
on:keypress
|
|
33
|
+
on:focus
|
|
34
|
+
on:blur
|
|
35
|
+
on:click
|
|
36
|
+
on:mouseover
|
|
37
|
+
on:mouseenter
|
|
38
|
+
on:mouseleave
|
|
39
|
+
on:change
|
|
40
|
+
on:input
|
|
41
|
+
{rows}
|
|
42
|
+
{cols}
|
|
43
|
+
{...$$restProps}
|
|
44
|
+
></textarea>
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
{#if $$slots.end}
|
|
47
|
+
<span class="slot end">
|
|
48
|
+
<slot name="end" />
|
|
49
|
+
</span>
|
|
50
|
+
{/if}
|
|
51
51
|
</span>
|
|
52
52
|
|
|
53
53
|
<style>.input-wrap {
|
|
@@ -15,38 +15,36 @@ $:
|
|
|
15
15
|
}[toast.type] || "inherit";
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<span
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Loader size="small" />
|
|
31
|
-
{/if}
|
|
18
|
+
<span style:color>
|
|
19
|
+
{#if toast.type === 'success'}
|
|
20
|
+
<IconCheckCircleFill />
|
|
21
|
+
{:else if toast.type === 'error'}
|
|
22
|
+
<IconXCircleFill />
|
|
23
|
+
{:else if toast.type === 'warning'}
|
|
24
|
+
<IconExclamationCircleFill />
|
|
25
|
+
{:else if toast.type === 'info'}
|
|
26
|
+
<IconInfoCircleFill />
|
|
27
|
+
{:else if toast.type === 'loading'}
|
|
28
|
+
<Loader size="small" />
|
|
29
|
+
{/if}
|
|
32
30
|
</span>
|
|
33
31
|
|
|
34
32
|
<style>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
span {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
animation: scale 0.2s ease-in-out;
|
|
38
|
+
}
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</style>
|
|
40
|
+
@keyframes scale {
|
|
41
|
+
0% {
|
|
42
|
+
transform: scale(0.5);
|
|
43
|
+
opacity: 0.4;
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: scale(1);
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -3,46 +3,40 @@ import { fade } from "svelte/transition";
|
|
|
3
3
|
export let toast;
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<div
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
>
|
|
11
|
-
|
|
12
|
-
{#if toast.type !== 'blank'}
|
|
13
|
-
<div class="icon-wrap">
|
|
14
|
-
<ToastIcon {toast} />
|
|
15
|
-
</div>
|
|
16
|
-
{/if}
|
|
17
|
-
|
|
18
|
-
<div class="message-wrap">
|
|
19
|
-
{#if typeof toast.message === 'string' || toast.message === null}
|
|
20
|
-
{@html toast.message }
|
|
21
|
-
{:else}
|
|
22
|
-
<svelte:component this={toast.message} {toast} />
|
|
23
|
-
{/if}
|
|
24
|
-
</div>
|
|
6
|
+
<div class="toast" out:fade={{ duration: 200 }} in:fade={{ duration: 50 }}>
|
|
7
|
+
{#if toast.type !== 'blank'}
|
|
8
|
+
<div class="icon-wrap">
|
|
9
|
+
<ToastIcon {toast} />
|
|
10
|
+
</div>
|
|
11
|
+
{/if}
|
|
25
12
|
|
|
13
|
+
<div class="message-wrap">
|
|
14
|
+
{#if typeof toast.message === 'string' || toast.message === null}
|
|
15
|
+
{@html toast.message}
|
|
16
|
+
{:else}
|
|
17
|
+
<svelte:component this={toast.message} {toast} />
|
|
18
|
+
{/if}
|
|
19
|
+
</div>
|
|
26
20
|
</div>
|
|
27
21
|
|
|
28
22
|
<style>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</style>
|
|
23
|
+
.toast {
|
|
24
|
+
margin-bottom: 10px;
|
|
25
|
+
box-shadow: 0 0 10px 2px rgba(0, 0, 0, 0.1);
|
|
26
|
+
border-radius: var(--box-radius);
|
|
27
|
+
background-color: var(--box-background);
|
|
28
|
+
padding: 8px 20px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
max-width: 350px;
|
|
32
|
+
pointer-events: initial;
|
|
33
|
+
}
|
|
34
|
+
.toast:first-child {
|
|
35
|
+
margin-top: 10px;
|
|
36
|
+
}
|
|
37
|
+
.icon-wrap {
|
|
38
|
+
margin-right: 8px;
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -5,22 +5,22 @@ useCleaner();
|
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<div id="toasts-wrap">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
{#each $toastStore as toast (toast.id)}
|
|
9
|
+
<ToastMessage {toast} />
|
|
10
|
+
{/each}
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
13
|
<style>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</style>
|
|
14
|
+
#toasts-wrap {
|
|
15
|
+
position: fixed;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
width: 100%;
|
|
19
|
+
z-index: 20000000;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { onDestroy } from
|
|
2
|
-
import { default as toastService, toastStore } from
|
|
1
|
+
import { onDestroy } from 'svelte';
|
|
2
|
+
import { default as toastService, toastStore } from './toast.js';
|
|
3
3
|
const DEFAULT_DURATIONS = {
|
|
4
4
|
success: 2000,
|
|
5
|
-
loading: Infinity
|
|
5
|
+
loading: Infinity
|
|
6
6
|
};
|
|
7
7
|
export function useCleaner() {
|
|
8
8
|
const timeouts = new Map();
|
|
9
|
-
const unsubscribe = toastStore.subscribe(toasts => {
|
|
10
|
-
toasts.forEach(toast => {
|
|
9
|
+
const unsubscribe = toastStore.subscribe((toasts) => {
|
|
10
|
+
toasts.forEach((toast) => {
|
|
11
11
|
if (timeouts.has(toast.id)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SvelteComponent } from
|
|
1
|
+
import type { SvelteComponent } from 'svelte';
|
|
2
2
|
export interface Toast {
|
|
3
3
|
id: number;
|
|
4
4
|
type: ToastType;
|
|
@@ -6,7 +6,7 @@ export interface Toast {
|
|
|
6
6
|
duration?: number;
|
|
7
7
|
}
|
|
8
8
|
export declare const toastStore: import("svelte/store").Writable<Toast[]>;
|
|
9
|
-
export type ToastType =
|
|
9
|
+
export type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading' | 'blank';
|
|
10
10
|
export type ToastMessageType = typeof SvelteComponent<Record<string, any>> | string | null;
|
|
11
11
|
declare function createHandler(type: ToastType): (message: ToastMessageType, options?: Partial<Toast>) => number;
|
|
12
12
|
type ToastFunctionSignature = ReturnType<typeof createHandler>;
|