@softwareone/spi-sv5-library 0.1.2 → 1.0.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/dist/Avatar/Avatar.svelte +33 -0
- package/dist/Avatar/Avatar.svelte.d.ts +10 -0
- package/dist/Breadcrumbs/Breadcrumbs.svelte +10 -20
- package/dist/Button/Button.svelte +59 -119
- package/dist/Button/Button.svelte.d.ts +8 -6
- package/dist/Card/Card.svelte +18 -44
- package/dist/Card/Card.svelte.d.ts +1 -1
- package/dist/Chips/Chips.svelte +25 -28
- package/dist/Chips/Chips.svelte.d.ts +2 -1
- package/dist/Chips/chipsState.svelte.d.ts +7 -0
- package/dist/Chips/chipsState.svelte.js +8 -0
- package/dist/ErrorPage/ErrorPage.svelte +98 -0
- package/dist/ErrorPage/ErrorPage.svelte.d.ts +8 -0
- package/dist/Footer/Footer.svelte +29 -135
- package/dist/Footer/Footer.svelte.d.ts +1 -1
- package/dist/Form/Input/Input.svelte +398 -0
- package/dist/Form/Input/Input.svelte.d.ts +14 -0
- package/dist/Form/Input/InputIcon.svelte +97 -0
- package/dist/Form/Input/InputIcon.svelte.d.ts +9 -0
- package/dist/Form/TextArea/TextArea.svelte +258 -0
- package/dist/Form/TextArea/TextArea.svelte.d.ts +13 -0
- package/dist/Form/Toggle/Toggle.svelte +120 -0
- package/dist/{Toggle → Form/Toggle}/Toggle.svelte.d.ts +4 -3
- package/dist/Header/Header.svelte +65 -100
- package/dist/Header/Header.svelte.d.ts +7 -2
- package/dist/Header/HeaderAccount.svelte +6 -29
- package/dist/HighlightPanel/HighlightPanel.svelte +125 -0
- package/dist/HighlightPanel/HighlightPanel.svelte.d.ts +10 -0
- package/dist/HighlightPanel/highlightPanelState.svelte.d.ts +35 -0
- package/dist/HighlightPanel/highlightPanelState.svelte.js +13 -0
- package/dist/Menu/Menu.svelte +158 -0
- package/dist/Menu/Menu.svelte.d.ts +8 -0
- package/dist/Menu/MenuItem.svelte +153 -0
- package/dist/Menu/MenuItem.svelte.d.ts +11 -0
- package/dist/Menu/Sidebar.svelte +228 -0
- package/dist/Menu/Sidebar.svelte.d.ts +11 -0
- package/dist/Menu/SidebarState.svelte.d.ts +6 -0
- package/dist/Menu/SidebarState.svelte.js +1 -0
- package/dist/Modal/Modal.svelte +2 -3
- package/dist/Modal/ModalContent.svelte +11 -18
- package/dist/Modal/ModalFooter.svelte +10 -14
- package/dist/Modal/ModalHeader.svelte +7 -9
- package/dist/ProgressWizard/ProgressWizard.svelte +355 -0
- package/dist/ProgressWizard/ProgressWizard.svelte.d.ts +16 -0
- package/dist/Tabs/Tabs.svelte +111 -0
- package/dist/Tabs/Tabs.svelte.d.ts +8 -0
- package/dist/Tabs/tabsState.svelte.d.ts +7 -0
- package/dist/Tabs/tabsState.svelte.js +1 -0
- package/dist/Toast/Toast.svelte +7 -12
- package/dist/Tooltip/Tooltip.svelte +168 -0
- package/dist/Tooltip/Tooltip.svelte.d.ts +13 -0
- package/dist/assets/icons/feedback.svg +5 -0
- package/dist/index.d.ts +25 -8
- package/dist/index.js +23 -9
- package/package.json +4 -2
- package/dist/Toggle/Toggle.svelte +0 -170
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { addToast } from '../Toast/toastState.svelte';
|
|
3
|
+
|
|
4
|
+
interface Step {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
isValid?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface StepProps {
|
|
11
|
+
steps: Step[];
|
|
12
|
+
currentStep?: number;
|
|
13
|
+
isFormValid?: boolean;
|
|
14
|
+
onFinalStepAction?: () => void;
|
|
15
|
+
useAsPopUp?: boolean;
|
|
16
|
+
children?: () => any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
steps = $bindable(),
|
|
21
|
+
currentStep = $bindable(1),
|
|
22
|
+
isFormValid = $bindable(),
|
|
23
|
+
onFinalStepAction,
|
|
24
|
+
useAsPopUp = false,
|
|
25
|
+
children
|
|
26
|
+
}: StepProps = $props();
|
|
27
|
+
|
|
28
|
+
steps = steps.map((step) => ({
|
|
29
|
+
...step,
|
|
30
|
+
isValid: step.isValid ?? true
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
let completedSteps = $state<Set<number>>(new Set());
|
|
34
|
+
let stepsFormInstance: any;
|
|
35
|
+
|
|
36
|
+
const goToStep = (step: number) => {
|
|
37
|
+
if (step <= steps.length) {
|
|
38
|
+
for (let i = 1; i <= step; i++) {
|
|
39
|
+
completedSteps.add(i);
|
|
40
|
+
}
|
|
41
|
+
currentStep = step;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const nextStep = () => {
|
|
46
|
+
if (stepsFormInstance && !stepsFormInstance.validateCurrentStep()) {
|
|
47
|
+
isFormValid = false;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (currentStep < steps.length) {
|
|
51
|
+
goToStep(currentStep + 1);
|
|
52
|
+
} else {
|
|
53
|
+
addToast({
|
|
54
|
+
type: 'success',
|
|
55
|
+
message: 'Form submitted successfully!'
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const previousStep = () => {
|
|
61
|
+
if (currentStep > 1) goToStep(currentStep - 1);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onClose = () => {
|
|
65
|
+
if (useAsPopUp) {
|
|
66
|
+
// Logic to close the pop-up
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div class="progress-wizard">
|
|
72
|
+
<!-- Header -->
|
|
73
|
+
<div class="progress-header">
|
|
74
|
+
<div class="title">Create workspace</div>
|
|
75
|
+
<div class="header-actions">
|
|
76
|
+
{#if useAsPopUp}
|
|
77
|
+
<button class="link close" onclick={onClose}>
|
|
78
|
+
<span class="material-icons-outlined">close</span>
|
|
79
|
+
</button>
|
|
80
|
+
{/if}
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<!-- Sidebar + Content -->
|
|
85
|
+
<div class="progress-body">
|
|
86
|
+
<!-- Sidebar -->
|
|
87
|
+
<div class="progress-sidebar">
|
|
88
|
+
<ol>
|
|
89
|
+
{#each steps as step, index}
|
|
90
|
+
<li
|
|
91
|
+
class:completed={completedSteps.has(index + 1)}
|
|
92
|
+
class:active={currentStep === index + 1}
|
|
93
|
+
>
|
|
94
|
+
<button
|
|
95
|
+
type="button"
|
|
96
|
+
onclick={() => goToStep(index + 1)}
|
|
97
|
+
class="step-button"
|
|
98
|
+
class:done={index + 1 < currentStep}
|
|
99
|
+
>
|
|
100
|
+
<div class="step-line-wrapper">
|
|
101
|
+
{#if index < steps.length - 1}
|
|
102
|
+
<div class="step-line"></div>
|
|
103
|
+
{/if}
|
|
104
|
+
<span class="step-icon" class:error={!step.isValid && index + 1 < currentStep}>
|
|
105
|
+
{#if index + 1 < currentStep && step.isValid}
|
|
106
|
+
✔
|
|
107
|
+
{:else if !step.isValid && index + 1 < currentStep}
|
|
108
|
+
x
|
|
109
|
+
{:else}
|
|
110
|
+
{index + 1}
|
|
111
|
+
{/if}
|
|
112
|
+
</span>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="step-details">
|
|
115
|
+
<strong>{step.title}</strong>
|
|
116
|
+
<small>{step.description}</small>
|
|
117
|
+
</div>
|
|
118
|
+
</button>
|
|
119
|
+
</li>
|
|
120
|
+
{/each}
|
|
121
|
+
</ol>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<!-- Main Content -->
|
|
125
|
+
<div class="progress-content">
|
|
126
|
+
<div class="step-content">
|
|
127
|
+
{@render children?.()}
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<!-- Footer -->
|
|
133
|
+
<div class="progress-footer">
|
|
134
|
+
<button class="btn link">Cancel</button>
|
|
135
|
+
<div class="action-buttons">
|
|
136
|
+
<button class="btn secondary" onclick={previousStep} disabled={currentStep === 1}>Back</button
|
|
137
|
+
>
|
|
138
|
+
<button
|
|
139
|
+
class="btn primary"
|
|
140
|
+
onclick={nextStep}
|
|
141
|
+
disabled={currentStep === steps.length && !isFormValid}
|
|
142
|
+
>
|
|
143
|
+
{currentStep === steps.length ? 'Create' : 'Next'}
|
|
144
|
+
</button>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<style>
|
|
150
|
+
.progress-wizard {
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
width: 100%;
|
|
154
|
+
max-width: 97vw;
|
|
155
|
+
margin: 0 auto;
|
|
156
|
+
background: #fff;
|
|
157
|
+
border-radius: 8px;
|
|
158
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
font-size: 14px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.progress-body {
|
|
164
|
+
display: flex;
|
|
165
|
+
width: 100%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.progress-sidebar {
|
|
169
|
+
width: 100%;
|
|
170
|
+
min-width: 226px;
|
|
171
|
+
max-width: 226px;
|
|
172
|
+
min-height: 50vh;
|
|
173
|
+
border-right: 1px solid #e6e6e6;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.progress-content {
|
|
177
|
+
flex-grow: 1;
|
|
178
|
+
padding: 24px;
|
|
179
|
+
margin-bottom: -20px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.progress-header {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: space-between;
|
|
186
|
+
padding: 24px;
|
|
187
|
+
gap: 16px;
|
|
188
|
+
border-bottom: 2px solid transparent;
|
|
189
|
+
border-image: linear-gradient(259deg, #00c9cd 16.32%, #472aff 59.03%, #392d9c 99.99%);
|
|
190
|
+
border-image-slice: 1;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.progress-header .title {
|
|
194
|
+
color: #000;
|
|
195
|
+
font-size: 18px;
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
line-height: 26px;
|
|
198
|
+
flex: 1 0 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.progress-header .header-actions button span {
|
|
202
|
+
font-size: 24px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.progress-sidebar li {
|
|
206
|
+
display: flex;
|
|
207
|
+
position: relative;
|
|
208
|
+
cursor: default;
|
|
209
|
+
padding: 16px 24px;
|
|
210
|
+
gap: 8px;
|
|
211
|
+
color: inherit;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.progress-sidebar li.completed {
|
|
215
|
+
color: #4caf50;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.progress-sidebar li.active {
|
|
219
|
+
color: #472aff;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.step-button {
|
|
223
|
+
all: unset;
|
|
224
|
+
width: 100%;
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: flex-start;
|
|
227
|
+
border-radius: 4px;
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
transition: background 0.3s;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.step-button:hover .step-icon,
|
|
233
|
+
li.active .step-icon {
|
|
234
|
+
border-color: #472aff;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.step-button:hover .step-details,
|
|
238
|
+
.step-button:hover .step-details small,
|
|
239
|
+
li.active .step-button .step-details small {
|
|
240
|
+
color: #472aff;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.step-icon {
|
|
244
|
+
width: 24px;
|
|
245
|
+
height: 24px;
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: center;
|
|
248
|
+
justify-content: center;
|
|
249
|
+
background: #eaecff;
|
|
250
|
+
border: 2px solid #eaecff;
|
|
251
|
+
border-radius: 50%;
|
|
252
|
+
margin-right: 10px;
|
|
253
|
+
font-size: 0.9rem;
|
|
254
|
+
color: #472aff;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
li .done .step-icon {
|
|
258
|
+
background: #472aff;
|
|
259
|
+
color: white;
|
|
260
|
+
border-color: #472aff;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.step-button .step-icon.error {
|
|
264
|
+
background: #fce8ea;
|
|
265
|
+
color: #bb1425;
|
|
266
|
+
border-color: #bb1425;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.step-line-wrapper {
|
|
270
|
+
position: relative;
|
|
271
|
+
display: flex;
|
|
272
|
+
flex-direction: column;
|
|
273
|
+
align-items: center;
|
|
274
|
+
justify-content: flex-start;
|
|
275
|
+
margin-right: 10px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.step-line {
|
|
279
|
+
width: 1px;
|
|
280
|
+
height: 40px;
|
|
281
|
+
background: #e6e6e6;
|
|
282
|
+
position: absolute;
|
|
283
|
+
top: 100%;
|
|
284
|
+
left: 37%;
|
|
285
|
+
transform: translateX(-50%);
|
|
286
|
+
z-index: 0;
|
|
287
|
+
transition: background 0.3s ease;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
li.completed .step-line,
|
|
291
|
+
li .done .step-line {
|
|
292
|
+
background: #472aff;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.step-details {
|
|
296
|
+
display: flex;
|
|
297
|
+
flex-direction: column;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.step-details strong {
|
|
301
|
+
font-size: 16px;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.step-details small {
|
|
305
|
+
font-size: 12px;
|
|
306
|
+
color: #999;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.step-content {
|
|
310
|
+
margin-bottom: 20px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.progress-footer {
|
|
314
|
+
display: flex;
|
|
315
|
+
justify-content: space-between;
|
|
316
|
+
align-items: center;
|
|
317
|
+
padding: 10px 20px;
|
|
318
|
+
border-top: 1px solid #e6e6e6;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.btn {
|
|
322
|
+
padding: 10px 20px;
|
|
323
|
+
border-radius: 4px;
|
|
324
|
+
border: none;
|
|
325
|
+
cursor: pointer;
|
|
326
|
+
font-size: 0.9rem;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.btn.primary {
|
|
330
|
+
background: #472aff;
|
|
331
|
+
color: white;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.btn.secondary {
|
|
335
|
+
background: #eaecff;
|
|
336
|
+
color: #472aff;
|
|
337
|
+
margin-right: 10px;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.btn:disabled {
|
|
341
|
+
cursor: not-allowed;
|
|
342
|
+
opacity: 0.5;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.link {
|
|
346
|
+
background: transparent;
|
|
347
|
+
color: #472aff;
|
|
348
|
+
font-size: 0.9rem;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.close {
|
|
352
|
+
color: #25282d;
|
|
353
|
+
border: none;
|
|
354
|
+
}
|
|
355
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Step {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isValid?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface StepProps {
|
|
7
|
+
steps: Step[];
|
|
8
|
+
currentStep?: number;
|
|
9
|
+
isFormValid?: boolean;
|
|
10
|
+
onFinalStepAction?: () => void;
|
|
11
|
+
useAsPopUp?: boolean;
|
|
12
|
+
children?: () => any;
|
|
13
|
+
}
|
|
14
|
+
declare const ProgressWizard: import("svelte").Component<StepProps, {}, "steps" | "currentStep" | "isFormValid">;
|
|
15
|
+
type ProgressWizard = ReturnType<typeof ProgressWizard>;
|
|
16
|
+
export default ProgressWizard;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Tab } from '../index.js';
|
|
3
|
+
|
|
4
|
+
interface TabsProps {
|
|
5
|
+
tabs: Tab[];
|
|
6
|
+
activeTab?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { tabs = [], activeTab = 0 }: TabsProps = $props();
|
|
10
|
+
|
|
11
|
+
const handleClick = (index: number) => (): void => {
|
|
12
|
+
activeTab = index;
|
|
13
|
+
};
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div class="tabs-container">
|
|
17
|
+
<div class="tabs-list" role="tablist" aria-label="tabs">
|
|
18
|
+
{#each tabs as tab}
|
|
19
|
+
{#if !tab.hidden}
|
|
20
|
+
{@const isActiveTab = activeTab === tab.index}
|
|
21
|
+
<button
|
|
22
|
+
id="tab-{tab.index}"
|
|
23
|
+
role="tab"
|
|
24
|
+
aria-selected={isActiveTab}
|
|
25
|
+
aria-controls="panel-{tab.index}"
|
|
26
|
+
tabindex={isActiveTab ? 0 : -1}
|
|
27
|
+
type="button"
|
|
28
|
+
class:active={isActiveTab}
|
|
29
|
+
onclick={handleClick(tab.index)}
|
|
30
|
+
>
|
|
31
|
+
{tab.label}
|
|
32
|
+
</button>
|
|
33
|
+
{/if}
|
|
34
|
+
{/each}
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{#each tabs as tab}
|
|
38
|
+
{#if activeTab === tab.index}
|
|
39
|
+
<div
|
|
40
|
+
class="tabs-content"
|
|
41
|
+
id="panel-{tab.index}"
|
|
42
|
+
role="tabpanel"
|
|
43
|
+
aria-labelledby="tab-{tab.index}"
|
|
44
|
+
>
|
|
45
|
+
{@render tab.component?.()}
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.tabs-container {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
width: 100%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tabs-list {
|
|
59
|
+
display: flex;
|
|
60
|
+
gap: 16px;
|
|
61
|
+
border-bottom: 1px solid #e0e5e8;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.tabs-list button {
|
|
65
|
+
border-radius: 8px;
|
|
66
|
+
background-color: #fff;
|
|
67
|
+
padding: 20px 16px 20px;
|
|
68
|
+
position: relative;
|
|
69
|
+
border: none;
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.tabs-list button:hover {
|
|
74
|
+
background-color: #f4f6f8;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.tabs-list button.active {
|
|
79
|
+
color: #472aff;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.tabs-list button::after {
|
|
83
|
+
content: '';
|
|
84
|
+
position: absolute;
|
|
85
|
+
left: 50%;
|
|
86
|
+
bottom: -2px;
|
|
87
|
+
width: 0;
|
|
88
|
+
height: 4px;
|
|
89
|
+
background-color: #472aff;
|
|
90
|
+
border-radius: 8px;
|
|
91
|
+
transform: translateX(-50%);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tabs-list button:hover::after,
|
|
95
|
+
.tabs-list button.active::after {
|
|
96
|
+
width: 90%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.tabs-content {
|
|
100
|
+
width: 100%;
|
|
101
|
+
height: 100%;
|
|
102
|
+
position: relative;
|
|
103
|
+
border-radius: 0px 0px 16px 16px;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
padding: 24px;
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
min-height: 300px;
|
|
108
|
+
text-align: left;
|
|
109
|
+
font-size: 18px;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Toast/Toast.svelte
CHANGED
|
@@ -65,9 +65,8 @@
|
|
|
65
65
|
align-items: center;
|
|
66
66
|
gap: 16px;
|
|
67
67
|
border-radius: 8px;
|
|
68
|
-
border: 1px solid
|
|
69
|
-
background:
|
|
70
|
-
/* shadow/dropdown */
|
|
68
|
+
border: 1px solid #e0e5e8;
|
|
69
|
+
background: #fff;
|
|
71
70
|
box-shadow:
|
|
72
71
|
0px 4px 5px 0px rgba(51, 56, 64, 0.15),
|
|
73
72
|
0px 1px 3px 0px rgba(51, 56, 64, 0.2),
|
|
@@ -78,27 +77,23 @@
|
|
|
78
77
|
padding: 8px 0px;
|
|
79
78
|
align-items: flex-start;
|
|
80
79
|
gap: 8px;
|
|
81
|
-
color:
|
|
82
|
-
|
|
83
|
-
/* regular/2 */
|
|
84
|
-
font-family: 'Haas Grotesk Display Pro', sans-serif;
|
|
80
|
+
color: #000;
|
|
85
81
|
font-size: 14px;
|
|
86
82
|
font-style: normal;
|
|
87
83
|
font-weight: 400;
|
|
88
|
-
line-height: 20px;
|
|
84
|
+
line-height: 20px;
|
|
89
85
|
}
|
|
90
86
|
.toast-content-link {
|
|
91
87
|
display: flex;
|
|
92
88
|
align-items: flex-start;
|
|
93
|
-
color:
|
|
94
|
-
font-family: 'Haas Grotesk Display Pro', sans-serif;
|
|
89
|
+
color: #2b1999;
|
|
95
90
|
font-size: 14px;
|
|
96
91
|
font-style: normal;
|
|
97
92
|
font-weight: 400;
|
|
98
|
-
line-height: 20px;
|
|
93
|
+
line-height: 20px;
|
|
99
94
|
}
|
|
100
95
|
.toast-content-link:hover {
|
|
101
|
-
color:
|
|
96
|
+
color: #472aff;
|
|
102
97
|
text-decoration: underline;
|
|
103
98
|
}
|
|
104
99
|
</style>
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { cubicOut } from 'svelte/easing';
|
|
4
|
+
import type { FlyParams } from 'svelte/transition';
|
|
5
|
+
import { fly } from 'svelte/transition';
|
|
6
|
+
|
|
7
|
+
type Position = 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
+
type Width = 'xs' | 'sm' | 'md';
|
|
9
|
+
|
|
10
|
+
interface TooltipProps {
|
|
11
|
+
content: string;
|
|
12
|
+
position?: Position;
|
|
13
|
+
width?: Width;
|
|
14
|
+
class?: string;
|
|
15
|
+
children: Snippet;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
content,
|
|
20
|
+
position = 'top',
|
|
21
|
+
width = 'xs',
|
|
22
|
+
class: customClass = '',
|
|
23
|
+
children
|
|
24
|
+
}: TooltipProps = $props();
|
|
25
|
+
|
|
26
|
+
let isVisible = $state(false);
|
|
27
|
+
|
|
28
|
+
const toggleTooltip = () => {
|
|
29
|
+
isVisible = !isVisible;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const TRANSITION_DURATION = 200;
|
|
33
|
+
const ARROW_OFFSET = 8;
|
|
34
|
+
|
|
35
|
+
const transitionConfig: FlyParams = {
|
|
36
|
+
duration: TRANSITION_DURATION,
|
|
37
|
+
easing: cubicOut,
|
|
38
|
+
y: position === 'top' ? ARROW_OFFSET : position === 'bottom' ? -ARROW_OFFSET : 0,
|
|
39
|
+
x: position === 'left' ? ARROW_OFFSET : position === 'right' ? -ARROW_OFFSET : 0
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<div
|
|
44
|
+
class="tooltip-trigger"
|
|
45
|
+
role="button"
|
|
46
|
+
tabindex="0"
|
|
47
|
+
onmouseenter={toggleTooltip}
|
|
48
|
+
onmouseleave={toggleTooltip}
|
|
49
|
+
onfocus={toggleTooltip}
|
|
50
|
+
onblur={toggleTooltip}
|
|
51
|
+
>
|
|
52
|
+
{@render children()}
|
|
53
|
+
|
|
54
|
+
{#if isVisible && content}
|
|
55
|
+
<div
|
|
56
|
+
class="tooltip tooltip-{position} tooltip-{width} {customClass}"
|
|
57
|
+
in:fly={transitionConfig}
|
|
58
|
+
out:fly={transitionConfig}
|
|
59
|
+
role="tooltip"
|
|
60
|
+
aria-live="polite"
|
|
61
|
+
>
|
|
62
|
+
{content}
|
|
63
|
+
<div class="tooltip-arrow tooltip-arrow-{position}" aria-hidden="true"></div>
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<style>
|
|
69
|
+
.tooltip-trigger {
|
|
70
|
+
position: relative;
|
|
71
|
+
display: inline-block;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.tooltip-trigger:focus-visible {
|
|
75
|
+
outline: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.tooltip {
|
|
79
|
+
position: absolute;
|
|
80
|
+
z-index: 1000;
|
|
81
|
+
padding: 8px 12px;
|
|
82
|
+
border-radius: 6px;
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
line-height: 20px;
|
|
86
|
+
text-align: center;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
background-color: #25282d;
|
|
89
|
+
color: #ffffff;
|
|
90
|
+
white-space: normal;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.tooltip-xs {
|
|
94
|
+
width: 120px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.tooltip-sm {
|
|
98
|
+
width: 200px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.tooltip-md {
|
|
102
|
+
width: 320px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tooltip-top {
|
|
106
|
+
bottom: calc(100% + 12px);
|
|
107
|
+
left: 50%;
|
|
108
|
+
transform: translateX(-50%);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.tooltip-bottom {
|
|
112
|
+
top: calc(100% + 12px);
|
|
113
|
+
left: 50%;
|
|
114
|
+
transform: translateX(-50%);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.tooltip-left {
|
|
118
|
+
top: 50%;
|
|
119
|
+
right: calc(100% + 12px);
|
|
120
|
+
transform: translateY(-50%);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.tooltip-right {
|
|
124
|
+
top: 50%;
|
|
125
|
+
left: calc(100% + 12px);
|
|
126
|
+
transform: translateY(-50%);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.tooltip-arrow {
|
|
130
|
+
position: absolute;
|
|
131
|
+
border: 6px solid transparent;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.tooltip-arrow-top {
|
|
135
|
+
top: 100%;
|
|
136
|
+
left: 50%;
|
|
137
|
+
transform: translateX(-50%);
|
|
138
|
+
border-top-color: #25282d;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.tooltip-arrow-bottom {
|
|
142
|
+
bottom: 100%;
|
|
143
|
+
left: 50%;
|
|
144
|
+
transform: translateX(-50%);
|
|
145
|
+
border-bottom-color: #25282d;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.tooltip-arrow-left {
|
|
149
|
+
top: 50%;
|
|
150
|
+
left: 100%;
|
|
151
|
+
transform: translateY(-50%);
|
|
152
|
+
border-left-color: #25282d;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.tooltip-arrow-right {
|
|
156
|
+
top: 50%;
|
|
157
|
+
right: 100%;
|
|
158
|
+
transform: translateY(-50%);
|
|
159
|
+
border-right-color: #25282d;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@media (max-width: 768px) {
|
|
163
|
+
.tooltip {
|
|
164
|
+
font-size: 11px;
|
|
165
|
+
padding: 6px 10px;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
</style>
|