@softwareone/spi-sv5-library 0.1.3 → 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 +55 -133
- package/dist/Header/Header.svelte.d.ts +2 -1
- 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 +19 -34
- 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 +2 -1
- package/dist/Toggle/Toggle.svelte +0 -170
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import HeaderLogo from '
|
|
3
|
-
import HeaderAccount from './HeaderAccount.svelte';
|
|
4
|
-
import HeaderLoader from './HeaderLoader.svelte';
|
|
2
|
+
import { HeaderAccount, HeaderLoader, HeaderLogo, Menu, type MenuItem } from '../index.js';
|
|
5
3
|
|
|
6
4
|
interface HeaderProps {
|
|
7
5
|
title?: string;
|
|
8
6
|
homeUrl?: string;
|
|
9
7
|
disableMenuButton?: boolean;
|
|
10
|
-
menuButton?: () => void;
|
|
11
8
|
hideAccount?: boolean;
|
|
12
9
|
hideHelp?: boolean;
|
|
13
10
|
hideNotification?: boolean;
|
|
@@ -15,165 +12,90 @@
|
|
|
15
12
|
userName?: string;
|
|
16
13
|
profileUrl?: string;
|
|
17
14
|
hideLoader?: boolean;
|
|
15
|
+
menuItems: MenuItem[];
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
let {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
18
|
+
let {
|
|
19
|
+
title = 'Default Title',
|
|
20
|
+
homeUrl = '/',
|
|
21
|
+
disableMenuButton,
|
|
22
|
+
hideAccount,
|
|
23
|
+
hideHelp,
|
|
24
|
+
hideNotification,
|
|
25
|
+
accountName = 'Company Name',
|
|
26
|
+
userName = 'User Name',
|
|
27
|
+
profileUrl = '/profile',
|
|
28
|
+
hideLoader,
|
|
29
|
+
menuItems
|
|
30
|
+
}: HeaderProps = $props();
|
|
34
31
|
</script>
|
|
35
32
|
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</button>
|
|
50
|
-
</div>
|
|
51
|
-
<div class="header-logo">
|
|
52
|
-
<a href={homeUrl}>
|
|
53
|
-
<HeaderLogo />
|
|
54
|
-
</a>
|
|
55
|
-
</div>
|
|
56
|
-
<div class="header-title">
|
|
57
|
-
{title}
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="header-right">
|
|
61
|
-
{#if !hideHelp}
|
|
33
|
+
<header class="header">
|
|
34
|
+
<section class="header-section">
|
|
35
|
+
<Menu {menuItems} {disableMenuButton} />
|
|
36
|
+
<a href={homeUrl}>
|
|
37
|
+
<HeaderLogo />
|
|
38
|
+
</a>
|
|
39
|
+
<section class="header-title">
|
|
40
|
+
{title}
|
|
41
|
+
</section>
|
|
42
|
+
</section>
|
|
43
|
+
|
|
44
|
+
<section class="header-section">
|
|
45
|
+
{#if !hideHelp}
|
|
62
46
|
<button class="header-btn" aria-labelledby="help-button">
|
|
63
|
-
<
|
|
64
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
65
|
-
height="24px"
|
|
66
|
-
viewBox="0 -960 960 960"
|
|
67
|
-
width="24px"
|
|
68
|
-
fill="#6b7180"
|
|
69
|
-
><path
|
|
70
|
-
d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"
|
|
71
|
-
/></svg
|
|
72
|
-
>
|
|
47
|
+
<span class="material-icons-outlined icon-span"> help_outline </span>
|
|
73
48
|
</button>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<button class="header-btn" aria-labelledby="
|
|
77
|
-
<
|
|
78
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
79
|
-
height="24px"
|
|
80
|
-
viewBox="0 -960 960 960"
|
|
81
|
-
width="24px"
|
|
82
|
-
fill="#6b7180"
|
|
83
|
-
><path
|
|
84
|
-
d="M160-200v-80h80v-280q0-83 50-147.5T420-792v-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820v28q80 20 130 84.5T720-560v280h80v80H160Zm320-300Zm0 420q-33 0-56.5-23.5T400-160h160q0 33-23.5 56.5T480-80ZM320-280h320v-280q0-66-47-113t-113-47q-66 0-113 47t-47 113v280Z"
|
|
85
|
-
/></svg
|
|
86
|
-
>
|
|
49
|
+
{/if}
|
|
50
|
+
{#if !hideNotification}
|
|
51
|
+
<button class="header-btn" aria-labelledby="notifications-button">
|
|
52
|
+
<span class="material-icons-outlined icon-span"> notifications </span>
|
|
87
53
|
</button>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
54
|
+
{/if}
|
|
55
|
+
{#if !hideAccount}
|
|
56
|
+
<a href={profileUrl}>
|
|
57
|
+
<HeaderAccount {accountName} {userName} />
|
|
58
|
+
</a>
|
|
59
|
+
{/if}
|
|
60
|
+
</section>
|
|
61
|
+
</header>
|
|
99
62
|
|
|
100
63
|
{#if !hideLoader}
|
|
101
64
|
<HeaderLoader />
|
|
102
65
|
{/if}
|
|
103
66
|
|
|
104
67
|
<style>
|
|
105
|
-
.header-container {
|
|
106
|
-
display: flex;
|
|
107
|
-
width: auto;
|
|
108
|
-
align-items: flex-start;
|
|
109
|
-
flex: 1 0 0;
|
|
110
|
-
}
|
|
111
68
|
.header {
|
|
112
69
|
display: flex;
|
|
113
|
-
height: 80px;
|
|
114
|
-
padding: 0px 24px;
|
|
115
70
|
justify-content: space-between;
|
|
116
71
|
align-items: center;
|
|
117
|
-
|
|
118
|
-
border-bottom: 3px solid #aeb1b9;
|
|
119
|
-
background: #fff;
|
|
120
|
-
}
|
|
121
|
-
.header-left {
|
|
122
|
-
display: flex;
|
|
123
|
-
height: 41px;
|
|
124
|
-
align-items: center;
|
|
125
|
-
gap: 32px;
|
|
126
|
-
}
|
|
127
|
-
.header-right {
|
|
128
|
-
display: flex;
|
|
129
|
-
max-width: 350px;
|
|
130
|
-
padding: 8px 24px;
|
|
131
|
-
align-items: center;
|
|
132
|
-
gap: 16px;
|
|
133
|
-
border-radius: 8px;
|
|
72
|
+
padding: 0px 24px;
|
|
134
73
|
background: #fff;
|
|
135
|
-
|
|
74
|
+
height: 80px;
|
|
75
|
+
border-bottom: 3px solid #aeb1b9;
|
|
136
76
|
}
|
|
137
|
-
|
|
77
|
+
|
|
78
|
+
.header-section {
|
|
138
79
|
display: flex;
|
|
139
|
-
justify-content: center;
|
|
140
80
|
align-items: center;
|
|
141
|
-
gap:
|
|
142
|
-
border: none;
|
|
143
|
-
background-color: transparent;
|
|
144
|
-
color: #6b7180;
|
|
145
|
-
}
|
|
146
|
-
.header-logo {
|
|
147
|
-
width: 65px;
|
|
148
|
-
height: 22.941px;
|
|
149
|
-
flex-shrink: 0;
|
|
150
|
-
fill: #000;
|
|
81
|
+
gap: 1.5rem;
|
|
151
82
|
}
|
|
83
|
+
|
|
152
84
|
.header-title {
|
|
153
85
|
color: #000;
|
|
154
|
-
|
|
155
|
-
/* medium/6 */
|
|
156
|
-
font-family: 'Haas Grotesk Display Pro', sans-serif;
|
|
157
86
|
font-size: 24px;
|
|
158
|
-
font-style: normal;
|
|
159
|
-
font-weight: 500;
|
|
160
|
-
line-height: normal;
|
|
161
87
|
}
|
|
88
|
+
|
|
162
89
|
.header-btn {
|
|
163
|
-
text-align: left;
|
|
164
90
|
border: none;
|
|
165
91
|
background: transparent;
|
|
166
|
-
color: #6b7180;
|
|
167
|
-
text-decoration: none;
|
|
168
|
-
}
|
|
169
|
-
.header-btn:hover {
|
|
170
|
-
cursor: pointer;
|
|
171
92
|
}
|
|
172
93
|
|
|
173
|
-
.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
94
|
+
.icon-span {
|
|
95
|
+
color: #6b7180;
|
|
96
|
+
font-size: 24px;
|
|
97
|
+
font-weight: 400;
|
|
98
|
+
line-height: 20px;
|
|
99
|
+
word-wrap: break-word;
|
|
178
100
|
}
|
|
179
101
|
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { type MenuItem } from '../index.js';
|
|
1
2
|
interface HeaderProps {
|
|
2
3
|
title?: string;
|
|
3
4
|
homeUrl?: string;
|
|
4
5
|
disableMenuButton?: boolean;
|
|
5
|
-
menuButton?: () => void;
|
|
6
6
|
hideAccount?: boolean;
|
|
7
7
|
hideHelp?: boolean;
|
|
8
8
|
hideNotification?: boolean;
|
|
@@ -10,6 +10,7 @@ interface HeaderProps {
|
|
|
10
10
|
userName?: string;
|
|
11
11
|
profileUrl?: string;
|
|
12
12
|
hideLoader?: boolean;
|
|
13
|
+
menuItems: MenuItem[];
|
|
13
14
|
}
|
|
14
15
|
declare const Header: import("svelte").Component<HeaderProps, {}, "">;
|
|
15
16
|
type Header = ReturnType<typeof Header>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { Avatar } from '../index.js';
|
|
3
|
+
|
|
2
4
|
interface HeaderAccountProps {
|
|
3
5
|
accountName?: string;
|
|
4
6
|
userName?: string;
|
|
@@ -8,27 +10,11 @@
|
|
|
8
10
|
|
|
9
11
|
accountName = accountName || 'SoftwareOne';
|
|
10
12
|
userName = userName || 'John Doe';
|
|
11
|
-
|
|
12
|
-
let avatarName = $state(
|
|
13
|
-
userName
|
|
14
|
-
.split(' ')
|
|
15
|
-
.map((word) => word[0])
|
|
16
|
-
.join('')
|
|
17
|
-
);
|
|
18
13
|
</script>
|
|
19
14
|
|
|
20
15
|
<div class="account-container">
|
|
21
16
|
<div class="account-avatar">
|
|
22
|
-
<
|
|
23
|
-
><circle cx="20" cy="20" r="20" fill="#25282D"></circle><text
|
|
24
|
-
x="20"
|
|
25
|
-
y="25"
|
|
26
|
-
text-anchor="middle"
|
|
27
|
-
font-size="14"
|
|
28
|
-
font-weight="normal"
|
|
29
|
-
fill="#FFFFFF">{avatarName}</text
|
|
30
|
-
></svg
|
|
31
|
-
>
|
|
17
|
+
<Avatar text={userName} />
|
|
32
18
|
</div>
|
|
33
19
|
<div class="account">
|
|
34
20
|
<div class="account-name">{accountName}</div>
|
|
@@ -42,7 +28,6 @@
|
|
|
42
28
|
.account-container {
|
|
43
29
|
display: flex;
|
|
44
30
|
max-width: 300px;
|
|
45
|
-
/* padding: 8px 24px; */
|
|
46
31
|
align-items: center;
|
|
47
32
|
gap: 16px;
|
|
48
33
|
border-radius: 8px;
|
|
@@ -52,10 +37,8 @@
|
|
|
52
37
|
display: flex;
|
|
53
38
|
width: 48px;
|
|
54
39
|
height: 48px;
|
|
55
|
-
/* padding: 15px 0px 15.194px 0px; */
|
|
56
40
|
justify-content: center;
|
|
57
41
|
align-items: center;
|
|
58
|
-
font-family: 'Haas Grotesk Display Pro', sans-serif;
|
|
59
42
|
}
|
|
60
43
|
.account {
|
|
61
44
|
display: flex;
|
|
@@ -70,15 +53,12 @@
|
|
|
70
53
|
width: auto;
|
|
71
54
|
max-width: auto;
|
|
72
55
|
overflow: hidden;
|
|
73
|
-
color:
|
|
56
|
+
color: #000;
|
|
74
57
|
text-overflow: ellipsis;
|
|
75
|
-
|
|
76
|
-
/* medium/2 */
|
|
77
|
-
font-family: 'Haas Grotesk Display Pro', sans-serif;
|
|
78
58
|
font-size: 14px;
|
|
79
59
|
font-style: normal;
|
|
80
60
|
font-weight: 500;
|
|
81
|
-
line-height: 20px;
|
|
61
|
+
line-height: 20px;
|
|
82
62
|
}
|
|
83
63
|
.account-more {
|
|
84
64
|
display: flex;
|
|
@@ -93,11 +73,8 @@
|
|
|
93
73
|
-webkit-line-clamp: 1;
|
|
94
74
|
line-clamp: 1;
|
|
95
75
|
overflow: hidden;
|
|
96
|
-
color:
|
|
76
|
+
color: #6b7180;
|
|
97
77
|
text-overflow: ellipsis;
|
|
98
|
-
|
|
99
|
-
/* regular/1 */
|
|
100
|
-
font-family: 'Haas Grotesk Display Pro', sans-serif;
|
|
101
78
|
font-size: 12px;
|
|
102
79
|
font-style: normal;
|
|
103
80
|
font-weight: 400;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
import { Avatar, Chips, ColumnType, ImageType, type HighlightPanelColumn } from '../index.js';
|
|
5
|
+
|
|
6
|
+
interface HighlightPanelProps {
|
|
7
|
+
columns: HighlightPanelColumn[];
|
|
8
|
+
buttonSection?: Snippet;
|
|
9
|
+
distributionType?: 'flex' | 'flex-column' | 'grid';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { columns, distributionType = 'flex', buttonSection }: HighlightPanelProps = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="highlight-panel">
|
|
16
|
+
<section class="panel-section-{distributionType}">
|
|
17
|
+
{#each columns as column}
|
|
18
|
+
<div class="panel-element">
|
|
19
|
+
{#if column.type === ColumnType.Text}
|
|
20
|
+
<h2>{column.label}</h2>
|
|
21
|
+
<p>{column.value}</p>
|
|
22
|
+
<p class="text-description">{column.description ?? ''}</p>
|
|
23
|
+
{/if}
|
|
24
|
+
|
|
25
|
+
{#if column.type === ColumnType.Status}
|
|
26
|
+
<h2>{column.label}</h2>
|
|
27
|
+
<Chips text={column.value} type={column.chipType} />
|
|
28
|
+
{/if}
|
|
29
|
+
|
|
30
|
+
{#if column.type === ColumnType.Link}
|
|
31
|
+
<h2>{column.label}</h2>
|
|
32
|
+
<a rel="noreferrer" class="link" target="_blank" href={column.url}>
|
|
33
|
+
{column.value}
|
|
34
|
+
</a>
|
|
35
|
+
{/if}
|
|
36
|
+
|
|
37
|
+
{#if column.type === ColumnType.Image}
|
|
38
|
+
{@const { content, iconType } = column}
|
|
39
|
+
<h2>{column.label}</h2>
|
|
40
|
+
{#if iconType === ImageType.Default}
|
|
41
|
+
<img src={content} alt="icon" />
|
|
42
|
+
{:else if iconType === ImageType.Avatar}
|
|
43
|
+
<Avatar text={content} />
|
|
44
|
+
{:else if iconType === ImageType.Material}
|
|
45
|
+
<span class="material-icons">{content}</span>
|
|
46
|
+
{/if}
|
|
47
|
+
<p class="text-description">{column.description ?? ''}</p>
|
|
48
|
+
{/if}
|
|
49
|
+
</div>
|
|
50
|
+
{/each}
|
|
51
|
+
</section>
|
|
52
|
+
|
|
53
|
+
{#if buttonSection}
|
|
54
|
+
<section class="buttons-section">
|
|
55
|
+
{@render buttonSection()}
|
|
56
|
+
</section>
|
|
57
|
+
{/if}
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<style>
|
|
61
|
+
h2,
|
|
62
|
+
p,
|
|
63
|
+
a {
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.text-description {
|
|
69
|
+
color: #6b7180;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.link {
|
|
73
|
+
color: #472aff;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.link:hover {
|
|
77
|
+
text-decoration-line: underline;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.highlight-panel {
|
|
81
|
+
display: grid;
|
|
82
|
+
grid-template-columns: 1fr auto;
|
|
83
|
+
gap: 48px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.panel-section-flex {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-wrap: wrap;
|
|
89
|
+
gap: 48px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.panel-section-flex-column {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 48px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.panel-section-grid {
|
|
99
|
+
display: grid;
|
|
100
|
+
grid-template-columns: repeat(auto-fit, minmax(50px, auto));
|
|
101
|
+
grid-gap: 48px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.buttons-section {
|
|
105
|
+
display: flex;
|
|
106
|
+
gap: 12px;
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.panel-element h2 {
|
|
111
|
+
margin-bottom: 8px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.panel-element img {
|
|
115
|
+
width: 40px;
|
|
116
|
+
height: 40px;
|
|
117
|
+
border-radius: 9999px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media screen and (max-width: 700px) {
|
|
121
|
+
.buttons-section {
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type HighlightPanelColumn } from '../index.js';
|
|
3
|
+
interface HighlightPanelProps {
|
|
4
|
+
columns: HighlightPanelColumn[];
|
|
5
|
+
buttonSection?: Snippet;
|
|
6
|
+
distributionType?: 'flex' | 'flex-column' | 'grid';
|
|
7
|
+
}
|
|
8
|
+
declare const HighlightPanel: import("svelte").Component<HighlightPanelProps, {}, "">;
|
|
9
|
+
type HighlightPanel = ReturnType<typeof HighlightPanel>;
|
|
10
|
+
export default HighlightPanel;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ChipType } from '../index.js';
|
|
2
|
+
export declare enum ImageType {
|
|
3
|
+
Default = "image",
|
|
4
|
+
Avatar = "avatar",
|
|
5
|
+
Material = "material"
|
|
6
|
+
}
|
|
7
|
+
export declare enum ColumnType {
|
|
8
|
+
Text = "text",
|
|
9
|
+
Link = "link",
|
|
10
|
+
Image = "image",
|
|
11
|
+
Status = "status"
|
|
12
|
+
}
|
|
13
|
+
type BaseColumn = {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
};
|
|
18
|
+
type Text = BaseColumn & {
|
|
19
|
+
type: ColumnType.Text;
|
|
20
|
+
};
|
|
21
|
+
type Link = BaseColumn & {
|
|
22
|
+
type: ColumnType.Link;
|
|
23
|
+
url: string;
|
|
24
|
+
};
|
|
25
|
+
type Icon = BaseColumn & {
|
|
26
|
+
type: ColumnType.Image;
|
|
27
|
+
iconType: ImageType;
|
|
28
|
+
content: string;
|
|
29
|
+
};
|
|
30
|
+
type Status = BaseColumn & {
|
|
31
|
+
type: ColumnType.Status;
|
|
32
|
+
chipType: ChipType;
|
|
33
|
+
};
|
|
34
|
+
export type HighlightPanelColumn = Text | Link | Icon | Status;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var ImageType;
|
|
2
|
+
(function (ImageType) {
|
|
3
|
+
ImageType["Default"] = "image";
|
|
4
|
+
ImageType["Avatar"] = "avatar";
|
|
5
|
+
ImageType["Material"] = "material";
|
|
6
|
+
})(ImageType || (ImageType = {}));
|
|
7
|
+
export var ColumnType;
|
|
8
|
+
(function (ColumnType) {
|
|
9
|
+
ColumnType["Text"] = "text";
|
|
10
|
+
ColumnType["Link"] = "link";
|
|
11
|
+
ColumnType["Image"] = "image";
|
|
12
|
+
ColumnType["Status"] = "status";
|
|
13
|
+
})(ColumnType || (ColumnType = {}));
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { goto } from '$app/navigation';
|
|
3
|
+
import { page } from '$app/state';
|
|
4
|
+
|
|
5
|
+
import type { MenuItem } from './SidebarState.svelte';
|
|
6
|
+
import MainMenuItem from './MenuItem.svelte';
|
|
7
|
+
|
|
8
|
+
interface MenuProps {
|
|
9
|
+
disableMenuButton?: boolean;
|
|
10
|
+
menuItems: MenuItem[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let showMenu: boolean = $state(false);
|
|
14
|
+
let isMainMenu: boolean = $state(true);
|
|
15
|
+
let activeItem: string = $state('');
|
|
16
|
+
|
|
17
|
+
const { disableMenuButton = false, menuItems }: MenuProps = $props();
|
|
18
|
+
|
|
19
|
+
$effect(() => {
|
|
20
|
+
if (showMenu) {
|
|
21
|
+
setActiveMenuItem();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const setActiveMenuItem = () => {
|
|
26
|
+
activeItem = menuItems.find((menuItem: MenuItem) => isActiveMenuItem(menuItem.url))?.text || '';
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const isActiveMenuItem = (url: string) => {
|
|
30
|
+
const firstSegmentUrl = page.url.pathname.split('/')[1];
|
|
31
|
+
return existRoute(`/${firstSegmentUrl}`, url);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const existRoute = (url: string, pathname: string) => {
|
|
35
|
+
const regex = new RegExp(`${url}(?![\\w-])`);
|
|
36
|
+
return regex.test(pathname);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const onClickMenuItem = (menuItem: MenuItem) => {
|
|
40
|
+
onHandleMenu();
|
|
41
|
+
goto(String(menuItem.url));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onHandleMenu = () => {
|
|
45
|
+
showMenu = !showMenu;
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
48
|
+
|
|
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
|
+
{#if showMenu}
|
|
61
|
+
<button
|
|
62
|
+
class="menu-principal"
|
|
63
|
+
onclick={onHandleMenu}
|
|
64
|
+
onkeypress={onHandleMenu}
|
|
65
|
+
aria-label="menu principal"
|
|
66
|
+
></button>
|
|
67
|
+
|
|
68
|
+
<nav class="menu-nav">
|
|
69
|
+
<menu class="menu-list">
|
|
70
|
+
{#each menuItems as menuItem}
|
|
71
|
+
<MainMenuItem
|
|
72
|
+
item={menuItem}
|
|
73
|
+
isCollapsed={false}
|
|
74
|
+
activeItem={activeItem === menuItem.text}
|
|
75
|
+
{isMainMenu}
|
|
76
|
+
onClick={onClickMenuItem}
|
|
77
|
+
/>
|
|
78
|
+
{/each}
|
|
79
|
+
</menu>
|
|
80
|
+
</nav>
|
|
81
|
+
{/if}
|
|
82
|
+
|
|
83
|
+
<style>
|
|
84
|
+
.menu-button {
|
|
85
|
+
border-radius: 0.375rem;
|
|
86
|
+
background: white;
|
|
87
|
+
z-index: 40;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
border: none;
|
|
90
|
+
width: 40px;
|
|
91
|
+
height: 40px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.icon-span {
|
|
95
|
+
color: #25282d;
|
|
96
|
+
font-size: 24px;
|
|
97
|
+
font-weight: 400;
|
|
98
|
+
line-height: 20px;
|
|
99
|
+
word-wrap: break-word;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.menu-button:hover {
|
|
103
|
+
background-color: #f3f4f6;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.menu-principal {
|
|
107
|
+
position: fixed;
|
|
108
|
+
inset: 0;
|
|
109
|
+
background-color: rgba(243, 244, 246, 0.5);
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
z-index: 30;
|
|
112
|
+
border: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.menu-nav {
|
|
116
|
+
position: absolute;
|
|
117
|
+
top: 80px;
|
|
118
|
+
left: 24px;
|
|
119
|
+
bottom: 24px;
|
|
120
|
+
display: flex;
|
|
121
|
+
border: 1px solid #f3f4f6;
|
|
122
|
+
border-bottom-left-radius: 10px;
|
|
123
|
+
border-bottom-right-radius: 10px;
|
|
124
|
+
background-color: white;
|
|
125
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
126
|
+
min-height: calc(100vh - 80px - 55px);
|
|
127
|
+
z-index: 40;
|
|
128
|
+
width: auto;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.menu-list {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
gap: 0.25rem;
|
|
135
|
+
padding: 0.7rem;
|
|
136
|
+
width: 150px;
|
|
137
|
+
overflow-y: auto;
|
|
138
|
+
overflow-x: hidden;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.disabled-menu {
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
opacity: 0.5;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (min-width: 768px) {
|
|
147
|
+
.menu-list {
|
|
148
|
+
min-width: 220px;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (min-width: 100px) and (max-width: 767px) {
|
|
153
|
+
.menu-list {
|
|
154
|
+
width: auto;
|
|
155
|
+
min-width: none;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MenuItem } from './SidebarState.svelte';
|
|
2
|
+
interface MenuProps {
|
|
3
|
+
disableMenuButton?: boolean;
|
|
4
|
+
menuItems: MenuItem[];
|
|
5
|
+
}
|
|
6
|
+
declare const Menu: import("svelte").Component<MenuProps, {}, "">;
|
|
7
|
+
type Menu = ReturnType<typeof Menu>;
|
|
8
|
+
export default Menu;
|