@hyvor/design 0.0.67 → 1.0.3
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 +21 -13
- package/dist/components/ActionList/ActionList.svelte.d.ts +8 -20
- package/dist/components/ActionList/ActionListGroup.svelte +40 -35
- package/dist/components/ActionList/ActionListGroup.svelte.d.ts +8 -20
- package/dist/components/ActionList/ActionListItem.svelte +129 -107
- package/dist/components/ActionList/ActionListItem.svelte.d.ts +27 -25
- package/dist/components/ActionList/Selected.svelte +27 -24
- package/dist/components/ActionList/Selected.svelte.d.ts +6 -17
- package/dist/components/Avatar/Avatar.svelte +22 -19
- package/dist/components/Avatar/Avatar.svelte.d.ts +7 -18
- package/dist/components/Avatar/AvatarStack.svelte +29 -27
- package/dist/components/Avatar/AvatarStack.svelte.d.ts +6 -18
- package/dist/components/Base/Base.svelte +16 -8
- package/dist/components/Base/Base.svelte.d.ts +6 -18
- package/dist/components/Box/Box.svelte +16 -9
- package/dist/components/Box/Box.svelte.d.ts +7 -19
- package/dist/components/Button/Button.svelte +65 -47
- package/dist/components/Button/Button.svelte.d.ts +16 -39
- package/dist/components/Button/ButtonGroup.svelte +14 -6
- package/dist/components/Button/ButtonGroup.svelte.d.ts +5 -27
- package/dist/components/Callout/Callout.svelte +110 -87
- package/dist/components/Callout/Callout.svelte.d.ts +11 -22
- package/dist/components/Checkbox/Checkbox.svelte +156 -144
- package/dist/components/Checkbox/Checkbox.svelte.d.ts +11 -34
- package/dist/components/CodeBlock/CodeBlock.svelte +45 -32
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +6 -17
- package/dist/components/CodeBlock/getCode.js +8 -6
- package/dist/components/CodeBlock/hljs.scss +189 -191
- package/dist/components/CodeBlock/prism.scss +370 -7
- package/dist/components/ColorPicker/ColorPicker.svelte +75 -56
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +25 -19
- package/dist/components/Dark/DarkProvider.svelte +16 -14
- package/dist/components/Dark/DarkProvider.svelte.d.ts +16 -12
- package/dist/components/Dark/DarkToggle.svelte +15 -16
- package/dist/components/Dark/DarkToggle.svelte.d.ts +16 -12
- package/dist/components/Divider/Divider.svelte +23 -13
- package/dist/components/Divider/Divider.svelte.d.ts +9 -20
- package/dist/components/Dropdown/Dropdown.svelte +58 -114
- package/dist/components/Dropdown/Dropdown.svelte.d.ts +13 -24
- package/dist/components/Dropdown/DropdownContent.svelte +152 -0
- package/dist/components/Dropdown/DropdownContent.svelte.d.ts +12 -0
- package/dist/components/FormControl/Caption.svelte +18 -11
- package/dist/components/FormControl/Caption.svelte.d.ts +7 -19
- package/dist/components/FormControl/FormControl.svelte +28 -19
- package/dist/components/FormControl/FormControl.svelte.d.ts +6 -27
- package/dist/components/FormControl/InputGroup.svelte +22 -15
- package/dist/components/FormControl/InputGroup.svelte.d.ts +7 -19
- package/dist/components/FormControl/Label.svelte +15 -6
- package/dist/components/FormControl/Label.svelte.d.ts +6 -27
- package/dist/components/FormControl/Validation.svelte +30 -19
- package/dist/components/FormControl/Validation.svelte.d.ts +9 -21
- package/dist/components/HyvorBar/BarProducts.svelte +71 -0
- package/dist/components/HyvorBar/BarProducts.svelte.d.ts +32 -0
- package/dist/components/HyvorBar/BarSupport.svelte +183 -0
- package/dist/components/HyvorBar/BarSupport.svelte.d.ts +8 -0
- package/dist/components/HyvorBar/BarUpdates.svelte +68 -0
- package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +7 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte +159 -0
- package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +7 -0
- package/dist/components/HyvorBar/BarUser.svelte +72 -0
- package/dist/components/HyvorBar/BarUser.svelte.d.ts +5 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte +43 -0
- package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +18 -0
- package/dist/components/HyvorBar/HyvorBar.svelte +183 -0
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +8 -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 +26 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte +11 -0
- package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +26 -0
- package/dist/components/IconButton/IconButton.svelte +49 -32
- package/dist/components/IconButton/IconButton.svelte.d.ts +10 -33
- package/dist/components/IconMessage/IconMessage.svelte +157 -51
- package/dist/components/IconMessage/IconMessage.svelte.d.ts +19 -27
- package/dist/components/Internationalization/InternationalizationProvider.svelte +15 -8
- package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +7 -19
- package/dist/components/Internationalization/LanguageToggle.svelte +80 -57
- package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +11 -22
- package/dist/components/Internationalization/T.svelte +158 -114
- package/dist/components/Internationalization/T.svelte.d.ts +17 -15
- package/dist/components/Internationalization/i18n.d.ts +3 -5
- package/dist/components/Internationalization/i18n.js +13 -11
- package/dist/components/Internationalization/t.d.ts +2 -3
- package/dist/components/Internationalization/t.js +4 -4
- package/dist/components/Internationalization/types.d.ts +2 -1
- package/dist/components/Link/Link.svelte +68 -61
- package/dist/components/Link/Link.svelte.d.ts +11 -34
- package/dist/components/Loader/LoadButton.svelte +39 -38
- package/dist/components/Loader/LoadButton.svelte.d.ts +29 -42
- package/dist/components/Loader/Loader.svelte +121 -107
- package/dist/components/Loader/Loader.svelte.d.ts +15 -27
- package/dist/components/Modal/ConfirmModalProvider.svelte +41 -51
- package/dist/components/Modal/ConfirmModalProvider.svelte.d.ts +3 -14
- package/dist/components/Modal/Modal.svelte +202 -203
- package/dist/components/Modal/Modal.svelte.d.ts +31 -29
- package/dist/components/Modal/ModalFooter.svelte +36 -31
- package/dist/components/Modal/ModalFooter.svelte.d.ts +22 -18
- package/dist/components/Modal/confirm.d.ts +2 -2
- package/dist/components/Modal/confirm.js +4 -4
- package/dist/components/Modal/modal-types.d.ts +4 -4
- package/dist/components/NavLink/NavLink.svelte +94 -89
- package/dist/components/NavLink/NavLink.svelte.d.ts +11 -33
- package/dist/components/Radio/Radio.svelte +46 -35
- package/dist/components/Radio/Radio.svelte.d.ts +10 -33
- package/dist/components/Slider/Slider.svelte +129 -120
- package/dist/components/Slider/Slider.svelte.d.ts +24 -20
- package/dist/components/SplitControl/SplitControl.svelte +43 -48
- package/dist/components/SplitControl/SplitControl.svelte.d.ts +11 -24
- package/dist/components/Switch/Switch.svelte +77 -67
- package/dist/components/Switch/Switch.svelte.d.ts +8 -31
- package/dist/components/TabNav/TabNav.svelte +33 -23
- package/dist/components/TabNav/TabNav.svelte.d.ts +7 -19
- package/dist/components/TabNav/TabNavItem.svelte +65 -51
- package/dist/components/TabNav/TabNavItem.svelte.d.ts +10 -24
- package/dist/components/Table/Table.svelte +17 -7
- package/dist/components/Table/Table.svelte.d.ts +7 -19
- package/dist/components/Table/TableRow.svelte +32 -24
- package/dist/components/Table/TableRow.svelte.d.ts +7 -19
- package/dist/components/Tag/Tag.svelte +75 -49
- package/dist/components/Tag/Tag.svelte.d.ts +16 -39
- package/dist/components/Text/Text.svelte +33 -26
- package/dist/components/Text/Text.svelte.d.ts +10 -22
- package/dist/components/TextInput/TextInput.svelte +54 -33
- package/dist/components/TextInput/TextInput.svelte.d.ts +12 -36
- package/dist/components/Textarea/Textarea.svelte +68 -46
- package/dist/components/Textarea/Textarea.svelte.d.ts +13 -37
- package/dist/components/Toast/ToastIcon.svelte +55 -46
- package/dist/components/Toast/ToastIcon.svelte.d.ts +5 -16
- package/dist/components/Toast/ToastMessage.svelte +42 -41
- package/dist/components/Toast/ToastMessage.svelte.d.ts +5 -16
- package/dist/components/Toast/ToastProvider.svelte +22 -20
- package/dist/components/Toast/ToastProvider.svelte.d.ts +16 -12
- package/dist/components/Toast/cleaner.js +5 -5
- package/dist/components/Toast/toast.d.ts +3 -3
- package/dist/components/Toast/toast.js +10 -10
- package/dist/components/Tooltip/Tooltip.svelte +163 -148
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +35 -23
- 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 +15 -9
- package/dist/marketing/Container/Container.svelte.d.ts +6 -18
- package/dist/marketing/Docs/Content/Content.svelte +48 -35
- package/dist/marketing/Docs/Content/Content.svelte.d.ts +5 -16
- package/dist/marketing/Docs/Content/DocsImage.svelte +67 -69
- package/dist/marketing/Docs/Content/DocsImage.svelte.d.ts +9 -20
- package/dist/marketing/Docs/Docs.svelte +28 -25
- package/dist/marketing/Docs/Docs.svelte.d.ts +6 -29
- package/dist/marketing/Docs/Nav/Nav.svelte +96 -70
- package/dist/marketing/Docs/Nav/Nav.svelte.d.ts +5 -16
- package/dist/marketing/Docs/Nav/NavCategory.svelte +39 -29
- package/dist/marketing/Docs/Nav/NavCategory.svelte.d.ts +8 -20
- package/dist/marketing/Docs/Nav/NavItem.svelte +30 -26
- package/dist/marketing/Docs/Nav/NavItem.svelte.d.ts +6 -18
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte +22 -25
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte.d.ts +22 -19
- package/dist/marketing/Docs/Toc.svelte +64 -56
- package/dist/marketing/Docs/Toc.svelte.d.ts +3 -14
- package/dist/marketing/Document/Document.svelte +15 -8
- package/dist/marketing/Document/Document.svelte.d.ts +7 -19
- package/dist/marketing/Document/DocumentTitle.svelte +65 -54
- package/dist/marketing/Document/DocumentTitle.svelte.d.ts +9 -20
- package/dist/marketing/Footer/Footer.svelte +154 -145
- package/dist/marketing/Footer/Footer.svelte.d.ts +8 -20
- package/dist/marketing/Footer/FooterLinkList.svelte +31 -27
- package/dist/marketing/Footer/FooterLinkList.svelte.d.ts +6 -18
- package/dist/marketing/Header/Header.svelte +47 -37
- package/dist/marketing/Header/Header.svelte.d.ts +10 -22
- package/dist/marketing/Logo/LogoBlogs.svelte +46 -0
- package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +5 -0
- package/dist/marketing/Logo/LogoCore.svelte +46 -0
- package/dist/marketing/Logo/LogoCore.svelte.d.ts +5 -0
- package/dist/marketing/Logo/LogoFortguard.svelte +54 -0
- package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +5 -0
- package/dist/marketing/Logo/LogoTalk.svelte +32 -0
- package/dist/marketing/Logo/LogoTalk.svelte.d.ts +5 -0
- package/dist/stores/dark.d.ts +0 -1
- package/dist/stores/dark.js +8 -8
- package/dist/variables.scss +41 -48
- package/package.json +59 -58
|
@@ -1,210 +1,209 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot making the component unusable -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import ModalFooter from './ModalFooter.svelte';
|
|
4
|
+
import type { Footer } from './modal-types.js';
|
|
5
|
+
import { clickOutside } from '../directives/clickOutside.js';
|
|
6
|
+
import { IconX } from '@hyvor/icons';
|
|
7
|
+
import IconButton from './../IconButton/IconButton.svelte';
|
|
8
|
+
import { fade, scale } from 'svelte/transition';
|
|
9
|
+
import { onMount, tick, type Snippet } from 'svelte';
|
|
10
|
+
import Loader from '../Loader/Loader.svelte';
|
|
11
|
+
import { createEventDispatcher } from 'svelte';
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
show?: boolean;
|
|
15
|
+
title?: string | Snippet;
|
|
16
|
+
size?: 'small' | 'medium' | 'large';
|
|
17
|
+
id?: string;
|
|
18
|
+
role?: 'dialog' | 'alertdialog';
|
|
19
|
+
closeOnOutsideClick?: boolean;
|
|
20
|
+
closeOnEscape?: boolean;
|
|
21
|
+
loading?: boolean | string;
|
|
22
|
+
|
|
23
|
+
footer?: Footer | Snippet;
|
|
24
|
+
children?: Snippet;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
show = $bindable(false),
|
|
29
|
+
title,
|
|
30
|
+
size = 'medium',
|
|
31
|
+
id = 'modal',
|
|
32
|
+
role = 'alertdialog',
|
|
33
|
+
closeOnOutsideClick = true,
|
|
34
|
+
closeOnEscape = true,
|
|
35
|
+
loading = false,
|
|
36
|
+
footer,
|
|
37
|
+
children
|
|
38
|
+
}: Props = $props();
|
|
39
|
+
|
|
40
|
+
const dispatch = createEventDispatcher();
|
|
41
|
+
|
|
42
|
+
const titleId = id + '-title';
|
|
43
|
+
const descId = id + '-desc';
|
|
44
|
+
|
|
45
|
+
let wrapEl: HTMLDivElement | undefined = $state();
|
|
46
|
+
let innerEl: HTMLDivElement | undefined = $state();
|
|
47
|
+
|
|
48
|
+
function handleCancel() {
|
|
49
|
+
show = false;
|
|
50
|
+
dispatch('cancel');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function setFlex() {
|
|
54
|
+
await tick();
|
|
55
|
+
if (!wrapEl || !innerEl) return;
|
|
56
|
+
if (innerEl.offsetHeight > wrapEl.offsetHeight - 60) {
|
|
57
|
+
wrapEl.style.alignItems = 'flex-start';
|
|
58
|
+
} else {
|
|
59
|
+
wrapEl.style.alignItems = 'center';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
onMount(setFlex);
|
|
64
|
+
|
|
65
|
+
$effect(() => {
|
|
66
|
+
show;
|
|
67
|
+
setFlex();
|
|
68
|
+
});
|
|
40
69
|
</script>
|
|
41
70
|
|
|
42
|
-
<svelte:window
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
71
|
+
<svelte:window
|
|
72
|
+
on:keyup={(e) => {
|
|
73
|
+
if (e.key === 'Escape' && closeOnEscape && !loading) {
|
|
74
|
+
show = false;
|
|
75
|
+
}
|
|
76
|
+
}}
|
|
77
|
+
/>
|
|
48
78
|
|
|
49
79
|
{#if show}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{#if $$slots.footer}
|
|
107
|
-
<slot name="footer" />
|
|
108
|
-
{:else if footer}
|
|
109
|
-
<ModalFooter
|
|
110
|
-
{footer}
|
|
111
|
-
bind:show={show}
|
|
112
|
-
on:cancel
|
|
113
|
-
on:confirm
|
|
114
|
-
/>
|
|
115
|
-
{/if}
|
|
116
|
-
</div>
|
|
117
|
-
{/if}
|
|
118
|
-
|
|
119
|
-
{#if loading}
|
|
120
|
-
<div
|
|
121
|
-
class="loading"
|
|
122
|
-
in:fade={{duration: 100}}
|
|
123
|
-
>
|
|
124
|
-
<Loader full>
|
|
125
|
-
{#if typeof loading === "string"}
|
|
126
|
-
{loading}
|
|
127
|
-
{/if}
|
|
128
|
-
</Loader>
|
|
129
|
-
</div>
|
|
130
|
-
{/if}
|
|
131
|
-
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
</div>
|
|
80
|
+
<div class="wrap" bind:this={wrapEl} in:fade={{ duration: 100 }} out:fade={{ duration: 100 }}>
|
|
81
|
+
<div
|
|
82
|
+
class="inner {size}"
|
|
83
|
+
use:clickOutside={{
|
|
84
|
+
enabled: closeOnOutsideClick,
|
|
85
|
+
callback: () => (!loading ? (show = false) : null)
|
|
86
|
+
}}
|
|
87
|
+
in:scale={{ duration: 100, start: 0.9, opacity: 0.9 }}
|
|
88
|
+
out:scale={{ duration: 100, start: 0.9, opacity: 0.9 }}
|
|
89
|
+
bind:this={innerEl}
|
|
90
|
+
{role}
|
|
91
|
+
aria-modal="true"
|
|
92
|
+
aria-labelledby={titleId}
|
|
93
|
+
aria-describedby={descId}
|
|
94
|
+
>
|
|
95
|
+
<div class="header">
|
|
96
|
+
<div class="title" id={titleId}>
|
|
97
|
+
{#if typeof title === 'string'}
|
|
98
|
+
<span>{title}</span>
|
|
99
|
+
{:else}
|
|
100
|
+
{@render title?.()}
|
|
101
|
+
{/if}
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div class="close-wrap">
|
|
105
|
+
<IconButton variant="invisible" on:click={handleCancel}>
|
|
106
|
+
<IconX size={25} />
|
|
107
|
+
</IconButton>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="content" id={descId}>
|
|
112
|
+
{@render children?.()}
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
{#if footer}
|
|
116
|
+
<div class="footer">
|
|
117
|
+
{#if typeof footer === 'object'}
|
|
118
|
+
<ModalFooter {footer} bind:show on:cancel on:confirm />
|
|
119
|
+
{:else}
|
|
120
|
+
{@render footer()}
|
|
121
|
+
{/if}
|
|
122
|
+
</div>
|
|
123
|
+
{/if}
|
|
124
|
+
|
|
125
|
+
{#if loading}
|
|
126
|
+
<div class="loading" in:fade={{ duration: 100 }}>
|
|
127
|
+
<Loader full>
|
|
128
|
+
{#if typeof loading === 'string'}
|
|
129
|
+
{loading}
|
|
130
|
+
{/if}
|
|
131
|
+
</Loader>
|
|
132
|
+
</div>
|
|
133
|
+
{/if}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
135
136
|
{/if}
|
|
136
137
|
|
|
137
138
|
<style>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
</style>
|
|
139
|
+
.loading {
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 0;
|
|
142
|
+
left: 0;
|
|
143
|
+
z-index: 1;
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
background-color: var(--box-background);
|
|
147
|
+
border-radius: var(--box-radius);
|
|
148
|
+
box-shadow: var(--box-shadow);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.wrap {
|
|
152
|
+
position: fixed;
|
|
153
|
+
top: 0;
|
|
154
|
+
left: 0;
|
|
155
|
+
z-index: 10000000;
|
|
156
|
+
width: 100%;
|
|
157
|
+
height: 100%;
|
|
158
|
+
background: rgba(0, 0, 0, 0.5);
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
padding: 30px;
|
|
163
|
+
overflow: auto;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.inner {
|
|
167
|
+
background: var(--box-background);
|
|
168
|
+
border-radius: var(--box-radius);
|
|
169
|
+
box-shadow: var(--box-shadow);
|
|
170
|
+
width: 650px;
|
|
171
|
+
max-width: 100%;
|
|
172
|
+
position: relative;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.inner.small {
|
|
176
|
+
width: 425px;
|
|
177
|
+
}
|
|
178
|
+
.inner.large {
|
|
179
|
+
width: 800px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.header {
|
|
183
|
+
padding: 20px 25px;
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.title {
|
|
189
|
+
flex: 1;
|
|
190
|
+
}
|
|
191
|
+
.title span {
|
|
192
|
+
font-size: 1.2em;
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.content {
|
|
197
|
+
padding: 20px 25px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.footer {
|
|
201
|
+
padding: 20px 25px;
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: flex-end;
|
|
205
|
+
}
|
|
206
|
+
.footer :global(button:not(:last-child)) {
|
|
207
|
+
margin-right: 2px;
|
|
208
|
+
}
|
|
209
|
+
</style>
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Footer } from './modal-types.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
4
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
+
$$bindings?: Bindings;
|
|
6
|
+
} & Exports;
|
|
7
|
+
(internal: unknown, props: Props & {
|
|
8
|
+
$$events?: Events;
|
|
9
|
+
$$slots?: Slots;
|
|
10
|
+
}): Exports & {
|
|
11
|
+
$set?: any;
|
|
12
|
+
$on?: any;
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
cancel: CustomEvent<any>;
|
|
17
|
-
confirm: CustomEvent<any>;
|
|
18
|
-
} & {
|
|
19
|
-
[evt: string]: CustomEvent<any>;
|
|
20
|
-
};
|
|
21
|
-
slots: {
|
|
22
|
-
title: {};
|
|
23
|
-
default: {};
|
|
24
|
-
footer: {};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export type ModalProps = typeof __propDef.props;
|
|
28
|
-
export type ModalEvents = typeof __propDef.events;
|
|
29
|
-
export type ModalSlots = typeof __propDef.slots;
|
|
30
|
-
export default class Modal extends SvelteComponent<ModalProps, ModalEvents, ModalSlots> {
|
|
14
|
+
z_$$bindings?: Bindings;
|
|
31
15
|
}
|
|
32
|
-
|
|
16
|
+
declare const Modal: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
+
show?: boolean;
|
|
18
|
+
title?: string | Snippet;
|
|
19
|
+
size?: "small" | "medium" | "large";
|
|
20
|
+
id?: string;
|
|
21
|
+
role?: "dialog" | "alertdialog";
|
|
22
|
+
closeOnOutsideClick?: boolean;
|
|
23
|
+
closeOnEscape?: boolean;
|
|
24
|
+
loading?: boolean | string;
|
|
25
|
+
footer?: Footer | Snippet;
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
}, {
|
|
28
|
+
cancel: CustomEvent<any>;
|
|
29
|
+
confirm: CustomEvent<any>;
|
|
30
|
+
} & {
|
|
31
|
+
[evt: string]: CustomEvent<any>;
|
|
32
|
+
}, {}, {}, "show">;
|
|
33
|
+
type Modal = InstanceType<typeof Modal>;
|
|
34
|
+
export default Modal;
|
|
@@ -1,36 +1,41 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const dispatch = createEventDispatcher();
|
|
7
|
-
</script>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from 'svelte';
|
|
3
|
+
import Button from '../Button/Button.svelte';
|
|
4
|
+
import ButtonGroup from '../Button/ButtonGroup.svelte';
|
|
5
|
+
import type { Footer } from './modal-types.ts';
|
|
8
6
|
|
|
7
|
+
interface Props {
|
|
8
|
+
show: boolean;
|
|
9
|
+
footer: Footer;
|
|
10
|
+
}
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
let { show = $bindable(), footer }: Props = $props();
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
variant="invisible"
|
|
15
|
-
on:click={() => {
|
|
16
|
-
show = false;
|
|
17
|
-
dispatch("cancel");
|
|
18
|
-
}}
|
|
19
|
-
{...footer.cancel?.props}
|
|
20
|
-
>
|
|
21
|
-
{footer.cancel?.text || "Cancel"}
|
|
22
|
-
</Button>
|
|
23
|
-
{/if}
|
|
14
|
+
const dispatch = createEventDispatcher();
|
|
15
|
+
</script>
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
<ButtonGroup>
|
|
18
|
+
{#if footer.cancel !== false}
|
|
19
|
+
<Button
|
|
20
|
+
variant="invisible"
|
|
21
|
+
on:click={() => {
|
|
22
|
+
show = false;
|
|
23
|
+
dispatch('cancel');
|
|
24
|
+
}}
|
|
25
|
+
{...footer.cancel?.props}
|
|
26
|
+
>
|
|
27
|
+
{footer.cancel?.text || 'Cancel'}
|
|
28
|
+
</Button>
|
|
29
|
+
{/if}
|
|
35
30
|
|
|
36
|
-
|
|
31
|
+
{#if footer.confirm !== false}
|
|
32
|
+
<Button
|
|
33
|
+
variant="fill"
|
|
34
|
+
color={footer.confirm?.danger ? 'red' : 'accent'}
|
|
35
|
+
on:click={() => dispatch('confirm')}
|
|
36
|
+
{...footer.confirm?.props}
|
|
37
|
+
>
|
|
38
|
+
{footer.confirm?.text || 'Confirm'}
|
|
39
|
+
</Button>
|
|
40
|
+
{/if}
|
|
41
|
+
</ButtonGroup>
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Footer } from './modal-types.ts';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
7
12
|
};
|
|
8
|
-
|
|
9
|
-
cancel: CustomEvent<any>;
|
|
10
|
-
confirm: CustomEvent<any>;
|
|
11
|
-
} & {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {};
|
|
15
|
-
};
|
|
16
|
-
export type ModalFooterProps = typeof __propDef.props;
|
|
17
|
-
export type ModalFooterEvents = typeof __propDef.events;
|
|
18
|
-
export type ModalFooterSlots = typeof __propDef.slots;
|
|
19
|
-
export default class ModalFooter extends SvelteComponent<ModalFooterProps, ModalFooterEvents, ModalFooterSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
20
14
|
}
|
|
21
|
-
|
|
15
|
+
declare const ModalFooter: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
show: boolean;
|
|
17
|
+
footer: Footer;
|
|
18
|
+
}, {
|
|
19
|
+
cancel: CustomEvent<any>;
|
|
20
|
+
confirm: CustomEvent<any>;
|
|
21
|
+
} & {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, "show">;
|
|
24
|
+
type ModalFooter = InstanceType<typeof ModalFooter>;
|
|
25
|
+
export default ModalFooter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Component } from 'svelte';
|
|
2
2
|
interface ConfirmConfig {
|
|
3
3
|
title: string;
|
|
4
|
-
content: string |
|
|
4
|
+
content: string | Component<any>;
|
|
5
5
|
contentProps?: Record<string, any>;
|
|
6
6
|
confirmText?: string;
|
|
7
7
|
cancelText?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {} from
|
|
2
|
-
import { writable } from
|
|
1
|
+
import {} from 'svelte';
|
|
2
|
+
import { writable } from 'svelte/store';
|
|
3
3
|
export const confirmStore = writable(null);
|
|
4
4
|
export function confirm(config) {
|
|
5
5
|
function getOptions() {
|
|
@@ -12,7 +12,7 @@ export function confirm(config) {
|
|
|
12
12
|
return store;
|
|
13
13
|
});
|
|
14
14
|
},
|
|
15
|
-
close: () => confirmStore.set(null)
|
|
15
|
+
close: () => confirmStore.set(null)
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
return new Promise((resolve, reject) => {
|
|
@@ -27,7 +27,7 @@ export function confirm(config) {
|
|
|
27
27
|
onCancel: () => {
|
|
28
28
|
resolve(false);
|
|
29
29
|
confirmStore.set(null);
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import type Button from
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import type Button from '../Button/Button.svelte';
|
|
3
3
|
export interface Footer {
|
|
4
4
|
/**
|
|
5
5
|
* undefined: default cancel button
|
|
@@ -8,11 +8,11 @@ export interface Footer {
|
|
|
8
8
|
*/
|
|
9
9
|
cancel?: false | {
|
|
10
10
|
text?: string;
|
|
11
|
-
props?: ComponentProps<Button>;
|
|
11
|
+
props?: ComponentProps<typeof Button>;
|
|
12
12
|
};
|
|
13
13
|
confirm?: false | {
|
|
14
14
|
danger?: boolean;
|
|
15
15
|
text?: string;
|
|
16
|
-
props?: ComponentProps<Button>;
|
|
16
|
+
props?: ComponentProps<typeof Button>;
|
|
17
17
|
};
|
|
18
18
|
}
|