@softwareone/spi-sv5-library 1.3.1 → 1.3.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/Form/Label.svelte +1 -3
- package/dist/Form/Select/Select.svelte +110 -95
- package/dist/Form/Toggle/Toggle.svelte +56 -21
- package/dist/Form/Toggle/Toggle.svelte.d.ts +3 -0
- package/dist/Header/Header.svelte +39 -25
- package/dist/Header/Header.svelte.d.ts +1 -3
- package/dist/Menu/Menu.svelte +2 -41
- package/dist/Menu/Menu.svelte.d.ts +1 -1
- package/dist/Modal/Modal.svelte +31 -23
- package/dist/Modal/ModalContent.svelte +7 -3
- package/dist/Modal/ModalContent.svelte.d.ts +1 -0
- package/dist/Modal/modalState.svelte.d.ts +1 -0
- package/dist/ProgressWizard/ProgressWizard.svelte +0 -1
- package/dist/Spinner/Spinner.svelte +1 -0
- package/package.json +1 -1
package/dist/Form/Label.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
3
|
import type { Action } from 'svelte/action';
|
|
4
4
|
|
|
5
5
|
import { Search, type SelectOption } from '../../index.js';
|
|
@@ -50,39 +50,75 @@
|
|
|
50
50
|
let searchText = $state('');
|
|
51
51
|
let showInTopPosition = $state(false);
|
|
52
52
|
let showListOptions = $state(false);
|
|
53
|
-
let selectedOptions = $state<SelectOption[]>([]);
|
|
54
|
-
let selectedOption = $state<SelectOption | undefined>();
|
|
55
53
|
|
|
56
|
-
let
|
|
54
|
+
let dropdown: HTMLElement;
|
|
55
|
+
let dropdownContainer: HTMLElement;
|
|
57
56
|
|
|
58
57
|
const isStringArray = (items: string[] | SelectOption[]): items is string[] =>
|
|
59
58
|
typeof items[0] === 'string';
|
|
60
59
|
|
|
61
|
-
const
|
|
62
|
-
|
|
60
|
+
const generateSelectOption = (text: string, options: SelectOption[]): SelectOption =>
|
|
61
|
+
options.find((option) => option.value === text) ?? {
|
|
62
|
+
label: text,
|
|
63
|
+
value: text
|
|
64
|
+
};
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
? originalOptions.filter((option) => option.label.toLowerCase().includes(text))
|
|
66
|
-
: originalOptions;
|
|
67
|
-
};
|
|
66
|
+
const valueSet = $derived<Set<string>>(new Set(Array.isArray(value) ? value : []));
|
|
68
67
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const isInvalid = $derived<boolean>(!!error && !disableValidationColor);
|
|
69
|
+
|
|
70
|
+
const isValid = $derived<boolean>(
|
|
71
|
+
!isInvalid &&
|
|
72
|
+
!disableValidationColor &&
|
|
73
|
+
(Array.isArray(value) ? value.length > 0 : !!value || optional)
|
|
74
|
+
);
|
|
73
75
|
|
|
74
76
|
const originalOptions = $derived<SelectOption[]>(
|
|
75
|
-
isStringArray(options) ? options.map((
|
|
77
|
+
isStringArray(options) ? options.map((option) => ({ label: option, value: option })) : options
|
|
76
78
|
);
|
|
77
|
-
const valueSet = $derived<Set<string>>(new Set(value));
|
|
78
|
-
const isInvalid = $derived<boolean>(!!error && !disableValidationColor);
|
|
79
|
-
const isValid = $derived<boolean>(!isInvalid && (!!value || optional) && !disableValidationColor);
|
|
80
|
-
const filteredOptions = $derived<SelectOption[]>(filterOptions());
|
|
81
|
-
const noOptionsAvailable = $derived<boolean>(checkNoOptionsAvailable());
|
|
82
79
|
|
|
83
|
-
const
|
|
80
|
+
const selectedOptions = $derived<SelectOption[]>(
|
|
81
|
+
multiple && Array.isArray(value) && value.length
|
|
82
|
+
? value.map((text) => generateSelectOption(text, originalOptions))
|
|
83
|
+
: []
|
|
84
|
+
);
|
|
84
85
|
|
|
85
|
-
const
|
|
86
|
+
const selectedOption = $derived<SelectOption | undefined>(
|
|
87
|
+
!multiple && typeof value === 'string' && value
|
|
88
|
+
? generateSelectOption(value, originalOptions)
|
|
89
|
+
: undefined
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const noOptionsAvailable = $derived<boolean>(
|
|
93
|
+
!options.length
|
|
94
|
+
? true
|
|
95
|
+
: multiple && originalOptions.every((option) => valueSet.has(option.value))
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const filteredOptions = $derived.by<SelectOption[]>(() => {
|
|
99
|
+
const text = searchText.toLowerCase();
|
|
100
|
+
return !text
|
|
101
|
+
? originalOptions
|
|
102
|
+
: originalOptions.filter((option) => option.label.toLowerCase().includes(text));
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const activeOptionScroll: Action<HTMLElement, boolean> = (node, isActive) => {
|
|
106
|
+
$effect(() => {
|
|
107
|
+
if (isActive) {
|
|
108
|
+
node.scrollIntoView({ behavior: 'instant', block: 'nearest' });
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const autoDirection: Action = () => {
|
|
114
|
+
$effect(() => {
|
|
115
|
+
const rect = dropdown.getBoundingClientRect();
|
|
116
|
+
const viewportHeight = window.innerHeight;
|
|
117
|
+
const footer = 300;
|
|
118
|
+
|
|
119
|
+
showInTopPosition = rect.bottom + footer > viewportHeight;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
86
122
|
|
|
87
123
|
const canBeVisible = (option: SelectOption): boolean =>
|
|
88
124
|
!selectedOptions.some((selectedOption) => selectedOption.value === option.value);
|
|
@@ -94,93 +130,61 @@
|
|
|
94
130
|
};
|
|
95
131
|
|
|
96
132
|
const onSelectOption = (option: SelectOption) => {
|
|
97
|
-
|
|
98
|
-
selectedOptions = [...selectedOptions, option];
|
|
99
|
-
value = selectedOptions.map(generateMultiselectValue);
|
|
100
|
-
} else {
|
|
101
|
-
selectedOption = option;
|
|
102
|
-
value = option.value;
|
|
103
|
-
}
|
|
104
|
-
|
|
133
|
+
value = multiple ? [...(value ?? []), option.value] : option.value;
|
|
105
134
|
closeAfterSelect();
|
|
106
135
|
onchange?.(option);
|
|
107
136
|
};
|
|
108
137
|
|
|
109
|
-
const onClearAll = () => {
|
|
110
|
-
if (multiple) {
|
|
111
|
-
selectedOptions = [];
|
|
112
|
-
value = [];
|
|
113
|
-
} else {
|
|
114
|
-
selectedOption = undefined;
|
|
115
|
-
value = '';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
onclear?.();
|
|
119
|
-
};
|
|
120
|
-
|
|
121
138
|
const onRemoveSelectedOption = (index: number) => {
|
|
122
139
|
const newSelectedOptions = [...selectedOptions];
|
|
123
140
|
newSelectedOptions.splice(index, 1);
|
|
124
|
-
|
|
125
|
-
value = selectedOptions.map(generateMultiselectValue);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const onClearSearch = () => {
|
|
129
|
-
searchText = '';
|
|
141
|
+
value = newSelectedOptions.map((option) => option.value);
|
|
130
142
|
};
|
|
131
143
|
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const activeOptionScroll: Action<HTMLElement, boolean> = (node, isActive) => {
|
|
139
|
-
$effect(() => {
|
|
140
|
-
if (isActive) {
|
|
141
|
-
node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
+
const onClearAll = () => {
|
|
145
|
+
value = multiple ? [] : '';
|
|
146
|
+
onclear?.();
|
|
144
147
|
};
|
|
145
148
|
|
|
146
|
-
const
|
|
147
|
-
$effect(() => {
|
|
148
|
-
const rect = dropdownElement.getBoundingClientRect();
|
|
149
|
-
const viewportHeight = window.innerHeight;
|
|
150
|
-
const footer = 300;
|
|
149
|
+
const onClearSearch = () => (searchText = '');
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
};
|
|
151
|
+
const onFocusDropdownContainer = () => dropdownContainer && dropdownContainer.focus();
|
|
155
152
|
|
|
156
|
-
|
|
157
|
-
if (!value) return;
|
|
153
|
+
const onToggleListOptions = () => (showListOptions = !showListOptions);
|
|
158
154
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
selectedOption = generateSelectOption(value);
|
|
155
|
+
const onHandleClickOutside = (event: MouseEvent) => {
|
|
156
|
+
if (showListOptions && dropdown && !dropdown.contains(event.target as Node)) {
|
|
157
|
+
showListOptions = false;
|
|
163
158
|
}
|
|
164
|
-
}
|
|
159
|
+
};
|
|
165
160
|
</script>
|
|
166
161
|
|
|
167
|
-
<svelte:window
|
|
162
|
+
<svelte:window onclick={onHandleClickOutside} />
|
|
168
163
|
|
|
169
|
-
<div class="form-
|
|
164
|
+
<div class="form-control">
|
|
170
165
|
{#if label}
|
|
171
|
-
<
|
|
166
|
+
<div
|
|
167
|
+
role="button"
|
|
168
|
+
aria-disabled="true"
|
|
169
|
+
class="label-wrapper"
|
|
170
|
+
onclick={onFocusDropdownContainer}
|
|
171
|
+
onkeypress={onFocusDropdownContainer}
|
|
172
|
+
>
|
|
173
|
+
<Label {label} {required} {optional} {infoTooltip} />
|
|
174
|
+
</div>
|
|
172
175
|
{/if}
|
|
173
176
|
|
|
174
177
|
<div
|
|
175
178
|
class={['dropdown', disabled ? 'disabled' : [isInvalid && 'invalid', isValid && 'valid']]}
|
|
176
|
-
bind:this={
|
|
179
|
+
bind:this={dropdown}
|
|
177
180
|
>
|
|
178
181
|
<section
|
|
179
|
-
class="dropdown-container"
|
|
180
182
|
role="button"
|
|
181
183
|
tabindex="0"
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
class="dropdown-container"
|
|
185
|
+
onclick={onToggleListOptions}
|
|
186
|
+
onkeypress={onToggleListOptions}
|
|
187
|
+
bind:this={dropdownContainer}
|
|
184
188
|
>
|
|
185
189
|
<div class="dropdown-container-selected-options">
|
|
186
190
|
{#if selectedOption || selectedOptions.length}
|
|
@@ -290,7 +294,7 @@
|
|
|
290
294
|
{/snippet}
|
|
291
295
|
|
|
292
296
|
<style>
|
|
293
|
-
.form-
|
|
297
|
+
.form-control {
|
|
294
298
|
--primary-color: #472aff;
|
|
295
299
|
--white: #fff;
|
|
296
300
|
--black: #000;
|
|
@@ -308,11 +312,17 @@
|
|
|
308
312
|
width: 100%;
|
|
309
313
|
gap: 8px;
|
|
310
314
|
font-size: 14px;
|
|
311
|
-
}
|
|
312
315
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
+
> .label-wrapper {
|
|
317
|
+
width: fit-content;
|
|
318
|
+
word-break: break-word;
|
|
319
|
+
cursor: default;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
> .form-message-error {
|
|
323
|
+
font-size: 12px;
|
|
324
|
+
color: var(--error);
|
|
325
|
+
}
|
|
316
326
|
}
|
|
317
327
|
|
|
318
328
|
.dropdown {
|
|
@@ -352,7 +362,7 @@
|
|
|
352
362
|
}
|
|
353
363
|
|
|
354
364
|
.dropdown.invalid {
|
|
355
|
-
border
|
|
365
|
+
border: 1px solid var(--error);
|
|
356
366
|
}
|
|
357
367
|
|
|
358
368
|
.dropdown.invalid:focus-within {
|
|
@@ -362,11 +372,12 @@
|
|
|
362
372
|
.dropdown > .dropdown-container {
|
|
363
373
|
display: grid;
|
|
364
374
|
grid-template-columns: 1fr auto;
|
|
365
|
-
min-height:
|
|
366
|
-
padding: 8px;
|
|
375
|
+
min-height: 36px;
|
|
376
|
+
padding: 8px 16px;
|
|
367
377
|
gap: 8px;
|
|
368
378
|
align-items: center;
|
|
369
379
|
cursor: pointer;
|
|
380
|
+
outline: none;
|
|
370
381
|
border: none;
|
|
371
382
|
border-radius: 8px;
|
|
372
383
|
background: var(--white);
|
|
@@ -386,13 +397,13 @@
|
|
|
386
397
|
}
|
|
387
398
|
|
|
388
399
|
> .dropdown-container-selected-option {
|
|
389
|
-
display:
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
gap: 8px;
|
|
400
|
+
display: flex;
|
|
401
|
+
padding: 0px 5px;
|
|
402
|
+
gap: 4px;
|
|
393
403
|
align-items: center;
|
|
394
404
|
cursor: default;
|
|
395
|
-
border-radius:
|
|
405
|
+
border-radius: 4px;
|
|
406
|
+
border: 1px solid var(--gray-2);
|
|
396
407
|
background: var(--gray-1);
|
|
397
408
|
}
|
|
398
409
|
}
|
|
@@ -442,11 +453,13 @@
|
|
|
442
453
|
min-height: 40px;
|
|
443
454
|
padding: 0px 8px;
|
|
444
455
|
cursor: pointer;
|
|
456
|
+
outline: none;
|
|
445
457
|
border: none;
|
|
446
458
|
background: transparent;
|
|
447
459
|
}
|
|
448
460
|
}
|
|
449
461
|
|
|
462
|
+
.dropdown-list-option:not(.active) > button:focus-visible,
|
|
450
463
|
.dropdown-list-option:not(.active) > button:hover {
|
|
451
464
|
background: var(--gray-1);
|
|
452
465
|
}
|
|
@@ -457,12 +470,14 @@
|
|
|
457
470
|
}
|
|
458
471
|
|
|
459
472
|
.clear-button {
|
|
473
|
+
outline: none;
|
|
460
474
|
border: none;
|
|
461
475
|
color: var(--gray-4);
|
|
462
476
|
background: transparent;
|
|
463
477
|
transition: color 0.2s ease-in-out;
|
|
464
478
|
}
|
|
465
479
|
|
|
480
|
+
.clear-button:focus-visible,
|
|
466
481
|
.clear-button:hover {
|
|
467
482
|
cursor: pointer;
|
|
468
483
|
color: var(--black);
|
|
@@ -1,36 +1,71 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Label from '../Label.svelte';
|
|
3
|
+
|
|
2
4
|
interface ToggleProps {
|
|
3
5
|
id?: string;
|
|
4
6
|
checked?: boolean;
|
|
5
7
|
disabled?: boolean;
|
|
8
|
+
label?: string;
|
|
9
|
+
infoTooltip?: string;
|
|
10
|
+
vertical?: boolean;
|
|
6
11
|
onchange?: (event: Event) => void;
|
|
7
12
|
}
|
|
8
13
|
|
|
9
|
-
let {
|
|
14
|
+
let {
|
|
15
|
+
id = '',
|
|
16
|
+
checked = $bindable(false),
|
|
17
|
+
disabled = false,
|
|
18
|
+
label,
|
|
19
|
+
infoTooltip,
|
|
20
|
+
vertical,
|
|
21
|
+
onchange
|
|
22
|
+
}: ToggleProps = $props();
|
|
10
23
|
</script>
|
|
11
24
|
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</
|
|
25
|
+
<div class="container" class:vertical>
|
|
26
|
+
<label class="toggle-container">
|
|
27
|
+
<input
|
|
28
|
+
type="checkbox"
|
|
29
|
+
class="toggle-input"
|
|
30
|
+
bind:checked
|
|
31
|
+
{disabled}
|
|
32
|
+
{id}
|
|
33
|
+
{onchange}
|
|
34
|
+
role="switch"
|
|
35
|
+
/>
|
|
36
|
+
<div class={['toggle-slider', checked && 'checked', disabled && 'disabled']}>
|
|
37
|
+
<span class="material-icons-outlined toggle-icon">
|
|
38
|
+
{#if checked}
|
|
39
|
+
done
|
|
40
|
+
{:else}
|
|
41
|
+
close
|
|
42
|
+
{/if}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
</label>
|
|
46
|
+
<Label {label} {infoTooltip} />
|
|
47
|
+
</div>
|
|
32
48
|
|
|
33
49
|
<style>
|
|
50
|
+
.container {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: 8px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.container.vertical {
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.container.vertical .toggle-container {
|
|
63
|
+
order: 2;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.container.vertical label {
|
|
67
|
+
order: 1;
|
|
68
|
+
}
|
|
34
69
|
.toggle-container {
|
|
35
70
|
position: relative;
|
|
36
71
|
}
|
|
@@ -2,6 +2,9 @@ interface ToggleProps {
|
|
|
2
2
|
id?: string;
|
|
3
3
|
checked?: boolean;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
infoTooltip?: string;
|
|
7
|
+
vertical?: boolean;
|
|
5
8
|
onchange?: (event: Event) => void;
|
|
6
9
|
}
|
|
7
10
|
declare const Toggle: import("svelte").Component<ToggleProps, {}, "checked">;
|
|
@@ -9,27 +9,29 @@
|
|
|
9
9
|
title?: string;
|
|
10
10
|
homeUrl?: string;
|
|
11
11
|
hideAccount?: boolean;
|
|
12
|
-
hideHelp?: boolean;
|
|
13
|
-
hideNotification?: boolean;
|
|
14
12
|
accountName?: string;
|
|
15
13
|
userName?: string;
|
|
16
14
|
profileUrl?: string;
|
|
17
15
|
hideLoader?: boolean;
|
|
18
|
-
menu?: Snippet
|
|
16
|
+
menu?: Snippet<[showMenu: boolean]>;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
let {
|
|
22
|
-
title = '
|
|
20
|
+
title = '',
|
|
23
21
|
homeUrl = '/',
|
|
24
22
|
hideAccount,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
accountName = 'Company Name',
|
|
28
|
-
userName = 'User Name',
|
|
23
|
+
accountName = '',
|
|
24
|
+
userName = '',
|
|
29
25
|
profileUrl = '/profile',
|
|
30
26
|
hideLoader,
|
|
31
27
|
menu
|
|
32
28
|
}: HeaderProps = $props();
|
|
29
|
+
|
|
30
|
+
let showMenu = $state(false);
|
|
31
|
+
|
|
32
|
+
const toggleMenu = () => {
|
|
33
|
+
showMenu = !showMenu;
|
|
34
|
+
};
|
|
33
35
|
</script>
|
|
34
36
|
|
|
35
37
|
<div class="header-container">
|
|
@@ -37,7 +39,13 @@
|
|
|
37
39
|
{#if !hideLoader}
|
|
38
40
|
<HeaderLoader />
|
|
39
41
|
{/if}
|
|
40
|
-
|
|
42
|
+
|
|
43
|
+
{#if menu}
|
|
44
|
+
<button type="button" class="header-button" onclick={toggleMenu} aria-label="menu button">
|
|
45
|
+
<span class="material-icons icon-span">menu</span>
|
|
46
|
+
</button>
|
|
47
|
+
{@render menu(showMenu)}
|
|
48
|
+
{/if}
|
|
41
49
|
<a href={homeUrl} title="Home">
|
|
42
50
|
<HeaderLogo />
|
|
43
51
|
</a>
|
|
@@ -47,16 +55,6 @@
|
|
|
47
55
|
</nav>
|
|
48
56
|
|
|
49
57
|
<nav class="header-section">
|
|
50
|
-
{#if !hideHelp}
|
|
51
|
-
<button class="header-btn material-icons-outlined" aria-labelledby="help-button">
|
|
52
|
-
help_outline
|
|
53
|
-
</button>
|
|
54
|
-
{/if}
|
|
55
|
-
{#if !hideNotification}
|
|
56
|
-
<button class="header-btn material-icons-outlined" aria-labelledby="notifications-button">
|
|
57
|
-
notifications
|
|
58
|
-
</button>
|
|
59
|
-
{/if}
|
|
60
58
|
{#if !hideAccount}
|
|
61
59
|
<a href={profileUrl} title="Profile">
|
|
62
60
|
<HeaderAccount {accountName} {userName} />
|
|
@@ -66,6 +64,28 @@
|
|
|
66
64
|
</div>
|
|
67
65
|
|
|
68
66
|
<style>
|
|
67
|
+
.header-button {
|
|
68
|
+
display: flex;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
71
|
+
border-radius: 50%;
|
|
72
|
+
background: white;
|
|
73
|
+
z-index: 40;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
border: none;
|
|
76
|
+
width: 40px;
|
|
77
|
+
height: 40px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.header-button:hover {
|
|
81
|
+
background: #e0e5e8;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.icon-span {
|
|
85
|
+
font-size: 32px;
|
|
86
|
+
color: #6b7180;
|
|
87
|
+
}
|
|
88
|
+
|
|
69
89
|
.header-container {
|
|
70
90
|
display: flex;
|
|
71
91
|
gap: 24px;
|
|
@@ -88,10 +108,4 @@
|
|
|
88
108
|
font-size: 24px;
|
|
89
109
|
font-weight: 600;
|
|
90
110
|
}
|
|
91
|
-
|
|
92
|
-
.header-btn {
|
|
93
|
-
border: none;
|
|
94
|
-
background: transparent;
|
|
95
|
-
color: #6b7180;
|
|
96
|
-
}
|
|
97
111
|
</style>
|
|
@@ -3,13 +3,11 @@ interface HeaderProps {
|
|
|
3
3
|
title?: string;
|
|
4
4
|
homeUrl?: string;
|
|
5
5
|
hideAccount?: boolean;
|
|
6
|
-
hideHelp?: boolean;
|
|
7
|
-
hideNotification?: boolean;
|
|
8
6
|
accountName?: string;
|
|
9
7
|
userName?: string;
|
|
10
8
|
profileUrl?: string;
|
|
11
9
|
hideLoader?: boolean;
|
|
12
|
-
menu?: Snippet
|
|
10
|
+
menu?: Snippet<[showMenu: boolean]>;
|
|
13
11
|
}
|
|
14
12
|
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|
|
15
13
|
type Header = ReturnType<typeof Header>;
|
package/dist/Menu/Menu.svelte
CHANGED
|
@@ -6,15 +6,14 @@
|
|
|
6
6
|
import type { MenuItem } from './SidebarState.svelte';
|
|
7
7
|
|
|
8
8
|
interface MenuProps {
|
|
9
|
-
disableMenuButton?: boolean;
|
|
10
9
|
menuItems: MenuItem[];
|
|
10
|
+
showMenu: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
let showMenu: boolean = $state(false);
|
|
14
13
|
let isMainMenu: boolean = $state(true);
|
|
15
14
|
let activeItem: string = $state('');
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
let { menuItems, showMenu }: MenuProps = $props();
|
|
18
17
|
|
|
19
18
|
$effect(() => {
|
|
20
19
|
if (showMenu) {
|
|
@@ -46,17 +45,6 @@
|
|
|
46
45
|
};
|
|
47
46
|
</script>
|
|
48
47
|
|
|
49
|
-
<button
|
|
50
|
-
type="button"
|
|
51
|
-
class="menu-button"
|
|
52
|
-
class:disabled-menu={disableMenuButton}
|
|
53
|
-
onclick={onHandleMenu}
|
|
54
|
-
disabled={disableMenuButton}
|
|
55
|
-
aria-label="menu button"
|
|
56
|
-
>
|
|
57
|
-
<span class="material-icons icon-span">menu</span>
|
|
58
|
-
</button>
|
|
59
|
-
|
|
60
48
|
{#if showMenu}
|
|
61
49
|
<button
|
|
62
50
|
class="menu-principal"
|
|
@@ -81,28 +69,6 @@
|
|
|
81
69
|
{/if}
|
|
82
70
|
|
|
83
71
|
<style>
|
|
84
|
-
.menu-button {
|
|
85
|
-
display: flex;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
align-items: center;
|
|
88
|
-
border-radius: 50%;
|
|
89
|
-
background: white;
|
|
90
|
-
z-index: 40;
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
border: none;
|
|
93
|
-
width: 40px;
|
|
94
|
-
height: 40px;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.menu-button:hover {
|
|
98
|
-
background: #e0e5e8;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.icon-span {
|
|
102
|
-
font-size: 32px;
|
|
103
|
-
color: #6b7180;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
72
|
.menu-principal {
|
|
107
73
|
position: fixed;
|
|
108
74
|
inset: 0;
|
|
@@ -138,11 +104,6 @@
|
|
|
138
104
|
overflow-x: hidden;
|
|
139
105
|
}
|
|
140
106
|
|
|
141
|
-
.disabled-menu {
|
|
142
|
-
cursor: not-allowed;
|
|
143
|
-
opacity: 0.5;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
107
|
@media (min-width: 768px) {
|
|
147
108
|
.menu-list {
|
|
148
109
|
min-width: 220px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MenuItem } from './SidebarState.svelte';
|
|
2
2
|
interface MenuProps {
|
|
3
|
-
disableMenuButton?: boolean;
|
|
4
3
|
menuItems: MenuItem[];
|
|
4
|
+
showMenu: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const Menu: import("svelte").Component<MenuProps, {}, "">;
|
|
7
7
|
type Menu = ReturnType<typeof Menu>;
|
package/dist/Modal/Modal.svelte
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
errorIcon,
|
|
14
14
|
onclose = () => {},
|
|
15
15
|
children,
|
|
16
|
-
footer
|
|
16
|
+
footer,
|
|
17
|
+
disablePadding
|
|
17
18
|
}: ModalProps = $props();
|
|
18
19
|
|
|
19
20
|
const onHandleClose = () => {
|
|
@@ -22,34 +23,37 @@
|
|
|
22
23
|
};
|
|
23
24
|
</script>
|
|
24
25
|
|
|
25
|
-
<div class="modal-
|
|
26
|
-
<div
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
<div class="modal-backdrop">
|
|
27
|
+
<div class="modal-container {width}">
|
|
28
|
+
<div
|
|
29
|
+
onclose={onHandleClose}
|
|
30
|
+
class="modal"
|
|
31
|
+
transition:scale={{
|
|
32
|
+
duration: 150,
|
|
33
|
+
start: 0.95
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<ModalHeader {title} {errorIcon} onclose={onHandleClose} />
|
|
37
|
+
<ModalContent content={children} {disablePadding} />
|
|
38
|
+
<ModalFooter {footer} onclose={onHandleClose} />
|
|
39
|
+
</div>
|
|
37
40
|
</div>
|
|
38
41
|
</div>
|
|
39
42
|
|
|
40
43
|
<style>
|
|
41
|
-
.modal-
|
|
44
|
+
.modal-backdrop {
|
|
42
45
|
display: flex;
|
|
43
46
|
position: fixed;
|
|
44
47
|
top: 0;
|
|
45
48
|
left: 0;
|
|
46
49
|
z-index: 1000;
|
|
50
|
+
justify-content: center;
|
|
47
51
|
width: 100%;
|
|
48
52
|
height: 100%;
|
|
49
53
|
background-color: #e0e5e880;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
.modal {
|
|
56
|
+
.modal-container {
|
|
53
57
|
width: var(--modal-width);
|
|
54
58
|
max-height: 90%;
|
|
55
59
|
border-radius: 16px;
|
|
@@ -62,36 +66,40 @@
|
|
|
62
66
|
0px 4px 5px 0px rgba(51, 56, 64, 0.14);
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
.modal
|
|
69
|
+
.modal {
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.modal-container.xs {
|
|
66
74
|
--modal-width: 500px;
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
.modal.md {
|
|
77
|
+
.modal-container.md {
|
|
70
78
|
--modal-width: 600px;
|
|
71
79
|
}
|
|
72
80
|
|
|
73
|
-
.modal.lg {
|
|
81
|
+
.modal-container.lg {
|
|
74
82
|
--modal-width: 800px;
|
|
75
83
|
}
|
|
76
84
|
|
|
77
|
-
.modal.xl {
|
|
85
|
+
.modal-container.xl {
|
|
78
86
|
--modal-width: 1000px;
|
|
79
87
|
}
|
|
80
88
|
|
|
81
|
-
.modal::-webkit-scrollbar {
|
|
89
|
+
.modal-container::-webkit-scrollbar {
|
|
82
90
|
width: 10px;
|
|
83
91
|
}
|
|
84
92
|
|
|
85
|
-
.modal::-webkit-scrollbar-thumb {
|
|
93
|
+
.modal-container::-webkit-scrollbar-thumb {
|
|
86
94
|
background: #888;
|
|
87
95
|
border-radius: 10px;
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
.modal::-webkit-scrollbar-thumb:hover {
|
|
98
|
+
.modal-container::-webkit-scrollbar-thumb:hover {
|
|
91
99
|
background: #555;
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
:global(html:has(.modal-
|
|
102
|
+
:global(html:has(.modal-backdrop)) {
|
|
95
103
|
overflow: hidden;
|
|
96
104
|
}
|
|
97
105
|
</style>
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
|
|
4
4
|
interface ModalContentProps {
|
|
5
5
|
content?: Snippet;
|
|
6
|
+
disablePadding?: boolean;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
let { content }: ModalContentProps = $props();
|
|
9
|
+
let { content, disablePadding = false }: ModalContentProps = $props();
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
|
-
<div class="modal-content">
|
|
12
|
+
<div class="modal-content" class:padding={!disablePadding}>
|
|
12
13
|
{@render content?.()}
|
|
13
14
|
</div>
|
|
14
15
|
|
|
15
16
|
<style>
|
|
16
17
|
.modal-content {
|
|
17
18
|
display: flex;
|
|
18
|
-
padding: 24px;
|
|
19
19
|
flex-direction: column;
|
|
20
20
|
align-items: flex-start;
|
|
21
21
|
gap: 24px;
|
|
@@ -23,4 +23,8 @@
|
|
|
23
23
|
background: #fff;
|
|
24
24
|
border-top: 1px solid #aeb1b9;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
.padding {
|
|
28
|
+
padding: 24px;
|
|
29
|
+
}
|
|
26
30
|
</style>
|