@likable-hair/svelte 2.0.8 → 3.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/components/composed/search/GlobalSearchTextField.css +11 -0
- package/dist/components/composed/search/GlobalSearchTextField.svelte +52 -30
- package/dist/components/composed/search/GlobalSearchTextField.svelte.d.ts +6 -9
- package/dist/components/composed/search/SearchBar.css +10 -0
- package/dist/components/composed/search/SearchBar.svelte +43 -20
- package/dist/components/composed/search/SearchBar.svelte.d.ts +6 -9
- package/dist/components/composed/search/SearchResults.css +5 -0
- package/dist/components/composed/search/SearchResults.svelte +45 -23
- package/dist/components/composed/search/SearchResults.svelte.d.ts +7 -8
- package/dist/components/layouts/CollapsibleSideBarLayout.css +5 -0
- package/dist/components/layouts/CollapsibleSideBarLayout.svelte +6 -7
- package/dist/components/layouts/NewCollapsibleSideBarLayout.svelte +155 -0
- package/dist/components/layouts/NewCollapsibleSideBarLayout.svelte.d.ts +38 -0
- package/dist/components/layouts/StableDividedSideBarLayout.css +16 -0
- package/dist/components/layouts/StableDividedSideBarLayout.svelte +81 -31
- package/dist/components/layouts/StableDividedSideBarLayout.svelte.d.ts +7 -10
- package/dist/components/simple/buttons/Button.css +18 -0
- package/dist/components/simple/buttons/Button.svelte +150 -50
- package/dist/components/simple/buttons/Button.svelte.d.ts +5 -25
- package/dist/components/simple/buttons/LinkButton.css +13 -0
- package/dist/components/simple/buttons/LinkButton.svelte +48 -25
- package/dist/components/simple/buttons/LinkButton.svelte.d.ts +2 -11
- package/dist/components/simple/common/CollapsibleDivider.css +14 -0
- package/dist/components/simple/common/CollapsibleDivider.svelte +81 -25
- package/dist/components/simple/common/CollapsibleDivider.svelte.d.ts +1 -11
- package/dist/components/simple/common/Menu.svelte +32 -2
- package/dist/components/simple/common/Menu.svelte.d.ts +1 -0
- package/dist/components/simple/dates/Calendar.css +10 -0
- package/dist/components/simple/dates/Calendar.svelte +52 -17
- package/dist/components/simple/dates/Calendar.svelte.d.ts +7 -10
- package/dist/components/simple/dates/DatePicker.css +9 -0
- package/dist/components/simple/dates/DatePicker.svelte +74 -55
- package/dist/components/simple/dates/DatePicker.svelte.d.ts +15 -11
- package/dist/components/simple/dates/DatePickerTextField.svelte +148 -0
- package/dist/components/simple/dates/DatePickerTextField.svelte.d.ts +28 -0
- package/dist/components/simple/dates/MonthSelector.css +4 -0
- package/dist/components/simple/dates/MonthSelector.svelte +20 -9
- package/dist/components/simple/dates/MonthSelector.svelte.d.ts +5 -4
- package/dist/components/simple/dates/YearSelector.css +4 -0
- package/dist/components/simple/dates/YearSelector.svelte +23 -10
- package/dist/components/simple/dates/YearSelector.svelte.d.ts +3 -2
- package/dist/components/simple/forms/Autocomplete.css +12 -0
- package/dist/components/simple/forms/Autocomplete.svelte +101 -50
- package/dist/components/simple/forms/Autocomplete.svelte.d.ts +7 -29
- package/dist/components/simple/forms/SimpleTextField.css +17 -0
- package/dist/components/simple/forms/SimpleTextField.svelte +110 -44
- package/dist/components/simple/forms/SimpleTextField.svelte.d.ts +13 -22
- package/dist/components/simple/lists/SelectableMenuList.css +7 -0
- package/dist/components/simple/lists/SelectableMenuList.svelte +107 -0
- package/dist/components/simple/lists/SelectableMenuList.svelte.d.ts +38 -0
- package/dist/components/simple/lists/SelectableVerticalList.svelte +1 -1
- package/dist/components/simple/lists/SidebarMenuList.css +7 -0
- package/dist/components/simple/lists/SidebarMenuList.svelte +43 -15
- package/dist/components/simple/lists/SidebarMenuList.svelte.d.ts +1 -0
- package/dist/components/simple/loaders/CircularLoader.css +5 -0
- package/dist/components/simple/loaders/CircularLoader.svelte +20 -4
- package/dist/components/simple/loaders/CircularLoader.svelte.d.ts +2 -3
- package/dist/components/simple/media/Icon.svelte +18 -7
- package/dist/components/simple/media/Icon.svelte.d.ts +0 -2
- package/dist/components/simple/navigation/Chip.css +14 -0
- package/dist/components/simple/navigation/Chip.svelte +74 -15
- package/dist/components/simple/navigation/Chip.svelte.d.ts +2 -3
- package/dist/components/simple/navigation/Drawer.css +9 -0
- package/dist/components/simple/navigation/Drawer.svelte +81 -74
- package/dist/components/simple/navigation/Drawer.svelte.d.ts +1 -8
- package/dist/components/simple/navigation/HeaderMenu.css +3 -0
- package/dist/components/simple/navigation/HeaderMenu.svelte +39 -63
- package/dist/components/simple/navigation/HeaderMenu.svelte.d.ts +5 -9
- package/dist/components/simple/notifiers/AlertBanner.css +9 -0
- package/dist/components/simple/notifiers/AlertBanner.svelte +21 -22
- package/dist/components/simple/notifiers/AlertBanner.svelte.d.ts +6 -9
- package/dist/components/simple/timeline/SimpleTimeLine.svelte.d.ts +1 -1
- package/dist/components/simple/typography/Code.svelte.d.ts +1 -1
- package/dist/css/main.css +261 -0
- package/dist/stores/theme.d.ts +30 -0
- package/dist/stores/theme.js +85 -0
- package/package.json +6 -3
- package/dist/components/simple/buttons/DefaultButton.svelte +0 -93
- package/dist/components/simple/buttons/DefaultButton.svelte.d.ts +0 -50
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import "./SelectableMenuList.css";
|
|
4
|
+
import Icon from "../media/Icon.svelte";
|
|
5
|
+
import { createEventDispatcher } from "svelte";
|
|
6
|
+
let dispatch = createEventDispatcher();
|
|
7
|
+
export let collapsed = false, items = [], selected = void 0;
|
|
8
|
+
function handleItemClick(item) {
|
|
9
|
+
if (item.disabled)
|
|
10
|
+
return;
|
|
11
|
+
selected = item.name;
|
|
12
|
+
dispatch("select", {
|
|
13
|
+
item
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
class="menu-container"
|
|
20
|
+
class:collapsed={collapsed}
|
|
21
|
+
>
|
|
22
|
+
<ul>
|
|
23
|
+
{#each items as item}
|
|
24
|
+
{#if !item.divider }
|
|
25
|
+
<li
|
|
26
|
+
class="menu-row"
|
|
27
|
+
aria-label={item.label}
|
|
28
|
+
class:selected={!!selected && item.name === selected}
|
|
29
|
+
class:disabled={item.disabled}
|
|
30
|
+
on:click={() => { if(!item.divider) handleItemClick(item) }}
|
|
31
|
+
on:keypress={() => { if(!item.divider) handleItemClick(item) }}
|
|
32
|
+
>
|
|
33
|
+
<div class="menu-icon">
|
|
34
|
+
<Icon
|
|
35
|
+
name={item.icon}
|
|
36
|
+
--icon-default-size="1.5rem"
|
|
37
|
+
></Icon>
|
|
38
|
+
</div>
|
|
39
|
+
{#if !collapsed}
|
|
40
|
+
<div class="menu-name">{item.label}</div>
|
|
41
|
+
{/if}
|
|
42
|
+
</li>
|
|
43
|
+
{:else}
|
|
44
|
+
<div
|
|
45
|
+
style:margin-top={item.marginTop}
|
|
46
|
+
style:margin-bottom={item.marginBottom}
|
|
47
|
+
style:margin-right={item.marginRight}
|
|
48
|
+
style:margin-left={item.marginLeft}
|
|
49
|
+
class="divider"
|
|
50
|
+
></div>
|
|
51
|
+
{/if}
|
|
52
|
+
{/each}
|
|
53
|
+
</ul>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
ul {
|
|
58
|
+
list-style: none;
|
|
59
|
+
padding-left: 0rem;
|
|
60
|
+
position: relative;
|
|
61
|
+
line-height: 1rem;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
gap: var(
|
|
66
|
+
--selectable-menu-list-spacing,
|
|
67
|
+
var(--selectable-menu-list-default-spacing)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.menu-row {
|
|
72
|
+
display: flex;
|
|
73
|
+
gap: var(
|
|
74
|
+
--selectable-menu-list-icon-gap,
|
|
75
|
+
var(--selectable-menu-list-default-icon-gap)
|
|
76
|
+
);
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
padding-left: .8rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.menu-name {
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.menu-row.disabled {
|
|
86
|
+
opacity: 50%;
|
|
87
|
+
cursor: not-allowed;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.menu-row.selected {
|
|
91
|
+
color: var(
|
|
92
|
+
--selectable-menu-list-selected-color,
|
|
93
|
+
var(--selectable-menu-list-default-selected-color)
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.divider {
|
|
98
|
+
height: var(
|
|
99
|
+
--selectable-menu-list-divider-height,
|
|
100
|
+
var(--selectable-menu-list-default-divider-height)
|
|
101
|
+
);
|
|
102
|
+
background-color: var(
|
|
103
|
+
--selectable-menu-list-divider-background-color,
|
|
104
|
+
var(--selectable-menu-list-default-divider-background-color)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
type Divider = {
|
|
3
|
+
divider: true;
|
|
4
|
+
marginTop?: string;
|
|
5
|
+
marginBottom?: string;
|
|
6
|
+
marginRight?: string;
|
|
7
|
+
marginLeft?: string;
|
|
8
|
+
};
|
|
9
|
+
type Item = {
|
|
10
|
+
name: string | number;
|
|
11
|
+
label: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
divider?: undefined | false;
|
|
15
|
+
};
|
|
16
|
+
export type MenuItem = Divider | Item;
|
|
17
|
+
import './SelectableMenuList.css';
|
|
18
|
+
declare const __propDef: {
|
|
19
|
+
props: {
|
|
20
|
+
collapsed?: boolean | undefined;
|
|
21
|
+
items?: MenuItem[] | undefined;
|
|
22
|
+
selected?: string | number | undefined;
|
|
23
|
+
};
|
|
24
|
+
events: {
|
|
25
|
+
select: CustomEvent<{
|
|
26
|
+
item: Item;
|
|
27
|
+
}>;
|
|
28
|
+
} & {
|
|
29
|
+
[evt: string]: CustomEvent<any>;
|
|
30
|
+
};
|
|
31
|
+
slots: {};
|
|
32
|
+
};
|
|
33
|
+
export type SelectableMenuListProps = typeof __propDef.props;
|
|
34
|
+
export type SelectableMenuListEvents = typeof __propDef.events;
|
|
35
|
+
export type SelectableMenuListSlots = typeof __propDef.slots;
|
|
36
|
+
export default class SelectableMenuList extends SvelteComponentTyped<SelectableMenuListProps, SelectableMenuListEvents, SelectableMenuListSlots> {
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<script>import keyboarder from "../../../utils/keyboarder";
|
|
4
4
|
import { createEventDispatcher, onMount } from "svelte";
|
|
5
|
-
export let elementPadding = ".75rem 1rem .75rem 1rem", elementCursor = "pointer", width = void 0, maxWidth = void 0, height = void 0, maxHeight = void 0, selectionBackgrounColor = "rgb(
|
|
5
|
+
export let elementPadding = ".75rem 1rem .75rem 1rem", elementCursor = "pointer", width = void 0, maxWidth = void 0, height = void 0, maxHeight = void 0, selectionBackgrounColor = "rgb(var(--global-color-background-300))", selectionColor = "inherit", activeKeyboard = false, loopSelection = true, selected = void 0, elements = [];
|
|
6
6
|
let dispatch = createEventDispatcher();
|
|
7
7
|
$:
|
|
8
8
|
selectedIndex = elements.findIndex((el) => el.name == selected);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--sidebar-menu-list-default-primary-color: rgb(var(--global-color-primary-500));
|
|
3
|
+
--sidebar-menu-list-default-selected-text-color: rgb(var(--global-color-primary-500));
|
|
4
|
+
--sidebar-menu-list-default-selected-font-weight: 600;
|
|
5
|
+
--sidebar-menu-list-default-color: inherit;
|
|
6
|
+
--sidebar-menu-list-default-hover-color: inherit;
|
|
7
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
|
-
<script>import
|
|
3
|
+
<script>import "./SidebarMenuList.css";
|
|
4
|
+
import { page } from "$app/stores";
|
|
4
5
|
export let menus, level = 0, selected = void 0, bookmarkColor = "black", color = "inherit", hoverColor = "inherit", selectedTextColor = "inherit", selectedFontWeight = "600", autoDetectUrl = false;
|
|
5
6
|
let selectedIndex = void 0;
|
|
6
7
|
page.subscribe(() => {
|
|
7
8
|
if (autoDetectUrl) {
|
|
8
|
-
|
|
9
|
+
const results = getMenuNameMatchingUrl({ menus });
|
|
10
|
+
selected = results.name;
|
|
9
11
|
}
|
|
10
12
|
});
|
|
11
13
|
$:
|
|
@@ -48,18 +50,29 @@ function getSelectionIndex(params) {
|
|
|
48
50
|
return { found: false, offset: initialOffset };
|
|
49
51
|
}
|
|
50
52
|
function getMenuNameMatchingUrl(params) {
|
|
53
|
+
let foundName = void 0;
|
|
54
|
+
let foundMatchType = void 0;
|
|
51
55
|
for (let i = 0; i < params.menus.length; i += 1) {
|
|
52
56
|
let currentMenu = params.menus[i];
|
|
53
57
|
if (!!currentMenu.children) {
|
|
54
|
-
let
|
|
55
|
-
if (
|
|
56
|
-
|
|
58
|
+
let found = getMenuNameMatchingUrl({ menus: currentMenu.children });
|
|
59
|
+
if (found.name !== void 0) {
|
|
60
|
+
foundName = found.name;
|
|
61
|
+
foundMatchType = found.matchType;
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
|
-
if (!!currentMenu.url && $page.url.pathname
|
|
59
|
-
|
|
64
|
+
if (!!currentMenu.url && $page.url.pathname === currentMenu.url) {
|
|
65
|
+
foundName = currentMenu.name;
|
|
66
|
+
foundMatchType = "equal";
|
|
67
|
+
} else if (foundMatchType !== "equal" && !!currentMenu.url && $page.url.pathname.startsWith(currentMenu.url)) {
|
|
68
|
+
foundName = currentMenu.name;
|
|
69
|
+
foundMatchType = "startsWith";
|
|
60
70
|
}
|
|
61
71
|
}
|
|
62
|
-
return
|
|
72
|
+
return {
|
|
73
|
+
name: foundName,
|
|
74
|
+
matchType: foundMatchType
|
|
75
|
+
};
|
|
63
76
|
}
|
|
64
77
|
function handleUrlClick(e, menu) {
|
|
65
78
|
if (menu.disabled)
|
|
@@ -129,8 +142,8 @@ function handleUrlClick(e, menu) {
|
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
.guide {
|
|
132
|
-
background-color:
|
|
133
|
-
width:
|
|
145
|
+
background-color: rgb(var(--global-color-contrast-50));
|
|
146
|
+
width: 1px;
|
|
134
147
|
position: absolute;
|
|
135
148
|
top: 0;
|
|
136
149
|
bottom: 0;
|
|
@@ -138,7 +151,10 @@ function handleUrlClick(e, menu) {
|
|
|
138
151
|
}
|
|
139
152
|
|
|
140
153
|
.bookmark {
|
|
141
|
-
background-color: var(
|
|
154
|
+
background-color: var(
|
|
155
|
+
--sidebar-menu-list-primary-color,
|
|
156
|
+
var(--sidebar-menu-list-default-primary-color)
|
|
157
|
+
);
|
|
142
158
|
width: 2px;
|
|
143
159
|
position: absolute;
|
|
144
160
|
top: calc((var(--sidebar-menu-list-selected-index) - 1) * 2.2rem);
|
|
@@ -152,18 +168,30 @@ function handleUrlClick(e, menu) {
|
|
|
152
168
|
.menu-link {
|
|
153
169
|
padding-left: 0.5rem;
|
|
154
170
|
text-decoration: none;
|
|
155
|
-
color: var(
|
|
171
|
+
color: var(
|
|
172
|
+
--sidebar-menu-list-color,
|
|
173
|
+
var(--sidebar-menu-list-default-color)
|
|
174
|
+
);
|
|
156
175
|
transition-property: color;
|
|
157
176
|
transition-duration: .4s;
|
|
158
177
|
transition-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1);
|
|
159
178
|
}
|
|
160
179
|
|
|
161
180
|
.menu-link:hover {
|
|
162
|
-
color: var(
|
|
181
|
+
color: var(
|
|
182
|
+
--sidebar-menu-list-hover-color,
|
|
183
|
+
var(--sidebar-menu-list-default-hover-color)
|
|
184
|
+
)
|
|
163
185
|
}
|
|
164
186
|
|
|
165
187
|
.menu-link.active {
|
|
166
|
-
color: var(
|
|
167
|
-
|
|
188
|
+
color: var(
|
|
189
|
+
--sidebar-menu-list-selected-text-color,
|
|
190
|
+
var(--sidebar-menu-list-default-selected-text-color)
|
|
191
|
+
);
|
|
192
|
+
font-weight: var(
|
|
193
|
+
--sidebar-menu-list-selected-font-weight,
|
|
194
|
+
var(--sidebar-menu-list-default-selected-font-weight)
|
|
195
|
+
)
|
|
168
196
|
}
|
|
169
197
|
</style>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script>import "./CircularLoader.css";
|
|
2
|
+
let clazz = "";
|
|
3
|
+
export { clazz as class };
|
|
4
|
+
export let loading = true;
|
|
2
5
|
</script>
|
|
3
6
|
|
|
4
7
|
<svg
|
|
5
8
|
xmlns="http://www.w3.org/2000/svg"
|
|
6
9
|
viewBox="21.904761904761905 21.904761904761905 43.80952380952381 43.80952380952381"
|
|
7
|
-
style:color
|
|
8
|
-
style:height
|
|
9
|
-
style:width
|
|
10
10
|
class:active={loading}
|
|
11
|
+
class={clazz}
|
|
11
12
|
>
|
|
12
13
|
<circle
|
|
13
14
|
fill="transparent"
|
|
@@ -23,6 +24,21 @@
|
|
|
23
24
|
</svg>
|
|
24
25
|
|
|
25
26
|
<style>
|
|
27
|
+
svg {
|
|
28
|
+
height: var(
|
|
29
|
+
--circular-loader-height,
|
|
30
|
+
var(--circular-loader-default-height)
|
|
31
|
+
);
|
|
32
|
+
width: var(
|
|
33
|
+
--circular-loader-width,
|
|
34
|
+
var(--circular-loader-default-width)
|
|
35
|
+
);
|
|
36
|
+
width: var(
|
|
37
|
+
--circular-loader-color,
|
|
38
|
+
var(--circular-loader-default-color)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
circle.active {
|
|
27
43
|
-webkit-animation: progress-circular-dash 1.4s ease-in-out infinite;
|
|
28
44
|
animation: progress-circular-dash 1.4s ease-in-out infinite;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import './CircularLoader.css';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
5
|
+
class?: string | undefined;
|
|
4
6
|
loading?: boolean | undefined;
|
|
5
|
-
height?: string | undefined;
|
|
6
|
-
width?: string | undefined;
|
|
7
|
-
color?: string | null | undefined;
|
|
8
7
|
};
|
|
9
8
|
events: {
|
|
10
9
|
[evt: string]: CustomEvent<any>;
|
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
<script>export let name,
|
|
1
|
+
<script>export let name, click = false;
|
|
2
2
|
let clazz = "";
|
|
3
3
|
export { clazz as class };
|
|
4
4
|
import "../common/materialDesign.css";
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<span
|
|
8
|
-
style:font-size={size + "pt"}
|
|
9
|
-
style:color
|
|
10
8
|
class="icon mdi {name} {clazz}"
|
|
9
|
+
class:click
|
|
11
10
|
on:click
|
|
12
11
|
on:keypress
|
|
13
|
-
style:cursor={click ? "pointer" : "default"}
|
|
14
|
-
style:pointer-events={click ? "auto" : "none"}
|
|
15
12
|
/>
|
|
16
13
|
|
|
17
14
|
<style>
|
|
18
15
|
.icon {
|
|
19
|
-
font-size: var(
|
|
20
|
-
|
|
16
|
+
font-size: var(
|
|
17
|
+
--icon-size,
|
|
18
|
+
var(--icon-default-size)
|
|
19
|
+
);
|
|
20
|
+
color: var(
|
|
21
|
+
--icon-color,
|
|
22
|
+
var(--icon-default-color)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
.icon.click {
|
|
26
|
+
cursor: var(--icon-cursor, pointer);
|
|
27
|
+
pointer-events: var(--icon-pointer-events, auto);
|
|
28
|
+
}
|
|
29
|
+
.icon.click:not(.click) {
|
|
30
|
+
cursor: var(--icon-cursor, default);
|
|
31
|
+
pointer-events: var(--icon-pointer-events, none);
|
|
21
32
|
}
|
|
22
33
|
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--chip-default-border-radius: 9999px;
|
|
3
|
+
--chip-default-label-border-radius: 5px;
|
|
4
|
+
--chip-default-min-height: 2rem;
|
|
5
|
+
--chip-default-padding: 2px 10px;
|
|
6
|
+
--chip-default-background-color: rgb(var(--global-color-primary-500));
|
|
7
|
+
--chip-default-outlined-background-color: transparent;
|
|
8
|
+
--chip-default-color: rgb(var(--global-color-grey-50));
|
|
9
|
+
--chip-default-outlined-color: rgb(var(--global-color-primary-500));
|
|
10
|
+
--chip-default-font-size: inherit;
|
|
11
|
+
--chip-default-line-height: inherit;
|
|
12
|
+
--chip-default-cursor: pointer;
|
|
13
|
+
--chip-default-hover-background-color: rgb(var(--global-color-primary-600))
|
|
14
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import "./Chip.css";
|
|
2
|
+
import Icon from "../media/Icon.svelte";
|
|
2
3
|
import Button from "../buttons/Button.svelte";
|
|
3
4
|
import { createEventDispatcher } from "svelte";
|
|
4
|
-
export let close = false, closeIcon = "mdi-close-circle",
|
|
5
|
+
export let close = false, closeIcon = "mdi-close-circle", disabled = false, filter = false, filterIcon = "mdi-check", label = false, outlined = false, buttonTabIndex = null;
|
|
5
6
|
const dispatch = createEventDispatcher();
|
|
6
7
|
function handleChipClick() {
|
|
7
8
|
dispatch("click");
|
|
@@ -13,9 +14,6 @@ function handleCloseClick() {
|
|
|
13
14
|
|
|
14
15
|
<div
|
|
15
16
|
class="chip"
|
|
16
|
-
style:border-radius={label ? "5px" : "100px"}
|
|
17
|
-
style:background-color={color}
|
|
18
|
-
style:color={outlined ? color : textColor}
|
|
19
17
|
class:label
|
|
20
18
|
class:outlined
|
|
21
19
|
class:disabled
|
|
@@ -24,19 +22,23 @@ function handleCloseClick() {
|
|
|
24
22
|
>
|
|
25
23
|
{#if filter}
|
|
26
24
|
<div class="icon-before">
|
|
27
|
-
<Icon name={filterIcon}
|
|
25
|
+
<Icon name={filterIcon} />
|
|
28
26
|
</div>
|
|
29
27
|
{/if}
|
|
30
|
-
<div
|
|
28
|
+
<div
|
|
29
|
+
class="text"
|
|
30
|
+
>
|
|
31
31
|
<slot />
|
|
32
32
|
</div>
|
|
33
33
|
{#if close}
|
|
34
34
|
<div class="icon-after">
|
|
35
35
|
<Button
|
|
36
36
|
icon={closeIcon}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
buttonType="icon"
|
|
38
|
+
tabindex={buttonTabIndex}
|
|
39
|
+
--button-background-color="transparent"
|
|
40
|
+
--button-padding="0px"
|
|
41
|
+
--button-color="var(--chip-color, var(--chip-default-color))"
|
|
40
42
|
on:click={handleCloseClick}
|
|
41
43
|
/>
|
|
42
44
|
</div>
|
|
@@ -48,10 +50,59 @@ function handleCloseClick() {
|
|
|
48
50
|
text-align: center;
|
|
49
51
|
display: flex;
|
|
50
52
|
align-items: center;
|
|
53
|
+
min-height: var(
|
|
54
|
+
--chip-min-height,
|
|
55
|
+
var(--chip-default-min-height)
|
|
56
|
+
);
|
|
57
|
+
height: var(
|
|
58
|
+
--chip-height,
|
|
59
|
+
var(--chip-default-height)
|
|
60
|
+
);
|
|
61
|
+
padding: var(
|
|
62
|
+
--chip-padding,
|
|
63
|
+
var(--chip-default-padding)
|
|
64
|
+
);
|
|
65
|
+
cursor: var(
|
|
66
|
+
--chip-cursor,
|
|
67
|
+
var(--chip-default-cursor)
|
|
68
|
+
);
|
|
51
69
|
}
|
|
70
|
+
|
|
71
|
+
.chip:not(.outlined) {
|
|
72
|
+
background-color: var(
|
|
73
|
+
--chip-background-color,
|
|
74
|
+
var(--chip-default-background-color)
|
|
75
|
+
);
|
|
76
|
+
color: var(
|
|
77
|
+
--chip-color,
|
|
78
|
+
var(--chip-default-color)
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.chip:not(.outlined):hover {
|
|
83
|
+
background-color: var(
|
|
84
|
+
--chip-hover-background-color,
|
|
85
|
+
var(--chip-default-hover-background-color)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.chip:not(.label) {
|
|
90
|
+
border-radius: var(
|
|
91
|
+
--chip-border-radius,
|
|
92
|
+
var(--chip-default-border-radius)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.label {
|
|
97
|
+
border-radius: var(
|
|
98
|
+
--chip-border-radius,
|
|
99
|
+
var(--chip-default-label-border-radius)
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
52
103
|
.icon-after {
|
|
53
104
|
float: right;
|
|
54
|
-
margin-left:
|
|
105
|
+
margin-left: 10px;
|
|
55
106
|
}
|
|
56
107
|
.icon-before {
|
|
57
108
|
float: left;
|
|
@@ -60,15 +111,23 @@ function handleCloseClick() {
|
|
|
60
111
|
.text {
|
|
61
112
|
display: inline-block;
|
|
62
113
|
vertical-align: middle;
|
|
63
|
-
margin-left: 20px;
|
|
64
|
-
margin-right: 20px;
|
|
65
|
-
margin-bottom: 3px;
|
|
66
|
-
cursor: default;
|
|
67
114
|
user-select: none;
|
|
115
|
+
font-size: var(
|
|
116
|
+
--chip-font-size,
|
|
117
|
+
var(--chip-default-font-size)
|
|
118
|
+
);
|
|
119
|
+
line-height: var(
|
|
120
|
+
--chip-line-height,
|
|
121
|
+
var(--chip-default-line-height)
|
|
122
|
+
);
|
|
68
123
|
}
|
|
69
124
|
.outlined {
|
|
70
125
|
background: transparent !important;
|
|
71
126
|
border: solid 1px;
|
|
127
|
+
background-color: var(
|
|
128
|
+
--chip-background-color,
|
|
129
|
+
var(--chip-default-outlined-background-color)
|
|
130
|
+
);
|
|
72
131
|
}
|
|
73
132
|
.disabled {
|
|
74
133
|
pointer-events: none;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import './Chip.css';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
close?: boolean | undefined;
|
|
5
6
|
closeIcon?: string | undefined;
|
|
6
|
-
color?: string | undefined;
|
|
7
|
-
textColor?: string | undefined;
|
|
8
7
|
disabled?: boolean | undefined;
|
|
9
8
|
filter?: boolean | undefined;
|
|
10
9
|
filterIcon?: string | undefined;
|
|
11
10
|
label?: boolean | undefined;
|
|
12
11
|
outlined?: boolean | undefined;
|
|
13
|
-
|
|
12
|
+
buttonTabIndex?: number | null | undefined;
|
|
14
13
|
};
|
|
15
14
|
events: {
|
|
16
15
|
click: CustomEvent<any>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--drawer-default-space: 20rem;
|
|
3
|
+
--drawer-default-opening-speed: .3s;
|
|
4
|
+
--drawer-default-overlay-speed: .2s;
|
|
5
|
+
--drawer-default-overlay-opacity: 50%;
|
|
6
|
+
--drawer-default-overlay-background-color: rgb(var(--global-color-grey-900));
|
|
7
|
+
--drawer-default-z-index: 30;
|
|
8
|
+
--drawer-background-color: rgb(var(--global-color-background-200))
|
|
9
|
+
}
|