@hyvor/design 0.0.68 → 1.0.5
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 +22 -9
- package/dist/components/ActionList/ActionList.svelte.d.ts +8 -19
- package/dist/components/ActionList/ActionListGroup.svelte +18 -8
- package/dist/components/ActionList/ActionListGroup.svelte.d.ts +8 -19
- package/dist/components/ActionList/ActionListItem.svelte +49 -25
- package/dist/components/ActionList/ActionListItem.svelte.d.ts +28 -25
- package/dist/components/ActionList/Selected.svelte +10 -4
- package/dist/components/ActionList/Selected.svelte.d.ts +6 -16
- package/dist/components/Avatar/Avatar.svelte +16 -9
- package/dist/components/Avatar/Avatar.svelte.d.ts +7 -17
- package/dist/components/Avatar/AvatarStack.svelte +14 -8
- package/dist/components/Avatar/AvatarStack.svelte.d.ts +6 -17
- package/dist/components/Base/Base.svelte +14 -6
- package/dist/components/Base/Base.svelte.d.ts +6 -17
- package/dist/components/Box/Box.svelte +10 -3
- package/dist/components/Box/Box.svelte.d.ts +7 -18
- package/dist/components/Button/Button.svelte +52 -25
- package/dist/components/Button/Button.svelte.d.ts +16 -38
- package/dist/components/Button/ButtonGroup.svelte +9 -1
- package/dist/components/Button/ButtonGroup.svelte.d.ts +5 -26
- package/dist/components/Callout/Callout.svelte +41 -20
- package/dist/components/Callout/Callout.svelte.d.ts +11 -22
- package/dist/components/Checkbox/Checkbox.svelte +58 -38
- package/dist/components/Checkbox/Checkbox.svelte.d.ts +11 -34
- package/dist/components/CodeBlock/CodeBlock.svelte +21 -11
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +7 -16
- package/dist/components/CodeBlock/getCode.js +2 -0
- package/dist/components/ColorPicker/ColorPicker.svelte +34 -15
- package/dist/components/ColorPicker/ColorPicker.svelte.d.ts +26 -19
- package/dist/components/Dark/DarkProvider.svelte +7 -5
- package/dist/components/Dark/DarkProvider.svelte.d.ts +16 -12
- package/dist/components/Dark/DarkToggle.svelte +8 -6
- package/dist/components/Dark/DarkToggle.svelte.d.ts +16 -12
- package/dist/components/Divider/Divider.svelte +17 -6
- package/dist/components/Divider/Divider.svelte.d.ts +9 -19
- package/dist/components/Dropdown/Dropdown.svelte +33 -14
- package/dist/components/Dropdown/Dropdown.svelte.d.ts +13 -23
- package/dist/components/Dropdown/DropdownContent.svelte +124 -92
- package/dist/components/Dropdown/DropdownContent.svelte.d.ts +12 -24
- package/dist/components/FormControl/Caption.svelte +10 -3
- package/dist/components/FormControl/Caption.svelte.d.ts +7 -18
- package/dist/components/FormControl/FormControl.svelte +11 -2
- package/dist/components/FormControl/FormControl.svelte.d.ts +6 -26
- package/dist/components/FormControl/InputGroup.svelte +17 -9
- package/dist/components/FormControl/InputGroup.svelte.d.ts +7 -18
- package/dist/components/FormControl/Label.svelte +11 -2
- package/dist/components/FormControl/Label.svelte.d.ts +6 -26
- package/dist/components/FormControl/Validation.svelte +18 -9
- package/dist/components/FormControl/Validation.svelte.d.ts +8 -19
- package/dist/components/HyvorBar/BarProducts.svelte +44 -25
- package/dist/components/HyvorBar/BarSupport.svelte +165 -101
- package/dist/components/HyvorBar/BarSupport.svelte.d.ts +7 -17
- package/dist/components/HyvorBar/BarUpdates.svelte +25 -15
- package/dist/components/HyvorBar/BarUpdates.svelte.d.ts +6 -16
- package/dist/components/HyvorBar/BarUpdatesList.svelte +73 -48
- package/dist/components/HyvorBar/BarUpdatesList.svelte.d.ts +6 -16
- package/dist/components/HyvorBar/BarUser.svelte +36 -24
- package/dist/components/HyvorBar/BarUser.svelte.d.ts +5 -15
- package/dist/components/HyvorBar/BarUserPreview.svelte +2 -1
- package/dist/components/HyvorBar/BarUserPreview.svelte.d.ts +16 -12
- package/dist/components/HyvorBar/HyvorBar.svelte +69 -36
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +7 -18
- package/dist/components/HyvorBar/bar.d.ts +2 -2
- package/dist/components/HyvorBar/img/G2.svelte.d.ts +22 -19
- package/dist/components/HyvorBar/img/Trustpilot.svelte.d.ts +22 -19
- package/dist/components/IconButton/IconButton.svelte +43 -22
- package/dist/components/IconButton/IconButton.svelte.d.ts +10 -32
- package/dist/components/IconMessage/IconMessage.svelte +111 -56
- package/dist/components/IconMessage/IconMessage.svelte.d.ts +19 -35
- package/dist/components/Internationalization/InternationalizationProvider.svelte +14 -7
- package/dist/components/Internationalization/InternationalizationProvider.svelte.d.ts +6 -17
- package/dist/components/Internationalization/LanguageToggle.svelte +73 -47
- package/dist/components/Internationalization/LanguageToggle.svelte.d.ts +10 -20
- 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 +1 -3
- package/dist/components/Internationalization/t.d.ts +1 -2
- package/dist/components/Internationalization/types.d.ts +1 -0
- package/dist/components/Link/Link.svelte +31 -19
- package/dist/components/Link/Link.svelte.d.ts +11 -33
- package/dist/components/Loader/LoadButton.svelte +24 -9
- package/dist/components/Loader/LoadButton.svelte.d.ts +29 -42
- package/dist/components/Loader/Loader.svelte +69 -42
- package/dist/components/Loader/Loader.svelte.d.ts +15 -26
- package/dist/components/Modal/ConfirmModalProvider.svelte +28 -20
- package/dist/components/Modal/ConfirmModalProvider.svelte.d.ts +3 -14
- package/dist/components/Modal/Modal.svelte +76 -47
- package/dist/components/Modal/Modal.svelte.d.ts +32 -29
- package/dist/components/Modal/ModalFooter.svelte +14 -6
- package/dist/components/Modal/ModalFooter.svelte.d.ts +23 -18
- package/dist/components/Modal/confirm.d.ts +2 -2
- package/dist/components/Modal/modal-types.d.ts +2 -2
- package/dist/components/NavLink/NavLink.svelte +31 -18
- package/dist/components/NavLink/NavLink.svelte.d.ts +11 -32
- package/dist/components/Radio/Radio.svelte +35 -16
- package/dist/components/Radio/Radio.svelte.d.ts +10 -32
- package/dist/components/Slider/Slider.svelte +86 -36
- package/dist/components/Slider/Slider.svelte.d.ts +25 -20
- package/dist/components/SplitControl/SplitControl.svelte +27 -18
- package/dist/components/SplitControl/SplitControl.svelte.d.ts +11 -23
- package/dist/components/Switch/Switch.svelte +30 -15
- package/dist/components/Switch/Switch.svelte.d.ts +8 -30
- package/dist/components/TabNav/TabNav.svelte +29 -15
- package/dist/components/TabNav/TabNav.svelte.d.ts +7 -18
- package/dist/components/TabNav/TabNavItem.svelte +36 -15
- package/dist/components/TabNav/TabNavItem.svelte.d.ts +10 -23
- package/dist/components/Table/Table.svelte +11 -4
- package/dist/components/Table/Table.svelte.d.ts +7 -18
- package/dist/components/Table/TableRow.svelte +11 -3
- package/dist/components/Table/TableRow.svelte.d.ts +7 -18
- package/dist/components/Tag/Tag.svelte +65 -31
- package/dist/components/Tag/Tag.svelte.d.ts +16 -38
- package/dist/components/Text/Text.svelte +20 -6
- package/dist/components/Text/Text.svelte.d.ts +10 -21
- package/dist/components/TextInput/TextInput.svelte +81 -28
- package/dist/components/TextInput/TextInput.svelte.d.ts +14 -36
- package/dist/components/Textarea/Textarea.svelte +46 -24
- package/dist/components/Textarea/Textarea.svelte.d.ts +13 -37
- package/dist/components/Toast/ToastIcon.svelte +26 -15
- package/dist/components/Toast/ToastIcon.svelte.d.ts +5 -15
- package/dist/components/Toast/ToastMessage.svelte +11 -4
- package/dist/components/Toast/ToastMessage.svelte.d.ts +5 -15
- package/dist/components/Toast/ToastProvider.svelte +6 -4
- package/dist/components/Toast/ToastProvider.svelte.d.ts +16 -12
- package/dist/components/Toast/toast.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.svelte +71 -55
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +35 -23
- package/dist/marketing/Container/Container.svelte +8 -2
- package/dist/marketing/Container/Container.svelte.d.ts +6 -17
- package/dist/marketing/Docs/Content/Content.svelte +41 -29
- package/dist/marketing/Docs/Content/Content.svelte.d.ts +5 -15
- package/dist/marketing/Docs/Content/DocsImage.svelte +17 -9
- package/dist/marketing/Docs/Content/DocsImage.svelte.d.ts +9 -19
- package/dist/marketing/Docs/Docs.svelte +9 -3
- package/dist/marketing/Docs/Docs.svelte.d.ts +6 -28
- package/dist/marketing/Docs/Nav/Nav.svelte +77 -50
- package/dist/marketing/Docs/Nav/Nav.svelte.d.ts +5 -15
- package/dist/marketing/Docs/Nav/NavCategory.svelte +16 -6
- package/dist/marketing/Docs/Nav/NavCategory.svelte.d.ts +8 -19
- package/dist/marketing/Docs/Nav/NavItem.svelte +10 -3
- package/dist/marketing/Docs/Nav/NavItem.svelte.d.ts +6 -17
- package/dist/marketing/Docs/Sidebar/Sidebar.svelte.d.ts +22 -19
- package/dist/marketing/Docs/Toc.svelte +49 -39
- package/dist/marketing/Docs/Toc.svelte.d.ts +3 -14
- package/dist/marketing/Document/Document.svelte +11 -4
- package/dist/marketing/Document/Document.svelte.d.ts +7 -18
- package/dist/marketing/Document/DocumentTitle.svelte +16 -5
- package/dist/marketing/Document/DocumentTitle.svelte.d.ts +9 -19
- package/dist/marketing/Footer/Footer.svelte +55 -38
- package/dist/marketing/Footer/Footer.svelte.d.ts +8 -19
- package/dist/marketing/Footer/FooterLinkList.svelte +8 -2
- package/dist/marketing/Footer/FooterLinkList.svelte.d.ts +6 -17
- package/dist/marketing/Header/Header.svelte +41 -23
- package/dist/marketing/Header/Header.svelte.d.ts +10 -21
- package/dist/marketing/Logo/LogoBlogs.svelte +6 -1
- package/dist/marketing/Logo/LogoBlogs.svelte.d.ts +5 -15
- package/dist/marketing/Logo/LogoCore.svelte +6 -1
- package/dist/marketing/Logo/LogoCore.svelte.d.ts +5 -15
- package/dist/marketing/Logo/LogoFortguard.svelte +7 -2
- package/dist/marketing/Logo/LogoFortguard.svelte.d.ts +5 -15
- package/dist/marketing/Logo/LogoTalk.svelte +6 -1
- package/dist/marketing/Logo/LogoTalk.svelte.d.ts +5 -15
- package/dist/stores/dark.d.ts +0 -1
- package/package.json +10 -10
- package/dist/components/HyvorBar/BarProducts.svelte.d.ts +0 -39
|
@@ -1,42 +1,69 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
<script lang="ts">
|
|
2
|
+
import { run } from 'svelte/legacy';
|
|
3
|
+
|
|
4
|
+
import { IconCheckCircleFill, IconXCircleFill } from '@hyvor/icons';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
block?: boolean;
|
|
8
|
+
full?: boolean;
|
|
9
|
+
padding?: 'none' | 'small' | 'medium' | 'large' | number;
|
|
10
|
+
size?: 'small' | 'medium' | 'large' | number;
|
|
11
|
+
state?: 'loading' | 'success' | 'error' | 'none';
|
|
12
|
+
duration?: null | number;
|
|
13
|
+
color?: string;
|
|
14
|
+
colorTrack?: string;
|
|
15
|
+
invert?: boolean;
|
|
16
|
+
children?: import('svelte').Snippet;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
block = false,
|
|
22
|
+
full = false,
|
|
23
|
+
padding = $bindable('medium'),
|
|
24
|
+
size = $bindable('medium'),
|
|
25
|
+
state = $bindable('loading'),
|
|
26
|
+
duration = 2000,
|
|
27
|
+
color = $bindable('var(--accent)'),
|
|
28
|
+
colorTrack = $bindable('var(--accent-lightest)'),
|
|
29
|
+
invert = false,
|
|
30
|
+
children,
|
|
31
|
+
...rest
|
|
32
|
+
}: Props = $props();
|
|
33
|
+
|
|
34
|
+
if (invert) {
|
|
35
|
+
const colorCopy = color;
|
|
36
|
+
color = colorTrack;
|
|
37
|
+
colorTrack = colorCopy;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const sizes = {
|
|
41
|
+
small: 16,
|
|
42
|
+
medium: 24,
|
|
43
|
+
large: 32
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
size = typeof size === 'number' ? size : sizes[size];
|
|
47
|
+
|
|
48
|
+
const strokeWidth = size >= 32 ? 5 : size >= 24 ? 4 : size >= 16 ? 3 : 2;
|
|
49
|
+
const r = size / 2 - strokeWidth / 2;
|
|
50
|
+
const strokeDashArray = 2 * Math.PI * r;
|
|
51
|
+
const strokeDashOffset = strokeDashArray - strokeDashArray * 0.25;
|
|
52
|
+
|
|
53
|
+
const paddings = {
|
|
54
|
+
none: 0,
|
|
55
|
+
small: 60,
|
|
56
|
+
medium: 150,
|
|
57
|
+
large: 250
|
|
58
|
+
};
|
|
59
|
+
padding = typeof padding === 'number' ? padding : paddings[padding];
|
|
60
|
+
run(() => {
|
|
61
|
+
if (duration && (state === 'success' || state === 'error')) {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
state = 'none';
|
|
64
|
+
}, duration);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
40
67
|
</script>
|
|
41
68
|
|
|
42
69
|
<div
|
|
@@ -47,7 +74,7 @@ padding = typeof padding === "number" ? padding : paddings[padding];
|
|
|
47
74
|
class:error={state === 'error'}
|
|
48
75
|
style:--local-size={size + 'px'}
|
|
49
76
|
style:padding={block ? padding + 'px' : undefined}
|
|
50
|
-
{
|
|
77
|
+
{...rest}
|
|
51
78
|
>
|
|
52
79
|
{#if state !== 'none'}
|
|
53
80
|
<span class="loader-wrap">
|
|
@@ -87,9 +114,9 @@ padding = typeof padding === "number" ? padding : paddings[padding];
|
|
|
87
114
|
</span>
|
|
88
115
|
{/if}
|
|
89
116
|
|
|
90
|
-
{#if
|
|
117
|
+
{#if children}
|
|
91
118
|
<div class="message">
|
|
92
|
-
|
|
119
|
+
{@render children?.()}
|
|
93
120
|
</div>
|
|
94
121
|
{/if}
|
|
95
122
|
</div>
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
invert?: boolean | undefined;
|
|
14
|
-
};
|
|
15
|
-
events: {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
};
|
|
18
|
-
slots: {
|
|
19
|
-
default: {};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export type LoaderProps = typeof __propDef.props;
|
|
23
|
-
export type LoaderEvents = typeof __propDef.events;
|
|
24
|
-
export type LoaderSlots = typeof __propDef.slots;
|
|
25
|
-
export default class Loader extends SvelteComponent<LoaderProps, LoaderEvents, LoaderSlots> {
|
|
1
|
+
interface Props {
|
|
2
|
+
block?: boolean;
|
|
3
|
+
full?: boolean;
|
|
4
|
+
padding?: 'none' | 'small' | 'medium' | 'large' | number;
|
|
5
|
+
size?: 'small' | 'medium' | 'large' | number;
|
|
6
|
+
state?: 'loading' | 'success' | 'error' | 'none';
|
|
7
|
+
duration?: null | number;
|
|
8
|
+
color?: string;
|
|
9
|
+
colorTrack?: string;
|
|
10
|
+
invert?: boolean;
|
|
11
|
+
children?: import('svelte').Snippet;
|
|
12
|
+
[key: string]: any;
|
|
26
13
|
}
|
|
27
|
-
|
|
14
|
+
declare const Loader: import("svelte").Component<Props, {}, "size" | "color" | "padding" | "state" | "colorTrack">;
|
|
15
|
+
type Loader = ReturnType<typeof Loader>;
|
|
16
|
+
export default Loader;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { run } from 'svelte/legacy';
|
|
3
|
+
|
|
4
|
+
import Modal from './Modal.svelte';
|
|
5
|
+
import { confirmStore } from './confirm.js';
|
|
6
|
+
import Button from './../Button/Button.svelte';
|
|
7
|
+
import ButtonGroup from './../Button/ButtonGroup.svelte';
|
|
8
|
+
|
|
9
|
+
let show = $state(true);
|
|
10
|
+
|
|
11
|
+
function handleCancel() {
|
|
12
|
+
$confirmStore!.onCancel();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function handleConfirm() {
|
|
16
|
+
$confirmStore!.onConfirm();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
run(() => {
|
|
20
|
+
if (!show) {
|
|
21
|
+
handleCancel();
|
|
22
|
+
show = true;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
18
25
|
</script>
|
|
19
26
|
|
|
20
27
|
{#if $confirmStore}
|
|
@@ -22,10 +29,11 @@ $: {
|
|
|
22
29
|
{#if typeof $confirmStore.content === 'string'}
|
|
23
30
|
{$confirmStore.content}
|
|
24
31
|
{:else}
|
|
25
|
-
|
|
32
|
+
{@const SvelteComponent = $confirmStore.content}
|
|
33
|
+
<SvelteComponent {...$confirmStore.contentProps || {}} />
|
|
26
34
|
{/if}
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
{#snippet footer()}
|
|
29
37
|
<ButtonGroup>
|
|
30
38
|
<Button variant="invisible" on:click={handleCancel}>
|
|
31
39
|
{$confirmStore.cancelText || 'Cancel'}
|
|
@@ -34,6 +42,6 @@ $: {
|
|
|
34
42
|
{$confirmStore.confirmText || 'Confirm'}
|
|
35
43
|
</Button>
|
|
36
44
|
</ButtonGroup>
|
|
37
|
-
|
|
45
|
+
{/snippet}
|
|
38
46
|
</Modal>
|
|
39
47
|
{/if}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
events: {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
export type ConfirmModalProviderProps = typeof __propDef.props;
|
|
10
|
-
export type ConfirmModalProviderEvents = typeof __propDef.events;
|
|
11
|
-
export type ConfirmModalProviderSlots = typeof __propDef.slots;
|
|
12
|
-
export default class ConfirmModalProvider extends SvelteComponent<ConfirmModalProviderProps, ConfirmModalProviderEvents, ConfirmModalProviderSlots> {
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
1
|
+
declare const ConfirmModalProvider: import("svelte").Component<Record<string, never>, {}, "">;
|
|
2
|
+
type ConfirmModalProvider = ReturnType<typeof ConfirmModalProvider>;
|
|
3
|
+
export default ConfirmModalProvider;
|
|
@@ -1,42 +1,71 @@
|
|
|
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
71
|
<svelte:window
|
|
@@ -65,10 +94,10 @@ $:
|
|
|
65
94
|
>
|
|
66
95
|
<div class="header">
|
|
67
96
|
<div class="title" id={titleId}>
|
|
68
|
-
{#if
|
|
69
|
-
<slot name="title" />
|
|
70
|
-
{:else}
|
|
97
|
+
{#if typeof title === 'string'}
|
|
71
98
|
<span>{title}</span>
|
|
99
|
+
{:else}
|
|
100
|
+
{@render title?.()}
|
|
72
101
|
{/if}
|
|
73
102
|
</div>
|
|
74
103
|
|
|
@@ -80,15 +109,15 @@ $:
|
|
|
80
109
|
</div>
|
|
81
110
|
|
|
82
111
|
<div class="content" id={descId}>
|
|
83
|
-
|
|
112
|
+
{@render children?.()}
|
|
84
113
|
</div>
|
|
85
114
|
|
|
86
|
-
{#if
|
|
115
|
+
{#if footer}
|
|
87
116
|
<div class="footer">
|
|
88
|
-
{#if
|
|
89
|
-
<slot name="footer" />
|
|
90
|
-
{:else if footer}
|
|
117
|
+
{#if typeof footer === 'object'}
|
|
91
118
|
<ModalFooter {footer} bind:show on:cancel on:confirm />
|
|
119
|
+
{:else}
|
|
120
|
+
{@render footer()}
|
|
92
121
|
{/if}
|
|
93
122
|
</div>
|
|
94
123
|
{/if}
|
|
@@ -1,32 +1,35 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
interface Props {
|
|
4
|
+
show?: boolean;
|
|
5
|
+
title?: string | Snippet;
|
|
6
|
+
size?: 'small' | 'medium' | 'large';
|
|
7
|
+
id?: string;
|
|
8
|
+
role?: 'dialog' | 'alertdialog';
|
|
9
|
+
closeOnOutsideClick?: boolean;
|
|
10
|
+
closeOnEscape?: boolean;
|
|
11
|
+
loading?: boolean | string;
|
|
12
|
+
footer?: Footer | Snippet;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
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> {
|
|
16
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: Props & {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
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> {
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
31
27
|
}
|
|
32
|
-
|
|
28
|
+
declare const Modal: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
29
|
+
cancel: CustomEvent<any>;
|
|
30
|
+
confirm: CustomEvent<any>;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
}, {}, {}, "show">;
|
|
34
|
+
type Modal = InstanceType<typeof Modal>;
|
|
35
|
+
export default Modal;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
show: boolean;
|
|
9
|
+
footer: Footer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { show = $bindable(), footer }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const dispatch = createEventDispatcher();
|
|
7
15
|
</script>
|
|
8
16
|
|
|
9
17
|
<ButtonGroup>
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { Footer } from './modal-types.ts';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
interface Props {
|
|
3
|
+
show: boolean;
|
|
4
|
+
footer: Footer;
|
|
5
|
+
}
|
|
6
|
+
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> {
|
|
7
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
8
|
+
$$bindings?: Bindings;
|
|
9
|
+
} & Exports;
|
|
10
|
+
(internal: unknown, props: Props & {
|
|
11
|
+
$$events?: Events;
|
|
12
|
+
$$slots?: Slots;
|
|
13
|
+
}): Exports & {
|
|
14
|
+
$set?: any;
|
|
15
|
+
$on?: any;
|
|
13
16
|
};
|
|
14
|
-
|
|
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> {
|
|
17
|
+
z_$$bindings?: Bindings;
|
|
20
18
|
}
|
|
21
|
-
|
|
19
|
+
declare const ModalFooter: $$__sveltets_2_IsomorphicComponent<Props, {
|
|
20
|
+
cancel: CustomEvent<any>;
|
|
21
|
+
confirm: CustomEvent<any>;
|
|
22
|
+
} & {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {}, {}, "show">;
|
|
25
|
+
type ModalFooter = InstanceType<typeof ModalFooter>;
|
|
26
|
+
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;
|
|
@@ -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
|
}
|
|
@@ -1,36 +1,49 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createBubbler } from 'svelte/legacy';
|
|
3
|
+
|
|
4
|
+
const bubble = createBubbler();
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
href: string;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
start?: import('svelte').Snippet;
|
|
11
|
+
children?: import('svelte').Snippet;
|
|
12
|
+
end?: import('svelte').Snippet;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let { href, active = false, disabled = false, start, children, end }: Props = $props();
|
|
4
17
|
</script>
|
|
5
18
|
|
|
6
19
|
<a
|
|
7
20
|
{href}
|
|
8
21
|
class:active
|
|
9
22
|
class:disabled
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
onkeyup={bubble('keyup')}
|
|
24
|
+
onkeydown={bubble('keydown')}
|
|
25
|
+
onkeypress={bubble('keypress')}
|
|
26
|
+
onfocus={bubble('focus')}
|
|
27
|
+
onblur={bubble('blur')}
|
|
28
|
+
onclick={bubble('click')}
|
|
29
|
+
onmouseover={bubble('mouseover')}
|
|
30
|
+
onmouseenter={bubble('mouseenter')}
|
|
31
|
+
onmouseleave={bubble('mouseleave')}
|
|
32
|
+
onchange={bubble('change')}
|
|
20
33
|
>
|
|
21
|
-
{#if
|
|
34
|
+
{#if start}
|
|
22
35
|
<span class="start">
|
|
23
|
-
|
|
36
|
+
{@render start?.()}
|
|
24
37
|
</span>
|
|
25
38
|
{/if}
|
|
26
39
|
|
|
27
40
|
<span class="middle">
|
|
28
|
-
|
|
41
|
+
{@render children?.()}
|
|
29
42
|
</span>
|
|
30
43
|
|
|
31
|
-
{#if
|
|
44
|
+
{#if end}
|
|
32
45
|
<span class="end">
|
|
33
|
-
|
|
46
|
+
{@render end?.()}
|
|
34
47
|
</span>
|
|
35
48
|
{/if}
|
|
36
49
|
</a>
|