@likable-hair/svelte 2.0.5 → 2.0.6
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/layouts/CollapsibleSideBarLayout.svelte +316 -0
- package/dist/components/layouts/CollapsibleSideBarLayout.svelte.d.ts +72 -0
- package/dist/components/layouts/StableDividedSideBarLayout.svelte +1 -0
- package/dist/components/simple/common/CollapsibleDivider.svelte +48 -0
- package/dist/components/simple/common/CollapsibleDivider.svelte.d.ts +38 -0
- package/dist/components/simple/common/Gesture.svelte +2 -2
- package/dist/components/simple/common/Menu.svelte +26 -3
- package/dist/components/simple/dates/Calendar.svelte +1 -1
- package/dist/components/simple/dates/DatePicker.svelte +2 -2
- package/dist/components/simple/dates/TimePickerTextField.svelte +1 -1
- package/dist/components/simple/dates/YearSelector.svelte +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import CollapsibleDivider from "../simple/common/CollapsibleDivider.svelte";
|
|
3
|
+
import Icon from "../simple/media/Icon.svelte";
|
|
4
|
+
import MediaQuery from "../simple/common/MediaQuery.svelte";
|
|
5
|
+
export let _pagePadding = "20px 0 0 30px", _menuElementMarginBottom = "30px", _menuElementFontSize = "1.1rem", _menuElementFontWeight = "400", _menuColor = "#454444", _selectedMenuColor = "#0b66cc", _expandedSideBarWidth = "16rem", _collapsedSideBarWidth = "4.6rem", _headerHeight = "80px", _collapseTransitionTime = "0.4s", _sideBarBackgroundColor = "white", _overlayColor = "hsla(240,5%,65%,.2)", _headerBackgroundColor = "#FFFF";
|
|
6
|
+
export let drawerOpened = false, drawerCollapsed = false, menuElements = [], menuIconsSize = 16, selectedMenuElementId = void 0, fullLogo = void 0, partialLogo = void 0;
|
|
7
|
+
let dispatch = createEventDispatcher();
|
|
8
|
+
function toggleMenu() {
|
|
9
|
+
drawerOpened = !drawerOpened;
|
|
10
|
+
dispatch("drawer-change", { opened: drawerOpened });
|
|
11
|
+
}
|
|
12
|
+
function toggleExpansion() {
|
|
13
|
+
drawerCollapsed = !drawerCollapsed;
|
|
14
|
+
}
|
|
15
|
+
function handleMenuClick(menu) {
|
|
16
|
+
selectedMenuElementId = menu.id;
|
|
17
|
+
dispatch("menu-click", { menu });
|
|
18
|
+
}
|
|
19
|
+
function handleOverlayClick() {
|
|
20
|
+
}
|
|
21
|
+
$:
|
|
22
|
+
if (drawerOpened)
|
|
23
|
+
drawerCollapsed = false;
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<MediaQuery let:mAndDown>
|
|
27
|
+
<div
|
|
28
|
+
style:--collapsible-side-bar-layout-expanded-width={_expandedSideBarWidth}
|
|
29
|
+
style:--collapsible-side-bar-layout-header-height={_headerHeight}
|
|
30
|
+
style:--collapsible-side-bar-layout-collapsed-width={_collapsedSideBarWidth}
|
|
31
|
+
style:--collapsible-side-bar-layout-collapse-transition-time={_collapseTransitionTime}
|
|
32
|
+
style:--collapsible-side-bar-layout-menu-element-margin-bottom={_menuElementMarginBottom}
|
|
33
|
+
style:--collapsible-side-bar-layout-menu-element-font-size={_menuElementFontSize}
|
|
34
|
+
style:--collapsible-side-bar-layout-menu-element-font-weight={_menuElementFontWeight}
|
|
35
|
+
style:--collapsible-side-bar-layout-menu-color={_menuColor}
|
|
36
|
+
style:--collapsible-side-bar-layout-selected-menu-color={_selectedMenuColor}
|
|
37
|
+
style:--collapsible-side-bar-layout-sidebar-background-color={_sideBarBackgroundColor}
|
|
38
|
+
style:--collapsible-side-bar-layout-overlay-color={_overlayColor}
|
|
39
|
+
style:--collapsible-side-bar-layout-header-background-color={_headerBackgroundColor}
|
|
40
|
+
>
|
|
41
|
+
<header
|
|
42
|
+
class="side-bar"
|
|
43
|
+
class:collapsed={drawerCollapsed}
|
|
44
|
+
class:opened={drawerOpened}
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
class="header-toolbar"
|
|
48
|
+
class:collapsed={drawerCollapsed}
|
|
49
|
+
class:opened={drawerOpened}
|
|
50
|
+
>
|
|
51
|
+
<slot name="menu">
|
|
52
|
+
<div class="inner-menu">
|
|
53
|
+
{#if mAndDown}
|
|
54
|
+
<div style:margin-right="2rem">
|
|
55
|
+
<Icon
|
|
56
|
+
name="mdi-menu"
|
|
57
|
+
click
|
|
58
|
+
on:click={toggleMenu}
|
|
59
|
+
></Icon>
|
|
60
|
+
</div>
|
|
61
|
+
{/if}
|
|
62
|
+
<slot name="inner-menu" hamburgerVisible={mAndDown}>
|
|
63
|
+
Menu
|
|
64
|
+
</slot>
|
|
65
|
+
</div>
|
|
66
|
+
</slot>
|
|
67
|
+
</div>
|
|
68
|
+
<div
|
|
69
|
+
class="side-bar-content"
|
|
70
|
+
class:collapsed={drawerCollapsed}
|
|
71
|
+
>
|
|
72
|
+
<slot name="sidebar-header" hamburgerVisible={mAndDown} collapsed={drawerCollapsed}>
|
|
73
|
+
{#if !!fullLogo && !!partialLogo && !mAndDown}
|
|
74
|
+
<div class="logo-container" class:collapsed={drawerCollapsed}>
|
|
75
|
+
<img src={drawerCollapsed ? partialLogo : fullLogo} alt="logo">
|
|
76
|
+
</div>
|
|
77
|
+
{/if}
|
|
78
|
+
</slot>
|
|
79
|
+
<slot name="sidebar-main" hamburgerVisible={mAndDown} collapsed={drawerCollapsed}>
|
|
80
|
+
<div
|
|
81
|
+
class="menu-container"
|
|
82
|
+
class:collapsed={drawerCollapsed}
|
|
83
|
+
>
|
|
84
|
+
<div
|
|
85
|
+
class="menu"
|
|
86
|
+
class:collapsed={drawerCollapsed}
|
|
87
|
+
>
|
|
88
|
+
{#each menuElements as menu}
|
|
89
|
+
<div
|
|
90
|
+
class="menu-row"
|
|
91
|
+
class:selected={menu.id === selectedMenuElementId}
|
|
92
|
+
on:click={() => handleMenuClick(menu)}
|
|
93
|
+
on:keypress
|
|
94
|
+
>
|
|
95
|
+
<div class="menu-icon"><Icon name={menu.icon} size={menuIconsSize}></Icon></div>
|
|
96
|
+
<div class="menu-name">{menu.name}</div>
|
|
97
|
+
</div>
|
|
98
|
+
{/each}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</slot>
|
|
102
|
+
<CollapsibleDivider
|
|
103
|
+
bind:collapsed={drawerCollapsed}
|
|
104
|
+
disabled={mAndDown}
|
|
105
|
+
></CollapsibleDivider>
|
|
106
|
+
<slot name="sidebar-footer" hamburgerVisible={mAndDown} collapsed={drawerCollapsed}></slot>
|
|
107
|
+
</div>
|
|
108
|
+
</header>
|
|
109
|
+
<div
|
|
110
|
+
class="main-section"
|
|
111
|
+
class:collapsed={drawerCollapsed}
|
|
112
|
+
>
|
|
113
|
+
<div
|
|
114
|
+
class="overlay"
|
|
115
|
+
on:click={handleOverlayClick}
|
|
116
|
+
on:keypress={handleOverlayClick}
|
|
117
|
+
class:visible={drawerOpened}
|
|
118
|
+
></div>
|
|
119
|
+
<div
|
|
120
|
+
style:padding={_pagePadding}
|
|
121
|
+
class:blurred={drawerOpened}
|
|
122
|
+
>
|
|
123
|
+
<slot>Content</slot>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</MediaQuery>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<style>
|
|
131
|
+
|
|
132
|
+
.logo-container {
|
|
133
|
+
padding-left: 16px;
|
|
134
|
+
padding-top: 10px;
|
|
135
|
+
transition-property: width padding-left;
|
|
136
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
137
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.logo-container.collapsed {
|
|
141
|
+
padding-left: 8px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.logo-container img {
|
|
145
|
+
height: calc(var(--collapsible-side-bar-layout-collapsed-width) - 20px);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.side-bar {
|
|
149
|
+
padding-left: 5px;
|
|
150
|
+
padding-top: 5px;
|
|
151
|
+
position: fixed;
|
|
152
|
+
width: var(--collapsible-side-bar-layout-expanded-width);
|
|
153
|
+
top: 0;
|
|
154
|
+
bottom: 0;
|
|
155
|
+
left: 0;
|
|
156
|
+
right: 0;
|
|
157
|
+
transition-property: width padding-left;
|
|
158
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
159
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
background-color: var(--collapsible-side-bar-layout-sidebar-background-color);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.side-bar.collapsed {
|
|
166
|
+
width: var(--collapsible-side-bar-layout-collapsed-width);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.header-toolbar {
|
|
170
|
+
padding-right: 20px;
|
|
171
|
+
position: fixed;
|
|
172
|
+
height: var(--collapsible-side-bar-layout-header-height);
|
|
173
|
+
left: calc(5px + var(--collapsible-side-bar-layout-expanded-width));
|
|
174
|
+
transition-property: left;
|
|
175
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
176
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
177
|
+
right: 0;
|
|
178
|
+
top: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.header-toolbar.collapsed {
|
|
182
|
+
left: calc(5px + var(--collapsible-side-bar-layout-collapsed-width));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.main-section {
|
|
186
|
+
padding-left: var(--collapsible-side-bar-layout-expanded-width);
|
|
187
|
+
padding-top: var(--collapsible-side-bar-layout-header-height);
|
|
188
|
+
transition-property: padding-left;
|
|
189
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
190
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.main-section.collapsed {
|
|
194
|
+
padding-left: var(--collapsible-side-bar-layout-collapsed-width);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.menu {
|
|
198
|
+
width: auto;
|
|
199
|
+
margin-top: 40px;
|
|
200
|
+
margin-bottom: 20px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.menu-container {
|
|
204
|
+
padding-left: 30px;
|
|
205
|
+
padding-right: 30px;
|
|
206
|
+
transition-property: padding-left padding-right;
|
|
207
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
208
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.menu-container.collapsed {
|
|
212
|
+
padding-left: 22px;
|
|
213
|
+
padding-right: 14px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.menu .menu-name {
|
|
217
|
+
transition-property: opacity width;
|
|
218
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
219
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
220
|
+
padding-left: 20px;
|
|
221
|
+
width: 100%;
|
|
222
|
+
font-size: var(--collapsible-side-bar-layout-menu-element-font-size);
|
|
223
|
+
font-weight: var(--collapsible-side-bar-layout-menu-element-font-weight);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.menu-icon {
|
|
227
|
+
display: flex;
|
|
228
|
+
justify-content: center;
|
|
229
|
+
margin-left: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.menu.collapsed .menu-name {
|
|
233
|
+
width: 0px;
|
|
234
|
+
padding-left: 0px;
|
|
235
|
+
opacity: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.menu-row {
|
|
239
|
+
display: flex;
|
|
240
|
+
margin-bottom: var(--collapsible-side-bar-layout-menu-element-margin-bottom);
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
color: var(--collapsible-side-bar-layout-menu-color)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.menu-row.selected {
|
|
246
|
+
color: var(--collapsible-side-bar-layout-selected-menu-color);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.inner-menu {
|
|
250
|
+
padding-left: 20px;
|
|
251
|
+
background-color: var(--collapsible-side-bar-layout-header-background-color);
|
|
252
|
+
height: 100%;
|
|
253
|
+
display: flex;
|
|
254
|
+
align-items: center;
|
|
255
|
+
justify-content: space-between;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@media (max-width: 1024px) {
|
|
259
|
+
.side-bar {
|
|
260
|
+
left: calc(0rem - var(--collapsible-side-bar-layout-expanded-width));
|
|
261
|
+
right: auto;
|
|
262
|
+
transition-property: left;
|
|
263
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
264
|
+
transition-duration: var(--collapsible-side-bar-layout-collapse-transition-time);
|
|
265
|
+
top: var(--collapsible-side-bar-layout-header-height);
|
|
266
|
+
background-color: var(--collapsible-side-bar-layout-sidebar-background-color);
|
|
267
|
+
bottom: 0;
|
|
268
|
+
z-index: 30;
|
|
269
|
+
width: var(--collapsible-side-bar-layout-expanded-width);
|
|
270
|
+
max-width: 100vw;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.side-bar.opened {
|
|
274
|
+
left: 0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.overlay {
|
|
278
|
+
position: fixed;
|
|
279
|
+
top: var(--collapsible-side-bar-layout-header-height);
|
|
280
|
+
left: 0;
|
|
281
|
+
bottom: 0;
|
|
282
|
+
right: 0;
|
|
283
|
+
z-index: -100;
|
|
284
|
+
transition-property: backdrop-filter;
|
|
285
|
+
transition-timing-function: cubic-bezier(.4,0,.2,1);
|
|
286
|
+
transition-duration: .15s;
|
|
287
|
+
display: block;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.overlay.visible {
|
|
291
|
+
background-color: var(--collapsible-side-bar-layout-overlay-color);
|
|
292
|
+
backdrop-filter: blur(4px);
|
|
293
|
+
z-index: 20;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.header-toolbar {
|
|
297
|
+
left: 0;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.header-toolbar.opened {
|
|
301
|
+
background-color: inherit;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.header-toolbar:hover {
|
|
305
|
+
background-color: inherit;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.main-section {
|
|
309
|
+
padding-left: 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.blurred {
|
|
313
|
+
backdrop-filter: blur(4px);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
_pagePadding?: string | undefined;
|
|
5
|
+
_menuElementMarginBottom?: string | undefined;
|
|
6
|
+
_menuElementFontSize?: string | undefined;
|
|
7
|
+
_menuElementFontWeight?: string | undefined;
|
|
8
|
+
_menuColor?: string | undefined;
|
|
9
|
+
_selectedMenuColor?: string | undefined;
|
|
10
|
+
_expandedSideBarWidth?: string | undefined;
|
|
11
|
+
_collapsedSideBarWidth?: string | undefined;
|
|
12
|
+
_headerHeight?: string | undefined;
|
|
13
|
+
_collapseTransitionTime?: string | undefined;
|
|
14
|
+
_sideBarBackgroundColor?: string | undefined;
|
|
15
|
+
_overlayColor?: string | undefined;
|
|
16
|
+
_headerBackgroundColor?: string | undefined;
|
|
17
|
+
drawerOpened?: boolean | undefined;
|
|
18
|
+
drawerCollapsed?: boolean | undefined;
|
|
19
|
+
menuElements?: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
icon: string;
|
|
23
|
+
}[] | undefined;
|
|
24
|
+
menuIconsSize?: number | undefined;
|
|
25
|
+
selectedMenuElementId?: string | undefined;
|
|
26
|
+
fullLogo?: string | undefined;
|
|
27
|
+
partialLogo?: string | undefined;
|
|
28
|
+
};
|
|
29
|
+
events: {
|
|
30
|
+
keypress: KeyboardEvent;
|
|
31
|
+
collapse: CustomEvent<{
|
|
32
|
+
collapsed: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
'drawer-change': CustomEvent<{
|
|
35
|
+
opened: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
'menu-click': CustomEvent<{
|
|
38
|
+
menu: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
icon: string;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
} & {
|
|
45
|
+
[evt: string]: CustomEvent<any>;
|
|
46
|
+
};
|
|
47
|
+
slots: {
|
|
48
|
+
menu: {};
|
|
49
|
+
'inner-menu': {
|
|
50
|
+
hamburgerVisible: boolean;
|
|
51
|
+
};
|
|
52
|
+
'sidebar-header': {
|
|
53
|
+
hamburgerVisible: boolean;
|
|
54
|
+
collapsed: boolean;
|
|
55
|
+
};
|
|
56
|
+
'sidebar-main': {
|
|
57
|
+
hamburgerVisible: boolean;
|
|
58
|
+
collapsed: boolean;
|
|
59
|
+
};
|
|
60
|
+
'sidebar-footer': {
|
|
61
|
+
hamburgerVisible: boolean;
|
|
62
|
+
collapsed: boolean;
|
|
63
|
+
};
|
|
64
|
+
default: {};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type CollapsibleSideBarLayoutProps = typeof __propDef.props;
|
|
68
|
+
export type CollapsibleSideBarLayoutEvents = typeof __propDef.events;
|
|
69
|
+
export type CollapsibleSideBarLayoutSlots = typeof __propDef.slots;
|
|
70
|
+
export default class CollapsibleSideBarLayout extends SvelteComponentTyped<CollapsibleSideBarLayoutProps, CollapsibleSideBarLayoutEvents, CollapsibleSideBarLayoutSlots> {
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import Icon from "../media/Icon.svelte";
|
|
3
|
+
let dispatch = createEventDispatcher();
|
|
4
|
+
export let collapsed = false, openedIconName = "mdi-chevron-left", collapsedIconName = "mdi-chevron-right", iconSize = 12, disabled = false;
|
|
5
|
+
export let _height = "1px", _radius = "0.5px", _marginTop = "10px", _marginBottom = "10px", _marginLeft = "5px", _marginRight = "5px", _dividerColor = "#d2d2d2", _circleColor = "#d2d2d2", _circleBorder = "1px solid", _iconColor = "grey";
|
|
6
|
+
let buttonHeight;
|
|
7
|
+
function handleCollapseClick() {
|
|
8
|
+
if (!disabled) {
|
|
9
|
+
collapsed = !collapsed;
|
|
10
|
+
dispatch("change", { collapsed });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
style:display="flex"
|
|
17
|
+
style:margin-right={_marginRight}
|
|
18
|
+
style:margin-left={_marginLeft}
|
|
19
|
+
style:margin-top={_marginTop}
|
|
20
|
+
style:margin-bottom={_marginBottom}
|
|
21
|
+
style:align-items="center"
|
|
22
|
+
>
|
|
23
|
+
<div
|
|
24
|
+
style:background-color={_dividerColor}
|
|
25
|
+
style:border-radius={_radius}
|
|
26
|
+
style:height={_height}
|
|
27
|
+
style:flex-grow={1}
|
|
28
|
+
/>
|
|
29
|
+
<div
|
|
30
|
+
style:border-radius={buttonHeight + 'px'}
|
|
31
|
+
style:border={_circleBorder}
|
|
32
|
+
style:border-color={_circleColor}
|
|
33
|
+
bind:clientHeight={buttonHeight}
|
|
34
|
+
style:width={buttonHeight + 'px'}
|
|
35
|
+
style:display="flex"
|
|
36
|
+
style:justify-content="center"
|
|
37
|
+
style:cursor="pointer"
|
|
38
|
+
style:color={_iconColor}
|
|
39
|
+
style:opacity={disabled ? 0 : 1}
|
|
40
|
+
on:click="{handleCollapseClick}"
|
|
41
|
+
on:click
|
|
42
|
+
on:keydown
|
|
43
|
+
on:keyup
|
|
44
|
+
on:keypress
|
|
45
|
+
>
|
|
46
|
+
<Icon name={collapsed ? collapsedIconName : openedIconName} size={iconSize}></Icon>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
collapsed?: boolean | undefined;
|
|
5
|
+
openedIconName?: string | undefined;
|
|
6
|
+
collapsedIconName?: string | undefined;
|
|
7
|
+
iconSize?: number | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
_height?: string | undefined;
|
|
10
|
+
_radius?: string | undefined;
|
|
11
|
+
_marginTop?: string | undefined;
|
|
12
|
+
_marginBottom?: string | undefined;
|
|
13
|
+
_marginLeft?: string | undefined;
|
|
14
|
+
_marginRight?: string | undefined;
|
|
15
|
+
_dividerColor?: string | undefined;
|
|
16
|
+
_circleColor?: string | undefined;
|
|
17
|
+
_circleBorder?: string | undefined;
|
|
18
|
+
_iconColor?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
click: MouseEvent;
|
|
22
|
+
keydown: KeyboardEvent;
|
|
23
|
+
keyup: KeyboardEvent;
|
|
24
|
+
keypress: KeyboardEvent;
|
|
25
|
+
change: CustomEvent<{
|
|
26
|
+
collapsed: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
} & {
|
|
29
|
+
[evt: string]: CustomEvent<any>;
|
|
30
|
+
};
|
|
31
|
+
slots: {};
|
|
32
|
+
};
|
|
33
|
+
export type CollapsibleDividerProps = typeof __propDef.props;
|
|
34
|
+
export type CollapsibleDividerEvents = typeof __propDef.events;
|
|
35
|
+
export type CollapsibleDividerSlots = typeof __propDef.slots;
|
|
36
|
+
export default class CollapsibleDivider extends SvelteComponentTyped<CollapsibleDividerProps, CollapsibleDividerEvents, CollapsibleDividerSlots> {
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -5,11 +5,11 @@ let lastTouch, startTouch, endTouch, startTime, endTime;
|
|
|
5
5
|
function handleTouchStart(event) {
|
|
6
6
|
lastTouch = event.touches[0];
|
|
7
7
|
startTouch = event.touches[0];
|
|
8
|
-
startTime = new Date();
|
|
8
|
+
startTime = /* @__PURE__ */ new Date();
|
|
9
9
|
}
|
|
10
10
|
function handleTouchEnd(event) {
|
|
11
11
|
endTouch = event.changedTouches[0];
|
|
12
|
-
endTime = new Date();
|
|
12
|
+
endTime = /* @__PURE__ */ new Date();
|
|
13
13
|
let timeDifference = endTime.getTime() - startTime.getTime();
|
|
14
14
|
if (timeDifference < timeThreshold) {
|
|
15
15
|
let direction;
|
|
@@ -39,6 +39,15 @@ function calculateMenuPosition(params) {
|
|
|
39
39
|
0
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
+
if (!!positionedAncestor) {
|
|
43
|
+
let { left: positionedAncestorLeft, top: positionedAncestorTop } = positionedAncestor.getBoundingClientRect();
|
|
44
|
+
if (!_left)
|
|
45
|
+
_left = 0;
|
|
46
|
+
if (!_top)
|
|
47
|
+
_top = 0;
|
|
48
|
+
_left = _left - positionedAncestorLeft;
|
|
49
|
+
_top = _top - positionedAncestorTop;
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
53
|
$:
|
|
@@ -75,27 +84,41 @@ $:
|
|
|
75
84
|
}
|
|
76
85
|
$:
|
|
77
86
|
if (closeOnClickOutside && !!menuElement) {
|
|
78
|
-
window.addEventListener("
|
|
87
|
+
window.addEventListener("mousedown", () => {
|
|
79
88
|
open = false;
|
|
80
89
|
});
|
|
81
90
|
window.addEventListener("touchstart", () => {
|
|
82
91
|
open = false;
|
|
83
92
|
});
|
|
84
93
|
if (activator) {
|
|
85
|
-
activator.addEventListener("
|
|
94
|
+
activator.addEventListener("mousedown", (event) => {
|
|
86
95
|
event.stopPropagation();
|
|
87
96
|
});
|
|
88
97
|
activator.addEventListener("touchstart", (event) => {
|
|
89
98
|
event.stopPropagation();
|
|
90
99
|
});
|
|
91
100
|
}
|
|
92
|
-
menuElement.addEventListener("
|
|
101
|
+
menuElement.addEventListener("mousedown", (event) => {
|
|
93
102
|
event.stopPropagation();
|
|
94
103
|
});
|
|
95
104
|
menuElement.addEventListener("touchstart", (event) => {
|
|
96
105
|
event.stopPropagation();
|
|
97
106
|
});
|
|
98
107
|
}
|
|
108
|
+
let positionedAncestor = void 0;
|
|
109
|
+
$:
|
|
110
|
+
if (!!menuElement && !!activator) {
|
|
111
|
+
let elem = getPositionedAncestor(menuElement.parentElement);
|
|
112
|
+
positionedAncestor = elem == null ? void 0 : elem;
|
|
113
|
+
calculateMenuPosition({ menuElement, activator });
|
|
114
|
+
}
|
|
115
|
+
function getPositionedAncestor(elem) {
|
|
116
|
+
if (!elem)
|
|
117
|
+
return null;
|
|
118
|
+
if (["fixed", "absolute"].includes(getComputedStyle(elem).position))
|
|
119
|
+
return elem;
|
|
120
|
+
return getPositionedAncestor(elem.parentElement);
|
|
121
|
+
}
|
|
99
122
|
</script>
|
|
100
123
|
|
|
101
124
|
{#if open}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { fly } from "svelte/transition";
|
|
2
2
|
import { getDateRowsStats, getDaysNames } from "./utils";
|
|
3
|
-
export let selectedDate = void 0, visibleMonth = new Date().getMonth(), visibleYear = new Date().getFullYear(), locale = "it", showExtraMonthDays = true, showHeader = true, height = "100%", width = "100%", dayWidth = "30px", dayHeight = "30px", dayHoverColor = "#c9c8c873", daySelectedColor = "#adadad", selectedTextColor = "black", gridGap = "1px", dayBackgroundColor = void 0, animationDuration = 200;
|
|
3
|
+
export let selectedDate = void 0, visibleMonth = (/* @__PURE__ */ new Date()).getMonth(), visibleYear = (/* @__PURE__ */ new Date()).getFullYear(), locale = "it", showExtraMonthDays = true, showHeader = true, height = "100%", width = "100%", dayWidth = "30px", dayHeight = "30px", dayHoverColor = "#c9c8c873", daySelectedColor = "#adadad", selectedTextColor = "black", gridGap = "1px", dayBackgroundColor = void 0, animationDuration = 200;
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
5
5
|
const dispatch = createEventDispatcher();
|
|
6
6
|
function handleDayClick(dateStat, extraMonth) {
|
|
@@ -3,8 +3,8 @@ import YearSelector from "./YearSelector.svelte";
|
|
|
3
3
|
import MonthSelector from "./MonthSelector.svelte";
|
|
4
4
|
import Calendar from "./Calendar.svelte";
|
|
5
5
|
import Button from "../buttons/Button.svelte";
|
|
6
|
-
export let selectedYear = new Date().getFullYear(), selectedMonth = new Date().getMonth(), selectedDate = new Date(), view = "day", locale = "it", primaryColor = "#008080", headerBackgroundColor = primaryColor, arrowColor = primaryColor, hoverColor = "#00808012", selectedDayColor = "black", headerColor = "white", cardColor = "black", cardBackGroundColor = "rgba(255,255,255,0)", selectableYears = [...Array(150).keys()].map(
|
|
7
|
-
(i) => i + (new Date().getFullYear() - 75)
|
|
6
|
+
export let selectedYear = (/* @__PURE__ */ new Date()).getFullYear(), selectedMonth = (/* @__PURE__ */ new Date()).getMonth(), selectedDate = /* @__PURE__ */ new Date(), view = "day", locale = "it", primaryColor = "#008080", headerBackgroundColor = primaryColor, arrowColor = primaryColor, hoverColor = "#00808012", selectedDayColor = "black", headerColor = "white", cardColor = "black", cardBackGroundColor = "rgba(255,255,255,0)", selectableYears = [...Array(150).keys()].map(
|
|
7
|
+
(i) => i + ((/* @__PURE__ */ new Date()).getFullYear() - 75)
|
|
8
8
|
), height = "100%", width = "100%";
|
|
9
9
|
let selectorText = void 0;
|
|
10
10
|
let elementDisabled = "date";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>import { scrollAtCenter } from "../common/scroller";
|
|
2
2
|
import { createEventDispatcher, onMount } from "svelte";
|
|
3
3
|
export let selectedYear = void 0, selectableYears = [...Array(150).keys()].map(
|
|
4
|
-
(i) => i + (new Date().getFullYear() - 75)
|
|
4
|
+
(i) => i + ((/* @__PURE__ */ new Date()).getFullYear() - 75)
|
|
5
5
|
), height = "100%", width = "100%";
|
|
6
6
|
let container, targetButtons = {};
|
|
7
7
|
onMount(() => {
|
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": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
7
7
|
"build": "vite build && npm run package",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"svelte-check": "^3.0.1",
|
|
49
49
|
"tslib": "^2.4.1",
|
|
50
50
|
"typescript": "^4.9.3",
|
|
51
|
-
"vite": "^4.
|
|
51
|
+
"vite": "^4.1.5",
|
|
52
52
|
"vitest": "^0.25.3"
|
|
53
53
|
},
|
|
54
54
|
"svelte": "./dist/index.js",
|