@likable-hair/svelte 0.0.17 → 0.0.20
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/buttons/Button.svelte +41 -35
- package/buttons/Button.svelte.d.ts +15 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/media/ImageGrid.svelte +1 -1
- package/navigation/Drawer.svelte +140 -0
- package/navigation/Drawer.svelte.d.ts +37 -0
- package/navigation/HeaderMenu.svelte +82 -17
- package/navigation/HeaderMenu.svelte.d.ts +15 -1
- package/navigation/Navigator.svelte +13 -4
- package/navigation/Navigator.svelte.d.ts +7 -0
- package/package.json +2 -1
package/buttons/Button.svelte
CHANGED
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
<script >export let type = 'default';
|
|
2
|
-
export let icon = undefined;
|
|
3
|
-
export let iconSize = 15;
|
|
4
|
-
let clazz = '';
|
|
1
|
+
<script >export let type = 'default', icon = undefined, iconSize = 15, clazz = '', maxWidth = undefined, maxHeight = undefined, minWidth = undefined, minHeight = undefined, width = undefined, height = undefined, textAlign = "center", cursor = "pointer", padding = "5px", fontSize = undefined, color = undefined, backgroundColor = undefined, hoverBackgroundColor = '#88888847', borderRadius = undefined, boxShadow = undefined;
|
|
5
2
|
export { clazz as class };
|
|
3
|
+
$: defaultBorderRadius = type == 'icon' ? '50%' : '5px';
|
|
6
4
|
$: position = !!$$slots.append ? 'relative' : undefined;
|
|
7
|
-
$: cssVariables = Object.entries({
|
|
8
|
-
'--icon-button-height': (iconSize + 15) + 'pt',
|
|
9
|
-
'--icon-button-width': (iconSize + 15) + 'pt',
|
|
10
|
-
'--button-position': position
|
|
11
|
-
}).filter(([key]) => key.startsWith('--'))
|
|
12
|
-
.reduce((css, [key, value]) => {
|
|
13
|
-
return `${css}${key}: ${value};`;
|
|
14
|
-
}, '');
|
|
15
5
|
import Icon from '../media/Icon.svelte';
|
|
16
6
|
</script>
|
|
17
7
|
|
|
18
8
|
<div
|
|
19
|
-
|
|
9
|
+
style:width={width}
|
|
10
|
+
style:max-width={maxWidth}
|
|
11
|
+
style:min-width={minWidth}
|
|
12
|
+
style:height={height}
|
|
13
|
+
style:max-height={maxHeight}
|
|
14
|
+
style:min-height={minHeight}
|
|
15
|
+
style:text-align={textAlign}
|
|
16
|
+
style:position={position}
|
|
17
|
+
style:cursor={cursor}
|
|
18
|
+
style:padding={padding}
|
|
19
|
+
style:font-size={fontSize}
|
|
20
|
+
style:color={color}
|
|
21
|
+
style:button-border-radius={!!borderRadius ? borderRadius : defaultBorderRadius}
|
|
22
|
+
style:--button-background-color={backgroundColor}
|
|
23
|
+
style:--button-hover-background-color={hoverBackgroundColor}
|
|
24
|
+
style:--button-box-shadow={boxShadow}
|
|
25
|
+
style:--button-icon-height={(iconSize + 5) + 'pt'}
|
|
26
|
+
style:--button-icon-width={(iconSize + 5) + 'pt'}
|
|
27
|
+
class="button no-select {clazz}"
|
|
20
28
|
class:button-default={type === 'default'}
|
|
21
29
|
class:button-text={type === 'text'}
|
|
22
30
|
class:button-icon={type === 'icon'}
|
|
23
31
|
on:click
|
|
24
|
-
style={cssVariables}
|
|
25
32
|
>
|
|
26
33
|
{#if !!icon}
|
|
27
34
|
<Icon name={icon} size={iconSize}></Icon>
|
|
@@ -31,7 +38,6 @@ import Icon from '../media/Icon.svelte';
|
|
|
31
38
|
{#if $$slots.append}
|
|
32
39
|
<span class="append-item">
|
|
33
40
|
<slot name="append">
|
|
34
|
-
|
|
35
41
|
</slot>
|
|
36
42
|
</span>
|
|
37
43
|
{/if}
|
|
@@ -45,57 +51,57 @@ import Icon from '../media/Icon.svelte';
|
|
|
45
51
|
|
|
46
52
|
.button {
|
|
47
53
|
overflow: hidden;
|
|
48
|
-
position: var(--button-position);
|
|
49
|
-
width: var(--width, fit-content);
|
|
50
|
-
height: var(--height, fit-content);
|
|
51
|
-
text-align: var(--text-align, center);
|
|
52
|
-
cursor: var(--cursor, pointer);
|
|
53
|
-
padding: var(--padding, 5px);
|
|
54
|
-
font-size: var(--font-size);
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
.button-default {
|
|
58
57
|
transition: background-color 200ms;
|
|
59
|
-
color: var(--color);
|
|
60
|
-
background-color: var(--background-color);
|
|
58
|
+
background-color: var(--button-background-color);
|
|
61
59
|
outline: 0;
|
|
62
60
|
border: 0;
|
|
63
|
-
border-radius: var(--border-radius, 0.25rem);
|
|
64
|
-
box-shadow: var(--box-shadow, 0 0 0.5rem rgba(0, 0, 0, 0.3));
|
|
61
|
+
border-radius: var(--button-border-radius, 0.25rem);
|
|
62
|
+
box-shadow: var(--button-box-shadow, 0 0 0.5rem rgba(0, 0, 0, 0.3));
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
.button-default:hover {
|
|
68
|
-
background-color: var(--hover-background-color, var(--background-color));
|
|
66
|
+
background-color: var(--button-hover-background-color, var(--button-background-color));
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
.button-text {
|
|
72
|
-
color: var(--color);
|
|
73
70
|
transition: background-color 200ms;
|
|
74
71
|
text-transform: uppercase;
|
|
75
72
|
font-weight: 600;
|
|
76
73
|
outline: 0;
|
|
77
74
|
border: 0;
|
|
78
|
-
border-radius: var(--border-radius, 0.25rem);
|
|
75
|
+
border-radius: var(--button-border-radius, 0.25rem);
|
|
79
76
|
}
|
|
80
77
|
|
|
81
78
|
.button-text:hover {
|
|
82
|
-
background-color: var(--hover-background-color, transparent);
|
|
79
|
+
background-color: var(--button-hover-background-color, transparent);
|
|
83
80
|
}
|
|
84
81
|
|
|
85
82
|
.button-icon {
|
|
86
|
-
color: var(--color);
|
|
87
83
|
transition: background-color 200ms;
|
|
88
84
|
outline: 0;
|
|
89
85
|
border: 0;
|
|
90
|
-
border-radius: var(--border-radius, 50%);
|
|
91
|
-
height: var(--icon-
|
|
92
|
-
width: var(--icon-
|
|
86
|
+
border-radius: var(--button-border-radius, 50%);
|
|
87
|
+
height: var(--button-icon-height) !important;
|
|
88
|
+
width: var(--button-icon-width) !important;
|
|
93
89
|
display: flex;
|
|
94
90
|
align-items: center;
|
|
95
91
|
justify-content: center;
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
.button-icon:hover {
|
|
99
|
-
background-color: var(--hover-background-color, transparent);
|
|
95
|
+
background-color: var(--button-hover-background-color, transparent);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.no-select {
|
|
99
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
100
|
+
-webkit-user-select: none; /* Safari */
|
|
101
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
102
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
103
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
104
|
+
user-select: none; /* Non-prefixed version, currently
|
|
105
|
+
supported by Chrome, Edge, Opera and Firefox */
|
|
100
106
|
}
|
|
101
107
|
</style>
|
|
@@ -5,6 +5,21 @@ declare const __propDef: {
|
|
|
5
5
|
icon?: string;
|
|
6
6
|
iconSize?: number;
|
|
7
7
|
class?: string;
|
|
8
|
+
maxWidth?: string;
|
|
9
|
+
maxHeight?: string;
|
|
10
|
+
minWidth?: string;
|
|
11
|
+
minHeight?: string;
|
|
12
|
+
width?: string;
|
|
13
|
+
height?: string;
|
|
14
|
+
textAlign?: string;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
padding?: string;
|
|
17
|
+
fontSize?: string;
|
|
18
|
+
color?: string;
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
hoverBackgroundColor?: string;
|
|
21
|
+
borderRadius?: string;
|
|
22
|
+
boxShadow?: string;
|
|
8
23
|
};
|
|
9
24
|
events: {
|
|
10
25
|
click: MouseEvent;
|
package/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as BreadCrumb } from './navigation/BreadCrumb.svelte';
|
|
|
15
15
|
export { default as HeaderMenu } from './navigation/HeaderMenu.svelte';
|
|
16
16
|
export { default as Navigator } from './navigation/Navigator.svelte';
|
|
17
17
|
export { default as TabSwitcher } from './navigation/TabSwitcher.svelte';
|
|
18
|
+
export { default as Drawer } from './navigation/Drawer.svelte';
|
|
18
19
|
export { default as ProgressBar } from './progress/ProgressBar.svelte';
|
|
19
20
|
export { default as ProductCard } from './shop/ProductCard.svelte';
|
|
20
21
|
export { default as ProductGrid } from './shop/ProductCard.svelte';
|
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { default as BreadCrumb } from './navigation/BreadCrumb.svelte';
|
|
|
21
21
|
export { default as HeaderMenu } from './navigation/HeaderMenu.svelte';
|
|
22
22
|
export { default as Navigator } from './navigation/Navigator.svelte';
|
|
23
23
|
export { default as TabSwitcher } from './navigation/TabSwitcher.svelte';
|
|
24
|
+
export { default as Drawer } from './navigation/Drawer.svelte';
|
|
24
25
|
// progress
|
|
25
26
|
export { default as ProgressBar } from './progress/ProgressBar.svelte';
|
|
26
27
|
// shop
|
package/media/ImageGrid.svelte
CHANGED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script >import Navigator from './Navigator.svelte';
|
|
2
|
+
export let open = false, position = 'left', space = '200px', openingSpeed = '0.3s', overlaySpeed = '0.2s', blockScroll = true, color = undefined, overlay = true, backgroundColor = undefined, overlayColor = '#282828', overlayOpacity = '30%', zIndex = 30, items = [];
|
|
3
|
+
let height = undefined, width = undefined, top = undefined, bottom = undefined, left = undefined, right = undefined;
|
|
4
|
+
function handleClickOverlay() {
|
|
5
|
+
open = false;
|
|
6
|
+
}
|
|
7
|
+
$: if (position == 'left') {
|
|
8
|
+
height = '100vh';
|
|
9
|
+
width = space;
|
|
10
|
+
top = '0px';
|
|
11
|
+
bottom = undefined;
|
|
12
|
+
right = undefined;
|
|
13
|
+
if (open) {
|
|
14
|
+
left = `0px`;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
left = `-${space}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (position == 'right') {
|
|
21
|
+
height = '100vh';
|
|
22
|
+
width = space;
|
|
23
|
+
top = '0px';
|
|
24
|
+
bottom = undefined;
|
|
25
|
+
left = 'auto';
|
|
26
|
+
if (open) {
|
|
27
|
+
right = `0px`;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
right = `calc(0vw - ${space})`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (position == 'top') {
|
|
34
|
+
height = space;
|
|
35
|
+
width = '100vw';
|
|
36
|
+
bottom = undefined;
|
|
37
|
+
left = '0px';
|
|
38
|
+
right = undefined;
|
|
39
|
+
if (open) {
|
|
40
|
+
top = `0px`;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
top = `-${space}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (position == 'bottom') {
|
|
47
|
+
height = space;
|
|
48
|
+
width = '100vw';
|
|
49
|
+
top = 'auto';
|
|
50
|
+
left = '0px';
|
|
51
|
+
right = undefined;
|
|
52
|
+
if (open) {
|
|
53
|
+
bottom = `0px`;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
bottom = `calc(0vh - ${space})`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
style:--drawer-opening-speed={openingSpeed}
|
|
63
|
+
style:position="fixed"
|
|
64
|
+
style:height={height}
|
|
65
|
+
style:width={width}
|
|
66
|
+
style:top={top}
|
|
67
|
+
style:bottom={bottom}
|
|
68
|
+
style:left={left}
|
|
69
|
+
style:right={right}
|
|
70
|
+
style:background-color={backgroundColor}
|
|
71
|
+
style:z-index={zIndex}
|
|
72
|
+
style:color={color}
|
|
73
|
+
class:animate-left={position == 'left'}
|
|
74
|
+
class:animate-right={position == 'right'}
|
|
75
|
+
class:animate-bottom={position == 'bottom'}
|
|
76
|
+
class:animate-top={position == 'top'}
|
|
77
|
+
>
|
|
78
|
+
<slot {open}>
|
|
79
|
+
<div
|
|
80
|
+
style:display="flex"
|
|
81
|
+
style:justify-content="center"
|
|
82
|
+
style:align-items="center"
|
|
83
|
+
style:margin-top={position == 'left' || position == 'right' ? '10px' : '0px'}
|
|
84
|
+
style:height={position == 'top' || position == 'bottom' ? '100%' : 'fit-content'}
|
|
85
|
+
>
|
|
86
|
+
<Navigator
|
|
87
|
+
items={items}
|
|
88
|
+
vertical={position == 'right' || position == 'left'}
|
|
89
|
+
on:item-click
|
|
90
|
+
></Navigator>
|
|
91
|
+
</div>
|
|
92
|
+
</slot>
|
|
93
|
+
</div>
|
|
94
|
+
{#if overlay}
|
|
95
|
+
<div
|
|
96
|
+
on:click={handleClickOverlay}
|
|
97
|
+
style:z-index={open ? zIndex - 1 : -5}
|
|
98
|
+
style:position="fixed"
|
|
99
|
+
style:top="0px"
|
|
100
|
+
style:left="0px"
|
|
101
|
+
style:width="100vw"
|
|
102
|
+
style:height="100vh"
|
|
103
|
+
style:background-color={overlayColor}
|
|
104
|
+
style:--drawer-overlay-opacity={overlayOpacity}
|
|
105
|
+
style:--drawer-overlay-speed={overlaySpeed}
|
|
106
|
+
class="overlay"
|
|
107
|
+
class:overlay-active={open}
|
|
108
|
+
class:overlay-hidden={!open}
|
|
109
|
+
></div>
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
<style>
|
|
113
|
+
.animate-left {
|
|
114
|
+
transition: left var(--drawer-opening-speed) cubic-bezier(0.4, 0, 0.2, 1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.animate-right {
|
|
118
|
+
transition: right var(--drawer-opening-speed) cubic-bezier(0.4, 0, 0.2, 1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.animate-bottom {
|
|
122
|
+
transition: bottom var(--drawer-opening-speed) cubic-bezier(0.4, 0, 0.2, 1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.animate-top {
|
|
126
|
+
transition: top var(--drawer-opening-speed) cubic-bezier(0.4, 0, 0.2, 1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.overlay {
|
|
130
|
+
transition: all var(--drawer-overlay-speed) cubic-bezier(0.4, 0, 0.2, 1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.overlay-active {
|
|
134
|
+
opacity: var(--drawer-overlay-opacity);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.overlay-hidden {
|
|
138
|
+
opacity: 0%;
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { Item } from './Navigator.svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
position?: 'left' | 'top' | 'right' | 'bottom';
|
|
7
|
+
space?: string;
|
|
8
|
+
openingSpeed?: string;
|
|
9
|
+
overlaySpeed?: string;
|
|
10
|
+
blockScroll?: boolean;
|
|
11
|
+
color?: string;
|
|
12
|
+
overlay?: boolean;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
overlayColor?: string;
|
|
15
|
+
overlayOpacity?: string;
|
|
16
|
+
zIndex?: number;
|
|
17
|
+
items?: Item[];
|
|
18
|
+
};
|
|
19
|
+
events: {
|
|
20
|
+
'item-click': CustomEvent<{
|
|
21
|
+
item: Item;
|
|
22
|
+
}>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
};
|
|
26
|
+
slots: {
|
|
27
|
+
default: {
|
|
28
|
+
open: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare type DrawerProps = typeof __propDef.props;
|
|
33
|
+
export declare type DrawerEvents = typeof __propDef.events;
|
|
34
|
+
export declare type DrawerSlots = typeof __propDef.slots;
|
|
35
|
+
export default class Drawer extends SvelteComponentTyped<DrawerProps, DrawerEvents, DrawerSlots> {
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
<script >export let title = "";
|
|
2
|
-
export let items = [];
|
|
3
|
-
export let hideOnScroll = true;
|
|
1
|
+
<script >export let title = "", items = [], hideOnScroll = true, initialRemoveShadow = false, initialBackgroundColor = undefined, backgroundColor = 'white', color = undefined, mobileMenu = true;
|
|
4
2
|
let scrollY, lastScrollY, visible = true;
|
|
5
3
|
function handleScroll() {
|
|
6
4
|
if (hideOnScroll) {
|
|
@@ -10,10 +8,21 @@ function handleScroll() {
|
|
|
10
8
|
else {
|
|
11
9
|
visible = true;
|
|
12
10
|
}
|
|
13
|
-
lastScrollY = scrollY;
|
|
14
11
|
}
|
|
12
|
+
lastScrollY = scrollY;
|
|
15
13
|
}
|
|
14
|
+
export let openDrawer = false;
|
|
15
|
+
function toggleDrawer() {
|
|
16
|
+
openDrawer = !openDrawer;
|
|
17
|
+
}
|
|
18
|
+
let localBackgroundColor = undefined;
|
|
19
|
+
$: if (scrollY == 0 && !!initialBackgroundColor)
|
|
20
|
+
localBackgroundColor = initialBackgroundColor;
|
|
21
|
+
else
|
|
22
|
+
localBackgroundColor = backgroundColor;
|
|
16
23
|
import Navigator from './Navigator.svelte';
|
|
24
|
+
import Button from '../buttons/Button.svelte';
|
|
25
|
+
import Drawer from './Drawer.svelte';
|
|
17
26
|
</script>
|
|
18
27
|
|
|
19
28
|
<svelte:window
|
|
@@ -21,24 +30,55 @@ import Navigator from './Navigator.svelte';
|
|
|
21
30
|
on:scroll={handleScroll}
|
|
22
31
|
></svelte:window>
|
|
23
32
|
|
|
33
|
+
{#if mobileMenu }
|
|
34
|
+
<Drawer
|
|
35
|
+
bind:open={openDrawer}
|
|
36
|
+
backgroundColor={backgroundColor}
|
|
37
|
+
color={color}
|
|
38
|
+
items={items}
|
|
39
|
+
on:item-click
|
|
40
|
+
></Drawer>
|
|
41
|
+
{/if}
|
|
24
42
|
<nav
|
|
43
|
+
style:color={color}
|
|
44
|
+
style:background-color={localBackgroundColor}
|
|
25
45
|
style:position="sticky"
|
|
26
46
|
style:display="flex"
|
|
27
47
|
style:flex-wrap="wrap"
|
|
28
48
|
style:align-items="center"
|
|
29
49
|
style:height="56px"
|
|
30
|
-
class="
|
|
50
|
+
class="transition-all header-menu-container"
|
|
31
51
|
class:-top-14={!visible}
|
|
32
52
|
class:top-0={visible}
|
|
53
|
+
class:shadow-md={!initialRemoveShadow || scrollY != 0}
|
|
33
54
|
>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
<div
|
|
56
|
+
style:height="56px"
|
|
57
|
+
style:flex="none"
|
|
58
|
+
style:display="flex"
|
|
59
|
+
style:align-items="center"
|
|
60
|
+
>
|
|
61
|
+
<slot
|
|
62
|
+
name="prepend"
|
|
63
|
+
toggleDrawer={toggleDrawer}
|
|
64
|
+
openDrawer={openDrawer}
|
|
38
65
|
>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
66
|
+
{#if mobileMenu}
|
|
67
|
+
<div
|
|
68
|
+
style:width="fit-content"
|
|
69
|
+
style:margin-left="10px"
|
|
70
|
+
style:margin-right="10px"
|
|
71
|
+
class="hide-on-desktop"
|
|
72
|
+
>
|
|
73
|
+
<Button
|
|
74
|
+
type="icon"
|
|
75
|
+
icon="mdi-menu"
|
|
76
|
+
on:click={toggleDrawer}
|
|
77
|
+
></Button>
|
|
78
|
+
</div>
|
|
79
|
+
{/if}
|
|
80
|
+
</slot>
|
|
81
|
+
</div>
|
|
42
82
|
<div
|
|
43
83
|
style:flex-grow="1"
|
|
44
84
|
style:margin-left="4px"
|
|
@@ -51,17 +91,20 @@ import Navigator from './Navigator.svelte';
|
|
|
51
91
|
</slot>
|
|
52
92
|
</div>
|
|
53
93
|
<div>
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
94
|
+
<slot name="menu-desktop">
|
|
95
|
+
<div class="hide-on-mobile">
|
|
96
|
+
<Navigator
|
|
97
|
+
items={items}
|
|
98
|
+
on:item-click
|
|
99
|
+
></Navigator>
|
|
100
|
+
</div>
|
|
101
|
+
</slot>
|
|
57
102
|
</div>
|
|
58
103
|
<slot name="append"></slot>
|
|
59
104
|
</nav>
|
|
60
105
|
|
|
61
106
|
<style>
|
|
62
107
|
.header-menu-container {
|
|
63
|
-
background-color: var(--background-color, white);
|
|
64
|
-
color: var(--color);
|
|
65
108
|
width: var(--width, 100vw)
|
|
66
109
|
}
|
|
67
110
|
|
|
@@ -91,4 +134,26 @@ import Navigator from './Navigator.svelte';
|
|
|
91
134
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
92
135
|
transition-duration: 150ms;
|
|
93
136
|
}
|
|
137
|
+
|
|
138
|
+
.hide-on-mobile {
|
|
139
|
+
visibility: visible !important;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.hide-on-desktop {
|
|
143
|
+
visibility: visible !important;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (max-width: 767.98px) {
|
|
147
|
+
.hide-on-mobile {
|
|
148
|
+
visibility: hidden !important;
|
|
149
|
+
display: none !important;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@media (min-width: 768px){
|
|
154
|
+
.hide-on-desktop {
|
|
155
|
+
visibility: hidden !important;
|
|
156
|
+
display: none !important;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
94
159
|
</style>
|
|
@@ -5,13 +5,27 @@ declare const __propDef: {
|
|
|
5
5
|
title?: string;
|
|
6
6
|
items?: Item[];
|
|
7
7
|
hideOnScroll?: boolean;
|
|
8
|
+
initialRemoveShadow?: boolean;
|
|
9
|
+
initialBackgroundColor?: string;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
mobileMenu?: boolean;
|
|
13
|
+
openDrawer?: boolean;
|
|
8
14
|
};
|
|
9
15
|
events: {
|
|
16
|
+
'item-click': CustomEvent<{
|
|
17
|
+
item: Item;
|
|
18
|
+
}>;
|
|
19
|
+
} & {
|
|
10
20
|
[evt: string]: CustomEvent<any>;
|
|
11
21
|
};
|
|
12
22
|
slots: {
|
|
13
|
-
prepend: {
|
|
23
|
+
prepend: {
|
|
24
|
+
toggleDrawer: () => void;
|
|
25
|
+
openDrawer: boolean;
|
|
26
|
+
};
|
|
14
27
|
title: {};
|
|
28
|
+
'menu-desktop': {};
|
|
15
29
|
append: {};
|
|
16
30
|
};
|
|
17
31
|
};
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
<script context="module" >export {};
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<script >export let items = [];
|
|
4
|
+
<script >export let items = [], color = undefined, vertical = false, space = '20px';
|
|
5
|
+
import { createEventDispatcher } from 'svelte';
|
|
6
|
+
const dispatch = createEventDispatcher();
|
|
7
|
+
function handleItemClick(item) {
|
|
8
|
+
dispatch('item-click', { item });
|
|
9
|
+
}
|
|
5
10
|
</script>
|
|
6
11
|
|
|
7
12
|
<div
|
|
8
13
|
style:display="flex"
|
|
14
|
+
style:flex-direction={vertical ? 'column' : 'row'}
|
|
9
15
|
>
|
|
10
16
|
{#each items as item}
|
|
11
17
|
<div
|
|
12
|
-
style:
|
|
18
|
+
style:width="fit-content"
|
|
19
|
+
style:margin-right={!vertical ? space : undefined}
|
|
20
|
+
style:margin-bottom={vertical ? space : undefined}
|
|
21
|
+
style:color={color}
|
|
13
22
|
class="link bar-link"
|
|
23
|
+
on:click={() => handleItemClick(item)}
|
|
14
24
|
>
|
|
15
25
|
{item.title}
|
|
16
26
|
</div>
|
|
@@ -23,14 +33,13 @@
|
|
|
23
33
|
font-size: 18px;
|
|
24
34
|
position: relative;
|
|
25
35
|
white-space: nowrap;
|
|
26
|
-
color: var(--color-text);
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
.link::before,
|
|
30
39
|
.link::after {
|
|
31
40
|
position: absolute;
|
|
32
41
|
width: 100%;
|
|
33
|
-
height:
|
|
42
|
+
height: 1.5px;
|
|
34
43
|
background: currentColor;
|
|
35
44
|
top: 100%;
|
|
36
45
|
left: 0;
|
|
@@ -7,8 +7,15 @@ export declare type Item = {
|
|
|
7
7
|
declare const __propDef: {
|
|
8
8
|
props: {
|
|
9
9
|
items?: Item[];
|
|
10
|
+
color?: string;
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
space?: string;
|
|
10
13
|
};
|
|
11
14
|
events: {
|
|
15
|
+
"item-click": CustomEvent<{
|
|
16
|
+
item: Item;
|
|
17
|
+
}>;
|
|
18
|
+
} & {
|
|
12
19
|
[evt: string]: CustomEvent<any>;
|
|
13
20
|
};
|
|
14
21
|
slots: {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likable-hair/svelte",
|
|
3
3
|
"description": "A Svelte component for likablehair",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.20",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@sveltejs/adapter-auto": "next",
|
|
7
7
|
"@sveltejs/kit": "next",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"./media/Image.svelte": "./media/Image.svelte",
|
|
44
44
|
"./media/ImageGrid.svelte": "./media/ImageGrid.svelte",
|
|
45
45
|
"./navigation/Breadcrumb.svelte": "./navigation/Breadcrumb.svelte",
|
|
46
|
+
"./navigation/Drawer.svelte": "./navigation/Drawer.svelte",
|
|
46
47
|
"./navigation/HeaderMenu.svelte": "./navigation/HeaderMenu.svelte",
|
|
47
48
|
"./navigation/Navigator.svelte": "./navigation/Navigator.svelte",
|
|
48
49
|
"./navigation/TabSwitcher.svelte": "./navigation/TabSwitcher.svelte",
|