@hyvor/design 2.0.0 → 2.0.2
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/cloud/HyvorBar/BarUserPicture.svelte +0 -27
- package/dist/components/ActionList/ActionList.svelte +2 -8
- package/dist/components/ActionList/ActionListGroup.svelte +1 -5
- package/dist/components/ActionList/ActionListItem.svelte +7 -7
- package/dist/components/IconMessage/IconMessage.svelte +29 -44
- package/dist/components/Link/Link.svelte +4 -1
- package/dist/components/Link/Link.svelte.d.ts +1 -1
- package/dist/components/Loader/Loader.svelte +1 -3
- package/dist/components/Modal/ConfirmModalProvider.svelte +1 -3
- package/dist/components/NavLink/NavLink.svelte +2 -1
- package/dist/components/TabNav/TabNav.svelte +0 -2
- package/dist/components/TextInput/TextInput.svelte +1 -1
- package/dist/marketing/Docs/Nav/NavItem.svelte +2 -1
- package/package.json +1 -1
|
@@ -6,30 +6,3 @@
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<UserPicture pictureUrl={user.picture_url} name={user.username || user.name || ''} size={30} />
|
|
9
|
-
|
|
10
|
-
{#if user.picture_url}
|
|
11
|
-
<img src={user.picture_url} alt={user.name} />
|
|
12
|
-
{:else}
|
|
13
|
-
<span class="user-placeholder">
|
|
14
|
-
{user.name ? user.name[0].toUpperCase() : '?'}
|
|
15
|
-
</span>
|
|
16
|
-
{/if}
|
|
17
|
-
|
|
18
|
-
<style>
|
|
19
|
-
img {
|
|
20
|
-
width: 30px;
|
|
21
|
-
height: 30px;
|
|
22
|
-
border-radius: 50%;
|
|
23
|
-
}
|
|
24
|
-
.user-placeholder {
|
|
25
|
-
display: inline-flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
width: 30px;
|
|
29
|
-
height: 30px;
|
|
30
|
-
border-radius: 50%;
|
|
31
|
-
color: var(--text);
|
|
32
|
-
font-size: 14px;
|
|
33
|
-
background-color: var(--input);
|
|
34
|
-
}
|
|
35
|
-
</style>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { run } from 'svelte/legacy';
|
|
3
|
-
|
|
4
2
|
import { setContext } from 'svelte';
|
|
5
3
|
|
|
6
4
|
interface Props {
|
|
@@ -12,12 +10,8 @@
|
|
|
12
10
|
|
|
13
11
|
let { selection = 'none', selectionAlign = 'start', children, ...rest }: Props = $props();
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
run(() => {
|
|
19
|
-
setContext('action-list-selection-align', selectionAlign);
|
|
20
|
-
});
|
|
13
|
+
setContext('action-list-selection', () => selection);
|
|
14
|
+
setContext('action-list-selection-align', () => selectionAlign);
|
|
21
15
|
</script>
|
|
22
16
|
|
|
23
17
|
<div class="action-list" {...rest}>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { run } from 'svelte/legacy';
|
|
3
|
-
|
|
4
2
|
import { setContext } from 'svelte';
|
|
5
3
|
|
|
6
4
|
interface Props {
|
|
@@ -12,9 +10,7 @@
|
|
|
12
10
|
|
|
13
11
|
let { title = undefined, divider = false, selection = undefined, children }: Props = $props();
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
if (selection !== undefined) setContext('action-list-selection', selection);
|
|
17
|
-
});
|
|
13
|
+
setContext('action-list-selection', () => selection);
|
|
18
14
|
</script>
|
|
19
15
|
|
|
20
16
|
<div class="action-list-group" class:has-divider={divider}>
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { getContext, createEventDispatcher } from 'svelte';
|
|
6
6
|
import Selected from './Selected.svelte';
|
|
7
7
|
|
|
8
|
-
const selection: 'none' | 'single' | 'multi' = getContext('action-list-selection');
|
|
9
|
-
const selectionAlign: 'start' | 'end' = getContext('action-list-selection-align');
|
|
8
|
+
const selection: () => 'none' | 'single' | 'multi' = getContext('action-list-selection');
|
|
9
|
+
const selectionAlign: () => 'start' | 'end' = getContext('action-list-selection-align');
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
selected?: boolean;
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
...rest
|
|
31
31
|
}: Props = $props();
|
|
32
32
|
|
|
33
|
-
selected = selection !== 'none' && selected;
|
|
33
|
+
selected = selection() !== 'none' && selected;
|
|
34
34
|
|
|
35
35
|
const dispatch = createEventDispatcher();
|
|
36
36
|
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
}}
|
|
54
54
|
{...rest}
|
|
55
55
|
>
|
|
56
|
-
{#if selectionAlign === 'start'}
|
|
57
|
-
<Selected {selection} bind:selected />
|
|
56
|
+
{#if selectionAlign() === 'start'}
|
|
57
|
+
<Selected selection={selection()} bind:selected />
|
|
58
58
|
{/if}
|
|
59
59
|
|
|
60
60
|
{#if start}
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
</span>
|
|
80
80
|
{/if}
|
|
81
81
|
|
|
82
|
-
{#if selectionAlign === 'end'}
|
|
83
|
-
<Selected {selection} bind:selected />
|
|
82
|
+
{#if selectionAlign() === 'end'}
|
|
83
|
+
<Selected selection={selection()} bind:selected />
|
|
84
84
|
{/if}
|
|
85
85
|
</div>
|
|
86
86
|
|
|
@@ -40,20 +40,11 @@
|
|
|
40
40
|
...rest
|
|
41
41
|
}: Props = $props();
|
|
42
42
|
|
|
43
|
-
// export let size: 'small' | 'medium' | 'large' = 'medium';
|
|
44
|
-
|
|
45
|
-
// export let icon: ComponentType | null = null;
|
|
46
|
-
// export let message: string | null = null;
|
|
47
|
-
|
|
48
|
-
// export let iconSize: number | undefined = undefined;
|
|
49
43
|
const iconsSizes = {
|
|
50
44
|
small: 35,
|
|
51
45
|
medium: 50,
|
|
52
46
|
large: 75
|
|
53
47
|
};
|
|
54
|
-
iconSize = iconSize || iconsSizes[size];
|
|
55
|
-
|
|
56
|
-
// export let padding: number | undefined = undefined;
|
|
57
48
|
|
|
58
49
|
const paddings = {
|
|
59
50
|
small: 15,
|
|
@@ -61,36 +52,31 @@
|
|
|
61
52
|
large: 60
|
|
62
53
|
};
|
|
63
54
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (error) {
|
|
80
|
-
message = message || 'Something went wrong';
|
|
81
|
-
icon = IconBug;
|
|
82
|
-
iconColor = iconColor || 'var(--gray-dark)';
|
|
83
|
-
}
|
|
55
|
+
const config = $derived.by(() => {
|
|
56
|
+
const ret = {
|
|
57
|
+
padding: padding === undefined ? paddings[size] : padding,
|
|
58
|
+
message,
|
|
59
|
+
icon,
|
|
60
|
+
iconSize: iconSize || iconsSizes[size],
|
|
61
|
+
iconColor
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (!ret.message) {
|
|
65
|
+
if (empty) ret.message = 'No results found';
|
|
66
|
+
if (error) ret.message = 'Something went wrong';
|
|
67
|
+
}
|
|
84
68
|
|
|
85
|
-
|
|
69
|
+
if (!ret.icon) {
|
|
70
|
+
if (empty) ret.icon = IconInbox;
|
|
71
|
+
if (error) ret.icon = IconBug;
|
|
72
|
+
}
|
|
86
73
|
|
|
87
|
-
|
|
74
|
+
if (!ret.iconColor) {
|
|
75
|
+
ret.iconColor = 'var(--gray-dark)';
|
|
76
|
+
}
|
|
88
77
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
// onClick: (e: MouseEvent) => void;
|
|
92
|
-
// props?: Record<string, any>;
|
|
93
|
-
// } | null = null;
|
|
78
|
+
return ret;
|
|
79
|
+
});
|
|
94
80
|
|
|
95
81
|
function onCtaClick(e: MouseEvent) {
|
|
96
82
|
if (cta && typeof cta === 'object') {
|
|
@@ -99,18 +85,18 @@
|
|
|
99
85
|
}
|
|
100
86
|
</script>
|
|
101
87
|
|
|
102
|
-
<div class="icon-message {size}" style:padding={padding + 'px'}>
|
|
103
|
-
<div class="icon" style:color={iconColor} {...rest}>
|
|
104
|
-
<
|
|
88
|
+
<div class="icon-message {size}" style:padding={config.padding + 'px'}>
|
|
89
|
+
<div class="icon" style:color={config.iconColor} {...rest}>
|
|
90
|
+
<config.icon size={config.iconSize + 'px'} />
|
|
105
91
|
</div>
|
|
106
92
|
|
|
107
93
|
<div class="message">
|
|
108
94
|
{#if children}
|
|
109
95
|
{@render children()}
|
|
110
|
-
{:else if typeof message === 'string'}
|
|
111
|
-
{message}
|
|
112
|
-
{:else if message}
|
|
113
|
-
{@render message()}
|
|
96
|
+
{:else if typeof config.message === 'string'}
|
|
97
|
+
{config.message}
|
|
98
|
+
{:else if config.message}
|
|
99
|
+
{@render config.message()}
|
|
114
100
|
{/if}
|
|
115
101
|
</div>
|
|
116
102
|
|
|
@@ -146,7 +132,6 @@
|
|
|
146
132
|
}
|
|
147
133
|
|
|
148
134
|
.message {
|
|
149
|
-
/* Add message styles here */
|
|
150
135
|
color: var(--text-light);
|
|
151
136
|
margin-top: 10px;
|
|
152
137
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const bubble = createBubbler();
|
|
5
5
|
interface Props {
|
|
6
6
|
href: string;
|
|
7
|
-
color?: 'link' | 'accent' | 'text';
|
|
7
|
+
color?: 'link' | 'accent' | 'text' | 'inherit';
|
|
8
8
|
underline?: boolean;
|
|
9
9
|
start?: import('svelte').Snippet;
|
|
10
10
|
children?: import('svelte').Snippet;
|
|
@@ -57,6 +57,9 @@
|
|
|
57
57
|
a.color-text {
|
|
58
58
|
--local-color: var(--text);
|
|
59
59
|
}
|
|
60
|
+
a.color-inherit {
|
|
61
|
+
--local-color: inherit;
|
|
62
|
+
}
|
|
60
63
|
a.underline {
|
|
61
64
|
text-decoration: underline;
|
|
62
65
|
text-decoration-color: var(--local-color);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { run } from 'svelte/legacy';
|
|
3
|
-
|
|
4
2
|
import IconCheckCircleFill from '@hyvor/icons/IconCheckCircleFill';
|
|
5
3
|
import IconXCircleFill from '@hyvor/icons/IconXCircleFill';
|
|
6
4
|
|
|
@@ -58,7 +56,7 @@
|
|
|
58
56
|
large: 250
|
|
59
57
|
};
|
|
60
58
|
padding = typeof padding === 'number' ? padding : paddings[padding];
|
|
61
|
-
|
|
59
|
+
$effect(() => {
|
|
62
60
|
if (duration && (state === 'success' || state === 'error')) {
|
|
63
61
|
setTimeout(() => {
|
|
64
62
|
state = 'none';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { run } from 'svelte/legacy';
|
|
3
|
-
|
|
4
2
|
import Modal from './Modal.svelte';
|
|
5
3
|
import { confirmStore } from './confirm.js';
|
|
6
4
|
import Button from './../Button/Button.svelte';
|
|
@@ -16,7 +14,7 @@
|
|
|
16
14
|
$confirmStore!.onConfirm();
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
$effect(() => {
|
|
20
18
|
if (!show) {
|
|
21
19
|
handleCancel();
|
|
22
20
|
show = true;
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
let { href, active = false, disabled = false, start, children, end }: Props = $props();
|
|
16
|
+
let { href, active = false, disabled = false, start, children, end, ...rest }: Props = $props();
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<a
|
|
20
20
|
{href}
|
|
21
|
+
{...rest}
|
|
21
22
|
class:active
|
|
22
23
|
class:disabled
|
|
23
24
|
onkeyup={bubble('keyup')}
|
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
children?: import('svelte').Snippet;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
let { href, children }: Props = $props();
|
|
9
|
+
let { href, children, ...rest }: Props = $props();
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<a
|
|
13
13
|
{href}
|
|
14
|
+
{...rest}
|
|
14
15
|
class:active={href === $page.url.pathname}
|
|
15
16
|
aria-current={href === $page.url.pathname ? 'page' : undefined}
|
|
16
17
|
>
|