@softwareone/spi-sv5-library 1.0.0 → 1.2.0
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/README.md +75 -19
- package/dist/Accordion/Accordion.svelte +89 -0
- package/dist/Accordion/Accordion.svelte.d.ts +9 -0
- package/dist/Button/Button.svelte +12 -1
- package/dist/Button/Button.svelte.d.ts +1 -1
- package/dist/Card/Card.svelte +2 -16
- package/dist/Card/Card.svelte.d.ts +0 -1
- package/dist/Chips/Chips.svelte +31 -34
- package/dist/Chips/Chips.svelte.d.ts +1 -1
- package/dist/ErrorPage/ErrorPage.svelte +6 -7
- package/dist/ErrorPage/ErrorPage.svelte.d.ts +1 -2
- package/dist/Form/Input/Input.svelte +16 -43
- package/dist/Form/Input/Input.svelte.d.ts +3 -2
- package/dist/Form/Label.svelte +37 -0
- package/dist/Form/Label.svelte.d.ts +9 -0
- package/dist/Form/Select/Select.svelte +457 -0
- package/dist/Form/Select/Select.svelte.d.ts +22 -0
- package/dist/Form/Select/selectState.svelte.d.ts +4 -0
- package/dist/Form/Select/selectState.svelte.js +1 -0
- package/dist/Form/TextArea/TextArea.svelte +9 -27
- package/dist/Form/TextArea/TextArea.svelte.d.ts +2 -2
- package/dist/Header/Header.svelte +29 -33
- package/dist/Header/Header.svelte.d.ts +2 -3
- package/dist/Header/HeaderAccount.svelte +8 -6
- package/dist/Header/HeaderLoader.svelte +2 -2
- package/dist/Header/HeaderLogo.svelte +7 -4
- package/dist/Header/HeaderLogo.svelte.d.ts +14 -6
- package/dist/Menu/Menu.svelte +11 -11
- package/dist/Menu/MenuItem.svelte +7 -11
- package/dist/Modal/Modal.svelte +84 -27
- package/dist/Modal/Modal.svelte.d.ts +2 -9
- package/dist/Modal/ModalContent.svelte +4 -77
- package/dist/Modal/ModalContent.svelte.d.ts +2 -3
- package/dist/Modal/ModalFooter.svelte +17 -58
- package/dist/Modal/ModalFooter.svelte.d.ts +5 -5
- package/dist/Modal/ModalHeader.svelte +49 -31
- package/dist/Modal/ModalHeader.svelte.d.ts +5 -4
- package/dist/Modal/modalState.svelte.d.ts +15 -0
- package/dist/Modal/modalState.svelte.js +1 -0
- package/dist/Notification/Notification.svelte +69 -0
- package/dist/Notification/Notification.svelte.d.ts +4 -0
- package/dist/Notification/notificationState.svelte.d.ts +9 -0
- package/dist/Notification/notificationState.svelte.js +1 -0
- package/dist/ProgressPage/ProgressPage.svelte +95 -0
- package/dist/ProgressPage/ProgressPage.svelte.d.ts +11 -0
- package/dist/ProgressWizard/ProgressWizard.svelte +271 -278
- package/dist/ProgressWizard/ProgressWizard.svelte.d.ts +11 -13
- package/dist/ProgressWizard/progressWizardState.svelte.d.ts +6 -0
- package/dist/ProgressWizard/progressWizardState.svelte.js +1 -0
- package/dist/Search/Search.svelte +161 -0
- package/dist/Search/Search.svelte.d.ts +10 -0
- package/dist/Spinner/Spinner.svelte +23 -34
- package/dist/Spinner/Spinner.svelte.d.ts +3 -2
- package/dist/Toast/Toast.svelte +109 -42
- package/dist/Toast/toastState.svelte.d.ts +7 -3
- package/dist/Toast/toastState.svelte.js +13 -10
- package/dist/Tooltip/Tooltip.svelte +0 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +7 -2
- package/package.json +4 -6
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
value?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onclear?: () => void;
|
|
9
|
+
} & Omit<HTMLInputAttributes, 'value' | 'type'>;
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
value = $bindable(''),
|
|
13
|
+
placeholder = 'Search',
|
|
14
|
+
disabled = false,
|
|
15
|
+
onclear,
|
|
16
|
+
...props
|
|
17
|
+
}: Props = $props();
|
|
18
|
+
|
|
19
|
+
const hasValue = $derived(!!value);
|
|
20
|
+
|
|
21
|
+
const handleClear = (event: Event) => {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
value = '';
|
|
24
|
+
onclear?.();
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const handleKeydown = (event: KeyboardEvent) => {
|
|
28
|
+
if (event.key === 'Escape' && hasValue) {
|
|
29
|
+
handleClear(event);
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div class="search-container" class:disabled>
|
|
36
|
+
<div class="search-wrapper">
|
|
37
|
+
<span class="material-icons-outlined search-icon" aria-hidden="true">search</span>
|
|
38
|
+
<input
|
|
39
|
+
type="search"
|
|
40
|
+
class="search-input"
|
|
41
|
+
bind:value
|
|
42
|
+
{placeholder}
|
|
43
|
+
{disabled}
|
|
44
|
+
onkeydown={handleKeydown}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
{#if hasValue && !disabled}
|
|
49
|
+
<button type="button" class="clear-button" onclick={handleClear} aria-label="Clear search">
|
|
50
|
+
<span class="material-icons-outlined" aria-hidden="true">close</span>
|
|
51
|
+
</button>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
.search-container {
|
|
58
|
+
position: relative;
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
line-height: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.search-wrapper {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
width: 100%;
|
|
68
|
+
border-radius: 8px;
|
|
69
|
+
border: 1px solid #6b7180;
|
|
70
|
+
background: #fff;
|
|
71
|
+
transition:
|
|
72
|
+
border-color 0.2s ease-in-out,
|
|
73
|
+
box-shadow 0.2s ease-in-out;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.search-wrapper:hover:not(:has(.search-input:disabled)),
|
|
77
|
+
.search-wrapper:focus-within {
|
|
78
|
+
border-color: #472aff;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.search-wrapper:focus-within {
|
|
82
|
+
box-shadow: 0 0 0 3px rgba(149, 155, 255, 0.3);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.search-input {
|
|
86
|
+
width: 100%;
|
|
87
|
+
padding: 8px 40px 8px 40px;
|
|
88
|
+
border: none;
|
|
89
|
+
background: transparent;
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
color: #000;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.search-input:focus {
|
|
95
|
+
outline: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.search-input::placeholder {
|
|
99
|
+
color: #6b7180;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.search-input::-webkit-search-cancel-button,
|
|
103
|
+
.search-input::-webkit-search-decoration {
|
|
104
|
+
-webkit-appearance: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.search-icon,
|
|
108
|
+
.clear-button {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 50%;
|
|
111
|
+
transform: translateY(-50%);
|
|
112
|
+
color: #6b7180;
|
|
113
|
+
font-size: 18px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.search-icon {
|
|
117
|
+
left: 12px;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.clear-button {
|
|
122
|
+
right: 12px;
|
|
123
|
+
background: none;
|
|
124
|
+
border: none;
|
|
125
|
+
padding: 4px;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
border-radius: 4px;
|
|
128
|
+
transition:
|
|
129
|
+
color 0.2s ease-in-out,
|
|
130
|
+
background-color 0.2s ease-in-out;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.clear-button:hover,
|
|
137
|
+
.clear-button:focus {
|
|
138
|
+
color: #000;
|
|
139
|
+
outline: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.clear-button span {
|
|
143
|
+
font-size: 16px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.disabled .search-wrapper {
|
|
147
|
+
border-color: #d1d5db;
|
|
148
|
+
background-color: #f3f4f6;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.disabled .search-input {
|
|
152
|
+
color: #6b7180;
|
|
153
|
+
cursor: not-allowed;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@media (max-width: 640px) {
|
|
157
|
+
.search-input {
|
|
158
|
+
font-size: 16px;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
type Props = {
|
|
3
|
+
value?: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onclear?: () => void;
|
|
7
|
+
} & Omit<HTMLInputAttributes, 'value' | 'type'>;
|
|
8
|
+
declare const Search: import("svelte").Component<Props, {}, "value">;
|
|
9
|
+
type Search = ReturnType<typeof Search>;
|
|
10
|
+
export default Search;
|
|
@@ -1,54 +1,43 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
interface SpinnerProps {
|
|
3
|
-
|
|
3
|
+
show: boolean;
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
let { size }: SpinnerProps = $props();
|
|
7
|
+
let { show = $bindable(false), size = 'lg' }: SpinnerProps = $props();
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
pxsize: '16px',
|
|
13
|
-
svg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
14
|
-
<path d="M16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0C12.4183 0 16 3.58172 16 8ZM4.2005 8C4.2005 10.0984 5.90159 11.7995 8 11.7995C10.0984 11.7995 11.7995 10.0984 11.7995 8C11.7995 5.90159 10.0984 4.2005 8 4.2005C5.90159 4.2005 4.2005 5.90159 4.2005 8Z" fill="#E0E5E8"/>
|
|
15
|
-
<path d="M8 13.8998C8 15.0597 8.95609 16.027 10.0763 15.7259C11.4189 15.365 12.6567 14.657 13.6569 13.6569C15.1571 12.1566 16 10.1217 16 8C16 5.87827 15.1571 3.84344 13.6569 2.34315C12.6567 1.34297 11.4189 0.634982 10.0763 0.274108C8.95609 -0.0269669 8 0.940313 8 2.10025C8 3.26019 9.00775 4.15735 9.99495 4.76635C10.244 4.91998 10.4764 5.10307 10.6867 5.31335C11.3992 6.02589 11.7995 6.99231 11.7995 8C11.7995 9.00769 11.3992 9.97411 10.6867 10.6867C10.4764 10.8969 10.244 11.08 9.99495 11.2336C9.00775 11.8427 8 12.7398 8 13.8998Z" fill="#472AFF"/>
|
|
16
|
-
</svg>`
|
|
17
|
-
},
|
|
18
|
-
medium: {
|
|
19
|
-
pxsize: '33px',
|
|
20
|
-
svg: `<svg xmlns="http://www.w3.org/2000/svg" width="33" height="33" viewBox="0 0 33 33" fill="none">
|
|
21
|
-
<path d="M33 16.5C33 25.6127 25.6127 33 16.5 33C7.3873 33 0 25.6127 0 16.5C0 7.3873 7.3873 0 16.5 0C25.6127 0 33 7.3873 33 16.5ZM3.4924 16.5C3.4924 23.6839 9.3161 29.5076 16.5 29.5076C23.6839 29.5076 29.5076 23.6839 29.5076 16.5C29.5076 9.3161 23.6839 3.4924 16.5 3.4924C9.3161 3.4924 3.4924 9.3161 3.4924 16.5Z" fill="#E0E5E8"/>
|
|
22
|
-
<path d="M16.5 31.2538C16.5 32.2182 17.2841 33.0096 18.2431 32.9077C21.9784 32.511 25.4865 30.848 28.1673 28.1673C31.2616 25.0729 33 20.8761 33 16.5C33 12.1239 31.2616 7.92709 28.1673 4.83274C25.4865 2.15202 21.9784 0.488977 18.2431 0.0922724C17.2841 -0.00957781 16.5 0.781801 16.5 1.7462C16.5 2.7106 17.2853 3.48033 18.2411 3.6094C21.048 3.98847 23.6725 5.27693 25.6978 7.30224C28.1372 9.74164 29.5076 13.0502 29.5076 16.5C29.5076 19.9498 28.1372 23.2584 25.6978 25.6978C23.6725 27.7231 21.048 29.0115 18.2411 29.3906C17.2853 29.5197 16.5 30.2894 16.5 31.2538Z" fill="#472AFF"/>
|
|
23
|
-
</svg>`
|
|
24
|
-
},
|
|
25
|
-
large: {
|
|
26
|
-
pxsize: '40px',
|
|
27
|
-
svg: `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
|
|
28
|
-
<path d="M40 20C40 31.0457 31.0457 40 20 40C8.9543 40 0 31.0457 0 20C0 8.9543 8.9543 0 20 0C31.0457 0 40 8.9543 40 20ZM6.27298 20C6.27298 27.5812 12.4188 33.727 20 33.727C27.5812 33.727 33.727 27.5812 33.727 20C33.727 12.4188 27.5812 6.27298 20 6.27298C12.4188 6.27298 6.27298 12.4188 6.27298 20Z" fill="#E0E5E8"/>
|
|
29
|
-
<path d="M20 3.13649C20 1.40425 21.4128 -0.0251732 23.1238 0.245376C27.2709 0.901143 31.1358 2.85154 34.1421 5.85786C37.8929 9.60859 40 14.6957 40 20C40 25.3043 37.8929 30.3914 34.1421 34.1421C31.1358 37.1485 27.2709 39.0989 23.1238 39.7546C21.4128 40.0252 20 38.5957 20 36.8635C20 35.1313 21.4222 33.7627 23.1094 33.3703C25.5876 32.7939 27.8783 31.5346 29.7065 29.7065C32.2808 27.1322 33.727 23.6406 33.727 20C33.727 16.3594 32.2808 12.8678 29.7065 10.2935C27.8783 8.46537 25.5876 7.20612 23.1094 6.62973C21.4222 6.23731 20 4.86873 20 3.13649Z" fill="#472AFF"/>
|
|
30
|
-
</svg>`
|
|
31
|
-
}
|
|
9
|
+
const pixelSizes: Record<string, number> = {
|
|
10
|
+
sm: 16,
|
|
11
|
+
md: 33,
|
|
12
|
+
lg: 40
|
|
32
13
|
};
|
|
33
|
-
|
|
34
|
-
let pxsize = $state(sizes[size].pxsize);
|
|
35
|
-
let svg = $state(sizes[size].svg);
|
|
36
14
|
</script>
|
|
37
15
|
|
|
16
|
+
{#if show}
|
|
38
17
|
<div class="spinner-container">
|
|
39
|
-
<div class="spinner" style="width: {
|
|
40
|
-
|
|
18
|
+
<div class="spinner" style="width: {pixelSizes[size]}px; height: {pixelSizes[size]}px;">
|
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" fill="none">
|
|
20
|
+
<path
|
|
21
|
+
d="M40 20C40 31.0457 31.0457 40 20 40C8.9543 40 0 31.0457 0 20C0 8.9543 8.9543 0 20 0C31.0457 0 40 8.9543 40 20ZM6.27298 20C6.27298 27.5812 12.4188 33.727 20 33.727C27.5812 33.727 33.727 27.5812 33.727 20C33.727 12.4188 27.5812 6.27298 20 6.27298C12.4188 6.27298 6.27298 12.4188 6.27298 20Z"
|
|
22
|
+
fill="#E0E5E8"
|
|
23
|
+
/>
|
|
24
|
+
<path
|
|
25
|
+
d="M20 3.13649C20 1.40425 21.4128 -0.0251732 23.1238 0.245376C27.2709 0.901143 31.1358 2.85154 34.1421 5.85786C37.8929 9.60859 40 14.6957 40 20C40 25.3043 37.8929 30.3914 34.1421 34.1421C31.1358 37.1485 27.2709 39.0989 23.1238 39.7546C21.4128 40.0252 20 38.5957 20 36.8635C20 35.1313 21.4222 33.7627 23.1094 33.3703C25.5876 32.7939 27.8783 31.5346 29.7065 29.7065C32.2808 27.1322 33.727 23.6406 33.727 20C33.727 16.3594 32.2808 12.8678 29.7065 10.2935C27.8783 8.46537 25.5876 7.20612 23.1094 6.62973C21.4222 6.23731 20 4.86873 20 3.13649Z"
|
|
26
|
+
fill="#472AFF"
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
41
29
|
</div>
|
|
42
30
|
</div>
|
|
31
|
+
{/if}
|
|
43
32
|
|
|
44
33
|
<style>
|
|
45
34
|
.spinner-container {
|
|
46
35
|
display: flex;
|
|
47
36
|
justify-content: center;
|
|
48
37
|
align-items: center;
|
|
49
|
-
width:
|
|
50
|
-
height:
|
|
51
|
-
position:
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
position: absolute;
|
|
52
41
|
top: 0;
|
|
53
42
|
left: 0;
|
|
54
43
|
background-color: rgba(255, 255, 255, 0.8);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface SpinnerProps {
|
|
2
|
-
|
|
2
|
+
show: boolean;
|
|
3
|
+
size?: 'sm' | 'md' | 'lg';
|
|
3
4
|
}
|
|
4
|
-
declare const Spinner: import("svelte").Component<SpinnerProps, {}, "">;
|
|
5
|
+
declare const Spinner: import("svelte").Component<SpinnerProps, {}, "show">;
|
|
5
6
|
type Spinner = ReturnType<typeof Spinner>;
|
|
6
7
|
export default Spinner;
|
package/dist/Toast/Toast.svelte
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { fly } from 'svelte/transition';
|
|
3
2
|
import { linear } from 'svelte/easing';
|
|
4
|
-
import {
|
|
3
|
+
import { fly, type FlyParams } from 'svelte/transition';
|
|
4
|
+
|
|
5
|
+
import { deleteToastById, getToast } from './toastState.svelte.js';
|
|
5
6
|
|
|
6
7
|
interface ToastProps {
|
|
7
8
|
duration?: number;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
let { duration }:ToastProps = $props();
|
|
11
|
+
let { duration }: ToastProps = $props();
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const TRANSITION_DURATION = 100;
|
|
14
|
+
const VERTICAL_DISTANCE = 8;
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
danger: '#DC182C',
|
|
19
|
-
neutral: '#6B7180',
|
|
20
|
-
success: '#008556'
|
|
21
|
-
};
|
|
22
|
-
return colors[type] || '#6B7180'; // Default to neutral if type is unknown
|
|
16
|
+
const transitionConfig: FlyParams = {
|
|
17
|
+
duration: TRANSITION_DURATION,
|
|
18
|
+
easing: linear,
|
|
19
|
+
y: VERTICAL_DISTANCE
|
|
23
20
|
};
|
|
24
21
|
|
|
22
|
+
const toastNotifications = getToast(duration);
|
|
25
23
|
</script>
|
|
26
24
|
|
|
27
|
-
{#if
|
|
28
|
-
<div class="toast-container" in:fly={
|
|
29
|
-
{#each
|
|
30
|
-
<div class="toast" in:fly={
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
>
|
|
39
|
-
<rect width="8" height="36" rx="4" fill={getToastColor(msg.type)} />
|
|
40
|
-
</svg>
|
|
25
|
+
{#if toastNotifications.toasts.length > 0}
|
|
26
|
+
<div class="toast-container" in:fly={transitionConfig} out:fly={transitionConfig}>
|
|
27
|
+
{#each toastNotifications.toasts as toast}
|
|
28
|
+
<div class="toast {toast.width ?? 'sm'}" in:fly={transitionConfig} out:fly={transitionConfig}>
|
|
29
|
+
<span class="status-indicator {toast.type}"></span>
|
|
30
|
+
<div class="toast-content-container">
|
|
31
|
+
<div class="toast-content">
|
|
32
|
+
<span>{toast.message}</span>
|
|
33
|
+
{#if toast.link}
|
|
34
|
+
<a class="toast-content-link" href={toast.link} title="View details">View details</a>
|
|
35
|
+
{/if}
|
|
36
|
+
</div>
|
|
41
37
|
</div>
|
|
42
|
-
<div class="toast-
|
|
43
|
-
<
|
|
44
|
-
|
|
38
|
+
<div class="toast-close-container">
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
class="toast-close-button material-icons"
|
|
42
|
+
aria-label="Close toast"
|
|
43
|
+
onclick={() => deleteToastById(toast.id)}>close</button
|
|
44
|
+
>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
47
|
{/each}
|
|
@@ -50,19 +50,21 @@
|
|
|
50
50
|
|
|
51
51
|
<style>
|
|
52
52
|
.toast-container {
|
|
53
|
-
position: fixed;
|
|
53
|
+
position: fixed;
|
|
54
54
|
top: 96px;
|
|
55
55
|
right: 16px;
|
|
56
56
|
z-index: 9999;
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
gap: 16px;
|
|
60
|
+
align-items: flex-end;
|
|
60
61
|
}
|
|
62
|
+
|
|
61
63
|
.toast {
|
|
64
|
+
width: var(--toast-width);
|
|
65
|
+
height: var(--toast-height);
|
|
62
66
|
display: inline-flex;
|
|
63
67
|
padding: 8px;
|
|
64
|
-
justify-content: flex-start;
|
|
65
|
-
align-items: center;
|
|
66
68
|
gap: 16px;
|
|
67
69
|
border-radius: 8px;
|
|
68
70
|
border: 1px solid #e0e5e8;
|
|
@@ -72,28 +74,93 @@
|
|
|
72
74
|
0px 1px 3px 0px rgba(51, 56, 64, 0.2),
|
|
73
75
|
0px 1px 16px 0px rgba(51, 56, 64, 0.1);
|
|
74
76
|
}
|
|
77
|
+
|
|
78
|
+
.toast.sm {
|
|
79
|
+
--toast-width: 400px;
|
|
80
|
+
--toast-height: 52px;
|
|
81
|
+
--toast-flex-direction: row;
|
|
82
|
+
--toast-gap: 8px;
|
|
83
|
+
--toast-close-button-align: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.toast.md {
|
|
87
|
+
--toast-width: 600px;
|
|
88
|
+
--toast-height: 88px;
|
|
89
|
+
--toast-flex-direction: column;
|
|
90
|
+
--toast-gap: 4px;
|
|
91
|
+
--toast-close-button-align: flex-start;
|
|
92
|
+
}
|
|
93
|
+
|
|
75
94
|
.toast-content {
|
|
76
95
|
display: flex;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
flex-direction: var(--toast-flex-direction);
|
|
98
|
+
gap: var(--toast-gap);
|
|
77
99
|
padding: 8px 0px;
|
|
78
|
-
align-items: flex-start;
|
|
79
|
-
gap: 8px;
|
|
80
|
-
color: #000;
|
|
81
100
|
font-size: 14px;
|
|
82
|
-
font-style: normal;
|
|
83
101
|
font-weight: 400;
|
|
84
102
|
line-height: 20px;
|
|
85
103
|
}
|
|
104
|
+
|
|
105
|
+
.toast-content-container {
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
gap: 16px;
|
|
109
|
+
flex-grow: 1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.status-indicator {
|
|
113
|
+
width: 8px;
|
|
114
|
+
height: calc(var(--toast-height) - 20px);
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
border-radius: 4px;
|
|
117
|
+
background-color: var(--toast-bg);
|
|
118
|
+
}
|
|
119
|
+
|
|
86
120
|
.toast-content-link {
|
|
87
121
|
display: flex;
|
|
88
|
-
align-items:
|
|
122
|
+
align-items: center;
|
|
89
123
|
color: #2b1999;
|
|
90
|
-
font-size: 14px;
|
|
91
|
-
font-style: normal;
|
|
92
|
-
font-weight: 400;
|
|
93
|
-
line-height: 20px;
|
|
94
124
|
}
|
|
125
|
+
|
|
95
126
|
.toast-content-link:hover {
|
|
96
127
|
color: #472aff;
|
|
97
128
|
text-decoration: underline;
|
|
98
129
|
}
|
|
130
|
+
|
|
131
|
+
.status-indicator.info {
|
|
132
|
+
--toast-bg: #472aff;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.status-indicator.warning {
|
|
136
|
+
--toast-bg: #e87d1e;
|
|
137
|
+
}
|
|
138
|
+
.status-indicator.danger {
|
|
139
|
+
--toast-bg: #dc182c;
|
|
140
|
+
}
|
|
141
|
+
.status-indicator.neutral {
|
|
142
|
+
--toast-bg: #6b7180;
|
|
143
|
+
}
|
|
144
|
+
.status-indicator.success {
|
|
145
|
+
--toast-bg: #008556;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.toast-close-container {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: var(--toast-close-button-align);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.toast-close-button {
|
|
154
|
+
background: none;
|
|
155
|
+
border: none;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.toast-close-button:hover {
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
color: #434952;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.toast-close-button:focus {
|
|
164
|
+
outline: none;
|
|
165
|
+
}
|
|
99
166
|
</style>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
type ToastType = 'info' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
2
|
+
type ToastWidth = 'sm' | 'md';
|
|
2
3
|
export interface Toast {
|
|
3
4
|
type: ToastType;
|
|
4
5
|
message: string;
|
|
6
|
+
width?: ToastWidth;
|
|
7
|
+
link?: string;
|
|
5
8
|
}
|
|
6
9
|
interface ToastState extends Toast {
|
|
7
10
|
id: string;
|
|
8
11
|
}
|
|
9
|
-
export declare
|
|
10
|
-
|
|
12
|
+
export declare const getToast: (duration?: number) => {
|
|
13
|
+
toasts: ToastState[];
|
|
11
14
|
duration: number;
|
|
12
15
|
};
|
|
13
|
-
export declare
|
|
16
|
+
export declare const addToast: (toast: Toast) => void;
|
|
17
|
+
export declare const deleteToastById: (id: string) => void;
|
|
14
18
|
export {};
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
const toastState = $state({
|
|
2
|
-
|
|
3
|
-
duration: 5000
|
|
2
|
+
toasts: [],
|
|
3
|
+
duration: 5000
|
|
4
4
|
});
|
|
5
|
-
export
|
|
5
|
+
export const getToast = (duration) => {
|
|
6
6
|
if (duration) {
|
|
7
7
|
toastState.duration = duration;
|
|
8
8
|
}
|
|
9
9
|
return toastState;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
10
|
+
};
|
|
11
|
+
export const addToast = (toast) => {
|
|
12
12
|
const newToast = { ...toast, id: crypto.randomUUID() };
|
|
13
|
-
toastState.
|
|
13
|
+
toastState.toasts.push(newToast);
|
|
14
14
|
scheduleToastRemoval(newToast.id);
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
};
|
|
16
|
+
const scheduleToastRemoval = (id) => {
|
|
17
17
|
setTimeout(() => {
|
|
18
|
-
|
|
18
|
+
deleteToastById(id);
|
|
19
19
|
}, toastState.duration);
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
|
+
export const deleteToastById = (id) => {
|
|
22
|
+
toastState.toasts = toastState.toasts.filter((toast) => toast.id !== id);
|
|
23
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Accordion from './Accordion/Accordion.svelte';
|
|
1
2
|
import Avatar from './Avatar/Avatar.svelte';
|
|
2
3
|
import Breadcrumbs from './Breadcrumbs/Breadcrumbs.svelte';
|
|
3
4
|
import { addBreadcrumbsNameMap, type BreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
@@ -8,8 +9,10 @@ import { ChipType } from './Chips/chipsState.svelte.js';
|
|
|
8
9
|
import ErrorPage from './ErrorPage/ErrorPage.svelte';
|
|
9
10
|
import Footer from './Footer/Footer.svelte';
|
|
10
11
|
import Input from './Form/Input/Input.svelte';
|
|
11
|
-
import
|
|
12
|
+
import Select from './Form/Select/Select.svelte';
|
|
13
|
+
import type { SelectOption } from './Form/Select/selectState.svelte.js';
|
|
12
14
|
import TextArea from './Form/TextArea/TextArea.svelte';
|
|
15
|
+
import Toggle from './Form/Toggle/Toggle.svelte';
|
|
13
16
|
import Header from './Header/Header.svelte';
|
|
14
17
|
import HeaderAccount from './Header/HeaderAccount.svelte';
|
|
15
18
|
import HeaderLoader from './Header/HeaderLoader.svelte';
|
|
@@ -20,11 +23,16 @@ import Menu from './Menu/Menu.svelte';
|
|
|
20
23
|
import Sidebar from './Menu/Sidebar.svelte';
|
|
21
24
|
import type { MenuItem } from './Menu/SidebarState.svelte';
|
|
22
25
|
import Modal from './Modal/Modal.svelte';
|
|
26
|
+
import type { ModalProps } from './Modal/modalState.svelte.js';
|
|
27
|
+
import Notification from './Notification/Notification.svelte';
|
|
28
|
+
import ProgressPage from './ProgressPage/ProgressPage.svelte';
|
|
23
29
|
import ProgressWizard from './ProgressWizard/ProgressWizard.svelte';
|
|
30
|
+
import type { ProgressWizardStep } from './ProgressWizard/progressWizardState.svelte.js';
|
|
31
|
+
import Search from './Search/Search.svelte';
|
|
24
32
|
import Spinner from './Spinner/Spinner.svelte';
|
|
25
33
|
import Tabs from './Tabs/Tabs.svelte';
|
|
26
34
|
import type { Tab } from './Tabs/tabsState.svelte.js';
|
|
27
35
|
import Toaster from './Toast/Toast.svelte';
|
|
28
36
|
import { addToast, type Toast } from './Toast/toastState.svelte';
|
|
29
37
|
import Tooltip from './Tooltip/Tooltip.svelte';
|
|
30
|
-
export { addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, ImageType, Input, Menu,
|
|
38
|
+
export { Accordion, addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, ImageType, Input, Menu, Modal, Notification, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Tabs, TextArea, Toaster, Toggle, Tooltip, type BreadcrumbsNameMap, type HighlightPanelColumn, type MenuItem, type ModalProps, type ProgressWizardStep, type SelectOption, type Tab, type Toast };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Accordion from './Accordion/Accordion.svelte';
|
|
1
2
|
import Avatar from './Avatar/Avatar.svelte';
|
|
2
3
|
import Breadcrumbs from './Breadcrumbs/Breadcrumbs.svelte';
|
|
3
4
|
import { addBreadcrumbsNameMap } from './Breadcrumbs/breadcrumbsState.svelte.js';
|
|
@@ -8,8 +9,9 @@ import { ChipType } from './Chips/chipsState.svelte.js';
|
|
|
8
9
|
import ErrorPage from './ErrorPage/ErrorPage.svelte';
|
|
9
10
|
import Footer from './Footer/Footer.svelte';
|
|
10
11
|
import Input from './Form/Input/Input.svelte';
|
|
11
|
-
import
|
|
12
|
+
import Select from './Form/Select/Select.svelte';
|
|
12
13
|
import TextArea from './Form/TextArea/TextArea.svelte';
|
|
14
|
+
import Toggle from './Form/Toggle/Toggle.svelte';
|
|
13
15
|
import Header from './Header/Header.svelte';
|
|
14
16
|
import HeaderAccount from './Header/HeaderAccount.svelte';
|
|
15
17
|
import HeaderLoader from './Header/HeaderLoader.svelte';
|
|
@@ -19,10 +21,13 @@ import { ColumnType, ImageType } from './HighlightPanel/highlightPanelState.svel
|
|
|
19
21
|
import Menu from './Menu/Menu.svelte';
|
|
20
22
|
import Sidebar from './Menu/Sidebar.svelte';
|
|
21
23
|
import Modal from './Modal/Modal.svelte';
|
|
24
|
+
import Notification from './Notification/Notification.svelte';
|
|
25
|
+
import ProgressPage from './ProgressPage/ProgressPage.svelte';
|
|
22
26
|
import ProgressWizard from './ProgressWizard/ProgressWizard.svelte';
|
|
27
|
+
import Search from './Search/Search.svelte';
|
|
23
28
|
import Spinner from './Spinner/Spinner.svelte';
|
|
24
29
|
import Tabs from './Tabs/Tabs.svelte';
|
|
25
30
|
import Toaster from './Toast/Toast.svelte';
|
|
26
31
|
import { addToast } from './Toast/toastState.svelte';
|
|
27
32
|
import Tooltip from './Tooltip/Tooltip.svelte';
|
|
28
|
-
export { addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, ImageType, Input, Menu,
|
|
33
|
+
export { Accordion, addBreadcrumbsNameMap, addToast, Avatar, Breadcrumbs, Button, Card, Chips, ChipType, ColumnType, ErrorPage, Footer, Header, HeaderAccount, HeaderLoader, HeaderLogo, HighlightPanel, ImageType, Input, Menu, Modal, Notification, ProgressPage, ProgressWizard, Search, Select, Sidebar, Spinner, Tabs, TextArea, Toaster, Toggle, Tooltip };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softwareone/spi-sv5-library",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Svelte components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -55,12 +55,10 @@
|
|
|
55
55
|
"svelte": "^5.0.0",
|
|
56
56
|
"svelte-check": "^4.0.0",
|
|
57
57
|
"typescript": "^5.0.0",
|
|
58
|
-
"vite": "^6.0.0"
|
|
58
|
+
"vite": "^6.0.0",
|
|
59
|
+
"zod": "^3.25.76"
|
|
59
60
|
},
|
|
60
61
|
"dependencies": {
|
|
61
|
-
"@sveltejs/kit": "^2.16.0"
|
|
62
|
-
"http-status-codes": "^2.3.0",
|
|
63
|
-
"lucide-svelte": "^0.475.0",
|
|
64
|
-
"zod": "^3.24.4"
|
|
62
|
+
"@sveltejs/kit": "^2.16.0"
|
|
65
63
|
}
|
|
66
64
|
}
|